@subwallet/extension-base 1.0.4-0 → 1.0.5-1
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 +37 -16
- package/background/KoniTypes.js +2 -0
- package/background/errors/TransactionError.js +4 -0
- package/background/handlers/State.d.ts +1 -1
- package/background/handlers/State.js +2 -8
- package/background/handlers/subscriptions.js +0 -1
- package/background/types.d.ts +2 -2
- package/cjs/background/KoniTypes.js +2 -0
- package/cjs/background/errors/TransactionError.js +4 -0
- package/cjs/background/handlers/State.js +1 -7
- package/cjs/background/handlers/subscriptions.js +0 -1
- package/cjs/constants/index.js +6 -6
- package/cjs/koni/api/coingecko.js +1 -4
- package/cjs/koni/api/dotsama/balance.js +7 -5
- package/cjs/koni/api/dotsama/crowdloan.js +0 -4
- package/cjs/koni/api/dotsama/transfer.js +0 -4
- package/cjs/koni/api/nft/acala_nft/index.js +1 -1
- package/cjs/koni/api/nft/bit.country/index.js +1 -1
- package/cjs/koni/api/nft/evm_nft/index.js +2 -3
- package/cjs/koni/api/nft/index.js +1 -2
- package/cjs/koni/api/nft/karura_nft/index.js +1 -1
- package/cjs/koni/api/nft/quartz_nft/index.js +1 -1
- package/cjs/koni/api/nft/rmrk_nft/index.js +2 -3
- package/cjs/koni/api/nft/statemine_nft/index.js +1 -1
- package/cjs/koni/api/nft/transfer.js +5 -5
- package/cjs/koni/api/nft/unique_nft/index.js +1 -1
- package/cjs/koni/api/nft/unique_nft/uniqueNftV2.js +0 -1
- package/cjs/koni/api/nft/wasm_nft/index.js +1 -2
- package/cjs/koni/api/staking/bonding/amplitude.js +9 -2
- package/cjs/koni/api/staking/bonding/astar.js +37 -13
- package/cjs/koni/api/staking/bonding/paraChain.js +10 -2
- package/cjs/koni/api/staking/bonding/relayChain.js +21 -4
- package/cjs/koni/api/staking/bonding/utils.js +4 -0
- package/cjs/koni/api/staking/relayChain.js +0 -1
- package/cjs/koni/api/staking/subsquidStaking.js +0 -2
- package/cjs/koni/api/tokens/wasm/index.js +0 -1
- package/cjs/koni/api/tokens/wasm/utils.js +0 -1
- package/cjs/koni/api/xcm/index.js +0 -1
- package/cjs/koni/background/cron.js +0 -45
- package/cjs/koni/background/handlers/Extension.js +204 -132
- package/cjs/koni/background/handlers/State.js +30 -3
- package/cjs/koni/background/handlers/Tabs.js +34 -2
- package/cjs/koni/background/handlers/index.js +3 -2
- package/cjs/koni/background/subscription.js +0 -26
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/chain-service/constants.js +1 -1
- package/cjs/services/chain-service/handler/EvmChainHandler.js +1 -1
- package/cjs/services/chain-service/handler/SubstrateChainHandler.js +3 -10
- package/cjs/services/chain-service/handler/light-client/index.js +9 -6
- package/cjs/services/chain-service/index.js +75 -28
- package/cjs/services/chain-service/utils.js +3 -0
- package/cjs/services/history-service/helpers/recoverHistoryStatus.js +108 -0
- package/cjs/services/history-service/index.js +60 -5
- package/cjs/services/history-service/subsquid-multi-chain-history.js +3 -2
- package/cjs/services/history-service/testChainMap.js +724 -0
- package/cjs/services/keyring-service/index.js +9 -2
- package/cjs/services/migration-service/index.js +7 -7
- package/cjs/services/migration-service/scripts/MigrateAuthUrls.js +39 -0
- package/cjs/services/migration-service/scripts/MigrateAutoLock.js +30 -0
- package/cjs/services/migration-service/scripts/MigrateChainPatrol.js +30 -0
- package/cjs/services/migration-service/scripts/index.js +7 -1
- package/cjs/services/price-service/coingecko.js +1 -1
- package/cjs/services/price-service/index.js +0 -4
- package/cjs/services/request-service/handler/AuthRequestHandler.js +8 -1
- package/cjs/services/request-service/handler/EvmRequestHandler.js +21 -0
- package/cjs/services/request-service/handler/MetadataRequestHandler.js +6 -0
- package/cjs/services/request-service/handler/SubstrateRequestHandler.js +6 -0
- package/cjs/services/request-service/index.js +6 -0
- package/cjs/services/setting-service/SettingService.js +4 -9
- package/cjs/services/setting-service/constants.js +18 -2
- package/cjs/services/storage-service/DatabaseService.js +16 -44
- package/cjs/services/storage-service/databases/index.js +1 -1
- package/cjs/services/storage-service/db-stores/BaseStore.js +3 -0
- package/cjs/services/transaction-service/constants.js +11 -0
- package/cjs/services/transaction-service/index.js +31 -9
- package/cjs/services/transaction-service/utils.js +25 -14
- package/constants/index.d.ts +1 -1
- package/constants/index.js +1 -1
- package/koni/api/coingecko.js +1 -4
- package/koni/api/dotsama/balance.js +7 -5
- package/koni/api/dotsama/crowdloan.js +0 -4
- package/koni/api/dotsama/transfer.js +0 -4
- package/koni/api/nft/acala_nft/index.js +1 -1
- package/koni/api/nft/bit.country/index.js +1 -1
- package/koni/api/nft/evm_nft/index.js +2 -3
- package/koni/api/nft/index.js +1 -2
- package/koni/api/nft/karura_nft/index.js +1 -1
- package/koni/api/nft/quartz_nft/index.js +1 -1
- package/koni/api/nft/rmrk_nft/index.js +2 -3
- package/koni/api/nft/statemine_nft/index.js +1 -1
- package/koni/api/nft/transfer.js +5 -5
- package/koni/api/nft/unique_nft/index.js +1 -1
- package/koni/api/nft/unique_nft/uniqueNftV2.js +0 -1
- package/koni/api/nft/wasm_nft/index.js +1 -2
- package/koni/api/staking/bonding/amplitude.js +9 -2
- package/koni/api/staking/bonding/astar.d.ts +2 -1
- package/koni/api/staking/bonding/astar.js +36 -13
- package/koni/api/staking/bonding/paraChain.js +10 -2
- package/koni/api/staking/bonding/relayChain.js +21 -4
- package/koni/api/staking/bonding/utils.js +4 -0
- package/koni/api/staking/relayChain.js +0 -1
- package/koni/api/staking/subsquidStaking.js +0 -2
- package/koni/api/tokens/wasm/index.js +0 -1
- package/koni/api/tokens/wasm/utils.js +0 -1
- package/koni/api/xcm/index.js +0 -1
- package/koni/background/cron.js +0 -45
- package/koni/background/handlers/Extension.d.ts +3 -0
- package/koni/background/handlers/Extension.js +120 -51
- package/koni/background/handlers/State.d.ts +4 -1
- package/koni/background/handlers/State.js +30 -3
- package/koni/background/handlers/Tabs.d.ts +1 -0
- package/koni/background/handlers/Tabs.js +32 -1
- package/koni/background/handlers/index.js +3 -2
- package/koni/background/subscription.d.ts +0 -1
- package/koni/background/subscription.js +0 -26
- package/package.json +65 -39
- package/packageInfo.js +1 -1
- package/services/chain-service/constants.js +1 -1
- package/services/chain-service/handler/EvmChainHandler.js +1 -1
- package/services/chain-service/handler/SubstrateChainHandler.js +3 -10
- package/services/chain-service/handler/light-client/index.js +8 -6
- package/services/chain-service/helper/api-helper/spec/acala.d.ts +3 -3
- package/services/chain-service/index.d.ts +2 -1
- package/services/chain-service/index.js +75 -28
- package/services/chain-service/utils.js +3 -0
- package/services/history-service/helpers/recoverHistoryStatus.d.ts +11 -0
- package/services/history-service/helpers/recoverHistoryStatus.js +98 -0
- package/services/history-service/index.d.ts +6 -0
- package/services/history-service/index.js +61 -6
- package/services/history-service/subsquid-multi-chain-history.js +3 -2
- package/services/history-service/testChainMap.d.ts +3 -0
- package/services/history-service/testChainMap.js +716 -0
- package/services/keyring-service/index.d.ts +1 -0
- package/services/keyring-service/index.js +9 -2
- package/services/migration-service/index.js +7 -7
- package/services/migration-service/scripts/MigrateAuthUrls.d.ts +4 -0
- package/services/migration-service/scripts/MigrateAuthUrls.js +31 -0
- package/services/migration-service/scripts/MigrateAutoLock.d.ts +4 -0
- package/services/migration-service/scripts/MigrateAutoLock.js +22 -0
- package/services/migration-service/scripts/MigrateChainPatrol.d.ts +4 -0
- package/services/migration-service/scripts/MigrateChainPatrol.js +22 -0
- package/services/migration-service/scripts/index.js +7 -1
- package/services/price-service/coingecko.js +1 -1
- package/services/price-service/index.js +0 -4
- package/services/request-service/handler/AuthRequestHandler.d.ts +1 -0
- package/services/request-service/handler/AuthRequestHandler.js +8 -1
- package/services/request-service/handler/EvmRequestHandler.d.ts +1 -0
- package/services/request-service/handler/EvmRequestHandler.js +21 -0
- package/services/request-service/handler/MetadataRequestHandler.d.ts +1 -0
- package/services/request-service/handler/MetadataRequestHandler.js +6 -0
- package/services/request-service/handler/SubstrateRequestHandler.d.ts +1 -0
- package/services/request-service/handler/SubstrateRequestHandler.js +6 -0
- package/services/request-service/index.d.ts +1 -0
- package/services/request-service/index.js +6 -0
- package/services/setting-service/SettingService.d.ts +1 -0
- package/services/setting-service/SettingService.js +5 -10
- package/services/setting-service/constants.d.ts +4 -1
- package/services/setting-service/constants.js +14 -1
- package/services/storage-service/DatabaseService.d.ts +1 -0
- package/services/storage-service/DatabaseService.js +16 -44
- package/services/storage-service/databases/index.js +1 -1
- package/services/storage-service/db-stores/BaseStore.d.ts +1 -0
- package/services/storage-service/db-stores/BaseStore.js +3 -0
- package/services/transaction-service/constants.d.ts +1 -0
- package/services/transaction-service/constants.js +4 -0
- package/services/transaction-service/index.d.ts +2 -0
- package/services/transaction-service/index.js +32 -10
- package/services/transaction-service/utils.d.ts +1 -1
- package/services/transaction-service/utils.js +24 -13
|
@@ -208,7 +208,6 @@ class KoniState {
|
|
|
208
208
|
this.onReady();
|
|
209
209
|
this.onAccountAdd();
|
|
210
210
|
this.onAccountRemove();
|
|
211
|
-
this.logger.log('Done init state');
|
|
212
211
|
}
|
|
213
212
|
startSubscription() {
|
|
214
213
|
this.dbService.subscribeChainStakingMetadata([], data => {
|
|
@@ -224,7 +223,6 @@ class KoniState {
|
|
|
224
223
|
this.historyService.start().catch(console.error);
|
|
225
224
|
this.priceService.start().catch(console.error);
|
|
226
225
|
this.ready = true;
|
|
227
|
-
this.logger.log('State is ready');
|
|
228
226
|
}
|
|
229
227
|
isReady() {
|
|
230
228
|
return this.ready;
|
|
@@ -623,7 +621,24 @@ class KoniState {
|
|
|
623
621
|
...settings,
|
|
624
622
|
camera: value
|
|
625
623
|
};
|
|
626
|
-
|
|
624
|
+
this.settingService.setSettings(newSettings);
|
|
625
|
+
});
|
|
626
|
+
}
|
|
627
|
+
setAutoLockTime(value) {
|
|
628
|
+
this.settingService.getSettings(settings => {
|
|
629
|
+
const newSettings = {
|
|
630
|
+
...settings,
|
|
631
|
+
timeAutoLock: value
|
|
632
|
+
};
|
|
633
|
+
this.settingService.setSettings(newSettings);
|
|
634
|
+
});
|
|
635
|
+
}
|
|
636
|
+
setEnableChainPatrol(value) {
|
|
637
|
+
this.settingService.getSettings(settings => {
|
|
638
|
+
const newSettings = {
|
|
639
|
+
...settings,
|
|
640
|
+
enableChainPatrol: value
|
|
641
|
+
};
|
|
627
642
|
this.settingService.setSettings(newSettings);
|
|
628
643
|
});
|
|
629
644
|
}
|
|
@@ -1454,5 +1469,17 @@ class KoniState {
|
|
|
1454
1469
|
async reloadStaking() {
|
|
1455
1470
|
return await this.cron.reloadStaking();
|
|
1456
1471
|
}
|
|
1472
|
+
async resetWallet(resetAll) {
|
|
1473
|
+
this.keyringService.resetWallet(resetAll);
|
|
1474
|
+
this.requestService.resetWallet();
|
|
1475
|
+
this.transactionService.resetWallet();
|
|
1476
|
+
await this.dbService.resetWallet(resetAll);
|
|
1477
|
+
this.accountRefStore.set('refList', []);
|
|
1478
|
+
if (resetAll) {
|
|
1479
|
+
this.settingService.resetWallet();
|
|
1480
|
+
}
|
|
1481
|
+
this.chainService.resetWallet(resetAll);
|
|
1482
|
+
await this.chainService.init();
|
|
1483
|
+
}
|
|
1457
1484
|
}
|
|
1458
1485
|
exports.default = KoniState;
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.default = void 0;
|
|
7
|
+
exports.default = exports.chainPatrolCheckUrl = void 0;
|
|
8
8
|
var _types = require("@subwallet/chain-list/types");
|
|
9
9
|
var _EvmProviderError = require("@subwallet/extension-base/background/errors/EvmProviderError");
|
|
10
10
|
var _helpers = require("@subwallet/extension-base/background/handlers/helpers");
|
|
@@ -15,6 +15,7 @@ var _RequestExtrinsicSign = _interopRequireDefault(require("@subwallet/extension
|
|
|
15
15
|
var _constants = require("@subwallet/extension-base/constants");
|
|
16
16
|
var _defaults = require("@subwallet/extension-base/defaults");
|
|
17
17
|
var _utils = require("@subwallet/extension-base/services/chain-service/utils");
|
|
18
|
+
var _constants2 = require("@subwallet/extension-base/services/setting-service/constants");
|
|
18
19
|
var _utils2 = require("@subwallet/extension-base/utils");
|
|
19
20
|
var _uiKeyring = _interopRequireDefault(require("@subwallet/ui-keyring"));
|
|
20
21
|
var _web = _interopRequireDefault(require("web3"));
|
|
@@ -94,11 +95,36 @@ function transformAccountsV2(accounts) {
|
|
|
94
95
|
};
|
|
95
96
|
});
|
|
96
97
|
}
|
|
98
|
+
// check if a URL is blocked
|
|
99
|
+
const chainPatrolCheckUrl = async url => {
|
|
100
|
+
const response = await fetch('https://app.chainpatrol.io/api/v2/asset/check', {
|
|
101
|
+
method: 'POST',
|
|
102
|
+
headers: {
|
|
103
|
+
'Content-Type': 'application/json',
|
|
104
|
+
'X-API-KEY': 'e5e88cd0-7994-4667-9071-bab849c2ba71'
|
|
105
|
+
},
|
|
106
|
+
body: JSON.stringify({
|
|
107
|
+
type: 'URL',
|
|
108
|
+
content: url
|
|
109
|
+
})
|
|
110
|
+
});
|
|
111
|
+
const data = await response.json();
|
|
112
|
+
return data.status === 'BLOCKED';
|
|
113
|
+
};
|
|
114
|
+
exports.chainPatrolCheckUrl = chainPatrolCheckUrl;
|
|
97
115
|
class KoniTabs {
|
|
98
116
|
#koniState;
|
|
99
117
|
evmEventEmitterMap = {};
|
|
118
|
+
#chainPatrolService = _constants2.DEFAULT_CHAIN_PATROL_ENABLE;
|
|
100
119
|
constructor(koniState) {
|
|
101
120
|
this.#koniState = koniState;
|
|
121
|
+
const updateChainPatrolService = rs => {
|
|
122
|
+
this.#chainPatrolService = rs.enableChainPatrol;
|
|
123
|
+
};
|
|
124
|
+
this.#koniState.settingService.getSettings(updateChainPatrolService);
|
|
125
|
+
this.#koniState.settingService.getSubject().subscribe({
|
|
126
|
+
next: updateChainPatrolService
|
|
127
|
+
});
|
|
102
128
|
}
|
|
103
129
|
|
|
104
130
|
/// Clone from Polkadot.js
|
|
@@ -197,6 +223,13 @@ class KoniTabs {
|
|
|
197
223
|
this.redirectPhishingLanding(url);
|
|
198
224
|
return true;
|
|
199
225
|
}
|
|
226
|
+
if (this.#chainPatrolService) {
|
|
227
|
+
const isInChainPatrolDenyList = await chainPatrolCheckUrl(url);
|
|
228
|
+
if (isInChainPatrolDenyList) {
|
|
229
|
+
this.redirectPhishingLanding(url);
|
|
230
|
+
return true;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
200
233
|
return false;
|
|
201
234
|
}
|
|
202
235
|
|
|
@@ -698,7 +731,6 @@ class KoniTabs {
|
|
|
698
731
|
const {
|
|
699
732
|
method
|
|
700
733
|
} = request;
|
|
701
|
-
console.log('method: ' + method);
|
|
702
734
|
try {
|
|
703
735
|
switch (method) {
|
|
704
736
|
case 'eth_chainId':
|
|
@@ -60,11 +60,12 @@ function handlers(_ref, port) {
|
|
|
60
60
|
const sender = port.sender;
|
|
61
61
|
const from = isExtension ? 'extension' : sender.tab && sender.tab.url || sender.url || '<unknown>';
|
|
62
62
|
const source = `${from}: ${id}: ${message}`;
|
|
63
|
-
|
|
63
|
+
|
|
64
|
+
// console.log(` [in] ${source}`); // :: ${JSON.stringify(request)}`);
|
|
64
65
|
|
|
65
66
|
const promise = isMobile ? mobile.handle(id, message, request, port) : isExtension ? extension.handle(id, message, request, port) : tabs.handle(id, message, request, from, port);
|
|
66
67
|
promise.then(response => {
|
|
67
|
-
console.log(`[out] ${source}`); // :: ${JSON.stringify(response)}`);
|
|
68
|
+
// console.log(`[out] ${source}`); // :: ${JSON.stringify(response)}`);
|
|
68
69
|
|
|
69
70
|
// between the start and the end of the promise, the user may have closed
|
|
70
71
|
// the tab, in which case port will be undefined
|
|
@@ -32,7 +32,6 @@ class KoniSubscription {
|
|
|
32
32
|
this.dbService = dbService;
|
|
33
33
|
this.state = state;
|
|
34
34
|
this.logger = (0, _util.logger)('Subscription');
|
|
35
|
-
this.init();
|
|
36
35
|
}
|
|
37
36
|
getSubscriptionMap() {
|
|
38
37
|
return this.subscriptionMap;
|
|
@@ -61,7 +60,6 @@ class KoniSubscription {
|
|
|
61
60
|
}
|
|
62
61
|
start() {
|
|
63
62
|
var _this$state$keyringSe;
|
|
64
|
-
this.logger.log('Starting subscription');
|
|
65
63
|
const currentAddress = (_this$state$keyringSe = this.state.keyringService.currentAccount) === null || _this$state$keyringSe === void 0 ? void 0 : _this$state$keyringSe.address;
|
|
66
64
|
if (currentAddress) {
|
|
67
65
|
this.subscribeBalancesAndCrowdloans(currentAddress, this.state.getChainInfoMap(), this.state.getChainStateMap(), this.state.getSubstrateApiMap(), this.state.getEvmApiMap());
|
|
@@ -74,7 +72,6 @@ class KoniSubscription {
|
|
|
74
72
|
if (!needReload) {
|
|
75
73
|
return;
|
|
76
74
|
}
|
|
77
|
-
this.logger.log('ServiceInfo updated, restarting...');
|
|
78
75
|
const address = (_serviceInfo$currentA = serviceInfo.currentAccountInfo) === null || _serviceInfo$currentA === void 0 ? void 0 : _serviceInfo$currentA.address;
|
|
79
76
|
if (!address) {
|
|
80
77
|
return;
|
|
@@ -85,34 +82,12 @@ class KoniSubscription {
|
|
|
85
82
|
this.state.eventService.onLazy(this.eventHandler);
|
|
86
83
|
}
|
|
87
84
|
stop() {
|
|
88
|
-
this.logger.log('Stopping subscription');
|
|
89
85
|
if (this.eventHandler) {
|
|
90
86
|
this.state.eventService.offLazy(this.eventHandler);
|
|
91
87
|
this.eventHandler = undefined;
|
|
92
88
|
}
|
|
93
89
|
this.stopAllSubscription();
|
|
94
90
|
}
|
|
95
|
-
init() {
|
|
96
|
-
this.state.getAuthorize(value => {
|
|
97
|
-
const authString = localStorage.getItem('authUrls') || '{}';
|
|
98
|
-
const previousAuth = JSON.parse(authString);
|
|
99
|
-
if (previousAuth && Object.keys(previousAuth).length) {
|
|
100
|
-
Object.keys(previousAuth).forEach(url => {
|
|
101
|
-
if (previousAuth[url].isAllowed) {
|
|
102
|
-
previousAuth[url].isAllowedMap = this.state.getAddressList(true);
|
|
103
|
-
} else {
|
|
104
|
-
previousAuth[url].isAllowedMap = this.state.getAddressList();
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
const migrateValue = {
|
|
109
|
-
...previousAuth,
|
|
110
|
-
...value
|
|
111
|
-
};
|
|
112
|
-
this.state.setAuthorize(migrateValue);
|
|
113
|
-
localStorage.setItem('authUrls', '{}');
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
91
|
subscribeBalancesAndCrowdloans(address, chainInfoMap, chainStateMap, substrateApiMap, web3ApiMap, onlyRunOnFirstTime) {
|
|
117
92
|
this.state.handleSwitchAccount(address).then(() => {
|
|
118
93
|
const addresses = this.state.getDecodedAddresses(address);
|
|
@@ -270,7 +245,6 @@ class KoniSubscription {
|
|
|
270
245
|
if (dataFromApi[chainInfo.slug]) {
|
|
271
246
|
this.state.updateChainStakingMetadata(dataFromApi[chainInfo.slug]);
|
|
272
247
|
} else {
|
|
273
|
-
console.warn('Not found staking data from api', chainInfo.slug);
|
|
274
248
|
const chainStakingMetadata = await (0, _bonding.getChainStakingMetadata)(chainInfo, substrateApiMap[chainInfo.slug]);
|
|
275
249
|
this.state.updateChainStakingMetadata(chainStakingMetadata);
|
|
276
250
|
}
|
package/cjs/packageInfo.js
CHANGED
|
@@ -228,7 +228,7 @@ const _CHAIN_ASSET_SRC = `https://raw.githubusercontent.com/Koniverse/SubWallet-
|
|
|
228
228
|
exports._CHAIN_ASSET_SRC = _CHAIN_ASSET_SRC;
|
|
229
229
|
const _ASSET_REF_SRC = `https://raw.githubusercontent.com/Koniverse/SubWallet-Chain/${TARGET_BRANCH}/packages/chain-list/src/data/AssetRef.json`;
|
|
230
230
|
exports._ASSET_REF_SRC = _ASSET_REF_SRC;
|
|
231
|
-
const _MULTI_CHAIN_ASSET_SRC = `https://raw.githubusercontent.com/Koniverse/SubWallet-Chain/${TARGET_BRANCH}/packages/chain-list/src/data/
|
|
231
|
+
const _MULTI_CHAIN_ASSET_SRC = `https://raw.githubusercontent.com/Koniverse/SubWallet-Chain/${TARGET_BRANCH}/packages/chain-list/src/data/MultiChainAsset.json`;
|
|
232
232
|
exports._MULTI_CHAIN_ASSET_SRC = _MULTI_CHAIN_ASSET_SRC;
|
|
233
233
|
const _CHAIN_LOGO_MAP_SRC = `https://raw.githubusercontent.com/Koniverse/SubWallet-Chain/${TARGET_BRANCH}/packages/chain-list/src/data/ChainLogoMap.json`;
|
|
234
234
|
exports._CHAIN_LOGO_MAP_SRC = _CHAIN_LOGO_MAP_SRC;
|
|
@@ -37,7 +37,6 @@ class SubstrateChainHandler {
|
|
|
37
37
|
resumeAllApis() {
|
|
38
38
|
return Promise.all(Object.values(this.getSubstrateApiMap()).map(async substrateApi => {
|
|
39
39
|
if (!substrateApi.api.isConnected && substrateApi.api.connect) {
|
|
40
|
-
this.logger.log(`[Substrate] Resuming network [${substrateApi.specName}]`);
|
|
41
40
|
await substrateApi.api.connect();
|
|
42
41
|
}
|
|
43
42
|
}));
|
|
@@ -46,7 +45,6 @@ class SubstrateChainHandler {
|
|
|
46
45
|
return Promise.all(Object.values(this.getSubstrateApiMap()).map(async substrateApi => {
|
|
47
46
|
if (substrateApi.api.isConnected) {
|
|
48
47
|
var _substrateApi$api, _substrateApi$api2;
|
|
49
|
-
this.logger.log(`[Substrate] Stopping network [${substrateApi.chainSlug}]`);
|
|
50
48
|
((_substrateApi$api = substrateApi.api) === null || _substrateApi$api === void 0 ? void 0 : _substrateApi$api.disconnect) && (await ((_substrateApi$api2 = substrateApi.api) === null || _substrateApi$api2 === void 0 ? void 0 : _substrateApi$api2.disconnect()));
|
|
51
49
|
}
|
|
52
50
|
}));
|
|
@@ -104,7 +102,6 @@ class SubstrateChainHandler {
|
|
|
104
102
|
gasLimit: (0, _utils.getDefaultWeightV2)(substrateApi.api)
|
|
105
103
|
})]);
|
|
106
104
|
if (!(nameResp.result.isOk && symbolResp.result.isOk && decimalsResp.result.isOk) || !nameResp.output || !decimalsResp.output || !symbolResp.output) {
|
|
107
|
-
this.logger.error('Error response while validating WASM contract');
|
|
108
105
|
return {
|
|
109
106
|
name: '',
|
|
110
107
|
decimals: -1,
|
|
@@ -119,7 +116,7 @@ class SubstrateChainHandler {
|
|
|
119
116
|
name = nameResp.output ? nameObj.Ok || nameObj.ok : '';
|
|
120
117
|
decimals = decimalsResp.output ? new _util.BN(decimalsObj.Ok || decimalsObj.ok).toNumber() : 0;
|
|
121
118
|
symbol = decimalsResp.output ? symbolObj.Ok || symbolObj.ok : '';
|
|
122
|
-
if (name === '' || symbol === '') {
|
|
119
|
+
if (!name || !symbol || typeof name === 'object' || typeof symbol === 'object') {
|
|
123
120
|
contractError = true;
|
|
124
121
|
}
|
|
125
122
|
console.log('validate PSP22', name, symbol, decimals);
|
|
@@ -131,7 +128,6 @@ class SubstrateChainHandler {
|
|
|
131
128
|
}); // read-only operation so no gas limit
|
|
132
129
|
|
|
133
130
|
if (!collectionIdResp.result.isOk || !collectionIdResp.output) {
|
|
134
|
-
this.logger.error('Error response while validating WASM contract');
|
|
135
131
|
return {
|
|
136
132
|
name: '',
|
|
137
133
|
decimals: -1,
|
|
@@ -156,7 +152,7 @@ class SubstrateChainHandler {
|
|
|
156
152
|
contractError
|
|
157
153
|
};
|
|
158
154
|
} catch (e) {
|
|
159
|
-
this.logger.error(
|
|
155
|
+
this.logger.error(e);
|
|
160
156
|
return {
|
|
161
157
|
name: '',
|
|
162
158
|
decimals: -1,
|
|
@@ -222,7 +218,6 @@ class SubstrateChainHandler {
|
|
|
222
218
|
defaultFormatBalance: undefined,
|
|
223
219
|
recoverConnect: () => {
|
|
224
220
|
substrateApi.apiRetry = 0;
|
|
225
|
-
this.logger.log('Recover connect to ', apiUrl);
|
|
226
221
|
provider.connect().then(this.logger.log).catch(this.logger.error);
|
|
227
222
|
},
|
|
228
223
|
get isReady() {
|
|
@@ -244,7 +239,6 @@ class SubstrateChainHandler {
|
|
|
244
239
|
}
|
|
245
240
|
};
|
|
246
241
|
api.on('connected', () => {
|
|
247
|
-
this.logger.log('Substrate API connected to ', apiUrl);
|
|
248
242
|
substrateApi.apiRetry = 0;
|
|
249
243
|
if (substrateApi.isApiReadyOnce) {
|
|
250
244
|
substrateApi.isApiReady = true;
|
|
@@ -262,7 +256,6 @@ class SubstrateChainHandler {
|
|
|
262
256
|
}
|
|
263
257
|
});
|
|
264
258
|
api.on('ready', () => {
|
|
265
|
-
this.logger.log('Substrate API ready with', apiUrl);
|
|
266
259
|
this.loadOnReady(registry, api).then(rs => {
|
|
267
260
|
(0, _util.objectSpread)(substrateApi, rs);
|
|
268
261
|
}).catch(error => {
|
|
@@ -314,7 +307,7 @@ class SubstrateChainHandler {
|
|
|
314
307
|
const tokenSymbol = properties.tokenSymbol.unwrapOr([_util.formatBalance.getDefaults().unit, ...DEFAULT_AUX]);
|
|
315
308
|
const tokenDecimals = properties.tokenDecimals.unwrapOr([DEFAULT_DECIMALS]);
|
|
316
309
|
const isDevelopment = systemChainType.isDevelopment || systemChainType.isLocal || (0, _util.isTestChain)(systemChain);
|
|
317
|
-
this.logger.log(`
|
|
310
|
+
this.logger.log(`Connected to ${systemChain} (${systemChainType.toString()}), ${(0, _util.stringify)(properties)}`);
|
|
318
311
|
|
|
319
312
|
// explicitly override the ss58Format as specified
|
|
320
313
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -5,15 +5,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getSubstrateConnectProvider = getSubstrateConnectProvider;
|
|
7
7
|
exports.relayChainSpecs = exports.paraChainSpecs = void 0;
|
|
8
|
+
var Sc = _interopRequireWildcard(require("@substrate/connect"));
|
|
8
9
|
var _rpcProvider = require("@polkadot/rpc-provider");
|
|
10
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
11
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
9
12
|
// Copyright 2019-2022 @subwallet/extension-base authors & contributors
|
|
10
13
|
// SPDX-License-Identifier: Apache-2.0
|
|
11
14
|
|
|
12
15
|
const relayChainSpecs = {
|
|
13
|
-
kusama:
|
|
14
|
-
polkadot:
|
|
15
|
-
rococo:
|
|
16
|
-
westend:
|
|
16
|
+
kusama: Sc.WellKnownChain.ksmcc3,
|
|
17
|
+
polkadot: Sc.WellKnownChain.polkadot,
|
|
18
|
+
rococo: Sc.WellKnownChain.rococo_v2_2,
|
|
19
|
+
westend: Sc.WellKnownChain.westend2
|
|
17
20
|
};
|
|
18
21
|
|
|
19
22
|
// Direct get spec data from @polkadot/react-api repository
|
|
@@ -106,14 +109,14 @@ class ProviderPlaceholder {
|
|
|
106
109
|
function getSubstrateConnectProvider(specLink) {
|
|
107
110
|
const [relayName, paraName] = specLink.split('/');
|
|
108
111
|
const relaySpec = relayChainSpecs[relayName];
|
|
109
|
-
const relayProvider = new _rpcProvider.ScProvider(relaySpec);
|
|
112
|
+
const relayProvider = new _rpcProvider.ScProvider(Sc, relaySpec);
|
|
110
113
|
if (!paraName) {
|
|
111
114
|
return relayProvider;
|
|
112
115
|
}
|
|
113
116
|
const paraChainData = paraChainSpecs[specLink];
|
|
114
117
|
let scProvider;
|
|
115
118
|
const scPromise = fetch(paraChainData).then(rs => rs.text()).then(spec => {
|
|
116
|
-
scProvider = new _rpcProvider.ScProvider(
|
|
119
|
+
scProvider = new _rpcProvider.ScProvider(Sc, spec);
|
|
117
120
|
return scProvider;
|
|
118
121
|
}).catch(console.error);
|
|
119
122
|
return new ProviderPlaceholder(scPromise);
|
|
@@ -367,7 +367,6 @@ class ChainService {
|
|
|
367
367
|
this.assetRegistrySubject.next(this.getAssetRegistry());
|
|
368
368
|
this.initApis();
|
|
369
369
|
await this.initAssetSettings();
|
|
370
|
-
this.logger.log('Initiated chains, assets and APIs');
|
|
371
370
|
}
|
|
372
371
|
initApis() {
|
|
373
372
|
// TODO: this might be async
|
|
@@ -483,31 +482,43 @@ class ChainService {
|
|
|
483
482
|
return duplicatedSlug;
|
|
484
483
|
}
|
|
485
484
|
async fetchLatestData(src, defaultValue) {
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
485
|
+
return Promise.resolve(defaultValue);
|
|
486
|
+
// try {
|
|
487
|
+
// const timeout = new Promise((resolve) => {
|
|
488
|
+
// const id = setTimeout(() => {
|
|
489
|
+
// clearTimeout(id);
|
|
490
|
+
// resolve(null);
|
|
491
|
+
// }, 1500);
|
|
492
|
+
// });
|
|
493
|
+
// let result = defaultValue;
|
|
494
|
+
// const resp = await Promise.race([
|
|
495
|
+
// timeout,
|
|
496
|
+
// fetch(src)
|
|
497
|
+
// ]) as Response || null;
|
|
498
|
+
//
|
|
499
|
+
// if (!resp) {
|
|
500
|
+
// console.warn('Error fetching latest data', src);
|
|
501
|
+
//
|
|
502
|
+
// return result;
|
|
503
|
+
// }
|
|
504
|
+
//
|
|
505
|
+
// if (resp.ok) {
|
|
506
|
+
// try {
|
|
507
|
+
// result = await resp.json();
|
|
508
|
+
// console.log('Fetched latest data', src);
|
|
509
|
+
// } catch (err) {
|
|
510
|
+
// console.warn('Error parsing latest data', src, err);
|
|
511
|
+
// }
|
|
512
|
+
// }
|
|
513
|
+
//
|
|
514
|
+
// return result;
|
|
515
|
+
// } catch (e) {
|
|
516
|
+
// console.warn('Error fetching latest data', src, e);
|
|
517
|
+
//
|
|
518
|
+
// return defaultValue;
|
|
519
|
+
// }
|
|
510
520
|
}
|
|
521
|
+
|
|
511
522
|
async initChains() {
|
|
512
523
|
const storedChainSettings = await this.dbService.getAllChainStore();
|
|
513
524
|
const latestChainInfoMap = await this.fetchLatestData(_constants._CHAIN_INFO_SRC, _chainList.ChainInfoMap);
|
|
@@ -1144,7 +1155,6 @@ class ChainService {
|
|
|
1144
1155
|
});
|
|
1145
1156
|
await Promise.all(promiseList);
|
|
1146
1157
|
if (update) {
|
|
1147
|
-
console.log('Update chain connection state');
|
|
1148
1158
|
this.chainStateMapSubject.next(chainStateMap);
|
|
1149
1159
|
}
|
|
1150
1160
|
}
|
|
@@ -1198,13 +1208,12 @@ class ChainService {
|
|
|
1198
1208
|
}
|
|
1199
1209
|
return this.assetSettingSubject.value;
|
|
1200
1210
|
}
|
|
1201
|
-
async updateAssetSetting(assetSlug, assetSetting) {
|
|
1211
|
+
async updateAssetSetting(assetSlug, assetSetting, autoEnableNativeToken) {
|
|
1202
1212
|
const currentAssetSettings = await this.getAssetSettings();
|
|
1203
1213
|
let needUpdateSubject;
|
|
1204
1214
|
|
|
1205
1215
|
// Update settings
|
|
1206
1216
|
currentAssetSettings[assetSlug] = assetSetting;
|
|
1207
|
-
this.setAssetSettings(currentAssetSettings);
|
|
1208
1217
|
if (assetSetting.visible) {
|
|
1209
1218
|
const assetInfo = this.getAssetBySlug(assetSlug);
|
|
1210
1219
|
const chainState = this.getChainStateByKey(assetInfo.originChain);
|
|
@@ -1213,8 +1222,15 @@ class ChainService {
|
|
|
1213
1222
|
if (chainState && !chainState.active) {
|
|
1214
1223
|
this.enableChain(chainState.slug);
|
|
1215
1224
|
needUpdateSubject = true;
|
|
1225
|
+
if (autoEnableNativeToken) {
|
|
1226
|
+
const nativeAsset = this.getNativeTokenInfo(assetInfo.originChain);
|
|
1227
|
+
currentAssetSettings[nativeAsset.slug] = {
|
|
1228
|
+
visible: true
|
|
1229
|
+
};
|
|
1230
|
+
}
|
|
1216
1231
|
}
|
|
1217
1232
|
}
|
|
1233
|
+
this.setAssetSettings(currentAssetSettings);
|
|
1218
1234
|
return needUpdateSubject;
|
|
1219
1235
|
}
|
|
1220
1236
|
async updateAssetSettingByChain(chainSlug, visible) {
|
|
@@ -1237,5 +1253,36 @@ class ChainService {
|
|
|
1237
1253
|
async getAssetLogoMap() {
|
|
1238
1254
|
return await this.fetchLatestData(_constants._ASSET_LOGO_MAP_SRC, _chainList.AssetLogoMap);
|
|
1239
1255
|
}
|
|
1256
|
+
resetWallet(resetAll) {
|
|
1257
|
+
if (resetAll) {
|
|
1258
|
+
this.setAssetSettings({});
|
|
1259
|
+
|
|
1260
|
+
// Disconnect chain
|
|
1261
|
+
const activeChains = this.getActiveChainInfos();
|
|
1262
|
+
for (const chain of Object.keys(activeChains)) {
|
|
1263
|
+
if (!_constants._DEFAULT_ACTIVE_CHAINS.includes(chain)) {
|
|
1264
|
+
this.disableChain(chain);
|
|
1265
|
+
}
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
// Remove custom chain
|
|
1269
|
+
const allChains = this.getChainInfoMap();
|
|
1270
|
+
for (const chain of Object.keys(allChains)) {
|
|
1271
|
+
if ((0, _utils._isCustomChain)(chain)) {
|
|
1272
|
+
this.removeCustomChain(chain);
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
|
|
1276
|
+
// Remove custom asset
|
|
1277
|
+
const assetSettings = this.getAssetSettings();
|
|
1278
|
+
const customToken = [];
|
|
1279
|
+
for (const asset of Object.keys(assetSettings)) {
|
|
1280
|
+
if ((0, _utils._isCustomAsset)(asset)) {
|
|
1281
|
+
customToken.push(asset);
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1284
|
+
this.deleteCustomAssets(customToken);
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1240
1287
|
}
|
|
1241
1288
|
exports.ChainService = ChainService;
|
|
@@ -352,6 +352,9 @@ function _getAssetDecimals(assetInfo) {
|
|
|
352
352
|
}
|
|
353
353
|
function _getBlockExplorerFromChain(chainInfo) {
|
|
354
354
|
let blockExplorer;
|
|
355
|
+
if (!chainInfo) {
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
355
358
|
if (_isPureEvmChain(chainInfo)) {
|
|
356
359
|
var _chainInfo$evmInfo4;
|
|
357
360
|
blockExplorer = chainInfo === null || chainInfo === void 0 ? void 0 : (_chainInfo$evmInfo4 = chainInfo.evmInfo) === null || _chainInfo$evmInfo4 === void 0 ? void 0 : _chainInfo$evmInfo4.blockExplorer;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.historyRecover = exports.HistoryRecoverStatus = void 0;
|
|
7
|
+
// Copyright 2019-2022 @subwallet/extension-koni authors & contributors
|
|
8
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
9
|
+
let HistoryRecoverStatus;
|
|
10
|
+
exports.HistoryRecoverStatus = HistoryRecoverStatus;
|
|
11
|
+
(function (HistoryRecoverStatus) {
|
|
12
|
+
HistoryRecoverStatus["SUCCESS"] = "SUCCESS";
|
|
13
|
+
HistoryRecoverStatus["FAILED"] = "FAILED";
|
|
14
|
+
HistoryRecoverStatus["API_INACTIVE"] = "API_INACTIVE";
|
|
15
|
+
HistoryRecoverStatus["LACK_INFO"] = "LACK_INFO";
|
|
16
|
+
HistoryRecoverStatus["FAIL_DETECT"] = "FAIL_DETECT";
|
|
17
|
+
HistoryRecoverStatus["UNKNOWN"] = "UNKNOWN";
|
|
18
|
+
})(HistoryRecoverStatus || (exports.HistoryRecoverStatus = HistoryRecoverStatus = {}));
|
|
19
|
+
const substrateRecover = async (history, chainService) => {
|
|
20
|
+
const {
|
|
21
|
+
blockHash,
|
|
22
|
+
chain,
|
|
23
|
+
extrinsicHash
|
|
24
|
+
} = history;
|
|
25
|
+
try {
|
|
26
|
+
const substrateApi = chainService.getSubstrateApi(chain);
|
|
27
|
+
if (substrateApi) {
|
|
28
|
+
const _api = await substrateApi.isReady;
|
|
29
|
+
const api = _api.api;
|
|
30
|
+
if (!blockHash) {
|
|
31
|
+
console.log(`Fail to find extrinsic ${extrinsicHash} on ${chain}: No block hash`);
|
|
32
|
+
return HistoryRecoverStatus.LACK_INFO;
|
|
33
|
+
}
|
|
34
|
+
const block = await api.rpc.chain.getBlock(blockHash);
|
|
35
|
+
const allEvents = await api.query.system.events.at(blockHash);
|
|
36
|
+
const extrinsics = block.block.extrinsics;
|
|
37
|
+
let index;
|
|
38
|
+
extrinsics.forEach((extrinsic, _idx) => {
|
|
39
|
+
if (extrinsicHash === extrinsic.hash.toHex()) {
|
|
40
|
+
index = _idx;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
if (index === undefined) {
|
|
44
|
+
console.log(`Fail to find extrinsic ${extrinsicHash} on ${chain}`);
|
|
45
|
+
return HistoryRecoverStatus.FAIL_DETECT;
|
|
46
|
+
}
|
|
47
|
+
const events = allEvents.filter(_ref => {
|
|
48
|
+
let {
|
|
49
|
+
phase
|
|
50
|
+
} = _ref;
|
|
51
|
+
return phase.isApplyExtrinsic && phase.asApplyExtrinsic.eq(index);
|
|
52
|
+
});
|
|
53
|
+
for (const {
|
|
54
|
+
event
|
|
55
|
+
} of events) {
|
|
56
|
+
if (api.events.system.ExtrinsicSuccess.is(event)) {
|
|
57
|
+
return HistoryRecoverStatus.SUCCESS;
|
|
58
|
+
} else if (api.events.system.ExtrinsicFailed.is(event)) {
|
|
59
|
+
return HistoryRecoverStatus.FAILED;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return HistoryRecoverStatus.FAIL_DETECT;
|
|
63
|
+
} else {
|
|
64
|
+
console.error(`Fail to update history ${chain}-${extrinsicHash}: Api not active`);
|
|
65
|
+
return HistoryRecoverStatus.API_INACTIVE;
|
|
66
|
+
}
|
|
67
|
+
} catch (e) {
|
|
68
|
+
console.error(`Fail to update history ${chain}-${extrinsicHash}:`, e.message);
|
|
69
|
+
return HistoryRecoverStatus.UNKNOWN;
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
const evmRecover = async (history, chainService) => {
|
|
73
|
+
const {
|
|
74
|
+
chain,
|
|
75
|
+
extrinsicHash
|
|
76
|
+
} = history;
|
|
77
|
+
try {
|
|
78
|
+
const evmApi = chainService.getEvmApi(chain);
|
|
79
|
+
if (evmApi) {
|
|
80
|
+
const _api = await evmApi.isReady;
|
|
81
|
+
const api = _api.api;
|
|
82
|
+
const block = await api.eth.getTransactionReceipt(extrinsicHash);
|
|
83
|
+
return block.status ? HistoryRecoverStatus.SUCCESS : HistoryRecoverStatus.FAILED;
|
|
84
|
+
} else {
|
|
85
|
+
console.error(`Fail to update history ${chain}-${extrinsicHash}: Api not active`);
|
|
86
|
+
return HistoryRecoverStatus.API_INACTIVE;
|
|
87
|
+
}
|
|
88
|
+
} catch (e) {
|
|
89
|
+
console.error(`Fail to update history ${chain}-${extrinsicHash}:`, e.message);
|
|
90
|
+
return HistoryRecoverStatus.UNKNOWN;
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
// undefined: Cannot check status
|
|
95
|
+
// true: Transaction success
|
|
96
|
+
// false: Transaction failed
|
|
97
|
+
const historyRecover = async (history, chainService) => {
|
|
98
|
+
const {
|
|
99
|
+
chainType
|
|
100
|
+
} = history;
|
|
101
|
+
if (chainType) {
|
|
102
|
+
const checkFunction = chainType === 'substrate' ? substrateRecover : evmRecover;
|
|
103
|
+
return await checkFunction(history, chainService);
|
|
104
|
+
} else {
|
|
105
|
+
return HistoryRecoverStatus.LACK_INFO;
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
exports.historyRecover = historyRecover;
|