@onekeyfe/onekey-bfc-provider 2.1.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE.md ADDED
@@ -0,0 +1,51 @@
1
+ # ONEKEY STANDARD SOURCE LICENSE (O-SSL)
2
+
3
+ This license governs use of the accompanying software. If you use the software,
4
+ you accept this license. If you do not accept the license, do not use the
5
+ software.
6
+
7
+ ## 1. Definitions
8
+
9
+ The terms "reproduce," "reproduction" and "distribution" have the same meaning
10
+ here as under Hong Kong copyright law.
11
+
12
+ "You" means the licensee of the software.
13
+
14
+ "Your company" means the company you worked for when you downloaded the
15
+ software.
16
+
17
+ "Reference use" means use of the software within your company as a reference,
18
+ in read only form, for the sole purposes of debugging your products,
19
+ maintaining your products, or enhancing the interoperability of your products
20
+ with the software, and specifically excludes the right to distribute the
21
+ software outside of your company.
22
+
23
+ "Licensed patents" means any Licensor patent claims which read directly on the
24
+ software as distributed by the Licensor under this license.
25
+
26
+ ## 2. Grant of Rights
27
+
28
+ (A) Copyright Grant - Subject to the terms of this license, the Licensor grants
29
+ you a non-transferable, non-exclusive, worldwide, royalty-free copyright
30
+ license to reproduce the software for reference use.
31
+
32
+ (B) Patent Grant - Subject to the terms of this license, the Licensor grants
33
+ you a non-transferable, non-exclusive, worldwide, royalty-free patent license
34
+ under licensed patents for reference use.
35
+
36
+ ## 3. Limitations
37
+
38
+ (A) No Trademark License - This license does not grant you any rights to use
39
+ the Licensor's name, logo, or trademarks.
40
+
41
+ (B) If you begin patent litigation against the Licensor over patents that you
42
+ think may apply to the software (including a cross-claim or counterclaim in
43
+ a lawsuit), your license to the software ends automatically.
44
+
45
+ (C) The software is licensed "as-is." You bear the risk of using it. The
46
+ Licensor gives no express warranties, guarantees or conditions. You may have
47
+ additional consumer rights under your local laws which this license cannot
48
+ change. To the extent permitted under your local laws, the Licensor excludes
49
+ the implied warranties of merchantability, fitness for a particular purpose and
50
+ non-infringement.This license agreement is governed by the laws of Hong Kong,
51
+ and any disputes related to this license agreement shall be resolved in accordance with Hong Kong law.
package/README.md ADDED
@@ -0,0 +1 @@
1
+ # cross-inpage-provider
@@ -0,0 +1,98 @@
1
+ import type { IInpageProviderConfig } from '@onekeyfe/cross-inpage-provider-core';
2
+ import { ProviderBfcBase } from './ProviderBfcBase';
3
+ import type { IJsonRpcRequest } from '@onekeyfe/cross-inpage-provider-types';
4
+ import { AccountInfo } from './types';
5
+ import type { PermissionType } from './types';
6
+ import { IdentifierString, BenfenSignAndExecuteTransactionBlockInput, BenfenSignAndExecuteTransactionBlockOutput, BenfenSignMessageInput, BenfenSignMessageOutput, BenfenSignPersonalMessageInput, BenfenSignPersonalMessageOutput, BenfenSignTransactionBlockInput, BenfenSignTransactionBlockOutput } from '@benfen/bfc.js/wallet-standard';
7
+ declare const PROVIDER_EVENTS: {
8
+ readonly connect: "connect";
9
+ readonly disconnect: "disconnect";
10
+ readonly accountChanged: "accountChanged";
11
+ readonly networkChange: "networkChange";
12
+ readonly message_low_level: "message_low_level";
13
+ };
14
+ type BfcProviderEventsMap = {
15
+ [PROVIDER_EVENTS.connect]: (account: string) => void;
16
+ [PROVIDER_EVENTS.disconnect]: () => void;
17
+ [PROVIDER_EVENTS.accountChanged]: (account: {
18
+ address: string;
19
+ publicKey: string;
20
+ } | null) => void;
21
+ [PROVIDER_EVENTS.networkChange]: (name: string | null) => void;
22
+ [PROVIDER_EVENTS.message_low_level]: (payload: IJsonRpcRequest) => void;
23
+ };
24
+ type SignAndExecuteTransactionBlockInput = BenfenSignAndExecuteTransactionBlockInput & {
25
+ blockSerialize: string;
26
+ walletSerialize: string;
27
+ };
28
+ type SignTransactionBlockInput = BenfenSignTransactionBlockInput & {
29
+ blockSerialize: string;
30
+ walletSerialize: string;
31
+ };
32
+ type SignMessageInput = BenfenSignMessageInput & {
33
+ messageSerialize: string;
34
+ walletSerialize: string;
35
+ };
36
+ type SignPersonalMessageInput = BenfenSignPersonalMessageInput & {
37
+ messageSerialize: string;
38
+ walletSerialize: string;
39
+ };
40
+ export type BenfenRequest = {
41
+ 'hasPermissions': (permissions: readonly PermissionType[]) => Promise<boolean>;
42
+ 'requestPermissions': (permissions: readonly PermissionType[]) => Promise<boolean>;
43
+ 'disconnect': () => Promise<void>;
44
+ 'getActiveChain': () => Promise<IdentifierString | undefined>;
45
+ 'getAccounts': () => Promise<AccountInfo[]>;
46
+ 'signAndExecuteTransactionBlock': (input: SignAndExecuteTransactionBlockInput) => Promise<BenfenSignAndExecuteTransactionBlockOutput>;
47
+ 'signTransactionBlock': (input: SignTransactionBlockInput) => Promise<BenfenSignTransactionBlockOutput>;
48
+ 'signMessage': (input: SignMessageInput) => Promise<BenfenSignMessageOutput>;
49
+ 'signPersonalMessage': (input: SignPersonalMessageInput) => Promise<BenfenSignPersonalMessageOutput>;
50
+ };
51
+ export type PROVIDER_EVENTS_STRINGS = keyof typeof PROVIDER_EVENTS;
52
+ export interface IProviderBfc {
53
+ hasPermissions(permissions: readonly PermissionType[]): Promise<boolean>;
54
+ requestPermissions(permissions: readonly PermissionType[]): Promise<boolean>;
55
+ /**
56
+ * Disconnect wallet
57
+ */
58
+ disconnect(): Promise<void>;
59
+ /**
60
+ * Connect wallet, and get wallet info
61
+ * @emits `connect` on success
62
+ */
63
+ getAccounts(): Promise<AccountInfo[]>;
64
+ }
65
+ export type OneKeyBfcProviderProps = IInpageProviderConfig & {
66
+ timeout?: number;
67
+ };
68
+ declare class ProviderBfc extends ProviderBfcBase implements IProviderBfc {
69
+ protected _account: AccountInfo | null;
70
+ constructor(props: OneKeyBfcProviderProps);
71
+ private _registerEvents;
72
+ private _callBridge;
73
+ private _handleConnected;
74
+ private _handleDisconnected;
75
+ isAccountsChanged(account: AccountInfo | undefined): boolean;
76
+ private _handleAccountChange;
77
+ private _network;
78
+ isNetworkChanged(network: string): boolean;
79
+ private _handleNetworkChange;
80
+ hasPermissions(permissions?: readonly PermissionType[]): Promise<boolean>;
81
+ requestPermissions(permissions?: readonly PermissionType[]): Promise<boolean>;
82
+ disconnect(): Promise<void>;
83
+ getAccounts(): Promise<{
84
+ address: string;
85
+ publicKey: string;
86
+ }[]>;
87
+ getActiveChain(): Promise<`${string}:${string}` | undefined>;
88
+ signAndExecuteTransactionBlock(input: BenfenSignAndExecuteTransactionBlockInput): Promise<BenfenSignAndExecuteTransactionBlockOutput>;
89
+ signTransactionBlock(input: BenfenSignTransactionBlockInput): Promise<BenfenSignTransactionBlockOutput>;
90
+ signMessage(input: BenfenSignMessageInput): Promise<BenfenSignMessageOutput>;
91
+ signPersonalMessage(input: BenfenSignPersonalMessageInput): Promise<BenfenSignPersonalMessageOutput>;
92
+ isConnected(): boolean;
93
+ onNetworkChange(listener: BfcProviderEventsMap['networkChange']): this;
94
+ onAccountChange(listener: BfcProviderEventsMap['accountChanged']): this;
95
+ on<E extends keyof BfcProviderEventsMap>(event: E, listener: BfcProviderEventsMap[E]): this;
96
+ emit<E extends keyof BfcProviderEventsMap>(event: E, ...args: Parameters<BfcProviderEventsMap[E]>): boolean;
97
+ }
98
+ export { ProviderBfc };
@@ -0,0 +1,187 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { bytesToHex } from '@noble/hashes/utils';
11
+ import { getOrCreateExtInjectedJsBridge } from '@onekeyfe/extension-bridge-injected';
12
+ import { ProviderBfcBase } from './ProviderBfcBase';
13
+ import { web3Errors } from '@onekeyfe/cross-inpage-provider-errors';
14
+ import { TransactionBlock } from '@benfen/bfc.js/transactions';
15
+ import { ALL_PERMISSION_TYPES } from './types';
16
+ const PROVIDER_EVENTS = {
17
+ 'connect': 'connect',
18
+ 'disconnect': 'disconnect',
19
+ 'accountChanged': 'accountChanged',
20
+ 'networkChange': 'networkChange',
21
+ 'message_low_level': 'message_low_level',
22
+ };
23
+ function isWalletEventMethodMatch({ method, name }) {
24
+ return method === `wallet_events_${name}`;
25
+ }
26
+ class ProviderBfc extends ProviderBfcBase {
27
+ constructor(props) {
28
+ super(Object.assign(Object.assign({}, props), { bridge: props.bridge || getOrCreateExtInjectedJsBridge({ timeout: props.timeout }) }));
29
+ this._account = null;
30
+ this._registerEvents();
31
+ }
32
+ _registerEvents() {
33
+ window.addEventListener('onekey_bridge_disconnect', () => {
34
+ this._handleDisconnected();
35
+ });
36
+ this.on(PROVIDER_EVENTS.message_low_level, (payload) => {
37
+ if (!payload)
38
+ return;
39
+ const { method, params } = payload;
40
+ if (isWalletEventMethodMatch({ method, name: PROVIDER_EVENTS.accountChanged })) {
41
+ this._handleAccountChange(params);
42
+ }
43
+ if (isWalletEventMethodMatch({ method, name: PROVIDER_EVENTS.networkChange })) {
44
+ this._handleNetworkChange(params);
45
+ }
46
+ });
47
+ }
48
+ _callBridge(params) {
49
+ return this.bridgeRequest(params);
50
+ }
51
+ _handleConnected(account, options = { emit: true }) {
52
+ var _a;
53
+ if (options.emit) {
54
+ this.emit('connect', (_a = account === null || account === void 0 ? void 0 : account.address) !== null && _a !== void 0 ? _a : null);
55
+ this.emit('accountChanged', account ? { address: account === null || account === void 0 ? void 0 : account.address, publicKey: account === null || account === void 0 ? void 0 : account.publicKey } : null);
56
+ }
57
+ }
58
+ _handleDisconnected(options = { emit: true }) {
59
+ this._account = null;
60
+ if (options.emit) {
61
+ this.emit('disconnect');
62
+ this.emit('accountChanged', null);
63
+ }
64
+ }
65
+ isAccountsChanged(account) {
66
+ var _a;
67
+ return (account === null || account === void 0 ? void 0 : account.address) !== ((_a = this._account) === null || _a === void 0 ? void 0 : _a.address);
68
+ }
69
+ // trigger by bridge account change event
70
+ _handleAccountChange(payload) {
71
+ if (!payload) {
72
+ this._handleDisconnected();
73
+ return;
74
+ }
75
+ if (this.isAccountsChanged(payload)) {
76
+ this._handleConnected(payload);
77
+ }
78
+ this._account = payload;
79
+ }
80
+ isNetworkChanged(network) {
81
+ return this._network === undefined || network !== this._network;
82
+ }
83
+ _handleNetworkChange(payload) {
84
+ const network = payload;
85
+ if (this.isNetworkChanged(network)) {
86
+ this.emit('networkChange', network || null);
87
+ }
88
+ this._network = network;
89
+ }
90
+ hasPermissions() {
91
+ return __awaiter(this, arguments, void 0, function* (permissions = ALL_PERMISSION_TYPES) {
92
+ return yield this._callBridge({
93
+ method: 'hasPermissions',
94
+ params: permissions,
95
+ });
96
+ });
97
+ }
98
+ requestPermissions() {
99
+ return __awaiter(this, arguments, void 0, function* (permissions = ALL_PERMISSION_TYPES) {
100
+ return yield this._callBridge({
101
+ method: 'requestPermissions',
102
+ params: permissions,
103
+ });
104
+ });
105
+ }
106
+ disconnect() {
107
+ return __awaiter(this, void 0, void 0, function* () {
108
+ yield this._callBridge({
109
+ method: 'disconnect',
110
+ params: void 0,
111
+ });
112
+ this._handleDisconnected();
113
+ });
114
+ }
115
+ getAccounts() {
116
+ return __awaiter(this, void 0, void 0, function* () {
117
+ const accounts = yield this._callBridge({
118
+ method: 'getAccounts',
119
+ params: undefined,
120
+ });
121
+ if (accounts.length === 0) {
122
+ this._handleDisconnected();
123
+ throw web3Errors.provider.unauthorized();
124
+ }
125
+ return accounts;
126
+ });
127
+ }
128
+ getActiveChain() {
129
+ return __awaiter(this, void 0, void 0, function* () {
130
+ return this._callBridge({
131
+ method: 'getActiveChain',
132
+ params: undefined,
133
+ });
134
+ });
135
+ }
136
+ signAndExecuteTransactionBlock(input) {
137
+ return __awaiter(this, void 0, void 0, function* () {
138
+ return this._callBridge({
139
+ method: 'signAndExecuteTransactionBlock',
140
+ params: Object.assign(Object.assign({}, input), {
141
+ // https://github.com/MystenLabs/sui/blob/ace69fa8404eb704b504082d324ebc355a3d2948/sdk/typescript/src/transactions/object.ts#L6-L17
142
+ // With a few more objects, other wallets have steps for tojson.
143
+ transactionBlock: TransactionBlock.from(input.transactionBlock.serialize()), walletSerialize: JSON.stringify(input.account), blockSerialize: input.transactionBlock.serialize() }),
144
+ });
145
+ });
146
+ }
147
+ signTransactionBlock(input) {
148
+ return __awaiter(this, void 0, void 0, function* () {
149
+ return this._callBridge({
150
+ method: 'signTransactionBlock',
151
+ params: Object.assign(Object.assign({}, input), { transactionBlock: TransactionBlock.from(input.transactionBlock.serialize()), walletSerialize: JSON.stringify(input.account), blockSerialize: input.transactionBlock.serialize() }),
152
+ });
153
+ });
154
+ }
155
+ signMessage(input) {
156
+ return __awaiter(this, void 0, void 0, function* () {
157
+ return this._callBridge({
158
+ method: 'signMessage',
159
+ params: Object.assign(Object.assign({}, input), { walletSerialize: JSON.stringify(input.account), messageSerialize: bytesToHex(input.message) }),
160
+ });
161
+ });
162
+ }
163
+ signPersonalMessage(input) {
164
+ return __awaiter(this, void 0, void 0, function* () {
165
+ return this._callBridge({
166
+ method: 'signPersonalMessage',
167
+ params: Object.assign(Object.assign({}, input), { walletSerialize: JSON.stringify(input.account), messageSerialize: bytesToHex(input.message) }),
168
+ });
169
+ });
170
+ }
171
+ isConnected() {
172
+ return this._account !== null;
173
+ }
174
+ onNetworkChange(listener) {
175
+ return super.on(PROVIDER_EVENTS.networkChange, listener);
176
+ }
177
+ onAccountChange(listener) {
178
+ return super.on(PROVIDER_EVENTS.accountChanged, listener);
179
+ }
180
+ on(event, listener) {
181
+ return super.on(event, listener);
182
+ }
183
+ emit(event, ...args) {
184
+ return super.emit(event, ...args);
185
+ }
186
+ }
187
+ export { ProviderBfc };
@@ -0,0 +1,3 @@
1
+ import { ProviderBfc } from './OnekeyBfcProvider';
2
+ import { WalletInfo } from './types';
3
+ export declare function registerBfcWallet(provider: ProviderBfc, options?: WalletInfo): void;
@@ -0,0 +1,180 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { hexToBytes } from '@noble/hashes/utils';
11
+ import mitt from 'mitt';
12
+ import { ReadonlyWalletAccount, registerWallet, BFC_DEVNET_CHAIN, BFC_TESTNET_CHAIN, } from '@benfen/bfc.js/wallet-standard';
13
+ import { ALL_PERMISSION_TYPES } from './types';
14
+ var Feature;
15
+ (function (Feature) {
16
+ Feature["STANDARD__CONNECT"] = "standard:connect";
17
+ Feature["STANDARD__DISCONNECT"] = "standard:disconnect";
18
+ Feature["STANDARD__EVENTS"] = "standard:events";
19
+ Feature["BFC__SIGN_AND_EXECUTE_TRANSACTION_BLOCK"] = "bfc:signAndExecuteTransactionBlock";
20
+ Feature["BFC__SIGN_TRANSACTION_BLOCK"] = "bfc:signTransactionBlock";
21
+ Feature["BFC__SIGN_MESSAGE"] = "bfc:signMessage";
22
+ Feature["BFC__SIGN_PERSONAL_MESSAGE"] = "bfc:signPersonalMessage";
23
+ })(Feature || (Feature = {}));
24
+ class OnekeyBfcStandardWallet {
25
+ get name() {
26
+ var _a, _b;
27
+ return (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : this._name;
28
+ }
29
+ get icon() {
30
+ var _a;
31
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-explicit-any
32
+ return (((_a = this.options) === null || _a === void 0 ? void 0 : _a.logo) || '');
33
+ }
34
+ get chains() {
35
+ return [BFC_DEVNET_CHAIN, BFC_TESTNET_CHAIN];
36
+ }
37
+ get accounts() {
38
+ return this._account ? [this._account] : [];
39
+ }
40
+ get features() {
41
+ return {
42
+ [Feature.STANDARD__CONNECT]: {
43
+ version: '1.0.0',
44
+ connect: this.$connect,
45
+ },
46
+ [Feature.STANDARD__DISCONNECT]: {
47
+ version: '1.0.0',
48
+ disconnect: this.$disconnect,
49
+ },
50
+ [Feature.STANDARD__EVENTS]: {
51
+ version: '1.0.0',
52
+ on: this.$on,
53
+ },
54
+ [Feature.BFC__SIGN_AND_EXECUTE_TRANSACTION_BLOCK]: {
55
+ version: '1.0.0',
56
+ signAndExecuteTransactionBlock: this.$signAndExecuteTransactionBlock,
57
+ },
58
+ [Feature.BFC__SIGN_TRANSACTION_BLOCK]: {
59
+ version: '1.0.0',
60
+ signTransactionBlock: this.$signTransactionBlock,
61
+ },
62
+ [Feature.BFC__SIGN_MESSAGE]: {
63
+ version: '1.0.0',
64
+ signMessage: this.$signMessage,
65
+ },
66
+ [Feature.BFC__SIGN_PERSONAL_MESSAGE]: {
67
+ version: '1.0.0',
68
+ signPersonalMessage: this.$signPersonalMessage,
69
+ },
70
+ };
71
+ }
72
+ constructor(provider, options) {
73
+ this.version = '1.0.0';
74
+ this._name = 'OneKey Wallet';
75
+ this.$on = (event, listener) => {
76
+ this._events.on(event, listener);
77
+ return () => this._events.off(event, listener);
78
+ };
79
+ this.$connected = () => __awaiter(this, void 0, void 0, function* () {
80
+ if (!(yield this.$hasPermissions(['viewAccount']))) {
81
+ return;
82
+ }
83
+ const accounts = yield this.provider.getAccounts();
84
+ const [account] = accounts;
85
+ const activateAccount = this._account;
86
+ if (activateAccount && activateAccount.address === account.address) {
87
+ return { accounts: this.accounts };
88
+ }
89
+ if (account) {
90
+ yield this.handleAccountSwitch(account);
91
+ return { accounts: this.accounts };
92
+ }
93
+ });
94
+ this.$connect = (input) => __awaiter(this, void 0, void 0, function* () {
95
+ if (!(input === null || input === void 0 ? void 0 : input.silent)) {
96
+ yield this.provider.requestPermissions();
97
+ }
98
+ yield this.$connected();
99
+ return { accounts: this.accounts };
100
+ });
101
+ this.$disconnect = () => __awaiter(this, void 0, void 0, function* () {
102
+ yield this.provider.disconnect();
103
+ this._account = null;
104
+ this._events.all.clear();
105
+ });
106
+ this.$signAndExecuteTransactionBlock = (input) => __awaiter(this, void 0, void 0, function* () {
107
+ return this.provider.signAndExecuteTransactionBlock(input);
108
+ });
109
+ this.$signTransactionBlock = (input) => __awaiter(this, void 0, void 0, function* () {
110
+ return this.provider.signTransactionBlock(input);
111
+ });
112
+ this.$signMessage = (input) => __awaiter(this, void 0, void 0, function* () {
113
+ return this.provider.signMessage(input);
114
+ });
115
+ this.$signPersonalMessage = (input) => __awaiter(this, void 0, void 0, function* () {
116
+ return this.provider.signPersonalMessage(input);
117
+ });
118
+ this.handleAccountSwitch = (payload) => __awaiter(this, void 0, void 0, function* () {
119
+ const { address, publicKey } = payload;
120
+ const activateChain = yield this.getActiveChain();
121
+ this._account = new ReadonlyWalletAccount({
122
+ address: address,
123
+ publicKey: hexToBytes(publicKey),
124
+ chains: activateChain ? [activateChain] : [],
125
+ features: [
126
+ Feature.STANDARD__CONNECT,
127
+ Feature.BFC__SIGN_AND_EXECUTE_TRANSACTION_BLOCK,
128
+ Feature.BFC__SIGN_TRANSACTION_BLOCK,
129
+ Feature.BFC__SIGN_MESSAGE,
130
+ Feature.BFC__SIGN_PERSONAL_MESSAGE,
131
+ ],
132
+ });
133
+ this._events.emit('change', {
134
+ accounts: this.accounts,
135
+ chains: activateChain ? [activateChain] : [],
136
+ });
137
+ });
138
+ this.handleNetworkSwitch = (payload) => {
139
+ const { network } = payload;
140
+ this._events.emit('change', {
141
+ accounts: this.accounts,
142
+ chains: [network],
143
+ });
144
+ };
145
+ this.provider = provider;
146
+ this._events = mitt();
147
+ this._account = null;
148
+ this.options = options;
149
+ this.subscribeEventFromBackend();
150
+ void this.$connected();
151
+ }
152
+ getActiveChain() {
153
+ return this.provider.getActiveChain();
154
+ }
155
+ $hasPermissions(permissions = ALL_PERMISSION_TYPES) {
156
+ return this.provider.hasPermissions(permissions);
157
+ }
158
+ subscribeEventFromBackend() {
159
+ this.provider.onNetworkChange((network) => {
160
+ if (!network) {
161
+ return;
162
+ }
163
+ this.handleNetworkSwitch({ network: network });
164
+ });
165
+ this.provider.onAccountChange((account) => {
166
+ if (!account) {
167
+ return;
168
+ }
169
+ void this.handleAccountSwitch(account);
170
+ });
171
+ }
172
+ }
173
+ export function registerBfcWallet(provider, options) {
174
+ try {
175
+ registerWallet(new OnekeyBfcStandardWallet(provider, options));
176
+ }
177
+ catch (error) {
178
+ console.error(error);
179
+ }
180
+ }
@@ -0,0 +1,8 @@
1
+ import { IInjectedProviderNames } from '@onekeyfe/cross-inpage-provider-types';
2
+ import { ProviderBase, IInpageProviderConfig } from '@onekeyfe/cross-inpage-provider-core';
3
+ declare class ProviderBfcBase extends ProviderBase {
4
+ constructor(props: IInpageProviderConfig);
5
+ protected providerName: IInjectedProviderNames;
6
+ request(data: unknown): Promise<unknown>;
7
+ }
8
+ export { ProviderBfcBase };
@@ -0,0 +1,12 @@
1
+ import { IInjectedProviderNames } from '@onekeyfe/cross-inpage-provider-types';
2
+ import { ProviderBase } from '@onekeyfe/cross-inpage-provider-core';
3
+ class ProviderBfcBase extends ProviderBase {
4
+ constructor(props) {
5
+ super(props);
6
+ this.providerName = IInjectedProviderNames.bfc;
7
+ }
8
+ request(data) {
9
+ return this.bridgeRequest(data);
10
+ }
11
+ }
12
+ export { ProviderBfcBase };
@@ -0,0 +1,190 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ProviderBfc = void 0;
13
+ const utils_1 = require("@noble/hashes/utils");
14
+ const extension_bridge_injected_1 = require("@onekeyfe/extension-bridge-injected");
15
+ const ProviderBfcBase_1 = require("./ProviderBfcBase");
16
+ const cross_inpage_provider_errors_1 = require("@onekeyfe/cross-inpage-provider-errors");
17
+ const transactions_1 = require("@benfen/bfc.js/transactions");
18
+ const types_1 = require("./types");
19
+ const PROVIDER_EVENTS = {
20
+ 'connect': 'connect',
21
+ 'disconnect': 'disconnect',
22
+ 'accountChanged': 'accountChanged',
23
+ 'networkChange': 'networkChange',
24
+ 'message_low_level': 'message_low_level',
25
+ };
26
+ function isWalletEventMethodMatch({ method, name }) {
27
+ return method === `wallet_events_${name}`;
28
+ }
29
+ class ProviderBfc extends ProviderBfcBase_1.ProviderBfcBase {
30
+ constructor(props) {
31
+ super(Object.assign(Object.assign({}, props), { bridge: props.bridge || (0, extension_bridge_injected_1.getOrCreateExtInjectedJsBridge)({ timeout: props.timeout }) }));
32
+ this._account = null;
33
+ this._registerEvents();
34
+ }
35
+ _registerEvents() {
36
+ window.addEventListener('onekey_bridge_disconnect', () => {
37
+ this._handleDisconnected();
38
+ });
39
+ this.on(PROVIDER_EVENTS.message_low_level, (payload) => {
40
+ if (!payload)
41
+ return;
42
+ const { method, params } = payload;
43
+ if (isWalletEventMethodMatch({ method, name: PROVIDER_EVENTS.accountChanged })) {
44
+ this._handleAccountChange(params);
45
+ }
46
+ if (isWalletEventMethodMatch({ method, name: PROVIDER_EVENTS.networkChange })) {
47
+ this._handleNetworkChange(params);
48
+ }
49
+ });
50
+ }
51
+ _callBridge(params) {
52
+ return this.bridgeRequest(params);
53
+ }
54
+ _handleConnected(account, options = { emit: true }) {
55
+ var _a;
56
+ if (options.emit) {
57
+ this.emit('connect', (_a = account === null || account === void 0 ? void 0 : account.address) !== null && _a !== void 0 ? _a : null);
58
+ this.emit('accountChanged', account ? { address: account === null || account === void 0 ? void 0 : account.address, publicKey: account === null || account === void 0 ? void 0 : account.publicKey } : null);
59
+ }
60
+ }
61
+ _handleDisconnected(options = { emit: true }) {
62
+ this._account = null;
63
+ if (options.emit) {
64
+ this.emit('disconnect');
65
+ this.emit('accountChanged', null);
66
+ }
67
+ }
68
+ isAccountsChanged(account) {
69
+ var _a;
70
+ return (account === null || account === void 0 ? void 0 : account.address) !== ((_a = this._account) === null || _a === void 0 ? void 0 : _a.address);
71
+ }
72
+ // trigger by bridge account change event
73
+ _handleAccountChange(payload) {
74
+ if (!payload) {
75
+ this._handleDisconnected();
76
+ return;
77
+ }
78
+ if (this.isAccountsChanged(payload)) {
79
+ this._handleConnected(payload);
80
+ }
81
+ this._account = payload;
82
+ }
83
+ isNetworkChanged(network) {
84
+ return this._network === undefined || network !== this._network;
85
+ }
86
+ _handleNetworkChange(payload) {
87
+ const network = payload;
88
+ if (this.isNetworkChanged(network)) {
89
+ this.emit('networkChange', network || null);
90
+ }
91
+ this._network = network;
92
+ }
93
+ hasPermissions() {
94
+ return __awaiter(this, arguments, void 0, function* (permissions = types_1.ALL_PERMISSION_TYPES) {
95
+ return yield this._callBridge({
96
+ method: 'hasPermissions',
97
+ params: permissions,
98
+ });
99
+ });
100
+ }
101
+ requestPermissions() {
102
+ return __awaiter(this, arguments, void 0, function* (permissions = types_1.ALL_PERMISSION_TYPES) {
103
+ return yield this._callBridge({
104
+ method: 'requestPermissions',
105
+ params: permissions,
106
+ });
107
+ });
108
+ }
109
+ disconnect() {
110
+ return __awaiter(this, void 0, void 0, function* () {
111
+ yield this._callBridge({
112
+ method: 'disconnect',
113
+ params: void 0,
114
+ });
115
+ this._handleDisconnected();
116
+ });
117
+ }
118
+ getAccounts() {
119
+ return __awaiter(this, void 0, void 0, function* () {
120
+ const accounts = yield this._callBridge({
121
+ method: 'getAccounts',
122
+ params: undefined,
123
+ });
124
+ if (accounts.length === 0) {
125
+ this._handleDisconnected();
126
+ throw cross_inpage_provider_errors_1.web3Errors.provider.unauthorized();
127
+ }
128
+ return accounts;
129
+ });
130
+ }
131
+ getActiveChain() {
132
+ return __awaiter(this, void 0, void 0, function* () {
133
+ return this._callBridge({
134
+ method: 'getActiveChain',
135
+ params: undefined,
136
+ });
137
+ });
138
+ }
139
+ signAndExecuteTransactionBlock(input) {
140
+ return __awaiter(this, void 0, void 0, function* () {
141
+ return this._callBridge({
142
+ method: 'signAndExecuteTransactionBlock',
143
+ params: Object.assign(Object.assign({}, input), {
144
+ // https://github.com/MystenLabs/sui/blob/ace69fa8404eb704b504082d324ebc355a3d2948/sdk/typescript/src/transactions/object.ts#L6-L17
145
+ // With a few more objects, other wallets have steps for tojson.
146
+ transactionBlock: transactions_1.TransactionBlock.from(input.transactionBlock.serialize()), walletSerialize: JSON.stringify(input.account), blockSerialize: input.transactionBlock.serialize() }),
147
+ });
148
+ });
149
+ }
150
+ signTransactionBlock(input) {
151
+ return __awaiter(this, void 0, void 0, function* () {
152
+ return this._callBridge({
153
+ method: 'signTransactionBlock',
154
+ params: Object.assign(Object.assign({}, input), { transactionBlock: transactions_1.TransactionBlock.from(input.transactionBlock.serialize()), walletSerialize: JSON.stringify(input.account), blockSerialize: input.transactionBlock.serialize() }),
155
+ });
156
+ });
157
+ }
158
+ signMessage(input) {
159
+ return __awaiter(this, void 0, void 0, function* () {
160
+ return this._callBridge({
161
+ method: 'signMessage',
162
+ params: Object.assign(Object.assign({}, input), { walletSerialize: JSON.stringify(input.account), messageSerialize: (0, utils_1.bytesToHex)(input.message) }),
163
+ });
164
+ });
165
+ }
166
+ signPersonalMessage(input) {
167
+ return __awaiter(this, void 0, void 0, function* () {
168
+ return this._callBridge({
169
+ method: 'signPersonalMessage',
170
+ params: Object.assign(Object.assign({}, input), { walletSerialize: JSON.stringify(input.account), messageSerialize: (0, utils_1.bytesToHex)(input.message) }),
171
+ });
172
+ });
173
+ }
174
+ isConnected() {
175
+ return this._account !== null;
176
+ }
177
+ onNetworkChange(listener) {
178
+ return super.on(PROVIDER_EVENTS.networkChange, listener);
179
+ }
180
+ onAccountChange(listener) {
181
+ return super.on(PROVIDER_EVENTS.accountChanged, listener);
182
+ }
183
+ on(event, listener) {
184
+ return super.on(event, listener);
185
+ }
186
+ emit(event, ...args) {
187
+ return super.emit(event, ...args);
188
+ }
189
+ }
190
+ exports.ProviderBfc = ProviderBfc;
@@ -0,0 +1,186 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.registerBfcWallet = registerBfcWallet;
16
+ const utils_1 = require("@noble/hashes/utils");
17
+ const mitt_1 = __importDefault(require("mitt"));
18
+ const wallet_standard_1 = require("@benfen/bfc.js/wallet-standard");
19
+ const types_1 = require("./types");
20
+ var Feature;
21
+ (function (Feature) {
22
+ Feature["STANDARD__CONNECT"] = "standard:connect";
23
+ Feature["STANDARD__DISCONNECT"] = "standard:disconnect";
24
+ Feature["STANDARD__EVENTS"] = "standard:events";
25
+ Feature["BFC__SIGN_AND_EXECUTE_TRANSACTION_BLOCK"] = "bfc:signAndExecuteTransactionBlock";
26
+ Feature["BFC__SIGN_TRANSACTION_BLOCK"] = "bfc:signTransactionBlock";
27
+ Feature["BFC__SIGN_MESSAGE"] = "bfc:signMessage";
28
+ Feature["BFC__SIGN_PERSONAL_MESSAGE"] = "bfc:signPersonalMessage";
29
+ })(Feature || (Feature = {}));
30
+ class OnekeyBfcStandardWallet {
31
+ get name() {
32
+ var _a, _b;
33
+ return (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : this._name;
34
+ }
35
+ get icon() {
36
+ var _a;
37
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-explicit-any
38
+ return (((_a = this.options) === null || _a === void 0 ? void 0 : _a.logo) || '');
39
+ }
40
+ get chains() {
41
+ return [wallet_standard_1.BFC_DEVNET_CHAIN, wallet_standard_1.BFC_TESTNET_CHAIN];
42
+ }
43
+ get accounts() {
44
+ return this._account ? [this._account] : [];
45
+ }
46
+ get features() {
47
+ return {
48
+ [Feature.STANDARD__CONNECT]: {
49
+ version: '1.0.0',
50
+ connect: this.$connect,
51
+ },
52
+ [Feature.STANDARD__DISCONNECT]: {
53
+ version: '1.0.0',
54
+ disconnect: this.$disconnect,
55
+ },
56
+ [Feature.STANDARD__EVENTS]: {
57
+ version: '1.0.0',
58
+ on: this.$on,
59
+ },
60
+ [Feature.BFC__SIGN_AND_EXECUTE_TRANSACTION_BLOCK]: {
61
+ version: '1.0.0',
62
+ signAndExecuteTransactionBlock: this.$signAndExecuteTransactionBlock,
63
+ },
64
+ [Feature.BFC__SIGN_TRANSACTION_BLOCK]: {
65
+ version: '1.0.0',
66
+ signTransactionBlock: this.$signTransactionBlock,
67
+ },
68
+ [Feature.BFC__SIGN_MESSAGE]: {
69
+ version: '1.0.0',
70
+ signMessage: this.$signMessage,
71
+ },
72
+ [Feature.BFC__SIGN_PERSONAL_MESSAGE]: {
73
+ version: '1.0.0',
74
+ signPersonalMessage: this.$signPersonalMessage,
75
+ },
76
+ };
77
+ }
78
+ constructor(provider, options) {
79
+ this.version = '1.0.0';
80
+ this._name = 'OneKey Wallet';
81
+ this.$on = (event, listener) => {
82
+ this._events.on(event, listener);
83
+ return () => this._events.off(event, listener);
84
+ };
85
+ this.$connected = () => __awaiter(this, void 0, void 0, function* () {
86
+ if (!(yield this.$hasPermissions(['viewAccount']))) {
87
+ return;
88
+ }
89
+ const accounts = yield this.provider.getAccounts();
90
+ const [account] = accounts;
91
+ const activateAccount = this._account;
92
+ if (activateAccount && activateAccount.address === account.address) {
93
+ return { accounts: this.accounts };
94
+ }
95
+ if (account) {
96
+ yield this.handleAccountSwitch(account);
97
+ return { accounts: this.accounts };
98
+ }
99
+ });
100
+ this.$connect = (input) => __awaiter(this, void 0, void 0, function* () {
101
+ if (!(input === null || input === void 0 ? void 0 : input.silent)) {
102
+ yield this.provider.requestPermissions();
103
+ }
104
+ yield this.$connected();
105
+ return { accounts: this.accounts };
106
+ });
107
+ this.$disconnect = () => __awaiter(this, void 0, void 0, function* () {
108
+ yield this.provider.disconnect();
109
+ this._account = null;
110
+ this._events.all.clear();
111
+ });
112
+ this.$signAndExecuteTransactionBlock = (input) => __awaiter(this, void 0, void 0, function* () {
113
+ return this.provider.signAndExecuteTransactionBlock(input);
114
+ });
115
+ this.$signTransactionBlock = (input) => __awaiter(this, void 0, void 0, function* () {
116
+ return this.provider.signTransactionBlock(input);
117
+ });
118
+ this.$signMessage = (input) => __awaiter(this, void 0, void 0, function* () {
119
+ return this.provider.signMessage(input);
120
+ });
121
+ this.$signPersonalMessage = (input) => __awaiter(this, void 0, void 0, function* () {
122
+ return this.provider.signPersonalMessage(input);
123
+ });
124
+ this.handleAccountSwitch = (payload) => __awaiter(this, void 0, void 0, function* () {
125
+ const { address, publicKey } = payload;
126
+ const activateChain = yield this.getActiveChain();
127
+ this._account = new wallet_standard_1.ReadonlyWalletAccount({
128
+ address: address,
129
+ publicKey: (0, utils_1.hexToBytes)(publicKey),
130
+ chains: activateChain ? [activateChain] : [],
131
+ features: [
132
+ Feature.STANDARD__CONNECT,
133
+ Feature.BFC__SIGN_AND_EXECUTE_TRANSACTION_BLOCK,
134
+ Feature.BFC__SIGN_TRANSACTION_BLOCK,
135
+ Feature.BFC__SIGN_MESSAGE,
136
+ Feature.BFC__SIGN_PERSONAL_MESSAGE,
137
+ ],
138
+ });
139
+ this._events.emit('change', {
140
+ accounts: this.accounts,
141
+ chains: activateChain ? [activateChain] : [],
142
+ });
143
+ });
144
+ this.handleNetworkSwitch = (payload) => {
145
+ const { network } = payload;
146
+ this._events.emit('change', {
147
+ accounts: this.accounts,
148
+ chains: [network],
149
+ });
150
+ };
151
+ this.provider = provider;
152
+ this._events = (0, mitt_1.default)();
153
+ this._account = null;
154
+ this.options = options;
155
+ this.subscribeEventFromBackend();
156
+ void this.$connected();
157
+ }
158
+ getActiveChain() {
159
+ return this.provider.getActiveChain();
160
+ }
161
+ $hasPermissions(permissions = types_1.ALL_PERMISSION_TYPES) {
162
+ return this.provider.hasPermissions(permissions);
163
+ }
164
+ subscribeEventFromBackend() {
165
+ this.provider.onNetworkChange((network) => {
166
+ if (!network) {
167
+ return;
168
+ }
169
+ this.handleNetworkSwitch({ network: network });
170
+ });
171
+ this.provider.onAccountChange((account) => {
172
+ if (!account) {
173
+ return;
174
+ }
175
+ void this.handleAccountSwitch(account);
176
+ });
177
+ }
178
+ }
179
+ function registerBfcWallet(provider, options) {
180
+ try {
181
+ (0, wallet_standard_1.registerWallet)(new OnekeyBfcStandardWallet(provider, options));
182
+ }
183
+ catch (error) {
184
+ console.error(error);
185
+ }
186
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ProviderBfcBase = void 0;
4
+ const cross_inpage_provider_types_1 = require("@onekeyfe/cross-inpage-provider-types");
5
+ const cross_inpage_provider_core_1 = require("@onekeyfe/cross-inpage-provider-core");
6
+ class ProviderBfcBase extends cross_inpage_provider_core_1.ProviderBase {
7
+ constructor(props) {
8
+ super(props);
9
+ this.providerName = cross_inpage_provider_types_1.IInjectedProviderNames.bfc;
10
+ }
11
+ request(data) {
12
+ return this.bridgeRequest(data);
13
+ }
14
+ }
15
+ exports.ProviderBfcBase = ProviderBfcBase;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.registerBfcWallet = void 0;
18
+ __exportStar(require("./OnekeyBfcProvider"), exports);
19
+ __exportStar(require("./ProviderBfcBase"), exports);
20
+ var OnekeyBfcStandardWallet_1 = require("./OnekeyBfcStandardWallet");
21
+ Object.defineProperty(exports, "registerBfcWallet", { enumerable: true, get: function () { return OnekeyBfcStandardWallet_1.registerBfcWallet; } });
22
+ __exportStar(require("./types"), exports);
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ALL_PERMISSION_TYPES = void 0;
4
+ exports.ALL_PERMISSION_TYPES = ['viewAccount', 'suggestTransactions'];
@@ -0,0 +1,4 @@
1
+ export * from './OnekeyBfcProvider';
2
+ export * from './ProviderBfcBase';
3
+ export { registerBfcWallet } from './OnekeyBfcStandardWallet';
4
+ export * from './types';
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export * from './OnekeyBfcProvider';
2
+ export * from './ProviderBfcBase';
3
+ export { registerBfcWallet } from './OnekeyBfcStandardWallet';
4
+ export * from './types';
@@ -0,0 +1,4 @@
1
+ export type WireStringified<T> = T extends Array<infer P> ? Array<WireStringified<P>> : T extends object ? {
2
+ [K in keyof T]: WireStringified<T[K]>;
3
+ } : T;
4
+ export type ResolvePromise<T> = T extends Promise<infer P> ? P : T;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,14 @@
1
+ import { BfcChain } from '@benfen/bfc.js/wallet-standard';
2
+ export declare const ALL_PERMISSION_TYPES: readonly ["viewAccount", "suggestTransactions"];
3
+ type AllPermissionsType = typeof ALL_PERMISSION_TYPES;
4
+ export type PermissionType = AllPermissionsType[number];
5
+ export type WalletInfo = {
6
+ name?: string;
7
+ logo: string;
8
+ };
9
+ export type BfcChainType = BfcChain;
10
+ export interface AccountInfo {
11
+ address: string;
12
+ publicKey: string;
13
+ }
14
+ export {};
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ export const ALL_PERMISSION_TYPES = ['viewAccount', 'suggestTransactions'];
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@onekeyfe/onekey-bfc-provider",
3
+ "version": "2.1.17",
4
+ "keywords": [
5
+ "cross-inpage-provider"
6
+ ],
7
+ "author": "dev-fe@onekey.so",
8
+ "repository": "https://github.com/OneKeyHQ/cross-inpage-provider",
9
+ "license": "Apache-2.0",
10
+ "publishConfig": {
11
+ "access": "public"
12
+ },
13
+ "type": "module",
14
+ "files": [
15
+ "dist/*"
16
+ ],
17
+ "exports": {
18
+ "types": "./dist/index.d.ts",
19
+ "import": "./dist/index.js",
20
+ "require": "./dist/cjs/index.js"
21
+ },
22
+ "types": "./dist/index.d.ts",
23
+ "module": "./dist/index.js",
24
+ "main": "./dist/cjs/index.js",
25
+ "scripts": {
26
+ "prebuild": "rm -rf dist",
27
+ "build": "tsc && tsc --project tsconfig.cjs.json",
28
+ "start": "tsc --watch"
29
+ },
30
+ "dependencies": {
31
+ "@benfen/bfc.js": "0.2.7",
32
+ "@onekeyfe/cross-inpage-provider-core": "2.1.17",
33
+ "@onekeyfe/cross-inpage-provider-errors": "2.1.17",
34
+ "@onekeyfe/cross-inpage-provider-types": "2.1.17",
35
+ "@onekeyfe/extension-bridge-injected": "2.1.17",
36
+ "eth-rpc-errors": "^4.0.3",
37
+ "mitt": "^3.0.0"
38
+ },
39
+ "devDependencies": {
40
+ "typescript": "^5"
41
+ },
42
+ "gitHead": "6b9e350734a850a60dbf9fa4406190900f8f13f2"
43
+ }