@subwallet/extension-base 1.0.4-0 → 1.0.5-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) hide show
  1. package/background/KoniTypes.d.ts +37 -16
  2. package/background/KoniTypes.js +2 -0
  3. package/background/errors/TransactionError.js +4 -0
  4. package/background/handlers/State.d.ts +1 -1
  5. package/background/handlers/State.js +2 -8
  6. package/background/handlers/subscriptions.js +0 -1
  7. package/background/types.d.ts +2 -2
  8. package/cjs/background/KoniTypes.js +2 -0
  9. package/cjs/background/errors/TransactionError.js +4 -0
  10. package/cjs/background/handlers/State.js +1 -7
  11. package/cjs/background/handlers/subscriptions.js +0 -1
  12. package/cjs/constants/index.js +6 -6
  13. package/cjs/koni/api/coingecko.js +1 -4
  14. package/cjs/koni/api/dotsama/balance.js +7 -5
  15. package/cjs/koni/api/dotsama/crowdloan.js +0 -4
  16. package/cjs/koni/api/dotsama/transfer.js +0 -4
  17. package/cjs/koni/api/nft/acala_nft/index.js +1 -1
  18. package/cjs/koni/api/nft/bit.country/index.js +1 -1
  19. package/cjs/koni/api/nft/evm_nft/index.js +2 -3
  20. package/cjs/koni/api/nft/index.js +1 -2
  21. package/cjs/koni/api/nft/karura_nft/index.js +1 -1
  22. package/cjs/koni/api/nft/quartz_nft/index.js +1 -1
  23. package/cjs/koni/api/nft/rmrk_nft/index.js +2 -3
  24. package/cjs/koni/api/nft/statemine_nft/index.js +1 -1
  25. package/cjs/koni/api/nft/transfer.js +5 -5
  26. package/cjs/koni/api/nft/unique_nft/index.js +1 -1
  27. package/cjs/koni/api/nft/unique_nft/uniqueNftV2.js +0 -1
  28. package/cjs/koni/api/nft/wasm_nft/index.js +1 -2
  29. package/cjs/koni/api/staking/bonding/amplitude.js +9 -2
  30. package/cjs/koni/api/staking/bonding/astar.js +37 -13
  31. package/cjs/koni/api/staking/bonding/paraChain.js +10 -2
  32. package/cjs/koni/api/staking/bonding/relayChain.js +21 -4
  33. package/cjs/koni/api/staking/bonding/utils.js +4 -0
  34. package/cjs/koni/api/staking/relayChain.js +0 -1
  35. package/cjs/koni/api/staking/subsquidStaking.js +0 -2
  36. package/cjs/koni/api/tokens/wasm/index.js +0 -1
  37. package/cjs/koni/api/tokens/wasm/utils.js +0 -1
  38. package/cjs/koni/api/xcm/index.js +0 -1
  39. package/cjs/koni/background/cron.js +0 -45
  40. package/cjs/koni/background/handlers/Extension.js +204 -132
  41. package/cjs/koni/background/handlers/State.js +30 -3
  42. package/cjs/koni/background/handlers/Tabs.js +34 -2
  43. package/cjs/koni/background/handlers/index.js +3 -2
  44. package/cjs/koni/background/subscription.js +0 -26
  45. package/cjs/packageInfo.js +1 -1
  46. package/cjs/services/chain-service/constants.js +1 -1
  47. package/cjs/services/chain-service/handler/EvmChainHandler.js +1 -1
  48. package/cjs/services/chain-service/handler/SubstrateChainHandler.js +3 -10
  49. package/cjs/services/chain-service/handler/light-client/index.js +9 -6
  50. package/cjs/services/chain-service/index.js +75 -28
  51. package/cjs/services/chain-service/utils.js +3 -0
  52. package/cjs/services/history-service/helpers/recoverHistoryStatus.js +108 -0
  53. package/cjs/services/history-service/index.js +60 -5
  54. package/cjs/services/history-service/subsquid-multi-chain-history.js +3 -2
  55. package/cjs/services/history-service/testChainMap.js +724 -0
  56. package/cjs/services/keyring-service/index.js +9 -2
  57. package/cjs/services/migration-service/index.js +7 -7
  58. package/cjs/services/migration-service/scripts/MigrateAuthUrls.js +39 -0
  59. package/cjs/services/migration-service/scripts/MigrateAutoLock.js +30 -0
  60. package/cjs/services/migration-service/scripts/MigrateChainPatrol.js +30 -0
  61. package/cjs/services/migration-service/scripts/index.js +7 -1
  62. package/cjs/services/price-service/coingecko.js +1 -1
  63. package/cjs/services/price-service/index.js +0 -4
  64. package/cjs/services/request-service/handler/AuthRequestHandler.js +8 -1
  65. package/cjs/services/request-service/handler/EvmRequestHandler.js +21 -0
  66. package/cjs/services/request-service/handler/MetadataRequestHandler.js +6 -0
  67. package/cjs/services/request-service/handler/SubstrateRequestHandler.js +6 -0
  68. package/cjs/services/request-service/index.js +6 -0
  69. package/cjs/services/setting-service/SettingService.js +4 -9
  70. package/cjs/services/setting-service/constants.js +18 -2
  71. package/cjs/services/storage-service/DatabaseService.js +16 -44
  72. package/cjs/services/storage-service/databases/index.js +1 -1
  73. package/cjs/services/storage-service/db-stores/BaseStore.js +3 -0
  74. package/cjs/services/transaction-service/constants.js +11 -0
  75. package/cjs/services/transaction-service/index.js +31 -9
  76. package/cjs/services/transaction-service/utils.js +25 -14
  77. package/constants/index.d.ts +1 -1
  78. package/constants/index.js +1 -1
  79. package/koni/api/coingecko.js +1 -4
  80. package/koni/api/dotsama/balance.js +7 -5
  81. package/koni/api/dotsama/crowdloan.js +0 -4
  82. package/koni/api/dotsama/transfer.js +0 -4
  83. package/koni/api/nft/acala_nft/index.js +1 -1
  84. package/koni/api/nft/bit.country/index.js +1 -1
  85. package/koni/api/nft/evm_nft/index.js +2 -3
  86. package/koni/api/nft/index.js +1 -2
  87. package/koni/api/nft/karura_nft/index.js +1 -1
  88. package/koni/api/nft/quartz_nft/index.js +1 -1
  89. package/koni/api/nft/rmrk_nft/index.js +2 -3
  90. package/koni/api/nft/statemine_nft/index.js +1 -1
  91. package/koni/api/nft/transfer.js +5 -5
  92. package/koni/api/nft/unique_nft/index.js +1 -1
  93. package/koni/api/nft/unique_nft/uniqueNftV2.js +0 -1
  94. package/koni/api/nft/wasm_nft/index.js +1 -2
  95. package/koni/api/staking/bonding/amplitude.js +9 -2
  96. package/koni/api/staking/bonding/astar.d.ts +2 -1
  97. package/koni/api/staking/bonding/astar.js +36 -13
  98. package/koni/api/staking/bonding/paraChain.js +10 -2
  99. package/koni/api/staking/bonding/relayChain.js +21 -4
  100. package/koni/api/staking/bonding/utils.js +4 -0
  101. package/koni/api/staking/relayChain.js +0 -1
  102. package/koni/api/staking/subsquidStaking.js +0 -2
  103. package/koni/api/tokens/wasm/index.js +0 -1
  104. package/koni/api/tokens/wasm/utils.js +0 -1
  105. package/koni/api/xcm/index.js +0 -1
  106. package/koni/background/cron.js +0 -45
  107. package/koni/background/handlers/Extension.d.ts +3 -0
  108. package/koni/background/handlers/Extension.js +120 -51
  109. package/koni/background/handlers/State.d.ts +4 -1
  110. package/koni/background/handlers/State.js +30 -3
  111. package/koni/background/handlers/Tabs.d.ts +1 -0
  112. package/koni/background/handlers/Tabs.js +32 -1
  113. package/koni/background/handlers/index.js +3 -2
  114. package/koni/background/subscription.d.ts +0 -1
  115. package/koni/background/subscription.js +0 -26
  116. package/package.json +65 -39
  117. package/packageInfo.js +1 -1
  118. package/services/chain-service/constants.js +1 -1
  119. package/services/chain-service/handler/EvmChainHandler.js +1 -1
  120. package/services/chain-service/handler/SubstrateChainHandler.js +3 -10
  121. package/services/chain-service/handler/light-client/index.js +8 -6
  122. package/services/chain-service/helper/api-helper/spec/acala.d.ts +3 -3
  123. package/services/chain-service/index.d.ts +2 -1
  124. package/services/chain-service/index.js +75 -28
  125. package/services/chain-service/utils.js +3 -0
  126. package/services/history-service/helpers/recoverHistoryStatus.d.ts +11 -0
  127. package/services/history-service/helpers/recoverHistoryStatus.js +98 -0
  128. package/services/history-service/index.d.ts +6 -0
  129. package/services/history-service/index.js +61 -6
  130. package/services/history-service/subsquid-multi-chain-history.js +3 -2
  131. package/services/history-service/testChainMap.d.ts +3 -0
  132. package/services/history-service/testChainMap.js +716 -0
  133. package/services/keyring-service/index.d.ts +1 -0
  134. package/services/keyring-service/index.js +9 -2
  135. package/services/migration-service/index.js +7 -7
  136. package/services/migration-service/scripts/MigrateAuthUrls.d.ts +4 -0
  137. package/services/migration-service/scripts/MigrateAuthUrls.js +31 -0
  138. package/services/migration-service/scripts/MigrateAutoLock.d.ts +4 -0
  139. package/services/migration-service/scripts/MigrateAutoLock.js +22 -0
  140. package/services/migration-service/scripts/MigrateChainPatrol.d.ts +4 -0
  141. package/services/migration-service/scripts/MigrateChainPatrol.js +22 -0
  142. package/services/migration-service/scripts/index.js +7 -1
  143. package/services/price-service/coingecko.js +1 -1
  144. package/services/price-service/index.js +0 -4
  145. package/services/request-service/handler/AuthRequestHandler.d.ts +1 -0
  146. package/services/request-service/handler/AuthRequestHandler.js +8 -1
  147. package/services/request-service/handler/EvmRequestHandler.d.ts +1 -0
  148. package/services/request-service/handler/EvmRequestHandler.js +21 -0
  149. package/services/request-service/handler/MetadataRequestHandler.d.ts +1 -0
  150. package/services/request-service/handler/MetadataRequestHandler.js +6 -0
  151. package/services/request-service/handler/SubstrateRequestHandler.d.ts +1 -0
  152. package/services/request-service/handler/SubstrateRequestHandler.js +6 -0
  153. package/services/request-service/index.d.ts +1 -0
  154. package/services/request-service/index.js +6 -0
  155. package/services/setting-service/SettingService.d.ts +1 -0
  156. package/services/setting-service/SettingService.js +5 -10
  157. package/services/setting-service/constants.d.ts +4 -1
  158. package/services/setting-service/constants.js +14 -1
  159. package/services/storage-service/DatabaseService.d.ts +1 -0
  160. package/services/storage-service/DatabaseService.js +16 -44
  161. package/services/storage-service/databases/index.js +1 -1
  162. package/services/storage-service/db-stores/BaseStore.d.ts +1 -0
  163. package/services/storage-service/db-stores/BaseStore.js +3 -0
  164. package/services/transaction-service/constants.d.ts +1 -0
  165. package/services/transaction-service/constants.js +4 -0
  166. package/services/transaction-service/index.d.ts +2 -0
  167. package/services/transaction-service/index.js +32 -10
  168. package/services/transaction-service/utils.d.ts +1 -1
  169. package/services/transaction-service/utils.js +24 -13
@@ -10,6 +10,7 @@ exports.getAstarDappsInfo = getAstarDappsInfo;
10
10
  exports.getAstarNominatorMetadata = getAstarNominatorMetadata;
11
11
  exports.getAstarStakingMetadata = getAstarStakingMetadata;
12
12
  exports.getAstarUnbondingExtrinsic = getAstarUnbondingExtrinsic;
13
+ exports.getAstarWithdrawable = getAstarWithdrawable;
13
14
  exports.getAstarWithdrawalExtrinsic = getAstarWithdrawalExtrinsic;
14
15
  var _KoniTypes = require("@subwallet/extension-base/background/KoniTypes");
15
16
  var _utils = require("@subwallet/extension-base/koni/api/staking/bonding/utils");
@@ -109,20 +110,28 @@ async function getAstarNominatorMetadata(chainInfo, address, substrateApi) {
109
110
 
110
111
  const unlockingChunks = ledger.unbondingInfo.unlockingChunks;
111
112
  if (unlockingChunks.length > 0) {
112
- const nearestUnstaking = unlockingChunks[0]; // only handle 1 unstaking request at a time, might need to change
113
-
114
- const isClaimable = nearestUnstaking.unlockEra - parseInt(currentEra) <= 0;
115
- const remainingEra = nearestUnstaking.unlockEra - (parseInt(currentEra) + 1);
116
- const waitingTime = remainingEra * _constants._STAKING_ERA_LENGTH_MAP[chain];
117
- unstakingList.push({
118
- chain,
119
- status: isClaimable ? _KoniTypes.UnstakingStatus.CLAIMABLE : _KoniTypes.UnstakingStatus.UNLOCKING,
120
- claimable: nearestUnstaking.amount.toString(),
121
- waitingTime: waitingTime > 0 ? waitingTime : 0
122
- });
113
+ for (const unlockingChunk of unlockingChunks) {
114
+ const isClaimable = unlockingChunk.unlockEra - parseInt(currentEra) <= 0;
115
+ const remainingEra = unlockingChunk.unlockEra - (parseInt(currentEra) + 1);
116
+ const waitingTime = remainingEra * _constants._STAKING_ERA_LENGTH_MAP[chain];
117
+ unstakingList.push({
118
+ chain,
119
+ status: isClaimable ? _KoniTypes.UnstakingStatus.CLAIMABLE : _KoniTypes.UnstakingStatus.UNLOCKING,
120
+ claimable: unlockingChunk.amount.toString(),
121
+ waitingTime: waitingTime > 0 ? waitingTime : 0
122
+ });
123
+ }
123
124
  }
124
125
  if (nominationList.length === 0 && unstakingList.length === 0) {
125
- return;
126
+ return {
127
+ chain: chainInfo.slug,
128
+ type: _KoniTypes.StakingType.NOMINATED,
129
+ address,
130
+ status: _KoniTypes.StakingStatus.NOT_STAKING,
131
+ activeStake: '0',
132
+ nominations: [],
133
+ unstakings: []
134
+ };
126
135
  }
127
136
  const stakingStatus = (0, _utils.getStakingStatusByNominations)(bnTotalActiveStake, nominationList);
128
137
  return {
@@ -252,6 +261,21 @@ async function getAstarClaimRewardExtrinsic(substrateApi, address) {
252
261
  transactions.push(tx);
253
262
  }
254
263
  }
255
- console.log('no of astar claim reward tx: ', transactions.length);
256
264
  return apiPromise.api.tx.utility.batch(transactions);
265
+ }
266
+ function getAstarWithdrawable(nominatorMetadata) {
267
+ const unstakingInfo = {
268
+ chain: nominatorMetadata.chain,
269
+ status: _KoniTypes.UnstakingStatus.CLAIMABLE,
270
+ claimable: '0',
271
+ waitingTime: 0
272
+ };
273
+ let bnWithdrawable = _util.BN_ZERO;
274
+ for (const unstaking of nominatorMetadata.unstakings) {
275
+ if (unstaking.status === _KoniTypes.UnstakingStatus.CLAIMABLE) {
276
+ bnWithdrawable = bnWithdrawable.add(new _util.BN(unstaking.claimable));
277
+ }
278
+ }
279
+ unstakingInfo.claimable = bnWithdrawable.toString();
280
+ return unstakingInfo;
257
281
  }
@@ -58,7 +58,7 @@ function validateParaChainBondingCondition(chainInfo, amount, selectedCollators,
58
58
  const bnChainMinStake = new _util.BN(chainStakingMetadata.minStake || '0');
59
59
  const bnCollatorMinStake = new _util.BN(selectedCollator.minBond || '0');
60
60
  const bnMinStake = bnCollatorMinStake > bnChainMinStake ? bnCollatorMinStake : bnChainMinStake;
61
- if (!nominatorMetadata) {
61
+ if (!nominatorMetadata || nominatorMetadata.status === _KoniTypes.StakingStatus.NOT_STAKING) {
62
62
  if (!bnTotalStake.gte(bnMinStake)) {
63
63
  errors.push(new _TransactionError.TransactionError(_KoniTypes.StakingTxErrorType.NOT_ENOUGH_MIN_STAKE));
64
64
  }
@@ -146,7 +146,15 @@ async function getParaChainNominatorMetadata(chainInfo, address, substrateApi) {
146
146
  const _delegatorState = await chainApi.api.query.parachainStaking.delegatorState(address);
147
147
  const delegatorState = _delegatorState.toPrimitive();
148
148
  if (!delegatorState) {
149
- return;
149
+ return {
150
+ chain: chainInfo.slug,
151
+ type: _KoniTypes.StakingType.NOMINATED,
152
+ address,
153
+ status: _KoniTypes.StakingStatus.NOT_STAKING,
154
+ activeStake: '0',
155
+ nominations: [],
156
+ unstakings: []
157
+ };
150
158
  }
151
159
  let bnTotalActiveStake = _util.BN_ZERO;
152
160
  await Promise.all(delegatorState.delegations.map(async delegation => {
@@ -55,7 +55,7 @@ function validatePoolBondingCondition(chainInfo, amount, selectedPool, address,
55
55
  if (nominatorMetadata) {
56
56
  const bnCurrentActiveStake = new _util.BN(nominatorMetadata.activeStake);
57
57
  bnTotalStake = bnTotalStake.add(bnCurrentActiveStake);
58
- if (!bnCurrentActiveStake.gt(_util.BN_ZERO)) {
58
+ if (nominatorMetadata.unstakings.length > 0) {
59
59
  errors.push(new _TransactionError.TransactionError(_KoniTypes.StakingTxErrorType.EXIST_UNSTAKING_REQUEST));
60
60
  }
61
61
  }
@@ -68,7 +68,7 @@ function validateRelayBondingCondition(chainInfo, amount, selectedValidators, ad
68
68
  const errors = [];
69
69
  let bnTotalStake = new _util.BN(amount);
70
70
  const bnMinStake = new _util.BN(chainStakingMetadata.minStake);
71
- if (!nominatorMetadata) {
71
+ if (!nominatorMetadata || nominatorMetadata.status === _KoniTypes.StakingStatus.NOT_STAKING) {
72
72
  if (!bnTotalStake.gte(bnMinStake)) {
73
73
  errors.push(new _TransactionError.TransactionError(_KoniTypes.StakingTxErrorType.NOT_ENOUGH_MIN_STAKE));
74
74
  }
@@ -166,7 +166,15 @@ async function getRelayChainNominatorMetadata(chainInfo, address, substrateApi)
166
166
  const currentEra = _currentEra.toString();
167
167
  const bonded = _bonded.toHuman();
168
168
  if (!ledger) {
169
- return;
169
+ return {
170
+ chain,
171
+ type: _KoniTypes.StakingType.NOMINATED,
172
+ status: _KoniTypes.StakingStatus.NOT_STAKING,
173
+ address: address,
174
+ activeStake: '0',
175
+ nominations: [],
176
+ unstakings: []
177
+ };
170
178
  }
171
179
  const activeStake = ledger.active.toString();
172
180
  const nominationList = [];
@@ -246,7 +254,16 @@ async function getRelayChainPoolMemberMetadata(chainInfo, address, substrateApi)
246
254
  const poolMemberInfo = _poolMemberInfo.toPrimitive();
247
255
  const currentEra = _currentEra.toString();
248
256
  if (!poolMemberInfo) {
249
- return;
257
+ return {
258
+ chain: chainInfo.slug,
259
+ type: _KoniTypes.StakingType.POOLED,
260
+ address,
261
+ status: _KoniTypes.StakingStatus.NOT_STAKING,
262
+ activeStake: '0',
263
+ nominations: [],
264
+ // can only join 1 pool at a time
265
+ unstakings: []
266
+ };
250
267
  }
251
268
  let stakingStatus = _KoniTypes.StakingStatus.NOT_EARNING;
252
269
  const _poolMetadata = await chainApi.api.query.nominationPools.metadata(poolMemberInfo.poolId);
@@ -25,6 +25,7 @@ exports.parseIdentity = parseIdentity;
25
25
  exports.parsePoolStashAddress = parsePoolStashAddress;
26
26
  exports.transformPoolName = transformPoolName;
27
27
  var _KoniTypes = require("@subwallet/extension-base/background/KoniTypes");
28
+ var _astar = require("@subwallet/extension-base/koni/api/staking/bonding/astar");
28
29
  var _constants = require("@subwallet/extension-base/services/chain-service/constants");
29
30
  var _utils = require("@subwallet/extension-base/utils");
30
31
  var _util = require("@polkadot/util");
@@ -238,6 +239,9 @@ function isActionFromValidator(stakingType, chain) {
238
239
  function getWithdrawalInfo(nominatorMetadata) {
239
240
  const unstakings = nominatorMetadata.unstakings;
240
241
  let result;
242
+ if (_constants._STAKING_CHAIN_GROUP.astar.includes(nominatorMetadata.chain)) {
243
+ return (0, _astar.getAstarWithdrawable)(nominatorMetadata);
244
+ }
241
245
  for (const unstaking of unstakings) {
242
246
  if (unstaking.status === _KoniTypes.UnstakingStatus.CLAIMABLE) {
243
247
  result = unstaking; // only get the first withdrawal
@@ -164,7 +164,6 @@ async function getNominationPoolReward(addresses, chainInfoMap, substrateApiMap)
164
164
  }));
165
165
  }));
166
166
  } catch (e) {
167
- console.error('Error fetching unclaimed reward for nomination pool', e);
168
167
  return rewardList;
169
168
  }
170
169
  return rewardList;
@@ -83,7 +83,6 @@ const getSubsquidStaking = async (accounts, chain, chainInfoMap) => {
83
83
  }));
84
84
  return result;
85
85
  } catch (e) {
86
- console.error(`error getting ${chain} staking reward from subsquid`, e);
87
86
  return [];
88
87
  }
89
88
  };
@@ -101,7 +100,6 @@ const getAllSubsquidStaking = async (accounts, chainInfoMap) => {
101
100
  rewardList = rewardList.concat(rewardItems);
102
101
  }));
103
102
  } catch (e) {
104
- console.error('Error fetching staking reward from SubSquid', e);
105
103
  return rewardList;
106
104
  }
107
105
  return rewardList;
@@ -31,7 +31,6 @@ async function getPSP34TransferExtrinsic(networkKey, substrateApi, senderAddress
31
31
  gasLimit
32
32
  }, recipientAddress, onChainOption, {});
33
33
  } catch (e) {
34
- console.error('Error getting WASM NFT transfer extrinsic', e);
35
34
  return null;
36
35
  }
37
36
  }
@@ -16,7 +16,6 @@ const toContractAbiMessage = (contractPromise, message) => {
16
16
  if (!value) {
17
17
  const messages = contractPromise === null || contractPromise === void 0 ? void 0 : contractPromise.abi.messages.map(m => m.method).join(', ');
18
18
  const error = `"${message}" not found in metadata.spec.messages: [${messages}]`;
19
- console.error(error);
20
19
  return {
21
20
  ok: false,
22
21
  error
@@ -32,7 +32,6 @@ const createXcmExtrinsic = async _ref => {
32
32
  } else {
33
33
  extrinsic = (0, _xTokens.getExtrinsicByXtokensPallet)(originTokenInfo, originChainInfo, destinationChainInfo, recipient, sendingValue, api);
34
34
  }
35
- console.log('XCM extrinsic: ', extrinsic.toHex());
36
35
  return extrinsic;
37
36
  };
38
37
  exports.createXcmExtrinsic = createXcmExtrinsic;
@@ -104,7 +104,6 @@ class KoniCron {
104
104
  if (!commonReload && !chainUpdated && !stakingSubmitted) {
105
105
  return;
106
106
  }
107
- this.logger.log('ServiceInfo updated, Cron restarting...', eventTypes);
108
107
  const address = (_serviceInfo$currentA = serviceInfo.currentAccountInfo) === null || _serviceInfo$currentA === void 0 ? void 0 : _serviceInfo$currentA.address;
109
108
  if (!address) {
110
109
  return;
@@ -144,7 +143,6 @@ class KoniCron {
144
143
  if (!(currentAccountInfo !== null && currentAccountInfo !== void 0 && currentAccountInfo.address)) {
145
144
  return;
146
145
  }
147
- this.logger.log('Starting cron jobs');
148
146
  if (Object.keys(this.state.getSubstrateApiMap()).length !== 0 || Object.keys(this.state.getEvmApiMap()).length !== 0) {
149
147
  this.resetNft(currentAccountInfo.address);
150
148
  this.addCron('refreshNft', this.refreshNft(currentAccountInfo.address, this.state.getApiMap(), this.state.getSmartContractNfts(), this.state.getActiveChainInfoMap()), _constants.CRON_REFRESH_NFT_INTERVAL);
@@ -173,48 +171,12 @@ class KoniCron {
173
171
  this.serviceSubscription.unsubscribe();
174
172
  this.serviceSubscription = undefined;
175
173
  }
176
- this.logger.log('Stopping cron jobs');
177
174
  this.removeAllCrons();
178
175
  this.status = 'stopped';
179
176
  };
180
177
  updateApiMapStatus = () => {
181
178
  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
- // }
216
179
  };
217
-
218
180
  recoverApiMap = () => {
219
181
  var _this$subscriptions;
220
182
  const apiMap = this.state.getApiMap();
@@ -235,7 +197,6 @@ class KoniCron {
235
197
  };
236
198
  refreshNft = (address, apiMap, smartContractNfts, chainInfoMap) => {
237
199
  return () => {
238
- console.debug('Refresh NFT state');
239
200
  this.subscriptions.subscribeNft(address, apiMap.substrate, apiMap.evm, smartContractNfts, chainInfoMap);
240
201
  };
241
202
  };
@@ -247,13 +208,11 @@ class KoniCron {
247
208
  };
248
209
  refreshStakingReward = address => {
249
210
  return () => {
250
- console.debug('Refresh staking reward state');
251
211
  this.subscriptions.subscribeStakingReward(address).catch(this.logger.error);
252
212
  };
253
213
  };
254
214
  refreshStakingRewardFastInterval = address => {
255
215
  return () => {
256
- console.debug('Refresh staking reward data with fast interval');
257
216
  this.subscriptions.subscribeStakingRewardFastInterval(address).catch(this.logger.error);
258
217
  };
259
218
  };
@@ -265,20 +224,17 @@ class KoniCron {
265
224
  };
266
225
  updateChainStakingMetadata = (chainInfoMap, chainStateMap, substrateApiMap) => {
267
226
  return () => {
268
- console.debug('Fetching chain staking metadata');
269
227
  this.subscriptions.fetchChainStakingMetadata(chainInfoMap, chainStateMap, substrateApiMap).catch(this.logger.error);
270
228
  };
271
229
  };
272
230
  updateNominatorMetadata = (address, chainInfoMap, chainStateMap, substrateApiMap) => {
273
231
  return () => {
274
- console.debug('Fetching nominator data for', address);
275
232
  this.subscriptions.fetchNominatorMetadata(address, chainInfoMap, chainStateMap, substrateApiMap).catch(this.logger.error);
276
233
  };
277
234
  };
278
235
  async reloadNft() {
279
236
  const address = this.state.keyringService.currentAccount.address;
280
237
  const serviceInfo = this.state.getServiceInfo();
281
- console.debug('Hard refresh NFT for', address);
282
238
  this.resetNft(address);
283
239
  this.removeCron('refreshNft');
284
240
  this.addCron('refreshNft', this.refreshNft(address, serviceInfo.chainApiMap, this.state.getSmartContractNfts(), this.state.getActiveChainInfoMap()), _constants.CRON_REFRESH_NFT_INTERVAL);
@@ -287,7 +243,6 @@ class KoniCron {
287
243
  }
288
244
  async reloadStaking() {
289
245
  const address = this.state.keyringService.currentAccount.address;
290
- console.debug('Hard refresh staking meta for', address);
291
246
  this.resetStakingReward();
292
247
  this.removeCron('refreshStakingReward');
293
248
  this.removeCron('refreshPoolingStakingReward');