@subwallet/extension-base 1.2.31-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 -15
- 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/SubstrateApi.js +1 -0
- 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 -17
- 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/SubstrateApi.js +1 -0
- 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/mkt-campaign-service/types.d.ts +4 -0
- 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
|
@@ -15,24 +15,33 @@ import { _CHAIN_VALIDATION_ERROR } from '@subwallet/extension-base/services/chai
|
|
|
15
15
|
import { _generateCustomProviderKey } from '@subwallet/extension-base/services/chain-service/utils';
|
|
16
16
|
import { DEFAULT_CHAIN_PATROL_ENABLE } from '@subwallet/extension-base/services/setting-service/constants';
|
|
17
17
|
import { canDerive, getEVMChainInfo, stripUrl } from '@subwallet/extension-base/utils';
|
|
18
|
+
import { EthereumKeypairTypes, SubstrateKeypairTypes, TonKeypairTypes } from '@subwallet/keyring/types';
|
|
18
19
|
import Web3 from 'web3';
|
|
19
20
|
import { checkIfDenied } from '@polkadot/phishing';
|
|
20
21
|
import { isArray, isNumber } from '@polkadot/util';
|
|
21
22
|
import { isEthereumAddress } from '@polkadot/util-crypto';
|
|
22
|
-
function transformAccountsV2(accounts, anyType = false, authInfo,
|
|
23
|
+
function transformAccountsV2(accounts, anyType = false, authInfo, accountAuthTypes) {
|
|
23
24
|
const accountSelected = authInfo ? authInfo.isAllowed ? Object.keys(authInfo.isAllowedMap).filter(address => authInfo.isAllowedMap[address]) : [] : [];
|
|
24
|
-
|
|
25
|
+
const authTypeFilter = ({
|
|
25
26
|
type
|
|
26
|
-
}) =>
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
27
|
+
}) => {
|
|
28
|
+
if (accountAuthTypes) {
|
|
29
|
+
if (!type) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
const validTypes = {
|
|
33
|
+
evm: EthereumKeypairTypes,
|
|
34
|
+
substrate: SubstrateKeypairTypes,
|
|
35
|
+
ton: TonKeypairTypes
|
|
36
|
+
};
|
|
37
|
+
return accountAuthTypes.some(authType => {
|
|
38
|
+
var _validTypes$authType;
|
|
39
|
+
return (_validTypes$authType = validTypes[authType]) === null || _validTypes$authType === void 0 ? void 0 : _validTypes$authType.includes(type);
|
|
40
|
+
});
|
|
41
|
+
} else {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
36
45
|
return Object.values(accounts).filter(({
|
|
37
46
|
json: {
|
|
38
47
|
meta: {
|
|
@@ -111,12 +120,13 @@ export default class KoniTabs {
|
|
|
111
120
|
payloadAfterValidated: request
|
|
112
121
|
};
|
|
113
122
|
const {
|
|
114
|
-
|
|
123
|
+
errors
|
|
115
124
|
} = await generateValidationProcess(this.#koniState, url, payloadValidate, [validationAuthMiddleware]);
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
125
|
+
if (errors.length === 0) {
|
|
126
|
+
return this.#koniState.sign(url, new RequestBytesSign(request));
|
|
127
|
+
} else {
|
|
128
|
+
throw errors[0];
|
|
129
|
+
}
|
|
120
130
|
}
|
|
121
131
|
async extrinsicSign(url, request) {
|
|
122
132
|
const address = request.address;
|
|
@@ -127,12 +137,14 @@ export default class KoniTabs {
|
|
|
127
137
|
payloadAfterValidated: request
|
|
128
138
|
};
|
|
129
139
|
const {
|
|
140
|
+
errors,
|
|
130
141
|
pair
|
|
131
142
|
} = await generateValidationProcess(this.#koniState, url, payloadValidate, [validationAuthMiddleware]);
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
143
|
+
if (pair && errors.length === 0) {
|
|
144
|
+
return this.#koniState.sign(url, new RequestExtrinsicSign(request));
|
|
145
|
+
} else {
|
|
146
|
+
throw errors[0];
|
|
147
|
+
}
|
|
136
148
|
}
|
|
137
149
|
metadataProvide(url, request) {
|
|
138
150
|
return this.#koniState.injectMetadata(url, request);
|
|
@@ -240,9 +252,22 @@ export default class KoniTabs {
|
|
|
240
252
|
anyType
|
|
241
253
|
}) {
|
|
242
254
|
const authInfo = await this.getAuthInfo(url);
|
|
243
|
-
|
|
255
|
+
const accountAuthTypes = [];
|
|
256
|
+
if (accountAuthType) {
|
|
257
|
+
accountAuthTypes.push(accountAuthType);
|
|
258
|
+
} else if (authInfo) {
|
|
259
|
+
if (authInfo.accountAuthTypes.includes('substrate')) {
|
|
260
|
+
accountAuthTypes.push('substrate');
|
|
261
|
+
}
|
|
262
|
+
if (authInfo.accountAuthTypes.includes('evm')) {
|
|
263
|
+
accountAuthTypes.push('evm');
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
return transformAccountsV2(this.#koniState.keyringService.context.pairs, anyType, authInfo, accountAuthTypes);
|
|
244
267
|
}
|
|
245
|
-
|
|
268
|
+
|
|
269
|
+
// TODO: Update logic
|
|
270
|
+
accountsSubstrateSubscribeV2(url, {
|
|
246
271
|
accountAuthType
|
|
247
272
|
}, id, port) {
|
|
248
273
|
const cb = createSubscription(id, port);
|
|
@@ -250,9 +275,19 @@ export default class KoniTabs {
|
|
|
250
275
|
this.#accountSubs[id] = {
|
|
251
276
|
subscription: authInfoSubject.subscribe(infos => {
|
|
252
277
|
this.getAuthInfo(url, infos).then(authInfo => {
|
|
253
|
-
const
|
|
254
|
-
|
|
255
|
-
|
|
278
|
+
const accountAuthTypes = [];
|
|
279
|
+
if (accountAuthType) {
|
|
280
|
+
accountAuthTypes.push(accountAuthType);
|
|
281
|
+
} else if (authInfo) {
|
|
282
|
+
if (authInfo.accountAuthTypes.includes('substrate')) {
|
|
283
|
+
accountAuthTypes.push('substrate');
|
|
284
|
+
}
|
|
285
|
+
if (authInfo.accountAuthTypes.includes('evm')) {
|
|
286
|
+
accountAuthTypes.push('evm');
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
const accounts = this.#koniState.keyringService.context.pairs;
|
|
290
|
+
return cb(transformAccountsV2(accounts, false, authInfo, accountAuthTypes));
|
|
256
291
|
}).catch(console.error);
|
|
257
292
|
}),
|
|
258
293
|
url
|
|
@@ -279,7 +314,9 @@ export default class KoniTabs {
|
|
|
279
314
|
return true;
|
|
280
315
|
}
|
|
281
316
|
authorizeV2(url, request) {
|
|
282
|
-
|
|
317
|
+
var _request$accountAuthT, _request$accountAuthT2;
|
|
318
|
+
const isConnectOnlyEvmAccountType = ((_request$accountAuthT = request.accountAuthTypes) === null || _request$accountAuthT === void 0 ? void 0 : _request$accountAuthT.length) === 1 && ((_request$accountAuthT2 = request.accountAuthTypes) === null || _request$accountAuthT2 === void 0 ? void 0 : _request$accountAuthT2.includes('evm'));
|
|
319
|
+
if (isConnectOnlyEvmAccountType) {
|
|
283
320
|
return new Promise((resolve, reject) => {
|
|
284
321
|
this.#koniState.authorizeUrlV2(url, request).then(resolve).catch(e => {
|
|
285
322
|
reject(new EvmProviderError(EvmProviderErrorType.USER_REJECTED_REQUEST));
|
|
@@ -289,23 +326,30 @@ export default class KoniTabs {
|
|
|
289
326
|
return this.#koniState.authorizeUrlV2(url, request);
|
|
290
327
|
}
|
|
291
328
|
}
|
|
329
|
+
|
|
330
|
+
// TODO: Update logic
|
|
292
331
|
async getEvmCurrentAccount(url) {
|
|
293
332
|
return await new Promise(resolve => {
|
|
294
333
|
this.getAuthInfo(url).then(authInfo => {
|
|
295
|
-
const allAccounts = this.#koniState.keyringService.
|
|
296
|
-
const accountList = transformAccountsV2(allAccounts, false, authInfo, 'evm').map(a => a.address);
|
|
334
|
+
const allAccounts = this.#koniState.keyringService.context.pairs;
|
|
335
|
+
const accountList = transformAccountsV2(allAccounts, false, authInfo, ['evm']).map(a => a.address);
|
|
297
336
|
let accounts = [];
|
|
298
|
-
const
|
|
299
|
-
if (
|
|
337
|
+
const proxyId = this.#koniState.keyringService.context.currentAccount.proxyId;
|
|
338
|
+
if (proxyId === ALL_ACCOUNT_KEY || !proxyId) {
|
|
300
339
|
accounts = accountList;
|
|
301
340
|
} else {
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
341
|
+
const addresses = this.#koniState.keyringService.context.addressesByProxyId(proxyId);
|
|
342
|
+
const result = [];
|
|
343
|
+
const inList = [];
|
|
344
|
+
for (const account of accountList) {
|
|
345
|
+
if (!addresses.includes(account)) {
|
|
346
|
+
result.push(account);
|
|
347
|
+
} else {
|
|
348
|
+
inList.push(account);
|
|
349
|
+
}
|
|
308
350
|
}
|
|
351
|
+
result.unshift(...inList);
|
|
352
|
+
accounts = result;
|
|
309
353
|
}
|
|
310
354
|
resolve(accounts);
|
|
311
355
|
}).catch(console.error);
|
|
@@ -407,34 +451,30 @@ export default class KoniTabs {
|
|
|
407
451
|
const urlStripped = stripUrl(url);
|
|
408
452
|
if (value && value[urlStripped]) {
|
|
409
453
|
const {
|
|
410
|
-
|
|
454
|
+
accountAuthTypes,
|
|
411
455
|
isAllowedMap
|
|
412
456
|
} = {
|
|
413
457
|
...value[urlStripped]
|
|
414
458
|
};
|
|
415
|
-
if (!
|
|
459
|
+
if (!accountAuthTypes) {
|
|
416
460
|
resolve();
|
|
417
461
|
}
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
resolve();
|
|
421
|
-
break;
|
|
422
|
-
case 'evm':
|
|
462
|
+
if (accountAuthTypes !== null && accountAuthTypes !== void 0 && accountAuthTypes.includes('evm')) {
|
|
463
|
+
if (accountAuthTypes.length === 1) {
|
|
423
464
|
delete value[urlStripped];
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
}
|
|
465
|
+
} else {
|
|
466
|
+
value[urlStripped].isAllowedMap = Object.entries(isAllowedMap).reduce((allowedMap, [address, value]) => {
|
|
467
|
+
if (isEthereumAddress(address)) {
|
|
468
|
+
allowedMap[address] = false;
|
|
469
|
+
} else {
|
|
470
|
+
allowedMap[address] = value;
|
|
471
|
+
}
|
|
472
|
+
return allowedMap;
|
|
473
|
+
}, {});
|
|
474
|
+
value[urlStripped].accountAuthTypes = accountAuthTypes === null || accountAuthTypes === void 0 ? void 0 : accountAuthTypes.filter(type => type !== 'evm');
|
|
475
|
+
}
|
|
476
|
+
} else {
|
|
477
|
+
resolve();
|
|
438
478
|
}
|
|
439
479
|
this.#koniState.setAuthorize(value, () => {
|
|
440
480
|
resolve();
|
|
@@ -670,6 +710,8 @@ export default class KoniTabs {
|
|
|
670
710
|
const evmState = await this.getEvmState(url);
|
|
671
711
|
return evmState.chainId || '0x0';
|
|
672
712
|
}
|
|
713
|
+
|
|
714
|
+
// TODO: Update logic
|
|
673
715
|
async evmSubscribeEvents(url, id, port) {
|
|
674
716
|
// This method will be called after DApp request connect to extension
|
|
675
717
|
const cb = createSubscription(id, port);
|
|
@@ -694,7 +736,7 @@ export default class KoniTabs {
|
|
|
694
736
|
currentAccountList = newAccountList;
|
|
695
737
|
}
|
|
696
738
|
};
|
|
697
|
-
const accountListSubscription = this.#koniState.keyringService.
|
|
739
|
+
const accountListSubscription = this.#koniState.keyringService.context.observable.currentAccount.subscribe(() => {
|
|
698
740
|
onCurrentAccountChanged().catch(console.error);
|
|
699
741
|
});
|
|
700
742
|
|
|
@@ -855,6 +897,8 @@ export default class KoniTabs {
|
|
|
855
897
|
throw new EvmProviderError(EvmProviderErrorType.INVALID_PARAMS, 'Failed to sign message');
|
|
856
898
|
}
|
|
857
899
|
}
|
|
900
|
+
|
|
901
|
+
// TODO: Update logic
|
|
858
902
|
async evmSendTransaction(id, url, {
|
|
859
903
|
params
|
|
860
904
|
}) {
|
|
@@ -894,7 +938,7 @@ export default class KoniTabs {
|
|
|
894
938
|
case 'wallet_requestPermissions':
|
|
895
939
|
await this.authorizeV2(url, {
|
|
896
940
|
origin: '',
|
|
897
|
-
|
|
941
|
+
accountAuthTypes: ['evm'],
|
|
898
942
|
reConfirm: true
|
|
899
943
|
});
|
|
900
944
|
return await this.getEvmPermission(url, id);
|
|
@@ -1047,7 +1091,7 @@ export default class KoniTabs {
|
|
|
1047
1091
|
case 'pub(accounts.listV2)':
|
|
1048
1092
|
return this.accountsListV2(url, request);
|
|
1049
1093
|
case 'pub(accounts.subscribeV2)':
|
|
1050
|
-
return this.
|
|
1094
|
+
return this.accountsSubstrateSubscribeV2(url, request, id, port);
|
|
1051
1095
|
case 'pub(accounts.unsubscribe)':
|
|
1052
1096
|
return this.accountsUnsubscribe(url, request);
|
|
1053
1097
|
case 'evm(events.subscribe)':
|
|
@@ -43,7 +43,7 @@ export class KoniSubscription {
|
|
|
43
43
|
async start() {
|
|
44
44
|
var _this$state$keyringSe;
|
|
45
45
|
await Promise.all([this.state.eventService.waitCryptoReady, this.state.eventService.waitKeyringReady, this.state.eventService.waitAssetReady]);
|
|
46
|
-
const currentAddress = (_this$state$keyringSe = this.state.keyringService.currentAccount) === null || _this$state$keyringSe === void 0 ? void 0 : _this$state$keyringSe.
|
|
46
|
+
const currentAddress = (_this$state$keyringSe = this.state.keyringService.context.currentAccount) === null || _this$state$keyringSe === void 0 ? void 0 : _this$state$keyringSe.proxyId;
|
|
47
47
|
if (currentAddress) {
|
|
48
48
|
this.subscribeCrowdloans(currentAddress, this.state.getSubstrateApiMap());
|
|
49
49
|
}
|
|
@@ -54,7 +54,7 @@ export class KoniSubscription {
|
|
|
54
54
|
if (!needReload) {
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
57
|
-
const address = (_serviceInfo$currentA = serviceInfo.currentAccountInfo) === null || _serviceInfo$currentA === void 0 ? void 0 : _serviceInfo$currentA.
|
|
57
|
+
const address = (_serviceInfo$currentA = serviceInfo.currentAccountInfo) === null || _serviceInfo$currentA === void 0 ? void 0 : _serviceInfo$currentA.proxyId;
|
|
58
58
|
if (!address) {
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
@@ -71,7 +71,7 @@ export class KoniSubscription {
|
|
|
71
71
|
return Promise.resolve();
|
|
72
72
|
}
|
|
73
73
|
subscribeCrowdloans(address, substrateApiMap, onlyRunOnFirstTime) {
|
|
74
|
-
const addresses = this.state.getDecodedAddresses(address);
|
|
74
|
+
const addresses = this.state.keyringService.context.getDecodedAddresses(address);
|
|
75
75
|
if (!addresses.length) {
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
@@ -92,7 +92,7 @@ export class KoniSubscription {
|
|
|
92
92
|
};
|
|
93
93
|
}
|
|
94
94
|
subscribeNft(address, substrateApiMap, evmApiMap, smartContractNfts, chainInfoMap) {
|
|
95
|
-
const addresses = this.state.getDecodedAddresses(address);
|
|
95
|
+
const addresses = this.state.keyringService.context.getDecodedAddresses(address);
|
|
96
96
|
if (!addresses.length) {
|
|
97
97
|
return;
|
|
98
98
|
}
|
|
@@ -107,7 +107,7 @@ export class KoniSubscription {
|
|
|
107
107
|
}
|
|
108
108
|
async reloadCrowdloan() {
|
|
109
109
|
var _this$state$keyringSe2;
|
|
110
|
-
const currentAddress = (_this$state$keyringSe2 = this.state.keyringService.currentAccount) === null || _this$state$keyringSe2 === void 0 ? void 0 : _this$state$keyringSe2.
|
|
110
|
+
const currentAddress = (_this$state$keyringSe2 = this.state.keyringService.context.currentAccount) === null || _this$state$keyringSe2 === void 0 ? void 0 : _this$state$keyringSe2.proxyId;
|
|
111
111
|
this.subscribeCrowdloans(currentAddress, this.state.getSubstrateApiMap());
|
|
112
112
|
await waitTimeout(1800);
|
|
113
113
|
}
|