@subwallet/extension-base 1.1.7-0 → 1.1.9-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 +10 -0
- package/cjs/koni/api/dotsama/domain.js +56 -0
- package/cjs/koni/api/nft/acala_nft/index.js +1 -1
- package/cjs/koni/api/nft/karura_nft/index.js +1 -1
- package/cjs/koni/api/nft/nft.js +3 -0
- package/cjs/koni/api/nft/wasm_nft/index.js +25 -7
- package/cjs/koni/api/staking/bonding/relayChain.js +12 -2
- package/cjs/koni/api/tokens/wasm/index.js +14 -0
- package/cjs/koni/background/cron.js +1 -1
- package/cjs/koni/background/handlers/Extension.js +13 -0
- package/cjs/koni/background/handlers/State.js +3 -0
- package/cjs/koni/background/subscription.js +3 -1
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/chain-service/helper/index.js +8 -2
- package/cjs/services/chain-service/index.js +20 -2
- package/cjs/services/migration-service/scripts/DeleteChain.js +21 -0
- package/cjs/services/migration-service/scripts/index.js +3 -1
- package/cjs/services/transaction-service/utils.js +4 -1
- package/cjs/services/wallet-connect-service/index.js +19 -10
- package/koni/api/dotsama/domain.d.ts +10 -0
- package/koni/api/dotsama/domain.js +41 -0
- package/koni/api/nft/acala_nft/index.js +1 -1
- package/koni/api/nft/karura_nft/index.js +1 -1
- package/koni/api/nft/nft.js +3 -0
- package/koni/api/nft/wasm_nft/index.js +26 -8
- package/koni/api/staking/bonding/relayChain.js +12 -2
- package/koni/api/tokens/wasm/index.d.ts +2 -0
- package/koni/api/tokens/wasm/index.js +13 -1
- package/koni/background/cron.js +1 -1
- package/koni/background/handlers/Extension.d.ts +2 -0
- package/koni/background/handlers/Extension.js +13 -0
- package/koni/background/handlers/State.d.ts +1 -0
- package/koni/background/handlers/State.js +3 -0
- package/koni/background/subscription.js +3 -1
- package/package.json +19 -6
- package/packageInfo.js +1 -1
- package/services/chain-service/helper/azero_domain_registry_abi.json +5428 -0
- package/services/chain-service/helper/index.d.ts +2 -0
- package/services/chain-service/helper/index.js +5 -1
- package/services/chain-service/helper/pink_psp34_abi.json +2758 -0
- package/services/chain-service/index.d.ts +1 -0
- package/services/chain-service/index.js +20 -2
- package/services/migration-service/scripts/DeleteChain.d.ts +4 -0
- package/services/migration-service/scripts/DeleteChain.js +13 -0
- package/services/migration-service/scripts/index.js +3 -1
- package/services/transaction-service/utils.js +4 -1
- package/services/wallet-connect-service/index.js +19 -10
|
@@ -61,6 +61,7 @@ export declare class ChainService {
|
|
|
61
61
|
getXcmEqualAssetByChain(destinationChainSlug: string, originTokenSlug: string): _ChainAsset | undefined;
|
|
62
62
|
getAssetByChainAndType(chainSlug: string, assetTypes: _AssetType[]): Record<string, _ChainAsset>;
|
|
63
63
|
getSmartContractNfts(): _ChainAsset[];
|
|
64
|
+
forceRemoveChain(slug: string): boolean;
|
|
64
65
|
removeCustomChain(slug: string): boolean;
|
|
65
66
|
resetChainInfoMap(excludedChains?: string[]): boolean;
|
|
66
67
|
setChainConnectionStatus(slug: string, connectionStatus: _ChainConnectionStatus): void;
|
|
@@ -279,11 +279,29 @@ export class ChainService {
|
|
|
279
279
|
}
|
|
280
280
|
|
|
281
281
|
// Setter
|
|
282
|
-
|
|
282
|
+
forceRemoveChain(slug) {
|
|
283
283
|
if (this.lockChainInfoMap) {
|
|
284
284
|
return false;
|
|
285
285
|
}
|
|
286
|
+
const chainInfoMap = this.getChainInfoMap();
|
|
287
|
+
const chainStateMap = this.getChainStateMap();
|
|
288
|
+
if (!(slug in chainInfoMap)) {
|
|
289
|
+
return false;
|
|
290
|
+
}
|
|
286
291
|
this.lockChainInfoMap = true;
|
|
292
|
+
delete chainStateMap[slug];
|
|
293
|
+
delete chainInfoMap[slug];
|
|
294
|
+
this.deleteAssetsByChain(slug);
|
|
295
|
+
this.dbService.removeFromChainStore([slug]).catch(console.error);
|
|
296
|
+
this.updateChainSubscription();
|
|
297
|
+
this.lockChainInfoMap = false;
|
|
298
|
+
this.eventService.emit('chain.updateState', slug);
|
|
299
|
+
return true;
|
|
300
|
+
}
|
|
301
|
+
removeCustomChain(slug) {
|
|
302
|
+
if (this.lockChainInfoMap) {
|
|
303
|
+
return false;
|
|
304
|
+
}
|
|
287
305
|
const chainInfoMap = this.getChainInfoMap();
|
|
288
306
|
const chainStateMap = this.getChainStateMap();
|
|
289
307
|
if (!(slug in chainInfoMap)) {
|
|
@@ -295,6 +313,7 @@ export class ChainService {
|
|
|
295
313
|
if (chainStateMap[slug].active) {
|
|
296
314
|
return false;
|
|
297
315
|
}
|
|
316
|
+
this.lockChainInfoMap = true;
|
|
298
317
|
delete chainStateMap[slug];
|
|
299
318
|
delete chainInfoMap[slug];
|
|
300
319
|
this.deleteAssetsByChain(slug);
|
|
@@ -412,7 +431,6 @@ export class ChainService {
|
|
|
412
431
|
|
|
413
432
|
// Avoid unnecessary update in case disable chain
|
|
414
433
|
if (currentStatus !== status) {
|
|
415
|
-
console.log(chainInfo.name, currentStatus, status);
|
|
416
434
|
this.setChainConnectionStatus(chainInfo.slug, status);
|
|
417
435
|
this.updateChainStateMapSubscription();
|
|
418
436
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Copyright 2019-2022 @subwallet/extension-koni authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import BaseMigrationJob from '@subwallet/extension-base/services/migration-service/Base';
|
|
5
|
+
export default class DeleteChain extends BaseMigrationJob {
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
7
|
+
async run() {
|
|
8
|
+
['snow', 'snow_evm', 'arctic_testnet'].forEach(chain => {
|
|
9
|
+
this.state.forceRemoveChain(chain);
|
|
10
|
+
});
|
|
11
|
+
console.log('done job');
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Copyright 2019-2022 @subwallet/extension-koni authors & contributors
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
+
import DeleteChain from '@subwallet/extension-base/services/migration-service/scripts/DeleteChain';
|
|
4
5
|
import AutoEnableChainsTokens from "./AutoEnableChainsTokens.js";
|
|
5
6
|
import MigrateAuthUrls from "./MigrateAuthUrls.js";
|
|
6
7
|
import MigrateAutoLock from "./MigrateAutoLock.js";
|
|
@@ -24,6 +25,7 @@ export default {
|
|
|
24
25
|
'1.0.3-02': MigrateChainPatrol,
|
|
25
26
|
'1.0.9-01': MigrateLedgerAccount,
|
|
26
27
|
'1.0.12-02': MigrateEthProvider,
|
|
27
|
-
'1.1.6-01': MigrateWalletReference
|
|
28
|
+
'1.1.6-01': MigrateWalletReference,
|
|
29
|
+
'1.1.7': DeleteChain
|
|
28
30
|
// [`${EVERYTIME}-1`]: AutoEnableChainsTokens
|
|
29
31
|
};
|
|
@@ -12,6 +12,9 @@ function getBlockExplorerAccountRoute(explorerLink) {
|
|
|
12
12
|
if (explorerLink.includes('explorer.subspace.network')) {
|
|
13
13
|
return 'accounts';
|
|
14
14
|
}
|
|
15
|
+
if (explorerLink.includes('deeperscan.io')) {
|
|
16
|
+
return 'account';
|
|
17
|
+
}
|
|
15
18
|
if (explorerLink.includes('subscan.io')) {
|
|
16
19
|
return 'account';
|
|
17
20
|
}
|
|
@@ -21,7 +24,7 @@ function getBlockExplorerTxRoute(chainInfo) {
|
|
|
21
24
|
if (_isPureEvmChain(chainInfo)) {
|
|
22
25
|
return 'tx';
|
|
23
26
|
}
|
|
24
|
-
if (['aventus'].includes(chainInfo.slug)) {
|
|
27
|
+
if (['aventus', 'deeper_network'].includes(chainInfo.slug)) {
|
|
25
28
|
return 'transaction';
|
|
26
29
|
}
|
|
27
30
|
return 'extrinsic';
|
|
@@ -138,21 +138,29 @@ export default class WalletConnectService {
|
|
|
138
138
|
// Disconnect session
|
|
139
139
|
const sessions = ((_classPrivateFieldLoo7 = _classPrivateFieldLooseBase(this, _client)[_client]) === null || _classPrivateFieldLoo7 === void 0 ? void 0 : _classPrivateFieldLoo7.session.values) || [];
|
|
140
140
|
for (const session of sessions) {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
141
|
+
try {
|
|
142
|
+
var _classPrivateFieldLoo8;
|
|
143
|
+
await ((_classPrivateFieldLoo8 = _classPrivateFieldLooseBase(this, _client)[_client]) === null || _classPrivateFieldLoo8 === void 0 ? void 0 : _classPrivateFieldLoo8.disconnect({
|
|
144
|
+
topic: session.topic,
|
|
145
|
+
reason: getSdkError('USER_DISCONNECTED')
|
|
146
|
+
}));
|
|
147
|
+
} catch (e) {
|
|
148
|
+
console.error(e);
|
|
149
|
+
}
|
|
146
150
|
}
|
|
147
151
|
|
|
148
152
|
// Disconnect pair
|
|
149
153
|
const pairs = ((_classPrivateFieldLoo9 = _classPrivateFieldLooseBase(this, _client)[_client]) === null || _classPrivateFieldLoo9 === void 0 ? void 0 : _classPrivateFieldLoo9.pairing.values) || [];
|
|
150
154
|
for (const pair of pairs) {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
155
|
+
try {
|
|
156
|
+
var _classPrivateFieldLoo10;
|
|
157
|
+
await ((_classPrivateFieldLoo10 = _classPrivateFieldLooseBase(this, _client)[_client]) === null || _classPrivateFieldLoo10 === void 0 ? void 0 : _classPrivateFieldLoo10.disconnect({
|
|
158
|
+
topic: pair.topic,
|
|
159
|
+
reason: getSdkError('USER_DISCONNECTED')
|
|
160
|
+
}));
|
|
161
|
+
} catch (e) {
|
|
162
|
+
console.error(e);
|
|
163
|
+
}
|
|
156
164
|
}
|
|
157
165
|
const keys = (await ((_classPrivateFieldLoo11 = _classPrivateFieldLooseBase(this, _client)[_client]) === null || _classPrivateFieldLoo11 === void 0 ? void 0 : _classPrivateFieldLoo11.core.storage.getKeys())) || [];
|
|
158
166
|
const deleteKeys = resetAll ? keys : keys.filter(key => key.startsWith('wc@'));
|
|
@@ -165,6 +173,7 @@ export default class WalletConnectService {
|
|
|
165
173
|
}
|
|
166
174
|
}
|
|
167
175
|
await _classPrivateFieldLooseBase(this, _initClient)[_initClient]();
|
|
176
|
+
_classPrivateFieldLooseBase(this, _updateSessions)[_updateSessions]();
|
|
168
177
|
}
|
|
169
178
|
async disconnect(topic) {
|
|
170
179
|
var _classPrivateFieldLoo13;
|