@subwallet/extension-base 1.0.2-1b → 1.0.2-3
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 +31 -5
- package/background/KoniTypes.js +2 -1
- package/background/errors/TransactionError.js +4 -0
- package/background/types.d.ts +10 -5
- package/cjs/background/KoniTypes.js +2 -1
- package/cjs/background/errors/TransactionError.js +4 -0
- package/cjs/koni/api/dotsama/transfer.js +6 -12
- package/cjs/koni/api/nft/acala_nft/index.js +7 -10
- package/cjs/koni/api/nft/bit.country/index.js +7 -9
- package/cjs/koni/api/nft/evm_nft/index.js +2 -1
- package/cjs/koni/api/nft/karura_nft/index.js +7 -9
- package/cjs/koni/api/nft/rmrk_nft/index.js +4 -1
- package/cjs/koni/api/nft/statemine_nft/index.js +7 -9
- package/cjs/koni/api/nft/unique_nft/index.js +5 -6
- package/cjs/koni/api/nft/wasm_nft/index.js +2 -1
- package/cjs/koni/api/staking/bonding/relayChain.js +3 -0
- package/cjs/koni/background/cron.js +53 -46
- package/cjs/koni/background/handlers/Extension.js +292 -159
- package/cjs/koni/background/handlers/State.js +24 -14
- package/cjs/koni/background/handlers/Tabs.js +42 -16
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/chain-service/handler/light-client/index.js +0 -2
- package/cjs/services/chain-service/index.js +53 -38
- package/cjs/services/history-service/index.js +3 -3
- package/cjs/services/history-service/subsquid-multi-chain-history.js +1 -1
- package/cjs/services/keyring-service/index.js +11 -13
- package/cjs/services/request-service/handler/AuthRequestHandler.js +7 -5
- package/cjs/services/request-service/handler/EvmRequestHandler.js +8 -12
- package/cjs/services/request-service/index.js +14 -5
- package/cjs/services/storage-service/DatabaseService.js +8 -5
- package/cjs/services/storage-service/db-stores/Nft.js +9 -4
- package/cjs/services/transaction-service/index.js +3 -1
- package/cjs/utils/address.js +10 -1
- package/cjs/utils/index.js +2 -1
- package/koni/api/dotsama/transfer.js +6 -12
- package/koni/api/nft/acala_nft/index.js +7 -9
- package/koni/api/nft/bit.country/index.js +7 -8
- package/koni/api/nft/evm_nft/index.js +2 -1
- package/koni/api/nft/index.d.ts +1 -1
- package/koni/api/nft/karura_nft/index.js +7 -8
- package/koni/api/nft/nft.d.ts +1 -1
- package/koni/api/nft/rmrk_nft/index.js +4 -1
- package/koni/api/nft/statemine_nft/index.js +7 -8
- package/koni/api/nft/unique_nft/index.js +5 -5
- package/koni/api/nft/wasm_nft/index.js +2 -1
- package/koni/api/staking/bonding/relayChain.js +3 -0
- package/koni/background/cron.js +53 -46
- package/koni/background/handlers/Extension.d.ts +6 -1
- package/koni/background/handlers/Extension.js +203 -73
- package/koni/background/handlers/State.d.ts +1 -1
- package/koni/background/handlers/State.js +26 -14
- package/koni/background/handlers/Tabs.js +42 -16
- package/package.json +13 -13
- package/packageInfo.js +1 -1
- package/services/chain-service/handler/light-client/index.d.ts +1 -17
- package/services/chain-service/handler/light-client/index.js +1 -1
- package/services/chain-service/index.d.ts +3 -2
- package/services/chain-service/index.js +47 -33
- package/services/chain-service/types.d.ts +1 -0
- package/services/history-service/index.d.ts +3 -1
- package/services/history-service/index.js +3 -3
- package/services/history-service/subsquid-multi-chain-history.js +1 -1
- package/services/keyring-service/index.d.ts +4 -2
- package/services/keyring-service/index.js +11 -13
- package/services/request-service/handler/AuthRequestHandler.d.ts +3 -1
- package/services/request-service/handler/AuthRequestHandler.js +7 -5
- package/services/request-service/handler/EvmRequestHandler.js +8 -12
- package/services/request-service/index.d.ts +3 -1
- package/services/request-service/index.js +14 -5
- package/services/storage-service/DatabaseService.d.ts +1 -1
- package/services/storage-service/DatabaseService.js +8 -5
- package/services/storage-service/db-stores/Nft.d.ts +2 -1
- package/services/storage-service/db-stores/Nft.js +9 -4
- package/services/transaction-service/index.js +3 -1
- package/utils/address.d.ts +3 -0
- package/utils/address.js +8 -1
- package/utils/index.d.ts +1 -1
- package/utils/index.js +1 -1
|
@@ -2,15 +2,14 @@
|
|
|
2
2
|
import { _AssetRef, _AssetType, _ChainAsset, _ChainInfo, _MultiChainAsset } from '@subwallet/chain-list/types';
|
|
3
3
|
import { TransactionError } from '@subwallet/extension-base/background/errors/TransactionError';
|
|
4
4
|
import { AuthUrls, Resolver } from '@subwallet/extension-base/background/handlers/State';
|
|
5
|
-
import { AccountAuthType, AccountJson, AuthorizeRequest, ConfirmationRequestBase, RequestAccountList, RequestAccountSubscribe, RequestAuthorizeCancel, RequestAuthorizeReject, RequestAuthorizeSubscribe, RequestAuthorizeTab, RequestCurrentAccountAddress, ResponseAuthorizeList, ResponseJsonGetAccountInfo, SeedLengths } from '@subwallet/extension-base/background/types';
|
|
5
|
+
import { AccountAuthType, AccountJson, AddressJson, AuthorizeRequest, ConfirmationRequestBase, RequestAccountList, RequestAccountSubscribe, RequestAuthorizeCancel, RequestAuthorizeReject, RequestAuthorizeSubscribe, RequestAuthorizeTab, RequestCurrentAccountAddress, ResponseAuthorizeList, ResponseJsonGetAccountInfo, SeedLengths } from '@subwallet/extension-base/background/types';
|
|
6
6
|
import { _CHAIN_VALIDATION_ERROR } from '@subwallet/extension-base/services/chain-service/handler/types';
|
|
7
7
|
import { _ChainState, _EvmApi, _NetworkUpsertParams, _SubstrateApi, _ValidateCustomAssetRequest, _ValidateCustomAssetResponse } from '@subwallet/extension-base/services/chain-service/types';
|
|
8
8
|
import { SWTransactionResponse, SWTransactionResult } from '@subwallet/extension-base/services/transaction-service/types';
|
|
9
9
|
import { InjectedAccount, MetadataDefBase } from '@subwallet/extension-inject/types';
|
|
10
10
|
import { KeyringPair$Json, KeyringPair$Meta } from '@subwallet/keyring/types';
|
|
11
|
-
import { SingleAddress } from '@subwallet/ui-keyring/observable/types';
|
|
12
11
|
import { KeyringOptions } from '@subwallet/ui-keyring/options/types';
|
|
13
|
-
import { KeyringPairs$Json } from '@subwallet/ui-keyring/types';
|
|
12
|
+
import { KeyringAddress, KeyringPairs$Json } from '@subwallet/ui-keyring/types';
|
|
14
13
|
import Web3 from 'web3';
|
|
15
14
|
import { RequestArguments, TransactionConfig } from 'web3-core';
|
|
16
15
|
import { JsonRpcPayload, JsonRpcResponse } from 'web3-core-helpers';
|
|
@@ -439,7 +438,8 @@ export declare enum StakingTxErrorType {
|
|
|
439
438
|
EXCEED_MAX_NOMINATIONS = "EXCEED_MAX_NOMINATIONS",
|
|
440
439
|
EXIST_UNSTAKING_REQUEST = "EXIST_UNSTAKING_REQUEST",
|
|
441
440
|
INVALID_ACTIVE_STAKE = "INVALID_ACTIVE_STAKE",
|
|
442
|
-
EXCEED_MAX_UNSTAKING = "EXCEED_MAX_UNSTAKING"
|
|
441
|
+
EXCEED_MAX_UNSTAKING = "EXCEED_MAX_UNSTAKING",
|
|
442
|
+
INACTIVE_NOMINATION_POOL = "INACTIVE_NOMINATION_POOL"
|
|
443
443
|
}
|
|
444
444
|
export declare enum TransferTxErrorType {
|
|
445
445
|
NOT_ENOUGH_VALUE = "NOT_ENOUGH_VALUE",
|
|
@@ -628,6 +628,16 @@ export interface ResponseAccountCreateWithSecretKey {
|
|
|
628
628
|
errors: AccountExternalError[];
|
|
629
629
|
success: boolean;
|
|
630
630
|
}
|
|
631
|
+
export interface AddressBookInfo {
|
|
632
|
+
addresses: AddressJson[];
|
|
633
|
+
}
|
|
634
|
+
export interface RequestEditContactAccount {
|
|
635
|
+
address: string;
|
|
636
|
+
meta: KeyringPair$Meta;
|
|
637
|
+
}
|
|
638
|
+
export interface RequestDeleteContactAccount {
|
|
639
|
+
address: string;
|
|
640
|
+
}
|
|
631
641
|
export declare enum ExternalRequestPromiseStatus {
|
|
632
642
|
PENDING = 0,
|
|
633
643
|
REJECTED = 1,
|
|
@@ -749,6 +759,13 @@ export interface RequestFreeBalance {
|
|
|
749
759
|
networkKey: string;
|
|
750
760
|
token?: string;
|
|
751
761
|
}
|
|
762
|
+
export interface RequestMaxTransferable {
|
|
763
|
+
address: string;
|
|
764
|
+
networkKey: string;
|
|
765
|
+
token?: string;
|
|
766
|
+
isXcmTransfer?: boolean;
|
|
767
|
+
destChain: string;
|
|
768
|
+
}
|
|
752
769
|
export interface RequestTransferCheckReferenceCount {
|
|
753
770
|
address: string;
|
|
754
771
|
networkKey: string;
|
|
@@ -880,6 +897,7 @@ export interface AddNetworkExternalRequest {
|
|
|
880
897
|
requestId: string;
|
|
881
898
|
}
|
|
882
899
|
export interface AddTokenRequestExternal {
|
|
900
|
+
slug?: string;
|
|
883
901
|
contractAddress: string;
|
|
884
902
|
originChain: string;
|
|
885
903
|
type: _AssetType;
|
|
@@ -1229,6 +1247,10 @@ export interface KeyringState {
|
|
|
1229
1247
|
hasMasterPassword: boolean;
|
|
1230
1248
|
isLocked: boolean;
|
|
1231
1249
|
}
|
|
1250
|
+
export interface AddressBookState {
|
|
1251
|
+
contacts: AddressJson[];
|
|
1252
|
+
recent: AddressJson[];
|
|
1253
|
+
}
|
|
1232
1254
|
export interface RequestChangeMasterPassword {
|
|
1233
1255
|
oldPassword?: string;
|
|
1234
1256
|
newPassword: string;
|
|
@@ -1415,10 +1437,13 @@ export interface KoniRequestSignatures {
|
|
|
1415
1437
|
'pri(accounts.checkPublicAndSecretKey)': [RequestCheckPublicAndSecretKey, ResponseCheckPublicAndSecretKey];
|
|
1416
1438
|
'pri(accounts.subscribeWithCurrentAddress)': [RequestAccountSubscribe, AccountsWithCurrentAddress, AccountsWithCurrentAddress];
|
|
1417
1439
|
'pri(accounts.subscribeAccountsInputAddress)': [RequestAccountSubscribe, string, OptionInputAddress];
|
|
1418
|
-
'pri(accounts.saveRecent)': [RequestSaveRecentAccount,
|
|
1440
|
+
'pri(accounts.saveRecent)': [RequestSaveRecentAccount, KeyringAddress];
|
|
1419
1441
|
'pri(accounts.get.meta)': [RequestAccountMeta, ResponseAccountMeta];
|
|
1420
1442
|
'pri(accounts.updateCurrentAddress)': [string, boolean];
|
|
1421
1443
|
'pri(currentAccount.saveAddress)': [RequestCurrentAccountAddress, CurrentAccountInfo];
|
|
1444
|
+
'pri(accounts.subscribeAddresses)': [null, AddressBookInfo, AddressBookInfo];
|
|
1445
|
+
'pri(accounts.editContact)': [RequestEditContactAccount, boolean];
|
|
1446
|
+
'pri(accounts.deleteContact)': [RequestDeleteContactAccount, boolean];
|
|
1422
1447
|
'pri(settings.changeBalancesVisibility)': [null, boolean, UiSettings];
|
|
1423
1448
|
'pri(settings.subscribe)': [null, UiSettings, UiSettings];
|
|
1424
1449
|
'pri(settings.saveAccountAllLogo)': [string, boolean, UiSettings];
|
|
@@ -1429,6 +1454,7 @@ export interface KoniRequestSignatures {
|
|
|
1429
1454
|
'pri(transfer.checkReferenceCount)': [RequestTransferCheckReferenceCount, boolean];
|
|
1430
1455
|
'pri(transfer.checkSupporting)': [RequestTransferCheckSupporting, SupportTransferResponse];
|
|
1431
1456
|
'pri(transfer.getExistentialDeposit)': [RequestTransferExistentialDeposit, string];
|
|
1457
|
+
'pri(transfer.getMaxTransferable)': [RequestMaxTransferable, AmountData];
|
|
1432
1458
|
'pri(subscription.cancel)': [string, boolean];
|
|
1433
1459
|
'pri(freeBalance.get)': [RequestFreeBalance, AmountData];
|
|
1434
1460
|
'pri(freeBalance.subscribe)': [RequestFreeBalance, AmountData, AmountData];
|
package/background/KoniTypes.js
CHANGED
|
@@ -109,6 +109,7 @@ export let StakingTxErrorType;
|
|
|
109
109
|
StakingTxErrorType["EXIST_UNSTAKING_REQUEST"] = "EXIST_UNSTAKING_REQUEST";
|
|
110
110
|
StakingTxErrorType["INVALID_ACTIVE_STAKE"] = "INVALID_ACTIVE_STAKE";
|
|
111
111
|
StakingTxErrorType["EXCEED_MAX_UNSTAKING"] = "EXCEED_MAX_UNSTAKING";
|
|
112
|
+
StakingTxErrorType["INACTIVE_NOMINATION_POOL"] = "INACTIVE_NOMINATION_POOL";
|
|
112
113
|
})(StakingTxErrorType || (StakingTxErrorType = {}));
|
|
113
114
|
export let TransferTxErrorType;
|
|
114
115
|
(function (TransferTxErrorType) {
|
|
@@ -130,7 +131,7 @@ export let BalanceErrorType;
|
|
|
130
131
|
})(BalanceErrorType || (BalanceErrorType = {}));
|
|
131
132
|
export let ProviderErrorType;
|
|
132
133
|
|
|
133
|
-
|
|
134
|
+
/// Manage account
|
|
134
135
|
// Export private key
|
|
135
136
|
(function (ProviderErrorType) {
|
|
136
137
|
ProviderErrorType["CHAIN_DISCONNECTED"] = "CHAIN_DISCONNECTED";
|
|
@@ -69,6 +69,10 @@ const defaultErrorMap = {
|
|
|
69
69
|
[StakingTxErrorType.EXCEED_MAX_UNSTAKING]: {
|
|
70
70
|
message: 'Exceed max unstaking',
|
|
71
71
|
code: undefined
|
|
72
|
+
},
|
|
73
|
+
[StakingTxErrorType.INACTIVE_NOMINATION_POOL]: {
|
|
74
|
+
message: 'This nomination pool is not active',
|
|
75
|
+
code: undefined
|
|
72
76
|
}
|
|
73
77
|
};
|
|
74
78
|
export class TransactionError extends SWError {
|
package/background/types.d.ts
CHANGED
|
@@ -22,8 +22,14 @@ declare type NullKeys<T> = {
|
|
|
22
22
|
[K in keyof T]: IsNull<T, K>;
|
|
23
23
|
}[keyof T];
|
|
24
24
|
export declare type SeedLengths = 12 | 24;
|
|
25
|
-
export interface
|
|
25
|
+
export interface AbstractAddressJson extends KeyringPair$Meta {
|
|
26
26
|
address: string;
|
|
27
|
+
type?: KeypairType;
|
|
28
|
+
whenCreated?: number;
|
|
29
|
+
name?: string;
|
|
30
|
+
originGenesisHash?: string | null;
|
|
31
|
+
}
|
|
32
|
+
export interface AccountJson extends AbstractAddressJson {
|
|
27
33
|
accountIndex?: number;
|
|
28
34
|
addressOffset?: number;
|
|
29
35
|
genesisHash?: string | null;
|
|
@@ -33,12 +39,11 @@ export interface AccountJson extends KeyringPair$Meta {
|
|
|
33
39
|
isMasterAccount?: boolean;
|
|
34
40
|
isMasterPassword?: boolean;
|
|
35
41
|
isReadOnly?: boolean;
|
|
36
|
-
name?: string;
|
|
37
|
-
originGenesisHash?: string | null;
|
|
38
42
|
parentAddress?: string;
|
|
39
43
|
suri?: string;
|
|
40
|
-
|
|
41
|
-
|
|
44
|
+
}
|
|
45
|
+
export interface AddressJson extends AbstractAddressJson {
|
|
46
|
+
isRecent?: boolean;
|
|
42
47
|
}
|
|
43
48
|
export interface AccountsWithCurrentAddress {
|
|
44
49
|
accounts: AccountJson[];
|
|
@@ -115,6 +115,7 @@ exports.StakingTxErrorType = StakingTxErrorType;
|
|
|
115
115
|
StakingTxErrorType["EXIST_UNSTAKING_REQUEST"] = "EXIST_UNSTAKING_REQUEST";
|
|
116
116
|
StakingTxErrorType["INVALID_ACTIVE_STAKE"] = "INVALID_ACTIVE_STAKE";
|
|
117
117
|
StakingTxErrorType["EXCEED_MAX_UNSTAKING"] = "EXCEED_MAX_UNSTAKING";
|
|
118
|
+
StakingTxErrorType["INACTIVE_NOMINATION_POOL"] = "INACTIVE_NOMINATION_POOL";
|
|
118
119
|
})(StakingTxErrorType || (exports.StakingTxErrorType = StakingTxErrorType = {}));
|
|
119
120
|
let TransferTxErrorType;
|
|
120
121
|
exports.TransferTxErrorType = TransferTxErrorType;
|
|
@@ -137,7 +138,7 @@ exports.BalanceErrorType = BalanceErrorType;
|
|
|
137
138
|
BalanceErrorType["TIMEOUT"] = "TIMEOUT";
|
|
138
139
|
BalanceErrorType["GET_BALANCE_ERROR"] = "GET_BALANCE_ERROR";
|
|
139
140
|
})(BalanceErrorType || (exports.BalanceErrorType = BalanceErrorType = {}));
|
|
140
|
-
let ProviderErrorType;
|
|
141
|
+
let ProviderErrorType; /// Manage account
|
|
141
142
|
// Export private key
|
|
142
143
|
exports.ProviderErrorType = ProviderErrorType;
|
|
143
144
|
(function (ProviderErrorType) {
|
|
@@ -74,6 +74,10 @@ const defaultErrorMap = {
|
|
|
74
74
|
[_KoniTypes.StakingTxErrorType.EXCEED_MAX_UNSTAKING]: {
|
|
75
75
|
message: 'Exceed max unstaking',
|
|
76
76
|
code: undefined
|
|
77
|
+
},
|
|
78
|
+
[_KoniTypes.StakingTxErrorType.INACTIVE_NOMINATION_POOL]: {
|
|
79
|
+
message: 'This nomination pool is not active',
|
|
80
|
+
code: undefined
|
|
77
81
|
}
|
|
78
82
|
};
|
|
79
83
|
class TransactionError extends _SWError.SWError {
|
|
@@ -67,15 +67,17 @@ async function checkSupportTransfer(networkKey, tokenInfo, substrateApiMap, chai
|
|
|
67
67
|
supportTransferAll: true
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
|
+
|
|
71
|
+
// TODO: need review
|
|
70
72
|
if (_constants._TRANSFER_CHAIN_GROUP.acala.includes(networkKey) && !(0, _utils2._isNativeToken)(tokenInfo) && isTxCurrenciesSupported) {
|
|
71
73
|
result.supportTransfer = true;
|
|
72
|
-
result.supportTransferAll =
|
|
74
|
+
result.supportTransferAll = true;
|
|
73
75
|
} else if (_constants._TRANSFER_CHAIN_GROUP.kintsugi.includes(networkKey) && !(0, _utils2._isNativeToken)(tokenInfo) && isTxTokensSupported) {
|
|
74
76
|
result.supportTransfer = true;
|
|
75
77
|
result.supportTransferAll = true;
|
|
76
78
|
} else if (_constants._TRANSFER_CHAIN_GROUP.genshiro.includes(networkKey) && !(0, _utils2._isNativeToken)(tokenInfo) && isTxEqBalancesSupported) {
|
|
77
79
|
result.supportTransfer = true;
|
|
78
|
-
result.supportTransferAll =
|
|
80
|
+
result.supportTransferAll = true;
|
|
79
81
|
} else if (_constants._TRANSFER_CHAIN_GROUP.crab.includes(networkKey) && _constants._BALANCE_TOKEN_GROUP.crab.includes(tokenInfo.symbol)) {
|
|
80
82
|
result.supportTransfer = true;
|
|
81
83
|
result.supportTransferAll = true;
|
|
@@ -123,11 +125,7 @@ const createTransferExtrinsic = async _ref => {
|
|
|
123
125
|
}, to, value, {});
|
|
124
126
|
transferAmount = value;
|
|
125
127
|
} else if (_constants._TRANSFER_CHAIN_GROUP.acala.includes(networkKey) && !(0, _utils2._isNativeToken)(tokenInfo) && isTxCurrenciesSupported) {
|
|
126
|
-
|
|
127
|
-
// currently Acala, Karura, Acala testnet do not have transfer all method for sub token
|
|
128
|
-
} else if (value) {
|
|
129
|
-
transfer = api.tx.currencies.transfer(to, (0, _utils2._getTokenOnChainInfo)(tokenInfo), value);
|
|
130
|
-
}
|
|
128
|
+
transfer = api.tx.currencies.transfer(to, (0, _utils2._getTokenOnChainInfo)(tokenInfo), value);
|
|
131
129
|
} else if (_constants._TRANSFER_CHAIN_GROUP.kintsugi.includes(networkKey) && !(0, _utils2._isNativeToken)(tokenInfo) && isTxTokensSupported) {
|
|
132
130
|
if (transferAll) {
|
|
133
131
|
transfer = api.tx.tokens.transferAll(to, (0, _utils2._getTokenOnChainInfo)(tokenInfo), false);
|
|
@@ -135,11 +133,7 @@ const createTransferExtrinsic = async _ref => {
|
|
|
135
133
|
transfer = api.tx.tokens.transfer(to, (0, _utils2._getTokenOnChainInfo)(tokenInfo), new _util.BN(value));
|
|
136
134
|
}
|
|
137
135
|
} else if (_constants._TRANSFER_CHAIN_GROUP.genshiro.includes(networkKey) && !(0, _utils2._isNativeToken)(tokenInfo) && isTxEqBalancesSupported) {
|
|
138
|
-
|
|
139
|
-
// currently genshiro_testnet, genshiro, equilibrium_parachain do not have transfer all method for tokens
|
|
140
|
-
} else if (value) {
|
|
141
|
-
transfer = api.tx.eqBalances.transfer((0, _utils2._getTokenOnChainAssetId)(tokenInfo), to, value);
|
|
142
|
-
}
|
|
136
|
+
transfer = api.tx.eqBalances.transfer([(0, _utils2._getTokenOnChainAssetId)(tokenInfo)], to, value);
|
|
143
137
|
} else if (!(0, _utils2._isNativeToken)(tokenInfo) && (_constants._TRANSFER_CHAIN_GROUP.crab.includes(networkKey) || _constants._BALANCE_TOKEN_GROUP.crab.includes(tokenInfo.symbol))) {
|
|
144
138
|
if (transferAll) {
|
|
145
139
|
transfer = api.tx.kton.transferAll(to, false);
|
|
@@ -79,21 +79,21 @@ class AcalaNftApi extends _nft.BaseNftApi {
|
|
|
79
79
|
return (await this.substrateApi.api.query.ormlNFT.tokens(assetId.classId, assetId.tokenId)).toHuman();
|
|
80
80
|
}
|
|
81
81
|
async handleNft(address, params) {
|
|
82
|
-
// const start = performance.now();
|
|
83
82
|
const assetIds = await this.getNfts([address]);
|
|
84
83
|
try {
|
|
85
84
|
if (!assetIds || assetIds.length === 0) {
|
|
85
|
+
params.cleanUpNfts(this.chain, address, [], [], true);
|
|
86
86
|
return;
|
|
87
87
|
}
|
|
88
|
-
const
|
|
88
|
+
const collectionIds = [];
|
|
89
|
+
const nftIds = [];
|
|
89
90
|
await Promise.all(assetIds.map(async assetId => {
|
|
90
91
|
const parsedClassId = this.parseTokenId(assetId.classId);
|
|
91
92
|
const parsedTokenId = this.parseTokenId(assetId.tokenId);
|
|
92
|
-
if (
|
|
93
|
-
|
|
94
|
-
} else {
|
|
95
|
-
collectionNftIds[parsedClassId] = [parsedTokenId];
|
|
93
|
+
if (!collectionIds.includes(parsedClassId)) {
|
|
94
|
+
collectionIds.push(parsedClassId);
|
|
96
95
|
}
|
|
96
|
+
nftIds.push(parsedTokenId);
|
|
97
97
|
const [tokenInfo, collectionMeta] = await Promise.all([this.getTokenDetails(assetId), this.getCollectionDetails(parseInt(parsedClassId))]);
|
|
98
98
|
const parsedNft = {
|
|
99
99
|
id: parsedTokenId,
|
|
@@ -118,10 +118,7 @@ class AcalaNftApi extends _nft.BaseNftApi {
|
|
|
118
118
|
params.updateItem(this.chain, parsedNft, address);
|
|
119
119
|
params.updateCollection(this.chain, parsedCollection);
|
|
120
120
|
}));
|
|
121
|
-
|
|
122
|
-
let [collectionId, nftIds] = _ref;
|
|
123
|
-
params.cleanUpNfts(this.chain, address, collectionId, nftIds);
|
|
124
|
-
});
|
|
121
|
+
params.cleanUpNfts(this.chain, address, collectionIds, nftIds);
|
|
125
122
|
} catch (e) {
|
|
126
123
|
console.error('Failed to fetch acala nft', e);
|
|
127
124
|
}
|
|
@@ -80,17 +80,18 @@ class BitCountryNftApi extends _nft.BaseNftApi {
|
|
|
80
80
|
const assetIds = await this.getNfts([address]);
|
|
81
81
|
try {
|
|
82
82
|
if (!assetIds || assetIds.length === 0) {
|
|
83
|
+
params.cleanUpNfts(this.chain, address, [], [], true);
|
|
83
84
|
return;
|
|
84
85
|
}
|
|
85
|
-
const
|
|
86
|
+
const collectionIds = [];
|
|
87
|
+
const nftIds = [];
|
|
86
88
|
await Promise.all(assetIds.map(async assetId => {
|
|
87
89
|
const parsedClassId = this.parseTokenId(assetId.classId);
|
|
88
90
|
const parsedTokenId = this.parseTokenId(assetId.tokenId);
|
|
89
|
-
if (
|
|
90
|
-
|
|
91
|
-
} else {
|
|
92
|
-
collectionNftIds[parsedClassId] = [parsedTokenId];
|
|
91
|
+
if (!collectionIds.includes(parsedClassId)) {
|
|
92
|
+
collectionIds.push(parsedClassId);
|
|
93
93
|
}
|
|
94
|
+
nftIds.push(parsedTokenId);
|
|
94
95
|
const [tokenInfo, collectionMeta] = await Promise.all([this.getTokenDetails(assetId), this.getCollectionDetails(parsedClassId)]);
|
|
95
96
|
const parsedNft = {
|
|
96
97
|
id: parsedTokenId,
|
|
@@ -115,10 +116,7 @@ class BitCountryNftApi extends _nft.BaseNftApi {
|
|
|
115
116
|
params.updateItem(this.chain, parsedNft, address);
|
|
116
117
|
params.updateCollection(this.chain, parsedCollection);
|
|
117
118
|
}));
|
|
118
|
-
|
|
119
|
-
let [collectionId, nftIds] = _ref;
|
|
120
|
-
params.cleanUpNfts(this.chain, address, collectionId, nftIds);
|
|
121
|
-
});
|
|
119
|
+
params.cleanUpNfts(this.chain, address, collectionIds, nftIds);
|
|
122
120
|
} catch (e) {
|
|
123
121
|
console.error('Failed to fetch bit.country nft', e);
|
|
124
122
|
}
|
|
@@ -92,6 +92,7 @@ class EvmNftApi extends _nft.BaseNftApi {
|
|
|
92
92
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
|
|
93
93
|
const balance = await contract.methods.balanceOf(address).call();
|
|
94
94
|
if (Number(balance) === 0) {
|
|
95
|
+
nftParams.cleanUpNfts(this.chain, address, [smartContract], []);
|
|
95
96
|
return;
|
|
96
97
|
}
|
|
97
98
|
const itemIndexes = [];
|
|
@@ -149,7 +150,7 @@ class EvmNftApi extends _nft.BaseNftApi {
|
|
|
149
150
|
nftParams.updateCollection(this.chain, nftCollection);
|
|
150
151
|
Object.entries(nftOwnerMap).forEach(_ref => {
|
|
151
152
|
let [owner, nftIds] = _ref;
|
|
152
|
-
nftParams.cleanUpNfts(this.chain, owner, smartContract, nftIds);
|
|
153
|
+
nftParams.cleanUpNfts(this.chain, owner, [smartContract], nftIds);
|
|
153
154
|
});
|
|
154
155
|
}
|
|
155
156
|
}
|
|
@@ -90,17 +90,18 @@ class KaruraNftApi extends _nft.BaseNftApi {
|
|
|
90
90
|
const assetIds = await this.getNfts([address]);
|
|
91
91
|
try {
|
|
92
92
|
if (!assetIds || assetIds.length === 0) {
|
|
93
|
+
params.cleanUpNfts(this.chain, address, [], [], true);
|
|
93
94
|
return;
|
|
94
95
|
}
|
|
95
|
-
const
|
|
96
|
+
const collectionIds = [];
|
|
97
|
+
const nftIds = [];
|
|
96
98
|
await Promise.all(assetIds.map(async assetId => {
|
|
97
99
|
const parsedClassId = this.parseTokenId(assetId.classId);
|
|
98
100
|
const parsedTokenId = this.parseTokenId(assetId.tokenId);
|
|
99
|
-
if (
|
|
100
|
-
|
|
101
|
-
} else {
|
|
102
|
-
collectionNftIds[parsedClassId] = [parsedTokenId];
|
|
101
|
+
if (!collectionIds.includes(parsedClassId)) {
|
|
102
|
+
collectionIds.push(parsedClassId);
|
|
103
103
|
}
|
|
104
|
+
nftIds.push(parsedTokenId);
|
|
104
105
|
const [tokenInfo, collectionMeta] = await Promise.all([this.getTokenDetails(assetId), this.getCollectionDetails(parseInt(parsedClassId))]);
|
|
105
106
|
const parsedNft = {
|
|
106
107
|
id: parsedTokenId,
|
|
@@ -123,10 +124,7 @@ class KaruraNftApi extends _nft.BaseNftApi {
|
|
|
123
124
|
params.updateItem(this.chain, parsedNft, address);
|
|
124
125
|
params.updateCollection(this.chain, parsedCollection);
|
|
125
126
|
}));
|
|
126
|
-
|
|
127
|
-
let [collectionId, nftIds] = _ref2;
|
|
128
|
-
params.cleanUpNfts(this.chain, address, collectionId, nftIds);
|
|
129
|
-
});
|
|
127
|
+
params.cleanUpNfts(this.chain, address, collectionIds, nftIds);
|
|
130
128
|
} catch (e) {
|
|
131
129
|
console.error('Failed to fetch karura nft', e);
|
|
132
130
|
}
|
|
@@ -139,6 +139,7 @@ class RmrkNftApi extends _nft.BaseNftApi {
|
|
|
139
139
|
const kusamaAddress = (0, _utils.reformatAddress)(address, 2);
|
|
140
140
|
allNfts = await this.getAllByAccount(kusamaAddress);
|
|
141
141
|
if (allNfts.length <= 0) {
|
|
142
|
+
params.cleanUpNfts(this.chain, address, [], [], true);
|
|
142
143
|
return;
|
|
143
144
|
}
|
|
144
145
|
const collectionInfoUrl = [];
|
|
@@ -246,8 +247,10 @@ class RmrkNftApi extends _nft.BaseNftApi {
|
|
|
246
247
|
}
|
|
247
248
|
});
|
|
248
249
|
params.updateCollection(this.chain, parsedCollection);
|
|
249
|
-
params.cleanUpNfts(this.chain, address, item.collectionId, nftIds);
|
|
250
250
|
});
|
|
251
|
+
const allCollectionIds = allCollections.map(item => item.collectionId);
|
|
252
|
+
const allNftIds = allNfts.map(nft => nft === null || nft === void 0 ? void 0 : nft.id);
|
|
253
|
+
params.cleanUpNfts(this.chain, address, allCollectionIds, allNftIds);
|
|
251
254
|
} catch (e) {
|
|
252
255
|
console.error('Failed to fetch rmrk nft', e);
|
|
253
256
|
}
|
|
@@ -93,17 +93,18 @@ class StatemineNftApi extends _nft.BaseNftApi {
|
|
|
93
93
|
const assetIds = await this.getNfts([address]);
|
|
94
94
|
try {
|
|
95
95
|
if (!assetIds || assetIds.length === 0) {
|
|
96
|
+
params.cleanUpNfts(this.chain, address, [], [], true);
|
|
96
97
|
return;
|
|
97
98
|
}
|
|
98
|
-
const
|
|
99
|
+
const collectionIds = [];
|
|
100
|
+
const nftIds = [];
|
|
99
101
|
await Promise.all(assetIds.map(async assetId => {
|
|
100
102
|
const parsedClassId = this.parseTokenId(assetId.classId);
|
|
101
103
|
const parsedTokenId = this.parseTokenId(assetId.tokenId);
|
|
102
|
-
if (
|
|
103
|
-
|
|
104
|
-
} else {
|
|
105
|
-
collectionNftIds[parsedClassId] = [parsedTokenId];
|
|
104
|
+
if (!collectionIds.includes(parsedClassId)) {
|
|
105
|
+
collectionIds.push(parsedClassId);
|
|
106
106
|
}
|
|
107
|
+
nftIds.push(parsedTokenId);
|
|
107
108
|
const [tokenInfo, collectionMeta] = await Promise.all([this.getTokenDetails(assetId), this.getCollectionDetail(parseInt(parsedClassId))]);
|
|
108
109
|
const parsedNft = {
|
|
109
110
|
id: parsedTokenId,
|
|
@@ -123,10 +124,7 @@ class StatemineNftApi extends _nft.BaseNftApi {
|
|
|
123
124
|
};
|
|
124
125
|
params.updateCollection(this.chain, parsedCollection);
|
|
125
126
|
}));
|
|
126
|
-
|
|
127
|
-
let [collectionId, nftIds] = _ref;
|
|
128
|
-
params.cleanUpNfts(this.chain, address, collectionId, nftIds);
|
|
129
|
-
});
|
|
127
|
+
params.cleanUpNfts(this.chain, address, collectionIds, nftIds);
|
|
130
128
|
} catch (e) {
|
|
131
129
|
console.error('Failed to fetch statemine nft', e);
|
|
132
130
|
}
|
|
@@ -141,7 +141,8 @@ class UniqueNftApi extends _nft.BaseNftApi {
|
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
}));
|
|
144
|
-
const
|
|
144
|
+
const collectionIds = [];
|
|
145
|
+
let allNftIds = [];
|
|
145
146
|
await Promise.all(allCollectionId.map(async collectionId => {
|
|
146
147
|
const collectionIdStr = collectionId.toString();
|
|
147
148
|
|
|
@@ -149,7 +150,8 @@ class UniqueNftApi extends _nft.BaseNftApi {
|
|
|
149
150
|
const collection = (await this.substrateApi.api.query.nft.collectionById(collectionId)).toJSON();
|
|
150
151
|
collectionMap[collectionIdStr] = collection;
|
|
151
152
|
const nftIds = Object.entries(nftMap).filter(item => item[1] === collectionId).map(item => item[0]);
|
|
152
|
-
|
|
153
|
+
collectionIds.push(collectionIdStr);
|
|
154
|
+
allNftIds = allNftIds.concat(nftIds);
|
|
153
155
|
const parsedCollection = {
|
|
154
156
|
collectionId: collectionIdStr,
|
|
155
157
|
chain: this.chain
|
|
@@ -179,10 +181,7 @@ class UniqueNftApi extends _nft.BaseNftApi {
|
|
|
179
181
|
}
|
|
180
182
|
}));
|
|
181
183
|
}));
|
|
182
|
-
|
|
183
|
-
let [collectionId, nftIds] = _ref;
|
|
184
|
-
params.cleanUpNfts(this.chain, address, collectionId, nftIds);
|
|
185
|
-
});
|
|
184
|
+
params.cleanUpNfts(this.chain, address, collectionIds, allNftIds);
|
|
186
185
|
} catch (e) {
|
|
187
186
|
console.error('Failed to fetch unique nft', e);
|
|
188
187
|
}
|
|
@@ -267,6 +267,7 @@ class WasmNftApi extends _nft.BaseNftApi {
|
|
|
267
267
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
268
268
|
const balance = _balance.output ? balanceJson.ok || balanceJson.Ok : '0';
|
|
269
269
|
if (parseInt(balance) === 0) {
|
|
270
|
+
nftParams.cleanUpNfts(this.chain, address, [smartContract], []);
|
|
270
271
|
return;
|
|
271
272
|
}
|
|
272
273
|
const itemIndexes = [];
|
|
@@ -323,7 +324,7 @@ class WasmNftApi extends _nft.BaseNftApi {
|
|
|
323
324
|
nftParams.updateCollection(this.chain, nftCollection);
|
|
324
325
|
Object.entries(nftOwnerMap).forEach(_ref => {
|
|
325
326
|
let [owner, nftIds] = _ref;
|
|
326
|
-
nftParams.cleanUpNfts(this.chain, owner, smartContract, nftIds);
|
|
327
|
+
nftParams.cleanUpNfts(this.chain, owner, [smartContract], nftIds);
|
|
327
328
|
});
|
|
328
329
|
}
|
|
329
330
|
}
|
|
@@ -49,6 +49,9 @@ function validatePoolBondingCondition(chainInfo, amount, selectedPool, address,
|
|
|
49
49
|
const errors = [];
|
|
50
50
|
let bnTotalStake = new _util.BN(amount);
|
|
51
51
|
const bnMinStake = new _util.BN(chainStakingMetadata.minPoolBonding || '0');
|
|
52
|
+
if (selectedPool.state !== 'Open') {
|
|
53
|
+
errors.push(new _TransactionError.TransactionError(_KoniTypes.StakingTxErrorType.INACTIVE_NOMINATION_POOL));
|
|
54
|
+
}
|
|
52
55
|
if (nominatorMetadata) {
|
|
53
56
|
const bnCurrentActiveStake = new _util.BN(nominatorMetadata.activeStake);
|
|
54
57
|
bnTotalStake = bnTotalStake.add(bnCurrentActiveStake);
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.KoniCron = void 0;
|
|
7
7
|
var _constants = require("@subwallet/extension-base/constants");
|
|
8
|
-
var _types = require("@subwallet/extension-base/services/chain-service/types");
|
|
9
8
|
var _utils = require("@subwallet/extension-base/services/chain-service/utils");
|
|
10
9
|
var _utils2 = require("@subwallet/extension-base/utils");
|
|
11
10
|
var _rxjs = require("rxjs");
|
|
@@ -85,23 +84,7 @@ class KoniCron {
|
|
|
85
84
|
if (this.status === 'running') {
|
|
86
85
|
return;
|
|
87
86
|
}
|
|
88
|
-
this.logger.log('Starting cron jobs');
|
|
89
87
|
const currentAccountInfo = this.state.keyringService.currentAccount;
|
|
90
|
-
if (!(currentAccountInfo !== null && currentAccountInfo !== void 0 && currentAccountInfo.address)) {
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
if (Object.keys(this.state.getSubstrateApiMap()).length !== 0 || Object.keys(this.state.getEvmApiMap()).length !== 0) {
|
|
94
|
-
this.resetNft(currentAccountInfo.address);
|
|
95
|
-
this.addCron('refreshNft', this.refreshNft(currentAccountInfo.address, this.state.getApiMap(), this.state.getSmartContractNfts(), this.state.getActiveChainInfoMap()), _constants.CRON_REFRESH_NFT_INTERVAL);
|
|
96
|
-
this.addCron('checkStatusApiMap', this.updateApiMapStatus, _constants.CRON_GET_API_MAP_STATUS);
|
|
97
|
-
this.addCron('recoverApiMap', this.recoverApiMap, _constants.CRON_AUTO_RECOVER_DOTSAMA_INTERVAL, false);
|
|
98
|
-
this.addCron('refreshStakingReward', this.refreshStakingReward(currentAccountInfo.address), _constants.CRON_REFRESH_STAKING_REWARD_INTERVAL);
|
|
99
|
-
this.addCron('refreshPoolingStakingReward', this.refreshStakingRewardFastInterval(currentAccountInfo.address), _constants.CRON_REFRESH_STAKING_REWARD_FAST_INTERVAL);
|
|
100
|
-
this.addCron('updateChainStakingMetadata', this.updateChainStakingMetadata(this.state.getChainInfoMap(), this.state.getChainStateMap(), this.state.getSubstrateApiMap()), _constants.CRON_REFRESH_CHAIN_STAKING_METADATA);
|
|
101
|
-
this.addCron('updateNominatorMetadata', this.updateNominatorMetadata(currentAccountInfo.address, this.state.getChainInfoMap(), this.state.getChainStateMap(), this.state.getSubstrateApiMap()), _constants.CRON_REFRESH_CHAIN_NOMINATOR_METADATA);
|
|
102
|
-
} else {
|
|
103
|
-
this.setStakingRewardReady();
|
|
104
|
-
}
|
|
105
88
|
const commonReloadEvents = ['account.add', 'account.remove', 'account.updateCurrent', 'chain.add', 'asset.updateState'];
|
|
106
89
|
this.eventHandler = (events, eventTypes) => {
|
|
107
90
|
var _serviceInfo$currentA;
|
|
@@ -147,7 +130,7 @@ class KoniCron {
|
|
|
147
130
|
if (this.checkNetworkAvailable(serviceInfo)) {
|
|
148
131
|
// only add cron job if there's at least 1 active network
|
|
149
132
|
(commonReload || needUpdateNft) && this.addCron('refreshNft', this.refreshNft(address, serviceInfo.chainApiMap, this.state.getSmartContractNfts(), this.state.getActiveChainInfoMap()), _constants.CRON_REFRESH_NFT_INTERVAL);
|
|
150
|
-
chainUpdated && this.addCron('checkStatusApiMap', this.updateApiMapStatus, _constants.CRON_GET_API_MAP_STATUS);
|
|
133
|
+
chainUpdated && this.addCron('checkStatusApiMap', this.updateApiMapStatus, _constants.CRON_GET_API_MAP_STATUS, false);
|
|
151
134
|
chainUpdated && this.addCron('recoverApiMap', this.recoverApiMap, _constants.CRON_AUTO_RECOVER_DOTSAMA_INTERVAL, false);
|
|
152
135
|
(commonReload || needUpdateStaking || stakingSubmitted) && this.addCron('refreshStakingReward', this.refreshStakingReward(address), _constants.CRON_REFRESH_STAKING_REWARD_INTERVAL);
|
|
153
136
|
(commonReload || needUpdateStaking || stakingSubmitted) && this.addCron('refreshPoolingStakingReward', this.refreshStakingRewardFastInterval(address), _constants.CRON_REFRESH_STAKING_REWARD_FAST_INTERVAL);
|
|
@@ -158,6 +141,22 @@ class KoniCron {
|
|
|
158
141
|
}
|
|
159
142
|
};
|
|
160
143
|
this.state.eventService.onLazy(this.eventHandler);
|
|
144
|
+
if (!(currentAccountInfo !== null && currentAccountInfo !== void 0 && currentAccountInfo.address)) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
this.logger.log('Starting cron jobs');
|
|
148
|
+
if (Object.keys(this.state.getSubstrateApiMap()).length !== 0 || Object.keys(this.state.getEvmApiMap()).length !== 0) {
|
|
149
|
+
this.resetNft(currentAccountInfo.address);
|
|
150
|
+
this.addCron('refreshNft', this.refreshNft(currentAccountInfo.address, this.state.getApiMap(), this.state.getSmartContractNfts(), this.state.getActiveChainInfoMap()), _constants.CRON_REFRESH_NFT_INTERVAL);
|
|
151
|
+
this.addCron('checkStatusApiMap', this.updateApiMapStatus, _constants.CRON_GET_API_MAP_STATUS);
|
|
152
|
+
this.addCron('recoverApiMap', this.recoverApiMap, _constants.CRON_AUTO_RECOVER_DOTSAMA_INTERVAL, false);
|
|
153
|
+
this.addCron('refreshStakingReward', this.refreshStakingReward(currentAccountInfo.address), _constants.CRON_REFRESH_STAKING_REWARD_INTERVAL);
|
|
154
|
+
this.addCron('refreshPoolingStakingReward', this.refreshStakingRewardFastInterval(currentAccountInfo.address), _constants.CRON_REFRESH_STAKING_REWARD_FAST_INTERVAL);
|
|
155
|
+
this.addCron('updateChainStakingMetadata', this.updateChainStakingMetadata(this.state.getChainInfoMap(), this.state.getChainStateMap(), this.state.getSubstrateApiMap()), _constants.CRON_REFRESH_CHAIN_STAKING_METADATA);
|
|
156
|
+
this.addCron('updateNominatorMetadata', this.updateNominatorMetadata(currentAccountInfo.address, this.state.getChainInfoMap(), this.state.getChainStateMap(), this.state.getSubstrateApiMap()), _constants.CRON_REFRESH_CHAIN_NOMINATOR_METADATA);
|
|
157
|
+
} else {
|
|
158
|
+
this.setStakingRewardReady();
|
|
159
|
+
}
|
|
161
160
|
this.status = 'running';
|
|
162
161
|
};
|
|
163
162
|
stop = () => {
|
|
@@ -179,35 +178,43 @@ class KoniCron {
|
|
|
179
178
|
this.status = 'stopped';
|
|
180
179
|
};
|
|
181
180
|
updateApiMapStatus = () => {
|
|
182
|
-
|
|
183
|
-
const
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
181
|
+
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
|
+
// }
|
|
210
216
|
};
|
|
217
|
+
|
|
211
218
|
recoverApiMap = () => {
|
|
212
219
|
var _this$subscriptions;
|
|
213
220
|
const apiMap = this.state.getApiMap();
|