@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
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { KeyringPair$Json } from '@subwallet/keyring/types';
|
|
2
|
+
import { AccountProxyExtra, KeyringPairs$JsonV2 } from '../../info';
|
|
3
|
+
export interface RequestJsonGetAccountInfo {
|
|
4
|
+
json: KeyringPair$Json;
|
|
5
|
+
password: string;
|
|
6
|
+
}
|
|
7
|
+
export interface ResponseJsonGetAccountInfo {
|
|
8
|
+
accountProxy: AccountProxyExtra;
|
|
9
|
+
}
|
|
10
|
+
export interface RequestJsonRestoreV2 {
|
|
11
|
+
file: KeyringPair$Json;
|
|
12
|
+
password: string;
|
|
13
|
+
address: string;
|
|
14
|
+
isAllowed: boolean;
|
|
15
|
+
withMasterPassword: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface RequestBatchJsonGetAccountInfo {
|
|
18
|
+
json: KeyringPairs$JsonV2;
|
|
19
|
+
password: string;
|
|
20
|
+
}
|
|
21
|
+
export interface ResponseBatchJsonGetAccountInfo {
|
|
22
|
+
accountProxies: AccountProxyExtra[];
|
|
23
|
+
}
|
|
24
|
+
export interface RequestBatchRestoreV2 {
|
|
25
|
+
file: KeyringPairs$JsonV2;
|
|
26
|
+
password: string;
|
|
27
|
+
isAllowed: boolean;
|
|
28
|
+
proxyIds?: string[];
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { SeedLengths } from '@subwallet/extension-base/background/types';
|
|
2
|
+
import { KeypairType } from '@subwallet/keyring/types';
|
|
3
|
+
export declare type MnemonicType = 'general' | 'ton';
|
|
4
|
+
/**
|
|
5
|
+
* @interface RequestMnemonicCreateV2
|
|
6
|
+
* @description Represents a request to create a new mnemonic phrase.
|
|
7
|
+
*
|
|
8
|
+
* @property {SeedLengths} [length] - The desired length of the mnemonic phrase.
|
|
9
|
+
* @property {string} [mnemonic] - An optional predefined mnemonic phrase.
|
|
10
|
+
* If provided, this mnemonic will be used instead of generating a new one.
|
|
11
|
+
* @property {MnemonicType} [type] - The type of mnemonic to create.
|
|
12
|
+
*/
|
|
13
|
+
export interface RequestMnemonicCreateV2 {
|
|
14
|
+
length?: SeedLengths;
|
|
15
|
+
mnemonic?: string;
|
|
16
|
+
type?: MnemonicType;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* @interface ResponseMnemonicCreateV2
|
|
20
|
+
* @description Represents the response for creating a new mnemonic phrase.
|
|
21
|
+
*
|
|
22
|
+
* @property {string} mnemonic - The generated mnemonic phrase.
|
|
23
|
+
* @property {Array<KeypairType>} pairTypes - The types of key pairs associated with the mnemonic.
|
|
24
|
+
* @property {Record<KeypairType, string>} addressMap - A map of key pair types to their corresponding addresses.
|
|
25
|
+
*/
|
|
26
|
+
export interface ResponseMnemonicCreateV2 {
|
|
27
|
+
mnemonic: string;
|
|
28
|
+
pairTypes: Array<KeypairType>;
|
|
29
|
+
addressMap: Record<KeypairType, string>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* @interface RequestMnemonicValidateV2
|
|
33
|
+
* @description Represents a request to validate a mnemonic phrase.
|
|
34
|
+
*
|
|
35
|
+
* @property {string} mnemonic - The mnemonic seed to validate.
|
|
36
|
+
*/
|
|
37
|
+
export interface RequestMnemonicValidateV2 {
|
|
38
|
+
mnemonic: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* @interface ResponseMnemonicValidateV2
|
|
42
|
+
* @description Represents the response for validating a mnemonic phrase.
|
|
43
|
+
*
|
|
44
|
+
* @property {string} mnemonic - The mnemonic phrase that was validated.
|
|
45
|
+
* @property {MnemonicType} mnemonicTypes - The type of the mnemonic phrase.
|
|
46
|
+
* @property {Array<KeypairType>} pairTypes - The types of key pairs associated with the mnemonic.
|
|
47
|
+
* @property {Record<KeypairType, string>} addressMap - A map of key pair types to their corresponding addresses.
|
|
48
|
+
*/
|
|
49
|
+
export interface ResponseMnemonicValidateV2 {
|
|
50
|
+
mnemonic: string;
|
|
51
|
+
mnemonicTypes: MnemonicType;
|
|
52
|
+
pairTypes: Array<KeypairType>;
|
|
53
|
+
addressMap: Record<KeypairType, string>;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* @interface RequestAccountCreateSuriV2
|
|
57
|
+
* @description Represents a request to create an account from a mnemonic phrase.
|
|
58
|
+
*
|
|
59
|
+
* @property {string} name - The name of the account.
|
|
60
|
+
* @property {string} [password] - An optional password for the account.
|
|
61
|
+
* @property {string} suri - The mnemonic phrase or derivation path.
|
|
62
|
+
* @property {KeypairType} [type] - The type of key pair to create. "undefined" means the unified account will be created
|
|
63
|
+
* If it is undefined, create a unified account with multiple types.
|
|
64
|
+
* @property {boolean} isAllowed - Indicates if the account creation is allowed.
|
|
65
|
+
*/
|
|
66
|
+
export interface RequestAccountCreateSuriV2 {
|
|
67
|
+
name: string;
|
|
68
|
+
password?: string;
|
|
69
|
+
suri: string;
|
|
70
|
+
type?: KeypairType;
|
|
71
|
+
isAllowed: boolean;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* @typedef {Record<KeypairType, string>} ResponseAccountCreateSuriV2
|
|
75
|
+
* @description Represents the response for creating an account from a mnemonic phrase.
|
|
76
|
+
*/
|
|
77
|
+
export declare type ResponseAccountCreateSuriV2 = Record<KeypairType, string>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { KeypairType } from '@subwallet/keyring/types';
|
|
2
|
+
import { AccountChainType } from '../../info/keyring';
|
|
3
|
+
/**
|
|
4
|
+
* @interface RequestPrivateKeyValidateV2
|
|
5
|
+
* @description Represents the request payload for validating a private key.
|
|
6
|
+
*
|
|
7
|
+
* Use for ethereum and ton private key only.
|
|
8
|
+
*
|
|
9
|
+
* @property {string} privateKey - The private key to be validated.
|
|
10
|
+
* @property {AccountChainType} [chainType] - Optional chain type associated with the private key.
|
|
11
|
+
* If not provided, the chain type will be determined based on the private key length (work only with 2 keypair types).
|
|
12
|
+
*/
|
|
13
|
+
export interface RequestPrivateKeyValidateV2 {
|
|
14
|
+
privateKey: string;
|
|
15
|
+
chainType?: AccountChainType;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* @interface ResponsePrivateKeyValidateV2
|
|
19
|
+
* @description Represents the response for validating a private key.
|
|
20
|
+
*
|
|
21
|
+
* @property {Record<KeypairType, string>} addressMap - A map of key pair types to their corresponding addresses.
|
|
22
|
+
* @property {boolean} autoAddPrefix - Indicates if the prefix should be automatically added.
|
|
23
|
+
*/
|
|
24
|
+
export interface ResponsePrivateKeyValidateV2 {
|
|
25
|
+
addressMap: Record<KeypairType, string>;
|
|
26
|
+
autoAddPrefix: boolean;
|
|
27
|
+
keyTypes: KeypairType[];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* @interface RequestCheckPublicAndSecretKey
|
|
31
|
+
* @description Represents the request payload for checking the validity of a public and secret key pair.
|
|
32
|
+
*
|
|
33
|
+
* Use for check ethereum and substrate key pair only.
|
|
34
|
+
*
|
|
35
|
+
* @property {string} secretKey - The secret key to be validated.
|
|
36
|
+
* @property {string} publicKey - The public key to be validated.
|
|
37
|
+
*/
|
|
38
|
+
export interface RequestCheckPublicAndSecretKey {
|
|
39
|
+
secretKey: string;
|
|
40
|
+
publicKey: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* @interface ResponseCheckPublicAndSecretKey
|
|
44
|
+
* @description Represents the response for checking the validity of a public and secret key pair.
|
|
45
|
+
*
|
|
46
|
+
* @property {string} address - The address derived from the public and secret key pair.
|
|
47
|
+
* @property {boolean} isValid - Indicates whether the public and secret key pair is valid.
|
|
48
|
+
* @property {boolean} isEthereum - Indicates whether the key pair is for an Ethereum account.
|
|
49
|
+
*/
|
|
50
|
+
export interface ResponseCheckPublicAndSecretKey {
|
|
51
|
+
address: string;
|
|
52
|
+
isValid: boolean;
|
|
53
|
+
errorMessage?: string;
|
|
54
|
+
isEthereum: boolean;
|
|
55
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { SWErrorData } from '@subwallet/extension-base/types';
|
|
2
|
+
import { KeypairType } from '@subwallet/keyring/types';
|
|
3
|
+
export interface CreateDeriveAccountInfo {
|
|
4
|
+
name: string;
|
|
5
|
+
suri: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated
|
|
9
|
+
* */
|
|
10
|
+
export interface RequestDeriveCreateMultiple {
|
|
11
|
+
parentAddress: string;
|
|
12
|
+
isAllowed: boolean;
|
|
13
|
+
items: CreateDeriveAccountInfo[];
|
|
14
|
+
}
|
|
15
|
+
export interface RequestDeriveCreateV3 {
|
|
16
|
+
proxyId: string;
|
|
17
|
+
name: string;
|
|
18
|
+
suri: string;
|
|
19
|
+
}
|
|
20
|
+
export interface DeriveAccountInfo {
|
|
21
|
+
address: string;
|
|
22
|
+
suri: string;
|
|
23
|
+
}
|
|
24
|
+
export interface RequestDeriveValidateV2 {
|
|
25
|
+
suri: string;
|
|
26
|
+
proxyId: string;
|
|
27
|
+
}
|
|
28
|
+
export declare type ResponseDeriveValidateV2 = {
|
|
29
|
+
info: DerivePathInfo | undefined;
|
|
30
|
+
error?: SWErrorData;
|
|
31
|
+
};
|
|
32
|
+
export interface RequestGetDeriveAccounts {
|
|
33
|
+
page: number;
|
|
34
|
+
limit: number;
|
|
35
|
+
parentAddress: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* @deprecated
|
|
39
|
+
* */
|
|
40
|
+
export interface ResponseGetDeriveAccounts {
|
|
41
|
+
result: DeriveAccountInfo[];
|
|
42
|
+
}
|
|
43
|
+
export interface RequestGetDeriveSuggestion {
|
|
44
|
+
proxyId: string;
|
|
45
|
+
}
|
|
46
|
+
export interface ResponseGetDeriveSuggestion {
|
|
47
|
+
proxyId: string;
|
|
48
|
+
info?: {
|
|
49
|
+
suri: string;
|
|
50
|
+
derivationPath?: string;
|
|
51
|
+
};
|
|
52
|
+
error?: SWErrorData;
|
|
53
|
+
}
|
|
54
|
+
export interface DeriveInfo {
|
|
55
|
+
parentAddress?: string;
|
|
56
|
+
suri?: string;
|
|
57
|
+
derivationPath?: string;
|
|
58
|
+
depth: number;
|
|
59
|
+
autoIndexes?: Array<number | undefined>;
|
|
60
|
+
}
|
|
61
|
+
export interface NextDerivePair {
|
|
62
|
+
deriveIndex: number;
|
|
63
|
+
derivationPath?: string;
|
|
64
|
+
deriveAddress: string;
|
|
65
|
+
depth: number;
|
|
66
|
+
suri: string;
|
|
67
|
+
}
|
|
68
|
+
export interface IDerivePathInfo_ {
|
|
69
|
+
type: KeypairType;
|
|
70
|
+
suri: string;
|
|
71
|
+
depth: number;
|
|
72
|
+
autoIndexes?: Array<number | undefined>;
|
|
73
|
+
derivationPath?: string;
|
|
74
|
+
}
|
|
75
|
+
export interface DerivePathInfo extends Omit<IDerivePathInfo_, 'type'> {
|
|
76
|
+
type: KeypairType | 'unified';
|
|
77
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { TonWalletContractVersion } from '@subwallet/keyring/types';
|
|
2
|
+
export interface RequestAccountProxyEdit {
|
|
3
|
+
proxyId: string;
|
|
4
|
+
name: string;
|
|
5
|
+
}
|
|
6
|
+
export interface RequestAccountProxyForget {
|
|
7
|
+
proxyId: string;
|
|
8
|
+
lockAfter: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface RequestGetAllTonWalletContractVersion {
|
|
11
|
+
address: string;
|
|
12
|
+
isTestnet?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface ResponseGetAllTonWalletContractVersion {
|
|
15
|
+
address: string;
|
|
16
|
+
currentVersion: TonWalletContractVersion;
|
|
17
|
+
addressMap: Record<TonWalletContractVersion, string>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* @interface RequestChangeTonWalletContractVersion
|
|
21
|
+
* @description Represents the request payload for changing the contract version of a TON wallet.
|
|
22
|
+
*
|
|
23
|
+
* @property {string} proxyId - The proxy ID of the account whose wallet contract version is to be changed.
|
|
24
|
+
* @property {string} [address] - Optional, special address of the account proxy.
|
|
25
|
+
* @property {TonWalletContractVersion} version - The new contract version to be set for the TON wallet.
|
|
26
|
+
*/
|
|
27
|
+
export interface RequestChangeTonWalletContractVersion {
|
|
28
|
+
proxyId: string;
|
|
29
|
+
address?: string;
|
|
30
|
+
version: TonWalletContractVersion;
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { KeyringPairs$JsonV2 } from '../info';
|
|
2
|
+
export interface RequestExportAccountProxyMnemonic {
|
|
3
|
+
proxyId: string;
|
|
4
|
+
password: string;
|
|
5
|
+
}
|
|
6
|
+
export interface ResponseExportAccountProxyMnemonic {
|
|
7
|
+
result: string;
|
|
8
|
+
}
|
|
9
|
+
export interface RequestAccountBatchExportV2 {
|
|
10
|
+
password: string;
|
|
11
|
+
proxyIds?: string[];
|
|
12
|
+
}
|
|
13
|
+
export interface ResponseAccountBatchExportV2 {
|
|
14
|
+
exportedJson: KeyringPairs$JsonV2;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Copyright 2019-2022 @subwallet/extension-base authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
export * from "./add/index.js";
|
|
5
|
+
export * from "./derive.js";
|
|
6
|
+
export * from "./edit.js";
|
|
7
|
+
export * from "./export.js";
|
|
8
|
+
export * from "./subscribe.js";
|
|
9
|
+
export * from "./validate.js";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface RequestInputAccountSubscribe {
|
|
2
|
+
data: string;
|
|
3
|
+
chain: string;
|
|
4
|
+
}
|
|
5
|
+
export declare enum AnalyzedGroup {
|
|
6
|
+
WALLET = "wallet",
|
|
7
|
+
CONTACT = "contact",
|
|
8
|
+
DOMAIN = "domain",
|
|
9
|
+
RECENT = "recent"
|
|
10
|
+
}
|
|
11
|
+
export interface AnalyzeAddress {
|
|
12
|
+
address: string;
|
|
13
|
+
proxyId?: string;
|
|
14
|
+
formatedAddress: string;
|
|
15
|
+
analyzedGroup: AnalyzedGroup;
|
|
16
|
+
displayName?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface ResponseInputAccountSubscribe {
|
|
19
|
+
id: string;
|
|
20
|
+
options: AnalyzeAddress[];
|
|
21
|
+
current?: AnalyzeAddress;
|
|
22
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Copyright 2019-2022 @subwallet/extension-base authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
export let AnalyzedGroup;
|
|
5
|
+
(function (AnalyzedGroup) {
|
|
6
|
+
AnalyzedGroup["WALLET"] = "wallet";
|
|
7
|
+
AnalyzedGroup["CONTACT"] = "contact";
|
|
8
|
+
AnalyzedGroup["DOMAIN"] = "domain";
|
|
9
|
+
AnalyzedGroup["RECENT"] = "recent";
|
|
10
|
+
})(AnalyzedGroup || (AnalyzedGroup = {}));
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description Represents the request payload for validating an account name.
|
|
3
|
+
*
|
|
4
|
+
* @property {string} name - The name to be validated.
|
|
5
|
+
* @property {string} [proxyId] - Optional, the proxy ID of the account.
|
|
6
|
+
* */
|
|
7
|
+
export interface RequestAccountNameValidate {
|
|
8
|
+
name: string;
|
|
9
|
+
proxyId?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface RequestBounceableValidate {
|
|
12
|
+
address: string;
|
|
13
|
+
chain: string;
|
|
14
|
+
}
|
|
15
|
+
export interface ResponseAccountNameValidate {
|
|
16
|
+
isValid: boolean;
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SWError } from '@subwallet/extension-base/background/errors/SWError';
|
|
2
|
+
export declare enum CommonAccountErrorType {
|
|
3
|
+
ACCOUNT_NOT_FOUND = "ACCOUNT_NOT_FOUND",
|
|
4
|
+
ACCOUNT_EXISTED = "ACCOUNT_EXISTED",
|
|
5
|
+
ACCOUNT_NAME_EXISTED = "ACCOUNT_NAME_EXISTED"
|
|
6
|
+
}
|
|
7
|
+
export declare class SWCommonAccountError extends SWError {
|
|
8
|
+
errorClass: string;
|
|
9
|
+
constructor(errorType: CommonAccountErrorType, _message?: string);
|
|
10
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Copyright 2019-2022 @subwallet/extension-koni authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { SWError } from '@subwallet/extension-base/background/errors/SWError';
|
|
5
|
+
import { detectTranslate } from '@subwallet/extension-base/utils';
|
|
6
|
+
export let CommonAccountErrorType;
|
|
7
|
+
(function (CommonAccountErrorType) {
|
|
8
|
+
CommonAccountErrorType["ACCOUNT_NOT_FOUND"] = "ACCOUNT_NOT_FOUND";
|
|
9
|
+
CommonAccountErrorType["ACCOUNT_EXISTED"] = "ACCOUNT_EXISTED";
|
|
10
|
+
CommonAccountErrorType["ACCOUNT_NAME_EXISTED"] = "ACCOUNT_NAME_EXISTED";
|
|
11
|
+
})(CommonAccountErrorType || (CommonAccountErrorType = {}));
|
|
12
|
+
const DEFAULT_DATA = {
|
|
13
|
+
[CommonAccountErrorType.ACCOUNT_NOT_FOUND]: {
|
|
14
|
+
message: detectTranslate('Account not found'),
|
|
15
|
+
code: 1001
|
|
16
|
+
},
|
|
17
|
+
[CommonAccountErrorType.ACCOUNT_EXISTED]: {
|
|
18
|
+
message: detectTranslate('Account already exists under the name "{{name}}"'),
|
|
19
|
+
code: 1002
|
|
20
|
+
},
|
|
21
|
+
[CommonAccountErrorType.ACCOUNT_NAME_EXISTED]: {
|
|
22
|
+
message: detectTranslate('Account name already in use'),
|
|
23
|
+
code: 1003
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
export class SWCommonAccountError extends SWError {
|
|
27
|
+
errorClass = 'Account';
|
|
28
|
+
constructor(errorType, _message) {
|
|
29
|
+
const defaultData = DEFAULT_DATA[errorType];
|
|
30
|
+
const message = _message || defaultData.message;
|
|
31
|
+
super(errorType, message, defaultData.code);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SWError } from '@subwallet/extension-base/background/errors/SWError';
|
|
2
|
+
export declare enum DeriveErrorType {
|
|
3
|
+
INVALID_DERIVATION_PATH = "INVALID_DERIVATION_PATH",
|
|
4
|
+
INVALID_DERIVATION_TYPE = "INVALID_DERIVATION_TYPE",
|
|
5
|
+
ROOT_ACCOUNT_NOT_FOUND = "ACCOUNT_NOT_FOUND",
|
|
6
|
+
INVALID_ACCOUNT_TYPE = "INVALID_ACCOUNT_TYPE",
|
|
7
|
+
MAX_DERIVATION_DEPTH = "MAX_DERIVATION_DEPTH",
|
|
8
|
+
MIN_DERIVATION_DEPTH = "MIN_DERIVATION_DEPTH"
|
|
9
|
+
}
|
|
10
|
+
export declare class SWDeriveError extends SWError {
|
|
11
|
+
errorClass: string;
|
|
12
|
+
constructor(errorType: DeriveErrorType, _message?: string);
|
|
13
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// Copyright 2019-2022 @subwallet/extension-koni authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { SWError } from '@subwallet/extension-base/background/errors/SWError';
|
|
5
|
+
import { detectTranslate } from '@subwallet/extension-base/utils';
|
|
6
|
+
export let DeriveErrorType;
|
|
7
|
+
(function (DeriveErrorType) {
|
|
8
|
+
DeriveErrorType["INVALID_DERIVATION_PATH"] = "INVALID_DERIVATION_PATH";
|
|
9
|
+
DeriveErrorType["INVALID_DERIVATION_TYPE"] = "INVALID_DERIVATION_TYPE";
|
|
10
|
+
DeriveErrorType["ROOT_ACCOUNT_NOT_FOUND"] = "ACCOUNT_NOT_FOUND";
|
|
11
|
+
DeriveErrorType["INVALID_ACCOUNT_TYPE"] = "INVALID_ACCOUNT_TYPE";
|
|
12
|
+
DeriveErrorType["MAX_DERIVATION_DEPTH"] = "MAX_DERIVATION_DEPTH";
|
|
13
|
+
DeriveErrorType["MIN_DERIVATION_DEPTH"] = "MIN_DERIVATION_DEPTH";
|
|
14
|
+
})(DeriveErrorType || (DeriveErrorType = {}));
|
|
15
|
+
const DEFAULT_DATA = {
|
|
16
|
+
[DeriveErrorType.INVALID_DERIVATION_PATH]: {
|
|
17
|
+
message: detectTranslate('Invalid derivation path'),
|
|
18
|
+
code: 1001
|
|
19
|
+
},
|
|
20
|
+
[DeriveErrorType.INVALID_DERIVATION_TYPE]: {
|
|
21
|
+
message: detectTranslate('Derivation path not supported'),
|
|
22
|
+
code: 1002
|
|
23
|
+
},
|
|
24
|
+
[DeriveErrorType.ROOT_ACCOUNT_NOT_FOUND]: {
|
|
25
|
+
message: detectTranslate('Account not found'),
|
|
26
|
+
code: 1003
|
|
27
|
+
},
|
|
28
|
+
[DeriveErrorType.INVALID_ACCOUNT_TYPE]: {
|
|
29
|
+
message: detectTranslate('Invalid account type'),
|
|
30
|
+
code: 1004
|
|
31
|
+
},
|
|
32
|
+
[DeriveErrorType.MAX_DERIVATION_DEPTH]: {
|
|
33
|
+
message: detectTranslate('Derivation path not supported'),
|
|
34
|
+
code: 1005
|
|
35
|
+
},
|
|
36
|
+
[DeriveErrorType.MIN_DERIVATION_DEPTH]: {
|
|
37
|
+
message: detectTranslate('Derivation path not supported'),
|
|
38
|
+
code: 1006
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
export class SWDeriveError extends SWError {
|
|
42
|
+
errorClass = 'Derive';
|
|
43
|
+
constructor(errorType, _message) {
|
|
44
|
+
const defaultData = DEFAULT_DATA[errorType];
|
|
45
|
+
const message = _message || defaultData.message;
|
|
46
|
+
super(errorType, message, defaultData.code);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|