@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
@@ -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];
@@ -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 || {};
@@ -185,7 +185,6 @@ class BaseOpenGovHandler {
185
185
  const decimals = Number((0, _utils._getAssetDecimals)(this.nativeToken));
186
186
  estimatedFee = new _bignumber.default(0.001).multipliedBy(new _bignumber.default(10).pow(decimals)); // fallback 0.001
187
187
  }
188
-
189
188
  const availableBalance = new _bignumber.default(totalBalance.value).minus(estimatedFee);
190
189
  if (availableBalance.lte(0)) {
191
190
  return new _TransactionError.TransactionError(_types.BasicTxErrorType.NOT_ENOUGH_BALANCE, "You don't have enough tokens to proceed");
@@ -236,7 +235,6 @@ class BaseOpenGovHandler {
236
235
  estimatedFee = new _bignumber.default(0.001 * 10 ** (0, _utils._getAssetDecimals)(this.nativeToken)); // fallback 0.001
237
236
  }
238
237
  }
239
-
240
238
  const availableBalance = new _bignumber.default(totalBalance.value).minus(estimatedFee);
241
239
  if (availableBalance.lte(0)) {
242
240
  return new _TransactionError.TransactionError(_types.BasicTxErrorType.NOT_ENOUGH_BALANCE, "You don't have enough tokens to proceed");
@@ -25,4 +25,7 @@ exports.Conviction = Conviction;
25
25
  Conviction["Locked4x"] = "Locked4x";
26
26
  Conviction["Locked5x"] = "Locked5x";
27
27
  Conviction["Locked6x"] = "Locked6x";
28
- })(Conviction || (exports.Conviction = Conviction = {}));
28
+ })(Conviction || (exports.Conviction = Conviction = {})); // ----- Casting -----
29
+ // ----- Delegating -----
30
+ // ----- VotingFor -----
31
+ // Unlock Vote
@@ -16,8 +16,7 @@ var bitcoin = _interopRequireWildcard(require("bitcoinjs-lib"));
16
16
  var _i18next = require("i18next");
17
17
  var _rxjs = require("rxjs");
18
18
  var _util = require("@polkadot/util");
19
- 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); }
20
- 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; }
19
+ 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); }
21
20
  // Copyright 2019-2022 @subwallet/extension-base authors & contributors
22
21
  // SPDX-License-Identifier: Apache-2.0
23
22
 
@@ -56,7 +56,6 @@ class CardanoRequestHandler {
56
56
  if (duplicated) {
57
57
  throw new Error('Cardano duplicate request'); // update this message.
58
58
  }
59
-
60
59
  confirmationType[id] = {
61
60
  id,
62
61
  url,
@@ -212,7 +212,6 @@ class EvmRequestHandler {
212
212
  maxPriorityFeePerGas: (0, _eth.anyNumberToBN)(maxPriorityFeePerGas).toNumber()
213
213
  // nonce: await web3.eth.getTransactionCount(from) // Todo: fill this value from transaction service
214
214
  };
215
-
216
215
  const tx = this.configToTransaction(params);
217
216
  await Promise.resolve();
218
217
  if (pair.isLocked) {
@@ -56,7 +56,6 @@ class TonRequestHandler {
56
56
  if (duplicated) {
57
57
  throw new Error('Ton duplicate request'); // update this message.
58
58
  }
59
-
60
59
  confirmationType[id] = {
61
60
  id,
62
61
  url,
@@ -15,8 +15,7 @@ exports.hasSufficientCardanoValue = hasSufficientCardanoValue;
15
15
  var CardanoWasm = _interopRequireWildcard(require("@emurgo/cardano-serialization-lib-nodejs"));
16
16
  var _extensionChains = require("@subwallet/extension-chains");
17
17
  var _defaults = require("@polkadot/networks/defaults");
18
- 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); }
19
- 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; }
18
+ 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); }
20
19
  // Copyright 2019-2022 @subwallet/extension-base authors & contributors
21
20
  // SPDX-License-Identifier: Apache-2.0
22
21
 
@@ -473,11 +473,9 @@ class DatabaseService {
473
473
  async setMantaPayData(data) {
474
474
  await this._db.mantaPay.put(data); // just override if exist
475
475
  }
476
-
477
476
  async updateMantaPayData(key, data) {
478
477
  await this._db.mantaPay.update(key, data); // just override if exist
479
478
  }
480
-
481
479
  async getMantaPayData(key) {
482
480
  return this._db.mantaPay.get({
483
481
  key
@@ -10,6 +10,8 @@ var _dexie = _interopRequireDefault(require("dexie"));
10
10
  // SPDX-License-Identifier: Apache-2.0
11
11
 
12
12
  const DEFAULT_DATABASE = 'SubWalletDB_v2';
13
+
14
+ // TODO: refactor this
13
15
  exports.DEFAULT_DATABASE = DEFAULT_DATABASE;
14
16
  class KoniDatabase extends _dexie.default {
15
17
  constructor() {
@@ -193,7 +193,6 @@ class AssetHubSwapHandler {
193
193
  if (swap) {
194
194
  return this.swapBaseHandler.validateSwapOnlyProcess(params, 1); // todo: create interface for input request
195
195
  }
196
-
197
196
  if (swapXcm) {
198
197
  return this.swapBaseHandler.validateSwapXcmProcess(params, 1, 2);
199
198
  }
@@ -36,7 +36,6 @@ class AssetHubRouter {
36
36
  // return [assetFrom, nativeToken, assetTo];
37
37
  // }
38
38
  }
39
-
40
39
  async earlyValidateSwapValidation(request) {
41
40
  const substrateApi = await this.substrateApi.isReady;
42
41
  const paths = this.buildPath(request.pair);
@@ -18,8 +18,7 @@ var _utils2 = require("@subwallet/extension-base/utils");
18
18
  var _getId = require("@subwallet/extension-base/utils/getId");
19
19
  var _bignumber = _interopRequireDefault(require("bignumber.js"));
20
20
  var bitcoin = _interopRequireWildcard(require("bitcoinjs-lib"));
21
- 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); }
22
- 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; }
21
+ 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); }
23
22
  // Copyright 2019-2022 @subwallet/extension-base
24
23
  // SPDX-License-Identifier: Apache-2.0
25
24
 
@@ -97,7 +96,6 @@ class ChainflipSwapHandler {
97
96
  // address to which assets are refunded
98
97
  retryDurationInBlocks: '100' // 100 blocks * 6 seconds = 10 minutes before deposits are refunded
99
98
  };
100
-
101
99
  const path = `/swap?${new URLSearchParams(depositParams).toString()}`;
102
100
  const response = await (0, _utils2.fetchFromProxyService)(_environment.ProxyServiceRoute.CHAINFLIP, path, {
103
101
  method: 'GET'
@@ -265,7 +263,6 @@ class ChainflipSwapHandler {
265
263
  if (swap) {
266
264
  return this.swapBaseHandler.validateSwapOnlyProcess(params, swapIndex); // todo: create interface for input request
267
265
  }
268
-
269
266
  if (swapXcm) {
270
267
  return [new _TransactionError.TransactionError(_types.BasicTxErrorType.INTERNAL_ERROR)];
271
268
  }
@@ -321,7 +321,6 @@ class HydradxHandler {
321
321
  if (swap) {
322
322
  return this.swapBaseHandler.validateSwapOnlyProcess(params, 1); // todo: create interface for input request
323
323
  }
324
-
325
324
  if (swapXcm) {
326
325
  return this.swapBaseHandler.validateSwapXcmProcess(params, 1, 2);
327
326
  }
@@ -351,7 +351,6 @@ class KyberHandler {
351
351
  if (swap) {
352
352
  return this.swapBaseHandler.validateSwapOnlyProcess(params, swapIndex); // todo: create interface for input request
353
353
  }
354
-
355
354
  if (swapXcm) {
356
355
  return [new _TransactionError.TransactionError(_types.BasicTxErrorType.INTERNAL_ERROR)];
357
356
  }