@subwallet/extension-base 1.3.79-1 → 1.3.80-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/background/KoniTypes.d.ts +13 -3
  2. package/cjs/core/substrate/system-pallet.js +3 -0
  3. package/cjs/koni/api/nft/index.js +0 -14
  4. package/cjs/koni/background/cron.js +0 -17
  5. package/cjs/koni/background/handlers/Extension.js +6 -5
  6. package/cjs/koni/background/handlers/State.js +24 -6
  7. package/cjs/packageInfo.js +1 -1
  8. package/cjs/services/balance-service/helpers/process.js +49 -21
  9. package/cjs/services/balance-service/index.js +2 -2
  10. package/cjs/services/chain-service/constants.js +6 -2
  11. package/cjs/services/earning-service/handlers/special.js +3 -2
  12. package/cjs/services/nft-service/index.js +219 -150
  13. package/cjs/services/nft-service/multi-chain-nft-fetcher.js +145 -0
  14. package/cjs/services/nft-service/nft-handlers/base-nft-handler.js +28 -0
  15. package/cjs/services/nft-service/nft-handlers/evm/evm-nft-handler.js +179 -0
  16. package/cjs/services/nft-service/nft-handlers/registry.js +37 -0
  17. package/cjs/services/nft-service/nft-handlers/unique/unique-nft-handler.js +187 -0
  18. package/cjs/services/storage-service/DatabaseService.js +1 -1
  19. package/core/substrate/system-pallet.js +3 -0
  20. package/koni/api/nft/index.js +1 -15
  21. package/koni/background/cron.d.ts +0 -1
  22. package/koni/background/cron.js +1 -18
  23. package/koni/background/handlers/Extension.d.ts +1 -0
  24. package/koni/background/handlers/Extension.js +6 -5
  25. package/koni/background/handlers/State.d.ts +8 -2
  26. package/koni/background/handlers/State.js +24 -6
  27. package/package.json +31 -6
  28. package/packageInfo.js +1 -1
  29. package/services/balance-service/helpers/process.d.ts +1 -1
  30. package/services/balance-service/helpers/process.js +48 -21
  31. package/services/balance-service/index.js +2 -2
  32. package/services/chain-service/constants.d.ts +3 -0
  33. package/services/chain-service/constants.js +3 -0
  34. package/services/earning-service/handlers/special.js +4 -3
  35. package/services/nft-service/index.d.ts +42 -6
  36. package/services/nft-service/index.js +219 -151
  37. package/services/nft-service/multi-chain-nft-fetcher.d.ts +13 -0
  38. package/services/nft-service/multi-chain-nft-fetcher.js +138 -0
  39. package/services/nft-service/nft-handlers/base-nft-handler.d.ts +13 -0
  40. package/services/nft-service/nft-handlers/base-nft-handler.js +21 -0
  41. package/services/nft-service/nft-handlers/evm/evm-nft-handler.d.ts +9 -0
  42. package/services/nft-service/nft-handlers/evm/evm-nft-handler.js +171 -0
  43. package/services/nft-service/nft-handlers/registry.d.ts +11 -0
  44. package/services/nft-service/nft-handlers/registry.js +29 -0
  45. package/services/nft-service/nft-handlers/unique/unique-nft-handler.d.ts +12 -0
  46. package/services/nft-service/nft-handlers/unique/unique-nft-handler.js +177 -0
  47. package/services/storage-service/DatabaseService.d.ts +1 -1
  48. package/services/storage-service/DatabaseService.js +1 -1
@@ -29,7 +29,7 @@ import MigrationService from '@subwallet/extension-base/services/migration-servi
29
29
  import MintCampaignService from '@subwallet/extension-base/services/mint-campaign-service';
30
30
  import MktCampaignService from '@subwallet/extension-base/services/mkt-campaign-service';
31
31
  import { MultisigService } from '@subwallet/extension-base/services/multisig-service';
32
- import NftService from '@subwallet/extension-base/services/nft-service';
32
+ import { NftService } from '@subwallet/extension-base/services/nft-service';
33
33
  import NotificationService from '@subwallet/extension-base/services/notification-service/NotificationService';
34
34
  import OpenGovService from '@subwallet/extension-base/services/open-gov';
35
35
  import { PriceService } from '@subwallet/extension-base/services/price-service';
@@ -79,6 +79,12 @@ export default class KoniState {
79
79
  externalRequest = {};
80
80
  crowdloanMap = generateDefaultCrowdloanMap();
81
81
  crowdloanSubject = new Subject();
82
+
83
+ /**
84
+ * TODO: Remove this subject once NFT migration to the service layer is completed.
85
+ * The state manager should not handle the internal state of the NFT service.
86
+ * The NFT service will manage its own state independently.
87
+ */
82
88
  nftSubject = new Subject();
83
89
  mantaPayConfigSubject = new Subject();
84
90
  isMantaPayEnabled = false;
@@ -115,13 +121,13 @@ export default class KoniState {
115
121
  this.requestService = new RequestService(this.chainService, this.settingService, this.keyringService, this.transactionService);
116
122
  this.priceService = new PriceService(this.dbService, this.eventService, this.chainService);
117
123
  this.balanceService = new BalanceService(this);
124
+ this.nftService = new NftService(this);
118
125
  this.historyService = new HistoryService(this.dbService, this.chainService, this.eventService, this.keyringService, this.subscanService);
119
126
  this.mintCampaignService = new MintCampaignService(this);
120
127
  this.walletConnectService = new WalletConnectService(this, this.requestService);
121
128
  this.migrationService = new MigrationService(this, this.eventService);
122
129
  this.campaignService = new CampaignService(this);
123
130
  this.mktCampaignService = new MktCampaignService(this);
124
- this.nftDetectionService = new NftService(this);
125
131
  this.buyService = new BuyService(this);
126
132
  this.earningService = new EarningService(this);
127
133
  this.swapService = new SwapService(this);
@@ -232,6 +238,7 @@ export default class KoniState {
232
238
  this.mktCampaignService.init();
233
239
  this.eventService.emit('chain.ready', true);
234
240
  await this.balanceService.init();
241
+ await this.nftService.init();
235
242
  await this.earningService.init();
236
243
  await this.swapService.init();
237
244
  await this.inappNotificationService.init();
@@ -387,6 +394,7 @@ export default class KoniState {
387
394
  return this.dbService.getAllNftCollection(this.activeChainSlugs);
388
395
  }
389
396
  subscribeNftCollection() {
397
+ // TODO: Move this logic to the NFT service once migration is complete.
390
398
  const getChains = () => this.activeChainSlugs;
391
399
  return this.dbService.stores.nftCollection.subscribeNftCollection(getChains);
392
400
  }
@@ -1768,7 +1776,7 @@ export default class KoniState {
1768
1776
  this.campaignService.stop();
1769
1777
  await Promise.all([this.cron.stop(), this.subscription.stop()]);
1770
1778
  await this.pauseAllNetworks(undefined, 'IDLE mode');
1771
- await Promise.all([this.historyService.stop(), this.priceService.stop(), this.balanceService.stop(), this.earningService.stop(), this.swapService.stop(), this.inappNotificationService.stop(), this.openGovService.stop(), this.multisigService.stop()]);
1779
+ await Promise.all([this.historyService.stop(), this.priceService.stop(), this.balanceService.stop(), this.nftService.stop(), this.earningService.stop(), this.swapService.stop(), this.inappNotificationService.stop(), this.openGovService.stop(), this.multisigService.stop()]);
1772
1780
 
1773
1781
  // Complete sleeping
1774
1782
  sleeping.resolve();
@@ -1824,7 +1832,7 @@ export default class KoniState {
1824
1832
  this.generalStatus = ServiceStatus.STARTING_FULL;
1825
1833
  const startingFull = createPromiseHandler();
1826
1834
  this.waitStartingFull = startingFull.promise;
1827
- await Promise.all([this.cron.start(), this.subscription.start(), this.historyService.start(), this.priceService.start(), this.balanceService.start(), this.earningService.start(), this.swapService.start(), this.inappNotificationService.start(), this.openGovService.start(), this.multisigService.start()]);
1835
+ await Promise.all([this.cron.start(), this.subscription.start(), this.historyService.start(), this.priceService.start(), this.balanceService.start(), this.nftService.start(), this.earningService.start(), this.swapService.start(), this.inappNotificationService.start(), this.openGovService.start(), this.multisigService.start()]);
1828
1836
  this.eventService.emit('general.start_full', true);
1829
1837
  this.waitStartingFull = null;
1830
1838
  this.generalStatus = ServiceStatus.STARTED_FULL;
@@ -1885,9 +1893,19 @@ export default class KoniState {
1885
1893
  });
1886
1894
  }
1887
1895
  async reloadNft() {
1888
- const currentAddress = this.keyringService.context.currentAccount.proxyId;
1896
+ const currentProxyId = this.keyringService.context.currentAccount.proxyId;
1897
+ const currentAddress = this.keyringService.context.addressesByProxyId(currentProxyId);
1889
1898
  await this.dbService.removeNftsByAddress(currentAddress);
1890
- return await this.cron.reloadNft();
1899
+ await this.cron.reloadNft();
1900
+ await this.reloadNftV2();
1901
+ return true;
1902
+ }
1903
+ async reloadNftV2() {
1904
+ // TODO: Recheck: Uncomment this block when migration is complete
1905
+ // const currentAddress = this.keyringService.context.currentAccount.proxyId;
1906
+ //
1907
+ // await this.dbService.removeNftsByAddress(currentAddress);
1908
+ await this.nftService.forceReload();
1891
1909
  }
1892
1910
  async reloadStaking() {
1893
1911
  await this.earningService.reloadEarning(true);
package/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "./cjs/detectPackage.js"
18
18
  ],
19
19
  "type": "module",
20
- "version": "1.3.79-1",
20
+ "version": "1.3.80-0",
21
21
  "main": "./cjs/index.js",
22
22
  "module": "./index.js",
23
23
  "types": "./index.d.ts",
@@ -1751,6 +1751,31 @@
1751
1751
  "require": "./cjs/services/nft-service/index.js",
1752
1752
  "default": "./services/nft-service/index.js"
1753
1753
  },
1754
+ "./services/nft-service/multi-chain-nft-fetcher": {
1755
+ "types": "./services/nft-service/multi-chain-nft-fetcher.d.ts",
1756
+ "require": "./cjs/services/nft-service/multi-chain-nft-fetcher.js",
1757
+ "default": "./services/nft-service/multi-chain-nft-fetcher.js"
1758
+ },
1759
+ "./services/nft-service/nft-handlers/base-nft-handler": {
1760
+ "types": "./services/nft-service/nft-handlers/base-nft-handler.d.ts",
1761
+ "require": "./cjs/services/nft-service/nft-handlers/base-nft-handler.js",
1762
+ "default": "./services/nft-service/nft-handlers/base-nft-handler.js"
1763
+ },
1764
+ "./services/nft-service/nft-handlers/evm/evm-nft-handler": {
1765
+ "types": "./services/nft-service/nft-handlers/evm/evm-nft-handler.d.ts",
1766
+ "require": "./cjs/services/nft-service/nft-handlers/evm/evm-nft-handler.js",
1767
+ "default": "./services/nft-service/nft-handlers/evm/evm-nft-handler.js"
1768
+ },
1769
+ "./services/nft-service/nft-handlers/registry": {
1770
+ "types": "./services/nft-service/nft-handlers/registry.d.ts",
1771
+ "require": "./cjs/services/nft-service/nft-handlers/registry.js",
1772
+ "default": "./services/nft-service/nft-handlers/registry.js"
1773
+ },
1774
+ "./services/nft-service/nft-handlers/unique/unique-nft-handler": {
1775
+ "types": "./services/nft-service/nft-handlers/unique/unique-nft-handler.d.ts",
1776
+ "require": "./cjs/services/nft-service/nft-handlers/unique/unique-nft-handler.js",
1777
+ "default": "./services/nft-service/nft-handlers/unique/unique-nft-handler.js"
1778
+ },
1754
1779
  "./services/notification-service/NotificationService": {
1755
1780
  "types": "./services/notification-service/NotificationService.d.ts",
1756
1781
  "require": "./cjs/services/notification-service/NotificationService.js",
@@ -3022,12 +3047,12 @@
3022
3047
  "@snowbridge/registry": "^0.2.0",
3023
3048
  "@sora-substrate/type-definitions": "^1.17.7",
3024
3049
  "@substrate/connect": "^0.8.9",
3025
- "@subwallet-monorepos/subwallet-services-sdk": "0.1.16",
3050
+ "@subwallet-monorepos/subwallet-services-sdk": "0.1.17-beta.2",
3026
3051
  "@subwallet/chain-list": "0.2.127",
3027
- "@subwallet/extension-base": "^1.3.79-1",
3028
- "@subwallet/extension-chains": "^1.3.79-1",
3029
- "@subwallet/extension-dapp": "^1.3.79-1",
3030
- "@subwallet/extension-inject": "^1.3.79-1",
3052
+ "@subwallet/extension-base": "^1.3.80-0",
3053
+ "@subwallet/extension-chains": "^1.3.80-0",
3054
+ "@subwallet/extension-dapp": "^1.3.80-0",
3055
+ "@subwallet/extension-inject": "^1.3.80-0",
3031
3056
  "@subwallet/keyring": "^0.1.14",
3032
3057
  "@subwallet/ui-keyring": "^0.1.14",
3033
3058
  "@ton/core": "^0.56.3",
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.3.79-1'
10
+ version: '1.3.80-0'
11
11
  };
@@ -11,4 +11,4 @@ export interface RequestOptimalTransferProcess {
11
11
  }
12
12
  export declare function getDefaultTransferProcess(): CommonOptimalTransferPath;
13
13
  export declare function getSnowbridgeTransferProcessFromEvm(address: string, evmApi: _EvmApi, tokenInfo: _ChainAsset, amount: string): Promise<CommonOptimalTransferPath>;
14
- export declare function getAcrossbridgeTransferProcessFromEvm(SpokePoolAddress: string): Promise<CommonOptimalTransferPath>;
14
+ export declare function getAcrossbridgeTransferProcessFromEvm(SpokePoolAddress: string, address: string, tokenInfo: _ChainAsset, evmApi: _EvmApi, amount: string): Promise<CommonOptimalTransferPath>;
@@ -2,7 +2,11 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
4
  import { COMMON_CHAIN_SLUGS } from '@subwallet/chain-list';
5
+ import { getERC20Allowance } from '@subwallet/extension-base/koni/api/contract-handler/evm/web3';
6
+ import { getSnowBridgeGatewayContract } from '@subwallet/extension-base/koni/api/contract-handler/utils';
7
+ import { _getContractAddressOfToken } from '@subwallet/extension-base/services/chain-service/utils';
5
8
  import { CommonStepType, DEFAULT_FIRST_STEP, MOCK_STEP_FEE } from '@subwallet/extension-base/types/service-base';
9
+ import BigN from 'bignumber.js';
6
10
  export function getDefaultTransferProcess() {
7
11
  return {
8
12
  totalFee: [MOCK_STEP_FEE, MOCK_STEP_FEE],
@@ -22,18 +26,25 @@ export async function getSnowbridgeTransferProcessFromEvm(address, evmApi, token
22
26
  totalFee: [MOCK_STEP_FEE],
23
27
  steps: [DEFAULT_FIRST_STEP]
24
28
  };
25
- // const allowance = await getERC20Allowance(getSnowBridgeGatewayContract(evmApi.chainSlug), address, _getContractAddressOfToken(tokenInfo), evmApi);
26
-
27
- result.steps.push({
28
- // always approve spending because sometimes allowance check fails
29
- id: result.steps.length,
30
- type: CommonStepType.TOKEN_APPROVAL,
31
- name: 'Approve spending'
32
- });
33
- result.totalFee.push(MOCK_STEP_FEE);
34
- // if (!allowance || BigInt(allowance) < BigInt(amount)) {
35
- // }
36
-
29
+ try {
30
+ const allowance = await getERC20Allowance(getSnowBridgeGatewayContract(evmApi.chainSlug), address, _getContractAddressOfToken(tokenInfo), evmApi);
31
+ if (!allowance || new BigN(allowance).lt(amount)) {
32
+ result.steps.push({
33
+ id: result.steps.length,
34
+ type: CommonStepType.TOKEN_APPROVAL,
35
+ name: 'Approve spending'
36
+ });
37
+ result.totalFee.push(MOCK_STEP_FEE);
38
+ }
39
+ } catch (e) {
40
+ console.error(e);
41
+ result.steps.push({
42
+ id: result.steps.length,
43
+ type: CommonStepType.TOKEN_APPROVAL,
44
+ name: 'Approve spending'
45
+ });
46
+ result.totalFee.push(MOCK_STEP_FEE);
47
+ }
37
48
  result.steps.push({
38
49
  id: result.steps.length,
39
50
  type: CommonStepType.TRANSFER,
@@ -42,20 +53,36 @@ export async function getSnowbridgeTransferProcessFromEvm(address, evmApi, token
42
53
  result.totalFee.push(MOCK_STEP_FEE);
43
54
  return Promise.resolve(result);
44
55
  }
45
- export async function getAcrossbridgeTransferProcessFromEvm(SpokePoolAddress) {
56
+ export async function getAcrossbridgeTransferProcessFromEvm(SpokePoolAddress, address, tokenInfo, evmApi, amount) {
46
57
  const result = {
47
58
  totalFee: [MOCK_STEP_FEE],
48
59
  steps: [DEFAULT_FIRST_STEP]
49
60
  };
50
- result.steps.push({
51
- id: result.steps.length,
52
- type: CommonStepType.TOKEN_APPROVAL,
53
- name: 'Approve spending',
54
- metadata: {
55
- SpokePoolAddress
61
+ try {
62
+ const allowance = await getERC20Allowance(SpokePoolAddress, address, _getContractAddressOfToken(tokenInfo), evmApi);
63
+ if (!allowance || new BigN(allowance).lt(amount)) {
64
+ result.steps.push({
65
+ id: result.steps.length,
66
+ type: CommonStepType.TOKEN_APPROVAL,
67
+ name: 'Approve spending',
68
+ metadata: {
69
+ SpokePoolAddress
70
+ }
71
+ });
72
+ result.totalFee.push(MOCK_STEP_FEE);
56
73
  }
57
- });
58
- result.totalFee.push(MOCK_STEP_FEE);
74
+ } catch (e) {
75
+ console.error(e);
76
+ result.steps.push({
77
+ id: result.steps.length,
78
+ type: CommonStepType.TOKEN_APPROVAL,
79
+ name: 'Approve spending',
80
+ metadata: {
81
+ SpokePoolAddress
82
+ }
83
+ });
84
+ result.totalFee.push(MOCK_STEP_FEE);
85
+ }
59
86
  result.steps.push({
60
87
  id: result.steps.length,
61
88
  type: CommonStepType.TRANSFER,
@@ -613,10 +613,10 @@ export class BalanceService {
613
613
  return getDefaultTransferProcess();
614
614
  }
615
615
  const destChainInfo = this.state.chainService.getChainInfoByKey(params.destChain);
616
+ const evmApi = this.state.chainService.getEvmApi(originChainInfo.slug);
616
617
 
617
618
  // xcm
618
619
  if (!_isXcmWithinSameConsensus(originChainInfo, destChainInfo) && _isPureEvmChain(originChainInfo)) {
619
- const evmApi = this.state.chainService.getEvmApi(originChainInfo.slug);
620
620
  const tokenInfo = this.state.chainService.getAssetBySlug(params.tokenSlug);
621
621
  return getSnowbridgeTransferProcessFromEvm(params.address, evmApi, tokenInfo, params.amount);
622
622
  }
@@ -644,7 +644,7 @@ export class BalanceService {
644
644
  if (!data) {
645
645
  throw new Error('Failed to fetch Across Bridge Data. Please try again later');
646
646
  }
647
- return getAcrossbridgeTransferProcessFromEvm(data.to);
647
+ return getAcrossbridgeTransferProcessFromEvm(data.to, params.address, originTokenInfo, evmApi, params.amount);
648
648
  }
649
649
  }
650
650
  return getDefaultTransferProcess();
@@ -52,6 +52,9 @@ export declare const _NFT_CHAIN_GROUP: {
52
52
  rari: string[];
53
53
  story_odyssey: string[];
54
54
  };
55
+ export declare const NFT_CHAIN_GROUPS_MIGRATED: {
56
+ unique_network: string[];
57
+ };
55
58
  export declare const _STAKING_ERA_LENGTH_MAP: Record<string, number>;
56
59
  export declare const _EXPECTED_BLOCK_TIME: Record<string, number>;
57
60
  export declare const _PARACHAIN_INFLATION_DISTRIBUTION: Record<string, Record<string, number>>;
@@ -67,6 +67,9 @@ export const _NFT_CHAIN_GROUP = {
67
67
  rari: ['rari'],
68
68
  story_odyssey: ['storyOdyssey', 'storyOdyssey_testnet']
69
69
  };
70
+ export const NFT_CHAIN_GROUPS_MIGRATED = {
71
+ unique_network: ['unique_network']
72
+ };
70
73
 
71
74
  // Staking--------------------------------------------------------------------------------------------------------------
72
75
 
@@ -10,7 +10,7 @@ import { estimateXcmFee } from '@subwallet/extension-base/services/balance-servi
10
10
  import { _getAssetDecimals, _getAssetExistentialDeposit, _getAssetSymbol, _getChainName, _getChainNativeTokenSlug } from '@subwallet/extension-base/services/chain-service/utils';
11
11
  import { MIN_XCM_LIQUID_STAKING_DOT } from '@subwallet/extension-base/services/earning-service/constants';
12
12
  import { BasicTxErrorType, YieldStepType, YieldValidationStatus } from '@subwallet/extension-base/types';
13
- import { createPromiseHandler, formatNumber } from '@subwallet/extension-base/utils';
13
+ import { _reformatAddressWithChain, createPromiseHandler, formatNumber } from '@subwallet/extension-base/utils';
14
14
  import { getId } from '@subwallet/extension-base/utils/getId';
15
15
  import BigN from 'bignumber.js';
16
16
  import { t } from 'i18next';
@@ -466,6 +466,7 @@ export default class BaseSpecialStakingPoolHandler extends BasePoolHandler {
466
466
  const originChainInfo = this.state.getChainInfo(originTokenInfo.originChain);
467
467
  const originTokenSlug = _getChainNativeTokenSlug(originChainInfo);
468
468
  const substrateApi = this.state.getSubstrateApi(originChainInfo.slug);
469
+ const fromAddress = _reformatAddressWithChain(address, originChainInfo);
469
470
  const id = getId();
470
471
  const feeInfo = await this.state.feeService.subscribeChainFee(id, originChainInfo.slug, 'substrate');
471
472
  const xcmRequest = {
@@ -474,7 +475,7 @@ export default class BaseSpecialStakingPoolHandler extends BasePoolHandler {
474
475
  recipient: address,
475
476
  sendingValue,
476
477
  substrateApi,
477
- sender: address,
478
+ sender: fromAddress,
478
479
  originChain: originChainInfo,
479
480
  destinationChain: this.chainInfo,
480
481
  feeInfo
@@ -486,7 +487,7 @@ export default class BaseSpecialStakingPoolHandler extends BasePoolHandler {
486
487
  const xcmData = {
487
488
  originNetworkKey: originChainInfo.slug,
488
489
  destinationNetworkKey: destinationTokenInfo.originChain,
489
- from: address,
490
+ from: fromAddress,
490
491
  to: address,
491
492
  value: sendingValue,
492
493
  tokenSlug: originTokenSlug,
@@ -1,9 +1,45 @@
1
- import { NftFullListRequest } from '@subwallet/extension-base/background/KoniTypes';
1
+ import { NftCollection, NftDetailRequest, NftFullListRequest, NftItem, NftJson } from '@subwallet/extension-base/background/KoniTypes';
2
2
  import KoniState from '@subwallet/extension-base/koni/background/handlers/State';
3
- export default class NftService {
4
- private inProgress;
5
- private state;
3
+ import { ServiceStatus, StoppableServiceInterface } from '@subwallet/extension-base/services/base/types';
4
+ import { PromiseHandler } from '@subwallet/extension-base/utils';
5
+ export interface NftState {
6
+ nftData: NftJson;
7
+ nftCollections: NftCollection[];
8
+ }
9
+ export declare class NftService implements StoppableServiceInterface {
10
+ private readonly state;
11
+ private readonly multiChainFetcher;
12
+ private _intervalFetchNft;
13
+ private readonly NFT_INTERVAL_TIME;
14
+ private readonly nftStateSubject;
15
+ readonly nftState$: import("rxjs").Observable<NftState>;
16
+ private isReloading;
17
+ startPromiseHandler: PromiseHandler<void>;
18
+ stopPromiseHandler: PromiseHandler<void>;
19
+ status: ServiceStatus;
20
+ get isStarted(): boolean;
6
21
  constructor(state: KoniState);
7
- fetchEvmCollectionsWithPreview(addresses: string[]): Promise<void>;
8
- getFullNftInstancesByCollection(request: NftFullListRequest): Promise<boolean>;
22
+ init(): Promise<void>;
23
+ private loadCachedData;
24
+ start(): Promise<void>;
25
+ stop(): Promise<void>;
26
+ waitForStarted(): Promise<void>;
27
+ waitForStopped(): Promise<void>;
28
+ private checkIfNftUpdateNeeded;
29
+ private extractUpdatedChains;
30
+ private hasNftSupportedChainUpdate;
31
+ private isChainNftSupported;
32
+ private handleImmediateRefresh;
33
+ private scheduleLazyRefresh;
34
+ private handleEvents;
35
+ fetchFullListNftOfACollection(request: NftFullListRequest): Promise<boolean>;
36
+ fetchNftDetail(request: NftDetailRequest): Promise<NftItem | null>;
37
+ private startScanNft;
38
+ private stopScanNft;
39
+ private persistNftData;
40
+ private refreshNftData;
41
+ /** Subscribe NFT state */
42
+ subscribeNftItem(): import("rxjs").Observable<NftState>;
43
+ subscribeNftCollection(): import("dexie").Observable<NftCollection[]>;
44
+ forceReload(): Promise<void>;
9
45
  }