@subwallet/extension-base 1.3.69-0 → 1.3.71-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (208) hide show
  1. package/background/KoniTypes.d.ts +11 -0
  2. package/background/KoniTypes.js +68 -8
  3. package/cjs/background/KoniTypes.js +68 -8
  4. package/cjs/constants/blocked-actions.js +3 -0
  5. package/cjs/core/logic-validation/swap.js +0 -3
  6. package/cjs/core/substrate/system-pallet.js +0 -2
  7. package/cjs/koni/api/nft/wasm_nft/index.js +0 -1
  8. package/cjs/koni/api/staking/bonding/astar.js +0 -2
  9. package/cjs/koni/api/staking/bonding/paraChain.js +0 -3
  10. package/cjs/koni/api/staking/bonding/relayChain.js +2 -4
  11. package/cjs/koni/api/staking/bonding/utils.js +0 -4
  12. package/cjs/koni/background/cron.js +0 -1
  13. package/cjs/koni/background/handlers/Extension.js +216 -158
  14. package/cjs/koni/background/handlers/State.js +59 -54
  15. package/cjs/koni/background/handlers/Tabs.js +39 -34
  16. package/cjs/packageInfo.js +1 -1
  17. package/cjs/page/index.js +7 -0
  18. package/cjs/page/substrate/PostMessageProvider.js +3 -0
  19. package/cjs/services/balance-service/helpers/subscribe/cardano/utils.js +0 -1
  20. package/cjs/services/balance-service/helpers/subscribe/substrate/gear.js +0 -2
  21. package/cjs/services/balance-service/helpers/subscribe/substrate/index.js +2 -3
  22. package/cjs/services/balance-service/helpers/subscribe/ton/utils.js +0 -3
  23. package/cjs/services/balance-service/index.js +103 -7
  24. package/cjs/services/balance-service/transfer/bitcoin-transfer.js +0 -1
  25. package/cjs/services/balance-service/transfer/cardano-transfer.js +1 -2
  26. package/cjs/services/balance-service/transfer/smart-contract.js +0 -1
  27. package/cjs/services/balance-service/transfer/token.js +0 -2
  28. package/cjs/services/balance-service/transfer/ton-transfer.js +0 -1
  29. package/cjs/services/balance-service/transfer/xcm/snowBridge.js +0 -1
  30. package/cjs/services/chain-service/constants.js +15 -4
  31. package/cjs/services/chain-service/handler/CardanoApi.js +3 -1
  32. package/cjs/services/chain-service/handler/SubstrateApi.js +0 -2
  33. package/cjs/services/chain-service/handler/light-client/index.js +1 -2
  34. package/cjs/services/chain-service/health-check/index.js +0 -1
  35. package/cjs/services/chain-service/health-check/utils/new-utils/chain-asset-validate.js +0 -1
  36. package/cjs/services/chain-service/index.js +18 -26
  37. package/cjs/services/chain-service/utils/index.js +34 -30
  38. package/cjs/services/earning-service/handlers/base.js +32 -0
  39. package/cjs/services/earning-service/handlers/lending/base.js +0 -2
  40. package/cjs/services/earning-service/handlers/liquid-staking/acala.js +0 -1
  41. package/cjs/services/earning-service/handlers/liquid-staking/base.js +0 -2
  42. package/cjs/services/earning-service/handlers/liquid-staking/bifrost.js +0 -2
  43. package/cjs/services/earning-service/handlers/liquid-staking/parallel.js +0 -1
  44. package/cjs/services/earning-service/handlers/native-staking/astar.js +0 -2
  45. package/cjs/services/earning-service/handlers/native-staking/dtao.js +43 -2
  46. package/cjs/services/earning-service/handlers/native-staking/energy.js +0 -1
  47. package/cjs/services/earning-service/handlers/native-staking/mythos.js +0 -2
  48. package/cjs/services/earning-service/handlers/native-staking/para-chain.js +0 -2
  49. package/cjs/services/earning-service/handlers/native-staking/relay-chain.js +8 -9
  50. package/cjs/services/earning-service/handlers/special.js +7 -0
  51. package/cjs/services/event-service/index.js +1 -0
  52. package/cjs/services/history-service/subsquid-multi-chain-history.js +0 -1
  53. package/cjs/services/keyring-service/context/handlers/Derive.js +1 -1
  54. package/cjs/services/keyring-service/context/handlers/Migration.js +11 -9
  55. package/cjs/services/keyring-service/context/handlers/Mnemonic.js +18 -13
  56. package/cjs/services/keyring-service/context/state.js +21 -3
  57. package/cjs/services/keyring-service/utils.js +12 -2
  58. package/cjs/services/migration-service/index.js +1 -2
  59. package/cjs/services/mint-campaign-service/campaigns/UnlockDotCampaign.js +0 -1
  60. package/cjs/services/nft-service/index.js +5 -0
  61. package/cjs/services/open-gov/handler.js +561 -0
  62. package/cjs/services/open-gov/index.js +273 -0
  63. package/cjs/services/open-gov/interface.js +31 -0
  64. package/cjs/services/open-gov/utils.js +66 -0
  65. package/cjs/services/request-service/handler/BitcoinRequestHandler.js +1 -2
  66. package/cjs/services/request-service/handler/CardanoRequestHandler.js +0 -1
  67. package/cjs/services/request-service/handler/EvmRequestHandler.js +0 -1
  68. package/cjs/services/request-service/handler/TonRequestHandler.js +0 -1
  69. package/cjs/services/request-service/helper/index.js +1 -2
  70. package/cjs/services/storage-service/DatabaseService.js +19 -3
  71. package/cjs/services/storage-service/databases/index.js +5 -0
  72. package/cjs/services/storage-service/db-stores/GovLockedInfoStore.js +35 -0
  73. package/cjs/services/swap-service/handler/asset-hub/handler.js +0 -1
  74. package/cjs/services/swap-service/handler/asset-hub/router.js +0 -1
  75. package/cjs/services/swap-service/handler/chainflip-handler.js +1 -4
  76. package/cjs/services/swap-service/handler/hydradx-handler.js +0 -1
  77. package/cjs/services/swap-service/handler/kyber-handler.js +0 -1
  78. package/cjs/services/swap-service/handler/optimex-handler.js +1 -2
  79. package/cjs/services/swap-service/handler/simpleswap-handler.js +1 -3
  80. package/cjs/services/swap-service/handler/uniswap-handler.js +0 -3
  81. package/cjs/services/transaction-service/event-parser/index.js +6 -6
  82. package/cjs/services/transaction-service/helpers/index.js +6 -0
  83. package/cjs/services/transaction-service/index.js +71 -28
  84. package/cjs/services/wallet-connect-service/index.js +21 -18
  85. package/cjs/services/wallet-connect-service/types.js +1 -1
  86. package/cjs/types/account/info/keyring.js +9 -1
  87. package/cjs/types/balance/index.js +5 -1
  88. package/cjs/types/swap/index.js +2 -1
  89. package/cjs/types/transaction/process.js +2 -0
  90. package/cjs/types/yield/actions/join/step.js +17 -1
  91. package/cjs/utils/account/common.js +0 -26
  92. package/cjs/utils/account/derive/info/solo.js +7 -4
  93. package/cjs/utils/account/derive/validate.js +1 -1
  94. package/cjs/utils/account/transform.js +10 -5
  95. package/cjs/utils/auth.js +1 -1
  96. package/cjs/utils/bitcoin/utxo-management.js +0 -1
  97. package/cjs/utils/environment.js +2 -1
  98. package/cjs/utils/fee/transfer.js +1 -2
  99. package/cjs/utils/index.js +1 -2
  100. package/constants/blocked-actions.js +3 -0
  101. package/core/logic-validation/swap.js +0 -3
  102. package/core/substrate/system-pallet.js +0 -2
  103. package/koni/api/nft/wasm_nft/index.js +0 -1
  104. package/koni/api/staking/bonding/astar.js +0 -2
  105. package/koni/api/staking/bonding/paraChain.js +0 -3
  106. package/koni/api/staking/bonding/relayChain.js +2 -4
  107. package/koni/api/staking/bonding/utils.js +0 -4
  108. package/koni/background/cron.js +0 -1
  109. package/koni/background/handlers/Extension.d.ts +4 -0
  110. package/koni/background/handlers/Extension.js +70 -11
  111. package/koni/background/handlers/State.d.ts +2 -0
  112. package/koni/background/handlers/State.js +46 -40
  113. package/koni/background/handlers/Tabs.js +9 -3
  114. package/package.json +44 -20
  115. package/packageInfo.js +1 -1
  116. package/page/substrate/PostMessageProvider.js +3 -0
  117. package/services/balance-service/helpers/subscribe/cardano/utils.js +0 -1
  118. package/services/balance-service/helpers/subscribe/substrate/gear.js +0 -2
  119. package/services/balance-service/helpers/subscribe/substrate/index.js +0 -1
  120. package/services/balance-service/helpers/subscribe/ton/utils.js +0 -3
  121. package/services/balance-service/index.d.ts +8 -0
  122. package/services/balance-service/index.js +105 -9
  123. package/services/balance-service/transfer/bitcoin-transfer.js +0 -1
  124. package/services/balance-service/transfer/smart-contract.js +0 -1
  125. package/services/balance-service/transfer/token.js +0 -2
  126. package/services/balance-service/transfer/ton-transfer.js +0 -1
  127. package/services/balance-service/transfer/xcm/snowBridge.js +0 -1
  128. package/services/chain-service/constants.d.ts +8 -0
  129. package/services/chain-service/constants.js +12 -2
  130. package/services/chain-service/handler/CardanoApi.js +3 -1
  131. package/services/chain-service/handler/SubstrateApi.js +0 -2
  132. package/services/chain-service/health-check/index.js +0 -1
  133. package/services/chain-service/health-check/utils/new-utils/chain-asset-validate.js +0 -1
  134. package/services/chain-service/index.d.ts +0 -1
  135. package/services/chain-service/index.js +15 -23
  136. package/services/chain-service/utils/index.js +35 -31
  137. package/services/earning-service/handlers/base.js +32 -0
  138. package/services/earning-service/handlers/lending/base.js +0 -2
  139. package/services/earning-service/handlers/liquid-staking/acala.js +0 -1
  140. package/services/earning-service/handlers/liquid-staking/base.js +0 -2
  141. package/services/earning-service/handlers/liquid-staking/bifrost.js +0 -2
  142. package/services/earning-service/handlers/liquid-staking/parallel.js +0 -1
  143. package/services/earning-service/handlers/native-staking/astar.js +0 -2
  144. package/services/earning-service/handlers/native-staking/dtao.js +43 -0
  145. package/services/earning-service/handlers/native-staking/energy.js +0 -1
  146. package/services/earning-service/handlers/native-staking/mythos.js +0 -2
  147. package/services/earning-service/handlers/native-staking/para-chain.js +0 -2
  148. package/services/earning-service/handlers/native-staking/relay-chain.js +8 -9
  149. package/services/earning-service/handlers/special.js +7 -0
  150. package/services/event-service/index.d.ts +1 -0
  151. package/services/event-service/index.js +1 -0
  152. package/services/event-service/types.d.ts +1 -0
  153. package/services/history-service/subsquid-multi-chain-history.js +0 -1
  154. package/services/keyring-service/context/handlers/Derive.js +2 -2
  155. package/services/keyring-service/context/handlers/Migration.js +3 -1
  156. package/services/keyring-service/context/handlers/Mnemonic.d.ts +1 -1
  157. package/services/keyring-service/context/handlers/Mnemonic.js +16 -10
  158. package/services/keyring-service/context/state.d.ts +3 -0
  159. package/services/keyring-service/context/state.js +21 -3
  160. package/services/keyring-service/utils.d.ts +1 -0
  161. package/services/keyring-service/utils.js +9 -0
  162. package/services/mint-campaign-service/campaigns/UnlockDotCampaign.js +0 -1
  163. package/services/nft-service/index.js +6 -0
  164. package/services/open-gov/handler.d.ts +27 -0
  165. package/services/open-gov/handler.js +545 -0
  166. package/services/open-gov/index.d.ts +45 -0
  167. package/services/open-gov/index.js +265 -0
  168. package/services/open-gov/interface.d.ts +141 -0
  169. package/services/open-gov/interface.js +24 -0
  170. package/services/open-gov/utils.d.ts +14 -0
  171. package/services/open-gov/utils.js +52 -0
  172. package/services/request-service/handler/CardanoRequestHandler.js +0 -1
  173. package/services/request-service/handler/EvmRequestHandler.js +0 -1
  174. package/services/request-service/handler/TonRequestHandler.js +0 -1
  175. package/services/setting-service/constants.js +0 -1
  176. package/services/storage-service/DatabaseService.d.ts +7 -0
  177. package/services/storage-service/DatabaseService.js +19 -3
  178. package/services/storage-service/databases/index.d.ts +2 -0
  179. package/services/storage-service/databases/index.js +6 -0
  180. package/services/storage-service/db-stores/GovLockedInfoStore.d.ts +10 -0
  181. package/services/storage-service/db-stores/GovLockedInfoStore.js +27 -0
  182. package/services/swap-service/handler/asset-hub/handler.js +0 -1
  183. package/services/swap-service/handler/asset-hub/router.js +0 -1
  184. package/services/swap-service/handler/chainflip-handler.js +0 -2
  185. package/services/swap-service/handler/hydradx-handler.js +0 -1
  186. package/services/swap-service/handler/kyber-handler.js +0 -1
  187. package/services/swap-service/handler/simpleswap-handler.js +0 -1
  188. package/services/swap-service/handler/uniswap-handler.js +0 -3
  189. package/services/transaction-service/event-parser/index.js +6 -6
  190. package/services/transaction-service/helpers/index.js +6 -0
  191. package/services/transaction-service/index.js +43 -0
  192. package/services/wallet-connect-service/index.js +21 -18
  193. package/services/wallet-connect-service/types.js +1 -1
  194. package/types/account/action/add/mnemonic.d.ts +3 -2
  195. package/types/account/info/keyring.js +9 -1
  196. package/types/balance/index.js +5 -1
  197. package/types/swap/index.js +2 -1
  198. package/types/transaction/process.js +3 -1
  199. package/types/yield/actions/join/step.js +17 -1
  200. package/utils/account/common.d.ts +0 -3
  201. package/utils/account/common.js +0 -24
  202. package/utils/account/derive/info/solo.js +8 -5
  203. package/utils/account/derive/validate.d.ts +2 -2
  204. package/utils/account/derive/validate.js +1 -1
  205. package/utils/account/transform.js +10 -5
  206. package/utils/auth.js +2 -2
  207. package/utils/bitcoin/utxo-management.js +0 -1
  208. package/utils/index.js +2 -5
@@ -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
  };
@@ -74,6 +74,12 @@ const typeName = type => {
74
74
  return 'Withdraw pool';
75
75
  case _KoniTypes.ExtrinsicType.JOIN_YIELD_POOL:
76
76
  return 'Start earning';
77
+ case _KoniTypes.ExtrinsicType.GOV_VOTE:
78
+ return 'Vote';
79
+ case _KoniTypes.ExtrinsicType.GOV_UNVOTE:
80
+ return 'Remove vote';
81
+ case _KoniTypes.ExtrinsicType.GOV_UNLOCK_VOTE:
82
+ return 'Unlock votes';
77
83
  case _KoniTypes.ExtrinsicType.CHANGE_EARNING_VALIDATOR:
78
84
  return 'Change validator';
79
85
  case _KoniTypes.ExtrinsicType.UNKNOWN:
@@ -32,6 +32,7 @@ var _eventemitter = _interopRequireDefault(require("eventemitter3"));
32
32
  var _i18next = require("i18next");
33
33
  var _rxjs = require("rxjs");
34
34
  var _util = require("@polkadot/util");
35
+ var _interface = require("../open-gov/interface");
35
36
  // Copyright 2019-2022 @subwallet/extension-base authors & contributors
36
37
  // SPDX-License-Identifier: Apache-2.0
37
38
 
@@ -1078,6 +1079,48 @@ class TransactionService {
1078
1079
  historyItem.additionalInfo = data;
1079
1080
  break;
1080
1081
  }
1082
+ case _KoniTypes.ExtrinsicType.GOV_VOTE:
1083
+ {
1084
+ const data = (0, _utils3.parseTransactionData)(transaction.data);
1085
+ let totalAmount = new _bignumber.default(0);
1086
+ switch (data.type) {
1087
+ case _interface.GovVoteType.AYE:
1088
+ case _interface.GovVoteType.NAY:
1089
+ totalAmount = new _bignumber.default(data.amount || '0');
1090
+ break;
1091
+ case _interface.GovVoteType.SPLIT:
1092
+ totalAmount = new _bignumber.default(data.ayeAmount || '0').plus(data.nayAmount || '0');
1093
+ break;
1094
+ case _interface.GovVoteType.ABSTAIN:
1095
+ totalAmount = new _bignumber.default(data.ayeAmount || '0').plus(data.nayAmount || '0').plus(data.abstainAmount || '0');
1096
+ break;
1097
+ }
1098
+ historyItem.amount = {
1099
+ ...baseNativeAmount,
1100
+ value: totalAmount.toString()
1101
+ };
1102
+ historyItem.additionalInfo = data;
1103
+ break;
1104
+ }
1105
+ case _KoniTypes.ExtrinsicType.GOV_UNVOTE:
1106
+ {
1107
+ const data = (0, _utils3.parseTransactionData)(transaction.data);
1108
+ historyItem.amount = {
1109
+ ...baseNativeAmount,
1110
+ value: new _bignumber.default(data.ayeAmount || '0').plus(data.nayAmount || '0').plus(data.abstainAmount || '0').plus(data.amount || 0).toString()
1111
+ };
1112
+ historyItem.additionalInfo = data;
1113
+ break;
1114
+ }
1115
+ case _KoniTypes.ExtrinsicType.GOV_UNLOCK_VOTE:
1116
+ {
1117
+ const data = (0, _utils3.parseTransactionData)(transaction.data);
1118
+ historyItem.amount = {
1119
+ ...baseNativeAmount,
1120
+ value: data.amount
1121
+ };
1122
+ break;
1123
+ }
1081
1124
  case _KoniTypes.ExtrinsicType.UNKNOWN:
1082
1125
  break;
1083
1126
  }
@@ -1569,7 +1612,7 @@ class TransactionService {
1569
1612
  }
1570
1613
  return emitter;
1571
1614
  }
1572
- signAndSendEvmPermitTransaction(_ref10) {
1615
+ signAndSendEvmPermitTransaction(_ref0) {
1573
1616
  let {
1574
1617
  address,
1575
1618
  id,
@@ -1577,7 +1620,7 @@ class TransactionService {
1577
1620
  step,
1578
1621
  transaction,
1579
1622
  url
1580
- } = _ref10;
1623
+ } = _ref0;
1581
1624
  // Allow sign transaction
1582
1625
  const canSign = true;
1583
1626
  const emitter = new _eventemitter.default();
@@ -1599,11 +1642,11 @@ class TransactionService {
1599
1642
  };
1600
1643
  this.state.requestService.addConfirmation(id, url || _constants2.EXTENSION_REQUEST_URL, 'evmSignatureRequest', evmSignaturePayload, {
1601
1644
  isPassConfirmation
1602
- }).then(_ref11 => {
1645
+ }).then(_ref1 => {
1603
1646
  let {
1604
1647
  isApproved,
1605
1648
  payload: signature
1606
- } = _ref11;
1649
+ } = _ref1;
1607
1650
  if (isApproved) {
1608
1651
  // Emit signed event
1609
1652
  emitter.emit('signed', eventData);
@@ -1626,7 +1669,7 @@ class TransactionService {
1626
1669
  });
1627
1670
  return emitter;
1628
1671
  }
1629
- signAndSendEvmDutchTransaction(_ref12) {
1672
+ signAndSendEvmDutchTransaction(_ref10) {
1630
1673
  let {
1631
1674
  address,
1632
1675
  id,
@@ -1634,7 +1677,7 @@ class TransactionService {
1634
1677
  step,
1635
1678
  transaction,
1636
1679
  url
1637
- } = _ref12;
1680
+ } = _ref10;
1638
1681
  const emitter = new _eventemitter.default();
1639
1682
  const eventData = {
1640
1683
  id,
@@ -1656,11 +1699,11 @@ class TransactionService {
1656
1699
  };
1657
1700
  this.state.requestService.addConfirmation(id, url || _constants2.EXTENSION_REQUEST_URL, 'submitApiRequest', evmSignaturePayload, {
1658
1701
  isPassConfirmation
1659
- }).then(_ref13 => {
1702
+ }).then(_ref11 => {
1660
1703
  let {
1661
1704
  isApproved,
1662
1705
  payload: signature
1663
- } = _ref13;
1706
+ } = _ref11;
1664
1707
  if (isApproved) {
1665
1708
  emitter.emit('signed', eventData);
1666
1709
  emitter.emit('send', eventData);
@@ -1698,7 +1741,7 @@ class TransactionService {
1698
1741
  });
1699
1742
  return emitter;
1700
1743
  }
1701
- signAndSendSubstrateTransaction(_ref14) {
1744
+ signAndSendSubstrateTransaction(_ref12) {
1702
1745
  var _this$state$chainServ;
1703
1746
  let {
1704
1747
  address,
@@ -1710,7 +1753,7 @@ class TransactionService {
1710
1753
  tokenPayFeeSlug,
1711
1754
  transaction,
1712
1755
  url
1713
- } = _ref14;
1756
+ } = _ref12;
1714
1757
  const tip = (feeCustom === null || feeCustom === void 0 ? void 0 : feeCustom.tip) || '0';
1715
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;
1716
1759
  const emitter = new _eventemitter.default();
@@ -1799,20 +1842,20 @@ class TransactionService {
1799
1842
  if (!eventData.extrinsicHash) {
1800
1843
  eventData.extrinsicHash = txState.txHash.toHex();
1801
1844
  }
1802
- txState.events.filter(_ref15 => {
1845
+ txState.events.filter(_ref13 => {
1803
1846
  let {
1804
1847
  event: {
1805
1848
  section
1806
1849
  }
1807
- } = _ref15;
1850
+ } = _ref13;
1808
1851
  return section === 'system';
1809
- }).forEach(_ref16 => {
1852
+ }).forEach(_ref14 => {
1810
1853
  let {
1811
1854
  event: {
1812
1855
  data: [error],
1813
1856
  method
1814
1857
  }
1815
- } = _ref16;
1858
+ } = _ref14;
1816
1859
  if (method === 'ExtrinsicFailed') {
1817
1860
  eventData.errors.push(new _TransactionError.TransactionError(_types.BasicTxErrorType.SEND_TRANSACTION_FAILED, error.toString()));
1818
1861
  emitter.emit('error', eventData);
@@ -1835,7 +1878,7 @@ class TransactionService {
1835
1878
  });
1836
1879
  return emitter;
1837
1880
  }
1838
- signAndSendTonTransaction(_ref17) {
1881
+ signAndSendTonTransaction(_ref15) {
1839
1882
  let {
1840
1883
  address,
1841
1884
  chain,
@@ -1844,7 +1887,7 @@ class TransactionService {
1844
1887
  step,
1845
1888
  transaction,
1846
1889
  url
1847
- } = _ref17;
1890
+ } = _ref15;
1848
1891
  const walletContract = _uiKeyring.default.getPair(address).ton.currentContract;
1849
1892
  const emitter = new _eventemitter.default();
1850
1893
  const eventData = {
@@ -1861,11 +1904,11 @@ class TransactionService {
1861
1904
  ...payload,
1862
1905
  messagePayload: (0, _utils.cellToBase64Str)(message),
1863
1906
  messages: []
1864
- }, {}).then(_ref18 => {
1907
+ }, {}).then(_ref16 => {
1865
1908
  let {
1866
1909
  isApproved,
1867
1910
  payload
1868
- } = _ref18;
1911
+ } = _ref16;
1869
1912
  if (!isApproved) {
1870
1913
  this.removeTransaction(id);
1871
1914
  eventData.errors.push(new _TransactionError.TransactionError(_types.BasicTxErrorType.USER_REJECT_REQUEST));
@@ -1900,8 +1943,8 @@ class TransactionService {
1900
1943
  if (!externalMsgHash) {
1901
1944
  return;
1902
1945
  }
1903
- tonApi.getStatusByExtMsgHash(externalMsgHash, extrinsicType).then(_ref19 => {
1904
- let [status, hex] = _ref19;
1946
+ tonApi.getStatusByExtMsgHash(externalMsgHash, extrinsicType).then(_ref17 => {
1947
+ let [status, hex] = _ref17;
1905
1948
  if (status && hex) {
1906
1949
  eventData.extrinsicHash = hex;
1907
1950
  emitter.emit('extrinsicHash', eventData);
@@ -1930,13 +1973,13 @@ class TransactionService {
1930
1973
  });
1931
1974
  return emitter;
1932
1975
  }
1933
- signAndSendCardanoTransaction(_ref20) {
1976
+ signAndSendCardanoTransaction(_ref18) {
1934
1977
  let {
1935
1978
  chain,
1936
1979
  id,
1937
1980
  transaction,
1938
1981
  url
1939
- } = _ref20;
1982
+ } = _ref18;
1940
1983
  const emitter = new _eventemitter.default();
1941
1984
  const eventData = {
1942
1985
  id,
@@ -1946,11 +1989,11 @@ class TransactionService {
1946
1989
  };
1947
1990
  const transactionConfig = transaction;
1948
1991
  const cardanoApi = this.state.chainService.getCardanoApi(chain);
1949
- 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 => {
1950
1993
  let {
1951
1994
  isApproved,
1952
1995
  payload
1953
- } = _ref21;
1996
+ } = _ref19;
1954
1997
  if (!isApproved) {
1955
1998
  this.removeTransaction(id);
1956
1999
  eventData.errors.push(new _TransactionError.TransactionError(_types.BasicTxErrorType.USER_REJECT_REQUEST));
@@ -2021,14 +2064,14 @@ class TransactionService {
2021
2064
  emitter.emit('error', eventData);
2022
2065
  });
2023
2066
  };
2024
- signAndSendBitcoinTransaction(_ref22) {
2067
+ signAndSendBitcoinTransaction(_ref20) {
2025
2068
  let {
2026
2069
  address,
2027
2070
  chain,
2028
2071
  id,
2029
2072
  transaction,
2030
2073
  url
2031
- } = _ref22;
2074
+ } = _ref20;
2032
2075
  const tx = transaction;
2033
2076
  // const bitcoinApi = this.state.chainService.getBitcoinApi(chain);
2034
2077
  // const chainInfo = this.state.chainService.getChainInfoByKey(chain);
@@ -2056,11 +2099,11 @@ class TransactionService {
2056
2099
  if (isInjected) {
2057
2100
  throw new _TransactionError.TransactionError(_types.BasicTxErrorType.UNSUPPORTED);
2058
2101
  } else {
2059
- 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 => {
2060
2103
  let {
2061
2104
  isApproved,
2062
2105
  payload
2063
- } = _ref23;
2106
+ } = _ref21;
2064
2107
  if (isApproved) {
2065
2108
  if (!payload) {
2066
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
 
@@ -164,12 +167,13 @@ const EARN_STDOT_ACTIONS = [_KoniTypes.ExtrinsicType.MINT_STDOT, _KoniTypes.Extr
164
167
  const EARN_VMANTA_ACTIONS = [_KoniTypes.ExtrinsicType.MINT_VMANTA, _KoniTypes.ExtrinsicType.REDEEM_VMANTA, _KoniTypes.ExtrinsicType.UNSTAKE_VMANTA];
165
168
  const EVM_ACTIONS = [_KoniTypes.ExtrinsicType.TOKEN_SPENDING_APPROVAL, _KoniTypes.ExtrinsicType.EVM_EXECUTE];
166
169
  const CLAIM_AVAIL_BRIDGE = [_KoniTypes.ExtrinsicType.CLAIM_BRIDGE];
170
+ const OPEN_GOV_ACTIONS = [_KoniTypes.ExtrinsicType.GOV_VOTE, _KoniTypes.ExtrinsicType.GOV_UNVOTE, _KoniTypes.ExtrinsicType.GOV_UNLOCK_VOTE];
167
171
  const OTHER_ACTIONS = [_KoniTypes.ExtrinsicType.TRANSFER_XCM, _KoniTypes.ExtrinsicType.SEND_NFT, _KoniTypes.ExtrinsicType.SWAP, _KoniTypes.ExtrinsicType.CROWDLOAN];
168
172
  const getAccountTransactionActions = (signMode, networkType, type, _meta, _specialNetwork) => {
169
173
  if ([_types2.AccountSignMode.PASSWORD, _types2.AccountSignMode.INJECTED].includes(signMode)) {
170
174
  switch (networkType) {
171
175
  case _types2.AccountChainType.SUBSTRATE:
172
- return [...BASE_TRANSFER_ACTIONS, ...NATIVE_STAKE_ACTIONS, ...POOL_STAKE_ACTIONS, ...EARN_VDOT_ACTIONS, ...EARN_LDOT_ACTIONS, ...EARN_SDOT_ACTIONS, ...EARN_QDOT_ACTIONS, ...EARN_VMANTA_ACTIONS, ...CLAIM_AVAIL_BRIDGE, ...OTHER_ACTIONS];
176
+ return [...BASE_TRANSFER_ACTIONS, ...NATIVE_STAKE_ACTIONS, ...POOL_STAKE_ACTIONS, ...EARN_VDOT_ACTIONS, ...EARN_LDOT_ACTIONS, ...EARN_SDOT_ACTIONS, ...EARN_QDOT_ACTIONS, ...EARN_VMANTA_ACTIONS, ...CLAIM_AVAIL_BRIDGE, ...OPEN_GOV_ACTIONS, ...OTHER_ACTIONS];
173
177
  case _types2.AccountChainType.ETHEREUM:
174
178
  return [...BASE_TRANSFER_ACTIONS, ...NATIVE_STAKE_ACTIONS, ...POOL_STAKE_ACTIONS, ...EARN_STDOT_ACTIONS, ...OTHER_ACTIONS, ...CLAIM_AVAIL_BRIDGE, ...EVM_ACTIONS];
175
179
  case _types2.AccountChainType.TON:
@@ -182,7 +186,7 @@ const getAccountTransactionActions = (signMode, networkType, type, _meta, _speci
182
186
  } else if (signMode === _types2.AccountSignMode.QR) {
183
187
  switch (networkType) {
184
188
  case _types2.AccountChainType.SUBSTRATE:
185
- return [...BASE_TRANSFER_ACTIONS, ...NATIVE_STAKE_ACTIONS, ...POOL_STAKE_ACTIONS, ...EARN_VDOT_ACTIONS, ...EARN_LDOT_ACTIONS, ...EARN_SDOT_ACTIONS, ...EARN_QDOT_ACTIONS, ...EARN_VMANTA_ACTIONS, ...CLAIM_AVAIL_BRIDGE, ...OTHER_ACTIONS];
189
+ return [...BASE_TRANSFER_ACTIONS, ...NATIVE_STAKE_ACTIONS, ...POOL_STAKE_ACTIONS, ...EARN_VDOT_ACTIONS, ...EARN_LDOT_ACTIONS, ...EARN_SDOT_ACTIONS, ...EARN_QDOT_ACTIONS, ...EARN_VMANTA_ACTIONS, ...CLAIM_AVAIL_BRIDGE, ...OPEN_GOV_ACTIONS, ...OTHER_ACTIONS];
186
190
  case _types2.AccountChainType.ETHEREUM:
187
191
  return [...(_constants.isProductionMode ? [] : [...BASE_TRANSFER_ACTIONS, ...NATIVE_STAKE_ACTIONS, ...POOL_STAKE_ACTIONS, ...EARN_STDOT_ACTIONS, ...CLAIM_AVAIL_BRIDGE, ...OTHER_ACTIONS, ...EVM_ACTIONS])];
188
192
  case _types2.AccountChainType.TON:
@@ -197,7 +201,7 @@ const getAccountTransactionActions = (signMode, networkType, type, _meta, _speci
197
201
  case _types2.AccountChainType.SUBSTRATE:
198
202
  return [...BASE_TRANSFER_ACTIONS, ...NATIVE_STAKE_ACTIONS, ...POOL_STAKE_ACTIONS, ...EARN_VDOT_ACTIONS, ...EARN_VMANTA_ACTIONS, ...EARN_LDOT_ACTIONS, ...EARN_SDOT_ACTIONS,
199
203
  // ...EARN_QDOT_ACTIONS,
200
- ...OTHER_ACTIONS];
204
+ ...OPEN_GOV_ACTIONS, ...OTHER_ACTIONS];
201
205
  case _types2.AccountChainType.ETHEREUM:
202
206
  return [...BASE_TRANSFER_ACTIONS, ...EARN_STDOT_ACTIONS, ...EVM_ACTIONS, ...CLAIM_AVAIL_BRIDGE, _KoniTypes.ExtrinsicType.STAKING_WITHDRAW,
203
207
  // For liquid staking
@@ -246,7 +250,7 @@ const getAccountTransactionActions = (signMode, networkType, type, _meta, _speci
246
250
  } else if (signMode === _types2.AccountSignMode.ECDSA_SUBSTRATE_LEDGER) {
247
251
  // Only for account substrate with ECDSA scheme format
248
252
  const result = [];
249
- result.push(...BASE_TRANSFER_ACTIONS, ...NATIVE_STAKE_ACTIONS, ...POOL_STAKE_ACTIONS, _KoniTypes.ExtrinsicType.TRANSFER_XCM, _KoniTypes.ExtrinsicType.SWAP, _KoniTypes.ExtrinsicType.CROWDLOAN);
253
+ result.push(...BASE_TRANSFER_ACTIONS, ...NATIVE_STAKE_ACTIONS, ...POOL_STAKE_ACTIONS, ...OPEN_GOV_ACTIONS, _KoniTypes.ExtrinsicType.TRANSFER_XCM, _KoniTypes.ExtrinsicType.SWAP, _KoniTypes.ExtrinsicType.CROWDLOAN);
250
254
  return result;
251
255
  }
252
256
  return [];
@@ -258,6 +262,7 @@ const getAccountTokenTypes = type => {
258
262
  return [_types._AssetType.NATIVE, _types._AssetType.LOCAL, _types._AssetType.ERC20, _types._AssetType.ERC721];
259
263
  case 'sr25519':
260
264
  case 'ed25519':
265
+ case 'ed25519-tw':
261
266
  case 'ecdsa':
262
267
  return [_types._AssetType.NATIVE, _types._AssetType.LOCAL, _types._AssetType.PSP22, _types._AssetType.PSP34, _types._AssetType.GRC20, _types._AssetType.ERC721, _types._AssetType.VFT];
263
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