@subwallet/extension-base 1.3.70-2 → 1.3.71-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 (182) hide show
  1. package/background/KoniTypes.js +65 -8
  2. package/cjs/background/KoniTypes.js +65 -8
  3. package/cjs/constants/blocked-actions.js +3 -0
  4. package/cjs/core/logic-validation/swap.js +0 -3
  5. package/cjs/core/substrate/system-pallet.js +0 -2
  6. package/cjs/koni/api/nft/wasm_nft/index.js +0 -1
  7. package/cjs/koni/api/staking/bonding/astar.js +0 -2
  8. package/cjs/koni/api/staking/bonding/paraChain.js +0 -3
  9. package/cjs/koni/api/staking/bonding/relayChain.js +2 -4
  10. package/cjs/koni/api/staking/bonding/utils.js +0 -4
  11. package/cjs/koni/background/cron.js +0 -1
  12. package/cjs/koni/background/handlers/Extension.js +154 -158
  13. package/cjs/koni/background/handlers/State.js +54 -52
  14. package/cjs/koni/background/handlers/Tabs.js +39 -34
  15. package/cjs/packageInfo.js +1 -1
  16. package/cjs/page/index.js +7 -0
  17. package/cjs/page/substrate/PostMessageProvider.js +3 -0
  18. package/cjs/services/balance-service/helpers/subscribe/cardano/utils.js +0 -1
  19. package/cjs/services/balance-service/helpers/subscribe/substrate/gear.js +0 -2
  20. package/cjs/services/balance-service/helpers/subscribe/substrate/index.js +2 -3
  21. package/cjs/services/balance-service/helpers/subscribe/ton/utils.js +0 -3
  22. package/cjs/services/balance-service/index.js +103 -7
  23. package/cjs/services/balance-service/transfer/bitcoin-transfer.js +0 -1
  24. package/cjs/services/balance-service/transfer/cardano-transfer.js +1 -2
  25. package/cjs/services/balance-service/transfer/smart-contract.js +0 -1
  26. package/cjs/services/balance-service/transfer/token.js +0 -2
  27. package/cjs/services/balance-service/transfer/ton-transfer.js +0 -1
  28. package/cjs/services/balance-service/transfer/xcm/snowBridge.js +0 -1
  29. package/cjs/services/chain-service/handler/CardanoApi.js +3 -1
  30. package/cjs/services/chain-service/handler/SubstrateApi.js +0 -2
  31. package/cjs/services/chain-service/handler/light-client/index.js +1 -2
  32. package/cjs/services/chain-service/health-check/index.js +0 -1
  33. package/cjs/services/chain-service/health-check/utils/new-utils/chain-asset-validate.js +0 -1
  34. package/cjs/services/chain-service/index.js +18 -26
  35. package/cjs/services/chain-service/utils/index.js +21 -25
  36. package/cjs/services/earning-service/handlers/base.js +32 -0
  37. package/cjs/services/earning-service/handlers/lending/base.js +0 -2
  38. package/cjs/services/earning-service/handlers/liquid-staking/acala.js +0 -1
  39. package/cjs/services/earning-service/handlers/liquid-staking/base.js +0 -2
  40. package/cjs/services/earning-service/handlers/liquid-staking/bifrost.js +0 -2
  41. package/cjs/services/earning-service/handlers/liquid-staking/parallel.js +0 -1
  42. package/cjs/services/earning-service/handlers/native-staking/astar.js +0 -2
  43. package/cjs/services/earning-service/handlers/native-staking/dtao.js +43 -2
  44. package/cjs/services/earning-service/handlers/native-staking/energy.js +0 -1
  45. package/cjs/services/earning-service/handlers/native-staking/mythos.js +0 -2
  46. package/cjs/services/earning-service/handlers/native-staking/para-chain.js +0 -2
  47. package/cjs/services/earning-service/handlers/native-staking/relay-chain.js +8 -9
  48. package/cjs/services/earning-service/handlers/special.js +7 -0
  49. package/cjs/services/history-service/subsquid-multi-chain-history.js +0 -1
  50. package/cjs/services/keyring-service/context/handlers/Derive.js +1 -1
  51. package/cjs/services/keyring-service/context/handlers/Migration.js +11 -9
  52. package/cjs/services/keyring-service/context/handlers/Mnemonic.js +18 -13
  53. package/cjs/services/keyring-service/context/state.js +21 -3
  54. package/cjs/services/keyring-service/utils.js +12 -2
  55. package/cjs/services/migration-service/index.js +1 -2
  56. package/cjs/services/mint-campaign-service/campaigns/UnlockDotCampaign.js +0 -1
  57. package/cjs/services/nft-service/index.js +5 -0
  58. package/cjs/services/open-gov/handler.js +0 -2
  59. package/cjs/services/open-gov/interface.js +4 -1
  60. package/cjs/services/request-service/handler/BitcoinRequestHandler.js +1 -2
  61. package/cjs/services/request-service/handler/CardanoRequestHandler.js +0 -1
  62. package/cjs/services/request-service/handler/EvmRequestHandler.js +0 -1
  63. package/cjs/services/request-service/handler/TonRequestHandler.js +0 -1
  64. package/cjs/services/request-service/helper/index.js +1 -2
  65. package/cjs/services/storage-service/DatabaseService.js +0 -2
  66. package/cjs/services/storage-service/databases/index.js +2 -0
  67. package/cjs/services/swap-service/handler/asset-hub/handler.js +0 -1
  68. package/cjs/services/swap-service/handler/asset-hub/router.js +0 -1
  69. package/cjs/services/swap-service/handler/chainflip-handler.js +1 -4
  70. package/cjs/services/swap-service/handler/hydradx-handler.js +0 -1
  71. package/cjs/services/swap-service/handler/kyber-handler.js +0 -1
  72. package/cjs/services/swap-service/handler/optimex-handler.js +1 -2
  73. package/cjs/services/swap-service/handler/simpleswap-handler.js +1 -3
  74. package/cjs/services/swap-service/handler/uniswap-handler.js +0 -3
  75. package/cjs/services/transaction-service/event-parser/index.js +6 -6
  76. package/cjs/services/transaction-service/index.js +28 -28
  77. package/cjs/services/wallet-connect-service/index.js +21 -18
  78. package/cjs/services/wallet-connect-service/types.js +1 -1
  79. package/cjs/types/account/info/keyring.js +9 -1
  80. package/cjs/types/balance/index.js +5 -1
  81. package/cjs/types/swap/index.js +2 -1
  82. package/cjs/types/transaction/process.js +2 -0
  83. package/cjs/types/yield/actions/join/step.js +17 -1
  84. package/cjs/utils/account/common.js +0 -26
  85. package/cjs/utils/account/derive/info/solo.js +7 -4
  86. package/cjs/utils/account/derive/validate.js +1 -1
  87. package/cjs/utils/account/transform.js +5 -1
  88. package/cjs/utils/auth.js +1 -1
  89. package/cjs/utils/bitcoin/utxo-management.js +0 -1
  90. package/cjs/utils/environment.js +2 -1
  91. package/cjs/utils/fee/transfer.js +1 -2
  92. package/cjs/utils/index.js +1 -2
  93. package/constants/blocked-actions.js +3 -0
  94. package/core/logic-validation/swap.js +0 -3
  95. package/core/substrate/system-pallet.js +0 -2
  96. package/koni/api/nft/wasm_nft/index.js +0 -1
  97. package/koni/api/staking/bonding/astar.js +0 -2
  98. package/koni/api/staking/bonding/paraChain.js +0 -3
  99. package/koni/api/staking/bonding/relayChain.js +2 -4
  100. package/koni/api/staking/bonding/utils.js +0 -4
  101. package/koni/background/cron.js +0 -1
  102. package/koni/background/handlers/Extension.js +8 -11
  103. package/koni/background/handlers/State.js +41 -38
  104. package/koni/background/handlers/Tabs.js +9 -3
  105. package/package.json +19 -20
  106. package/packageInfo.js +1 -1
  107. package/page/substrate/PostMessageProvider.js +3 -0
  108. package/services/balance-service/helpers/subscribe/cardano/utils.js +0 -1
  109. package/services/balance-service/helpers/subscribe/substrate/gear.js +0 -2
  110. package/services/balance-service/helpers/subscribe/substrate/index.js +0 -1
  111. package/services/balance-service/helpers/subscribe/ton/utils.js +0 -3
  112. package/services/balance-service/index.d.ts +8 -0
  113. package/services/balance-service/index.js +105 -9
  114. package/services/balance-service/transfer/bitcoin-transfer.js +0 -1
  115. package/services/balance-service/transfer/smart-contract.js +0 -1
  116. package/services/balance-service/transfer/token.js +0 -2
  117. package/services/balance-service/transfer/ton-transfer.js +0 -1
  118. package/services/balance-service/transfer/xcm/snowBridge.js +0 -1
  119. package/services/chain-service/handler/CardanoApi.js +3 -1
  120. package/services/chain-service/handler/SubstrateApi.js +0 -2
  121. package/services/chain-service/health-check/index.js +0 -1
  122. package/services/chain-service/health-check/utils/new-utils/chain-asset-validate.js +0 -1
  123. package/services/chain-service/index.d.ts +0 -1
  124. package/services/chain-service/index.js +15 -23
  125. package/services/chain-service/utils/index.js +22 -26
  126. package/services/earning-service/handlers/base.js +32 -0
  127. package/services/earning-service/handlers/lending/base.js +0 -2
  128. package/services/earning-service/handlers/liquid-staking/acala.js +0 -1
  129. package/services/earning-service/handlers/liquid-staking/base.js +0 -2
  130. package/services/earning-service/handlers/liquid-staking/bifrost.js +0 -2
  131. package/services/earning-service/handlers/liquid-staking/parallel.js +0 -1
  132. package/services/earning-service/handlers/native-staking/astar.js +0 -2
  133. package/services/earning-service/handlers/native-staking/dtao.js +43 -0
  134. package/services/earning-service/handlers/native-staking/energy.js +0 -1
  135. package/services/earning-service/handlers/native-staking/mythos.js +0 -2
  136. package/services/earning-service/handlers/native-staking/para-chain.js +0 -2
  137. package/services/earning-service/handlers/native-staking/relay-chain.js +8 -9
  138. package/services/earning-service/handlers/special.js +7 -0
  139. package/services/history-service/subsquid-multi-chain-history.js +0 -1
  140. package/services/keyring-service/context/handlers/Derive.js +2 -2
  141. package/services/keyring-service/context/handlers/Migration.js +3 -1
  142. package/services/keyring-service/context/handlers/Mnemonic.d.ts +1 -1
  143. package/services/keyring-service/context/handlers/Mnemonic.js +16 -10
  144. package/services/keyring-service/context/state.d.ts +3 -0
  145. package/services/keyring-service/context/state.js +21 -3
  146. package/services/keyring-service/utils.d.ts +1 -0
  147. package/services/keyring-service/utils.js +9 -0
  148. package/services/mint-campaign-service/campaigns/UnlockDotCampaign.js +0 -1
  149. package/services/nft-service/index.js +6 -0
  150. package/services/open-gov/handler.js +0 -2
  151. package/services/open-gov/interface.js +4 -1
  152. package/services/request-service/handler/CardanoRequestHandler.js +0 -1
  153. package/services/request-service/handler/EvmRequestHandler.js +0 -1
  154. package/services/request-service/handler/TonRequestHandler.js +0 -1
  155. package/services/setting-service/constants.js +0 -1
  156. package/services/storage-service/DatabaseService.js +0 -2
  157. package/services/storage-service/databases/index.js +3 -0
  158. package/services/swap-service/handler/asset-hub/handler.js +0 -1
  159. package/services/swap-service/handler/asset-hub/router.js +0 -1
  160. package/services/swap-service/handler/chainflip-handler.js +0 -2
  161. package/services/swap-service/handler/hydradx-handler.js +0 -1
  162. package/services/swap-service/handler/kyber-handler.js +0 -1
  163. package/services/swap-service/handler/simpleswap-handler.js +0 -1
  164. package/services/swap-service/handler/uniswap-handler.js +0 -3
  165. package/services/transaction-service/event-parser/index.js +6 -6
  166. package/services/wallet-connect-service/index.js +21 -18
  167. package/services/wallet-connect-service/types.js +1 -1
  168. package/types/account/action/add/mnemonic.d.ts +3 -2
  169. package/types/account/info/keyring.js +9 -1
  170. package/types/balance/index.js +5 -1
  171. package/types/swap/index.js +2 -1
  172. package/types/transaction/process.js +3 -1
  173. package/types/yield/actions/join/step.js +17 -1
  174. package/utils/account/common.d.ts +0 -3
  175. package/utils/account/common.js +0 -24
  176. package/utils/account/derive/info/solo.js +8 -5
  177. package/utils/account/derive/validate.d.ts +2 -2
  178. package/utils/account/derive/validate.js +1 -1
  179. package/utils/account/transform.js +5 -1
  180. package/utils/auth.js +2 -2
  181. package/utils/bitcoin/utxo-management.js +0 -1
  182. package/utils/index.js +2 -5
@@ -602,7 +602,6 @@ function isSameAddress(address1, address2) {
602
602
  }
603
603
  return (0, _account.reformatAddress)(address1, 0) === (0, _account.reformatAddress)(address2, 0); // TODO: maybe there's a better way
604
604
  }
605
-
606
605
  function isSameAddressType(address1, address2) {
607
606
  const isSameEvmAddress = (0, _utilCrypto.isEthereumAddress)(address1) && (0, _utilCrypto.isEthereumAddress)(address2);
608
607
  const isSameTonAddress = (0, _keyring.isTonAddress)(address1) && (0, _keyring.isTonAddress)(address2);
@@ -614,7 +613,7 @@ function isAddressAndChainCompatible(address, chain) {
614
613
  const keypairType = (0, _keyring.getKeypairTypeByAddress)(address);
615
614
  const isEvmCompatible = (0, _utils._isChainEvmCompatible)(chain) && _types.EthereumKeypairTypes.includes(keypairType); // some chains compatible to substrate and evm, and use evm-address
616
615
  const isTonCompatible = (0, _utils._isPureTonChain)(chain) && _types.TonKeypairTypes.includes(keypairType);
617
- const isSubstrateCompatible = (0, _utils._isPureSubstrateChain)(chain) && _types.SubstrateKeypairTypes.includes(keypairType);
616
+ const isSubstrateCompatible = (0, _utils._isPureSubstrateChain)(chain) && _types.AllSubstrateKeypairTypes.includes(keypairType);
618
617
  const isCardanoCompatible = (0, _utils._isPureCardanoChain)(chain) && _types.CardanoKeypairTypes.includes(keypairType);
619
618
  const isBitcoinCompatible = (0, _utils._isPureBitcoinChain)(chain) && _types.BitcoinKeypairTypes.includes(keypairType);
620
619
  return isEvmCompatible || isSubstrateCompatible || isTonCompatible || isCardanoCompatible || isBitcoinCompatible;
@@ -9,6 +9,9 @@ export const APP_VER = packageInfo.version;
9
9
  const PRODUCTION_BRANCHES = ['master', 'webapp', 'webapp-dev'];
10
10
  const branchName = process.env.BRANCH_NAME || 'koni-dev';
11
11
  const targetFolder = PRODUCTION_BRANCHES.indexOf(branchName) > -1 ? 'list' : 'preview';
12
+
13
+ // todo: check if can check exactly App Environment, Browser Type, OS Type
14
+
12
15
  export async function fetchBlockedConfigObjects() {
13
16
  const targetFile = `${targetFolder}/envConfig.json`;
14
17
  return await fetchStaticData('blocked-actions', targetFile);
@@ -34,7 +34,6 @@ export function _validateBalanceToSwapOnAssetHub(fromToken, feeToken, feeTokenCh
34
34
  return new TransactionError(SwapErrorType.SWAP_NOT_ENOUGH_BALANCE, `Insufficient balance. You need more than ${parsedMinSwapValue} ${fromToken.symbol} to start swapping. Deposit ${fromToken.symbol} and try again.`); // todo: min swap or amount?
35
35
  }
36
36
  }
37
-
38
37
  if (new BigN(swapAmount).gte(fromTokenBalance)) {
39
38
  const parsedMaxBalanceSwap = formatNumber(fromTokenBalance, _getAssetDecimals(fromToken));
40
39
  return new TransactionError(SwapErrorType.SWAP_EXCEED_ALLOWANCE, `Amount too high. Lower your amount ${bnFromTokenBalance.gt(0) ? `below ${parsedMaxBalanceSwap} ${fromToken.symbol}` : ''} and try again`);
@@ -62,7 +61,6 @@ export function _validateBalanceToSwap(fromToken, feeToken, feeTokenChainInfo, f
62
61
  return new TransactionError(SwapErrorType.SWAP_NOT_ENOUGH_BALANCE, `Insufficient balance. You need more than ${parsedMinSwapValue} ${fromToken.symbol} to start swapping. Deposit ${fromToken.symbol} and try again.`); // todo: min swap or amount?
63
62
  }
64
63
  }
65
-
66
64
  if (new BigN(swapAmount).gte(fromTokenBalance)) {
67
65
  const parsedMaxBalanceSwap = formatNumber(fromTokenBalance, _getAssetDecimals(fromToken));
68
66
  return new TransactionError(SwapErrorType.SWAP_EXCEED_ALLOWANCE, `Amount too high. Lower your amount ${bnFromTokenBalance.gt(0) ? `below ${parsedMaxBalanceSwap} ${fromToken.symbol}` : ''} and try again`);
@@ -206,7 +204,6 @@ export function _validateBalanceToSwapV2(request) {
206
204
  return new TransactionError(SwapErrorType.SWAP_NOT_ENOUGH_BALANCE, `Insufficient balance. You need more than ${parsedMinSwapValue} ${fromToken.symbol} to start swapping. Deposit ${fromToken.symbol} and try again.`); // todo: min swap or amount?
207
205
  }
208
206
  }
209
-
210
207
  return undefined;
211
208
  }
212
209
  export function _validateSwapRecipientV2(destChainInfo, recipient) {
@@ -18,7 +18,6 @@ export function _getSystemPalletTransferable(accountInfo, existentialDeposit, ex
18
18
  export function _canAccountBeReaped(accountInfo) {
19
19
  return accountInfo.consumers === 0; // might need to check refCount
20
20
  }
21
-
22
21
  export function _isAccountActive(accountInfo) {
23
22
  return !(accountInfo.consumers === 0 && accountInfo.providers === 0 && accountInfo.sufficients === 0);
24
23
  }
@@ -46,7 +45,6 @@ function _getAppliedExistentialDeposit(accountInfo, existentialDeposit, strictMo
46
45
  }
47
46
  return _canAccountBeReaped(accountInfo) ? BigInt(0) : bnExistentialDeposit; // account for ED here will go better with max transfer logic
48
47
  }
49
-
50
48
  function _getSystemPalletTransferableV2(accountInfo, existentialDeposit, strictMode) {
51
49
  const bnLocked = BigInt(accountInfo.data.frozen) - BigInt(accountInfo.data.reserved); // locked can go below 0 but this shouldn't matter
52
50
  const bnAppliedExistentialDeposit = _getAppliedExistentialDeposit(accountInfo, existentialDeposit, strictMode);
@@ -398,7 +398,6 @@ export class WasmNftApi extends BaseNftApi {
398
398
  }
399
399
  }
400
400
  }));
401
-
402
401
  nftOwnerMap[address] = nftIds;
403
402
  } catch (e) {
404
403
  console.error(`${this.chain}`, e);
@@ -114,7 +114,6 @@ export async function subscribeAstarNominatorMetadata(chainInfo, address, substr
114
114
  }
115
115
  }
116
116
  }
117
-
118
117
  const unlockingChunks = ledger.unbondingInfo.unlockingChunks;
119
118
  if (unlockingChunks.length > 0) {
120
119
  for (const unlockingChunk of unlockingChunks) {
@@ -200,7 +199,6 @@ export async function getAstarNominatorMetadata(chainInfo, address, substrateApi
200
199
  }
201
200
  }
202
201
  }
203
-
204
202
  const unlockingChunks = ledger.unbondingInfo.unlockingChunks;
205
203
  if (unlockingChunks.length > 0) {
206
204
  for (const unlockingChunk of unlockingChunks) {
@@ -132,7 +132,6 @@ export async function getParaChainStakingMetadata(chain, substrateApi) {
132
132
  if (unvestedAllocation) {
133
133
  totalIssuance.add(unvestedAllocation); // for Turing network, read more at https://hackmd.io/@sbAqOuXkRvyiZPOB3Ryn6Q/Sypr3ZJh5
134
134
  }
135
-
136
135
  const inflationConfig = _inflation.toHuman();
137
136
  const inflation = getParaCurrentInflation(parseRawNumber(totalStake.toString()), inflationConfig);
138
137
  const unstakingPeriod = parseInt(unstakingDelay) * _STAKING_ERA_LENGTH_MAP[chain];
@@ -185,7 +184,6 @@ export async function subscribeParaChainNominatorMetadata(chainInfo, address, su
185
184
  }
186
185
  }
187
186
  }
188
-
189
187
  const bnStake = new BN(delegation.amount);
190
188
  const bnUnstakeBalance = unstakingMap[delegation.owner] ? new BN(unstakingMap[delegation.owner].claimable) : BN_ZERO;
191
189
  const bnActiveStake = bnStake.sub(bnUnstakeBalance);
@@ -279,7 +277,6 @@ export async function getParaChainNominatorMetadata(chainInfo, address, substrat
279
277
  }
280
278
  }
281
279
  }
282
-
283
280
  const bnStake = new BN(delegation.amount);
284
281
  const bnUnstakeBalance = unstakingMap[delegation.owner] ? new BN(unstakingMap[delegation.owner].claimable) : BN_ZERO;
285
282
  const bnActiveStake = bnStake.sub(bnUnstakeBalance);
@@ -221,7 +221,6 @@ export async function subscribeRelayChainNominatorMetadata(chainInfo, address, s
221
221
  });
222
222
  }));
223
223
  }
224
-
225
224
  let stakingStatus = EarningStatus.NOT_EARNING;
226
225
  const bnActiveStake = new BN(activeStake);
227
226
  let waitingNominationCount = 0;
@@ -273,13 +272,13 @@ export async function subscribeRelayChainNominatorMetadata(chainInfo, address, s
273
272
  * Deprecated
274
273
  * */
275
274
  export async function getRelayChainNominatorMetadata(chainInfo, address, substrateApi) {
276
- var _chainApi$api$query10, _chainApi$api$query11, _chainApi$api$query12, _chainApi$api$query13, _chainApi$api$query14, _chainApi$api$query15, _chainApi$api$query16, _chainApi$api$query17, _chainApi$api$query18, _chainApi$api$query19, _chainApi$api$query20, _chainApi$api$query21, _chainApi$api$query22, _chainApi$api$query23;
275
+ var _chainApi$api$query0, _chainApi$api$query0$, _chainApi$api$query1, _chainApi$api$query1$, _chainApi$api$query10, _chainApi$api$query11, _chainApi$api$query12, _chainApi$api$query13, _chainApi$api$query14, _chainApi$api$query15, _chainApi$api$query16, _chainApi$api$query17, _chainApi$api$query18, _chainApi$api$query19;
277
276
  if (isEthereumAddress(address)) {
278
277
  return;
279
278
  }
280
279
  const chain = chainInfo.slug;
281
280
  const chainApi = await substrateApi.isReady;
282
- const [_ledger, _nominations, _currentEra, _bonded, _minimumActiveStake, _minNominatorBond] = await Promise.all([(_chainApi$api$query10 = chainApi.api.query) === null || _chainApi$api$query10 === void 0 ? void 0 : (_chainApi$api$query11 = _chainApi$api$query10.staking) === null || _chainApi$api$query11 === void 0 ? void 0 : _chainApi$api$query11.ledger(address), (_chainApi$api$query12 = chainApi.api.query) === null || _chainApi$api$query12 === void 0 ? void 0 : (_chainApi$api$query13 = _chainApi$api$query12.staking) === null || _chainApi$api$query13 === void 0 ? void 0 : _chainApi$api$query13.nominators(address), (_chainApi$api$query14 = chainApi.api.query) === null || _chainApi$api$query14 === void 0 ? void 0 : (_chainApi$api$query15 = _chainApi$api$query14.staking) === null || _chainApi$api$query15 === void 0 ? void 0 : _chainApi$api$query15.currentEra(), (_chainApi$api$query16 = chainApi.api.query) === null || _chainApi$api$query16 === void 0 ? void 0 : (_chainApi$api$query17 = _chainApi$api$query16.staking) === null || _chainApi$api$query17 === void 0 ? void 0 : _chainApi$api$query17.bonded(address), ((_chainApi$api$query18 = chainApi.api.query) === null || _chainApi$api$query18 === void 0 ? void 0 : (_chainApi$api$query19 = _chainApi$api$query18.staking) === null || _chainApi$api$query19 === void 0 ? void 0 : _chainApi$api$query19.minimumActiveStake) && ((_chainApi$api$query20 = chainApi.api.query) === null || _chainApi$api$query20 === void 0 ? void 0 : (_chainApi$api$query21 = _chainApi$api$query20.staking) === null || _chainApi$api$query21 === void 0 ? void 0 : _chainApi$api$query21.minimumActiveStake()), (_chainApi$api$query22 = chainApi.api.query) === null || _chainApi$api$query22 === void 0 ? void 0 : (_chainApi$api$query23 = _chainApi$api$query22.staking) === null || _chainApi$api$query23 === void 0 ? void 0 : _chainApi$api$query23.minNominatorBond()]);
281
+ const [_ledger, _nominations, _currentEra, _bonded, _minimumActiveStake, _minNominatorBond] = await Promise.all([(_chainApi$api$query0 = chainApi.api.query) === null || _chainApi$api$query0 === void 0 ? void 0 : (_chainApi$api$query0$ = _chainApi$api$query0.staking) === null || _chainApi$api$query0$ === void 0 ? void 0 : _chainApi$api$query0$.ledger(address), (_chainApi$api$query1 = chainApi.api.query) === null || _chainApi$api$query1 === void 0 ? void 0 : (_chainApi$api$query1$ = _chainApi$api$query1.staking) === null || _chainApi$api$query1$ === void 0 ? void 0 : _chainApi$api$query1$.nominators(address), (_chainApi$api$query10 = chainApi.api.query) === null || _chainApi$api$query10 === void 0 ? void 0 : (_chainApi$api$query11 = _chainApi$api$query10.staking) === null || _chainApi$api$query11 === void 0 ? void 0 : _chainApi$api$query11.currentEra(), (_chainApi$api$query12 = chainApi.api.query) === null || _chainApi$api$query12 === void 0 ? void 0 : (_chainApi$api$query13 = _chainApi$api$query12.staking) === null || _chainApi$api$query13 === void 0 ? void 0 : _chainApi$api$query13.bonded(address), ((_chainApi$api$query14 = chainApi.api.query) === null || _chainApi$api$query14 === void 0 ? void 0 : (_chainApi$api$query15 = _chainApi$api$query14.staking) === null || _chainApi$api$query15 === void 0 ? void 0 : _chainApi$api$query15.minimumActiveStake) && ((_chainApi$api$query16 = chainApi.api.query) === null || _chainApi$api$query16 === void 0 ? void 0 : (_chainApi$api$query17 = _chainApi$api$query16.staking) === null || _chainApi$api$query17 === void 0 ? void 0 : _chainApi$api$query17.minimumActiveStake()), (_chainApi$api$query18 = chainApi.api.query) === null || _chainApi$api$query18 === void 0 ? void 0 : (_chainApi$api$query19 = _chainApi$api$query18.staking) === null || _chainApi$api$query19 === void 0 ? void 0 : _chainApi$api$query19.minNominatorBond()]);
283
282
  const minActiveStake = (_minimumActiveStake === null || _minimumActiveStake === void 0 ? void 0 : _minimumActiveStake.toString()) || '0';
284
283
  const minNominatorBond = _minNominatorBond.toString();
285
284
  const bnMinActiveStake = new BN(minActiveStake);
@@ -334,7 +333,6 @@ export async function getRelayChainNominatorMetadata(chainInfo, address, substra
334
333
  });
335
334
  }));
336
335
  }
337
-
338
336
  let stakingStatus = EarningStatus.NOT_EARNING;
339
337
  const bnActiveStake = new BN(activeStake);
340
338
  let waitingNominationCount = 0;
@@ -69,7 +69,6 @@ export function calculateChainStakedReturn(inflation, totalEraStake, totalIssuan
69
69
  if (_STAKING_CHAIN_GROUP.aleph.includes(networkKey)) {
70
70
  stakedReturn *= 0.9; // 10% goes to treasury
71
71
  }
72
-
73
72
  return stakedReturn;
74
73
  }
75
74
  export async function calculateChainStakedReturnV2(chainInfo, totalIssuance, erasPerDay, lastTotalStaked, validatorEraReward, inflation, isCompound) {
@@ -136,11 +135,9 @@ export function calculateValidatorStakedReturn(chainStakedReturn, totalValidator
136
135
  const stakedReturn = (adjusted > Number.MAX_SAFE_INTEGER ? Number.MAX_SAFE_INTEGER : adjusted) / 100;
137
136
  return stakedReturn * (100 - commission) / 100; // Deduct commission
138
137
  }
139
-
140
138
  export function getCommission(commissionString) {
141
139
  return parseFloat(commissionString.split('%')[0]); // Example: 12%
142
140
  }
143
-
144
141
  export function getParaCurrentInflation(totalStaked, inflationConfig) {
145
142
  // read more at https://hackmd.io/@sbAqOuXkRvyiZPOB3Ryn6Q/Sypr3ZJh5
146
143
  const expectMin = parseRawNumber(inflationConfig.expect.min);
@@ -263,7 +260,6 @@ export function getYieldAvailableActionsByPosition(yieldPosition, yieldPoolInfo,
263
260
  result.push(YieldAction.START_EARNING);
264
261
  result.push(YieldAction.WITHDRAW_EARNING); // TODO
265
262
  }
266
-
267
263
  return result;
268
264
  }
269
265
  export let StakingAction;
@@ -13,7 +13,6 @@ export class KoniCron {
13
13
  this.state = state;
14
14
  // this.init();
15
15
  }
16
-
17
16
  cronMap = {};
18
17
  subjectMap = {};
19
18
  getCron = name => {
@@ -52,7 +52,7 @@ import { _analyzeAddress, calculateMaxTransferable, combineAllAccountProxy, comb
52
52
  import { parseContractInput, parseEvmRlp } from '@subwallet/extension-base/utils/eth/parseTransaction';
53
53
  import { getId } from '@subwallet/extension-base/utils/getId';
54
54
  import { getKeypairTypeByAddress, isAddress, isCardanoAddress, isSubstrateAddress, isTonAddress } from '@subwallet/keyring';
55
- import { BitcoinKeypairTypes, CardanoKeypairTypes, EthereumKeypairTypes, SubstrateKeypairTypes, TonKeypairTypes } from '@subwallet/keyring/types';
55
+ import { AllSubstrateKeypairTypes, BitcoinKeypairTypes, CardanoKeypairTypes, EthereumKeypairTypes, TonKeypairTypes } from '@subwallet/keyring/types';
56
56
  import { getBitcoinAddressInfo } from '@subwallet/keyring/utils';
57
57
  import { isBitcoinAddress } from '@subwallet/keyring/utils/address/validate';
58
58
  import { keyring } from '@subwallet/ui-keyring';
@@ -591,7 +591,7 @@ export default class KoniExtension {
591
591
  const type = getKeypairTypeByAddress(address);
592
592
  const validTypes = {
593
593
  evm: EthereumKeypairTypes,
594
- substrate: SubstrateKeypairTypes,
594
+ substrate: AllSubstrateKeypairTypes,
595
595
  ton: TonKeypairTypes,
596
596
  cardano: CardanoKeypairTypes,
597
597
  bitcoin: BitcoinKeypairTypes
@@ -2227,7 +2227,6 @@ export default class KoniExtension {
2227
2227
  const fee = await this.#koniState.feeService.subscribeChainFee(id, chain, feeChainType, data => {
2228
2228
  feeSubject.next(data); // Must be called after subscription
2229
2229
  });
2230
-
2231
2230
  const unsub = () => {
2232
2231
  subscription.unsubscribe();
2233
2232
  unsubBalance();
@@ -2352,11 +2351,9 @@ export default class KoniExtension {
2352
2351
  const [unsubBalance, freeBalance] = await this.#koniState.balanceService.subscribeBalance(address, chain, token, BalanceType.TRANSFERABLE, ExtrinsicType.TRANSFER_BALANCE, data => {
2353
2352
  freeBalanceSubject.next(data); // Must be called after subscription
2354
2353
  });
2355
-
2356
2354
  const fee = await this.#koniState.feeService.subscribeChainFee(id, chain, feeType, data => {
2357
2355
  feeSubject.next(data); // Must be called after subscription
2358
2356
  });
2359
-
2360
2357
  const unsub = () => {
2361
2358
  subscription.unsubscribe();
2362
2359
  unsubBalance();
@@ -3592,21 +3589,21 @@ export default class KoniExtension {
3592
3589
  const unsubSyncProgress = await ((_this$koniState$chain7 = this.#koniState.chainService) === null || _this$koniState$chain7 === void 0 ? void 0 : (_this$koniState$chain8 = _this$koniState$chain7.mantaPay) === null || _this$koniState$chain8 === void 0 ? void 0 : _this$koniState$chain8.subscribeSyncProgress());
3593
3590
  console.debug('Start initial sync for MantaPay');
3594
3591
  this.#koniState.initialSyncMantaPay(address).then(() => {
3595
- var _this$koniState$chain9, _this$koniState$chain10;
3592
+ var _this$koniState$chain9, _this$koniState$chain0;
3596
3593
  console.debug('Finished initial sync for MantaPay');
3597
3594
  this.#skipAutoLock = false;
3598
3595
  unsubSyncProgress && unsubSyncProgress();
3599
3596
  // make sure the sync state is set, just in case it gets unsubscribed
3600
- (_this$koniState$chain9 = this.#koniState.chainService) === null || _this$koniState$chain9 === void 0 ? void 0 : (_this$koniState$chain10 = _this$koniState$chain9.mantaPay) === null || _this$koniState$chain10 === void 0 ? void 0 : _this$koniState$chain10.setSyncState({
3597
+ (_this$koniState$chain9 = this.#koniState.chainService) === null || _this$koniState$chain9 === void 0 ? void 0 : (_this$koniState$chain0 = _this$koniState$chain9.mantaPay) === null || _this$koniState$chain0 === void 0 ? void 0 : _this$koniState$chain0.setSyncState({
3601
3598
  progress: 100,
3602
3599
  isSyncing: false
3603
3600
  });
3604
3601
  }).catch(e => {
3605
- var _this$koniState$chain11, _this$koniState$chain12;
3602
+ var _this$koniState$chain1, _this$koniState$chain10;
3606
3603
  console.error('Error syncing MantaPay', e);
3607
3604
  this.#skipAutoLock = false;
3608
3605
  unsubSyncProgress && unsubSyncProgress();
3609
- (_this$koniState$chain11 = this.#koniState.chainService) === null || _this$koniState$chain11 === void 0 ? void 0 : (_this$koniState$chain12 = _this$koniState$chain11.mantaPay) === null || _this$koniState$chain12 === void 0 ? void 0 : _this$koniState$chain12.setSyncState({
3606
+ (_this$koniState$chain1 = this.#koniState.chainService) === null || _this$koniState$chain1 === void 0 ? void 0 : (_this$koniState$chain10 = _this$koniState$chain1.mantaPay) === null || _this$koniState$chain10 === void 0 ? void 0 : _this$koniState$chain10.setSyncState({
3610
3607
  progress: 0,
3611
3608
  isSyncing: false
3612
3609
  });
@@ -3644,7 +3641,7 @@ export default class KoniExtension {
3644
3641
  return this.#koniState.getMantaPayConfig('calamari');
3645
3642
  }
3646
3643
  subscribeMantaPaySyncState(id, port) {
3647
- var _this$koniState$subsc, _this$koniState$chain13, _this$koniState$chain14;
3644
+ var _this$koniState$subsc, _this$koniState$chain11, _this$koniState$chain12;
3648
3645
  const cb = createSubscription(id, port);
3649
3646
  const syncingStateSubscription = (_this$koniState$subsc = this.#koniState.subscribeMantaPaySyncState()) === null || _this$koniState$subsc === void 0 ? void 0 : _this$koniState$subsc.subscribe({
3650
3647
  next: rs => {
@@ -3655,7 +3652,7 @@ export default class KoniExtension {
3655
3652
  port.onDisconnect.addListener(() => {
3656
3653
  this.cancelSubscription(id);
3657
3654
  });
3658
- return ((_this$koniState$chain13 = this.#koniState.chainService) === null || _this$koniState$chain13 === void 0 ? void 0 : (_this$koniState$chain14 = _this$koniState$chain13.mantaPay) === null || _this$koniState$chain14 === void 0 ? void 0 : _this$koniState$chain14.getSyncState()) || {
3655
+ return ((_this$koniState$chain11 = this.#koniState.chainService) === null || _this$koniState$chain11 === void 0 ? void 0 : (_this$koniState$chain12 = _this$koniState$chain11.mantaPay) === null || _this$koniState$chain12 === void 0 ? void 0 : _this$koniState$chain12.getSyncState()) || {
3659
3656
  isSyncing: false,
3660
3657
  progress: 0,
3661
3658
  needManualSync: false
@@ -87,6 +87,9 @@ export default class KoniState {
87
87
  data: {}
88
88
  };
89
89
  lazyMap = {};
90
+
91
+ // TODO: consider making chainService public (or getter) and call function directly
92
+
90
93
  // Handle the general status of the extension
91
94
  generalStatus = ServiceStatus.INITIALIZING;
92
95
  waitSleeping = null;
@@ -745,7 +748,7 @@ export default class KoniState {
745
748
  }
746
749
  async enableChainWithPriorityAssets(chainSlug, enableTokens = true) {
747
750
  if (enableTokens) {
748
- await this.chainService.updatePriorityAssetsByChain(chainSlug, true);
751
+ await this.balanceService.updatePriorityAssetsByChain(chainSlug, true);
749
752
  }
750
753
  return this.chainService.enableChain(chainSlug);
751
754
  }
@@ -1845,7 +1848,7 @@ export default class KoniState {
1845
1848
  });
1846
1849
  }
1847
1850
  async enableMantaPay(updateStore, address, password, seedPhrase) {
1848
- var _this$chainService3, _this$chainService3$m, _this$chainService4, _this$chainService4$m, _this$chainService4$m2, _this$chainService11, _this$chainService11$, _this$chainService11$2;
1851
+ var _this$chainService3, _this$chainService3$m, _this$chainService4, _this$chainService4$m, _this$chainService4$m2, _this$chainService1, _this$chainService1$m, _this$chainService1$m2;
1849
1852
  if (!address || isEthereumAddress(address)) {
1850
1853
  return;
1851
1854
  }
@@ -1865,7 +1868,7 @@ export default class KoniState {
1865
1868
  data: encryptedData
1866
1869
  }));
1867
1870
  } else {
1868
- var _this$chainService9, _this$chainService9$m, _this$chainService10, _this$chainService10$, _this$chainService10$2;
1871
+ var _this$chainService9, _this$chainService9$m, _this$chainService0, _this$chainService0$m, _this$chainService0$m2;
1869
1872
  const authContext = await ((_this$chainService9 = this.chainService) === null || _this$chainService9 === void 0 ? void 0 : (_this$chainService9$m = _this$chainService9.mantaPay) === null || _this$chainService9$m === void 0 ? void 0 : _this$chainService9$m.getMantaAuthContext(address, _DEFAULT_MANTA_ZK_CHAIN));
1870
1873
 
1871
1874
  // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment
@@ -1873,18 +1876,18 @@ export default class KoniState {
1873
1876
 
1874
1877
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument,@typescript-eslint/no-unsafe-member-access
1875
1878
  const proofAuthKey = new Uint8Array(Object.values(decryptedData.proof_authorization_key));
1876
- await ((_this$chainService10 = this.chainService) === null || _this$chainService10 === void 0 ? void 0 : (_this$chainService10$ = _this$chainService10.mantaPay) === null || _this$chainService10$ === void 0 ? void 0 : (_this$chainService10$2 = _this$chainService10$.privateWallet) === null || _this$chainService10$2 === void 0 ? void 0 : _this$chainService10$2.loadAuthorizationContext({
1879
+ await ((_this$chainService0 = this.chainService) === null || _this$chainService0 === void 0 ? void 0 : (_this$chainService0$m = _this$chainService0.mantaPay) === null || _this$chainService0$m === void 0 ? void 0 : (_this$chainService0$m2 = _this$chainService0$m.privateWallet) === null || _this$chainService0$m2 === void 0 ? void 0 : _this$chainService0$m2.loadAuthorizationContext({
1877
1880
  proof_authorization_key: proofAuthKey
1878
1881
  }));
1879
1882
  }
1880
- const zkAddress = await ((_this$chainService11 = this.chainService) === null || _this$chainService11 === void 0 ? void 0 : (_this$chainService11$ = _this$chainService11.mantaPay) === null || _this$chainService11$ === void 0 ? void 0 : (_this$chainService11$2 = _this$chainService11$.privateWallet) === null || _this$chainService11$2 === void 0 ? void 0 : _this$chainService11$2.getZkAddress());
1883
+ const zkAddress = await ((_this$chainService1 = this.chainService) === null || _this$chainService1 === void 0 ? void 0 : (_this$chainService1$m = _this$chainService1.mantaPay) === null || _this$chainService1$m === void 0 ? void 0 : (_this$chainService1$m2 = _this$chainService1$m.privateWallet) === null || _this$chainService1$m2 === void 0 ? void 0 : _this$chainService1$m2.getZkAddress());
1881
1884
  if (updateStore) {
1882
- var _this$chainService12, _this$chainService12$, _this$chainService13, _this$chainService13$, _this$chainService13$2, _this$chainService13$3;
1883
- await ((_this$chainService12 = this.chainService) === null || _this$chainService12 === void 0 ? void 0 : (_this$chainService12$ = _this$chainService12.mantaPay) === null || _this$chainService12$ === void 0 ? void 0 : _this$chainService12$.saveMantaPayConfig({
1885
+ var _this$chainService10, _this$chainService10$, _this$chainService11, _this$chainService11$, _this$chainService11$2, _this$chainService11$3;
1886
+ await ((_this$chainService10 = this.chainService) === null || _this$chainService10 === void 0 ? void 0 : (_this$chainService10$ = _this$chainService10.mantaPay) === null || _this$chainService10$ === void 0 ? void 0 : _this$chainService10$.saveMantaPayConfig({
1884
1887
  address,
1885
1888
  zkAddress: zkAddress,
1886
1889
  enabled: true,
1887
- chain: (_this$chainService13 = this.chainService) === null || _this$chainService13 === void 0 ? void 0 : (_this$chainService13$ = _this$chainService13.mantaPay) === null || _this$chainService13$ === void 0 ? void 0 : (_this$chainService13$2 = _this$chainService13$.privateWallet) === null || _this$chainService13$2 === void 0 ? void 0 : (_this$chainService13$3 = _this$chainService13$2.network) === null || _this$chainService13$3 === void 0 ? void 0 : _this$chainService13$3.toLowerCase(),
1890
+ chain: (_this$chainService11 = this.chainService) === null || _this$chainService11 === void 0 ? void 0 : (_this$chainService11$ = _this$chainService11.mantaPay) === null || _this$chainService11$ === void 0 ? void 0 : (_this$chainService11$2 = _this$chainService11$.privateWallet) === null || _this$chainService11$2 === void 0 ? void 0 : (_this$chainService11$3 = _this$chainService11$2.network) === null || _this$chainService11$3 === void 0 ? void 0 : _this$chainService11$3.toLowerCase(),
1888
1891
  isInitialSync: false
1889
1892
  }));
1890
1893
  }
@@ -1892,48 +1895,48 @@ export default class KoniState {
1892
1895
  return zkAddress;
1893
1896
  }
1894
1897
  async disableMantaPay(address) {
1895
- var _this$chainService14, _this$chainService14$, _this$chainService15, _this$chainService15$, _this$chainService15$2, _this$chainService16, _this$chainService16$, _this$chainService16$2, _this$chainService17, _this$chainService17$, _this$chainService18, _this$chainService18$;
1896
- const config = await ((_this$chainService14 = this.chainService) === null || _this$chainService14 === void 0 ? void 0 : (_this$chainService14$ = _this$chainService14.mantaPay) === null || _this$chainService14$ === void 0 ? void 0 : _this$chainService14$.getMantaPayConfig(address, _DEFAULT_MANTA_ZK_CHAIN));
1898
+ var _this$chainService12, _this$chainService12$, _this$chainService13, _this$chainService13$, _this$chainService13$2, _this$chainService14, _this$chainService14$, _this$chainService14$2, _this$chainService15, _this$chainService15$, _this$chainService16, _this$chainService16$;
1899
+ const config = await ((_this$chainService12 = this.chainService) === null || _this$chainService12 === void 0 ? void 0 : (_this$chainService12$ = _this$chainService12.mantaPay) === null || _this$chainService12$ === void 0 ? void 0 : _this$chainService12$.getMantaPayConfig(address, _DEFAULT_MANTA_ZK_CHAIN));
1897
1900
  if (!config) {
1898
1901
  return false;
1899
1902
  }
1900
- await ((_this$chainService15 = this.chainService) === null || _this$chainService15 === void 0 ? void 0 : (_this$chainService15$ = _this$chainService15.mantaPay) === null || _this$chainService15$ === void 0 ? void 0 : (_this$chainService15$2 = _this$chainService15$.privateWallet) === null || _this$chainService15$2 === void 0 ? void 0 : _this$chainService15$2.dropAuthorizationContext());
1901
- await ((_this$chainService16 = this.chainService) === null || _this$chainService16 === void 0 ? void 0 : (_this$chainService16$ = _this$chainService16.mantaPay) === null || _this$chainService16$ === void 0 ? void 0 : (_this$chainService16$2 = _this$chainService16$.privateWallet) === null || _this$chainService16$2 === void 0 ? void 0 : _this$chainService16$2.dropUserSeedPhrase());
1903
+ await ((_this$chainService13 = this.chainService) === null || _this$chainService13 === void 0 ? void 0 : (_this$chainService13$ = _this$chainService13.mantaPay) === null || _this$chainService13$ === void 0 ? void 0 : (_this$chainService13$2 = _this$chainService13$.privateWallet) === null || _this$chainService13$2 === void 0 ? void 0 : _this$chainService13$2.dropAuthorizationContext());
1904
+ await ((_this$chainService14 = this.chainService) === null || _this$chainService14 === void 0 ? void 0 : (_this$chainService14$ = _this$chainService14.mantaPay) === null || _this$chainService14$ === void 0 ? void 0 : (_this$chainService14$2 = _this$chainService14$.privateWallet) === null || _this$chainService14$2 === void 0 ? void 0 : _this$chainService14$2.dropUserSeedPhrase());
1902
1905
  // await this.chainService?.mantaPay?.privateWallet?.resetState();
1903
- await ((_this$chainService17 = this.chainService) === null || _this$chainService17 === void 0 ? void 0 : (_this$chainService17$ = _this$chainService17.mantaPay) === null || _this$chainService17$ === void 0 ? void 0 : _this$chainService17$.deleteMantaPayConfig(address, _DEFAULT_MANTA_ZK_CHAIN));
1904
- await ((_this$chainService18 = this.chainService) === null || _this$chainService18 === void 0 ? void 0 : (_this$chainService18$ = _this$chainService18.mantaPay) === null || _this$chainService18$ === void 0 ? void 0 : _this$chainService18$.deleteMantaAuthContext(address, _DEFAULT_MANTA_ZK_CHAIN));
1906
+ await ((_this$chainService15 = this.chainService) === null || _this$chainService15 === void 0 ? void 0 : (_this$chainService15$ = _this$chainService15.mantaPay) === null || _this$chainService15$ === void 0 ? void 0 : _this$chainService15$.deleteMantaPayConfig(address, _DEFAULT_MANTA_ZK_CHAIN));
1907
+ await ((_this$chainService16 = this.chainService) === null || _this$chainService16 === void 0 ? void 0 : (_this$chainService16$ = _this$chainService16.mantaPay) === null || _this$chainService16$ === void 0 ? void 0 : _this$chainService16$.deleteMantaAuthContext(address, _DEFAULT_MANTA_ZK_CHAIN));
1905
1908
  this.chainService.setMantaZkAssetSettings(false);
1906
1909
  this.isMantaPayEnabled = false;
1907
1910
  return true;
1908
1911
  }
1909
1912
  async initialSyncMantaPay(address) {
1910
- var _this$chainService19, _this$chainService19$, _this$chainService20, _this$chainService20$, _this$chainService20$2, _this$chainService20$3, _this$chainService21, _this$chainService21$, _this$chainService21$2, _this$chainService22, _this$chainService22$;
1913
+ var _this$chainService17, _this$chainService17$, _this$chainService18, _this$chainService18$, _this$chainService18$2, _this$chainService18$3, _this$chainService19, _this$chainService19$, _this$chainService19$2, _this$chainService20, _this$chainService20$;
1911
1914
  if (!address || isEthereumAddress(address)) {
1912
1915
  return;
1913
1916
  }
1914
- (_this$chainService19 = this.chainService) === null || _this$chainService19 === void 0 ? void 0 : (_this$chainService19$ = _this$chainService19.mantaPay) === null || _this$chainService19$ === void 0 ? void 0 : _this$chainService19$.setCurrentAddress(address);
1915
- await ((_this$chainService20 = this.chainService) === null || _this$chainService20 === void 0 ? void 0 : (_this$chainService20$ = _this$chainService20.mantaPay) === null || _this$chainService20$ === void 0 ? void 0 : (_this$chainService20$2 = _this$chainService20$.privateWallet) === null || _this$chainService20$2 === void 0 ? void 0 : (_this$chainService20$3 = _this$chainService20$2.baseWallet) === null || _this$chainService20$3 === void 0 ? void 0 : _this$chainService20$3.isApiReady());
1916
- const syncResult = await ((_this$chainService21 = this.chainService) === null || _this$chainService21 === void 0 ? void 0 : (_this$chainService21$ = _this$chainService21.mantaPay) === null || _this$chainService21$ === void 0 ? void 0 : (_this$chainService21$2 = _this$chainService21$.privateWallet) === null || _this$chainService21$2 === void 0 ? void 0 : _this$chainService21$2.initialWalletSync());
1917
- await ((_this$chainService22 = this.chainService) === null || _this$chainService22 === void 0 ? void 0 : (_this$chainService22$ = _this$chainService22.mantaPay) === null || _this$chainService22$ === void 0 ? void 0 : _this$chainService22$.updateMantaPayConfig(address, _DEFAULT_MANTA_ZK_CHAIN, {
1917
+ (_this$chainService17 = this.chainService) === null || _this$chainService17 === void 0 ? void 0 : (_this$chainService17$ = _this$chainService17.mantaPay) === null || _this$chainService17$ === void 0 ? void 0 : _this$chainService17$.setCurrentAddress(address);
1918
+ await ((_this$chainService18 = this.chainService) === null || _this$chainService18 === void 0 ? void 0 : (_this$chainService18$ = _this$chainService18.mantaPay) === null || _this$chainService18$ === void 0 ? void 0 : (_this$chainService18$2 = _this$chainService18$.privateWallet) === null || _this$chainService18$2 === void 0 ? void 0 : (_this$chainService18$3 = _this$chainService18$2.baseWallet) === null || _this$chainService18$3 === void 0 ? void 0 : _this$chainService18$3.isApiReady());
1919
+ const syncResult = await ((_this$chainService19 = this.chainService) === null || _this$chainService19 === void 0 ? void 0 : (_this$chainService19$ = _this$chainService19.mantaPay) === null || _this$chainService19$ === void 0 ? void 0 : (_this$chainService19$2 = _this$chainService19$.privateWallet) === null || _this$chainService19$2 === void 0 ? void 0 : _this$chainService19$2.initialWalletSync());
1920
+ await ((_this$chainService20 = this.chainService) === null || _this$chainService20 === void 0 ? void 0 : (_this$chainService20$ = _this$chainService20.mantaPay) === null || _this$chainService20$ === void 0 ? void 0 : _this$chainService20$.updateMantaPayConfig(address, _DEFAULT_MANTA_ZK_CHAIN, {
1918
1921
  isInitialSync: true
1919
1922
  }));
1920
1923
  this.eventService.emit('mantaPay.initSync', undefined);
1921
1924
  return syncResult;
1922
1925
  }
1923
1926
  getMantaZkBalance() {
1924
- var _this$chainService23, _this$chainService24, _this$chainService24$, _this$chainService24$2, _this$chainService25, _this$chainService25$, _this$chainService26, _this$chainService26$, _this$chainService26$2;
1925
- if (!this.chainService || !((_this$chainService23 = this.chainService) !== null && _this$chainService23 !== void 0 && _this$chainService23.mantaPay)) {
1927
+ var _this$chainService21, _this$chainService22, _this$chainService22$, _this$chainService22$2, _this$chainService23, _this$chainService23$, _this$chainService24, _this$chainService24$, _this$chainService24$2;
1928
+ if (!this.chainService || !((_this$chainService21 = this.chainService) !== null && _this$chainService21 !== void 0 && _this$chainService21.mantaPay)) {
1926
1929
  return;
1927
1930
  }
1928
- if (!((_this$chainService24 = this.chainService) !== null && _this$chainService24 !== void 0 && (_this$chainService24$ = _this$chainService24.mantaPay) !== null && _this$chainService24$ !== void 0 && (_this$chainService24$2 = _this$chainService24$.privateWallet) !== null && _this$chainService24$2 !== void 0 && _this$chainService24$2.initialSyncIsFinished)) {
1931
+ if (!((_this$chainService22 = this.chainService) !== null && _this$chainService22 !== void 0 && (_this$chainService22$ = _this$chainService22.mantaPay) !== null && _this$chainService22$ !== void 0 && (_this$chainService22$2 = _this$chainService22$.privateWallet) !== null && _this$chainService22$2 !== void 0 && _this$chainService22$2.initialSyncIsFinished)) {
1929
1932
  return;
1930
1933
  }
1931
- const chain = (_this$chainService25 = this.chainService) === null || _this$chainService25 === void 0 ? void 0 : (_this$chainService25$ = _this$chainService25.mantaPay.privateWallet) === null || _this$chainService25$ === void 0 ? void 0 : _this$chainService25$.network;
1934
+ const chain = (_this$chainService23 = this.chainService) === null || _this$chainService23 === void 0 ? void 0 : (_this$chainService23$ = _this$chainService23.mantaPay.privateWallet) === null || _this$chainService23$ === void 0 ? void 0 : _this$chainService23$.network;
1932
1935
  if (!chain) {
1933
1936
  return;
1934
1937
  }
1935
1938
  const assetMap = this.chainService.getMantaZkAssets(chain === null || chain === void 0 ? void 0 : chain.toLowerCase());
1936
- (_this$chainService26 = this.chainService) === null || _this$chainService26 === void 0 ? void 0 : (_this$chainService26$ = _this$chainService26.mantaPay) === null || _this$chainService26$ === void 0 ? void 0 : (_this$chainService26$2 = _this$chainService26$.privateWallet) === null || _this$chainService26$2 === void 0 ? void 0 : _this$chainService26$2.getMultiZkBalance(Object.values(assetMap).map(tokenInfo => new BN(_getTokenOnChainAssetId(tokenInfo)))).then(zkBalances => {
1939
+ (_this$chainService24 = this.chainService) === null || _this$chainService24 === void 0 ? void 0 : (_this$chainService24$ = _this$chainService24.mantaPay) === null || _this$chainService24$ === void 0 ? void 0 : (_this$chainService24$2 = _this$chainService24$.privateWallet) === null || _this$chainService24$2 === void 0 ? void 0 : _this$chainService24$2.getMultiZkBalance(Object.values(assetMap).map(tokenInfo => new BN(_getTokenOnChainAssetId(tokenInfo)))).then(zkBalances => {
1937
1940
  const assetList = Object.values(assetMap);
1938
1941
  for (let i = 0; i < assetList.length; i++) {
1939
1942
  var _zkBalances$i;
@@ -1950,9 +1953,9 @@ export default class KoniState {
1950
1953
  }).catch(console.warn);
1951
1954
  }
1952
1955
  subscribeMantaPayBalance() {
1953
- var _this$chainService27, _this$chainService27$;
1956
+ var _this$chainService25, _this$chainService25$;
1954
1957
  let interval;
1955
- (_this$chainService27 = this.chainService) === null || _this$chainService27 === void 0 ? void 0 : (_this$chainService27$ = _this$chainService27.mantaPay) === null || _this$chainService27$ === void 0 ? void 0 : _this$chainService27$.getMantaPayConfig(this.keyringService.context.currentAccount.proxyId, _DEFAULT_MANTA_ZK_CHAIN).then(config => {
1958
+ (_this$chainService25 = this.chainService) === null || _this$chainService25 === void 0 ? void 0 : (_this$chainService25$ = _this$chainService25.mantaPay) === null || _this$chainService25$ === void 0 ? void 0 : _this$chainService25$.getMantaPayConfig(this.keyringService.context.currentAccount.proxyId, _DEFAULT_MANTA_ZK_CHAIN).then(config => {
1956
1959
  if (config && config.enabled && config.isInitialSync) {
1957
1960
  this.getMantaZkBalance();
1958
1961
  interval = setInterval(this.getMantaZkBalance, MANTA_PAY_BALANCE_INTERVAL);
@@ -1963,23 +1966,23 @@ export default class KoniState {
1963
1966
  };
1964
1967
  }
1965
1968
  async syncMantaPay() {
1966
- var _this$chainService28, _this$chainService28$, _this$chainService29, _this$chainService29$, _this$chainService29$2;
1967
- const config = await ((_this$chainService28 = this.chainService) === null || _this$chainService28 === void 0 ? void 0 : (_this$chainService28$ = _this$chainService28.mantaPay) === null || _this$chainService28$ === void 0 ? void 0 : _this$chainService28$.getMantaPayFirstConfig(_DEFAULT_MANTA_ZK_CHAIN));
1969
+ var _this$chainService26, _this$chainService26$, _this$chainService27, _this$chainService27$, _this$chainService27$2;
1970
+ const config = await ((_this$chainService26 = this.chainService) === null || _this$chainService26 === void 0 ? void 0 : (_this$chainService26$ = _this$chainService26.mantaPay) === null || _this$chainService26$ === void 0 ? void 0 : _this$chainService26$.getMantaPayFirstConfig(_DEFAULT_MANTA_ZK_CHAIN));
1968
1971
  if (!config.isInitialSync) {
1969
1972
  return;
1970
1973
  }
1971
- if ((_this$chainService29 = this.chainService) !== null && _this$chainService29 !== void 0 && (_this$chainService29$ = _this$chainService29.mantaPay) !== null && _this$chainService29$ !== void 0 && (_this$chainService29$2 = _this$chainService29$.privateWallet) !== null && _this$chainService29$2 !== void 0 && _this$chainService29$2.initialSyncIsFinished) {
1972
- var _this$chainService30, _this$chainService30$, _this$chainService30$2;
1973
- await ((_this$chainService30 = this.chainService) === null || _this$chainService30 === void 0 ? void 0 : (_this$chainService30$ = _this$chainService30.mantaPay) === null || _this$chainService30$ === void 0 ? void 0 : (_this$chainService30$2 = _this$chainService30$.privateWallet) === null || _this$chainService30$2 === void 0 ? void 0 : _this$chainService30$2.walletSync());
1974
+ if ((_this$chainService27 = this.chainService) !== null && _this$chainService27 !== void 0 && (_this$chainService27$ = _this$chainService27.mantaPay) !== null && _this$chainService27$ !== void 0 && (_this$chainService27$2 = _this$chainService27$.privateWallet) !== null && _this$chainService27$2 !== void 0 && _this$chainService27$2.initialSyncIsFinished) {
1975
+ var _this$chainService28, _this$chainService28$, _this$chainService28$2;
1976
+ await ((_this$chainService28 = this.chainService) === null || _this$chainService28 === void 0 ? void 0 : (_this$chainService28$ = _this$chainService28.mantaPay) === null || _this$chainService28$ === void 0 ? void 0 : (_this$chainService28$2 = _this$chainService28$.privateWallet) === null || _this$chainService28$2 === void 0 ? void 0 : _this$chainService28$2.walletSync());
1974
1977
  } else {
1975
- var _this$chainService31, _this$chainService31$, _this$chainService31$2;
1976
- await ((_this$chainService31 = this.chainService) === null || _this$chainService31 === void 0 ? void 0 : (_this$chainService31$ = _this$chainService31.mantaPay) === null || _this$chainService31$ === void 0 ? void 0 : (_this$chainService31$2 = _this$chainService31$.privateWallet) === null || _this$chainService31$2 === void 0 ? void 0 : _this$chainService31$2.initialWalletSync());
1978
+ var _this$chainService29, _this$chainService29$, _this$chainService29$2;
1979
+ await ((_this$chainService29 = this.chainService) === null || _this$chainService29 === void 0 ? void 0 : (_this$chainService29$ = _this$chainService29.mantaPay) === null || _this$chainService29$ === void 0 ? void 0 : (_this$chainService29$2 = _this$chainService29$.privateWallet) === null || _this$chainService29$2 === void 0 ? void 0 : _this$chainService29$2.initialWalletSync());
1977
1980
  }
1978
1981
  }
1979
1982
  async getMantaPayZkBalance(address, tokenInfo) {
1980
- var _this$chainService32, _this$chainService32$, _this$chainService32$2;
1983
+ var _this$chainService30, _this$chainService30$, _this$chainService30$2;
1981
1984
  const bnAssetId = new BN(_getTokenOnChainAssetId(tokenInfo));
1982
- const balance = await ((_this$chainService32 = this.chainService) === null || _this$chainService32 === void 0 ? void 0 : (_this$chainService32$ = _this$chainService32.mantaPay) === null || _this$chainService32$ === void 0 ? void 0 : (_this$chainService32$2 = _this$chainService32$.privateWallet) === null || _this$chainService32$2 === void 0 ? void 0 : _this$chainService32$2.getZkBalance(bnAssetId));
1985
+ const balance = await ((_this$chainService30 = this.chainService) === null || _this$chainService30 === void 0 ? void 0 : (_this$chainService30$ = _this$chainService30.mantaPay) === null || _this$chainService30$ === void 0 ? void 0 : (_this$chainService30$2 = _this$chainService30$.privateWallet) === null || _this$chainService30$2 === void 0 ? void 0 : _this$chainService30$2.getZkBalance(bnAssetId));
1983
1986
  return {
1984
1987
  decimals: tokenInfo.decimals || 0,
1985
1988
  symbol: tokenInfo.symbol,
@@ -1987,11 +1990,11 @@ export default class KoniState {
1987
1990
  };
1988
1991
  }
1989
1992
  subscribeMantaPaySyncState() {
1990
- var _this$chainService33, _this$chainService34, _this$chainService34$;
1991
- if (!((_this$chainService33 = this.chainService) !== null && _this$chainService33 !== void 0 && _this$chainService33.mantaPay)) {
1993
+ var _this$chainService31, _this$chainService32, _this$chainService32$;
1994
+ if (!((_this$chainService31 = this.chainService) !== null && _this$chainService31 !== void 0 && _this$chainService31.mantaPay)) {
1992
1995
  return new Subject();
1993
1996
  }
1994
- return (_this$chainService34 = this.chainService) === null || _this$chainService34 === void 0 ? void 0 : (_this$chainService34$ = _this$chainService34.mantaPay) === null || _this$chainService34$ === void 0 ? void 0 : _this$chainService34$.subscribeSyncState();
1997
+ return (_this$chainService32 = this.chainService) === null || _this$chainService32 === void 0 ? void 0 : (_this$chainService32$ = _this$chainService32.mantaPay) === null || _this$chainService32$ === void 0 ? void 0 : _this$chainService32$.subscribeSyncState();
1995
1998
  }
1996
1999
 
1997
2000
  /* Metadata */
@@ -19,7 +19,7 @@ import { _generateCustomProviderKey } from '@subwallet/extension-base/services/c
19
19
  import { hasSufficientCardanoValue } from '@subwallet/extension-base/services/request-service/helper';
20
20
  import { DEFAULT_CHAIN_PATROL_ENABLE } from '@subwallet/extension-base/services/setting-service/constants';
21
21
  import { convertCardanoAddressToHex, getEVMChainInfo, reformatAddress, stripUrl } from '@subwallet/extension-base/utils';
22
- import { BitcoinKeypairTypes, CardanoKeypairTypes, EthereumKeypairTypes, SubstrateKeypairTypes, TonKeypairTypes } from '@subwallet/keyring/types';
22
+ import { AllSubstrateKeypairTypes, BitcoinKeypairTypes, CardanoKeypairTypes, EthereumKeypairTypes, TonKeypairTypes } from '@subwallet/keyring/types';
23
23
  import { getBitcoinAddressInfo } from '@subwallet/keyring/utils';
24
24
  import { keyring } from '@subwallet/ui-keyring';
25
25
  import Web3 from 'web3';
@@ -38,7 +38,7 @@ function transformAccountsV2(accounts, anyType = false, authInfo, accountAuthTyp
38
38
  }
39
39
  const validTypes = {
40
40
  evm: EthereumKeypairTypes,
41
- substrate: SubstrateKeypairTypes,
41
+ substrate: AllSubstrateKeypairTypes,
42
42
  ton: TonKeypairTypes,
43
43
  cardano: CardanoKeypairTypes,
44
44
  bitcoin: BitcoinKeypairTypes
@@ -66,7 +66,7 @@ function transformAccountsV2(accounts, anyType = false, authInfo, accountAuthTyp
66
66
  return true;
67
67
  }
68
68
  };
69
- return Object.values(accounts).filter(({
69
+ const injectedAccounts = Object.values(accounts).filter(({
70
70
  json: {
71
71
  meta: {
72
72
  isHidden
@@ -91,6 +91,12 @@ function transformAccountsV2(accounts, anyType = false, authInfo, accountAuthTyp
91
91
  name,
92
92
  type
93
93
  }));
94
+ return injectedAccounts.map(acc => {
95
+ if (acc.type === 'ed25519-tw') {
96
+ acc.type = 'ed25519';
97
+ }
98
+ return acc;
99
+ });
94
100
  }
95
101
  // check if a URL is blocked
96
102
  export const chainPatrolCheckUrl = async url => {
package/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "./cjs/detectPackage.js"
18
18
  ],
19
19
  "type": "module",
20
- "version": "1.3.70-2",
20
+ "version": "1.3.71-0",
21
21
  "main": "./cjs/index.js",
22
22
  "module": "./index.js",
23
23
  "types": "./index.d.ts",
@@ -2944,21 +2944,21 @@
2944
2944
  "@substrate/connect": "^0.8.9",
2945
2945
  "@subwallet-monorepos/subwallet-services-sdk": "0.1.14",
2946
2946
  "@subwallet/chain-list": "0.2.122",
2947
- "@subwallet/extension-base": "^1.3.70-2",
2948
- "@subwallet/extension-chains": "^1.3.70-2",
2949
- "@subwallet/extension-dapp": "^1.3.70-2",
2950
- "@subwallet/extension-inject": "^1.3.70-2",
2951
- "@subwallet/keyring": "^0.1.13",
2952
- "@subwallet/ui-keyring": "^0.1.13",
2947
+ "@subwallet/extension-base": "^1.3.71-0",
2948
+ "@subwallet/extension-chains": "^1.3.71-0",
2949
+ "@subwallet/extension-dapp": "^1.3.71-0",
2950
+ "@subwallet/extension-inject": "^1.3.71-0",
2951
+ "@subwallet/keyring": "^0.1.14",
2952
+ "@subwallet/ui-keyring": "^0.1.14",
2953
2953
  "@ton/core": "^0.56.3",
2954
2954
  "@ton/crypto": "^3.2.0",
2955
2955
  "@ton/ton": "^15.0.0",
2956
2956
  "@walletconnect/keyvaluestorage": "^1.1.1",
2957
- "@walletconnect/sign-client": "2.21.5",
2958
- "@walletconnect/types": "2.21.5",
2959
- "@walletconnect/utils": "2.21.5",
2957
+ "@walletconnect/sign-client": "^2.23.0",
2958
+ "@walletconnect/types": "2.23.0",
2959
+ "@walletconnect/utils": "2.23.0",
2960
2960
  "avail-js-sdk": "^0.2.12",
2961
- "axios": "^1.6.2",
2961
+ "axios": "^1.13.2",
2962
2962
  "bignumber.js": "^9.1.1",
2963
2963
  "bitcoinjs-lib": "6.1.5",
2964
2964
  "bn.js": "^5.2.1",
@@ -2968,7 +2968,6 @@
2968
2968
  "cross-fetch": "^4.1.0",
2969
2969
  "dexie": "^3.2.2",
2970
2970
  "dexie-export-import": "^4.0.7",
2971
- "eth-simple-keyring": "^4.2.0",
2972
2971
  "ethereumjs-util": "^7.1.5",
2973
2972
  "ethers": "^6.4.2",
2974
2973
  "eventemitter3": "^5.0.0",
@@ -2979,19 +2978,19 @@
2979
2978
  "json-rpc-engine": "^6.1.0",
2980
2979
  "manta-extension-sdk": "^1.1.0",
2981
2980
  "moment": "^2.29.4",
2982
- "protobufjs": "^7.2.4",
2981
+ "protobufjs": "^7.5.4",
2983
2982
  "rxjs": "^7.8.1",
2984
2983
  "sails-js": "^0.4.2",
2985
2984
  "sails-js-parser": "^0.4.2",
2986
2985
  "ts-md5": "^1.3.1",
2987
2986
  "tweetnacl": "^1.0.3",
2988
2987
  "uuid": "^9.0.0",
2989
- "web3": "^1.10.0",
2990
- "web3-core": "^1.10.0",
2991
- "web3-core-helpers": "^1.10.0",
2992
- "web3-core-subscriptions": "1.10.0",
2993
- "web3-eth": "1.10.0",
2994
- "web3-eth-contract": "^1.10.0",
2995
- "web3-utils": "^1.10.0"
2988
+ "web3": "^1.10.4",
2989
+ "web3-core": "^1.10.4",
2990
+ "web3-core-helpers": "^1.10.4",
2991
+ "web3-core-subscriptions": "1.10.4",
2992
+ "web3-eth": "1.10.4",
2993
+ "web3-eth-contract": "1.10.4",
2994
+ "web3-utils": "1.10.4"
2996
2995
  }
2997
2996
  }
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.70-2'
10
+ version: '1.3.71-0'
11
11
  };