@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,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SwapProviderErrorTypes = void 0;
|
|
4
|
+
var SwapProviderErrorTypes;
|
|
5
|
+
(function (SwapProviderErrorTypes) {
|
|
6
|
+
SwapProviderErrorTypes["AMOUNT_TOO_LOW"] = "AMOUNT_TOO_LOW";
|
|
7
|
+
SwapProviderErrorTypes["FEES_HIGHER_THAN_AMOUNT"] = "FEES_HIGHER_THAN_AMOUNT";
|
|
8
|
+
})(SwapProviderErrorTypes = exports.SwapProviderErrorTypes || (exports.SwapProviderErrorTypes = {}));
|
|
9
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/swaps/types.ts"],"names":[],"mappings":";;;AA+FA,IAAY,sBAGX;AAHD,WAAY,sBAAsB;IAChC,2DAAiC,CAAA;IACjC,6EAAmD,CAAA;AACrD,CAAC,EAHW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAGjC"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { Client } from '@yaswap/client';
|
|
2
|
+
import { EvmChainProvider, EvmTypes } from '@yaswap/evm';
|
|
3
|
+
import { Transaction } from '@yaswap/types';
|
|
4
|
+
import { CurrencyAmount, Token } from '@uniswap/sdk-core';
|
|
5
|
+
import BN from 'bignumber.js';
|
|
6
|
+
import { ActionContext } from '../../store';
|
|
7
|
+
import { Asset, Network, SwapHistoryItem, WalletId } from '../../store/types';
|
|
8
|
+
import { SwapProvider } from '../SwapProvider';
|
|
9
|
+
import { ActionStatus, BaseSwapProviderConfig, EstimateFeeRequest, EstimateFeeResponse, NextSwapActionRequest, QuoteRequest, SwapQuote, SwapRequest, SwapStatus } from '../types';
|
|
10
|
+
export interface UniswapSwapProviderConfig extends BaseSwapProviderConfig {
|
|
11
|
+
routerAddress: '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D';
|
|
12
|
+
}
|
|
13
|
+
export interface UniswapSwapHistoryItem extends SwapHistoryItem {
|
|
14
|
+
approveTxHash: string;
|
|
15
|
+
swapTxHash: string;
|
|
16
|
+
approveTx: Transaction<EvmTypes.EthersTransactionResponse>;
|
|
17
|
+
swapTx: Transaction<EvmTypes.EthersTransactionResponse>;
|
|
18
|
+
}
|
|
19
|
+
interface BuildSwapQuote extends SwapQuote {
|
|
20
|
+
fee?: number;
|
|
21
|
+
}
|
|
22
|
+
interface BuildSwapRequest {
|
|
23
|
+
network: Network;
|
|
24
|
+
walletId: WalletId;
|
|
25
|
+
quote: BuildSwapQuote;
|
|
26
|
+
}
|
|
27
|
+
declare class UniswapSwapProvider extends SwapProvider {
|
|
28
|
+
config: UniswapSwapProviderConfig;
|
|
29
|
+
_apiCache: any;
|
|
30
|
+
constructor(config: UniswapSwapProviderConfig);
|
|
31
|
+
getClient(network: Network, walletId: string, asset: string, accountId: string): Client<EvmChainProvider, import("@yaswap/client").Wallet<any, any>, import("@yaswap/client").Swap<any, any, import("@yaswap/client").Wallet<any, any>>, import("@yaswap/client").Nft<any, any>>;
|
|
32
|
+
getSupportedPairs(): Promise<never[]>;
|
|
33
|
+
getApi(network: Network, asset: Asset): any;
|
|
34
|
+
getUniswapToken(chainId: number, asset: Asset): Token;
|
|
35
|
+
getMinimumOutput(outputAmount: CurrencyAmount<Token>): CurrencyAmount<Token>;
|
|
36
|
+
getChainId(asset: Asset, network: Network): number;
|
|
37
|
+
getQuote({ network, from, to, amount }: QuoteRequest): Promise<{
|
|
38
|
+
fromAmount: string;
|
|
39
|
+
toAmount: string;
|
|
40
|
+
} | null>;
|
|
41
|
+
requiresApproval({ network, walletId, quote }: {
|
|
42
|
+
network: Network;
|
|
43
|
+
walletId: WalletId;
|
|
44
|
+
quote: SwapQuote;
|
|
45
|
+
}): Promise<boolean>;
|
|
46
|
+
buildApprovalTx({ network, walletId, quote }: BuildSwapRequest): Promise<{
|
|
47
|
+
from: string;
|
|
48
|
+
to: string;
|
|
49
|
+
value: BN;
|
|
50
|
+
data: string;
|
|
51
|
+
fee: number | undefined;
|
|
52
|
+
}>;
|
|
53
|
+
approveTokens({ network, walletId, quote }: SwapRequest): Promise<{
|
|
54
|
+
status: string;
|
|
55
|
+
approveTx?: undefined;
|
|
56
|
+
approveTxHash?: undefined;
|
|
57
|
+
} | {
|
|
58
|
+
status: string;
|
|
59
|
+
approveTx: Transaction<any>;
|
|
60
|
+
approveTxHash: string;
|
|
61
|
+
}>;
|
|
62
|
+
buildSwapTx({ network, walletId, quote }: BuildSwapRequest, supportingFeeOnTransferTokens?: boolean): Promise<{
|
|
63
|
+
from: string;
|
|
64
|
+
to: "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D";
|
|
65
|
+
value: BN;
|
|
66
|
+
data: string;
|
|
67
|
+
fee: number | undefined;
|
|
68
|
+
}>;
|
|
69
|
+
sendSwap({ network, walletId, quote }: SwapRequest): Promise<{
|
|
70
|
+
status: string;
|
|
71
|
+
swapTx: Transaction<any>;
|
|
72
|
+
swapTxHash: string;
|
|
73
|
+
}>;
|
|
74
|
+
_sendSwap({ network, walletId, quote }: SwapRequest, supportingFeeOnTransferTokens?: boolean): Promise<Transaction<any>>;
|
|
75
|
+
newSwap({ network, walletId, quote }: SwapRequest): Promise<{
|
|
76
|
+
status: string;
|
|
77
|
+
approveTx?: undefined;
|
|
78
|
+
approveTxHash?: undefined;
|
|
79
|
+
id: string;
|
|
80
|
+
fee: number;
|
|
81
|
+
slippage: number;
|
|
82
|
+
} | {
|
|
83
|
+
status: string;
|
|
84
|
+
approveTx: Transaction<any>;
|
|
85
|
+
approveTxHash: string;
|
|
86
|
+
id: string;
|
|
87
|
+
fee: number;
|
|
88
|
+
slippage: number;
|
|
89
|
+
} | {
|
|
90
|
+
status: string;
|
|
91
|
+
swapTx: Transaction<any>;
|
|
92
|
+
swapTxHash: string;
|
|
93
|
+
id: string;
|
|
94
|
+
fee: number;
|
|
95
|
+
slippage: number;
|
|
96
|
+
}>;
|
|
97
|
+
estimateFees({ network, walletId, asset, txType, quote, feePrices }: EstimateFeeRequest): Promise<EstimateFeeResponse>;
|
|
98
|
+
getMin(_quoteRequest: QuoteRequest): Promise<BN>;
|
|
99
|
+
waitForApproveConfirmations({ swap, network, walletId }: NextSwapActionRequest<UniswapSwapHistoryItem>): Promise<{
|
|
100
|
+
endTime: number;
|
|
101
|
+
status: string;
|
|
102
|
+
} | undefined>;
|
|
103
|
+
waitForSwapConfirmations({ swap, network, walletId }: NextSwapActionRequest<UniswapSwapHistoryItem>): Promise<ActionStatus | undefined>;
|
|
104
|
+
performNextSwapAction(store: ActionContext, { network, walletId, swap }: NextSwapActionRequest<UniswapSwapHistoryItem>): Promise<Partial<{
|
|
105
|
+
endTime: number;
|
|
106
|
+
status: string;
|
|
107
|
+
}> | undefined>;
|
|
108
|
+
protected _getStatuses(): Record<string, SwapStatus>;
|
|
109
|
+
protected _txTypes(): {
|
|
110
|
+
SWAP: string;
|
|
111
|
+
};
|
|
112
|
+
protected _fromTxType(): string | null;
|
|
113
|
+
protected _toTxType(): string | null;
|
|
114
|
+
protected _timelineDiagramSteps(): string[];
|
|
115
|
+
protected _totalSteps(): number;
|
|
116
|
+
}
|
|
117
|
+
export { UniswapSwapProvider };
|
|
@@ -0,0 +1,438 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UniswapSwapProvider = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const types_1 = require("@yaswap/types");
|
|
6
|
+
const cryptoassets_1 = require("@yaswap/cryptoassets");
|
|
7
|
+
const isTransactionNotFoundError_1 = require("../../utils/isTransactionNotFoundError");
|
|
8
|
+
const sdk_core_1 = require("@uniswap/sdk-core");
|
|
9
|
+
const ERC20_json_1 = tslib_1.__importDefault(require("@uniswap/v2-core/build/ERC20.json"));
|
|
10
|
+
const IUniswapV2Pair_json_1 = tslib_1.__importDefault(require("@uniswap/v2-core/build/IUniswapV2Pair.json"));
|
|
11
|
+
const IUniswapV2Router02_json_1 = tslib_1.__importDefault(require("@uniswap/v2-periphery/build/IUniswapV2Router02.json"));
|
|
12
|
+
const v2_sdk_1 = require("@uniswap/v2-sdk");
|
|
13
|
+
const bignumber_js_1 = tslib_1.__importStar(require("bignumber.js"));
|
|
14
|
+
const ethers = tslib_1.__importStar(require("ethers"));
|
|
15
|
+
const jsbi_1 = tslib_1.__importDefault(require("jsbi"));
|
|
16
|
+
const uuid_1 = require("uuid");
|
|
17
|
+
const build_config_1 = tslib_1.__importDefault(require("../../build.config"));
|
|
18
|
+
const utils_1 = require("../../store/actions/performNextAction/utils");
|
|
19
|
+
const asset_1 = require("../../utils/asset");
|
|
20
|
+
const coinFormatter_1 = require("../../utils/coinFormatter");
|
|
21
|
+
const cryptoassets_2 = tslib_1.__importDefault(require("../../utils/cryptoassets"));
|
|
22
|
+
const SwapProvider_1 = require("../SwapProvider");
|
|
23
|
+
const error_parser_1 = require("@yaswap/error-parser");
|
|
24
|
+
const SWAP_DEADLINE = 30 * 60;
|
|
25
|
+
class UniswapSwapProvider extends SwapProvider_1.SwapProvider {
|
|
26
|
+
constructor(config) {
|
|
27
|
+
super(config);
|
|
28
|
+
this._apiCache = {};
|
|
29
|
+
}
|
|
30
|
+
getClient(network, walletId, asset, accountId) {
|
|
31
|
+
return super.getClient(network, walletId, asset, accountId);
|
|
32
|
+
}
|
|
33
|
+
getSupportedPairs() {
|
|
34
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
return [];
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
getApi(network, asset) {
|
|
39
|
+
const chainId = this.getChainId(asset, network);
|
|
40
|
+
if (chainId in this._apiCache) {
|
|
41
|
+
return this._apiCache[chainId];
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
const api = new ethers.providers.InfuraProvider(chainId, build_config_1.default.infuraApiKey);
|
|
45
|
+
this._apiCache[chainId] = api;
|
|
46
|
+
return api;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
getUniswapToken(chainId, asset) {
|
|
50
|
+
if (asset === 'ETH') {
|
|
51
|
+
return sdk_core_1.WETH9[chainId];
|
|
52
|
+
}
|
|
53
|
+
const assetData = cryptoassets_2.default[asset];
|
|
54
|
+
return new sdk_core_1.Token(chainId, assetData.contractAddress, assetData.decimals, assetData.code, assetData.name);
|
|
55
|
+
}
|
|
56
|
+
getMinimumOutput(outputAmount) {
|
|
57
|
+
const slippageTolerance = new sdk_core_1.Percent('50', '10000');
|
|
58
|
+
const slippageAdjustedAmountOut = new sdk_core_1.Fraction(jsbi_1.default.BigInt(1))
|
|
59
|
+
.add(slippageTolerance)
|
|
60
|
+
.invert()
|
|
61
|
+
.multiply(outputAmount.quotient).quotient;
|
|
62
|
+
return sdk_core_1.CurrencyAmount.fromRawAmount(outputAmount.currency, slippageAdjustedAmountOut);
|
|
63
|
+
}
|
|
64
|
+
getChainId(asset, network) {
|
|
65
|
+
const chainId = cryptoassets_2.default[asset].chain;
|
|
66
|
+
if (chainId !== cryptoassets_1.ChainId.Ethereum) {
|
|
67
|
+
throw (0, error_parser_1.createInternalError)(error_parser_1.CUSTOM_ERRORS.Unsupported.Chain);
|
|
68
|
+
}
|
|
69
|
+
const chain = (0, cryptoassets_1.getChain)(network, chainId);
|
|
70
|
+
return Number(chain.network.chainId);
|
|
71
|
+
}
|
|
72
|
+
getQuote({ network, from, to, amount }) {
|
|
73
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
74
|
+
if (!(0, asset_1.isChainEvmCompatible)(from, network) || !(0, asset_1.isChainEvmCompatible)(to, network)) {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
if (cryptoassets_2.default[from].chain !== cryptoassets_1.ChainId.Ethereum || cryptoassets_2.default[to].chain !== cryptoassets_1.ChainId.Ethereum) {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
const chainId = this.getChainId(from, network);
|
|
81
|
+
const tokenA = this.getUniswapToken(chainId, from);
|
|
82
|
+
const tokenB = this.getUniswapToken(chainId, to);
|
|
83
|
+
const pairAddress = v2_sdk_1.Pair.getAddress(tokenA, tokenB);
|
|
84
|
+
const api = this.getApi(network, from);
|
|
85
|
+
const contract = new ethers.Contract(pairAddress, IUniswapV2Pair_json_1.default.abi, api);
|
|
86
|
+
const reserves = yield contract.getReserves();
|
|
87
|
+
const token0Address = yield contract.token0();
|
|
88
|
+
const token1Address = yield contract.token1();
|
|
89
|
+
const token0 = [tokenA, tokenB].find((token) => token.address === token0Address);
|
|
90
|
+
const token1 = [tokenA, tokenB].find((token) => token.address === token1Address);
|
|
91
|
+
if (!token0 || !token1) {
|
|
92
|
+
throw (0, error_parser_1.createInternalError)(error_parser_1.CUSTOM_ERRORS.FailedAssert.UniswapTokenCalculation);
|
|
93
|
+
}
|
|
94
|
+
const pair = new v2_sdk_1.Pair(sdk_core_1.CurrencyAmount.fromRawAmount(token0, reserves.reserve0.toString()), sdk_core_1.CurrencyAmount.fromRawAmount(token1, reserves.reserve1.toString()));
|
|
95
|
+
const route = new v2_sdk_1.Route([pair], tokenA, tokenB);
|
|
96
|
+
const fromAmountInUnit = (0, cryptoassets_1.currencyToUnit)(cryptoassets_2.default[from], new bignumber_js_1.default(amount));
|
|
97
|
+
const tokenAmount = sdk_core_1.CurrencyAmount.fromRawAmount(tokenA, fromAmountInUnit.toFixed());
|
|
98
|
+
const trade = new v2_sdk_1.Trade(route, tokenAmount, sdk_core_1.TradeType.EXACT_INPUT);
|
|
99
|
+
const toAmountInUnit = (0, cryptoassets_1.currencyToUnit)(cryptoassets_2.default[to], new bignumber_js_1.default(trade.outputAmount.toExact()));
|
|
100
|
+
return {
|
|
101
|
+
fromAmount: fromAmountInUnit.toFixed(),
|
|
102
|
+
toAmount: toAmountInUnit.toFixed(),
|
|
103
|
+
};
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
requiresApproval({ network, walletId, quote }) {
|
|
107
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
108
|
+
if (!(0, asset_1.isERC20)(quote.from))
|
|
109
|
+
return false;
|
|
110
|
+
const fromChain = cryptoassets_2.default[quote.from].chain;
|
|
111
|
+
const api = this.getApi(network, quote.from);
|
|
112
|
+
const erc20 = new ethers.Contract(cryptoassets_2.default[quote.from].contractAddress, ERC20_json_1.default.abi, api);
|
|
113
|
+
const fromAddressRaw = yield this.getSwapAddress(network, walletId, quote.from, quote.fromAccountId);
|
|
114
|
+
const fromAddress = (0, cryptoassets_1.getChain)(network, fromChain).formatAddress(fromAddressRaw);
|
|
115
|
+
const allowance = yield erc20.allowance(fromAddress, this.config.routerAddress);
|
|
116
|
+
const inputAmount = ethers.BigNumber.from(new bignumber_js_1.default(quote.fromAmount).toFixed());
|
|
117
|
+
if (allowance.gte(inputAmount)) {
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
return true;
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
buildApprovalTx({ network, walletId, quote }) {
|
|
124
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
125
|
+
const api = this.getApi(network, quote.from);
|
|
126
|
+
const erc20 = new ethers.Contract(cryptoassets_2.default[quote.from].contractAddress, ERC20_json_1.default.abi, api);
|
|
127
|
+
const inputAmount = ethers.BigNumber.from(new bignumber_js_1.default(quote.fromAmount).toFixed());
|
|
128
|
+
const inputAmountHex = inputAmount.toHexString();
|
|
129
|
+
const encodedData = erc20.interface.encodeFunctionData('approve', [this.config.routerAddress, inputAmountHex]);
|
|
130
|
+
const fromChain = cryptoassets_2.default[quote.from].chain;
|
|
131
|
+
const fromAddressRaw = yield this.getSwapAddress(network, walletId, quote.from, quote.fromAccountId);
|
|
132
|
+
const fromAddress = (0, cryptoassets_1.getChain)(network, fromChain).formatAddress(fromAddressRaw);
|
|
133
|
+
return {
|
|
134
|
+
from: fromAddress,
|
|
135
|
+
to: cryptoassets_2.default[quote.from].contractAddress,
|
|
136
|
+
value: new bignumber_js_1.BigNumber(0),
|
|
137
|
+
data: encodedData,
|
|
138
|
+
fee: quote.fee,
|
|
139
|
+
};
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
approveTokens({ network, walletId, quote }) {
|
|
143
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
144
|
+
const requiresApproval = yield this.requiresApproval({
|
|
145
|
+
network,
|
|
146
|
+
walletId,
|
|
147
|
+
quote,
|
|
148
|
+
});
|
|
149
|
+
if (!requiresApproval) {
|
|
150
|
+
return {
|
|
151
|
+
status: 'APPROVE_CONFIRMED',
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
const txData = yield this.buildApprovalTx({ network, walletId, quote });
|
|
155
|
+
const client = this.getClient(network, walletId, quote.from, quote.fromAccountId);
|
|
156
|
+
const approveTx = yield client.wallet.sendTransaction(txData);
|
|
157
|
+
return {
|
|
158
|
+
status: 'WAITING_FOR_APPROVE_CONFIRMATIONS',
|
|
159
|
+
approveTx,
|
|
160
|
+
approveTxHash: approveTx.hash,
|
|
161
|
+
};
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
buildSwapTx({ network, walletId, quote }, supportingFeeOnTransferTokens = false) {
|
|
165
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
166
|
+
const toChain = cryptoassets_2.default[quote.to].chain;
|
|
167
|
+
const chainId = this.getChainId(quote.from, network);
|
|
168
|
+
const fromToken = this.getUniswapToken(chainId, quote.from);
|
|
169
|
+
const toToken = this.getUniswapToken(chainId, quote.to);
|
|
170
|
+
const outputAmount = sdk_core_1.CurrencyAmount.fromRawAmount(toToken, new bignumber_js_1.default(quote.toAmount).toFixed());
|
|
171
|
+
const minimumOutput = this.getMinimumOutput(outputAmount);
|
|
172
|
+
const client = this.getClient(network, walletId, quote.from, quote.fromAccountId);
|
|
173
|
+
const blockHeight = yield client.chain.getBlockHeight();
|
|
174
|
+
const currentBlock = yield client.chain.getBlockByNumber(blockHeight);
|
|
175
|
+
const path = [fromToken.address, toToken.address];
|
|
176
|
+
const deadline = currentBlock.timestamp + SWAP_DEADLINE;
|
|
177
|
+
const minimumOutputInUnit = (0, cryptoassets_1.currencyToUnit)(cryptoassets_2.default[quote.to], new bignumber_js_1.default(minimumOutput.toExact()));
|
|
178
|
+
const inputAmountHex = ethers.BigNumber.from(new bignumber_js_1.default(quote.fromAmount).toFixed()).toHexString();
|
|
179
|
+
const outputAmountHex = ethers.BigNumber.from(minimumOutputInUnit.toFixed()).toHexString();
|
|
180
|
+
const toAddressRaw = yield this.getSwapAddress(network, walletId, quote.to, quote.toAccountId);
|
|
181
|
+
const toAddress = (0, cryptoassets_1.getChain)(network, toChain).formatAddress(toAddressRaw);
|
|
182
|
+
const api = this.getApi(network, quote.to);
|
|
183
|
+
const uniswap = new ethers.Contract(this.config.routerAddress, IUniswapV2Router02_json_1.default.abi, api);
|
|
184
|
+
let encodedData;
|
|
185
|
+
const SWAP_EXACT_TOKEN_FOR_TOKENS = supportingFeeOnTransferTokens
|
|
186
|
+
? 'swapExactTokensForTokensSupportingFeeOnTransferTokens'
|
|
187
|
+
: 'swapExactTokensForTokens';
|
|
188
|
+
const SWAP_EXACT_TOKEN_FOR_ETH = supportingFeeOnTransferTokens
|
|
189
|
+
? 'swapExactTokensForETHSupportingFeeOnTransferTokens'
|
|
190
|
+
: 'swapExactTokensForETH';
|
|
191
|
+
const SWAP_EXACT_ETH_FOR_TOKENS = supportingFeeOnTransferTokens
|
|
192
|
+
? 'swapExactETHForTokensSupportingFeeOnTransferTokens'
|
|
193
|
+
: 'swapExactETHForTokens';
|
|
194
|
+
if ((0, asset_1.isERC20)(quote.from)) {
|
|
195
|
+
const swapTokensMethod = (0, asset_1.isERC20)(quote.to) ? SWAP_EXACT_TOKEN_FOR_TOKENS : SWAP_EXACT_TOKEN_FOR_ETH;
|
|
196
|
+
encodedData = uniswap.interface.encodeFunctionData(swapTokensMethod, [
|
|
197
|
+
inputAmountHex,
|
|
198
|
+
outputAmountHex,
|
|
199
|
+
path,
|
|
200
|
+
toAddress,
|
|
201
|
+
deadline,
|
|
202
|
+
]);
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
encodedData = uniswap.interface.encodeFunctionData(SWAP_EXACT_ETH_FOR_TOKENS, [
|
|
206
|
+
outputAmountHex,
|
|
207
|
+
path,
|
|
208
|
+
toAddress,
|
|
209
|
+
deadline,
|
|
210
|
+
]);
|
|
211
|
+
}
|
|
212
|
+
const value = (0, asset_1.isERC20)(quote.from) ? new bignumber_js_1.BigNumber(0) : new bignumber_js_1.default(quote.fromAmount);
|
|
213
|
+
const fromChain = cryptoassets_2.default[quote.from].chain;
|
|
214
|
+
const fromAddressRaw = yield this.getSwapAddress(network, walletId, quote.from, quote.fromAccountId);
|
|
215
|
+
const fromAddress = (0, cryptoassets_1.getChain)(network, fromChain).formatAddress(fromAddressRaw);
|
|
216
|
+
return {
|
|
217
|
+
from: fromAddress,
|
|
218
|
+
to: this.config.routerAddress,
|
|
219
|
+
value,
|
|
220
|
+
data: encodedData,
|
|
221
|
+
fee: quote.fee,
|
|
222
|
+
};
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
sendSwap({ network, walletId, quote }) {
|
|
226
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
227
|
+
let swapTx;
|
|
228
|
+
try {
|
|
229
|
+
swapTx = yield this._sendSwap({ network, walletId, quote });
|
|
230
|
+
}
|
|
231
|
+
catch (e) {
|
|
232
|
+
if ((0, error_parser_1.errorName)(e) === error_parser_1.ERROR_NAMES.ValidationError) {
|
|
233
|
+
swapTx = yield this._sendSwap({ network, walletId, quote }, true);
|
|
234
|
+
}
|
|
235
|
+
else {
|
|
236
|
+
throw e;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
return {
|
|
240
|
+
status: 'WAITING_FOR_SWAP_CONFIRMATIONS',
|
|
241
|
+
swapTx,
|
|
242
|
+
swapTxHash: swapTx.hash,
|
|
243
|
+
};
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
_sendSwap({ network, walletId, quote }, supportingFeeOnTransferTokens = false) {
|
|
247
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
248
|
+
const txData = yield this.buildSwapTx({ network, walletId, quote }, supportingFeeOnTransferTokens);
|
|
249
|
+
const client = this.getClient(network, walletId, quote.from, quote.fromAccountId);
|
|
250
|
+
yield this.sendLedgerNotification(quote.fromAccountId, 'Signing required to complete the swap.');
|
|
251
|
+
return yield client.wallet.sendTransaction(txData);
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
newSwap({ network, walletId, quote }) {
|
|
255
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
256
|
+
const approvalRequired = (0, asset_1.isERC20)(quote.from);
|
|
257
|
+
const updates = approvalRequired
|
|
258
|
+
? yield this.approveTokens({ network, walletId, quote })
|
|
259
|
+
: yield this.sendSwap({ network, walletId, quote });
|
|
260
|
+
return Object.assign({ id: (0, uuid_1.v4)(), fee: quote.fee, slippage: 50 }, updates);
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
estimateFees({ network, walletId, asset, txType, quote, feePrices }) {
|
|
264
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
265
|
+
if (txType !== this.fromTxType) {
|
|
266
|
+
throw (0, error_parser_1.createInternalError)(error_parser_1.CUSTOM_ERRORS.Invalid.TransactionType(txType));
|
|
267
|
+
}
|
|
268
|
+
const nativeAsset = (0, cryptoassets_1.getChain)(network, cryptoassets_2.default[asset].chain).nativeAsset;
|
|
269
|
+
const account = this.getAccount(quote.fromAccountId);
|
|
270
|
+
if (!account) {
|
|
271
|
+
throw (0, error_parser_1.createInternalError)(error_parser_1.CUSTOM_ERRORS.NotFound.Account(quote.fromAccountId));
|
|
272
|
+
}
|
|
273
|
+
const client = this.getClient(network, walletId, quote.from, account.id);
|
|
274
|
+
let gasLimit = 0;
|
|
275
|
+
if (yield this.requiresApproval({ network, walletId, quote })) {
|
|
276
|
+
const approvalTx = yield this.buildApprovalTx({
|
|
277
|
+
network,
|
|
278
|
+
walletId,
|
|
279
|
+
quote,
|
|
280
|
+
});
|
|
281
|
+
const rawApprovalTx = {
|
|
282
|
+
from: approvalTx.from,
|
|
283
|
+
to: approvalTx.to,
|
|
284
|
+
data: approvalTx.data,
|
|
285
|
+
value: '0x' + approvalTx.value.toString(16),
|
|
286
|
+
};
|
|
287
|
+
gasLimit += (yield client.chain.getProvider().estimateGas(rawApprovalTx)).toNumber();
|
|
288
|
+
}
|
|
289
|
+
const swapTx = yield this.buildSwapTx({ network, walletId, quote });
|
|
290
|
+
const rawSwapTx = {
|
|
291
|
+
from: swapTx.from,
|
|
292
|
+
to: swapTx.to,
|
|
293
|
+
data: swapTx.data,
|
|
294
|
+
value: '0x' + swapTx.value.toString(16),
|
|
295
|
+
};
|
|
296
|
+
try {
|
|
297
|
+
gasLimit += (yield client.chain.getProvider().estimateGas(rawSwapTx)).toNumber();
|
|
298
|
+
}
|
|
299
|
+
catch (_a) {
|
|
300
|
+
gasLimit += 350000;
|
|
301
|
+
}
|
|
302
|
+
const fees = {};
|
|
303
|
+
for (const feePrice of feePrices) {
|
|
304
|
+
const gasPrice = new bignumber_js_1.default(feePrice).times(1e9);
|
|
305
|
+
const fee = new bignumber_js_1.default(gasLimit).times(1.1).times(gasPrice);
|
|
306
|
+
fees[feePrice] = (0, cryptoassets_1.unitToCurrency)(cryptoassets_2.default[nativeAsset[0].code], fee);
|
|
307
|
+
}
|
|
308
|
+
return fees;
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
getMin(_quoteRequest) {
|
|
312
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
313
|
+
return new bignumber_js_1.default(0);
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
waitForApproveConfirmations({ swap, network, walletId }) {
|
|
317
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
318
|
+
const client = this.getClient(network, walletId, swap.from, swap.fromAccountId);
|
|
319
|
+
try {
|
|
320
|
+
const tx = yield client.chain.getTransactionByHash(swap.approveTxHash);
|
|
321
|
+
if (tx && tx.confirmations && tx.confirmations > 0) {
|
|
322
|
+
return {
|
|
323
|
+
endTime: Date.now(),
|
|
324
|
+
status: 'APPROVE_CONFIRMED',
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
catch (e) {
|
|
329
|
+
if ((0, isTransactionNotFoundError_1.isTransactionNotFoundError)(e))
|
|
330
|
+
console.warn(e);
|
|
331
|
+
else
|
|
332
|
+
throw e;
|
|
333
|
+
}
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
waitForSwapConfirmations({ swap, network, walletId }) {
|
|
337
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
338
|
+
const client = this.getClient(network, walletId, swap.from, swap.fromAccountId);
|
|
339
|
+
try {
|
|
340
|
+
const tx = yield client.chain.getTransactionByHash(swap.swapTxHash);
|
|
341
|
+
if (tx && tx.confirmations && tx.confirmations > 0) {
|
|
342
|
+
const { status } = tx;
|
|
343
|
+
this.updateBalances(network, walletId, [swap.fromAccountId]);
|
|
344
|
+
return {
|
|
345
|
+
endTime: Date.now(),
|
|
346
|
+
status: status === types_1.TxStatus.Success ? 'SUCCESS' : 'FAILED',
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
catch (e) {
|
|
351
|
+
if ((0, isTransactionNotFoundError_1.isTransactionNotFoundError)(e))
|
|
352
|
+
console.warn(e);
|
|
353
|
+
else
|
|
354
|
+
throw e;
|
|
355
|
+
}
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
performNextSwapAction(store, { network, walletId, swap }) {
|
|
359
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
360
|
+
switch (swap.status) {
|
|
361
|
+
case 'WAITING_FOR_APPROVE_CONFIRMATIONS':
|
|
362
|
+
return (0, utils_1.withInterval)(() => tslib_1.__awaiter(this, void 0, void 0, function* () { return this.waitForApproveConfirmations({ swap, network, walletId }); }));
|
|
363
|
+
case 'APPROVE_CONFIRMED':
|
|
364
|
+
return (0, utils_1.withLock)(store, { item: swap, network, walletId, asset: swap.from }, () => tslib_1.__awaiter(this, void 0, void 0, function* () { return this.sendSwap({ quote: swap, network, walletId }); }));
|
|
365
|
+
case 'WAITING_FOR_SWAP_CONFIRMATIONS':
|
|
366
|
+
return (0, utils_1.withInterval)(() => tslib_1.__awaiter(this, void 0, void 0, function* () { return this.waitForSwapConfirmations({ swap, network, walletId }); }));
|
|
367
|
+
}
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
_getStatuses() {
|
|
371
|
+
return {
|
|
372
|
+
WAITING_FOR_APPROVE_CONFIRMATIONS: {
|
|
373
|
+
step: 0,
|
|
374
|
+
label: 'Approving {from}',
|
|
375
|
+
filterStatus: 'PENDING',
|
|
376
|
+
notification(swap) {
|
|
377
|
+
return {
|
|
378
|
+
message: `Approving ${swap.from}`,
|
|
379
|
+
};
|
|
380
|
+
},
|
|
381
|
+
},
|
|
382
|
+
APPROVE_CONFIRMED: {
|
|
383
|
+
step: 1,
|
|
384
|
+
label: 'Swapping {from}',
|
|
385
|
+
filterStatus: 'PENDING',
|
|
386
|
+
},
|
|
387
|
+
WAITING_FOR_SWAP_CONFIRMATIONS: {
|
|
388
|
+
step: 1,
|
|
389
|
+
label: 'Swapping {from}',
|
|
390
|
+
filterStatus: 'PENDING',
|
|
391
|
+
notification() {
|
|
392
|
+
return {
|
|
393
|
+
message: 'Engaging the unicorn',
|
|
394
|
+
};
|
|
395
|
+
},
|
|
396
|
+
},
|
|
397
|
+
SUCCESS: {
|
|
398
|
+
step: 2,
|
|
399
|
+
label: 'Completed',
|
|
400
|
+
filterStatus: 'COMPLETED',
|
|
401
|
+
notification(swap) {
|
|
402
|
+
return {
|
|
403
|
+
message: `Swap completed, ${(0, coinFormatter_1.prettyBalance)(swap.toAmount, swap.to)} ${swap.to} ready to use`,
|
|
404
|
+
};
|
|
405
|
+
},
|
|
406
|
+
},
|
|
407
|
+
FAILED: {
|
|
408
|
+
step: 2,
|
|
409
|
+
label: 'Swap Failed',
|
|
410
|
+
filterStatus: 'REFUNDED',
|
|
411
|
+
notification() {
|
|
412
|
+
return {
|
|
413
|
+
message: 'Swap failed',
|
|
414
|
+
};
|
|
415
|
+
},
|
|
416
|
+
},
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
_txTypes() {
|
|
420
|
+
return {
|
|
421
|
+
SWAP: 'SWAP',
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
_fromTxType() {
|
|
425
|
+
return this._txTypes().SWAP;
|
|
426
|
+
}
|
|
427
|
+
_toTxType() {
|
|
428
|
+
return null;
|
|
429
|
+
}
|
|
430
|
+
_timelineDiagramSteps() {
|
|
431
|
+
return ['APPROVE', 'SWAP'];
|
|
432
|
+
}
|
|
433
|
+
_totalSteps() {
|
|
434
|
+
return 3;
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
exports.UniswapSwapProvider = UniswapSwapProvider;
|
|
438
|
+
//# sourceMappingURL=UniswapSwapProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UniswapSwapProvider.js","sourceRoot":"","sources":["../../../../src/swaps/uniswap/UniswapSwapProvider.ts"],"names":[],"mappings":";;;;AAEA,yCAAsD;AACtD,uDAAyF;AACzF,uFAAoF;AACpF,gDAA+F;AAC/F,2FAAsD;AACtD,6GAAuE;AACvE,0HAAkF;AAClF,4CAAqD;AACrD,qEAA6C;AAC7C,uDAAiC;AACjC,wDAAwB;AACxB,+BAAoC;AACpC,8EAA6C;AAE7C,uEAAqF;AAErF,6CAAkE;AAClE,6DAA0D;AAC1D,oFAAoD;AACpD,kDAA+C;AAY/C,uDAAkG;AAElG,MAAM,aAAa,GAAG,EAAE,GAAG,EAAE,CAAC;AAuB9B,MAAM,mBAAoB,SAAQ,2BAAY;IAG5C,YAAY,MAAiC;QAC3C,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;IACtB,CAAC;IAEM,SAAS,CAAC,OAAgB,EAAE,QAAgB,EAAE,KAAa,EAAE,SAAiB;QACnF,OAAO,KAAK,CAAC,SAAS,CAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,CAA6B,CAAC;IAC1F,CAAC;IAEK,iBAAiB;;YACrB,OAAO,EAAE,CAAC;QACZ,CAAC;KAAA;IAGD,MAAM,CAAC,OAAgB,EAAE,KAAY;QACnC,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAChD,IAAI,OAAO,IAAI,IAAI,CAAC,SAAS,EAAE;YAC7B,OAAO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AAO,EAAE,sBAAsB;qBAChC,CAAC;gBACJ,CAAC;aACF;YACD,OAAO,EAAE;gBACP,IAAI,EAAE,CAAC;gBACP,KAAK,EAAE,WAAW;gBAClB,YAAY,EAAE,WAAW;gBACzB,YAAY,CAAC,IAAS;oBACpB,OAAO;wBACL,OAAO,EAAE,mBAAmB,IAAA,6BAAa,EAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,EAAE,eAAe;qBAC5F,CAAC;gBACJ,CAAC;aACF;YACD,MAAM,EAAE;gBACN,IAAI,EAAE,CAAC;gBACP,KAAK,EAAE,aAAa;gBACpB,YAAY,EAAE,UAAU;gBACxB,YAAY;oBACV,OAAO;wBACL,OAAO,EAAE,aAAa;qBACvB,CAAC;gBACJ,CAAC;aACF;SACF,CAAC;IACJ,CAAC;IAES,QAAQ;QAChB,OAAO;YACL,IAAI,EAAE,MAAM;SACb,CAAC;IACJ,CAAC;IAES,WAAW;QACnB,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC;IAC9B,CAAC;IAES,SAAS;QACjB,OAAO,IAAI,CAAC;IACd,CAAC;IAES,qBAAqB;QAC7B,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAC7B,CAAC;IAES,WAAW;QACnB,OAAO,CAAC,CAAC;IACX,CAAC;CACF;AAEQ,kDAAmB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "Uniswap AMM Swaps",
|
|
3
|
+
"description": "Popular DEX for Ethereum tokens only.",
|
|
4
|
+
"pros": ["High liquidity", "Many pairs", "Fast"],
|
|
5
|
+
"cons": ["Slippage", "Ethereum tokens only", "Few pairs"],
|
|
6
|
+
"fees": ["0.3% liquidity provider fee", "Slippage (up to 0.5% in Liquality)"]
|
|
7
|
+
}
|