@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,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const types_1 = require("../store/types");
|
|
5
|
+
const asset_1 = require("./asset");
|
|
6
|
+
describe('asset tests', () => {
|
|
7
|
+
test('get native asset test', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
8
|
+
expect((0, asset_1.getNativeAsset)('DAI')).toBe('ETH');
|
|
9
|
+
expect((0, asset_1.getNativeAsset)('MATIC')).toBe('MATIC');
|
|
10
|
+
expect((0, asset_1.getNativeAsset)('UST')).toBe('UST');
|
|
11
|
+
expect((0, asset_1.getNativeAsset)('LUNA')).toBe('LUNA');
|
|
12
|
+
expect((0, asset_1.getNativeAsset)('SOV')).toBe('RBTC');
|
|
13
|
+
}));
|
|
14
|
+
test('is ERC20 test', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
+
expect((0, asset_1.isERC20)('ETH')).toBe(false);
|
|
16
|
+
expect((0, asset_1.isERC20)('DAI')).toBe(true);
|
|
17
|
+
expect((0, asset_1.isERC20)('USDT')).toBe(true);
|
|
18
|
+
expect((0, asset_1.isERC20)('NEAR')).toBe(false);
|
|
19
|
+
}));
|
|
20
|
+
test('isChainEvmCompatible', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
21
|
+
expect((0, asset_1.isChainEvmCompatible)('ETH')).toBe(true);
|
|
22
|
+
expect((0, asset_1.isERC20)('DAI')).toBe(true);
|
|
23
|
+
expect((0, asset_1.isERC20)('USDT')).toBe(true);
|
|
24
|
+
expect((0, asset_1.isERC20)('WBTC')).toBe(true);
|
|
25
|
+
expect((0, asset_1.isERC20)('NEAR')).toBe(false);
|
|
26
|
+
expect((0, asset_1.isERC20)('LUNA')).toBe(false);
|
|
27
|
+
expect((0, asset_1.isERC20)('BTC')).toBe(false);
|
|
28
|
+
}));
|
|
29
|
+
test('getTransactionExplorerLink test', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
30
|
+
let result = (0, asset_1.getTransactionExplorerLink)('f04298d08f77014851f1104a4d7a0248', 'ETH', types_1.Network.Mainnet);
|
|
31
|
+
expect(result).toContain('https://etherscan.io/tx/');
|
|
32
|
+
result = (0, asset_1.getTransactionExplorerLink)('f04298d08f77014851f1104a4d7a0248', 'DAI', types_1.Network.Mainnet);
|
|
33
|
+
expect(result).toContain('https://etherscan.io/tx/');
|
|
34
|
+
result = (0, asset_1.getTransactionExplorerLink)('f04298d08f77014851f1104a4d7a0248', 'USDT', types_1.Network.Mainnet);
|
|
35
|
+
expect(result).toContain('https://etherscan.io/tx/');
|
|
36
|
+
result = (0, asset_1.getTransactionExplorerLink)('f04298d08f77014851f1104a4d7a0248', 'WBTC', types_1.Network.Mainnet);
|
|
37
|
+
expect(result).toContain('https://etherscan.io/tx/');
|
|
38
|
+
result = (0, asset_1.getTransactionExplorerLink)('f04298d08f77014851f1104a4d7a0248', 'NEAR', types_1.Network.Mainnet);
|
|
39
|
+
expect(result).toContain('https://explorer.near.org/transactions/');
|
|
40
|
+
}));
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=asset.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asset.test.js","sourceRoot":"","sources":["../../../src/utils/asset.test.ts"],"names":[],"mappings":";;;AAAA,0CAAyC;AACzC,mCAAoG;AAEpG,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,IAAI,CAAC,uBAAuB,EAAE,GAAS,EAAE;QACvC,MAAM,CAAC,IAAA,sBAAc,EAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC1C,MAAM,CAAC,IAAA,sBAAc,EAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC9C,MAAM,CAAC,IAAA,sBAAc,EAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC1C,MAAM,CAAC,IAAA,sBAAc,EAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC5C,MAAM,CAAC,IAAA,sBAAc,EAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC7C,CAAC,CAAA,CAAC,CAAC;IAEH,IAAI,CAAC,eAAe,EAAE,GAAS,EAAE;QAC/B,MAAM,CAAC,IAAA,eAAO,EAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACnC,MAAM,CAAC,IAAA,eAAO,EAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClC,MAAM,CAAC,IAAA,eAAO,EAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnC,MAAM,CAAC,IAAA,eAAO,E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AM,EAAE,eAAO,CAAC,OAAO,CAAC,CAAC;QACjG,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,0BAA0B,CAAC,CAAC;QAErD,MAAM,GAAG,IAAA,kCAA0B,EAAC,kCAAkC,EAAE,MAAM,EAAE,eAAO,CAAC,OAAO,CAAC,CAAC;QACjG,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,0BAA0B,CAAC,CAAC;QAErD,MAAM,GAAG,IAAA,kCAA0B,EAAC,kCAAkC,EAAE,MAAM,EAAE,eAAO,CAAC,OAAO,CAAC,CAAC;QACjG,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,yCAAyC,CAAC,CAAC;IACtE,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HTLC_CONTRACT_ADDRESS = exports.assetsAdapter = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const cryptoassets_1 = require("@yaswap/cryptoassets");
|
|
6
|
+
const cryptoassets_2 = tslib_1.__importDefault(require("./cryptoassets"));
|
|
7
|
+
function assetsAdapter(assets) {
|
|
8
|
+
if (assets instanceof Array) {
|
|
9
|
+
return assets.reduce((result, asset) => {
|
|
10
|
+
if (cryptoassets_2.default[asset]) {
|
|
11
|
+
result.push(parseAsset(cryptoassets_2.default[asset]));
|
|
12
|
+
}
|
|
13
|
+
return result;
|
|
14
|
+
}, []);
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
const result = [];
|
|
18
|
+
if (cryptoassets_2.default[assets]) {
|
|
19
|
+
result.push(parseAsset(cryptoassets_2.default[assets]));
|
|
20
|
+
}
|
|
21
|
+
return result;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.assetsAdapter = assetsAdapter;
|
|
25
|
+
const parseAsset = (asset) => {
|
|
26
|
+
var _a;
|
|
27
|
+
if (asset.type === 'native') {
|
|
28
|
+
return Object.assign(Object.assign({}, asset), { isNative: true });
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
const chainifyAsset = Object.assign(Object.assign({}, asset), { isNative: false });
|
|
32
|
+
switch (asset.chain) {
|
|
33
|
+
case cryptoassets_1.ChainId.Solana:
|
|
34
|
+
return chainifyAsset;
|
|
35
|
+
default:
|
|
36
|
+
return Object.assign(Object.assign({}, chainifyAsset), { contractAddress: (_a = asset.contractAddress) === null || _a === void 0 ? void 0 : _a.toLowerCase() });
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
exports.HTLC_CONTRACT_ADDRESS = '0x133713376F69C1A67d7f3594583349DFB53d8166';
|
|
41
|
+
//# sourceMappingURL=chainify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chainify.js","sourceRoot":"","sources":["../../../src/utils/chainify.ts"],"names":[],"mappings":";;;;AACA,uDAAuD;AACvD,0EAA0C;AAE1C,SAAgB,aAAa,CAAC,MAAyB;IACrD,IAAI,MAAM,YAAY,KAAK,EAAE;QAC3B,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;YACrC,IAAI,sBAAY,CAAC,KAAK,CAAC,EAAE;gBACvB,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,sBAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;aAC9C;YACD,OAAO,MAAM,CAAC;QAChB,CAAC,EAAE,EAAqB,CAAC,CAAC;KAC3B;SAAM;QACL,MAAM,MAAM,GAAG,EAAE,CAAC;QAClB,IAAI,sBAAY,CAAC,MAAM,CAAC,EAAE;YACxB,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,sBAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;SAC/C;QACD,OAAO,MAAM,CAAC;KACf;AACH,CAAC;AAfD,sCAeC;AAED,MAAM,UAAU,GAAG,CAAC,KAAa,EAAE,EAAE;;IACnC,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE;QAC3B,OAAO,gCAAK,KAAK,KAAE,QAAQ,EAAE,IAAI,GAAS,CAAC;KAC5C;SAAM;QACL,MAAM,aAAa,mCACd,KAAK,KACR,QAAQ,EAAE,KAAK,GAChB,CAAC;QAGF,QAAQ,KAAK,CAAC,KAAK,EAAE;YACnB,KAAK,sBAAO,CAAC,MAAM;gBACjB,OAAO,aAAoB,CAAC;YAC9B;gBACE,OAAO,gCACF,aAAa,KAChB,eAAe,EAAE,MAAA,KAAK,CAAC,eAAe,0CAAE,WAAW,EAAE,GAC/C,CAAC;SACZ;KACF;AACH,CAAC,CAAC;AAEW,QAAA,qBAAqB,GAAG,4CAA4C,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BigNumber } from 'bignumber.js';
|
|
2
|
+
import { Asset } from '../store/types';
|
|
3
|
+
export declare const VALUE_DECIMALS = 6;
|
|
4
|
+
declare type Amount = number | BigNumber;
|
|
5
|
+
export declare const dp: (amount: Amount | string | BigNumber, coin: Asset) => string | number | BigNumber;
|
|
6
|
+
export declare const dpUI: (amount: Amount, dp?: number) => number | BigNumber;
|
|
7
|
+
export declare const prettyBalance: (amount: Amount, coin: Asset, dp?: number) => Amount;
|
|
8
|
+
export declare const prettyFiatBalance: (amount: Amount, rate: number) => string | BigNumber;
|
|
9
|
+
export declare const cryptoToFiat: (amount: Amount, rate: number) => BigNumber | "--";
|
|
10
|
+
export declare const fiatToCrypto: (amount: Amount, rate: number) => Amount;
|
|
11
|
+
export declare const formatFiat: (amount: BigNumber) => string | BigNumber;
|
|
12
|
+
export declare const formatFiatUI: (amount: number) => string | number;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatFiatUI = exports.formatFiat = exports.fiatToCrypto = exports.cryptoToFiat = exports.prettyFiatBalance = exports.prettyBalance = exports.dpUI = exports.dp = exports.VALUE_DECIMALS = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const cryptoassets_1 = require("@yaswap/cryptoassets");
|
|
6
|
+
const bignumber_js_1 = require("bignumber.js");
|
|
7
|
+
const cryptoassets_2 = tslib_1.__importDefault(require("./cryptoassets"));
|
|
8
|
+
exports.VALUE_DECIMALS = 6;
|
|
9
|
+
const dp = (amount, coin) => {
|
|
10
|
+
if (!amount)
|
|
11
|
+
return amount;
|
|
12
|
+
return new bignumber_js_1.BigNumber(amount).dp(cryptoassets_2.default[coin].decimals);
|
|
13
|
+
};
|
|
14
|
+
exports.dp = dp;
|
|
15
|
+
const dpUI = (amount, dp = exports.VALUE_DECIMALS) => {
|
|
16
|
+
if (!amount)
|
|
17
|
+
return amount;
|
|
18
|
+
return new bignumber_js_1.BigNumber(amount).dp(dp, bignumber_js_1.BigNumber.ROUND_FLOOR);
|
|
19
|
+
};
|
|
20
|
+
exports.dpUI = dpUI;
|
|
21
|
+
const prettyBalance = (amount, coin, dp = exports.VALUE_DECIMALS) => {
|
|
22
|
+
if (!amount || !coin)
|
|
23
|
+
return amount;
|
|
24
|
+
amount = (0, cryptoassets_1.unitToCurrency)(cryptoassets_2.default[coin], amount);
|
|
25
|
+
return (0, exports.dpUI)(amount, dp);
|
|
26
|
+
};
|
|
27
|
+
exports.prettyBalance = prettyBalance;
|
|
28
|
+
const prettyFiatBalance = (amount, rate) => {
|
|
29
|
+
const fiatAmount = (0, exports.cryptoToFiat)(amount, rate);
|
|
30
|
+
if (isNaN(fiatAmount))
|
|
31
|
+
return fiatAmount;
|
|
32
|
+
return (0, exports.formatFiat)(fiatAmount);
|
|
33
|
+
};
|
|
34
|
+
exports.prettyFiatBalance = prettyFiatBalance;
|
|
35
|
+
const cryptoToFiat = (amount, rate) => {
|
|
36
|
+
if (!rate)
|
|
37
|
+
return '--';
|
|
38
|
+
return new bignumber_js_1.BigNumber(amount).times(rate);
|
|
39
|
+
};
|
|
40
|
+
exports.cryptoToFiat = cryptoToFiat;
|
|
41
|
+
const fiatToCrypto = (amount, rate) => {
|
|
42
|
+
if (!rate)
|
|
43
|
+
return amount;
|
|
44
|
+
return new bignumber_js_1.BigNumber(amount).dividedBy(rate).dp(exports.VALUE_DECIMALS, bignumber_js_1.BigNumber.ROUND_FLOOR);
|
|
45
|
+
};
|
|
46
|
+
exports.fiatToCrypto = fiatToCrypto;
|
|
47
|
+
const formatFiat = (amount) => {
|
|
48
|
+
if (isNaN(amount))
|
|
49
|
+
return amount;
|
|
50
|
+
return amount.toFormat(2, bignumber_js_1.BigNumber.ROUND_CEIL);
|
|
51
|
+
};
|
|
52
|
+
exports.formatFiat = formatFiat;
|
|
53
|
+
const formatFiatUI = (amount) => {
|
|
54
|
+
const _amount = String(amount).replace(/,/g, '');
|
|
55
|
+
return isNaN(Number(_amount)) ? amount : '$' + amount;
|
|
56
|
+
};
|
|
57
|
+
exports.formatFiatUI = formatFiatUI;
|
|
58
|
+
//# sourceMappingURL=coinFormatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coinFormatter.js","sourceRoot":"","sources":["../../../src/utils/coinFormatter.ts"],"names":[],"mappings":";;;;AAAA,uDAAsD;AACtD,+CAAyC;AAEzC,0EAA0C;AAE7B,QAAA,cAAc,GAAG,CAAC,CAAC;AAIzB,MAAM,EAAE,GAAG,CAAC,MAAmC,EAAE,IAAW,EAAE,EAAE;IACrE,IAAI,CAAC,MAAM;QAAE,OAAO,MAAM,CAAC;IAC3B,OAAO,IAAI,wBAAS,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,sBAAY,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC;AAC/D,CAAC,CAAC;AAHW,QAAA,EAAE,MAGb;AAEK,MAAM,IAAI,GAAG,CAAC,MAAc,EAAE,EAAE,GAAG,sBAAc,EAAE,EA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AC,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,sBAAc,EAAE,wBAAS,CAAC,WAAW,CAAC,CAAC;AACzF,CAAC,CAAC;AAHW,QAAA,YAAY,gBAGvB;AAEK,MAAM,UAAU,GAAG,CAAC,MAAiB,EAAE,EAAE;IAE9C,IAAI,KAAK,CAAC,MAAM,CAAC;QAAE,OAAO,MAAM,CAAC;IACjC,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,wBAAS,CAAC,UAAU,CAAC,CAAC;AAClD,CAAC,CAAC;AAJW,QAAA,UAAU,cAIrB;AAEK,MAAM,YAAY,GAAG,CAAC,MAAc,EAAE,EAAE;IAC7C,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACjD,OAAO,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,GAAG,MAAM,CAAC;AACxD,CAAC,CAAC;AAHW,QAAA,YAAY,gBAGvB"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.decrypt = exports.encrypt = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const crypto_js_1 = require("crypto-js");
|
|
6
|
+
const walletOptions_1 = require("../walletOptions");
|
|
7
|
+
const PBKDF2_ITERATIONS = 1000000;
|
|
8
|
+
const PBKDF2_LENGTH = 32;
|
|
9
|
+
const PBKDF2_DIGEST = 'sha256';
|
|
10
|
+
function pbkdf2(password, salt) {
|
|
11
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
12
|
+
return walletOptions_1.walletOptionsStore.walletOptions.crypto.pbkdf2(password, salt, PBKDF2_ITERATIONS, PBKDF2_LENGTH, PBKDF2_DIGEST);
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
const JsonFormatter = {
|
|
16
|
+
stringify(cipherParams) {
|
|
17
|
+
const jsonObj = {
|
|
18
|
+
ct: cipherParams.ciphertext.toString(crypto_js_1.enc.Base64),
|
|
19
|
+
};
|
|
20
|
+
if (cipherParams.iv) {
|
|
21
|
+
jsonObj.iv = cipherParams.iv.toString();
|
|
22
|
+
}
|
|
23
|
+
if (cipherParams.salt) {
|
|
24
|
+
jsonObj.s = cipherParams.salt.toString();
|
|
25
|
+
}
|
|
26
|
+
return JSON.stringify(jsonObj);
|
|
27
|
+
},
|
|
28
|
+
parse(jsonStr) {
|
|
29
|
+
const jsonObj = JSON.parse(jsonStr);
|
|
30
|
+
const cipherParams = crypto_js_1.lib.CipherParams.create({
|
|
31
|
+
ciphertext: crypto_js_1.enc.Base64.parse(jsonObj.ct),
|
|
32
|
+
});
|
|
33
|
+
if (jsonObj.iv) {
|
|
34
|
+
cipherParams.iv = crypto_js_1.enc.Hex.parse(jsonObj.iv);
|
|
35
|
+
}
|
|
36
|
+
if (jsonObj.s) {
|
|
37
|
+
cipherParams.salt = crypto_js_1.enc.Hex.parse(jsonObj.s);
|
|
38
|
+
}
|
|
39
|
+
return cipherParams;
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
function encrypt(value, key) {
|
|
43
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
const keySalt = crypto_js_1.enc.Hex.stringify(crypto_js_1.lib.WordArray.random(16));
|
|
45
|
+
const derivedKey = yield pbkdf2(key, keySalt);
|
|
46
|
+
const rawEncryptedValue = yield walletOptions_1.walletOptionsStore.walletOptions.crypto.encrypt(value, derivedKey);
|
|
47
|
+
return {
|
|
48
|
+
encrypted: JsonFormatter.stringify(rawEncryptedValue),
|
|
49
|
+
keySalt,
|
|
50
|
+
};
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
exports.encrypt = encrypt;
|
|
54
|
+
function decrypt(encrypted, key, keySalt) {
|
|
55
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
if (!keySalt)
|
|
57
|
+
return false;
|
|
58
|
+
const encryptedValue = JsonFormatter.parse(encrypted);
|
|
59
|
+
try {
|
|
60
|
+
const derivedKey = yield pbkdf2(key, keySalt);
|
|
61
|
+
const decryptedValue = yield walletOptions_1.walletOptionsStore.walletOptions.crypto.decrypt(encryptedValue, derivedKey);
|
|
62
|
+
return decryptedValue.toString(crypto_js_1.enc.Utf8);
|
|
63
|
+
}
|
|
64
|
+
catch (e) {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
exports.decrypt = decrypt;
|
|
70
|
+
//# sourceMappingURL=crypto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto.js","sourceRoot":"","sources":["../../../src/utils/crypto.ts"],"names":[],"mappings":";;;;AAAA,yCAAmD;AACnD,oDAAsD;AAEtD,MAAM,iBAAiB,GAAG,OAAO,CAAC;AAClC,MAAM,aAAa,GAAG,EAAE,CAAC;AACzB,MAAM,aAAa,GAAG,QAAQ,CAAC;AAE/B,SAAe,MAAM,CAAC,QAAgB,EAAE,IAAY;;QAClD,OAAO,kCAAkB,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,CACnD,QAAQ,EACR,IAAI,EACJ,iBAAiB,EACjB,aAAa,EACb,aAAa,CACd,CAAC;IACJ,CAAC;CAAA;AAED,MAAM,aAAa,GAAG;IACpB,SAAS,CAAC,YAAuD;QAC/D,MAAM,OAAO,GAA4C;YACvD,EAAE,EAAE,YAAY,CAAC,UAAU,CAAC,QAAQ,CAAC,eAAG,CAAC,MAAM,CAAC;SACjD,CAAC;QAEF,IAAI,YAAY,CAAC,EAAE,EAAE;YACnB,OAAO,CAAC,EAAE,GAAG,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC;SACzC;QAED,IAAI,YAAY,CAAC,IAAI,EAAE;YACrB,OAAO,CAAC,CAAC,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AI,CAAC,OAAO;YAAE,OAAO,KAAK,CAAC;QAE3B,MAAM,cAAc,GAAG,aAAa,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QACtD,IAAI;YACF,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;YAC9C,MAAM,cAAc,GAAG,MAAM,kCAAkB,CAAC,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;YACzG,OAAO,cAAc,CAAC,QAAQ,CAAC,eAAG,CAAC,IAAI,CAAC,CAAC;SAC1C;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,KAAK,CAAC;SACd;IACH,CAAC;CAAA;AAEiB,0BAAO"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
let store;
|
|
4
|
+
function getStore() {
|
|
5
|
+
if (store) {
|
|
6
|
+
return store;
|
|
7
|
+
}
|
|
8
|
+
store = require('../store').default;
|
|
9
|
+
return store;
|
|
10
|
+
}
|
|
11
|
+
const cryptoassets = new Proxy({}, {
|
|
12
|
+
get(_target, name, receiver) {
|
|
13
|
+
return Reflect.get(Object.assign({}, getStore().getters.cryptoassets), name, receiver);
|
|
14
|
+
},
|
|
15
|
+
ownKeys() {
|
|
16
|
+
return Reflect.ownKeys(getStore().getters.cryptoassets);
|
|
17
|
+
},
|
|
18
|
+
getOwnPropertyDescriptor() {
|
|
19
|
+
return {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
configurable: true,
|
|
22
|
+
};
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
exports.default = cryptoassets;
|
|
26
|
+
//# sourceMappingURL=cryptoassets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cryptoassets.js","sourceRoot":"","sources":["../../../src/utils/cryptoassets.ts"],"names":[],"mappings":";;AAIA,IAAI,KAAoB,CAAC;AAGzB,SAAS,QAAQ;IACf,IAAI,KAAK,EAAE;QACT,OAAO,KAAK,CAAC;KACd;IAED,KAAK,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC;IACpC,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,YAAY,GAAgC,IAAI,KAAK,CACzD,EAAE,EACF;IACE,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,QAAQ;QACzB,OAAO,OAAO,CAAC,GAAG,mBAAM,QAAQ,EAAE,CAAC,OAAO,CAAC,YAAY,GAAI,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO;QACL,OAAO,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IAC1D,CAAC;IACD,wBAAwB;QACtB,OAAO;YACL,UAAU,EAAE,IAAI;YAChB,YAAY,EAAE,IAAI;SACnB,CAAC;IACJ,CAAC;CACF,CACF,CAAC;AAEF,kBAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ChainId } from '@yaswap/cryptoassets';
|
|
2
|
+
import { AccountType, Network } from '../store/types';
|
|
3
|
+
export declare type DerivationPathCreator = {
|
|
4
|
+
[key in ChainId]?: (network: Network, index: number, accountType?: AccountType) => string;
|
|
5
|
+
};
|
|
6
|
+
export declare const getDerivationPath: (chainId: ChainId, network: Network, index: number, accountType: AccountType) => string;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDerivationPath = void 0;
|
|
4
|
+
const bitcoin_1 = require("@yaswap/bitcoin");
|
|
5
|
+
const cryptoassets_1 = require("@yaswap/cryptoassets");
|
|
6
|
+
const error_parser_1 = require("@yaswap/error-parser");
|
|
7
|
+
const types_1 = require("../store/types");
|
|
8
|
+
const address_1 = require("./address");
|
|
9
|
+
const ledger_1 = require("./ledger");
|
|
10
|
+
const getDerivationPath = (chainId, network, index, accountType) => {
|
|
11
|
+
const pathFunction = derivationPaths[chainId];
|
|
12
|
+
if (!pathFunction) {
|
|
13
|
+
const chain = (0, cryptoassets_1.getChain)(network, chainId);
|
|
14
|
+
if (chain.isEVM) {
|
|
15
|
+
return getEVMBasedDerivationPath(chain.network.coinType, index, accountType);
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
throw (0, error_parser_1.createInternalError)(error_parser_1.CUSTOM_ERRORS.NotFound.Chain.DerivationPath(chainId));
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return pathFunction(network, index, accountType);
|
|
22
|
+
};
|
|
23
|
+
exports.getDerivationPath = getDerivationPath;
|
|
24
|
+
const derivationPaths = {
|
|
25
|
+
[cryptoassets_1.ChainId.Rootstock]: (network, index, accountType = types_1.AccountType.Default) => {
|
|
26
|
+
let coinType;
|
|
27
|
+
if (accountType === types_1.AccountType.RskLedger) {
|
|
28
|
+
coinType = network === 'mainnet' ? '137' : '37310';
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
coinType = (0, cryptoassets_1.getChain)(network, cryptoassets_1.ChainId.Rootstock).network.coinType;
|
|
32
|
+
}
|
|
33
|
+
return getEVMBasedDerivationPath(coinType, index, accountType);
|
|
34
|
+
},
|
|
35
|
+
[cryptoassets_1.ChainId.Bitcoin]: (network, index, accountType = types_1.AccountType.Default) => {
|
|
36
|
+
const coinType = (0, cryptoassets_1.getChain)(network, cryptoassets_1.ChainId.Bitcoin).network.coinType;
|
|
37
|
+
return getBitcoinDerivationPath(accountType, coinType, index);
|
|
38
|
+
},
|
|
39
|
+
[cryptoassets_1.ChainId.Yacoin]: (network, index) => {
|
|
40
|
+
const coinType = (0, cryptoassets_1.getChain)(network, cryptoassets_1.ChainId.Yacoin).network.coinType;
|
|
41
|
+
return `84'/${coinType}'/${index}'`;
|
|
42
|
+
},
|
|
43
|
+
[cryptoassets_1.ChainId.Near]: (network, index) => {
|
|
44
|
+
const coinType = (0, cryptoassets_1.getChain)(network, cryptoassets_1.ChainId.Near).network.coinType;
|
|
45
|
+
return `m/44'/${coinType}'/${index}'`;
|
|
46
|
+
},
|
|
47
|
+
[cryptoassets_1.ChainId.Solana]: (network, index) => {
|
|
48
|
+
const coinType = (0, cryptoassets_1.getChain)(network, cryptoassets_1.ChainId.Solana).network.coinType;
|
|
49
|
+
return `m/44'/${coinType}'/${index}'/0'`;
|
|
50
|
+
},
|
|
51
|
+
[cryptoassets_1.ChainId.Terra]: (network, index) => {
|
|
52
|
+
const coinType = (0, cryptoassets_1.getChain)(network, cryptoassets_1.ChainId.Terra).network.coinType;
|
|
53
|
+
return `'m/44'/${coinType}'/${index}'`;
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
const getEVMBasedDerivationPath = (coinType, index, accountType = types_1.AccountType.Default) => {
|
|
57
|
+
if (accountType === types_1.AccountType.EthereumLedger || accountType === types_1.AccountType.RskLedger) {
|
|
58
|
+
return `m/44'/${coinType}'/${index}'/0/0`;
|
|
59
|
+
}
|
|
60
|
+
return `m/44'/${coinType}'/0'/0/${index}`;
|
|
61
|
+
};
|
|
62
|
+
const getBitcoinDerivationPath = (accountType, coinType, index) => {
|
|
63
|
+
if (accountType.includes('ledger')) {
|
|
64
|
+
const option = ledger_1.LEDGER_BITCOIN_OPTIONS.find((o) => o.name === accountType);
|
|
65
|
+
if (!option) {
|
|
66
|
+
throw (0, error_parser_1.createInternalError)(error_parser_1.CUSTOM_ERRORS.NotFound.AccountTypeOption(accountType));
|
|
67
|
+
}
|
|
68
|
+
const { addressType } = option;
|
|
69
|
+
return `${address_1.BTC_ADDRESS_TYPE_TO_PREFIX[addressType]}'/${coinType}'/${index}'`;
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
return `${address_1.BTC_ADDRESS_TYPE_TO_PREFIX[bitcoin_1.BitcoinTypes.AddressType.BECH32]}'/${coinType}'/${index}'`;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
//# sourceMappingURL=derivationPath.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"derivationPath.js","sourceRoot":"","sources":["../../../src/utils/derivationPath.ts"],"names":[],"mappings":";;;AAAA,6CAA+C;AAC/C,uDAAyD;AACzD,uDAA0E;AAC1E,0CAAsD;AACtD,uCAAuD;AACvD,qCAAkD;AAM3C,MAAM,iBAAiB,GAAG,CAAC,OAAgB,EAAE,OAAgB,EAAE,KAAa,EAAE,WAAwB,EAAE,EAAE;IAC/G,MAAM,YAAY,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;IAE9C,IAAI,CAAC,YAAY,EAAE;QACjB,MAAM,KAAK,GAAG,IAAA,uBAAQ,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAGzC,IAAI,KAAK,CAAC,KAAK,EAAE;YACf,OAAO,yBAAyB,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;SAC9E;aAAM;YACL,MAAM,IAAA,kCAAmB,EAAC,4BAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;SACjF;KACF;IAED,OAAO,YAAY,CAAC,OAAO,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;AACnD,CAAC,CAAC;AAfW,QAAA,iBAAiB,qBAe5B;AAEF,MAAM,eAAe,GAA0B;IAE7C,CAAC,sBAAO,CAAC,SAAS,CAAC,EAAE,CAAC,OAAgB,EAAE,KAAa,EAAE,WAAW,GAAG,mBAAW,CAAC,OAAO,EAAE,EAAE;QAC1F,IAAI,QAAQ,CAAC;QACb,IAAI,WAAW,KAAK,mBAAW,CAAC,SAAS,EAAE;YACzC,QAAQ,GAAG,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC;SACpD;aAAM;YACL,QAAQ,GAAG,IAAA,uBAAQ,EAA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H,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const cryptoassets_1 = require("@yaswap/cryptoassets");
|
|
4
|
+
const types_1 = require("../store/types");
|
|
5
|
+
const derivationPath_1 = require("./derivationPath");
|
|
6
|
+
test('get bitcoin derivation path for default account type Segwit', () => {
|
|
7
|
+
expect((0, derivationPath_1.getDerivationPath)(cryptoassets_1.ChainId.Bitcoin, types_1.Network.Mainnet, 0, types_1.AccountType.Default)).toBe("84'/0'/0'");
|
|
8
|
+
});
|
|
9
|
+
test('get bitcoin derivation path for ledger account type Segwit', () => {
|
|
10
|
+
expect((0, derivationPath_1.getDerivationPath)(cryptoassets_1.ChainId.Bitcoin, types_1.Network.Mainnet, 0, types_1.AccountType.BitcoinLedgerNativeSegwit)).toBe("84'/0'/0'");
|
|
11
|
+
});
|
|
12
|
+
test('get bitcoin derivation path for ledger account type Legacy', () => {
|
|
13
|
+
expect((0, derivationPath_1.getDerivationPath)(cryptoassets_1.ChainId.Bitcoin, types_1.Network.Mainnet, 0, types_1.AccountType.BitcoinLedgerLegacy)).toBe("44'/0'/0'");
|
|
14
|
+
});
|
|
15
|
+
test('get ETH derivation path for default accounts on mainnet and testnet', () => {
|
|
16
|
+
const ethPathMainnet = (0, derivationPath_1.getDerivationPath)(cryptoassets_1.ChainId.Ethereum, types_1.Network.Mainnet, 0, types_1.AccountType.Default);
|
|
17
|
+
const ethPathTestnet = (0, derivationPath_1.getDerivationPath)(cryptoassets_1.ChainId.Ethereum, types_1.Network.Testnet, 0, types_1.AccountType.Default);
|
|
18
|
+
expect(ethPathMainnet).toBe("m/44'/60'/0'/0/0");
|
|
19
|
+
expect(ethPathMainnet).toEqual(ethPathTestnet);
|
|
20
|
+
});
|
|
21
|
+
test('get RSK derivation path for Ledger accounts on mainnet', () => {
|
|
22
|
+
expect((0, derivationPath_1.getDerivationPath)(cryptoassets_1.ChainId.Rootstock, types_1.Network.Mainnet, 0, types_1.AccountType.RskLedger)).toBe("m/44'/137'/0'/0/0");
|
|
23
|
+
});
|
|
24
|
+
test('get RSK derivation path for Ledger accounts on testnet', () => {
|
|
25
|
+
expect((0, derivationPath_1.getDerivationPath)(cryptoassets_1.ChainId.Rootstock, types_1.Network.Testnet, 0, types_1.AccountType.RskLedger)).toBe("m/44'/37310'/0'/0/0");
|
|
26
|
+
});
|
|
27
|
+
test('get RSK derivation path for default accounts on mainnet', () => {
|
|
28
|
+
const ethPath = (0, derivationPath_1.getDerivationPath)(cryptoassets_1.ChainId.Ethereum, types_1.Network.Mainnet, 0, types_1.AccountType.Default);
|
|
29
|
+
expect((0, derivationPath_1.getDerivationPath)(cryptoassets_1.ChainId.Rootstock, types_1.Network.Mainnet, 0, types_1.AccountType.Default)).toBe("m/44'/60'/0'/0/0");
|
|
30
|
+
expect(ethPath).toEqual(ethPath);
|
|
31
|
+
});
|
|
32
|
+
test('get RSK derivation path for default accounts on testnet', () => {
|
|
33
|
+
const ethPath = (0, derivationPath_1.getDerivationPath)(cryptoassets_1.ChainId.Ethereum, types_1.Network.Testnet, 0, types_1.AccountType.Default);
|
|
34
|
+
expect((0, derivationPath_1.getDerivationPath)(cryptoassets_1.ChainId.Rootstock, types_1.Network.Testnet, 0, types_1.AccountType.Default)).toBe("m/44'/60'/0'/0/0");
|
|
35
|
+
expect(ethPath).toEqual(ethPath);
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=derivationPath.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"derivationPath.spec.js","sourceRoot":"","sources":["../../../src/utils/derivationPath.spec.ts"],"names":[],"mappings":";;AACA,uDAA+C;AAC/C,0CAAsD;AACtD,qDAAqD;AAGrD,IAAI,CAAC,6DAA6D,EAAE,GAAG,EAAE;IACvE,MAAM,CAAC,IAAA,kCAAiB,EAAC,sBAAO,C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AAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCSVContent = void 0;
|
|
4
|
+
const getCSVContent = (data, headers) => {
|
|
5
|
+
if (!data == null || !data.length) {
|
|
6
|
+
return null;
|
|
7
|
+
}
|
|
8
|
+
const columnDelimiter = ',';
|
|
9
|
+
const lineDelimiter = '\n';
|
|
10
|
+
let result = `${headers.map((h) => h.label).join(columnDelimiter)}${lineDelimiter}`;
|
|
11
|
+
data.forEach((item) => {
|
|
12
|
+
let ctr = 0;
|
|
13
|
+
headers.forEach((header) => {
|
|
14
|
+
if (ctr > 0)
|
|
15
|
+
result += columnDelimiter;
|
|
16
|
+
result += item[header.key];
|
|
17
|
+
ctr++;
|
|
18
|
+
});
|
|
19
|
+
result += lineDelimiter;
|
|
20
|
+
});
|
|
21
|
+
return result;
|
|
22
|
+
};
|
|
23
|
+
exports.getCSVContent = getCSVContent;
|
|
24
|
+
//# sourceMappingURL=export.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export.js","sourceRoot":"","sources":["../../../src/utils/export.ts"],"names":[],"mappings":";;;AAEO,MAAM,aAAa,GAAG,CAAC,IAAmB,EAAE,OAAyC,EAAE,EAAE;IAC9F,IAAI,CAAC,IAAI,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;QACjC,OAAO,IAAI,CAAC;KACb;IAED,MAAM,eAAe,GAAG,GAAG,CAAC;IAC5B,MAAM,aAAa,GAAG,IAAI,CAAC;IAE3B,IAAI,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,GAAG,aAAa,EAAE,CAAC;IAEpF,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACpB,IAAI,GAAG,GAAG,CAAC,CAAC;QACZ,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;YACzB,IAAI,GAAG,GAAG,CAAC;gBAAE,MAAM,IAAI,eAAe,CAAC;YAEvC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,GAAwB,CAAC,CAAC;YAChD,GAAG,EAAE,CAAC;QACR,CAAC,CAAC,CAAC;QACH,MAAM,IAAI,aAAa,CAAC;IAC1B,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAtBW,QAAA,aAAa,iBAsBxB"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ChainId, EIP1559Fee, FeeDetail, FeeDetails, FeeType } from '@yaswap/types';
|
|
2
|
+
import BN from 'bignumber.js';
|
|
3
|
+
import { AccountId, Asset, Network, NFT } from '../store/types';
|
|
4
|
+
declare type FeeUnits = {
|
|
5
|
+
[asset: Asset]: number;
|
|
6
|
+
};
|
|
7
|
+
interface FeeDetailsWithCustom extends FeeDetails {
|
|
8
|
+
custom: FeeDetail;
|
|
9
|
+
}
|
|
10
|
+
declare type SendFees = {
|
|
11
|
+
[speed in keyof FeeDetailsWithCustom]: BN;
|
|
12
|
+
};
|
|
13
|
+
declare function newSendFees(): SendFees;
|
|
14
|
+
declare const FEE_OPTIONS: {
|
|
15
|
+
SLOW: {
|
|
16
|
+
name: string;
|
|
17
|
+
label: string;
|
|
18
|
+
};
|
|
19
|
+
AVERAGE: {
|
|
20
|
+
name: string;
|
|
21
|
+
label: string;
|
|
22
|
+
};
|
|
23
|
+
FAST: {
|
|
24
|
+
name: string;
|
|
25
|
+
label: string;
|
|
26
|
+
};
|
|
27
|
+
CUSTOM: {
|
|
28
|
+
name: string;
|
|
29
|
+
label: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
declare function getSendFee(asset: Asset, feePrice: number, l1FeePrice?: number, network?: Network): BN;
|
|
33
|
+
declare function getTxFee(units: FeeUnits, _asset: Asset, _feePrice: number): BN;
|
|
34
|
+
declare function getFeeLabel(fee: string): string;
|
|
35
|
+
declare function isEIP1559Fees(chain: ChainId): boolean;
|
|
36
|
+
declare function probableFeePerUnitEIP1559(suggestedGasFee: EIP1559Fee): number;
|
|
37
|
+
declare function maxFeePerUnitEIP1559(suggestedGasFee: EIP1559Fee): number;
|
|
38
|
+
declare function feePerUnit(suggestedGasFee: FeeType, chain: ChainId): number;
|
|
39
|
+
declare function getSendTxFees(accountId: AccountId, asset: Asset, amount?: BN, customFee?: FeeType): Promise<SendFees>;
|
|
40
|
+
declare function sendTxFeesInNativeAsset(asset: Asset, suggestedGasFees: FeeDetailsWithCustom, sendFees?: SendFees): SendFees;
|
|
41
|
+
declare function sendBitcoinTxFees(accountId: AccountId, asset: Asset, suggestedGasFees: FeeDetailsWithCustom, amount?: BN, sendFees?: SendFees): Promise<SendFees>;
|
|
42
|
+
declare function estimateTransferNFT(accountId: AccountId, network: Network, receiver: string, values: number[], nft: NFT, customFee?: FeeType): Promise<SendFees>;
|
|
43
|
+
export { FEE_OPTIONS, getSendFee, getTxFee, getFeeLabel, isEIP1559Fees, getSendTxFees, sendTxFeesInNativeAsset, sendBitcoinTxFees, probableFeePerUnitEIP1559, maxFeePerUnitEIP1559, feePerUnit, newSendFees, estimateTransferNFT, };
|