@subwallet/extension-base 1.3.45-1 → 1.3.47-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/background/KoniTypes.d.ts +5 -0
- package/background/KoniTypes.js +5 -0
- package/background/types.d.ts +2 -0
- package/cjs/background/KoniTypes.js +7 -1
- package/cjs/core/logic-validation/request.js +55 -28
- package/cjs/core/utils.js +22 -0
- package/cjs/koni/api/nft/ordinal_nft/index.js +3 -2
- package/cjs/koni/background/handlers/Extension.js +84 -61
- package/cjs/koni/background/handlers/State.js +3 -0
- package/cjs/koni/background/handlers/Tabs.js +11 -3
- package/cjs/packageInfo.js +1 -1
- package/cjs/page/evm/index.js +64 -105
- package/cjs/page/index.js +5 -3
- package/cjs/page/substrate/Accounts.js +2 -1
- package/cjs/services/balance-service/helpers/subscribe/index.js +3 -76
- package/cjs/services/balance-service/helpers/subscribe/substrate/index.js +8 -14
- package/cjs/services/buy-service/index.js +2 -0
- package/cjs/services/chain-service/index.js +3 -0
- package/cjs/services/chain-service/utils/index.js +34 -1
- package/cjs/services/chain-service/utils/patch.js +1 -1
- package/cjs/services/earning-service/constants/chains.js +2 -1
- package/cjs/services/earning-service/handlers/native-staking/amplitude.js +32 -0
- package/cjs/services/earning-service/handlers/native-staking/astar.js +18 -0
- package/cjs/services/earning-service/handlers/native-staking/base.js +40 -29
- package/cjs/services/earning-service/handlers/native-staking/dtao.js +5 -0
- package/cjs/services/earning-service/handlers/native-staking/mythos.js +28 -0
- package/cjs/services/earning-service/handlers/native-staking/para-chain.js +17 -0
- package/cjs/services/earning-service/handlers/native-staking/relay-chain.js +25 -2
- package/cjs/services/earning-service/handlers/native-staking/tao.js +5 -0
- package/cjs/services/earning-service/handlers/nomination-pool/index.js +6 -3
- package/cjs/services/earning-service/service.js +65 -22
- package/cjs/services/history-service/index.js +12 -7
- package/cjs/services/keyring-service/context/handlers/Json.js +2 -1
- package/cjs/services/keyring-service/context/handlers/Ledger.js +7 -2
- package/cjs/services/request-service/handler/AuthRequestHandler.js +30 -6
- package/cjs/services/subscan-service/index.js +35 -104
- package/cjs/services/transaction-service/utils.js +10 -1
- package/cjs/strategy/api-request-strategy/index.js +1 -0
- package/cjs/strategy/api-request-strategy/utils/index.js +2 -2
- package/cjs/strategy/api-request-strategy-v2/index.js +138 -0
- package/cjs/strategy/api-request-strategy-v2/types.js +1 -0
- package/cjs/types/account/info/keyring.js +1 -0
- package/cjs/utils/account/analyze.js +5 -2
- package/cjs/utils/account/common.js +93 -2
- package/cjs/utils/account/transform.js +10 -0
- package/cjs/utils/asset.js +9 -2
- package/cjs/utils/gear/combine.js +4 -3
- package/cjs/utils/gear/vft.js +104 -135
- package/cjs/utils/staticData/index.js +7 -2
- package/core/logic-validation/request.js +31 -4
- package/core/types.d.ts +3 -2
- package/core/utils.js +24 -2
- package/koni/api/nft/ordinal_nft/index.js +3 -2
- package/koni/background/handlers/Extension.js +31 -8
- package/koni/background/handlers/State.js +4 -1
- package/koni/background/handlers/Tabs.js +11 -4
- package/package.json +21 -9
- package/packageInfo.js +1 -1
- package/page/evm/index.d.ts +9 -18
- package/page/evm/index.js +62 -101
- package/page/index.js +5 -3
- package/page/substrate/Accounts.js +2 -1
- package/services/balance-service/helpers/subscribe/index.d.ts +1 -11
- package/services/balance-service/helpers/subscribe/index.js +3 -74
- package/services/balance-service/helpers/subscribe/substrate/index.js +8 -14
- package/services/buy-service/index.js +2 -0
- package/services/chain-service/index.d.ts +1 -0
- package/services/chain-service/index.js +3 -0
- package/services/chain-service/utils/index.d.ts +10 -2
- package/services/chain-service/utils/index.js +29 -2
- package/services/chain-service/utils/patch.js +1 -1
- package/services/earning-service/constants/chains.d.ts +1 -0
- package/services/earning-service/constants/chains.js +2 -1
- package/services/earning-service/handlers/native-staking/amplitude.d.ts +1 -0
- package/services/earning-service/handlers/native-staking/amplitude.js +32 -0
- package/services/earning-service/handlers/native-staking/astar.d.ts +1 -0
- package/services/earning-service/handlers/native-staking/astar.js +18 -0
- package/services/earning-service/handlers/native-staking/base.d.ts +2 -0
- package/services/earning-service/handlers/native-staking/base.js +40 -29
- package/services/earning-service/handlers/native-staking/dtao.d.ts +1 -0
- package/services/earning-service/handlers/native-staking/dtao.js +5 -0
- package/services/earning-service/handlers/native-staking/mythos.d.ts +1 -0
- package/services/earning-service/handlers/native-staking/mythos.js +28 -0
- package/services/earning-service/handlers/native-staking/para-chain.d.ts +1 -0
- package/services/earning-service/handlers/native-staking/para-chain.js +17 -0
- package/services/earning-service/handlers/native-staking/relay-chain.d.ts +1 -0
- package/services/earning-service/handlers/native-staking/relay-chain.js +25 -2
- package/services/earning-service/handlers/native-staking/tao.d.ts +1 -0
- package/services/earning-service/handlers/native-staking/tao.js +5 -0
- package/services/earning-service/handlers/nomination-pool/index.d.ts +1 -0
- package/services/earning-service/handlers/nomination-pool/index.js +6 -3
- package/services/earning-service/service.d.ts +3 -0
- package/services/earning-service/service.js +68 -25
- package/services/history-service/index.js +12 -7
- package/services/keyring-service/context/handlers/Json.js +2 -1
- package/services/keyring-service/context/handlers/Ledger.js +7 -2
- package/services/request-service/handler/AuthRequestHandler.d.ts +1 -0
- package/services/request-service/handler/AuthRequestHandler.js +30 -6
- package/services/request-service/types.d.ts +1 -0
- package/services/subscan-service/index.d.ts +13 -27
- package/services/subscan-service/index.js +26 -95
- package/services/transaction-service/utils.js +11 -2
- package/strategy/api-request-strategy/context/base.d.ts +2 -6
- package/strategy/api-request-strategy/index.js +1 -0
- package/strategy/api-request-strategy/types.d.ts +4 -2
- package/strategy/api-request-strategy/utils/index.js +2 -2
- package/strategy/api-request-strategy-v2/index.d.ts +22 -0
- package/strategy/api-request-strategy-v2/index.js +128 -0
- package/strategy/api-request-strategy-v2/types.d.ts +11 -0
- package/strategy/api-request-strategy-v2/types.js +1 -0
- package/types/account/action/subscribe.d.ts +3 -0
- package/types/account/info/keyring.d.ts +3 -0
- package/types/account/info/keyring.js +1 -0
- package/types/balance/transfer.d.ts +1 -0
- package/types/buy.d.ts +1 -1
- package/utils/account/analyze.js +5 -2
- package/utils/account/common.d.ts +13 -1
- package/utils/account/common.js +91 -2
- package/utils/account/transform.js +10 -0
- package/utils/asset.d.ts +2 -1
- package/utils/asset.js +7 -1
- package/utils/gear/combine.d.ts +2 -1
- package/utils/gear/combine.js +4 -4
- package/utils/gear/vft.d.ts +20 -9
- package/utils/gear/vft.js +104 -135
- package/utils/staticData/assetHubStaking.json +1 -0
- package/utils/staticData/index.d.ts +4 -1
- package/utils/staticData/index.js +5 -1
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"./cjs/detectPackage.js"
|
|
18
18
|
],
|
|
19
19
|
"type": "module",
|
|
20
|
-
"version": "1.3.
|
|
20
|
+
"version": "1.3.47-0",
|
|
21
21
|
"main": "./cjs/index.js",
|
|
22
22
|
"module": "./index.js",
|
|
23
23
|
"types": "./index.d.ts",
|
|
@@ -2201,6 +2201,16 @@
|
|
|
2201
2201
|
"require": "./cjs/strategy/api-request-strategy/index.js",
|
|
2202
2202
|
"default": "./strategy/api-request-strategy/index.js"
|
|
2203
2203
|
},
|
|
2204
|
+
"./strategy/api-request-strategy-v2": {
|
|
2205
|
+
"types": "./strategy/api-request-strategy-v2/index.d.ts",
|
|
2206
|
+
"require": "./cjs/strategy/api-request-strategy-v2/index.js",
|
|
2207
|
+
"default": "./strategy/api-request-strategy-v2/index.js"
|
|
2208
|
+
},
|
|
2209
|
+
"./strategy/api-request-strategy-v2/types": {
|
|
2210
|
+
"types": "./strategy/api-request-strategy-v2/types.d.ts",
|
|
2211
|
+
"require": "./cjs/strategy/api-request-strategy-v2/types.js",
|
|
2212
|
+
"default": "./strategy/api-request-strategy-v2/types.js"
|
|
2213
|
+
},
|
|
2204
2214
|
"./strategy/api-request-strategy/context/base": {
|
|
2205
2215
|
"types": "./strategy/api-request-strategy/context/base.d.ts",
|
|
2206
2216
|
"require": "./cjs/strategy/api-request-strategy/context/base.js",
|
|
@@ -2796,6 +2806,7 @@
|
|
|
2796
2806
|
"require": "./cjs/utils/staticData/index.js",
|
|
2797
2807
|
"default": "./utils/staticData/index.js"
|
|
2798
2808
|
},
|
|
2809
|
+
"./utils/staticData/assetHubStaking.json": "./utils/staticData/assetHubStaking.json",
|
|
2799
2810
|
"./utils/staticData/blockedActions.json": "./utils/staticData/blockedActions.json",
|
|
2800
2811
|
"./utils/staticData/blockedActionsFeatures.json": "./utils/staticData/blockedActionsFeatures.json",
|
|
2801
2812
|
"./utils/staticData/buyServiceInfos.json": "./utils/staticData/buyServiceInfos.json",
|
|
@@ -2828,7 +2839,7 @@
|
|
|
2828
2839
|
"@ethereumjs/common": "^4.1.0",
|
|
2829
2840
|
"@ethereumjs/tx": "^5.1.0",
|
|
2830
2841
|
"@ethersproject/abi": "^5.7.0",
|
|
2831
|
-
"@gear-js/api": "^0.
|
|
2842
|
+
"@gear-js/api": "^0.42.0",
|
|
2832
2843
|
"@json-rpc-tools/utils": "^1.7.6",
|
|
2833
2844
|
"@metamask/eth-sig-util": "^7.0.3",
|
|
2834
2845
|
"@metamask/safe-event-emitter": "^2.0.0",
|
|
@@ -2854,13 +2865,13 @@
|
|
|
2854
2865
|
"@reduxjs/toolkit": "^1.9.1",
|
|
2855
2866
|
"@sora-substrate/type-definitions": "^1.17.7",
|
|
2856
2867
|
"@substrate/connect": "^0.8.9",
|
|
2857
|
-
"@subwallet/chain-list": "0.2.
|
|
2858
|
-
"@subwallet/extension-base": "^1.3.
|
|
2859
|
-
"@subwallet/extension-chains": "^1.3.
|
|
2860
|
-
"@subwallet/extension-dapp": "^1.3.
|
|
2861
|
-
"@subwallet/extension-inject": "^1.3.
|
|
2868
|
+
"@subwallet/chain-list": "0.2.109",
|
|
2869
|
+
"@subwallet/extension-base": "^1.3.47-0",
|
|
2870
|
+
"@subwallet/extension-chains": "^1.3.47-0",
|
|
2871
|
+
"@subwallet/extension-dapp": "^1.3.47-0",
|
|
2872
|
+
"@subwallet/extension-inject": "^1.3.47-0",
|
|
2862
2873
|
"@subwallet/keyring": "^0.1.12",
|
|
2863
|
-
"@subwallet/subwallet-api-sdk": "^1.3.
|
|
2874
|
+
"@subwallet/subwallet-api-sdk": "^1.3.47-0",
|
|
2864
2875
|
"@subwallet/ui-keyring": "^0.1.12",
|
|
2865
2876
|
"@ton/core": "^0.56.3",
|
|
2866
2877
|
"@ton/crypto": "^3.2.0",
|
|
@@ -2893,7 +2904,8 @@
|
|
|
2893
2904
|
"moment": "^2.29.4",
|
|
2894
2905
|
"protobufjs": "^7.2.4",
|
|
2895
2906
|
"rxjs": "^7.8.1",
|
|
2896
|
-
"sails-js": "^0.
|
|
2907
|
+
"sails-js": "^0.4.2",
|
|
2908
|
+
"sails-js-parser": "^0.4.2",
|
|
2897
2909
|
"ts-md5": "^1.3.1",
|
|
2898
2910
|
"tweetnacl": "^1.0.3",
|
|
2899
2911
|
"uuid": "^9.0.0",
|
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.3.
|
|
10
|
+
version: '1.3.47-0'
|
|
11
11
|
};
|
package/page/evm/index.d.ts
CHANGED
|
@@ -1,29 +1,20 @@
|
|
|
1
|
+
import type { SendRequest } from '@subwallet/extension-base/page/types';
|
|
1
2
|
import type { EvmProvider } from '@subwallet/extension-inject/types';
|
|
3
|
+
import type { JsonRpcRequest, JsonRpcResponse } from 'json-rpc-engine';
|
|
4
|
+
import type { RequestArguments } from 'web3-core';
|
|
2
5
|
import SafeEventEmitter from '@metamask/safe-event-emitter';
|
|
3
|
-
import { SendRequest } from '@subwallet/extension-base/page/types';
|
|
4
|
-
import { JsonRpcRequest, JsonRpcResponse } from 'json-rpc-engine';
|
|
5
|
-
import { RequestArguments } from 'web3-core';
|
|
6
6
|
interface SendSyncJsonRpcRequest extends JsonRpcRequest<unknown> {
|
|
7
7
|
method: 'net_version';
|
|
8
8
|
}
|
|
9
|
-
export
|
|
10
|
-
readonly isSubWallet = true;
|
|
11
|
-
readonly isMetaMask = false;
|
|
12
|
-
readonly version: string;
|
|
13
|
-
protected sendMessage: SendRequest;
|
|
14
|
-
protected _connected: boolean;
|
|
15
|
-
constructor(sendMessage: SendRequest, version: string);
|
|
16
|
-
get connected(): boolean;
|
|
17
|
-
isConnected(): boolean;
|
|
18
|
-
protected subscribeExtensionEvents(): void;
|
|
9
|
+
export interface SubWalletEvmProvider extends EvmProvider, SafeEventEmitter {
|
|
19
10
|
enable(): Promise<string[]>;
|
|
20
|
-
|
|
21
|
-
once(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
22
|
-
request<T>({ method, params }: RequestArguments): Promise<T>;
|
|
23
|
-
private _sendSync;
|
|
11
|
+
request<T>(args: RequestArguments): Promise<T>;
|
|
24
12
|
send<T>(method: string, params?: T[]): Promise<JsonRpcResponse<T>>;
|
|
25
13
|
send<T>(payload: JsonRpcRequest<unknown>, callback: (error: Error | null, result?: JsonRpcResponse<T>) => void): void;
|
|
26
14
|
send<T>(payload: SendSyncJsonRpcRequest): JsonRpcResponse<T>;
|
|
27
|
-
sendAsync<T>(payload: JsonRpcRequest<T>, callback: (error:
|
|
15
|
+
sendAsync<T>(payload: JsonRpcRequest<T>, callback: (error: Error | null, result?: JsonRpcResponse<T>) => void): void;
|
|
16
|
+
on(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
17
|
+
once(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
28
18
|
}
|
|
19
|
+
export declare function createSubWalletEvmProvider(sendMessage: SendRequest, version: string): SubWalletEvmProvider;
|
|
29
20
|
export {};
|
package/page/evm/index.js
CHANGED
|
@@ -2,117 +2,45 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
4
|
import SafeEventEmitter from '@metamask/safe-event-emitter';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
get connected() {
|
|
17
|
-
return this._connected;
|
|
18
|
-
}
|
|
19
|
-
isConnected() {
|
|
20
|
-
return this._connected;
|
|
21
|
-
}
|
|
22
|
-
subscribeExtensionEvents() {
|
|
5
|
+
export function createSubWalletEvmProvider(sendMessage, version) {
|
|
6
|
+
const emitter = new SafeEventEmitter();
|
|
7
|
+
let connected = true;
|
|
8
|
+
let subscribeFlag = false;
|
|
9
|
+
const provider = Object.assign(emitter, {
|
|
10
|
+
isSubWallet: true,
|
|
11
|
+
isMetaMask: false,
|
|
12
|
+
version
|
|
13
|
+
});
|
|
14
|
+
function subscribeExtensionEvents() {
|
|
23
15
|
if (subscribeFlag) {
|
|
24
16
|
return;
|
|
25
17
|
}
|
|
26
|
-
|
|
18
|
+
sendMessage('evm(events.subscribe)', null, ({
|
|
27
19
|
payload,
|
|
28
20
|
type
|
|
29
21
|
}) => {
|
|
30
22
|
if (['connect', 'disconnect', 'accountsChanged', 'chainChanged', 'message', 'data', 'reconnect', 'error'].includes(type)) {
|
|
31
23
|
if (type === 'connect') {
|
|
32
|
-
|
|
24
|
+
connected = true;
|
|
33
25
|
} else if (type === 'disconnect') {
|
|
34
|
-
|
|
26
|
+
connected = false;
|
|
35
27
|
}
|
|
36
28
|
const finalType = type === 'data' ? 'message' : type;
|
|
37
|
-
|
|
38
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
39
|
-
this.emit(finalType, payload);
|
|
29
|
+
emitter.emit(finalType, payload);
|
|
40
30
|
} else {
|
|
41
31
|
console.warn('Can not handle event', type, payload);
|
|
42
32
|
}
|
|
43
|
-
}).then(
|
|
33
|
+
}).then(() => {
|
|
44
34
|
subscribeFlag = true;
|
|
45
35
|
}).catch(() => {
|
|
46
36
|
subscribeFlag = false;
|
|
47
37
|
});
|
|
48
|
-
subscribeFlag = true;
|
|
49
|
-
}
|
|
50
|
-
async enable() {
|
|
51
|
-
return this.request({
|
|
52
|
-
method: 'eth_requestAccounts'
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
on(eventName, listener) {
|
|
56
|
-
this.subscribeExtensionEvents();
|
|
57
|
-
super.on(eventName, listener);
|
|
58
|
-
return this;
|
|
59
38
|
}
|
|
60
|
-
|
|
61
|
-
this.subscribeExtensionEvents();
|
|
62
|
-
super.once(eventName, listener);
|
|
63
|
-
return this;
|
|
64
|
-
}
|
|
65
|
-
request({
|
|
66
|
-
method,
|
|
67
|
-
params
|
|
68
|
-
}) {
|
|
69
|
-
// if (!this._isEnable) {
|
|
70
|
-
// if (method === 'eth_accounts') {
|
|
71
|
-
// return this.request<T>({ method: 'eth_requestAccounts' });
|
|
72
|
-
// }
|
|
73
|
-
// }
|
|
74
|
-
|
|
75
|
-
// Subscribe events
|
|
76
|
-
switch (method) {
|
|
77
|
-
case 'eth_requestAccounts':
|
|
78
|
-
return new Promise((resolve, reject) => {
|
|
79
|
-
const origin = document.title !== '' ? document.title : window.location.hostname;
|
|
80
|
-
this.sendMessage('pub(authorize.tabV2)', {
|
|
81
|
-
origin,
|
|
82
|
-
accountAuthTypes: ['evm']
|
|
83
|
-
}).then(() => {
|
|
84
|
-
// Return account list
|
|
85
|
-
this.request({
|
|
86
|
-
method: 'eth_accounts'
|
|
87
|
-
}).then(accounts => {
|
|
88
|
-
// @ts-ignore
|
|
89
|
-
resolve(accounts);
|
|
90
|
-
}).catch(e => {
|
|
91
|
-
reject(e);
|
|
92
|
-
});
|
|
93
|
-
}).catch(e => {
|
|
94
|
-
reject(e);
|
|
95
|
-
});
|
|
96
|
-
});
|
|
97
|
-
default:
|
|
98
|
-
return new Promise((resolve, reject) => {
|
|
99
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
100
|
-
this.sendMessage('evm(request)', {
|
|
101
|
-
params,
|
|
102
|
-
method
|
|
103
|
-
}).then(result => {
|
|
104
|
-
resolve(result);
|
|
105
|
-
}).catch(e => {
|
|
106
|
-
reject(e);
|
|
107
|
-
});
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
_sendSync(payload) {
|
|
39
|
+
const _sendSync = payload => {
|
|
112
40
|
let result;
|
|
113
41
|
switch (payload.method) {
|
|
114
42
|
case 'net_version':
|
|
115
|
-
result =
|
|
43
|
+
result = version ? `SubWallet v${version}` : null;
|
|
116
44
|
break;
|
|
117
45
|
default:
|
|
118
46
|
throw new Error(`Not support ${payload.method}`);
|
|
@@ -122,28 +50,61 @@ export default class SubWalletEvmProvider extends SafeEventEmitter {
|
|
|
122
50
|
jsonrpc: payload.jsonrpc,
|
|
123
51
|
result
|
|
124
52
|
};
|
|
125
|
-
}
|
|
126
|
-
|
|
53
|
+
};
|
|
54
|
+
provider.isConnected = () => connected;
|
|
55
|
+
provider.request = arg => {
|
|
56
|
+
if (arg.method === 'eth_requestAccounts') {
|
|
57
|
+
const origin = document.title || window.location.hostname;
|
|
58
|
+
return sendMessage('pub(authorize.tabV2)', {
|
|
59
|
+
origin,
|
|
60
|
+
accountAuthTypes: ['evm']
|
|
61
|
+
}).then(() => provider.request({
|
|
62
|
+
method: 'eth_accounts'
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
return sendMessage('evm(request)', arg);
|
|
66
|
+
};
|
|
67
|
+
provider.send = (methodOrPayload, callbackOrArgs) => {
|
|
127
68
|
if (typeof methodOrPayload === 'string' && (!callbackOrArgs || Array.isArray(callbackOrArgs))) {
|
|
128
|
-
return
|
|
69
|
+
return provider.request({
|
|
129
70
|
method: methodOrPayload,
|
|
130
71
|
params: callbackOrArgs
|
|
131
72
|
});
|
|
132
|
-
} else if (
|
|
133
|
-
return
|
|
134
|
-
callbackOrArgs(
|
|
73
|
+
} else if (typeof methodOrPayload === 'object' && typeof callbackOrArgs === 'function') {
|
|
74
|
+
return provider.request(methodOrPayload).then(result => {
|
|
75
|
+
callbackOrArgs(null, result);
|
|
135
76
|
});
|
|
136
77
|
}
|
|
137
|
-
return
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
78
|
+
return _sendSync(methodOrPayload);
|
|
79
|
+
};
|
|
80
|
+
provider.enable = async () => {
|
|
81
|
+
const accounts = await provider.request({
|
|
82
|
+
method: 'eth_requestAccounts'
|
|
83
|
+
});
|
|
84
|
+
connected = accounts.length > 0;
|
|
85
|
+
return accounts;
|
|
86
|
+
};
|
|
87
|
+
provider.sendAsync = (payload, callback) => {
|
|
88
|
+
provider.request(payload).then(result => {
|
|
142
89
|
callback(null, {
|
|
90
|
+
id: payload.id,
|
|
91
|
+
jsonrpc: payload.jsonrpc,
|
|
92
|
+
// @ts-ignore
|
|
143
93
|
result
|
|
144
94
|
});
|
|
145
95
|
}).catch(e => {
|
|
146
96
|
callback(e);
|
|
147
97
|
});
|
|
148
|
-
}
|
|
98
|
+
};
|
|
99
|
+
provider.on = (eventName, listener) => {
|
|
100
|
+
subscribeExtensionEvents();
|
|
101
|
+
SafeEventEmitter.prototype.on.call(emitter, eventName, listener);
|
|
102
|
+
return provider;
|
|
103
|
+
};
|
|
104
|
+
provider.once = (eventName, listener) => {
|
|
105
|
+
subscribeExtensionEvents();
|
|
106
|
+
SafeEventEmitter.prototype.once.call(emitter, eventName, listener);
|
|
107
|
+
return provider;
|
|
108
|
+
};
|
|
109
|
+
return provider;
|
|
149
110
|
}
|
package/page/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { ProviderError } from '@subwallet/extension-base/background/errors/Provi
|
|
|
5
5
|
import { ProviderErrorType } from '@subwallet/extension-base/background/KoniTypes';
|
|
6
6
|
import SubWalletBitcoinProvider from '@subwallet/extension-base/page/bitcoin';
|
|
7
7
|
import SubWalletCardanoProvider from '@subwallet/extension-base/page/cardano';
|
|
8
|
-
import
|
|
8
|
+
import { createSubWalletEvmProvider } from '@subwallet/extension-base/page/evm';
|
|
9
9
|
import Injected from '@subwallet/extension-base/page/substrate';
|
|
10
10
|
import { MESSAGE_ORIGIN_PAGE } from "../defaults.js";
|
|
11
11
|
import { getId } from "../utils/getId.js";
|
|
@@ -43,9 +43,11 @@ export function sendMessage(message, request, subscriber) {
|
|
|
43
43
|
|
|
44
44
|
export async function enable(origin, opt) {
|
|
45
45
|
const accountAuthTypes = (opt === null || opt === void 0 ? void 0 : opt.accountAuthType) === 'both' ? ['substrate', 'evm'] : [(opt === null || opt === void 0 ? void 0 : opt.accountAuthType) || 'substrate'];
|
|
46
|
+
const canConnectSubstrateEcdsa = accountAuthTypes.includes('evm');
|
|
46
47
|
await sendMessage('pub(authorize.tabV2)', {
|
|
47
48
|
origin,
|
|
48
|
-
accountAuthTypes
|
|
49
|
+
accountAuthTypes,
|
|
50
|
+
canConnectSubstrateEcdsa
|
|
49
51
|
});
|
|
50
52
|
return new Injected(sendMessage);
|
|
51
53
|
}
|
|
@@ -69,7 +71,7 @@ export function handleResponse(data) {
|
|
|
69
71
|
}
|
|
70
72
|
}
|
|
71
73
|
export function initEvmProvider(version) {
|
|
72
|
-
return
|
|
74
|
+
return createSubWalletEvmProvider(sendMessage, version);
|
|
73
75
|
}
|
|
74
76
|
export function initCardanoProvider() {
|
|
75
77
|
return new SubWalletCardanoProvider(sendMessage);
|
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
import { _ChainAsset, _ChainInfo } from '@subwallet/chain-list/types';
|
|
2
2
|
import { ExtrinsicType } from '@subwallet/extension-base/background/KoniTypes';
|
|
3
3
|
import { _BitcoinApi, _CardanoApi, _EvmApi, _SubstrateApi, _TonApi } from '@subwallet/extension-base/services/chain-service/types';
|
|
4
|
-
import {
|
|
5
|
-
/**
|
|
6
|
-
* @function getAccountJsonByAddress
|
|
7
|
-
* @desc Get account info by address
|
|
8
|
-
* <p>
|
|
9
|
-
* Note: Use on the background only
|
|
10
|
-
* </p>
|
|
11
|
-
* @param {string} address - Address
|
|
12
|
-
* @returns {AccountJson|null} - Account info or null if not found
|
|
13
|
-
*/
|
|
14
|
-
export declare const getAccountJsonByAddress: (address: string) => AccountJson | null;
|
|
4
|
+
import { BalanceItem } from '@subwallet/extension-base/types';
|
|
15
5
|
export declare function subscribeBalance(addresses: string[], chains: string[], tokens: string[], _chainAssetMap: Record<string, _ChainAsset>, _chainInfoMap: Record<string, _ChainInfo>, substrateApiMap: Record<string, _SubstrateApi>, evmApiMap: Record<string, _EvmApi>, tonApiMap: Record<string, _TonApi>, cardanoApiMap: Record<string, _CardanoApi>, bitcoinApiMap: Record<string, _BitcoinApi>, callback: (rs: BalanceItem[]) => void, extrinsicType?: ExtrinsicType): () => void;
|
|
@@ -5,82 +5,11 @@ import { _AssetType } from '@subwallet/chain-list/types';
|
|
|
5
5
|
import { APIItemState } from '@subwallet/extension-base/background/KoniTypes';
|
|
6
6
|
import { subscribeBitcoinBalance } from '@subwallet/extension-base/services/balance-service/helpers/subscribe/bitcoin';
|
|
7
7
|
import { subscribeCardanoBalance } from '@subwallet/extension-base/services/balance-service/helpers/subscribe/cardano';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import keyring from '@subwallet/ui-keyring';
|
|
8
|
+
import { _isPureBitcoinChain, _isPureCardanoChain, _isPureEvmChain, _isPureTonChain } from '@subwallet/extension-base/services/chain-service/utils';
|
|
9
|
+
import { filterAddressByChainInfo, filterAssetsByChainAndType } from '@subwallet/extension-base/utils';
|
|
11
10
|
import { subscribeTonBalance } from "./ton/ton.js";
|
|
12
11
|
import { subscribeEVMBalance } from "./evm.js";
|
|
13
12
|
import { subscribeSubstrateBalance } from "./substrate/index.js";
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @function getAccountJsonByAddress
|
|
17
|
-
* @desc Get account info by address
|
|
18
|
-
* <p>
|
|
19
|
-
* Note: Use on the background only
|
|
20
|
-
* </p>
|
|
21
|
-
* @param {string} address - Address
|
|
22
|
-
* @returns {AccountJson|null} - Account info or null if not found
|
|
23
|
-
*/
|
|
24
|
-
export const getAccountJsonByAddress = address => {
|
|
25
|
-
try {
|
|
26
|
-
const pair = keyring.getPair(address);
|
|
27
|
-
if (pair) {
|
|
28
|
-
return pairToAccount(pair);
|
|
29
|
-
} else {
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
} catch (e) {
|
|
33
|
-
console.warn(e);
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
/** Filter addresses to subscribe by chain info */
|
|
39
|
-
const filterAddress = (addresses, chainInfo) => {
|
|
40
|
-
const {
|
|
41
|
-
_bitcoin,
|
|
42
|
-
bitcoin,
|
|
43
|
-
cardano,
|
|
44
|
-
evm,
|
|
45
|
-
substrate,
|
|
46
|
-
ton
|
|
47
|
-
} = getAddressesByChainTypeMap(addresses, chainInfo);
|
|
48
|
-
if (_isChainEvmCompatible(chainInfo)) {
|
|
49
|
-
return [evm, [bitcoin, substrate, ton, cardano, _bitcoin].flat()];
|
|
50
|
-
} else if (_isChainBitcoinCompatible(chainInfo)) {
|
|
51
|
-
return [bitcoin, [evm, substrate, ton, cardano, _bitcoin].flat()];
|
|
52
|
-
} else if (_isChainTonCompatible(chainInfo)) {
|
|
53
|
-
return [ton, [bitcoin, evm, substrate, cardano, _bitcoin].flat()];
|
|
54
|
-
} else if (_isChainCardanoCompatible(chainInfo)) {
|
|
55
|
-
return [cardano, [bitcoin, evm, substrate, ton, _bitcoin].flat()];
|
|
56
|
-
} else {
|
|
57
|
-
const fetchList = [];
|
|
58
|
-
const unfetchList = [];
|
|
59
|
-
substrate.forEach(address => {
|
|
60
|
-
const account = getAccountJsonByAddress(address);
|
|
61
|
-
if (account) {
|
|
62
|
-
if (account.isHardware) {
|
|
63
|
-
if (account.isGeneric) {
|
|
64
|
-
fetchList.push(address);
|
|
65
|
-
} else {
|
|
66
|
-
const availGen = account.availableGenesisHashes || [];
|
|
67
|
-
const gen = _getSubstrateGenesisHash(chainInfo);
|
|
68
|
-
if (availGen.includes(gen)) {
|
|
69
|
-
fetchList.push(address);
|
|
70
|
-
} else {
|
|
71
|
-
unfetchList.push(address);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
} else {
|
|
75
|
-
fetchList.push(address);
|
|
76
|
-
}
|
|
77
|
-
} else {
|
|
78
|
-
fetchList.push(address);
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
return [fetchList, [unfetchList, bitcoin, evm, ton, cardano, _bitcoin].flat()];
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
13
|
const handleUnsupportedOrPendingAddresses = (addresses, chainSlug, chainAssetMap, state, callback) => {
|
|
85
14
|
const tokens = filterAssetsByChainAndType(chainAssetMap, chainSlug, [_AssetType.NATIVE, _AssetType.ERC20, _AssetType.PSP22, _AssetType.LOCAL, _AssetType.GRC20, _AssetType.VFT, _AssetType.TEP74, _AssetType.CIP26]);
|
|
86
15
|
const now = new Date().getTime();
|
|
@@ -106,7 +35,7 @@ export function subscribeBalance(addresses, chains, tokens, _chainAssetMap, _cha
|
|
|
106
35
|
// Looping over each chain
|
|
107
36
|
const unsubList = Object.values(chainInfoMap).map(async chainInfo => {
|
|
108
37
|
const chainSlug = chainInfo.slug;
|
|
109
|
-
const [useAddresses, notSupportAddresses] =
|
|
38
|
+
const [useAddresses, notSupportAddresses] = filterAddressByChainInfo(addresses, chainInfo);
|
|
110
39
|
if (notSupportAddresses.length) {
|
|
111
40
|
handleUnsupportedOrPendingAddresses(notSupportAddresses, chainSlug, chainAssetMap, APIItemState.NOT_SUPPORT, callback);
|
|
112
41
|
}
|
|
@@ -324,17 +324,15 @@ const subscribeTokensAccountsPallet = async ({
|
|
|
324
324
|
const tokensAccountsKey = 'query_tokens_accounts';
|
|
325
325
|
const tokenTypes = includeNativeToken ? [_AssetType.NATIVE, _AssetType.LOCAL] : [_AssetType.LOCAL];
|
|
326
326
|
const tokenMap = filterAssetsByChainAndType(assetMap, chainInfo.slug, tokenTypes);
|
|
327
|
-
|
|
328
|
-
// Hotfix balance for gdot
|
|
329
|
-
const getGdotBalance = async () => {
|
|
330
|
-
const gdotBalances = await queryGdotBalance(substrateApi, addresses, assetMap[gdotSlug], extrinsicType);
|
|
331
|
-
callback(gdotBalances);
|
|
332
|
-
};
|
|
333
327
|
const unsubList = await Promise.all(Object.values(tokenMap).map(tokenInfo => {
|
|
334
|
-
|
|
335
|
-
if (tokenInfo.
|
|
328
|
+
var _tokenInfo$metadata;
|
|
329
|
+
if ((_tokenInfo$metadata = tokenInfo.metadata) !== null && _tokenInfo$metadata !== void 0 && _tokenInfo$metadata.isGigaToken) {
|
|
336
330
|
return timer(0, CRON_REFRESH_PRICE_INTERVAL).subscribe(() => {
|
|
337
|
-
|
|
331
|
+
const getGigaTokenBalance = async () => {
|
|
332
|
+
const gigaTokenBalances = await queryGigaTokenBalance(substrateApi, addresses, assetMap[tokenInfo.slug], extrinsicType);
|
|
333
|
+
callback(gigaTokenBalances);
|
|
334
|
+
};
|
|
335
|
+
getGigaTokenBalance().catch(console.error);
|
|
338
336
|
});
|
|
339
337
|
}
|
|
340
338
|
try {
|
|
@@ -543,11 +541,7 @@ const subscribeSubnetAlphaPallet = async ({
|
|
|
543
541
|
clearInterval(interval);
|
|
544
542
|
};
|
|
545
543
|
};
|
|
546
|
-
|
|
547
|
-
// Hot fix for gdot balance
|
|
548
|
-
|
|
549
|
-
const gdotSlug = 'hydradx_main-LOCAL-GDOT';
|
|
550
|
-
async function queryGdotBalance(substrateApi, addresses, tokenInfo, extrinsicType) {
|
|
544
|
+
async function queryGigaTokenBalance(substrateApi, addresses, tokenInfo, extrinsicType) {
|
|
551
545
|
return await Promise.all(addresses.map(async address => {
|
|
552
546
|
const _balanceInfo = await substrateApi.api.call.currenciesApi.account(_getTokenOnChainAssetId(tokenInfo), address);
|
|
553
547
|
const balanceInfo = _balanceInfo.toPrimitive();
|
|
@@ -140,6 +140,7 @@ export declare class ChainService {
|
|
|
140
140
|
private fetchLatestLedgerGenericAllowChains;
|
|
141
141
|
private fetchLatestPriorityTokens;
|
|
142
142
|
private fetchLatestSufficientChains;
|
|
143
|
+
fetchAhMapChain(): Promise<Record<string, string>>;
|
|
143
144
|
private initChains;
|
|
144
145
|
private initAssetRegistry;
|
|
145
146
|
private updateChainStateMapSubscription;
|
|
@@ -1018,6 +1018,9 @@ export class ChainService {
|
|
|
1018
1018
|
async fetchLatestSufficientChains() {
|
|
1019
1019
|
return (await fetchStaticData('chains/supported-sufficient-chains')) || [];
|
|
1020
1020
|
}
|
|
1021
|
+
async fetchAhMapChain() {
|
|
1022
|
+
return await fetchStaticData('asset-hub-staking-map');
|
|
1023
|
+
}
|
|
1021
1024
|
async initChains() {
|
|
1022
1025
|
const storedChainSettings = await this.dbService.getAllChainStore();
|
|
1023
1026
|
const defaultChainInfoMap = filterChainInfoMap(ChainInfoMap, ignoredList);
|
|
@@ -2,7 +2,7 @@ import { _AssetRef, _AssetType, _ChainAsset, _ChainInfo, _MultiChainAsset } from
|
|
|
2
2
|
import { BasicTokenInfo } from '@subwallet/extension-base/background/KoniTypes';
|
|
3
3
|
import { _ChainState, _DataMap } from '@subwallet/extension-base/services/chain-service/types';
|
|
4
4
|
import { IChain } from '@subwallet/extension-base/services/storage-service/databases';
|
|
5
|
-
import { AccountChainType } from '@subwallet/extension-base/types';
|
|
5
|
+
import { AccountChainType, AccountSignMode } from '@subwallet/extension-base/types';
|
|
6
6
|
import { KeypairType } from '@subwallet/keyring/types';
|
|
7
7
|
export declare function _isCustomChain(slug: string): boolean;
|
|
8
8
|
export declare function _isCustomAsset(slug: string): boolean;
|
|
@@ -40,6 +40,8 @@ export declare function _getTokenOnChainInfo(tokenInfo: _ChainAsset): Record<str
|
|
|
40
40
|
export declare function _isBridgedToken(tokenInfo: _ChainAsset): boolean;
|
|
41
41
|
export declare function _getTokenMinAmount(tokenInfo: _ChainAsset): string;
|
|
42
42
|
export declare function _isChainEvmCompatible(chainInfo: _ChainInfo): boolean;
|
|
43
|
+
export declare function _isChainCompatibleLedgerEvm(chainInfo: _ChainInfo): boolean;
|
|
44
|
+
export declare function _isSubstrateEvmCompatibleChain(chainInfo: _ChainInfo): boolean;
|
|
43
45
|
export declare function _isChainBitcoinCompatible(chainInfo: _ChainInfo): boolean;
|
|
44
46
|
export declare function _isChainTonCompatible(chainInfo: _ChainInfo): boolean;
|
|
45
47
|
export declare function _isChainCardanoCompatible(chainInfo: _ChainInfo): boolean;
|
|
@@ -68,6 +70,7 @@ export declare function _getNftTypesSupportedByChain(chainInfo: _ChainInfo): _As
|
|
|
68
70
|
export declare function _getTokenTypesSupportedByChain(chainInfo: _ChainInfo): _AssetType[];
|
|
69
71
|
export declare function _getChainNativeTokenBasicInfo(chainInfo: _ChainInfo): BasicTokenInfo;
|
|
70
72
|
export declare function _getChainNativeTokenSlug(chainInfo: _ChainInfo): string;
|
|
73
|
+
export declare function _getChainSubstrateTokenSymbol(chainInfo: _ChainInfo): string;
|
|
71
74
|
export declare function _isLocalToken(tokenInfo: _ChainAsset): boolean;
|
|
72
75
|
export declare function _isTokenEvmSmartContract(tokenInfo: _ChainAsset): boolean;
|
|
73
76
|
export declare function _isTokenTonSmartContract(tokenInfo: _ChainAsset): boolean;
|
|
@@ -119,6 +122,11 @@ export declare function updateLatestChainInfo(currentDataMap: _DataMap, latestCh
|
|
|
119
122
|
needUpdateChainApiList: _ChainInfo[];
|
|
120
123
|
};
|
|
121
124
|
export declare const _chainInfoToChainType: (chainInfo: _ChainInfo) => AccountChainType;
|
|
122
|
-
|
|
125
|
+
interface AccountInfo {
|
|
126
|
+
chainType: AccountChainType;
|
|
127
|
+
type: KeypairType;
|
|
128
|
+
signMode?: AccountSignMode;
|
|
129
|
+
}
|
|
130
|
+
export declare const _isChainInfoCompatibleWithAccountInfo: (chainInfo: _ChainInfo, accountInfo: AccountInfo) => boolean;
|
|
123
131
|
export declare const _getAssetNetuid: (assetInfo: _ChainAsset) => number;
|
|
124
132
|
export * from './patch';
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { _AssetRefPath, _AssetType, _ChainStatus, _SubstrateChainType } from '@subwallet/chain-list/types';
|
|
5
5
|
import { _MANTA_ZK_CHAIN_GROUP, _ZK_ASSET_PREFIX } from '@subwallet/extension-base/services/chain-service/constants';
|
|
6
6
|
import { _CUSTOM_PREFIX, _SMART_CONTRACT_STANDARDS } from '@subwallet/extension-base/services/chain-service/types';
|
|
7
|
-
import { AccountChainType } from '@subwallet/extension-base/types';
|
|
7
|
+
import { AccountChainType, AccountSignMode } from '@subwallet/extension-base/types';
|
|
8
8
|
import { BitcoinMainnetKeypairTypes, BitcoinTestnetKeypairTypes, CardanoKeypairTypes, EthereumKeypairTypes, SubstrateKeypairTypes, TonKeypairTypes } from '@subwallet/keyring/types';
|
|
9
9
|
import { isEthereumAddress } from '@polkadot/util-crypto';
|
|
10
10
|
export function _isCustomChain(slug) {
|
|
@@ -142,6 +142,12 @@ export function _getTokenMinAmount(tokenInfo) {
|
|
|
142
142
|
export function _isChainEvmCompatible(chainInfo) {
|
|
143
143
|
return !!chainInfo.evmInfo;
|
|
144
144
|
}
|
|
145
|
+
export function _isChainCompatibleLedgerEvm(chainInfo) {
|
|
146
|
+
return !!chainInfo.evmInfo && chainInfo.evmInfo.evmChainId > 0;
|
|
147
|
+
}
|
|
148
|
+
export function _isSubstrateEvmCompatibleChain(chainInfo) {
|
|
149
|
+
return !!chainInfo.evmInfo && !!chainInfo.substrateInfo;
|
|
150
|
+
}
|
|
145
151
|
export function _isChainBitcoinCompatible(chainInfo) {
|
|
146
152
|
return !!chainInfo.bitcoinInfo;
|
|
147
153
|
}
|
|
@@ -312,6 +318,13 @@ export function _getChainNativeTokenSlug(chainInfo) {
|
|
|
312
318
|
}
|
|
313
319
|
return `${chainInfo.slug}-${_AssetType.NATIVE}-${_getChainNativeTokenBasicInfo(chainInfo).symbol}`;
|
|
314
320
|
}
|
|
321
|
+
export function _getChainSubstrateTokenSymbol(chainInfo) {
|
|
322
|
+
if (chainInfo.substrateInfo) {
|
|
323
|
+
return chainInfo.substrateInfo.symbol || '';
|
|
324
|
+
} else {
|
|
325
|
+
return '';
|
|
326
|
+
}
|
|
327
|
+
}
|
|
315
328
|
export function _isLocalToken(tokenInfo) {
|
|
316
329
|
return tokenInfo.assetType === _AssetType.LOCAL;
|
|
317
330
|
}
|
|
@@ -419,6 +432,9 @@ export function _getBlockExplorerFromChain(chainInfo) {
|
|
|
419
432
|
} else if (_isPureBitcoinChain(chainInfo)) {
|
|
420
433
|
var _chainInfo$bitcoinInf;
|
|
421
434
|
blockExplorer = chainInfo === null || chainInfo === void 0 ? void 0 : (_chainInfo$bitcoinInf = chainInfo.bitcoinInfo) === null || _chainInfo$bitcoinInf === void 0 ? void 0 : _chainInfo$bitcoinInf.blockExplorer;
|
|
435
|
+
} else if (_isPureTonChain(chainInfo)) {
|
|
436
|
+
var _chainInfo$tonInfo;
|
|
437
|
+
blockExplorer = chainInfo === null || chainInfo === void 0 ? void 0 : (_chainInfo$tonInfo = chainInfo.tonInfo) === null || _chainInfo$tonInfo === void 0 ? void 0 : _chainInfo$tonInfo.blockExplorer;
|
|
422
438
|
} else {
|
|
423
439
|
var _chainInfo$substrateI18;
|
|
424
440
|
blockExplorer = chainInfo === null || chainInfo === void 0 ? void 0 : (_chainInfo$substrateI18 = chainInfo.substrateInfo) === null || _chainInfo$substrateI18 === void 0 ? void 0 : _chainInfo$substrateI18.blockExplorer;
|
|
@@ -594,11 +610,22 @@ export const _chainInfoToChainType = chainInfo => {
|
|
|
594
610
|
}
|
|
595
611
|
return AccountChainType.SUBSTRATE;
|
|
596
612
|
};
|
|
597
|
-
export const _isChainInfoCompatibleWithAccountInfo = (chainInfo,
|
|
613
|
+
export const _isChainInfoCompatibleWithAccountInfo = (chainInfo, accountInfo) => {
|
|
614
|
+
const {
|
|
615
|
+
chainType: accountChainType,
|
|
616
|
+
signMode: accountSignMode,
|
|
617
|
+
type: accountType
|
|
618
|
+
} = accountInfo;
|
|
598
619
|
if (accountChainType === AccountChainType.SUBSTRATE) {
|
|
599
620
|
return _isPureSubstrateChain(chainInfo) && SubstrateKeypairTypes.includes(accountType);
|
|
600
621
|
}
|
|
601
622
|
if (accountChainType === AccountChainType.ETHEREUM) {
|
|
623
|
+
if (accountSignMode === AccountSignMode.ECDSA_SUBSTRATE_LEDGER) {
|
|
624
|
+
return _isSubstrateEvmCompatibleChain(chainInfo) && EthereumKeypairTypes.includes(accountType);
|
|
625
|
+
}
|
|
626
|
+
if (accountSignMode === AccountSignMode.GENERIC_LEDGER) {
|
|
627
|
+
return _isChainCompatibleLedgerEvm(chainInfo) && EthereumKeypairTypes.includes(accountType);
|
|
628
|
+
}
|
|
602
629
|
return _isChainEvmCompatible(chainInfo) && EthereumKeypairTypes.includes(accountType);
|
|
603
630
|
}
|
|
604
631
|
if (accountChainType === AccountChainType.TON) {
|