@subwallet/extension-base 1.3.67-0 → 1.3.68-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 +12 -1
- package/cjs/constants/environment.js +1 -3
- package/cjs/constants/index.js +4 -1
- package/cjs/core/substrate/system-pallet.js +4 -0
- package/cjs/koni/api/nft/rari/index.js +1 -1
- package/cjs/koni/background/cron.js +16 -0
- package/cjs/koni/background/handlers/Extension.js +165 -89
- package/cjs/koni/background/handlers/State.js +25 -0
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/balance-service/helpers/group.js +31 -2
- package/cjs/services/balance-service/helpers/subscribe/substrate/index.js +51 -13
- package/cjs/services/balance-service/helpers/subscribe/substrate/utils.js +69 -0
- package/cjs/services/balance-service/index.js +36 -11
- package/cjs/services/balance-service/transfer/smart-contract.js +2 -0
- package/cjs/services/chain-service/constants.js +8 -46
- package/cjs/services/chain-service/handler/EvmChainHandler.js +6 -3
- package/cjs/services/earning-service/handlers/base.js +7 -1
- package/cjs/services/nft-service/index.js +173 -0
- package/cjs/services/transaction-service/index.js +1 -1
- package/cjs/types/balance/index.js +26 -1
- package/cjs/utils/index.js +25 -2
- package/cjs/utils/setup-api-sdk.js +0 -5
- package/constants/environment.d.ts +0 -1
- package/constants/environment.js +0 -1
- package/constants/index.d.ts +1 -0
- package/constants/index.js +1 -0
- package/core/substrate/system-pallet.d.ts +1 -0
- package/core/substrate/system-pallet.js +3 -0
- package/core/substrate/types.d.ts +14 -0
- package/koni/api/nft/rari/index.js +1 -1
- package/koni/background/cron.d.ts +1 -0
- package/koni/background/cron.js +17 -1
- package/koni/background/handlers/Extension.d.ts +3 -0
- package/koni/background/handlers/Extension.js +87 -13
- package/koni/background/handlers/State.d.ts +4 -0
- package/koni/background/handlers/State.js +25 -0
- package/package.json +16 -6
- package/packageInfo.js +1 -1
- package/services/balance-service/helpers/group.js +31 -2
- package/services/balance-service/helpers/subscribe/substrate/index.js +51 -13
- package/services/balance-service/helpers/subscribe/substrate/utils.d.ts +7 -0
- package/services/balance-service/helpers/subscribe/substrate/utils.js +58 -0
- package/services/balance-service/index.d.ts +4 -2
- package/services/balance-service/index.js +26 -6
- package/services/balance-service/transfer/smart-contract.js +2 -0
- package/services/chain-service/constants.d.ts +5 -24
- package/services/chain-service/constants.js +6 -35
- package/services/chain-service/handler/EvmChainHandler.js +6 -3
- package/services/earning-service/handlers/base.js +7 -1
- package/services/nft-service/index.d.ts +9 -0
- package/services/nft-service/index.js +165 -0
- package/services/transaction-service/index.js +1 -1
- package/services/transaction-service/types.d.ts +2 -1
- package/types/balance/index.d.ts +14 -0
- package/types/balance/index.js +21 -1
- package/utils/index.js +25 -2
- package/utils/setup-api-sdk.js +1 -6
|
@@ -16,7 +16,7 @@ import { AuthUrls } from '@subwallet/extension-base/services/request-service/typ
|
|
|
16
16
|
import { CrowdloanContributionsResponse } from '@subwallet/extension-base/services/subscan-service/types';
|
|
17
17
|
import { BitcoinTransactionData, SWTransactionResponse, SWTransactionResult } from '@subwallet/extension-base/services/transaction-service/types';
|
|
18
18
|
import { WalletConnectNotSupportRequest, WalletConnectSessionRequest } from '@subwallet/extension-base/services/wallet-connect-service/types';
|
|
19
|
-
import { AccountChainType, AccountJson, AccountsWithCurrentAddress, AddressJson, BalanceJson, BaseRequestSign, BuyServiceInfo, BuyTokenInfo, CommonOptimalTransferPath, CurrentAccountInfo, EarningRewardHistoryItem, EarningRewardJson, EarningStatus, HandleYieldStepParams, InternalRequestSign, LeavePoolAdditionalData, NominationPoolInfo, OptimalYieldPath, OptimalYieldPathParams, RequestAccountBatchExportV2, RequestAccountCreateSuriV2, RequestAccountNameValidate, RequestAccountProxyEdit, RequestAccountProxyForget, RequestBatchJsonGetAccountInfo, RequestBatchRestoreV2, RequestBounceableValidate, RequestChangeAllowOneSign, RequestChangeTonWalletContractVersion, RequestCheckCrossChainTransfer, RequestCheckPublicAndSecretKey, RequestCheckTransfer, RequestCrossChainTransfer, RequestDeriveCreateMultiple, RequestDeriveCreateV3, RequestDeriveValidateV2, RequestEarlyValidateYield, RequestEarningImpact, RequestExportAccountProxyMnemonic, RequestGetAllTonWalletContractVersion, RequestGetAmountForPair, RequestGetDeriveAccounts, RequestGetDeriveSuggestion, RequestGetTokensCanPayFee, RequestGetYieldPoolTargets, RequestInputAccountSubscribe, RequestJsonGetAccountInfo, RequestJsonRestoreV2, RequestMetadataHash, RequestMnemonicCreateV2, RequestMnemonicValidateV2, RequestPrivateKeyValidateV2, RequestShortenMetadata, RequestStakeCancelWithdrawal, RequestStakeClaimReward, RequestSubmitProcessTransaction, RequestSubscribeProcessById, RequestTransfer, RequestUnlockDotCheckCanMint, RequestUnlockDotSubscribeMintedData, RequestYieldLeave, RequestYieldStepSubmit, RequestYieldWithdrawal, ResponseAccountBatchExportV2, ResponseAccountCreateSuriV2, ResponseAccountNameValidate, ResponseBatchJsonGetAccountInfo, ResponseCheckPublicAndSecretKey, ResponseDeriveValidateV2, ResponseEarlyValidateYield, ResponseExportAccountProxyMnemonic, ResponseGetAllTonWalletContractVersion, ResponseGetDeriveAccounts, ResponseGetDeriveSuggestion, ResponseGetYieldPoolTargets, ResponseInputAccountSubscribe, ResponseJsonGetAccountInfo, ResponseMetadataHash, ResponseMnemonicCreateV2, ResponseMnemonicValidateV2, ResponsePrivateKeyValidateV2, ResponseShortenMetadata, ResponseSubscribeProcessAlive, ResponseSubscribeProcessById, StorageDataInterface, SubmitChangeValidatorStaking, SubmitYieldJoinData, SubmitYieldStepData, SubnetYieldPositionInfo, SwapPair, SwapQuoteResponse, SwapRequest, SwapRequestResult, SwapRequestV2, SwapSubmitParams, SwapTxData, TokenSpendingApprovalParams, UnlockDotTransactionNft, UnstakingStatus, ValidateSwapProcessParams, ValidateYieldProcessParams, YieldPoolInfo, YieldPoolType, YieldPositionInfo } from '@subwallet/extension-base/types';
|
|
19
|
+
import { AccountChainType, AccountJson, AccountsWithCurrentAddress, AddressJson, BalanceJson, BalanceType, BaseRequestSign, BuyServiceInfo, BuyTokenInfo, CommonOptimalTransferPath, CurrentAccountInfo, EarningRewardHistoryItem, EarningRewardJson, EarningStatus, HandleYieldStepParams, InternalRequestSign, LeavePoolAdditionalData, NominationPoolInfo, OptimalYieldPath, OptimalYieldPathParams, RequestAccountBatchExportV2, RequestAccountCreateSuriV2, RequestAccountNameValidate, RequestAccountProxyEdit, RequestAccountProxyForget, RequestBatchJsonGetAccountInfo, RequestBatchRestoreV2, RequestBounceableValidate, RequestChangeAllowOneSign, RequestChangeTonWalletContractVersion, RequestCheckCrossChainTransfer, RequestCheckPublicAndSecretKey, RequestCheckTransfer, RequestCrossChainTransfer, RequestDeriveCreateMultiple, RequestDeriveCreateV3, RequestDeriveValidateV2, RequestEarlyValidateYield, RequestEarningImpact, RequestExportAccountProxyMnemonic, RequestGetAllTonWalletContractVersion, RequestGetAmountForPair, RequestGetDeriveAccounts, RequestGetDeriveSuggestion, RequestGetTokensCanPayFee, RequestGetYieldPoolTargets, RequestInputAccountSubscribe, RequestJsonGetAccountInfo, RequestJsonRestoreV2, RequestMetadataHash, RequestMnemonicCreateV2, RequestMnemonicValidateV2, RequestPrivateKeyValidateV2, RequestShortenMetadata, RequestStakeCancelWithdrawal, RequestStakeClaimReward, RequestSubmitProcessTransaction, RequestSubscribeProcessById, RequestTransfer, RequestUnlockDotCheckCanMint, RequestUnlockDotSubscribeMintedData, RequestYieldLeave, RequestYieldStepSubmit, RequestYieldWithdrawal, ResponseAccountBatchExportV2, ResponseAccountCreateSuriV2, ResponseAccountNameValidate, ResponseBatchJsonGetAccountInfo, ResponseCheckPublicAndSecretKey, ResponseDeriveValidateV2, ResponseEarlyValidateYield, ResponseExportAccountProxyMnemonic, ResponseGetAllTonWalletContractVersion, ResponseGetDeriveAccounts, ResponseGetDeriveSuggestion, ResponseGetYieldPoolTargets, ResponseInputAccountSubscribe, ResponseJsonGetAccountInfo, ResponseMetadataHash, ResponseMnemonicCreateV2, ResponseMnemonicValidateV2, ResponsePrivateKeyValidateV2, ResponseShortenMetadata, ResponseSubscribeProcessAlive, ResponseSubscribeProcessById, StorageDataInterface, SubmitChangeValidatorStaking, SubmitYieldJoinData, SubmitYieldStepData, SubnetYieldPositionInfo, SwapPair, SwapQuoteResponse, SwapRequest, SwapRequestResult, SwapRequestV2, SwapSubmitParams, SwapTxData, TokenSpendingApprovalParams, UnlockDotTransactionNft, UnstakingStatus, ValidateSwapProcessParams, ValidateYieldProcessParams, YieldPoolInfo, YieldPoolType, YieldPositionInfo } from '@subwallet/extension-base/types';
|
|
20
20
|
import { RequestSubmitSignPsbtTransfer, RequestSubmitTransfer, RequestSubmitTransferWithId, RequestSubscribeTransfer, ResponseSubscribeTransfer, ResponseSubscribeTransferConfirmation } from '@subwallet/extension-base/types/balance/transfer';
|
|
21
21
|
import { RequestClaimBridge } from '@subwallet/extension-base/types/bridge';
|
|
22
22
|
import { GetNotificationParams, RequestIsClaimedPolygonBridge, RequestSwitchStatusParams } from '@subwallet/extension-base/types/notification';
|
|
@@ -767,6 +767,11 @@ export interface NftTransactionRequest {
|
|
|
767
767
|
params: Record<string, any>;
|
|
768
768
|
nftItem: NftItem;
|
|
769
769
|
}
|
|
770
|
+
export interface NftFullListRequest {
|
|
771
|
+
contractAddress: string;
|
|
772
|
+
owners: string[];
|
|
773
|
+
chainInfo: _ChainInfo;
|
|
774
|
+
}
|
|
770
775
|
export interface EvmNftTransaction extends ValidateTransactionResponse {
|
|
771
776
|
tx: Record<string, any> | null;
|
|
772
777
|
}
|
|
@@ -798,6 +803,9 @@ export interface RequestFreeBalance {
|
|
|
798
803
|
token?: string;
|
|
799
804
|
extrinsicType?: ExtrinsicType;
|
|
800
805
|
}
|
|
806
|
+
export interface RequestAvailableBalanceByType extends RequestFreeBalance {
|
|
807
|
+
balanceType?: BalanceType;
|
|
808
|
+
}
|
|
801
809
|
export interface RequestMaxTransferable {
|
|
802
810
|
address: string;
|
|
803
811
|
networkKey: string;
|
|
@@ -1821,6 +1829,7 @@ export interface KoniRequestSignatures {
|
|
|
1821
1829
|
'pri(nft.getSubscription)': [RequestSubscribeNft, NftJson, NftJson];
|
|
1822
1830
|
'pri(nftCollection.getNftCollection)': [null, NftCollectionJson];
|
|
1823
1831
|
'pri(nftCollection.getSubscription)': [null, NftCollection[], NftCollection[]];
|
|
1832
|
+
'pri(nft.getFullList)': [NftFullListRequest, boolean];
|
|
1824
1833
|
'pri(staking.getStaking)': [null, StakingJson];
|
|
1825
1834
|
'pri(staking.getSubscription)': [RequestSubscribeStaking, StakingJson, StakingJson];
|
|
1826
1835
|
'pri(stakingReward.getStakingReward)': [null, StakingRewardJson];
|
|
@@ -1952,6 +1961,8 @@ export interface KoniRequestSignatures {
|
|
|
1952
1961
|
'pri(subscription.cancel)': [string, boolean];
|
|
1953
1962
|
'pri(freeBalance.get)': [RequestFreeBalance, AmountData];
|
|
1954
1963
|
'pri(freeBalance.subscribe)': [RequestFreeBalance, AmountDataWithId, AmountDataWithId];
|
|
1964
|
+
'pri(availableBalance.getBalanceByType)': [RequestAvailableBalanceByType, AmountData];
|
|
1965
|
+
'pri(availableBalance.subscribeBalanceByType)': [RequestAvailableBalanceByType, AmountDataWithId, AmountDataWithId];
|
|
1955
1966
|
'pri(accounts.checkTransfer)': [RequestCheckTransfer, ValidateTransactionResponse];
|
|
1956
1967
|
'pri(accounts.transfer)': [RequestSubmitTransfer, SWTransactionResponse];
|
|
1957
1968
|
'pri(accounts.bitcoin.dapp.transfer.confirmation)': [RequestSubmitTransferWithId, SWTransactionResponse];
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.isProductionMode = exports.SW_EXTERNAL_SERVICES_API = exports.
|
|
6
|
+
exports.isProductionMode = exports.SW_EXTERNAL_SERVICES_API = exports.BACKEND_API_URL = exports.APP_VERSION = void 0;
|
|
7
7
|
// Copyright 2019-2022 @subwallet/extension-base authors & contributors
|
|
8
8
|
// SPDX-License-Identifier: Apache-2.0
|
|
9
9
|
|
|
@@ -15,7 +15,5 @@ const isProductionMode = PRODUCTION_BRANCHES.indexOf(branchName) > -1;
|
|
|
15
15
|
exports.isProductionMode = isProductionMode;
|
|
16
16
|
const BACKEND_API_URL = process.env.SUBWALLET_API || (isProductionMode ? 'https://sw-services.subwallet.app/api' : 'https://be-dev.subwallet.app/api');
|
|
17
17
|
exports.BACKEND_API_URL = BACKEND_API_URL;
|
|
18
|
-
const BACKEND_PRICE_HISTORY_URL = process.env.SUBWALLET_PRICE_HISTORY_API || (isProductionMode ? 'https://price-history.subwallet.app/api' : 'https://price-history-dev.subwallet.app/api');
|
|
19
|
-
exports.BACKEND_PRICE_HISTORY_URL = BACKEND_PRICE_HISTORY_URL;
|
|
20
18
|
const SW_EXTERNAL_SERVICES_API = process.env.SW_EXTERNAL_SERVICES_API || (isProductionMode ? 'https://external-services.subwallet.app' : 'https://external-services-dev.subwallet.app');
|
|
21
19
|
exports.SW_EXTERNAL_SERVICES_API = SW_EXTERNAL_SERVICES_API;
|
package/cjs/constants/index.js
CHANGED
|
@@ -20,6 +20,7 @@ var _exportNames = {
|
|
|
20
20
|
CRON_REFRESH_HISTORY_INTERVAL: true,
|
|
21
21
|
CRON_GET_API_MAP_STATUS: true,
|
|
22
22
|
CRON_REFRESH_CHAIN_STAKING_METADATA: true,
|
|
23
|
+
CRON_NFT_DETECT_INTERVAL: true,
|
|
23
24
|
CRON_REFRESH_CHAIN_NOMINATOR_METADATA: true,
|
|
24
25
|
CRON_RECOVER_HISTORY_INTERVAL: true,
|
|
25
26
|
CRON_SYNC_MANTA_PAY: true,
|
|
@@ -46,7 +47,7 @@ var _exportNames = {
|
|
|
46
47
|
getSupportTokenPayFeeChain: true,
|
|
47
48
|
isChainSupportTokenPayFee: true
|
|
48
49
|
};
|
|
49
|
-
exports.isChainSupportTokenPayFee = exports.getSupportTokenPayFeeChain = exports._SUPPORT_TOKEN_PAY_FEE_GROUP = exports.XCM_MIN_AMOUNT_RATIO = exports.XCM_FEE_RATIO = exports.SUB_TOKEN_REFRESH_BALANCE_INTERVAL = exports.PERMISSIONS_TO_REVOKE = exports.ORDINAL_METHODS = exports.ORDINAL_COLLECTION = exports.NETWORK_MULTI_GAS_FEE = exports.MAX_COLLATERAL_AMOUNT = exports.MANTA_PAY_BALANCE_INTERVAL = exports.IGNORE_QR_SIGNER = exports.IGNORE_GET_SUBSTRATE_FEATURES_LIST = exports.GAS_PRICE_RATIO = exports.CRON_SYNC_MANTA_PAY = exports.CRON_REFRESH_STAKING_REWARD_INTERVAL = exports.CRON_REFRESH_STAKING_REWARD_FAST_INTERVAL = exports.CRON_REFRESH_PRICE_INTERVAL = exports.CRON_REFRESH_NFT_INTERVAL = exports.CRON_REFRESH_MKT_CAMPAIGN_INTERVAL = exports.CRON_REFRESH_HISTORY_INTERVAL = exports.CRON_REFRESH_EARNING_REWARD_HISTORY_INTERVAL = exports.CRON_REFRESH_CHAIN_STAKING_METADATA = exports.CRON_REFRESH_CHAIN_NOMINATOR_METADATA = exports.CRON_RECOVER_HISTORY_INTERVAL = exports.CRON_LISTEN_AVAIL_BRIDGE_CLAIM = exports.CRON_GET_API_MAP_STATUS = exports.CRON_AUTO_RECOVER_WEB3_INTERVAL = exports.CRON_AUTO_RECOVER_DOTSAMA_INTERVAL = exports.BITTENSOR_REFRESH_STAKE_INFO = exports.BITTENSOR_REFRESH_STAKE_APY = exports.BITCOIN_REFRESH_BALANCE_INTERVAL = exports.BASE_SECOND_INTERVAL = exports.BASE_MINUTE_INTERVAL = exports.ASTAR_REFRESH_BALANCE_INTERVAL = exports.ALL_NETWORK_KEY = exports.ALL_GENESIS_HASH = exports.ALL_ACCOUNT_KEY = exports.ALL_ACCOUNT_AUTH_TYPES = exports.ACALA_REFRESH_CROWDLOAN_INTERVAL = void 0;
|
|
50
|
+
exports.isChainSupportTokenPayFee = exports.getSupportTokenPayFeeChain = exports._SUPPORT_TOKEN_PAY_FEE_GROUP = exports.XCM_MIN_AMOUNT_RATIO = exports.XCM_FEE_RATIO = exports.SUB_TOKEN_REFRESH_BALANCE_INTERVAL = exports.PERMISSIONS_TO_REVOKE = exports.ORDINAL_METHODS = exports.ORDINAL_COLLECTION = exports.NETWORK_MULTI_GAS_FEE = exports.MAX_COLLATERAL_AMOUNT = exports.MANTA_PAY_BALANCE_INTERVAL = exports.IGNORE_QR_SIGNER = exports.IGNORE_GET_SUBSTRATE_FEATURES_LIST = exports.GAS_PRICE_RATIO = exports.CRON_SYNC_MANTA_PAY = exports.CRON_REFRESH_STAKING_REWARD_INTERVAL = exports.CRON_REFRESH_STAKING_REWARD_FAST_INTERVAL = exports.CRON_REFRESH_PRICE_INTERVAL = exports.CRON_REFRESH_NFT_INTERVAL = exports.CRON_REFRESH_MKT_CAMPAIGN_INTERVAL = exports.CRON_REFRESH_HISTORY_INTERVAL = exports.CRON_REFRESH_EARNING_REWARD_HISTORY_INTERVAL = exports.CRON_REFRESH_CHAIN_STAKING_METADATA = exports.CRON_REFRESH_CHAIN_NOMINATOR_METADATA = exports.CRON_RECOVER_HISTORY_INTERVAL = exports.CRON_NFT_DETECT_INTERVAL = exports.CRON_LISTEN_AVAIL_BRIDGE_CLAIM = exports.CRON_GET_API_MAP_STATUS = exports.CRON_AUTO_RECOVER_WEB3_INTERVAL = exports.CRON_AUTO_RECOVER_DOTSAMA_INTERVAL = exports.BITTENSOR_REFRESH_STAKE_INFO = exports.BITTENSOR_REFRESH_STAKE_APY = exports.BITCOIN_REFRESH_BALANCE_INTERVAL = exports.BASE_SECOND_INTERVAL = exports.BASE_MINUTE_INTERVAL = exports.ASTAR_REFRESH_BALANCE_INTERVAL = exports.ALL_NETWORK_KEY = exports.ALL_GENESIS_HASH = exports.ALL_ACCOUNT_KEY = exports.ALL_ACCOUNT_AUTH_TYPES = exports.ACALA_REFRESH_CROWDLOAN_INTERVAL = void 0;
|
|
50
51
|
var _blockedActions = require("./blocked-actions");
|
|
51
52
|
Object.keys(_blockedActions).forEach(function (key) {
|
|
52
53
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -166,6 +167,8 @@ const CRON_GET_API_MAP_STATUS = 10000;
|
|
|
166
167
|
exports.CRON_GET_API_MAP_STATUS = CRON_GET_API_MAP_STATUS;
|
|
167
168
|
const CRON_REFRESH_CHAIN_STAKING_METADATA = 90000;
|
|
168
169
|
exports.CRON_REFRESH_CHAIN_STAKING_METADATA = CRON_REFRESH_CHAIN_STAKING_METADATA;
|
|
170
|
+
const CRON_NFT_DETECT_INTERVAL = 7500000;
|
|
171
|
+
exports.CRON_NFT_DETECT_INTERVAL = CRON_NFT_DETECT_INTERVAL;
|
|
169
172
|
const CRON_REFRESH_CHAIN_NOMINATOR_METADATA = 1800000;
|
|
170
173
|
exports.CRON_REFRESH_CHAIN_NOMINATOR_METADATA = CRON_REFRESH_CHAIN_NOMINATOR_METADATA;
|
|
171
174
|
const CRON_RECOVER_HISTORY_INTERVAL = 30000;
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports._canAccountBeReaped = _canAccountBeReaped;
|
|
7
7
|
exports._getAppliedExistentialDepositWithExtrinsicType = _getAppliedExistentialDepositWithExtrinsicType;
|
|
8
|
+
exports._getSystemPalletReservedBalance = _getSystemPalletReservedBalance;
|
|
8
9
|
exports._getSystemPalletTotalBalance = _getSystemPalletTotalBalance;
|
|
9
10
|
exports._getSystemPalletTransferable = _getSystemPalletTransferable;
|
|
10
11
|
exports._isAccountActive = _isAccountActive;
|
|
@@ -74,4 +75,7 @@ function _getSystemPalletTransferableV1(accountInfo, existentialDeposit, strictM
|
|
|
74
75
|
}
|
|
75
76
|
function _getSystemPalletTotalBalanceV1(accountInfo) {
|
|
76
77
|
return BigInt(accountInfo.data.free) + BigInt(accountInfo.data.reserved);
|
|
78
|
+
}
|
|
79
|
+
function _getSystemPalletReservedBalance(accountInfo) {
|
|
80
|
+
return BigInt(accountInfo.data.reserved);
|
|
77
81
|
}
|
|
@@ -99,6 +99,7 @@ class KoniCron {
|
|
|
99
99
|
// NFT
|
|
100
100
|
(commonReload || needUpdateNft) && this.resetNft(address);
|
|
101
101
|
(commonReload || needUpdateNft) && this.removeCron('refreshNft');
|
|
102
|
+
(commonReload || needUpdateNft) && this.removeCron('detectNft');
|
|
102
103
|
commonReload && this.removeCron('refreshPoolingStakingReward');
|
|
103
104
|
if (mktCampaignNeedReload) {
|
|
104
105
|
this.removeCron('fetchMktCampaignData');
|
|
@@ -114,6 +115,7 @@ class KoniCron {
|
|
|
114
115
|
if (this.checkNetworkAvailable(serviceInfo)) {
|
|
115
116
|
// only add cron jobs if there's at least 1 active network
|
|
116
117
|
(commonReload || needUpdateNft) && this.addCron('refreshNft', this.refreshNft(address, serviceInfo.chainApiMap, this.state.getSmartContractNfts(), this.state.getActiveChainInfoMap()), _constants.CRON_REFRESH_NFT_INTERVAL);
|
|
118
|
+
(commonReload || needUpdateNft) && this.addCron('detectNft', this.detectEvmCollectionNft(address), _constants.CRON_NFT_DETECT_INTERVAL);
|
|
117
119
|
reloadMantaPay && this.addCron('syncMantaPay', this.syncMantaPay, _constants.CRON_SYNC_MANTA_PAY);
|
|
118
120
|
}
|
|
119
121
|
};
|
|
@@ -126,6 +128,7 @@ class KoniCron {
|
|
|
126
128
|
if (Object.keys(this.state.getSubstrateApiMap()).length !== 0 || Object.keys(this.state.getEvmApiMap()).length !== 0) {
|
|
127
129
|
this.resetNft(currentAccountInfo.proxyId);
|
|
128
130
|
this.addCron('refreshNft', this.refreshNft(currentAccountInfo.proxyId, this.state.getApiMap(), this.state.getSmartContractNfts(), this.state.getActiveChainInfoMap()), _constants.CRON_REFRESH_NFT_INTERVAL);
|
|
131
|
+
this.addCron('detectNft', this.detectEvmCollectionNft(currentAccountInfo.proxyId), _constants.CRON_NFT_DETECT_INTERVAL);
|
|
129
132
|
// this.addCron('refreshStakingReward', this.refreshStakingReward(currentAccountInfo.address), CRON_REFRESH_STAKING_REWARD_INTERVAL);
|
|
130
133
|
this.addCron('syncMantaPay', this.syncMantaPay, _constants.CRON_SYNC_MANTA_PAY);
|
|
131
134
|
}
|
|
@@ -175,12 +178,25 @@ class KoniCron {
|
|
|
175
178
|
checkNetworkAvailable = serviceInfo => {
|
|
176
179
|
return Object.keys(serviceInfo.chainApiMap.substrate).length > 0 || Object.keys(serviceInfo.chainApiMap.evm).length > 0;
|
|
177
180
|
};
|
|
181
|
+
detectEvmCollectionNft = address => {
|
|
182
|
+
return () => {
|
|
183
|
+
let addresses = [];
|
|
184
|
+
addresses = this.state.keyringService.context.getDecodedAddresses();
|
|
185
|
+
if (!addresses.length) {
|
|
186
|
+
console.warn('[Cron] No decoded addresses found for ALL_ACCOUNT_KEY');
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
this.state.nftDetectionService.fetchEvmCollectionsWithPreview(addresses).catch(err => console.warn(`[Cron] NFT detection failed for ${address}:`, err));
|
|
190
|
+
};
|
|
191
|
+
};
|
|
178
192
|
async reloadNft() {
|
|
179
193
|
const address = this.state.keyringService.context.currentAccount.proxyId;
|
|
180
194
|
const serviceInfo = this.state.getServiceInfo();
|
|
181
195
|
this.resetNft(address);
|
|
182
196
|
this.removeCron('refreshNft');
|
|
197
|
+
this.removeCron('detectNft');
|
|
183
198
|
this.addCron('refreshNft', this.refreshNft(address, serviceInfo.chainApiMap, this.state.getSmartContractNfts(), this.state.getActiveChainInfoMap()), _constants.CRON_REFRESH_NFT_INTERVAL);
|
|
199
|
+
this.addCron('detectNft', this.detectEvmCollectionNft(address), _constants.CRON_NFT_DETECT_INTERVAL);
|
|
184
200
|
await (0, _utils2.waitTimeout)(1800);
|
|
185
201
|
return true;
|
|
186
202
|
}
|