@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,369 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OneinchSwapProvider = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const client_1 = require("@yaswap/client");
|
|
6
|
+
const types_1 = require("@yaswap/types");
|
|
7
|
+
const cryptoassets_1 = require("@yaswap/cryptoassets");
|
|
8
|
+
const isTransactionNotFoundError_1 = require("../../utils/isTransactionNotFoundError");
|
|
9
|
+
const ERC20_json_1 = tslib_1.__importDefault(require("@uniswap/v2-core/build/ERC20.json"));
|
|
10
|
+
const bignumber_js_1 = tslib_1.__importStar(require("bignumber.js"));
|
|
11
|
+
const ethers = tslib_1.__importStar(require("ethers"));
|
|
12
|
+
const uuid_1 = require("uuid");
|
|
13
|
+
const store_1 = tslib_1.__importDefault(require("../../store"));
|
|
14
|
+
const utils_1 = require("../../store/actions/performNextAction/utils");
|
|
15
|
+
const asset_1 = require("../../utils/asset");
|
|
16
|
+
const coinFormatter_1 = require("../../utils/coinFormatter");
|
|
17
|
+
const cryptoassets_2 = tslib_1.__importDefault(require("../../utils/cryptoassets"));
|
|
18
|
+
const SwapProvider_1 = require("../SwapProvider");
|
|
19
|
+
const error_parser_1 = require("@yaswap/error-parser");
|
|
20
|
+
const NATIVE_ASSET_ADDRESS = '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee';
|
|
21
|
+
const SLIPPAGE_PERCENTAGE = 0.5;
|
|
22
|
+
const supportedChains = {
|
|
23
|
+
1: true,
|
|
24
|
+
10: true,
|
|
25
|
+
56: true,
|
|
26
|
+
137: true,
|
|
27
|
+
43114: true,
|
|
28
|
+
42161: true,
|
|
29
|
+
};
|
|
30
|
+
const chainToGasMultiplier = {
|
|
31
|
+
1: 1.5,
|
|
32
|
+
10: 1.5,
|
|
33
|
+
56: 1.5,
|
|
34
|
+
137: 1.5,
|
|
35
|
+
43114: 1.5,
|
|
36
|
+
42161: 10,
|
|
37
|
+
};
|
|
38
|
+
const optimismL1GasLimits = {
|
|
39
|
+
approve: 6500,
|
|
40
|
+
send: 100000,
|
|
41
|
+
};
|
|
42
|
+
const oneInchSwapErrorParser = (0, error_parser_1.getErrorParser)(error_parser_1.OneInchSwapErrorParser);
|
|
43
|
+
const oneInchApproveErrorParser = (0, error_parser_1.getErrorParser)(error_parser_1.OneInchApproveErrorParser);
|
|
44
|
+
const oneInchQuoteErrorParser = (0, error_parser_1.getErrorParser)(error_parser_1.OneInchQuoteErrorParser);
|
|
45
|
+
class OneinchSwapProvider extends SwapProvider_1.SwapProvider {
|
|
46
|
+
constructor(config) {
|
|
47
|
+
super(config);
|
|
48
|
+
this._httpClient = new client_1.HttpClient({ baseURL: this.config.agent });
|
|
49
|
+
}
|
|
50
|
+
getSupportedPairs() {
|
|
51
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
return [];
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
getClient(network, walletId, asset, accountId) {
|
|
56
|
+
return super.getClient(network, walletId, asset, accountId);
|
|
57
|
+
}
|
|
58
|
+
getQuote({ network, from, to, amount }) {
|
|
59
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
if (!(0, asset_1.isChainEvmCompatible)(from, network) || !(0, asset_1.isChainEvmCompatible)(to, network) || new bignumber_js_1.BigNumber(amount).lte(0))
|
|
61
|
+
return null;
|
|
62
|
+
const fromAmountInUnit = new bignumber_js_1.default((0, cryptoassets_1.currencyToUnit)(cryptoassets_2.default[from], new bignumber_js_1.default(amount)));
|
|
63
|
+
const chainIdFrom = Number((0, cryptoassets_1.getChain)(network, cryptoassets_2.default[from].chain).network.chainId);
|
|
64
|
+
const chainIdTo = Number((0, cryptoassets_1.getChain)(network, cryptoassets_2.default[to].chain).network.chainId);
|
|
65
|
+
if (chainIdFrom !== chainIdTo || !supportedChains[chainIdFrom]) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
const trade = yield this._getQuote(chainIdFrom, from, to, fromAmountInUnit.toNumber());
|
|
69
|
+
const toAmountInUnit = new bignumber_js_1.default(trade === null || trade === void 0 ? void 0 : trade.toTokenAmount);
|
|
70
|
+
return {
|
|
71
|
+
fromAmount: fromAmountInUnit.toFixed(),
|
|
72
|
+
toAmount: toAmountInUnit.toFixed(),
|
|
73
|
+
};
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
approveTokens({ network, walletId, quote }) {
|
|
77
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
78
|
+
const approvalData = yield this._buildApproval({ network, walletId, quote });
|
|
79
|
+
const client = this.getClient(network, walletId, quote.from, quote.fromAccountId);
|
|
80
|
+
const approveTx = yield client.wallet.sendTransaction({
|
|
81
|
+
to: approvalData === null || approvalData === void 0 ? void 0 : approvalData.to,
|
|
82
|
+
value: approvalData === null || approvalData === void 0 ? void 0 : approvalData.value,
|
|
83
|
+
data: approvalData === null || approvalData === void 0 ? void 0 : approvalData.data,
|
|
84
|
+
fee: quote.fee,
|
|
85
|
+
});
|
|
86
|
+
return {
|
|
87
|
+
status: 'WAITING_FOR_APPROVE_CONFIRMATIONS',
|
|
88
|
+
approveTx,
|
|
89
|
+
approveTxHash: approveTx.hash,
|
|
90
|
+
};
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
sendSwap({ network, walletId, quote }) {
|
|
94
|
+
var _a, _b, _c;
|
|
95
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
96
|
+
const swapData = yield this._buildSwap({ network, walletId, quote });
|
|
97
|
+
const client = this.getClient(network, walletId, quote.from, quote.fromAccountId);
|
|
98
|
+
yield this.sendLedgerNotification(quote.fromAccountId, 'Signing required to complete the swap.');
|
|
99
|
+
const swapTx = yield client.wallet.sendTransaction({
|
|
100
|
+
to: (_a = swapData === null || swapData === void 0 ? void 0 : swapData.tx) === null || _a === void 0 ? void 0 : _a.to,
|
|
101
|
+
value: (_b = swapData === null || swapData === void 0 ? void 0 : swapData.tx) === null || _b === void 0 ? void 0 : _b.value,
|
|
102
|
+
data: (_c = swapData === null || swapData === void 0 ? void 0 : swapData.tx) === null || _c === void 0 ? void 0 : _c.data,
|
|
103
|
+
fee: quote.fee,
|
|
104
|
+
});
|
|
105
|
+
return {
|
|
106
|
+
status: 'WAITING_FOR_SWAP_CONFIRMATIONS',
|
|
107
|
+
swapTx,
|
|
108
|
+
swapTxHash: swapTx.hash,
|
|
109
|
+
};
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
newSwap({ network, walletId, quote }) {
|
|
113
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
114
|
+
const approvalRequired = (0, asset_1.isERC20)(quote.from);
|
|
115
|
+
const updates = approvalRequired
|
|
116
|
+
? yield this.approveTokens({ network, walletId, quote })
|
|
117
|
+
: yield this.sendSwap({ network, walletId, quote });
|
|
118
|
+
return Object.assign({ id: (0, uuid_1.v4)(), fee: quote.fee, slippage: 50 }, updates);
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
estimateFees({ network, txType, quote, feePrices, feePricesL1, }) {
|
|
122
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
123
|
+
const chain = cryptoassets_2.default[quote.from].chain;
|
|
124
|
+
const _chain = (0, cryptoassets_1.getChain)(network, chain);
|
|
125
|
+
const chainId = Number(_chain.network.chainId);
|
|
126
|
+
const nativeAsset = _chain.nativeAsset[0].code;
|
|
127
|
+
if (txType in this._txTypes()) {
|
|
128
|
+
const fees = {};
|
|
129
|
+
const tradeData = yield this._getQuote(chainId, quote.from, quote.to, new bignumber_js_1.BigNumber(quote.fromAmount).toNumber());
|
|
130
|
+
const isMultiLayered = feePricesL1 && (0, cryptoassets_1.getChain)(network, chain).isMultiLayered;
|
|
131
|
+
const l1GasLimit = isMultiLayered
|
|
132
|
+
? (0, asset_1.isERC20)(quote.from)
|
|
133
|
+
? new bignumber_js_1.default(optimismL1GasLimits.approve + optimismL1GasLimits.send)
|
|
134
|
+
: new bignumber_js_1.default(optimismL1GasLimits.send)
|
|
135
|
+
: new bignumber_js_1.default(0);
|
|
136
|
+
const multiplier = chainToGasMultiplier[chainId] || 1.5;
|
|
137
|
+
feePrices.forEach((feePrice, index) => {
|
|
138
|
+
let fee = new bignumber_js_1.default(0);
|
|
139
|
+
if (isMultiLayered) {
|
|
140
|
+
const gasPriceL1 = new bignumber_js_1.default(feePricesL1[index]).times(1e9);
|
|
141
|
+
fee = fee.plus(new bignumber_js_1.default(l1GasLimit).times(multiplier).times(gasPriceL1));
|
|
142
|
+
}
|
|
143
|
+
const gasPrice = new bignumber_js_1.default(feePrice).times(1e9);
|
|
144
|
+
fee = fee.plus(new bignumber_js_1.default(tradeData === null || tradeData === void 0 ? void 0 : tradeData.estimatedGas).times(multiplier).times(gasPrice));
|
|
145
|
+
fees[feePrice] = (0, cryptoassets_1.unitToCurrency)(cryptoassets_2.default[nativeAsset], fee);
|
|
146
|
+
});
|
|
147
|
+
return fees;
|
|
148
|
+
}
|
|
149
|
+
return null;
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
getMin(_quoteRequest) {
|
|
153
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
154
|
+
return new bignumber_js_1.default(0);
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
_getQuote(chainIdFrom, from, to, amount) {
|
|
158
|
+
var _a;
|
|
159
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
160
|
+
const fromToken = cryptoassets_2.default[from].contractAddress;
|
|
161
|
+
const toToken = cryptoassets_2.default[to].contractAddress;
|
|
162
|
+
const referrerAddress = (_a = this.config.referrerAddress) === null || _a === void 0 ? void 0 : _a[cryptoassets_2.default[from].chain];
|
|
163
|
+
const fee = referrerAddress && this.config.referrerFee;
|
|
164
|
+
return yield oneInchQuoteErrorParser.wrapAsync(() => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
165
|
+
return yield this._httpClient.nodeGet(`/${chainIdFrom}/quote`, {
|
|
166
|
+
fromTokenAddress: fromToken || NATIVE_ASSET_ADDRESS,
|
|
167
|
+
toTokenAddress: toToken || NATIVE_ASSET_ADDRESS,
|
|
168
|
+
amount,
|
|
169
|
+
fee,
|
|
170
|
+
});
|
|
171
|
+
}), {
|
|
172
|
+
from: from,
|
|
173
|
+
to: to,
|
|
174
|
+
amount: (0, cryptoassets_1.unitToCurrency)(cryptoassets_2.default[from], amount).toString(),
|
|
175
|
+
balance: 'NA',
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
_buildApproval({ network, walletId, quote }) {
|
|
180
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
181
|
+
const fromChain = cryptoassets_2.default[quote.from].chain;
|
|
182
|
+
const toChain = cryptoassets_2.default[quote.to].chain;
|
|
183
|
+
const chainId = Number((0, cryptoassets_1.getChain)(network, fromChain).network.chainId);
|
|
184
|
+
if (fromChain !== toChain || !supportedChains[Number(chainId)]) {
|
|
185
|
+
return null;
|
|
186
|
+
}
|
|
187
|
+
const client = this.getClient(network, walletId, quote.from, quote.fromAccountId);
|
|
188
|
+
const provider = client.chain.getProvider();
|
|
189
|
+
const erc20 = new ethers.Contract(cryptoassets_2.default[quote.from].contractAddress, ERC20_json_1.default.abi, provider);
|
|
190
|
+
const fromAddressRaw = yield this.getSwapAddress(network, walletId, quote.from, quote.fromAccountId);
|
|
191
|
+
const fromAddress = (0, cryptoassets_1.getChain)(network, fromChain).formatAddress(fromAddressRaw);
|
|
192
|
+
const allowance = yield erc20.allowance(fromAddress, this.config.routerAddress);
|
|
193
|
+
const inputAmount = ethers.BigNumber.from(new bignumber_js_1.default(quote.fromAmount).toFixed());
|
|
194
|
+
if (allowance.gte(inputAmount)) {
|
|
195
|
+
return {
|
|
196
|
+
status: 'APPROVE_CONFIRMED',
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
const callData = yield oneInchApproveErrorParser.wrapAsync(() => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
200
|
+
return yield this._httpClient.nodeGet(`/${chainId}/approve/transaction`, {
|
|
201
|
+
tokenAddress: cryptoassets_2.default[quote.from].contractAddress,
|
|
202
|
+
amount: inputAmount.toString(),
|
|
203
|
+
});
|
|
204
|
+
}), null);
|
|
205
|
+
return callData;
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
_buildSwap({ network, walletId, quote }) {
|
|
209
|
+
var _a, _b;
|
|
210
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
211
|
+
const toChain = cryptoassets_2.default[quote.to].chain;
|
|
212
|
+
const fromChain = cryptoassets_2.default[quote.from].chain;
|
|
213
|
+
const chainId = Number((0, cryptoassets_1.getChain)(network, toChain).network.chainId);
|
|
214
|
+
if (toChain !== fromChain || !supportedChains[Number(chainId)]) {
|
|
215
|
+
throw (0, error_parser_1.createInternalError)(error_parser_1.CUSTOM_ERRORS.Unsupported.SwapRoute(fromChain, toChain));
|
|
216
|
+
}
|
|
217
|
+
const fromAddressRaw = yield this.getSwapAddress(network, walletId, quote.from, quote.fromAccountId);
|
|
218
|
+
const fromAddress = (0, cryptoassets_1.getChain)(network, fromChain).formatAddress(fromAddressRaw);
|
|
219
|
+
const swapParams = {
|
|
220
|
+
fromTokenAddress: cryptoassets_2.default[quote.from].contractAddress || NATIVE_ASSET_ADDRESS,
|
|
221
|
+
toTokenAddress: cryptoassets_2.default[quote.to].contractAddress || NATIVE_ASSET_ADDRESS,
|
|
222
|
+
amount: quote.fromAmount,
|
|
223
|
+
fromAddress: fromAddress,
|
|
224
|
+
slippage: quote.slippagePercentage ? quote.slippagePercentage : SLIPPAGE_PERCENTAGE,
|
|
225
|
+
};
|
|
226
|
+
const referrerAddress = (_a = this.config.referrerAddress) === null || _a === void 0 ? void 0 : _a[cryptoassets_2.default[quote.from].chain];
|
|
227
|
+
if (referrerAddress) {
|
|
228
|
+
swapParams.referrerAddress = referrerAddress;
|
|
229
|
+
swapParams.fee = this.config.referrerFee;
|
|
230
|
+
}
|
|
231
|
+
const swap = yield oneInchSwapErrorParser.wrapAsync(() => tslib_1.__awaiter(this, void 0, void 0, function* () { return yield this._httpClient.nodeGet(`/${chainId}/swap`, swapParams); }), {
|
|
232
|
+
from: quote.from,
|
|
233
|
+
to: quote.to,
|
|
234
|
+
amount: (0, cryptoassets_1.unitToCurrency)(cryptoassets_2.default[quote.from], new bignumber_js_1.default(quote.fromAmount)).toString(),
|
|
235
|
+
balance: ((_b = store_1.default.getters.accountItem(quote.fromAccountId)) === null || _b === void 0 ? void 0 : _b.balances[quote.from]) || 'NA',
|
|
236
|
+
});
|
|
237
|
+
if (new bignumber_js_1.default(quote.toAmount).times(1 - swapParams.slippage / 100).gt(swap === null || swap === void 0 ? void 0 : swap.toTokenAmount)) {
|
|
238
|
+
throw new error_parser_1.SlippageTooHighError({
|
|
239
|
+
expectedAmount: quote.toAmount,
|
|
240
|
+
actualAmount: swap === null || swap === void 0 ? void 0 : swap.toTokenAmount,
|
|
241
|
+
currency: quote.to,
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
return swap;
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
waitForApproveConfirmations({ swap, network, walletId }) {
|
|
248
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
249
|
+
const client = this.getClient(network, walletId, swap.from, swap.fromAccountId);
|
|
250
|
+
try {
|
|
251
|
+
const tx = yield client.chain.getTransactionByHash(swap.approveTxHash);
|
|
252
|
+
if (tx && tx.confirmations && tx.confirmations > 0) {
|
|
253
|
+
return {
|
|
254
|
+
endTime: Date.now(),
|
|
255
|
+
status: 'APPROVE_CONFIRMED',
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
catch (e) {
|
|
260
|
+
if ((0, isTransactionNotFoundError_1.isTransactionNotFoundError)(e))
|
|
261
|
+
console.warn(e);
|
|
262
|
+
else
|
|
263
|
+
throw e;
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
waitForSwapConfirmations({ swap, network, walletId }) {
|
|
268
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
269
|
+
const client = this.getClient(network, walletId, swap.from, swap.fromAccountId);
|
|
270
|
+
try {
|
|
271
|
+
const tx = yield client.chain.getTransactionByHash(swap.swapTxHash);
|
|
272
|
+
if (tx && tx.confirmations && tx.confirmations > 0) {
|
|
273
|
+
const { status } = tx;
|
|
274
|
+
this.updateBalances(network, walletId, [swap.fromAccountId]);
|
|
275
|
+
return {
|
|
276
|
+
endTime: Date.now(),
|
|
277
|
+
status: status === types_1.TxStatus.Success ? 'SUCCESS' : 'FAILED',
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
catch (e) {
|
|
282
|
+
if ((0, isTransactionNotFoundError_1.isTransactionNotFoundError)(e))
|
|
283
|
+
console.warn(e);
|
|
284
|
+
else
|
|
285
|
+
throw e;
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
performNextSwapAction(store, { network, walletId, swap }) {
|
|
290
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
291
|
+
switch (swap.status) {
|
|
292
|
+
case 'WAITING_FOR_APPROVE_CONFIRMATIONS':
|
|
293
|
+
return (0, utils_1.withInterval)(() => tslib_1.__awaiter(this, void 0, void 0, function* () { return this.waitForApproveConfirmations({ swap, network, walletId }); }));
|
|
294
|
+
case 'APPROVE_CONFIRMED':
|
|
295
|
+
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 }); }));
|
|
296
|
+
case 'WAITING_FOR_SWAP_CONFIRMATIONS':
|
|
297
|
+
return (0, utils_1.withInterval)(() => tslib_1.__awaiter(this, void 0, void 0, function* () { return this.waitForSwapConfirmations({ swap, network, walletId }); }));
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
_getStatuses() {
|
|
302
|
+
return {
|
|
303
|
+
WAITING_FOR_APPROVE_CONFIRMATIONS: {
|
|
304
|
+
step: 0,
|
|
305
|
+
label: 'Approving {from}',
|
|
306
|
+
filterStatus: 'PENDING',
|
|
307
|
+
notification(swap) {
|
|
308
|
+
return {
|
|
309
|
+
message: `Approving ${swap.from}`,
|
|
310
|
+
};
|
|
311
|
+
},
|
|
312
|
+
},
|
|
313
|
+
APPROVE_CONFIRMED: {
|
|
314
|
+
step: 1,
|
|
315
|
+
label: 'Swapping {from}',
|
|
316
|
+
filterStatus: 'PENDING',
|
|
317
|
+
},
|
|
318
|
+
WAITING_FOR_SWAP_CONFIRMATIONS: {
|
|
319
|
+
step: 1,
|
|
320
|
+
label: 'Swapping {from}',
|
|
321
|
+
filterStatus: 'PENDING',
|
|
322
|
+
notification() {
|
|
323
|
+
return {
|
|
324
|
+
message: 'Engaging oneinch',
|
|
325
|
+
};
|
|
326
|
+
},
|
|
327
|
+
},
|
|
328
|
+
SUCCESS: {
|
|
329
|
+
step: 2,
|
|
330
|
+
label: 'Completed',
|
|
331
|
+
filterStatus: 'COMPLETED',
|
|
332
|
+
notification(swap) {
|
|
333
|
+
return {
|
|
334
|
+
message: `Swap completed, ${(0, coinFormatter_1.prettyBalance)(swap.toAmount, swap.to)} ${swap.to} ready to use`,
|
|
335
|
+
};
|
|
336
|
+
},
|
|
337
|
+
},
|
|
338
|
+
FAILED: {
|
|
339
|
+
step: 2,
|
|
340
|
+
label: 'Swap Failed',
|
|
341
|
+
filterStatus: 'REFUNDED',
|
|
342
|
+
notification() {
|
|
343
|
+
return {
|
|
344
|
+
message: 'Swap failed',
|
|
345
|
+
};
|
|
346
|
+
},
|
|
347
|
+
},
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
_txTypes() {
|
|
351
|
+
return {
|
|
352
|
+
SWAP: 'SWAP',
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
_fromTxType() {
|
|
356
|
+
return this._txTypes().SWAP;
|
|
357
|
+
}
|
|
358
|
+
_toTxType() {
|
|
359
|
+
return null;
|
|
360
|
+
}
|
|
361
|
+
_timelineDiagramSteps() {
|
|
362
|
+
return ['APPROVE', 'SWAP'];
|
|
363
|
+
}
|
|
364
|
+
_totalSteps() {
|
|
365
|
+
return 3;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
exports.OneinchSwapProvider = OneinchSwapProvider;
|
|
369
|
+
//# sourceMappingURL=OneinchSwapProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OneinchSwapProvider.js","sourceRoot":"","sources":["../../../../src/swaps/oneinch/OneinchSwapProvider.ts"],"names":[],"mappings":";;;;AAAA,2CAAoD;AAEpD,yCAAsD;AACtD,uDAAyF;AACzF,uFAAoF;AACpF,2FAAsD;AACtD,q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AAE,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,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "1inch DEX Aggregator Swaps",
|
|
3
|
+
"description": "Aggregate of popular DEXes",
|
|
4
|
+
"pros": [
|
|
5
|
+
"Ethereum, Polygon, Binance Smart Chain, Avalanche",
|
|
6
|
+
"Best exchange rates",
|
|
7
|
+
"High liquidity",
|
|
8
|
+
"Many pairs",
|
|
9
|
+
"Fast"
|
|
10
|
+
],
|
|
11
|
+
"cons": ["Slippage"],
|
|
12
|
+
"fees": ["Additional aggregator fees", "Slippage (up to 0.5% in Liquality)"]
|
|
13
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { Client } from '@yaswap/client';
|
|
2
|
+
import { EvmChainProvider, EvmTypes } from '@yaswap/evm';
|
|
3
|
+
import { Transaction } from '@yaswap/types';
|
|
4
|
+
import BN from 'bignumber.js';
|
|
5
|
+
import * as ethers from 'ethers';
|
|
6
|
+
import { ActionContext } from '../../store';
|
|
7
|
+
import { Asset, Network, SwapHistoryItem } from '../../store/types';
|
|
8
|
+
import { SwapProvider } from '../SwapProvider';
|
|
9
|
+
import { BaseSwapProviderConfig, EstimateFeeRequest, EstimateFeeResponse, NextSwapActionRequest, QuoteRequest, SwapRequest, SwapStatus } from '../types';
|
|
10
|
+
export interface SovrynSwapProviderConfig extends BaseSwapProviderConfig {
|
|
11
|
+
routerAddress: string;
|
|
12
|
+
routerAddressRBTC: string;
|
|
13
|
+
rpcURL: string;
|
|
14
|
+
}
|
|
15
|
+
export interface SovrynSwapHistoryItem extends SwapHistoryItem {
|
|
16
|
+
approveTxHash: string;
|
|
17
|
+
swapTxHash: string;
|
|
18
|
+
approveTx: Transaction<EvmTypes.EthersTransactionResponse>;
|
|
19
|
+
swapTx: Transaction<EvmTypes.EthersTransactionResponse>;
|
|
20
|
+
}
|
|
21
|
+
declare class SovrynSwapProvider extends SwapProvider {
|
|
22
|
+
config: SovrynSwapProviderConfig;
|
|
23
|
+
_apiCache: {
|
|
24
|
+
[key: number]: ethers.ethers.providers.StaticJsonRpcProvider;
|
|
25
|
+
};
|
|
26
|
+
constructor(config: SovrynSwapProviderConfig);
|
|
27
|
+
getSupportedPairs(): Promise<never[]>;
|
|
28
|
+
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>>;
|
|
29
|
+
getQuote({ network, from, to, amount }: QuoteRequest): Promise<{
|
|
30
|
+
fromAmount: string;
|
|
31
|
+
toAmount: string;
|
|
32
|
+
path: any;
|
|
33
|
+
} | null>;
|
|
34
|
+
newSwap({ network, walletId, quote }: SwapRequest<SovrynSwapHistoryItem>): Promise<{
|
|
35
|
+
status: string;
|
|
36
|
+
approveTx?: undefined;
|
|
37
|
+
approveTxHash?: undefined;
|
|
38
|
+
id: string;
|
|
39
|
+
fee: number;
|
|
40
|
+
slippage: number;
|
|
41
|
+
} | {
|
|
42
|
+
status: string;
|
|
43
|
+
approveTx: Transaction<any>;
|
|
44
|
+
approveTxHash: string;
|
|
45
|
+
id: string;
|
|
46
|
+
fee: number;
|
|
47
|
+
slippage: number;
|
|
48
|
+
} | {
|
|
49
|
+
status: string;
|
|
50
|
+
swapTx: Transaction<any>;
|
|
51
|
+
swapTxHash: string;
|
|
52
|
+
id: string;
|
|
53
|
+
fee: number;
|
|
54
|
+
slippage: number;
|
|
55
|
+
}>;
|
|
56
|
+
requiresApproval({ network, walletId, quote }: SwapRequest<SovrynSwapHistoryItem>): Promise<boolean>;
|
|
57
|
+
buildApprovalTx({ network, walletId, quote }: SwapRequest<SovrynSwapHistoryItem>): Promise<{
|
|
58
|
+
from: string;
|
|
59
|
+
to: string;
|
|
60
|
+
value: BN;
|
|
61
|
+
data: string;
|
|
62
|
+
fee: number;
|
|
63
|
+
}>;
|
|
64
|
+
approveTokens({ network, walletId, quote }: SwapRequest<SovrynSwapHistoryItem>): Promise<{
|
|
65
|
+
status: string;
|
|
66
|
+
approveTx?: undefined;
|
|
67
|
+
approveTxHash?: undefined;
|
|
68
|
+
} | {
|
|
69
|
+
status: string;
|
|
70
|
+
approveTx: Transaction<any>;
|
|
71
|
+
approveTxHash: string;
|
|
72
|
+
}>;
|
|
73
|
+
buildSwapTx({ network, walletId, quote }: SwapRequest<SovrynSwapHistoryItem>): Promise<{
|
|
74
|
+
from: string;
|
|
75
|
+
to: string;
|
|
76
|
+
value: BN;
|
|
77
|
+
data: string;
|
|
78
|
+
fee: number;
|
|
79
|
+
}>;
|
|
80
|
+
sendSwap({ network, walletId, quote }: SwapRequest<SovrynSwapHistoryItem>): Promise<{
|
|
81
|
+
status: string;
|
|
82
|
+
swapTx: Transaction<any>;
|
|
83
|
+
swapTxHash: string;
|
|
84
|
+
}>;
|
|
85
|
+
estimateFees({ network, walletId, asset, txType, quote, feePrices, }: EstimateFeeRequest<string, SovrynSwapHistoryItem>): Promise<EstimateFeeResponse>;
|
|
86
|
+
getMin(_quoteRequest: QuoteRequest): Promise<BN>;
|
|
87
|
+
waitForApproveConfirmations({ swap, network, walletId }: NextSwapActionRequest<SovrynSwapHistoryItem>): Promise<{
|
|
88
|
+
endTime: number;
|
|
89
|
+
status: string;
|
|
90
|
+
} | undefined>;
|
|
91
|
+
waitForSwapConfirmations({ swap, network, walletId }: NextSwapActionRequest<SovrynSwapHistoryItem>): Promise<{
|
|
92
|
+
endTime: number;
|
|
93
|
+
status: string;
|
|
94
|
+
} | undefined>;
|
|
95
|
+
performNextSwapAction(store: ActionContext, { network, walletId, swap }: NextSwapActionRequest<SovrynSwapHistoryItem>): Promise<Partial<{
|
|
96
|
+
endTime: number;
|
|
97
|
+
status: string;
|
|
98
|
+
}> | undefined>;
|
|
99
|
+
_getApi(network: Network, asset: Asset): ethers.ethers.providers.StaticJsonRpcProvider;
|
|
100
|
+
_calculateSlippage(amount: string): string;
|
|
101
|
+
protected _getStatuses(): Record<string, SwapStatus>;
|
|
102
|
+
protected _txTypes(): {
|
|
103
|
+
SWAP: string;
|
|
104
|
+
};
|
|
105
|
+
protected _fromTxType(): string | null;
|
|
106
|
+
protected _toTxType(): string | null;
|
|
107
|
+
protected _timelineDiagramSteps(): string[];
|
|
108
|
+
protected _totalSteps(): number;
|
|
109
|
+
}
|
|
110
|
+
export { SovrynSwapProvider };
|