@subwallet/extension-base 1.3.70-2 → 1.3.72-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 (237) hide show
  1. package/background/KoniTypes.d.ts +13 -2
  2. package/background/KoniTypes.js +68 -9
  3. package/cjs/background/KoniTypes.js +68 -9
  4. package/cjs/constants/blocked-actions.js +3 -0
  5. package/cjs/core/logic-validation/recipientAddress.js +1 -1
  6. package/cjs/core/logic-validation/swap.js +0 -3
  7. package/cjs/core/logic-validation/transfer.js +33 -10
  8. package/cjs/core/substrate/system-pallet.js +0 -2
  9. package/cjs/core/types.js +1 -0
  10. package/cjs/koni/api/nft/wasm_nft/index.js +0 -1
  11. package/cjs/koni/api/staking/bonding/astar.js +0 -2
  12. package/cjs/koni/api/staking/bonding/paraChain.js +0 -3
  13. package/cjs/koni/api/staking/bonding/relayChain.js +2 -4
  14. package/cjs/koni/api/staking/bonding/utils.js +0 -4
  15. package/cjs/koni/background/cron.js +0 -1
  16. package/cjs/koni/background/handlers/Extension.js +235 -166
  17. package/cjs/koni/background/handlers/State.js +56 -52
  18. package/cjs/koni/background/handlers/Tabs.js +39 -34
  19. package/cjs/packageInfo.js +1 -1
  20. package/cjs/page/index.js +7 -0
  21. package/cjs/page/substrate/PostMessageProvider.js +3 -0
  22. package/cjs/services/balance-service/helpers/subscribe/cardano/utils.js +0 -1
  23. package/cjs/services/balance-service/helpers/subscribe/substrate/gear.js +0 -2
  24. package/cjs/services/balance-service/helpers/subscribe/substrate/index.js +48 -5
  25. package/cjs/services/balance-service/helpers/subscribe/ton/utils.js +0 -3
  26. package/cjs/services/balance-service/index.js +103 -7
  27. package/cjs/services/balance-service/transfer/bitcoin-transfer.js +0 -1
  28. package/cjs/services/balance-service/transfer/cardano-transfer.js +1 -2
  29. package/cjs/services/balance-service/transfer/smart-contract.js +0 -1
  30. package/cjs/services/balance-service/transfer/token.js +13 -37
  31. package/cjs/services/balance-service/transfer/ton-transfer.js +0 -1
  32. package/cjs/services/balance-service/transfer/xcm/index.js +3 -8
  33. package/cjs/services/balance-service/transfer/xcm/snowBridge.js +0 -1
  34. package/cjs/services/balance-service/transfer/xcm/utils.js +1 -1
  35. package/cjs/services/chain-service/constants.js +6 -5
  36. package/cjs/services/chain-service/handler/CardanoApi.js +3 -1
  37. package/cjs/services/chain-service/handler/SubstrateApi.js +0 -2
  38. package/cjs/services/chain-service/handler/light-client/index.js +1 -2
  39. package/cjs/services/chain-service/health-check/index.js +0 -1
  40. package/cjs/services/chain-service/health-check/utils/new-utils/chain-asset-validate.js +0 -1
  41. package/cjs/services/chain-service/index.js +19 -26
  42. package/cjs/services/chain-service/utils/index.js +21 -25
  43. package/cjs/services/chain-service/utils/patch.js +1 -1
  44. package/cjs/services/earning-service/handlers/base.js +32 -0
  45. package/cjs/services/earning-service/handlers/lending/base.js +0 -2
  46. package/cjs/services/earning-service/handlers/liquid-staking/acala.js +0 -1
  47. package/cjs/services/earning-service/handlers/liquid-staking/base.js +0 -2
  48. package/cjs/services/earning-service/handlers/liquid-staking/bifrost.js +0 -2
  49. package/cjs/services/earning-service/handlers/liquid-staking/parallel.js +0 -1
  50. package/cjs/services/earning-service/handlers/native-staking/astar.js +0 -2
  51. package/cjs/services/earning-service/handlers/native-staking/dtao.js +43 -2
  52. package/cjs/services/earning-service/handlers/native-staking/energy.js +0 -1
  53. package/cjs/services/earning-service/handlers/native-staking/mythos.js +0 -2
  54. package/cjs/services/earning-service/handlers/native-staking/para-chain.js +0 -2
  55. package/cjs/services/earning-service/handlers/native-staking/relay-chain.js +8 -9
  56. package/cjs/services/earning-service/handlers/special.js +7 -0
  57. package/cjs/services/history-service/subsquid-multi-chain-history.js +0 -1
  58. package/cjs/services/keyring-service/context/handlers/Derive.js +1 -1
  59. package/cjs/services/keyring-service/context/handlers/Migration.js +11 -9
  60. package/cjs/services/keyring-service/context/handlers/Mnemonic.js +18 -13
  61. package/cjs/services/keyring-service/context/state.js +21 -3
  62. package/cjs/services/keyring-service/utils.js +12 -2
  63. package/cjs/services/migration-service/index.js +1 -2
  64. package/cjs/services/migration-service/scripts/MigrateTransactionHistoryBySymbol20251223.js +55 -0
  65. package/cjs/services/migration-service/scripts/databases/MigrateAssetSetting20251223.js +41 -0
  66. package/cjs/services/migration-service/scripts/index.js +17 -13
  67. package/cjs/services/mint-campaign-service/campaigns/UnlockDotCampaign.js +0 -1
  68. package/cjs/services/nft-service/index.js +5 -0
  69. package/cjs/services/open-gov/handler.js +0 -2
  70. package/cjs/services/open-gov/interface.js +4 -1
  71. package/cjs/services/request-service/handler/BitcoinRequestHandler.js +1 -2
  72. package/cjs/services/request-service/handler/CardanoRequestHandler.js +0 -1
  73. package/cjs/services/request-service/handler/EvmRequestHandler.js +0 -1
  74. package/cjs/services/request-service/handler/TonRequestHandler.js +0 -1
  75. package/cjs/services/request-service/helper/index.js +1 -2
  76. package/cjs/services/storage-service/DatabaseService.js +0 -2
  77. package/cjs/services/storage-service/databases/index.js +2 -0
  78. package/cjs/services/substrate-proxy-service/constant.js +26 -0
  79. package/cjs/services/substrate-proxy-service/index.js +170 -0
  80. package/cjs/services/swap-service/handler/asset-hub/handler.js +0 -1
  81. package/cjs/services/swap-service/handler/asset-hub/router.js +0 -1
  82. package/cjs/services/swap-service/handler/chainflip-handler.js +1 -4
  83. package/cjs/services/swap-service/handler/hydradx-handler.js +0 -1
  84. package/cjs/services/swap-service/handler/kyber-handler.js +0 -1
  85. package/cjs/services/swap-service/handler/optimex-handler.js +1 -2
  86. package/cjs/services/swap-service/handler/simpleswap-handler.js +1 -3
  87. package/cjs/services/swap-service/handler/uniswap-handler.js +0 -3
  88. package/cjs/services/transaction-service/event-parser/index.js +6 -6
  89. package/cjs/services/transaction-service/index.js +105 -37
  90. package/cjs/services/transaction-service/utils.js +8 -5
  91. package/cjs/services/wallet-connect-service/index.js +21 -18
  92. package/cjs/services/wallet-connect-service/types.js +1 -1
  93. package/cjs/types/account/info/keyring.js +9 -1
  94. package/cjs/types/balance/index.js +5 -1
  95. package/cjs/types/index.js +11 -0
  96. package/cjs/types/substrateProxyAccount/actions/index.js +1 -0
  97. package/cjs/types/substrateProxyAccount/index.js +16 -0
  98. package/cjs/types/swap/index.js +2 -1
  99. package/cjs/types/transaction/process.js +2 -0
  100. package/cjs/types/yield/actions/join/step.js +17 -1
  101. package/cjs/utils/account/common.js +0 -26
  102. package/cjs/utils/account/derive/info/solo.js +7 -4
  103. package/cjs/utils/account/derive/validate.js +1 -1
  104. package/cjs/utils/account/transform.js +10 -5
  105. package/cjs/utils/auth.js +1 -1
  106. package/cjs/utils/bitcoin/utxo-management.js +0 -1
  107. package/cjs/utils/environment.js +2 -1
  108. package/cjs/utils/fee/transfer.js +5 -4
  109. package/cjs/utils/index.js +1 -2
  110. package/constants/blocked-actions.js +3 -0
  111. package/core/logic-validation/recipientAddress.js +1 -1
  112. package/core/logic-validation/swap.js +0 -3
  113. package/core/logic-validation/transfer.d.ts +3 -3
  114. package/core/logic-validation/transfer.js +34 -11
  115. package/core/substrate/system-pallet.js +0 -2
  116. package/core/types.d.ts +2 -1
  117. package/core/types.js +1 -0
  118. package/koni/api/nft/wasm_nft/index.js +0 -1
  119. package/koni/api/staking/bonding/astar.js +0 -2
  120. package/koni/api/staking/bonding/paraChain.js +0 -3
  121. package/koni/api/staking/bonding/relayChain.js +2 -4
  122. package/koni/api/staking/bonding/utils.js +0 -4
  123. package/koni/background/cron.js +0 -1
  124. package/koni/background/handlers/Extension.d.ts +3 -0
  125. package/koni/background/handlers/Extension.js +89 -19
  126. package/koni/background/handlers/State.d.ts +2 -0
  127. package/koni/background/handlers/State.js +43 -38
  128. package/koni/background/handlers/Tabs.js +9 -3
  129. package/package.json +50 -21
  130. package/packageInfo.js +1 -1
  131. package/page/substrate/PostMessageProvider.js +3 -0
  132. package/services/balance-service/helpers/subscribe/cardano/utils.js +0 -1
  133. package/services/balance-service/helpers/subscribe/substrate/gear.js +0 -2
  134. package/services/balance-service/helpers/subscribe/substrate/index.js +47 -4
  135. package/services/balance-service/helpers/subscribe/ton/utils.js +0 -3
  136. package/services/balance-service/index.d.ts +8 -0
  137. package/services/balance-service/index.js +105 -9
  138. package/services/balance-service/transfer/bitcoin-transfer.js +0 -1
  139. package/services/balance-service/transfer/smart-contract.js +0 -1
  140. package/services/balance-service/transfer/token.d.ts +0 -4
  141. package/services/balance-service/transfer/token.js +12 -35
  142. package/services/balance-service/transfer/ton-transfer.js +0 -1
  143. package/services/balance-service/transfer/xcm/index.js +3 -8
  144. package/services/balance-service/transfer/xcm/snowBridge.js +0 -1
  145. package/services/balance-service/transfer/xcm/utils.d.ts +0 -2
  146. package/services/balance-service/transfer/xcm/utils.js +1 -1
  147. package/services/chain-service/constants.d.ts +1 -1
  148. package/services/chain-service/constants.js +4 -4
  149. package/services/chain-service/handler/CardanoApi.js +3 -1
  150. package/services/chain-service/handler/SubstrateApi.js +0 -2
  151. package/services/chain-service/health-check/index.js +0 -1
  152. package/services/chain-service/health-check/utils/new-utils/chain-asset-validate.js +0 -1
  153. package/services/chain-service/index.d.ts +0 -1
  154. package/services/chain-service/index.js +16 -23
  155. package/services/chain-service/utils/index.js +22 -26
  156. package/services/chain-service/utils/patch.d.ts +1 -1
  157. package/services/chain-service/utils/patch.js +1 -1
  158. package/services/earning-service/handlers/base.js +32 -0
  159. package/services/earning-service/handlers/lending/base.js +0 -2
  160. package/services/earning-service/handlers/liquid-staking/acala.js +0 -1
  161. package/services/earning-service/handlers/liquid-staking/base.js +0 -2
  162. package/services/earning-service/handlers/liquid-staking/bifrost.js +0 -2
  163. package/services/earning-service/handlers/liquid-staking/parallel.js +0 -1
  164. package/services/earning-service/handlers/native-staking/astar.js +0 -2
  165. package/services/earning-service/handlers/native-staking/dtao.js +43 -0
  166. package/services/earning-service/handlers/native-staking/energy.js +0 -1
  167. package/services/earning-service/handlers/native-staking/mythos.js +0 -2
  168. package/services/earning-service/handlers/native-staking/para-chain.js +0 -2
  169. package/services/earning-service/handlers/native-staking/relay-chain.js +8 -9
  170. package/services/earning-service/handlers/special.js +7 -0
  171. package/services/history-service/subsquid-multi-chain-history.js +0 -1
  172. package/services/keyring-service/context/handlers/Derive.js +2 -2
  173. package/services/keyring-service/context/handlers/Migration.js +3 -1
  174. package/services/keyring-service/context/handlers/Mnemonic.d.ts +1 -1
  175. package/services/keyring-service/context/handlers/Mnemonic.js +16 -10
  176. package/services/keyring-service/context/state.d.ts +3 -0
  177. package/services/keyring-service/context/state.js +21 -3
  178. package/services/keyring-service/utils.d.ts +1 -0
  179. package/services/keyring-service/utils.js +9 -0
  180. package/services/migration-service/scripts/MigrateTransactionHistoryBySymbol20251223.d.ts +4 -0
  181. package/services/migration-service/scripts/MigrateTransactionHistoryBySymbol20251223.js +46 -0
  182. package/services/migration-service/scripts/databases/MigrateAssetSetting20251223.d.ts +4 -0
  183. package/services/migration-service/scripts/databases/MigrateAssetSetting20251223.js +33 -0
  184. package/services/migration-service/scripts/index.js +8 -4
  185. package/services/mint-campaign-service/campaigns/UnlockDotCampaign.js +0 -1
  186. package/services/nft-service/index.js +6 -0
  187. package/services/open-gov/handler.js +0 -2
  188. package/services/open-gov/interface.d.ts +4 -3
  189. package/services/open-gov/interface.js +4 -1
  190. package/services/request-service/handler/CardanoRequestHandler.js +0 -1
  191. package/services/request-service/handler/EvmRequestHandler.js +0 -1
  192. package/services/request-service/handler/TonRequestHandler.js +0 -1
  193. package/services/setting-service/constants.js +0 -1
  194. package/services/storage-service/DatabaseService.js +0 -2
  195. package/services/storage-service/databases/index.js +3 -0
  196. package/services/substrate-proxy-service/constant.d.ts +3 -0
  197. package/services/substrate-proxy-service/constant.js +19 -0
  198. package/services/substrate-proxy-service/index.d.ts +13 -0
  199. package/services/substrate-proxy-service/index.js +159 -0
  200. package/services/swap-service/handler/asset-hub/handler.js +0 -1
  201. package/services/swap-service/handler/asset-hub/router.js +0 -1
  202. package/services/swap-service/handler/chainflip-handler.js +0 -2
  203. package/services/swap-service/handler/hydradx-handler.js +0 -1
  204. package/services/swap-service/handler/kyber-handler.js +0 -1
  205. package/services/swap-service/handler/simpleswap-handler.js +0 -1
  206. package/services/swap-service/handler/uniswap-handler.js +0 -3
  207. package/services/transaction-service/event-parser/index.js +6 -6
  208. package/services/transaction-service/index.js +79 -11
  209. package/services/transaction-service/types.d.ts +2 -2
  210. package/services/transaction-service/utils.js +8 -5
  211. package/services/wallet-connect-service/index.js +21 -18
  212. package/services/wallet-connect-service/types.js +1 -1
  213. package/types/account/action/add/mnemonic.d.ts +3 -2
  214. package/types/account/info/keyring.js +9 -1
  215. package/types/balance/index.js +5 -1
  216. package/types/balance/transfer.d.ts +1 -0
  217. package/types/index.d.ts +1 -0
  218. package/types/index.js +1 -0
  219. package/types/substrateProxyAccount/actions/index.d.ts +17 -0
  220. package/types/substrateProxyAccount/actions/index.js +1 -0
  221. package/types/substrateProxyAccount/index.d.ts +23 -0
  222. package/types/substrateProxyAccount/index.js +8 -0
  223. package/types/swap/index.js +2 -1
  224. package/types/transaction/process.js +3 -1
  225. package/types/transaction/request.d.ts +1 -0
  226. package/types/yield/actions/join/step.js +17 -1
  227. package/types/yield/actions/join/submit.d.ts +1 -1
  228. package/utils/account/common.d.ts +0 -3
  229. package/utils/account/common.js +0 -24
  230. package/utils/account/derive/info/solo.js +8 -5
  231. package/utils/account/derive/validate.d.ts +2 -2
  232. package/utils/account/derive/validate.js +1 -1
  233. package/utils/account/transform.js +10 -5
  234. package/utils/auth.js +2 -2
  235. package/utils/bitcoin/utxo-management.js +0 -1
  236. package/utils/fee/transfer.js +4 -2
  237. package/utils/index.js +2 -5
@@ -0,0 +1,159 @@
1
+ // Copyright 2019-2022 @subwallet/extension-base
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import { TransactionError } from '@subwallet/extension-base/background/errors/TransactionError';
5
+ import { BasicTxErrorType } from '@subwallet/extension-base/types';
6
+ import { reformatAddress } from '@subwallet/extension-base/utils';
7
+ import BigN from 'bignumber.js';
8
+ import { txTypeToSubstrateProxyMap } from "./constant.js";
9
+ export default class SubstrateProxyAccountService {
10
+ constructor(state) {
11
+ this.state = state;
12
+ }
13
+ getSubstrateApi(chain) {
14
+ return this.state.getSubstrateApi(chain);
15
+ }
16
+
17
+ // Get proxied accounts for a main account
18
+ // Get when view details or perform transaction
19
+ async getSubstrateProxyAccountGroup(request) {
20
+ var _substrateApi$api$con, _substrateApi$api$con2;
21
+ const {
22
+ address,
23
+ chain,
24
+ excludedSubstrateProxyAccounts,
25
+ type
26
+ } = request;
27
+ const substrateApi = this.getSubstrateApi(chain);
28
+ await substrateApi.isReady;
29
+
30
+ // Get proxied accounts from on-chain data
31
+ const result = await substrateApi.api.query.proxy.proxies(address);
32
+ const baseDeposit = ((_substrateApi$api$con = substrateApi.api.consts.proxy.proxyDepositBase) === null || _substrateApi$api$con === void 0 ? void 0 : _substrateApi$api$con.toString()) || '0';
33
+ const factorDeposit = ((_substrateApi$api$con2 = substrateApi.api.consts.proxy.proxyDepositFactor) === null || _substrateApi$api$con2 === void 0 ? void 0 : _substrateApi$api$con2.toString()) || '0';
34
+ const deposit = new BigN(baseDeposit).plus(factorDeposit);
35
+ const [_substrateProxyAccounts, currentSubstrateProxyDeposit] = result.toPrimitive();
36
+
37
+ // Mapping on-chain data to our defined type
38
+ let substrateProxyAccounts = (_substrateProxyAccounts || []).map(account => {
39
+ const proxyId = this.state.keyringService.context.belongUnifiedAccount(account.delegate) || reformatAddress(account.delegate);
40
+ return {
41
+ substrateProxyAddress: account.delegate,
42
+ substrateProxyType: account.proxyType,
43
+ delay: account.delay,
44
+ proxyId
45
+ };
46
+ });
47
+ if (type) {
48
+ const allowedSet = new Set([...(txTypeToSubstrateProxyMap[type] || []), 'Any']);
49
+ substrateProxyAccounts = substrateProxyAccounts.filter(p => allowedSet.has(p.substrateProxyType));
50
+ }
51
+ if (excludedSubstrateProxyAccounts && excludedSubstrateProxyAccounts.length > 0) {
52
+ substrateProxyAccounts = substrateProxyAccounts.filter(p => {
53
+ return !excludedSubstrateProxyAccounts.some(excluded => excluded.address === p.substrateProxyAddress && excluded.substrateProxyType === p.substrateProxyType);
54
+ });
55
+ }
56
+ const estimateSubstrateProxyDeposit = new BigN(currentSubstrateProxyDeposit).plus(factorDeposit);
57
+ return {
58
+ substrateProxyAccounts,
59
+ substrateProxyDeposit: new BigN(currentSubstrateProxyDeposit).gt(0) ? estimateSubstrateProxyDeposit.toFixed() : deposit.toFixed()
60
+ };
61
+ }
62
+
63
+ // Linking proxy account with main account
64
+ async addSubstrateProxyAccounts(data) {
65
+ const {
66
+ address,
67
+ chain,
68
+ substrateProxyAddress,
69
+ substrateProxyType
70
+ } = data;
71
+ if (address === substrateProxyAddress) {
72
+ return Promise.reject(new TransactionError(BasicTxErrorType.INVALID_PARAMS));
73
+ }
74
+ const substrateApi = this.getSubstrateApi(chain);
75
+ await substrateApi.isReady;
76
+
77
+ // Currently we not support delay time
78
+ return substrateApi.api.tx.proxy.addProxy(substrateProxyAddress, substrateProxyType, 0);
79
+ }
80
+
81
+ // Validate adding proxy account
82
+ async validateAddSubstrateProxyAccount(params, signerSubstrateProxyAddress) {
83
+ var _substrateApi$api$con3, _substrateApi$api$con4, _substrateApi$api$con5, _substrateApi$api$con6;
84
+ const {
85
+ address,
86
+ chain,
87
+ substrateProxyType
88
+ } = params;
89
+ const substrateApi = this.getSubstrateApi(chain);
90
+ await substrateApi.isReady;
91
+ const addProxyTx = substrateApi.api.tx.proxy.addProxy;
92
+ const proxyTypeArg = addProxyTx.meta.args.find(arg => arg.name.toString() === 'proxyType');
93
+ if (proxyTypeArg) {
94
+ const typeName = proxyTypeArg.type.toString();
95
+ const proxyTypeEnum = substrateApi.api.registry.createType(typeName);
96
+ const variants = proxyTypeEnum.defKeys;
97
+ if (!variants.includes(substrateProxyType)) {
98
+ return [new TransactionError(BasicTxErrorType.UNSUPPORTED, 'This proxy type is not supported on the chosen network. Select another one and try again')];
99
+ }
100
+ }
101
+ if (!substrateApi.api.tx.proxy || !substrateApi.api.tx.proxy.addProxy) {
102
+ return [new TransactionError(BasicTxErrorType.UNSUPPORTED)];
103
+ }
104
+
105
+ // Validate max proxies accounts limit
106
+ const maxSubstrateProxies = ((_substrateApi$api$con3 = substrateApi.api.consts.proxy.maxProxies) === null || _substrateApi$api$con3 === void 0 ? void 0 : (_substrateApi$api$con4 = _substrateApi$api$con3.toNumber) === null || _substrateApi$api$con4 === void 0 ? void 0 : _substrateApi$api$con4.call(_substrateApi$api$con3)) || 0;
107
+ const currentProxiesRaw = await substrateApi.api.query.proxy.proxies(address);
108
+ const [proxyList] = currentProxiesRaw.toPrimitive();
109
+ if (proxyList.length >= maxSubstrateProxies) {
110
+ return [new TransactionError(BasicTxErrorType.INVALID_PARAMS, `Maximum number of proxies reached: ${maxSubstrateProxies}`)];
111
+ }
112
+
113
+ // Ensure enough balance for deposit + fee
114
+ const transferableBalance = await this.state.balanceService.getTransferableBalance(address, chain);
115
+ const bnTransferableBalance = new BigN(transferableBalance.value);
116
+ const feeInfo = await substrateApi.api.tx.proxy.addProxy(params.substrateProxyAddress, params.substrateProxyType, 0).paymentInfo(address);
117
+ const estimatedFee = new BigN(feeInfo.partialFee.toString());
118
+ const baseDeposit = ((_substrateApi$api$con5 = substrateApi.api.consts.proxy.proxyDepositBase) === null || _substrateApi$api$con5 === void 0 ? void 0 : _substrateApi$api$con5.toString()) || '0';
119
+ const factorDeposit = ((_substrateApi$api$con6 = substrateApi.api.consts.proxy.proxyDepositFactor) === null || _substrateApi$api$con6 === void 0 ? void 0 : _substrateApi$api$con6.toString()) || '0';
120
+ const requiredDeposit = proxyList.length === 0 ? new BigN(baseDeposit).plus(factorDeposit) : new BigN(factorDeposit);
121
+ const totalRequired = new BigN(requiredDeposit).plus(!signerSubstrateProxyAddress ? estimatedFee : 0);
122
+ if (bnTransferableBalance.lt(totalRequired)) {
123
+ return [new TransactionError(BasicTxErrorType.NOT_ENOUGH_BALANCE)];
124
+ }
125
+ return [];
126
+ }
127
+
128
+ // Removing linked proxy accounts from main account
129
+ async removeSubstrateProxyAccounts(data) {
130
+ const {
131
+ chain,
132
+ isRemoveAll,
133
+ selectedSubstrateProxyAccounts
134
+ } = data;
135
+ const substrateApi = this.getSubstrateApi(chain);
136
+ await substrateApi.isReady;
137
+ const api = substrateApi.api;
138
+ if (isRemoveAll) {
139
+ return api.tx.proxy.removeProxies();
140
+ }
141
+ if (!selectedSubstrateProxyAccounts.length) {
142
+ return Promise.reject(new TransactionError(BasicTxErrorType.INVALID_PARAMS));
143
+ }
144
+ if (selectedSubstrateProxyAccounts.length === 1) {
145
+ const {
146
+ delay,
147
+ substrateProxyAddress,
148
+ substrateProxyType
149
+ } = selectedSubstrateProxyAccounts[0];
150
+ return api.tx.proxy.removeProxy(substrateProxyAddress, substrateProxyType, delay);
151
+ }
152
+ const removeProxies = selectedSubstrateProxyAccounts.map(({
153
+ delay,
154
+ substrateProxyAddress,
155
+ substrateProxyType
156
+ }) => api.tx.proxy.removeProxy(substrateProxyAddress, substrateProxyType, delay));
157
+ return api.tx.utility.batchAll(removeProxies);
158
+ }
159
+ }
@@ -186,7 +186,6 @@ export class AssetHubSwapHandler {
186
186
  if (swap) {
187
187
  return this.swapBaseHandler.validateSwapOnlyProcess(params, 1); // todo: create interface for input request
188
188
  }
189
-
190
189
  if (swapXcm) {
191
190
  return this.swapBaseHandler.validateSwapXcmProcess(params, 1, 2);
192
191
  }
@@ -29,7 +29,6 @@ export class AssetHubRouter {
29
29
  // return [assetFrom, nativeToken, assetTo];
30
30
  // }
31
31
  }
32
-
33
32
  async earlyValidateSwapValidation(request) {
34
33
  const substrateApi = await this.substrateApi.isReady;
35
34
  const paths = this.buildPath(request.pair);
@@ -87,7 +87,6 @@ export class ChainflipSwapHandler {
87
87
  // address to which assets are refunded
88
88
  retryDurationInBlocks: '100' // 100 blocks * 6 seconds = 10 minutes before deposits are refunded
89
89
  };
90
-
91
90
  const path = `/swap?${new URLSearchParams(depositParams).toString()}`;
92
91
  const response = await fetchFromProxyService(ProxyServiceRoute.CHAINFLIP, path, {
93
92
  method: 'GET'
@@ -255,7 +254,6 @@ export class ChainflipSwapHandler {
255
254
  if (swap) {
256
255
  return this.swapBaseHandler.validateSwapOnlyProcess(params, swapIndex); // todo: create interface for input request
257
256
  }
258
-
259
257
  if (swapXcm) {
260
258
  return [new TransactionError(BasicTxErrorType.INTERNAL_ERROR)];
261
259
  }
@@ -313,7 +313,6 @@ export class HydradxHandler {
313
313
  if (swap) {
314
314
  return this.swapBaseHandler.validateSwapOnlyProcess(params, 1); // todo: create interface for input request
315
315
  }
316
-
317
316
  if (swapXcm) {
318
317
  return this.swapBaseHandler.validateSwapXcmProcess(params, 1, 2);
319
318
  }
@@ -344,7 +344,6 @@ export class KyberHandler {
344
344
  if (swap) {
345
345
  return this.swapBaseHandler.validateSwapOnlyProcess(params, swapIndex); // todo: create interface for input request
346
346
  }
347
-
348
347
  if (swapXcm) {
349
348
  return [new TransactionError(BasicTxErrorType.INTERNAL_ERROR)];
350
349
  }
@@ -285,7 +285,6 @@ export class SimpleSwapHandler {
285
285
  if (swap) {
286
286
  return this.swapBaseHandler.validateSwapOnlyProcess(params, swapIndex); // todo: create interface for input request
287
287
  }
288
-
289
288
  if (swapXcm) {
290
289
  return [new TransactionError(BasicTxErrorType.INTERNAL_ERROR)];
291
290
  }
@@ -39,7 +39,6 @@ async function fetchCheckApproval(request) {
39
39
  if (!output) {
40
40
  return undefined; // todo: recheck
41
41
  }
42
-
43
42
  chainId = dutchQuote.orderInfo.chainId;
44
43
  tokenIn = dutchQuote.orderInfo.input.token;
45
44
  tokenOut = output.token;
@@ -60,7 +59,6 @@ async function fetchCheckApproval(request) {
60
59
  tokenOutChainId: chainId // swap in-chain
61
60
  })
62
61
  });
63
-
64
62
  return await response.json();
65
63
  }
66
64
  export class UniswapHandler {
@@ -802,7 +800,6 @@ export class UniswapHandler {
802
800
  if (swap) {
803
801
  return this.swapBaseHandler.validateSwapOnlyProcess(params, swapIndex); // todo: create interface for input request
804
802
  }
805
-
806
803
  if (swapXcm) {
807
804
  return this.swapBaseHandler.validateSwapXcmProcess(params, swapIndex, bridgeIndex);
808
805
  }
@@ -87,10 +87,10 @@ export function parseLiquidStakingEvents(historyItem, eventLogs, inputTokenInfo,
87
87
  if (record.event.section === section && record.event.method.toLowerCase() === eventMethod) {
88
88
  var _record$event$data$9;
89
89
  if ((_record$event$data$9 = record.event.data[2]) !== null && _record$event$data$9 !== void 0 && _record$event$data$9.toString()) {
90
- var _record$event$data$10;
90
+ var _record$event$data$0;
91
91
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
92
92
  historyItem.fee = {
93
- value: ((_record$event$data$10 = record.event.data[2]) === null || _record$event$data$10 === void 0 ? void 0 : _record$event$data$10.toString()) || '0',
93
+ value: ((_record$event$data$0 = record.event.data[2]) === null || _record$event$data$0 === void 0 ? void 0 : _record$event$data$0.toString()) || '0',
94
94
  symbol: nativeSymbol,
95
95
  decimals: nativeDecimals
96
96
  };
@@ -109,12 +109,12 @@ export function parseLiquidStakingFastUnstakeEvents(historyItem, eventLogs, chai
109
109
  const section = extrinsicType === ExtrinsicType.REDEEM_QDOT ? 'tokens' : 'balances';
110
110
  const eventMethod = extrinsicType === ExtrinsicType.REDEEM_QDOT ? 'withdrawn' : 'withdraw';
111
111
  if (record.event.section === section && record.event.method.toLowerCase() === eventMethod) {
112
- var _record$event$data$11;
113
- if ((_record$event$data$11 = record.event.data[2]) !== null && _record$event$data$11 !== void 0 && _record$event$data$11.toString()) {
114
- var _record$event$data$12;
112
+ var _record$event$data$1;
113
+ if ((_record$event$data$1 = record.event.data[2]) !== null && _record$event$data$1 !== void 0 && _record$event$data$1.toString()) {
114
+ var _record$event$data$10;
115
115
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
116
116
  historyItem.fee = {
117
- value: ((_record$event$data$12 = record.event.data[2]) === null || _record$event$data$12 === void 0 ? void 0 : _record$event$data$12.toString()) || '0',
117
+ value: ((_record$event$data$10 = record.event.data[2]) === null || _record$event$data$10 === void 0 ? void 0 : _record$event$data$10.toString()) || '0',
118
118
  symbol: nativeSymbol,
119
119
  decimals: nativeDecimals
120
120
  };
@@ -15,7 +15,7 @@ import { getBaseTransactionInfo, getTransactionId, isBitcoinTransaction, isCarda
15
15
  import { getExplorerLink, parseTransactionData } from '@subwallet/extension-base/services/transaction-service/utils';
16
16
  import { isWalletConnectRequest } from '@subwallet/extension-base/services/wallet-connect-service/helpers';
17
17
  import { BasicTxErrorType, StepStatus, YieldPoolType } from '@subwallet/extension-base/types';
18
- import { anyNumberToBN, pairToAccount, reformatAddress } from '@subwallet/extension-base/utils';
18
+ import { anyNumberToBN, isSameAddress, pairToAccount, reformatAddress } from '@subwallet/extension-base/utils';
19
19
  import { mergeTransactionAndSignature } from '@subwallet/extension-base/utils/eth/mergeTransactionAndSignature';
20
20
  import { isContractAddress, parseContractInput } from '@subwallet/extension-base/utils/eth/parseTransaction';
21
21
  import { getId } from '@subwallet/extension-base/utils/getId';
@@ -120,18 +120,26 @@ export default class TransactionService {
120
120
  const isNonNativeTokenPayFee = tokenPayFeeSlug && !_isNativeTokenBySlug(tokenPayFeeSlug);
121
121
  const nonNativeTokenPayFeeInfo = isNonNativeTokenPayFee ? this.state.chainService.getAssetBySlug(tokenPayFeeSlug) : undefined;
122
122
  const priceMap = (await this.state.priceService.getPrice()).priceMap;
123
+
124
+ // Get signer account
125
+ let signer = address;
126
+ const signerSubstrateProxyAddress = transactionInput.signerSubstrateProxyAddress;
123
127
  if (!transactionInput.skipFeeRecalculation) {
124
- validationResponse.estimateFee = await estimateFeeForTransaction(validationResponse, transaction, chainInfo, evmApi, substrateApi, priceMap, feeInfo, nativeTokenInfo, nonNativeTokenPayFeeInfo, transactionInput.isTransferLocalTokenAndPayThatTokenAsFee);
128
+ validationResponse.estimateFee = await estimateFeeForTransaction(validationResponse, transaction, chainInfo, evmApi, substrateApi, priceMap, feeInfo, nativeTokenInfo, nonNativeTokenPayFeeInfo, transactionInput.isTransferLocalTokenAndPayThatTokenAsFee, signerSubstrateProxyAddress);
125
129
  }
126
130
  const chainInfoMap = this.state.chainService.getChainInfoMap();
131
+ let substrateProxyAccountNativeTokenAvailable;
132
+ if (signerSubstrateProxyAddress && !isSameAddress(signerSubstrateProxyAddress, address)) {
133
+ signer = signerSubstrateProxyAddress;
134
+ substrateProxyAccountNativeTokenAvailable = await this.state.balanceService.getTransferableBalance(signerSubstrateProxyAddress, chain, nativeTokenInfo.slug, extrinsicType);
135
+ }
127
136
 
128
137
  // Check account signing transaction
129
-
130
- checkSigningAccountForTransaction(validationResponse, chainInfoMap);
138
+ checkSigningAccountForTransaction(validationResponse, chainInfoMap, signer);
131
139
  const nativeTokenAvailable = await this.state.balanceService.getBalanceByType(address, chain, nativeTokenInfo.slug, transactionInput.balanceType, extrinsicType);
132
140
 
133
141
  // Check available balance against transaction fee
134
- checkBalanceWithTransactionFee(validationResponse, transactionInput, nativeTokenInfo, nativeTokenAvailable);
142
+ checkBalanceWithTransactionFee(validationResponse, transactionInput, nativeTokenInfo, nativeTokenAvailable, substrateProxyAccountNativeTokenAvailable);
135
143
 
136
144
  // Warnings Ton address if bounceable and not active
137
145
  // if (transaction && isTonTransaction(transaction) && tonApi) {
@@ -746,8 +754,10 @@ export default class TransactionService {
746
754
  // Will be added in next step
747
755
  nonce: nonce !== null && nonce !== void 0 ? nonce : 0,
748
756
  startBlock: startBlock || 0,
749
- processId: (_transaction$step3 = transaction.step) === null || _transaction$step3 === void 0 ? void 0 : _transaction$step3.processId
757
+ processId: (_transaction$step3 = transaction.step) === null || _transaction$step3 === void 0 ? void 0 : _transaction$step3.processId,
758
+ substrateProxyAddresses: []
750
759
  };
760
+ const substrateProxyHistories = [];
751
761
  const nativeAsset = _getChainNativeTokenBasicInfo(chainInfo);
752
762
  const baseNativeAmount = {
753
763
  value: '0',
@@ -1114,6 +1124,55 @@ export default class TransactionService {
1114
1124
  };
1115
1125
  break;
1116
1126
  }
1127
+ case ExtrinsicType.ADD_SUBSTRATE_PROXY_ACCOUNT:
1128
+ {
1129
+ const data = parseTransactionData(transaction.data);
1130
+ const substrateProxyAddress = data.substrateProxyAddress;
1131
+ historyItem.substrateProxyAddresses = [substrateProxyAddress];
1132
+ substrateProxyHistories.push({
1133
+ ...historyItem,
1134
+ substrateProxyAddresses: [substrateProxyAddress]
1135
+ });
1136
+ try {
1137
+ const substrateProxyAccount = keyring.getPair(substrateProxyAddress);
1138
+ if (substrateProxyAccount) {
1139
+ substrateProxyHistories.push({
1140
+ ...historyItem,
1141
+ address: substrateProxyAccount.address,
1142
+ direction: TransactionDirection.RECEIVED,
1143
+ substrateProxyAddresses: [substrateProxyAddress]
1144
+ });
1145
+ }
1146
+ } catch (e) {
1147
+ // skip
1148
+ }
1149
+ break;
1150
+ }
1151
+ case ExtrinsicType.REMOVE_SUBSTRATE_PROXY_ACCOUNT:
1152
+ {
1153
+ const data = parseTransactionData(transaction.data);
1154
+ for (const substrateProxyItem of data.selectedSubstrateProxyAccounts || []) {
1155
+ const substrateProxyAddress = substrateProxyItem.substrateProxyAddress;
1156
+ substrateProxyHistories.push({
1157
+ ...historyItem,
1158
+ substrateProxyAddresses: [substrateProxyAddress]
1159
+ });
1160
+ try {
1161
+ const substrateProxyAccount = keyring.getPair(substrateProxyAddress);
1162
+ if (substrateProxyAccount) {
1163
+ substrateProxyHistories.push({
1164
+ ...historyItem,
1165
+ address: substrateProxyAccount.address,
1166
+ direction: TransactionDirection.RECEIVED,
1167
+ substrateProxyAddresses: [substrateProxyAddress]
1168
+ });
1169
+ }
1170
+ } catch (e) {
1171
+ // skip
1172
+ }
1173
+ }
1174
+ break;
1175
+ }
1117
1176
  case ExtrinsicType.UNKNOWN:
1118
1177
  break;
1119
1178
  }
@@ -1141,7 +1200,7 @@ export default class TransactionService {
1141
1200
  } catch (e) {
1142
1201
  console.warn(e);
1143
1202
  }
1144
- return [historyItem];
1203
+ return [historyItem, ...substrateProxyHistories];
1145
1204
  }
1146
1205
  onSigned({
1147
1206
  id
@@ -1721,12 +1780,13 @@ export default class TransactionService {
1721
1780
  });
1722
1781
  return emitter;
1723
1782
  }
1724
- signAndSendSubstrateTransaction({
1783
+ async signAndSendSubstrateTransaction({
1725
1784
  address,
1726
1785
  chain,
1727
1786
  feeCustom,
1728
1787
  id,
1729
1788
  signAfterCreate,
1789
+ signerSubstrateProxyAddress,
1730
1790
  step,
1731
1791
  tokenPayFeeSlug,
1732
1792
  transaction,
@@ -1743,7 +1803,15 @@ export default class TransactionService {
1743
1803
  extrinsicHash: id,
1744
1804
  processId: step === null || step === void 0 ? void 0 : step.processId
1745
1805
  };
1746
- const extrinsic = transaction;
1806
+ let extrinsic = transaction;
1807
+ let signer = address;
1808
+ if (signerSubstrateProxyAddress && signerSubstrateProxyAddress !== address) {
1809
+ const substrateApi = this.state.chainService.getSubstrateApi(chain);
1810
+ await substrateApi.isReady;
1811
+ signer = signerSubstrateProxyAddress;
1812
+ extrinsic = substrateApi.api.tx.proxy.proxy(address, null, transaction);
1813
+ }
1814
+
1747
1815
  // const registry = extrinsic.registry;
1748
1816
  // const signedExtensions = registry.signedExtensions;
1749
1817
 
@@ -1753,7 +1821,7 @@ export default class TransactionService {
1753
1821
  const {
1754
1822
  signature,
1755
1823
  signedTransaction
1756
- } = await this.state.requestService.signInternalTransaction(id, address, url || EXTENSION_REQUEST_URL, payload, signAfterCreate);
1824
+ } = await this.state.requestService.signInternalTransaction(id, signer, url || EXTENSION_REQUEST_URL, payload, signAfterCreate);
1757
1825
  return {
1758
1826
  id: new Date().getTime(),
1759
1827
  signature,
@@ -1775,7 +1843,7 @@ export default class TransactionService {
1775
1843
  // }
1776
1844
  // }
1777
1845
 
1778
- extrinsic.signAsync(address, signerOption).then(async rs => {
1846
+ extrinsic.signAsync(signer, signerOption).then(async rs => {
1779
1847
  // Emit signed event
1780
1848
  emitter.emit('signed', eventData);
1781
1849
 
@@ -8,7 +8,7 @@ import EventEmitter from 'eventemitter3';
8
8
  import { TransactionConfig } from 'web3-core';
9
9
  import { SubmittableExtrinsic } from '@polkadot/api/promise/types';
10
10
  import { EventRecord } from '@polkadot/types/interfaces';
11
- export interface SWTransactionBase extends ValidateTransactionResponse, Partial<Pick<BaseRequestSign, 'ignoreWarnings'>>, TransactionFee, SWTransactionEmitter {
11
+ export interface SWTransactionBase extends ValidateTransactionResponse, Partial<Pick<BaseRequestSign, 'ignoreWarnings' | 'signerSubstrateProxyAddress'>>, TransactionFee, SWTransactionEmitter {
12
12
  id: string;
13
13
  url?: string;
14
14
  isInternal: boolean;
@@ -50,7 +50,7 @@ export interface SWTransactionEmitter {
50
50
  emitterTransaction?: TransactionEmitter;
51
51
  }
52
52
  declare type SwInputBase = Pick<SWTransactionBase, 'address' | 'url' | 'data' | 'extrinsicType' | 'chain' | 'chainType' | 'ignoreWarnings' | 'transferNativeAmount'> & Partial<Pick<SWTransactionBase, 'additionalValidator' | 'eventsHandler'>>;
53
- export interface SWTransactionInput extends SwInputBase, Partial<Pick<SWTransactionBase, 'estimateFee' | 'signAfterCreate' | 'isPassConfirmation' | 'step' | 'errorOnTimeOut' | 'xcmFeeDryRun'>>, TransactionFee {
53
+ export interface SWTransactionInput extends SwInputBase, Partial<Pick<SWTransactionBase, 'estimateFee' | 'signAfterCreate' | 'isPassConfirmation' | 'step' | 'errorOnTimeOut' | 'xcmFeeDryRun' | 'signerSubstrateProxyAddress'>>, TransactionFee {
54
54
  id?: string;
55
55
  transaction?: SWTransactionBase['transaction'] | null;
56
56
  warnings?: SWTransactionBase['warnings'];
@@ -25,6 +25,9 @@ function getBlockExplorerAccountRoute(explorerLink) {
25
25
  if (explorerLink.includes('devnet-explorer.mosaicchain.io')) {
26
26
  return 'accounts';
27
27
  }
28
+ if (explorerLink.includes('mainnet-gw2.mosaicchain.io')) {
29
+ return 'accounts';
30
+ }
28
31
  if (explorerLink.includes('statescan.io')) {
29
32
  return '#/accounts';
30
33
  }
@@ -53,7 +56,7 @@ function getBlockExplorerAccountRoute(explorerLink) {
53
56
  return 'account';
54
57
  }
55
58
  if (explorerLink.includes('node.xode.net')) {
56
- return 'account';
59
+ return 'polkadot/account';
57
60
  }
58
61
  if (explorerLink.includes('tonviewer.com')) {
59
62
  return '';
@@ -82,7 +85,10 @@ function getBlockExplorerTxRoute(chainInfo) {
82
85
  if (['edgeware', 'commune'].includes(chainInfo.slug)) {
83
86
  return 'extrinsics';
84
87
  }
85
- if (['mosaicTest', 'polkadex'].includes(chainInfo.slug)) {
88
+ if (['xode'].includes(chainInfo.slug)) {
89
+ return 'polkadot/extrinsics';
90
+ }
91
+ if (['mosaicTest', 'polkadex', 'mosaic'].includes(chainInfo.slug)) {
86
92
  return 'transactions';
87
93
  }
88
94
  const explorerLink = _getBlockExplorerFromChain(chainInfo);
@@ -126,9 +132,6 @@ export function getExplorerLink(chainInfo, value, type) {
126
132
  if (chainInfo.slug === 'tangle') {
127
133
  return `${explorerLink}${explorerLink.endsWith('/') ? '' : '/'}extrinsic/${value}${route}/${value}`;
128
134
  }
129
- if (chainInfo.slug === 'xode') {
130
- return `${explorerLink}${explorerLink.endsWith('/') ? '' : '/'}polkadot-chain-transaction?search=${value}`;
131
- }
132
135
  if (['truth_network', 'aventus'].includes(chainInfo.slug)) {
133
136
  // getTransactionId(value)
134
137
  // .then((transactionId) => {
@@ -138,6 +138,9 @@ export default class WalletConnectService {
138
138
  var _classPrivateFieldLoo;
139
139
  return ((_classPrivateFieldLoo = _classPrivateFieldLooseBase(this, _client)[_client]) === null || _classPrivateFieldLoo === void 0 ? void 0 : _classPrivateFieldLoo.session.values) || [];
140
140
  }
141
+
142
+ // Remove old listener
143
+
141
144
  getSession(topic) {
142
145
  var _classPrivateFieldLoo2;
143
146
  const session = (_classPrivateFieldLoo2 = _classPrivateFieldLooseBase(this, _client)[_client]) === null || _classPrivateFieldLoo2 === void 0 ? void 0 : _classPrivateFieldLoo2.session.get(topic);
@@ -191,7 +194,7 @@ export default class WalletConnectService {
191
194
  await ((_classPrivateFieldLoo7 = _classPrivateFieldLooseBase(this, _client)[_client]) === null || _classPrivateFieldLoo7 === void 0 ? void 0 : _classPrivateFieldLoo7.respond(response));
192
195
  }
193
196
  async resetWallet(resetAll) {
194
- var _classPrivateFieldLoo8, _classPrivateFieldLoo10, _classPrivateFieldLoo12;
197
+ var _classPrivateFieldLoo8, _classPrivateFieldLoo0, _classPrivateFieldLoo10;
195
198
  _classPrivateFieldLooseBase(this, _removeListener)[_removeListener]();
196
199
 
197
200
  // Disconnect session
@@ -209,11 +212,11 @@ export default class WalletConnectService {
209
212
  }
210
213
 
211
214
  // Disconnect pair
212
- const pairs = ((_classPrivateFieldLoo10 = _classPrivateFieldLooseBase(this, _client)[_client]) === null || _classPrivateFieldLoo10 === void 0 ? void 0 : _classPrivateFieldLoo10.pairing.values) || [];
215
+ const pairs = ((_classPrivateFieldLoo0 = _classPrivateFieldLooseBase(this, _client)[_client]) === null || _classPrivateFieldLoo0 === void 0 ? void 0 : _classPrivateFieldLoo0.pairing.values) || [];
213
216
  for (const pair of pairs) {
214
217
  try {
215
- var _classPrivateFieldLoo11;
216
- await ((_classPrivateFieldLoo11 = _classPrivateFieldLooseBase(this, _client)[_client]) === null || _classPrivateFieldLoo11 === void 0 ? void 0 : _classPrivateFieldLoo11.disconnect({
218
+ var _classPrivateFieldLoo1;
219
+ await ((_classPrivateFieldLoo1 = _classPrivateFieldLooseBase(this, _client)[_client]) === null || _classPrivateFieldLoo1 === void 0 ? void 0 : _classPrivateFieldLoo1.disconnect({
217
220
  topic: pair.topic,
218
221
  reason: getSdkError('USER_DISCONNECTED')
219
222
  }));
@@ -221,12 +224,12 @@ export default class WalletConnectService {
221
224
  console.error(e);
222
225
  }
223
226
  }
224
- const keys = (await ((_classPrivateFieldLoo12 = _classPrivateFieldLooseBase(this, _client)[_client]) === null || _classPrivateFieldLoo12 === void 0 ? void 0 : _classPrivateFieldLoo12.core.storage.getKeys())) || [];
227
+ const keys = (await ((_classPrivateFieldLoo10 = _classPrivateFieldLooseBase(this, _client)[_client]) === null || _classPrivateFieldLoo10 === void 0 ? void 0 : _classPrivateFieldLoo10.core.storage.getKeys())) || [];
225
228
  const deleteKeys = resetAll ? keys : keys.filter(key => key.startsWith('wc@'));
226
229
  for (const key of deleteKeys) {
227
230
  try {
228
- var _classPrivateFieldLoo13;
229
- await ((_classPrivateFieldLoo13 = _classPrivateFieldLooseBase(this, _client)[_client]) === null || _classPrivateFieldLoo13 === void 0 ? void 0 : _classPrivateFieldLoo13.core.storage.removeItem(key));
231
+ var _classPrivateFieldLoo11;
232
+ await ((_classPrivateFieldLoo11 = _classPrivateFieldLooseBase(this, _client)[_client]) === null || _classPrivateFieldLoo11 === void 0 ? void 0 : _classPrivateFieldLoo11.core.storage.removeItem(key));
230
233
  } catch (e) {
231
234
  console.error(e);
232
235
  }
@@ -235,8 +238,8 @@ export default class WalletConnectService {
235
238
  _classPrivateFieldLooseBase(this, _updateSessions)[_updateSessions]();
236
239
  }
237
240
  async disconnect(topic) {
238
- var _classPrivateFieldLoo14;
239
- await ((_classPrivateFieldLoo14 = _classPrivateFieldLooseBase(this, _client)[_client]) === null || _classPrivateFieldLoo14 === void 0 ? void 0 : _classPrivateFieldLoo14.disconnect({
241
+ var _classPrivateFieldLoo12;
242
+ await ((_classPrivateFieldLoo12 = _classPrivateFieldLooseBase(this, _client)[_client]) === null || _classPrivateFieldLoo12 === void 0 ? void 0 : _classPrivateFieldLoo12.disconnect({
240
243
  topic: topic,
241
244
  reason: getSdkError('USER_DISCONNECTED')
242
245
  }));
@@ -343,18 +346,18 @@ async function _onPingReply2({
343
346
  }
344
347
  }
345
348
  function _createListener2() {
346
- var _classPrivateFieldLoo15, _classPrivateFieldLoo16, _classPrivateFieldLoo17, _classPrivateFieldLoo18, _classPrivateFieldLoo19, _classPrivateFieldLoo20;
347
- (_classPrivateFieldLoo15 = _classPrivateFieldLooseBase(this, _client)[_client]) === null || _classPrivateFieldLoo15 === void 0 ? void 0 : _classPrivateFieldLoo15.on('session_proposal', _classPrivateFieldLooseBase(this, _onSessionProposal)[_onSessionProposal].bind(this));
348
- (_classPrivateFieldLoo16 = _classPrivateFieldLooseBase(this, _client)[_client]) === null || _classPrivateFieldLoo16 === void 0 ? void 0 : _classPrivateFieldLoo16.on('session_request', _classPrivateFieldLooseBase(this, _onSessionRequest)[_onSessionRequest].bind(this));
349
- (_classPrivateFieldLoo17 = _classPrivateFieldLooseBase(this, _client)[_client]) === null || _classPrivateFieldLoo17 === void 0 ? void 0 : _classPrivateFieldLoo17.on('session_ping', _classPrivateFieldLooseBase(this, _onPingReply)[_onPingReply].bind(this));
350
- (_classPrivateFieldLoo18 = _classPrivateFieldLooseBase(this, _client)[_client]) === null || _classPrivateFieldLoo18 === void 0 ? void 0 : _classPrivateFieldLoo18.on('session_event', data => console.log('event', data));
351
- (_classPrivateFieldLoo19 = _classPrivateFieldLooseBase(this, _client)[_client]) === null || _classPrivateFieldLoo19 === void 0 ? void 0 : _classPrivateFieldLoo19.on('session_update', data => console.log('update', data));
352
- (_classPrivateFieldLoo20 = _classPrivateFieldLooseBase(this, _client)[_client]) === null || _classPrivateFieldLoo20 === void 0 ? void 0 : _classPrivateFieldLoo20.on('session_delete', _classPrivateFieldLooseBase(this, _updateSessions)[_updateSessions].bind(this));
349
+ var _classPrivateFieldLoo13, _classPrivateFieldLoo14, _classPrivateFieldLoo15, _classPrivateFieldLoo16, _classPrivateFieldLoo17, _classPrivateFieldLoo18;
350
+ (_classPrivateFieldLoo13 = _classPrivateFieldLooseBase(this, _client)[_client]) === null || _classPrivateFieldLoo13 === void 0 ? void 0 : _classPrivateFieldLoo13.on('session_proposal', _classPrivateFieldLooseBase(this, _onSessionProposal)[_onSessionProposal].bind(this));
351
+ (_classPrivateFieldLoo14 = _classPrivateFieldLooseBase(this, _client)[_client]) === null || _classPrivateFieldLoo14 === void 0 ? void 0 : _classPrivateFieldLoo14.on('session_request', _classPrivateFieldLooseBase(this, _onSessionRequest)[_onSessionRequest].bind(this));
352
+ (_classPrivateFieldLoo15 = _classPrivateFieldLooseBase(this, _client)[_client]) === null || _classPrivateFieldLoo15 === void 0 ? void 0 : _classPrivateFieldLoo15.on('session_ping', _classPrivateFieldLooseBase(this, _onPingReply)[_onPingReply].bind(this));
353
+ (_classPrivateFieldLoo16 = _classPrivateFieldLooseBase(this, _client)[_client]) === null || _classPrivateFieldLoo16 === void 0 ? void 0 : _classPrivateFieldLoo16.on('session_event', data => console.log('event', data));
354
+ (_classPrivateFieldLoo17 = _classPrivateFieldLooseBase(this, _client)[_client]) === null || _classPrivateFieldLoo17 === void 0 ? void 0 : _classPrivateFieldLoo17.on('session_update', data => console.log('update', data));
355
+ (_classPrivateFieldLoo18 = _classPrivateFieldLooseBase(this, _client)[_client]) === null || _classPrivateFieldLoo18 === void 0 ? void 0 : _classPrivateFieldLoo18.on('session_delete', _classPrivateFieldLooseBase(this, _updateSessions)[_updateSessions].bind(this));
353
356
  }
354
357
  function _removeListener2() {
355
358
  ALL_WALLET_CONNECT_EVENT.forEach(event => {
356
- var _classPrivateFieldLoo21;
357
- (_classPrivateFieldLoo21 = _classPrivateFieldLooseBase(this, _client)[_client]) === null || _classPrivateFieldLoo21 === void 0 ? void 0 : _classPrivateFieldLoo21.removeAllListeners(event);
359
+ var _classPrivateFieldLoo19;
360
+ (_classPrivateFieldLoo19 = _classPrivateFieldLooseBase(this, _client)[_client]) === null || _classPrivateFieldLoo19 === void 0 ? void 0 : _classPrivateFieldLoo19.removeAllListeners(event);
358
361
  });
359
362
  }
360
363
  function _checkClient2() {
@@ -17,4 +17,4 @@ export let POLKADOT_SIGNING_METHODS;
17
17
  (function (POLKADOT_SIGNING_METHODS) {
18
18
  POLKADOT_SIGNING_METHODS["POLKADOT_SIGN_TRANSACTION"] = "polkadot_signTransaction";
19
19
  POLKADOT_SIGNING_METHODS["POLKADOT_SIGN_MESSAGE"] = "polkadot_signMessage";
20
- })(POLKADOT_SIGNING_METHODS || (POLKADOT_SIGNING_METHODS = {}));
20
+ })(POLKADOT_SIGNING_METHODS || (POLKADOT_SIGNING_METHODS = {})); // payload and address
@@ -1,6 +1,6 @@
1
1
  import { SeedLengths } from '@subwallet/extension-base/background/types';
2
2
  import { KeypairType } from '@subwallet/keyring/types';
3
- export declare type MnemonicType = 'general' | 'ton';
3
+ export declare type MnemonicType = 'general' | 'trust-wallet' | 'ton';
4
4
  /**
5
5
  * @interface RequestMnemonicCreateV2
6
6
  * @description Represents a request to create a new mnemonic phrase.
@@ -36,6 +36,7 @@ export interface ResponseMnemonicCreateV2 {
36
36
  */
37
37
  export interface RequestMnemonicValidateV2 {
38
38
  mnemonic: string;
39
+ mnemonicType: MnemonicType;
39
40
  }
40
41
  /**
41
42
  * @interface ResponseMnemonicValidateV2
@@ -67,7 +68,7 @@ export interface RequestAccountCreateSuriV2 {
67
68
  name: string;
68
69
  password?: string;
69
70
  suri: string;
70
- type?: KeypairType;
71
+ types: KeypairType[];
71
72
  isAllowed: boolean;
72
73
  }
73
74
  /**
@@ -95,4 +95,12 @@ export let AccountActions;
95
95
  AccountActions["EXPORT_JSON"] = "EXPORT_JSON";
96
96
  AccountActions["EXPORT_QR"] = "EXPORT_QR";
97
97
  AccountActions["TON_CHANGE_WALLET_CONTRACT_VERSION"] = "TON_CHANGE_WALLET_CONTRACT_VERSION";
98
- })(AccountActions || (AccountActions = {}));
98
+ })(AccountActions || (AccountActions = {}));
99
+ /**
100
+ * @interface AccountJson
101
+ * @extends AbstractAddressJson
102
+ * @extends AccountMetadataData
103
+ * @extends AccountActionData
104
+ * @prop {boolean} [isSubWallet] - Import from SubWallet
105
+ * @prop {boolean} [pendingMigrate] - Pending migrate password
106
+ * */
@@ -18,4 +18,8 @@ export let BalanceType;
18
18
  BalanceType["TOTAL"] = "total";
19
19
  BalanceType["TOTAL_MINUS_RESERVED"] = "totalMinusReserved";
20
20
  BalanceType["KEEP_ALIVE"] = "keepAlive";
21
- })(BalanceType || (BalanceType = {}));
21
+ })(BalanceType || (BalanceType = {}));
22
+ /** Balance info of all tokens on an address */
23
+ // Key is tokenSlug
24
+ /** Balance info of all addresses */
25
+ // Key is address