@yaswap/wallet-core 2.0.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/CHANGELOG.md +804 -0
- package/README.md +163 -0
- package/dist/package.json +76 -0
- package/dist/src/build.config.d.ts +46 -0
- package/dist/src/build.config.js +237 -0
- package/dist/src/build.config.js.map +1 -0
- package/dist/src/factory/client/clients.d.ts +11 -0
- package/dist/src/factory/client/clients.js +119 -0
- package/dist/src/factory/client/clients.js.map +1 -0
- package/dist/src/factory/client/evm.d.ts +6 -0
- package/dist/src/factory/client/evm.js +71 -0
- package/dist/src/factory/client/evm.js.map +1 -0
- package/dist/src/factory/client/index.d.ts +11 -0
- package/dist/src/factory/client/index.js +38 -0
- package/dist/src/factory/client/index.js.map +1 -0
- package/dist/src/factory/client/nft.d.ts +4 -0
- package/dist/src/factory/client/nft.js +26 -0
- package/dist/src/factory/client/nft.js.map +1 -0
- package/dist/src/factory/index.d.ts +3 -0
- package/dist/src/factory/index.js +7 -0
- package/dist/src/factory/index.js.map +1 -0
- package/dist/src/factory/settings.d.ts +4 -0
- package/dist/src/factory/settings.js +27 -0
- package/dist/src/factory/settings.js.map +1 -0
- package/dist/src/factory/swap/index.d.ts +4 -0
- package/dist/src/factory/swap/index.js +66 -0
- package/dist/src/factory/swap/index.js.map +1 -0
- package/dist/src/index.d.ts +1619 -0
- package/dist/src/index.js +38 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/index.test.d.ts +1 -0
- package/dist/src/index.test.js +187 -0
- package/dist/src/index.test.js.map +1 -0
- package/dist/src/nameResolvers/nameResolver.d.ts +7 -0
- package/dist/src/nameResolvers/nameResolver.js +3 -0
- package/dist/src/nameResolvers/nameResolver.js.map +1 -0
- package/dist/src/nameResolvers/uns.d.ts +12 -0
- package/dist/src/nameResolvers/uns.js +83 -0
- package/dist/src/nameResolvers/uns.js.map +1 -0
- package/dist/src/nameResolvers/uns.test.d.ts +1 -0
- package/dist/src/nameResolvers/uns.test.js +29 -0
- package/dist/src/nameResolvers/uns.test.js.map +1 -0
- package/dist/src/store/actions/acceptTermsAndConditions.d.ts +4 -0
- package/dist/src/store/actions/acceptTermsAndConditions.js +17 -0
- package/dist/src/store/actions/acceptTermsAndConditions.js.map +1 -0
- package/dist/src/store/actions/acceptTermsAndConditions.test.d.ts +1 -0
- package/dist/src/store/actions/acceptTermsAndConditions.test.js +22 -0
- package/dist/src/store/actions/acceptTermsAndConditions.test.js.map +1 -0
- package/dist/src/store/actions/accounts/createAccount.d.ts +7 -0
- package/dist/src/store/actions/accounts/createAccount.js +27 -0
- package/dist/src/store/actions/accounts/createAccount.js.map +1 -0
- package/dist/src/store/actions/accounts/createAccount.test.d.ts +1 -0
- package/dist/src/store/actions/accounts/createAccount.test.js +29 -0
- package/dist/src/store/actions/accounts/createAccount.test.js.map +1 -0
- package/dist/src/store/actions/accounts/index.d.ts +5 -0
- package/dist/src/store/actions/accounts/index.js +9 -0
- package/dist/src/store/actions/accounts/index.js.map +1 -0
- package/dist/src/store/actions/accounts/removeAccount.d.ts +7 -0
- package/dist/src/store/actions/accounts/removeAccount.js +12 -0
- package/dist/src/store/actions/accounts/removeAccount.js.map +1 -0
- package/dist/src/store/actions/accounts/removeAccount.test.d.ts +1 -0
- package/dist/src/store/actions/accounts/removeAccount.test.js +53 -0
- package/dist/src/store/actions/accounts/removeAccount.test.js.map +1 -0
- package/dist/src/store/actions/accounts/toggleAccount.d.ts +8 -0
- package/dist/src/store/actions/accounts/toggleAccount.js +19 -0
- package/dist/src/store/actions/accounts/toggleAccount.js.map +1 -0
- package/dist/src/store/actions/accounts/toggleAccount.test.d.ts +1 -0
- package/dist/src/store/actions/accounts/toggleAccount.test.js +44 -0
- package/dist/src/store/actions/accounts/toggleAccount.test.js.map +1 -0
- package/dist/src/store/actions/accounts/toggleBlockchain.d.ts +9 -0
- package/dist/src/store/actions/accounts/toggleBlockchain.js +14 -0
- package/dist/src/store/actions/accounts/toggleBlockchain.js.map +1 -0
- package/dist/src/store/actions/accounts/updateAccount.d.ts +26 -0
- package/dist/src/store/actions/accounts/updateAccount.js +14 -0
- package/dist/src/store/actions/accounts/updateAccount.js.map +1 -0
- package/dist/src/store/actions/addCustomToken.d.ts +12 -0
- package/dist/src/store/actions/addCustomToken.js +12 -0
- package/dist/src/store/actions/addCustomToken.js.map +1 -0
- package/dist/src/store/actions/addCustomToken.test.d.ts +1 -0
- package/dist/src/store/actions/addCustomToken.test.js +59 -0
- package/dist/src/store/actions/addCustomToken.test.js.map +1 -0
- package/dist/src/store/actions/addExternalConnection.d.ts +9 -0
- package/dist/src/store/actions/addExternalConnection.js +13 -0
- package/dist/src/store/actions/addExternalConnection.js.map +1 -0
- package/dist/src/store/actions/addExternalConnection.test.d.ts +1 -0
- package/dist/src/store/actions/addExternalConnection.test.js +100 -0
- package/dist/src/store/actions/addExternalConnection.test.js.map +1 -0
- package/dist/src/store/actions/analytics.d.ts +21 -0
- package/dist/src/store/actions/analytics.js +58 -0
- package/dist/src/store/actions/analytics.js.map +1 -0
- package/dist/src/store/actions/analytics.test.d.ts +1 -0
- package/dist/src/store/actions/analytics.test.js +33 -0
- package/dist/src/store/actions/analytics.test.js.map +1 -0
- package/dist/src/store/actions/changeActiveNetwork.d.ts +5 -0
- package/dist/src/store/actions/changeActiveNetwork.js +13 -0
- package/dist/src/store/actions/changeActiveNetwork.js.map +1 -0
- package/dist/src/store/actions/changeActiveWalletId.d.ts +5 -0
- package/dist/src/store/actions/changeActiveWalletId.js +11 -0
- package/dist/src/store/actions/changeActiveWalletId.js.map +1 -0
- package/dist/src/store/actions/changeActiveWalletId.test.d.ts +1 -0
- package/dist/src/store/actions/changeActiveWalletId.test.js +40 -0
- package/dist/src/store/actions/changeActiveWalletId.test.js.map +1 -0
- package/dist/src/store/actions/changePassword.d.ts +4 -0
- package/dist/src/store/actions/changePassword.js +13 -0
- package/dist/src/store/actions/changePassword.js.map +1 -0
- package/dist/src/store/actions/changePassword.test.d.ts +1 -0
- package/dist/src/store/actions/changePassword.test.js +22 -0
- package/dist/src/store/actions/changePassword.test.js.map +1 -0
- package/dist/src/store/actions/checkPendingActions.d.ts +5 -0
- package/dist/src/store/actions/checkPendingActions.js +25 -0
- package/dist/src/store/actions/checkPendingActions.js.map +1 -0
- package/dist/src/store/actions/clearErrorLog.d.ts +2 -0
- package/dist/src/store/actions/clearErrorLog.js +10 -0
- package/dist/src/store/actions/clearErrorLog.js.map +1 -0
- package/dist/src/store/actions/createWallet.d.ts +7 -0
- package/dist/src/store/actions/createWallet.js +90 -0
- package/dist/src/store/actions/createWallet.js.map +1 -0
- package/dist/src/store/actions/createWallet.test.d.ts +1 -0
- package/dist/src/store/actions/createWallet.test.js +41 -0
- package/dist/src/store/actions/createWallet.test.js.map +1 -0
- package/dist/src/store/actions/customChainSettings.d.ts +15 -0
- package/dist/src/store/actions/customChainSettings.js +37 -0
- package/dist/src/store/actions/customChainSettings.js.map +1 -0
- package/dist/src/store/actions/disableAssets.d.ts +7 -0
- package/dist/src/store/actions/disableAssets.js +28 -0
- package/dist/src/store/actions/disableAssets.js.map +1 -0
- package/dist/src/store/actions/disableEthereumInjection.d.ts +2 -0
- package/dist/src/store/actions/disableEthereumInjection.js +11 -0
- package/dist/src/store/actions/disableEthereumInjection.js.map +1 -0
- package/dist/src/store/actions/disableEthereumInjection.test.d.ts +1 -0
- package/dist/src/store/actions/disableEthereumInjection.test.js +24 -0
- package/dist/src/store/actions/disableEthereumInjection.test.js.map +1 -0
- package/dist/src/store/actions/enableAssets.d.ts +7 -0
- package/dist/src/store/actions/enableAssets.js +65 -0
- package/dist/src/store/actions/enableAssets.js.map +1 -0
- package/dist/src/store/actions/enableAssets.test.d.ts +1 -0
- package/dist/src/store/actions/enableAssets.test.js +37 -0
- package/dist/src/store/actions/enableAssets.test.js.map +1 -0
- package/dist/src/store/actions/enableDisableAssets.test.d.ts +1 -0
- package/dist/src/store/actions/enableDisableAssets.test.js +79 -0
- package/dist/src/store/actions/enableDisableAssets.test.js.map +1 -0
- package/dist/src/store/actions/enableEthereumInjection.d.ts +2 -0
- package/dist/src/store/actions/enableEthereumInjection.js +11 -0
- package/dist/src/store/actions/enableEthereumInjection.js.map +1 -0
- package/dist/src/store/actions/exportPrivateKey.d.ts +9 -0
- package/dist/src/store/actions/exportPrivateKey.js +12 -0
- package/dist/src/store/actions/exportPrivateKey.js.map +1 -0
- package/dist/src/store/actions/exportPrivateKey.test.d.ts +1 -0
- package/dist/src/store/actions/exportPrivateKey.test.js +36 -0
- package/dist/src/store/actions/exportPrivateKey.test.js.map +1 -0
- package/dist/src/store/actions/fetchTokenDetails.d.ts +11 -0
- package/dist/src/store/actions/fetchTokenDetails.js +22 -0
- package/dist/src/store/actions/fetchTokenDetails.js.map +1 -0
- package/dist/src/store/actions/forgetDappConnections.d.ts +2 -0
- package/dist/src/store/actions/forgetDappConnections.js +11 -0
- package/dist/src/store/actions/forgetDappConnections.js.map +1 -0
- package/dist/src/store/actions/getLockForAsset.d.ts +8 -0
- package/dist/src/store/actions/getLockForAsset.js +34 -0
- package/dist/src/store/actions/getLockForAsset.js.map +1 -0
- package/dist/src/store/actions/getQuotes.d.ts +13 -0
- package/dist/src/store/actions/getQuotes.js +70 -0
- package/dist/src/store/actions/getQuotes.js.map +1 -0
- package/dist/src/store/actions/getQuotes.test.d.ts +1 -0
- package/dist/src/store/actions/getQuotes.test.js +30 -0
- package/dist/src/store/actions/getQuotes.test.js.map +1 -0
- package/dist/src/store/actions/getUnusedAddresses.d.ts +8 -0
- package/dist/src/store/actions/getUnusedAddresses.js +51 -0
- package/dist/src/store/actions/getUnusedAddresses.js.map +1 -0
- package/dist/src/store/actions/hardware-wallet/getLedgerAccounts.d.ts +16 -0
- package/dist/src/store/actions/hardware-wallet/getLedgerAccounts.js +57 -0
- package/dist/src/store/actions/hardware-wallet/getLedgerAccounts.js.map +1 -0
- package/dist/src/store/actions/hardware-wallet/index.d.ts +1 -0
- package/dist/src/store/actions/hardware-wallet/index.js +5 -0
- package/dist/src/store/actions/hardware-wallet/index.js.map +1 -0
- package/dist/src/store/actions/index.d.ts +47 -0
- package/dist/src/store/actions/index.js +51 -0
- package/dist/src/store/actions/index.js.map +1 -0
- package/dist/src/store/actions/initializeAddresses.d.ts +6 -0
- package/dist/src/store/actions/initializeAddresses.js +26 -0
- package/dist/src/store/actions/initializeAddresses.js.map +1 -0
- package/dist/src/store/actions/initializeAddresses.test.d.ts +1 -0
- package/dist/src/store/actions/initializeAddresses.test.js +58 -0
- package/dist/src/store/actions/initializeAddresses.test.js.map +1 -0
- package/dist/src/store/actions/lockWallet.d.ts +2 -0
- package/dist/src/store/actions/lockWallet.js +11 -0
- package/dist/src/store/actions/lockWallet.js.map +1 -0
- package/dist/src/store/actions/lockWallet.test.d.ts +1 -0
- package/dist/src/store/actions/lockWallet.test.js +24 -0
- package/dist/src/store/actions/lockWallet.test.js.map +1 -0
- package/dist/src/store/actions/logError.d.ts +3 -0
- package/dist/src/store/actions/logError.js +10 -0
- package/dist/src/store/actions/logError.js.map +1 -0
- package/dist/src/store/actions/logError.test.d.ts +1 -0
- package/dist/src/store/actions/logError.test.js +27 -0
- package/dist/src/store/actions/logError.test.js.map +1 -0
- package/dist/src/store/actions/newSwap.d.ts +12 -0
- package/dist/src/store/actions/newSwap.js +34 -0
- package/dist/src/store/actions/newSwap.js.map +1 -0
- package/dist/src/store/actions/performNextAction/index.d.ts +7 -0
- package/dist/src/store/actions/performNextAction/index.js +65 -0
- package/dist/src/store/actions/performNextAction/index.js.map +1 -0
- package/dist/src/store/actions/performNextAction/send.d.ts +7 -0
- package/dist/src/store/actions/performNextAction/send.js +54 -0
- package/dist/src/store/actions/performNextAction/send.js.map +1 -0
- package/dist/src/store/actions/performNextAction/sendNFT.d.ts +7 -0
- package/dist/src/store/actions/performNextAction/sendNFT.js +50 -0
- package/dist/src/store/actions/performNextAction/sendNFT.js.map +1 -0
- package/dist/src/store/actions/performNextAction/utils.d.ts +11 -0
- package/dist/src/store/actions/performNextAction/utils.js +42 -0
- package/dist/src/store/actions/performNextAction/utils.js.map +1 -0
- package/dist/src/store/actions/proxyMutation.d.ts +5 -0
- package/dist/src/store/actions/proxyMutation.js +9 -0
- package/dist/src/store/actions/proxyMutation.js.map +1 -0
- package/dist/src/store/actions/removeCustomToken.d.ts +7 -0
- package/dist/src/store/actions/removeCustomToken.js +11 -0
- package/dist/src/store/actions/removeCustomToken.js.map +1 -0
- package/dist/src/store/actions/retrySwap.d.ts +5 -0
- package/dist/src/store/actions/retrySwap.js +23 -0
- package/dist/src/store/actions/retrySwap.js.map +1 -0
- package/dist/src/store/actions/sendNFTTransaction.d.ts +4 -0
- package/dist/src/store/actions/sendNFTTransaction.js +47 -0
- package/dist/src/store/actions/sendNFTTransaction.js.map +1 -0
- package/dist/src/store/actions/sendTransaction.d.ts +17 -0
- package/dist/src/store/actions/sendTransaction.js +51 -0
- package/dist/src/store/actions/sendTransaction.js.map +1 -0
- package/dist/src/store/actions/sendTransaction.test.d.ts +1 -0
- package/dist/src/store/actions/sendTransaction.test.js +80 -0
- package/dist/src/store/actions/sendTransaction.test.js.map +1 -0
- package/dist/src/store/actions/setEthereumInjectionChain.d.ts +5 -0
- package/dist/src/store/actions/setEthereumInjectionChain.js +11 -0
- package/dist/src/store/actions/setEthereumInjectionChain.js.map +1 -0
- package/dist/src/store/actions/setEthereumInjectionChain.test.d.ts +1 -0
- package/dist/src/store/actions/setEthereumInjectionChain.test.js +20 -0
- package/dist/src/store/actions/setEthereumInjectionChain.test.js.map +1 -0
- package/dist/src/store/actions/setWhatsNewModalVersion.d.ts +4 -0
- package/dist/src/store/actions/setWhatsNewModalVersion.js +10 -0
- package/dist/src/store/actions/setWhatsNewModalVersion.js.map +1 -0
- package/dist/src/store/actions/setWhatsNewModalVersion.test.d.ts +1 -0
- package/dist/src/store/actions/setWhatsNewModalVersion.test.js +24 -0
- package/dist/src/store/actions/setWhatsNewModalVersion.test.js.map +1 -0
- package/dist/src/store/actions/showNotification.d.ts +2 -0
- package/dist/src/store/actions/showNotification.js +10 -0
- package/dist/src/store/actions/showNotification.js.map +1 -0
- package/dist/src/store/actions/toggleExperiment.d.ts +5 -0
- package/dist/src/store/actions/toggleExperiment.js +10 -0
- package/dist/src/store/actions/toggleExperiment.js.map +1 -0
- package/dist/src/store/actions/toggleExperiment.test.d.ts +1 -0
- package/dist/src/store/actions/toggleExperiment.test.js +34 -0
- package/dist/src/store/actions/toggleExperiment.test.js.map +1 -0
- package/dist/src/store/actions/toggleNFTStarred.d.ts +8 -0
- package/dist/src/store/actions/toggleNFTStarred.js +10 -0
- package/dist/src/store/actions/toggleNFTStarred.js.map +1 -0
- package/dist/src/store/actions/unlockWallet.d.ts +4 -0
- package/dist/src/store/actions/unlockWallet.js +22 -0
- package/dist/src/store/actions/unlockWallet.js.map +1 -0
- package/dist/src/store/actions/updateAccountBalance.d.ts +7 -0
- package/dist/src/store/actions/updateAccountBalance.js +29 -0
- package/dist/src/store/actions/updateAccountBalance.js.map +1 -0
- package/dist/src/store/actions/updateBalances.d.ts +9 -0
- package/dist/src/store/actions/updateBalances.js +169 -0
- package/dist/src/store/actions/updateBalances.js.map +1 -0
- package/dist/src/store/actions/updateBalances.test.d.ts +1 -0
- package/dist/src/store/actions/updateBalances.test.js +43 -0
- package/dist/src/store/actions/updateBalances.test.js.map +1 -0
- package/dist/src/store/actions/updateCurrenciesInfo.d.ts +5 -0
- package/dist/src/store/actions/updateCurrenciesInfo.js +14 -0
- package/dist/src/store/actions/updateCurrenciesInfo.js.map +1 -0
- package/dist/src/store/actions/updateFees.d.ts +6 -0
- package/dist/src/store/actions/updateFees.js +16 -0
- package/dist/src/store/actions/updateFees.js.map +1 -0
- package/dist/src/store/actions/updateFees.test.d.ts +1 -0
- package/dist/src/store/actions/updateFees.test.js +86 -0
- package/dist/src/store/actions/updateFees.test.js.map +1 -0
- package/dist/src/store/actions/updateFiatRates.d.ts +5 -0
- package/dist/src/store/actions/updateFiatRates.js +15 -0
- package/dist/src/store/actions/updateFiatRates.js.map +1 -0
- package/dist/src/store/actions/updateFiatRates.test.d.ts +1 -0
- package/dist/src/store/actions/updateFiatRates.test.js +43 -0
- package/dist/src/store/actions/updateFiatRates.test.js.map +1 -0
- package/dist/src/store/actions/updateMarketData.d.ts +8 -0
- package/dist/src/store/actions/updateMarketData.js +28 -0
- package/dist/src/store/actions/updateMarketData.js.map +1 -0
- package/dist/src/store/actions/updateMarketData.test.d.ts +1 -0
- package/dist/src/store/actions/updateMarketData.test.js +49 -0
- package/dist/src/store/actions/updateMarketData.test.js.map +1 -0
- package/dist/src/store/actions/updateNFTs.d.ts +7 -0
- package/dist/src/store/actions/updateNFTs.js +39 -0
- package/dist/src/store/actions/updateNFTs.js.map +1 -0
- package/dist/src/store/actions/updateNFTs.test.d.ts +1 -0
- package/dist/src/store/actions/updateNFTs.test.js +32 -0
- package/dist/src/store/actions/updateNFTs.test.js.map +1 -0
- package/dist/src/store/actions/updateTransactionFee.d.ts +11 -0
- package/dist/src/store/actions/updateTransactionFee.js +81 -0
- package/dist/src/store/actions/updateTransactionFee.js.map +1 -0
- package/dist/src/store/broker/notification.d.ts +4 -0
- package/dist/src/store/broker/notification.js +84 -0
- package/dist/src/store/broker/notification.js.map +1 -0
- package/dist/src/store/getters.d.ts +59 -0
- package/dist/src/store/getters.js +350 -0
- package/dist/src/store/getters.js.map +1 -0
- package/dist/src/store/index.d.ts +3524 -0
- package/dist/src/store/index.js +24 -0
- package/dist/src/store/index.js.map +1 -0
- package/dist/src/store/migrations/10_analytics_settings.d.ts +4 -0
- package/dist/src/store/migrations/10_analytics_settings.js +19 -0
- package/dist/src/store/migrations/10_analytics_settings.js.map +1 -0
- package/dist/src/store/migrations/11_12_rsk_legacy_derivation_path.d.ts +8 -0
- package/dist/src/store/migrations/11_12_rsk_legacy_derivation_path.js +22 -0
- package/dist/src/store/migrations/11_12_rsk_legacy_derivation_path.js.map +1 -0
- package/dist/src/store/migrations/13_rsk_fish_token.d.ts +4 -0
- package/dist/src/store/migrations/13_rsk_fish_token.js +19 -0
- package/dist/src/store/migrations/13_rsk_fish_token.js.map +1 -0
- package/dist/src/store/migrations/14_account_set_derivation_path.d.ts +4 -0
- package/dist/src/store/migrations/14_account_set_derivation_path.js +56 -0
- package/dist/src/store/migrations/14_account_set_derivation_path.js.map +1 -0
- package/dist/src/store/migrations/15_accounts_chains_set_enabled.d.ts +4 -0
- package/dist/src/store/migrations/15_accounts_chains_set_enabled.js +25 -0
- package/dist/src/store/migrations/15_accounts_chains_set_enabled.js.map +1 -0
- package/dist/src/store/migrations/16_enable_terra_chain.d.ts +4 -0
- package/dist/src/store/migrations/16_enable_terra_chain.js +10 -0
- package/dist/src/store/migrations/16_enable_terra_chain.js.map +1 -0
- package/dist/src/store/migrations/17_remove_injection_enabled.d.ts +4 -0
- package/dist/src/store/migrations/17_remove_injection_enabled.js +12 -0
- package/dist/src/store/migrations/17_remove_injection_enabled.js.map +1 -0
- package/dist/src/store/migrations/18_enable_avalanche_chain.d.ts +4 -0
- package/dist/src/store/migrations/18_enable_avalanche_chain.js +10 -0
- package/dist/src/store/migrations/18_enable_avalanche_chain.js.map +1 -0
- package/dist/src/store/migrations/19_remove_existing_ledger_accounts.d.ts +4 -0
- package/dist/src/store/migrations/19_remove_existing_ledger_accounts.js +25 -0
- package/dist/src/store/migrations/19_remove_existing_ledger_accounts.js.map +1 -0
- package/dist/src/store/migrations/19_remove_existing_ledger_accounts.state.pre.json +1944 -0
- package/dist/src/store/migrations/19_remove_existing_ledger_accounts_test.d.ts +1 -0
- package/dist/src/store/migrations/19_remove_existing_ledger_accounts_test.js +7 -0
- package/dist/src/store/migrations/19_remove_existing_ledger_accounts_test.js.map +1 -0
- package/dist/src/store/migrations/1_first_migration.d.ts +4 -0
- package/dist/src/store/migrations/1_first_migration.js +11 -0
- package/dist/src/store/migrations/1_first_migration.js.map +1 -0
- package/dist/src/store/migrations/20_fix_accounts.d.ts +4 -0
- package/dist/src/store/migrations/20_fix_accounts.js +68 -0
- package/dist/src/store/migrations/20_fix_accounts.js.map +1 -0
- package/dist/src/store/migrations/21_enable_solana_chain.d.ts +4 -0
- package/dist/src/store/migrations/21_enable_solana_chain.js +10 -0
- package/dist/src/store/migrations/21_enable_solana_chain.js.map +1 -0
- package/dist/src/store/migrations/22_enable_optimism_chain.d.ts +4 -0
- package/dist/src/store/migrations/22_enable_optimism_chain.js +10 -0
- package/dist/src/store/migrations/22_enable_optimism_chain.js.map +1 -0
- package/dist/src/store/migrations/2_set_default_assets.d.ts +4 -0
- package/dist/src/store/migrations/2_set_default_assets.js +20 -0
- package/dist/src/store/migrations/2_set_default_assets.js.map +1 -0
- package/dist/src/store/migrations/3_add_network_custom_tokens.d.ts +4 -0
- package/dist/src/store/migrations/3_add_network_custom_tokens.js +21 -0
- package/dist/src/store/migrations/3_add_network_custom_tokens.js.map +1 -0
- package/dist/src/store/migrations/4_fix_rsk_token_injected_asset.d.ts +4 -0
- package/dist/src/store/migrations/4_fix_rsk_token_injected_asset.js +15 -0
- package/dist/src/store/migrations/4_fix_rsk_token_injected_asset.js.map +1 -0
- package/dist/src/store/migrations/5_multiple_account_support.d.ts +4 -0
- package/dist/src/store/migrations/5_multiple_account_support.js +96 -0
- package/dist/src/store/migrations/5_multiple_account_support.js.map +1 -0
- package/dist/src/store/migrations/6_use_ledger_live_default.d.ts +4 -0
- package/dist/src/store/migrations/6_use_ledger_live_default.js +11 -0
- package/dist/src/store/migrations/6_use_ledger_live_default.js.map +1 -0
- package/dist/src/store/migrations/7_multi_provider_swaps.d.ts +4 -0
- package/dist/src/store/migrations/7_multi_provider_swaps.js +27 -0
- package/dist/src/store/migrations/7_multi_provider_swaps.js.map +1 -0
- package/dist/src/store/migrations/8_remove_use_ledger_live.d.ts +4 -0
- package/dist/src/store/migrations/8_remove_use_ledger_live.js +12 -0
- package/dist/src/store/migrations/8_remove_use_ledger_live.js.map +1 -0
- package/dist/src/store/migrations/9_inject_ethereum_asset_chain.d.ts +4 -0
- package/dist/src/store/migrations/9_inject_ethereum_asset_chain.js +14 -0
- package/dist/src/store/migrations/9_inject_ethereum_asset_chain.js.map +1 -0
- package/dist/src/store/migrations/before_after_migration_script.test.d.ts +1 -0
- package/dist/src/store/migrations/before_after_migration_script.test.js +92 -0
- package/dist/src/store/migrations/before_after_migration_script.test.js.map +1 -0
- package/dist/src/store/migrations/enable_chain.d.ts +3 -0
- package/dist/src/store/migrations/enable_chain.js +71 -0
- package/dist/src/store/migrations/enable_chain.js.map +1 -0
- package/dist/src/store/migrations/index.d.ts +5 -0
- package/dist/src/store/migrations/index.js +78 -0
- package/dist/src/store/migrations/index.js.map +1 -0
- package/dist/src/store/migrations/migration_script.test.d.ts +1 -0
- package/dist/src/store/migrations/migration_script.test.js +59 -0
- package/dist/src/store/migrations/migration_script.test.js.map +1 -0
- package/dist/src/store/mutations.d.ts +209 -0
- package/dist/src/store/mutations.js +348 -0
- package/dist/src/store/mutations.js.map +1 -0
- package/dist/src/store/state.d.ts +3 -0
- package/dist/src/store/state.js +46 -0
- package/dist/src/store/state.js.map +1 -0
- package/dist/src/store/types.d.ts +249 -0
- package/dist/src/store/types.js +64 -0
- package/dist/src/store/types.js.map +1 -0
- package/dist/src/store/utils.d.ts +38 -0
- package/dist/src/store/utils.js +194 -0
- package/dist/src/store/utils.js.map +1 -0
- package/dist/src/swaps/EvmSwapProvider.d.ts +32 -0
- package/dist/src/swaps/EvmSwapProvider.js +118 -0
- package/dist/src/swaps/EvmSwapProvider.js.map +1 -0
- package/dist/src/swaps/SwapProvider.d.ts +35 -0
- package/dist/src/swaps/SwapProvider.js +89 -0
- package/dist/src/swaps/SwapProvider.js.map +1 -0
- package/dist/src/swaps/astroport/AstroportSwapProvider.d.ts +67 -0
- package/dist/src/swaps/astroport/AstroportSwapProvider.js +251 -0
- package/dist/src/swaps/astroport/AstroportSwapProvider.js.map +1 -0
- package/dist/src/swaps/astroport/info.json +7 -0
- package/dist/src/swaps/astroport/queries.d.ts +108 -0
- package/dist/src/swaps/astroport/queries.js +227 -0
- package/dist/src/swaps/astroport/queries.js.map +1 -0
- package/dist/src/swaps/debridge/DeBridgeSwapProvider.d.ts +98 -0
- package/dist/src/swaps/debridge/DeBridgeSwapProvider.js +553 -0
- package/dist/src/swaps/debridge/DeBridgeSwapProvider.js.map +1 -0
- package/dist/src/swaps/debridge/abi/DeBridgeGate.json +1958 -0
- package/dist/src/swaps/debridge/abi/SignatureVerifier.json +925 -0
- package/dist/src/swaps/debridge/info.json +13 -0
- package/dist/src/swaps/fastbtc/FastBTCDepositSwapProvider.d.ts +103 -0
- package/dist/src/swaps/fastbtc/FastBTCDepositSwapProvider.js +292 -0
- package/dist/src/swaps/fastbtc/FastBTCDepositSwapProvider.js.map +1 -0
- package/dist/src/swaps/fastbtc/FastBTCWithdrawSwapProvider.d.ts +108 -0
- package/dist/src/swaps/fastbtc/FastBTCWithdrawSwapProvider.js +306 -0
- package/dist/src/swaps/fastbtc/FastBTCWithdrawSwapProvider.js.map +1 -0
- package/dist/src/swaps/fastbtc/fastBtcBridgeContract.d.ts +19 -0
- package/dist/src/swaps/fastbtc/fastBtcBridgeContract.js +24 -0
- package/dist/src/swaps/fastbtc/fastBtcBridgeContract.js.map +1 -0
- package/dist/src/swaps/fastbtc/info.json +7 -0
- package/dist/src/swaps/hop/HopSwapProvider.d.ts +124 -0
- package/dist/src/swaps/hop/HopSwapProvider.js +479 -0
- package/dist/src/swaps/hop/HopSwapProvider.js.map +1 -0
- package/dist/src/swaps/hop/info.json +12 -0
- package/dist/src/swaps/hop/queries.d.ts +2 -0
- package/dist/src/swaps/hop/queries.js +61 -0
- package/dist/src/swaps/hop/queries.js.map +1 -0
- package/dist/src/swaps/jupiter/JupiterSwapProvider.d.ts +46 -0
- package/dist/src/swaps/jupiter/JupiterSwapProvider.js +189 -0
- package/dist/src/swaps/jupiter/JupiterSwapProvider.js.map +1 -0
- package/dist/src/swaps/jupiter/info.json +7 -0
- package/dist/src/swaps/lifi/LifiSwapProvider.d.ts +76 -0
- package/dist/src/swaps/lifi/LifiSwapProvider.js +313 -0
- package/dist/src/swaps/lifi/LifiSwapProvider.js.map +1 -0
- package/dist/src/swaps/lifi/info.json +7 -0
- package/dist/src/swaps/liquality/LiqualitySwapProvider.d.ts +104 -0
- package/dist/src/swaps/liquality/LiqualitySwapProvider.js +704 -0
- package/dist/src/swaps/liquality/LiqualitySwapProvider.js.map +1 -0
- package/dist/src/swaps/liquality/info.json +7 -0
- package/dist/src/swaps/liqualityboost/liqualityBoostERC20toNative/LiqualityBoostERC20toNative.d.ts +124 -0
- package/dist/src/swaps/liqualityboost/liqualityBoostERC20toNative/LiqualityBoostERC20toNative.js +239 -0
- package/dist/src/swaps/liqualityboost/liqualityBoostERC20toNative/LiqualityBoostERC20toNative.js.map +1 -0
- package/dist/src/swaps/liqualityboost/liqualityBoostERC20toNative/info.json +7 -0
- package/dist/src/swaps/liqualityboost/liqualityBoostNativeToERC20/LiqualityBoostNativeToERC20.d.ts +52 -0
- package/dist/src/swaps/liqualityboost/liqualityBoostNativeToERC20/LiqualityBoostNativeToERC20.js +213 -0
- package/dist/src/swaps/liqualityboost/liqualityBoostNativeToERC20/LiqualityBoostNativeToERC20.js.map +1 -0
- package/dist/src/swaps/liqualityboost/liqualityBoostNativeToERC20/info.json +7 -0
- package/dist/src/swaps/liqualityboost/types.d.ts +17 -0
- package/dist/src/swaps/liqualityboost/types.js +3 -0
- package/dist/src/swaps/liqualityboost/types.js.map +1 -0
- package/dist/src/swaps/oneinch/OneinchSwapProvider.d.ts +86 -0
- package/dist/src/swaps/oneinch/OneinchSwapProvider.js +369 -0
- package/dist/src/swaps/oneinch/OneinchSwapProvider.js.map +1 -0
- package/dist/src/swaps/oneinch/info.json +13 -0
- package/dist/src/swaps/sovryn/SovrynSwapProvider.d.ts +110 -0
- package/dist/src/swaps/sovryn/SovrynSwapProvider.js +369 -0
- package/dist/src/swaps/sovryn/SovrynSwapProvider.js.map +1 -0
- package/dist/src/swaps/sovryn/info.json +7 -0
- package/dist/src/swaps/teleswap/TeleSwapSwapProvider.d.ts +167 -0
- package/dist/src/swaps/teleswap/TeleSwapSwapProvider.js +874 -0
- package/dist/src/swaps/teleswap/TeleSwapSwapProvider.js.map +1 -0
- package/dist/src/swaps/teleswap/info.json +7 -0
- package/dist/src/swaps/thorchain/ThorchainSwapProvider.d.ts +194 -0
- package/dist/src/swaps/thorchain/ThorchainSwapProvider.js +534 -0
- package/dist/src/swaps/thorchain/ThorchainSwapProvider.js.map +1 -0
- package/dist/src/swaps/thorchain/info.json +7 -0
- package/dist/src/swaps/types.d.ts +87 -0
- package/dist/src/swaps/types.js +9 -0
- package/dist/src/swaps/types.js.map +1 -0
- package/dist/src/swaps/uniswap/UniswapSwapProvider.d.ts +117 -0
- package/dist/src/swaps/uniswap/UniswapSwapProvider.js +438 -0
- package/dist/src/swaps/uniswap/UniswapSwapProvider.js.map +1 -0
- package/dist/src/swaps/uniswap/info.json +7 -0
- package/dist/src/swaps/utils.d.ts +92 -0
- package/dist/src/swaps/utils.js +57 -0
- package/dist/src/swaps/utils.js.map +1 -0
- package/dist/src/tsconfig.json +30 -0
- package/dist/src/types.d.ts +29 -0
- package/dist/src/types.js +3 -0
- package/dist/src/types.js.map +1 -0
- package/dist/src/utils/accounts.d.ts +16 -0
- package/dist/src/utils/accounts.js +89 -0
- package/dist/src/utils/accounts.js.map +1 -0
- package/dist/src/utils/address.d.ts +8 -0
- package/dist/src/utils/address.js +17 -0
- package/dist/src/utils/address.js.map +1 -0
- package/dist/src/utils/address.test.d.ts +1 -0
- package/dist/src/utils/address.test.js +12 -0
- package/dist/src/utils/address.test.js.map +1 -0
- package/dist/src/utils/asset.d.ts +22 -0
- package/dist/src/utils/asset.js +198 -0
- package/dist/src/utils/asset.js.map +1 -0
- package/dist/src/utils/asset.test.d.ts +1 -0
- package/dist/src/utils/asset.test.js +42 -0
- package/dist/src/utils/asset.test.js.map +1 -0
- package/dist/src/utils/chainify.d.ts +3 -0
- package/dist/src/utils/chainify.js +41 -0
- package/dist/src/utils/chainify.js.map +1 -0
- package/dist/src/utils/coinFormatter.d.ts +13 -0
- package/dist/src/utils/coinFormatter.js +58 -0
- package/dist/src/utils/coinFormatter.js.map +1 -0
- package/dist/src/utils/crypto.d.ts +6 -0
- package/dist/src/utils/crypto.js +70 -0
- package/dist/src/utils/crypto.js.map +1 -0
- package/dist/src/utils/cryptoassets.d.ts +5 -0
- package/dist/src/utils/cryptoassets.js +26 -0
- package/dist/src/utils/cryptoassets.js.map +1 -0
- package/dist/src/utils/derivationPath.d.ts +6 -0
- package/dist/src/utils/derivationPath.js +75 -0
- package/dist/src/utils/derivationPath.js.map +1 -0
- package/dist/src/utils/derivationPath.spec.d.ts +1 -0
- package/dist/src/utils/derivationPath.spec.js +37 -0
- package/dist/src/utils/derivationPath.spec.js.map +1 -0
- package/dist/src/utils/export.d.ts +5 -0
- package/dist/src/utils/export.js +24 -0
- package/dist/src/utils/export.js.map +1 -0
- package/dist/src/utils/fees.d.ts +43 -0
- package/dist/src/utils/fees.js +222 -0
- package/dist/src/utils/fees.js.map +1 -0
- package/dist/src/utils/fees.test.d.ts +1 -0
- package/dist/src/utils/fees.test.js +40 -0
- package/dist/src/utils/fees.test.js.map +1 -0
- package/dist/src/utils/fetchTokenDetails.d.ts +1 -0
- package/dist/src/utils/fetchTokenDetails.js +19 -0
- package/dist/src/utils/fetchTokenDetails.js.map +1 -0
- package/dist/src/utils/history.d.ts +66 -0
- package/dist/src/utils/history.js +135 -0
- package/dist/src/utils/history.js.map +1 -0
- package/dist/src/utils/isTransactionNotFoundError.d.ts +1 -0
- package/dist/src/utils/isTransactionNotFoundError.js +16 -0
- package/dist/src/utils/isTransactionNotFoundError.js.map +1 -0
- package/dist/src/utils/ledger.d.ts +12 -0
- package/dist/src/utils/ledger.js +38 -0
- package/dist/src/utils/ledger.js.map +1 -0
- package/dist/src/utils/moment.d.ts +2 -0
- package/dist/src/utils/moment.js +8 -0
- package/dist/src/utils/moment.js.map +1 -0
- package/dist/src/utils/networks.d.ts +10 -0
- package/dist/src/utils/networks.js +43 -0
- package/dist/src/utils/networks.js.map +1 -0
- package/dist/src/utils/parseTokenTx.d.ts +2 -0
- package/dist/src/utils/parseTokenTx.js +10 -0
- package/dist/src/utils/parseTokenTx.js.map +1 -0
- package/dist/src/utils/quotes.d.ts +5 -0
- package/dist/src/utils/quotes.js +20 -0
- package/dist/src/utils/quotes.js.map +1 -0
- package/dist/src/utils/quotes.test.d.ts +1 -0
- package/dist/src/utils/quotes.test.js +85 -0
- package/dist/src/utils/quotes.test.js.map +1 -0
- package/dist/src/utils/timeline.d.ts +71 -0
- package/dist/src/utils/timeline.js +176 -0
- package/dist/src/utils/timeline.js.map +1 -0
- package/dist/src/walletOptions/defaultOptions.d.ts +3 -0
- package/dist/src/walletOptions/defaultOptions.js +36 -0
- package/dist/src/walletOptions/defaultOptions.js.map +1 -0
- package/dist/src/walletOptions/index.d.ts +7 -0
- package/dist/src/walletOptions/index.js +11 -0
- package/dist/src/walletOptions/index.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +76 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.changeActiveNetwork = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const __1 = require("..");
|
|
6
|
+
const changeActiveNetwork = (context, { network }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
7
|
+
const { commit } = (0, __1.rootActionContext)(context);
|
|
8
|
+
commit.CHANGE_ACTIVE_NETWORK({
|
|
9
|
+
network,
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
exports.changeActiveNetwork = changeActiveNetwork;
|
|
13
|
+
//# sourceMappingURL=changeActiveNetwork.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changeActiveNetwork.js","sourceRoot":"","sources":["../../../../src/store/actions/changeActiveNetwork.ts"],"names":[],"mappings":";;;;AAAA,0BAAsD;AAG/C,MAAM,mBAAmB,GAAG,CAAO,OAAsB,EAAE,EAAE,OAAO,EAAwB,EAAE,EAAE;IACrG,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,qBAAiB,EAAC,OAAO,CAAC,CAAC;IAC9C,MAAM,CAAC,qBAAqB,CAAC;QAC3B,OAAO;KACR,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AALW,QAAA,mBAAmB,uBAK9B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.changeActiveWalletId = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const __1 = require("..");
|
|
6
|
+
const changeActiveWalletId = (context, { walletId }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
7
|
+
const { commit } = (0, __1.rootActionContext)(context);
|
|
8
|
+
commit.CHANGE_ACTIVE_WALLETID({ walletId });
|
|
9
|
+
});
|
|
10
|
+
exports.changeActiveWalletId = changeActiveWalletId;
|
|
11
|
+
//# sourceMappingURL=changeActiveWalletId.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changeActiveWalletId.js","sourceRoot":"","sources":["../../../../src/store/actions/changeActiveWalletId.ts"],"names":[],"mappings":";;;;AAAA,0BAAsD;AAG/C,MAAM,oBAAoB,GAAG,CAAO,OAAsB,EAAE,EAAE,QAAQ,EAA0B,EAAE,EAAE;IACzG,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,qBAAiB,EAAC,OAAO,CAAC,CAAC;IAC9C,MAAM,CAAC,sBAAsB,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC;AAC9C,CAAC,CAAA,CAAC;AAHW,QAAA,oBAAoB,wBAG/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const uuid_1 = require("uuid");
|
|
5
|
+
const index_1 = require("../../index");
|
|
6
|
+
const defaultOptions_1 = tslib_1.__importDefault(require("../../walletOptions/defaultOptions"));
|
|
7
|
+
describe('change active wallet id', () => {
|
|
8
|
+
it('should be able to change the active wallet id', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
9
|
+
var _a, _b, _c;
|
|
10
|
+
const wallet = yield (0, index_1.setupWallet)(defaultOptions_1.default);
|
|
11
|
+
yield wallet.dispatch.createWallet({
|
|
12
|
+
key: '0x1234567890123456789012345678901234567890',
|
|
13
|
+
mnemonic: 'test',
|
|
14
|
+
imported: true,
|
|
15
|
+
});
|
|
16
|
+
yield wallet.dispatch.unlockWallet({
|
|
17
|
+
key: '0x1234567890123456789012345678901234567890',
|
|
18
|
+
});
|
|
19
|
+
expect(wallet.state.wallets.length).toBe(1);
|
|
20
|
+
expect(wallet.state.wallets[0].imported).toBe(true);
|
|
21
|
+
expect(wallet.state.unlockedAt).not.toBe(0);
|
|
22
|
+
yield wallet.dispatch.initializeAnalyticsPreferences({
|
|
23
|
+
accepted: true,
|
|
24
|
+
});
|
|
25
|
+
expect(wallet.state.analytics.userId).not.toBe(null);
|
|
26
|
+
expect(wallet.state.analytics.acceptedDate).not.toBe(0);
|
|
27
|
+
expect(wallet.state.analytics.askedDate).not.toBe(0);
|
|
28
|
+
expect(wallet.state.analytics.askedTimes).toBe(0);
|
|
29
|
+
expect(wallet.state.analytics.notAskAgain).toBe(false);
|
|
30
|
+
const walletIdBefore = wallet.state.activeWalletId;
|
|
31
|
+
const mainnetAccounts = (_c = (_b = (_a = wallet === null || wallet === void 0 ? void 0 : wallet.state) === null || _a === void 0 ? void 0 : _a.enabledAssets) === null || _b === void 0 ? void 0 : _b.mainnet) === null || _c === void 0 ? void 0 : _c[walletIdBefore];
|
|
32
|
+
expect(mainnetAccounts).not.toBeNull();
|
|
33
|
+
yield wallet.dispatch.changeActiveWalletId({
|
|
34
|
+
walletId: (0, uuid_1.v4)(),
|
|
35
|
+
});
|
|
36
|
+
const walletIdAfterChange = wallet.state.activeWalletId;
|
|
37
|
+
expect(walletIdAfterChange).not.toEqual(walletIdBefore);
|
|
38
|
+
}));
|
|
39
|
+
});
|
|
40
|
+
//# sourceMappingURL=changeActiveWalletId.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changeActiveWalletId.test.js","sourceRoot":"","sources":["../../../../src/store/actions/changeActiveWalletId.test.ts"],"names":[],"mappings":";;;AAAA,+BAAoC;AACpC,uCAA0C;AAC1C,gGAAsE;AAEtE,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACvC,EAAE,CAAC,+CAA+C,EAAE,GAAS,EAAE;;QAC7D,MAAM,MAAM,GAAG,MAAM,IAAA,mBAAW,EAAC,wBAAoB,CAAC,CAAC;QACvD,MAAM,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC;YACjC,GAAG,EAAE,4CAA4C;YACjD,QAAQ,EAAE,MAAM;YAChB,QAAQ,EAAE,IAAI;SACf,CAAC,CAAC;QACH,MAAM,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC;YACjC,GAAG,EAAE,4CAA4C;SAClD,CAAC,CAAC;QACH,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC5C,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACpD,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAE5C,MAAM,MAAM,CAAC,QAAQ,CAAC,8BAA8B,CAAC;YACnD,QAAQ,EAAE,IAAI;SACf,CAAC,CAAC;QA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|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const __1 = require("..");
|
|
6
|
+
const crypto_1 = require("../../utils/crypto");
|
|
7
|
+
const changePassword = (context, { key }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
8
|
+
const { commit, state } = (0, __1.rootActionContext)(context);
|
|
9
|
+
const { encrypted: encryptedWallets, keySalt } = yield (0, crypto_1.encrypt)(JSON.stringify(state.wallets), key);
|
|
10
|
+
commit.CHANGE_PASSWORD({ key, keySalt, encryptedWallets });
|
|
11
|
+
});
|
|
12
|
+
exports.changePassword = changePassword;
|
|
13
|
+
//# sourceMappingURL=changePassword.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changePassword.js","sourceRoot":"","sources":["../../../../src/store/actions/changePassword.ts"],"names":[],"mappings":";;;;AAAA,0BAAsD;AACtD,+CAA6C;AAEtC,MAAM,cAAc,GAAG,CAAO,OAAsB,EAAE,EAAE,GAAG,EAAmB,EAAE,EAAE;IACvF,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,IAAA,qBAAiB,EAAC,OAAO,CAAC,CAAC;IACrD,MAAM,EAAE,SAAS,EAAE,gBAAgB,EAAE,OAAO,EAAE,GAAG,MAAM,IAAA,gBAAO,EAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,GAAG,CAAC,CAAC;IAEnG,MAAM,CAAC,eAAe,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,gBAAgB,EAAE,CAAC,CAAC;AAC7D,CAAC,CAAA,CAAC;AALW,QAAA,cAAc,kBAKzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const index_1 = require("../../index");
|
|
5
|
+
const defaultOptions_1 = tslib_1.__importDefault(require("../../walletOptions/defaultOptions"));
|
|
6
|
+
test('change password test', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
7
|
+
const wallet = yield (0, index_1.setupWallet)(defaultOptions_1.default);
|
|
8
|
+
yield wallet.dispatch.createWallet({
|
|
9
|
+
key: '0x1234567890123456789012345678901234567890',
|
|
10
|
+
mnemonic: 'test',
|
|
11
|
+
imported: true,
|
|
12
|
+
});
|
|
13
|
+
yield wallet.dispatch.unlockWallet({
|
|
14
|
+
key: '0x1234567890123456789012345678901234567890',
|
|
15
|
+
});
|
|
16
|
+
expect(wallet.state.key).toBe('0x1234567890123456789012345678901234567890');
|
|
17
|
+
yield wallet.dispatch.changePassword({
|
|
18
|
+
key: '0x3334567890123456789012345678901234567890',
|
|
19
|
+
});
|
|
20
|
+
expect(wallet.state.key).toBe('0x3334567890123456789012345678901234567890');
|
|
21
|
+
}));
|
|
22
|
+
//# sourceMappingURL=changePassword.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changePassword.test.js","sourceRoot":"","sources":["../../../../src/store/actions/changePassword.test.ts"],"names":[],"mappings":";;;AAAA,uCAA0C;AAC1C,gGAAsE;AAEtE,IAAI,CAAC,sBAAsB,EAAE,GAAS,EAAE;IACtC,MAAM,MAAM,GAAG,MAAM,IAAA,mBAAW,EAAC,wBAAoB,CAAC,CAAC;IACvD,MAAM,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC;QACjC,GAAG,EAAE,4CAA4C;QACjD,QAAQ,EAAE,MAAM;QAChB,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC;IACH,MAAM,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC;QACjC,GAAG,EAAE,4CAA4C;KAClD,CAAC,CAAC;IACH,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,4CAA4C,CAAC,CAAC;IAE5E,MAAM,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC;QACnC,GAAG,EAAE,4CAA4C;KAClD,CAAC,CAAC;IACH,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,4CAA4C,CAAC,CAAC;AAC9E,CAAC,CAAA,CAAC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.checkPendingActions = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const __1 = require("..");
|
|
6
|
+
const networks_1 = require("../../utils/networks");
|
|
7
|
+
const COMPLETED_STATES = ['SUCCESS', 'REFUNDED'];
|
|
8
|
+
const checkPendingActions = (context, { walletId }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
9
|
+
const { state, dispatch } = (0, __1.rootActionContext)(context);
|
|
10
|
+
networks_1.Networks.forEach((network) => {
|
|
11
|
+
var _a;
|
|
12
|
+
const history = (_a = state.history[network]) === null || _a === void 0 ? void 0 : _a[walletId];
|
|
13
|
+
if (!history)
|
|
14
|
+
return;
|
|
15
|
+
history.forEach((item) => {
|
|
16
|
+
if (item.error)
|
|
17
|
+
return;
|
|
18
|
+
if (!COMPLETED_STATES.includes(item.status)) {
|
|
19
|
+
dispatch.performNextAction({ network, walletId, id: item.id });
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
exports.checkPendingActions = checkPendingActions;
|
|
25
|
+
//# sourceMappingURL=checkPendingActions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkPendingActions.js","sourceRoot":"","sources":["../../../../src/store/actions/checkPendingActions.ts"],"names":[],"mappings":";;;;AAAA,0BAAsD;AACtD,mDAAgD;AAGhD,MAAM,gBAAgB,GAAG,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;AAE1C,MAAM,mBAAmB,GAAG,CACjC,OAAsB,EACtB,EAAE,QAAQ,EAA0B,EACrB,EAAE;IACjB,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,IAAA,qBAAiB,EAAC,OAAO,CAAC,CAAC;IACvD,mBAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;;QAC3B,MAAM,OAAO,GAAG,MAAA,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,0CAAG,QAAQ,CAAC,CAAC;QACnD,IAAI,CAAC,OAAO;YAAE,OAAO;QACrB,OAAO,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YACvB,IAAI,IAAI,CAAC,KAAK;gBAAE,OAAO;YAEvB,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;gBAC3C,QAAQ,CAAC,iBAAiB,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;aAChE;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AAhBW,QAAA,mBAAmB,uBAgB9B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.clearErrorLog = void 0;
|
|
4
|
+
const __1 = require("..");
|
|
5
|
+
const clearErrorLog = (context) => {
|
|
6
|
+
const { commit } = (0, __1.rootActionContext)(context);
|
|
7
|
+
commit.CLEAR_ERROR_LOG();
|
|
8
|
+
};
|
|
9
|
+
exports.clearErrorLog = clearErrorLog;
|
|
10
|
+
//# sourceMappingURL=clearErrorLog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clearErrorLog.js","sourceRoot":"","sources":["../../../../src/store/actions/clearErrorLog.ts"],"names":[],"mappings":";;;AAAA,0BAAsD;AAE/C,MAAM,aAAa,GAAG,CAAC,OAAsB,EAAE,EAAE;IACtD,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,qBAAiB,EAAC,OAAO,CAAC,CAAC;IAC9C,MAAM,CAAC,eAAe,EAAE,CAAC;AAC3B,CAAC,CAAC;AAHW,QAAA,aAAa,iBAGxB"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createWallet = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const cryptoassets_1 = require("@yaswap/cryptoassets");
|
|
6
|
+
const uuid_1 = require("uuid");
|
|
7
|
+
const __1 = require("..");
|
|
8
|
+
const build_config_1 = tslib_1.__importDefault(require("../../build.config"));
|
|
9
|
+
const accounts_1 = require("../../utils/accounts");
|
|
10
|
+
const crypto_1 = require("../../utils/crypto");
|
|
11
|
+
const types_1 = require("../types");
|
|
12
|
+
const createWallet = (context, { key, mnemonic, imported = false }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
13
|
+
const { commit } = (0, __1.rootActionContext)(context);
|
|
14
|
+
const id = (0, uuid_1.v4)();
|
|
15
|
+
const at = Date.now();
|
|
16
|
+
const name = 'Account 1';
|
|
17
|
+
const wallet = { id, name, mnemonic, at, imported };
|
|
18
|
+
const { networks, defaultAssets } = build_config_1.default;
|
|
19
|
+
const { encrypted: encryptedWallets, keySalt } = yield (0, crypto_1.encrypt)(JSON.stringify([wallet]), key);
|
|
20
|
+
commit.CREATE_WALLET({ key, keySalt, encryptedWallets, wallet });
|
|
21
|
+
commit.CHANGE_ACTIVE_WALLETID({ walletId: id });
|
|
22
|
+
commit.ENABLE_ASSETS({
|
|
23
|
+
network: types_1.Network.Mainnet,
|
|
24
|
+
walletId: id,
|
|
25
|
+
assets: defaultAssets.mainnet,
|
|
26
|
+
});
|
|
27
|
+
commit.ENABLE_ASSETS({
|
|
28
|
+
network: types_1.Network.Testnet,
|
|
29
|
+
walletId: id,
|
|
30
|
+
assets: defaultAssets.testnet,
|
|
31
|
+
});
|
|
32
|
+
networks.forEach((network) => {
|
|
33
|
+
const assetKeys = defaultAssets[network];
|
|
34
|
+
build_config_1.default.chains.forEach((chainId) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
35
|
+
commit.TOGGLE_BLOCKCHAIN({
|
|
36
|
+
network,
|
|
37
|
+
walletId: id,
|
|
38
|
+
chainId,
|
|
39
|
+
enable: true,
|
|
40
|
+
});
|
|
41
|
+
const assets = assetKeys.filter((asset) => {
|
|
42
|
+
var _a;
|
|
43
|
+
return ((_a = (0, cryptoassets_1.getAsset)(network, asset)) === null || _a === void 0 ? void 0 : _a.chain) === chainId;
|
|
44
|
+
});
|
|
45
|
+
const chain = (0, cryptoassets_1.getChain)(network, chainId);
|
|
46
|
+
const _account = (0, accounts_1.accountCreator)({
|
|
47
|
+
walletId: id,
|
|
48
|
+
network,
|
|
49
|
+
account: {
|
|
50
|
+
name: `${chain.name} 1`,
|
|
51
|
+
alias: '',
|
|
52
|
+
chain: chainId,
|
|
53
|
+
addresses: [],
|
|
54
|
+
assets,
|
|
55
|
+
balances: {},
|
|
56
|
+
type: types_1.AccountType.Default,
|
|
57
|
+
index: 0,
|
|
58
|
+
color: (0, accounts_1.getNextAccountColor)(chainId, 0),
|
|
59
|
+
enabled: true,
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
commit.CREATE_ACCOUNT({ network, walletId: id, account: _account });
|
|
63
|
+
if (imported && chainId === cryptoassets_1.ChainId.Rootstock) {
|
|
64
|
+
const coinType = network === 'mainnet' ? '137' : '37310';
|
|
65
|
+
const chain = (0, cryptoassets_1.getChain)(network, cryptoassets_1.ChainId.Rootstock);
|
|
66
|
+
const _account = (0, accounts_1.accountCreator)({
|
|
67
|
+
walletId: id,
|
|
68
|
+
network,
|
|
69
|
+
account: {
|
|
70
|
+
name: `Legacy ${chain.name} 1`,
|
|
71
|
+
alias: '',
|
|
72
|
+
chain: cryptoassets_1.ChainId.Rootstock,
|
|
73
|
+
addresses: [],
|
|
74
|
+
assets,
|
|
75
|
+
balances: {},
|
|
76
|
+
type: types_1.AccountType.Default,
|
|
77
|
+
index: 0,
|
|
78
|
+
derivationPath: `m/44'/${coinType}'/0'/0/0`,
|
|
79
|
+
color: (0, accounts_1.getNextAccountColor)(cryptoassets_1.ChainId.Rootstock, 1),
|
|
80
|
+
enabled: true,
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
commit.CREATE_ACCOUNT({ network, walletId: id, account: _account });
|
|
84
|
+
}
|
|
85
|
+
}));
|
|
86
|
+
});
|
|
87
|
+
return wallet;
|
|
88
|
+
});
|
|
89
|
+
exports.createWallet = createWallet;
|
|
90
|
+
//# sourceMappingURL=createWallet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createWallet.js","sourceRoot":"","sources":["../../../../src/store/actions/createWallet.ts"],"names":[],"mappings":";;;;AAAA,uDAAmE;AACnE,+BAAoC;AACpC,0BAAsD;AACtD,8EAA6C;AAC7C,mDAA2E;AAC3E,+CAA6C;AAC7C,oCAAwD;AAEjD,MAAM,YAAY,GAAG,CAC1B,OAAsB,EACtB,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,GAAG,KAAK,EAAyD,EACzE,EAAE;IACnB,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,qBAAiB,EAAC,OAAO,CAAC,CAAC;IAC9C,MAAM,EAAE,GAAG,IAAA,SAAM,GAAE,CAAC;IACpB,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACtB,MAAM,IAAI,GAAG,WAAW,CAAC;IACzB,MAAM,MAAM,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC;IACpD,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,GAAG,sBAAW,CAAC;IAChD,MAAM,EAAE,SAAS,EAAE,gBAAgB,EAAE,OAAO,EAAE,GAAG,MAAM,IAAA,gBA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EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC;aACrE;QACH,CAAC,CAAA,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC,CAAA,CAAC;AAtFW,QAAA,YAAY,gBAsFvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const index_1 = require("../../index");
|
|
5
|
+
const defaultOptions_1 = tslib_1.__importDefault(require("../../walletOptions/defaultOptions"));
|
|
6
|
+
test('should be able to create wallet with imported false', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
7
|
+
const wallet = yield (0, index_1.setupWallet)(defaultOptions_1.default);
|
|
8
|
+
yield wallet.dispatch.createWallet({
|
|
9
|
+
key: '0x1234567890123456789012345678901234567890',
|
|
10
|
+
mnemonic: 'test',
|
|
11
|
+
imported: false,
|
|
12
|
+
});
|
|
13
|
+
expect(wallet.state.wallets.length).toBe(1);
|
|
14
|
+
expect(wallet.state.wallets[0].id).not.toBe(undefined);
|
|
15
|
+
expect(wallet.state.wallets[0].name).toEqual('Account 1');
|
|
16
|
+
expect(wallet.state.wallets[0].mnemonic).toBe('test');
|
|
17
|
+
expect(wallet.state.wallets[0].at).not.toBe(0);
|
|
18
|
+
expect(wallet.state.unlockedAt).toBe(0);
|
|
19
|
+
expect(wallet.state.activeNetwork).toBe('mainnet');
|
|
20
|
+
expect(wallet.state.wallets[0].imported).toBe(false);
|
|
21
|
+
expect(wallet.state.activeWalletId).not.toBe(null);
|
|
22
|
+
const numberOfAccounts = wallet.state.accounts;
|
|
23
|
+
const walletId = wallet.state.activeWalletId;
|
|
24
|
+
expect(numberOfAccounts[walletId]).not.toBe(undefined);
|
|
25
|
+
expect(numberOfAccounts[walletId]).toHaveProperty('mainnet');
|
|
26
|
+
expect(numberOfAccounts[walletId]).toHaveProperty('testnet');
|
|
27
|
+
expect(wallet.state.enabledChains[walletId]).toHaveProperty('mainnet');
|
|
28
|
+
expect(wallet.state.enabledChains[walletId]).toHaveProperty('testnet');
|
|
29
|
+
expect(wallet.state.enabledChains[walletId]).toHaveProperty('testnet');
|
|
30
|
+
expect(wallet.state.enabledChains[walletId]).toHaveProperty('mainnet');
|
|
31
|
+
}));
|
|
32
|
+
test('should be able to create wallet with imported true', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
33
|
+
const wallet = yield (0, index_1.setupWallet)(defaultOptions_1.default);
|
|
34
|
+
yield wallet.dispatch.createWallet({
|
|
35
|
+
key: '0x1234567890123456789012345678901234567890',
|
|
36
|
+
mnemonic: 'test',
|
|
37
|
+
imported: true,
|
|
38
|
+
});
|
|
39
|
+
expect(wallet.state.wallets[0].imported).toBe(true);
|
|
40
|
+
}));
|
|
41
|
+
//# sourceMappingURL=createWallet.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createWallet.test.js","sourceRoot":"","sources":["../../../../src/store/actions/createWallet.test.ts"],"names":[],"mappings":";;;AAAA,uCAA0C;AAC1C,gGAAsE;AAEtE,IAAI,CAAC,qDAAqD,EAAE,GAAS,EAAE;IACrE,MAAM,MAAM,GAAG,MAAM,IAAA,mBAAW,EAAC,wBAAoB,CAAC,CAAC;IACvD,MAAM,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC;QACjC,GAAG,EAAE,4CAA4C;QACjD,QAAQ,EAAE,MAAM;QAChB,QAAQ,EAAE,KAAK;KAChB,CAAC,CAAC;IACH,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC5C,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC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S,CAAC,CAAC;IAC7D,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;IACvE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;IACvE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;IACvE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;AACzE,CAAC,CAAA,CAAC,CAAC;AACH,IAAI,CAAC,oDAAoD,EAAE,GAAS,EAAE;IACpE,MAAM,MAAM,GAAG,MAAM,IAAA,mBAAW,EAAC,wBAAoB,CAAC,CAAC;IACvD,MAAM,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC;QACjC,GAAG,EAAE,4CAA4C;QACjD,QAAQ,EAAE,MAAM;QAChB,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC;IACH,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACtD,CAAC,CAAA,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ActionContext } from '..';
|
|
2
|
+
import { ChainId } from '@yaswap/cryptoassets';
|
|
3
|
+
import { Network as ChainifyNetwork } from '@yaswap/types';
|
|
4
|
+
import { WalletId, Network } from '../types';
|
|
5
|
+
export declare const saveCustomChainSettings: (context: ActionContext, { network, walletId, chainId, chanifyNetwork, }: {
|
|
6
|
+
network: Network;
|
|
7
|
+
walletId: WalletId;
|
|
8
|
+
chainId: ChainId;
|
|
9
|
+
chanifyNetwork: ChainifyNetwork;
|
|
10
|
+
}) => void;
|
|
11
|
+
export declare const removeCustomChainSettings: (context: ActionContext, { network, walletId, chainId }: {
|
|
12
|
+
network: Network;
|
|
13
|
+
walletId: WalletId;
|
|
14
|
+
chainId: ChainId;
|
|
15
|
+
}) => void;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.removeCustomChainSettings = exports.saveCustomChainSettings = void 0;
|
|
4
|
+
const __1 = require("..");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
|
+
const saveCustomChainSettings = (context, { network, walletId, chainId, chanifyNetwork, }) => {
|
|
7
|
+
const { commit } = (0, __1.rootActionContext)(context);
|
|
8
|
+
commit.SET_CUSTOM_CHAIN_SETTINGS({
|
|
9
|
+
network,
|
|
10
|
+
walletId,
|
|
11
|
+
chainId,
|
|
12
|
+
chanifyNetwork,
|
|
13
|
+
});
|
|
14
|
+
clearClientCache({ network, walletId, chainId });
|
|
15
|
+
};
|
|
16
|
+
exports.saveCustomChainSettings = saveCustomChainSettings;
|
|
17
|
+
const removeCustomChainSettings = (context, { network, walletId, chainId }) => {
|
|
18
|
+
const { commit } = (0, __1.rootActionContext)(context);
|
|
19
|
+
commit.REMOVE_CUSTOM_CHAIN_SETTINGS({
|
|
20
|
+
network,
|
|
21
|
+
walletId,
|
|
22
|
+
chainId,
|
|
23
|
+
});
|
|
24
|
+
clearClientCache({ network, walletId, chainId });
|
|
25
|
+
};
|
|
26
|
+
exports.removeCustomChainSettings = removeCustomChainSettings;
|
|
27
|
+
const clearClientCache = ({ network, walletId, chainId, }) => {
|
|
28
|
+
const cacheKey = [chainId, network, walletId].join('-');
|
|
29
|
+
Object.keys(utils_1.clientCache)
|
|
30
|
+
.filter((k) => k.startsWith(cacheKey))
|
|
31
|
+
.forEach((k) => {
|
|
32
|
+
if (utils_1.clientCache[k]) {
|
|
33
|
+
delete utils_1.clientCache[k];
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=customChainSettings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customChainSettings.js","sourceRoot":"","sources":["../../../../src/store/actions/customChainSettings.ts"],"names":[],"mappings":";;;AAAA,0BAAsD;AAItD,oCAAuC;AAEhC,MAAM,uBAAuB,GAAG,CACrC,OAAsB,EACtB,EACE,OAAO,EACP,QAAQ,EACR,OAAO,EACP,cAAc,GAC8E,EAC9F,EAAE;IACF,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,qBAAiB,EAAC,OAAO,CAAC,CAAC;IAC9C,MAAM,CAAC,yBAAyB,CAAC;QAC/B,OAAO;QACP,QAAQ;QACR,OAAO;QACP,cAAc;KACf,CAAC,CAAC;IACH,gBAAgB,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;AACnD,CAAC,CAAC;AAjBW,QAAA,uBAAuB,2BAiBlC;AAEK,MAAM,yBAAyB,GAAG,CACvC,OAAsB,EACtB,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAA8D,EAC1F,EAAE;IACF,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,qBAAiB,EAAC,OAAO,CAAC,CAAC;IAC9C,MAAM,CAAC,4BAA4B,CAAC;QAClC,OAAO;QACP,QAAQ;QACR,OAAO;KACR,CAAC,CAAC;IACH,gBAAgB,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;AACnD,CAAC,CAAC;AAXW,QAAA,yBAAyB,6BAWpC;AAEF,MAAM,gBAAgB,GAAG,CAAC,EACxB,OAAO,EACP,QAAQ,EACR,OAAO,GAKR,EAAE,EAAE;IACH,MAAM,QAAQ,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAExD,MAAM,CAAC,IAAI,CAAC,mBAAW,CAAC;SACrB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;SACrC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;QACb,IAAI,mBAAW,CAAC,CAAC,CAAC,EAAE;YAClB,OAAO,mBAAW,CAAC,CAAC,CAAC,CAAC;SACvB;IACH,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ActionContext } from '..';
|
|
2
|
+
import { Asset, Network, WalletId } from '../types';
|
|
3
|
+
export declare const disableAssets: (context: ActionContext, { network, walletId, assets }: {
|
|
4
|
+
network: Network;
|
|
5
|
+
walletId: WalletId;
|
|
6
|
+
assets: Asset[];
|
|
7
|
+
}) => Promise<void>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.disableAssets = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const error_parser_1 = require("@yaswap/error-parser");
|
|
6
|
+
const __1 = require("..");
|
|
7
|
+
const disableAssets = (context, { network, walletId, assets }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
8
|
+
var _a;
|
|
9
|
+
const { state, commit, getters } = (0, __1.rootActionContext)(context);
|
|
10
|
+
commit.DISABLE_ASSETS({ network, walletId, assets });
|
|
11
|
+
const accounts = (_a = state.accounts[walletId]) === null || _a === void 0 ? void 0 : _a[network];
|
|
12
|
+
if (!accounts) {
|
|
13
|
+
throw (0, error_parser_1.createInternalError)(error_parser_1.CUSTOM_ERRORS.NotFound.Accounts);
|
|
14
|
+
}
|
|
15
|
+
accounts
|
|
16
|
+
.filter((a) => a.assets.some((s) => assets.includes(s)))
|
|
17
|
+
.forEach((account) => {
|
|
18
|
+
const _assets = assets.filter((asset) => { var _a; return ((_a = getters.cryptoassets[asset]) === null || _a === void 0 ? void 0 : _a.chain) === account.chain; });
|
|
19
|
+
commit.DISABLE_ACCOUNT_ASSETS({
|
|
20
|
+
network,
|
|
21
|
+
walletId,
|
|
22
|
+
assets: _assets,
|
|
23
|
+
accountId: account.id,
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
exports.disableAssets = disableAssets;
|
|
28
|
+
//# sourceMappingURL=disableAssets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disableAssets.js","sourceRoot":"","sources":["../../../../src/store/actions/disableAssets.ts"],"names":[],"mappings":";;;;AAAA,uDAA0E;AAC1E,0BAAsD;AAG/C,MAAM,aAAa,GAAG,CAC3B,OAAsB,EACtB,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAA6D,EACxF,EAAE;;IACF,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,qBAAiB,EAAC,OAAO,CAAC,CAAC;IAC9D,MAAM,CAAC,cAAc,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;IACrD,MAAM,QAAQ,GAAG,MAAA,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,0CAAG,OAAO,CAAC,CAAC;IACrD,IAAI,CAAC,QAAQ,EAAE;QACb,MAAM,IAAA,kCAAmB,EAAC,4BAAa,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;KAC5D;IACD,QAAQ;SACL,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;SACvD,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QACnB,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,WAAC,OAAA,CAAA,MAAA,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,0CAAE,KAAK,MAAK,OAAO,CAAC,KAAK,CAAA,EAAA,CAAC,CAAC;QAC/F,MAAM,CAAC,sBAAsB,CAAC;YAC5B,OAAO;YACP,QAAQ;YACR,MAAM,EAAE,OAAO;YACf,SAAS,EAAE,OAAO,CAAC,EAAE;SACtB,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACP,CAAC,CAAA,CAAC;AArBW,QAAA,aAAa,iBAqBxB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.disableEthereumInjection = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const __1 = require("..");
|
|
6
|
+
const disableEthereumInjection = (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
7
|
+
const { commit } = (0, __1.rootActionContext)(context);
|
|
8
|
+
commit.DISABLE_ETHEREUM_INJECTION();
|
|
9
|
+
});
|
|
10
|
+
exports.disableEthereumInjection = disableEthereumInjection;
|
|
11
|
+
//# sourceMappingURL=disableEthereumInjection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disableEthereumInjection.js","sourceRoot":"","sources":["../../../../src/store/actions/disableEthereumInjection.ts"],"names":[],"mappings":";;;;AAAA,0BAAsD;AAE/C,MAAM,wBAAwB,GAAG,CAAO,OAAsB,EAAE,EAAE;IACvE,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,qBAAiB,EAAC,OAAO,CAAC,CAAC;IAC9C,MAAM,CAAC,0BAA0B,EAAE,CAAC;AACtC,CAAC,CAAA,CAAC;AAHW,QAAA,wBAAwB,4BAGnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const index_1 = require("../../index");
|
|
5
|
+
const defaultOptions_1 = tslib_1.__importDefault(require("../../walletOptions/defaultOptions"));
|
|
6
|
+
describe('disableEthereumInjection & enableEthereumInjection', () => {
|
|
7
|
+
it('should be able to disable injectEthereumChain', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
8
|
+
const wallet = yield (0, index_1.setupWallet)(defaultOptions_1.default);
|
|
9
|
+
yield wallet.dispatch.createWallet({
|
|
10
|
+
key: '0x1234567890123456789012345678901234567890',
|
|
11
|
+
mnemonic: 'test',
|
|
12
|
+
imported: true,
|
|
13
|
+
});
|
|
14
|
+
yield wallet.dispatch.unlockWallet({
|
|
15
|
+
key: '0x1234567890123456789012345678901234567890',
|
|
16
|
+
});
|
|
17
|
+
expect(wallet.state.injectEthereum).toBe(true);
|
|
18
|
+
yield wallet.dispatch.disableEthereumInjection();
|
|
19
|
+
expect(wallet.state.injectEthereum).toBe(false);
|
|
20
|
+
yield wallet.dispatch.enableEthereumInjection();
|
|
21
|
+
expect(wallet.state.injectEthereum).toBe(true);
|
|
22
|
+
}));
|
|
23
|
+
});
|
|
24
|
+
//# sourceMappingURL=disableEthereumInjection.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disableEthereumInjection.test.js","sourceRoot":"","sources":["../../../../src/store/actions/disableEthereumInjection.test.ts"],"names":[],"mappings":";;;AAAA,uCAA0C;AAC1C,gGAAsE;AAEtE,QAAQ,CAAC,oDAAoD,EAAE,GAAG,EAAE;IAClE,EAAE,CAAC,+CAA+C,EAAE,GAAS,EAAE;QAC7D,MAAM,MAAM,GAAG,MAAM,IAAA,mBAAW,EAAC,wBAAoB,CAAC,CAAC;QACvD,MAAM,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC;YACjC,GAAG,EAAE,4CAA4C;YACjD,QAAQ,EAAE,MAAM;YAChB,QAAQ,EAAE,IAAI;SACf,CAAC,CAAC;QACH,MAAM,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC;YACjC,GAAG,EAAE,4CAA4C;SAClD,CAAC,CAAC;QACH,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC/C,MAAM,MAAM,CAAC,QAAQ,CAAC,wBAAwB,EAAE,CAAC;QACjD,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAChD,MAAM,MAAM,CAAC,QAAQ,CAAC,uBAAuB,EAAE,CAAC;QAChD,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjD,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ActionContext } from '..';
|
|
2
|
+
import { Asset, Network, WalletId } from '../types';
|
|
3
|
+
export declare const enableAssets: (context: ActionContext, { network, walletId, assets }: {
|
|
4
|
+
network: Network;
|
|
5
|
+
walletId: WalletId;
|
|
6
|
+
assets: Asset[];
|
|
7
|
+
}) => Promise<void>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.enableAssets = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const cryptoassets_1 = require("@yaswap/cryptoassets");
|
|
6
|
+
const __1 = require("..");
|
|
7
|
+
const accounts_1 = require("../../utils/accounts");
|
|
8
|
+
const types_1 = require("../types");
|
|
9
|
+
const enableAssets = (context, { network, walletId, assets }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
10
|
+
var _a;
|
|
11
|
+
const { state, commit, dispatch, getters } = (0, __1.rootActionContext)(context);
|
|
12
|
+
commit.ENABLE_ASSETS({ network, walletId, assets });
|
|
13
|
+
const accounts = ((_a = state.accounts[walletId]) === null || _a === void 0 ? void 0 : _a[network]) || [];
|
|
14
|
+
const accountsChains = accounts.map((a) => a.chain);
|
|
15
|
+
const accountsToCreate = assets
|
|
16
|
+
.filter((asset) => { var _a; return !!((_a = getters.cryptoassets[asset]) === null || _a === void 0 ? void 0 : _a.chain); })
|
|
17
|
+
.map((asset) => { var _a; return (_a = getters.cryptoassets[asset]) === null || _a === void 0 ? void 0 : _a.chain; })
|
|
18
|
+
.filter((chainId) => !accountsChains.includes(chainId))
|
|
19
|
+
.map((chainId) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
20
|
+
const chain = (0, cryptoassets_1.getChain)(network, chainId);
|
|
21
|
+
const _assets = assets.filter((asset) => { var _a; return ((_a = getters.cryptoassets[asset]) === null || _a === void 0 ? void 0 : _a.chain) === chainId; });
|
|
22
|
+
const _account = (0, accounts_1.accountCreator)({
|
|
23
|
+
walletId,
|
|
24
|
+
network,
|
|
25
|
+
account: {
|
|
26
|
+
name: `${chain.name} 1`,
|
|
27
|
+
chain: chainId,
|
|
28
|
+
addresses: [],
|
|
29
|
+
assets: _assets,
|
|
30
|
+
balances: {},
|
|
31
|
+
type: types_1.AccountType.Default,
|
|
32
|
+
index: 0,
|
|
33
|
+
color: (0, accounts_1.getNextAccountColor)(chainId, 0),
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
commit.CREATE_ACCOUNT({ network, walletId, account: _account });
|
|
37
|
+
yield dispatch.getUnusedAddresses({
|
|
38
|
+
network,
|
|
39
|
+
walletId,
|
|
40
|
+
assets: _account.assets,
|
|
41
|
+
accountId: _account.id,
|
|
42
|
+
});
|
|
43
|
+
}));
|
|
44
|
+
if (accountsToCreate.length > 0) {
|
|
45
|
+
yield Promise.all(accountsToCreate);
|
|
46
|
+
}
|
|
47
|
+
accounts.forEach((account) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
48
|
+
const accountId = account.id;
|
|
49
|
+
const _assets = assets.filter((asset) => { var _a; return ((_a = getters.cryptoassets[asset]) === null || _a === void 0 ? void 0 : _a.chain) === account.chain; });
|
|
50
|
+
if (_assets && _assets.length > 0) {
|
|
51
|
+
commit.ENABLE_ACCOUNT_ASSETS({
|
|
52
|
+
network,
|
|
53
|
+
walletId,
|
|
54
|
+
assets: _assets,
|
|
55
|
+
accountId,
|
|
56
|
+
});
|
|
57
|
+
yield dispatch.updateAccountBalance({ network, walletId, accountId });
|
|
58
|
+
}
|
|
59
|
+
}));
|
|
60
|
+
dispatch.updateCurrenciesInfo({ assets: [...getters.allNetworkAssets] });
|
|
61
|
+
dispatch.updateFiatRates({ assets: [...getters.allNetworkAssets] });
|
|
62
|
+
dispatch.updateMarketData({ network });
|
|
63
|
+
});
|
|
64
|
+
exports.enableAssets = enableAssets;
|
|
65
|
+
//# sourceMappingURL=enableAssets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enableAssets.js","sourceRoot":"","sources":["../../../../src/store/actions/enableAssets.ts"],"names":[],"mappings":";;;;AAAA,uDAAyD;AACzD,0BAAsD;AACtD,mDAA2E;AAC3E,oCAAiE;AAE1D,MAAM,YAAY,GAAG,CAC1B,OAAsB,EACtB,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAA6D,EACxF,EAAE;;IACF,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,IAAA,qBAAiB,EAAC,OAAO,CAAC,CAAC;IACxE,MAAM,CAAC,aAAa,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;IACpD,MAAM,QAAQ,GAAG,CAAA,MAAA,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,0CAAG,OAAO,CAAC,KAAI,EAAE,CAAC;IAG3D,MAAM,cAAc,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IACpD,MAAM,gBAAgB,GAAG,MAAM;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