@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
@@ -20,8 +20,7 @@ var _uiKeyring = _interopRequireDefault(require("@subwallet/ui-keyring"));
20
20
  var _bignumber = _interopRequireDefault(require("bignumber.js"));
21
21
  var bitcoin = _interopRequireWildcard(require("bitcoinjs-lib"));
22
22
  var _util = require("@polkadot/util");
23
- 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); }
24
- 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; }
23
+ 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); }
25
24
  // Copyright 2019-2022 @subwallet/extension-base
26
25
  // SPDX-License-Identifier: Apache-2.0
27
26
 
@@ -16,8 +16,7 @@ var _bignumber = _interopRequireWildcard(require("bignumber.js"));
16
16
  var _smartContract = require("../../balance-service/transfer/smart-contract");
17
17
  var _token = require("../../balance-service/transfer/token");
18
18
  var _baseHandler = require("./base-handler");
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
22
21
  // SPDX-License-Identifier: Apache-2.0
23
22
 
@@ -293,7 +292,6 @@ class SimpleSwapHandler {
293
292
  if (swap) {
294
293
  return this.swapBaseHandler.validateSwapOnlyProcess(params, swapIndex); // todo: create interface for input request
295
294
  }
296
-
297
295
  if (swapXcm) {
298
296
  return [new _TransactionError.TransactionError(_types.BasicTxErrorType.INTERNAL_ERROR)];
299
297
  }
@@ -46,7 +46,6 @@ async function fetchCheckApproval(request) {
46
46
  if (!output) {
47
47
  return undefined; // todo: recheck
48
48
  }
49
-
50
49
  chainId = dutchQuote.orderInfo.chainId;
51
50
  tokenIn = dutchQuote.orderInfo.input.token;
52
51
  tokenOut = output.token;
@@ -67,7 +66,6 @@ async function fetchCheckApproval(request) {
67
66
  tokenOutChainId: chainId // swap in-chain
68
67
  })
69
68
  });
70
-
71
69
  return await response.json();
72
70
  }
73
71
  class UniswapHandler {
@@ -809,7 +807,6 @@ class UniswapHandler {
809
807
  if (swap) {
810
808
  return this.swapBaseHandler.validateSwapOnlyProcess(params, swapIndex); // todo: create interface for input request
811
809
  }
812
-
813
810
  if (swapXcm) {
814
811
  return this.swapBaseHandler.validateSwapXcmProcess(params, swapIndex, bridgeIndex);
815
812
  }
@@ -96,10 +96,10 @@ function parseLiquidStakingEvents(historyItem, eventLogs, inputTokenInfo, chainI
96
96
  if (record.event.section === section && record.event.method.toLowerCase() === eventMethod) {
97
97
  var _record$event$data$9;
98
98
  if ((_record$event$data$9 = record.event.data[2]) !== null && _record$event$data$9 !== void 0 && _record$event$data$9.toString()) {
99
- var _record$event$data$10;
99
+ var _record$event$data$0;
100
100
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
101
101
  historyItem.fee = {
102
- value: ((_record$event$data$10 = record.event.data[2]) === null || _record$event$data$10 === void 0 ? void 0 : _record$event$data$10.toString()) || '0',
102
+ value: ((_record$event$data$0 = record.event.data[2]) === null || _record$event$data$0 === void 0 ? void 0 : _record$event$data$0.toString()) || '0',
103
103
  symbol: nativeSymbol,
104
104
  decimals: nativeDecimals
105
105
  };
@@ -118,12 +118,12 @@ function parseLiquidStakingFastUnstakeEvents(historyItem, eventLogs, chainInfo,
118
118
  const section = extrinsicType === _KoniTypes.ExtrinsicType.REDEEM_QDOT ? 'tokens' : 'balances';
119
119
  const eventMethod = extrinsicType === _KoniTypes.ExtrinsicType.REDEEM_QDOT ? 'withdrawn' : 'withdraw';
120
120
  if (record.event.section === section && record.event.method.toLowerCase() === eventMethod) {
121
- var _record$event$data$11;
122
- if ((_record$event$data$11 = record.event.data[2]) !== null && _record$event$data$11 !== void 0 && _record$event$data$11.toString()) {
123
- var _record$event$data$12;
121
+ var _record$event$data$1;
122
+ if ((_record$event$data$1 = record.event.data[2]) !== null && _record$event$data$1 !== void 0 && _record$event$data$1.toString()) {
123
+ var _record$event$data$10;
124
124
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
125
125
  historyItem.fee = {
126
- value: ((_record$event$data$12 = record.event.data[2]) === null || _record$event$data$12 === void 0 ? void 0 : _record$event$data$12.toString()) || '0',
126
+ value: ((_record$event$data$10 = record.event.data[2]) === null || _record$event$data$10 === void 0 ? void 0 : _record$event$data$10.toString()) || '0',
127
127
  symbol: nativeSymbol,
128
128
  decimals: nativeDecimals
129
129
  };
@@ -1612,7 +1612,7 @@ class TransactionService {
1612
1612
  }
1613
1613
  return emitter;
1614
1614
  }
1615
- signAndSendEvmPermitTransaction(_ref10) {
1615
+ signAndSendEvmPermitTransaction(_ref0) {
1616
1616
  let {
1617
1617
  address,
1618
1618
  id,
@@ -1620,7 +1620,7 @@ class TransactionService {
1620
1620
  step,
1621
1621
  transaction,
1622
1622
  url
1623
- } = _ref10;
1623
+ } = _ref0;
1624
1624
  // Allow sign transaction
1625
1625
  const canSign = true;
1626
1626
  const emitter = new _eventemitter.default();
@@ -1642,11 +1642,11 @@ class TransactionService {
1642
1642
  };
1643
1643
  this.state.requestService.addConfirmation(id, url || _constants2.EXTENSION_REQUEST_URL, 'evmSignatureRequest', evmSignaturePayload, {
1644
1644
  isPassConfirmation
1645
- }).then(_ref11 => {
1645
+ }).then(_ref1 => {
1646
1646
  let {
1647
1647
  isApproved,
1648
1648
  payload: signature
1649
- } = _ref11;
1649
+ } = _ref1;
1650
1650
  if (isApproved) {
1651
1651
  // Emit signed event
1652
1652
  emitter.emit('signed', eventData);
@@ -1669,7 +1669,7 @@ class TransactionService {
1669
1669
  });
1670
1670
  return emitter;
1671
1671
  }
1672
- signAndSendEvmDutchTransaction(_ref12) {
1672
+ signAndSendEvmDutchTransaction(_ref10) {
1673
1673
  let {
1674
1674
  address,
1675
1675
  id,
@@ -1677,7 +1677,7 @@ class TransactionService {
1677
1677
  step,
1678
1678
  transaction,
1679
1679
  url
1680
- } = _ref12;
1680
+ } = _ref10;
1681
1681
  const emitter = new _eventemitter.default();
1682
1682
  const eventData = {
1683
1683
  id,
@@ -1699,11 +1699,11 @@ class TransactionService {
1699
1699
  };
1700
1700
  this.state.requestService.addConfirmation(id, url || _constants2.EXTENSION_REQUEST_URL, 'submitApiRequest', evmSignaturePayload, {
1701
1701
  isPassConfirmation
1702
- }).then(_ref13 => {
1702
+ }).then(_ref11 => {
1703
1703
  let {
1704
1704
  isApproved,
1705
1705
  payload: signature
1706
- } = _ref13;
1706
+ } = _ref11;
1707
1707
  if (isApproved) {
1708
1708
  emitter.emit('signed', eventData);
1709
1709
  emitter.emit('send', eventData);
@@ -1741,7 +1741,7 @@ class TransactionService {
1741
1741
  });
1742
1742
  return emitter;
1743
1743
  }
1744
- signAndSendSubstrateTransaction(_ref14) {
1744
+ signAndSendSubstrateTransaction(_ref12) {
1745
1745
  var _this$state$chainServ;
1746
1746
  let {
1747
1747
  address,
@@ -1753,7 +1753,7 @@ class TransactionService {
1753
1753
  tokenPayFeeSlug,
1754
1754
  transaction,
1755
1755
  url
1756
- } = _ref14;
1756
+ } = _ref12;
1757
1757
  const tip = (feeCustom === null || feeCustom === void 0 ? void 0 : feeCustom.tip) || '0';
1758
1758
  const feeAssetId = tokenPayFeeSlug && !(0, _utils2._isNativeTokenBySlug)(tokenPayFeeSlug) && _constants._SUPPORT_TOKEN_PAY_FEE_GROUP.assetHub.includes(chain) ? (_this$state$chainServ = this.state.chainService.getAssetBySlug(tokenPayFeeSlug).metadata) === null || _this$state$chainServ === void 0 ? void 0 : _this$state$chainServ.multilocation : undefined;
1759
1759
  const emitter = new _eventemitter.default();
@@ -1842,20 +1842,20 @@ class TransactionService {
1842
1842
  if (!eventData.extrinsicHash) {
1843
1843
  eventData.extrinsicHash = txState.txHash.toHex();
1844
1844
  }
1845
- txState.events.filter(_ref15 => {
1845
+ txState.events.filter(_ref13 => {
1846
1846
  let {
1847
1847
  event: {
1848
1848
  section
1849
1849
  }
1850
- } = _ref15;
1850
+ } = _ref13;
1851
1851
  return section === 'system';
1852
- }).forEach(_ref16 => {
1852
+ }).forEach(_ref14 => {
1853
1853
  let {
1854
1854
  event: {
1855
1855
  data: [error],
1856
1856
  method
1857
1857
  }
1858
- } = _ref16;
1858
+ } = _ref14;
1859
1859
  if (method === 'ExtrinsicFailed') {
1860
1860
  eventData.errors.push(new _TransactionError.TransactionError(_types.BasicTxErrorType.SEND_TRANSACTION_FAILED, error.toString()));
1861
1861
  emitter.emit('error', eventData);
@@ -1878,7 +1878,7 @@ class TransactionService {
1878
1878
  });
1879
1879
  return emitter;
1880
1880
  }
1881
- signAndSendTonTransaction(_ref17) {
1881
+ signAndSendTonTransaction(_ref15) {
1882
1882
  let {
1883
1883
  address,
1884
1884
  chain,
@@ -1887,7 +1887,7 @@ class TransactionService {
1887
1887
  step,
1888
1888
  transaction,
1889
1889
  url
1890
- } = _ref17;
1890
+ } = _ref15;
1891
1891
  const walletContract = _uiKeyring.default.getPair(address).ton.currentContract;
1892
1892
  const emitter = new _eventemitter.default();
1893
1893
  const eventData = {
@@ -1904,11 +1904,11 @@ class TransactionService {
1904
1904
  ...payload,
1905
1905
  messagePayload: (0, _utils.cellToBase64Str)(message),
1906
1906
  messages: []
1907
- }, {}).then(_ref18 => {
1907
+ }, {}).then(_ref16 => {
1908
1908
  let {
1909
1909
  isApproved,
1910
1910
  payload
1911
- } = _ref18;
1911
+ } = _ref16;
1912
1912
  if (!isApproved) {
1913
1913
  this.removeTransaction(id);
1914
1914
  eventData.errors.push(new _TransactionError.TransactionError(_types.BasicTxErrorType.USER_REJECT_REQUEST));
@@ -1943,8 +1943,8 @@ class TransactionService {
1943
1943
  if (!externalMsgHash) {
1944
1944
  return;
1945
1945
  }
1946
- tonApi.getStatusByExtMsgHash(externalMsgHash, extrinsicType).then(_ref19 => {
1947
- let [status, hex] = _ref19;
1946
+ tonApi.getStatusByExtMsgHash(externalMsgHash, extrinsicType).then(_ref17 => {
1947
+ let [status, hex] = _ref17;
1948
1948
  if (status && hex) {
1949
1949
  eventData.extrinsicHash = hex;
1950
1950
  emitter.emit('extrinsicHash', eventData);
@@ -1973,13 +1973,13 @@ class TransactionService {
1973
1973
  });
1974
1974
  return emitter;
1975
1975
  }
1976
- signAndSendCardanoTransaction(_ref20) {
1976
+ signAndSendCardanoTransaction(_ref18) {
1977
1977
  let {
1978
1978
  chain,
1979
1979
  id,
1980
1980
  transaction,
1981
1981
  url
1982
- } = _ref20;
1982
+ } = _ref18;
1983
1983
  const emitter = new _eventemitter.default();
1984
1984
  const eventData = {
1985
1985
  id,
@@ -1989,11 +1989,11 @@ class TransactionService {
1989
1989
  };
1990
1990
  const transactionConfig = transaction;
1991
1991
  const cardanoApi = this.state.chainService.getCardanoApi(chain);
1992
- this.state.requestService.addConfirmationCardano(id, url || _constants2.EXTENSION_REQUEST_URL, 'cardanoSendTransactionRequest', transactionConfig, {}).then(_ref21 => {
1992
+ this.state.requestService.addConfirmationCardano(id, url || _constants2.EXTENSION_REQUEST_URL, 'cardanoSendTransactionRequest', transactionConfig, {}).then(_ref19 => {
1993
1993
  let {
1994
1994
  isApproved,
1995
1995
  payload
1996
- } = _ref21;
1996
+ } = _ref19;
1997
1997
  if (!isApproved) {
1998
1998
  this.removeTransaction(id);
1999
1999
  eventData.errors.push(new _TransactionError.TransactionError(_types.BasicTxErrorType.USER_REJECT_REQUEST));
@@ -2064,14 +2064,14 @@ class TransactionService {
2064
2064
  emitter.emit('error', eventData);
2065
2065
  });
2066
2066
  };
2067
- signAndSendBitcoinTransaction(_ref22) {
2067
+ signAndSendBitcoinTransaction(_ref20) {
2068
2068
  let {
2069
2069
  address,
2070
2070
  chain,
2071
2071
  id,
2072
2072
  transaction,
2073
2073
  url
2074
- } = _ref22;
2074
+ } = _ref20;
2075
2075
  const tx = transaction;
2076
2076
  // const bitcoinApi = this.state.chainService.getBitcoinApi(chain);
2077
2077
  // const chainInfo = this.state.chainService.getChainInfoByKey(chain);
@@ -2099,11 +2099,11 @@ class TransactionService {
2099
2099
  if (isInjected) {
2100
2100
  throw new _TransactionError.TransactionError(_types.BasicTxErrorType.UNSUPPORTED);
2101
2101
  } else {
2102
- this.state.requestService.addConfirmationBitcoin(id, url || _constants2.EXTENSION_REQUEST_URL, 'bitcoinSendTransactionRequest', payload, {}).then(_ref23 => {
2102
+ this.state.requestService.addConfirmationBitcoin(id, url || _constants2.EXTENSION_REQUEST_URL, 'bitcoinSendTransactionRequest', payload, {}).then(_ref21 => {
2103
2103
  let {
2104
2104
  isApproved,
2105
2105
  payload
2106
- } = _ref23;
2106
+ } = _ref21;
2107
2107
  if (isApproved) {
2108
2108
  if (!payload) {
2109
2109
  throw new Error('Bad signature');
@@ -152,6 +152,9 @@ class WalletConnectService {
152
152
  var _classPrivateFieldLoo;
153
153
  return ((_classPrivateFieldLoo = (0, _classPrivateFieldLooseBase2.default)(this, _client)[_client]) === null || _classPrivateFieldLoo === void 0 ? void 0 : _classPrivateFieldLoo.session.values) || [];
154
154
  }
155
+
156
+ // Remove old listener
157
+
155
158
  getSession(topic) {
156
159
  var _classPrivateFieldLoo2;
157
160
  const session = (_classPrivateFieldLoo2 = (0, _classPrivateFieldLooseBase2.default)(this, _client)[_client]) === null || _classPrivateFieldLoo2 === void 0 ? void 0 : _classPrivateFieldLoo2.session.get(topic);
@@ -206,7 +209,7 @@ class WalletConnectService {
206
209
  await ((_classPrivateFieldLoo7 = (0, _classPrivateFieldLooseBase2.default)(this, _client)[_client]) === null || _classPrivateFieldLoo7 === void 0 ? void 0 : _classPrivateFieldLoo7.respond(response));
207
210
  }
208
211
  async resetWallet(resetAll) {
209
- var _classPrivateFieldLoo8, _classPrivateFieldLoo10, _classPrivateFieldLoo12;
212
+ var _classPrivateFieldLoo8, _classPrivateFieldLoo0, _classPrivateFieldLoo10;
210
213
  (0, _classPrivateFieldLooseBase2.default)(this, _removeListener)[_removeListener]();
211
214
 
212
215
  // Disconnect session
@@ -224,11 +227,11 @@ class WalletConnectService {
224
227
  }
225
228
 
226
229
  // Disconnect pair
227
- const pairs = ((_classPrivateFieldLoo10 = (0, _classPrivateFieldLooseBase2.default)(this, _client)[_client]) === null || _classPrivateFieldLoo10 === void 0 ? void 0 : _classPrivateFieldLoo10.pairing.values) || [];
230
+ const pairs = ((_classPrivateFieldLoo0 = (0, _classPrivateFieldLooseBase2.default)(this, _client)[_client]) === null || _classPrivateFieldLoo0 === void 0 ? void 0 : _classPrivateFieldLoo0.pairing.values) || [];
228
231
  for (const pair of pairs) {
229
232
  try {
230
- var _classPrivateFieldLoo11;
231
- await ((_classPrivateFieldLoo11 = (0, _classPrivateFieldLooseBase2.default)(this, _client)[_client]) === null || _classPrivateFieldLoo11 === void 0 ? void 0 : _classPrivateFieldLoo11.disconnect({
233
+ var _classPrivateFieldLoo1;
234
+ await ((_classPrivateFieldLoo1 = (0, _classPrivateFieldLooseBase2.default)(this, _client)[_client]) === null || _classPrivateFieldLoo1 === void 0 ? void 0 : _classPrivateFieldLoo1.disconnect({
232
235
  topic: pair.topic,
233
236
  reason: (0, _utils3.getSdkError)('USER_DISCONNECTED')
234
237
  }));
@@ -236,12 +239,12 @@ class WalletConnectService {
236
239
  console.error(e);
237
240
  }
238
241
  }
239
- const keys = (await ((_classPrivateFieldLoo12 = (0, _classPrivateFieldLooseBase2.default)(this, _client)[_client]) === null || _classPrivateFieldLoo12 === void 0 ? void 0 : _classPrivateFieldLoo12.core.storage.getKeys())) || [];
242
+ const keys = (await ((_classPrivateFieldLoo10 = (0, _classPrivateFieldLooseBase2.default)(this, _client)[_client]) === null || _classPrivateFieldLoo10 === void 0 ? void 0 : _classPrivateFieldLoo10.core.storage.getKeys())) || [];
240
243
  const deleteKeys = resetAll ? keys : keys.filter(key => key.startsWith('wc@'));
241
244
  for (const key of deleteKeys) {
242
245
  try {
243
- var _classPrivateFieldLoo13;
244
- await ((_classPrivateFieldLoo13 = (0, _classPrivateFieldLooseBase2.default)(this, _client)[_client]) === null || _classPrivateFieldLoo13 === void 0 ? void 0 : _classPrivateFieldLoo13.core.storage.removeItem(key));
246
+ var _classPrivateFieldLoo11;
247
+ await ((_classPrivateFieldLoo11 = (0, _classPrivateFieldLooseBase2.default)(this, _client)[_client]) === null || _classPrivateFieldLoo11 === void 0 ? void 0 : _classPrivateFieldLoo11.core.storage.removeItem(key));
245
248
  } catch (e) {
246
249
  console.error(e);
247
250
  }
@@ -250,8 +253,8 @@ class WalletConnectService {
250
253
  (0, _classPrivateFieldLooseBase2.default)(this, _updateSessions)[_updateSessions]();
251
254
  }
252
255
  async disconnect(topic) {
253
- var _classPrivateFieldLoo14;
254
- await ((_classPrivateFieldLoo14 = (0, _classPrivateFieldLooseBase2.default)(this, _client)[_client]) === null || _classPrivateFieldLoo14 === void 0 ? void 0 : _classPrivateFieldLoo14.disconnect({
256
+ var _classPrivateFieldLoo12;
257
+ await ((_classPrivateFieldLoo12 = (0, _classPrivateFieldLooseBase2.default)(this, _client)[_client]) === null || _classPrivateFieldLoo12 === void 0 ? void 0 : _classPrivateFieldLoo12.disconnect({
255
258
  topic: topic,
256
259
  reason: (0, _utils3.getSdkError)('USER_DISCONNECTED')
257
260
  }));
@@ -360,18 +363,18 @@ async function _onPingReply2(_ref4) {
360
363
  }
361
364
  }
362
365
  function _createListener2() {
363
- var _classPrivateFieldLoo15, _classPrivateFieldLoo16, _classPrivateFieldLoo17, _classPrivateFieldLoo18, _classPrivateFieldLoo19, _classPrivateFieldLoo20;
364
- (_classPrivateFieldLoo15 = (0, _classPrivateFieldLooseBase2.default)(this, _client)[_client]) === null || _classPrivateFieldLoo15 === void 0 ? void 0 : _classPrivateFieldLoo15.on('session_proposal', (0, _classPrivateFieldLooseBase2.default)(this, _onSessionProposal)[_onSessionProposal].bind(this));
365
- (_classPrivateFieldLoo16 = (0, _classPrivateFieldLooseBase2.default)(this, _client)[_client]) === null || _classPrivateFieldLoo16 === void 0 ? void 0 : _classPrivateFieldLoo16.on('session_request', (0, _classPrivateFieldLooseBase2.default)(this, _onSessionRequest)[_onSessionRequest].bind(this));
366
- (_classPrivateFieldLoo17 = (0, _classPrivateFieldLooseBase2.default)(this, _client)[_client]) === null || _classPrivateFieldLoo17 === void 0 ? void 0 : _classPrivateFieldLoo17.on('session_ping', (0, _classPrivateFieldLooseBase2.default)(this, _onPingReply)[_onPingReply].bind(this));
367
- (_classPrivateFieldLoo18 = (0, _classPrivateFieldLooseBase2.default)(this, _client)[_client]) === null || _classPrivateFieldLoo18 === void 0 ? void 0 : _classPrivateFieldLoo18.on('session_event', data => console.log('event', data));
368
- (_classPrivateFieldLoo19 = (0, _classPrivateFieldLooseBase2.default)(this, _client)[_client]) === null || _classPrivateFieldLoo19 === void 0 ? void 0 : _classPrivateFieldLoo19.on('session_update', data => console.log('update', data));
369
- (_classPrivateFieldLoo20 = (0, _classPrivateFieldLooseBase2.default)(this, _client)[_client]) === null || _classPrivateFieldLoo20 === void 0 ? void 0 : _classPrivateFieldLoo20.on('session_delete', (0, _classPrivateFieldLooseBase2.default)(this, _updateSessions)[_updateSessions].bind(this));
366
+ var _classPrivateFieldLoo13, _classPrivateFieldLoo14, _classPrivateFieldLoo15, _classPrivateFieldLoo16, _classPrivateFieldLoo17, _classPrivateFieldLoo18;
367
+ (_classPrivateFieldLoo13 = (0, _classPrivateFieldLooseBase2.default)(this, _client)[_client]) === null || _classPrivateFieldLoo13 === void 0 ? void 0 : _classPrivateFieldLoo13.on('session_proposal', (0, _classPrivateFieldLooseBase2.default)(this, _onSessionProposal)[_onSessionProposal].bind(this));
368
+ (_classPrivateFieldLoo14 = (0, _classPrivateFieldLooseBase2.default)(this, _client)[_client]) === null || _classPrivateFieldLoo14 === void 0 ? void 0 : _classPrivateFieldLoo14.on('session_request', (0, _classPrivateFieldLooseBase2.default)(this, _onSessionRequest)[_onSessionRequest].bind(this));
369
+ (_classPrivateFieldLoo15 = (0, _classPrivateFieldLooseBase2.default)(this, _client)[_client]) === null || _classPrivateFieldLoo15 === void 0 ? void 0 : _classPrivateFieldLoo15.on('session_ping', (0, _classPrivateFieldLooseBase2.default)(this, _onPingReply)[_onPingReply].bind(this));
370
+ (_classPrivateFieldLoo16 = (0, _classPrivateFieldLooseBase2.default)(this, _client)[_client]) === null || _classPrivateFieldLoo16 === void 0 ? void 0 : _classPrivateFieldLoo16.on('session_event', data => console.log('event', data));
371
+ (_classPrivateFieldLoo17 = (0, _classPrivateFieldLooseBase2.default)(this, _client)[_client]) === null || _classPrivateFieldLoo17 === void 0 ? void 0 : _classPrivateFieldLoo17.on('session_update', data => console.log('update', data));
372
+ (_classPrivateFieldLoo18 = (0, _classPrivateFieldLooseBase2.default)(this, _client)[_client]) === null || _classPrivateFieldLoo18 === void 0 ? void 0 : _classPrivateFieldLoo18.on('session_delete', (0, _classPrivateFieldLooseBase2.default)(this, _updateSessions)[_updateSessions].bind(this));
370
373
  }
371
374
  function _removeListener2() {
372
375
  _constants.ALL_WALLET_CONNECT_EVENT.forEach(event => {
373
- var _classPrivateFieldLoo21;
374
- (_classPrivateFieldLoo21 = (0, _classPrivateFieldLooseBase2.default)(this, _client)[_client]) === null || _classPrivateFieldLoo21 === void 0 ? void 0 : _classPrivateFieldLoo21.removeAllListeners(event);
376
+ var _classPrivateFieldLoo19;
377
+ (_classPrivateFieldLoo19 = (0, _classPrivateFieldLooseBase2.default)(this, _client)[_client]) === null || _classPrivateFieldLoo19 === void 0 ? void 0 : _classPrivateFieldLoo19.removeAllListeners(event);
375
378
  });
376
379
  }
377
380
  function _checkClient2() {
@@ -24,4 +24,4 @@ exports.POLKADOT_SIGNING_METHODS = POLKADOT_SIGNING_METHODS;
24
24
  (function (POLKADOT_SIGNING_METHODS) {
25
25
  POLKADOT_SIGNING_METHODS["POLKADOT_SIGN_TRANSACTION"] = "polkadot_signTransaction";
26
26
  POLKADOT_SIGNING_METHODS["POLKADOT_SIGN_MESSAGE"] = "polkadot_signMessage";
27
- })(POLKADOT_SIGNING_METHODS || (exports.POLKADOT_SIGNING_METHODS = POLKADOT_SIGNING_METHODS = {}));
27
+ })(POLKADOT_SIGNING_METHODS || (exports.POLKADOT_SIGNING_METHODS = POLKADOT_SIGNING_METHODS = {})); // payload and address
@@ -99,4 +99,12 @@ exports.AccountActions = AccountActions;
99
99
  AccountActions["EXPORT_JSON"] = "EXPORT_JSON";
100
100
  AccountActions["EXPORT_QR"] = "EXPORT_QR";
101
101
  AccountActions["TON_CHANGE_WALLET_CONTRACT_VERSION"] = "TON_CHANGE_WALLET_CONTRACT_VERSION";
102
- })(AccountActions || (exports.AccountActions = AccountActions = {}));
102
+ })(AccountActions || (exports.AccountActions = AccountActions = {}));
103
+ /**
104
+ * @interface AccountJson
105
+ * @extends AbstractAddressJson
106
+ * @extends AccountMetadataData
107
+ * @extends AccountActionData
108
+ * @prop {boolean} [isSubWallet] - Import from SubWallet
109
+ * @prop {boolean} [pendingMigrate] - Pending migrate password
110
+ * */
@@ -23,4 +23,8 @@ exports.BalanceType = BalanceType;
23
23
  BalanceType["TOTAL"] = "total";
24
24
  BalanceType["TOTAL_MINUS_RESERVED"] = "totalMinusReserved";
25
25
  BalanceType["KEEP_ALIVE"] = "keepAlive";
26
- })(BalanceType || (exports.BalanceType = BalanceType = {}));
26
+ })(BalanceType || (exports.BalanceType = BalanceType = {}));
27
+ /** Balance info of all tokens on an address */
28
+ // Key is tokenSlug
29
+ /** Balance info of all addresses */
30
+ // Key is address
@@ -55,7 +55,8 @@ exports.SwapFeeType = SwapFeeType;
55
55
  SwapFeeType["PLATFORM_FEE"] = "PLATFORM_FEE";
56
56
  SwapFeeType["NETWORK_FEE"] = "NETWORK_FEE";
57
57
  SwapFeeType["WALLET_FEE"] = "WALLET_FEE";
58
- })(SwapFeeType || (exports.SwapFeeType = SwapFeeType = {}));
58
+ })(SwapFeeType || (exports.SwapFeeType = SwapFeeType = {})); // todo: will be more
59
+ // parameters & responses
59
60
  let DynamicSwapType;
60
61
  exports.DynamicSwapType = DynamicSwapType;
61
62
  (function (DynamicSwapType) {
@@ -25,4 +25,6 @@ exports.StepStatus = StepStatus;
25
25
  StepStatus["TIMEOUT"] = "TIMEOUT";
26
26
  })(StepStatus || (exports.StepStatus = StepStatus = {}));
27
27
  const PROCESSING_STEP_STATUS = [StepStatus.PREPARE, StepStatus.SUBMITTING, StepStatus.PROCESSING];
28
+
29
+ // temp for avoid conflict // todo: recheck to refactor BriefXcmStepV2 and BriefSwapStepV2 later;
28
30
  exports.PROCESSING_STEP_STATUS = PROCESSING_STEP_STATUS;
@@ -45,4 +45,20 @@ exports.YieldStepType = YieldStepType;
45
45
  YieldStepType["MINT_SDOT"] = "MINT_SDOT";
46
46
  YieldStepType["MINT_STDOT"] = "MINT_STDOT";
47
47
  YieldStepType["TOKEN_APPROVAL"] = "TOKEN_APPROVAL";
48
- })(YieldStepType || (exports.YieldStepType = YieldStepType = {}));
48
+ })(YieldStepType || (exports.YieldStepType = YieldStepType = {}));
49
+ /**
50
+ * @interface YieldStepDetail
51
+ * @extends BaseYieldStepDetail
52
+ * @description Detail of a step
53
+ * @prop {number} id - Step's id
54
+ * */
55
+ /**
56
+ * @interface YieldTokenBaseInfo
57
+ * @prop {string} slug - Token's slug
58
+ * @prop {string} [amount] - Token's amount
59
+ * */
60
+ /** Base info and fee of a step */
61
+ /**
62
+ * @interface OptimalYieldPath
63
+ * @description Result after generate steps
64
+ * */
@@ -7,7 +7,6 @@ exports.getAccountJsonByAddress = exports.getAccountChainTypeForAddress = export
7
7
  exports.getAddressesByChainType = getAddressesByChainType;
8
8
  exports.getAddressesByChainTypeMap = getAddressesByChainTypeMap;
9
9
  exports.isAccountAll = isAccountAll;
10
- exports.modifyAccountName = void 0;
11
10
  exports.quickFormatAddressToCompare = quickFormatAddressToCompare;
12
11
  exports.reformatAddress = reformatAddress;
13
12
  var _constants = require("@subwallet/extension-base/constants");
@@ -80,7 +79,6 @@ function getAddressesByChainType(addresses, chainTypes, chainInfo) {
80
79
  return addressByChainTypeMap[chainType];
81
80
  }).flat(); // todo: recheck
82
81
  }
83
-
84
82
  function getAddressesByChainTypeMap(addresses, chainInfo) {
85
83
  const addressByChainType = {
86
84
  substrate: [],
@@ -120,29 +118,6 @@ function quickFormatAddressToCompare(address) {
120
118
  return reformatAddress(address, 42).toLowerCase();
121
119
  }
122
120
 
123
- /** @deprecated */
124
- const modifyAccountName = (type, name, modify) => {
125
- if (!modify) {
126
- return name;
127
- }
128
- let network = '';
129
- switch (type) {
130
- case 'sr25519':
131
- case 'ed25519':
132
- case 'ecdsa':
133
- network = 'Substrate';
134
- break;
135
- case 'ethereum':
136
- network = 'EVM';
137
- break;
138
- case 'ton':
139
- case 'ton-native':
140
- network = 'Ton';
141
- break;
142
- }
143
- return network ? [name, network].join(' - ') : name;
144
- };
145
-
146
121
  /**
147
122
  * @function getAccountJsonByAddress
148
123
  * @desc Get account info by address
@@ -152,7 +127,6 @@ const modifyAccountName = (type, name, modify) => {
152
127
  * @param {string} address - Address
153
128
  * @returns {AccountJson|null} - Account info or null if not found
154
129
  */
155
- exports.modifyAccountName = modifyAccountName;
156
130
  const getAccountJsonByAddress = address => {
157
131
  try {
158
132
  const pair = _uiKeyring.keyring.getPair(address);
@@ -59,7 +59,7 @@ const parseUnifiedSuriToDerivationPath = (suri, type) => {
59
59
  return path.replace('{firstIndex}', firstIndex);
60
60
  }
61
61
  }
62
- if (_types.SubstrateKeypairTypes.includes(type)) {
62
+ if (_types.DefaultSubstrateKeypairTypes.includes(type)) {
63
63
  return suri;
64
64
  }
65
65
  }
@@ -120,7 +120,7 @@ const getSoloDerivationInfo = function (type) {
120
120
  };
121
121
  }
122
122
  } else {
123
- if (_types.SubstrateKeypairTypes.includes(type)) {
123
+ if (_types.DefaultSubstrateKeypairTypes.includes(type)) {
124
124
  const _type = type;
125
125
  const validateTypeFunc = _type === 'sr25519' ? _validate.validateSr25519DerivationPath : raw => (0, _validate.validateOtherSubstrateDerivationPath)(raw, _type);
126
126
  const validateTypeRs = validateTypeFunc(suri);
@@ -256,7 +256,7 @@ const findSoloNextDerive = parentAddress => {
256
256
  break;
257
257
  }
258
258
  }
259
- const isSubstrate = _types.SubstrateKeypairTypes.includes(parentPair.type);
259
+ const isSubstrate = _types.DefaultSubstrateKeypairTypes.includes(parentPair.type);
260
260
  const indexes = currentDepth > 0 ? deriveInfo.autoIndexes || [] : [];
261
261
  indexes.push(index);
262
262
  const suri = isSubstrate ? [deriveInfo.suri || '', index].join('//') : '//'.concat(indexes.join('//'));
@@ -296,7 +296,10 @@ const derivePair = (parentPair, name, suri, derivationPath) => {
296
296
  };
297
297
  exports.derivePair = derivePair;
298
298
  const getSuri = (seed, type) => {
299
- const extraPath = type ? (0, _keyring.getDerivePath)(type)(0) : '';
299
+ if (!type) {
300
+ return seed;
301
+ }
302
+ const extraPath = (0, _keyring.getDerivePath)(type)(0);
300
303
  return seed + (extraPath ? '/' + extraPath : '');
301
304
  };
302
305
  exports.getSuri = getSuri;
@@ -259,7 +259,7 @@ const validateDerivationPath = (raw, type) => {
259
259
  return validateTonDerivationPath(raw);
260
260
  } else if (type === 'sr25519') {
261
261
  return validateSr25519DerivationPath(raw);
262
- } else if (type === 'ed25519' || type === 'ecdsa') {
262
+ } else if (type === 'ed25519' || type === 'ed25519-tw' || type === 'ecdsa') {
263
263
  return validateOtherSubstrateDerivationPath(raw, type);
264
264
  } else if (type === 'cardano') {
265
265
  return validateCardanoDerivationPath(raw);
@@ -115,7 +115,10 @@ const getAccountActions = (signMode, networkType, type, _meta, parentAccount) =>
115
115
  // QR
116
116
  if (signMode === _types2.AccountSignMode.PASSWORD) {
117
117
  if (networkType === _types2.AccountChainType.ETHEREUM || networkType === _types2.AccountChainType.SUBSTRATE) {
118
- result.push(_types2.AccountActions.EXPORT_QR);
118
+ if (type !== 'ed25519-tw') {
119
+ // todo: recheck if can export this account type
120
+ result.push(_types2.AccountActions.EXPORT_QR);
121
+ }
119
122
  }
120
123
  }
121
124
 
@@ -259,6 +262,7 @@ const getAccountTokenTypes = type => {
259
262
  return [_types._AssetType.NATIVE, _types._AssetType.LOCAL, _types._AssetType.ERC20, _types._AssetType.ERC721];
260
263
  case 'sr25519':
261
264
  case 'ed25519':
265
+ case 'ed25519-tw':
262
266
  case 'ecdsa':
263
267
  return [_types._AssetType.NATIVE, _types._AssetType.LOCAL, _types._AssetType.PSP22, _types._AssetType.PSP34, _types._AssetType.GRC20, _types._AssetType.ERC721, _types._AssetType.VFT];
264
268
  case 'ton':
package/cjs/utils/auth.js CHANGED
@@ -13,7 +13,7 @@ const isAddressValidWithAuthType = (address, accountAuthTypes) => {
13
13
  const keypairType = (0, _keyring.getKeypairTypeByAddress)(address);
14
14
  const validTypes = {
15
15
  evm: _types.EthereumKeypairTypes,
16
- substrate: _types.SubstrateKeypairTypes,
16
+ substrate: _types.AllSubstrateKeypairTypes,
17
17
  ton: _types.TonKeypairTypes,
18
18
  cardano: _types.CardanoKeypairTypes,
19
19
  bitcoin: _types.BitcoinKeypairTypes
@@ -249,7 +249,6 @@ async function getRuneUtxos(bitcoinApi, address) {
249
249
  status: {
250
250
  confirmed: true // not use in filter out rune utxos
251
251
  },
252
-
253
252
  value: utxoValue
254
253
  };
255
254
  runeUtxos.push(item);
@@ -11,7 +11,8 @@ var _mv = require("@subwallet/extension-base/utils/mv3");
11
11
  var _bowser = _interopRequireDefault(require("bowser"));
12
12
  var _KoniTypes = require("../background/KoniTypes");
13
13
  var _constants = require("../constants");
14
- var _navigator3;
14
+ var _navigator3; // Copyright 2019-2022 @polkadot/extension authors & contributors
15
+ // SPDX-License-Identifier: Apache-2.0
15
16
  function detectRuntimeEnvironment() {
16
17
  if (_mv.isSupportWindow && typeof document !== 'undefined') {
17
18
  var _navigator, _window$location, _window$location2;
@@ -31,8 +31,7 @@ var bitcoin = _interopRequireWildcard(require("bitcoinjs-lib"));
31
31
  var _util = require("@polkadot/util");
32
32
  var _utilCrypto = require("@polkadot/util-crypto");
33
33
  var _combine = require("./combine");
34
- 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); }
35
- 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; }
34
+ 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); }
36
35
  // Copyright 2019-2022 @subwallet/extension-base
37
36
  // SPDX-License-Identifier: Apache-2.0
38
37