@subwallet/extension-base 1.1.49-0 → 1.1.51-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.
@@ -1744,6 +1744,8 @@ export interface KoniRequestSignatures {
1744
1744
  'pri(settings.saveLanguage)': [RequestChangeLanguage, boolean];
1745
1745
  'pri(settings.saveShowZeroBalance)': [RequestChangeShowZeroBalance, boolean];
1746
1746
  'pri(settings.saveShowBalance)': [RequestChangeShowBalance, boolean];
1747
+ 'pri(settings.logo.assets.subscribe)': [null, Record<string, string>, Record<string, string>];
1748
+ 'pri(settings.logo.chains.subscribe)': [null, Record<string, string>, Record<string, string>];
1747
1749
  'pri(yield.subscribePoolInfo)': [null, YieldPoolInfo[], YieldPoolInfo[]];
1748
1750
  'pri(yield.subscribeYieldPosition)': [null, YieldPositionInfo[], YieldPositionInfo[]];
1749
1751
  'pri(yield.subscribeYieldReward)': [null, EarningRewardJson, EarningRewardJson];
@@ -3270,20 +3270,16 @@ class KoniExtension {
3270
3270
  }
3271
3271
  async subscribeAssetRegistry(id, port) {
3272
3272
  const cb = (0, _subscriptions.createSubscription)(id, port);
3273
- let ready = false;
3273
+ await this.#koniState.eventService.waitAssetOnlineReady;
3274
3274
  const assetRegistrySubscription = this.#koniState.subscribeAssetRegistry().subscribe({
3275
3275
  next: rs => {
3276
- if (ready) {
3277
- cb(rs);
3278
- }
3276
+ cb(rs);
3279
3277
  }
3280
3278
  });
3281
3279
  this.createUnsubscriptionHandle(id, assetRegistrySubscription.unsubscribe);
3282
3280
  port.onDisconnect.addListener(() => {
3283
3281
  this.cancelSubscription(id);
3284
3282
  });
3285
- await this.#koniState.eventService.waitAssetReady;
3286
- ready = true;
3287
3283
  return this.#koniState.getAssetRegistry();
3288
3284
  }
3289
3285
  subscribeMultiChainAssetMap(id, port) {
@@ -3383,6 +3379,28 @@ class KoniExtension {
3383
3379
  assetLogoMap
3384
3380
  };
3385
3381
  }
3382
+ subscribeAssetLogoMap(id, port) {
3383
+ const cb = (0, _subscriptions.createSubscription)(id, port);
3384
+ const subscription = this.#koniState.chainService.subscribeAssetLogoMap().subscribe(rs => {
3385
+ cb(rs);
3386
+ });
3387
+ port.onDisconnect.addListener(() => {
3388
+ subscription.unsubscribe();
3389
+ this.cancelSubscription(id);
3390
+ });
3391
+ return this.#koniState.chainService.getAssetLogoMap();
3392
+ }
3393
+ subscribeChainLogoMap(id, port) {
3394
+ const cb = (0, _subscriptions.createSubscription)(id, port);
3395
+ const subscription = this.#koniState.chainService.subscribeChainLogoMap().subscribe(rs => {
3396
+ cb(rs);
3397
+ });
3398
+ port.onDisconnect.addListener(() => {
3399
+ subscription.unsubscribe();
3400
+ this.cancelSubscription(id);
3401
+ });
3402
+ return this.#koniState.chainService.getChainLogoMap();
3403
+ }
3386
3404
 
3387
3405
  // Phishing detect
3388
3406
 
@@ -4483,6 +4501,10 @@ class KoniExtension {
4483
4501
  return await this.reloadCron(request);
4484
4502
  case 'pri(settings.getLogoMaps)':
4485
4503
  return await this.getLogoMap();
4504
+ case 'pri(settings.logo.assets.subscribe)':
4505
+ return this.subscribeAssetLogoMap(id, port);
4506
+ case 'pri(settings.logo.chains.subscribe)':
4507
+ return this.subscribeChainLogoMap(id, port);
4486
4508
 
4487
4509
  /// Wallet Connect
4488
4510
  case 'pri(walletConnect.connect)':
@@ -13,6 +13,6 @@ const packageInfo = {
13
13
  name: '@subwallet/extension-base',
14
14
  path: typeof __dirname === 'string' ? __dirname : 'auto',
15
15
  type: 'cjs',
16
- version: '1.1.49-0'
16
+ version: '1.1.51-0'
17
17
  };
18
18
  exports.packageInfo = packageInfo;
@@ -40,7 +40,7 @@ const _BALANCE_CHAIN_GROUP = {
40
40
  genshiro: ['genshiro_testnet', 'genshiro'],
41
41
  equilibrium_parachain: ['equilibrium_parachain'],
42
42
  bifrost: ['bifrost', 'acala', 'karura', 'acala_testnet', 'pioneer', 'bitcountry', 'bifrost_dot', 'hydradx_main', 'pendulum', 'amplitude', 'continuum_network'],
43
- statemine: ['statemine', 'astar', 'shiden', 'statemint', 'moonbeam', 'moonbase', 'moonriver', 'crabParachain', 'darwinia2', 'parallel', 'calamari', 'manta_network', 'rococo_assethub', 'liberlandTest', 'liberland', 'dentnet', 'pangolin', 'crust', 'phala'],
43
+ statemine: ['statemine', 'astar', 'shiden', 'statemint', 'moonbeam', 'moonbase', 'moonriver', 'crabParachain', 'darwinia2', 'parallel', 'calamari', 'manta_network', 'rococo_assethub', 'liberlandTest', 'liberland', 'dentnet', 'pangolin', 'crust', 'phala', 'shibuya'],
44
44
  kusama: ['kusama', 'kintsugi', 'kintsugi_test', 'interlay', 'acala', 'statemint', 'karura', 'bifrost'],
45
45
  // perhaps there are some runtime updates
46
46
  centrifuge: ['centrifuge'],
@@ -42,6 +42,10 @@ class ChainService {
42
42
  assetRegistrySubject = new _rxjs.Subject();
43
43
  multiChainAssetMapSubject = new _rxjs.Subject();
44
44
  xcmRefMapSubject = new _rxjs.Subject();
45
+ assetLogoMapSubject = new _rxjs.BehaviorSubject(_chainList.AssetLogoMap);
46
+ chainLogoMapSubject = new _rxjs.BehaviorSubject(_chainList.ChainLogoMap);
47
+ assetMapPatch = JSON.stringify({});
48
+ assetLogoPatch = JSON.stringify({});
45
49
 
46
50
  // Todo: Update to new store indexed DB
47
51
  store = new _AssetSetting.default();
@@ -451,27 +455,12 @@ class ChainService {
451
455
  this.xcmRefMapSubject.next(this.xcmRefMap);
452
456
  await this.initApis();
453
457
  await this.initAssetSettings();
454
- await this.initAssetRefMap();
458
+ this.initAssetRefMap();
459
+ await this.autoEnableTokens();
455
460
  this.checkLatestData();
456
461
  }
457
- async initAssetRefMap() {
458
- try {
459
- const fetchPromise = this.fetchLatestBlockedAssetRef();
460
- const timeout = new Promise(resolve => {
461
- const id = setTimeout(() => {
462
- clearTimeout(id);
463
- resolve(null);
464
- }, 1000);
465
- });
466
- const disabledAssetRefs = (await Promise.race([timeout, fetchPromise])) || null;
467
- if (disabledAssetRefs) {
468
- this.handleLatestBlockedAssetRef(disabledAssetRefs);
469
- } else {
470
- this.dataMap.assetRefMap = _chainList.AssetRefMap;
471
- }
472
- } catch (e) {
473
- this.dataMap.assetRefMap = _chainList.AssetRefMap;
474
- }
462
+ initAssetRefMap() {
463
+ this.dataMap.assetRefMap = _chainList.AssetRefMap;
475
464
  }
476
465
  checkLatestData() {
477
466
  clearInterval(this.refreshLatestChainDataTimeOut);
@@ -500,10 +489,15 @@ class ChainService {
500
489
  console.error('Error fetching latest chain data');
501
490
  }
502
491
  }
503
- handleLatestBlockedAssetRef(latestBlockedAssetRefList) {
492
+ handleLatestAssetRef(latestBlockedAssetRefList, latestAssetRefMap) {
504
493
  const updatedAssetRefMap = {
505
494
  ..._chainList.AssetRefMap
506
495
  };
496
+ if (latestAssetRefMap) {
497
+ for (const [assetRefKey, assetRef] of Object.entries(latestAssetRefMap)) {
498
+ updatedAssetRefMap[assetRefKey] = assetRef;
499
+ }
500
+ }
507
501
  latestBlockedAssetRefList.forEach(blockedAssetRef => {
508
502
  delete updatedAssetRefMap[blockedAssetRef];
509
503
  });
@@ -526,12 +520,76 @@ class ChainService {
526
520
  }
527
521
  this.logger.log('Finished updating latest price IDs');
528
522
  }
523
+ handleLatestAssetData(latestAssetInfo, latestAssetLogoMap) {
524
+ try {
525
+ if (latestAssetInfo) {
526
+ const latestAssetPatch = JSON.stringify(latestAssetInfo);
527
+ if (this.assetMapPatch !== latestAssetPatch) {
528
+ const assetRegistry = {
529
+ ..._chainList.ChainAssetMap,
530
+ ...latestAssetInfo
531
+ };
532
+ this.assetMapPatch = latestAssetPatch;
533
+ this.dataMap.assetRegistry = assetRegistry;
534
+ this.assetRegistrySubject.next(assetRegistry);
535
+ this.autoEnableTokens().then(() => {
536
+ this.eventService.emit('asset.updateState', '');
537
+ }).catch(console.error);
538
+ }
539
+ }
540
+ if (latestAssetLogoMap) {
541
+ const latestAssetLogoPatch = JSON.stringify(latestAssetLogoMap);
542
+ if (this.assetLogoPatch !== latestAssetLogoPatch) {
543
+ const logoMap = {
544
+ ..._chainList.AssetLogoMap,
545
+ ...latestAssetLogoMap
546
+ };
547
+ this.assetLogoPatch = latestAssetLogoPatch;
548
+ this.assetLogoMapSubject.next(logoMap);
549
+ }
550
+ }
551
+ } catch (e) {
552
+ console.error('Error fetching latest asset data');
553
+ }
554
+ this.eventService.emit('asset.online.ready', true);
555
+ this.logger.log('Finished updating latest asset');
556
+ }
557
+ async autoEnableTokens() {
558
+ const autoEnableTokens = Object.values(this.dataMap.assetRegistry).filter(asset => (0, _utils._isAssetAutoEnable)(asset));
559
+ const assetSettings = this.assetSettingSubject.value;
560
+ const chainStateMap = this.getChainStateMap();
561
+ for (const asset of autoEnableTokens) {
562
+ const {
563
+ originChain,
564
+ slug: assetSlug
565
+ } = asset;
566
+ const assetState = assetSettings[assetSlug];
567
+ const chainState = chainStateMap[originChain];
568
+ if (!assetState) {
569
+ // If this asset not has asset setting, this token is not enabled before (not turned off before)
570
+ // @ts-ignore
571
+ // TODO: Merge issue detect balance to define manualTurnOff props
572
+ if (!chainState || !chainState.manualTurnOff) {
573
+ await this.updateAssetSetting(assetSlug, {
574
+ visible: true
575
+ });
576
+ }
577
+ }
578
+ }
579
+ }
529
580
  handleLatestData() {
581
+ this.fetchLatestAssetData().then(_ref6 => {
582
+ let [latestAssetInfo, latestAssetLogoMap] = _ref6;
583
+ this.eventService.waitAssetReady.then(() => {
584
+ this.handleLatestAssetData(latestAssetInfo, latestAssetLogoMap);
585
+ }).catch(console.error);
586
+ }).catch(console.error);
530
587
  this.fetchLatestChainData().then(latestChainInfo => {
531
588
  this.handleLatestProviderData(latestChainInfo);
532
589
  }).catch(console.error);
533
- this.fetchLatestBlockedAssetRef().then(latestAssetRef => {
534
- this.handleLatestBlockedAssetRef(latestAssetRef);
590
+ this.fetchLatestAssetRef().then(_ref7 => {
591
+ let [latestAssetRef, latestAssetRefMap] = _ref7;
592
+ this.handleLatestAssetRef(latestAssetRef, latestAssetRefMap);
535
593
  }).catch(console.error);
536
594
  this.fetchLatestPriceIdsData().then(latestPriceIds => {
537
595
  this.handleLatestPriceId(latestPriceIds);
@@ -540,12 +598,12 @@ class ChainService {
540
598
  async initApis() {
541
599
  const chainInfoMap = this.getChainInfoMap();
542
600
  const chainStateMap = this.getChainStateMap();
543
- await Promise.all(Object.entries(chainInfoMap).filter(_ref6 => {
601
+ await Promise.all(Object.entries(chainInfoMap).filter(_ref8 => {
544
602
  var _chainStateMap$slug;
545
- let [slug] = _ref6;
603
+ let [slug] = _ref8;
546
604
  return (_chainStateMap$slug = chainStateMap[slug]) === null || _chainStateMap$slug === void 0 ? void 0 : _chainStateMap$slug.active;
547
- }).map(_ref7 => {
548
- let [, chainInfo] = _ref7;
605
+ }).map(_ref9 => {
606
+ let [, chainInfo] = _ref9;
549
607
  try {
550
608
  return this.initApiForChain(chainInfo);
551
609
  } catch (e) {
@@ -727,12 +785,16 @@ class ChainService {
727
785
  // }
728
786
  }
729
787
 
788
+ async fetchLatestAssetData() {
789
+ return await Promise.all([(0, _utils.fetchPatchData)('ChainAsset.json'), (0, _utils.fetchPatchData)('AssetLogoMap.json')]);
790
+ }
791
+
730
792
  // @ts-ignore
731
793
  async fetchLatestPriceIdsData() {
732
794
  return await (0, _utils2.fetchStaticData)('chain-assets/price-map');
733
795
  }
734
- async fetchLatestBlockedAssetRef() {
735
- return await (0, _utils2.fetchStaticData)('chain-assets/disabled-xcm-channels');
796
+ async fetchLatestAssetRef() {
797
+ return await Promise.all([(0, _utils2.fetchStaticData)('chain-assets/disabled-xcm-channels'), (0, _utils.fetchPatchData)('AssetRef.json')]);
736
798
  }
737
799
  async initChains() {
738
800
  const storedChainSettings = await this.dbService.getAllChainStore();
@@ -870,8 +932,8 @@ class ChainService {
870
932
  }
871
933
 
872
934
  // Fill in the missing chainState and storageData (new chains never before seen)
873
- Object.entries(mergedChainInfoMap).forEach(_ref8 => {
874
- let [slug, chainInfo] = _ref8;
935
+ Object.entries(mergedChainInfoMap).forEach(_ref10 => {
936
+ let [slug, chainInfo] = _ref10;
875
937
  if (!(slug in this.dataMap.chainStateMap)) {
876
938
  this.dataMap.chainStateMap[slug] = {
877
939
  currentProvider: Object.keys(chainInfo.providers)[0],
@@ -1467,11 +1529,17 @@ class ChainService {
1467
1529
  subscribeAssetSettings() {
1468
1530
  return this.assetSettingSubject;
1469
1531
  }
1470
- async getChainLogoMap() {
1471
- return Promise.resolve(_chainList.ChainLogoMap);
1532
+ getAssetLogoMap() {
1533
+ return this.assetLogoMapSubject.value;
1534
+ }
1535
+ subscribeAssetLogoMap() {
1536
+ return this.assetLogoMapSubject;
1537
+ }
1538
+ getChainLogoMap() {
1539
+ return this.chainLogoMapSubject.value;
1472
1540
  }
1473
- async getAssetLogoMap() {
1474
- return Promise.resolve(_chainList.AssetLogoMap);
1541
+ subscribeChainLogoMap() {
1542
+ return this.chainLogoMapSubject;
1475
1543
  }
1476
1544
  resetWallet(resetAll) {
1477
1545
  if (resetAll) {
@@ -3,6 +3,78 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ var _exportNames = {
7
+ _isCustomChain: true,
8
+ _isCustomAsset: true,
9
+ _getCustomAssets: true,
10
+ _isEqualContractAddress: true,
11
+ _isEqualSmartContractAsset: true,
12
+ _isPureEvmChain: true,
13
+ _isPureSubstrateChain: true,
14
+ _getOriginChainOfAsset: true,
15
+ _getContractAddressOfToken: true,
16
+ _isTokenTransferredByEvm: true,
17
+ _checkSmartContractSupportByChain: true,
18
+ _getTokenOnChainAssetId: true,
19
+ _getTokenOnChainInfo: true,
20
+ _isBridgedToken: true,
21
+ _getTokenMinAmount: true,
22
+ _isChainEvmCompatible: true,
23
+ _isNativeToken: true,
24
+ _isNativeTokenBySlug: true,
25
+ _isSmartContractToken: true,
26
+ _isSubstrateChain: true,
27
+ _getEvmChainId: true,
28
+ _getSubstrateParaId: true,
29
+ _getSubstrateRelayParent: true,
30
+ _getSubstrateGenesisHash: true,
31
+ _isChainSupportSubstrateStaking: true,
32
+ _isChainEnabled: true,
33
+ _getChainSubstrateAddressPrefix: true,
34
+ _isChainSupportNativeNft: true,
35
+ _isChainSupportEvmNft: true,
36
+ _isChainSupportWasmNft: true,
37
+ _isSupportOrdinal: true,
38
+ _getNftTypesSupportedByChain: true,
39
+ _getTokenTypesSupportedByChain: true,
40
+ _getChainNativeTokenBasicInfo: true,
41
+ _getChainNativeTokenSlug: true,
42
+ _isLocalToken: true,
43
+ _isTokenEvmSmartContract: true,
44
+ _isTokenWasmSmartContract: true,
45
+ _isAssetSmartContractNft: true,
46
+ _parseAssetRefKey: true,
47
+ _isXcmPathSupported: true,
48
+ _getXcmAssetType: true,
49
+ _getXcmAssetId: true,
50
+ _getXcmAssetMultilocation: true,
51
+ _getXcmTransferType: true,
52
+ _isSubstrateRelayChain: true,
53
+ _isSubstrateParaChain: true,
54
+ _getEvmAbiExplorer: true,
55
+ _isAssetValuable: true,
56
+ _getMultiChainAsset: true,
57
+ _getAssetPriceId: true,
58
+ _getMultiChainAssetPriceId: true,
59
+ _getAssetSymbol: true,
60
+ _getMultiChainAssetSymbol: true,
61
+ _getAssetOriginChain: true,
62
+ _getChainName: true,
63
+ _getAssetDecimals: true,
64
+ _getBlockExplorerFromChain: true,
65
+ _parseMetadataForSmartContractAsset: true,
66
+ _isChainTestNet: true,
67
+ _isAssetFungibleToken: true,
68
+ _isAssetAutoEnable: true,
69
+ _getCrowdloanUrlFromChain: true,
70
+ _isCustomProvider: true,
71
+ _generateCustomProviderKey: true,
72
+ findChainInfoByHalfGenesisHash: true,
73
+ findChainInfoByChainId: true,
74
+ _isMantaZkAsset: true,
75
+ randomizeProvider: true,
76
+ updateLatestChainInfo: true
77
+ };
6
78
  exports._checkSmartContractSupportByChain = _checkSmartContractSupportByChain;
7
79
  exports._generateCustomProviderKey = _generateCustomProviderKey;
8
80
  exports._getAssetDecimals = _getAssetDecimals;
@@ -35,6 +107,7 @@ exports._getXcmAssetId = _getXcmAssetId;
35
107
  exports._getXcmAssetMultilocation = _getXcmAssetMultilocation;
36
108
  exports._getXcmAssetType = _getXcmAssetType;
37
109
  exports._getXcmTransferType = _getXcmTransferType;
110
+ exports._isAssetAutoEnable = void 0;
38
111
  exports._isAssetFungibleToken = _isAssetFungibleToken;
39
112
  exports._isAssetSmartContractNft = _isAssetSmartContractNft;
40
113
  exports._isAssetValuable = _isAssetValuable;
@@ -75,6 +148,18 @@ var _types = require("@subwallet/chain-list/types");
75
148
  var _constants = require("@subwallet/extension-base/services/chain-service/constants");
76
149
  var _types2 = require("@subwallet/extension-base/services/chain-service/types");
77
150
  var _utilCrypto = require("@polkadot/util-crypto");
151
+ var _patch = require("./patch");
152
+ Object.keys(_patch).forEach(function (key) {
153
+ if (key === "default" || key === "__esModule") return;
154
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
155
+ if (key in exports && exports[key] === _patch[key]) return;
156
+ Object.defineProperty(exports, key, {
157
+ enumerable: true,
158
+ get: function () {
159
+ return _patch[key];
160
+ }
161
+ });
162
+ });
78
163
  // Copyright 2019-2022 @subwallet/extension-base
79
164
  // SPDX-License-Identifier: Apache-2.0
80
165
 
@@ -404,6 +489,10 @@ function _isChainTestNet(chainInfo) {
404
489
  function _isAssetFungibleToken(chainAsset) {
405
490
  return ![_types._AssetType.ERC721, _types._AssetType.PSP34, _types._AssetType.UNKNOWN].includes(chainAsset.assetType);
406
491
  }
492
+ const _isAssetAutoEnable = chainAsset => {
493
+ return chainAsset.metadata ? !!chainAsset.metadata.autoEnable : false;
494
+ };
495
+ exports._isAssetAutoEnable = _isAssetAutoEnable;
407
496
  function _getCrowdloanUrlFromChain(chainInfo) {
408
497
  var _chainInfo$substrateI13;
409
498
  return (chainInfo === null || chainInfo === void 0 ? void 0 : (_chainInfo$substrateI13 = chainInfo.substrateInfo) === null || _chainInfo$substrateI13 === void 0 ? void 0 : _chainInfo$substrateI13.crowdloanUrl) || '';
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.fetchPatchData = fetchPatchData;
8
+ var _packageInfo = require("@subwallet/chain-list/packageInfo");
9
+ var _crossFetch = _interopRequireDefault(require("cross-fetch"));
10
+ // Copyright 2019-2022 @subwallet/extension-base
11
+ // SPDX-License-Identifier: Apache-2.0
12
+
13
+ const PRODUCTION_BRANCHES = ['master', 'webapp', 'webapp-dev'];
14
+ const branchName = process.env.BRANCH_NAME || 'subwallet-dev';
15
+ const fetchDomain = PRODUCTION_BRANCHES.indexOf(branchName) > -1 ? 'https://chain-list-assets.subwallet.app' : 'https://dev.sw-chain-list-assets.pages.dev';
16
+ async function fetchPatchData(slug) {
17
+ try {
18
+ const fetchPromise = (0, _crossFetch.default)(`${fetchDomain}/patch/${_packageInfo.packageInfo.version}/${slug}`);
19
+ const timeout = new Promise(resolve => {
20
+ const id = setTimeout(() => {
21
+ clearTimeout(id);
22
+ resolve(null);
23
+ }, 1000);
24
+ });
25
+ const rs = await Promise.race([timeout, fetchPromise]);
26
+ if (!rs) {
27
+ return null;
28
+ }
29
+ return await rs.json();
30
+ } catch (e) {
31
+ return null;
32
+ }
33
+ }
@@ -29,6 +29,7 @@ class EventService extends _eventemitter.default {
29
29
  this.waitInjectReady = _utils.TARGET_ENV === 'webapp' ? this.generateWaitPromise('inject.ready') : Promise.resolve(true);
30
30
  this.waitChainReady = this.generateWaitPromise('chain.ready');
31
31
  this.waitAssetReady = this.generateWaitPromise('asset.ready');
32
+ this.waitAssetOnlineReady = this.generateWaitPromise('asset.online.ready');
32
33
  this.waitMigrateReady = this.generateWaitPromise('migration.done');
33
34
  this.waitCampaignReady = this.generateWaitPromise('campaign.ready');
34
35
  this.waitBuyTokenReady = this.generateWaitPromise('buy.tokens.ready');
@@ -195,6 +195,8 @@ export default class KoniExtension {
195
195
  private subscribeNotifications;
196
196
  private reloadCron;
197
197
  private getLogoMap;
198
+ private subscribeAssetLogoMap;
199
+ private subscribeChainLogoMap;
198
200
  private passPhishingPage;
199
201
  private connectWalletConnect;
200
202
  private connectWCSubscribe;
@@ -3184,20 +3184,16 @@ export default class KoniExtension {
3184
3184
  }
3185
3185
  async subscribeAssetRegistry(id, port) {
3186
3186
  const cb = createSubscription(id, port);
3187
- let ready = false;
3187
+ await this.#koniState.eventService.waitAssetOnlineReady;
3188
3188
  const assetRegistrySubscription = this.#koniState.subscribeAssetRegistry().subscribe({
3189
3189
  next: rs => {
3190
- if (ready) {
3191
- cb(rs);
3192
- }
3190
+ cb(rs);
3193
3191
  }
3194
3192
  });
3195
3193
  this.createUnsubscriptionHandle(id, assetRegistrySubscription.unsubscribe);
3196
3194
  port.onDisconnect.addListener(() => {
3197
3195
  this.cancelSubscription(id);
3198
3196
  });
3199
- await this.#koniState.eventService.waitAssetReady;
3200
- ready = true;
3201
3197
  return this.#koniState.getAssetRegistry();
3202
3198
  }
3203
3199
  subscribeMultiChainAssetMap(id, port) {
@@ -3294,6 +3290,28 @@ export default class KoniExtension {
3294
3290
  assetLogoMap
3295
3291
  };
3296
3292
  }
3293
+ subscribeAssetLogoMap(id, port) {
3294
+ const cb = createSubscription(id, port);
3295
+ const subscription = this.#koniState.chainService.subscribeAssetLogoMap().subscribe(rs => {
3296
+ cb(rs);
3297
+ });
3298
+ port.onDisconnect.addListener(() => {
3299
+ subscription.unsubscribe();
3300
+ this.cancelSubscription(id);
3301
+ });
3302
+ return this.#koniState.chainService.getAssetLogoMap();
3303
+ }
3304
+ subscribeChainLogoMap(id, port) {
3305
+ const cb = createSubscription(id, port);
3306
+ const subscription = this.#koniState.chainService.subscribeChainLogoMap().subscribe(rs => {
3307
+ cb(rs);
3308
+ });
3309
+ port.onDisconnect.addListener(() => {
3310
+ subscription.unsubscribe();
3311
+ this.cancelSubscription(id);
3312
+ });
3313
+ return this.#koniState.chainService.getChainLogoMap();
3314
+ }
3297
3315
 
3298
3316
  // Phishing detect
3299
3317
 
@@ -4379,6 +4397,10 @@ export default class KoniExtension {
4379
4397
  return await this.reloadCron(request);
4380
4398
  case 'pri(settings.getLogoMaps)':
4381
4399
  return await this.getLogoMap();
4400
+ case 'pri(settings.logo.assets.subscribe)':
4401
+ return this.subscribeAssetLogoMap(id, port);
4402
+ case 'pri(settings.logo.chains.subscribe)':
4403
+ return this.subscribeChainLogoMap(id, port);
4382
4404
 
4383
4405
  /// Wallet Connect
4384
4406
  case 'pri(walletConnect.connect)':
package/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "./cjs/detectPackage.js"
18
18
  ],
19
19
  "type": "module",
20
- "version": "1.1.49-0",
20
+ "version": "1.1.51-0",
21
21
  "main": "./cjs/index.js",
22
22
  "module": "./index.js",
23
23
  "types": "./index.d.ts",
@@ -714,9 +714,14 @@
714
714
  "default": "./services/chain-service/types.js"
715
715
  },
716
716
  "./services/chain-service/utils": {
717
- "types": "./services/chain-service/utils.d.ts",
718
- "require": "./cjs/services/chain-service/utils.js",
719
- "default": "./services/chain-service/utils.js"
717
+ "types": "./services/chain-service/utils/index.d.ts",
718
+ "require": "./cjs/services/chain-service/utils/index.js",
719
+ "default": "./services/chain-service/utils/index.js"
720
+ },
721
+ "./services/chain-service/utils/patch": {
722
+ "types": "./services/chain-service/utils/patch.d.ts",
723
+ "require": "./cjs/services/chain-service/utils/patch.js",
724
+ "default": "./services/chain-service/utils/patch.js"
720
725
  },
721
726
  "./services/earning-service/constants": {
722
727
  "types": "./services/earning-service/constants/index.d.ts",
@@ -1796,11 +1801,11 @@
1796
1801
  "@reduxjs/toolkit": "^1.9.1",
1797
1802
  "@sora-substrate/type-definitions": "^1.17.7",
1798
1803
  "@substrate/connect": "^0.7.26",
1799
- "@subwallet/chain-list": "0.2.52",
1800
- "@subwallet/extension-base": "^1.1.49-0",
1801
- "@subwallet/extension-chains": "^1.1.49-0",
1802
- "@subwallet/extension-dapp": "^1.1.49-0",
1803
- "@subwallet/extension-inject": "^1.1.49-0",
1804
+ "@subwallet/chain-list": "0.2.53",
1805
+ "@subwallet/extension-base": "^1.1.51-0",
1806
+ "@subwallet/extension-chains": "^1.1.51-0",
1807
+ "@subwallet/extension-dapp": "^1.1.51-0",
1808
+ "@subwallet/extension-inject": "^1.1.51-0",
1804
1809
  "@subwallet/keyring": "^0.1.3",
1805
1810
  "@subwallet/ui-keyring": "^0.1.3",
1806
1811
  "@walletconnect/sign-client": "^2.8.4",
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.1.49-0'
10
+ version: '1.1.51-0'
11
11
  };
@@ -29,7 +29,7 @@ export const _BALANCE_CHAIN_GROUP = {
29
29
  genshiro: ['genshiro_testnet', 'genshiro'],
30
30
  equilibrium_parachain: ['equilibrium_parachain'],
31
31
  bifrost: ['bifrost', 'acala', 'karura', 'acala_testnet', 'pioneer', 'bitcountry', 'bifrost_dot', 'hydradx_main', 'pendulum', 'amplitude', 'continuum_network'],
32
- statemine: ['statemine', 'astar', 'shiden', 'statemint', 'moonbeam', 'moonbase', 'moonriver', 'crabParachain', 'darwinia2', 'parallel', 'calamari', 'manta_network', 'rococo_assethub', 'liberlandTest', 'liberland', 'dentnet', 'pangolin', 'crust', 'phala'],
32
+ statemine: ['statemine', 'astar', 'shiden', 'statemint', 'moonbeam', 'moonbase', 'moonriver', 'crabParachain', 'darwinia2', 'parallel', 'calamari', 'manta_network', 'rococo_assethub', 'liberlandTest', 'liberland', 'dentnet', 'pangolin', 'crust', 'phala', 'shibuya'],
33
33
  kusama: ['kusama', 'kintsugi', 'kintsugi_test', 'interlay', 'acala', 'statemint', 'karura', 'bifrost'],
34
34
  // perhaps there are some runtime updates
35
35
  centrifuge: ['centrifuge'],
@@ -23,6 +23,10 @@ export declare class ChainService {
23
23
  private assetRegistrySubject;
24
24
  private multiChainAssetMapSubject;
25
25
  private xcmRefMapSubject;
26
+ private assetLogoMapSubject;
27
+ private chainLogoMapSubject;
28
+ private assetMapPatch;
29
+ private assetLogoPatch;
26
30
  private store;
27
31
  private assetSettingSubject;
28
32
  private logger;
@@ -76,12 +80,14 @@ export declare class ChainService {
76
80
  deleteAssetsByChain(chainSlug: string): void;
77
81
  deleteCustomAssets(targetAssets: string[]): void;
78
82
  init(): Promise<void>;
79
- initAssetRefMap(): Promise<void>;
83
+ initAssetRefMap(): void;
80
84
  checkLatestData(): void;
81
85
  stopCheckLatestChainData(): void;
82
86
  handleLatestProviderData(latestChainInfo: _ChainInfo[]): void;
83
- handleLatestBlockedAssetRef(latestBlockedAssetRefList: string[]): void;
87
+ handleLatestAssetRef(latestBlockedAssetRefList: string[], latestAssetRefMap: Record<string, _AssetRef> | null): void;
84
88
  handleLatestPriceId(latestPriceIds: Record<string, string | null>): void;
89
+ handleLatestAssetData(latestAssetInfo: Record<string, _ChainAsset> | null, latestAssetLogoMap: Record<string, string> | null): void;
90
+ autoEnableTokens(): Promise<void>;
85
91
  handleLatestData(): void;
86
92
  private initApis;
87
93
  private initApiForChain;
@@ -92,8 +98,9 @@ export declare class ChainService {
92
98
  disableChain(chainSlug: string): boolean;
93
99
  private checkExistedPredefinedChain;
94
100
  private fetchLatestChainData;
101
+ private fetchLatestAssetData;
95
102
  private fetchLatestPriceIdsData;
96
- private fetchLatestBlockedAssetRef;
103
+ private fetchLatestAssetRef;
97
104
  private initChains;
98
105
  private initAssetRegistry;
99
106
  private updateChainStateMapSubscription;
@@ -122,8 +129,10 @@ export declare class ChainService {
122
129
  updateAssetSetting(assetSlug: string, assetSetting: AssetSetting, autoEnableNativeToken?: boolean): Promise<boolean | undefined>;
123
130
  updateAssetSettingByChain(chainSlug: string, visible: boolean): Promise<void>;
124
131
  subscribeAssetSettings(): BehaviorSubject<Record<string, AssetSetting>>;
125
- getChainLogoMap(): Promise<Record<string, string>>;
126
- getAssetLogoMap(): Promise<Record<string, string>>;
132
+ getAssetLogoMap(): Record<string, string>;
133
+ subscribeAssetLogoMap(): BehaviorSubject<Record<string, string>>;
134
+ getChainLogoMap(): Record<string, string>;
135
+ subscribeChainLogoMap(): BehaviorSubject<Record<string, string>>;
127
136
  resetWallet(resetAll: boolean): void;
128
137
  getMetadata(chain: string): import("dexie").PromiseExtended<IMetadataItem | undefined>;
129
138
  upsertMetadata(chain: string, metadata: IMetadataItem): import("dexie").PromiseExtended<unknown>;
@@ -9,7 +9,7 @@ import { MantaPrivateHandler } from '@subwallet/extension-base/services/chain-se
9
9
  import { SubstrateChainHandler } from '@subwallet/extension-base/services/chain-service/handler/SubstrateChainHandler';
10
10
  import { _CHAIN_VALIDATION_ERROR } from '@subwallet/extension-base/services/chain-service/handler/types';
11
11
  import { _ChainConnectionStatus, _CUSTOM_PREFIX, _NFT_CONTRACT_STANDARDS, _SMART_CONTRACT_STANDARDS } from '@subwallet/extension-base/services/chain-service/types';
12
- import { _isAssetFungibleToken, _isChainEnabled, _isCustomAsset, _isCustomChain, _isCustomProvider, _isEqualContractAddress, _isEqualSmartContractAsset, _isMantaZkAsset, _isPureEvmChain, _isPureSubstrateChain, _parseAssetRefKey, randomizeProvider, updateLatestChainInfo } from '@subwallet/extension-base/services/chain-service/utils';
12
+ import { _isAssetAutoEnable, _isAssetFungibleToken, _isChainEnabled, _isCustomAsset, _isCustomChain, _isCustomProvider, _isEqualContractAddress, _isEqualSmartContractAsset, _isMantaZkAsset, _isPureEvmChain, _isPureSubstrateChain, _parseAssetRefKey, fetchPatchData, randomizeProvider, updateLatestChainInfo } from '@subwallet/extension-base/services/chain-service/utils';
13
13
  import AssetSettingStore from '@subwallet/extension-base/stores/AssetSetting';
14
14
  import { addLazy, fetchStaticData, MODULE_SUPPORT } from '@subwallet/extension-base/utils';
15
15
  import { BehaviorSubject, Subject } from 'rxjs';
@@ -35,6 +35,10 @@ export class ChainService {
35
35
  assetRegistrySubject = new Subject();
36
36
  multiChainAssetMapSubject = new Subject();
37
37
  xcmRefMapSubject = new Subject();
38
+ assetLogoMapSubject = new BehaviorSubject(AssetLogoMap);
39
+ chainLogoMapSubject = new BehaviorSubject(ChainLogoMap);
40
+ assetMapPatch = JSON.stringify({});
41
+ assetLogoPatch = JSON.stringify({});
38
42
 
39
43
  // Todo: Update to new store indexed DB
40
44
  store = new AssetSettingStore();
@@ -435,27 +439,12 @@ export class ChainService {
435
439
  this.xcmRefMapSubject.next(this.xcmRefMap);
436
440
  await this.initApis();
437
441
  await this.initAssetSettings();
438
- await this.initAssetRefMap();
442
+ this.initAssetRefMap();
443
+ await this.autoEnableTokens();
439
444
  this.checkLatestData();
440
445
  }
441
- async initAssetRefMap() {
442
- try {
443
- const fetchPromise = this.fetchLatestBlockedAssetRef();
444
- const timeout = new Promise(resolve => {
445
- const id = setTimeout(() => {
446
- clearTimeout(id);
447
- resolve(null);
448
- }, 1000);
449
- });
450
- const disabledAssetRefs = (await Promise.race([timeout, fetchPromise])) || null;
451
- if (disabledAssetRefs) {
452
- this.handleLatestBlockedAssetRef(disabledAssetRefs);
453
- } else {
454
- this.dataMap.assetRefMap = AssetRefMap;
455
- }
456
- } catch (e) {
457
- this.dataMap.assetRefMap = AssetRefMap;
458
- }
446
+ initAssetRefMap() {
447
+ this.dataMap.assetRefMap = AssetRefMap;
459
448
  }
460
449
  checkLatestData() {
461
450
  clearInterval(this.refreshLatestChainDataTimeOut);
@@ -484,10 +473,15 @@ export class ChainService {
484
473
  console.error('Error fetching latest chain data');
485
474
  }
486
475
  }
487
- handleLatestBlockedAssetRef(latestBlockedAssetRefList) {
476
+ handleLatestAssetRef(latestBlockedAssetRefList, latestAssetRefMap) {
488
477
  const updatedAssetRefMap = {
489
478
  ...AssetRefMap
490
479
  };
480
+ if (latestAssetRefMap) {
481
+ for (const [assetRefKey, assetRef] of Object.entries(latestAssetRefMap)) {
482
+ updatedAssetRefMap[assetRefKey] = assetRef;
483
+ }
484
+ }
491
485
  latestBlockedAssetRefList.forEach(blockedAssetRef => {
492
486
  delete updatedAssetRefMap[blockedAssetRef];
493
487
  });
@@ -509,12 +503,74 @@ export class ChainService {
509
503
  }
510
504
  this.logger.log('Finished updating latest price IDs');
511
505
  }
506
+ handleLatestAssetData(latestAssetInfo, latestAssetLogoMap) {
507
+ try {
508
+ if (latestAssetInfo) {
509
+ const latestAssetPatch = JSON.stringify(latestAssetInfo);
510
+ if (this.assetMapPatch !== latestAssetPatch) {
511
+ const assetRegistry = {
512
+ ...ChainAssetMap,
513
+ ...latestAssetInfo
514
+ };
515
+ this.assetMapPatch = latestAssetPatch;
516
+ this.dataMap.assetRegistry = assetRegistry;
517
+ this.assetRegistrySubject.next(assetRegistry);
518
+ this.autoEnableTokens().then(() => {
519
+ this.eventService.emit('asset.updateState', '');
520
+ }).catch(console.error);
521
+ }
522
+ }
523
+ if (latestAssetLogoMap) {
524
+ const latestAssetLogoPatch = JSON.stringify(latestAssetLogoMap);
525
+ if (this.assetLogoPatch !== latestAssetLogoPatch) {
526
+ const logoMap = {
527
+ ...AssetLogoMap,
528
+ ...latestAssetLogoMap
529
+ };
530
+ this.assetLogoPatch = latestAssetLogoPatch;
531
+ this.assetLogoMapSubject.next(logoMap);
532
+ }
533
+ }
534
+ } catch (e) {
535
+ console.error('Error fetching latest asset data');
536
+ }
537
+ this.eventService.emit('asset.online.ready', true);
538
+ this.logger.log('Finished updating latest asset');
539
+ }
540
+ async autoEnableTokens() {
541
+ const autoEnableTokens = Object.values(this.dataMap.assetRegistry).filter(asset => _isAssetAutoEnable(asset));
542
+ const assetSettings = this.assetSettingSubject.value;
543
+ const chainStateMap = this.getChainStateMap();
544
+ for (const asset of autoEnableTokens) {
545
+ const {
546
+ originChain,
547
+ slug: assetSlug
548
+ } = asset;
549
+ const assetState = assetSettings[assetSlug];
550
+ const chainState = chainStateMap[originChain];
551
+ if (!assetState) {
552
+ // If this asset not has asset setting, this token is not enabled before (not turned off before)
553
+ // @ts-ignore
554
+ // TODO: Merge issue detect balance to define manualTurnOff props
555
+ if (!chainState || !chainState.manualTurnOff) {
556
+ await this.updateAssetSetting(assetSlug, {
557
+ visible: true
558
+ });
559
+ }
560
+ }
561
+ }
562
+ }
512
563
  handleLatestData() {
564
+ this.fetchLatestAssetData().then(([latestAssetInfo, latestAssetLogoMap]) => {
565
+ this.eventService.waitAssetReady.then(() => {
566
+ this.handleLatestAssetData(latestAssetInfo, latestAssetLogoMap);
567
+ }).catch(console.error);
568
+ }).catch(console.error);
513
569
  this.fetchLatestChainData().then(latestChainInfo => {
514
570
  this.handleLatestProviderData(latestChainInfo);
515
571
  }).catch(console.error);
516
- this.fetchLatestBlockedAssetRef().then(latestAssetRef => {
517
- this.handleLatestBlockedAssetRef(latestAssetRef);
572
+ this.fetchLatestAssetRef().then(([latestAssetRef, latestAssetRefMap]) => {
573
+ this.handleLatestAssetRef(latestAssetRef, latestAssetRefMap);
518
574
  }).catch(console.error);
519
575
  this.fetchLatestPriceIdsData().then(latestPriceIds => {
520
576
  this.handleLatestPriceId(latestPriceIds);
@@ -708,12 +764,16 @@ export class ChainService {
708
764
  // }
709
765
  }
710
766
 
767
+ async fetchLatestAssetData() {
768
+ return await Promise.all([fetchPatchData('ChainAsset.json'), fetchPatchData('AssetLogoMap.json')]);
769
+ }
770
+
711
771
  // @ts-ignore
712
772
  async fetchLatestPriceIdsData() {
713
773
  return await fetchStaticData('chain-assets/price-map');
714
774
  }
715
- async fetchLatestBlockedAssetRef() {
716
- return await fetchStaticData('chain-assets/disabled-xcm-channels');
775
+ async fetchLatestAssetRef() {
776
+ return await Promise.all([fetchStaticData('chain-assets/disabled-xcm-channels'), fetchPatchData('AssetRef.json')]);
717
777
  }
718
778
  async initChains() {
719
779
  const storedChainSettings = await this.dbService.getAllChainStore();
@@ -1446,11 +1506,17 @@ export class ChainService {
1446
1506
  subscribeAssetSettings() {
1447
1507
  return this.assetSettingSubject;
1448
1508
  }
1449
- async getChainLogoMap() {
1450
- return Promise.resolve(ChainLogoMap);
1509
+ getAssetLogoMap() {
1510
+ return this.assetLogoMapSubject.value;
1511
+ }
1512
+ subscribeAssetLogoMap() {
1513
+ return this.assetLogoMapSubject;
1514
+ }
1515
+ getChainLogoMap() {
1516
+ return this.chainLogoMapSubject.value;
1451
1517
  }
1452
- async getAssetLogoMap() {
1453
- return Promise.resolve(AssetLogoMap);
1518
+ subscribeChainLogoMap() {
1519
+ return this.chainLogoMapSubject;
1454
1520
  }
1455
1521
  resetWallet(resetAll) {
1456
1522
  if (resetAll) {
@@ -63,6 +63,7 @@ export declare function _getBlockExplorerFromChain(chainInfo: _ChainInfo): strin
63
63
  export declare function _parseMetadataForSmartContractAsset(contractAddress: string): Record<string, string>;
64
64
  export declare function _isChainTestNet(chainInfo: _ChainInfo): boolean;
65
65
  export declare function _isAssetFungibleToken(chainAsset: _ChainAsset): boolean;
66
+ export declare const _isAssetAutoEnable: (chainAsset: _ChainAsset) => boolean;
66
67
  export declare function _getCrowdloanUrlFromChain(chainInfo: _ChainInfo): string;
67
68
  export declare function _isCustomProvider(providerKey: string): boolean;
68
69
  export declare function _generateCustomProviderKey(index: number): string;
@@ -77,3 +78,4 @@ export declare function updateLatestChainInfo(currentDataMap: _DataMap, latestCh
77
78
  storedChainInfoList: IChain[];
78
79
  needUpdateChainApiList: _ChainInfo[];
79
80
  };
81
+ export * from './patch';
@@ -330,6 +330,9 @@ export function _isChainTestNet(chainInfo) {
330
330
  export function _isAssetFungibleToken(chainAsset) {
331
331
  return ![_AssetType.ERC721, _AssetType.PSP34, _AssetType.UNKNOWN].includes(chainAsset.assetType);
332
332
  }
333
+ export const _isAssetAutoEnable = chainAsset => {
334
+ return chainAsset.metadata ? !!chainAsset.metadata.autoEnable : false;
335
+ };
333
336
  export function _getCrowdloanUrlFromChain(chainInfo) {
334
337
  var _chainInfo$substrateI13;
335
338
  return (chainInfo === null || chainInfo === void 0 ? void 0 : (_chainInfo$substrateI13 = chainInfo.substrateInfo) === null || _chainInfo$substrateI13 === void 0 ? void 0 : _chainInfo$substrateI13.crowdloanUrl) || '';
@@ -431,4 +434,5 @@ export function updateLatestChainInfo(currentDataMap, latestChainInfoList) {
431
434
  storedChainInfoList,
432
435
  needUpdateChainApiList
433
436
  };
434
- }
437
+ }
438
+ export * from "./patch.js";
@@ -0,0 +1 @@
1
+ export declare function fetchPatchData<T>(slug: string): Promise<T | null>;
@@ -0,0 +1,26 @@
1
+ // Copyright 2019-2022 @subwallet/extension-base
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import { packageInfo as chainListInfo } from '@subwallet/chain-list/packageInfo';
5
+ import fetch from 'cross-fetch';
6
+ const PRODUCTION_BRANCHES = ['master', 'webapp', 'webapp-dev'];
7
+ const branchName = process.env.BRANCH_NAME || 'subwallet-dev';
8
+ const fetchDomain = PRODUCTION_BRANCHES.indexOf(branchName) > -1 ? 'https://chain-list-assets.subwallet.app' : 'https://dev.sw-chain-list-assets.pages.dev';
9
+ export async function fetchPatchData(slug) {
10
+ try {
11
+ const fetchPromise = fetch(`${fetchDomain}/patch/${chainListInfo.version}/${slug}`);
12
+ const timeout = new Promise(resolve => {
13
+ const id = setTimeout(() => {
14
+ clearTimeout(id);
15
+ resolve(null);
16
+ }, 1000);
17
+ });
18
+ const rs = await Promise.race([timeout, fetchPromise]);
19
+ if (!rs) {
20
+ return null;
21
+ }
22
+ return await rs.json();
23
+ } catch (e) {
24
+ return null;
25
+ }
26
+ }
@@ -11,6 +11,7 @@ export declare class EventService extends EventEmitter<EventRegistry> {
11
11
  readonly waitInjectReady: Promise<boolean>;
12
12
  readonly waitChainReady: Promise<boolean>;
13
13
  readonly waitAssetReady: Promise<boolean>;
14
+ readonly waitAssetOnlineReady: Promise<boolean>;
14
15
  readonly waitMigrateReady: Promise<boolean>;
15
16
  readonly waitCampaignReady: Promise<boolean>;
16
17
  readonly waitBuyTokenReady: Promise<boolean>;
@@ -22,6 +22,7 @@ export class EventService extends EventEmitter {
22
22
  this.waitInjectReady = TARGET_ENV === 'webapp' ? this.generateWaitPromise('inject.ready') : Promise.resolve(true);
23
23
  this.waitChainReady = this.generateWaitPromise('chain.ready');
24
24
  this.waitAssetReady = this.generateWaitPromise('asset.ready');
25
+ this.waitAssetOnlineReady = this.generateWaitPromise('asset.online.ready');
25
26
  this.waitMigrateReady = this.generateWaitPromise('migration.done');
26
27
  this.waitCampaignReady = this.generateWaitPromise('campaign.ready');
27
28
  this.waitBuyTokenReady = this.generateWaitPromise('buy.tokens.ready');
@@ -23,6 +23,7 @@ export interface EventRegistry {
23
23
  'chain.add': [string];
24
24
  'chain.updateState': [string];
25
25
  'asset.ready': [boolean];
26
+ 'asset.online.ready': [boolean];
26
27
  'asset.updateState': [string];
27
28
  'transaction.done': [SWTransaction];
28
29
  'transaction.failed': [SWTransaction | undefined];