@subwallet/extension-base 1.3.69-0 → 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 (208) hide show
  1. package/background/KoniTypes.d.ts +11 -0
  2. package/background/KoniTypes.js +68 -8
  3. package/cjs/background/KoniTypes.js +68 -8
  4. package/cjs/constants/blocked-actions.js +3 -0
  5. package/cjs/core/logic-validation/swap.js +0 -3
  6. package/cjs/core/substrate/system-pallet.js +0 -2
  7. package/cjs/koni/api/nft/wasm_nft/index.js +0 -1
  8. package/cjs/koni/api/staking/bonding/astar.js +0 -2
  9. package/cjs/koni/api/staking/bonding/paraChain.js +0 -3
  10. package/cjs/koni/api/staking/bonding/relayChain.js +2 -4
  11. package/cjs/koni/api/staking/bonding/utils.js +0 -4
  12. package/cjs/koni/background/cron.js +0 -1
  13. package/cjs/koni/background/handlers/Extension.js +216 -158
  14. package/cjs/koni/background/handlers/State.js +59 -54
  15. package/cjs/koni/background/handlers/Tabs.js +39 -34
  16. package/cjs/packageInfo.js +1 -1
  17. package/cjs/page/index.js +7 -0
  18. package/cjs/page/substrate/PostMessageProvider.js +3 -0
  19. package/cjs/services/balance-service/helpers/subscribe/cardano/utils.js +0 -1
  20. package/cjs/services/balance-service/helpers/subscribe/substrate/gear.js +0 -2
  21. package/cjs/services/balance-service/helpers/subscribe/substrate/index.js +2 -3
  22. package/cjs/services/balance-service/helpers/subscribe/ton/utils.js +0 -3
  23. package/cjs/services/balance-service/index.js +103 -7
  24. package/cjs/services/balance-service/transfer/bitcoin-transfer.js +0 -1
  25. package/cjs/services/balance-service/transfer/cardano-transfer.js +1 -2
  26. package/cjs/services/balance-service/transfer/smart-contract.js +0 -1
  27. package/cjs/services/balance-service/transfer/token.js +0 -2
  28. package/cjs/services/balance-service/transfer/ton-transfer.js +0 -1
  29. package/cjs/services/balance-service/transfer/xcm/snowBridge.js +0 -1
  30. package/cjs/services/chain-service/constants.js +15 -4
  31. package/cjs/services/chain-service/handler/CardanoApi.js +3 -1
  32. package/cjs/services/chain-service/handler/SubstrateApi.js +0 -2
  33. package/cjs/services/chain-service/handler/light-client/index.js +1 -2
  34. package/cjs/services/chain-service/health-check/index.js +0 -1
  35. package/cjs/services/chain-service/health-check/utils/new-utils/chain-asset-validate.js +0 -1
  36. package/cjs/services/chain-service/index.js +18 -26
  37. package/cjs/services/chain-service/utils/index.js +34 -30
  38. package/cjs/services/earning-service/handlers/base.js +32 -0
  39. package/cjs/services/earning-service/handlers/lending/base.js +0 -2
  40. package/cjs/services/earning-service/handlers/liquid-staking/acala.js +0 -1
  41. package/cjs/services/earning-service/handlers/liquid-staking/base.js +0 -2
  42. package/cjs/services/earning-service/handlers/liquid-staking/bifrost.js +0 -2
  43. package/cjs/services/earning-service/handlers/liquid-staking/parallel.js +0 -1
  44. package/cjs/services/earning-service/handlers/native-staking/astar.js +0 -2
  45. package/cjs/services/earning-service/handlers/native-staking/dtao.js +43 -2
  46. package/cjs/services/earning-service/handlers/native-staking/energy.js +0 -1
  47. package/cjs/services/earning-service/handlers/native-staking/mythos.js +0 -2
  48. package/cjs/services/earning-service/handlers/native-staking/para-chain.js +0 -2
  49. package/cjs/services/earning-service/handlers/native-staking/relay-chain.js +8 -9
  50. package/cjs/services/earning-service/handlers/special.js +7 -0
  51. package/cjs/services/event-service/index.js +1 -0
  52. package/cjs/services/history-service/subsquid-multi-chain-history.js +0 -1
  53. package/cjs/services/keyring-service/context/handlers/Derive.js +1 -1
  54. package/cjs/services/keyring-service/context/handlers/Migration.js +11 -9
  55. package/cjs/services/keyring-service/context/handlers/Mnemonic.js +18 -13
  56. package/cjs/services/keyring-service/context/state.js +21 -3
  57. package/cjs/services/keyring-service/utils.js +12 -2
  58. package/cjs/services/migration-service/index.js +1 -2
  59. package/cjs/services/mint-campaign-service/campaigns/UnlockDotCampaign.js +0 -1
  60. package/cjs/services/nft-service/index.js +5 -0
  61. package/cjs/services/open-gov/handler.js +561 -0
  62. package/cjs/services/open-gov/index.js +273 -0
  63. package/cjs/services/open-gov/interface.js +31 -0
  64. package/cjs/services/open-gov/utils.js +66 -0
  65. package/cjs/services/request-service/handler/BitcoinRequestHandler.js +1 -2
  66. package/cjs/services/request-service/handler/CardanoRequestHandler.js +0 -1
  67. package/cjs/services/request-service/handler/EvmRequestHandler.js +0 -1
  68. package/cjs/services/request-service/handler/TonRequestHandler.js +0 -1
  69. package/cjs/services/request-service/helper/index.js +1 -2
  70. package/cjs/services/storage-service/DatabaseService.js +19 -3
  71. package/cjs/services/storage-service/databases/index.js +5 -0
  72. package/cjs/services/storage-service/db-stores/GovLockedInfoStore.js +35 -0
  73. package/cjs/services/swap-service/handler/asset-hub/handler.js +0 -1
  74. package/cjs/services/swap-service/handler/asset-hub/router.js +0 -1
  75. package/cjs/services/swap-service/handler/chainflip-handler.js +1 -4
  76. package/cjs/services/swap-service/handler/hydradx-handler.js +0 -1
  77. package/cjs/services/swap-service/handler/kyber-handler.js +0 -1
  78. package/cjs/services/swap-service/handler/optimex-handler.js +1 -2
  79. package/cjs/services/swap-service/handler/simpleswap-handler.js +1 -3
  80. package/cjs/services/swap-service/handler/uniswap-handler.js +0 -3
  81. package/cjs/services/transaction-service/event-parser/index.js +6 -6
  82. package/cjs/services/transaction-service/helpers/index.js +6 -0
  83. package/cjs/services/transaction-service/index.js +71 -28
  84. package/cjs/services/wallet-connect-service/index.js +21 -18
  85. package/cjs/services/wallet-connect-service/types.js +1 -1
  86. package/cjs/types/account/info/keyring.js +9 -1
  87. package/cjs/types/balance/index.js +5 -1
  88. package/cjs/types/swap/index.js +2 -1
  89. package/cjs/types/transaction/process.js +2 -0
  90. package/cjs/types/yield/actions/join/step.js +17 -1
  91. package/cjs/utils/account/common.js +0 -26
  92. package/cjs/utils/account/derive/info/solo.js +7 -4
  93. package/cjs/utils/account/derive/validate.js +1 -1
  94. package/cjs/utils/account/transform.js +10 -5
  95. package/cjs/utils/auth.js +1 -1
  96. package/cjs/utils/bitcoin/utxo-management.js +0 -1
  97. package/cjs/utils/environment.js +2 -1
  98. package/cjs/utils/fee/transfer.js +1 -2
  99. package/cjs/utils/index.js +1 -2
  100. package/constants/blocked-actions.js +3 -0
  101. package/core/logic-validation/swap.js +0 -3
  102. package/core/substrate/system-pallet.js +0 -2
  103. package/koni/api/nft/wasm_nft/index.js +0 -1
  104. package/koni/api/staking/bonding/astar.js +0 -2
  105. package/koni/api/staking/bonding/paraChain.js +0 -3
  106. package/koni/api/staking/bonding/relayChain.js +2 -4
  107. package/koni/api/staking/bonding/utils.js +0 -4
  108. package/koni/background/cron.js +0 -1
  109. package/koni/background/handlers/Extension.d.ts +4 -0
  110. package/koni/background/handlers/Extension.js +70 -11
  111. package/koni/background/handlers/State.d.ts +2 -0
  112. package/koni/background/handlers/State.js +46 -40
  113. package/koni/background/handlers/Tabs.js +9 -3
  114. package/package.json +44 -20
  115. package/packageInfo.js +1 -1
  116. package/page/substrate/PostMessageProvider.js +3 -0
  117. package/services/balance-service/helpers/subscribe/cardano/utils.js +0 -1
  118. package/services/balance-service/helpers/subscribe/substrate/gear.js +0 -2
  119. package/services/balance-service/helpers/subscribe/substrate/index.js +0 -1
  120. package/services/balance-service/helpers/subscribe/ton/utils.js +0 -3
  121. package/services/balance-service/index.d.ts +8 -0
  122. package/services/balance-service/index.js +105 -9
  123. package/services/balance-service/transfer/bitcoin-transfer.js +0 -1
  124. package/services/balance-service/transfer/smart-contract.js +0 -1
  125. package/services/balance-service/transfer/token.js +0 -2
  126. package/services/balance-service/transfer/ton-transfer.js +0 -1
  127. package/services/balance-service/transfer/xcm/snowBridge.js +0 -1
  128. package/services/chain-service/constants.d.ts +8 -0
  129. package/services/chain-service/constants.js +12 -2
  130. package/services/chain-service/handler/CardanoApi.js +3 -1
  131. package/services/chain-service/handler/SubstrateApi.js +0 -2
  132. package/services/chain-service/health-check/index.js +0 -1
  133. package/services/chain-service/health-check/utils/new-utils/chain-asset-validate.js +0 -1
  134. package/services/chain-service/index.d.ts +0 -1
  135. package/services/chain-service/index.js +15 -23
  136. package/services/chain-service/utils/index.js +35 -31
  137. package/services/earning-service/handlers/base.js +32 -0
  138. package/services/earning-service/handlers/lending/base.js +0 -2
  139. package/services/earning-service/handlers/liquid-staking/acala.js +0 -1
  140. package/services/earning-service/handlers/liquid-staking/base.js +0 -2
  141. package/services/earning-service/handlers/liquid-staking/bifrost.js +0 -2
  142. package/services/earning-service/handlers/liquid-staking/parallel.js +0 -1
  143. package/services/earning-service/handlers/native-staking/astar.js +0 -2
  144. package/services/earning-service/handlers/native-staking/dtao.js +43 -0
  145. package/services/earning-service/handlers/native-staking/energy.js +0 -1
  146. package/services/earning-service/handlers/native-staking/mythos.js +0 -2
  147. package/services/earning-service/handlers/native-staking/para-chain.js +0 -2
  148. package/services/earning-service/handlers/native-staking/relay-chain.js +8 -9
  149. package/services/earning-service/handlers/special.js +7 -0
  150. package/services/event-service/index.d.ts +1 -0
  151. package/services/event-service/index.js +1 -0
  152. package/services/event-service/types.d.ts +1 -0
  153. package/services/history-service/subsquid-multi-chain-history.js +0 -1
  154. package/services/keyring-service/context/handlers/Derive.js +2 -2
  155. package/services/keyring-service/context/handlers/Migration.js +3 -1
  156. package/services/keyring-service/context/handlers/Mnemonic.d.ts +1 -1
  157. package/services/keyring-service/context/handlers/Mnemonic.js +16 -10
  158. package/services/keyring-service/context/state.d.ts +3 -0
  159. package/services/keyring-service/context/state.js +21 -3
  160. package/services/keyring-service/utils.d.ts +1 -0
  161. package/services/keyring-service/utils.js +9 -0
  162. package/services/mint-campaign-service/campaigns/UnlockDotCampaign.js +0 -1
  163. package/services/nft-service/index.js +6 -0
  164. package/services/open-gov/handler.d.ts +27 -0
  165. package/services/open-gov/handler.js +545 -0
  166. package/services/open-gov/index.d.ts +45 -0
  167. package/services/open-gov/index.js +265 -0
  168. package/services/open-gov/interface.d.ts +141 -0
  169. package/services/open-gov/interface.js +24 -0
  170. package/services/open-gov/utils.d.ts +14 -0
  171. package/services/open-gov/utils.js +52 -0
  172. package/services/request-service/handler/CardanoRequestHandler.js +0 -1
  173. package/services/request-service/handler/EvmRequestHandler.js +0 -1
  174. package/services/request-service/handler/TonRequestHandler.js +0 -1
  175. package/services/setting-service/constants.js +0 -1
  176. package/services/storage-service/DatabaseService.d.ts +7 -0
  177. package/services/storage-service/DatabaseService.js +19 -3
  178. package/services/storage-service/databases/index.d.ts +2 -0
  179. package/services/storage-service/databases/index.js +6 -0
  180. package/services/storage-service/db-stores/GovLockedInfoStore.d.ts +10 -0
  181. package/services/storage-service/db-stores/GovLockedInfoStore.js +27 -0
  182. package/services/swap-service/handler/asset-hub/handler.js +0 -1
  183. package/services/swap-service/handler/asset-hub/router.js +0 -1
  184. package/services/swap-service/handler/chainflip-handler.js +0 -2
  185. package/services/swap-service/handler/hydradx-handler.js +0 -1
  186. package/services/swap-service/handler/kyber-handler.js +0 -1
  187. package/services/swap-service/handler/simpleswap-handler.js +0 -1
  188. package/services/swap-service/handler/uniswap-handler.js +0 -3
  189. package/services/transaction-service/event-parser/index.js +6 -6
  190. package/services/transaction-service/helpers/index.js +6 -0
  191. package/services/transaction-service/index.js +43 -0
  192. package/services/wallet-connect-service/index.js +21 -18
  193. package/services/wallet-connect-service/types.js +1 -1
  194. package/types/account/action/add/mnemonic.d.ts +3 -2
  195. package/types/account/info/keyring.js +9 -1
  196. package/types/balance/index.js +5 -1
  197. package/types/swap/index.js +2 -1
  198. package/types/transaction/process.js +3 -1
  199. package/types/yield/actions/join/step.js +17 -1
  200. package/utils/account/common.d.ts +0 -3
  201. package/utils/account/common.js +0 -24
  202. package/utils/account/derive/info/solo.js +8 -5
  203. package/utils/account/derive/validate.d.ts +2 -2
  204. package/utils/account/derive/validate.js +1 -1
  205. package/utils/account/transform.js +10 -5
  206. package/utils/auth.js +2 -2
  207. package/utils/bitcoin/utxo-management.js +0 -1
  208. package/utils/index.js +2 -5
@@ -141,6 +141,14 @@ class BasePoolHandler {
141
141
 
142
142
  /** Subscribe pool info */
143
143
 
144
+ /** Subscribe pool position */
145
+
146
+ /** Get pool reward */
147
+
148
+ /** Get pool reward history */
149
+
150
+ /** Get pool target */
151
+
144
152
  /* Subscribe data */
145
153
 
146
154
  /* Join action */
@@ -276,6 +284,24 @@ class BasePoolHandler {
276
284
 
277
285
  /** Validate param to join the pool */
278
286
 
287
+ /* Validate */
288
+
289
+ /* Submit */
290
+
291
+ /** Create `transaction` to join the pool step-by-step */
292
+
293
+ /* Submit */
294
+
295
+ /* Join action */
296
+
297
+ /* Leave action */
298
+
299
+ /** Validate param to leave the pool */
300
+
301
+ /** Create `transaction` to leave the pool normal (default unstake) */
302
+
303
+ /** Create `transaction` to leave the pool fast (swap token) */
304
+
279
305
  /** Create `transaction` to leave the pool */
280
306
  async handleYieldLeave(fastLeave, amount, address, selectedTarget, netuid, slippage) {
281
307
  if (fastLeave) {
@@ -291,6 +317,12 @@ class BasePoolHandler {
291
317
 
292
318
  /** Create `transaction` to withdraw unstaked amount */
293
319
 
320
+ /** Create `transaction` to cancel unstake */
321
+
322
+ /** Create `transaction` to claim reward */
323
+
324
+ /** Change earning validator */
325
+
294
326
  /** Check handler can handle slug */
295
327
  canHandleSlug(slug) {
296
328
  return this.slug === slug;
@@ -59,7 +59,6 @@ class BaseLendingPoolHandler extends _special.default {
59
59
  if (!(bnRemainingStake.isZero() || bnRemainingStake.gte(minStake))) {
60
60
  errors.push(new _TransactionError.TransactionError(_types.StakingTxErrorType.INVALID_ACTIVE_STAKE)); // TODO
61
61
  }
62
-
63
62
  if (poolPosition.unstakings.length > maxUnstakeRequest) {
64
63
  errors.push(new _TransactionError.TransactionError(_types.StakingTxErrorType.EXCEED_MAX_UNSTAKING, (0, _i18next.t)('bg.EARNING.services.service.earning.lending.maxUnstakeTimes', {
65
64
  replace: {
@@ -71,7 +70,6 @@ class BaseLendingPoolHandler extends _special.default {
71
70
  if (bnRemainingStake.lt(0)) {
72
71
  errors.push(new _TransactionError.TransactionError(_types.StakingTxErrorType.INVALID_ACTIVE_STAKE)); // TODO
73
72
  }
74
-
75
73
  return Promise.resolve(errors);
76
74
  }
77
75
 
@@ -257,7 +257,6 @@ class AcalaLiquidStakingPoolHandler extends _base.default {
257
257
  // Min target amount
258
258
  weightedMinAmount // should always set a min target to prevent unexpected result
259
259
  );
260
-
261
260
  return [_KoniTypes.ExtrinsicType.REDEEM_LDOT, extrinsic];
262
261
  }
263
262
  async handleYieldUnstake(amount, address, selectedTarget) {
@@ -76,7 +76,6 @@ class BaseLiquidStakingPoolHandler extends _special.default {
76
76
  if (!(bnRemainingStake.isZero() || bnRemainingStake.gte(minStake))) {
77
77
  errors.push(new _TransactionError.TransactionError(_types.StakingTxErrorType.INVALID_ACTIVE_STAKE)); // TODO
78
78
  }
79
-
80
79
  if (poolPosition.unstakings.length > maxUnstakeRequest) {
81
80
  errors.push(new _TransactionError.TransactionError(_types.StakingTxErrorType.EXCEED_MAX_UNSTAKING, (0, _i18next.t)('bg.EARNING.services.service.earning.liquidStaking.maxUnstakeTimes', {
82
81
  replace: {
@@ -88,7 +87,6 @@ class BaseLiquidStakingPoolHandler extends _special.default {
88
87
  if (bnRemainingStake.lt(_util.BN_ZERO)) {
89
88
  errors.push(new _TransactionError.TransactionError(_types.StakingTxErrorType.INVALID_ACTIVE_STAKE)); // TODO
90
89
  }
91
-
92
90
  return Promise.resolve(errors);
93
91
  }
94
92
 
@@ -161,7 +161,6 @@ class BifrostLiquidStakingPoolHandler extends _base.default {
161
161
 
162
162
  // const bnTotalBalance = bnActiveBalance.add(bnUnstakingBalance);
163
163
  }
164
-
165
164
  const unlockingMap = {};
166
165
 
167
166
  // TODO: review unstaking info vtokenMinting.userUnlockLedger
@@ -213,7 +212,6 @@ class BifrostLiquidStakingPoolHandler extends _base.default {
213
212
  });
214
213
  });
215
214
  }
216
-
217
215
  const activeToTotalBalance = exchangeRate.multipliedBy(bnActiveBalance.toString());
218
216
  const totalBalance = activeToTotalBalance.plus(unlockBalance.toString());
219
217
  const result = {
@@ -138,7 +138,6 @@ class ParallelLiquidStakingPoolHandler extends _base.default {
138
138
  });
139
139
  }
140
140
  }
141
-
142
141
  const result = {
143
142
  ...this.baseInfo,
144
143
  type: this.type,
@@ -200,7 +200,6 @@ class AstarNativeStakingPoolHandler extends _basePara.default {
200
200
  }
201
201
  }
202
202
  }
203
-
204
203
  const unlockingChunks = ledger.unbondingInfo.unlockingChunks;
205
204
  if (unlockingChunks.length > 0) {
206
205
  for (const unlockingChunk of unlockingChunks) {
@@ -219,7 +218,6 @@ class AstarNativeStakingPoolHandler extends _basePara.default {
219
218
  });
220
219
  }
221
220
  }
222
-
223
221
  if (nominationList.length === 0 && unstakingList.length === 0) {
224
222
  return {
225
223
  balanceToken: this.nativeToken.slug,
@@ -12,11 +12,52 @@ var _utils = require("@subwallet/extension-base/utils");
12
12
  var _bignumber = _interopRequireDefault(require("bignumber.js"));
13
13
  var _util = require("@polkadot/util");
14
14
  var _tao = _interopRequireWildcard(require("./tao"));
15
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
16
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
15
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
17
16
  // Copyright 2019-2022 @subwallet/extension-base
18
17
  // SPDX-License-Identifier: Apache-2.0
19
18
 
19
+ // interface ApiResponse {
20
+ // data: SubnetData[];
21
+ // }
22
+
23
+ // interface PoolData {
24
+ // netuid: number;
25
+ // name: string;
26
+ // symbol: string;
27
+ // }
28
+
29
+ // interface PoolApiResponse {
30
+ // data: PoolData[];
31
+ // }
32
+
33
+ // const SUBNET_API_URL = 'https://dash.taostats.io/api/subnet';
34
+ // const POOL_API_URL = 'https://dash.taostats.io/api/dtao/pool';
35
+
36
+ // export async function fetchSubnetData () {
37
+ // try {
38
+ // const [subnetResponse, poolResponse] = await Promise.all([
39
+ // fetch(SUBNET_API_URL).then((res) => res.json()) as Promise<ApiResponse>,
40
+ // fetch(POOL_API_URL).then((res) => res.json()) as Promise<PoolApiResponse>
41
+ // ]);
42
+
43
+ // const poolMap = new Map(poolResponse.data.map((pool) => [pool.netuid, pool]));
44
+
45
+ // const filteredSubnets = subnetResponse.data.filter((subnet) => subnet.netuid !== 0);
46
+
47
+ // const mergedData = filteredSubnets.map((subnet) => ({
48
+ // ...subnet,
49
+ // name: poolMap.get(subnet.netuid)?.name || 'Unknown',
50
+ // symbol: poolMap.get(subnet.netuid)?.symbol || 'Unknown'
51
+ // }));
52
+
53
+ // return mergedData;
54
+ // } catch (err) {
55
+ // console.error('Error:', err);
56
+
57
+ // return [];
58
+ // }
59
+ // }
60
+
20
61
  const getAlphaToTaoMapping = async substrateApi => {
21
62
  const allSubnets = (await substrateApi.api.call.subnetInfoRuntimeApi.getAllDynamicInfo()).toJSON();
22
63
  if (!allSubnets || allSubnets.length === 0) {
@@ -158,7 +158,6 @@ class EnergyNativeStakingPoolHandler extends _basePara.default {
158
158
  }
159
159
  }
160
160
  }
161
-
162
161
  const bnStake = new _util.BN(nomination.amount);
163
162
  const bnUnstakeBalance = unstakingMap[nomination.owner] ? new _util.BN(unstakingMap[nomination.owner].claimable) : _util.BN_ZERO;
164
163
  const bnActiveStake = bnStake.sub(bnUnstakeBalance);
@@ -112,7 +112,6 @@ class MythosNativeStakingPoolHandler extends _basePara.default {
112
112
  // tvl: totalStake.toString(),
113
113
  // inflation
114
114
  },
115
-
116
115
  maxPoolMembers: parseInt(maxStakers)
117
116
  };
118
117
  callback(data);
@@ -347,7 +346,6 @@ class MythosNativeStakingPoolHandler extends _basePara.default {
347
346
  }
348
347
  extrinsicList.push(...[substrateApi.api.tx.collatorStaking.unstakeFrom(selectedTarget), substrateApi.api.tx.collatorStaking.unlock(null) // ignore amount to unlock all
349
348
  ]);
350
-
351
349
  return [_KoniTypes.ExtrinsicType.STAKING_UNBOND, substrateApi.api.tx.utility.batchAll(extrinsicList)];
352
350
  }
353
351
 
@@ -88,7 +88,6 @@ class ParaNativeStakingPoolHandler extends _basePara.default {
88
88
  if (unvestedAllocation) {
89
89
  totalIssuance.add(unvestedAllocation); // for Turing network, read more at https://hackmd.io/@sbAqOuXkRvyiZPOB3Ryn6Q/Sypr3ZJh5
90
90
  }
91
-
92
91
  const inflationConfig = _inflation.toHuman();
93
92
  const inflation = (0, _utils.getParaCurrentInflation)((0, _utils3.parseRawNumber)(totalStake.toString()), inflationConfig);
94
93
  const eraTime = _constants._STAKING_ERA_LENGTH_MAP[this.chain] || _constants._STAKING_ERA_LENGTH_MAP.default; // in hours
@@ -185,7 +184,6 @@ class ParaNativeStakingPoolHandler extends _basePara.default {
185
184
  }
186
185
  }
187
186
  }
188
-
189
187
  const bnStake = new _util.BN(delegation.amount);
190
188
  const bnUnstakeBalance = unstakingMap[delegation.owner] ? new _util.BN(unstakingMap[delegation.owner].claimable) : _util.BN_ZERO;
191
189
  const bnActiveStake = bnStake.sub(bnUnstakeBalance);
@@ -141,9 +141,9 @@ class RelayNativeStakingPoolHandler extends _base.default {
141
141
  /* Subscribe pool position */
142
142
 
143
143
  async parseNominatorMetadata(chainInfo, address, substrateApi, ledger, currentEra, minStake) {
144
- var _substrateApi$api$que7, _substrateApi$api$que8, _substrateApi$api$que9, _substrateApi$api$que10, _substrateApi$api$que11, _substrateApi$api$que12;
144
+ var _substrateApi$api$que7, _substrateApi$api$que8, _substrateApi$api$que9, _substrateApi$api$que0, _substrateApi$api$que1, _substrateApi$api$que10;
145
145
  const chain = chainInfo.slug;
146
- const [_nominations, _bonded, _activeEra] = await Promise.all([(_substrateApi$api$que7 = substrateApi.api.query) === null || _substrateApi$api$que7 === void 0 ? void 0 : (_substrateApi$api$que8 = _substrateApi$api$que7.staking) === null || _substrateApi$api$que8 === void 0 ? void 0 : _substrateApi$api$que8.nominators(address), (_substrateApi$api$que9 = substrateApi.api.query) === null || _substrateApi$api$que9 === void 0 ? void 0 : (_substrateApi$api$que10 = _substrateApi$api$que9.staking) === null || _substrateApi$api$que10 === void 0 ? void 0 : _substrateApi$api$que10.bonded(address), (_substrateApi$api$que11 = substrateApi.api.query) === null || _substrateApi$api$que11 === void 0 ? void 0 : (_substrateApi$api$que12 = _substrateApi$api$que11.staking) === null || _substrateApi$api$que12 === void 0 ? void 0 : _substrateApi$api$que12.activeEra()]);
146
+ const [_nominations, _bonded, _activeEra] = await Promise.all([(_substrateApi$api$que7 = substrateApi.api.query) === null || _substrateApi$api$que7 === void 0 ? void 0 : (_substrateApi$api$que8 = _substrateApi$api$que7.staking) === null || _substrateApi$api$que8 === void 0 ? void 0 : _substrateApi$api$que8.nominators(address), (_substrateApi$api$que9 = substrateApi.api.query) === null || _substrateApi$api$que9 === void 0 ? void 0 : (_substrateApi$api$que0 = _substrateApi$api$que9.staking) === null || _substrateApi$api$que0 === void 0 ? void 0 : _substrateApi$api$que0.bonded(address), (_substrateApi$api$que1 = substrateApi.api.query) === null || _substrateApi$api$que1 === void 0 ? void 0 : (_substrateApi$api$que10 = _substrateApi$api$que1.staking) === null || _substrateApi$api$que10 === void 0 ? void 0 : _substrateApi$api$que10.activeEra()]);
147
147
  const unlimitedNominatorRewarded = substrateApi.api.consts.staking.maxExposurePageSize !== undefined;
148
148
  const _maxNominatorRewardedPerValidator = (substrateApi.api.consts.staking.maxNominatorRewardedPerValidator || 0).toString();
149
149
  const maxNominatorRewardedPerValidator = unlimitedNominatorRewarded ? undefined : parseInt(_maxNominatorRewardedPerValidator);
@@ -243,23 +243,22 @@ class RelayNativeStakingPoolHandler extends _base.default {
243
243
  activeStake: '0' // relaychain allocates stake accordingly
244
244
  });
245
245
  }));
246
-
247
246
  return nominationList;
248
247
  }
249
248
  async subscribePoolPosition(useAddresses, resultCallback) {
250
- var _substrateApi$api$que13;
249
+ var _substrateApi$api$que11;
251
250
  let cancel = false;
252
251
  const substrateApi = await this.substrateApi.isReady;
253
252
  const defaultInfo = this.baseInfo;
254
253
  const chainInfo = this.chainInfo;
255
- const unsub = await ((_substrateApi$api$que13 = substrateApi.api.query.staking) === null || _substrateApi$api$que13 === void 0 ? void 0 : _substrateApi$api$que13.ledger.multi(useAddresses, async ledgers => {
254
+ const unsub = await ((_substrateApi$api$que11 = substrateApi.api.query.staking) === null || _substrateApi$api$que11 === void 0 ? void 0 : _substrateApi$api$que11.ledger.multi(useAddresses, async ledgers => {
256
255
  if (cancel) {
257
256
  unsub === null || unsub === void 0 ? void 0 : unsub();
258
257
  return;
259
258
  }
260
259
  if (ledgers) {
261
- var _substrateApi$api$que14, _substrateApi$api$que15, _substrateApi$api$que16, _substrateApi$api$que17, _substrateApi$api$que18, _substrateApi$api$que19, _substrateApi$api$que20, _substrateApi$api$que21, _substrateApi$api$der, _substrateApi$api$der2;
262
- const [_currentEra, _minimumActiveStake, _minNominatorBond] = await Promise.all([(_substrateApi$api$que14 = substrateApi.api.query) === null || _substrateApi$api$que14 === void 0 ? void 0 : (_substrateApi$api$que15 = _substrateApi$api$que14.staking) === null || _substrateApi$api$que15 === void 0 ? void 0 : _substrateApi$api$que15.currentEra(), ((_substrateApi$api$que16 = substrateApi.api.query) === null || _substrateApi$api$que16 === void 0 ? void 0 : (_substrateApi$api$que17 = _substrateApi$api$que16.staking) === null || _substrateApi$api$que17 === void 0 ? void 0 : _substrateApi$api$que17.minimumActiveStake) && ((_substrateApi$api$que18 = substrateApi.api.query) === null || _substrateApi$api$que18 === void 0 ? void 0 : (_substrateApi$api$que19 = _substrateApi$api$que18.staking) === null || _substrateApi$api$que19 === void 0 ? void 0 : _substrateApi$api$que19.minimumActiveStake()), (_substrateApi$api$que20 = substrateApi.api.query) === null || _substrateApi$api$que20 === void 0 ? void 0 : (_substrateApi$api$que21 = _substrateApi$api$que20.staking) === null || _substrateApi$api$que21 === void 0 ? void 0 : _substrateApi$api$que21.minNominatorBond(), (_substrateApi$api$der = substrateApi.api.derive) === null || _substrateApi$api$der === void 0 ? void 0 : (_substrateApi$api$der2 = _substrateApi$api$der.session) === null || _substrateApi$api$der2 === void 0 ? void 0 : _substrateApi$api$der2.progress()]);
260
+ var _substrateApi$api$que12, _substrateApi$api$que13, _substrateApi$api$que14, _substrateApi$api$que15, _substrateApi$api$que16, _substrateApi$api$que17, _substrateApi$api$que18, _substrateApi$api$que19, _substrateApi$api$der, _substrateApi$api$der2;
261
+ const [_currentEra, _minimumActiveStake, _minNominatorBond] = await Promise.all([(_substrateApi$api$que12 = substrateApi.api.query) === null || _substrateApi$api$que12 === void 0 ? void 0 : (_substrateApi$api$que13 = _substrateApi$api$que12.staking) === null || _substrateApi$api$que13 === void 0 ? void 0 : _substrateApi$api$que13.currentEra(), ((_substrateApi$api$que14 = substrateApi.api.query) === null || _substrateApi$api$que14 === void 0 ? void 0 : (_substrateApi$api$que15 = _substrateApi$api$que14.staking) === null || _substrateApi$api$que15 === void 0 ? void 0 : _substrateApi$api$que15.minimumActiveStake) && ((_substrateApi$api$que16 = substrateApi.api.query) === null || _substrateApi$api$que16 === void 0 ? void 0 : (_substrateApi$api$que17 = _substrateApi$api$que16.staking) === null || _substrateApi$api$que17 === void 0 ? void 0 : _substrateApi$api$que17.minimumActiveStake()), (_substrateApi$api$que18 = substrateApi.api.query) === null || _substrateApi$api$que18 === void 0 ? void 0 : (_substrateApi$api$que19 = _substrateApi$api$que18.staking) === null || _substrateApi$api$que19 === void 0 ? void 0 : _substrateApi$api$que19.minNominatorBond(), (_substrateApi$api$der = substrateApi.api.derive) === null || _substrateApi$api$der === void 0 ? void 0 : (_substrateApi$api$der2 = _substrateApi$api$der.session) === null || _substrateApi$api$der2 === void 0 ? void 0 : _substrateApi$api$der2.progress()]);
263
262
  const currentEra = _currentEra.toString();
264
263
  const minActiveStake = (_minimumActiveStake === null || _minimumActiveStake === void 0 ? void 0 : _minimumActiveStake.toString()) || '0';
265
264
  const minNominatorBond = _minNominatorBond.toString();
@@ -301,10 +300,10 @@ class RelayNativeStakingPoolHandler extends _base.default {
301
300
  };
302
301
  }
303
302
  async checkAccountHaveStake(useAddresses) {
304
- var _substrateApi$api$que22, _substrateApi$api$que23, _substrateApi$api$que24;
303
+ var _substrateApi$api$que20, _substrateApi$api$que21, _substrateApi$api$que22;
305
304
  const result = [];
306
305
  const substrateApi = await this.substrateApi.isReady;
307
- const ledgers = await ((_substrateApi$api$que22 = substrateApi.api.query.staking) === null || _substrateApi$api$que22 === void 0 ? void 0 : (_substrateApi$api$que23 = _substrateApi$api$que22.ledger) === null || _substrateApi$api$que23 === void 0 ? void 0 : (_substrateApi$api$que24 = _substrateApi$api$que23.multi) === null || _substrateApi$api$que24 === void 0 ? void 0 : _substrateApi$api$que24.call(_substrateApi$api$que23, useAddresses));
306
+ const ledgers = await ((_substrateApi$api$que20 = substrateApi.api.query.staking) === null || _substrateApi$api$que20 === void 0 ? void 0 : (_substrateApi$api$que21 = _substrateApi$api$que20.ledger) === null || _substrateApi$api$que21 === void 0 ? void 0 : (_substrateApi$api$que22 = _substrateApi$api$que21.multi) === null || _substrateApi$api$que22 === void 0 ? void 0 : _substrateApi$api$que22.call(_substrateApi$api$que21, useAddresses));
308
307
  if (ledgers) {
309
308
  for (let i = 0; i < useAddresses.length; i++) {
310
309
  const address = useAddresses[i];
@@ -281,6 +281,13 @@ class BaseSpecialStakingPoolHandler extends _base.default {
281
281
  * @return Fee of the submitting step
282
282
  * */
283
283
 
284
+ /**
285
+ * @async
286
+ * @function getSubmitStepFee
287
+ * @description Get submit step fee
288
+ * @return {Promise<YieldTokenBaseInfo>} Fee of the submitting step
289
+ * */
290
+
284
291
  async getSubmitStep(params) {
285
292
  const fee = await this.getSubmitStepFee(params);
286
293
  return [this.submitJoinStepInfo, fee];
@@ -40,6 +40,7 @@ class EventService extends _eventemitter.default {
40
40
  this.waitBuyServiceReady = this.generateWaitPromise('buy.services.ready');
41
41
  this.waitEarningReady = this.generateWaitPromise('earning.ready');
42
42
  this.waitLedgerReady = this.generateWaitPromise('ledger.ready');
43
+ this.waitOpenGovReady = this.generateWaitPromise('open-gov.ready');
43
44
  }
44
45
  generateWaitPromise(eventType) {
45
46
  return new Promise(resolve => {
@@ -47,7 +47,6 @@ exports.SubsquidTransactionType = SubsquidTransactionType;
47
47
  const HISTORY_SUPPORT_TYPES = [SubsquidTransactionType.BalanceTransfer, SubsquidTransactionType.EthereumExecuted, SubsquidTransactionType.StakingBonded
48
48
  // SubsquidTransactionType.CrowdloanContributed // Not support because data indexer not enough data
49
49
  ];
50
-
51
50
  function parseData(anyData) {
52
51
  try {
53
52
  return JSON.parse(anyData);
@@ -15,7 +15,7 @@ var _Base = require("./Base");
15
15
  // Copyright 2019-2022 @subwallet/extension-base
16
16
  // SPDX-License-Identifier: Apache-2.0
17
17
 
18
- const validDeriveKeypairTypes = [..._types2.SubstrateKeypairTypes, ..._types2.EthereumKeypairTypes, 'ton', 'cardano', ..._types2.BitcoinKeypairTypes];
18
+ const validDeriveKeypairTypes = [..._types2.DefaultSubstrateKeypairTypes, ..._types2.EthereumKeypairTypes, 'ton', 'cardano', ..._types2.BitcoinKeypairTypes];
19
19
 
20
20
  /**
21
21
  * @class AccountDeriveHandler
@@ -5,8 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.SESSION_TIMEOUT = exports.AccountMigrationHandler = void 0;
7
7
  var _Base = require("@subwallet/extension-base/services/keyring-service/context/handlers/Base");
8
+ var _utils = require("@subwallet/extension-base/services/keyring-service/utils");
8
9
  var _types = require("@subwallet/extension-base/types");
9
- var _utils = require("@subwallet/extension-base/utils");
10
+ var _utils2 = require("@subwallet/extension-base/utils");
10
11
  var _getId = require("@subwallet/extension-base/utils/getId");
11
12
  var _uiKeyring = require("@subwallet/ui-keyring");
12
13
  var _utilCrypto = require("@polkadot/util-crypto");
@@ -34,7 +35,8 @@ class AccountMigrationHandler extends _Base.AccountBaseHandler {
34
35
  async migrateUnifiedAndFetchEligibleSoloAccounts(request, setMigratingModeFn) {
35
36
  // Migrate unified -> unified
36
37
  const password = request.password;
37
- const allAccountProxies = Object.values(this.state.accounts);
38
+ const _allAccountProxies = Object.values(this.state.accounts);
39
+ const allAccountProxies = _allAccountProxies.filter(acc => !(0, _utils.isTWAccount)(acc)); // Prevent migrate TrustWallet solo account
38
40
  const UACanBeMigrated = this.getUACanBeMigrated(allAccountProxies);
39
41
  const UACanBeMigratedSortedByParent = this.sortUAByParent(UACanBeMigrated); // master account must be migrated before derived account
40
42
  const migratedUnifiedAccountIds = await this.migrateUnifiedToUnifiedAccount(password, UACanBeMigratedSortedByParent, setMigratingModeFn);
@@ -82,9 +84,9 @@ class AccountMigrationHandler extends _Base.AccountBaseHandler {
82
84
  proxyId
83
85
  }).result;
84
86
  const newChainTypes = Object.values(_types.AccountChainType).filter(type => !unifiedAccount.chainTypes.includes(type) && _types.SUPPORTED_ACCOUNT_CHAIN_TYPES.includes(type));
85
- const keypairTypes = newChainTypes.flatMap(chainType => (0, _utils.getDefaultKeypairTypeFromAccountChainType)(chainType));
87
+ const keypairTypes = newChainTypes.flatMap(chainType => (0, _utils2.getDefaultKeypairTypeFromAccountChainType)(chainType));
86
88
  keypairTypes.forEach(type => {
87
- const suri = (0, _utils.getSuri)(mnemonic, type);
89
+ const suri = (0, _utils2.getSuri)(mnemonic, type);
88
90
  const pair = _uiKeyring.keyring.createFromUri(suri, {}, type);
89
91
  const address = pair.address;
90
92
  modifiedPairs[address] = {
@@ -94,7 +96,7 @@ class AccountMigrationHandler extends _Base.AccountBaseHandler {
94
96
  };
95
97
  });
96
98
  keypairTypes.forEach(type => {
97
- const suri = (0, _utils.getSuri)(mnemonic, type);
99
+ const suri = (0, _utils2.getSuri)(mnemonic, type);
98
100
  const {
99
101
  derivePath
100
102
  } = (0, _utilCrypto.keyExtractSuri)(suri);
@@ -141,7 +143,7 @@ class AccountMigrationHandler extends _Base.AccountBaseHandler {
141
143
  password,
142
144
  proxyId: oldProxyId
143
145
  }).result;
144
- const upcomingProxyId = (0, _utils.createAccountProxyId)(mnemonic);
146
+ const upcomingProxyId = (0, _utils2.createAccountProxyId)(mnemonic);
145
147
  if (!rs[upcomingProxyId]) {
146
148
  rs[upcomingProxyId] = [];
147
149
  }
@@ -187,9 +189,9 @@ class AccountMigrationHandler extends _Base.AccountBaseHandler {
187
189
  password,
188
190
  proxyId: firstAccountOldProxyId
189
191
  }).result;
190
- const keypairTypes = _types.SUPPORTED_ACCOUNT_CHAIN_TYPES.flatMap(chainType => (0, _utils.getDefaultKeypairTypeFromAccountChainType)(chainType));
192
+ const keypairTypes = _types.SUPPORTED_ACCOUNT_CHAIN_TYPES.flatMap(chainType => (0, _utils2.getDefaultKeypairTypeFromAccountChainType)(chainType));
191
193
  keypairTypes.forEach(type => {
192
- const suri = (0, _utils.getSuri)(mnemonic, type);
194
+ const suri = (0, _utils2.getSuri)(mnemonic, type);
193
195
  const pair = _uiKeyring.keyring.createFromUri(suri, {}, type);
194
196
  const address = pair.address;
195
197
  modifiedPairs[address] = {
@@ -205,7 +207,7 @@ class AccountMigrationHandler extends _Base.AccountBaseHandler {
205
207
  });
206
208
  const soloAccountProxyIds = [];
207
209
  keypairTypes.forEach(type => {
208
- const suri = (0, _utils.getSuri)(mnemonic, type);
210
+ const suri = (0, _utils2.getSuri)(mnemonic, type);
209
211
  const {
210
212
  derivePath
211
213
  } = (0, _utilCrypto.keyExtractSuri)(suri);
@@ -50,10 +50,11 @@ class AccountMnemonicHandler extends _Base.AccountBaseHandler {
50
50
  }
51
51
 
52
52
  /* Validate seed */
53
- mnemonicValidateV2(_ref2) {
54
- let {
55
- mnemonic
56
- } = _ref2;
53
+ mnemonicValidateV2(request) {
54
+ const {
55
+ mnemonic,
56
+ mnemonicType
57
+ } = request;
57
58
  const {
58
59
  phrase
59
60
  } = (0, _utilCrypto.keyExtractSuri)(mnemonic);
@@ -70,8 +71,13 @@ class AccountMnemonicHandler extends _Base.AccountBaseHandler {
70
71
  }));
71
72
  try {
72
73
  (0, _util.assert)((0, _utilCrypto.mnemonicValidate)(phrase), (0, _i18next.t)('bg.ACCOUNT.services.keyring.handler.Mnemonic.invalidSeedPhraseTryAgain'));
73
- mnemonicTypes = 'general';
74
- pairTypes = ['sr25519', ..._types2.EthereumKeypairTypes, 'ton', ..._types2.CardanoKeypairTypes, ..._types2.BitcoinKeypairTypes];
74
+ if (mnemonicType === 'trust-wallet') {
75
+ mnemonicTypes = 'trust-wallet';
76
+ pairTypes = ['ed25519-tw'];
77
+ } else {
78
+ mnemonicTypes = 'general';
79
+ pairTypes = ['sr25519', ..._types2.EthereumKeypairTypes, 'ton', ..._types2.CardanoKeypairTypes, ..._types2.BitcoinKeypairTypes];
80
+ }
75
81
  } catch (e) {
76
82
  (0, _util.assert)((0, _utils2.tonMnemonicValidate)(phrase), (0, _i18next.t)('bg.ACCOUNT.services.keyring.handler.Mnemonic.invalidSeedPhraseTryAgain'));
77
83
  mnemonicTypes = 'ton';
@@ -87,10 +93,10 @@ class AccountMnemonicHandler extends _Base.AccountBaseHandler {
87
93
  pairTypes.forEach(type => {
88
94
  rs.addressMap[type] = _uiKeyring.keyring.createFromUri((0, _utils.getSuri)(mnemonic, type), {}, type).address;
89
95
  });
90
- const exists = this.state.checkAddressExists(Object.values(rs.addressMap));
91
- (0, _util.assert)(!exists, (0, _i18next.t)('bg.ACCOUNT.services.keyring.handler.Mnemonic.accountAlreadyExistsWithName', {
96
+ const existingAccount = this.state.checkAddressExists(Object.values(rs.addressMap));
97
+ (0, _util.assert)(!existingAccount, (0, _i18next.t)('bg.ACCOUNT.services.keyring.handler.Mnemonic.accountAlreadyExistsWithName', {
92
98
  replace: {
93
- name: (exists === null || exists === void 0 ? void 0 : exists.name) || (exists === null || exists === void 0 ? void 0 : exists.address) || ''
99
+ name: (existingAccount === null || existingAccount === void 0 ? void 0 : existingAccount.name) || (existingAccount === null || existingAccount === void 0 ? void 0 : existingAccount.address) || ''
94
100
  }
95
101
  }));
96
102
  return rs;
@@ -103,12 +109,11 @@ class AccountMnemonicHandler extends _Base.AccountBaseHandler {
103
109
  name,
104
110
  password,
105
111
  suri: _suri,
106
- type
112
+ types
107
113
  } = request;
108
114
  const addressDict = {};
109
115
  let changedAccount = false;
110
116
  const hasMasterPassword = _uiKeyring.keyring.keyring.hasMasterPassword;
111
- const types = type ? [type] : ['sr25519', ..._types2.EthereumKeypairTypes, 'ton', ..._types2.CardanoKeypairTypes, ..._types2.BitcoinKeypairTypes];
112
117
  if (!hasMasterPassword) {
113
118
  if (!password) {
114
119
  throw Error((0, _i18next.t)('bg.ACCOUNT.services.keyring.handler.Mnemonic.eachAccountPasswordNeeded'));
@@ -183,11 +188,11 @@ class AccountMnemonicHandler extends _Base.AccountBaseHandler {
183
188
 
184
189
  /* Export mnemonic */
185
190
 
186
- exportAccountProxyMnemonic(_ref3) {
191
+ exportAccountProxyMnemonic(_ref2) {
187
192
  let {
188
193
  password,
189
194
  proxyId
190
- } = _ref3;
195
+ } = _ref2;
191
196
  const isUnified = this.state.isUnifiedAccount(proxyId);
192
197
  if (!isUnified) {
193
198
  const pair = _uiKeyring.keyring.getPair(proxyId);
@@ -290,15 +290,19 @@ class AccountState {
290
290
  const belongsTo = this.belongUnifiedAccount(address);
291
291
  if (belongsTo) {
292
292
  const accountProxy = this.accountProxies[belongsTo];
293
+ const allAccountTypes = this.getDecodedAccountTypes(belongsTo); // get allAccountTypes of unified account of the account address
294
+
293
295
  return {
294
296
  address,
295
- name: accountProxy.name
297
+ name: accountProxy.name,
298
+ relatedAccountTypes: allAccountTypes
296
299
  };
297
300
  } else {
298
301
  var _pair$meta;
299
302
  return {
300
303
  address,
301
- name: ((_pair$meta = pair.meta) === null || _pair$meta === void 0 ? void 0 : _pair$meta.name) || address
304
+ name: ((_pair$meta = pair.meta) === null || _pair$meta === void 0 ? void 0 : _pair$meta.name) || address,
305
+ relatedAccountTypes: [pair.type]
302
306
  };
303
307
  }
304
308
  }
@@ -462,6 +466,20 @@ class AccountState {
462
466
  return accountProxies[proxyId].accounts.map(account => account.address);
463
467
  }
464
468
  }
469
+ getDecodedAccountTypes(accountProxyId) {
470
+ if (!accountProxyId) {
471
+ return [];
472
+ }
473
+ if (accountProxyId === _constants.ALL_ACCOUNT_KEY) {
474
+ return []; // todo
475
+ }
476
+ const accountProxies = this.accounts;
477
+ if (!accountProxies[accountProxyId]) {
478
+ return [];
479
+ } else {
480
+ return accountProxies[accountProxyId].accounts.map(account => account.type);
481
+ }
482
+ }
465
483
 
466
484
  /* Get address for another service */
467
485
 
@@ -582,7 +600,7 @@ class AccountState {
582
600
  metadata.suri = _parentSuri;
583
601
  needUpdateSet.add(address);
584
602
  }
585
- const hasSuri = ('suri' in metadata);
603
+ const hasSuri = 'suri' in metadata;
586
604
  const lacksDerivationPath = !('derivationPath' in metadata);
587
605
  const isEthereumType = _types2.EthereumKeypairTypes.includes(pair.type);
588
606
  const isTonType = pair.type === 'ton';
@@ -3,7 +3,8 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.hasAnyAccountForMigration = void 0;
6
+ exports.isTWAccount = exports.hasAnyAccountForMigration = void 0;
7
+ var _types = require("@subwallet/extension-base/types");
7
8
  // Copyright 2019-2022 @subwallet/extension-base
8
9
  // SPDX-License-Identifier: Apache-2.0
9
10
 
@@ -15,4 +16,13 @@ const hasAnyAccountForMigration = allAccountProxies => {
15
16
  }
16
17
  return false;
17
18
  };
18
- exports.hasAnyAccountForMigration = hasAnyAccountForMigration;
19
+
20
+ // Check if account is TrustWallet account
21
+ exports.hasAnyAccountForMigration = hasAnyAccountForMigration;
22
+ const isTWAccount = account => {
23
+ const isTWDerivation = account.suri === "m/44'/354'/0'/0'/0'";
24
+ const isTWSolo = account.accountType === _types.AccountProxyType.SOLO;
25
+ const isTWKeyPairType = account.accounts[0].type === 'ed25519-tw';
26
+ return isTWDerivation && isTWSolo && isTWKeyPairType;
27
+ };
28
+ exports.isTWAccount = isTWAccount;
@@ -6,8 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var _util = require("@polkadot/util");
8
8
  var _scripts = _interopRequireWildcard(require("./scripts"));
9
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
10
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
9
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
11
10
  // Copyright 2019-2022 @subwallet/extension-koni authors & contributors
12
11
  // SPDX-License-Identifier: Apache-2.0
13
12
 
@@ -43,7 +43,6 @@ class UnlockDotCampaign {
43
43
  // } else {
44
44
  // result = await this.getMinted(address, slug);
45
45
  }
46
-
47
46
  this.#transactionNftState[transactionId] = (_result = result) !== null && _result !== void 0 ? _result : {
48
47
  nftImage: ''
49
48
  };
@@ -14,6 +14,11 @@ var _subwalletServicesSdk = _interopRequireDefault(require("@subwallet-monorepos
14
14
  // Copyright 2019-2022 @subwallet/extension-base authors & contributors
15
15
  // SPDX-License-Identifier: Apache-2.0
16
16
 
17
+ /**
18
+ * NFT detection service
19
+ * Responsible for managing NFT detection jobs per address
20
+ */
21
+
17
22
  function mapSdkToNftItem(rawInstance, chain, collectionId, owner) {
18
23
  var _rawInstance$token_ty, _rawInstance$token_ty2, _rawInstance$id;
19
24
  const metadata = rawInstance.metadata || {};