@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
|
@@ -38,13 +38,11 @@ var _swapService = require("@subwallet/extension-base/services/swap-service");
|
|
|
38
38
|
var _transactionService = _interopRequireDefault(require("@subwallet/extension-base/services/transaction-service"));
|
|
39
39
|
var _walletConnectService = _interopRequireDefault(require("@subwallet/extension-base/services/wallet-connect-service"));
|
|
40
40
|
var _storage = require("@subwallet/extension-base/storage");
|
|
41
|
-
var
|
|
41
|
+
var _types2 = require("@subwallet/extension-base/types");
|
|
42
42
|
var _utils3 = require("@subwallet/extension-base/utils");
|
|
43
43
|
var _promise = require("@subwallet/extension-base/utils/promise");
|
|
44
|
-
var _decode = require("@subwallet/keyring/pair/decode");
|
|
45
44
|
var _uiKeyring = require("@subwallet/ui-keyring");
|
|
46
45
|
var _bn = _interopRequireDefault(require("bn.js"));
|
|
47
|
-
var _ethSimpleKeyring = _interopRequireDefault(require("eth-simple-keyring"));
|
|
48
46
|
var _i18next = require("i18next");
|
|
49
47
|
var _rxjs = require("rxjs");
|
|
50
48
|
var _util = require("@polkadot/util");
|
|
@@ -56,15 +54,11 @@ var _subscription = require("../subscription");
|
|
|
56
54
|
|
|
57
55
|
// eslint-disable-next-line @typescript-eslint/no-var-requires,@typescript-eslint/no-unsafe-assignment
|
|
58
56
|
const passworder = require('browser-passworder');
|
|
59
|
-
const ETH_DERIVE_DEFAULT = '/m/44\'/60\'/0\'/0/0';
|
|
60
57
|
const ERROR_CONFIRMATION_TYPE = ['errorConnectNetwork'];
|
|
61
58
|
|
|
62
59
|
// List of providers passed into constructor. This is the list of providers
|
|
63
60
|
// exposed by the extension.
|
|
64
61
|
|
|
65
|
-
const getSuri = (seed, type) => {
|
|
66
|
-
return type === 'ethereum' ? `${seed}${ETH_DERIVE_DEFAULT}` : seed;
|
|
67
|
-
};
|
|
68
62
|
const generateDefaultCrowdloanMap = () => {
|
|
69
63
|
const crowdloanMap = {};
|
|
70
64
|
return crowdloanMap;
|
|
@@ -73,7 +67,6 @@ const DEFAULT_CURRENCY = 'USD';
|
|
|
73
67
|
class KoniState {
|
|
74
68
|
injectedProviders = new Map();
|
|
75
69
|
unsubscriptionMap = {};
|
|
76
|
-
accountRefStore = new _AccountRef.default();
|
|
77
70
|
externalRequest = {};
|
|
78
71
|
crowdloanMap = generateDefaultCrowdloanMap();
|
|
79
72
|
crowdloanSubject = new _rxjs.Subject();
|
|
@@ -98,7 +91,7 @@ class KoniState {
|
|
|
98
91
|
this.providers = providers;
|
|
99
92
|
this.eventService = new _eventService.EventService();
|
|
100
93
|
this.dbService = new _DatabaseService.default(this.eventService);
|
|
101
|
-
this.keyringService = new _keyringService.KeyringService(this
|
|
94
|
+
this.keyringService = new _keyringService.KeyringService(this);
|
|
102
95
|
this.notificationService = new _NotificationService.default();
|
|
103
96
|
this.chainService = new _chainService.ChainService(this.dbService, this.eventService);
|
|
104
97
|
this.subscanService = _subscanService.SubscanService.getInstance();
|
|
@@ -199,35 +192,12 @@ class KoniState {
|
|
|
199
192
|
saveMetadata(meta) {
|
|
200
193
|
this.requestService.saveMetadata(meta);
|
|
201
194
|
}
|
|
202
|
-
sign(url, request
|
|
203
|
-
return this.requestService.sign(url, request
|
|
195
|
+
sign(url, request) {
|
|
196
|
+
return this.requestService.sign(url, request);
|
|
204
197
|
}
|
|
205
198
|
get authSubjectV2() {
|
|
206
199
|
return this.requestService.authSubjectV2;
|
|
207
200
|
}
|
|
208
|
-
generateDefaultBalanceMap(_addresses) {
|
|
209
|
-
const balanceMap = {};
|
|
210
|
-
const activeChains = this.chainService.getActiveChainInfoMap();
|
|
211
|
-
const isAllAccount = (0, _utils3.isAccountAll)(this.keyringService.currentAccount.address);
|
|
212
|
-
const addresses = _addresses || (isAllAccount ? Object.keys(this.keyringService.accounts) : [this.keyringService.currentAccount.address]);
|
|
213
|
-
addresses.forEach(address => {
|
|
214
|
-
const temp = {};
|
|
215
|
-
Object.values(activeChains).forEach(chainInfo => {
|
|
216
|
-
const chainAssetMap = this.chainService.getFungibleTokensByChain(chainInfo.slug);
|
|
217
|
-
Object.keys(chainAssetMap).forEach(assetSlug => {
|
|
218
|
-
temp[assetSlug] = {
|
|
219
|
-
address,
|
|
220
|
-
tokenSlug: assetSlug,
|
|
221
|
-
free: '',
|
|
222
|
-
locked: '',
|
|
223
|
-
state: _KoniTypes.APIItemState.PENDING
|
|
224
|
-
};
|
|
225
|
-
});
|
|
226
|
-
});
|
|
227
|
-
balanceMap[address] = temp;
|
|
228
|
-
});
|
|
229
|
-
return balanceMap;
|
|
230
|
-
}
|
|
231
201
|
afterChainServiceInit() {
|
|
232
202
|
this.subscanService.setSubscanChainMap(this.chainService.getSubscanChainMap());
|
|
233
203
|
}
|
|
@@ -313,14 +283,6 @@ class KoniState {
|
|
|
313
283
|
getAuthList() {
|
|
314
284
|
return this.requestService.getAuthList();
|
|
315
285
|
}
|
|
316
|
-
getAddressList() {
|
|
317
|
-
let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
318
|
-
const addressList = Object.keys(this.keyringService.accounts);
|
|
319
|
-
return addressList.reduce((addressList, v) => ({
|
|
320
|
-
...addressList,
|
|
321
|
-
[v]: value
|
|
322
|
-
}), {});
|
|
323
|
-
}
|
|
324
286
|
async authorizeUrlV2(url, request) {
|
|
325
287
|
return this.requestService.authorizeUrlV2(url, request);
|
|
326
288
|
}
|
|
@@ -344,7 +306,7 @@ class KoniState {
|
|
|
344
306
|
return this.dbService.getMantaPayConfig(chain);
|
|
345
307
|
}
|
|
346
308
|
async getStaking() {
|
|
347
|
-
const addresses = this.getDecodedAddresses();
|
|
309
|
+
const addresses = this.keyringService.context.getDecodedAddresses();
|
|
348
310
|
const stakings = await this.dbService.getStakings(addresses, this.activeChainSlugs);
|
|
349
311
|
return {
|
|
350
312
|
ready: true,
|
|
@@ -404,7 +366,7 @@ class KoniState {
|
|
|
404
366
|
nftList: [],
|
|
405
367
|
total: 0
|
|
406
368
|
})).catch(e => this.logger.warn(e));
|
|
407
|
-
const addresses = this.getDecodedAddresses(newAddress);
|
|
369
|
+
const addresses = this.keyringService.context.getDecodedAddresses(newAddress);
|
|
408
370
|
this.dbService.subscribeNft(addresses, this.activeChainSlugs, nfts => {
|
|
409
371
|
this.nftSubject.next({
|
|
410
372
|
nftList: nfts,
|
|
@@ -423,7 +385,7 @@ class KoniState {
|
|
|
423
385
|
this.dbService.cleanUpNft(chain, owner, collectionId, nftIds, ownNothing).catch(e => this.logger.warn(e));
|
|
424
386
|
}
|
|
425
387
|
async getNft() {
|
|
426
|
-
const addresses = this.getDecodedAddresses();
|
|
388
|
+
const addresses = this.keyringService.context.getDecodedAddresses();
|
|
427
389
|
if (!addresses.length) {
|
|
428
390
|
return;
|
|
429
391
|
}
|
|
@@ -453,94 +415,12 @@ class KoniState {
|
|
|
453
415
|
this.stakingRewardState.ready = ready;
|
|
454
416
|
this.stakingRewardSubject.next(this.stakingRewardState);
|
|
455
417
|
}
|
|
456
|
-
getAccountRefMap(callback) {
|
|
457
|
-
const refMap = {};
|
|
458
|
-
this.accountRefStore.get('refList', refList => {
|
|
459
|
-
if (refList) {
|
|
460
|
-
refList.forEach(accRef => {
|
|
461
|
-
accRef.forEach(acc => {
|
|
462
|
-
refMap[acc] = [...accRef].filter(r => !(r === acc));
|
|
463
|
-
});
|
|
464
|
-
});
|
|
465
|
-
}
|
|
466
|
-
callback(refMap);
|
|
467
|
-
});
|
|
468
|
-
}
|
|
469
|
-
addAccountRef(addresses, callback) {
|
|
470
|
-
this.accountRefStore.get('refList', refList => {
|
|
471
|
-
const newList = refList ? [...refList] : [];
|
|
472
|
-
newList.push(addresses);
|
|
473
|
-
this.accountRefStore.set('refList', newList, callback);
|
|
474
|
-
});
|
|
475
|
-
}
|
|
476
|
-
removeAccountRef(address, callback) {
|
|
477
|
-
this.accountRefStore.get('refList', refList => {
|
|
478
|
-
if (refList) {
|
|
479
|
-
refList.forEach(accRef => {
|
|
480
|
-
if (accRef.indexOf(address) > -1) {
|
|
481
|
-
accRef.splice(accRef.indexOf(address), 1);
|
|
482
|
-
}
|
|
483
|
-
if (accRef.length < 2) {
|
|
484
|
-
refList.splice(refList.indexOf(accRef), 1);
|
|
485
|
-
}
|
|
486
|
-
});
|
|
487
|
-
this.accountRefStore.set('refList', refList, () => {
|
|
488
|
-
callback();
|
|
489
|
-
});
|
|
490
|
-
} else {
|
|
491
|
-
callback();
|
|
492
|
-
}
|
|
493
|
-
});
|
|
494
|
-
}
|
|
495
418
|
getStakingReward(update) {
|
|
496
419
|
update(this.stakingRewardState);
|
|
497
420
|
}
|
|
498
421
|
subscribeStakingReward() {
|
|
499
422
|
return this.stakingRewardSubject;
|
|
500
423
|
}
|
|
501
|
-
setCurrentAccount(data, callback, preventOneAccount) {
|
|
502
|
-
const {
|
|
503
|
-
address,
|
|
504
|
-
currentGenesisHash
|
|
505
|
-
} = data;
|
|
506
|
-
const result = {
|
|
507
|
-
...data
|
|
508
|
-
};
|
|
509
|
-
if (address === _constants.ALL_ACCOUNT_KEY) {
|
|
510
|
-
const pairs = _uiKeyring.keyring.getAccounts();
|
|
511
|
-
const pair = pairs[0];
|
|
512
|
-
const pairGenesisHash = (pair === null || pair === void 0 ? void 0 : pair.meta.genesisHash) || '';
|
|
513
|
-
if (pairs.length > 1 || !pair) {
|
|
514
|
-
result.allGenesisHash = currentGenesisHash || undefined;
|
|
515
|
-
} else {
|
|
516
|
-
if (!preventOneAccount) {
|
|
517
|
-
result.address = pair.address;
|
|
518
|
-
result.currentGenesisHash = pairGenesisHash || '';
|
|
519
|
-
result.allGenesisHash = pairGenesisHash || undefined;
|
|
520
|
-
} else {
|
|
521
|
-
result.allGenesisHash = currentGenesisHash || undefined;
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
}
|
|
525
|
-
this.keyringService.setCurrentAccount(result);
|
|
526
|
-
callback && callback();
|
|
527
|
-
}
|
|
528
|
-
setAccountTie(address, genesisHash) {
|
|
529
|
-
if (address !== _constants.ALL_ACCOUNT_KEY) {
|
|
530
|
-
const pair = _uiKeyring.keyring.getPair(address);
|
|
531
|
-
(0, _util.assert)(pair, (0, _i18next.t)('Unable to find account'));
|
|
532
|
-
_uiKeyring.keyring.saveAccountMeta(pair, {
|
|
533
|
-
...pair.meta,
|
|
534
|
-
genesisHash
|
|
535
|
-
});
|
|
536
|
-
}
|
|
537
|
-
const accountInfo = this.keyringService.currentAccount;
|
|
538
|
-
if (address === accountInfo.address) {
|
|
539
|
-
accountInfo.currentGenesisHash = genesisHash || _constants.ALL_GENESIS_HASH;
|
|
540
|
-
this.setCurrentAccount(accountInfo);
|
|
541
|
-
}
|
|
542
|
-
return true;
|
|
543
|
-
}
|
|
544
424
|
async switchEvmNetworkByUrl(shortenUrl, networkKey) {
|
|
545
425
|
const authUrls = await this.getAuthList();
|
|
546
426
|
const chainInfo = this.chainService.getChainInfoByKey(networkKey);
|
|
@@ -635,29 +515,6 @@ class KoniState {
|
|
|
635
515
|
subscribeSettingsSubject() {
|
|
636
516
|
return this.settingService.getSubject();
|
|
637
517
|
}
|
|
638
|
-
getAccountAddress() {
|
|
639
|
-
const address = this.keyringService.currentAccount.address;
|
|
640
|
-
if (address === '') {
|
|
641
|
-
return null;
|
|
642
|
-
}
|
|
643
|
-
return address;
|
|
644
|
-
}
|
|
645
|
-
getDecodedAddresses(address) {
|
|
646
|
-
let checkingAddress = address;
|
|
647
|
-
if (!address) {
|
|
648
|
-
checkingAddress = this.getAccountAddress();
|
|
649
|
-
}
|
|
650
|
-
if (!checkingAddress) {
|
|
651
|
-
return [];
|
|
652
|
-
}
|
|
653
|
-
if (checkingAddress === _constants.ALL_ACCOUNT_KEY) {
|
|
654
|
-
return this.getAllAddresses();
|
|
655
|
-
}
|
|
656
|
-
return [checkingAddress];
|
|
657
|
-
}
|
|
658
|
-
getAllAddresses() {
|
|
659
|
-
return _uiKeyring.keyring.getAccounts().map(account => account.address);
|
|
660
|
-
}
|
|
661
518
|
async resetCrowdloanMap(newAddress) {
|
|
662
519
|
const defaultData = generateDefaultCrowdloanMap();
|
|
663
520
|
const storedData = await this.getStoredCrowdloan(newAddress);
|
|
@@ -671,7 +528,7 @@ class KoniState {
|
|
|
671
528
|
this.getStaking().then(data => {
|
|
672
529
|
this.stakingSubject.next(data);
|
|
673
530
|
}).catch(e => this.logger.warn(e));
|
|
674
|
-
const addresses = this.getDecodedAddresses(newAddress);
|
|
531
|
+
const addresses = this.keyringService.context.getDecodedAddresses(newAddress);
|
|
675
532
|
this.dbService.subscribeStaking(addresses, this.activeChainSlugs, stakings => {
|
|
676
533
|
this.stakingSubject.next({
|
|
677
534
|
ready: true,
|
|
@@ -703,8 +560,8 @@ class KoniState {
|
|
|
703
560
|
});
|
|
704
561
|
}
|
|
705
562
|
updateCrowdloanStore(networkKey, item) {
|
|
706
|
-
const currentAccountInfo = this.keyringService.currentAccount;
|
|
707
|
-
this.dbService.updateCrowdloanStore(networkKey, currentAccountInfo.
|
|
563
|
+
const currentAccountInfo = this.keyringService.context.currentAccount;
|
|
564
|
+
this.dbService.updateCrowdloanStore(networkKey, currentAccountInfo.proxyId, item).catch(e => this.logger.warn(e));
|
|
708
565
|
}
|
|
709
566
|
subscribeCrowdloan() {
|
|
710
567
|
return this.crowdloanSubject;
|
|
@@ -860,6 +717,12 @@ class KoniState {
|
|
|
860
717
|
getEvmApi(networkKey) {
|
|
861
718
|
return this.chainService.getEvmApi(networkKey);
|
|
862
719
|
}
|
|
720
|
+
getTonApiMap() {
|
|
721
|
+
return this.chainService.getTonApiMap();
|
|
722
|
+
}
|
|
723
|
+
getTonApi(networkKey) {
|
|
724
|
+
return this.chainService.getTonApi(networkKey);
|
|
725
|
+
}
|
|
863
726
|
getApiMap() {
|
|
864
727
|
return {
|
|
865
728
|
substrate: this.chainService.getSubstrateApiMap(),
|
|
@@ -877,7 +740,7 @@ class KoniState {
|
|
|
877
740
|
return {
|
|
878
741
|
chainInfoMap: this.chainService.getChainInfoMap(),
|
|
879
742
|
chainApiMap: this.getApiMap(),
|
|
880
|
-
currentAccountInfo: this.keyringService.currentAccount,
|
|
743
|
+
currentAccountInfo: this.keyringService.context.currentAccount,
|
|
881
744
|
assetRegistry: this.chainService.getAssetRegistry(),
|
|
882
745
|
chainStateMap: this.chainService.getChainStateMap()
|
|
883
746
|
};
|
|
@@ -988,77 +851,11 @@ class KoniState {
|
|
|
988
851
|
}
|
|
989
852
|
return Object.values(_constants2._PREDEFINED_SINGLE_MODES).find(item => item.networkKeys.includes(networkKey));
|
|
990
853
|
}
|
|
991
|
-
accountExportPrivateKey(
|
|
992
|
-
|
|
993
|
-
address,
|
|
994
|
-
password
|
|
995
|
-
} = _ref6;
|
|
996
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
997
|
-
const exportedJson = _uiKeyring.keyring.backupAccount(_uiKeyring.keyring.getPair(address), password);
|
|
998
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
999
|
-
const decoded = (0, _decode.decodePair)(password, (0, _utilCrypto.base64Decode)(exportedJson.encoded), exportedJson.encoding.type);
|
|
1000
|
-
return {
|
|
1001
|
-
privateKey: (0, _util.u8aToHex)(decoded.secretKey),
|
|
1002
|
-
publicKey: (0, _util.u8aToHex)(decoded.publicKey)
|
|
1003
|
-
};
|
|
1004
|
-
}
|
|
1005
|
-
checkPublicAndSecretKey(_ref7) {
|
|
1006
|
-
let {
|
|
1007
|
-
publicKey,
|
|
1008
|
-
secretKey
|
|
1009
|
-
} = _ref7;
|
|
1010
|
-
try {
|
|
1011
|
-
const _secret = (0, _util.hexStripPrefix)(secretKey);
|
|
1012
|
-
if (_secret.length === 64) {
|
|
1013
|
-
const suri = `0x${_secret}`;
|
|
1014
|
-
const {
|
|
1015
|
-
phrase
|
|
1016
|
-
} = (0, _utilCrypto.keyExtractSuri)(suri);
|
|
1017
|
-
if ((0, _util.isHex)(phrase) && (0, _util.isHex)(phrase, 256)) {
|
|
1018
|
-
const type = 'ethereum';
|
|
1019
|
-
const address = _uiKeyring.keyring.createFromUri(getSuri(suri, type), {}, type).address;
|
|
1020
|
-
return {
|
|
1021
|
-
address: address,
|
|
1022
|
-
isValid: true,
|
|
1023
|
-
isEthereum: true
|
|
1024
|
-
};
|
|
1025
|
-
} else {
|
|
1026
|
-
return {
|
|
1027
|
-
address: '',
|
|
1028
|
-
isValid: false,
|
|
1029
|
-
isEthereum: true
|
|
1030
|
-
};
|
|
1031
|
-
}
|
|
1032
|
-
}
|
|
1033
|
-
const keyPair = _uiKeyring.keyring.keyring.addFromPair({
|
|
1034
|
-
publicKey: (0, _util.hexToU8a)(publicKey),
|
|
1035
|
-
secretKey: (0, _util.hexToU8a)(secretKey)
|
|
1036
|
-
});
|
|
1037
|
-
return {
|
|
1038
|
-
address: keyPair.address,
|
|
1039
|
-
isValid: true,
|
|
1040
|
-
isEthereum: false
|
|
1041
|
-
};
|
|
1042
|
-
} catch (e) {
|
|
1043
|
-
console.error(e);
|
|
1044
|
-
return {
|
|
1045
|
-
address: '',
|
|
1046
|
-
isValid: false,
|
|
1047
|
-
isEthereum: false
|
|
1048
|
-
};
|
|
1049
|
-
}
|
|
854
|
+
accountExportPrivateKey(request) {
|
|
855
|
+
return this.keyringService.context.accountExportPrivateKey(request);
|
|
1050
856
|
}
|
|
1051
|
-
|
|
1052
|
-
return
|
|
1053
|
-
const {
|
|
1054
|
-
privateKey
|
|
1055
|
-
} = this.accountExportPrivateKey({
|
|
1056
|
-
address,
|
|
1057
|
-
password: password
|
|
1058
|
-
});
|
|
1059
|
-
const ethKeyring = new _ethSimpleKeyring.default([privateKey]);
|
|
1060
|
-
resolve(ethKeyring);
|
|
1061
|
-
});
|
|
857
|
+
checkPublicAndSecretKey(request) {
|
|
858
|
+
return this.keyringService.context.checkPublicAndSecretKey(request);
|
|
1062
859
|
}
|
|
1063
860
|
async evmSign(id, url, method, params, topic) {
|
|
1064
861
|
let address = '';
|
|
@@ -1086,11 +883,11 @@ class KoniState {
|
|
|
1086
883
|
errors: errorsFormated,
|
|
1087
884
|
id
|
|
1088
885
|
};
|
|
1089
|
-
return this.requestService.addConfirmation(id, url, 'evmSignatureRequest', payloadAfterValidated, {}).then(
|
|
886
|
+
return this.requestService.addConfirmation(id, url, 'evmSignatureRequest', payloadAfterValidated, {}).then(_ref6 => {
|
|
1090
887
|
let {
|
|
1091
888
|
isApproved,
|
|
1092
889
|
payload
|
|
1093
|
-
} =
|
|
890
|
+
} = _ref6;
|
|
1094
891
|
if (isApproved) {
|
|
1095
892
|
if (payload) {
|
|
1096
893
|
return payload;
|
|
@@ -1201,10 +998,10 @@ class KoniState {
|
|
|
1201
998
|
transactionEmitter.on('error', rs => {
|
|
1202
999
|
var _rs$errors$;
|
|
1203
1000
|
let evmProviderError = new _EvmProviderError.EvmProviderError(_KoniTypes.EvmProviderErrorType.INTERNAL_ERROR);
|
|
1204
|
-
const errorType = ((_rs$errors$ = rs.errors[0]) === null || _rs$errors$ === void 0 ? void 0 : _rs$errors$.errorType) ||
|
|
1205
|
-
if (errorType ===
|
|
1001
|
+
const errorType = ((_rs$errors$ = rs.errors[0]) === null || _rs$errors$ === void 0 ? void 0 : _rs$errors$.errorType) || _types2.BasicTxErrorType.INTERNAL_ERROR;
|
|
1002
|
+
if (errorType === _types2.BasicTxErrorType.USER_REJECT_REQUEST || errorType === _types2.BasicTxErrorType.UNABLE_TO_SIGN) {
|
|
1206
1003
|
evmProviderError = new _EvmProviderError.EvmProviderError(_KoniTypes.EvmProviderErrorType.USER_REJECTED_REQUEST);
|
|
1207
|
-
} else if (errorType ===
|
|
1004
|
+
} else if (errorType === _types2.BasicTxErrorType.UNABLE_TO_SEND) {
|
|
1208
1005
|
var _rs$errors$2;
|
|
1209
1006
|
evmProviderError = new _EvmProviderError.EvmProviderError(_KoniTypes.EvmProviderErrorType.INTERNAL_ERROR, (_rs$errors$2 = rs.errors[0]) === null || _rs$errors$2 === void 0 ? void 0 : _rs$errors$2.message);
|
|
1210
1007
|
}
|
|
@@ -1215,9 +1012,15 @@ class KoniState {
|
|
|
1215
1012
|
getConfirmationsQueueSubject() {
|
|
1216
1013
|
return this.requestService.confirmationsQueueSubject;
|
|
1217
1014
|
}
|
|
1015
|
+
getConfirmationsQueueSubjectTon() {
|
|
1016
|
+
return this.requestService.confirmationsQueueSubjectTon;
|
|
1017
|
+
}
|
|
1218
1018
|
async completeConfirmation(request) {
|
|
1219
1019
|
return await this.requestService.completeConfirmation(request);
|
|
1220
1020
|
}
|
|
1021
|
+
async completeConfirmationTon(request) {
|
|
1022
|
+
return await this.requestService.completeConfirmationTon(request);
|
|
1023
|
+
}
|
|
1221
1024
|
async onMV3Update() {
|
|
1222
1025
|
const migrationStatus = await _storage.SWStorage.instance.getItem('mv3_migration');
|
|
1223
1026
|
if (!migrationStatus || migrationStatus !== 'done') {
|
|
@@ -1232,6 +1035,18 @@ class KoniState {
|
|
|
1232
1035
|
}
|
|
1233
1036
|
}
|
|
1234
1037
|
}
|
|
1038
|
+
async storePreviousVersionData(details) {
|
|
1039
|
+
if (details.reason === 'update') {
|
|
1040
|
+
const previousVersion = details.previousVersion;
|
|
1041
|
+
if (!previousVersion) {
|
|
1042
|
+
return;
|
|
1043
|
+
}
|
|
1044
|
+
const storedData = await _storage.SWStorage.instance.getItem('previous_version');
|
|
1045
|
+
if (!storedData || !storedData.includes(previousVersion)) {
|
|
1046
|
+
await _storage.SWStorage.instance.setItem('previous_version', previousVersion);
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1235
1050
|
async migrateMV3LocalStorage(data) {
|
|
1236
1051
|
try {
|
|
1237
1052
|
const parsedData = JSON.parse(data);
|
|
@@ -1262,13 +1077,14 @@ class KoniState {
|
|
|
1262
1077
|
this.onMV3Install().catch(console.error);
|
|
1263
1078
|
} else if (details.reason === 'update') {
|
|
1264
1079
|
this.onMV3Update().catch(console.error);
|
|
1080
|
+
this.storePreviousVersionData(details).catch(console.error);
|
|
1265
1081
|
}
|
|
1266
1082
|
}
|
|
1267
1083
|
async onHandleRemindExportAccount() {
|
|
1268
1084
|
const remindStatus = await _storage.SWStorage.instance.getItem(_constants.REMIND_EXPORT_ACCOUNT);
|
|
1269
1085
|
if (!remindStatus || !remindStatus.includes('done')) {
|
|
1270
1086
|
const handleRemind = account => {
|
|
1271
|
-
if (account.
|
|
1087
|
+
if (account.proxyId !== '') {
|
|
1272
1088
|
// Open remind tab
|
|
1273
1089
|
const url = `${chrome.runtime.getURL('index.html')}#/remind-export-account`;
|
|
1274
1090
|
(0, _PopupHandler.openPopup)(url).then(_util.noop).catch(console.error).finally(() => subscription.unsubscribe());
|
|
@@ -1278,14 +1094,14 @@ class KoniState {
|
|
|
1278
1094
|
}, 3000);
|
|
1279
1095
|
}
|
|
1280
1096
|
};
|
|
1281
|
-
const subscription = this.keyringService.
|
|
1097
|
+
const subscription = this.keyringService.context.observable.currentAccount.subscribe(handleRemind);
|
|
1282
1098
|
}
|
|
1283
1099
|
}
|
|
1284
|
-
async setStorageFromWS(
|
|
1100
|
+
async setStorageFromWS(_ref7) {
|
|
1285
1101
|
let {
|
|
1286
1102
|
key,
|
|
1287
1103
|
value
|
|
1288
|
-
} =
|
|
1104
|
+
} = _ref7;
|
|
1289
1105
|
try {
|
|
1290
1106
|
const jsonData = JSON.stringify(value);
|
|
1291
1107
|
await _storage.SWStorage.instance.setItem(key, jsonData);
|
|
@@ -1295,6 +1111,14 @@ class KoniState {
|
|
|
1295
1111
|
return false;
|
|
1296
1112
|
}
|
|
1297
1113
|
}
|
|
1114
|
+
async getStorageFromWS(key) {
|
|
1115
|
+
try {
|
|
1116
|
+
return await _storage.SWStorage.instance.getItem(key);
|
|
1117
|
+
} catch (e) {
|
|
1118
|
+
console.error(e);
|
|
1119
|
+
return null;
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1298
1122
|
onCheckToRemindUser() {
|
|
1299
1123
|
this.onHandleRemindExportAccount().catch(console.error);
|
|
1300
1124
|
}
|
|
@@ -1463,7 +1287,7 @@ class KoniState {
|
|
|
1463
1287
|
});
|
|
1464
1288
|
}
|
|
1465
1289
|
async reloadNft() {
|
|
1466
|
-
const currentAddress = this.keyringService.currentAccount.
|
|
1290
|
+
const currentAddress = this.keyringService.context.currentAccount.proxyId;
|
|
1467
1291
|
await this.dbService.removeNftsByAddress(currentAddress);
|
|
1468
1292
|
return await this.cron.reloadNft();
|
|
1469
1293
|
}
|
|
@@ -1504,7 +1328,6 @@ class KoniState {
|
|
|
1504
1328
|
// await this.handleResetBalance(ALL_ACCOUNT_KEY, true);
|
|
1505
1329
|
await this.earningService.resetWallet();
|
|
1506
1330
|
await this.dbService.resetWallet(resetAll);
|
|
1507
|
-
this.accountRefStore.set('refList', []);
|
|
1508
1331
|
if (resetAll) {
|
|
1509
1332
|
await this.priceService.setPriceCurrency(DEFAULT_CURRENCY);
|
|
1510
1333
|
this.settingService.resetWallet();
|
|
@@ -1624,7 +1447,7 @@ class KoniState {
|
|
|
1624
1447
|
subscribeMantaPayBalance() {
|
|
1625
1448
|
var _this$chainService27, _this$chainService27$;
|
|
1626
1449
|
let interval;
|
|
1627
|
-
(_this$chainService27 = this.chainService) === null || _this$chainService27 === void 0 ? void 0 : (_this$chainService27$ = _this$chainService27.mantaPay) === null || _this$chainService27$ === void 0 ? void 0 : _this$chainService27$.getMantaPayConfig(this.keyringService.currentAccount.
|
|
1450
|
+
(_this$chainService27 = this.chainService) === null || _this$chainService27 === void 0 ? void 0 : (_this$chainService27$ = _this$chainService27.mantaPay) === null || _this$chainService27$ === void 0 ? void 0 : _this$chainService27$.getMantaPayConfig(this.keyringService.context.currentAccount.proxyId, _constants2._DEFAULT_MANTA_ZK_CHAIN).then(config => {
|
|
1628
1451
|
if (config && config.enabled && config.isInitialSync) {
|
|
1629
1452
|
this.getMantaZkBalance();
|
|
1630
1453
|
interval = setInterval(this.getMantaZkBalance, _constants.MANTA_PAY_BALANCE_INTERVAL);
|
|
@@ -1686,12 +1509,12 @@ class KoniState {
|
|
|
1686
1509
|
|
|
1687
1510
|
/* Metadata */
|
|
1688
1511
|
|
|
1689
|
-
getCrowdloanContributions(
|
|
1512
|
+
getCrowdloanContributions(_ref8) {
|
|
1690
1513
|
let {
|
|
1691
1514
|
address,
|
|
1692
1515
|
page,
|
|
1693
1516
|
relayChain
|
|
1694
|
-
} =
|
|
1517
|
+
} = _ref8;
|
|
1695
1518
|
return this.subscanService.getCrowdloanContributions(relayChain, address, page);
|
|
1696
1519
|
}
|
|
1697
1520
|
}
|