@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.SovrynSwapProvider = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const abiSovrynSwapNetwork_json_1 = tslib_1.__importDefault(require("@blobfishkate/sovryncontracts/abi/abiSovrynSwapNetwork.json"));
|
|
6
|
+
const abiWrapperProxy_new_json_1 = tslib_1.__importDefault(require("@blobfishkate/sovryncontracts/abi/abiWrapperProxy_new.json"));
|
|
7
|
+
const contracts_mainnet_json_1 = tslib_1.__importDefault(require("@blobfishkate/sovryncontracts/contracts-mainnet.json"));
|
|
8
|
+
const contracts_testnet_json_1 = tslib_1.__importDefault(require("@blobfishkate/sovryncontracts/contracts-testnet.json"));
|
|
9
|
+
const types_1 = require("@yaswap/types");
|
|
10
|
+
const cryptoassets_1 = require("@yaswap/cryptoassets");
|
|
11
|
+
const isTransactionNotFoundError_1 = require("../../utils/isTransactionNotFoundError");
|
|
12
|
+
const ERC20_json_1 = tslib_1.__importDefault(require("@uniswap/v2-core/build/ERC20.json"));
|
|
13
|
+
const bignumber_js_1 = tslib_1.__importDefault(require("bignumber.js"));
|
|
14
|
+
const ethers = tslib_1.__importStar(require("ethers"));
|
|
15
|
+
const uuid_1 = require("uuid");
|
|
16
|
+
const utils_1 = require("../../store/actions/performNextAction/utils");
|
|
17
|
+
const asset_1 = require("../../utils/asset");
|
|
18
|
+
const chainify_1 = require("../../utils/chainify");
|
|
19
|
+
const coinFormatter_1 = require("../../utils/coinFormatter");
|
|
20
|
+
const cryptoassets_2 = tslib_1.__importDefault(require("../../utils/cryptoassets"));
|
|
21
|
+
const SwapProvider_1 = require("../SwapProvider");
|
|
22
|
+
const error_parser_1 = require("@yaswap/error-parser");
|
|
23
|
+
const wrappedRbtcAddress = {
|
|
24
|
+
mainnet: contracts_mainnet_json_1.default.BTC_token,
|
|
25
|
+
testnet: contracts_testnet_json_1.default.BTC_token,
|
|
26
|
+
};
|
|
27
|
+
class SovrynSwapProvider extends SwapProvider_1.SwapProvider {
|
|
28
|
+
constructor(config) {
|
|
29
|
+
super(config);
|
|
30
|
+
this._apiCache = {};
|
|
31
|
+
}
|
|
32
|
+
getSupportedPairs() {
|
|
33
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
return [];
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
getClient(network, walletId, asset, accountId) {
|
|
38
|
+
return super.getClient(network, walletId, asset, accountId);
|
|
39
|
+
}
|
|
40
|
+
getQuote({ network, from, to, amount }) {
|
|
41
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
const fromInfo = cryptoassets_2.default[from];
|
|
43
|
+
const toInfo = cryptoassets_2.default[to];
|
|
44
|
+
if (fromInfo.chain !== cryptoassets_1.ChainId.Rootstock || toInfo.chain !== cryptoassets_1.ChainId.Rootstock || amount.lte(0)) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
const fromTokenAddress = (fromInfo.contractAddress || wrappedRbtcAddress[network]).toLowerCase();
|
|
48
|
+
const toTokenAddress = (toInfo.contractAddress || wrappedRbtcAddress[network]).toLowerCase();
|
|
49
|
+
const fromAmountInUnit = (0, cryptoassets_1.currencyToUnit)(fromInfo, new bignumber_js_1.default(amount)).toFixed();
|
|
50
|
+
const ssnContract = new ethers.Contract(this.config.routerAddress.toLowerCase(), abiSovrynSwapNetwork_json_1.default, this._getApi(network, from));
|
|
51
|
+
const path = yield ssnContract.conversionPath(fromTokenAddress, toTokenAddress);
|
|
52
|
+
const rate = yield ssnContract.rateByPath(path, fromAmountInUnit);
|
|
53
|
+
return {
|
|
54
|
+
fromAmount: fromAmountInUnit,
|
|
55
|
+
toAmount: rate.toString(),
|
|
56
|
+
path: path,
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
newSwap({ network, walletId, quote }) {
|
|
61
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
const approvalRequired = (0, asset_1.isERC20)(quote.from);
|
|
63
|
+
const updates = approvalRequired
|
|
64
|
+
? yield this.approveTokens({ network, walletId, quote })
|
|
65
|
+
: yield this.sendSwap({ network, walletId, quote });
|
|
66
|
+
return Object.assign({ id: (0, uuid_1.v4)(), fee: quote.fee, slippage: 50 }, updates);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
requiresApproval({ network, walletId, quote }) {
|
|
70
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
if (!(0, asset_1.isERC20)(quote.from))
|
|
72
|
+
return false;
|
|
73
|
+
const fromInfo = cryptoassets_2.default[quote.from];
|
|
74
|
+
const toInfo = cryptoassets_2.default[quote.to];
|
|
75
|
+
const erc20 = new ethers.Contract(fromInfo.contractAddress.toLowerCase(), ERC20_json_1.default.abi, this._getApi(network, quote.from));
|
|
76
|
+
const fromAddressRaw = yield this.getSwapAddress(network, walletId, quote.from, quote.fromAccountId);
|
|
77
|
+
const fromAddress = (0, cryptoassets_1.getChain)(network, fromInfo.chain).formatAddress(fromAddressRaw);
|
|
78
|
+
const spender = (fromInfo.type === cryptoassets_1.AssetTypes.native || toInfo.type === cryptoassets_1.AssetTypes.native
|
|
79
|
+
? this.config.routerAddressRBTC
|
|
80
|
+
: this.config.routerAddress).toLowerCase();
|
|
81
|
+
const allowance = yield erc20.allowance(fromAddress.toLowerCase(), spender);
|
|
82
|
+
const inputAmount = ethers.BigNumber.from(new bignumber_js_1.default(quote.fromAmount).toFixed());
|
|
83
|
+
if (allowance.gte(inputAmount)) {
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
return true;
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
buildApprovalTx({ network, walletId, quote }) {
|
|
90
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
91
|
+
const fromInfo = (0, chainify_1.assetsAdapter)(quote.from)[0];
|
|
92
|
+
const toInfo = cryptoassets_2.default[quote.to];
|
|
93
|
+
const erc20 = new ethers.Contract(String(fromInfo.contractAddress), ERC20_json_1.default.abi, this._getApi(network, quote.from));
|
|
94
|
+
const inputAmount = ethers.BigNumber.from(new bignumber_js_1.default(quote.fromAmount).toFixed());
|
|
95
|
+
const inputAmountHex = inputAmount.toHexString();
|
|
96
|
+
const spender = (fromInfo.type === cryptoassets_1.AssetTypes.native || toInfo.type === cryptoassets_1.AssetTypes.native
|
|
97
|
+
? this.config.routerAddressRBTC
|
|
98
|
+
: this.config.routerAddress).toLowerCase();
|
|
99
|
+
const encodedData = erc20.interface.encodeFunctionData('approve', [spender, inputAmountHex]);
|
|
100
|
+
const fromChain = fromInfo.chain;
|
|
101
|
+
const fromAddressRaw = yield this.getSwapAddress(network, walletId, quote.from, quote.fromAccountId);
|
|
102
|
+
const fromAddress = (0, cryptoassets_1.getChain)(network, fromChain).formatAddress(fromAddressRaw);
|
|
103
|
+
return {
|
|
104
|
+
from: fromAddress,
|
|
105
|
+
to: String(fromInfo.contractAddress),
|
|
106
|
+
value: new bignumber_js_1.default(0),
|
|
107
|
+
data: encodedData,
|
|
108
|
+
fee: quote.fee,
|
|
109
|
+
};
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
approveTokens({ network, walletId, quote }) {
|
|
113
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
114
|
+
const requiresApproval = yield this.requiresApproval({
|
|
115
|
+
network,
|
|
116
|
+
walletId,
|
|
117
|
+
quote,
|
|
118
|
+
});
|
|
119
|
+
if (!requiresApproval) {
|
|
120
|
+
return {
|
|
121
|
+
status: 'APPROVE_CONFIRMED',
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
const txData = yield this.buildApprovalTx({ network, walletId, quote });
|
|
125
|
+
const client = this.getClient(network, walletId, quote.from, quote.fromAccountId);
|
|
126
|
+
const approveTx = yield client.wallet.sendTransaction(txData);
|
|
127
|
+
return {
|
|
128
|
+
status: 'WAITING_FOR_APPROVE_CONFIRMATIONS',
|
|
129
|
+
approveTx,
|
|
130
|
+
approveTxHash: approveTx.hash,
|
|
131
|
+
};
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
buildSwapTx({ network, walletId, quote }) {
|
|
135
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
136
|
+
const fromInfo = cryptoassets_2.default[quote.from];
|
|
137
|
+
const toInfo = cryptoassets_2.default[quote.to];
|
|
138
|
+
const api = this._getApi(network, quote.from);
|
|
139
|
+
const conversionPath = quote.path;
|
|
140
|
+
const toAmountWithSlippage = this._calculateSlippage(quote.toAmount).toString();
|
|
141
|
+
let encodedData;
|
|
142
|
+
let routerAddress;
|
|
143
|
+
if (fromInfo.type === cryptoassets_1.AssetTypes.native || toInfo.type === cryptoassets_1.AssetTypes.native) {
|
|
144
|
+
routerAddress = this.config.routerAddressRBTC.toLowerCase();
|
|
145
|
+
const wpContract = new ethers.Contract(routerAddress, abiWrapperProxy_new_json_1.default, api);
|
|
146
|
+
encodedData = wpContract.interface.encodeFunctionData('convertByPath', [
|
|
147
|
+
conversionPath,
|
|
148
|
+
quote.fromAmount,
|
|
149
|
+
toAmountWithSlippage,
|
|
150
|
+
]);
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
routerAddress = this.config.routerAddress.toLowerCase();
|
|
154
|
+
const ssnContract = new ethers.Contract(routerAddress, abiSovrynSwapNetwork_json_1.default, api);
|
|
155
|
+
encodedData = ssnContract.interface.encodeFunctionData('convertByPath', [
|
|
156
|
+
conversionPath,
|
|
157
|
+
quote.fromAmount,
|
|
158
|
+
toAmountWithSlippage,
|
|
159
|
+
'0x0000000000000000000000000000000000000000',
|
|
160
|
+
'0x0000000000000000000000000000000000000000',
|
|
161
|
+
0,
|
|
162
|
+
]);
|
|
163
|
+
}
|
|
164
|
+
const value = (0, asset_1.isERC20)(quote.from) ? new bignumber_js_1.default(0) : new bignumber_js_1.default(quote.fromAmount);
|
|
165
|
+
const fromAddressRaw = yield this.getSwapAddress(network, walletId, quote.from, quote.fromAccountId);
|
|
166
|
+
const fromAddress = (0, cryptoassets_1.getChain)(network, fromInfo.chain).formatAddress(fromAddressRaw);
|
|
167
|
+
return {
|
|
168
|
+
from: fromAddress,
|
|
169
|
+
to: routerAddress,
|
|
170
|
+
value,
|
|
171
|
+
data: encodedData,
|
|
172
|
+
fee: quote.fee,
|
|
173
|
+
};
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
sendSwap({ network, walletId, quote }) {
|
|
177
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
178
|
+
const txData = yield this.buildSwapTx({ network, walletId, quote });
|
|
179
|
+
const client = this.getClient(network, walletId, quote.from, quote.fromAccountId);
|
|
180
|
+
yield this.sendLedgerNotification(quote.fromAccountId, 'Signing required to complete the swap.');
|
|
181
|
+
const swapTx = yield client.wallet.sendTransaction(txData);
|
|
182
|
+
return {
|
|
183
|
+
status: 'WAITING_FOR_SWAP_CONFIRMATIONS',
|
|
184
|
+
swapTx,
|
|
185
|
+
swapTxHash: swapTx.hash,
|
|
186
|
+
};
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
estimateFees({ network, walletId, asset, txType, quote, feePrices, }) {
|
|
190
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
191
|
+
if (txType !== this.fromTxType) {
|
|
192
|
+
throw (0, error_parser_1.createInternalError)(error_parser_1.CUSTOM_ERRORS.Invalid.TransactionType(txType));
|
|
193
|
+
}
|
|
194
|
+
const nativeAsset = (0, cryptoassets_1.getChain)(network, cryptoassets_2.default[asset].chain).nativeAsset[0].code;
|
|
195
|
+
const account = this.getAccount(quote.fromAccountId);
|
|
196
|
+
if (!account)
|
|
197
|
+
throw (0, error_parser_1.createInternalError)(error_parser_1.CUSTOM_ERRORS.NotFound.Account(quote.fromAccountId));
|
|
198
|
+
const client = this.getClient(network, walletId, quote.from, account.id);
|
|
199
|
+
let gasLimit = 0;
|
|
200
|
+
if (yield this.requiresApproval({ network, walletId, quote })) {
|
|
201
|
+
const approvalTx = yield this.buildApprovalTx({
|
|
202
|
+
network,
|
|
203
|
+
walletId,
|
|
204
|
+
quote,
|
|
205
|
+
});
|
|
206
|
+
const rawApprovalTx = {
|
|
207
|
+
from: approvalTx.from,
|
|
208
|
+
to: approvalTx.to,
|
|
209
|
+
data: approvalTx.data,
|
|
210
|
+
value: '0x' + approvalTx.value.toString(16),
|
|
211
|
+
};
|
|
212
|
+
gasLimit += (yield client.chain.getProvider().estimateGas(rawApprovalTx)).toNumber();
|
|
213
|
+
}
|
|
214
|
+
gasLimit += 750000;
|
|
215
|
+
const fees = {};
|
|
216
|
+
for (const feePrice of feePrices) {
|
|
217
|
+
const gasPrice = new bignumber_js_1.default(feePrice).times(1e9);
|
|
218
|
+
const fee = new bignumber_js_1.default(gasLimit).times(1.1).times(gasPrice);
|
|
219
|
+
fees[feePrice] = (0, cryptoassets_1.unitToCurrency)(cryptoassets_2.default[nativeAsset], fee);
|
|
220
|
+
}
|
|
221
|
+
return fees;
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
getMin(_quoteRequest) {
|
|
225
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
226
|
+
return new bignumber_js_1.default(0);
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
waitForApproveConfirmations({ swap, network, walletId }) {
|
|
230
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
231
|
+
const client = this.getClient(network, walletId, swap.from, swap.fromAccountId);
|
|
232
|
+
try {
|
|
233
|
+
const tx = yield client.chain.getTransactionByHash(swap.approveTxHash);
|
|
234
|
+
if (tx && tx.confirmations && tx.confirmations > 0) {
|
|
235
|
+
return {
|
|
236
|
+
endTime: Date.now(),
|
|
237
|
+
status: 'APPROVE_CONFIRMED',
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
catch (e) {
|
|
242
|
+
if ((0, isTransactionNotFoundError_1.isTransactionNotFoundError)(e))
|
|
243
|
+
console.warn(e);
|
|
244
|
+
else
|
|
245
|
+
throw e;
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
waitForSwapConfirmations({ swap, network, walletId }) {
|
|
250
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
251
|
+
const client = this.getClient(network, walletId, swap.from, swap.fromAccountId);
|
|
252
|
+
try {
|
|
253
|
+
const tx = yield client.chain.getTransactionByHash(swap.swapTxHash);
|
|
254
|
+
if (tx && tx.confirmations && tx.confirmations > 0) {
|
|
255
|
+
const { status } = tx;
|
|
256
|
+
this.updateBalances(network, walletId, [swap.fromAccountId]);
|
|
257
|
+
return {
|
|
258
|
+
endTime: Date.now(),
|
|
259
|
+
status: status === types_1.TxStatus.Success ? 'SUCCESS' : 'FAILED',
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
catch (e) {
|
|
264
|
+
if ((0, isTransactionNotFoundError_1.isTransactionNotFoundError)(e))
|
|
265
|
+
console.warn(e);
|
|
266
|
+
else
|
|
267
|
+
throw e;
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
performNextSwapAction(store, { network, walletId, swap }) {
|
|
272
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
273
|
+
switch (swap.status) {
|
|
274
|
+
case 'WAITING_FOR_APPROVE_CONFIRMATIONS':
|
|
275
|
+
return (0, utils_1.withInterval)(() => tslib_1.__awaiter(this, void 0, void 0, function* () { return this.waitForApproveConfirmations({ swap, network, walletId }); }));
|
|
276
|
+
case 'APPROVE_CONFIRMED':
|
|
277
|
+
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 }); }));
|
|
278
|
+
case 'WAITING_FOR_SWAP_CONFIRMATIONS':
|
|
279
|
+
return (0, utils_1.withInterval)(() => tslib_1.__awaiter(this, void 0, void 0, function* () { return this.waitForSwapConfirmations({ swap, network, walletId }); }));
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
_getApi(network, asset) {
|
|
284
|
+
const chain = cryptoassets_2.default[asset].chain;
|
|
285
|
+
if (chain !== cryptoassets_1.ChainId.Rootstock) {
|
|
286
|
+
throw (0, error_parser_1.createInternalError)(error_parser_1.CUSTOM_ERRORS.Unsupported.Chain);
|
|
287
|
+
}
|
|
288
|
+
const chainId = Number((0, cryptoassets_1.getChain)(network, cryptoassets_1.ChainId.Rootstock).network.chainId);
|
|
289
|
+
if (chainId in this._apiCache) {
|
|
290
|
+
return this._apiCache[chainId];
|
|
291
|
+
}
|
|
292
|
+
else {
|
|
293
|
+
const api = new ethers.providers.StaticJsonRpcProvider(this.config.rpcURL);
|
|
294
|
+
this._apiCache[chainId] = api;
|
|
295
|
+
return api;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
_calculateSlippage(amount) {
|
|
299
|
+
return new bignumber_js_1.default(amount).times(new bignumber_js_1.default(0.995)).toFixed(0);
|
|
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 Sovryn',
|
|
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.SovrynSwapProvider = SovrynSwapProvider;
|
|
369
|
+
//# sourceMappingURL=SovrynSwapProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SovrynSwapProvider.js","sourceRoot":"","sources":["../../../../src/swaps/sovryn/SovrynSwapProvider.ts"],"names":[],"mappings":";;;;AAAA,oIAA+F;AAC/F,kIAA6F;AAC7F,0HAA0F;AAC1F,0HAA0F;AAG1F,yCAAsD;AACtD,uDAAqG;AACrG,uFAAoF;AACpF,2FAAsD;AACtD,wEAA8B;AAC9B,uDAAiC;AACjC,+BAAoC;AAEpC,uEAAqF;AAErF,6CAA4C;AAC5C,mDAAqD;AACrD,6DAA0D;AAC1D,oFAAoD;AACpD,kDAA+C;AAU/C,uDAA0E;AAG1E,MAAM,kBAAkB,GAA8B;IACpD,OAAO,EAAE,gCAAsB,CAAC,SAAS;IACzC,OAAO,EAAE,gCAAsB,CAAC,SAAS;CAC1C,CAAC;AAeF,MAAM,kBAAmB,SAAQ,2BAAY;IAI3C,YAAY,MAAgC;QAC1C,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;IACtB,CAAC;IAEK,iBAAiB;;YACrB,OAAO,EAAE,CAAC;QACZ,CAAC;KAAA;IAEM,SAAS,CAAC,OAAgB,EAAE,QAAgB,EA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AAY;oBACV,OAAO;wBACL,OAAO,EAAE,iBAAiB;qBAC3B,CAAC;gBACJ,CAAC;aACF;YACD,OAAO,EAAE;gBACP,IAAI,EAAE,CAAC;gBACP,KAAK,EAAE,WAAW;gBAClB,YAAY,EAAE,WAAW;gBACzB,YAAY,CAAC,IAAS;oBACpB,OAAO;wBACL,OAAO,EAAE,mBAAmB,IAAA,6BAAa,EAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,EAAE,eAAe;qBAC5F,CAAC;gBACJ,CAAC;aACF;YACD,MAAM,EAAE;gBACN,IAAI,EAAE,CAAC;gBACP,KAAK,EAAE,aAAa;gBACpB,YAAY,EAAE,UAAU;gBACxB,YAAY;oBACV,OAAO;wBACL,OAAO,EAAE,aAAa;qBACvB,CAAC;gBACJ,CAAC;aACF;SACF,CAAC;IACJ,CAAC;IAES,QAAQ;QAChB,OAAO;YACL,IAAI,EAAE,MAAM;SACb,CAAC;IACJ,CAAC;IAES,WAAW;QACnB,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC;IAC9B,CAAC;IAES,SAAS;QACjB,OAAO,IAAI,CAAC;IACd,CAAC;IAES,qBAAqB;QAC7B,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAC7B,CAAC;IAES,WAAW;QACnB,OAAO,CAAC,CAAC;IACX,CAAC;CACF;AAEQ,gDAAkB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "Sovryn AMM Swaps",
|
|
3
|
+
"description": "Non-custodial and permissionless smart contract based system for Bitcoin lending, borrowing and margin trading.",
|
|
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,167 @@
|
|
|
1
|
+
import { Transaction } from '@yaswap/types';
|
|
2
|
+
import BN from 'bignumber.js';
|
|
3
|
+
import { ActionContext } from '../../store';
|
|
4
|
+
import { Asset, Network, SwapHistoryItem, WalletId } from '../../store/types';
|
|
5
|
+
import { SwapProvider } from '../SwapProvider';
|
|
6
|
+
import { BaseSwapProviderConfig, EstimateFeeRequest, NextSwapActionRequest, QuoteRequest, SwapRequest, SwapStatus } from '../types';
|
|
7
|
+
export interface TeleSwapSwapProviderConfig extends BaseSwapProviderConfig {
|
|
8
|
+
QuickSwapRouterAddress: string;
|
|
9
|
+
QuickSwapFactoryAddress: string;
|
|
10
|
+
}
|
|
11
|
+
export declare enum TeleSwapTxTypes {
|
|
12
|
+
WRAP = "WRAP",
|
|
13
|
+
SWAP = "SWAP"
|
|
14
|
+
}
|
|
15
|
+
export interface TeleSwapSwapHistoryItem extends SwapHistoryItem {
|
|
16
|
+
swapTx: Transaction;
|
|
17
|
+
swapTxHash: string;
|
|
18
|
+
approveTxHash: string;
|
|
19
|
+
exchangeApproveTxHash: string;
|
|
20
|
+
exchangeTxHash: string;
|
|
21
|
+
exchangedTeleBTCAmount: BN;
|
|
22
|
+
numberOfBitcoinConfirmations: number;
|
|
23
|
+
userBitcoinAddress: string;
|
|
24
|
+
}
|
|
25
|
+
declare class TeleSwapSwapProvider extends SwapProvider {
|
|
26
|
+
config: TeleSwapSwapProviderConfig;
|
|
27
|
+
constructor(config: TeleSwapSwapProviderConfig);
|
|
28
|
+
getSupportedPairs(): Promise<never[]>;
|
|
29
|
+
isSwapSupported(from: Asset, to: Asset, network: Network): boolean;
|
|
30
|
+
getQuote({ network, from, to, amount }: QuoteRequest): Promise<{
|
|
31
|
+
fromAmount: string;
|
|
32
|
+
toAmount: string;
|
|
33
|
+
}>;
|
|
34
|
+
sendBitcoinSwap({ quote, network, walletId, }: {
|
|
35
|
+
quote: TeleSwapSwapHistoryItem;
|
|
36
|
+
network: Network;
|
|
37
|
+
walletId: WalletId;
|
|
38
|
+
}): Promise<{
|
|
39
|
+
status: string;
|
|
40
|
+
swapTxHash: string;
|
|
41
|
+
swapTx: Transaction<any>;
|
|
42
|
+
numberOfBitcoinConfirmations: number;
|
|
43
|
+
}>;
|
|
44
|
+
sendBurn({ quote, network, walletId, }: {
|
|
45
|
+
quote: TeleSwapSwapHistoryItem;
|
|
46
|
+
network: Network;
|
|
47
|
+
walletId: WalletId;
|
|
48
|
+
}): Promise<{
|
|
49
|
+
status: string;
|
|
50
|
+
swapTxHash: string;
|
|
51
|
+
swapTx: Transaction<any>;
|
|
52
|
+
userBitcoinAddress: string;
|
|
53
|
+
}>;
|
|
54
|
+
sendExchange({ quote, network, walletId, }: {
|
|
55
|
+
quote: TeleSwapSwapHistoryItem;
|
|
56
|
+
network: Network;
|
|
57
|
+
walletId: WalletId;
|
|
58
|
+
}): Promise<{
|
|
59
|
+
status: string;
|
|
60
|
+
exchangeTxHash: string;
|
|
61
|
+
exchangedTeleBTCAmount: BN;
|
|
62
|
+
}>;
|
|
63
|
+
approveForExchange({ quote, network, walletId, }: {
|
|
64
|
+
quote: TeleSwapSwapHistoryItem;
|
|
65
|
+
network: Network;
|
|
66
|
+
walletId: WalletId;
|
|
67
|
+
}): Promise<{
|
|
68
|
+
status: string;
|
|
69
|
+
exchangeApproveTxHash: string;
|
|
70
|
+
}>;
|
|
71
|
+
approveForBurn({ quote, network, walletId, }: {
|
|
72
|
+
quote: TeleSwapSwapHistoryItem;
|
|
73
|
+
network: Network;
|
|
74
|
+
walletId: WalletId;
|
|
75
|
+
}): Promise<{
|
|
76
|
+
status: string;
|
|
77
|
+
approveTxHash: string;
|
|
78
|
+
}>;
|
|
79
|
+
sendSwap({ network, walletId, swap }: NextSwapActionRequest<TeleSwapSwapHistoryItem>): Promise<{
|
|
80
|
+
status: string;
|
|
81
|
+
swapTxHash: string;
|
|
82
|
+
swapTx: Transaction<any>;
|
|
83
|
+
numberOfBitcoinConfirmations: number;
|
|
84
|
+
} | {
|
|
85
|
+
status: string;
|
|
86
|
+
exchangeApproveTxHash: string;
|
|
87
|
+
} | {
|
|
88
|
+
status: string;
|
|
89
|
+
approveTxHash: string;
|
|
90
|
+
} | undefined>;
|
|
91
|
+
newSwap({ network, walletId, quote }: SwapRequest<TeleSwapSwapHistoryItem>): Promise<{
|
|
92
|
+
id: string;
|
|
93
|
+
fee: number;
|
|
94
|
+
} | {
|
|
95
|
+
status: string;
|
|
96
|
+
swapTxHash: string;
|
|
97
|
+
swapTx: Transaction<any>;
|
|
98
|
+
numberOfBitcoinConfirmations: number;
|
|
99
|
+
id: string;
|
|
100
|
+
fee: number;
|
|
101
|
+
} | {
|
|
102
|
+
status: string;
|
|
103
|
+
exchangeApproveTxHash: string;
|
|
104
|
+
id: string;
|
|
105
|
+
fee: number;
|
|
106
|
+
} | {
|
|
107
|
+
status: string;
|
|
108
|
+
approveTxHash: string;
|
|
109
|
+
id: string;
|
|
110
|
+
fee: number;
|
|
111
|
+
}>;
|
|
112
|
+
estimateFees({ network, walletId, asset, txType, quote, feePrices, max }: EstimateFeeRequest): Promise<{
|
|
113
|
+
[x: string]: BN;
|
|
114
|
+
} | null>;
|
|
115
|
+
getMin(quote: QuoteRequest): Promise<BN>;
|
|
116
|
+
getTokenAddress(asset: Asset, network: Network): string | undefined;
|
|
117
|
+
waitForBitcoinConfirmations({ swap, network, walletId }: NextSwapActionRequest<TeleSwapSwapHistoryItem>): Promise<{
|
|
118
|
+
endTime: number;
|
|
119
|
+
status: string;
|
|
120
|
+
numberOfBitcoinConfirmations: number;
|
|
121
|
+
} | undefined>;
|
|
122
|
+
waitForReceive({ swap, network, walletId }: NextSwapActionRequest<TeleSwapSwapHistoryItem>): Promise<{
|
|
123
|
+
endTime: number;
|
|
124
|
+
status: string;
|
|
125
|
+
numberOfBitcoinConfirmations: number;
|
|
126
|
+
} | undefined>;
|
|
127
|
+
waitForApproveConfirmations({ swap, network, walletId }: NextSwapActionRequest<TeleSwapSwapHistoryItem>): Promise<{
|
|
128
|
+
endTime: number;
|
|
129
|
+
status: string;
|
|
130
|
+
} | undefined>;
|
|
131
|
+
waitForExchangeApproveConfirmations({ swap, network, walletId, }: NextSwapActionRequest<TeleSwapSwapHistoryItem>): Promise<{
|
|
132
|
+
endTime: number;
|
|
133
|
+
status: string;
|
|
134
|
+
} | undefined>;
|
|
135
|
+
waitForExchangeConfirmations({ swap, network, walletId }: NextSwapActionRequest<TeleSwapSwapHistoryItem>): Promise<{
|
|
136
|
+
endTime: number;
|
|
137
|
+
status: string;
|
|
138
|
+
exchangedTeleBTCAmount: BN;
|
|
139
|
+
} | undefined>;
|
|
140
|
+
waitForBurnConfirmations({ swap, network, walletId }: NextSwapActionRequest<TeleSwapSwapHistoryItem>): Promise<{
|
|
141
|
+
endTime: number;
|
|
142
|
+
status: string;
|
|
143
|
+
toAmount: string;
|
|
144
|
+
} | undefined>;
|
|
145
|
+
waitForBurnBitcoinConfirmations({ swap, network }: NextSwapActionRequest<TeleSwapSwapHistoryItem>): Promise<{
|
|
146
|
+
endTime: number;
|
|
147
|
+
status: string;
|
|
148
|
+
} | undefined>;
|
|
149
|
+
performNextSwapAction(store: ActionContext, { network, walletId, swap }: NextSwapActionRequest<TeleSwapSwapHistoryItem>): Promise<Partial<{
|
|
150
|
+
endTime: number;
|
|
151
|
+
status: string;
|
|
152
|
+
}> | undefined>;
|
|
153
|
+
protected _getStatuses(): Record<string, SwapStatus>;
|
|
154
|
+
protected _txTypes(): typeof TeleSwapTxTypes;
|
|
155
|
+
protected _fromTxType(): string | null;
|
|
156
|
+
protected _toTxType(): string | null;
|
|
157
|
+
protected _timelineDiagramSteps(): string[];
|
|
158
|
+
protected _totalSteps(): number;
|
|
159
|
+
private _chooseLockerAddress;
|
|
160
|
+
private getChainIdNumber;
|
|
161
|
+
private getFees;
|
|
162
|
+
private getOutputAmountAndPath;
|
|
163
|
+
private changeEndianness;
|
|
164
|
+
private getTargetNetworkConnectionInfo;
|
|
165
|
+
private getOpReturnData;
|
|
166
|
+
}
|
|
167
|
+
export { TeleSwapSwapProvider };
|