@subwallet/extension-base 1.1.52-0 → 1.1.53-0
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/cjs/packageInfo.js +1 -1
- package/cjs/services/balance-service/helpers/subscribe/substrate/index.js +2 -1
- package/cjs/services/request-service/handler/ConnectWCRequestHandler.js +0 -1
- package/cjs/services/wallet-connect-service/helpers.js +1 -1
- package/cjs/services/wallet-connect-service/index.js +19 -0
- package/cjs/utils/eth/parseTransaction/index.js +1 -1
- package/package.json +5 -5
- package/packageInfo.js +1 -1
- package/services/balance-service/helpers/subscribe/substrate/index.js +2 -1
- package/services/request-service/handler/ConnectWCRequestHandler.js +0 -1
- package/services/wallet-connect-service/helpers.js +1 -1
- package/services/wallet-connect-service/index.d.ts +1 -0
- package/services/wallet-connect-service/index.js +19 -1
- package/utils/eth/parseTransaction/index.js +1 -1
package/cjs/packageInfo.js
CHANGED
|
@@ -98,7 +98,8 @@ const subscribeWithSystemAccountPallet = async _ref => {
|
|
|
98
98
|
if ((0, _utils2._isSubstrateRelayChain)(chainInfo) && substrateApi.query.nominationPools) {
|
|
99
99
|
var _substrateApi$rx$quer;
|
|
100
100
|
poolSubscribe = (_substrateApi$rx$quer = substrateApi.rx.query.nominationPools.poolMembers) === null || _substrateApi$rx$quer === void 0 ? void 0 : _substrateApi$rx$quer.multi(addresses);
|
|
101
|
-
}
|
|
101
|
+
}
|
|
102
|
+
if (!poolSubscribe) {
|
|
102
103
|
poolSubscribe = new _rxjs.Observable(subscriber => {
|
|
103
104
|
subscriber.next(addresses.map(() => ({
|
|
104
105
|
toPrimitive() {
|
|
@@ -21,6 +21,8 @@ var _types = require("./types");
|
|
|
21
21
|
// SPDX-License-Identifier: Apache-2.0
|
|
22
22
|
|
|
23
23
|
const storage = _storage.SWStorage.instance;
|
|
24
|
+
const methodDOTRequire = [_types.POLKADOT_SIGNING_METHODS.POLKADOT_SIGN_MESSAGE, _types.POLKADOT_SIGNING_METHODS.POLKADOT_SIGN_TRANSACTION];
|
|
25
|
+
const methodEVMRequire = [_types.EIP155_SIGNING_METHODS.PERSONAL_SIGN, _types.EIP155_SIGNING_METHODS.ETH_SIGN, _types.EIP155_SIGNING_METHODS.ETH_SEND_TRANSACTION];
|
|
24
26
|
var _requestService = /*#__PURE__*/(0, _classPrivateFieldLooseKey2.default)("requestService");
|
|
25
27
|
var _polkadotRequestHandler = /*#__PURE__*/(0, _classPrivateFieldLooseKey2.default)("polkadotRequestHandler");
|
|
26
28
|
var _eip155RequestHandler = /*#__PURE__*/(0, _classPrivateFieldLooseKey2.default)("eip155RequestHandler");
|
|
@@ -125,6 +127,13 @@ class WalletConnectService {
|
|
|
125
127
|
async approveSession(result) {
|
|
126
128
|
var _classPrivateFieldLoo4;
|
|
127
129
|
(0, _classPrivateFieldLooseBase2.default)(this, _checkClient)[_checkClient]();
|
|
130
|
+
Object.entries(result.namespaces).forEach(_ref => {
|
|
131
|
+
let [namespace, {
|
|
132
|
+
methods
|
|
133
|
+
}] = _ref;
|
|
134
|
+
methods = [...methods, ...this.findMethodsMissing(_constants.WALLET_CONNECT_EIP155_NAMESPACE === namespace ? methodEVMRequire : methodDOTRequire, methods)];
|
|
135
|
+
result.namespaces[namespace].methods = methods;
|
|
136
|
+
});
|
|
128
137
|
await ((_classPrivateFieldLoo4 = (0, _classPrivateFieldLooseBase2.default)(this, _client)[_client]) === null || _classPrivateFieldLoo4 === void 0 ? void 0 : _classPrivateFieldLoo4.approve(result));
|
|
129
138
|
(0, _classPrivateFieldLooseBase2.default)(this, _updateSessions)[_updateSessions]();
|
|
130
139
|
}
|
|
@@ -193,6 +202,16 @@ class WalletConnectService {
|
|
|
193
202
|
}));
|
|
194
203
|
(0, _classPrivateFieldLooseBase2.default)(this, _updateSessions)[_updateSessions]();
|
|
195
204
|
}
|
|
205
|
+
findMethodsMissing(methodRequire, methods) {
|
|
206
|
+
const methodMap = methods.reduce((obj, m) => ({
|
|
207
|
+
...obj,
|
|
208
|
+
[m]: m
|
|
209
|
+
}), {});
|
|
210
|
+
return methodEVMRequire.reduce((methods, m) => {
|
|
211
|
+
!methodMap[m] && methods.push(m);
|
|
212
|
+
return methods;
|
|
213
|
+
}, []);
|
|
214
|
+
}
|
|
196
215
|
}
|
|
197
216
|
exports.default = WalletConnectService;
|
|
198
217
|
function _get_haveData() {
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"./cjs/detectPackage.js"
|
|
18
18
|
],
|
|
19
19
|
"type": "module",
|
|
20
|
-
"version": "1.1.
|
|
20
|
+
"version": "1.1.53-0",
|
|
21
21
|
"main": "./cjs/index.js",
|
|
22
22
|
"module": "./index.js",
|
|
23
23
|
"types": "./index.d.ts",
|
|
@@ -1817,10 +1817,10 @@
|
|
|
1817
1817
|
"@sora-substrate/type-definitions": "^1.17.7",
|
|
1818
1818
|
"@substrate/connect": "^0.7.26",
|
|
1819
1819
|
"@subwallet/chain-list": "0.2.54",
|
|
1820
|
-
"@subwallet/extension-base": "^1.1.
|
|
1821
|
-
"@subwallet/extension-chains": "^1.1.
|
|
1822
|
-
"@subwallet/extension-dapp": "^1.1.
|
|
1823
|
-
"@subwallet/extension-inject": "^1.1.
|
|
1820
|
+
"@subwallet/extension-base": "^1.1.53-0",
|
|
1821
|
+
"@subwallet/extension-chains": "^1.1.53-0",
|
|
1822
|
+
"@subwallet/extension-dapp": "^1.1.53-0",
|
|
1823
|
+
"@subwallet/extension-inject": "^1.1.53-0",
|
|
1824
1824
|
"@subwallet/keyring": "^0.1.3",
|
|
1825
1825
|
"@subwallet/ui-keyring": "^0.1.3",
|
|
1826
1826
|
"@walletconnect/sign-client": "^2.8.4",
|
package/packageInfo.js
CHANGED
|
@@ -7,5 +7,5 @@ export const packageInfo = {
|
|
|
7
7
|
name: '@subwallet/extension-base',
|
|
8
8
|
path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto',
|
|
9
9
|
type: 'esm',
|
|
10
|
-
version: '1.1.
|
|
10
|
+
version: '1.1.53-0'
|
|
11
11
|
};
|
|
@@ -90,7 +90,8 @@ const subscribeWithSystemAccountPallet = async ({
|
|
|
90
90
|
if (_isSubstrateRelayChain(chainInfo) && substrateApi.query.nominationPools) {
|
|
91
91
|
var _substrateApi$rx$quer;
|
|
92
92
|
poolSubscribe = (_substrateApi$rx$quer = substrateApi.rx.query.nominationPools.poolMembers) === null || _substrateApi$rx$quer === void 0 ? void 0 : _substrateApi$rx$quer.multi(addresses);
|
|
93
|
-
}
|
|
93
|
+
}
|
|
94
|
+
if (!poolSubscribe) {
|
|
94
95
|
poolSubscribe = new Observable(subscriber => {
|
|
95
96
|
subscriber.next(addresses.map(() => ({
|
|
96
97
|
toPrimitive() {
|
|
@@ -10,10 +10,12 @@ import SignClient from '@walletconnect/sign-client';
|
|
|
10
10
|
import { getInternalError, getSdkError } from '@walletconnect/utils';
|
|
11
11
|
import { BehaviorSubject } from 'rxjs';
|
|
12
12
|
import PolkadotRequestHandler from "./handler/PolkadotRequestHandler.js";
|
|
13
|
-
import { ALL_WALLET_CONNECT_EVENT, DEFAULT_WALLET_CONNECT_OPTIONS, WALLET_CONNECT_SUPPORTED_METHODS } from "./constants.js";
|
|
13
|
+
import { ALL_WALLET_CONNECT_EVENT, DEFAULT_WALLET_CONNECT_OPTIONS, WALLET_CONNECT_EIP155_NAMESPACE, WALLET_CONNECT_SUPPORTED_METHODS } from "./constants.js";
|
|
14
14
|
import { convertConnectRequest, convertNotSupportRequest, isSupportWalletConnectChain } from "./helpers.js";
|
|
15
15
|
import { EIP155_SIGNING_METHODS, POLKADOT_SIGNING_METHODS } from "./types.js";
|
|
16
16
|
const storage = SWStorage.instance;
|
|
17
|
+
const methodDOTRequire = [POLKADOT_SIGNING_METHODS.POLKADOT_SIGN_MESSAGE, POLKADOT_SIGNING_METHODS.POLKADOT_SIGN_TRANSACTION];
|
|
18
|
+
const methodEVMRequire = [EIP155_SIGNING_METHODS.PERSONAL_SIGN, EIP155_SIGNING_METHODS.ETH_SIGN, EIP155_SIGNING_METHODS.ETH_SEND_TRANSACTION];
|
|
17
19
|
var _requestService = /*#__PURE__*/_classPrivateFieldLooseKey("requestService");
|
|
18
20
|
var _polkadotRequestHandler = /*#__PURE__*/_classPrivateFieldLooseKey("polkadotRequestHandler");
|
|
19
21
|
var _eip155RequestHandler = /*#__PURE__*/_classPrivateFieldLooseKey("eip155RequestHandler");
|
|
@@ -117,6 +119,12 @@ export default class WalletConnectService {
|
|
|
117
119
|
async approveSession(result) {
|
|
118
120
|
var _classPrivateFieldLoo4;
|
|
119
121
|
_classPrivateFieldLooseBase(this, _checkClient)[_checkClient]();
|
|
122
|
+
Object.entries(result.namespaces).forEach(([namespace, {
|
|
123
|
+
methods
|
|
124
|
+
}]) => {
|
|
125
|
+
methods = [...methods, ...this.findMethodsMissing(WALLET_CONNECT_EIP155_NAMESPACE === namespace ? methodEVMRequire : methodDOTRequire, methods)];
|
|
126
|
+
result.namespaces[namespace].methods = methods;
|
|
127
|
+
});
|
|
120
128
|
await ((_classPrivateFieldLoo4 = _classPrivateFieldLooseBase(this, _client)[_client]) === null || _classPrivateFieldLoo4 === void 0 ? void 0 : _classPrivateFieldLoo4.approve(result));
|
|
121
129
|
_classPrivateFieldLooseBase(this, _updateSessions)[_updateSessions]();
|
|
122
130
|
}
|
|
@@ -185,6 +193,16 @@ export default class WalletConnectService {
|
|
|
185
193
|
}));
|
|
186
194
|
_classPrivateFieldLooseBase(this, _updateSessions)[_updateSessions]();
|
|
187
195
|
}
|
|
196
|
+
findMethodsMissing(methodRequire, methods) {
|
|
197
|
+
const methodMap = methods.reduce((obj, m) => ({
|
|
198
|
+
...obj,
|
|
199
|
+
[m]: m
|
|
200
|
+
}), {});
|
|
201
|
+
return methodEVMRequire.reduce((methods, m) => {
|
|
202
|
+
!methodMap[m] && methods.push(m);
|
|
203
|
+
return methods;
|
|
204
|
+
}, []);
|
|
205
|
+
}
|
|
188
206
|
}
|
|
189
207
|
function _get_haveData() {
|
|
190
208
|
const sessionStorage = storage.getItem('wc@2:client:0.3//session');
|