@subwallet/extension-base 1.3.70-2 → 1.3.72-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (237) hide show
  1. package/background/KoniTypes.d.ts +13 -2
  2. package/background/KoniTypes.js +68 -9
  3. package/cjs/background/KoniTypes.js +68 -9
  4. package/cjs/constants/blocked-actions.js +3 -0
  5. package/cjs/core/logic-validation/recipientAddress.js +1 -1
  6. package/cjs/core/logic-validation/swap.js +0 -3
  7. package/cjs/core/logic-validation/transfer.js +33 -10
  8. package/cjs/core/substrate/system-pallet.js +0 -2
  9. package/cjs/core/types.js +1 -0
  10. package/cjs/koni/api/nft/wasm_nft/index.js +0 -1
  11. package/cjs/koni/api/staking/bonding/astar.js +0 -2
  12. package/cjs/koni/api/staking/bonding/paraChain.js +0 -3
  13. package/cjs/koni/api/staking/bonding/relayChain.js +2 -4
  14. package/cjs/koni/api/staking/bonding/utils.js +0 -4
  15. package/cjs/koni/background/cron.js +0 -1
  16. package/cjs/koni/background/handlers/Extension.js +235 -166
  17. package/cjs/koni/background/handlers/State.js +56 -52
  18. package/cjs/koni/background/handlers/Tabs.js +39 -34
  19. package/cjs/packageInfo.js +1 -1
  20. package/cjs/page/index.js +7 -0
  21. package/cjs/page/substrate/PostMessageProvider.js +3 -0
  22. package/cjs/services/balance-service/helpers/subscribe/cardano/utils.js +0 -1
  23. package/cjs/services/balance-service/helpers/subscribe/substrate/gear.js +0 -2
  24. package/cjs/services/balance-service/helpers/subscribe/substrate/index.js +48 -5
  25. package/cjs/services/balance-service/helpers/subscribe/ton/utils.js +0 -3
  26. package/cjs/services/balance-service/index.js +103 -7
  27. package/cjs/services/balance-service/transfer/bitcoin-transfer.js +0 -1
  28. package/cjs/services/balance-service/transfer/cardano-transfer.js +1 -2
  29. package/cjs/services/balance-service/transfer/smart-contract.js +0 -1
  30. package/cjs/services/balance-service/transfer/token.js +13 -37
  31. package/cjs/services/balance-service/transfer/ton-transfer.js +0 -1
  32. package/cjs/services/balance-service/transfer/xcm/index.js +3 -8
  33. package/cjs/services/balance-service/transfer/xcm/snowBridge.js +0 -1
  34. package/cjs/services/balance-service/transfer/xcm/utils.js +1 -1
  35. package/cjs/services/chain-service/constants.js +6 -5
  36. package/cjs/services/chain-service/handler/CardanoApi.js +3 -1
  37. package/cjs/services/chain-service/handler/SubstrateApi.js +0 -2
  38. package/cjs/services/chain-service/handler/light-client/index.js +1 -2
  39. package/cjs/services/chain-service/health-check/index.js +0 -1
  40. package/cjs/services/chain-service/health-check/utils/new-utils/chain-asset-validate.js +0 -1
  41. package/cjs/services/chain-service/index.js +19 -26
  42. package/cjs/services/chain-service/utils/index.js +21 -25
  43. package/cjs/services/chain-service/utils/patch.js +1 -1
  44. package/cjs/services/earning-service/handlers/base.js +32 -0
  45. package/cjs/services/earning-service/handlers/lending/base.js +0 -2
  46. package/cjs/services/earning-service/handlers/liquid-staking/acala.js +0 -1
  47. package/cjs/services/earning-service/handlers/liquid-staking/base.js +0 -2
  48. package/cjs/services/earning-service/handlers/liquid-staking/bifrost.js +0 -2
  49. package/cjs/services/earning-service/handlers/liquid-staking/parallel.js +0 -1
  50. package/cjs/services/earning-service/handlers/native-staking/astar.js +0 -2
  51. package/cjs/services/earning-service/handlers/native-staking/dtao.js +43 -2
  52. package/cjs/services/earning-service/handlers/native-staking/energy.js +0 -1
  53. package/cjs/services/earning-service/handlers/native-staking/mythos.js +0 -2
  54. package/cjs/services/earning-service/handlers/native-staking/para-chain.js +0 -2
  55. package/cjs/services/earning-service/handlers/native-staking/relay-chain.js +8 -9
  56. package/cjs/services/earning-service/handlers/special.js +7 -0
  57. package/cjs/services/history-service/subsquid-multi-chain-history.js +0 -1
  58. package/cjs/services/keyring-service/context/handlers/Derive.js +1 -1
  59. package/cjs/services/keyring-service/context/handlers/Migration.js +11 -9
  60. package/cjs/services/keyring-service/context/handlers/Mnemonic.js +18 -13
  61. package/cjs/services/keyring-service/context/state.js +21 -3
  62. package/cjs/services/keyring-service/utils.js +12 -2
  63. package/cjs/services/migration-service/index.js +1 -2
  64. package/cjs/services/migration-service/scripts/MigrateTransactionHistoryBySymbol20251223.js +55 -0
  65. package/cjs/services/migration-service/scripts/databases/MigrateAssetSetting20251223.js +41 -0
  66. package/cjs/services/migration-service/scripts/index.js +17 -13
  67. package/cjs/services/mint-campaign-service/campaigns/UnlockDotCampaign.js +0 -1
  68. package/cjs/services/nft-service/index.js +5 -0
  69. package/cjs/services/open-gov/handler.js +0 -2
  70. package/cjs/services/open-gov/interface.js +4 -1
  71. package/cjs/services/request-service/handler/BitcoinRequestHandler.js +1 -2
  72. package/cjs/services/request-service/handler/CardanoRequestHandler.js +0 -1
  73. package/cjs/services/request-service/handler/EvmRequestHandler.js +0 -1
  74. package/cjs/services/request-service/handler/TonRequestHandler.js +0 -1
  75. package/cjs/services/request-service/helper/index.js +1 -2
  76. package/cjs/services/storage-service/DatabaseService.js +0 -2
  77. package/cjs/services/storage-service/databases/index.js +2 -0
  78. package/cjs/services/substrate-proxy-service/constant.js +26 -0
  79. package/cjs/services/substrate-proxy-service/index.js +170 -0
  80. package/cjs/services/swap-service/handler/asset-hub/handler.js +0 -1
  81. package/cjs/services/swap-service/handler/asset-hub/router.js +0 -1
  82. package/cjs/services/swap-service/handler/chainflip-handler.js +1 -4
  83. package/cjs/services/swap-service/handler/hydradx-handler.js +0 -1
  84. package/cjs/services/swap-service/handler/kyber-handler.js +0 -1
  85. package/cjs/services/swap-service/handler/optimex-handler.js +1 -2
  86. package/cjs/services/swap-service/handler/simpleswap-handler.js +1 -3
  87. package/cjs/services/swap-service/handler/uniswap-handler.js +0 -3
  88. package/cjs/services/transaction-service/event-parser/index.js +6 -6
  89. package/cjs/services/transaction-service/index.js +105 -37
  90. package/cjs/services/transaction-service/utils.js +8 -5
  91. package/cjs/services/wallet-connect-service/index.js +21 -18
  92. package/cjs/services/wallet-connect-service/types.js +1 -1
  93. package/cjs/types/account/info/keyring.js +9 -1
  94. package/cjs/types/balance/index.js +5 -1
  95. package/cjs/types/index.js +11 -0
  96. package/cjs/types/substrateProxyAccount/actions/index.js +1 -0
  97. package/cjs/types/substrateProxyAccount/index.js +16 -0
  98. package/cjs/types/swap/index.js +2 -1
  99. package/cjs/types/transaction/process.js +2 -0
  100. package/cjs/types/yield/actions/join/step.js +17 -1
  101. package/cjs/utils/account/common.js +0 -26
  102. package/cjs/utils/account/derive/info/solo.js +7 -4
  103. package/cjs/utils/account/derive/validate.js +1 -1
  104. package/cjs/utils/account/transform.js +10 -5
  105. package/cjs/utils/auth.js +1 -1
  106. package/cjs/utils/bitcoin/utxo-management.js +0 -1
  107. package/cjs/utils/environment.js +2 -1
  108. package/cjs/utils/fee/transfer.js +5 -4
  109. package/cjs/utils/index.js +1 -2
  110. package/constants/blocked-actions.js +3 -0
  111. package/core/logic-validation/recipientAddress.js +1 -1
  112. package/core/logic-validation/swap.js +0 -3
  113. package/core/logic-validation/transfer.d.ts +3 -3
  114. package/core/logic-validation/transfer.js +34 -11
  115. package/core/substrate/system-pallet.js +0 -2
  116. package/core/types.d.ts +2 -1
  117. package/core/types.js +1 -0
  118. package/koni/api/nft/wasm_nft/index.js +0 -1
  119. package/koni/api/staking/bonding/astar.js +0 -2
  120. package/koni/api/staking/bonding/paraChain.js +0 -3
  121. package/koni/api/staking/bonding/relayChain.js +2 -4
  122. package/koni/api/staking/bonding/utils.js +0 -4
  123. package/koni/background/cron.js +0 -1
  124. package/koni/background/handlers/Extension.d.ts +3 -0
  125. package/koni/background/handlers/Extension.js +89 -19
  126. package/koni/background/handlers/State.d.ts +2 -0
  127. package/koni/background/handlers/State.js +43 -38
  128. package/koni/background/handlers/Tabs.js +9 -3
  129. package/package.json +50 -21
  130. package/packageInfo.js +1 -1
  131. package/page/substrate/PostMessageProvider.js +3 -0
  132. package/services/balance-service/helpers/subscribe/cardano/utils.js +0 -1
  133. package/services/balance-service/helpers/subscribe/substrate/gear.js +0 -2
  134. package/services/balance-service/helpers/subscribe/substrate/index.js +47 -4
  135. package/services/balance-service/helpers/subscribe/ton/utils.js +0 -3
  136. package/services/balance-service/index.d.ts +8 -0
  137. package/services/balance-service/index.js +105 -9
  138. package/services/balance-service/transfer/bitcoin-transfer.js +0 -1
  139. package/services/balance-service/transfer/smart-contract.js +0 -1
  140. package/services/balance-service/transfer/token.d.ts +0 -4
  141. package/services/balance-service/transfer/token.js +12 -35
  142. package/services/balance-service/transfer/ton-transfer.js +0 -1
  143. package/services/balance-service/transfer/xcm/index.js +3 -8
  144. package/services/balance-service/transfer/xcm/snowBridge.js +0 -1
  145. package/services/balance-service/transfer/xcm/utils.d.ts +0 -2
  146. package/services/balance-service/transfer/xcm/utils.js +1 -1
  147. package/services/chain-service/constants.d.ts +1 -1
  148. package/services/chain-service/constants.js +4 -4
  149. package/services/chain-service/handler/CardanoApi.js +3 -1
  150. package/services/chain-service/handler/SubstrateApi.js +0 -2
  151. package/services/chain-service/health-check/index.js +0 -1
  152. package/services/chain-service/health-check/utils/new-utils/chain-asset-validate.js +0 -1
  153. package/services/chain-service/index.d.ts +0 -1
  154. package/services/chain-service/index.js +16 -23
  155. package/services/chain-service/utils/index.js +22 -26
  156. package/services/chain-service/utils/patch.d.ts +1 -1
  157. package/services/chain-service/utils/patch.js +1 -1
  158. package/services/earning-service/handlers/base.js +32 -0
  159. package/services/earning-service/handlers/lending/base.js +0 -2
  160. package/services/earning-service/handlers/liquid-staking/acala.js +0 -1
  161. package/services/earning-service/handlers/liquid-staking/base.js +0 -2
  162. package/services/earning-service/handlers/liquid-staking/bifrost.js +0 -2
  163. package/services/earning-service/handlers/liquid-staking/parallel.js +0 -1
  164. package/services/earning-service/handlers/native-staking/astar.js +0 -2
  165. package/services/earning-service/handlers/native-staking/dtao.js +43 -0
  166. package/services/earning-service/handlers/native-staking/energy.js +0 -1
  167. package/services/earning-service/handlers/native-staking/mythos.js +0 -2
  168. package/services/earning-service/handlers/native-staking/para-chain.js +0 -2
  169. package/services/earning-service/handlers/native-staking/relay-chain.js +8 -9
  170. package/services/earning-service/handlers/special.js +7 -0
  171. package/services/history-service/subsquid-multi-chain-history.js +0 -1
  172. package/services/keyring-service/context/handlers/Derive.js +2 -2
  173. package/services/keyring-service/context/handlers/Migration.js +3 -1
  174. package/services/keyring-service/context/handlers/Mnemonic.d.ts +1 -1
  175. package/services/keyring-service/context/handlers/Mnemonic.js +16 -10
  176. package/services/keyring-service/context/state.d.ts +3 -0
  177. package/services/keyring-service/context/state.js +21 -3
  178. package/services/keyring-service/utils.d.ts +1 -0
  179. package/services/keyring-service/utils.js +9 -0
  180. package/services/migration-service/scripts/MigrateTransactionHistoryBySymbol20251223.d.ts +4 -0
  181. package/services/migration-service/scripts/MigrateTransactionHistoryBySymbol20251223.js +46 -0
  182. package/services/migration-service/scripts/databases/MigrateAssetSetting20251223.d.ts +4 -0
  183. package/services/migration-service/scripts/databases/MigrateAssetSetting20251223.js +33 -0
  184. package/services/migration-service/scripts/index.js +8 -4
  185. package/services/mint-campaign-service/campaigns/UnlockDotCampaign.js +0 -1
  186. package/services/nft-service/index.js +6 -0
  187. package/services/open-gov/handler.js +0 -2
  188. package/services/open-gov/interface.d.ts +4 -3
  189. package/services/open-gov/interface.js +4 -1
  190. package/services/request-service/handler/CardanoRequestHandler.js +0 -1
  191. package/services/request-service/handler/EvmRequestHandler.js +0 -1
  192. package/services/request-service/handler/TonRequestHandler.js +0 -1
  193. package/services/setting-service/constants.js +0 -1
  194. package/services/storage-service/DatabaseService.js +0 -2
  195. package/services/storage-service/databases/index.js +3 -0
  196. package/services/substrate-proxy-service/constant.d.ts +3 -0
  197. package/services/substrate-proxy-service/constant.js +19 -0
  198. package/services/substrate-proxy-service/index.d.ts +13 -0
  199. package/services/substrate-proxy-service/index.js +159 -0
  200. package/services/swap-service/handler/asset-hub/handler.js +0 -1
  201. package/services/swap-service/handler/asset-hub/router.js +0 -1
  202. package/services/swap-service/handler/chainflip-handler.js +0 -2
  203. package/services/swap-service/handler/hydradx-handler.js +0 -1
  204. package/services/swap-service/handler/kyber-handler.js +0 -1
  205. package/services/swap-service/handler/simpleswap-handler.js +0 -1
  206. package/services/swap-service/handler/uniswap-handler.js +0 -3
  207. package/services/transaction-service/event-parser/index.js +6 -6
  208. package/services/transaction-service/index.js +79 -11
  209. package/services/transaction-service/types.d.ts +2 -2
  210. package/services/transaction-service/utils.js +8 -5
  211. package/services/wallet-connect-service/index.js +21 -18
  212. package/services/wallet-connect-service/types.js +1 -1
  213. package/types/account/action/add/mnemonic.d.ts +3 -2
  214. package/types/account/info/keyring.js +9 -1
  215. package/types/balance/index.js +5 -1
  216. package/types/balance/transfer.d.ts +1 -0
  217. package/types/index.d.ts +1 -0
  218. package/types/index.js +1 -0
  219. package/types/substrateProxyAccount/actions/index.d.ts +17 -0
  220. package/types/substrateProxyAccount/actions/index.js +1 -0
  221. package/types/substrateProxyAccount/index.d.ts +23 -0
  222. package/types/substrateProxyAccount/index.js +8 -0
  223. package/types/swap/index.js +2 -1
  224. package/types/transaction/process.js +3 -1
  225. package/types/transaction/request.d.ts +1 -0
  226. package/types/yield/actions/join/step.js +17 -1
  227. package/types/yield/actions/join/submit.d.ts +1 -1
  228. package/utils/account/common.d.ts +0 -3
  229. package/utils/account/common.js +0 -24
  230. package/utils/account/derive/info/solo.js +8 -5
  231. package/utils/account/derive/validate.d.ts +2 -2
  232. package/utils/account/derive/validate.js +1 -1
  233. package/utils/account/transform.js +10 -5
  234. package/utils/auth.js +2 -2
  235. package/utils/bitcoin/utxo-management.js +0 -1
  236. package/utils/fee/transfer.js +4 -2
  237. package/utils/index.js +2 -5
@@ -18,6 +18,7 @@ export interface ResponseSubscribeTransfer {
18
18
  feePercentageSpecialCase?: number;
19
19
  error?: string;
20
20
  isEvmRpcError?: boolean;
21
+ maxTransferableWithoutFee: string;
21
22
  }
22
23
  export interface RequestSubmitTransferWithId extends RequestSubmitTransfer {
23
24
  id?: string;
package/types/index.d.ts CHANGED
@@ -24,3 +24,4 @@ export * from './transaction';
24
24
  export * from './yield';
25
25
  export * from './setting';
26
26
  export * from './bitcoin';
27
+ export * from './substrateProxyAccount';
package/types/index.js CHANGED
@@ -17,4 +17,5 @@ export * from "./transaction/index.js";
17
17
  export * from "./yield/index.js";
18
18
  export * from "./setting.js";
19
19
  export * from "./bitcoin.js";
20
+ export * from "./substrateProxyAccount/index.js";
20
21
  export {};
@@ -0,0 +1,17 @@
1
+ import { BaseRequestSign, InternalRequestSign } from '../../transaction';
2
+ import { SubstrateProxyAccountItem, SubstrateProxyType } from '..';
3
+ export interface AddSubstrateProxyAccountParams extends BaseRequestSign {
4
+ address: string;
5
+ chain: string;
6
+ substrateProxyAddress: string;
7
+ substrateProxyType: SubstrateProxyType;
8
+ substrateProxyDeposit: string;
9
+ }
10
+ export declare type RequestAddSubstrateProxyAccount = InternalRequestSign<AddSubstrateProxyAccountParams>;
11
+ export interface RemoveSubstrateProxyAccountParams extends BaseRequestSign {
12
+ address: string;
13
+ chain: string;
14
+ selectedSubstrateProxyAccounts: SubstrateProxyAccountItem[];
15
+ isRemoveAll?: boolean;
16
+ }
17
+ export declare type RequestRemoveSubstrateProxyAccount = InternalRequestSign<RemoveSubstrateProxyAccountParams>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,23 @@
1
+ import { ExtrinsicType } from '@subwallet/extension-base/background/KoniTypes';
2
+ export interface ExcludedSubstrateProxyAccounts {
3
+ address: string;
4
+ substrateProxyType: SubstrateProxyType;
5
+ }
6
+ export interface RequestGetSubstrateProxyAccountGroup {
7
+ chain: string;
8
+ address: string;
9
+ type?: ExtrinsicType;
10
+ excludedSubstrateProxyAccounts?: ExcludedSubstrateProxyAccounts[];
11
+ }
12
+ export declare type SubstrateProxyType = 'Any' | 'NonTransfer' | 'Governance' | 'Staking';
13
+ export interface SubstrateProxyAccountItem {
14
+ substrateProxyAddress: string;
15
+ substrateProxyType: SubstrateProxyType;
16
+ delay: number;
17
+ proxyId?: string;
18
+ }
19
+ export interface SubstrateProxyAccountGroup {
20
+ substrateProxyAccounts: SubstrateProxyAccountItem[];
21
+ substrateProxyDeposit: string;
22
+ }
23
+ export * from './actions';
@@ -0,0 +1,8 @@
1
+ // Copyright 2019-2022 @subwallet/extension-base
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ // All possible proxy types in Substrate in this article: https://wiki.polkadot.com/learn/learn-proxies/#proxy-types
5
+ // Only support these 4 types for now
6
+
7
+ export * from "./actions/index.js";
8
+ export {};
@@ -50,7 +50,8 @@ export let SwapFeeType;
50
50
  SwapFeeType["PLATFORM_FEE"] = "PLATFORM_FEE";
51
51
  SwapFeeType["NETWORK_FEE"] = "NETWORK_FEE";
52
52
  SwapFeeType["WALLET_FEE"] = "WALLET_FEE";
53
- })(SwapFeeType || (SwapFeeType = {}));
53
+ })(SwapFeeType || (SwapFeeType = {})); // todo: will be more
54
+ // parameters & responses
54
55
  export let DynamicSwapType;
55
56
  (function (DynamicSwapType) {
56
57
  DynamicSwapType["SWAP"] = "SWAP";
@@ -17,4 +17,6 @@ export let StepStatus;
17
17
  StepStatus["CANCELLED"] = "CANCELLED";
18
18
  StepStatus["TIMEOUT"] = "TIMEOUT";
19
19
  })(StepStatus || (StepStatus = {}));
20
- export const PROCESSING_STEP_STATUS = [StepStatus.PREPARE, StepStatus.SUBMITTING, StepStatus.PROCESSING];
20
+ export const PROCESSING_STEP_STATUS = [StepStatus.PREPARE, StepStatus.SUBMITTING, StepStatus.PROCESSING];
21
+
22
+ // temp for avoid conflict // todo: recheck to refactor BriefXcmStepV2 and BriefSwapStepV2 later;
@@ -2,6 +2,7 @@ import { TransactionFee } from '../fee';
2
2
  import { TransactionWarningType } from './warning';
3
3
  export declare type BaseRequestSign = {
4
4
  ignoreWarnings?: TransactionWarningType[];
5
+ signerSubstrateProxyAddress?: string;
5
6
  };
6
7
  export declare type InternalRequestSign<T> = T & BaseRequestSign;
7
8
  export interface RequestBaseTransfer {
@@ -44,4 +44,20 @@ export let YieldStepType;
44
44
  YieldStepType["MINT_SDOT"] = "MINT_SDOT";
45
45
  YieldStepType["MINT_STDOT"] = "MINT_STDOT";
46
46
  YieldStepType["TOKEN_APPROVAL"] = "TOKEN_APPROVAL";
47
- })(YieldStepType || (YieldStepType = {}));
47
+ })(YieldStepType || (YieldStepType = {}));
48
+ /**
49
+ * @interface YieldStepDetail
50
+ * @extends BaseYieldStepDetail
51
+ * @description Detail of a step
52
+ * @prop {number} id - Step's id
53
+ * */
54
+ /**
55
+ * @interface YieldTokenBaseInfo
56
+ * @prop {string} slug - Token's slug
57
+ * @prop {string} [amount] - Token's amount
58
+ * */
59
+ /** Base info and fee of a step */
60
+ /**
61
+ * @interface OptimalYieldPath
62
+ * @description Result after generate steps
63
+ * */
@@ -86,7 +86,7 @@ export interface BondingSubmitParams extends BaseRequestSign {
86
86
  };
87
87
  }
88
88
  export declare type RequestBondingSubmit = InternalRequestSign<BondingSubmitParams>;
89
- export declare type SubmitChangeValidatorStaking = SubmitBittensorChangeValidatorStaking | SubmitJoinNativeStaking;
89
+ export declare type SubmitChangeValidatorStaking = InternalRequestSign<SubmitBittensorChangeValidatorStaking | SubmitJoinNativeStaking>;
90
90
  export interface SubmitBittensorChangeValidatorStaking extends SubmitJoinNativeStaking {
91
91
  originValidator: string;
92
92
  maxAmount: string;
@@ -1,7 +1,6 @@
1
1
  import { _ChainInfo } from '@subwallet/chain-list/types';
2
2
  import { ChainType } from '@subwallet/extension-base/background/KoniTypes';
3
3
  import { AccountChainType, AccountJson } from '@subwallet/extension-base/types';
4
- import { KeypairType } from '@subwallet/keyring/types';
5
4
  export declare function isAccountAll(address?: string): boolean;
6
5
  export declare function reformatAddress(address: string, networkPrefix?: number, isEthereum?: boolean, ignoreError?: boolean): string;
7
6
  export declare const _reformatAddressWithChain: (address: string, chainInfo: _ChainInfo) => string;
@@ -15,8 +14,6 @@ interface ExtendAddressesByChainType extends AddressesByChainType {
15
14
  export declare function getAddressesByChainType(addresses: string[], chainTypes: ChainType[], chainInfo?: _ChainInfo): string[];
16
15
  export declare function getAddressesByChainTypeMap(addresses: string[], chainInfo?: _ChainInfo): ExtendAddressesByChainType;
17
16
  export declare function quickFormatAddressToCompare(address?: string): string | undefined;
18
- /** @deprecated */
19
- export declare const modifyAccountName: (type: KeypairType, name: string, modify: boolean) => string;
20
17
  /**
21
18
  * @function getAccountJsonByAddress
22
19
  * @desc Get account info by address
@@ -63,7 +63,6 @@ export function getAddressesByChainType(addresses, chainTypes, chainInfo) {
63
63
  return addressByChainTypeMap[chainType];
64
64
  }).flat(); // todo: recheck
65
65
  }
66
-
67
66
  export function getAddressesByChainTypeMap(addresses, chainInfo) {
68
67
  const addressByChainType = {
69
68
  substrate: [],
@@ -103,29 +102,6 @@ export function quickFormatAddressToCompare(address) {
103
102
  return reformatAddress(address, 42).toLowerCase();
104
103
  }
105
104
 
106
- /** @deprecated */
107
- export const modifyAccountName = (type, name, modify) => {
108
- if (!modify) {
109
- return name;
110
- }
111
- let network = '';
112
- switch (type) {
113
- case 'sr25519':
114
- case 'ed25519':
115
- case 'ecdsa':
116
- network = 'Substrate';
117
- break;
118
- case 'ethereum':
119
- network = 'EVM';
120
- break;
121
- case 'ton':
122
- case 'ton-native':
123
- network = 'Ton';
124
- break;
125
- }
126
- return network ? [name, network].join(' - ') : name;
127
- };
128
-
129
105
  /**
130
106
  * @function getAccountJsonByAddress
131
107
  * @desc Get account info by address
@@ -2,7 +2,7 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
4
  import { getDerivePath } from '@subwallet/keyring';
5
- import { BitcoinKeypairTypes, EthereumKeypairTypes, SubstrateKeypairTypes } from '@subwallet/keyring/types';
5
+ import { BitcoinKeypairTypes, DefaultSubstrateKeypairTypes, EthereumKeypairTypes } from '@subwallet/keyring/types';
6
6
  import { keyring } from '@subwallet/ui-keyring';
7
7
  import { t } from 'i18next';
8
8
  import { assert } from '@polkadot/util';
@@ -53,7 +53,7 @@ export const parseUnifiedSuriToDerivationPath = (suri, type) => {
53
53
  return path.replace('{firstIndex}', firstIndex);
54
54
  }
55
55
  }
56
- if (SubstrateKeypairTypes.includes(type)) {
56
+ if (DefaultSubstrateKeypairTypes.includes(type)) {
57
57
  return suri;
58
58
  }
59
59
  }
@@ -112,7 +112,7 @@ export const getSoloDerivationInfo = (type, metadata = {}) => {
112
112
  };
113
113
  }
114
114
  } else {
115
- if (SubstrateKeypairTypes.includes(type)) {
115
+ if (DefaultSubstrateKeypairTypes.includes(type)) {
116
116
  const _type = type;
117
117
  const validateTypeFunc = _type === 'sr25519' ? validateSr25519DerivationPath : raw => validateOtherSubstrateDerivationPath(raw, _type);
118
118
  const validateTypeRs = validateTypeFunc(suri);
@@ -243,7 +243,7 @@ export const findSoloNextDerive = parentAddress => {
243
243
  break;
244
244
  }
245
245
  }
246
- const isSubstrate = SubstrateKeypairTypes.includes(parentPair.type);
246
+ const isSubstrate = DefaultSubstrateKeypairTypes.includes(parentPair.type);
247
247
  const indexes = currentDepth > 0 ? deriveInfo.autoIndexes || [] : [];
248
248
  indexes.push(index);
249
249
  const suri = isSubstrate ? [deriveInfo.suri || '', index].join('//') : '//'.concat(indexes.join('//'));
@@ -281,6 +281,9 @@ export const derivePair = (parentPair, name, suri, derivationPath) => {
281
281
  }
282
282
  };
283
283
  export const getSuri = (seed, type) => {
284
- const extraPath = type ? getDerivePath(type)(0) : '';
284
+ if (!type) {
285
+ return seed;
286
+ }
287
+ const extraPath = getDerivePath(type)(0);
285
288
  return seed + (extraPath ? '/' + extraPath : '');
286
289
  };
@@ -1,10 +1,10 @@
1
1
  import { DerivePathInfo, IDerivePathInfo_ } from '@subwallet/extension-base/types';
2
- import { KeypairType, SubstrateKeypairType } from '@subwallet/keyring/types';
2
+ import { DefaultSubstrateKeypairType, KeypairType, TrustWalletSubstrateKeypairType } from '@subwallet/keyring/types';
3
3
  export declare const validateUnifiedDerivationPath: (raw: string) => DerivePathInfo | undefined;
4
4
  export declare const validateEvmDerivationPath: (raw: string) => IDerivePathInfo_ | undefined;
5
5
  export declare const validateTonDerivationPath: (raw: string) => IDerivePathInfo_ | undefined;
6
6
  export declare const validateBitcoinDerivationPath: (raw: string) => IDerivePathInfo_ | undefined;
7
7
  export declare const validateCardanoDerivationPath: (raw: string) => IDerivePathInfo_ | undefined;
8
8
  export declare const validateSr25519DerivationPath: (raw: string) => IDerivePathInfo_ | undefined;
9
- export declare const validateOtherSubstrateDerivationPath: (raw: string, type: Exclude<SubstrateKeypairType, 'sr25519'>) => IDerivePathInfo_ | undefined;
9
+ export declare const validateOtherSubstrateDerivationPath: (raw: string, type: Exclude<DefaultSubstrateKeypairType | TrustWalletSubstrateKeypairType, 'sr25519'>) => IDerivePathInfo_ | undefined;
10
10
  export declare const validateDerivationPath: (raw: string, type?: KeypairType) => DerivePathInfo | undefined;
@@ -246,7 +246,7 @@ export const validateDerivationPath = (raw, type) => {
246
246
  return validateTonDerivationPath(raw);
247
247
  } else if (type === 'sr25519') {
248
248
  return validateSr25519DerivationPath(raw);
249
- } else if (type === 'ed25519' || type === 'ecdsa') {
249
+ } else if (type === 'ed25519' || type === 'ed25519-tw' || type === 'ecdsa') {
250
250
  return validateOtherSubstrateDerivationPath(raw, type);
251
251
  } else if (type === 'cardano') {
252
252
  return validateCardanoDerivationPath(raw);
@@ -105,7 +105,10 @@ export const getAccountActions = (signMode, networkType, type, _meta, parentAcco
105
105
  // QR
106
106
  if (signMode === AccountSignMode.PASSWORD) {
107
107
  if (networkType === AccountChainType.ETHEREUM || networkType === AccountChainType.SUBSTRATE) {
108
- result.push(AccountActions.EXPORT_QR);
108
+ if (type !== 'ed25519-tw') {
109
+ // todo: recheck if can export this account type
110
+ result.push(AccountActions.EXPORT_QR);
111
+ }
109
112
  }
110
113
  }
111
114
 
@@ -154,14 +157,15 @@ const EARN_VMANTA_ACTIONS = [ExtrinsicType.MINT_VMANTA, ExtrinsicType.REDEEM_VMA
154
157
  const EVM_ACTIONS = [ExtrinsicType.TOKEN_SPENDING_APPROVAL, ExtrinsicType.EVM_EXECUTE];
155
158
  const CLAIM_AVAIL_BRIDGE = [ExtrinsicType.CLAIM_BRIDGE];
156
159
  const OPEN_GOV_ACTIONS = [ExtrinsicType.GOV_VOTE, ExtrinsicType.GOV_UNVOTE, ExtrinsicType.GOV_UNLOCK_VOTE];
160
+ const SUBSTRATE_PROXY_ACTION = [ExtrinsicType.ADD_SUBSTRATE_PROXY_ACCOUNT, ExtrinsicType.REMOVE_SUBSTRATE_PROXY_ACCOUNT];
157
161
  const OTHER_ACTIONS = [ExtrinsicType.TRANSFER_XCM, ExtrinsicType.SEND_NFT, ExtrinsicType.SWAP, ExtrinsicType.CROWDLOAN];
158
162
  export const getAccountTransactionActions = (signMode, networkType, type, _meta, _specialNetwork) => {
159
163
  if ([AccountSignMode.PASSWORD, AccountSignMode.INJECTED].includes(signMode)) {
160
164
  switch (networkType) {
161
165
  case AccountChainType.SUBSTRATE:
162
- 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];
166
+ 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, ...SUBSTRATE_PROXY_ACTION, ...OTHER_ACTIONS];
163
167
  case AccountChainType.ETHEREUM:
164
- return [...BASE_TRANSFER_ACTIONS, ...NATIVE_STAKE_ACTIONS, ...POOL_STAKE_ACTIONS, ...EARN_STDOT_ACTIONS, ...OTHER_ACTIONS, ...CLAIM_AVAIL_BRIDGE, ...EVM_ACTIONS];
168
+ return [...BASE_TRANSFER_ACTIONS, ...NATIVE_STAKE_ACTIONS, ...POOL_STAKE_ACTIONS, ...EARN_STDOT_ACTIONS, ...OTHER_ACTIONS, ...CLAIM_AVAIL_BRIDGE, ...SUBSTRATE_PROXY_ACTION, ...EVM_ACTIONS];
165
169
  case AccountChainType.TON:
166
170
  return [...BASE_TRANSFER_ACTIONS];
167
171
  case AccountChainType.CARDANO:
@@ -172,7 +176,7 @@ export const getAccountTransactionActions = (signMode, networkType, type, _meta,
172
176
  } else if (signMode === AccountSignMode.QR) {
173
177
  switch (networkType) {
174
178
  case AccountChainType.SUBSTRATE:
175
- 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];
179
+ 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, ...SUBSTRATE_PROXY_ACTION, ...OTHER_ACTIONS];
176
180
  case AccountChainType.ETHEREUM:
177
181
  return [...(isProductionMode ? [] : [...BASE_TRANSFER_ACTIONS, ...NATIVE_STAKE_ACTIONS, ...POOL_STAKE_ACTIONS, ...EARN_STDOT_ACTIONS, ...CLAIM_AVAIL_BRIDGE, ...OTHER_ACTIONS, ...EVM_ACTIONS])];
178
182
  case AccountChainType.TON:
@@ -187,7 +191,7 @@ export const getAccountTransactionActions = (signMode, networkType, type, _meta,
187
191
  case AccountChainType.SUBSTRATE:
188
192
  return [...BASE_TRANSFER_ACTIONS, ...NATIVE_STAKE_ACTIONS, ...POOL_STAKE_ACTIONS, ...EARN_VDOT_ACTIONS, ...EARN_VMANTA_ACTIONS, ...EARN_LDOT_ACTIONS, ...EARN_SDOT_ACTIONS,
189
193
  // ...EARN_QDOT_ACTIONS,
190
- ...OPEN_GOV_ACTIONS, ...OTHER_ACTIONS];
194
+ ...OPEN_GOV_ACTIONS, ...SUBSTRATE_PROXY_ACTION, ...OTHER_ACTIONS];
191
195
  case AccountChainType.ETHEREUM:
192
196
  return [...BASE_TRANSFER_ACTIONS, ...EARN_STDOT_ACTIONS, ...EVM_ACTIONS, ...CLAIM_AVAIL_BRIDGE, ExtrinsicType.STAKING_WITHDRAW,
193
197
  // For liquid staking
@@ -247,6 +251,7 @@ export const getAccountTokenTypes = type => {
247
251
  return [_AssetType.NATIVE, _AssetType.LOCAL, _AssetType.ERC20, _AssetType.ERC721];
248
252
  case 'sr25519':
249
253
  case 'ed25519':
254
+ case 'ed25519-tw':
250
255
  case 'ecdsa':
251
256
  return [_AssetType.NATIVE, _AssetType.LOCAL, _AssetType.PSP22, _AssetType.PSP34, _AssetType.GRC20, _AssetType.ERC721, _AssetType.VFT];
252
257
  case 'ton':
package/utils/auth.js CHANGED
@@ -2,12 +2,12 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
4
  import { getKeypairTypeByAddress } from '@subwallet/keyring';
5
- import { BitcoinKeypairTypes, CardanoKeypairTypes, EthereumKeypairTypes, SubstrateKeypairTypes, TonKeypairTypes } from '@subwallet/keyring/types';
5
+ import { AllSubstrateKeypairTypes, BitcoinKeypairTypes, CardanoKeypairTypes, EthereumKeypairTypes, TonKeypairTypes } from '@subwallet/keyring/types';
6
6
  export const isAddressValidWithAuthType = (address, accountAuthTypes) => {
7
7
  const keypairType = getKeypairTypeByAddress(address);
8
8
  const validTypes = {
9
9
  evm: EthereumKeypairTypes,
10
- substrate: SubstrateKeypairTypes,
10
+ substrate: AllSubstrateKeypairTypes,
11
11
  ton: TonKeypairTypes,
12
12
  cardano: CardanoKeypairTypes,
13
13
  bitcoin: BitcoinKeypairTypes
@@ -234,7 +234,6 @@ export async function getRuneUtxos(bitcoinApi, address) {
234
234
  status: {
235
235
  confirmed: true // not use in filter out rune utxos
236
236
  },
237
-
238
237
  value: utxoValue
239
238
  };
240
239
  runeUtxos.push(item);
@@ -319,7 +319,8 @@ export const calculateTransferMaxTransferable = async (id, request, freeBalance,
319
319
  feeType: feeChainType,
320
320
  id: id,
321
321
  error,
322
- isEvmRpcError: isEvmRpcError
322
+ isEvmRpcError: isEvmRpcError,
323
+ maxTransferableWithoutFee: freeBalance.value
323
324
  };
324
325
  };
325
326
  export const calculateXcmMaxTransferable = async (id, request, freeBalance, fee) => {
@@ -510,7 +511,8 @@ export const calculateXcmMaxTransferable = async (id, request, freeBalance, fee)
510
511
  feeOptions: feeOptions,
511
512
  feeType: feeChainType,
512
513
  id: id,
513
- error
514
+ error,
515
+ maxTransferableWithoutFee: freeBalance.value
514
516
  };
515
517
  };
516
518
  export const isEvmEIP1559FeeDetail = fee => {
package/utils/index.js CHANGED
@@ -6,7 +6,7 @@ import { getRandomIpfsGateway, SUBWALLET_IPFS } from '@subwallet/extension-base/
6
6
  import { _isChainEvmCompatible, _isPureBitcoinChain, _isPureCardanoChain, _isPureSubstrateChain, _isPureTonChain } from '@subwallet/extension-base/services/chain-service/utils';
7
7
  import { reformatAddress } from '@subwallet/extension-base/utils/account';
8
8
  import { decodeAddress, encodeAddress, getKeypairTypeByAddress, isTonAddress } from '@subwallet/keyring';
9
- import { BitcoinKeypairTypes, CardanoKeypairTypes, EthereumKeypairTypes, SubstrateKeypairTypes, TonKeypairTypes } from '@subwallet/keyring/types';
9
+ import { AllSubstrateKeypairTypes, BitcoinKeypairTypes, CardanoKeypairTypes, EthereumKeypairTypes, TonKeypairTypes } from '@subwallet/keyring/types';
10
10
  import { t } from 'i18next';
11
11
  import { assert, BN, hexToU8a, isHex } from '@polkadot/util';
12
12
  import { ethereumEncode, isEthereumAddress } from '@polkadot/util-crypto';
@@ -244,7 +244,6 @@ export function isSameAddress(address1, address2) {
244
244
  }
245
245
  return reformatAddress(address1, 0) === reformatAddress(address2, 0); // TODO: maybe there's a better way
246
246
  }
247
-
248
247
  export function isSameAddressType(address1, address2) {
249
248
  const isSameEvmAddress = isEthereumAddress(address1) && isEthereumAddress(address2);
250
249
  const isSameTonAddress = isTonAddress(address1) && isTonAddress(address2);
@@ -256,7 +255,7 @@ export function isAddressAndChainCompatible(address, chain) {
256
255
  const keypairType = getKeypairTypeByAddress(address);
257
256
  const isEvmCompatible = _isChainEvmCompatible(chain) && EthereumKeypairTypes.includes(keypairType); // some chains compatible to substrate and evm, and use evm-address
258
257
  const isTonCompatible = _isPureTonChain(chain) && TonKeypairTypes.includes(keypairType);
259
- const isSubstrateCompatible = _isPureSubstrateChain(chain) && SubstrateKeypairTypes.includes(keypairType);
258
+ const isSubstrateCompatible = _isPureSubstrateChain(chain) && AllSubstrateKeypairTypes.includes(keypairType);
260
259
  const isCardanoCompatible = _isPureCardanoChain(chain) && CardanoKeypairTypes.includes(keypairType);
261
260
  const isBitcoinCompatible = _isPureBitcoinChain(chain) && BitcoinKeypairTypes.includes(keypairType);
262
261
  return isEvmCompatible || isSubstrateCompatible || isTonCompatible || isCardanoCompatible || isBitcoinCompatible;
@@ -319,7 +318,6 @@ export const baseParseIPFSUrl = (input, customDomain) => {
319
318
  }
320
319
  return selectedDomain + input.split('ipfs://ipfs/')[1]; // starts with ipfs://ipfs/
321
320
  };
322
-
323
321
  export const swParseIPFSUrl = input => {
324
322
  if (!input || input.length === 0) {
325
323
  return undefined;
@@ -343,7 +341,6 @@ export const swParseIPFSUrl = input => {
343
341
  }
344
342
  return SUBWALLET_IPFS + input.split('ipfs://ipfs/')[1]; // starts with ipfs://ipfs/
345
343
  };
346
-
347
344
  export function wait(milliseconds) {
348
345
  return new Promise(resolve => {
349
346
  setTimeout(() => {