@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,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "deBridge Cross-Chain Swaps",
|
|
3
|
+
"description": "deSwap — cross-chain swaps between any assets",
|
|
4
|
+
"pros": [
|
|
5
|
+
"Ethereum, Polygon, Binance Smart Chain, Arbitrum, Avalanche",
|
|
6
|
+
"Best exchange rates",
|
|
7
|
+
"High liquidity",
|
|
8
|
+
"Many pairs",
|
|
9
|
+
"Fast"
|
|
10
|
+
],
|
|
11
|
+
"cons": ["Slippage"],
|
|
12
|
+
"fees": ["Additional aggregator fees", "Slippage (up to 3%)"]
|
|
13
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { BitcoinBaseWalletProvider, BitcoinEsploraApiProvider, BitcoinTypes } from '@yaswap/bitcoin';
|
|
2
|
+
import { Client } from '@yaswap/client';
|
|
3
|
+
import { Transaction } from '@yaswap/types';
|
|
4
|
+
import BN from 'bignumber.js';
|
|
5
|
+
import { Socket } from 'socket.io-client';
|
|
6
|
+
import { ActionContext } from '../../store';
|
|
7
|
+
import { Network, SwapHistoryItem } from '../../store/types';
|
|
8
|
+
import { SwapProvider } from '../SwapProvider';
|
|
9
|
+
import { BaseSwapProviderConfig, EstimateFeeRequest, NextSwapActionRequest, QuoteRequest, SwapRequest, SwapStatus } from '../types';
|
|
10
|
+
export interface FastBtcTxAmount {
|
|
11
|
+
max: number;
|
|
12
|
+
min: number;
|
|
13
|
+
}
|
|
14
|
+
export interface FastBtcDepositAddress {
|
|
15
|
+
id: number;
|
|
16
|
+
web3adr: string;
|
|
17
|
+
btcadr: string;
|
|
18
|
+
label: string;
|
|
19
|
+
dateAdded: number;
|
|
20
|
+
signatures: {
|
|
21
|
+
signer: string;
|
|
22
|
+
signature: string;
|
|
23
|
+
}[];
|
|
24
|
+
}
|
|
25
|
+
export declare enum FastBtcStatus {
|
|
26
|
+
Confirmed = "confirmed"
|
|
27
|
+
}
|
|
28
|
+
export declare enum FastBtcType {
|
|
29
|
+
Deposit = "deposit",
|
|
30
|
+
Transfer = "transfer"
|
|
31
|
+
}
|
|
32
|
+
export interface FastBtcDepositHistory {
|
|
33
|
+
dateAdded: number;
|
|
34
|
+
txHash: string;
|
|
35
|
+
type: FastBtcType;
|
|
36
|
+
status: FastBtcStatus;
|
|
37
|
+
valueBtc: number;
|
|
38
|
+
}
|
|
39
|
+
export interface FastBtcDepositSwapHistoryItem extends SwapHistoryItem {
|
|
40
|
+
swapTxHash: string;
|
|
41
|
+
swapTx: Transaction<BitcoinTypes.Transaction>;
|
|
42
|
+
}
|
|
43
|
+
export interface FastBtcDepositSwapProviderConfig extends BaseSwapProviderConfig {
|
|
44
|
+
bridgeEndpoint: string;
|
|
45
|
+
}
|
|
46
|
+
declare class FastBTCDepositSwapProvider extends SwapProvider {
|
|
47
|
+
config: FastBtcDepositSwapProviderConfig;
|
|
48
|
+
socketConnection: Socket;
|
|
49
|
+
connectSocket(): Promise<unknown>;
|
|
50
|
+
getClient(network: Network, walletId: string, asset: string, accountId: string): Client<BitcoinEsploraApiProvider, BitcoinBaseWalletProvider<any, any>, import("@yaswap/client").Swap<any, any, import("@yaswap/client").Wallet<any, any>>, import("@yaswap/client").Nft<any, any>>;
|
|
51
|
+
getSupportedPairs(): Promise<{
|
|
52
|
+
from: string;
|
|
53
|
+
to: string;
|
|
54
|
+
rate: string;
|
|
55
|
+
max: string;
|
|
56
|
+
min: string;
|
|
57
|
+
}[]>;
|
|
58
|
+
_getHistory(address: string): Promise<FastBtcDepositHistory[]>;
|
|
59
|
+
_getAddress(address: string): Promise<FastBtcDepositAddress>;
|
|
60
|
+
_getTxAmount(): Promise<FastBtcTxAmount>;
|
|
61
|
+
getQuote(quoteRequest: QuoteRequest): Promise<{
|
|
62
|
+
fromAmount: string;
|
|
63
|
+
toAmount: string;
|
|
64
|
+
} | null>;
|
|
65
|
+
sendSwap({ network, walletId, quote }: SwapRequest): Promise<{
|
|
66
|
+
status: string;
|
|
67
|
+
swapTx: Transaction<BitcoinTypes.Transaction>;
|
|
68
|
+
swapTxHash: string;
|
|
69
|
+
} | null>;
|
|
70
|
+
newSwap({ network, walletId, quote }: SwapRequest): Promise<{
|
|
71
|
+
status?: string | undefined;
|
|
72
|
+
swapTx?: Transaction<BitcoinTypes.Transaction> | undefined;
|
|
73
|
+
swapTxHash?: string | undefined;
|
|
74
|
+
id: string;
|
|
75
|
+
fee: number;
|
|
76
|
+
slippage: number;
|
|
77
|
+
}>;
|
|
78
|
+
estimateFees({ network, walletId, asset, txType, quote, feePrices, max }: EstimateFeeRequest): Promise<{
|
|
79
|
+
[x: string]: BN;
|
|
80
|
+
} | null>;
|
|
81
|
+
getMin(_quoteRequest: QuoteRequest): Promise<BN>;
|
|
82
|
+
waitForSendConfirmations({ swap, network, walletId }: NextSwapActionRequest<FastBtcDepositSwapHistoryItem>): Promise<{
|
|
83
|
+
endTime: number;
|
|
84
|
+
status: string;
|
|
85
|
+
} | undefined>;
|
|
86
|
+
waitForReceive({ swap, network, walletId }: NextSwapActionRequest<FastBtcDepositSwapHistoryItem>): Promise<{
|
|
87
|
+
endTime: number;
|
|
88
|
+
status: string;
|
|
89
|
+
} | undefined>;
|
|
90
|
+
performNextSwapAction(_store: ActionContext, { network, walletId, swap }: NextSwapActionRequest<FastBtcDepositSwapHistoryItem>): Promise<Partial<{
|
|
91
|
+
endTime: number;
|
|
92
|
+
status: string;
|
|
93
|
+
}> | undefined>;
|
|
94
|
+
protected _getStatuses(): Record<string, SwapStatus>;
|
|
95
|
+
protected _txTypes(): {
|
|
96
|
+
SWAP: string;
|
|
97
|
+
};
|
|
98
|
+
protected _fromTxType(): string | null;
|
|
99
|
+
protected _toTxType(): string | null;
|
|
100
|
+
protected _timelineDiagramSteps(): string[];
|
|
101
|
+
protected _totalSteps(): number;
|
|
102
|
+
}
|
|
103
|
+
export { FastBTCDepositSwapProvider };
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FastBTCDepositSwapProvider = exports.FastBtcType = exports.FastBtcStatus = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const cryptoassets_1 = require("@yaswap/cryptoassets");
|
|
6
|
+
const isTransactionNotFoundError_1 = require("../../utils/isTransactionNotFoundError");
|
|
7
|
+
const bignumber_js_1 = tslib_1.__importDefault(require("bignumber.js"));
|
|
8
|
+
const lodash_1 = require("lodash");
|
|
9
|
+
const socket_io_client_1 = require("socket.io-client");
|
|
10
|
+
const uuid_1 = require("uuid");
|
|
11
|
+
const utils_1 = require("../../store/actions/performNextAction/utils");
|
|
12
|
+
const coinFormatter_1 = require("../../utils/coinFormatter");
|
|
13
|
+
const cryptoassets_2 = tslib_1.__importDefault(require("../../utils/cryptoassets"));
|
|
14
|
+
const SwapProvider_1 = require("../SwapProvider");
|
|
15
|
+
const FAST_BTC_SATOSHI_FEE = 5000;
|
|
16
|
+
const FAST_BTC_PERCENTAGE_FEE = 0.2;
|
|
17
|
+
var FastBtcStatus;
|
|
18
|
+
(function (FastBtcStatus) {
|
|
19
|
+
FastBtcStatus["Confirmed"] = "confirmed";
|
|
20
|
+
})(FastBtcStatus = exports.FastBtcStatus || (exports.FastBtcStatus = {}));
|
|
21
|
+
var FastBtcType;
|
|
22
|
+
(function (FastBtcType) {
|
|
23
|
+
FastBtcType["Deposit"] = "deposit";
|
|
24
|
+
FastBtcType["Transfer"] = "transfer";
|
|
25
|
+
})(FastBtcType = exports.FastBtcType || (exports.FastBtcType = {}));
|
|
26
|
+
class FastBTCDepositSwapProvider extends SwapProvider_1.SwapProvider {
|
|
27
|
+
connectSocket() {
|
|
28
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
if (this.socketConnection && this.socketConnection.connected)
|
|
30
|
+
return true;
|
|
31
|
+
return new Promise((resolve) => {
|
|
32
|
+
this.socketConnection = (0, socket_io_client_1.io)(this.config.bridgeEndpoint, {
|
|
33
|
+
reconnectionDelayMax: 10000,
|
|
34
|
+
});
|
|
35
|
+
this.socketConnection.on('connect', function () {
|
|
36
|
+
resolve(true);
|
|
37
|
+
});
|
|
38
|
+
this.socketConnection.on('disconnect', function () {
|
|
39
|
+
console.warn('FastBtc socket disconnected');
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
getClient(network, walletId, asset, accountId) {
|
|
45
|
+
return super.getClient(network, walletId, asset, accountId);
|
|
46
|
+
}
|
|
47
|
+
getSupportedPairs() {
|
|
48
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
const validAmountRange = yield this._getTxAmount();
|
|
50
|
+
return [
|
|
51
|
+
{
|
|
52
|
+
from: 'BTC',
|
|
53
|
+
to: 'RBTC',
|
|
54
|
+
rate: '0.998',
|
|
55
|
+
max: (0, cryptoassets_1.currencyToUnit)(cryptoassets_2.default.BTC, new bignumber_js_1.default(validAmountRange.max)).toFixed(),
|
|
56
|
+
min: (0, cryptoassets_1.currencyToUnit)(cryptoassets_2.default.BTC, new bignumber_js_1.default(validAmountRange.min)).toFixed(),
|
|
57
|
+
},
|
|
58
|
+
];
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
_getHistory(address) {
|
|
62
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
63
|
+
yield this.connectSocket();
|
|
64
|
+
return new Promise((resolve, reject) => {
|
|
65
|
+
this.socketConnection.emit('getDepositHistory', address, (res) => {
|
|
66
|
+
if (res && res.error) {
|
|
67
|
+
reject(res.err);
|
|
68
|
+
}
|
|
69
|
+
resolve(res);
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
_getAddress(address) {
|
|
75
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
yield this.connectSocket();
|
|
77
|
+
return new Promise((resolve, reject) => {
|
|
78
|
+
this.socketConnection.emit('getDepositAddress', address, (err, res) => {
|
|
79
|
+
if (err) {
|
|
80
|
+
reject(err);
|
|
81
|
+
}
|
|
82
|
+
resolve(res);
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
_getTxAmount() {
|
|
88
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
89
|
+
yield this.connectSocket();
|
|
90
|
+
return new Promise((resolve) => {
|
|
91
|
+
this.socketConnection.emit('txAmount', (res) => {
|
|
92
|
+
resolve(res);
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
getQuote(quoteRequest) {
|
|
98
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
99
|
+
const { from, to, amount } = quoteRequest;
|
|
100
|
+
if (from !== 'BTC' || to !== 'RBTC') {
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
const fromAmountInUnit = new bignumber_js_1.default((0, cryptoassets_1.currencyToUnit)(cryptoassets_2.default[from], new bignumber_js_1.default(amount)));
|
|
104
|
+
const validAmountRange = yield this._getTxAmount();
|
|
105
|
+
const isQuoteAmountInTheRange = amount.lte(validAmountRange.max) && amount.gte(validAmountRange.min);
|
|
106
|
+
if (!isQuoteAmountInTheRange) {
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
const toAmountInUnit = new bignumber_js_1.default((0, cryptoassets_1.currencyToUnit)(cryptoassets_2.default[to], new bignumber_js_1.default(amount).minus((0, cryptoassets_1.unitToCurrency)(cryptoassets_2.default[from], FAST_BTC_SATOSHI_FEE)))).times(1 - FAST_BTC_PERCENTAGE_FEE / 100);
|
|
110
|
+
return {
|
|
111
|
+
fromAmount: fromAmountInUnit.toFixed(),
|
|
112
|
+
toAmount: toAmountInUnit.toFixed(),
|
|
113
|
+
};
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
sendSwap({ network, walletId, quote }) {
|
|
117
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
118
|
+
if (quote.from !== 'BTC' || quote.to !== 'RBTC') {
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
const toChain = cryptoassets_2.default[quote.to].chain;
|
|
122
|
+
const client = this.getClient(network, walletId, quote.from, quote.fromAccountId);
|
|
123
|
+
const toAddressRaw = yield this.getSwapAddress(network, walletId, quote.to, quote.toAccountId);
|
|
124
|
+
const toAddress = (0, cryptoassets_1.getChain)(network, toChain).formatAddress(toAddressRaw);
|
|
125
|
+
const relayAddress = yield this._getAddress(toAddress);
|
|
126
|
+
yield this.sendLedgerNotification(quote.fromAccountId, 'Signing required to complete the swap.');
|
|
127
|
+
const swapTx = yield client.wallet.sendTransaction({
|
|
128
|
+
to: relayAddress.btcadr,
|
|
129
|
+
value: new bignumber_js_1.default(quote.fromAmount),
|
|
130
|
+
data: '',
|
|
131
|
+
fee: quote.fee,
|
|
132
|
+
});
|
|
133
|
+
return {
|
|
134
|
+
status: 'WAITING_FOR_SEND_CONFIRMATIONS',
|
|
135
|
+
swapTx,
|
|
136
|
+
swapTxHash: swapTx.hash,
|
|
137
|
+
};
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
newSwap({ network, walletId, quote }) {
|
|
141
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
142
|
+
const updates = yield this.sendSwap({ network, walletId, quote });
|
|
143
|
+
return Object.assign({ id: (0, uuid_1.v4)(), fee: quote.fee, slippage: 50 }, updates);
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
estimateFees({ network, walletId, asset, txType, quote, feePrices, max }) {
|
|
147
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
148
|
+
if (txType === this._txTypes().SWAP && asset === 'BTC') {
|
|
149
|
+
const client = this.getClient(network, walletId, asset, quote.fromAccountId);
|
|
150
|
+
const value = max ? undefined : new bignumber_js_1.default(quote.fromAmount);
|
|
151
|
+
const txs = feePrices.map((fee) => ({ to: '', value, fee }));
|
|
152
|
+
const totalFees = yield client.wallet.getTotalFees(txs, max);
|
|
153
|
+
return (0, lodash_1.mapValues)(totalFees, (f) => (0, cryptoassets_1.unitToCurrency)(cryptoassets_2.default[asset], f));
|
|
154
|
+
}
|
|
155
|
+
return null;
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
getMin(_quoteRequest) {
|
|
159
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
160
|
+
const validAmountRange = yield this._getTxAmount();
|
|
161
|
+
return new bignumber_js_1.default(validAmountRange.min);
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
waitForSendConfirmations({ swap, network, walletId }) {
|
|
165
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
166
|
+
const client = this.getClient(network, walletId, swap.from, swap.fromAccountId);
|
|
167
|
+
try {
|
|
168
|
+
const tx = yield client.chain.getTransactionByHash(swap.swapTxHash);
|
|
169
|
+
if (tx && tx.confirmations && tx.confirmations > 0) {
|
|
170
|
+
return {
|
|
171
|
+
endTime: Date.now(),
|
|
172
|
+
status: 'WAITING_FOR_RECEIVE',
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
catch (e) {
|
|
177
|
+
if ((0, isTransactionNotFoundError_1.isTransactionNotFoundError)(e))
|
|
178
|
+
console.warn(e);
|
|
179
|
+
else
|
|
180
|
+
throw e;
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
waitForReceive({ swap, network, walletId }) {
|
|
185
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
186
|
+
try {
|
|
187
|
+
const toChain = cryptoassets_2.default[swap.to].chain;
|
|
188
|
+
const toAddressRaw = yield this.getSwapAddress(network, walletId, swap.to, swap.toAccountId);
|
|
189
|
+
const toAddress = (0, cryptoassets_1.getChain)(network, toChain).formatAddress(toAddressRaw);
|
|
190
|
+
const addressHistory = (yield this._getHistory(toAddress)).sort((a, b) => new Date(a.dateAdded).getTime() > new Date(b.dateAdded).getTime() ? 1 : -1);
|
|
191
|
+
let isDepositConfirmed = false;
|
|
192
|
+
let isReceiveConfirmed = false;
|
|
193
|
+
let depositConfirmationDate = 0;
|
|
194
|
+
let depositAmount = 0;
|
|
195
|
+
for (const transaction of addressHistory) {
|
|
196
|
+
if (transaction.txHash === swap.swapTxHash &&
|
|
197
|
+
transaction.status === FastBtcStatus.Confirmed &&
|
|
198
|
+
transaction.type === FastBtcType.Deposit) {
|
|
199
|
+
isDepositConfirmed = true;
|
|
200
|
+
depositConfirmationDate = new Date(transaction.dateAdded).getTime();
|
|
201
|
+
depositAmount = transaction.valueBtc;
|
|
202
|
+
}
|
|
203
|
+
else if (isDepositConfirmed &&
|
|
204
|
+
transaction.status === FastBtcStatus.Confirmed &&
|
|
205
|
+
transaction.type === FastBtcType.Transfer &&
|
|
206
|
+
transaction.valueBtc === depositAmount &&
|
|
207
|
+
new Date(transaction.dateAdded).getTime() - depositConfirmationDate > 0 &&
|
|
208
|
+
new Date(transaction.dateAdded).getTime() - depositConfirmationDate < 86400000) {
|
|
209
|
+
isReceiveConfirmed = true;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
if (isDepositConfirmed && isReceiveConfirmed) {
|
|
213
|
+
return {
|
|
214
|
+
endTime: Date.now(),
|
|
215
|
+
status: 'SUCCESS',
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
catch (e) {
|
|
220
|
+
console.warn(e);
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
performNextSwapAction(_store, { network, walletId, swap }) {
|
|
225
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
226
|
+
switch (swap.status) {
|
|
227
|
+
case 'WAITING_FOR_SEND_CONFIRMATIONS':
|
|
228
|
+
return (0, utils_1.withInterval)(() => tslib_1.__awaiter(this, void 0, void 0, function* () { return this.waitForSendConfirmations({ swap, network, walletId }); }));
|
|
229
|
+
case 'WAITING_FOR_RECEIVE':
|
|
230
|
+
return (0, utils_1.withInterval)(() => tslib_1.__awaiter(this, void 0, void 0, function* () { return this.waitForReceive({ swap, network, walletId }); }));
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
_getStatuses() {
|
|
235
|
+
return {
|
|
236
|
+
WAITING_FOR_SEND_CONFIRMATIONS: {
|
|
237
|
+
step: 0,
|
|
238
|
+
label: 'Swapping {from}',
|
|
239
|
+
filterStatus: 'PENDING',
|
|
240
|
+
notification() {
|
|
241
|
+
return {
|
|
242
|
+
message: 'Swap initiated',
|
|
243
|
+
};
|
|
244
|
+
},
|
|
245
|
+
},
|
|
246
|
+
WAITING_FOR_RECEIVE: {
|
|
247
|
+
step: 1,
|
|
248
|
+
label: 'Swapping {from}',
|
|
249
|
+
filterStatus: 'PENDING',
|
|
250
|
+
},
|
|
251
|
+
SUCCESS: {
|
|
252
|
+
step: 2,
|
|
253
|
+
label: 'Completed',
|
|
254
|
+
filterStatus: 'COMPLETED',
|
|
255
|
+
notification(swap) {
|
|
256
|
+
return {
|
|
257
|
+
message: `Swap completed, ${(0, coinFormatter_1.prettyBalance)(swap.toAmount, swap.to)} ${swap.to} ready to use`,
|
|
258
|
+
};
|
|
259
|
+
},
|
|
260
|
+
},
|
|
261
|
+
FAILED: {
|
|
262
|
+
step: 2,
|
|
263
|
+
label: 'Swap Failed',
|
|
264
|
+
filterStatus: 'REFUNDED',
|
|
265
|
+
notification() {
|
|
266
|
+
return {
|
|
267
|
+
message: 'Swap failed',
|
|
268
|
+
};
|
|
269
|
+
},
|
|
270
|
+
},
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
_txTypes() {
|
|
274
|
+
return {
|
|
275
|
+
SWAP: 'SWAP',
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
_fromTxType() {
|
|
279
|
+
return this._txTypes().SWAP;
|
|
280
|
+
}
|
|
281
|
+
_toTxType() {
|
|
282
|
+
return null;
|
|
283
|
+
}
|
|
284
|
+
_timelineDiagramSteps() {
|
|
285
|
+
return ['SWAP'];
|
|
286
|
+
}
|
|
287
|
+
_totalSteps() {
|
|
288
|
+
return 3;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
exports.FastBTCDepositSwapProvider = FastBTCDepositSwapProvider;
|
|
292
|
+
//# sourceMappingURL=FastBTCDepositSwapProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FastBTCDepositSwapProvider.js","sourceRoot":"","sources":["../../../../src/swaps/fastbtc/FastBTCDepositSwapProvider.ts"],"names":[],"mappings":";;;;AAGA,uDAAgF;AAChF,uFAAoF;AACpF,wEAA8B;AAC9B,mCAAmC;AACnC,uDAA8C;AAC9C,+BAAoC;AAEpC,uEAA2E;AAE3E,6DAA0D;AAC1D,oFAAoD;AACpD,kDAA+C;AAU/C,MAAM,oBAAoB,GAAG,IAAI,CAAC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AE,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,MAAM,CAAC,CAAC;IAClB,CAAC;IAES,WAAW;QACnB,OAAO,CAAC,CAAC;IACX,CAAC;CACF;AAEQ,gEAA0B"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { BitcoinBaseWalletProvider, BitcoinEsploraApiProvider, BitcoinTypes } from '@yaswap/bitcoin';
|
|
2
|
+
import { Client } from '@yaswap/client';
|
|
3
|
+
import { EvmChainProvider, EvmTypes, EvmWalletProvider } from '@yaswap/evm';
|
|
4
|
+
import { Transaction } from '@yaswap/types';
|
|
5
|
+
import { JsonRpcProvider } from '@ethersproject/providers';
|
|
6
|
+
import BN from 'bignumber.js';
|
|
7
|
+
import * as ethers from 'ethers';
|
|
8
|
+
import { ActionContext } from '../../store';
|
|
9
|
+
import { Network, SwapHistoryItem, WalletId } from '../../store/types';
|
|
10
|
+
import { SwapProvider } from '../SwapProvider';
|
|
11
|
+
import { BaseSwapProviderConfig, EstimateFeeRequest, EstimateFeeResponse, NextSwapActionRequest, QuoteRequest, SwapQuote, SwapRequest, SwapStatus } from '../types';
|
|
12
|
+
export interface FastBtcWithdrawSwapHistoryItem extends SwapHistoryItem {
|
|
13
|
+
transferId: string;
|
|
14
|
+
swapTxHash: string;
|
|
15
|
+
swapTx: Transaction<EvmTypes.EthersTransactionResponse>;
|
|
16
|
+
receiveTxHash: string;
|
|
17
|
+
receiveTx: Transaction<BitcoinTypes.Transaction>;
|
|
18
|
+
}
|
|
19
|
+
export interface FastBtcWithdrawSwapProviderConfig extends BaseSwapProviderConfig {
|
|
20
|
+
network: Network;
|
|
21
|
+
routerAddress: string;
|
|
22
|
+
}
|
|
23
|
+
export interface BuildSwapOptions {
|
|
24
|
+
network: Network;
|
|
25
|
+
walletId: WalletId;
|
|
26
|
+
quote: SwapQuote;
|
|
27
|
+
}
|
|
28
|
+
declare class FastBTCWithdrawSwapProvider extends SwapProvider {
|
|
29
|
+
config: FastBtcWithdrawSwapProviderConfig;
|
|
30
|
+
private _provider;
|
|
31
|
+
constructor(config: FastBtcWithdrawSwapProviderConfig);
|
|
32
|
+
getFastBtcBridge(provider: JsonRpcProvider): ethers.ethers.Contract;
|
|
33
|
+
getLimits(): Promise<{
|
|
34
|
+
min: BN;
|
|
35
|
+
max: BN;
|
|
36
|
+
}>;
|
|
37
|
+
getClient(network: Network, walletId: string, asset: string, accountId: string): Client<EvmChainProvider, EvmWalletProvider, import("@yaswap/client").Swap<any, any, import("@yaswap/client").Wallet<any, any>>, import("@yaswap/client").Nft<any, any>>;
|
|
38
|
+
getReceiveClient(network: Network, walletId: string, asset: string, accountId: string): Client<BitcoinEsploraApiProvider, BitcoinBaseWalletProvider<any, any>, import("@yaswap/client").Swap<any, any, import("@yaswap/client").Wallet<any, any>>, import("@yaswap/client").Nft<any, any>>;
|
|
39
|
+
getSupportedPairs(): Promise<{
|
|
40
|
+
from: string;
|
|
41
|
+
to: string;
|
|
42
|
+
rate: string;
|
|
43
|
+
min: string;
|
|
44
|
+
max: string;
|
|
45
|
+
}[]>;
|
|
46
|
+
getQuote(quoteRequest: QuoteRequest): Promise<{
|
|
47
|
+
fromAmount: string;
|
|
48
|
+
toAmount: string;
|
|
49
|
+
} | null>;
|
|
50
|
+
buildSwapTx({ network, walletId, quote }: BuildSwapOptions): Promise<{
|
|
51
|
+
from: string;
|
|
52
|
+
to: string;
|
|
53
|
+
value: ethers.ethers.BigNumber;
|
|
54
|
+
data: string;
|
|
55
|
+
}>;
|
|
56
|
+
sendSwap({ network, walletId, quote }: SwapRequest): Promise<{
|
|
57
|
+
status: string;
|
|
58
|
+
swapTx: Transaction<EvmTypes.EthersTransactionResponse>;
|
|
59
|
+
swapTxHash: string;
|
|
60
|
+
}>;
|
|
61
|
+
newSwap({ network, walletId, quote }: SwapRequest): Promise<{
|
|
62
|
+
status: string;
|
|
63
|
+
swapTx: Transaction<EvmTypes.EthersTransactionResponse>;
|
|
64
|
+
swapTxHash: string;
|
|
65
|
+
id: string;
|
|
66
|
+
fee: number;
|
|
67
|
+
slippage: number;
|
|
68
|
+
}>;
|
|
69
|
+
estimateFees({ network, walletId, quote, feePrices }: EstimateFeeRequest): Promise<EstimateFeeResponse>;
|
|
70
|
+
getMin(): Promise<BN>;
|
|
71
|
+
waitForSendConfirmations({ swap, network, walletId }: NextSwapActionRequest<FastBtcWithdrawSwapHistoryItem>): Promise<{
|
|
72
|
+
transferId: string;
|
|
73
|
+
status: string;
|
|
74
|
+
} | undefined>;
|
|
75
|
+
waitForReceive({ swap, network, walletId }: NextSwapActionRequest<FastBtcWithdrawSwapHistoryItem>): Promise<{
|
|
76
|
+
receiveTxHash: any;
|
|
77
|
+
receiveTx: Transaction<any>;
|
|
78
|
+
endTime: number;
|
|
79
|
+
status: string;
|
|
80
|
+
} | {
|
|
81
|
+
receiveTxHash: any;
|
|
82
|
+
receiveTx: Transaction<any>;
|
|
83
|
+
status: string;
|
|
84
|
+
endTime?: undefined;
|
|
85
|
+
} | undefined>;
|
|
86
|
+
waitForReceiveConfirmations({ swap, network, walletId, }: NextSwapActionRequest<FastBtcWithdrawSwapHistoryItem>): Promise<{
|
|
87
|
+
receiveTx: Transaction<any>;
|
|
88
|
+
endTime: number;
|
|
89
|
+
status: string;
|
|
90
|
+
} | undefined>;
|
|
91
|
+
performNextSwapAction(_store: ActionContext, { network, walletId, swap }: NextSwapActionRequest<FastBtcWithdrawSwapHistoryItem>): Promise<Partial<{
|
|
92
|
+
transferId: string;
|
|
93
|
+
status: string;
|
|
94
|
+
}> | Partial<{
|
|
95
|
+
receiveTx: Transaction<any>;
|
|
96
|
+
endTime: number;
|
|
97
|
+
status: string;
|
|
98
|
+
}> | undefined>;
|
|
99
|
+
protected _getStatuses(): Record<string, SwapStatus>;
|
|
100
|
+
protected _txTypes(): {
|
|
101
|
+
SWAP: string;
|
|
102
|
+
};
|
|
103
|
+
protected _fromTxType(): string | null;
|
|
104
|
+
protected _toTxType(): string | null;
|
|
105
|
+
protected _timelineDiagramSteps(): string[];
|
|
106
|
+
protected _totalSteps(): number;
|
|
107
|
+
}
|
|
108
|
+
export { FastBTCWithdrawSwapProvider };
|