@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
|
@@ -65,7 +65,7 @@ export default class KoniState {
|
|
|
65
65
|
getMetaRequest(id: string): MetaRequest;
|
|
66
66
|
getSignRequest(id: string): SignRequest | undefined;
|
|
67
67
|
rpcListProviders(): Promise<ResponseRpcListProviders>;
|
|
68
|
-
rpcSend(request: RequestRpcSend, port: chrome.runtime.Port): Promise<JsonRpcResponse
|
|
68
|
+
rpcSend(request: RequestRpcSend, port: chrome.runtime.Port): Promise<JsonRpcResponse<unknown>>;
|
|
69
69
|
rpcStartProvider(key: string, port: chrome.runtime.Port): Promise<ProviderMeta>;
|
|
70
70
|
rpcSubscribe({ method, params, type }: RequestRpcSubscribe, cb: ProviderInterfaceCallback, port: chrome.runtime.Port): Promise<number | string>;
|
|
71
71
|
rpcSubscribeConnected(_request: null, cb: ProviderInterfaceCallback, port: chrome.runtime.Port): void;
|
|
@@ -133,6 +133,8 @@ export default class KoniState {
|
|
|
133
133
|
setTheme(theme: ThemeNames, callback?: (settingData: UiSettings) => void): void;
|
|
134
134
|
setBrowserConfirmationType(browserConfirmationType: BrowserConfirmationType, callback?: (settingData: UiSettings) => void): void;
|
|
135
135
|
setCamera(value: boolean): void;
|
|
136
|
+
setAutoLockTime(value: number): void;
|
|
137
|
+
setEnableChainPatrol(value: boolean): void;
|
|
136
138
|
subscribeSettingsSubject(): Subject<RequestSettingsType>;
|
|
137
139
|
getAccountAddress(): string | null;
|
|
138
140
|
getDecodedAddresses(address?: string): string[];
|
|
@@ -221,5 +223,6 @@ export default class KoniState {
|
|
|
221
223
|
onAccountRemove(): void;
|
|
222
224
|
reloadNft(): Promise<boolean>;
|
|
223
225
|
reloadStaking(): Promise<boolean>;
|
|
226
|
+
resetWallet(resetAll: boolean): Promise<void>;
|
|
224
227
|
}
|
|
225
228
|
export {};
|
|
@@ -198,7 +198,6 @@ export default class KoniState {
|
|
|
198
198
|
this.onReady();
|
|
199
199
|
this.onAccountAdd();
|
|
200
200
|
this.onAccountRemove();
|
|
201
|
-
this.logger.log('Done init state');
|
|
202
201
|
}
|
|
203
202
|
startSubscription() {
|
|
204
203
|
this.dbService.subscribeChainStakingMetadata([], data => {
|
|
@@ -214,7 +213,6 @@ export default class KoniState {
|
|
|
214
213
|
this.historyService.start().catch(console.error);
|
|
215
214
|
this.priceService.start().catch(console.error);
|
|
216
215
|
this.ready = true;
|
|
217
|
-
this.logger.log('State is ready');
|
|
218
216
|
}
|
|
219
217
|
isReady() {
|
|
220
218
|
return this.ready;
|
|
@@ -607,7 +605,24 @@ export default class KoniState {
|
|
|
607
605
|
...settings,
|
|
608
606
|
camera: value
|
|
609
607
|
};
|
|
610
|
-
|
|
608
|
+
this.settingService.setSettings(newSettings);
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
setAutoLockTime(value) {
|
|
612
|
+
this.settingService.getSettings(settings => {
|
|
613
|
+
const newSettings = {
|
|
614
|
+
...settings,
|
|
615
|
+
timeAutoLock: value
|
|
616
|
+
};
|
|
617
|
+
this.settingService.setSettings(newSettings);
|
|
618
|
+
});
|
|
619
|
+
}
|
|
620
|
+
setEnableChainPatrol(value) {
|
|
621
|
+
this.settingService.getSettings(settings => {
|
|
622
|
+
const newSettings = {
|
|
623
|
+
...settings,
|
|
624
|
+
enableChainPatrol: value
|
|
625
|
+
};
|
|
611
626
|
this.settingService.setSettings(newSettings);
|
|
612
627
|
});
|
|
613
628
|
}
|
|
@@ -1426,4 +1441,16 @@ export default class KoniState {
|
|
|
1426
1441
|
async reloadStaking() {
|
|
1427
1442
|
return await this.cron.reloadStaking();
|
|
1428
1443
|
}
|
|
1444
|
+
async resetWallet(resetAll) {
|
|
1445
|
+
this.keyringService.resetWallet(resetAll);
|
|
1446
|
+
this.requestService.resetWallet();
|
|
1447
|
+
this.transactionService.resetWallet();
|
|
1448
|
+
await this.dbService.resetWallet(resetAll);
|
|
1449
|
+
this.accountRefStore.set('refList', []);
|
|
1450
|
+
if (resetAll) {
|
|
1451
|
+
this.settingService.resetWallet();
|
|
1452
|
+
}
|
|
1453
|
+
this.chainService.resetWallet(resetAll);
|
|
1454
|
+
await this.chainService.init();
|
|
1455
|
+
}
|
|
1429
1456
|
}
|
|
@@ -3,6 +3,7 @@ import { AuthUrlInfo } from '@subwallet/extension-base/background/handlers/State
|
|
|
3
3
|
import { MessageTypes, RequestTypes, ResponseTypes } from '@subwallet/extension-base/background/types';
|
|
4
4
|
import KoniState from '@subwallet/extension-base/koni/background/handlers/State';
|
|
5
5
|
import { RequestArguments } from 'web3-core';
|
|
6
|
+
export declare const chainPatrolCheckUrl: (url: string) => Promise<boolean>;
|
|
6
7
|
export default class KoniTabs {
|
|
7
8
|
#private;
|
|
8
9
|
private evmEventEmitterMap;
|
|
@@ -11,6 +11,7 @@ import RequestExtrinsicSign from '@subwallet/extension-base/background/RequestEx
|
|
|
11
11
|
import { ALL_ACCOUNT_KEY, CRON_GET_API_MAP_STATUS } from '@subwallet/extension-base/constants';
|
|
12
12
|
import { PHISHING_PAGE_REDIRECT } from '@subwallet/extension-base/defaults';
|
|
13
13
|
import { _generateCustomProviderKey } from '@subwallet/extension-base/services/chain-service/utils';
|
|
14
|
+
import { DEFAULT_CHAIN_PATROL_ENABLE } from '@subwallet/extension-base/services/setting-service/constants';
|
|
14
15
|
import { canDerive } from '@subwallet/extension-base/utils';
|
|
15
16
|
import keyring from '@subwallet/ui-keyring';
|
|
16
17
|
import Web3 from 'web3';
|
|
@@ -63,11 +64,35 @@ function transformAccountsV2(accounts, anyType = false, authInfo, accountAuthTyp
|
|
|
63
64
|
type
|
|
64
65
|
}));
|
|
65
66
|
}
|
|
67
|
+
// check if a URL is blocked
|
|
68
|
+
export const chainPatrolCheckUrl = async url => {
|
|
69
|
+
const response = await fetch('https://app.chainpatrol.io/api/v2/asset/check', {
|
|
70
|
+
method: 'POST',
|
|
71
|
+
headers: {
|
|
72
|
+
'Content-Type': 'application/json',
|
|
73
|
+
'X-API-KEY': 'e5e88cd0-7994-4667-9071-bab849c2ba71'
|
|
74
|
+
},
|
|
75
|
+
body: JSON.stringify({
|
|
76
|
+
type: 'URL',
|
|
77
|
+
content: url
|
|
78
|
+
})
|
|
79
|
+
});
|
|
80
|
+
const data = await response.json();
|
|
81
|
+
return data.status === 'BLOCKED';
|
|
82
|
+
};
|
|
66
83
|
export default class KoniTabs {
|
|
67
84
|
#koniState;
|
|
68
85
|
evmEventEmitterMap = {};
|
|
86
|
+
#chainPatrolService = DEFAULT_CHAIN_PATROL_ENABLE;
|
|
69
87
|
constructor(koniState) {
|
|
70
88
|
this.#koniState = koniState;
|
|
89
|
+
const updateChainPatrolService = rs => {
|
|
90
|
+
this.#chainPatrolService = rs.enableChainPatrol;
|
|
91
|
+
};
|
|
92
|
+
this.#koniState.settingService.getSettings(updateChainPatrolService);
|
|
93
|
+
this.#koniState.settingService.getSubject().subscribe({
|
|
94
|
+
next: updateChainPatrolService
|
|
95
|
+
});
|
|
71
96
|
}
|
|
72
97
|
|
|
73
98
|
/// Clone from Polkadot.js
|
|
@@ -160,6 +185,13 @@ export default class KoniTabs {
|
|
|
160
185
|
this.redirectPhishingLanding(url);
|
|
161
186
|
return true;
|
|
162
187
|
}
|
|
188
|
+
if (this.#chainPatrolService) {
|
|
189
|
+
const isInChainPatrolDenyList = await chainPatrolCheckUrl(url);
|
|
190
|
+
if (isInChainPatrolDenyList) {
|
|
191
|
+
this.redirectPhishingLanding(url);
|
|
192
|
+
return true;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
163
195
|
return false;
|
|
164
196
|
}
|
|
165
197
|
|
|
@@ -649,7 +681,6 @@ export default class KoniTabs {
|
|
|
649
681
|
const {
|
|
650
682
|
method
|
|
651
683
|
} = request;
|
|
652
|
-
console.log('method: ' + method);
|
|
653
684
|
try {
|
|
654
685
|
switch (method) {
|
|
655
686
|
case 'eth_chainId':
|
|
@@ -46,11 +46,12 @@ export default function handlers({
|
|
|
46
46
|
const sender = port.sender;
|
|
47
47
|
const from = isExtension ? 'extension' : sender.tab && sender.tab.url || sender.url || '<unknown>';
|
|
48
48
|
const source = `${from}: ${id}: ${message}`;
|
|
49
|
-
|
|
49
|
+
|
|
50
|
+
// console.log(` [in] ${source}`); // :: ${JSON.stringify(request)}`);
|
|
50
51
|
|
|
51
52
|
const promise = isMobile ? mobile.handle(id, message, request, port) : isExtension ? extension.handle(id, message, request, port) : tabs.handle(id, message, request, from, port);
|
|
52
53
|
promise.then(response => {
|
|
53
|
-
console.log(`[out] ${source}`); // :: ${JSON.stringify(response)}`);
|
|
54
|
+
// console.log(`[out] ${source}`); // :: ${JSON.stringify(response)}`);
|
|
54
55
|
|
|
55
56
|
// between the start and the end of the promise, the user may have closed
|
|
56
57
|
// the tab, in which case port will be undefined
|
|
@@ -17,7 +17,6 @@ export declare class KoniSubscription {
|
|
|
17
17
|
stopAllSubscription(): void;
|
|
18
18
|
start(): void;
|
|
19
19
|
stop(): void;
|
|
20
|
-
init(): void;
|
|
21
20
|
subscribeBalancesAndCrowdloans(address: string, chainInfoMap: Record<string, _ChainInfo>, chainStateMap: Record<string, _ChainState>, substrateApiMap: Record<string, _SubstrateApi>, web3ApiMap: Record<string, _EvmApi>, onlyRunOnFirstTime?: boolean): void;
|
|
22
21
|
subscribeStakingOnChain(address: string, substrateApiMap: Record<string, _SubstrateApi>, onlyRunOnFirstTime?: boolean): void;
|
|
23
22
|
initStakingOnChainSubscription(addresses: string[], substrateApiMap: Record<string, _SubstrateApi>, onlyRunOnFirstTime?: boolean): (() => void) | undefined;
|
|
@@ -25,7 +25,6 @@ export class KoniSubscription {
|
|
|
25
25
|
this.dbService = dbService;
|
|
26
26
|
this.state = state;
|
|
27
27
|
this.logger = createLogger('Subscription');
|
|
28
|
-
this.init();
|
|
29
28
|
}
|
|
30
29
|
getSubscriptionMap() {
|
|
31
30
|
return this.subscriptionMap;
|
|
@@ -54,7 +53,6 @@ export class KoniSubscription {
|
|
|
54
53
|
}
|
|
55
54
|
start() {
|
|
56
55
|
var _this$state$keyringSe;
|
|
57
|
-
this.logger.log('Starting subscription');
|
|
58
56
|
const currentAddress = (_this$state$keyringSe = this.state.keyringService.currentAccount) === null || _this$state$keyringSe === void 0 ? void 0 : _this$state$keyringSe.address;
|
|
59
57
|
if (currentAddress) {
|
|
60
58
|
this.subscribeBalancesAndCrowdloans(currentAddress, this.state.getChainInfoMap(), this.state.getChainStateMap(), this.state.getSubstrateApiMap(), this.state.getEvmApiMap());
|
|
@@ -67,7 +65,6 @@ export class KoniSubscription {
|
|
|
67
65
|
if (!needReload) {
|
|
68
66
|
return;
|
|
69
67
|
}
|
|
70
|
-
this.logger.log('ServiceInfo updated, restarting...');
|
|
71
68
|
const address = (_serviceInfo$currentA = serviceInfo.currentAccountInfo) === null || _serviceInfo$currentA === void 0 ? void 0 : _serviceInfo$currentA.address;
|
|
72
69
|
if (!address) {
|
|
73
70
|
return;
|
|
@@ -78,34 +75,12 @@ export class KoniSubscription {
|
|
|
78
75
|
this.state.eventService.onLazy(this.eventHandler);
|
|
79
76
|
}
|
|
80
77
|
stop() {
|
|
81
|
-
this.logger.log('Stopping subscription');
|
|
82
78
|
if (this.eventHandler) {
|
|
83
79
|
this.state.eventService.offLazy(this.eventHandler);
|
|
84
80
|
this.eventHandler = undefined;
|
|
85
81
|
}
|
|
86
82
|
this.stopAllSubscription();
|
|
87
83
|
}
|
|
88
|
-
init() {
|
|
89
|
-
this.state.getAuthorize(value => {
|
|
90
|
-
const authString = localStorage.getItem('authUrls') || '{}';
|
|
91
|
-
const previousAuth = JSON.parse(authString);
|
|
92
|
-
if (previousAuth && Object.keys(previousAuth).length) {
|
|
93
|
-
Object.keys(previousAuth).forEach(url => {
|
|
94
|
-
if (previousAuth[url].isAllowed) {
|
|
95
|
-
previousAuth[url].isAllowedMap = this.state.getAddressList(true);
|
|
96
|
-
} else {
|
|
97
|
-
previousAuth[url].isAllowedMap = this.state.getAddressList();
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
const migrateValue = {
|
|
102
|
-
...previousAuth,
|
|
103
|
-
...value
|
|
104
|
-
};
|
|
105
|
-
this.state.setAuthorize(migrateValue);
|
|
106
|
-
localStorage.setItem('authUrls', '{}');
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
84
|
subscribeBalancesAndCrowdloans(address, chainInfoMap, chainStateMap, substrateApiMap, web3ApiMap, onlyRunOnFirstTime) {
|
|
110
85
|
this.state.handleSwitchAccount(address).then(() => {
|
|
111
86
|
const addresses = this.state.getDecodedAddresses(address);
|
|
@@ -254,7 +229,6 @@ export class KoniSubscription {
|
|
|
254
229
|
if (dataFromApi[chainInfo.slug]) {
|
|
255
230
|
this.state.updateChainStakingMetadata(dataFromApi[chainInfo.slug]);
|
|
256
231
|
} else {
|
|
257
|
-
console.warn('Not found staking data from api', chainInfo.slug);
|
|
258
232
|
const chainStakingMetadata = await getChainStakingMetadata(chainInfo, substrateApiMap[chainInfo.slug]);
|
|
259
233
|
this.state.updateChainStakingMetadata(chainStakingMetadata);
|
|
260
234
|
}
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"./cjs/detectPackage.js"
|
|
18
18
|
],
|
|
19
19
|
"type": "module",
|
|
20
|
-
"version": "1.0.
|
|
20
|
+
"version": "1.0.5-1",
|
|
21
21
|
"main": "./cjs/index.js",
|
|
22
22
|
"module": "./index.js",
|
|
23
23
|
"types": "./index.d.ts",
|
|
@@ -1190,11 +1190,21 @@
|
|
|
1190
1190
|
"require": "./cjs/services/history-service/index.js",
|
|
1191
1191
|
"default": "./services/history-service/index.js"
|
|
1192
1192
|
},
|
|
1193
|
+
"./services/history-service/helpers/recoverHistoryStatus": {
|
|
1194
|
+
"types": "./services/history-service/helpers/recoverHistoryStatus.d.ts",
|
|
1195
|
+
"require": "./cjs/services/history-service/helpers/recoverHistoryStatus.js",
|
|
1196
|
+
"default": "./services/history-service/helpers/recoverHistoryStatus.js"
|
|
1197
|
+
},
|
|
1193
1198
|
"./services/history-service/subsquid-multi-chain-history": {
|
|
1194
1199
|
"types": "./services/history-service/subsquid-multi-chain-history.d.ts",
|
|
1195
1200
|
"require": "./cjs/services/history-service/subsquid-multi-chain-history.js",
|
|
1196
1201
|
"default": "./services/history-service/subsquid-multi-chain-history.js"
|
|
1197
1202
|
},
|
|
1203
|
+
"./services/history-service/testChainMap": {
|
|
1204
|
+
"types": "./services/history-service/testChainMap.d.ts",
|
|
1205
|
+
"require": "./cjs/services/history-service/testChainMap.js",
|
|
1206
|
+
"default": "./services/history-service/testChainMap.js"
|
|
1207
|
+
},
|
|
1198
1208
|
"./services/keyring-service": {
|
|
1199
1209
|
"types": "./services/keyring-service/index.d.ts",
|
|
1200
1210
|
"require": "./cjs/services/keyring-service/index.js",
|
|
@@ -1225,6 +1235,21 @@
|
|
|
1225
1235
|
"require": "./cjs/services/migration-service/scripts/ClearOldStorage.js",
|
|
1226
1236
|
"default": "./services/migration-service/scripts/ClearOldStorage.js"
|
|
1227
1237
|
},
|
|
1238
|
+
"./services/migration-service/scripts/MigrateAuthUrls": {
|
|
1239
|
+
"types": "./services/migration-service/scripts/MigrateAuthUrls.d.ts",
|
|
1240
|
+
"require": "./cjs/services/migration-service/scripts/MigrateAuthUrls.js",
|
|
1241
|
+
"default": "./services/migration-service/scripts/MigrateAuthUrls.js"
|
|
1242
|
+
},
|
|
1243
|
+
"./services/migration-service/scripts/MigrateAutoLock": {
|
|
1244
|
+
"types": "./services/migration-service/scripts/MigrateAutoLock.d.ts",
|
|
1245
|
+
"require": "./cjs/services/migration-service/scripts/MigrateAutoLock.js",
|
|
1246
|
+
"default": "./services/migration-service/scripts/MigrateAutoLock.js"
|
|
1247
|
+
},
|
|
1248
|
+
"./services/migration-service/scripts/MigrateChainPatrol": {
|
|
1249
|
+
"types": "./services/migration-service/scripts/MigrateChainPatrol.d.ts",
|
|
1250
|
+
"require": "./cjs/services/migration-service/scripts/MigrateChainPatrol.js",
|
|
1251
|
+
"default": "./services/migration-service/scripts/MigrateChainPatrol.js"
|
|
1252
|
+
},
|
|
1228
1253
|
"./services/migration-service/scripts/MigrateImportedToken": {
|
|
1229
1254
|
"types": "./services/migration-service/scripts/MigrateImportedToken.d.ts",
|
|
1230
1255
|
"require": "./cjs/services/migration-service/scripts/MigrateImportedToken.js",
|
|
@@ -1430,6 +1455,11 @@
|
|
|
1430
1455
|
"require": "./cjs/services/transaction-service/index.js",
|
|
1431
1456
|
"default": "./services/transaction-service/index.js"
|
|
1432
1457
|
},
|
|
1458
|
+
"./services/transaction-service/constants": {
|
|
1459
|
+
"types": "./services/transaction-service/constants.d.ts",
|
|
1460
|
+
"require": "./cjs/services/transaction-service/constants.js",
|
|
1461
|
+
"default": "./services/transaction-service/constants.js"
|
|
1462
|
+
},
|
|
1433
1463
|
"./services/transaction-service/event-parser": {
|
|
1434
1464
|
"types": "./services/transaction-service/event-parser/index.d.ts",
|
|
1435
1465
|
"require": "./cjs/services/transaction-service/event-parser/index.js",
|
|
@@ -1612,8 +1642,8 @@
|
|
|
1612
1642
|
}
|
|
1613
1643
|
},
|
|
1614
1644
|
"dependencies": {
|
|
1615
|
-
"@acala-network/api": "^
|
|
1616
|
-
"@acala-network/type-definitions": "^
|
|
1645
|
+
"@acala-network/api": "^5.0.2",
|
|
1646
|
+
"@acala-network/type-definitions": "^5.0.2",
|
|
1617
1647
|
"@apollo/client": "^3.7.14",
|
|
1618
1648
|
"@babel/runtime": "^7.20.6",
|
|
1619
1649
|
"@bifrost-finance/type-definitions": "^1.7.2",
|
|
@@ -1623,7 +1653,7 @@
|
|
|
1623
1653
|
"@digitalnative/type-definitions": "^1.1.27",
|
|
1624
1654
|
"@docknetwork/node-types": "^0.15.0",
|
|
1625
1655
|
"@edgeware/node-types": "^3.6.2-wako",
|
|
1626
|
-
"@equilab/api": "^1.14.
|
|
1656
|
+
"@equilab/api": "^1.14.25",
|
|
1627
1657
|
"@equilab/definitions": "^1.4.18",
|
|
1628
1658
|
"@ethereumjs/common": "^2.6.5",
|
|
1629
1659
|
"@ethereumjs/tx": "^4.0.2",
|
|
@@ -1634,47 +1664,43 @@
|
|
|
1634
1664
|
"@fortawesome/free-solid-svg-icons": "^6.2.1",
|
|
1635
1665
|
"@fortawesome/react-fontawesome": "^0.2.0",
|
|
1636
1666
|
"@google/model-viewer": "^2.0.2",
|
|
1637
|
-
"@interlay/interbtc-types": "^1.
|
|
1638
|
-
"@kiltprotocol/type-definitions": "^0.
|
|
1667
|
+
"@interlay/interbtc-types": "^1.12.0",
|
|
1668
|
+
"@kiltprotocol/type-definitions": "^0.32.0",
|
|
1639
1669
|
"@laminar/type-definitions": "^0.3.1",
|
|
1640
1670
|
"@metamask/safe-event-emitter": "^2.0.0",
|
|
1641
1671
|
"@metaverse-network-sdk/type-definitions": "^0.0.1-13",
|
|
1642
1672
|
"@oak-foundation/api-augment": "^0.0.23",
|
|
1643
1673
|
"@oak-foundation/types": "^0.0.23",
|
|
1644
|
-
"@parallel-finance/type-definitions": "^1.7.
|
|
1645
|
-
"@phala/typedefs": "^0.2.
|
|
1646
|
-
"@polkadot/api": "^
|
|
1647
|
-
"@polkadot/api-contract": "^
|
|
1648
|
-
"@polkadot/api-derive": "^
|
|
1649
|
-
"@polkadot/hw-ledger": "^
|
|
1650
|
-
"@polkadot/
|
|
1651
|
-
"@polkadot/
|
|
1652
|
-
"@polkadot/
|
|
1653
|
-
"@polkadot/
|
|
1654
|
-
"@polkadot/
|
|
1655
|
-
"@polkadot/
|
|
1656
|
-
"@polkadot/
|
|
1657
|
-
"@polkadot/
|
|
1658
|
-
"@polkadot/ui-keyring": "^2.9.14",
|
|
1659
|
-
"@polkadot/ui-settings": "^2.9.14",
|
|
1660
|
-
"@polkadot/util": "^10.2.1",
|
|
1661
|
-
"@polkadot/util-crypto": "^10.2.1",
|
|
1674
|
+
"@parallel-finance/type-definitions": "^1.7.17",
|
|
1675
|
+
"@phala/typedefs": "^0.2.33",
|
|
1676
|
+
"@polkadot/api": "^10.7.1",
|
|
1677
|
+
"@polkadot/api-contract": "^10.7.1",
|
|
1678
|
+
"@polkadot/api-derive": "^10.7.1",
|
|
1679
|
+
"@polkadot/hw-ledger": "^12.2.1",
|
|
1680
|
+
"@polkadot/networks": "^12.2.1",
|
|
1681
|
+
"@polkadot/phishing": "^0.21.3",
|
|
1682
|
+
"@polkadot/rpc-provider": "^10.7.1",
|
|
1683
|
+
"@polkadot/types": "^10.7.1",
|
|
1684
|
+
"@polkadot/types-augment": "^10.7.1",
|
|
1685
|
+
"@polkadot/ui-settings": "^3.4.1",
|
|
1686
|
+
"@polkadot/util": "^12.2.1",
|
|
1687
|
+
"@polkadot/util-crypto": "^12.2.1",
|
|
1662
1688
|
"@polymathnetwork/polymesh-types": "^0.0.2",
|
|
1663
1689
|
"@ramonak/react-progress-bar": "^5.0.3",
|
|
1664
1690
|
"@reduxjs/toolkit": "^1.9.1",
|
|
1665
1691
|
"@snowfork/snowbridge-types": "^0.2.7",
|
|
1666
|
-
"@sora-substrate/type-definitions": "^1.
|
|
1692
|
+
"@sora-substrate/type-definitions": "^1.17.7",
|
|
1667
1693
|
"@subsocial/types": "^0.6.8",
|
|
1668
|
-
"@substrate/connect": "^0.7.
|
|
1694
|
+
"@substrate/connect": "^0.7.26",
|
|
1669
1695
|
"@subwallet/chain-list": "^0.1.2",
|
|
1670
|
-
"@subwallet/extension-base": "^1.0.
|
|
1671
|
-
"@subwallet/extension-chains": "^1.0.
|
|
1672
|
-
"@subwallet/extension-dapp": "^1.0.
|
|
1673
|
-
"@subwallet/extension-inject": "^1.0.
|
|
1674
|
-
"@subwallet/keyring": "^0.0.
|
|
1675
|
-
"@subwallet/ui-keyring": "^0.0.
|
|
1696
|
+
"@subwallet/extension-base": "^1.0.5-1",
|
|
1697
|
+
"@subwallet/extension-chains": "^1.0.5-1",
|
|
1698
|
+
"@subwallet/extension-dapp": "^1.0.5-1",
|
|
1699
|
+
"@subwallet/extension-inject": "^1.0.5-1",
|
|
1700
|
+
"@subwallet/keyring": "^0.0.9",
|
|
1701
|
+
"@subwallet/ui-keyring": "^0.0.9",
|
|
1676
1702
|
"@unique-nft/types": "^0.6.0-4",
|
|
1677
|
-
"@zeitgeistpm/type-defs": "^0.
|
|
1703
|
+
"@zeitgeistpm/type-defs": "^1.0.0",
|
|
1678
1704
|
"@zeroio/type-definitions": "^0.0.14",
|
|
1679
1705
|
"axios": "^1.2.1",
|
|
1680
1706
|
"bignumber.js": "^9.1.1",
|
|
@@ -1696,16 +1722,16 @@
|
|
|
1696
1722
|
"is-buffer": "^2.0.5",
|
|
1697
1723
|
"json-rpc-engine": "^6.1.0",
|
|
1698
1724
|
"moment": "^2.29.4",
|
|
1699
|
-
"moonbeam-types-bundle": "^2.0.
|
|
1725
|
+
"moonbeam-types-bundle": "^2.0.10",
|
|
1700
1726
|
"phosphor-react": "^1.4.1",
|
|
1701
1727
|
"pontem-types-bundle": "^1.0.15",
|
|
1702
1728
|
"protobufjs": "^7.1.2",
|
|
1703
1729
|
"rlp": "^3.0.0",
|
|
1704
1730
|
"rxjs": "^7.8.0",
|
|
1705
|
-
"web3": "^1.
|
|
1706
|
-
"web3-core": "^1.
|
|
1707
|
-
"web3-core-helpers": "^1.
|
|
1708
|
-
"web3-eth-contract": "^1.
|
|
1709
|
-
"web3-utils": "^1.
|
|
1731
|
+
"web3": "^1.10.0",
|
|
1732
|
+
"web3-core": "^1.10.0",
|
|
1733
|
+
"web3-core-helpers": "^1.10.0",
|
|
1734
|
+
"web3-eth-contract": "^1.10.0",
|
|
1735
|
+
"web3-utils": "^1.10.0"
|
|
1710
1736
|
}
|
|
1711
1737
|
}
|
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.0.
|
|
10
|
+
version: '1.0.5-1'
|
|
11
11
|
};
|
|
@@ -208,6 +208,6 @@ const TARGET_BRANCH = process.env.NODE_ENV !== 'production' ? 'koni-dev' : 'mast
|
|
|
208
208
|
export const _CHAIN_INFO_SRC = `https://raw.githubusercontent.com/Koniverse/SubWallet-Chain/${TARGET_BRANCH}/packages/chain-list/src/data/ChainInfo.json`;
|
|
209
209
|
export const _CHAIN_ASSET_SRC = `https://raw.githubusercontent.com/Koniverse/SubWallet-Chain/${TARGET_BRANCH}/packages/chain-list/src/data/ChainAsset.json`;
|
|
210
210
|
export const _ASSET_REF_SRC = `https://raw.githubusercontent.com/Koniverse/SubWallet-Chain/${TARGET_BRANCH}/packages/chain-list/src/data/AssetRef.json`;
|
|
211
|
-
export const _MULTI_CHAIN_ASSET_SRC = `https://raw.githubusercontent.com/Koniverse/SubWallet-Chain/${TARGET_BRANCH}/packages/chain-list/src/data/
|
|
211
|
+
export const _MULTI_CHAIN_ASSET_SRC = `https://raw.githubusercontent.com/Koniverse/SubWallet-Chain/${TARGET_BRANCH}/packages/chain-list/src/data/MultiChainAsset.json`;
|
|
212
212
|
export const _CHAIN_LOGO_MAP_SRC = `https://raw.githubusercontent.com/Koniverse/SubWallet-Chain/${TARGET_BRANCH}/packages/chain-list/src/data/ChainLogoMap.json`;
|
|
213
213
|
export const _ASSET_LOGO_MAP_SRC = `https://raw.githubusercontent.com/Koniverse/SubWallet-Chain/${TARGET_BRANCH}/packages/chain-list/src/data/AssetLogoMap.json`;
|
|
@@ -30,7 +30,6 @@ export class SubstrateChainHandler {
|
|
|
30
30
|
resumeAllApis() {
|
|
31
31
|
return Promise.all(Object.values(this.getSubstrateApiMap()).map(async substrateApi => {
|
|
32
32
|
if (!substrateApi.api.isConnected && substrateApi.api.connect) {
|
|
33
|
-
this.logger.log(`[Substrate] Resuming network [${substrateApi.specName}]`);
|
|
34
33
|
await substrateApi.api.connect();
|
|
35
34
|
}
|
|
36
35
|
}));
|
|
@@ -39,7 +38,6 @@ export class SubstrateChainHandler {
|
|
|
39
38
|
return Promise.all(Object.values(this.getSubstrateApiMap()).map(async substrateApi => {
|
|
40
39
|
if (substrateApi.api.isConnected) {
|
|
41
40
|
var _substrateApi$api, _substrateApi$api2;
|
|
42
|
-
this.logger.log(`[Substrate] Stopping network [${substrateApi.chainSlug}]`);
|
|
43
41
|
((_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()));
|
|
44
42
|
}
|
|
45
43
|
}));
|
|
@@ -97,7 +95,6 @@ export class SubstrateChainHandler {
|
|
|
97
95
|
gasLimit: getDefaultWeightV2(substrateApi.api)
|
|
98
96
|
})]);
|
|
99
97
|
if (!(nameResp.result.isOk && symbolResp.result.isOk && decimalsResp.result.isOk) || !nameResp.output || !decimalsResp.output || !symbolResp.output) {
|
|
100
|
-
this.logger.error('Error response while validating WASM contract');
|
|
101
98
|
return {
|
|
102
99
|
name: '',
|
|
103
100
|
decimals: -1,
|
|
@@ -112,7 +109,7 @@ export class SubstrateChainHandler {
|
|
|
112
109
|
name = nameResp.output ? nameObj.Ok || nameObj.ok : '';
|
|
113
110
|
decimals = decimalsResp.output ? new BN(decimalsObj.Ok || decimalsObj.ok).toNumber() : 0;
|
|
114
111
|
symbol = decimalsResp.output ? symbolObj.Ok || symbolObj.ok : '';
|
|
115
|
-
if (name === '' || symbol === '') {
|
|
112
|
+
if (!name || !symbol || typeof name === 'object' || typeof symbol === 'object') {
|
|
116
113
|
contractError = true;
|
|
117
114
|
}
|
|
118
115
|
console.log('validate PSP22', name, symbol, decimals);
|
|
@@ -124,7 +121,6 @@ export class SubstrateChainHandler {
|
|
|
124
121
|
}); // read-only operation so no gas limit
|
|
125
122
|
|
|
126
123
|
if (!collectionIdResp.result.isOk || !collectionIdResp.output) {
|
|
127
|
-
this.logger.error('Error response while validating WASM contract');
|
|
128
124
|
return {
|
|
129
125
|
name: '',
|
|
130
126
|
decimals: -1,
|
|
@@ -149,7 +145,7 @@ export class SubstrateChainHandler {
|
|
|
149
145
|
contractError
|
|
150
146
|
};
|
|
151
147
|
} catch (e) {
|
|
152
|
-
this.logger.error(
|
|
148
|
+
this.logger.error(e);
|
|
153
149
|
return {
|
|
154
150
|
name: '',
|
|
155
151
|
decimals: -1,
|
|
@@ -215,7 +211,6 @@ export class SubstrateChainHandler {
|
|
|
215
211
|
defaultFormatBalance: undefined,
|
|
216
212
|
recoverConnect: () => {
|
|
217
213
|
substrateApi.apiRetry = 0;
|
|
218
|
-
this.logger.log('Recover connect to ', apiUrl);
|
|
219
214
|
provider.connect().then(this.logger.log).catch(this.logger.error);
|
|
220
215
|
},
|
|
221
216
|
get isReady() {
|
|
@@ -237,7 +232,6 @@ export class SubstrateChainHandler {
|
|
|
237
232
|
}
|
|
238
233
|
};
|
|
239
234
|
api.on('connected', () => {
|
|
240
|
-
this.logger.log('Substrate API connected to ', apiUrl);
|
|
241
235
|
substrateApi.apiRetry = 0;
|
|
242
236
|
if (substrateApi.isApiReadyOnce) {
|
|
243
237
|
substrateApi.isApiReady = true;
|
|
@@ -255,7 +249,6 @@ export class SubstrateChainHandler {
|
|
|
255
249
|
}
|
|
256
250
|
});
|
|
257
251
|
api.on('ready', () => {
|
|
258
|
-
this.logger.log('Substrate API ready with', apiUrl);
|
|
259
252
|
this.loadOnReady(registry, api).then(rs => {
|
|
260
253
|
objectSpread(substrateApi, rs);
|
|
261
254
|
}).catch(error => {
|
|
@@ -307,7 +300,7 @@ export class SubstrateChainHandler {
|
|
|
307
300
|
const tokenSymbol = properties.tokenSymbol.unwrapOr([formatBalance.getDefaults().unit, ...DEFAULT_AUX]);
|
|
308
301
|
const tokenDecimals = properties.tokenDecimals.unwrapOr([DEFAULT_DECIMALS]);
|
|
309
302
|
const isDevelopment = systemChainType.isDevelopment || systemChainType.isLocal || isTestChain(systemChain);
|
|
310
|
-
this.logger.log(`
|
|
303
|
+
this.logger.log(`Connected to ${systemChain} (${systemChainType.toString()}), ${stringify(properties)}`);
|
|
311
304
|
|
|
312
305
|
// explicitly override the ss58Format as specified
|
|
313
306
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
// Copyright 2019-2022 @subwallet/extension-base authors & contributors
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
+
import * as Sc from '@substrate/connect';
|
|
5
|
+
import { WellKnownChain } from '@substrate/connect';
|
|
4
6
|
import { ScProvider } from '@polkadot/rpc-provider';
|
|
5
7
|
export const relayChainSpecs = {
|
|
6
|
-
kusama:
|
|
7
|
-
polkadot:
|
|
8
|
-
rococo:
|
|
9
|
-
westend:
|
|
8
|
+
kusama: WellKnownChain.ksmcc3,
|
|
9
|
+
polkadot: WellKnownChain.polkadot,
|
|
10
|
+
rococo: WellKnownChain.rococo_v2_2,
|
|
11
|
+
westend: WellKnownChain.westend2
|
|
10
12
|
};
|
|
11
13
|
|
|
12
14
|
// Direct get spec data from @polkadot/react-api repository
|
|
@@ -97,14 +99,14 @@ class ProviderPlaceholder {
|
|
|
97
99
|
export function getSubstrateConnectProvider(specLink) {
|
|
98
100
|
const [relayName, paraName] = specLink.split('/');
|
|
99
101
|
const relaySpec = relayChainSpecs[relayName];
|
|
100
|
-
const relayProvider = new ScProvider(relaySpec);
|
|
102
|
+
const relayProvider = new ScProvider(Sc, relaySpec);
|
|
101
103
|
if (!paraName) {
|
|
102
104
|
return relayProvider;
|
|
103
105
|
}
|
|
104
106
|
const paraChainData = paraChainSpecs[specLink];
|
|
105
107
|
let scProvider;
|
|
106
108
|
const scPromise = fetch(paraChainData).then(rs => rs.text()).then(spec => {
|
|
107
|
-
scProvider = new ScProvider(
|
|
109
|
+
scProvider = new ScProvider(Sc, spec);
|
|
108
110
|
return scProvider;
|
|
109
111
|
}).catch(console.error);
|
|
110
112
|
return new ProviderPlaceholder(scPromise);
|
|
@@ -5,7 +5,7 @@ declare const _default: {
|
|
|
5
5
|
council: string[];
|
|
6
6
|
};
|
|
7
7
|
types: {
|
|
8
|
-
minmax: [
|
|
8
|
+
minmax: number[] | [(number | undefined)?, (number | undefined)?] | [number, number];
|
|
9
9
|
types: {
|
|
10
10
|
Keys: string;
|
|
11
11
|
};
|
|
@@ -18,7 +18,7 @@ declare const _default: {
|
|
|
18
18
|
council: string[];
|
|
19
19
|
};
|
|
20
20
|
types: {
|
|
21
|
-
minmax: [
|
|
21
|
+
minmax: number[] | [(number | undefined)?, (number | undefined)?] | [number, number];
|
|
22
22
|
types: {
|
|
23
23
|
Keys: string;
|
|
24
24
|
};
|
|
@@ -31,7 +31,7 @@ declare const _default: {
|
|
|
31
31
|
council: string[];
|
|
32
32
|
};
|
|
33
33
|
types: {
|
|
34
|
-
minmax: [
|
|
34
|
+
minmax: number[] | [(number | undefined)?, (number | undefined)?] | [number, number];
|
|
35
35
|
types: {
|
|
36
36
|
Keys: string;
|
|
37
37
|
};
|
|
@@ -100,9 +100,10 @@ export declare class ChainService {
|
|
|
100
100
|
setAssetSettings(assetSettings: Record<string, AssetSetting>, emitEvent?: boolean): void;
|
|
101
101
|
getStoreAssetSettings(): Promise<Record<string, AssetSetting>>;
|
|
102
102
|
getAssetSettings(): Promise<Record<string, AssetSetting>>;
|
|
103
|
-
updateAssetSetting(assetSlug: string, assetSetting: AssetSetting): Promise<boolean | undefined>;
|
|
103
|
+
updateAssetSetting(assetSlug: string, assetSetting: AssetSetting, autoEnableNativeToken?: boolean): Promise<boolean | undefined>;
|
|
104
104
|
updateAssetSettingByChain(chainSlug: string, visible: boolean): Promise<void>;
|
|
105
105
|
subscribeAssetSettings(): BehaviorSubject<Record<string, AssetSetting>>;
|
|
106
106
|
getChainLogoMap(): Promise<Record<string, string>>;
|
|
107
107
|
getAssetLogoMap(): Promise<Record<string, string>>;
|
|
108
|
+
resetWallet(resetAll: boolean): void;
|
|
108
109
|
}
|