@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,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.YieldValidationStatus = exports.TransferTxErrorType = exports.StakingTxErrorType = exports.BasicTxErrorType = void 0;
|
|
7
|
+
// Copyright 2019-2022 @subwallet/extension-base
|
|
8
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
9
|
+
let YieldValidationStatus;
|
|
10
|
+
exports.YieldValidationStatus = YieldValidationStatus;
|
|
11
|
+
(function (YieldValidationStatus) {
|
|
12
|
+
YieldValidationStatus["NOT_ENOUGH_FEE"] = "NOT_ENOUGH_FEE";
|
|
13
|
+
YieldValidationStatus["NOT_ENOUGH_BALANCE"] = "NOT_ENOUGH_BALANCE";
|
|
14
|
+
YieldValidationStatus["NOT_ENOUGH_MIN_JOIN_POOL"] = "NOT_ENOUGH_MIN_JOIN_POOL";
|
|
15
|
+
YieldValidationStatus["OK"] = "OK";
|
|
16
|
+
})(YieldValidationStatus || (exports.YieldValidationStatus = YieldValidationStatus = {}));
|
|
17
|
+
let BasicTxErrorType;
|
|
18
|
+
exports.BasicTxErrorType = BasicTxErrorType;
|
|
19
|
+
(function (BasicTxErrorType) {
|
|
20
|
+
BasicTxErrorType["NOT_ENOUGH_BALANCE"] = "NOT_ENOUGH_BALANCE";
|
|
21
|
+
BasicTxErrorType["CHAIN_DISCONNECTED"] = "CHAIN_DISCONNECTED";
|
|
22
|
+
BasicTxErrorType["INVALID_PARAMS"] = "INVALID_PARAMS";
|
|
23
|
+
BasicTxErrorType["DUPLICATE_TRANSACTION"] = "DUPLICATE_TRANSACTION";
|
|
24
|
+
BasicTxErrorType["UNABLE_TO_SIGN"] = "UNABLE_TO_SIGN";
|
|
25
|
+
BasicTxErrorType["USER_REJECT_REQUEST"] = "USER_REJECT_REQUEST";
|
|
26
|
+
BasicTxErrorType["UNABLE_TO_SEND"] = "UNABLE_TO_SEND";
|
|
27
|
+
BasicTxErrorType["SEND_TRANSACTION_FAILED"] = "SEND_TRANSACTION_FAILED";
|
|
28
|
+
BasicTxErrorType["INTERNAL_ERROR"] = "INTERNAL_ERROR";
|
|
29
|
+
BasicTxErrorType["UNSUPPORTED"] = "UNSUPPORTED";
|
|
30
|
+
BasicTxErrorType["TIMEOUT"] = "TIMEOUT";
|
|
31
|
+
BasicTxErrorType["NOT_ENOUGH_EXISTENTIAL_DEPOSIT"] = "NOT_ENOUGH_EXISTENTIAL_DEPOSIT";
|
|
32
|
+
})(BasicTxErrorType || (exports.BasicTxErrorType = BasicTxErrorType = {}));
|
|
33
|
+
let StakingTxErrorType;
|
|
34
|
+
exports.StakingTxErrorType = StakingTxErrorType;
|
|
35
|
+
(function (StakingTxErrorType) {
|
|
36
|
+
StakingTxErrorType["NOT_ENOUGH_MIN_STAKE"] = "NOT_ENOUGH_MIN_STAKE";
|
|
37
|
+
StakingTxErrorType["EXCEED_MAX_NOMINATIONS"] = "EXCEED_MAX_NOMINATIONS";
|
|
38
|
+
StakingTxErrorType["EXIST_UNSTAKING_REQUEST"] = "EXIST_UNSTAKING_REQUEST";
|
|
39
|
+
StakingTxErrorType["INVALID_ACTIVE_STAKE"] = "INVALID_ACTIVE_STAKE";
|
|
40
|
+
StakingTxErrorType["EXCEED_MAX_UNSTAKING"] = "EXCEED_MAX_UNSTAKING";
|
|
41
|
+
StakingTxErrorType["INACTIVE_NOMINATION_POOL"] = "INACTIVE_NOMINATION_POOL";
|
|
42
|
+
StakingTxErrorType["CAN_NOT_GET_METADATA"] = "CAN_NOT_GET_METADATA";
|
|
43
|
+
StakingTxErrorType["NOT_ENOUGH_MIN_UNSTAKE"] = "NOT_ENOUGH_MIN_UNSTAKE";
|
|
44
|
+
})(StakingTxErrorType || (exports.StakingTxErrorType = StakingTxErrorType = {}));
|
|
45
|
+
let TransferTxErrorType;
|
|
46
|
+
exports.TransferTxErrorType = TransferTxErrorType;
|
|
47
|
+
(function (TransferTxErrorType) {
|
|
48
|
+
TransferTxErrorType["NOT_ENOUGH_VALUE"] = "NOT_ENOUGH_VALUE";
|
|
49
|
+
TransferTxErrorType["NOT_ENOUGH_FEE"] = "NOT_ENOUGH_FEE";
|
|
50
|
+
TransferTxErrorType["INVALID_TOKEN"] = "INVALID_TOKEN";
|
|
51
|
+
TransferTxErrorType["TRANSFER_ERROR"] = "TRANSFER_ERROR";
|
|
52
|
+
TransferTxErrorType["RECEIVER_NOT_ENOUGH_EXISTENTIAL_DEPOSIT"] = "RECEIVER_NOT_ENOUGH_EXISTENTIAL_DEPOSIT";
|
|
53
|
+
})(TransferTxErrorType || (exports.TransferTxErrorType = TransferTxErrorType = {}));
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _data = require("./data");
|
|
7
|
+
Object.keys(_data).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _data[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _data[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _error = require("./error");
|
|
18
|
+
Object.keys(_error).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _error[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _error[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _request = require("./request");
|
|
29
|
+
Object.keys(_request).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _request[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _request[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
var _warning = require("./warning");
|
|
40
|
+
Object.keys(_warning).forEach(function (key) {
|
|
41
|
+
if (key === "default" || key === "__esModule") return;
|
|
42
|
+
if (key in exports && exports[key] === _warning[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return _warning[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.BasicTxWarningCode = void 0;
|
|
7
|
+
// Copyright 2019-2022 @subwallet/extension-koni-ui authors & contributors
|
|
8
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
9
|
+
let BasicTxWarningCode;
|
|
10
|
+
exports.BasicTxWarningCode = BasicTxWarningCode;
|
|
11
|
+
(function (BasicTxWarningCode) {
|
|
12
|
+
BasicTxWarningCode["NOT_ENOUGH_EXISTENTIAL_DEPOSIT"] = "notEnoughExistentialDeposit";
|
|
13
|
+
BasicTxWarningCode["IS_BOUNCEABLE_ADDRESS"] = "isBounceableAddress";
|
|
14
|
+
})(BasicTxWarningCode || (exports.BasicTxWarningCode = BasicTxWarningCode = {}));
|
|
@@ -1,16 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.YieldValidationStatus = void 0;
|
|
7
|
-
// Copyright 2019-2022 @subwallet/extension-base
|
|
8
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
9
|
-
let YieldValidationStatus;
|
|
10
|
-
exports.YieldValidationStatus = YieldValidationStatus;
|
|
11
|
-
(function (YieldValidationStatus) {
|
|
12
|
-
YieldValidationStatus["NOT_ENOUGH_FEE"] = "NOT_ENOUGH_FEE";
|
|
13
|
-
YieldValidationStatus["NOT_ENOUGH_BALANCE"] = "NOT_ENOUGH_BALANCE";
|
|
14
|
-
YieldValidationStatus["NOT_ENOUGH_MIN_JOIN_POOL"] = "NOT_ENOUGH_MIN_JOIN_POOL";
|
|
15
|
-
YieldValidationStatus["OK"] = "OK";
|
|
16
|
-
})(YieldValidationStatus || (exports.YieldValidationStatus = YieldValidationStatus = {}));
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports._analyzeAddress = void 0;
|
|
7
|
+
var _domain = require("@subwallet/extension-base/koni/api/dotsama/domain");
|
|
8
|
+
var _utils = require("@subwallet/extension-base/services/chain-service/utils");
|
|
9
|
+
var _types = require("@subwallet/extension-base/types");
|
|
10
|
+
var _utilCrypto = require("@polkadot/util-crypto");
|
|
11
|
+
var _common = require("./common");
|
|
12
|
+
// Copyright 2019-2022 @subwallet/extension-base authors & contributors
|
|
13
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
14
|
+
|
|
15
|
+
// TODO: Re-confirm to compare without
|
|
16
|
+
const isStrValidWithAddress = (str, account, chainInfo) => {
|
|
17
|
+
if (account.chainType === _types.AccountChainType.SUBSTRATE) {
|
|
18
|
+
const reformated = (0, _common.reformatAddress)(account.address, (0, _utils._getChainSubstrateAddressPrefix)(chainInfo));
|
|
19
|
+
if (account.address.toLowerCase() === str || reformated.toLowerCase() === str) {
|
|
20
|
+
return 'extracted';
|
|
21
|
+
} else if (account.address.toLowerCase().includes(str) || reformated.toLowerCase().includes(str)) {
|
|
22
|
+
return 'valid';
|
|
23
|
+
}
|
|
24
|
+
} else if (account.chainType === _types.AccountChainType.TON) {
|
|
25
|
+
const isTestnet = chainInfo.isTestnet;
|
|
26
|
+
const reformated = (0, _common.reformatAddress)(account.address, isTestnet ? 0 : 1);
|
|
27
|
+
if (account.address.toLowerCase() === str || reformated.toLowerCase() === str) {
|
|
28
|
+
return 'extracted';
|
|
29
|
+
} else if (account.address.toLowerCase().includes(str) || reformated.toLowerCase().includes(str)) {
|
|
30
|
+
return 'valid';
|
|
31
|
+
}
|
|
32
|
+
} else {
|
|
33
|
+
if (account.address.toLowerCase() === str) {
|
|
34
|
+
return 'extracted';
|
|
35
|
+
} else if (account.address.toLowerCase().includes(str)) {
|
|
36
|
+
return 'valid';
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return 'invalid';
|
|
40
|
+
};
|
|
41
|
+
const isNameValid = (str, name) => {
|
|
42
|
+
if (name === str) {
|
|
43
|
+
return 'extracted';
|
|
44
|
+
} else if (name.includes(str)) {
|
|
45
|
+
return 'valid';
|
|
46
|
+
} else {
|
|
47
|
+
return 'invalid';
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
const _analyzeAddress = async (data, accountProxies, contacts, chainInfo, substrateApi) => {
|
|
51
|
+
if (!data) {
|
|
52
|
+
return {
|
|
53
|
+
options: []
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
const chain = chainInfo.slug;
|
|
57
|
+
const _data = data.trim().toLowerCase();
|
|
58
|
+
const options = [];
|
|
59
|
+
const currentChainType = (0, _utils._chainInfoToChainType)(chainInfo);
|
|
60
|
+
let current;
|
|
61
|
+
|
|
62
|
+
// Filter account proxies
|
|
63
|
+
for (const accountProxy of accountProxies) {
|
|
64
|
+
const _name = accountProxy.name.trim().toLowerCase();
|
|
65
|
+
const nameCondition = isNameValid(_data, _name);
|
|
66
|
+
const filterAccounts = accountProxy.accounts.filter(account => account.chainType === currentChainType);
|
|
67
|
+
for (const account of filterAccounts) {
|
|
68
|
+
const addressCondition = isStrValidWithAddress(_data, account, chainInfo);
|
|
69
|
+
const condition = nameCondition !== 'invalid' ? nameCondition : addressCondition;
|
|
70
|
+
const rs = {
|
|
71
|
+
address: account.address,
|
|
72
|
+
proxyId: accountProxy.id,
|
|
73
|
+
analyzedGroup: _types.AnalyzedGroup.WALLET,
|
|
74
|
+
displayName: accountProxy.name,
|
|
75
|
+
formatedAddress: (0, _common._reformatAddressWithChain)(account.address, chainInfo)
|
|
76
|
+
};
|
|
77
|
+
if (condition !== 'invalid') {
|
|
78
|
+
if (account.specialChain) {
|
|
79
|
+
if (account.specialChain === chain) {
|
|
80
|
+
options.push(rs);
|
|
81
|
+
if (condition === 'extracted') {
|
|
82
|
+
current = rs;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
} else {
|
|
86
|
+
options.push(rs);
|
|
87
|
+
if (condition === 'extracted') {
|
|
88
|
+
current = rs;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
const filterContacts = contacts.filter(contact => contact.chainType === currentChainType);
|
|
95
|
+
|
|
96
|
+
// Filter address book addresses
|
|
97
|
+
for (const contact of filterContacts) {
|
|
98
|
+
const name = (contact === null || contact === void 0 ? void 0 : contact.name) || '';
|
|
99
|
+
const _name = name.trim().toLowerCase();
|
|
100
|
+
const nameCondition = isNameValid(_data, _name);
|
|
101
|
+
const addressCondition = isStrValidWithAddress(_data, contact, chainInfo);
|
|
102
|
+
const condition = nameCondition !== 'invalid' ? nameCondition : addressCondition;
|
|
103
|
+
const rs = {
|
|
104
|
+
address: contact.address,
|
|
105
|
+
analyzedGroup: contact.isRecent ? _types.AnalyzedGroup.RECENT : _types.AnalyzedGroup.CONTACT,
|
|
106
|
+
displayName: name,
|
|
107
|
+
formatedAddress: (0, _common._reformatAddressWithChain)(contact.address, chainInfo)
|
|
108
|
+
};
|
|
109
|
+
if (condition !== 'invalid') {
|
|
110
|
+
if (contact.isRecent) {
|
|
111
|
+
var _contact$recentChainS;
|
|
112
|
+
if ((_contact$recentChainS = contact.recentChainSlugs) !== null && _contact$recentChainS !== void 0 && _contact$recentChainS.includes(chain)) {
|
|
113
|
+
options.push(rs);
|
|
114
|
+
if (condition === 'extracted') {
|
|
115
|
+
current = rs;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
} else {
|
|
119
|
+
options.push(rs);
|
|
120
|
+
if (condition === 'extracted') {
|
|
121
|
+
current = rs;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
if (substrateApi) {
|
|
127
|
+
await (substrateApi === null || substrateApi === void 0 ? void 0 : substrateApi.isReady);
|
|
128
|
+
const _raw = data.trim();
|
|
129
|
+
if (chain === 'aleph' || chain === 'alephTest') {
|
|
130
|
+
if ((0, _utilCrypto.isAddress)(_raw)) {
|
|
131
|
+
const domain = await (0, _domain.resolveAzeroAddressToDomain)(_raw, chain, substrateApi.api);
|
|
132
|
+
if (domain) {
|
|
133
|
+
const rs = {
|
|
134
|
+
address: _raw,
|
|
135
|
+
analyzedGroup: _types.AnalyzedGroup.DOMAIN,
|
|
136
|
+
displayName: domain,
|
|
137
|
+
formatedAddress: (0, _common._reformatAddressWithChain)(_raw, chainInfo)
|
|
138
|
+
};
|
|
139
|
+
options.push(rs);
|
|
140
|
+
if (!current) {
|
|
141
|
+
current = rs;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
} else {
|
|
145
|
+
const address = await (0, _domain.resolveAzeroDomainToAddress)(_raw, chain, substrateApi.api);
|
|
146
|
+
if (address) {
|
|
147
|
+
const rs = {
|
|
148
|
+
address: address,
|
|
149
|
+
analyzedGroup: _types.AnalyzedGroup.DOMAIN,
|
|
150
|
+
displayName: _raw,
|
|
151
|
+
formatedAddress: (0, _common._reformatAddressWithChain)(address, chainInfo)
|
|
152
|
+
};
|
|
153
|
+
options.push(rs);
|
|
154
|
+
if (!current) {
|
|
155
|
+
current = rs;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return {
|
|
162
|
+
options,
|
|
163
|
+
current
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
exports._analyzeAddress = _analyzeAddress;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports._reformatAddressWithChain = void 0;
|
|
7
|
+
exports.categoryAddresses = categoryAddresses;
|
|
8
|
+
exports.getAccountChainTypeForAddress = void 0;
|
|
9
|
+
exports.isAccountAll = isAccountAll;
|
|
10
|
+
exports.modifyAccountName = void 0;
|
|
11
|
+
exports.quickFormatAddressToCompare = quickFormatAddressToCompare;
|
|
12
|
+
exports.reformatAddress = reformatAddress;
|
|
13
|
+
var _constants = require("@subwallet/extension-base/constants");
|
|
14
|
+
var _utils = require("@subwallet/extension-base/services/chain-service/utils");
|
|
15
|
+
var _types = require("@subwallet/extension-base/types");
|
|
16
|
+
var _utils2 = require("@subwallet/extension-base/utils");
|
|
17
|
+
var _keyring = require("@subwallet/keyring");
|
|
18
|
+
var _utilCrypto = require("@polkadot/util-crypto");
|
|
19
|
+
// Copyright 2019-2022 @subwallet/extension-base authors & contributors
|
|
20
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
21
|
+
|
|
22
|
+
function isAccountAll(address) {
|
|
23
|
+
return address === _constants.ALL_ACCOUNT_KEY;
|
|
24
|
+
}
|
|
25
|
+
function reformatAddress(address) {
|
|
26
|
+
let networkPrefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 42;
|
|
27
|
+
let isEthereum = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
28
|
+
try {
|
|
29
|
+
if (!address || address === '') {
|
|
30
|
+
return '';
|
|
31
|
+
}
|
|
32
|
+
if ((0, _utilCrypto.isEthereumAddress)(address)) {
|
|
33
|
+
return address;
|
|
34
|
+
}
|
|
35
|
+
if (isAccountAll(address)) {
|
|
36
|
+
return address;
|
|
37
|
+
}
|
|
38
|
+
const publicKey = (0, _keyring.decodeAddress)(address);
|
|
39
|
+
if (isEthereum) {
|
|
40
|
+
return (0, _utilCrypto.ethereumEncode)(publicKey);
|
|
41
|
+
}
|
|
42
|
+
const type = (0, _keyring.getKeypairTypeByAddress)(address);
|
|
43
|
+
if (networkPrefix < 0) {
|
|
44
|
+
return address;
|
|
45
|
+
}
|
|
46
|
+
return (0, _keyring.encodeAddress)(publicKey, networkPrefix, type);
|
|
47
|
+
} catch (e) {
|
|
48
|
+
console.warn('Get error while reformat address', address, e);
|
|
49
|
+
return address;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
const _reformatAddressWithChain = (address, chainInfo) => {
|
|
53
|
+
const chainType = (0, _utils._chainInfoToChainType)(chainInfo);
|
|
54
|
+
if (chainType === _types.AccountChainType.SUBSTRATE) {
|
|
55
|
+
return reformatAddress(address, (0, _utils._getChainSubstrateAddressPrefix)(chainInfo));
|
|
56
|
+
} else if (chainType === _types.AccountChainType.TON) {
|
|
57
|
+
const isTestnet = chainInfo.isTestnet;
|
|
58
|
+
return reformatAddress(address, isTestnet ? 0 : 1);
|
|
59
|
+
} else {
|
|
60
|
+
return address;
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
exports._reformatAddressWithChain = _reformatAddressWithChain;
|
|
64
|
+
const getAccountChainTypeForAddress = address => {
|
|
65
|
+
const type = (0, _keyring.getKeypairTypeByAddress)(address);
|
|
66
|
+
return (0, _utils2.getAccountChainType)(type);
|
|
67
|
+
};
|
|
68
|
+
exports.getAccountChainTypeForAddress = getAccountChainTypeForAddress;
|
|
69
|
+
function categoryAddresses(addresses) {
|
|
70
|
+
const substrate = [];
|
|
71
|
+
const evm = [];
|
|
72
|
+
const ton = [];
|
|
73
|
+
const bitcoin = [];
|
|
74
|
+
addresses.forEach(address => {
|
|
75
|
+
if ((0, _utilCrypto.isEthereumAddress)(address)) {
|
|
76
|
+
evm.push(address);
|
|
77
|
+
} else if ((0, _keyring.isTonAddress)(address)) {
|
|
78
|
+
ton.push(address);
|
|
79
|
+
} else if ((0, _keyring.isBitcoinAddress)(address)) {
|
|
80
|
+
bitcoin.push(address);
|
|
81
|
+
} else {
|
|
82
|
+
substrate.push(address);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
return {
|
|
86
|
+
bitcoin,
|
|
87
|
+
evm,
|
|
88
|
+
substrate,
|
|
89
|
+
ton
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
function quickFormatAddressToCompare(address) {
|
|
93
|
+
if (!(0, _keyring.isAddress)(address)) {
|
|
94
|
+
return address;
|
|
95
|
+
}
|
|
96
|
+
return reformatAddress(address, 42).toLowerCase();
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** @deprecated */
|
|
100
|
+
const modifyAccountName = (type, name, modify) => {
|
|
101
|
+
if (!modify) {
|
|
102
|
+
return name;
|
|
103
|
+
}
|
|
104
|
+
let network = '';
|
|
105
|
+
switch (type) {
|
|
106
|
+
case 'sr25519':
|
|
107
|
+
case 'ed25519':
|
|
108
|
+
case 'ecdsa':
|
|
109
|
+
network = 'Substrate';
|
|
110
|
+
break;
|
|
111
|
+
case 'ethereum':
|
|
112
|
+
network = 'EVM';
|
|
113
|
+
break;
|
|
114
|
+
case 'ton':
|
|
115
|
+
case 'ton-native':
|
|
116
|
+
network = 'Ton';
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
return network ? [name, network].join(' - ') : name;
|
|
120
|
+
};
|
|
121
|
+
exports.modifyAccountName = modifyAccountName;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _info = require("./info");
|
|
7
|
+
Object.keys(_info).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _info[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _info[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _validate = require("./validate");
|
|
18
|
+
Object.keys(_validate).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _validate[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _validate[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _solo = require("./solo");
|
|
7
|
+
Object.keys(_solo).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _solo[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _solo[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _unified = require("./unified");
|
|
18
|
+
Object.keys(_unified).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _unified[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _unified[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|