@subwallet/extension-base 1.2.32-0 → 1.2.33-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 +78 -227
- package/background/KoniTypes.js +3 -40
- package/background/errors/SWError.d.ts +4 -7
- package/background/errors/SWError.js +4 -0
- package/background/errors/TransactionError.d.ts +2 -2
- package/background/errors/TransactionError.js +2 -4
- package/background/handlers/State.d.ts +0 -12
- package/background/types.d.ts +9 -134
- package/background/warnings/TransactionWarning.d.ts +1 -1
- package/background/warnings/TransactionWarning.js +5 -1
- package/cjs/background/KoniTypes.js +4 -44
- package/cjs/background/errors/SWError.js +4 -0
- package/cjs/background/errors/TransactionError.js +13 -15
- package/cjs/background/warnings/TransactionWarning.js +6 -2
- package/cjs/constants/environment.js +13 -0
- package/cjs/constants/index.js +40 -13
- package/cjs/constants/signing.js +23 -0
- package/cjs/constants/storage.js +4 -2
- package/cjs/core/consts.js +20 -0
- package/cjs/core/logic-validation/recipientAddress.js +106 -0
- package/cjs/core/logic-validation/request.js +11 -19
- package/cjs/core/logic-validation/swap.js +5 -5
- package/cjs/core/logic-validation/transfer.js +83 -42
- package/cjs/core/types.js +26 -0
- package/cjs/core/utils.js +113 -0
- package/cjs/koni/api/dotsama/crowdloan.js +1 -1
- package/cjs/koni/api/nft/index.js +14 -5
- package/cjs/koni/api/staking/bonding/paraChain.js +8 -8
- package/cjs/koni/api/staking/bonding/relayChain.js +9 -9
- package/cjs/koni/api/staking/index.js +4 -1
- package/cjs/koni/background/cron.js +7 -7
- package/cjs/koni/background/handlers/Extension.js +510 -1446
- package/cjs/koni/background/handlers/State.js +61 -238
- package/cjs/koni/background/handlers/Tabs.js +143 -107
- package/cjs/koni/background/subscription.js +5 -5
- package/cjs/packageInfo.js +1 -1
- package/cjs/page/Accounts.js +2 -5
- package/cjs/page/SubWalleEvmProvider.js +1 -1
- package/cjs/page/index.js +2 -1
- package/cjs/services/balance-service/BalanceMapImpl.js +48 -20
- package/cjs/services/balance-service/helpers/subscribe/index.js +27 -12
- package/cjs/services/balance-service/helpers/subscribe/ton/consts.js +40 -0
- package/cjs/services/balance-service/helpers/subscribe/ton/ton.js +120 -0
- package/cjs/services/balance-service/helpers/subscribe/ton/utils.js +181 -0
- package/cjs/services/balance-service/index.js +25 -13
- package/cjs/services/balance-service/transfer/token.js +41 -24
- package/cjs/services/balance-service/transfer/ton-transfer.js +136 -0
- package/cjs/services/buy-service/index.js +5 -1
- package/cjs/services/chain-service/constants.js +1 -1
- package/cjs/services/chain-service/handler/TonApi.js +213 -0
- package/cjs/services/chain-service/handler/TonChainHandler.js +81 -0
- package/cjs/services/chain-service/index.js +32 -8
- package/cjs/services/chain-service/utils/index.js +78 -22
- package/cjs/services/earning-service/constants/chains.js +3 -1
- package/cjs/services/earning-service/handlers/base.js +2 -1
- package/cjs/services/earning-service/handlers/lending/base.js +8 -9
- package/cjs/services/earning-service/handlers/lending/interlay.js +1 -1
- package/cjs/services/earning-service/handlers/liquid-staking/base.js +9 -10
- package/cjs/services/earning-service/handlers/liquid-staking/stella-swap.js +1 -1
- package/cjs/services/earning-service/handlers/native-staking/amplitude.js +1 -1
- package/cjs/services/earning-service/handlers/native-staking/astar.js +2 -2
- package/cjs/services/earning-service/handlers/native-staking/base-para.js +13 -13
- package/cjs/services/earning-service/handlers/native-staking/base.js +2 -2
- package/cjs/services/earning-service/handlers/native-staking/para-chain.js +2 -2
- package/cjs/services/earning-service/handlers/native-staking/relay-chain.js +15 -15
- package/cjs/services/earning-service/handlers/nomination-pool/index.js +14 -14
- package/cjs/services/earning-service/handlers/special.js +10 -10
- package/cjs/services/earning-service/service.js +26 -17
- package/cjs/services/history-service/helpers/subscan-extrinsic-parser-helper.js +1 -1
- package/cjs/services/history-service/index.js +29 -11
- package/cjs/services/history-service/subscan-history.js +9 -21
- package/cjs/services/keyring-service/context/account-context.js +259 -0
- package/cjs/services/keyring-service/context/handlers/Base.js +20 -0
- package/cjs/services/keyring-service/context/handlers/Derive.js +377 -0
- package/cjs/services/keyring-service/context/handlers/Inject.js +75 -0
- package/cjs/services/keyring-service/context/handlers/Json.js +348 -0
- package/cjs/services/keyring-service/context/handlers/Ledger.js +165 -0
- package/cjs/services/keyring-service/context/handlers/Mnemonic.js +218 -0
- package/cjs/services/keyring-service/context/handlers/Modify.js +258 -0
- package/cjs/services/keyring-service/context/handlers/Secret.js +310 -0
- package/cjs/services/keyring-service/context/handlers/index.js +82 -0
- package/cjs/services/keyring-service/context/state.js +649 -0
- package/cjs/services/keyring-service/context/stores/AccountProxy.js +32 -0
- package/cjs/services/keyring-service/context/stores/Base.js +37 -0
- package/cjs/services/keyring-service/context/stores/CurrentAccount.js +28 -0
- package/cjs/services/keyring-service/context/stores/ModifyPair.js +19 -0
- package/cjs/services/keyring-service/context/stores/index.js +38 -0
- package/cjs/services/keyring-service/index.js +20 -164
- package/cjs/services/migration-service/scripts/index.js +6 -4
- package/cjs/services/migration-service/scripts/{MigrateLedgerAccountV2.js → keyring/MigrateLedgerAccountV2.js} +1 -1
- package/cjs/services/migration-service/scripts/keyring/MigratePairData.js +28 -0
- package/cjs/services/migration-service/scripts/{MigrateRemoveGenesisHash.js → keyring/MigrateRemoveGenesisHash.js} +1 -1
- package/cjs/services/request-service/constants.js +5 -3
- package/cjs/services/request-service/handler/AuthRequestHandler.js +104 -57
- package/cjs/services/request-service/handler/EvmRequestHandler.js +3 -4
- package/cjs/services/request-service/handler/SubstrateRequestHandler.js +5 -11
- package/cjs/services/request-service/handler/TonRequestHandler.js +175 -0
- package/cjs/services/request-service/index.js +24 -5
- package/cjs/services/swap-service/handler/asset-hub/handler.js +6 -5
- package/cjs/services/swap-service/handler/base-handler.js +8 -8
- package/cjs/services/swap-service/handler/chainflip-handler.js +5 -4
- package/cjs/services/swap-service/handler/hydradx-handler.js +4 -3
- package/cjs/services/swap-service/index.js +4 -4
- package/cjs/services/transaction-service/helpers/index.js +6 -1
- package/cjs/services/transaction-service/index.js +184 -84
- package/cjs/services/wallet-connect-service/handler/PolkadotRequestHandler.js +2 -10
- package/cjs/stores/AccountProxyStore.js +18 -0
- package/cjs/stores/ModifyPairStore.js +18 -0
- package/cjs/stores/index.js +23 -2
- package/cjs/types/account/action/add/index.js +38 -0
- package/cjs/types/account/action/add/json.js +1 -0
- package/cjs/types/account/action/add/mnemonic.js +1 -0
- package/cjs/types/account/action/add/secret.js +1 -0
- package/cjs/types/account/action/derive.js +1 -0
- package/cjs/types/account/action/edit.js +1 -0
- package/cjs/types/account/action/export.js +1 -0
- package/cjs/types/account/action/index.js +71 -0
- package/cjs/types/account/action/subscribe.js +16 -0
- package/cjs/types/account/action/validate.js +1 -0
- package/cjs/types/account/error/common.js +40 -0
- package/cjs/types/account/error/derive.js +55 -0
- package/cjs/types/account/error/index.js +27 -0
- package/cjs/types/account/index.js +38 -0
- package/cjs/types/account/info/current.js +1 -0
- package/cjs/types/account/info/index.js +38 -0
- package/cjs/types/account/info/keyring.js +90 -0
- package/cjs/types/account/info/proxy.js +49 -0
- package/cjs/types/error.js +1 -0
- package/cjs/types/index.js +44 -0
- package/cjs/types/transaction/data.js +1 -0
- package/cjs/types/transaction/error.js +53 -0
- package/cjs/types/transaction/index.js +49 -0
- package/cjs/types/transaction/request.js +1 -0
- package/cjs/types/transaction/warning.js +14 -0
- package/cjs/types/yield/actions/join/validate.js +1 -16
- package/cjs/utils/account/analyze.js +166 -0
- package/cjs/utils/account/common.js +121 -0
- package/cjs/utils/account/derive/index.js +27 -0
- package/cjs/utils/account/derive/info/index.js +27 -0
- package/cjs/utils/account/derive/info/solo.js +246 -0
- package/cjs/utils/account/derive/info/unified.js +112 -0
- package/cjs/utils/account/derive/validate.js +177 -0
- package/cjs/utils/account/index.js +49 -0
- package/cjs/utils/account/transform.js +566 -0
- package/cjs/utils/auth.js +46 -0
- package/cjs/utils/getId.js +8 -1
- package/cjs/utils/index.js +48 -62
- package/constants/environment.d.ts +1 -0
- package/constants/environment.js +6 -0
- package/constants/index.d.ts +5 -1
- package/constants/index.js +5 -2
- package/constants/signing.d.ts +4 -0
- package/constants/signing.js +15 -0
- package/constants/storage.d.ts +1 -0
- package/constants/storage.js +2 -1
- package/core/consts.d.ts +1 -0
- package/core/consts.js +13 -0
- package/core/logic-validation/recipientAddress.d.ts +2 -0
- package/core/logic-validation/recipientAddress.js +100 -0
- package/core/logic-validation/request.js +10 -18
- package/core/logic-validation/swap.js +1 -1
- package/core/logic-validation/transfer.d.ts +3 -2
- package/core/logic-validation/transfer.js +50 -10
- package/core/types.d.ts +26 -0
- package/core/types.js +19 -0
- package/core/utils.d.ts +10 -0
- package/core/utils.js +105 -0
- package/koni/api/dotsama/crowdloan.js +1 -1
- package/koni/api/nft/index.js +14 -5
- package/koni/api/staking/bonding/paraChain.js +2 -2
- package/koni/api/staking/bonding/relayChain.js +2 -2
- package/koni/api/staking/index.js +4 -1
- package/koni/background/cron.js +7 -7
- package/koni/background/handlers/Extension.d.ts +26 -35
- package/koni/background/handlers/Extension.js +337 -1242
- package/koni/background/handlers/State.d.ts +12 -19
- package/koni/background/handlers/State.js +57 -231
- package/koni/background/handlers/Tabs.d.ts +2 -3
- package/koni/background/handlers/Tabs.js +105 -61
- package/koni/background/subscription.js +5 -5
- package/package.json +352 -53
- package/packageInfo.js +1 -1
- package/page/Accounts.js +2 -5
- package/page/SubWalleEvmProvider.js +1 -1
- package/page/index.js +2 -1
- package/services/balance-service/BalanceMapImpl.d.ts +6 -4
- package/services/balance-service/BalanceMapImpl.js +44 -18
- package/services/balance-service/helpers/subscribe/index.d.ts +3 -4
- package/services/balance-service/helpers/subscribe/index.js +29 -14
- package/services/balance-service/helpers/subscribe/ton/consts.d.ts +18 -0
- package/services/balance-service/helpers/subscribe/ton/consts.js +28 -0
- package/services/balance-service/helpers/subscribe/ton/ton.d.ts +3 -0
- package/services/balance-service/helpers/subscribe/ton/ton.js +111 -0
- package/services/balance-service/helpers/subscribe/ton/types.d.ts +26 -0
- package/services/balance-service/helpers/subscribe/ton/utils.d.ts +32 -0
- package/services/balance-service/helpers/subscribe/ton/utils.js +159 -0
- package/services/balance-service/index.js +25 -13
- package/services/balance-service/transfer/token.d.ts +2 -2
- package/services/balance-service/transfer/token.js +18 -1
- package/services/balance-service/transfer/ton-transfer.d.ts +25 -0
- package/services/balance-service/transfer/ton-transfer.js +127 -0
- package/services/buy-service/index.js +5 -1
- package/services/buy-service/types.d.ts +2 -2
- package/services/chain-service/constants.js +1 -1
- package/services/chain-service/handler/TonApi.d.ts +52 -0
- package/services/chain-service/handler/TonApi.js +204 -0
- package/services/chain-service/handler/TonChainHandler.d.ts +17 -0
- package/services/chain-service/handler/TonChainHandler.js +73 -0
- package/services/chain-service/index.d.ts +5 -1
- package/services/chain-service/index.js +32 -8
- package/services/chain-service/types.d.ts +24 -0
- package/services/chain-service/utils/index.d.ts +10 -2
- package/services/chain-service/utils/index.js +59 -18
- package/services/earning-service/constants/chains.d.ts +1 -0
- package/services/earning-service/constants/chains.js +1 -0
- package/services/earning-service/handlers/base.js +3 -2
- package/services/earning-service/handlers/lending/base.js +1 -2
- package/services/earning-service/handlers/lending/interlay.js +2 -2
- package/services/earning-service/handlers/liquid-staking/base.js +1 -2
- package/services/earning-service/handlers/liquid-staking/stella-swap.js +2 -2
- package/services/earning-service/handlers/native-staking/amplitude.js +2 -2
- package/services/earning-service/handlers/native-staking/astar.js +2 -2
- package/services/earning-service/handlers/native-staking/base-para.js +2 -2
- package/services/earning-service/handlers/native-staking/base.js +2 -2
- package/services/earning-service/handlers/native-staking/para-chain.js +2 -2
- package/services/earning-service/handlers/native-staking/relay-chain.js +2 -2
- package/services/earning-service/handlers/nomination-pool/index.js +2 -2
- package/services/earning-service/handlers/special.js +2 -2
- package/services/earning-service/service.js +18 -9
- package/services/event-service/types.d.ts +3 -1
- package/services/history-service/helpers/subscan-extrinsic-parser-helper.js +1 -1
- package/services/history-service/index.d.ts +4 -1
- package/services/history-service/index.js +29 -11
- package/services/history-service/subscan-history.js +8 -20
- package/services/keyring-service/context/account-context.d.ts +87 -0
- package/services/keyring-service/context/account-context.js +250 -0
- package/services/keyring-service/context/handlers/Base.d.ts +11 -0
- package/services/keyring-service/context/handlers/Base.js +13 -0
- package/services/keyring-service/context/handlers/Derive.d.ts +29 -0
- package/services/keyring-service/context/handlers/Derive.js +365 -0
- package/services/keyring-service/context/handlers/Inject.d.ts +11 -0
- package/services/keyring-service/context/handlers/Inject.js +69 -0
- package/services/keyring-service/context/handlers/Json.d.ts +18 -0
- package/services/keyring-service/context/handlers/Json.js +328 -0
- package/services/keyring-service/context/handlers/Ledger.d.ts +11 -0
- package/services/keyring-service/context/handlers/Ledger.js +158 -0
- package/services/keyring-service/context/handlers/Mnemonic.d.ts +15 -0
- package/services/keyring-service/context/handlers/Mnemonic.js +206 -0
- package/services/keyring-service/context/handlers/Modify.d.ts +16 -0
- package/services/keyring-service/context/handlers/Modify.js +250 -0
- package/services/keyring-service/context/handlers/Secret.d.ts +16 -0
- package/services/keyring-service/context/handlers/Secret.js +299 -0
- package/services/keyring-service/context/handlers/index.d.ts +7 -0
- package/services/keyring-service/context/handlers/index.js +10 -0
- package/services/keyring-service/context/state.d.ts +92 -0
- package/services/keyring-service/context/state.js +629 -0
- package/services/keyring-service/context/stores/AccountProxy.d.ts +13 -0
- package/services/keyring-service/context/stores/AccountProxy.js +25 -0
- package/services/keyring-service/context/stores/Base.d.ts +22 -0
- package/services/keyring-service/context/stores/Base.js +30 -0
- package/services/keyring-service/context/stores/CurrentAccount.d.ts +15 -0
- package/services/keyring-service/context/stores/CurrentAccount.js +21 -0
- package/services/keyring-service/context/stores/ModifyPair.d.ts +10 -0
- package/services/keyring-service/context/stores/ModifyPair.js +12 -0
- package/services/keyring-service/context/stores/index.d.ts +3 -0
- package/services/keyring-service/context/stores/index.js +6 -0
- package/services/keyring-service/index.d.ts +10 -22
- package/services/keyring-service/index.js +20 -161
- package/services/migration-service/scripts/index.js +6 -4
- package/services/migration-service/scripts/{MigrateLedgerAccountV2.d.ts → keyring/MigrateLedgerAccountV2.d.ts} +1 -1
- package/services/migration-service/scripts/{MigrateLedgerAccountV2.js → keyring/MigrateLedgerAccountV2.js} +1 -1
- package/services/migration-service/scripts/keyring/MigratePairData.d.ts +4 -0
- package/services/migration-service/scripts/keyring/MigratePairData.js +20 -0
- package/services/migration-service/scripts/{MigrateRemoveGenesisHash.js → keyring/MigrateRemoveGenesisHash.js} +1 -1
- package/services/request-service/constants.d.ts +1 -1
- package/services/request-service/constants.js +2 -1
- package/services/request-service/handler/AuthRequestHandler.d.ts +1 -0
- package/services/request-service/handler/AuthRequestHandler.js +93 -45
- package/services/request-service/handler/EvmRequestHandler.js +3 -4
- package/services/request-service/handler/SubstrateRequestHandler.d.ts +2 -2
- package/services/request-service/handler/SubstrateRequestHandler.js +5 -11
- package/services/request-service/handler/TonRequestHandler.d.ts +17 -0
- package/services/request-service/handler/TonRequestHandler.js +168 -0
- package/services/request-service/index.d.ts +8 -3
- package/services/request-service/index.js +23 -5
- package/services/request-service/types.d.ts +6 -3
- package/services/swap-service/handler/asset-hub/handler.d.ts +1 -1
- package/services/swap-service/handler/asset-hub/handler.js +2 -1
- package/services/swap-service/handler/base-handler.js +1 -1
- package/services/swap-service/handler/chainflip-handler.d.ts +1 -1
- package/services/swap-service/handler/chainflip-handler.js +4 -3
- package/services/swap-service/handler/hydradx-handler.d.ts +1 -1
- package/services/swap-service/handler/hydradx-handler.js +2 -1
- package/services/swap-service/index.js +1 -1
- package/services/transaction-service/helpers/index.d.ts +2 -0
- package/services/transaction-service/helpers/index.js +4 -0
- package/services/transaction-service/index.d.ts +1 -0
- package/services/transaction-service/index.js +114 -17
- package/services/transaction-service/types.d.ts +4 -2
- package/services/wallet-connect-service/handler/PolkadotRequestHandler.js +2 -10
- package/stores/AccountProxyStore.d.ts +5 -0
- package/stores/AccountProxyStore.js +10 -0
- package/stores/Authorize.d.ts +1 -1
- package/stores/CurrentAccountStore.d.ts +1 -1
- package/stores/ModifyPairStore.d.ts +5 -0
- package/stores/ModifyPairStore.js +10 -0
- package/stores/index.d.ts +4 -1
- package/stores/index.js +5 -2
- package/types/account/action/add/index.d.ts +3 -0
- package/types/account/action/add/index.js +6 -0
- package/types/account/action/add/json.d.ts +29 -0
- package/types/account/action/add/json.js +1 -0
- package/types/account/action/add/mnemonic.d.ts +77 -0
- package/types/account/action/add/mnemonic.js +1 -0
- package/types/account/action/add/secret.d.ts +55 -0
- package/types/account/action/add/secret.js +1 -0
- package/types/account/action/derive.d.ts +77 -0
- package/types/account/action/derive.js +1 -0
- package/types/account/action/edit.d.ts +31 -0
- package/types/account/action/edit.js +1 -0
- package/types/account/action/export.d.ts +15 -0
- package/types/account/action/export.js +1 -0
- package/types/account/action/index.d.ts +6 -0
- package/types/account/action/index.js +9 -0
- package/types/account/action/subscribe.d.ts +22 -0
- package/types/account/action/subscribe.js +10 -0
- package/types/account/action/validate.d.ts +17 -0
- package/types/account/action/validate.js +1 -0
- package/types/account/error/common.d.ts +10 -0
- package/types/account/error/common.js +33 -0
- package/types/account/error/derive.d.ts +13 -0
- package/types/account/error/derive.js +48 -0
- package/types/account/error/index.d.ts +2 -0
- package/types/account/error/index.js +5 -0
- package/types/account/index.d.ts +3 -0
- package/types/account/index.js +6 -0
- package/types/account/info/current.d.ts +10 -0
- package/types/account/info/current.js +1 -0
- package/types/account/info/index.d.ts +3 -0
- package/types/account/info/index.js +6 -0
- package/types/account/info/keyring.d.ts +161 -0
- package/types/account/info/keyring.js +88 -0
- package/types/account/info/proxy.d.ts +73 -0
- package/types/account/info/proxy.js +46 -0
- package/types/balance/index.d.ts +4 -1
- package/types/buy.d.ts +3 -1
- package/types/error.d.ts +8 -0
- package/types/error.js +1 -0
- package/types/index.d.ts +4 -0
- package/types/index.js +5 -1
- package/types/transaction/data.d.ts +17 -0
- package/types/transaction/data.js +1 -0
- package/types/transaction/error.d.ts +39 -0
- package/types/transaction/error.js +44 -0
- package/types/transaction/index.d.ts +4 -0
- package/types/transaction/index.js +7 -0
- package/types/transaction/request.d.ts +24 -0
- package/types/transaction/request.js +1 -0
- package/types/transaction/warning.d.ts +5 -0
- package/types/transaction/warning.js +8 -0
- package/types/yield/actions/join/submit.d.ts +2 -2
- package/types/yield/actions/join/validate.d.ts +1 -6
- package/types/yield/actions/join/validate.js +1 -10
- package/types/yield/actions/others.d.ts +1 -1
- package/utils/account/analyze.d.ts +4 -0
- package/utils/account/analyze.js +159 -0
- package/utils/account/common.d.ts +16 -0
- package/utils/account/common.js +104 -0
- package/utils/account/derive/index.d.ts +2 -0
- package/utils/account/derive/index.js +5 -0
- package/utils/account/derive/info/index.d.ts +2 -0
- package/utils/account/derive/info/index.js +5 -0
- package/utils/account/derive/info/solo.d.ts +11 -0
- package/utils/account/derive/info/solo.js +230 -0
- package/utils/account/derive/info/unified.d.ts +7 -0
- package/utils/account/derive/info/unified.js +102 -0
- package/utils/account/derive/validate.d.ts +8 -0
- package/utils/account/derive/validate.js +165 -0
- package/utils/account/index.d.ts +4 -0
- package/utils/account/index.js +7 -0
- package/utils/account/transform.d.ts +41 -0
- package/utils/account/transform.js +533 -0
- package/utils/auth.d.ts +2 -0
- package/utils/auth.js +39 -0
- package/utils/canDerive.d.ts +1 -1
- package/utils/eth/mergeTransactionAndSignature.d.ts +1 -1
- package/utils/getId.d.ts +1 -0
- package/utils/getId.js +3 -1
- package/utils/index.d.ts +12 -5
- package/utils/index.js +28 -47
- package/cjs/signers/substrates/KeyringSigner.js +0 -35
- package/cjs/signers/substrates/LedgerSigner.js +0 -44
- package/cjs/signers/substrates/QrSigner.js +0 -63
- package/cjs/signers/types.js +0 -15
- package/cjs/signers/web3/QrSigner.js +0 -67
- package/cjs/utils/account.js +0 -34
- package/signers/substrates/KeyringSigner.d.ts +0 -13
- package/signers/substrates/KeyringSigner.js +0 -27
- package/signers/substrates/LedgerSigner.d.ts +0 -13
- package/signers/substrates/LedgerSigner.js +0 -37
- package/signers/substrates/QrSigner.d.ts +0 -20
- package/signers/substrates/QrSigner.js +0 -55
- package/signers/types.d.ts +0 -34
- package/signers/types.js +0 -9
- package/signers/web3/QrSigner.d.ts +0 -18
- package/signers/web3/QrSigner.js +0 -59
- package/types/transaction.d.ts +0 -3
- package/utils/account.d.ts +0 -5
- package/utils/account.js +0 -24
- /package/cjs/{types/transaction.js → services/balance-service/helpers/subscribe/ton/types.js} +0 -0
- /package/cjs/services/migration-service/scripts/{MigrateLedgerAccount.js → keyring/MigrateLedgerAccount.js} +0 -0
- /package/{types/transaction.js → services/balance-service/helpers/subscribe/ton/types.js} +0 -0
- /package/services/migration-service/scripts/{MigrateLedgerAccount.d.ts → keyring/MigrateLedgerAccount.d.ts} +0 -0
- /package/services/migration-service/scripts/{MigrateLedgerAccount.js → keyring/MigrateLedgerAccount.js} +0 -0
- /package/services/migration-service/scripts/{MigrateRemoveGenesisHash.d.ts → keyring/MigrateRemoveGenesisHash.d.ts} +0 -0
package/core/types.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { _ChainInfo } from '@subwallet/chain-list/types';
|
|
2
|
+
import { AccountJson } from '@subwallet/extension-base/types';
|
|
3
|
+
export declare type LedgerMustCheckType = 'polkadot' | 'migration' | 'unnecessary';
|
|
4
|
+
export declare enum ValidationCondition {
|
|
5
|
+
IS_NOT_NULL = "IS_NOT_NULL",
|
|
6
|
+
IS_ADDRESS = "IS_ADDRESS",
|
|
7
|
+
IS_VALID_ADDRESS_FOR_ECOSYSTEM = "IS_VALID_ADDRESS_FOR_ECOSYSTEM",
|
|
8
|
+
IS_VALID_SUBSTRATE_ADDRESS_FORMAT = "IS_VALID_SUBSTRATE_ADDRESS_FORMAT",
|
|
9
|
+
IS_VALID_TON_ADDRESS_FORMAT = "IS_VALID_TON_ADDRESS_FORMAT",
|
|
10
|
+
IS_NOT_DUPLICATE_ADDRESS = "IS_NOT_DUPLICATE_ADDRESS",
|
|
11
|
+
IS_SUPPORT_LEDGER_ACCOUNT = "IS_SUPPORT_LEDGER_ACCOUNT"
|
|
12
|
+
}
|
|
13
|
+
export declare enum ActionType {
|
|
14
|
+
SEND_FUND = "SEND_FUND",
|
|
15
|
+
SEND_NFT = "SEND_NFT",
|
|
16
|
+
SWAP = "SWAP"
|
|
17
|
+
}
|
|
18
|
+
export interface ValidateRecipientParams {
|
|
19
|
+
srcChain: string;
|
|
20
|
+
destChainInfo: _ChainInfo;
|
|
21
|
+
fromAddress: string;
|
|
22
|
+
toAddress: string;
|
|
23
|
+
account: AccountJson | null;
|
|
24
|
+
actionType: ActionType;
|
|
25
|
+
autoFormatValue?: boolean;
|
|
26
|
+
}
|
package/core/types.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Copyright 2019-2022 @subwallet/extension-base
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
export let ValidationCondition;
|
|
5
|
+
(function (ValidationCondition) {
|
|
6
|
+
ValidationCondition["IS_NOT_NULL"] = "IS_NOT_NULL";
|
|
7
|
+
ValidationCondition["IS_ADDRESS"] = "IS_ADDRESS";
|
|
8
|
+
ValidationCondition["IS_VALID_ADDRESS_FOR_ECOSYSTEM"] = "IS_VALID_ADDRESS_FOR_ECOSYSTEM";
|
|
9
|
+
ValidationCondition["IS_VALID_SUBSTRATE_ADDRESS_FORMAT"] = "IS_VALID_SUBSTRATE_ADDRESS_FORMAT";
|
|
10
|
+
ValidationCondition["IS_VALID_TON_ADDRESS_FORMAT"] = "IS_VALID_TON_ADDRESS_FORMAT";
|
|
11
|
+
ValidationCondition["IS_NOT_DUPLICATE_ADDRESS"] = "IS_NOT_DUPLICATE_ADDRESS";
|
|
12
|
+
ValidationCondition["IS_SUPPORT_LEDGER_ACCOUNT"] = "IS_SUPPORT_LEDGER_ACCOUNT";
|
|
13
|
+
})(ValidationCondition || (ValidationCondition = {}));
|
|
14
|
+
export let ActionType;
|
|
15
|
+
(function (ActionType) {
|
|
16
|
+
ActionType["SEND_FUND"] = "SEND_FUND";
|
|
17
|
+
ActionType["SEND_NFT"] = "SEND_NFT";
|
|
18
|
+
ActionType["SWAP"] = "SWAP";
|
|
19
|
+
})(ActionType || (ActionType = {}));
|
package/core/utils.d.ts
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import { ExtrinsicType } from '@subwallet/extension-base/background/KoniTypes';
|
|
2
|
+
import { LedgerMustCheckType, ValidateRecipientParams } from '@subwallet/extension-base/core/types';
|
|
3
|
+
import { AccountJson } from '@subwallet/extension-base/types';
|
|
2
4
|
export declare function getStrictMode(type: string, extrinsicType?: ExtrinsicType): boolean;
|
|
3
5
|
export declare function _getAppliedExistentialDeposit(existentialDeposit: string, strictMode?: boolean): bigint;
|
|
4
6
|
export declare function getMaxBigInt(a: bigint, b: bigint): bigint;
|
|
7
|
+
export declare function ledgerMustCheckNetwork(account: AccountJson | null): LedgerMustCheckType;
|
|
8
|
+
export declare function _isNotNull(validateRecipientParams: ValidateRecipientParams): string;
|
|
9
|
+
export declare function _isAddress(validateRecipientParams: ValidateRecipientParams): string;
|
|
10
|
+
export declare function _isValidAddressForEcosystem(validateRecipientParams: ValidateRecipientParams): string;
|
|
11
|
+
export declare function _isValidSubstrateAddressFormat(validateRecipientParams: ValidateRecipientParams): string;
|
|
12
|
+
export declare function _isValidTonAddressFormat(validateRecipientParams: ValidateRecipientParams): string;
|
|
13
|
+
export declare function _isNotDuplicateAddress(validateRecipientParams: ValidateRecipientParams): string;
|
|
14
|
+
export declare function _isSupportLedgerAccount(validateRecipientParams: ValidateRecipientParams): string;
|
package/core/utils.js
CHANGED
|
@@ -2,7 +2,13 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
4
|
import { ExtrinsicType } from '@subwallet/extension-base/background/KoniTypes';
|
|
5
|
+
import { LEDGER_GENERIC_ALLOW_NETWORKS } from '@subwallet/extension-base/core/consts';
|
|
5
6
|
import { BalanceAccountType } from '@subwallet/extension-base/core/substrate/types';
|
|
7
|
+
import { tonAddressInfo } from '@subwallet/extension-base/services/balance-service/helpers/subscribe/ton/utils';
|
|
8
|
+
import { _isChainEvmCompatible, _isChainSubstrateCompatible, _isChainTonCompatible } from '@subwallet/extension-base/services/chain-service/utils';
|
|
9
|
+
import { isAddressAndChainCompatible, isSameAddress, reformatAddress } from '@subwallet/extension-base/utils';
|
|
10
|
+
import { isAddress, isTonAddress } from '@subwallet/keyring';
|
|
11
|
+
import { isEthereumAddress } from '@polkadot/util-crypto';
|
|
6
12
|
export function getStrictMode(type, extrinsicType) {
|
|
7
13
|
if (type === BalanceAccountType.FrameSystemAccountInfo) {
|
|
8
14
|
return !extrinsicType || ![ExtrinsicType.TRANSFER_BALANCE].includes(extrinsicType);
|
|
@@ -14,4 +20,103 @@ export function _getAppliedExistentialDeposit(existentialDeposit, strictMode) {
|
|
|
14
20
|
}
|
|
15
21
|
export function getMaxBigInt(a, b) {
|
|
16
22
|
return a > b ? a : b;
|
|
23
|
+
}
|
|
24
|
+
export function ledgerMustCheckNetwork(account) {
|
|
25
|
+
if (account && account.isHardware && account.isGeneric && !isEthereumAddress(account.address)) {
|
|
26
|
+
return account.originGenesisHash ? 'migration' : 'polkadot';
|
|
27
|
+
} else {
|
|
28
|
+
return 'unnecessary';
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// --- recipient address validation --- //
|
|
33
|
+
|
|
34
|
+
export function _isNotNull(validateRecipientParams) {
|
|
35
|
+
const {
|
|
36
|
+
toAddress
|
|
37
|
+
} = validateRecipientParams;
|
|
38
|
+
if (!toAddress) {
|
|
39
|
+
return 'Recipient address is required';
|
|
40
|
+
}
|
|
41
|
+
return '';
|
|
42
|
+
}
|
|
43
|
+
export function _isAddress(validateRecipientParams) {
|
|
44
|
+
const {
|
|
45
|
+
toAddress
|
|
46
|
+
} = validateRecipientParams;
|
|
47
|
+
if (!isAddress(toAddress)) {
|
|
48
|
+
return 'Invalid recipient address';
|
|
49
|
+
}
|
|
50
|
+
return '';
|
|
51
|
+
}
|
|
52
|
+
export function _isValidAddressForEcosystem(validateRecipientParams) {
|
|
53
|
+
const {
|
|
54
|
+
destChainInfo,
|
|
55
|
+
toAddress
|
|
56
|
+
} = validateRecipientParams;
|
|
57
|
+
if (!isAddressAndChainCompatible(toAddress, destChainInfo)) {
|
|
58
|
+
if (_isChainEvmCompatible(destChainInfo) || _isChainSubstrateCompatible(destChainInfo) || _isChainTonCompatible(destChainInfo)) {
|
|
59
|
+
return 'Recipient address must be the same type as sender address';
|
|
60
|
+
}
|
|
61
|
+
return 'Unknown chain type';
|
|
62
|
+
}
|
|
63
|
+
return '';
|
|
64
|
+
}
|
|
65
|
+
export function _isValidSubstrateAddressFormat(validateRecipientParams) {
|
|
66
|
+
var _destChainInfo$substr, _destChainInfo$substr2;
|
|
67
|
+
const {
|
|
68
|
+
destChainInfo,
|
|
69
|
+
toAddress
|
|
70
|
+
} = validateRecipientParams;
|
|
71
|
+
const addressPrefix = (_destChainInfo$substr = destChainInfo === null || destChainInfo === void 0 ? void 0 : (_destChainInfo$substr2 = destChainInfo.substrateInfo) === null || _destChainInfo$substr2 === void 0 ? void 0 : _destChainInfo$substr2.addressPrefix) !== null && _destChainInfo$substr !== void 0 ? _destChainInfo$substr : 42;
|
|
72
|
+
const toAddressFormatted = reformatAddress(toAddress, addressPrefix);
|
|
73
|
+
if (toAddressFormatted !== toAddress) {
|
|
74
|
+
return `Recipient address must be a valid ${destChainInfo.name} address`;
|
|
75
|
+
}
|
|
76
|
+
return '';
|
|
77
|
+
}
|
|
78
|
+
export function _isValidTonAddressFormat(validateRecipientParams) {
|
|
79
|
+
const {
|
|
80
|
+
destChainInfo,
|
|
81
|
+
toAddress
|
|
82
|
+
} = validateRecipientParams;
|
|
83
|
+
const tonInfoData = isTonAddress(toAddress) && tonAddressInfo(toAddress);
|
|
84
|
+
if (tonInfoData && tonInfoData.isTestOnly !== destChainInfo.isTestnet) {
|
|
85
|
+
return `Recipient address must be a valid ${destChainInfo.name} address`;
|
|
86
|
+
}
|
|
87
|
+
return '';
|
|
88
|
+
}
|
|
89
|
+
export function _isNotDuplicateAddress(validateRecipientParams) {
|
|
90
|
+
const {
|
|
91
|
+
fromAddress,
|
|
92
|
+
toAddress
|
|
93
|
+
} = validateRecipientParams;
|
|
94
|
+
if (isSameAddress(fromAddress, toAddress)) {
|
|
95
|
+
return 'Recipient address must be different from sender address';
|
|
96
|
+
}
|
|
97
|
+
return '';
|
|
98
|
+
}
|
|
99
|
+
export function _isSupportLedgerAccount(validateRecipientParams) {
|
|
100
|
+
const {
|
|
101
|
+
account,
|
|
102
|
+
destChainInfo
|
|
103
|
+
} = validateRecipientParams;
|
|
104
|
+
if (account !== null && account !== void 0 && account.isHardware) {
|
|
105
|
+
if (!account.isGeneric) {
|
|
106
|
+
var _destChainInfo$substr3;
|
|
107
|
+
// For ledger legacy
|
|
108
|
+
const availableGen = account.availableGenesisHashes || [];
|
|
109
|
+
const destChainName = (destChainInfo === null || destChainInfo === void 0 ? void 0 : destChainInfo.name) || 'Unknown';
|
|
110
|
+
if (!availableGen.includes((destChainInfo === null || destChainInfo === void 0 ? void 0 : (_destChainInfo$substr3 = destChainInfo.substrateInfo) === null || _destChainInfo$substr3 === void 0 ? void 0 : _destChainInfo$substr3.genesisHash) || '')) {
|
|
111
|
+
return 'Your Ledger account is not supported by {{network}} network.'.replace('{{network}}', destChainName);
|
|
112
|
+
}
|
|
113
|
+
} else {
|
|
114
|
+
// For ledger generic
|
|
115
|
+
const ledgerCheck = ledgerMustCheckNetwork(account);
|
|
116
|
+
if (ledgerCheck !== 'unnecessary' && !LEDGER_GENERIC_ALLOW_NETWORKS.includes(destChainInfo.slug)) {
|
|
117
|
+
return `Ledger ${ledgerCheck === 'polkadot' ? 'Polkadot' : 'Migration'} address is not supported for this transfer`;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return '';
|
|
17
122
|
}
|
|
@@ -164,7 +164,7 @@ export async function subscribeCrowdloan(addresses, substrateApiMap, callback) {
|
|
|
164
164
|
const now = Date.now();
|
|
165
165
|
const polkadotAPI = await substrateApiMap[COMMON_CHAIN_SLUGS.POLKADOT].isReady;
|
|
166
166
|
const kusamaAPI = await substrateApiMap[COMMON_CHAIN_SLUGS.KUSAMA].isReady;
|
|
167
|
-
const substrateAddresses = categoryAddresses(addresses)
|
|
167
|
+
const substrateAddresses = categoryAddresses(addresses).substrate;
|
|
168
168
|
const hexAddresses = substrateAddresses.map(address => {
|
|
169
169
|
return registry.createType('AccountId', address).toHex();
|
|
170
170
|
});
|
package/koni/api/nft/index.js
CHANGED
|
@@ -18,7 +18,10 @@ import { _isChainSupportEvmNft, _isChainSupportNativeNft, _isChainSupportWasmNft
|
|
|
18
18
|
import { categoryAddresses, targetIsWeb } from '@subwallet/extension-base/utils';
|
|
19
19
|
import AssetHubNftsPalletApi from "./assethub_nft/index.js";
|
|
20
20
|
function createSubstrateNftApi(chain, substrateApi, addresses) {
|
|
21
|
-
const
|
|
21
|
+
const {
|
|
22
|
+
evm: evmAddresses,
|
|
23
|
+
substrate: substrateAddresses
|
|
24
|
+
} = categoryAddresses(addresses);
|
|
22
25
|
if (_NFT_CHAIN_GROUP.acala.includes(chain)) {
|
|
23
26
|
return [new AcalaNftApi(substrateApi, substrateAddresses, chain)];
|
|
24
27
|
} else if (_NFT_CHAIN_GROUP.karura.includes(chain)) {
|
|
@@ -43,11 +46,11 @@ function createSubstrateNftApi(chain, substrateApi, addresses) {
|
|
|
43
46
|
return null;
|
|
44
47
|
}
|
|
45
48
|
function createWasmNftApi(chain, apiProps, addresses) {
|
|
46
|
-
const
|
|
49
|
+
const substrateAddresses = categoryAddresses(addresses).substrate;
|
|
47
50
|
return new WasmNftApi(apiProps, substrateAddresses, chain);
|
|
48
51
|
}
|
|
49
52
|
function createWeb3NftApi(chain, evmApi, addresses) {
|
|
50
|
-
const
|
|
53
|
+
const evmAddresses = categoryAddresses(addresses).evm;
|
|
51
54
|
return new EvmNftApi(evmApi, evmAddresses, chain);
|
|
52
55
|
}
|
|
53
56
|
const createOrdinalApi = (chain, subscanChain, addresses) => {
|
|
@@ -81,7 +84,10 @@ export class NftHandler {
|
|
|
81
84
|
}
|
|
82
85
|
setAddresses(addresses) {
|
|
83
86
|
this.addresses = addresses;
|
|
84
|
-
const
|
|
87
|
+
const {
|
|
88
|
+
evm: evmAddresses,
|
|
89
|
+
substrate: substrateAddresses
|
|
90
|
+
} = categoryAddresses(addresses);
|
|
85
91
|
for (const handler of this.handlers) {
|
|
86
92
|
const useAddresses = handler.isEthereum ? evmAddresses : substrateAddresses;
|
|
87
93
|
handler.setAddresses(useAddresses);
|
|
@@ -106,7 +112,10 @@ export class NftHandler {
|
|
|
106
112
|
if (this.needSetupApi) {
|
|
107
113
|
// setup connections for first time use
|
|
108
114
|
this.handlers = [];
|
|
109
|
-
const
|
|
115
|
+
const {
|
|
116
|
+
evm: evmAddresses,
|
|
117
|
+
substrate: substrateAddresses
|
|
118
|
+
} = categoryAddresses(this.addresses);
|
|
110
119
|
Object.entries(this.chainInfoMap).forEach(([chain, chainInfo]) => {
|
|
111
120
|
if (_isChainSupportNativeNft(chainInfo)) {
|
|
112
121
|
if (this.substrateApiMap[chain]) {
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
4
|
import { TransactionError } from '@subwallet/extension-base/background/errors/TransactionError';
|
|
5
|
-
import {
|
|
5
|
+
import { StakingType } from '@subwallet/extension-base/background/KoniTypes';
|
|
6
6
|
import { getBondedValidators, getEarningStatusByNominations, getExistUnstakeErrorMessage, getMaxValidatorErrorMessage, getMinStakeErrorMessage, getParaCurrentInflation, isUnstakeAll } from '@subwallet/extension-base/koni/api/staking/bonding/utils';
|
|
7
7
|
import { _STAKING_ERA_LENGTH_MAP } from '@subwallet/extension-base/services/chain-service/constants';
|
|
8
8
|
import { _isChainEvmCompatible } from '@subwallet/extension-base/services/chain-service/utils';
|
|
9
9
|
import { parseIdentity } from '@subwallet/extension-base/services/earning-service/utils';
|
|
10
|
-
import { EarningStatus, UnstakingStatus } from '@subwallet/extension-base/types';
|
|
10
|
+
import { BasicTxErrorType, EarningStatus, StakingTxErrorType, UnstakingStatus } from '@subwallet/extension-base/types';
|
|
11
11
|
import { isSameAddress, parseRawNumber, reformatAddress } from '@subwallet/extension-base/utils';
|
|
12
12
|
import { BN, BN_ZERO } from '@polkadot/util';
|
|
13
13
|
import { isEthereumAddress } from '@polkadot/util-crypto';
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
4
|
import { TransactionError } from '@subwallet/extension-base/background/errors/TransactionError';
|
|
5
|
-
import {
|
|
5
|
+
import { StakingType } from '@subwallet/extension-base/background/KoniTypes';
|
|
6
6
|
import { MAX_NOMINATIONS } from '@subwallet/extension-base/constants';
|
|
7
7
|
import { calculateAlephZeroValidatorReturn, calculateChainStakedReturn, calculateInflation, calculateTernoaValidatorReturn, calculateValidatorStakedReturn, getCommission, getExistUnstakeErrorMessage, getMaxValidatorErrorMessage, getMinStakeErrorMessage, parsePoolStashAddress } from '@subwallet/extension-base/koni/api/staking/bonding/utils';
|
|
8
8
|
import { _EXPECTED_BLOCK_TIME, _STAKING_ERA_LENGTH_MAP } from '@subwallet/extension-base/services/chain-service/constants';
|
|
9
9
|
import { _getChainSubstrateAddressPrefix } from '@subwallet/extension-base/services/chain-service/utils';
|
|
10
10
|
import { _STAKING_CHAIN_GROUP } from '@subwallet/extension-base/services/earning-service/constants';
|
|
11
11
|
import { parseIdentity } from '@subwallet/extension-base/services/earning-service/utils';
|
|
12
|
-
import { EarningStatus, UnstakingStatus } from '@subwallet/extension-base/types';
|
|
12
|
+
import { EarningStatus, StakingTxErrorType, UnstakingStatus } from '@subwallet/extension-base/types';
|
|
13
13
|
import { reformatAddress } from '@subwallet/extension-base/utils';
|
|
14
14
|
import BigN from 'bignumber.js';
|
|
15
15
|
import { t } from 'i18next';
|
|
@@ -10,7 +10,10 @@ import { _STAKING_CHAIN_GROUP } from '@subwallet/extension-base/services/earning
|
|
|
10
10
|
import { categoryAddresses } from '@subwallet/extension-base/utils';
|
|
11
11
|
export function stakingOnChainApi(addresses, substrateApiMap, chainInfoMap, stakingCallback, nominatorStateCallback) {
|
|
12
12
|
const filteredApiMap = [];
|
|
13
|
-
const
|
|
13
|
+
const {
|
|
14
|
+
evm: evmAddresses,
|
|
15
|
+
substrate: substrateAddresses
|
|
16
|
+
} = categoryAddresses(addresses);
|
|
14
17
|
Object.entries(chainInfoMap).forEach(([networkKey, chainInfo]) => {
|
|
15
18
|
if (_PURE_EVM_CHAINS.indexOf(networkKey) < 0 && _isChainSupportSubstrateStaking(chainInfo)) {
|
|
16
19
|
filteredApiMap.push({
|
package/koni/background/cron.js
CHANGED
|
@@ -52,7 +52,7 @@ export class KoniCron {
|
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
54
|
await Promise.all([this.state.eventService.waitKeyringReady, this.state.eventService.waitAssetReady]);
|
|
55
|
-
const currentAccountInfo = this.state.keyringService.currentAccount;
|
|
55
|
+
const currentAccountInfo = this.state.keyringService.context.currentAccount;
|
|
56
56
|
const commonReloadEvents = ['account.add', 'account.remove', 'account.updateCurrent', 'chain.add', 'asset.updateState'];
|
|
57
57
|
const mktCampaignReloadEvents = ['account.add', 'account.remove'];
|
|
58
58
|
this.eventHandler = (events, eventTypes) => {
|
|
@@ -74,7 +74,7 @@ export class KoniCron {
|
|
|
74
74
|
if (!commonReload && !chainUpdated && !reloadMantaPay) {
|
|
75
75
|
return;
|
|
76
76
|
}
|
|
77
|
-
const address = (_serviceInfo$currentA = serviceInfo.currentAccountInfo) === null || _serviceInfo$currentA === void 0 ? void 0 : _serviceInfo$currentA.
|
|
77
|
+
const address = (_serviceInfo$currentA = serviceInfo.currentAccountInfo) === null || _serviceInfo$currentA === void 0 ? void 0 : _serviceInfo$currentA.proxyId;
|
|
78
78
|
if (!address) {
|
|
79
79
|
return;
|
|
80
80
|
}
|
|
@@ -109,12 +109,12 @@ export class KoniCron {
|
|
|
109
109
|
this.state.eventService.onLazy(this.eventHandler);
|
|
110
110
|
this.addCron('fetchPoolInfo', this.fetchPoolInfo, CRON_REFRESH_CHAIN_STAKING_METADATA);
|
|
111
111
|
this.addCron('fetchMktCampaignData', this.fetchMktCampaignData, CRON_REFRESH_MKT_CAMPAIGN_INTERVAL);
|
|
112
|
-
if (!(currentAccountInfo !== null && currentAccountInfo !== void 0 && currentAccountInfo.
|
|
112
|
+
if (!(currentAccountInfo !== null && currentAccountInfo !== void 0 && currentAccountInfo.proxyId)) {
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
115
115
|
if (Object.keys(this.state.getSubstrateApiMap()).length !== 0 || Object.keys(this.state.getEvmApiMap()).length !== 0) {
|
|
116
|
-
this.resetNft(currentAccountInfo.
|
|
117
|
-
this.addCron('refreshNft', this.refreshNft(currentAccountInfo.
|
|
116
|
+
this.resetNft(currentAccountInfo.proxyId);
|
|
117
|
+
this.addCron('refreshNft', this.refreshNft(currentAccountInfo.proxyId, this.state.getApiMap(), this.state.getSmartContractNfts(), this.state.getActiveChainInfoMap()), CRON_REFRESH_NFT_INTERVAL);
|
|
118
118
|
// this.addCron('refreshStakingReward', this.refreshStakingReward(currentAccountInfo.address), CRON_REFRESH_STAKING_REWARD_INTERVAL);
|
|
119
119
|
this.addCron('syncMantaPay', this.syncMantaPay, CRON_SYNC_MANTA_PAY);
|
|
120
120
|
}
|
|
@@ -165,7 +165,7 @@ export class KoniCron {
|
|
|
165
165
|
return Object.keys(serviceInfo.chainApiMap.substrate).length > 0 || Object.keys(serviceInfo.chainApiMap.evm).length > 0;
|
|
166
166
|
};
|
|
167
167
|
async reloadNft() {
|
|
168
|
-
const address = this.state.keyringService.currentAccount.
|
|
168
|
+
const address = this.state.keyringService.context.currentAccount.proxyId;
|
|
169
169
|
const serviceInfo = this.state.getServiceInfo();
|
|
170
170
|
this.resetNft(address);
|
|
171
171
|
this.removeCron('refreshNft');
|
|
@@ -174,7 +174,7 @@ export class KoniCron {
|
|
|
174
174
|
return true;
|
|
175
175
|
}
|
|
176
176
|
async reloadStaking() {
|
|
177
|
-
const address = this.state.keyringService.currentAccount.
|
|
177
|
+
const address = this.state.keyringService.context.currentAccount.proxyId;
|
|
178
178
|
console.log('reload staking', address);
|
|
179
179
|
await waitTimeout(1800);
|
|
180
180
|
return true;
|
|
@@ -2,50 +2,45 @@
|
|
|
2
2
|
import { MessageTypes, RequestTypes, ResponseAuthorizeList, ResponseType } from '@subwallet/extension-base/background/types';
|
|
3
3
|
import KoniState from '@subwallet/extension-base/koni/background/handlers/State';
|
|
4
4
|
import { SignerPayloadJSON, SignerPayloadRaw } from '@polkadot/types/types';
|
|
5
|
-
import { Prefix } from '@polkadot/util-crypto/types';
|
|
6
|
-
export declare const SEED_DEFAULT_LENGTH = 12;
|
|
7
|
-
export declare const SEED_LENGTHS: number[];
|
|
8
5
|
export declare function isJsonPayload(value: SignerPayloadJSON | SignerPayloadRaw): value is SignerPayloadJSON;
|
|
9
6
|
export default class KoniExtension {
|
|
10
7
|
#private;
|
|
11
8
|
constructor(state: KoniState);
|
|
12
|
-
private accountsCreateExternal;
|
|
13
|
-
private accountsCreateHardware;
|
|
14
|
-
private accountsCreateSuri;
|
|
15
|
-
private accountsChangePassword;
|
|
16
9
|
private accountsEdit;
|
|
10
|
+
private tonGetAllTonWalletContractVersion;
|
|
11
|
+
private tonAccountChangeWalletContractVersion;
|
|
17
12
|
private accountsExport;
|
|
18
|
-
private accountsShow;
|
|
19
|
-
private accountsValidate;
|
|
20
|
-
private accountsSubscribe;
|
|
21
13
|
private metadataApprove;
|
|
22
14
|
private metadataGet;
|
|
23
15
|
private metadataList;
|
|
24
16
|
private metadataReject;
|
|
25
17
|
private metadataSubscribe;
|
|
26
|
-
private jsonRestore;
|
|
27
|
-
private batchRestore;
|
|
28
|
-
private jsonGetAccountInfo;
|
|
29
|
-
private seedCreate;
|
|
30
|
-
private seedValidate;
|
|
31
18
|
private signingApproveSignature;
|
|
32
19
|
private signingCancel;
|
|
33
20
|
private signingSubscribe;
|
|
34
21
|
private windowOpen;
|
|
35
|
-
private derive;
|
|
36
|
-
private derivationValidate;
|
|
37
|
-
private derivationCreate;
|
|
38
22
|
private cancelSubscription;
|
|
39
23
|
private createUnsubscriptionHandle;
|
|
40
|
-
decodeAddress: (key: string | Uint8Array, ignoreChecksum?: boolean, ss58Format?: Prefix) => Uint8Array;
|
|
41
|
-
encodeAddress: (key: string | Uint8Array, ss58Format?: Prefix) => string;
|
|
42
24
|
private accountExportPrivateKey;
|
|
43
25
|
private checkPublicAndSecretKey;
|
|
26
|
+
private checkNameExists;
|
|
44
27
|
private accountsGetAllWithCurrentAddress;
|
|
45
|
-
private
|
|
28
|
+
private subscribeInputAddressData;
|
|
29
|
+
/**
|
|
30
|
+
* @todo: move to keyring context
|
|
31
|
+
* */
|
|
46
32
|
private subscribeAddresses;
|
|
33
|
+
/**
|
|
34
|
+
* @todo: move to keyring context
|
|
35
|
+
* */
|
|
47
36
|
private saveRecentAccount;
|
|
37
|
+
/**
|
|
38
|
+
* @todo: move to keyring context
|
|
39
|
+
* */
|
|
48
40
|
private editContactAccount;
|
|
41
|
+
/**
|
|
42
|
+
* @todo: move to keyring context
|
|
43
|
+
* */
|
|
49
44
|
private deleteContactAccount;
|
|
50
45
|
private _getAuthListV2;
|
|
51
46
|
private authorizeSubscribeV2;
|
|
@@ -57,7 +52,7 @@ export default class KoniExtension {
|
|
|
57
52
|
private forgetSite;
|
|
58
53
|
private _forgetAllSite;
|
|
59
54
|
private forgetAllSite;
|
|
60
|
-
private
|
|
55
|
+
private getPairs;
|
|
61
56
|
private isAddressValidWithAuthType;
|
|
62
57
|
private filterAccountsByAccountAuthType;
|
|
63
58
|
private _changeAuthorizationAll;
|
|
@@ -85,9 +80,7 @@ export default class KoniExtension {
|
|
|
85
80
|
private setLanguage;
|
|
86
81
|
private setShowBalance;
|
|
87
82
|
private subscribeAuthUrls;
|
|
88
|
-
private
|
|
89
|
-
private updateCurrentAccountAddress;
|
|
90
|
-
private saveCurrentAccountAddress;
|
|
83
|
+
private saveCurrentAccountProxy;
|
|
91
84
|
private getAssetSetting;
|
|
92
85
|
private subscribeAssetSetting;
|
|
93
86
|
private updateAssetSetting;
|
|
@@ -99,21 +92,17 @@ export default class KoniExtension {
|
|
|
99
92
|
private getCrowdloan;
|
|
100
93
|
private getCrowdloanContributions;
|
|
101
94
|
private subscribeCrowdloan;
|
|
102
|
-
private validatePassword;
|
|
103
|
-
private validatedAccountsPassword;
|
|
104
|
-
private _addAddressToAuthList;
|
|
105
|
-
private _addAddressesToAuthList;
|
|
106
95
|
private accountsCreateSuriV2;
|
|
107
96
|
private accountsForgetOverride;
|
|
108
97
|
private seedCreateV2;
|
|
109
98
|
private seedValidateV2;
|
|
110
|
-
private
|
|
111
|
-
private
|
|
112
|
-
private deriveV2;
|
|
113
|
-
private derivationCreateV2;
|
|
99
|
+
private privateKeyValidateV2;
|
|
100
|
+
private parseInfoSingleJson;
|
|
114
101
|
private jsonRestoreV2;
|
|
102
|
+
private parseInfoMultiJson;
|
|
115
103
|
private batchRestoreV2;
|
|
116
104
|
private batchExportV2;
|
|
105
|
+
private exportAccountProxyMnemonic;
|
|
117
106
|
private getNftCollection;
|
|
118
107
|
private subscribeNftCollection;
|
|
119
108
|
private getNft;
|
|
@@ -147,8 +136,6 @@ export default class KoniExtension {
|
|
|
147
136
|
private subscribeAddressTransferableBalance;
|
|
148
137
|
private substrateNftSubmitTransaction;
|
|
149
138
|
private enableChains;
|
|
150
|
-
private getAccountMeta;
|
|
151
|
-
private accountsTie2;
|
|
152
139
|
private accountsCreateExternalV2;
|
|
153
140
|
private accountsCreateHardwareV2;
|
|
154
141
|
private accountsCreateHardwareMultiple;
|
|
@@ -156,7 +143,9 @@ export default class KoniExtension {
|
|
|
156
143
|
private rejectExternalRequest;
|
|
157
144
|
private resolveQrTransfer;
|
|
158
145
|
private subscribeConfirmations;
|
|
146
|
+
private subscribeConfirmationsTon;
|
|
159
147
|
private completeConfirmation;
|
|
148
|
+
private completeConfirmationTon;
|
|
160
149
|
private getNetworkJsonByChainId;
|
|
161
150
|
private parseSubstrateTransaction;
|
|
162
151
|
private parseEVMRLP;
|
|
@@ -188,6 +177,7 @@ export default class KoniExtension {
|
|
|
188
177
|
private derivationCreateMultiple;
|
|
189
178
|
private derivationCreateV3;
|
|
190
179
|
private validateDerivePath;
|
|
180
|
+
private getDeriveSuggestion;
|
|
191
181
|
private getListDeriveAccounts;
|
|
192
182
|
private subscribeChainInfoMap;
|
|
193
183
|
private subscribeChainStateMap;
|
|
@@ -216,6 +206,7 @@ export default class KoniExtension {
|
|
|
216
206
|
private enableMantaPay;
|
|
217
207
|
private initSyncMantaPay;
|
|
218
208
|
private disableMantaPay;
|
|
209
|
+
private isTonBounceableAddress;
|
|
219
210
|
private subscribeMantaPayConfig;
|
|
220
211
|
private subscribeMantaPaySyncState;
|
|
221
212
|
private findRawMetadata;
|