@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,37 @@
|
|
|
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
|
+
const types_1 = require("../types");
|
|
7
|
+
describe('disableAssets and enableAssets', () => {
|
|
8
|
+
it('should be able to enable assets & disable assets', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
9
|
+
var _a, _b, _c, _d, _e, _f;
|
|
10
|
+
jest.setTimeout(90000);
|
|
11
|
+
const wallet = yield (0, index_1.setupWallet)(defaultOptions_1.default);
|
|
12
|
+
yield wallet.dispatch.createWallet({
|
|
13
|
+
key: '0x1234567890123456789012345678901234567890',
|
|
14
|
+
mnemonic: 'test',
|
|
15
|
+
imported: true,
|
|
16
|
+
});
|
|
17
|
+
yield wallet.dispatch.unlockWallet({
|
|
18
|
+
key: '0x1234567890123456789012345678901234567890',
|
|
19
|
+
});
|
|
20
|
+
const walletId = wallet.state.activeWalletId;
|
|
21
|
+
yield wallet.dispatch.disableAssets({
|
|
22
|
+
network: types_1.Network.Mainnet,
|
|
23
|
+
walletId: walletId,
|
|
24
|
+
assets: ['BTC'],
|
|
25
|
+
});
|
|
26
|
+
let enabledAssets = (_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[walletId];
|
|
27
|
+
expect(enabledAssets).not.toContain('BTC');
|
|
28
|
+
yield wallet.dispatch.enableAssets({
|
|
29
|
+
network: types_1.Network.Mainnet,
|
|
30
|
+
walletId: walletId,
|
|
31
|
+
assets: ['BTC'],
|
|
32
|
+
});
|
|
33
|
+
enabledAssets = (_f = (_e = (_d = wallet === null || wallet === void 0 ? void 0 : wallet.state) === null || _d === void 0 ? void 0 : _d.enabledAssets) === null || _e === void 0 ? void 0 : _e.mainnet) === null || _f === void 0 ? void 0 : _f[walletId];
|
|
34
|
+
expect(enabledAssets).toContain('BTC');
|
|
35
|
+
}));
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=enableAssets.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enableAssets.test.js","sourceRoot":"","sources":["../../../../src/store/actions/enableAssets.test.ts"],"names":[],"mappings":";;;AAAA,uCAA0C;AAC1C,gGAAsE;AACtE,oCAAmC;AAEnC,QAAQ,CAAC,gCAAgC,EAAE,GAAG,EAAE;IAC9C,EAAE,CAAC,kDAAkD,EAAE,GAAS,EAAE;;QAChE,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QACvB,MAAM,MAAM,GAAG,MAAM,IAAA,mBAAW,EAAC,wBAAoB,CAAC,CAAC;QACvD,MAAM,MAAM,CAAC,Q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|
|
4
|
+
const index_1 = require("../../index");
|
|
5
|
+
const defaultOptions_1 = tslib_1.__importDefault(require("../../walletOptions/defaultOptions"));
|
|
6
|
+
const types_1 = require("../types");
|
|
7
|
+
let wallet;
|
|
8
|
+
describe('disable and enable assets', () => {
|
|
9
|
+
jest.setTimeout(20000);
|
|
10
|
+
beforeEach(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
11
|
+
wallet = yield (0, index_1.setupWallet)(defaultOptions_1.default);
|
|
12
|
+
yield wallet.dispatch.createWallet({
|
|
13
|
+
key: '0x1234567890123456789012345678901234567890',
|
|
14
|
+
mnemonic: 'rough symbol license spirit advance pact catalog vibrant dream great usage empty',
|
|
15
|
+
imported: true,
|
|
16
|
+
});
|
|
17
|
+
yield wallet.dispatch.unlockWallet({
|
|
18
|
+
key: '0x1234567890123456789012345678901234567890',
|
|
19
|
+
});
|
|
20
|
+
yield wallet.dispatch.setWhatsNewModalVersion({
|
|
21
|
+
version: '1.0.0',
|
|
22
|
+
});
|
|
23
|
+
}));
|
|
24
|
+
test('should be able to disable and enable mainnet assets', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
25
|
+
var _a, _b;
|
|
26
|
+
expect(wallet.state.wallets.length).toBe(1);
|
|
27
|
+
expect(wallet.state.wallets[0].imported).toBe(true);
|
|
28
|
+
expect(wallet.state.unlockedAt).not.toBe(0);
|
|
29
|
+
expect(wallet.state.whatsNewModalVersion).toBe('1.0.0');
|
|
30
|
+
expect(wallet.state.keyUpdatedAt).not.toBe(0);
|
|
31
|
+
expect(wallet.state.unlockedAt).not.toBe(0);
|
|
32
|
+
expect(wallet.state.setupAt).not.toBe(0);
|
|
33
|
+
const walletId = wallet.state.activeWalletId;
|
|
34
|
+
const mainnetEnabledAssets = (_a = wallet.state.enabledAssets.mainnet) === null || _a === void 0 ? void 0 : _a[walletId];
|
|
35
|
+
expect(mainnetEnabledAssets === null || mainnetEnabledAssets === void 0 ? void 0 : mainnetEnabledAssets.length).toBeGreaterThan(1);
|
|
36
|
+
yield wallet.dispatch.disableAssets({
|
|
37
|
+
network: types_1.Network.Mainnet,
|
|
38
|
+
walletId: walletId,
|
|
39
|
+
assets: mainnetEnabledAssets,
|
|
40
|
+
});
|
|
41
|
+
expect((_b = wallet.state.enabledAssets.mainnet) === null || _b === void 0 ? void 0 : _b[walletId].length).toBe(0);
|
|
42
|
+
yield wallet.dispatch.enableAssets({
|
|
43
|
+
network: types_1.Network.Mainnet,
|
|
44
|
+
walletId: walletId,
|
|
45
|
+
assets: mainnetEnabledAssets,
|
|
46
|
+
});
|
|
47
|
+
expect(mainnetEnabledAssets === null || mainnetEnabledAssets === void 0 ? void 0 : mainnetEnabledAssets.length).toBeGreaterThan(1);
|
|
48
|
+
}));
|
|
49
|
+
test('should be able to disable and enable testnet assets', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
50
|
+
var _c, _d, _e, _f;
|
|
51
|
+
yield wallet.dispatch.changeActiveNetwork({
|
|
52
|
+
network: types_1.Network.Testnet,
|
|
53
|
+
});
|
|
54
|
+
expect(wallet.state.activeNetwork).toBe('testnet');
|
|
55
|
+
expect(wallet.state.wallets.length).toBe(1);
|
|
56
|
+
expect(wallet.state.wallets[0].imported).toBe(true);
|
|
57
|
+
expect(wallet.state.unlockedAt).not.toBe(0);
|
|
58
|
+
expect(wallet.state.whatsNewModalVersion).toBe('1.0.0');
|
|
59
|
+
expect(wallet.state.keyUpdatedAt).not.toBe(0);
|
|
60
|
+
expect(wallet.state.unlockedAt).not.toBe(0);
|
|
61
|
+
expect(wallet.state.setupAt).not.toBe(0);
|
|
62
|
+
const walletId = wallet.state.activeWalletId;
|
|
63
|
+
const testnetEnabledAssets = (_c = wallet.state.enabledAssets.testnet) === null || _c === void 0 ? void 0 : _c[walletId];
|
|
64
|
+
expect(testnetEnabledAssets === null || testnetEnabledAssets === void 0 ? void 0 : testnetEnabledAssets.length).toBeGreaterThan(1);
|
|
65
|
+
yield wallet.dispatch.disableAssets({
|
|
66
|
+
network: types_1.Network.Testnet,
|
|
67
|
+
walletId: walletId,
|
|
68
|
+
assets: testnetEnabledAssets,
|
|
69
|
+
});
|
|
70
|
+
expect((_d = wallet.state.enabledAssets.testnet) === null || _d === void 0 ? void 0 : _d[walletId].length).toBe(0);
|
|
71
|
+
yield wallet.dispatch.enableAssets({
|
|
72
|
+
network: types_1.Network.Testnet,
|
|
73
|
+
walletId: walletId,
|
|
74
|
+
assets: testnetEnabledAssets,
|
|
75
|
+
});
|
|
76
|
+
expect((_f = (_e = wallet.state.enabledAssets.testnet) === null || _e === void 0 ? void 0 : _e[walletId]) === null || _f === void 0 ? void 0 : _f.length).toBeGreaterThan(1);
|
|
77
|
+
}));
|
|
78
|
+
});
|
|
79
|
+
//# sourceMappingURL=enableDisableAssets.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enableDisableAssets.test.js","sourceRoot":"","sources":["../../../../src/store/actions/enableDisableAssets.test.ts"],"names":[],"mappings":";;;AAAA,uCAA0C;AAC1C,gGAAsE;AACtE,oCAAmC;AAEnC,IAAI,MAAW,CAAC;AAChB,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;IACzC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACvB,UAAU,CAAC,GAAS,EAAE;QACpB,MAAM,GAAG,MAAM,IAAA,mBAAW,EAAC,wBAAoB,CAAC,CAAC;QACjD,MAAM,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC;YACjC,GAAG,EAAE,4CAA4C;YACjD,QAAQ,EAAE,kFAAkF;YAC5F,QAAQ,EAAE,IAAI;SACf,CAAC,CAAC;QACH,MAAM,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC;YACjC,GAAG,EAAE,4CAA4C;SAClD,CAAC,CAAC;QAEH,MAAM,MAAM,CAAC,QAAQ,CAAC,uBAAuB,CAAC;YAC5C,OAAO,EAAE,OAAO;SACjB,CAAC,CAAC;IACL,CAAC,CA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tslib_1 = require("tslib");
|
|
5
|
+
const __1 = require("..");
|
|
6
|
+
const enableEthereumInjection = (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
7
|
+
const { commit } = (0, __1.rootActionContext)(context);
|
|
8
|
+
commit.ENABLE_ETHEREUM_INJECTION();
|
|
9
|
+
});
|
|
10
|
+
exports.enableEthereumInjection = enableEthereumInjection;
|
|
11
|
+
//# sourceMappingURL=enableEthereumInjection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enableEthereumInjection.js","sourceRoot":"","sources":["../../../../src/store/actions/enableEthereumInjection.ts"],"names":[],"mappings":";;;;AAAA,0BAAsD;AAE/C,MAAM,uBAAuB,GAAG,CAAO,OAAsB,EAAE,EAAE;IACtE,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,qBAAiB,EAAC,OAAO,CAAC,CAAC;IAC9C,MAAM,CAAC,yBAAyB,EAAE,CAAC;AACrC,CAAC,CAAA,CAAC;AAHW,QAAA,uBAAuB,2BAGlC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ChainId } from '@yaswap/cryptoassets';
|
|
2
|
+
import { ActionContext } from '..';
|
|
3
|
+
import { AccountId, Network, WalletId } from '../types';
|
|
4
|
+
export declare const exportPrivateKey: (context: ActionContext, { network, walletId, accountId, chainId, }: {
|
|
5
|
+
network: Network;
|
|
6
|
+
walletId: WalletId;
|
|
7
|
+
accountId: AccountId;
|
|
8
|
+
chainId: ChainId;
|
|
9
|
+
}) => Promise<string>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.exportPrivateKey = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const __1 = require("..");
|
|
6
|
+
const exportPrivateKey = (context, { network, walletId, accountId, chainId, }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
7
|
+
const { getters } = (0, __1.rootActionContext)(context);
|
|
8
|
+
const client = getters.client({ network, walletId, accountId, chainId });
|
|
9
|
+
return client.wallet.exportPrivateKey();
|
|
10
|
+
});
|
|
11
|
+
exports.exportPrivateKey = exportPrivateKey;
|
|
12
|
+
//# sourceMappingURL=exportPrivateKey.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exportPrivateKey.js","sourceRoot":"","sources":["../../../../src/store/actions/exportPrivateKey.ts"],"names":[],"mappings":";;;;AACA,0BAAsD;AAG/C,MAAM,gBAAgB,GAAG,CAC9B,OAAsB,EACtB,EACE,OAAO,EACP,QAAQ,EACR,SAAS,EACT,OAAO,GAC0E,EAClE,EAAE;IACnB,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,qBAAiB,EAAC,OAAO,CAAC,CAAC;IAC/C,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC;IACzE,OAAO,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE,CAAC;AAC1C,CAAC,CAAA,CAAC;AAZW,QAAA,gBAAgB,oBAY3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const cryptoassets_1 = require("@yaswap/cryptoassets");
|
|
5
|
+
const index_1 = require("../../index");
|
|
6
|
+
const defaultOptions_1 = tslib_1.__importDefault(require("../../walletOptions/defaultOptions"));
|
|
7
|
+
const types_1 = require("../types");
|
|
8
|
+
test('should be able to export private key', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
9
|
+
var _a, _b, _c, _d, _e, _f;
|
|
10
|
+
const wallet = yield (0, index_1.setupWallet)(defaultOptions_1.default);
|
|
11
|
+
yield wallet.dispatch.createWallet({
|
|
12
|
+
key: '0x1234567890123456789012345678901234567890',
|
|
13
|
+
mnemonic: 'piece effort bind that embrace enrich remind powder sudden patient legend group',
|
|
14
|
+
imported: true,
|
|
15
|
+
});
|
|
16
|
+
yield wallet.dispatch.unlockWallet({
|
|
17
|
+
key: '0x1234567890123456789012345678901234567890',
|
|
18
|
+
});
|
|
19
|
+
const walletId = wallet.state.activeWalletId;
|
|
20
|
+
expect(walletId).not.toBeNull();
|
|
21
|
+
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[walletId];
|
|
22
|
+
expect(mainnetAccounts).not.toBeNull();
|
|
23
|
+
const account = (_f = (_e = (_d = wallet.state.accounts) === null || _d === void 0 ? void 0 : _d[walletId]) === null || _e === void 0 ? void 0 : _e.mainnet) === null || _f === void 0 ? void 0 : _f[1];
|
|
24
|
+
expect(account === null || account === void 0 ? void 0 : account.chain).toBe(cryptoassets_1.ChainId.Ethereum);
|
|
25
|
+
const ethAccountId = account === null || account === void 0 ? void 0 : account.id;
|
|
26
|
+
const privateKey = yield wallet.dispatch.exportPrivateKey({
|
|
27
|
+
network: types_1.Network.Mainnet,
|
|
28
|
+
walletId: walletId,
|
|
29
|
+
accountId: ethAccountId,
|
|
30
|
+
chainId: cryptoassets_1.ChainId.Ethereum,
|
|
31
|
+
});
|
|
32
|
+
expect(privateKey).not.toBeNull();
|
|
33
|
+
expect(privateKey).not.toBe(undefined);
|
|
34
|
+
expect(privateKey).not.toBe('N/A');
|
|
35
|
+
}));
|
|
36
|
+
//# sourceMappingURL=exportPrivateKey.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exportPrivateKey.test.js","sourceRoot":"","sources":["../../../../src/store/actions/exportPrivateKey.test.ts"],"names":[],"mappings":";;;AAAA,uDAA+C;AAC/C,uCA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AAO,CAAC,QAAQ;KAC1B,CAAC,CAAC;IACH,MAAM,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;IAClC,MAAM,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACvC,MAAM,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACrC,CAAC,CAAA,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Nullable, TokenDetails } from '@yaswap/types';
|
|
2
|
+
import { ChainId } from '@yaswap/cryptoassets';
|
|
3
|
+
import { ActionContext } from '..';
|
|
4
|
+
import { Network, WalletId } from '../types';
|
|
5
|
+
export declare type FetchTokenDetailsRequest = {
|
|
6
|
+
walletId: WalletId;
|
|
7
|
+
network: Network;
|
|
8
|
+
chain: ChainId;
|
|
9
|
+
contractAddress: string;
|
|
10
|
+
};
|
|
11
|
+
export declare const fetchTokenDetails: (context: ActionContext, tokenDetailsRequest: FetchTokenDetailsRequest) => Promise<Nullable<TokenDetails>>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchTokenDetails = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const errors_1 = require("@yaswap/errors");
|
|
6
|
+
const __1 = require("..");
|
|
7
|
+
const fetchTokenDetails = (context, tokenDetailsRequest) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
8
|
+
const { walletId, network, chain, contractAddress } = tokenDetailsRequest;
|
|
9
|
+
const { getters } = (0, __1.rootActionContext)(context);
|
|
10
|
+
const client = getters.client({ network, walletId, chainId: chain });
|
|
11
|
+
try {
|
|
12
|
+
return yield client.chain.getTokenDetails(contractAddress);
|
|
13
|
+
}
|
|
14
|
+
catch (err) {
|
|
15
|
+
if (err.rawError instanceof errors_1.UnsupportedMethodError) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
throw err;
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
exports.fetchTokenDetails = fetchTokenDetails;
|
|
22
|
+
//# sourceMappingURL=fetchTokenDetails.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetchTokenDetails.js","sourceRoot":"","sources":["../../../../src/store/actions/fetchTokenDetails.ts"],"names":[],"mappings":";;;;AAAA,2CAAwD;AAIxD,0BAAsD;AAU/C,MAAM,iBAAiB,GAAG,CAC/B,OAAsB,EACtB,mBAA6C,EACZ,EAAE;IACnC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,GAAG,mBAAmB,CAAC;IAC1E,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,qBAAiB,EAAC,OAAO,CAAC,CAAC;IAC/C,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;IAErE,IAAI;QACF,OAAO,MAAM,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,eAAe,CAAC,CAAC;KAC5D;IAAC,OAAO,GAAG,EAAE;QACZ,IAAK,GAAsB,CAAC,QAAQ,YAAY,+BAAsB,EAAE;YACtE,OAAO,IAAI,CAAC;SACb;QACD,MAAM,GAAG,CAAC;KACX;AACH,CAAC,CAAA,CAAC;AAhBW,QAAA,iBAAiB,qBAgB5B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.forgetDappConnections = void 0;
|
|
4
|
+
const __1 = require("..");
|
|
5
|
+
const forgetDappConnections = (context) => {
|
|
6
|
+
const { commit, state } = (0, __1.rootActionContext)(context);
|
|
7
|
+
const { activeWalletId } = state;
|
|
8
|
+
commit.REMOVE_EXTERNAL_CONNECTIONS({ activeWalletId });
|
|
9
|
+
};
|
|
10
|
+
exports.forgetDappConnections = forgetDappConnections;
|
|
11
|
+
//# sourceMappingURL=forgetDappConnections.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forgetDappConnections.js","sourceRoot":"","sources":["../../../../src/store/actions/forgetDappConnections.ts"],"names":[],"mappings":";;;AAAA,0BAAsD;AAE/C,MAAM,qBAAqB,GAAG,CAAC,OAAsB,EAAE,EAAE;IAC9D,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,IAAA,qBAAiB,EAAC,OAAO,CAAC,CAAC;IACrD,MAAM,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC;IACjC,MAAM,CAAC,2BAA2B,CAAC,EAAE,cAAc,EAAE,CAAC,CAAC;AACzD,CAAC,CAAC;AAJW,QAAA,qBAAqB,yBAIhC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ActionContext } from '..';
|
|
2
|
+
import { Asset, BaseHistoryItem, Network, WalletId } from '../types';
|
|
3
|
+
export declare const getLockForAsset: (context: ActionContext, { network, walletId, asset, item }: {
|
|
4
|
+
network: Network;
|
|
5
|
+
walletId: WalletId;
|
|
6
|
+
asset: Asset;
|
|
7
|
+
item: BaseHistoryItem;
|
|
8
|
+
}) => Promise<string>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getLockForAsset = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const __1 = require("..");
|
|
6
|
+
const utils_1 = require("../utils");
|
|
7
|
+
const getLockForAsset = (context, { network, walletId, asset, item }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
8
|
+
const { dispatch, commit } = (0, __1.rootActionContext)(context);
|
|
9
|
+
const { key, success } = (0, utils_1.attemptToLockAsset)(network, walletId, asset);
|
|
10
|
+
if (!success) {
|
|
11
|
+
commit.UPDATE_HISTORY({
|
|
12
|
+
network,
|
|
13
|
+
walletId,
|
|
14
|
+
id: item.id,
|
|
15
|
+
updates: {
|
|
16
|
+
waitingForLock: true,
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
yield new Promise((resolve) => utils_1.emitter.once(`unlock:${key}`, () => resolve(null)));
|
|
20
|
+
return dispatch.getLockForAsset({ network, walletId, asset, item });
|
|
21
|
+
}
|
|
22
|
+
commit.UPDATE_HISTORY({
|
|
23
|
+
network,
|
|
24
|
+
walletId,
|
|
25
|
+
id: item.id,
|
|
26
|
+
updates: {
|
|
27
|
+
waitingForLock: false,
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
yield (0, utils_1.waitForRandom)(3000, 5000);
|
|
31
|
+
return key;
|
|
32
|
+
});
|
|
33
|
+
exports.getLockForAsset = getLockForAsset;
|
|
34
|
+
//# sourceMappingURL=getLockForAsset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getLockForAsset.js","sourceRoot":"","sources":["../../../../src/store/actions/getLockForAsset.ts"],"names":[],"mappings":";;;;AAAA,0BAAsD;AAEtD,oCAAsE;AAE/D,MAAM,eAAe,GAAG,CAC7B,OAAsB,EACtB,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAiF,EAChG,EAAE;IACnB,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAA,qBAAiB,EAAC,OAAO,CAAC,CAAC;IACxD,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,IAAA,0BAAkB,EAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;IAEtE,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,CAAC,cAAc,CAAC;YACpB,OAAO;YACP,QAAQ;YACR,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,OAAO,EAAE;gBACP,cAAc,EAAE,IAAI;aACrB;SACF,CAAC,CAAC;QAEH,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,eAAO,CAAC,IAAI,CAAC,UAAU,GAAG,EAAE,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAEnF,OAAO,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;KACrE;IAED,MAAM,CAAC,cAAc,CAAC;QACpB,OAAO;QACP,QAAQ;QACR,EAAE,EAAE,IAAI,CAAC,EAAE;QACX,OAAO,EAAE;YACP,cAAc,EAAE,KAAK;SACtB;KACF,CAAC,CAAC;IAEH,MAAM,IAAA,qBAAa,EAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAEhC,OAAO,GAAG,CAAC;AACb,CAAC,CAAA,CAAC;AAlCW,QAAA,eAAe,mBAkC1B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ActionContext } from '..';
|
|
2
|
+
import { GetQuotesRequest, SwapQuote } from '../../swaps/types';
|
|
3
|
+
export declare type RequestId = string;
|
|
4
|
+
export declare type SlowQuotesCallback = (quotes: SwapQuote[]) => void;
|
|
5
|
+
export interface GetQuotesResult {
|
|
6
|
+
requestId: RequestId;
|
|
7
|
+
hasSlowQuotes: boolean;
|
|
8
|
+
quotes: SwapQuote[];
|
|
9
|
+
}
|
|
10
|
+
export declare const getQuotes: (_context: ActionContext, { network, from, to, fromAccountId, toAccountId, walletId, amount, slowQuoteThreshold, }: GetQuotesRequest) => Promise<GetQuotesResult>;
|
|
11
|
+
export declare const getSlowQuotes: (_context: ActionContext, { requestId }: {
|
|
12
|
+
requestId: RequestId;
|
|
13
|
+
}) => Promise<SwapQuote[]>;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSlowQuotes = exports.getQuotes = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const utils_1 = require("@yaswap/utils");
|
|
6
|
+
const bignumber_js_1 = tslib_1.__importDefault(require("bignumber.js"));
|
|
7
|
+
const bluebird_1 = tslib_1.__importDefault(require("bluebird"));
|
|
8
|
+
const uuid_1 = require("uuid");
|
|
9
|
+
const build_config_1 = tslib_1.__importDefault(require("../../build.config"));
|
|
10
|
+
const swap_1 = require("../../factory/swap");
|
|
11
|
+
const slowQuotesCallbacks = {};
|
|
12
|
+
const getQuotes = (_context, { network, from, to, fromAccountId, toAccountId, walletId, amount, slowQuoteThreshold = 5000, }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
13
|
+
const requestId = (0, uuid_1.v4)();
|
|
14
|
+
if (!amount) {
|
|
15
|
+
return {
|
|
16
|
+
requestId,
|
|
17
|
+
hasSlowQuotes: false,
|
|
18
|
+
quotes: [],
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
const quotes = [];
|
|
22
|
+
const slowQuotes = [];
|
|
23
|
+
let hasSlowQuotes = false;
|
|
24
|
+
const getAllQuotes = (() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
25
|
+
return bluebird_1.default.map(Object.keys(build_config_1.default.swapProviders[network]), (provider) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
26
|
+
const swapProvider = (0, swap_1.getSwapProvider)(network, provider);
|
|
27
|
+
const quote = yield swapProvider
|
|
28
|
+
.getQuote({ network, from, to, amount: new bignumber_js_1.default(amount), fromAccountId, toAccountId, walletId })
|
|
29
|
+
.catch(console.error);
|
|
30
|
+
if (!quote) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
const result = Object.assign(Object.assign({}, quote), { from, to, provider, fromAccountId, toAccountId });
|
|
34
|
+
if (quote) {
|
|
35
|
+
if (hasSlowQuotes) {
|
|
36
|
+
slowQuotes.push(result);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
quotes.push(result);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return result;
|
|
43
|
+
}), { concurrency: 5 });
|
|
44
|
+
}))().then(() => {
|
|
45
|
+
if (hasSlowQuotes && slowQuotesCallbacks[requestId]) {
|
|
46
|
+
slowQuotesCallbacks[requestId](slowQuotes);
|
|
47
|
+
delete slowQuotesCallbacks[requestId];
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
const fastQuotes = yield Promise.race([
|
|
51
|
+
getAllQuotes.then(() => false),
|
|
52
|
+
(0, utils_1.sleep)(slowQuoteThreshold).then(() => true),
|
|
53
|
+
]).then((timedOut) => {
|
|
54
|
+
hasSlowQuotes = timedOut;
|
|
55
|
+
return quotes;
|
|
56
|
+
});
|
|
57
|
+
return {
|
|
58
|
+
requestId,
|
|
59
|
+
hasSlowQuotes,
|
|
60
|
+
quotes: fastQuotes,
|
|
61
|
+
};
|
|
62
|
+
});
|
|
63
|
+
exports.getQuotes = getQuotes;
|
|
64
|
+
const getSlowQuotes = (_context, { requestId }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
65
|
+
return new Promise((resolve, _reject) => {
|
|
66
|
+
slowQuotesCallbacks[requestId] = (quotes) => resolve(quotes);
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
exports.getSlowQuotes = getSlowQuotes;
|
|
70
|
+
//# sourceMappingURL=getQuotes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getQuotes.js","sourceRoot":"","sources":["../../../../src/store/actions/getQuotes.ts"],"names":[],"mappings":";;;;AAAA,yCAAsC;AACtC,wEAAqC;AACrC,gEAAgC;AAChC,+BAAoC;AAEpC,8EAA6C;AAC7C,6CAAqD;AAcrD,MAAM,mBAAmB,GAErB,EAAE,CAAC;AAIA,MAAM,SAAS,GAAG,CACvB,QAAuB,EACvB,EACE,OAAO,EACP,IAAI,EACJ,EAAE,EACF,aAAa,EACb,WAAW,EACX,QAAQ,EAER,MAAM,EACN,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AC;IACJ,CAAC,CAAA,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE;QACb,IAAI,aAAa,IAAI,mBAAmB,CAAC,SAAS,CAAC,EAAE;YACnD,mBAAmB,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC,CAAC;YAC3C,OAAO,mBAAmB,CAAC,SAAS,CAAC,CAAC;SACvC;IACH,CAAC,CAAC,CAAC;IAEH,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC;QAEpC,YAAY,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC;QAC9B,IAAA,aAAK,EAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC;KAC3C,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;QACnB,aAAa,GAAG,QAAQ,CAAC;QACzB,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,SAAS;QACT,aAAa;QACb,MAAM,EAAE,UAAU;KACnB,CAAC;AACJ,CAAC,CAAA,CAAC;AA5EW,QAAA,SAAS,aA4EpB;AAEK,MAAM,aAAa,GAAG,CAC3B,QAAuB,EACvB,EAAE,SAAS,EAA4B,EACjB,EAAE;IACxB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE;QACtC,mBAAmB,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AAPW,QAAA,aAAa,iBAOxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const Process = tslib_1.__importStar(require("process"));
|
|
5
|
+
const index_1 = require("../../index");
|
|
6
|
+
const defaultOptions_1 = tslib_1.__importDefault(require("../../walletOptions/defaultOptions"));
|
|
7
|
+
const types_1 = require("../types");
|
|
8
|
+
describe('getQuotes tests', () => {
|
|
9
|
+
jest.setTimeout(90000);
|
|
10
|
+
const wallet = (0, index_1.setupWallet)(defaultOptions_1.default);
|
|
11
|
+
let TEST_MNEMONIC = Process.env.TEST_MNEMONIC;
|
|
12
|
+
if (!TEST_MNEMONIC) {
|
|
13
|
+
throw new Error('Please set the TEST_MNEMONIC environment variable');
|
|
14
|
+
}
|
|
15
|
+
TEST_MNEMONIC = TEST_MNEMONIC.replace(/,/g, ' ');
|
|
16
|
+
beforeEach(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
+
yield wallet.dispatch.createWallet({
|
|
18
|
+
key: '0x1234567890123456789012345678901234567890',
|
|
19
|
+
mnemonic: TEST_MNEMONIC,
|
|
20
|
+
imported: true,
|
|
21
|
+
});
|
|
22
|
+
yield wallet.dispatch.unlockWallet({
|
|
23
|
+
key: '0x1234567890123456789012345678901234567890',
|
|
24
|
+
});
|
|
25
|
+
yield wallet.dispatch.changeActiveNetwork({
|
|
26
|
+
network: types_1.Network.Testnet,
|
|
27
|
+
});
|
|
28
|
+
}));
|
|
29
|
+
});
|
|
30
|
+
//# sourceMappingURL=getQuotes.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getQuotes.test.js","sourceRoot":"","sources":["../../../../src/store/actions/getQuotes.test.ts"],"names":[],"mappings":";;;AAAA,yDAAmC;AACnC,uCAA0C;AAC1C,gGAAsE;AACtE,oCAAmC;AAEnC,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACvB,MAAM,MAAM,GAAG,IAAA,mBAAW,EAAC,wBAAoB,CAAC,CAAC;IACjD,IAAI,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;IAC9C,IAAI,CAAC,aAAa,EAAE;QAClB,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;KACtE;IACD,aAAa,GAAG,aAAa,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAEjD,UAAU,CAAC,GAAS,EAAE;QACpB,MAAM,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC;YACjC,GAAG,EAAE,4CAA4C;YACjD,QAAQ,EAAE,aAAc;YACxB,QAAQ,EAAE,IAAI;SACf,CAAC,CAAC;QACH,MAAM,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC;YACjC,GAAG,EAAE,4CAA4C;SAClD,CAAC,CAAC;QAGH,MAAM,MAAM,CAAC,QAAQ,CAAC,mBAAmB,CAAC;YACxC,OAAO,EAAE,eAAO,CAAC,OAAO;SACzB,CAAC,CAAC;IACL,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ActionContext } from '..';
|
|
2
|
+
import { AccountId, Asset, Network, WalletId } from '../types';
|
|
3
|
+
export declare const getUnusedAddresses: (context: ActionContext, { network, walletId, assets, accountId, }: {
|
|
4
|
+
network: Network;
|
|
5
|
+
walletId: WalletId;
|
|
6
|
+
assets: Asset[];
|
|
7
|
+
accountId: AccountId;
|
|
8
|
+
}) => Promise<string[]>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getUnusedAddresses = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const cryptoassets_1 = require("@yaswap/cryptoassets");
|
|
6
|
+
const error_parser_1 = require("@yaswap/error-parser");
|
|
7
|
+
const bluebird_1 = tslib_1.__importDefault(require("bluebird"));
|
|
8
|
+
const cryptoassets_2 = tslib_1.__importDefault(require("../../utils/cryptoassets"));
|
|
9
|
+
const __1 = require("..");
|
|
10
|
+
const getUnusedAddresses = (context, { network, walletId, assets, accountId, }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
11
|
+
const { state, commit, getters } = (0, __1.rootActionContext)(context);
|
|
12
|
+
return bluebird_1.default.map(assets, (asset) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
13
|
+
var _a;
|
|
14
|
+
const accounts = (_a = state.accounts[walletId]) === null || _a === void 0 ? void 0 : _a[network];
|
|
15
|
+
if (!accounts) {
|
|
16
|
+
throw (0, error_parser_1.createInternalError)(error_parser_1.CUSTOM_ERRORS.NotFound.Accounts);
|
|
17
|
+
}
|
|
18
|
+
const chainId = cryptoassets_2.default[asset].chain;
|
|
19
|
+
const index = accounts.findIndex((a) => a.id === accountId);
|
|
20
|
+
if (index >= 0 && asset) {
|
|
21
|
+
const account = accounts[index];
|
|
22
|
+
const client = getters.client({ network, walletId, chainId, accountId: account.id });
|
|
23
|
+
if (client && client.wallet) {
|
|
24
|
+
const result = yield client.wallet.getUnusedAddress();
|
|
25
|
+
const address = result.address;
|
|
26
|
+
let updatedAddresses = [];
|
|
27
|
+
if (account.chain === cryptoassets_1.ChainId.Bitcoin) {
|
|
28
|
+
if (!account.addresses.includes(address)) {
|
|
29
|
+
updatedAddresses = [...account.addresses, address];
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
updatedAddresses = [...account.addresses];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
updatedAddresses = [address];
|
|
37
|
+
}
|
|
38
|
+
commit.UPDATE_ACCOUNT_ADDRESSES({
|
|
39
|
+
network,
|
|
40
|
+
accountId: account.id,
|
|
41
|
+
walletId,
|
|
42
|
+
addresses: updatedAddresses,
|
|
43
|
+
});
|
|
44
|
+
return address;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return '';
|
|
48
|
+
}), { concurrency: 7 });
|
|
49
|
+
});
|
|
50
|
+
exports.getUnusedAddresses = getUnusedAddresses;
|
|
51
|
+
//# sourceMappingURL=getUnusedAddresses.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getUnusedAddresses.js","sourceRoot":"","sources":["../../../../src/store/actions/getUnusedAddresses.ts"],"names":[],"mappings":";;;;AAAA,uDAA+C;AAC/C,uDAA0E;AAC1E,gEAAgC;AAChC,oFAAoD;AACpD,0BAAsD;AAG/C,MAAM,kBAAkB,GAAG,CAChC,OAAsB,EACtB,EACE,OAAO,EACP,QAAQ,EACR,MAAM,EACN,SAAS,GACuE,EAC/D,EAAE;IACrB,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,qBAAiB,EAAC,OAAO,CAAC,CAAC;IAC9D,OAAO,kBAAQ,CAAC,GAAG,CACjB,MAAM,EACN,CAAO,KAAK,EAAE,EAAE;;QACd,MAAM,QAAQ,GAAG,MAAA,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,0CAAG,OAAO,CAAC,CAAC;QACrD,IAAI,CAAC,QAAQ,EAAE;YACb,MAAM,IAAA,kCAAmB,EAAC,4BAAa,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;SAC5D;QAED,MAAM,OAAO,GAAG,sBAAY,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC;QAC1C,MAAM,KAAK,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,SAAS,CAAC,CAAC;QAC5D,IAAI,KAAK,IAAI,CAAC,IAAI,KAAK,EAAE;YACvB,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;YAChC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;YACrF,IAAI,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE;gBAC3B,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE,CAAC;gBACtD,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;gBAC/B,IAAI,gBAAgB,GAAa,EAAE,CAAC;gBACpC,IAAI,OAAO,CAAC,KAAK,KAAK,sBAAO,CAAC,OAAO,EAAE;oBACrC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;wBACxC,gBAAgB,GAAG,CAAC,GAAG,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;qBACpD;yBAAM;wBACL,gBAAgB,GAAG,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;qBAC3C;iBACF;qBAAM;oBACL,gBAAgB,GAAG,CAAC,OAAO,CAAC,CAAC;iBAC9B;gBAED,MAAM,CAAC,wBAAwB,CAAC;oBAC9B,OAAO;oBACP,SAAS,EAAE,OAAO,CAAC,EAAE;oBACrB,QAAQ;oBACR,SAAS,EAAE,gBAAgB;iBAC5B,CAAC,CAAC;gBAEH,OAAO,OAAO,CAAC;aAChB;SACF;QACD,OAAO,EAAE,CAAC;IACZ,CAAC,CAAA,EACD,EAAE,WAAW,EAAE,CAAC,EAAE,CACnB,CAAC;AACJ,CAAC,CAAA,CAAC;AAnDW,QAAA,kBAAkB,sBAmD7B"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ActionContext } from '../..';
|
|
2
|
+
import { AccountType, Asset, Network, WalletId } from '../../types';
|
|
3
|
+
declare type LedgerAccountEntry = {
|
|
4
|
+
account: string;
|
|
5
|
+
index: number;
|
|
6
|
+
exists: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare const getLedgerAccounts: (context: ActionContext, { network, walletId, asset, accountType, startingIndex, numAccounts, }: {
|
|
9
|
+
network: Network;
|
|
10
|
+
walletId: WalletId;
|
|
11
|
+
asset: Asset;
|
|
12
|
+
accountType: AccountType;
|
|
13
|
+
startingIndex: number;
|
|
14
|
+
numAccounts: number;
|
|
15
|
+
}) => Promise<LedgerAccountEntry[]>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getLedgerAccounts = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const cryptoassets_1 = require("@yaswap/cryptoassets");
|
|
6
|
+
const bignumber_js_1 = tslib_1.__importDefault(require("bignumber.js"));
|
|
7
|
+
const __1 = require("../..");
|
|
8
|
+
const derivationPath_1 = require("../../../utils/derivationPath");
|
|
9
|
+
const getLedgerAccounts = (context, { network, walletId, asset, accountType, startingIndex, numAccounts, }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
10
|
+
const { getters } = (0, __1.rootActionContext)(context);
|
|
11
|
+
const { client, networkAccounts, assetFiatBalance } = getters;
|
|
12
|
+
const allAssets = (0, cryptoassets_1.getAllAssets)();
|
|
13
|
+
const { chain } = allAssets[network][asset];
|
|
14
|
+
const chainifyAsset = Object.assign({}, allAssets[network][asset]);
|
|
15
|
+
const results = [];
|
|
16
|
+
const existingAccounts = networkAccounts.filter((account) => {
|
|
17
|
+
return account.chain === chain;
|
|
18
|
+
});
|
|
19
|
+
const pageIndexes = [...Array(numAccounts || 5).keys()].map((i) => i + startingIndex);
|
|
20
|
+
for (const index of pageIndexes) {
|
|
21
|
+
const derivationPath = (0, derivationPath_1.getDerivationPath)(chain, network, index, accountType);
|
|
22
|
+
let _chainCode = null;
|
|
23
|
+
let _publicKey = null;
|
|
24
|
+
const _client = client({ network, walletId, chainId: chain, accountType, accountIndex: index, useCache: false });
|
|
25
|
+
if (chain === cryptoassets_1.ChainId.Bitcoin) {
|
|
26
|
+
const btcAccount = yield _client.wallet.getWalletPublicKey(derivationPath);
|
|
27
|
+
_chainCode = btcAccount.chainCode;
|
|
28
|
+
_publicKey = btcAccount.publicKey;
|
|
29
|
+
}
|
|
30
|
+
const addresses = yield _client.wallet.getAddresses();
|
|
31
|
+
if (addresses && addresses.length > 0) {
|
|
32
|
+
const [account] = addresses;
|
|
33
|
+
const normalizedAddress = (0, cryptoassets_1.getChain)(network, chain).formatAddress(account.address);
|
|
34
|
+
const existingIndex = existingAccounts.findIndex((a) => {
|
|
35
|
+
const addresses = a.addresses.map((a) => (0, cryptoassets_1.getChain)(network, chain).formatAddress(a));
|
|
36
|
+
return addresses.includes(normalizedAddress);
|
|
37
|
+
});
|
|
38
|
+
const exists = existingIndex >= 0;
|
|
39
|
+
const balance = addresses.length === 0 ? (0, bignumber_js_1.default)(0) : (yield _client.chain.getBalance(addresses, [chainifyAsset]))[0];
|
|
40
|
+
const fiatBalance = assetFiatBalance(asset, balance) || new bignumber_js_1.default(0);
|
|
41
|
+
const result = {
|
|
42
|
+
account: normalizedAddress,
|
|
43
|
+
balance,
|
|
44
|
+
fiatBalance,
|
|
45
|
+
index,
|
|
46
|
+
exists,
|
|
47
|
+
chainCode: _chainCode,
|
|
48
|
+
publicKey: _publicKey || account.publicKey,
|
|
49
|
+
derivationPath,
|
|
50
|
+
};
|
|
51
|
+
results.push(result);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return results;
|
|
55
|
+
});
|
|
56
|
+
exports.getLedgerAccounts = getLedgerAccounts;
|
|
57
|
+
//# sourceMappingURL=getLedgerAccounts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getLedgerAccounts.js","sourceRoot":"","sources":["../../../../../src/store/actions/hardware-wallet/getLedgerAccounts.ts"],"names":[],"mappings":";;;;AACA,uDAAuE;AACvE,wEAA8B;AAC9B,6BAAyD;AACzD,kEAAkE;AAS3D,MAAM,iBAAiB,GAAG,CAC/B,OAAsB,EACtB,EACE,OAAO,EACP,QAAQ,EACR,KAAK,EACL,WAAW,EACX,aAAa,EACb,WAAW,GAQZ,EACD,EAAE;IACF,MAAM,EAAE,OAAO,EAAE,GA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