Skip to content

Commit

Permalink
feat: Add benfen provider (#255)
Browse files Browse the repository at this point in the history
* feat: Add benfen provider

* chore: revert alephium commit

* chore: update version
  • Loading branch information
originalix authored Nov 26, 2024
1 parent c17620a commit aaf3539
Show file tree
Hide file tree
Showing 57 changed files with 1,533 additions and 358 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"react": "^17.0.2",
"react-test-renderer": "^17.0.2",
"ts-jest": "^27.0.5",
"typescript": "^4"
"typescript": "^5"
},
"dependencies": {},
"packageManager": "[email protected]+sha1.1959a18351b811cdeedbd484a8f86c3cc3bbaf72"
Expand Down
8 changes: 4 additions & 4 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/cross-inpage-provider-core",
"version": "2.1.16",
"version": "2.1.17",
"keywords": [
"cross-inpage-provider"
],
Expand Down Expand Up @@ -29,9 +29,9 @@
"build-version-info": "node ./scripts/buildVersionInfo.js"
},
"dependencies": {
"@onekeyfe/cross-inpage-provider-errors": "2.1.16",
"@onekeyfe/cross-inpage-provider-events": "2.1.16",
"@onekeyfe/cross-inpage-provider-types": "2.1.16",
"@onekeyfe/cross-inpage-provider-errors": "2.1.17",
"@onekeyfe/cross-inpage-provider-events": "2.1.17",
"@onekeyfe/cross-inpage-provider-types": "2.1.17",
"events": "^3.3.0",
"lodash-es": "^4.17.21",
"ms": "^2.1.3"
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/ProviderBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ abstract class ProviderBase extends CrossEventEmitter {
return result;
} catch (error) {
if (callback && hasCallback) {
// @ts-expect-error
callback(error);
}
throw error;
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/versionInfo.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

const version = '2.1.15';
const version = '2.1.16';
const versionBuild = '2020-0101-1';

export default {
Expand Down
6 changes: 3 additions & 3 deletions packages/desktop/desktop-bridge-injected/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/desktop-bridge-injected",
"version": "2.1.16",
"version": "2.1.17",
"keywords": [
"cross-inpage-provider"
],
Expand Down Expand Up @@ -34,7 +34,7 @@
"electron": "^17.2.0"
},
"dependencies": {
"@onekeyfe/cross-inpage-provider-core": "2.1.16",
"@onekeyfe/cross-inpage-provider-types": "2.1.16"
"@onekeyfe/cross-inpage-provider-core": "2.1.17",
"@onekeyfe/cross-inpage-provider-types": "2.1.17"
}
}
2 changes: 1 addition & 1 deletion packages/empty/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/cross-inpage-provider-empty",
"version": "2.1.16",
"version": "2.1.17",
"keywords": [
"cross-inpage-provider"
],
Expand Down
2 changes: 1 addition & 1 deletion packages/errors/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/cross-inpage-provider-errors",
"version": "2.1.16",
"version": "2.1.17",
"keywords": [
"cross-inpage-provider"
],
Expand Down
2 changes: 1 addition & 1 deletion packages/events/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/cross-inpage-provider-events",
"version": "2.1.16",
"version": "2.1.17",
"keywords": [
"cross-inpage-provider"
],
Expand Down
24 changes: 12 additions & 12 deletions packages/example/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/cross-inpage-provider-example",
"version": "2.1.16",
"version": "2.1.17",
"private": true,
"scripts": {
"postinstall": "patch-package",
Expand All @@ -21,17 +21,17 @@
"@metamask/eth-sig-util": "^7.0.2",
"@metamask/onboarding": "^1.0.1",
"@mysten/dapp-kit": "0.13.2",
"@onekeyfe/cross-inpage-provider-core": "2.1.16",
"@onekeyfe/cross-inpage-provider-types": "2.1.16",
"@onekeyfe/onekey-aptos-provider": "2.1.16",
"@onekeyfe/onekey-cardano-provider": "2.1.16",
"@onekeyfe/onekey-conflux-provider": "2.1.16",
"@onekeyfe/onekey-cosmos-provider": "2.1.16",
"@onekeyfe/onekey-near-provider": "2.1.16",
"@onekeyfe/onekey-solana-provider": "2.1.16",
"@onekeyfe/onekey-sui-provider": "2.1.16",
"@onekeyfe/onekey-tron-provider": "2.1.16",
"@onekeyfe/onekey-webln-provider": "2.1.16",
"@onekeyfe/cross-inpage-provider-core": "2.1.17",
"@onekeyfe/cross-inpage-provider-types": "2.1.17",
"@onekeyfe/onekey-aptos-provider": "2.1.17",
"@onekeyfe/onekey-cardano-provider": "2.1.17",
"@onekeyfe/onekey-conflux-provider": "2.1.17",
"@onekeyfe/onekey-cosmos-provider": "2.1.17",
"@onekeyfe/onekey-near-provider": "2.1.17",
"@onekeyfe/onekey-solana-provider": "2.1.17",
"@onekeyfe/onekey-sui-provider": "2.1.17",
"@onekeyfe/onekey-tron-provider": "2.1.17",
"@onekeyfe/onekey-webln-provider": "2.1.17",
"@polkadot/api": "^9.11.3",
"@polkadot/extension-dapp": "^0.47.5",
"@radix-ui/react-checkbox": "^1.1.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/extension/extension-bridge-hosted/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/extension-bridge-hosted",
"version": "2.1.16",
"version": "2.1.17",
"keywords": [
"cross-inpage-provider"
],
Expand Down Expand Up @@ -28,8 +28,8 @@
"start": "tsc --watch"
},
"dependencies": {
"@onekeyfe/cross-inpage-provider-core": "2.1.16",
"@onekeyfe/cross-inpage-provider-types": "2.1.16",
"@onekeyfe/cross-inpage-provider-core": "2.1.17",
"@onekeyfe/cross-inpage-provider-types": "2.1.17",
"uuid": "^8.3.2"
},
"devDependencies": {
Expand Down
6 changes: 3 additions & 3 deletions packages/extension/extension-bridge-injected/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/extension-bridge-injected",
"version": "2.1.16",
"version": "2.1.17",
"keywords": [
"cross-inpage-provider"
],
Expand Down Expand Up @@ -28,7 +28,7 @@
"start": "tsc --watch"
},
"dependencies": {
"@onekeyfe/cross-inpage-provider-core": "2.1.16",
"@onekeyfe/cross-inpage-provider-types": "2.1.16"
"@onekeyfe/cross-inpage-provider-core": "2.1.17",
"@onekeyfe/cross-inpage-provider-types": "2.1.17"
}
}
14 changes: 7 additions & 7 deletions packages/injected/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/cross-inpage-provider-injected",
"version": "2.1.16",
"version": "2.1.17",
"keywords": [
"cross-inpage-provider"
],
Expand Down Expand Up @@ -42,12 +42,12 @@
"electron": "*"
},
"dependencies": {
"@onekeyfe/cross-inpage-provider-core": "2.1.16",
"@onekeyfe/cross-inpage-provider-types": "2.1.16",
"@onekeyfe/desktop-bridge-injected": "2.1.16",
"@onekeyfe/extension-bridge-injected": "2.1.16",
"@onekeyfe/inpage-providers-hub": "2.1.16",
"@onekeyfe/native-bridge-injected": "2.1.16",
"@onekeyfe/cross-inpage-provider-core": "2.1.17",
"@onekeyfe/cross-inpage-provider-types": "2.1.17",
"@onekeyfe/desktop-bridge-injected": "2.1.17",
"@onekeyfe/extension-bridge-injected": "2.1.17",
"@onekeyfe/inpage-providers-hub": "2.1.17",
"@onekeyfe/native-bridge-injected": "2.1.17",
"buffer": "^6.0.3",
"crypto-browserify": "^3.12.0"
}
Expand Down
6 changes: 3 additions & 3 deletions packages/native/native-bridge-injected/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/native-bridge-injected",
"version": "2.1.16",
"version": "2.1.17",
"keywords": [
"cross-inpage-provider"
],
Expand Down Expand Up @@ -28,7 +28,7 @@
"start": "tsc --watch"
},
"dependencies": {
"@onekeyfe/cross-inpage-provider-core": "2.1.16",
"@onekeyfe/cross-inpage-provider-types": "2.1.16"
"@onekeyfe/cross-inpage-provider-core": "2.1.17",
"@onekeyfe/cross-inpage-provider-types": "2.1.17"
}
}
42 changes: 21 additions & 21 deletions packages/providers/inpage-providers-hub/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/inpage-providers-hub",
"version": "2.1.16",
"version": "2.1.17",
"keywords": [
"cross-inpage-provider"
],
Expand Down Expand Up @@ -30,26 +30,26 @@
"start": "tsc --watch"
},
"dependencies": {
"@onekeyfe/cross-inpage-provider-core": "2.1.16",
"@onekeyfe/cross-inpage-provider-types": "2.1.16",
"@onekeyfe/onekey-algo-provider": "2.1.16",
"@onekeyfe/onekey-alph-provider": "2.1.16",
"@onekeyfe/onekey-aptos-provider": "2.1.16",
"@onekeyfe/onekey-btc-provider": "2.1.16",
"@onekeyfe/onekey-cardano-provider": "2.1.16",
"@onekeyfe/onekey-conflux-provider": "2.1.16",
"@onekeyfe/onekey-cosmos-provider": "2.1.16",
"@onekeyfe/onekey-eth-provider": "2.1.16",
"@onekeyfe/onekey-nostr-provider": "2.1.16",
"@onekeyfe/onekey-polkadot-provider": "2.1.16",
"@onekeyfe/onekey-private-external-account-provider": "2.1.16",
"@onekeyfe/onekey-private-provider": "2.1.16",
"@onekeyfe/onekey-scdo-provider": "2.1.16",
"@onekeyfe/onekey-solana-provider": "2.1.16",
"@onekeyfe/onekey-sui-provider": "2.1.16",
"@onekeyfe/onekey-ton-provider": "2.1.16",
"@onekeyfe/onekey-tron-provider": "2.1.16",
"@onekeyfe/onekey-webln-provider": "2.1.16",
"@onekeyfe/cross-inpage-provider-core": "2.1.17",
"@onekeyfe/cross-inpage-provider-types": "2.1.17",
"@onekeyfe/onekey-algo-provider": "2.1.17",
"@onekeyfe/onekey-alph-provider": "2.1.17",
"@onekeyfe/onekey-aptos-provider": "2.1.17",
"@onekeyfe/onekey-bfc-provider": "2.1.17",
"@onekeyfe/onekey-btc-provider": "2.1.17",
"@onekeyfe/onekey-cardano-provider": "2.1.17",
"@onekeyfe/onekey-conflux-provider": "2.1.17",
"@onekeyfe/onekey-cosmos-provider": "2.1.17",
"@onekeyfe/onekey-eth-provider": "2.1.17",
"@onekeyfe/onekey-nostr-provider": "2.1.17",
"@onekeyfe/onekey-polkadot-provider": "2.1.17",
"@onekeyfe/onekey-private-provider": "2.1.17",
"@onekeyfe/onekey-scdo-provider": "2.1.17",
"@onekeyfe/onekey-solana-provider": "2.1.17",
"@onekeyfe/onekey-sui-provider": "2.1.17",
"@onekeyfe/onekey-ton-provider": "2.1.17",
"@onekeyfe/onekey-tron-provider": "2.1.17",
"@onekeyfe/onekey-webln-provider": "2.1.17",
"web3": "^1.7.3"
},
"devDependencies": {
Expand Down
20 changes: 15 additions & 5 deletions packages/providers/inpage-providers-hub/src/injectWeb3Provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ import { ProviderConflux } from '@onekeyfe/onekey-conflux-provider';
import { ProviderAlph, registerAlephiumProvider } from '@onekeyfe/onekey-alph-provider';
import { ProviderTron } from '@onekeyfe/onekey-tron-provider';
import { ProviderCardano, defineWindowCardanoProperty } from '@onekeyfe/onekey-cardano-provider';
// import { ProviderPrivateExternalAccount } from '@onekeyfe/onekey-private-external-account-provider';
import { ProviderCosmos } from '@onekeyfe/onekey-cosmos-provider';
import { ProviderPolkadot, registerPolkadot } from '@onekeyfe/onekey-polkadot-provider';
import {
defineWindowProperty,
checkWalletSwitchEnable,
} from '@onekeyfe/cross-inpage-provider-core';
import { ProviderSui, registerSuiWallet } from '@onekeyfe/onekey-sui-provider';
import { ProviderBfc, registerBfcWallet } from '@onekeyfe/onekey-bfc-provider';
import { ProviderWebln } from '@onekeyfe/onekey-webln-provider';
import { ProviderScdo } from '@onekeyfe/onekey-scdo-provider';
import { createTonProviderOpenMask, ProviderTon } from '@onekeyfe/onekey-ton-provider';
Expand All @@ -27,7 +27,6 @@ import { ProviderAlgo } from '@onekeyfe/onekey-algo-provider';
import { hackAllConnectButtons } from './connectButtonHack';
import { detectWebsiteRiskLevel, listenPageFocus } from './detectRiskWebsite';
import { WALLET_CONNECT_INFO } from './connectButtonHack/consts';
// import Web3 from 'web3'; // cause build error

export type IWindowOneKeyHub = {
debugLogger?: any;
Expand All @@ -40,6 +39,7 @@ export type IWindowOneKeyHub = {
petra?: ProviderAptos;
martian?: ProviderAptosMartian;
suiWallet?: ProviderSui;
bfcWallet?: ProviderBfc;
cardano?: ProviderCardano;
keplr?: ProviderCosmos;
webln?: ProviderWebln;
Expand Down Expand Up @@ -103,6 +103,10 @@ function injectWeb3Provider(): unknown {
bridge,
});

const bfc = new ProviderBfc({
bridge,
});

const cardano = new ProviderCardano({
bridge,
});
Expand Down Expand Up @@ -138,14 +142,11 @@ function injectWeb3Provider(): unknown {

const scdo = new ProviderScdo({ bridge });

// const $privateExternalAccount = new ProviderPrivateExternalAccount({ bridge });

// providerHub
const $onekey = {
...window.$onekey,
jsBridge: bridge,
$private,
// $privateExternalAccount,
ethereum,
solana,
// starcoin,
Expand All @@ -154,6 +155,7 @@ function injectWeb3Provider(): unknown {
tron,
sollet: null,
sui,
bfc,
tonconnect,
cardano,
alephium,
Expand Down Expand Up @@ -208,6 +210,7 @@ function injectWeb3Provider(): unknown {
registerAlephiumProvider(alephium);
defineWindowProperty('tronLink', tron);
defineWindowProperty('suiWallet', sui);
defineWindowProperty('bfcWallet', bfc);
defineWindowProperty('onekeyTonWallet', {
tonconnect,
});
Expand Down Expand Up @@ -270,6 +273,13 @@ function injectWeb3Provider(): unknown {
});
}

// BFC Standard Wallet
if (checkWalletSwitchEnable()) {
registerBfcWallet(bfc, {
logo: WALLET_CONNECT_INFO.onekey.icon,
});
}

if (checkWalletSwitchEnable()) {
registerPolkadot(polkadot);
}
Expand Down
10 changes: 5 additions & 5 deletions packages/providers/onekey-algo-provider/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/onekey-algo-provider",
"version": "2.1.16",
"version": "2.1.17",
"keywords": [
"cross-inpage-provider"
],
Expand Down Expand Up @@ -28,9 +28,9 @@
"start": "tsc --watch"
},
"dependencies": {
"@onekeyfe/cross-inpage-provider-core": "2.1.16",
"@onekeyfe/cross-inpage-provider-errors": "2.1.16",
"@onekeyfe/cross-inpage-provider-types": "2.1.16",
"@onekeyfe/extension-bridge-injected": "2.1.16"
"@onekeyfe/cross-inpage-provider-core": "2.1.17",
"@onekeyfe/cross-inpage-provider-errors": "2.1.17",
"@onekeyfe/cross-inpage-provider-types": "2.1.17",
"@onekeyfe/extension-bridge-injected": "2.1.17"
}
}
10 changes: 5 additions & 5 deletions packages/providers/onekey-alph-provider/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/onekey-alph-provider",
"version": "2.1.16",
"version": "2.1.17",
"keywords": [
"cross-inpage-provider"
],
Expand Down Expand Up @@ -31,9 +31,9 @@
"@alephium/get-extension-wallet": "^1.5.2",
"@alephium/walletconnect-provider": "^1.5.2",
"@alephium/web3": "^1.5.2",
"@onekeyfe/cross-inpage-provider-core": "2.1.16",
"@onekeyfe/cross-inpage-provider-errors": "2.1.16",
"@onekeyfe/cross-inpage-provider-types": "2.1.16",
"@onekeyfe/extension-bridge-injected": "2.1.16"
"@onekeyfe/cross-inpage-provider-core": "2.1.17",
"@onekeyfe/cross-inpage-provider-errors": "2.1.17",
"@onekeyfe/cross-inpage-provider-types": "2.1.17",
"@onekeyfe/extension-bridge-injected": "2.1.17"
}
}
Loading

0 comments on commit aaf3539

Please sign in to comment.