@onekeyfe/onekey-polkadot-provider 1.1.26 → 1.1.28
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.
|
@@ -22,9 +22,18 @@ class ProviderPolkadot extends ProviderPolkadotBase {
|
|
|
22
22
|
this._handleDisconnected();
|
|
23
23
|
});
|
|
24
24
|
this.on(PROVIDER_EVENTS.message_low_level, (payload) => {
|
|
25
|
+
if (!payload)
|
|
26
|
+
return;
|
|
25
27
|
const { method, params } = payload;
|
|
26
28
|
if (isWalletEventMethodMatch({ method, name: PROVIDER_EVENTS.accountChanged })) {
|
|
27
|
-
|
|
29
|
+
let temp = undefined;
|
|
30
|
+
if (typeof params === 'string') {
|
|
31
|
+
temp = JSON.parse(params);
|
|
32
|
+
}
|
|
33
|
+
else if (typeof params === 'object') {
|
|
34
|
+
temp = params;
|
|
35
|
+
}
|
|
36
|
+
this._handleAccountChange(temp);
|
|
28
37
|
}
|
|
29
38
|
});
|
|
30
39
|
}
|
|
@@ -50,7 +59,7 @@ class ProviderPolkadot extends ProviderPolkadotBase {
|
|
|
50
59
|
}
|
|
51
60
|
// trigger by bridge account change event
|
|
52
61
|
_handleAccountChange(payload) {
|
|
53
|
-
const account =
|
|
62
|
+
const account = payload ? [payload] : [];
|
|
54
63
|
this.emit('accountChanged', account);
|
|
55
64
|
if (!account) {
|
|
56
65
|
this._handleDisconnected();
|
|
@@ -25,9 +25,18 @@ class ProviderPolkadot extends ProviderPolkadotBase_1.ProviderPolkadotBase {
|
|
|
25
25
|
this._handleDisconnected();
|
|
26
26
|
});
|
|
27
27
|
this.on(PROVIDER_EVENTS.message_low_level, (payload) => {
|
|
28
|
+
if (!payload)
|
|
29
|
+
return;
|
|
28
30
|
const { method, params } = payload;
|
|
29
31
|
if (isWalletEventMethodMatch({ method, name: PROVIDER_EVENTS.accountChanged })) {
|
|
30
|
-
|
|
32
|
+
let temp = undefined;
|
|
33
|
+
if (typeof params === 'string') {
|
|
34
|
+
temp = JSON.parse(params);
|
|
35
|
+
}
|
|
36
|
+
else if (typeof params === 'object') {
|
|
37
|
+
temp = params;
|
|
38
|
+
}
|
|
39
|
+
this._handleAccountChange(temp);
|
|
31
40
|
}
|
|
32
41
|
});
|
|
33
42
|
}
|
|
@@ -53,7 +62,7 @@ class ProviderPolkadot extends ProviderPolkadotBase_1.ProviderPolkadotBase {
|
|
|
53
62
|
}
|
|
54
63
|
// trigger by bridge account change event
|
|
55
64
|
_handleAccountChange(payload) {
|
|
56
|
-
const account =
|
|
65
|
+
const account = payload ? [payload] : [];
|
|
57
66
|
this.emit('accountChanged', account);
|
|
58
67
|
if (!account) {
|
|
59
68
|
this._handleDisconnected();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/onekey-polkadot-provider",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.28",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"cross-inpage-provider"
|
|
6
6
|
],
|
|
@@ -29,14 +29,14 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@noble/hashes": "^1.1.4",
|
|
32
|
-
"@onekeyfe/cross-inpage-provider-core": "1.1.
|
|
33
|
-
"@onekeyfe/cross-inpage-provider-errors": "1.1.
|
|
34
|
-
"@onekeyfe/cross-inpage-provider-types": "1.1.
|
|
35
|
-
"@onekeyfe/extension-bridge-injected": "1.1.
|
|
36
|
-
"@polkadot/extension-inject": "^0.
|
|
32
|
+
"@onekeyfe/cross-inpage-provider-core": "1.1.28",
|
|
33
|
+
"@onekeyfe/cross-inpage-provider-errors": "1.1.28",
|
|
34
|
+
"@onekeyfe/cross-inpage-provider-types": "1.1.28",
|
|
35
|
+
"@onekeyfe/extension-bridge-injected": "1.1.28",
|
|
36
|
+
"@polkadot/extension-inject": "^0.46.2",
|
|
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": "5469ed1680c52acc985f6191bdbe2a102f848071"
|
|
42
42
|
}
|