@subwallet/extension-base 1.0.4-1 → 1.0.5-2
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 +14 -1
- package/background/KoniTypes.js +1 -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 +1 -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/astar.js +28 -12
- 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 +164 -134
- package/cjs/koni/background/handlers/State.js +18 -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/handler/EvmChainHandler.js +1 -1
- package/cjs/services/chain-service/handler/SubstrateChainHandler.js +2 -9
- package/cjs/services/chain-service/handler/light-client/index.js +9 -6
- package/cjs/services/chain-service/index.js +0 -2
- package/cjs/services/chain-service/utils.js +3 -0
- package/cjs/services/history-service/helpers/recoverHistoryStatus.js +227 -0
- package/cjs/services/history-service/index.js +68 -6
- 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 +0 -2
- package/cjs/services/migration-service/index.js +0 -3
- 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 +5 -1
- package/cjs/services/notification-service/NotificationService.js +1 -1
- package/cjs/services/price-service/coingecko.js +1 -1
- package/cjs/services/price-service/index.js +0 -3
- package/cjs/services/request-service/handler/AuthRequestHandler.js +1 -1
- package/cjs/services/setting-service/constants.js +8 -2
- package/cjs/services/storage-service/DatabaseService.js +3 -45
- package/cjs/services/transaction-service/constants.js +11 -0
- package/cjs/services/transaction-service/index.js +60 -20
- package/cjs/services/transaction-service/utils.js +25 -14
- package/cjs/utils/index.js +3 -0
- 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/astar.d.ts +2 -1
- package/koni/api/staking/bonding/astar.js +27 -12
- 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 +2 -0
- package/koni/background/handlers/Extension.js +79 -51
- package/koni/background/handlers/State.d.ts +3 -1
- package/koni/background/handlers/State.js +18 -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 +55 -34
- package/packageInfo.js +1 -1
- package/services/chain-service/handler/EvmChainHandler.js +1 -1
- package/services/chain-service/handler/SubstrateChainHandler.js +2 -9
- 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.js +0 -2
- package/services/chain-service/utils.js +3 -0
- package/services/history-service/helpers/recoverHistoryStatus.d.ts +17 -0
- package/services/history-service/helpers/recoverHistoryStatus.js +214 -0
- package/services/history-service/index.d.ts +6 -0
- package/services/history-service/index.js +69 -7
- 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.js +0 -2
- package/services/migration-service/index.js +0 -3
- 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 +5 -1
- package/services/notification-service/NotificationService.js +1 -1
- package/services/price-service/coingecko.js +1 -1
- package/services/price-service/index.js +0 -3
- package/services/request-service/handler/AuthRequestHandler.js +1 -1
- package/services/setting-service/constants.d.ts +4 -2
- package/services/setting-service/constants.js +5 -1
- package/services/storage-service/DatabaseService.d.ts +1 -1
- package/services/storage-service/DatabaseService.js +3 -45
- package/services/transaction-service/constants.d.ts +1 -0
- package/services/transaction-service/constants.js +4 -0
- package/services/transaction-service/index.d.ts +1 -0
- package/services/transaction-service/index.js +61 -21
- package/services/transaction-service/types.d.ts +2 -0
- package/services/transaction-service/utils.d.ts +1 -1
- package/services/transaction-service/utils.js +24 -13
- package/utils/index.js +3 -0
|
@@ -104,7 +104,6 @@ class KoniCron {
|
|
|
104
104
|
if (!commonReload && !chainUpdated && !stakingSubmitted) {
|
|
105
105
|
return;
|
|
106
106
|
}
|
|
107
|
-
this.logger.log('ServiceInfo updated, Cron restarting...', eventTypes);
|
|
108
107
|
const address = (_serviceInfo$currentA = serviceInfo.currentAccountInfo) === null || _serviceInfo$currentA === void 0 ? void 0 : _serviceInfo$currentA.address;
|
|
109
108
|
if (!address) {
|
|
110
109
|
return;
|
|
@@ -144,7 +143,6 @@ class KoniCron {
|
|
|
144
143
|
if (!(currentAccountInfo !== null && currentAccountInfo !== void 0 && currentAccountInfo.address)) {
|
|
145
144
|
return;
|
|
146
145
|
}
|
|
147
|
-
this.logger.log('Starting cron jobs');
|
|
148
146
|
if (Object.keys(this.state.getSubstrateApiMap()).length !== 0 || Object.keys(this.state.getEvmApiMap()).length !== 0) {
|
|
149
147
|
this.resetNft(currentAccountInfo.address);
|
|
150
148
|
this.addCron('refreshNft', this.refreshNft(currentAccountInfo.address, this.state.getApiMap(), this.state.getSmartContractNfts(), this.state.getActiveChainInfoMap()), _constants.CRON_REFRESH_NFT_INTERVAL);
|
|
@@ -173,48 +171,12 @@ class KoniCron {
|
|
|
173
171
|
this.serviceSubscription.unsubscribe();
|
|
174
172
|
this.serviceSubscription = undefined;
|
|
175
173
|
}
|
|
176
|
-
this.logger.log('Stopping cron jobs');
|
|
177
174
|
this.removeAllCrons();
|
|
178
175
|
this.status = 'stopped';
|
|
179
176
|
};
|
|
180
177
|
updateApiMapStatus = () => {
|
|
181
178
|
this.state.chainService.updateApiMapStatus().catch(console.error);
|
|
182
|
-
// const apiMap = this.state.getApiMap();
|
|
183
|
-
// const networkMap = this.state.getChainStateMap();
|
|
184
|
-
//
|
|
185
|
-
// for (const [key, substrateApi] of Object.entries(apiMap.substrate)) {
|
|
186
|
-
// let status: _ChainConnectionStatus = _ChainConnectionStatus.CONNECTING;
|
|
187
|
-
//
|
|
188
|
-
// if (substrateApi.isApiConnected) {
|
|
189
|
-
// status = _ChainConnectionStatus.CONNECTED;
|
|
190
|
-
// }
|
|
191
|
-
//
|
|
192
|
-
// if (!networkMap[key].connectionStatus) {
|
|
193
|
-
// this.state.updateChainConnectionStatus(key, status);
|
|
194
|
-
// } else if (networkMap[key].connectionStatus && networkMap[key].connectionStatus !== status) {
|
|
195
|
-
// this.state.updateChainConnectionStatus(key, status);
|
|
196
|
-
// }
|
|
197
|
-
// }
|
|
198
|
-
//
|
|
199
|
-
// for (const [key, evmApi] of Object.entries(apiMap.evm)) {
|
|
200
|
-
// evmApi.api.eth.net.isListening()
|
|
201
|
-
// .then(() => {
|
|
202
|
-
// if (!networkMap[key].connectionStatus) {
|
|
203
|
-
// this.state.updateChainConnectionStatus(key, _ChainConnectionStatus.CONNECTED);
|
|
204
|
-
// } else if (networkMap[key].connectionStatus && networkMap[key].connectionStatus !== _ChainConnectionStatus.CONNECTED) {
|
|
205
|
-
// this.state.updateChainConnectionStatus(key, _ChainConnectionStatus.CONNECTED);
|
|
206
|
-
// }
|
|
207
|
-
// })
|
|
208
|
-
// .catch(() => {
|
|
209
|
-
// if (!networkMap[key].connectionStatus) {
|
|
210
|
-
// this.state.updateChainConnectionStatus(key, _ChainConnectionStatus.CONNECTING);
|
|
211
|
-
// } else if (networkMap[key].connectionStatus && networkMap[key].connectionStatus !== _ChainConnectionStatus.CONNECTING) {
|
|
212
|
-
// this.state.updateChainConnectionStatus(key, _ChainConnectionStatus.CONNECTING);
|
|
213
|
-
// }
|
|
214
|
-
// });
|
|
215
|
-
// }
|
|
216
179
|
};
|
|
217
|
-
|
|
218
180
|
recoverApiMap = () => {
|
|
219
181
|
var _this$subscriptions;
|
|
220
182
|
const apiMap = this.state.getApiMap();
|
|
@@ -235,7 +197,6 @@ class KoniCron {
|
|
|
235
197
|
};
|
|
236
198
|
refreshNft = (address, apiMap, smartContractNfts, chainInfoMap) => {
|
|
237
199
|
return () => {
|
|
238
|
-
console.debug('Refresh NFT state');
|
|
239
200
|
this.subscriptions.subscribeNft(address, apiMap.substrate, apiMap.evm, smartContractNfts, chainInfoMap);
|
|
240
201
|
};
|
|
241
202
|
};
|
|
@@ -247,13 +208,11 @@ class KoniCron {
|
|
|
247
208
|
};
|
|
248
209
|
refreshStakingReward = address => {
|
|
249
210
|
return () => {
|
|
250
|
-
console.debug('Refresh staking reward state');
|
|
251
211
|
this.subscriptions.subscribeStakingReward(address).catch(this.logger.error);
|
|
252
212
|
};
|
|
253
213
|
};
|
|
254
214
|
refreshStakingRewardFastInterval = address => {
|
|
255
215
|
return () => {
|
|
256
|
-
console.debug('Refresh staking reward data with fast interval');
|
|
257
216
|
this.subscriptions.subscribeStakingRewardFastInterval(address).catch(this.logger.error);
|
|
258
217
|
};
|
|
259
218
|
};
|
|
@@ -265,20 +224,17 @@ class KoniCron {
|
|
|
265
224
|
};
|
|
266
225
|
updateChainStakingMetadata = (chainInfoMap, chainStateMap, substrateApiMap) => {
|
|
267
226
|
return () => {
|
|
268
|
-
console.debug('Fetching chain staking metadata');
|
|
269
227
|
this.subscriptions.fetchChainStakingMetadata(chainInfoMap, chainStateMap, substrateApiMap).catch(this.logger.error);
|
|
270
228
|
};
|
|
271
229
|
};
|
|
272
230
|
updateNominatorMetadata = (address, chainInfoMap, chainStateMap, substrateApiMap) => {
|
|
273
231
|
return () => {
|
|
274
|
-
console.debug('Fetching nominator data for', address);
|
|
275
232
|
this.subscriptions.fetchNominatorMetadata(address, chainInfoMap, chainStateMap, substrateApiMap).catch(this.logger.error);
|
|
276
233
|
};
|
|
277
234
|
};
|
|
278
235
|
async reloadNft() {
|
|
279
236
|
const address = this.state.keyringService.currentAccount.address;
|
|
280
237
|
const serviceInfo = this.state.getServiceInfo();
|
|
281
|
-
console.debug('Hard refresh NFT for', address);
|
|
282
238
|
this.resetNft(address);
|
|
283
239
|
this.removeCron('refreshNft');
|
|
284
240
|
this.addCron('refreshNft', this.refreshNft(address, serviceInfo.chainApiMap, this.state.getSmartContractNfts(), this.state.getActiveChainInfoMap()), _constants.CRON_REFRESH_NFT_INTERVAL);
|
|
@@ -287,7 +243,6 @@ class KoniCron {
|
|
|
287
243
|
}
|
|
288
244
|
async reloadStaking() {
|
|
289
245
|
const address = this.state.keyringService.currentAccount.address;
|
|
290
|
-
console.debug('Hard refresh staking meta for', address);
|
|
291
246
|
this.resetStakingReward();
|
|
292
247
|
this.removeCron('refreshStakingReward');
|
|
293
248
|
this.removeCron('refreshPoolingStakingReward');
|