@onekeyfe/onekey-polkadot-provider 2.1.12 → 2.1.14
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/dist/OnekeyPolkadotProvider.js +10 -3
- package/dist/cjs/OnekeyPolkadotProvider.js +10 -3
- package/dist/cjs/inject/Accounts.js +10 -1
- package/dist/cjs/inject/Injected.js +8 -0
- package/dist/cjs/inject/Signer.js +3 -0
- package/dist/inject/Accounts.d.ts +4 -0
- package/dist/inject/Accounts.js +10 -1
- package/dist/inject/Injected.d.ts +6 -0
- package/dist/inject/Injected.js +8 -0
- package/dist/inject/Signer.d.ts +1 -0
- package/dist/inject/Signer.js +3 -0
- package/package.json +6 -6
|
@@ -122,9 +122,16 @@ class ProviderPolkadot extends ProviderPolkadotBase {
|
|
|
122
122
|
});
|
|
123
123
|
}
|
|
124
124
|
web3Accounts(anyType) {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
125
|
+
const _super = Object.create(null, {
|
|
126
|
+
emit: { get: () => super.emit }
|
|
127
|
+
});
|
|
128
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
129
|
+
const accounts = yield this._callBridge({
|
|
130
|
+
method: 'web3Accounts',
|
|
131
|
+
params: anyType !== null && anyType !== void 0 ? anyType : false,
|
|
132
|
+
});
|
|
133
|
+
_super.emit.call(this, 'accountChanged', accounts);
|
|
134
|
+
return accounts;
|
|
128
135
|
});
|
|
129
136
|
}
|
|
130
137
|
web3AccountsSubscribe(cb) {
|
|
@@ -128,9 +128,16 @@ class ProviderPolkadot extends ProviderPolkadotBase_1.ProviderPolkadotBase {
|
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
130
|
web3Accounts(anyType) {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
131
|
+
const _super = Object.create(null, {
|
|
132
|
+
emit: { get: () => super.emit }
|
|
133
|
+
});
|
|
134
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
135
|
+
const accounts = yield this._callBridge({
|
|
136
|
+
method: 'web3Accounts',
|
|
137
|
+
params: anyType !== null && anyType !== void 0 ? anyType : false,
|
|
138
|
+
});
|
|
139
|
+
_super.emit.call(this, 'accountChanged', accounts);
|
|
140
|
+
return accounts;
|
|
134
141
|
});
|
|
135
142
|
}
|
|
136
143
|
web3AccountsSubscribe(cb) {
|
|
@@ -16,7 +16,16 @@ class default_1 {
|
|
|
16
16
|
return this.provider.web3Accounts(anyType);
|
|
17
17
|
});
|
|
18
18
|
this.subscribe = (cb) => {
|
|
19
|
-
|
|
19
|
+
// listener for account change
|
|
20
|
+
const unsub = this.provider.web3AccountsSubscribe(cb);
|
|
21
|
+
void this.get();
|
|
22
|
+
return unsub;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
toJSON() {
|
|
26
|
+
return {
|
|
27
|
+
get: {},
|
|
28
|
+
subscribe: {},
|
|
20
29
|
};
|
|
21
30
|
}
|
|
22
31
|
}
|
|
@@ -12,5 +12,13 @@ class default_1 {
|
|
|
12
12
|
this.provider = undefined;
|
|
13
13
|
this.signer = new Signer_1.default(provider);
|
|
14
14
|
}
|
|
15
|
+
toJSON() {
|
|
16
|
+
return {
|
|
17
|
+
accounts: this.accounts,
|
|
18
|
+
metadata: this.metadata,
|
|
19
|
+
provider: this.provider,
|
|
20
|
+
signer: this.signer,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
15
23
|
}
|
|
16
24
|
exports.default = default_1;
|
|
@@ -6,4 +6,8 @@ export default class implements InjectedAccounts {
|
|
|
6
6
|
constructor(provider: ProviderPolkadot);
|
|
7
7
|
get: (anyType?: boolean) => Promise<InjectedAccount[]>;
|
|
8
8
|
subscribe: (cb: (accounts: InjectedAccount[]) => unknown) => Unsubcall;
|
|
9
|
+
toJSON(): {
|
|
10
|
+
get: {};
|
|
11
|
+
subscribe: {};
|
|
12
|
+
};
|
|
9
13
|
}
|
package/dist/inject/Accounts.js
CHANGED
|
@@ -14,7 +14,16 @@ export default class {
|
|
|
14
14
|
return this.provider.web3Accounts(anyType);
|
|
15
15
|
});
|
|
16
16
|
this.subscribe = (cb) => {
|
|
17
|
-
|
|
17
|
+
// listener for account change
|
|
18
|
+
const unsub = this.provider.web3AccountsSubscribe(cb);
|
|
19
|
+
void this.get();
|
|
20
|
+
return unsub;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
toJSON() {
|
|
24
|
+
return {
|
|
25
|
+
get: {},
|
|
26
|
+
subscribe: {},
|
|
18
27
|
};
|
|
19
28
|
}
|
|
20
29
|
}
|
|
@@ -8,4 +8,10 @@ export default class implements Injected {
|
|
|
8
8
|
readonly provider: InjectedProvider | undefined;
|
|
9
9
|
readonly signer: Signer;
|
|
10
10
|
constructor(provider: ProviderPolkadot);
|
|
11
|
+
toJSON(): {
|
|
12
|
+
accounts: Accounts;
|
|
13
|
+
metadata: InjectedMetadata | undefined;
|
|
14
|
+
provider: InjectedProvider | undefined;
|
|
15
|
+
signer: Signer;
|
|
16
|
+
};
|
|
11
17
|
}
|
package/dist/inject/Injected.js
CHANGED
package/dist/inject/Signer.d.ts
CHANGED
package/dist/inject/Signer.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/onekey-polkadot-provider",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.14",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"cross-inpage-provider"
|
|
6
6
|
],
|
|
@@ -29,14 +29,14 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@noble/hashes": "^1.3.0",
|
|
32
|
-
"@onekeyfe/cross-inpage-provider-core": "2.1.
|
|
33
|
-
"@onekeyfe/cross-inpage-provider-errors": "2.1.
|
|
34
|
-
"@onekeyfe/cross-inpage-provider-types": "2.1.
|
|
35
|
-
"@onekeyfe/extension-bridge-injected": "2.1.
|
|
32
|
+
"@onekeyfe/cross-inpage-provider-core": "2.1.14",
|
|
33
|
+
"@onekeyfe/cross-inpage-provider-errors": "2.1.14",
|
|
34
|
+
"@onekeyfe/cross-inpage-provider-types": "2.1.14",
|
|
35
|
+
"@onekeyfe/extension-bridge-injected": "2.1.14",
|
|
36
36
|
"@polkadot/extension-inject": "^0.46.3",
|
|
37
37
|
"eth-rpc-errors": "^4.0.3",
|
|
38
38
|
"long": "^5.2.1",
|
|
39
39
|
"mitt": "^3.0.0"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "a834c7223890d2c153f04dafad9e7095cf9547dc"
|
|
42
42
|
}
|