@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.
- package/background/KoniTypes.d.ts +13 -2
- package/background/KoniTypes.js +68 -9
- package/cjs/background/KoniTypes.js +68 -9
- package/cjs/constants/blocked-actions.js +3 -0
- package/cjs/core/logic-validation/recipientAddress.js +1 -1
- package/cjs/core/logic-validation/swap.js +0 -3
- package/cjs/core/logic-validation/transfer.js +33 -10
- package/cjs/core/substrate/system-pallet.js +0 -2
- package/cjs/core/types.js +1 -0
- package/cjs/koni/api/nft/wasm_nft/index.js +0 -1
- package/cjs/koni/api/staking/bonding/astar.js +0 -2
- package/cjs/koni/api/staking/bonding/paraChain.js +0 -3
- package/cjs/koni/api/staking/bonding/relayChain.js +2 -4
- package/cjs/koni/api/staking/bonding/utils.js +0 -4
- package/cjs/koni/background/cron.js +0 -1
- package/cjs/koni/background/handlers/Extension.js +235 -166
- package/cjs/koni/background/handlers/State.js +56 -52
- package/cjs/koni/background/handlers/Tabs.js +39 -34
- package/cjs/packageInfo.js +1 -1
- package/cjs/page/index.js +7 -0
- package/cjs/page/substrate/PostMessageProvider.js +3 -0
- package/cjs/services/balance-service/helpers/subscribe/cardano/utils.js +0 -1
- package/cjs/services/balance-service/helpers/subscribe/substrate/gear.js +0 -2
- package/cjs/services/balance-service/helpers/subscribe/substrate/index.js +48 -5
- package/cjs/services/balance-service/helpers/subscribe/ton/utils.js +0 -3
- package/cjs/services/balance-service/index.js +103 -7
- package/cjs/services/balance-service/transfer/bitcoin-transfer.js +0 -1
- package/cjs/services/balance-service/transfer/cardano-transfer.js +1 -2
- package/cjs/services/balance-service/transfer/smart-contract.js +0 -1
- package/cjs/services/balance-service/transfer/token.js +13 -37
- package/cjs/services/balance-service/transfer/ton-transfer.js +0 -1
- package/cjs/services/balance-service/transfer/xcm/index.js +3 -8
- package/cjs/services/balance-service/transfer/xcm/snowBridge.js +0 -1
- package/cjs/services/balance-service/transfer/xcm/utils.js +1 -1
- package/cjs/services/chain-service/constants.js +6 -5
- package/cjs/services/chain-service/handler/CardanoApi.js +3 -1
- package/cjs/services/chain-service/handler/SubstrateApi.js +0 -2
- package/cjs/services/chain-service/handler/light-client/index.js +1 -2
- package/cjs/services/chain-service/health-check/index.js +0 -1
- package/cjs/services/chain-service/health-check/utils/new-utils/chain-asset-validate.js +0 -1
- package/cjs/services/chain-service/index.js +19 -26
- package/cjs/services/chain-service/utils/index.js +21 -25
- package/cjs/services/chain-service/utils/patch.js +1 -1
- package/cjs/services/earning-service/handlers/base.js +32 -0
- package/cjs/services/earning-service/handlers/lending/base.js +0 -2
- package/cjs/services/earning-service/handlers/liquid-staking/acala.js +0 -1
- package/cjs/services/earning-service/handlers/liquid-staking/base.js +0 -2
- package/cjs/services/earning-service/handlers/liquid-staking/bifrost.js +0 -2
- package/cjs/services/earning-service/handlers/liquid-staking/parallel.js +0 -1
- package/cjs/services/earning-service/handlers/native-staking/astar.js +0 -2
- package/cjs/services/earning-service/handlers/native-staking/dtao.js +43 -2
- package/cjs/services/earning-service/handlers/native-staking/energy.js +0 -1
- package/cjs/services/earning-service/handlers/native-staking/mythos.js +0 -2
- package/cjs/services/earning-service/handlers/native-staking/para-chain.js +0 -2
- package/cjs/services/earning-service/handlers/native-staking/relay-chain.js +8 -9
- package/cjs/services/earning-service/handlers/special.js +7 -0
- package/cjs/services/history-service/subsquid-multi-chain-history.js +0 -1
- package/cjs/services/keyring-service/context/handlers/Derive.js +1 -1
- package/cjs/services/keyring-service/context/handlers/Migration.js +11 -9
- package/cjs/services/keyring-service/context/handlers/Mnemonic.js +18 -13
- package/cjs/services/keyring-service/context/state.js +21 -3
- package/cjs/services/keyring-service/utils.js +12 -2
- package/cjs/services/migration-service/index.js +1 -2
- package/cjs/services/migration-service/scripts/MigrateTransactionHistoryBySymbol20251223.js +55 -0
- package/cjs/services/migration-service/scripts/databases/MigrateAssetSetting20251223.js +41 -0
- package/cjs/services/migration-service/scripts/index.js +17 -13
- package/cjs/services/mint-campaign-service/campaigns/UnlockDotCampaign.js +0 -1
- package/cjs/services/nft-service/index.js +5 -0
- package/cjs/services/open-gov/handler.js +0 -2
- package/cjs/services/open-gov/interface.js +4 -1
- package/cjs/services/request-service/handler/BitcoinRequestHandler.js +1 -2
- package/cjs/services/request-service/handler/CardanoRequestHandler.js +0 -1
- package/cjs/services/request-service/handler/EvmRequestHandler.js +0 -1
- package/cjs/services/request-service/handler/TonRequestHandler.js +0 -1
- package/cjs/services/request-service/helper/index.js +1 -2
- package/cjs/services/storage-service/DatabaseService.js +0 -2
- package/cjs/services/storage-service/databases/index.js +2 -0
- package/cjs/services/substrate-proxy-service/constant.js +26 -0
- package/cjs/services/substrate-proxy-service/index.js +170 -0
- package/cjs/services/swap-service/handler/asset-hub/handler.js +0 -1
- package/cjs/services/swap-service/handler/asset-hub/router.js +0 -1
- package/cjs/services/swap-service/handler/chainflip-handler.js +1 -4
- package/cjs/services/swap-service/handler/hydradx-handler.js +0 -1
- package/cjs/services/swap-service/handler/kyber-handler.js +0 -1
- package/cjs/services/swap-service/handler/optimex-handler.js +1 -2
- package/cjs/services/swap-service/handler/simpleswap-handler.js +1 -3
- package/cjs/services/swap-service/handler/uniswap-handler.js +0 -3
- package/cjs/services/transaction-service/event-parser/index.js +6 -6
- package/cjs/services/transaction-service/index.js +105 -37
- package/cjs/services/transaction-service/utils.js +8 -5
- package/cjs/services/wallet-connect-service/index.js +21 -18
- package/cjs/services/wallet-connect-service/types.js +1 -1
- package/cjs/types/account/info/keyring.js +9 -1
- package/cjs/types/balance/index.js +5 -1
- package/cjs/types/index.js +11 -0
- package/cjs/types/substrateProxyAccount/actions/index.js +1 -0
- package/cjs/types/substrateProxyAccount/index.js +16 -0
- package/cjs/types/swap/index.js +2 -1
- package/cjs/types/transaction/process.js +2 -0
- package/cjs/types/yield/actions/join/step.js +17 -1
- package/cjs/utils/account/common.js +0 -26
- package/cjs/utils/account/derive/info/solo.js +7 -4
- package/cjs/utils/account/derive/validate.js +1 -1
- package/cjs/utils/account/transform.js +10 -5
- package/cjs/utils/auth.js +1 -1
- package/cjs/utils/bitcoin/utxo-management.js +0 -1
- package/cjs/utils/environment.js +2 -1
- package/cjs/utils/fee/transfer.js +5 -4
- package/cjs/utils/index.js +1 -2
- package/constants/blocked-actions.js +3 -0
- package/core/logic-validation/recipientAddress.js +1 -1
- package/core/logic-validation/swap.js +0 -3
- package/core/logic-validation/transfer.d.ts +3 -3
- package/core/logic-validation/transfer.js +34 -11
- package/core/substrate/system-pallet.js +0 -2
- package/core/types.d.ts +2 -1
- package/core/types.js +1 -0
- package/koni/api/nft/wasm_nft/index.js +0 -1
- package/koni/api/staking/bonding/astar.js +0 -2
- package/koni/api/staking/bonding/paraChain.js +0 -3
- package/koni/api/staking/bonding/relayChain.js +2 -4
- package/koni/api/staking/bonding/utils.js +0 -4
- package/koni/background/cron.js +0 -1
- package/koni/background/handlers/Extension.d.ts +3 -0
- package/koni/background/handlers/Extension.js +89 -19
- package/koni/background/handlers/State.d.ts +2 -0
- package/koni/background/handlers/State.js +43 -38
- package/koni/background/handlers/Tabs.js +9 -3
- package/package.json +50 -21
- package/packageInfo.js +1 -1
- package/page/substrate/PostMessageProvider.js +3 -0
- package/services/balance-service/helpers/subscribe/cardano/utils.js +0 -1
- package/services/balance-service/helpers/subscribe/substrate/gear.js +0 -2
- package/services/balance-service/helpers/subscribe/substrate/index.js +47 -4
- package/services/balance-service/helpers/subscribe/ton/utils.js +0 -3
- package/services/balance-service/index.d.ts +8 -0
- package/services/balance-service/index.js +105 -9
- package/services/balance-service/transfer/bitcoin-transfer.js +0 -1
- package/services/balance-service/transfer/smart-contract.js +0 -1
- package/services/balance-service/transfer/token.d.ts +0 -4
- package/services/balance-service/transfer/token.js +12 -35
- package/services/balance-service/transfer/ton-transfer.js +0 -1
- package/services/balance-service/transfer/xcm/index.js +3 -8
- package/services/balance-service/transfer/xcm/snowBridge.js +0 -1
- package/services/balance-service/transfer/xcm/utils.d.ts +0 -2
- package/services/balance-service/transfer/xcm/utils.js +1 -1
- package/services/chain-service/constants.d.ts +1 -1
- package/services/chain-service/constants.js +4 -4
- package/services/chain-service/handler/CardanoApi.js +3 -1
- package/services/chain-service/handler/SubstrateApi.js +0 -2
- package/services/chain-service/health-check/index.js +0 -1
- package/services/chain-service/health-check/utils/new-utils/chain-asset-validate.js +0 -1
- package/services/chain-service/index.d.ts +0 -1
- package/services/chain-service/index.js +16 -23
- package/services/chain-service/utils/index.js +22 -26
- package/services/chain-service/utils/patch.d.ts +1 -1
- package/services/chain-service/utils/patch.js +1 -1
- package/services/earning-service/handlers/base.js +32 -0
- package/services/earning-service/handlers/lending/base.js +0 -2
- package/services/earning-service/handlers/liquid-staking/acala.js +0 -1
- package/services/earning-service/handlers/liquid-staking/base.js +0 -2
- package/services/earning-service/handlers/liquid-staking/bifrost.js +0 -2
- package/services/earning-service/handlers/liquid-staking/parallel.js +0 -1
- package/services/earning-service/handlers/native-staking/astar.js +0 -2
- package/services/earning-service/handlers/native-staking/dtao.js +43 -0
- package/services/earning-service/handlers/native-staking/energy.js +0 -1
- package/services/earning-service/handlers/native-staking/mythos.js +0 -2
- package/services/earning-service/handlers/native-staking/para-chain.js +0 -2
- package/services/earning-service/handlers/native-staking/relay-chain.js +8 -9
- package/services/earning-service/handlers/special.js +7 -0
- package/services/history-service/subsquid-multi-chain-history.js +0 -1
- package/services/keyring-service/context/handlers/Derive.js +2 -2
- package/services/keyring-service/context/handlers/Migration.js +3 -1
- package/services/keyring-service/context/handlers/Mnemonic.d.ts +1 -1
- package/services/keyring-service/context/handlers/Mnemonic.js +16 -10
- package/services/keyring-service/context/state.d.ts +3 -0
- package/services/keyring-service/context/state.js +21 -3
- package/services/keyring-service/utils.d.ts +1 -0
- package/services/keyring-service/utils.js +9 -0
- package/services/migration-service/scripts/MigrateTransactionHistoryBySymbol20251223.d.ts +4 -0
- package/services/migration-service/scripts/MigrateTransactionHistoryBySymbol20251223.js +46 -0
- package/services/migration-service/scripts/databases/MigrateAssetSetting20251223.d.ts +4 -0
- package/services/migration-service/scripts/databases/MigrateAssetSetting20251223.js +33 -0
- package/services/migration-service/scripts/index.js +8 -4
- package/services/mint-campaign-service/campaigns/UnlockDotCampaign.js +0 -1
- package/services/nft-service/index.js +6 -0
- package/services/open-gov/handler.js +0 -2
- package/services/open-gov/interface.d.ts +4 -3
- package/services/open-gov/interface.js +4 -1
- package/services/request-service/handler/CardanoRequestHandler.js +0 -1
- package/services/request-service/handler/EvmRequestHandler.js +0 -1
- package/services/request-service/handler/TonRequestHandler.js +0 -1
- package/services/setting-service/constants.js +0 -1
- package/services/storage-service/DatabaseService.js +0 -2
- package/services/storage-service/databases/index.js +3 -0
- package/services/substrate-proxy-service/constant.d.ts +3 -0
- package/services/substrate-proxy-service/constant.js +19 -0
- package/services/substrate-proxy-service/index.d.ts +13 -0
- package/services/substrate-proxy-service/index.js +159 -0
- package/services/swap-service/handler/asset-hub/handler.js +0 -1
- package/services/swap-service/handler/asset-hub/router.js +0 -1
- package/services/swap-service/handler/chainflip-handler.js +0 -2
- package/services/swap-service/handler/hydradx-handler.js +0 -1
- package/services/swap-service/handler/kyber-handler.js +0 -1
- package/services/swap-service/handler/simpleswap-handler.js +0 -1
- package/services/swap-service/handler/uniswap-handler.js +0 -3
- package/services/transaction-service/event-parser/index.js +6 -6
- package/services/transaction-service/index.js +79 -11
- package/services/transaction-service/types.d.ts +2 -2
- package/services/transaction-service/utils.js +8 -5
- package/services/wallet-connect-service/index.js +21 -18
- package/services/wallet-connect-service/types.js +1 -1
- package/types/account/action/add/mnemonic.d.ts +3 -2
- package/types/account/info/keyring.js +9 -1
- package/types/balance/index.js +5 -1
- package/types/balance/transfer.d.ts +1 -0
- package/types/index.d.ts +1 -0
- package/types/index.js +1 -0
- package/types/substrateProxyAccount/actions/index.d.ts +17 -0
- package/types/substrateProxyAccount/actions/index.js +1 -0
- package/types/substrateProxyAccount/index.d.ts +23 -0
- package/types/substrateProxyAccount/index.js +8 -0
- package/types/swap/index.js +2 -1
- package/types/transaction/process.js +3 -1
- package/types/transaction/request.d.ts +1 -0
- package/types/yield/actions/join/step.js +17 -1
- package/types/yield/actions/join/submit.d.ts +1 -1
- package/utils/account/common.d.ts +0 -3
- package/utils/account/common.js +0 -24
- package/utils/account/derive/info/solo.js +8 -5
- package/utils/account/derive/validate.d.ts +2 -2
- package/utils/account/derive/validate.js +1 -1
- package/utils/account/transform.js +10 -5
- package/utils/auth.js +2 -2
- package/utils/bitcoin/utxo-management.js +0 -1
- package/utils/fee/transfer.js +4 -2
- package/utils/index.js +2 -5
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"./cjs/detectPackage.js"
|
|
18
18
|
],
|
|
19
19
|
"type": "module",
|
|
20
|
-
"version": "1.3.
|
|
20
|
+
"version": "1.3.72-0",
|
|
21
21
|
"main": "./cjs/index.js",
|
|
22
22
|
"module": "./index.js",
|
|
23
23
|
"types": "./index.d.ts",
|
|
@@ -1486,6 +1486,11 @@
|
|
|
1486
1486
|
"require": "./cjs/services/migration-service/scripts/databases/MigrateAssetSetting20251107.js",
|
|
1487
1487
|
"default": "./services/migration-service/scripts/databases/MigrateAssetSetting20251107.js"
|
|
1488
1488
|
},
|
|
1489
|
+
"./services/migration-service/scripts/databases/MigrateAssetSetting20251223": {
|
|
1490
|
+
"types": "./services/migration-service/scripts/databases/MigrateAssetSetting20251223.d.ts",
|
|
1491
|
+
"require": "./cjs/services/migration-service/scripts/databases/MigrateAssetSetting20251223.js",
|
|
1492
|
+
"default": "./services/migration-service/scripts/databases/MigrateAssetSetting20251223.js"
|
|
1493
|
+
},
|
|
1489
1494
|
"./services/migration-service/scripts/databases/MigrateEarningHistory": {
|
|
1490
1495
|
"types": "./services/migration-service/scripts/databases/MigrateEarningHistory.d.ts",
|
|
1491
1496
|
"require": "./cjs/services/migration-service/scripts/databases/MigrateEarningHistory.js",
|
|
@@ -1631,6 +1636,11 @@
|
|
|
1631
1636
|
"require": "./cjs/services/migration-service/scripts/MigrateTransactionHistoryBySymbol20251107.js",
|
|
1632
1637
|
"default": "./services/migration-service/scripts/MigrateTransactionHistoryBySymbol20251107.js"
|
|
1633
1638
|
},
|
|
1639
|
+
"./services/migration-service/scripts/MigrateTransactionHistoryBySymbol20251223": {
|
|
1640
|
+
"types": "./services/migration-service/scripts/MigrateTransactionHistoryBySymbol20251223.d.ts",
|
|
1641
|
+
"require": "./cjs/services/migration-service/scripts/MigrateTransactionHistoryBySymbol20251223.js",
|
|
1642
|
+
"default": "./services/migration-service/scripts/MigrateTransactionHistoryBySymbol20251223.js"
|
|
1643
|
+
},
|
|
1634
1644
|
"./services/migration-service/scripts/MigrateWalletReference": {
|
|
1635
1645
|
"types": "./services/migration-service/scripts/MigrateWalletReference.d.ts",
|
|
1636
1646
|
"require": "./cjs/services/migration-service/scripts/MigrateWalletReference.js",
|
|
@@ -2026,6 +2036,16 @@
|
|
|
2026
2036
|
"require": "./cjs/services/subscan-service/types.js",
|
|
2027
2037
|
"default": "./services/subscan-service/types.js"
|
|
2028
2038
|
},
|
|
2039
|
+
"./services/substrate-proxy-service": {
|
|
2040
|
+
"types": "./services/substrate-proxy-service/index.d.ts",
|
|
2041
|
+
"require": "./cjs/services/substrate-proxy-service/index.js",
|
|
2042
|
+
"default": "./services/substrate-proxy-service/index.js"
|
|
2043
|
+
},
|
|
2044
|
+
"./services/substrate-proxy-service/constant": {
|
|
2045
|
+
"types": "./services/substrate-proxy-service/constant.d.ts",
|
|
2046
|
+
"require": "./cjs/services/substrate-proxy-service/constant.js",
|
|
2047
|
+
"default": "./services/substrate-proxy-service/constant.js"
|
|
2048
|
+
},
|
|
2029
2049
|
"./services/swap-service": {
|
|
2030
2050
|
"types": "./services/swap-service/index.d.ts",
|
|
2031
2051
|
"require": "./cjs/services/swap-service/index.js",
|
|
@@ -2521,6 +2541,16 @@
|
|
|
2521
2541
|
"require": "./cjs/types/setting.js",
|
|
2522
2542
|
"default": "./types/setting.js"
|
|
2523
2543
|
},
|
|
2544
|
+
"./types/substrateProxyAccount": {
|
|
2545
|
+
"types": "./types/substrateProxyAccount/index.d.ts",
|
|
2546
|
+
"require": "./cjs/types/substrateProxyAccount/index.js",
|
|
2547
|
+
"default": "./types/substrateProxyAccount/index.js"
|
|
2548
|
+
},
|
|
2549
|
+
"./types/substrateProxyAccount/actions": {
|
|
2550
|
+
"types": "./types/substrateProxyAccount/actions/index.d.ts",
|
|
2551
|
+
"require": "./cjs/types/substrateProxyAccount/actions/index.js",
|
|
2552
|
+
"default": "./types/substrateProxyAccount/actions/index.js"
|
|
2553
|
+
},
|
|
2524
2554
|
"./types/swap": {
|
|
2525
2555
|
"types": "./types/swap/index.d.ts",
|
|
2526
2556
|
"require": "./cjs/types/swap/index.js",
|
|
@@ -2943,22 +2973,22 @@
|
|
|
2943
2973
|
"@sora-substrate/type-definitions": "^1.17.7",
|
|
2944
2974
|
"@substrate/connect": "^0.8.9",
|
|
2945
2975
|
"@subwallet-monorepos/subwallet-services-sdk": "0.1.14",
|
|
2946
|
-
"@subwallet/chain-list": "0.2.
|
|
2947
|
-
"@subwallet/extension-base": "^1.3.
|
|
2948
|
-
"@subwallet/extension-chains": "^1.3.
|
|
2949
|
-
"@subwallet/extension-dapp": "^1.3.
|
|
2950
|
-
"@subwallet/extension-inject": "^1.3.
|
|
2951
|
-
"@subwallet/keyring": "^0.1.
|
|
2952
|
-
"@subwallet/ui-keyring": "^0.1.
|
|
2976
|
+
"@subwallet/chain-list": "0.2.123",
|
|
2977
|
+
"@subwallet/extension-base": "^1.3.72-0",
|
|
2978
|
+
"@subwallet/extension-chains": "^1.3.72-0",
|
|
2979
|
+
"@subwallet/extension-dapp": "^1.3.72-0",
|
|
2980
|
+
"@subwallet/extension-inject": "^1.3.72-0",
|
|
2981
|
+
"@subwallet/keyring": "^0.1.14",
|
|
2982
|
+
"@subwallet/ui-keyring": "^0.1.14",
|
|
2953
2983
|
"@ton/core": "^0.56.3",
|
|
2954
2984
|
"@ton/crypto": "^3.2.0",
|
|
2955
2985
|
"@ton/ton": "^15.0.0",
|
|
2956
2986
|
"@walletconnect/keyvaluestorage": "^1.1.1",
|
|
2957
|
-
"@walletconnect/sign-client": "2.
|
|
2958
|
-
"@walletconnect/types": "2.
|
|
2959
|
-
"@walletconnect/utils": "2.
|
|
2987
|
+
"@walletconnect/sign-client": "^2.23.0",
|
|
2988
|
+
"@walletconnect/types": "2.23.0",
|
|
2989
|
+
"@walletconnect/utils": "2.23.0",
|
|
2960
2990
|
"avail-js-sdk": "^0.2.12",
|
|
2961
|
-
"axios": "^1.
|
|
2991
|
+
"axios": "^1.13.2",
|
|
2962
2992
|
"bignumber.js": "^9.1.1",
|
|
2963
2993
|
"bitcoinjs-lib": "6.1.5",
|
|
2964
2994
|
"bn.js": "^5.2.1",
|
|
@@ -2968,7 +2998,6 @@
|
|
|
2968
2998
|
"cross-fetch": "^4.1.0",
|
|
2969
2999
|
"dexie": "^3.2.2",
|
|
2970
3000
|
"dexie-export-import": "^4.0.7",
|
|
2971
|
-
"eth-simple-keyring": "^4.2.0",
|
|
2972
3001
|
"ethereumjs-util": "^7.1.5",
|
|
2973
3002
|
"ethers": "^6.4.2",
|
|
2974
3003
|
"eventemitter3": "^5.0.0",
|
|
@@ -2979,19 +3008,19 @@
|
|
|
2979
3008
|
"json-rpc-engine": "^6.1.0",
|
|
2980
3009
|
"manta-extension-sdk": "^1.1.0",
|
|
2981
3010
|
"moment": "^2.29.4",
|
|
2982
|
-
"protobufjs": "^7.
|
|
3011
|
+
"protobufjs": "^7.5.4",
|
|
2983
3012
|
"rxjs": "^7.8.1",
|
|
2984
3013
|
"sails-js": "^0.4.2",
|
|
2985
3014
|
"sails-js-parser": "^0.4.2",
|
|
2986
3015
|
"ts-md5": "^1.3.1",
|
|
2987
3016
|
"tweetnacl": "^1.0.3",
|
|
2988
3017
|
"uuid": "^9.0.0",
|
|
2989
|
-
"web3": "^1.10.
|
|
2990
|
-
"web3-core": "^1.10.
|
|
2991
|
-
"web3-core-helpers": "^1.10.
|
|
2992
|
-
"web3-core-subscriptions": "1.10.
|
|
2993
|
-
"web3-eth": "1.10.
|
|
2994
|
-
"web3-eth-contract": "
|
|
2995
|
-
"web3-utils": "
|
|
3018
|
+
"web3": "^1.10.4",
|
|
3019
|
+
"web3-core": "^1.10.4",
|
|
3020
|
+
"web3-core-helpers": "^1.10.4",
|
|
3021
|
+
"web3-core-subscriptions": "1.10.4",
|
|
3022
|
+
"web3-eth": "1.10.4",
|
|
3023
|
+
"web3-eth-contract": "1.10.4",
|
|
3024
|
+
"web3-utils": "1.10.4"
|
|
2996
3025
|
}
|
|
2997
3026
|
}
|
package/packageInfo.js
CHANGED
|
@@ -7,5 +7,5 @@ export const packageInfo = {
|
|
|
7
7
|
name: '@subwallet/extension-base',
|
|
8
8
|
path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto',
|
|
9
9
|
type: 'esm',
|
|
10
|
-
version: '1.3.
|
|
10
|
+
version: '1.3.72-0'
|
|
11
11
|
};
|
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
import EventEmitter from 'eventemitter3';
|
|
5
5
|
import { isUndefined, logger } from '@polkadot/util';
|
|
6
6
|
const l = logger('PostMessageProvider');
|
|
7
|
+
|
|
8
|
+
// Same as https://github.com/polkadot-js/api/blob/57ca9a9c3204339e1e1f693fcacc33039868dc27/packages/rpc-provider/src/ws/Provider.ts#L17
|
|
9
|
+
|
|
7
10
|
// External to class, this.# is not private enough (yet)
|
|
8
11
|
let sendRequest;
|
|
9
12
|
|
|
@@ -37,7 +37,6 @@ export async function retryCardanoTxStatus(fn, options) {
|
|
|
37
37
|
await new Promise(resolve => setTimeout(resolve, options.delay)); // wait for delay period, then recall the fn()
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
|
|
41
40
|
console.error('Cardano transaction timeout', lastError); // throw only last error, in case no successful result from fn()
|
|
42
41
|
|
|
43
42
|
return false;
|
|
@@ -59,7 +59,6 @@ export const subscribeGRC20Balance = ({
|
|
|
59
59
|
}
|
|
60
60
|
});
|
|
61
61
|
};
|
|
62
|
-
|
|
63
62
|
getTokenBalances();
|
|
64
63
|
const interval = setInterval(getTokenBalances, SUB_TOKEN_REFRESH_BALANCE_INTERVAL);
|
|
65
64
|
return () => {
|
|
@@ -116,7 +115,6 @@ export const subscribeVftBalance = ({
|
|
|
116
115
|
}
|
|
117
116
|
});
|
|
118
117
|
};
|
|
119
|
-
|
|
120
118
|
getTokenBalances();
|
|
121
119
|
const interval = setInterval(getTokenBalances, SUB_TOKEN_REFRESH_BALANCE_INTERVAL);
|
|
122
120
|
return () => {
|
|
@@ -13,7 +13,7 @@ import { _getTokensPalletLocked, _getTokensPalletTransferable } from '@subwallet
|
|
|
13
13
|
import { _adaptX1Interior } from '@subwallet/extension-base/core/substrate/xcm-parser';
|
|
14
14
|
import { getPSP22ContractPromise } from '@subwallet/extension-base/koni/api/contract-handler/wasm';
|
|
15
15
|
import { getDefaultWeightV2 } from '@subwallet/extension-base/koni/api/contract-handler/wasm/utils';
|
|
16
|
-
import { _BALANCE_CHAIN_GROUP, _MANTA_ZK_CHAIN_GROUP, _ZK_ASSET_PREFIX } from '@subwallet/extension-base/services/chain-service/constants';
|
|
16
|
+
import { _BALANCE_CHAIN_GROUP, _MANTA_ZK_CHAIN_GROUP, _ZK_ASSET_PREFIX, USE_MULTILOCATION_INDEX } from '@subwallet/extension-base/services/chain-service/constants';
|
|
17
17
|
import { _checkSmartContractSupportByChain, _getAssetExistentialDeposit, _getAssetNetuid, _getChainExistentialDeposit, _getChainNativeTokenSlug, _getContractAddressOfToken, _getTokenOnChainAssetId, _getTokenOnChainInfo, _getTokenTypesSupportedByChain, _getXcmAssetMultilocation, _isBridgedToken, _isChainEvmCompatible } from '@subwallet/extension-base/services/chain-service/utils';
|
|
18
18
|
import { filterAlphaAssetsByChain, filterAssetsByChainAndType } from '@subwallet/extension-base/utils';
|
|
19
19
|
import BigN from 'bignumber.js';
|
|
@@ -343,7 +343,6 @@ const subscribePSP22Balance = ({
|
|
|
343
343
|
}
|
|
344
344
|
});
|
|
345
345
|
};
|
|
346
|
-
|
|
347
346
|
getTokenBalances();
|
|
348
347
|
const interval = setInterval(getTokenBalances, SUB_TOKEN_REFRESH_BALANCE_INTERVAL);
|
|
349
348
|
return () => {
|
|
@@ -423,16 +422,27 @@ const subscribeAssetsAccountPallet = async ({
|
|
|
423
422
|
}
|
|
424
423
|
});
|
|
425
424
|
const unsubList = await Promise.all(Object.values(tokenMap).map(tokenInfo => {
|
|
425
|
+
if (tokenInfo.slug === 'energy_web_x-LOCAL-stEWT') {
|
|
426
|
+
return timer(0, CRON_REFRESH_PRICE_INTERVAL).subscribe(() => {
|
|
427
|
+
const getEwtFrozenBalance = async () => {
|
|
428
|
+
const ewtTokenBalances = await queryEwtFrozenBalance(substrateApi, addresses, assetMap[tokenInfo.slug], extrinsicType);
|
|
429
|
+
callback(ewtTokenBalances);
|
|
430
|
+
};
|
|
431
|
+
getEwtFrozenBalance().catch(console.error);
|
|
432
|
+
});
|
|
433
|
+
}
|
|
426
434
|
try {
|
|
427
435
|
const assetIndex = _getTokenOnChainAssetId(tokenInfo);
|
|
428
|
-
if (assetIndex === '-1') {
|
|
436
|
+
if (assetIndex === '-1' && !USE_MULTILOCATION_INDEX.includes(chainInfo.slug)) {
|
|
429
437
|
return undefined;
|
|
430
438
|
}
|
|
439
|
+
const version = ['statemint', 'statemine', 'westend_assethub'].includes(chainInfo.slug) ? 4 : 3;
|
|
440
|
+
const index = USE_MULTILOCATION_INDEX.includes(chainInfo.slug) ? _adaptX1Interior(_getXcmAssetMultilocation(tokenInfo), version) : assetIndex;
|
|
431
441
|
const params = [{
|
|
432
442
|
section: 'query',
|
|
433
443
|
module: assetsAccountKey.split('_')[1],
|
|
434
444
|
method: assetsAccountKey.split('_')[2],
|
|
435
|
-
args: addresses.map(address => [
|
|
445
|
+
args: addresses.map(address => [index, address])
|
|
436
446
|
}];
|
|
437
447
|
|
|
438
448
|
// Get Token Balance
|
|
@@ -593,4 +603,37 @@ async function queryGigaTokenBalance(substrateApi, addresses, tokenInfo, extrins
|
|
|
593
603
|
locked: totalLockedFromTransfer.toString()
|
|
594
604
|
};
|
|
595
605
|
}));
|
|
606
|
+
}
|
|
607
|
+
async function queryEwtFrozenBalance(substrateApi, addresses, tokenInfo, extrinsicType) {
|
|
608
|
+
const multilocation = _getXcmAssetMultilocation(tokenInfo);
|
|
609
|
+
return await Promise.all(addresses.map(async address => {
|
|
610
|
+
const [_frozenBalance, _balanceInfo] = await Promise.all([substrateApi.api.query.assetsFreezer.frozenBalances(multilocation, address), substrateApi.api.query.assets.account(multilocation, address)]);
|
|
611
|
+
const balanceInfo = _balanceInfo.toPrimitive();
|
|
612
|
+
if (!balanceInfo) {
|
|
613
|
+
// no balance info response
|
|
614
|
+
return {
|
|
615
|
+
address: address,
|
|
616
|
+
tokenSlug: tokenInfo.slug,
|
|
617
|
+
free: '0',
|
|
618
|
+
locked: '0',
|
|
619
|
+
state: APIItemState.READY
|
|
620
|
+
};
|
|
621
|
+
}
|
|
622
|
+
const transferableBalance = _getAssetsPalletTransferable(balanceInfo, _getAssetExistentialDeposit(tokenInfo), extrinsicType);
|
|
623
|
+
const totalLockedFromTransfer = _getAssetsPalletLocked(balanceInfo);
|
|
624
|
+
let freeBalance = transferableBalance;
|
|
625
|
+
let lockedBalance = totalLockedFromTransfer;
|
|
626
|
+
const frozenBalance = _frozenBalance.toPrimitive();
|
|
627
|
+
if (frozenBalance) {
|
|
628
|
+
freeBalance = transferableBalance - BigInt(frozenBalance);
|
|
629
|
+
lockedBalance = totalLockedFromTransfer + BigInt(frozenBalance);
|
|
630
|
+
}
|
|
631
|
+
return {
|
|
632
|
+
address: address,
|
|
633
|
+
tokenSlug: tokenInfo.slug,
|
|
634
|
+
free: freeBalance.toString(),
|
|
635
|
+
locked: lockedBalance.toString(),
|
|
636
|
+
state: APIItemState.READY
|
|
637
|
+
};
|
|
638
|
+
}));
|
|
596
639
|
}
|
|
@@ -35,10 +35,8 @@ export async function retryTonTxStatus(fn, options) {
|
|
|
35
35
|
await new Promise(resolve => setTimeout(resolve, options.delay)); // wait for delay period, then recall the fn()
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
|
|
39
38
|
throw lastError; // throw only last error, in case no successful result from fn()
|
|
40
39
|
}
|
|
41
|
-
|
|
42
40
|
export function getMessageTxStatus(txByMsgInfo) {
|
|
43
41
|
var _txDetailInfo$descrip, _txDetailInfo$descrip2, _txDetailInfo$descrip3, _txDetailInfo$descrip4, _txDetailInfo$descrip5, _txDetailInfo$descrip6, _txDetailInfo$out_msg, _txDetailInfo$out_msg2;
|
|
44
42
|
const txDetailInfo = txByMsgInfo.transactions[0];
|
|
@@ -64,7 +62,6 @@ export async function getJettonTxStatus(tonApi, jettonTransferMsgHash) {
|
|
|
64
62
|
const jettonInternalTransferTxInfoRaw = await tonApi.getTxByInMsg(jettonInternalTransferHash);
|
|
65
63
|
return getMessageTxStatus(jettonInternalTransferTxInfoRaw); // Jetton Internal Transfer success -> Receiver successfully receiver fund!
|
|
66
64
|
}
|
|
67
|
-
|
|
68
65
|
return false;
|
|
69
66
|
}
|
|
70
67
|
export async function estimateTonTxFee(tonApi, messages, walletContract, _seqno) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { _ChainAsset, _ChainInfo } from '@subwallet/chain-list/types';
|
|
1
2
|
import { AmountData, DetectBalanceCache, ExtrinsicType } from '@subwallet/extension-base/background/KoniTypes';
|
|
2
3
|
import KoniState from '@subwallet/extension-base/koni/background/handlers/State';
|
|
3
4
|
import { RequestOptimalTransferProcess } from '@subwallet/extension-base/services/balance-service/helpers/process';
|
|
@@ -111,4 +112,11 @@ export declare class BalanceService implements StoppableServiceInterface {
|
|
|
111
112
|
/** optimize token area **/
|
|
112
113
|
enableOptimizeTokenPromise(): void;
|
|
113
114
|
optimizeEnableTokens(): Promise<void>;
|
|
115
|
+
/** Return token slugs with balance in evm chain - only work with evm addresses & pure evm chains **/
|
|
116
|
+
getEvmTokensBalanceByChain(address: string, chainSlug: string): Promise<string[]>;
|
|
117
|
+
/** Return token slugs with balance in substrate chain - only work with substrate chains that have subscanSlug **/
|
|
118
|
+
getSubstrateTokensBalanceByChain(address: string, chainSlug: string, assetsByChain: Record<string, _ChainAsset>): Promise<string[]>;
|
|
119
|
+
getCurrentAccountAddressByChain(chainInfo: _ChainInfo): string | undefined;
|
|
120
|
+
/** re-detect balance & enable custom, priority tokens when enabling chain again **/
|
|
121
|
+
updatePriorityAssetsByChain(chainSlug: string, visible: boolean): Promise<void>;
|
|
114
122
|
}
|
|
@@ -7,12 +7,12 @@ import { ALL_ACCOUNT_KEY } from '@subwallet/extension-base/constants';
|
|
|
7
7
|
import { _isXcmWithinSameConsensus } from '@subwallet/extension-base/core/substrate/xcm-parser';
|
|
8
8
|
import { getAcrossbridgeTransferProcessFromEvm, getDefaultTransferProcess, getSnowbridgeTransferProcessFromEvm } from '@subwallet/extension-base/services/balance-service/helpers/process';
|
|
9
9
|
import { ServiceStatus } from '@subwallet/extension-base/services/base/types';
|
|
10
|
-
import { _getChainNativeTokenSlug, _isCustomAsset, _isNativeToken, _isPureEvmChain } from '@subwallet/extension-base/services/chain-service/utils';
|
|
10
|
+
import { _getChainNativeTokenSlug, _isChainSubstrateCompatible, _isCustomAsset, _isCustomChain, _isNativeToken, _isPureEvmChain } from '@subwallet/extension-base/services/chain-service/utils';
|
|
11
11
|
import DetectAccountBalanceStore from '@subwallet/extension-base/stores/DetectAccountBalance';
|
|
12
12
|
import { BalanceType } from '@subwallet/extension-base/types';
|
|
13
13
|
import { addLazy, createPromiseHandler, isAccountAll, waitTimeout } from '@subwallet/extension-base/utils';
|
|
14
14
|
import { getKeypairTypeByAddress } from '@subwallet/keyring';
|
|
15
|
-
import {
|
|
15
|
+
import { AllSubstrateKeypairTypes, EthereumKeypairTypes } from '@subwallet/keyring/types';
|
|
16
16
|
import keyring from '@subwallet/ui-keyring';
|
|
17
17
|
import subwalletApiSdk from '@subwallet-monorepos/subwallet-services-sdk';
|
|
18
18
|
import BigN from 'bignumber.js';
|
|
@@ -458,7 +458,7 @@ export class BalanceService {
|
|
|
458
458
|
const assetMap = this.state.chainService.getAssetRegistry();
|
|
459
459
|
const promiseList = addresses.map(address => {
|
|
460
460
|
const type = getKeypairTypeByAddress(address);
|
|
461
|
-
const typeValid = [...
|
|
461
|
+
const typeValid = [...AllSubstrateKeypairTypes, ...EthereumKeypairTypes].includes(type);
|
|
462
462
|
if (typeValid) {
|
|
463
463
|
return this.state.subscanService.getMultiChainBalance(address).catch(e => {
|
|
464
464
|
console.error(e);
|
|
@@ -539,12 +539,10 @@ export class BalanceService {
|
|
|
539
539
|
var _currentAssetSettings2;
|
|
540
540
|
const chainSlug = tokenSlug.split('-')[0];
|
|
541
541
|
const chainState = this.state.chainService.getChainStateByKey(chainSlug);
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
// Cancel if chain is turned off by user
|
|
545
|
-
if (chainState && chainState.manualTurnOff) {
|
|
542
|
+
if (chainState !== null && chainState !== void 0 && chainState.manualTurnOff) {
|
|
546
543
|
continue;
|
|
547
544
|
}
|
|
545
|
+
const existedKey = Object.keys(assetMap).find(v => v.toLowerCase() === tokenSlug.toLowerCase());
|
|
548
546
|
if (existedKey && !((_currentAssetSettings2 = currentAssetSettings[existedKey]) !== null && _currentAssetSettings2 !== void 0 && _currentAssetSettings2.visible)) {
|
|
549
547
|
needEnableChains.push(chainSlug);
|
|
550
548
|
needActiveTokens.push(existedKey);
|
|
@@ -760,7 +758,7 @@ export class BalanceService {
|
|
|
760
758
|
const assetMap = this.state.chainService.getAssetRegistry();
|
|
761
759
|
const addresses = keyring.getPairs().map(account => account.address);
|
|
762
760
|
const evmAddresses = addresses.filter(address => [...EthereumKeypairTypes].includes(getKeypairTypeByAddress(address)));
|
|
763
|
-
const substrateAddresses = addresses.filter(address => [...
|
|
761
|
+
const substrateAddresses = addresses.filter(address => [...AllSubstrateKeypairTypes].includes(getKeypairTypeByAddress(address)));
|
|
764
762
|
const [nonZeroBalanceEvmToken, nonZeroBalanceSubstrateToken] = await Promise.all([this.evmDetectBalanceToken(evmAddresses), this.substrateDetectBalanceToken(substrateAddresses)]);
|
|
765
763
|
const substrateDetectChain = this.substrateDetectBalanceChain();
|
|
766
764
|
const evmDetectChain = await this.evmDetectBalanceChain();
|
|
@@ -788,5 +786,103 @@ export class BalanceService {
|
|
|
788
786
|
}
|
|
789
787
|
}
|
|
790
788
|
|
|
791
|
-
/**
|
|
789
|
+
/** Return token slugs with balance in evm chain - only work with evm addresses & pure evm chains **/
|
|
790
|
+
async getEvmTokensBalanceByChain(address, chainSlug) {
|
|
791
|
+
const tokenBalanceSlugs = await subwalletApiSdk.balanceDetectionApi.getSwEvmTokenBalanceByChain(address, chainSlug);
|
|
792
|
+
return tokenBalanceSlugs;
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
/** Return token slugs with balance in substrate chain - only work with substrate chains that have subscanSlug **/
|
|
796
|
+
async getSubstrateTokensBalanceByChain(address, chainSlug, assetsByChain) {
|
|
797
|
+
const tokenBalanceSlugs = [];
|
|
798
|
+
const balanceData = await this.state.subscanService.getMultiChainBalance(address);
|
|
799
|
+
if (!balanceData) {
|
|
800
|
+
return [];
|
|
801
|
+
}
|
|
802
|
+
for (const datum of balanceData) {
|
|
803
|
+
const {
|
|
804
|
+
balance,
|
|
805
|
+
bonded,
|
|
806
|
+
category,
|
|
807
|
+
locked,
|
|
808
|
+
network,
|
|
809
|
+
symbol
|
|
810
|
+
} = datum;
|
|
811
|
+
const chain = this.state.chainService.detectBalanceChainSlugMap[network];
|
|
812
|
+
if (chain !== chainSlug) {
|
|
813
|
+
continue;
|
|
814
|
+
}
|
|
815
|
+
const isBalanceEmpty = (!balance || balance === '0') && (!locked || locked === '0') && (!bonded || bonded === '0');
|
|
816
|
+
if (isBalanceEmpty) {
|
|
817
|
+
continue;
|
|
818
|
+
}
|
|
819
|
+
const tokenKey = `${chain}-${category === 'native' ? 'NATIVE' : 'LOCAL'}-${symbol.toUpperCase()}`;
|
|
820
|
+
const existedKey = Object.keys(assetsByChain).find(v => v.toLowerCase() === tokenKey.toLowerCase());
|
|
821
|
+
if (existedKey) {
|
|
822
|
+
tokenBalanceSlugs.push(existedKey);
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
return tokenBalanceSlugs;
|
|
826
|
+
}
|
|
827
|
+
getCurrentAccountAddressByChain(chainInfo) {
|
|
828
|
+
const proxyId = this.state.keyringService.context.currentAccount.proxyId;
|
|
829
|
+
const addresses = this.state.keyringService.context.addressesByProxyId(proxyId);
|
|
830
|
+
if (_isPureEvmChain(chainInfo)) {
|
|
831
|
+
const evmAddress = addresses.find(address => {
|
|
832
|
+
const type = getKeypairTypeByAddress(address);
|
|
833
|
+
return [...EthereumKeypairTypes].includes(type);
|
|
834
|
+
});
|
|
835
|
+
if (evmAddress) {
|
|
836
|
+
return evmAddress;
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
if (_isChainSubstrateCompatible(chainInfo)) {
|
|
840
|
+
const substrateAddress = addresses.find(address => {
|
|
841
|
+
const type = getKeypairTypeByAddress(address);
|
|
842
|
+
return [...AllSubstrateKeypairTypes, ...EthereumKeypairTypes].includes(type);
|
|
843
|
+
});
|
|
844
|
+
if (substrateAddress) {
|
|
845
|
+
return substrateAddress;
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
return undefined;
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
/** re-detect balance & enable custom, priority tokens when enabling chain again **/
|
|
852
|
+
async updatePriorityAssetsByChain(chainSlug, visible) {
|
|
853
|
+
const currentAssetSettings = await this.state.chainService.getAssetSettings();
|
|
854
|
+
const assetsByChain = this.state.chainService.getFungibleTokensByChain(chainSlug);
|
|
855
|
+
const priorityTokensMap = this.state.chainService.value.priorityTokens || {};
|
|
856
|
+
const chainInfo = this.state.chainService.getChainInfoByKey(chainSlug);
|
|
857
|
+
const address = this.getCurrentAccountAddressByChain(chainInfo);
|
|
858
|
+
const tokenSlugsWithBalance = [];
|
|
859
|
+
if (address && !_isCustomChain(chainInfo.slug)) {
|
|
860
|
+
if (_isPureEvmChain(chainInfo)) {
|
|
861
|
+
tokenSlugsWithBalance.push(...(await this.getEvmTokensBalanceByChain(address, chainSlug)));
|
|
862
|
+
} else if (_isChainSubstrateCompatible(chainInfo)) {
|
|
863
|
+
tokenSlugsWithBalance.push(...(await this.getSubstrateTokensBalanceByChain(address, chainSlug, assetsByChain)));
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
tokenSlugsWithBalance.forEach(tokenSlug => {
|
|
867
|
+
currentAssetSettings[tokenSlug] = {
|
|
868
|
+
visible: true
|
|
869
|
+
};
|
|
870
|
+
});
|
|
871
|
+
const priorityTokensList = priorityTokensMap.token && typeof priorityTokensMap.token === 'object' ? Object.keys(priorityTokensMap.token) : [];
|
|
872
|
+
for (const asset of Object.values(assetsByChain)) {
|
|
873
|
+
if (visible) {
|
|
874
|
+
const isPriorityToken = priorityTokensList.includes(asset.slug) || _isCustomAsset(asset.slug);
|
|
875
|
+
if (isPriorityToken || _isNativeToken(asset)) {
|
|
876
|
+
currentAssetSettings[asset.slug] = {
|
|
877
|
+
visible: true
|
|
878
|
+
};
|
|
879
|
+
}
|
|
880
|
+
} else {
|
|
881
|
+
currentAssetSettings[asset.slug] = {
|
|
882
|
+
visible: false
|
|
883
|
+
};
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
this.state.chainService.setAssetSettings(currentAssetSettings);
|
|
887
|
+
}
|
|
792
888
|
}
|
|
@@ -13,8 +13,4 @@ interface CreateTransferExtrinsicProps {
|
|
|
13
13
|
}
|
|
14
14
|
export declare const createSubstrateExtrinsic: ({ from, networkKey, substrateApi, to, tokenInfo, transferAll, value }: CreateTransferExtrinsicProps) => Promise<[SubmittableExtrinsic | null, string]>;
|
|
15
15
|
export declare const getTransferMockTxFee: (address: string, chainInfo: _ChainInfo, tokenInfo: _ChainAsset, api: _SubstrateApi | _EvmApi | _TonApi) => Promise<BigN>;
|
|
16
|
-
export declare const getAccountNetuidTokenInfo: (address: string, tokenInfo: _ChainAsset, substrateApi: _SubstrateApi) => Promise<{
|
|
17
|
-
isEnableTransferSubnet: boolean;
|
|
18
|
-
accountHotKey: string | undefined;
|
|
19
|
-
}>;
|
|
20
16
|
export {};
|
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
|
|
4
4
|
import { GearApi } from '@gear-js/api';
|
|
5
5
|
import { _AssetType } from '@subwallet/chain-list/types';
|
|
6
|
+
import { _adaptX1Interior } from '@subwallet/extension-base/core/substrate/xcm-parser';
|
|
6
7
|
import { getPSP22ContractPromise } from '@subwallet/extension-base/koni/api/contract-handler/wasm';
|
|
7
8
|
import { getWasmContractGasLimit } from '@subwallet/extension-base/koni/api/contract-handler/wasm/utils';
|
|
8
9
|
import { estimateTonTxFee } from '@subwallet/extension-base/services/balance-service/helpers/subscribe/ton/utils';
|
|
9
|
-
import { _TRANSFER_CHAIN_GROUP } from '@subwallet/extension-base/services/chain-service/constants';
|
|
10
|
+
import { _TRANSFER_CHAIN_GROUP, USE_MULTILOCATION_INDEX } from '@subwallet/extension-base/services/chain-service/constants';
|
|
10
11
|
import { _getContractAddressOfToken, _getTokenOnChainAssetId, _getTokenOnChainInfo, _getXcmAssetMultilocation, _isBridgedToken, _isChainEvmCompatible, _isChainTonCompatible, _isGigaToken, _isNativeToken, _isTokenGearSmartContract, _isTokenTransferredByEvm, _isTokenTransferredByTon, _isTokenWasmSmartContract } from '@subwallet/extension-base/services/chain-service/utils';
|
|
11
12
|
import { calculateGasFeeParams } from '@subwallet/extension-base/services/fee-service/utils';
|
|
12
13
|
import { combineEthFee, getGRC20ContractPromise, getVFTContractPromise } from '@subwallet/extension-base/utils';
|
|
@@ -25,7 +26,7 @@ export const createSubstrateExtrinsic = async ({
|
|
|
25
26
|
transferAll,
|
|
26
27
|
value
|
|
27
28
|
}) => {
|
|
28
|
-
var _tokenInfo$metadata
|
|
29
|
+
var _tokenInfo$metadata;
|
|
29
30
|
const api = substrateApi.api;
|
|
30
31
|
const isDisableTransfer = (_tokenInfo$metadata = tokenInfo.metadata) === null || _tokenInfo$metadata === void 0 ? void 0 : _tokenInfo$metadata.isDisableTransfer;
|
|
31
32
|
if (isDisableTransfer) {
|
|
@@ -94,7 +95,15 @@ export const createSubstrateExtrinsic = async ({
|
|
|
94
95
|
} else if (_TRANSFER_CHAIN_GROUP.bitcountry.includes(networkKey) && !_isNativeToken(tokenInfo)) {
|
|
95
96
|
transfer = api.tx.currencies.transfer(to, _getTokenOnChainInfo(tokenInfo), value);
|
|
96
97
|
} else if (_TRANSFER_CHAIN_GROUP.statemine.includes(networkKey) && !_isNativeToken(tokenInfo)) {
|
|
97
|
-
|
|
98
|
+
if (USE_MULTILOCATION_INDEX.includes(networkKey)) {
|
|
99
|
+
const version = ['statemint', 'statemine', 'westend_assethub'].includes(networkKey) ? 4 : 3;
|
|
100
|
+
const multilocationIndex = _adaptX1Interior(_getXcmAssetMultilocation(tokenInfo), version);
|
|
101
|
+
|
|
102
|
+
// @ts-ignore
|
|
103
|
+
transfer = api.tx.assets.transfer(multilocationIndex, to, value);
|
|
104
|
+
} else {
|
|
105
|
+
transfer = api.tx.assets.transfer(_getTokenOnChainAssetId(tokenInfo), to, value);
|
|
106
|
+
}
|
|
98
107
|
} else if (_TRANSFER_CHAIN_GROUP.sora_substrate.includes(networkKey) && isTxAssetsSupported) {
|
|
99
108
|
transfer = api.tx.assets.transfer(_getTokenOnChainAssetId(tokenInfo), to, value);
|
|
100
109
|
} else if (isTxBalancesSupported && _isNativeToken(tokenInfo)) {
|
|
@@ -112,18 +121,6 @@ export const createSubstrateExtrinsic = async ({
|
|
|
112
121
|
}
|
|
113
122
|
} else if (_TRANSFER_CHAIN_GROUP.truth.includes(networkKey)) {
|
|
114
123
|
transfer = api.tx.assetManager.transfer(to, _getTokenOnChainInfo(tokenInfo), value);
|
|
115
|
-
} else if (_TRANSFER_CHAIN_GROUP.bittensor.includes(networkKey) && (_tokenInfo$metadata2 = tokenInfo.metadata) !== null && _tokenInfo$metadata2 !== void 0 && _tokenInfo$metadata2.netuid) {
|
|
116
|
-
var _tokenInfo$metadata3;
|
|
117
|
-
const {
|
|
118
|
-
accountHotKey,
|
|
119
|
-
isEnableTransferSubnet
|
|
120
|
-
} = await getAccountNetuidTokenInfo(from, tokenInfo, substrateApi);
|
|
121
|
-
const tokenNetuid = (_tokenInfo$metadata3 = tokenInfo.metadata) === null || _tokenInfo$metadata3 === void 0 ? void 0 : _tokenInfo$metadata3.netuid;
|
|
122
|
-
if (isEnableTransferSubnet && accountHotKey) {
|
|
123
|
-
transfer = api.tx.subtensorModule.transferStake(from, accountHotKey, tokenNetuid, tokenNetuid, value);
|
|
124
|
-
} else {
|
|
125
|
-
return [null, value];
|
|
126
|
-
}
|
|
127
124
|
}
|
|
128
125
|
return [transfer, transferAmount || value];
|
|
129
126
|
};
|
|
@@ -158,7 +155,6 @@ export const getTransferMockTxFee = async (address, chainInfo, tokenInfo, api) =
|
|
|
158
155
|
// estimate value
|
|
159
156
|
bounce: false // anyMode
|
|
160
157
|
});
|
|
161
|
-
|
|
162
158
|
estimatedFee = new BigN((await estimateTonTxFee(tonApi, [mockMessage], mockWalletContract)).toString());
|
|
163
159
|
} else {
|
|
164
160
|
var _paymentInfo$partialF;
|
|
@@ -176,28 +172,9 @@ export const getTransferMockTxFee = async (address, chainInfo, tokenInfo, api) =
|
|
|
176
172
|
const paymentInfo = await (mockTx === null || mockTx === void 0 ? void 0 : mockTx.paymentInfo(address));
|
|
177
173
|
estimatedFee = new BigN((paymentInfo === null || paymentInfo === void 0 ? void 0 : (_paymentInfo$partialF = paymentInfo.partialFee) === null || _paymentInfo$partialF === void 0 ? void 0 : _paymentInfo$partialF.toString()) || '0'); // todo: should handle error case instead of setting fee to 0
|
|
178
174
|
}
|
|
179
|
-
|
|
180
175
|
return estimatedFee;
|
|
181
176
|
} catch (e) {
|
|
182
177
|
console.error('error mocking tx fee', e);
|
|
183
178
|
return new BigN(0);
|
|
184
179
|
}
|
|
185
|
-
};
|
|
186
|
-
export const getAccountNetuidTokenInfo = async (address, tokenInfo, substrateApi) => {
|
|
187
|
-
var _tokenInfo$metadata4;
|
|
188
|
-
const tokenNetuid = (_tokenInfo$metadata4 = tokenInfo.metadata) === null || _tokenInfo$metadata4 === void 0 ? void 0 : _tokenInfo$metadata4.netuid;
|
|
189
|
-
if (!tokenNetuid) {
|
|
190
|
-
return {
|
|
191
|
-
isEnableTransferSubnet: false,
|
|
192
|
-
accountHotKey: undefined
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
const [isTransferToggle, rawStakeInfoForColdKey] = await Promise.all([substrateApi.api.query.subtensorModule.transferToggle(tokenNetuid), substrateApi.api.call.stakeInfoRuntimeApi.getStakeInfoForColdkey(address)]);
|
|
196
|
-
const isEnableTransferSubnet = isTransferToggle.toPrimitive();
|
|
197
|
-
const taoStakeInfos = rawStakeInfoForColdKey.toPrimitive();
|
|
198
|
-
const accountHotKey = taoStakeInfos.find(value => value.netuid === tokenNetuid);
|
|
199
|
-
return {
|
|
200
|
-
isEnableTransferSubnet,
|
|
201
|
-
accountHotKey: accountHotKey === null || accountHotKey === void 0 ? void 0 : accountHotKey.hotkey
|
|
202
|
-
};
|
|
203
180
|
};
|
|
@@ -56,7 +56,6 @@ async function createTonNativeTransaction({
|
|
|
56
56
|
value: fromNano(value),
|
|
57
57
|
bounce: false // todo: check and update the send bounced logic
|
|
58
58
|
});
|
|
59
|
-
|
|
60
59
|
const messagePayload = cellToBase64Str(messageRelaxedToCell(messages));
|
|
61
60
|
const estimateExternalFee = await estimateTonTxFee(tonApi, [messages], walletContract);
|
|
62
61
|
const transactionObject = {
|
|
@@ -102,8 +102,6 @@ export const dryRunXcmExtrinsicV2 = async (request, isPreview = false) => {
|
|
|
102
102
|
const originDryRunRs = dryRunResult.origin;
|
|
103
103
|
if (originDryRunRs.success) {
|
|
104
104
|
const {
|
|
105
|
-
assetHub,
|
|
106
|
-
bridgeHub,
|
|
107
105
|
destination,
|
|
108
106
|
hops
|
|
109
107
|
} = dryRunResult;
|
|
@@ -112,12 +110,9 @@ export const dryRunXcmExtrinsicV2 = async (request, isPreview = false) => {
|
|
|
112
110
|
return false;
|
|
113
111
|
}
|
|
114
112
|
}
|
|
115
|
-
if ((
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
return isChainNotSupportDryRun(destination.failureReason) || isChainNotSupportPolkadotApi(destination.failureReason);
|
|
119
|
-
}
|
|
120
|
-
return false;
|
|
113
|
+
if ((destination === null || destination === void 0 ? void 0 : destination.success) === false) {
|
|
114
|
+
// pass dry-run in these cases
|
|
115
|
+
return isChainNotSupportDryRun(destination.failureReason) || isChainNotSupportPolkadotApi(destination.failureReason);
|
|
121
116
|
}
|
|
122
117
|
return true;
|
|
123
118
|
}
|
|
@@ -19,8 +19,6 @@ export declare type THopInfo = {
|
|
|
19
19
|
export declare type DryRunResult = {
|
|
20
20
|
origin: DryRunNodeResult;
|
|
21
21
|
destination?: DryRunNodeResult;
|
|
22
|
-
assetHub?: DryRunNodeResult;
|
|
23
|
-
bridgeHub?: DryRunNodeResult;
|
|
24
22
|
hops: THopInfo[];
|
|
25
23
|
};
|
|
26
24
|
interface GetXcmFeeRequest {
|
|
@@ -6,7 +6,7 @@ import { ProxyServiceRoute } from '@subwallet/extension-base/types/environment';
|
|
|
6
6
|
import { fetchFromProxyService } from '@subwallet/extension-base/utils';
|
|
7
7
|
import BigNumber from 'bignumber.js';
|
|
8
8
|
import { assert, compactToU8a, isHex, u8aConcat, u8aEq } from '@polkadot/util';
|
|
9
|
-
const version = '/
|
|
9
|
+
const version = '/v5';
|
|
10
10
|
const paraSpellApi = {
|
|
11
11
|
buildXcm: `${version}/x-transfer`,
|
|
12
12
|
feeXcm: `${version}/xcm-fee`,
|