@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,189 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JupiterSwapProvider = 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 web3_js_1 = require("@solana/web3.js");
|
|
9
|
+
const axios_1 = tslib_1.__importDefault(require("axios"));
|
|
10
|
+
const bignumber_js_1 = tslib_1.__importStar(require("bignumber.js"));
|
|
11
|
+
const uuid_1 = require("uuid");
|
|
12
|
+
const utils_1 = require("../../store/actions/performNextAction/utils");
|
|
13
|
+
const coinFormatter_1 = require("../../utils/coinFormatter");
|
|
14
|
+
const cryptoassets_2 = tslib_1.__importDefault(require("../../utils/cryptoassets"));
|
|
15
|
+
const SwapProvider_1 = require("../SwapProvider");
|
|
16
|
+
const error_parser_1 = require("@yaswap/error-parser");
|
|
17
|
+
const SOL_MINT_ADDRESS = 'So11111111111111111111111111111111111111112';
|
|
18
|
+
class JupiterSwapProvider extends SwapProvider_1.SwapProvider {
|
|
19
|
+
_getStatuses() {
|
|
20
|
+
return {
|
|
21
|
+
WAITING_FOR_SWAP_CONFIRMATIONS: {
|
|
22
|
+
step: 0,
|
|
23
|
+
label: 'Swapping {from}',
|
|
24
|
+
filterStatus: 'PENDING',
|
|
25
|
+
notification() {
|
|
26
|
+
return { message: 'Engaging Astroport' };
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
SUCCESS: {
|
|
30
|
+
step: 1,
|
|
31
|
+
label: 'Completed',
|
|
32
|
+
filterStatus: 'COMPLETED',
|
|
33
|
+
notification(swap) {
|
|
34
|
+
return {
|
|
35
|
+
message: `Swap completed, ${(0, coinFormatter_1.prettyBalance)(new bignumber_js_1.BigNumber(swap.toAmount), swap.to)} ${swap.to} ready to use`,
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
FAILED: {
|
|
40
|
+
step: 1,
|
|
41
|
+
label: 'Swap Failed',
|
|
42
|
+
filterStatus: 'REFUNDED',
|
|
43
|
+
notification() {
|
|
44
|
+
return { message: 'Swap failed' };
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
_txTypes() {
|
|
50
|
+
return {
|
|
51
|
+
SWAP: 'SWAP',
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
_fromTxType() {
|
|
55
|
+
return this._txTypes().SWAP;
|
|
56
|
+
}
|
|
57
|
+
_toTxType() {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
_totalSteps() {
|
|
61
|
+
return 2;
|
|
62
|
+
}
|
|
63
|
+
_timelineDiagramSteps() {
|
|
64
|
+
return ['SWAP'];
|
|
65
|
+
}
|
|
66
|
+
getSupportedPairs() {
|
|
67
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
68
|
+
return [];
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
getQuote(quoteRequest) {
|
|
72
|
+
var _a;
|
|
73
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
74
|
+
const { from, to, amount } = quoteRequest;
|
|
75
|
+
const fromInfo = cryptoassets_2.default[from];
|
|
76
|
+
const toInfo = cryptoassets_2.default[to];
|
|
77
|
+
if (fromInfo.chain !== cryptoassets_1.ChainId.Solana || toInfo.chain !== cryptoassets_1.ChainId.Solana || amount.lt(0)) {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
const fromAddress = fromInfo.contractAddress || SOL_MINT_ADDRESS;
|
|
81
|
+
const toAddress = toInfo.contractAddress || SOL_MINT_ADDRESS;
|
|
82
|
+
const fromAmountInUnit = (0, cryptoassets_1.currencyToUnit)(fromInfo, new bignumber_js_1.default(amount)).toFixed();
|
|
83
|
+
const { data } = yield axios_1.default.get(`https://quote-api.jup.ag/v1/quote?inputMint=${fromAddress}&outputMint=${toAddress}&amount=${fromAmountInUnit}&slippage=0.5&`);
|
|
84
|
+
if (!((_a = data.data) === null || _a === void 0 ? void 0 : _a[0])) {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
const info = data.data[0];
|
|
88
|
+
return {
|
|
89
|
+
from,
|
|
90
|
+
to,
|
|
91
|
+
fromAmount: fromAmountInUnit.toString(),
|
|
92
|
+
toAmount: info.outAmount.toString(),
|
|
93
|
+
info: Object.assign(Object.assign({}, info), { toAddress }),
|
|
94
|
+
};
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
newSwap(quoteInput) {
|
|
98
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
99
|
+
const { network, walletId, quote } = quoteInput;
|
|
100
|
+
const client = this.getClient(network, walletId, quote.from, quote.fromAccountId);
|
|
101
|
+
const connection = client.chain.getProvider();
|
|
102
|
+
const [{ address }] = yield client.wallet.getAddresses();
|
|
103
|
+
const transactions = yield this._getTransactions(quote.info, address);
|
|
104
|
+
let swapTx;
|
|
105
|
+
const txTypes = Object.keys(transactions);
|
|
106
|
+
for (let i = 0; i < txTypes.length; i++) {
|
|
107
|
+
const tx = web3_js_1.Transaction.from(Buffer.from(transactions[txTypes[i]], 'base64'));
|
|
108
|
+
if (txTypes[i] === 'swapTransaction') {
|
|
109
|
+
swapTx = yield client.wallet.sendTransaction({ transaction: tx, value: new bignumber_js_1.default(quote.fromAmount) });
|
|
110
|
+
yield connection.confirmTransaction(swapTx.hash);
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
const transaction = yield client.wallet.sendTransaction({ transaction: tx, value: new bignumber_js_1.default(0) });
|
|
114
|
+
yield connection.confirmTransaction(transaction.hash);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
const updates = {
|
|
118
|
+
status: 'WAITING_FOR_SWAP_CONFIRMATIONS',
|
|
119
|
+
swapTx,
|
|
120
|
+
swapTxHash: swapTx === null || swapTx === void 0 ? void 0 : swapTx.hash,
|
|
121
|
+
};
|
|
122
|
+
return Object.assign({ id: (0, uuid_1.v4)(), fee: quote.fee, slippage: 50 }, updates);
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
estimateFees({ txType, feePrices, asset, network, }) {
|
|
126
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
127
|
+
if (txType != this.fromTxType) {
|
|
128
|
+
throw (0, error_parser_1.createInternalError)(error_parser_1.CUSTOM_ERRORS.Invalid.TransactionType(txType));
|
|
129
|
+
}
|
|
130
|
+
const nativeAsset = (0, cryptoassets_1.getNativeAssetCode)(network, cryptoassets_2.default[asset].chain);
|
|
131
|
+
const gasLimit = 1000000000;
|
|
132
|
+
const fees = {};
|
|
133
|
+
for (const feePrice of feePrices) {
|
|
134
|
+
const fee = new bignumber_js_1.default(gasLimit).times(feePrice);
|
|
135
|
+
fees[feePrice] = new bignumber_js_1.default((0, cryptoassets_1.unitToCurrency)(cryptoassets_2.default[nativeAsset], fee).toFixed());
|
|
136
|
+
}
|
|
137
|
+
return fees;
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
getExtraAmountToExtractFromBalance() {
|
|
141
|
+
return 33333333;
|
|
142
|
+
}
|
|
143
|
+
performNextSwapAction(_store, { network, walletId, swap }) {
|
|
144
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
145
|
+
if (swap.status === 'WAITING_FOR_SWAP_CONFIRMATIONS') {
|
|
146
|
+
return (0, utils_1.withInterval)(() => tslib_1.__awaiter(this, void 0, void 0, function* () { return this.waitForSwapConfirmations({ swap, network, walletId }); }));
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
getMin(_quoteRequest) {
|
|
151
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
152
|
+
return new bignumber_js_1.default(0);
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
waitForSwapConfirmations({ swap, network, walletId }) {
|
|
156
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
157
|
+
const client = this.getClient(network, walletId, swap.from, swap.fromAccountId);
|
|
158
|
+
try {
|
|
159
|
+
const tx = yield client.chain.getTransactionByHash(swap.swapTxHash);
|
|
160
|
+
if (tx && tx.confirmations && tx.confirmations > 0) {
|
|
161
|
+
const { status } = tx;
|
|
162
|
+
this.updateBalances(network, walletId, [swap.from]);
|
|
163
|
+
return {
|
|
164
|
+
endTime: Date.now(),
|
|
165
|
+
status: status === types_1.TxStatus.Success ? 'SUCCESS' : 'FAILED',
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
catch (e) {
|
|
170
|
+
if ((0, isTransactionNotFoundError_1.isTransactionNotFoundError)(e))
|
|
171
|
+
console.warn(e);
|
|
172
|
+
else
|
|
173
|
+
throw e;
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
_getTransactions(route, userPublicKey) {
|
|
178
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
179
|
+
const { data: transactions } = yield axios_1.default.post('https://quote-api.jup.ag/v1/swap', {
|
|
180
|
+
route,
|
|
181
|
+
userPublicKey,
|
|
182
|
+
wrapUnwrapSOL: true,
|
|
183
|
+
});
|
|
184
|
+
return transactions;
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
exports.JupiterSwapProvider = JupiterSwapProvider;
|
|
189
|
+
//# sourceMappingURL=JupiterSwapProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JupiterSwapProvider.js","sourceRoot":"","sources":["../../../../src/swaps/jupiter/JupiterSwapProvider.ts"],"names":[],"mappings":";;;;AAAA,yCAAyC;AACzC,uDAAmG;AACnG,uFAAoF;AACpF,6CAA8C;AAC9C,0DAA0B;AAC1B,qEAA6C;AAC7C,+BAAoC;AAEpC,uEAA2E;AAE3E,6DAA0D;AAC1D,oFAAoD;AACpD,kDAA+C;AAS/C,uDAA0E;AAE1E,MAAM,gBAAgB,GAAG,6CAA6C,CAAC;AAKvE,MAAM,mBAAoB,SAAQ,2BAAY;IAClC,YAAY;QACpB,OAAO;YACL,8BAA8B,EAAE;gBAC9B,IAAI,EAAE,CAAC;gBACP,KAAK,EAAE,iBAAiB;gBACxB,YAAY,EAAE,SAAS;gBACvB,YAAY;oBACV,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,CAAC;gBAC3C,CAAC;aACF;YACD,OAAO,EAAE;gBACP,IAAI,EAAE,CAAC;gBACP,KAAK,EAAE,WAAW;gBAClB,YAAY,EAAE,WAAW;gBACzB,YAAY,CAAC,IAAqB;oBAChC,OAAO;wBACL,OAAO,EAAE,mBAAmB,IAAA,6BAAa,EAAC,IAAI,wBAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,EAA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AC,UAAU,CAAC,CAAC;gBACpE,IAAI,EAAE,IAAI,EAAE,CAAC,aAAa,IAAI,EAAE,CAAC,aAAa,GAAG,CAAC,EAAE;oBAClD,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;oBACtB,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,QAAQ,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;oBAEpD,OAAO;wBACL,OAAO,EAAE,IAAI,CAAC,GAAG,EAAE;wBACnB,MAAM,EAAE,MAAM,KAAK,gBAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ;qBAC3D,CAAC;iBACH;aACF;YAAC,OAAO,CAAC,EAAE;gBACV,IAAI,IAAA,uDAA0B,EAAC,CAAC,CAAC;oBAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;;oBAC9C,MAAM,CAAC,CAAC;aACd;QACH,CAAC;KAAA;IACa,gBAAgB,CAAC,KAAa,EAAE,aAAqB;;YACjE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,MAAM,eAAK,CAAC,IAAI,CAAC,kCAAkC,EAAE;gBAClF,KAAK;gBACL,aAAa;gBACb,aAAa,EAAE,IAAI;aACpB,CAAC,CAAC;YAEH,OAAO,YAAY,CAAC;QACtB,CAAC;KAAA;CACF;AAEQ,kDAAmB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "Jupiter AMM Swaps",
|
|
3
|
+
"description": "Decentralized, permissionless and open-source, Jupiter marketplace is a public good governed by its community of token holders",
|
|
4
|
+
"pros": ["Low liquidity provider fee", "Margin Trading"],
|
|
5
|
+
"cons": ["Slippage"],
|
|
6
|
+
"fees": ["0.15% liquidity provider fee", "Slippage (up to 0.5% in Liquality)"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { EvmTypes } from '@yaswap/evm';
|
|
2
|
+
import { Transaction } from '@yaswap/types';
|
|
3
|
+
import { Order, Step } from '@lifi/sdk';
|
|
4
|
+
import BN from 'bignumber.js';
|
|
5
|
+
import { ActionContext } from '../../store';
|
|
6
|
+
import { EvmSwapHistoryItem, EvmSwapProvider, EvmSwapProviderConfig } from '../EvmSwapProvider';
|
|
7
|
+
import { EstimateFeeRequest, EstimateFeeResponse, NextSwapActionRequest, QuoteRequest, SwapRequest, SwapStatus } from '../types';
|
|
8
|
+
export interface LifiSwapProviderConfig extends EvmSwapProviderConfig {
|
|
9
|
+
apiURL: string;
|
|
10
|
+
slippage?: number;
|
|
11
|
+
order?: Order;
|
|
12
|
+
}
|
|
13
|
+
export interface LifiSwapHistoryItem extends EvmSwapHistoryItem {
|
|
14
|
+
fromFundHash: string;
|
|
15
|
+
fromFundTx: Transaction<EvmTypes.EthersTransactionResponse>;
|
|
16
|
+
}
|
|
17
|
+
export { Action as LifiToolAction, QuoteRequest as LifiQuoteRequest } from '@lifi/sdk';
|
|
18
|
+
declare class LifiSwapProvider extends EvmSwapProvider {
|
|
19
|
+
readonly config: LifiSwapProviderConfig;
|
|
20
|
+
readonly nativeAssetAddress = "0x0000000000000000000000000000000000000000";
|
|
21
|
+
private readonly _lifiClient;
|
|
22
|
+
private readonly _httpClient;
|
|
23
|
+
constructor(config: LifiSwapProviderConfig);
|
|
24
|
+
getSupportedPairs(): Promise<never[]>;
|
|
25
|
+
getQuote({ network, from, to, amount, fromAccountId, toAccountId, walletId }: QuoteRequest): Promise<{
|
|
26
|
+
from: string;
|
|
27
|
+
to: string;
|
|
28
|
+
fromAmount: string;
|
|
29
|
+
toAmount: string;
|
|
30
|
+
lifiRoute: Step;
|
|
31
|
+
} | null>;
|
|
32
|
+
newSwap(swap: SwapRequest<LifiSwapHistoryItem>): Promise<{
|
|
33
|
+
status: string;
|
|
34
|
+
approveTx: Transaction<any>;
|
|
35
|
+
approveTxHash: string;
|
|
36
|
+
id: string;
|
|
37
|
+
} | {
|
|
38
|
+
status: string;
|
|
39
|
+
approveTx?: undefined;
|
|
40
|
+
approveTxHash?: undefined;
|
|
41
|
+
id: string;
|
|
42
|
+
} | {
|
|
43
|
+
status: string;
|
|
44
|
+
fromFundTx: Transaction<any>;
|
|
45
|
+
fromFundHash: string;
|
|
46
|
+
id: string;
|
|
47
|
+
}>;
|
|
48
|
+
private initiateSwap;
|
|
49
|
+
estimateFees(feeRequest: EstimateFeeRequest<string, LifiSwapHistoryItem>): Promise<EstimateFeeResponse | null>;
|
|
50
|
+
getMin(_quoteRequest: QuoteRequest): Promise<BN>;
|
|
51
|
+
private getCrossChainSwapStatus;
|
|
52
|
+
private getChainNameByChainID;
|
|
53
|
+
private isCrossSwap;
|
|
54
|
+
private getRoute;
|
|
55
|
+
waitForInitiationConfirmations({ swap, network, walletId }: NextSwapActionRequest<LifiSwapHistoryItem>): Promise<{
|
|
56
|
+
endTime: number;
|
|
57
|
+
status: string;
|
|
58
|
+
} | undefined>;
|
|
59
|
+
waitForReceiveConfirmations({ swap, network, walletId }: NextSwapActionRequest<LifiSwapHistoryItem>): Promise<{
|
|
60
|
+
endTime: number;
|
|
61
|
+
status: string;
|
|
62
|
+
} | undefined>;
|
|
63
|
+
performNextSwapAction(store: ActionContext, { network, walletId, swap }: NextSwapActionRequest<LifiSwapHistoryItem>): Promise<Partial<{
|
|
64
|
+
endTime: number;
|
|
65
|
+
status: string;
|
|
66
|
+
}> | undefined>;
|
|
67
|
+
protected _getStatuses(): Record<string, SwapStatus>;
|
|
68
|
+
protected _txTypes(): {
|
|
69
|
+
SWAP: string;
|
|
70
|
+
};
|
|
71
|
+
protected _fromTxType(): string | null;
|
|
72
|
+
protected _toTxType(): string | null;
|
|
73
|
+
protected _timelineDiagramSteps(): string[];
|
|
74
|
+
protected _totalSteps(): number;
|
|
75
|
+
}
|
|
76
|
+
export { LifiSwapProvider };
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LifiSwapProvider = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const client_1 = require("@yaswap/client");
|
|
6
|
+
const types_1 = require("@yaswap/types");
|
|
7
|
+
const sdk_1 = tslib_1.__importStar(require("@lifi/sdk"));
|
|
8
|
+
const cryptoassets_1 = require("@yaswap/cryptoassets");
|
|
9
|
+
const error_parser_1 = require("@yaswap/error-parser");
|
|
10
|
+
const bignumber_js_1 = tslib_1.__importDefault(require("bignumber.js"));
|
|
11
|
+
const ethers_1 = require("ethers");
|
|
12
|
+
const uuid_1 = require("uuid");
|
|
13
|
+
const utils_1 = require("../../store/actions/performNextAction/utils");
|
|
14
|
+
const coinFormatter_1 = require("../../utils/coinFormatter");
|
|
15
|
+
const cryptoassets_2 = tslib_1.__importDefault(require("../../utils/cryptoassets"));
|
|
16
|
+
const EvmSwapProvider_1 = require("../EvmSwapProvider");
|
|
17
|
+
class LifiSwapProvider extends EvmSwapProvider_1.EvmSwapProvider {
|
|
18
|
+
constructor(config) {
|
|
19
|
+
var _a, _b;
|
|
20
|
+
super(config);
|
|
21
|
+
this.nativeAssetAddress = ethers_1.ethers.constants.AddressZero;
|
|
22
|
+
const lifiConfig = {
|
|
23
|
+
defaultRouteOptions: {
|
|
24
|
+
slippage: (_a = config.slippage) !== null && _a !== void 0 ? _a : 0.05,
|
|
25
|
+
order: (_b = config.order) !== null && _b !== void 0 ? _b : sdk_1.Orders[0],
|
|
26
|
+
integrator: 'Liquality Wallet',
|
|
27
|
+
bridges: {
|
|
28
|
+
deny: ['connext'],
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
this._httpClient = new client_1.HttpClient({ baseURL: this.config.apiURL });
|
|
33
|
+
this._lifiClient = new sdk_1.default(lifiConfig);
|
|
34
|
+
}
|
|
35
|
+
getSupportedPairs() {
|
|
36
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
return [];
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
getQuote({ network, from, to, amount, fromAccountId, toAccountId, walletId }) {
|
|
41
|
+
var _a, _b, _c;
|
|
42
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
const fromInfo = cryptoassets_2.default[from];
|
|
44
|
+
const toInfo = cryptoassets_2.default[to];
|
|
45
|
+
const fromAmountInUnit = (0, cryptoassets_1.currencyToUnit)(fromInfo, new bignumber_js_1.default(amount)).toString(10);
|
|
46
|
+
const fromChainId = (0, cryptoassets_1.getChain)(network, fromInfo.chain).network.chainId;
|
|
47
|
+
const toChainId = (0, cryptoassets_1.getChain)(network, toInfo.chain).network.chainId;
|
|
48
|
+
const fromAddressRaw = yield this.getSwapAddress(network, walletId, from, fromAccountId);
|
|
49
|
+
const toAddressRaw = yield this.getSwapAddress(network, walletId, to, toAccountId);
|
|
50
|
+
const quoteRequest = {
|
|
51
|
+
fromChain: fromChainId,
|
|
52
|
+
fromAmount: fromAmountInUnit,
|
|
53
|
+
fromToken: (_a = fromInfo.contractAddress) !== null && _a !== void 0 ? _a : this.nativeAssetAddress,
|
|
54
|
+
toChain: toChainId,
|
|
55
|
+
toToken: (_b = toInfo.contractAddress) !== null && _b !== void 0 ? _b : this.nativeAssetAddress,
|
|
56
|
+
fromAddress: (0, cryptoassets_1.getChain)(network, fromInfo.chain).formatAddress(fromAddressRaw),
|
|
57
|
+
toAddress: (0, cryptoassets_1.getChain)(network, toInfo.chain).formatAddress(toAddressRaw),
|
|
58
|
+
order: this._lifiClient.getConfig().defaultRouteOptions.order,
|
|
59
|
+
slippage: this._lifiClient.getConfig().defaultRouteOptions.slippage,
|
|
60
|
+
integrator: this._lifiClient.getConfig().defaultRouteOptions.integrator,
|
|
61
|
+
denyBridges: (_c = this._lifiClient.getConfig().defaultRouteOptions.bridges) === null || _c === void 0 ? void 0 : _c.deny,
|
|
62
|
+
};
|
|
63
|
+
try {
|
|
64
|
+
const parser = (0, error_parser_1.getErrorParser)(error_parser_1.LifiQuoteErrorParser);
|
|
65
|
+
const lifiRoute = (yield parser.wrapAsync(() => tslib_1.__awaiter(this, void 0, void 0, function* () { return yield this._lifiClient.getQuote(quoteRequest); }), {
|
|
66
|
+
fromToken: quoteRequest.fromToken,
|
|
67
|
+
toToken: quoteRequest.toToken,
|
|
68
|
+
fromAmount: quoteRequest.fromAmount,
|
|
69
|
+
}));
|
|
70
|
+
return { from, to, fromAmount: fromAmountInUnit, toAmount: lifiRoute.estimate.toAmount, lifiRoute };
|
|
71
|
+
}
|
|
72
|
+
catch (e) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
newSwap(swap) {
|
|
78
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
79
|
+
const route = this.getRoute(swap.quote);
|
|
80
|
+
const approvalAddress = route.estimate.approvalAddress;
|
|
81
|
+
const approveTx = yield this.approve(swap, false, approvalAddress);
|
|
82
|
+
let updates;
|
|
83
|
+
if (approveTx) {
|
|
84
|
+
updates = approveTx;
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
updates = yield this.initiateSwap(swap);
|
|
88
|
+
}
|
|
89
|
+
return Object.assign({ id: (0, uuid_1.v4)() }, updates);
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
initiateSwap({ network, walletId, quote }) {
|
|
93
|
+
const _super = Object.create(null, {
|
|
94
|
+
getClient: { get: () => super.getClient }
|
|
95
|
+
});
|
|
96
|
+
var _a;
|
|
97
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
98
|
+
const route = this.getRoute(quote);
|
|
99
|
+
const client = _super.getClient.call(this, network, walletId, quote.from, quote.fromAccountId);
|
|
100
|
+
const txData = route.transactionRequest;
|
|
101
|
+
let gasLimit = txData.gasLimit;
|
|
102
|
+
const chainName = (_a = cryptoassets_2.default[quote.from]) === null || _a === void 0 ? void 0 : _a.chain;
|
|
103
|
+
if (chainName === cryptoassets_1.ChainId.Arbitrum && (0, bignumber_js_1.default)(gasLimit || 0).lt(9000000)) {
|
|
104
|
+
gasLimit = 9000000;
|
|
105
|
+
}
|
|
106
|
+
const fromFundTx = yield client.wallet.sendTransaction({
|
|
107
|
+
data: txData.data,
|
|
108
|
+
to: txData.to,
|
|
109
|
+
value: txData.value,
|
|
110
|
+
gasLimit,
|
|
111
|
+
fee: quote.fee,
|
|
112
|
+
});
|
|
113
|
+
return {
|
|
114
|
+
status: 'WAITING_FOR_INITIATION_CONFIRMATIONS',
|
|
115
|
+
fromFundTx,
|
|
116
|
+
fromFundHash: fromFundTx.hash,
|
|
117
|
+
};
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
estimateFees(feeRequest) {
|
|
121
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
122
|
+
const route = this.getRoute(feeRequest.quote);
|
|
123
|
+
if (feeRequest.txType in this._txTypes()) {
|
|
124
|
+
const fees = {};
|
|
125
|
+
const client = this.getClient(feeRequest.network, feeRequest.walletId, feeRequest.quote.from, feeRequest.quote.fromAccountId);
|
|
126
|
+
const approvalData = yield this.buildApprovalTx(feeRequest, false, route.estimate.approvalAddress);
|
|
127
|
+
let approvalGas = 0;
|
|
128
|
+
if (approvalData) {
|
|
129
|
+
approvalGas = (yield client.chain.getProvider().estimateGas(Object.assign(Object.assign({}, approvalData), { fee: feeRequest.quote.fee }))).toNumber();
|
|
130
|
+
}
|
|
131
|
+
const txData = route.transactionRequest;
|
|
132
|
+
let txGas = 0;
|
|
133
|
+
try {
|
|
134
|
+
txGas = (yield client.chain.getProvider().estimateGas({
|
|
135
|
+
data: txData === null || txData === void 0 ? void 0 : txData.data,
|
|
136
|
+
to: txData === null || txData === void 0 ? void 0 : txData.to,
|
|
137
|
+
from: txData === null || txData === void 0 ? void 0 : txData.from,
|
|
138
|
+
value: txData === null || txData === void 0 ? void 0 : txData.value,
|
|
139
|
+
fee: feeRequest.quote.fee,
|
|
140
|
+
})).toNumber();
|
|
141
|
+
}
|
|
142
|
+
catch (_a) {
|
|
143
|
+
txGas = txData === null || txData === void 0 ? void 0 : txData.gasLimit;
|
|
144
|
+
}
|
|
145
|
+
const nativeAsset = (0, cryptoassets_1.getChain)(feeRequest.network, cryptoassets_2.default[feeRequest.quote.from].chain).nativeAsset[0];
|
|
146
|
+
for (const feePrice of feeRequest.feePrices) {
|
|
147
|
+
const gasPrice = new bignumber_js_1.default(feePrice).times(1e9);
|
|
148
|
+
const fee = new bignumber_js_1.default(approvalGas).plus(txGas).times(1.1).times(gasPrice);
|
|
149
|
+
fees[feePrice] = (0, cryptoassets_1.unitToCurrency)(nativeAsset, fee);
|
|
150
|
+
}
|
|
151
|
+
return fees;
|
|
152
|
+
}
|
|
153
|
+
return null;
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
getMin(_quoteRequest) {
|
|
157
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
158
|
+
return new bignumber_js_1.default(0);
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
getCrossChainSwapStatus(quote) {
|
|
162
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
163
|
+
const route = this.getRoute(quote);
|
|
164
|
+
const result = yield this._httpClient.nodeGet('/status', {
|
|
165
|
+
bridge: route.tool,
|
|
166
|
+
fromChain: this.getChainNameByChainID(route.action.fromChainId),
|
|
167
|
+
toChain: this.getChainNameByChainID(route.action.toChainId),
|
|
168
|
+
txHash: quote.fromFundHash,
|
|
169
|
+
});
|
|
170
|
+
return result;
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
getChainNameByChainID(id) {
|
|
174
|
+
const indexOfChainId = Object.values(sdk_1.ChainId).indexOf(id);
|
|
175
|
+
return Object.keys(sdk_1.ChainId)[indexOfChainId];
|
|
176
|
+
}
|
|
177
|
+
isCrossSwap(swap) {
|
|
178
|
+
const route = this.getRoute(swap);
|
|
179
|
+
switch (route.type) {
|
|
180
|
+
case 'swap':
|
|
181
|
+
return false;
|
|
182
|
+
case 'cross':
|
|
183
|
+
return true;
|
|
184
|
+
case 'lifi':
|
|
185
|
+
return route.includedSteps.reduce((acc, action) => action.type === 'cross' || acc, false);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
getRoute(quote) {
|
|
189
|
+
if (!quote.lifiRoute) {
|
|
190
|
+
throw new Error(`LiFiSwapProvider: best route doesn't exist`);
|
|
191
|
+
}
|
|
192
|
+
return quote.lifiRoute;
|
|
193
|
+
}
|
|
194
|
+
waitForInitiationConfirmations({ swap, network, walletId }) {
|
|
195
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
196
|
+
const client = this.getClient(network, walletId, swap.from, swap.fromAccountId);
|
|
197
|
+
try {
|
|
198
|
+
const tx = yield client.chain.getTransactionByHash(swap.fromFundHash);
|
|
199
|
+
if (tx && tx.confirmations && tx.confirmations > 0) {
|
|
200
|
+
const { status } = tx;
|
|
201
|
+
this.updateBalances(network, walletId, [swap.fromAccountId]);
|
|
202
|
+
if (status === types_1.TxStatus.Success && this.isCrossSwap(swap)) {
|
|
203
|
+
return {
|
|
204
|
+
endTime: Date.now(),
|
|
205
|
+
status: 'WAITING_FOR_RECEIVE_CONFIRMATIONS',
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
return {
|
|
209
|
+
endTime: Date.now(),
|
|
210
|
+
status: status === types_1.TxStatus.Success ? 'SUCCESS' : 'FAILED',
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
catch (e) {
|
|
215
|
+
if (e.name === 'TxNotFoundError') {
|
|
216
|
+
console.warn(e);
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
throw e;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
waitForReceiveConfirmations({ swap, network, walletId }) {
|
|
225
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
226
|
+
try {
|
|
227
|
+
const result = yield this.getCrossChainSwapStatus(swap);
|
|
228
|
+
if (result.status === 'DONE' || result.status === 'FAILED') {
|
|
229
|
+
this.updateBalances(network, walletId, [swap.toAccountId]);
|
|
230
|
+
return {
|
|
231
|
+
endTime: Date.now(),
|
|
232
|
+
status: result.status === 'DONE' ? 'SUCCESS' : 'FAILED',
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
catch (e) {
|
|
237
|
+
console.warn('LifiSwapProvider: ', e);
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
performNextSwapAction(store, { network, walletId, swap }) {
|
|
242
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
243
|
+
switch (swap.status) {
|
|
244
|
+
case 'WAITING_FOR_APPROVE_CONFIRMATIONS':
|
|
245
|
+
return (0, utils_1.withInterval)(() => tslib_1.__awaiter(this, void 0, void 0, function* () { return this.waitForApproveConfirmations({ swap, network, walletId }); }));
|
|
246
|
+
case 'APPROVE_CONFIRMED':
|
|
247
|
+
return (0, utils_1.withLock)(store, { item: swap, network, walletId, asset: swap.from }, () => tslib_1.__awaiter(this, void 0, void 0, function* () { return this.initiateSwap({ quote: swap, network, walletId }); }));
|
|
248
|
+
case 'WAITING_FOR_INITIATION_CONFIRMATIONS':
|
|
249
|
+
return (0, utils_1.withInterval)(() => tslib_1.__awaiter(this, void 0, void 0, function* () { return this.waitForInitiationConfirmations({ swap, network, walletId }); }));
|
|
250
|
+
case 'WAITING_FOR_RECEIVE_CONFIRMATIONS':
|
|
251
|
+
return yield (0, utils_1.withInterval)(() => tslib_1.__awaiter(this, void 0, void 0, function* () { return this.waitForReceiveConfirmations({ swap, network, walletId }); }));
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
_getStatuses() {
|
|
256
|
+
return Object.assign(Object.assign({}, super._getStatuses()), { WAITING_FOR_INITIATION_CONFIRMATIONS: {
|
|
257
|
+
step: 1,
|
|
258
|
+
label: 'Swapping {from}',
|
|
259
|
+
filterStatus: 'PENDING',
|
|
260
|
+
notification() {
|
|
261
|
+
return {
|
|
262
|
+
message: 'Engaging LiFi',
|
|
263
|
+
};
|
|
264
|
+
},
|
|
265
|
+
}, WAITING_FOR_RECEIVE_CONFIRMATIONS: {
|
|
266
|
+
step: 2,
|
|
267
|
+
label: 'Swapping {to}',
|
|
268
|
+
filterStatus: 'PENDING',
|
|
269
|
+
notification() {
|
|
270
|
+
return {
|
|
271
|
+
message: 'Engaging LiFi',
|
|
272
|
+
};
|
|
273
|
+
},
|
|
274
|
+
}, SUCCESS: {
|
|
275
|
+
step: 3,
|
|
276
|
+
label: 'Completed',
|
|
277
|
+
filterStatus: 'COMPLETED',
|
|
278
|
+
notification(swap) {
|
|
279
|
+
return {
|
|
280
|
+
message: `Swap completed, ${(0, coinFormatter_1.prettyBalance)(swap.toAmount, swap.to)} ${swap.to} ready to use`,
|
|
281
|
+
};
|
|
282
|
+
},
|
|
283
|
+
}, FAILED: {
|
|
284
|
+
step: 3,
|
|
285
|
+
label: 'Swap Failed',
|
|
286
|
+
filterStatus: 'REFUNDED',
|
|
287
|
+
notification() {
|
|
288
|
+
return {
|
|
289
|
+
message: 'Swap failed',
|
|
290
|
+
};
|
|
291
|
+
},
|
|
292
|
+
} });
|
|
293
|
+
}
|
|
294
|
+
_txTypes() {
|
|
295
|
+
return {
|
|
296
|
+
SWAP: 'SWAP',
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
_fromTxType() {
|
|
300
|
+
return this._txTypes().SWAP;
|
|
301
|
+
}
|
|
302
|
+
_toTxType() {
|
|
303
|
+
return null;
|
|
304
|
+
}
|
|
305
|
+
_timelineDiagramSteps() {
|
|
306
|
+
return ['APPROVE', 'INITIATION', 'RECEIVE'];
|
|
307
|
+
}
|
|
308
|
+
_totalSteps() {
|
|
309
|
+
return 4;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
exports.LifiSwapProvider = LifiSwapProvider;
|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