@swapkit/helpers
Advanced tools
Comparing version 1.5.1 to 1.6.0
@@ -1,6 +0,6 @@ | ||
var e=((x)=>typeof require!=="undefined"?require:typeof Proxy!=="undefined"?new Proxy(x,{get:(F,H)=>(typeof require!=="undefined"?require:F)[H]}):x)(function(x){if(typeof require!=="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+x+'" is not supported')});export*from"@swapkit/contracts";var d;((P)=>{P.Arbitrum="https://arb1.arbitrum.io/rpc";P.Avalanche="https://node-router.thorswap.net/avalanche-c";P.BinanceSmartChain="https://bsc-dataseed.binance.org";P.Bitcoin="https://node-router.thorswap.net/bitcoin";P.BitcoinCash="https://node-router.thorswap.net/bitcoin-cash";P.Chainflip="wss://mainnet-archive.chainflip.io";P.Cosmos="https://node-router.thorswap.net/cosmos/rpc";P.Dash="https://node-router.thorswap.net/dash";P.Dogecoin="https://node-router.thorswap.net/dogecoin";P.Ethereum="https://node-router.thorswap.net/ethereum";P.Kujira="https://rpc-kujira.synergynodes.com/";P.Litecoin="https://node-router.thorswap.net/litecoin";P.Maya="https://tendermint.mayachain.info";P.MayaStagenet="https://stagenet.tendermint.mayachain.info";P.Optimism="https://mainnet.optimism.io";P.Polkadot="wss://rpc.polkadot.io";P.Polygon="https://polygon-rpc.com";P.Radix="https://radix-mainnet.rpc.grove.city/v1/326002fc/core";P.THORChain="https://rpc.thorswap.net";P.THORChainStagenet="https://stagenet-rpc.ninerealms.com";P.Solana="https://mainnet.helius-rpc.com/?api-key=2cbe3ae6-cfc5-4141-a093-0055d0fa3d80"})(d||={});var t;((k)=>{k.Arbitrum="https://arbiscan.io";k.Avalanche="https://snowtrace.io";k.BinanceSmartChain="https://bscscan.com";k.Bitcoin="https://blockchair.com/bitcoin";k.BitcoinCash="https://www.blockchair.com/bitcoin-cash";k.Chainflip="https://explorer.polkascan.io/polkadot";k.Cosmos="https://www.mintscan.io/cosmos";k.Dash="https://blockchair.com/dash";k.Dogecoin="https://blockchair.com/dogecoin";k.Ethereum="https://etherscan.io";k.Kujira="https://finder.kujira.network/kaiyo-1";k.Litecoin="https://blockchair.com/litecoin";k.Maya="https://www.mayascan.org";k.Optimism="https://optimistic.etherscan.io";k.Polkadot="https://polkadot.subscan.io";k.Polygon="https://polygonscan.com";k.Radix="https://dashboard.radixdlt.com";k.THORChain="https://runescan.io";k.Solana="https://solscan.io"})(t||={});var Y;((k)=>{k.Arbitrum="ARB";k.Avalanche="AVAX";k.BinanceSmartChain="BSC";k.Bitcoin="BTC";k.BitcoinCash="BCH";k.Cosmos="GAIA";k.Dash="DASH";k.Dogecoin="DOGE";k.Ethereum="ETH";k.Kujira="KUJI";k.Litecoin="LTC";k.Maya="MAYA";k.Optimism="OP";k.Polkadot="DOT";k.Chainflip="FLIP";k.Polygon="MATIC";k.Radix="XRD";k.THORChain="THOR";k.Solana="SOL"})(Y||={});var u;((A)=>{A.Arbitrum="42161";A.ArbitrumHex="0xa4b1";A.Avalanche="43114";A.AvalancheHex="0xa86a";A.BinanceSmartChain="56";A.BinanceSmartChainHex="0x38";A.Bitcoin="bitcoin";A.BitcoinCash="bitcoincash";A.Chainflip="chainflip";A.Cosmos="cosmoshub-4";A.Dash="dash";A.Dogecoin="dogecoin";A.Kujira="kaiyo-1";A.Ethereum="1";A.EthereumHex="0x1";A.Litecoin="litecoin";A.Maya="mayachain-mainnet-v1";A.MayaStagenet="mayachain-stagenet-v1";A.Optimism="10";A.OptimismHex="0xa";A.Polkadot="polkadot";A.Polygon="137";A.PolygonHex="0x89";A.Radix="radix-mainnet";A.THORChain="thorchain-mainnet-v1";A.THORChainStagenet="thorchain-stagenet-v2";A.Solana="solana"})(u||={});var kF={["0xa4b1"]:"ARB",["42161"]:"ARB",["0xa86a"]:"AVAX",["43114"]:"AVAX",["0x38"]:"BSC",["56"]:"BSC",["bitcoincash"]:"BCH",["bitcoin"]:"BTC",["chainflip"]:"FLIP",["cosmoshub-4"]:"GAIA",["dash"]:"DASH",["dogecoin"]:"DOGE",["0x1"]:"ETH",["kaiyo-1"]:"KUJI",["1"]:"ETH",["litecoin"]:"LTC",["mayachain-stagenet-v1"]:"MAYA",["mayachain-mainnet-v1"]:"MAYA",["0xa"]:"OP",["10"]:"OP",["polkadot"]:"DOT",["0x89"]:"MATIC",["137"]:"MATIC",["radix-mainnet"]:"XRD",["thorchain-stagenet-v2"]:"THOR",["thorchain-mainnet-v1"]:"THOR",["solana"]:"SOL"},$x=Object.keys(Y),C=Object.values(Y),z;((T)=>{T[T.ARB=18]="ARB";T[T.AVAX=18]="AVAX";T[T.BCH=8]="BCH";T[T.BSC=18]="BSC";T[T.BTC=8]="BTC";T[T.DASH=8]="DASH";T[T.DOGE=8]="DOGE";T[T.DOT=10]="DOT";T[T.ETH=18]="ETH";T[T.FLIP=18]="FLIP";T[T.GAIA=6]="GAIA";T[T.KUJI=6]="KUJI";T[T.LTC=8]="LTC";T[T.MATIC=18]="MATIC";T[T.MAYA=8]="MAYA";T[T.OP=18]="OP";T[T.SOL=9]="SOL";T[T.THOR=8]="THOR";T[T.XRD=18]="XRD";T[T.ZEC=8]="ZEC"})(z||={});var TF=["DOT","FLIP"],y=["ETH","AVAX","BSC","ARB","OP","MATIC"],_F=["BTC","BCH","DASH","DOGE","LTC"],GF=["GAIA","THOR","MAYA","KUJI"],LF=["AVAX","BSC","BTC","BCH","GAIA","DOGE","ETH","LTC","THOR"],AF=["ARB","DASH","ETH","KUJI","MAYA","THOR"],v=C.reduce((x,F)=>{const H=$x.find((n)=>Y[n]===F);if(H)x[F]=H;return x},{}),xx=C.reduce((x,F)=>{return x[F]=u[v[F]],x},{}),m=C.reduce((x,F)=>{return x[F]=d[v[F]],x},{}),OF=C.reduce((x,F)=>{const H=`${v[F]}Hex`;return x[F]=u[H],x},{}),PF=C.reduce((x,F)=>{return x[F]=t[v[F]],x},{});var Xx;((X)=>{X.TC_SUPPORTED_TO_TC_SUPPORTED="TC-TC";X.TC_SUPPORTED_TO_ETH="TC-ERC20";X.TC_SUPPORTED_TO_AVAX="TC-ARC20";X.TC_SUPPORTED_TO_BSC="TC-BEP20";X.ETH_TO_TC_SUPPORTED="ERC20-TC";X.ETH_TO_ETH="ERC20-ERC20";X.ETH_TO_AVAX="ERC20-ARC20";X.ETH_TO_BSC="ERC20-BEP20";X.AVAX_TO_TC_SUPPORTED="ARC20-TC";X.AVAX_TO_ETH="ARC20-ERC20";X.AVAX_TO_AVAX="ARC20-ARC20";X.AVAX_TO_BSC="ARC20-BEP20";X.BSC_TO_TC_SUPPORTED="BEP20-TC";X.BSC_TO_ETH="BEP20-ERC20";X.BSC_TO_AVAX="BEP20-ARC20";X.BSC_TO_BSC="BEP20-BEP20"})(Xx||={});var XF=["ERC20-ERC20","ARC20-ARC20","BEP20-BEP20"],jF=["ERC20-TC","ERC20-ARC20","ERC20-BEP20","ARC20-TC","ARC20-ERC20","ARC20-BEP20","BEP20-TC","BEP20-ERC20","BEP20-ARC20"],JF=["TC-TC","TC-ERC20","TC-ARC20","TC-BEP20"];var jx;((I)=>{I.ARB="0x0000000000000000000000000000000000000000";I.AVAX="0x0000000000000000000000000000000000000000";I.ETH="0x0000000000000000000000000000000000000000";I.BSC="0x0000000000000000000000000000000000000000";I.MATIC="0x0000000000000000000000000000000000001010";I.OP="0x4200000000000000000000000000000000000042"})(jx||={});var Jx;((k)=>{k.ARB="m/44'/60'/0'/0";k.AVAX="m/44'/60'/0'/0";k.BCH="m/44'/145'/0'/0";k.BSC="m/44'/60'/0'/0";k.BTC="m/84'/0'/0'/0";k.DASH="m/44'/5'/0'/0";k.DOGE="m/44'/3'/0'/0";k.DOT="////";k.ETH="m/44'/60'/0'/0";k.FLIP="////";k.GAIA="m/44'/118'/0'/0";k.KUJI="m/44'/118'/0'/0";k.LTC="m/84'/2'/0'/0";k.MATIC="m/44'/60'/0'/0";k.MAYA="m/44'/931'/0'/0";k.OP="m/44'/60'/0'/0";k.SOL="m/44'/501'/0'/0";k.THOR="m/44'/931'/0'/0";k.XRD="////"})(Jx||={});var s={ARB:[44,60,0,0,0],AVAX:[44,60,0,0,0],BCH:[44,145,0,0,0],BSC:[44,60,0,0,0],BTC:[84,0,0,0,0],DASH:[44,5,0,0,0],DOGE:[44,3,0,0,0],ETH:[44,60,0,0,0],GAIA:[44,118,0,0,0],KUJI:[44,118,0,0,0],LTC:[84,2,0,0,0],MATIC:[44,60,0,0,0],MAYA:[44,931,0,0,0],OP:[44,60,0,0,0],SOL:[44,501,0,0,0],THOR:[44,931,0,0,0],XRD:[0,0,0,0,0],DOT:[0,0,0,0,0],FLIP:[0,0,0,0,0]};var Fx;((T)=>{T.BRAVE="BRAVE";T.COINBASE_MOBILE="COINBASE_MOBILE";T.COINBASE_WEB="COINBASE_WEB";T.EIP6963="EIP6963";T.EXODUS="EXODUS";T.KEEPKEY="KEEPKEY";T.KEPLR="KEPLR";T.KEYSTORE="KEYSTORE";T.LEDGER="LEDGER";T.METAMASK="METAMASK";T.OKX="OKX";T.OKX_MOBILE="OKX_MOBILE";T.PHANTOM="PHANTOM";T.POLKADOT_JS="POLKADOT_JS";T.RADIX_WALLET="RADIX_WALLET";T.TREZOR="TREZOR";T.TALISMAN="TALISMAN";T.TRUSTWALLET_WEB="TRUSTWALLET_WEB";T.WALLETCONNECT="WALLETCONNECT";T.XDEFI="XDEFI"})(Fx||={});var zx;((n)=>{n[n.NoError=36864]="NoError";n[n.LockedDevice=21781]="LockedDevice";n[n.TC_NotFound=65535]="TC_NotFound"})(zx||={});var Zx;((n)=>{n.Average="average";n.Fast="fast";n.Fastest="fastest"})(Zx||={});var Yx;((H)=>{H.Approve="approve";H.CheckOnly="checkOnly"})(Yx||={});var Hx;((L)=>{L.NAME_REGISTER="~";L.BOND="BOND";L.DEPOSIT="+";L.LEAVE="LEAVE";L.UNBOND="UNBOND";L.WITHDRAW="-";L.OPEN_LOAN="$+";L.CLOSE_LOAN="$-";L.RUNEPOOL_DEPOSIT="POOL+";L.RUNEPOOL_WITHDRAW="POOL-"})(Hx||={});var wx;((h)=>{h.unknownError="unknownError";h.test_error="test_error";h.providerDetailsError="providerDetailsError";h.blockHeaderNotFound="blockHeaderNotFound";h.blockHashNotFoundAtHeight="blockHashNotFoundAtHeight";h.blockHashNotFoundAtHash="blockHashNotFoundAtHash";h.txHashMissing="txHashMissing";h.assetValueMissingInfo="assetValueMissingInfo";h.invalidAsset="invalidAsset";h.blockIsRequired="blockIsRequired";h.currentBlockHeaderNotFound="currentBlockHeaderNotFound";h.failedToRetrieveBalance="failedToRetrieveBalance";h.failedToRetrieveBlock="failedToRetrieveBlock";h.failedToRetrieveFees="failedToRetrieveFees";h.notImplementedBCH="notImplementedBCH";h.notImplementedDoge="notImplementedDoge";h.noPoolsFound="noPoolsFound";h.noVaultsFound="noVaultsFound";h.noTxFound="noTxFound";h.noInputCoinFound="noInputCoinFound";h.noBlockDataFound="noBlockDataFound";h.multipleCosmosMessages="multipleCosmosMessages";h.heightOrHashNotProvided="heightOrHashNotProvided";h.unknownDenom="unknownDenom";h.invalidBlockHeight="invalidBlockHeight";h.timestampExtrinsicNoArgumentsForBlock="timestampExtrinsicNoArgumentsForBlock";h.timestampExtrinsicNoTimestampForBlock="timestampExtrinsicNoTimestampForBlock";h.noTimestampExtrinsicForHash="noTimestampExtrinsicForHash";h.timestampExtrinsicNoArgumentsForHash="timestampExtrinsicNoArgumentsForHash";h.txMemoUndefined="txMemoUndefined";h.txMemoIncorrect="txMemoIncorrect";h.txTypeNotFound="txTypeNotFound";h.txNoMessage="txNoMessage";h.txNotFound="txNotFound";h.txReceiptNotFound="txReceiptNotFound";h.txParsingError="txParsingError";h.blockNotFound="blockNotFound";h.balanceNotFound="balanceNotFound";h.configError="configError";h.noQuoteResponse="noQuoteResponse";h.noPoolAssetsFound="noPoolAssetsFound";h.noThorchainPools="noThorchainPools";h.noMayachainPools="noMayachainPools";h.invalidAffiliateFee="invalidAffiliateFee";h.invalidBuyAssetAddress="invalidBuyAssetAddress";h.invalidSellAssetAddress="invalidSellAssetAddress";h.invalidSourceAddress="invalidSourceAddress";h.invalidDestinationAddress="invalidDestinationAddress";h.sourceAddressIsSmartContract="sourceAddressIsSmartContract";h.destinationAddressIsSmartContract="destinationAddressIsSmartContract";h.invalidChainId="invalidChainId";h.unsupportedChainId="unsupportedChainId";h.unsupportedEVMChainId="unsupportedEVMChainId";h.noWhitelistTokens="noWhitelistTokens";h.failedFetchGasPrice="failedFetchGasPrice";h.failedToCreateDepositChannel="failedToCreateDepositChannel";h.noProviderDetailsFound="noProviderDetailsFound";h.noTokenListsFound="noTokenListsFound";h.tokenNotFound="tokenNotFound";h.tokenPriceNotFound="tokenPriceNotFound";h.swapAmountTooSmall="swapAmountTooSmall";h.legsArrayIsEmpty="legsArrayIsEmpty";h.failedToFetchQuoteForLeg="failedToFetchQuoteForLeg";h.noBlockHeaderFound="noBlockHeaderFound";h.failedToSimulateSwap="failedToSimulateSwap";h.addressScreeningFailed="addressScreeningFailed";h.noLiquidtyProvidersFound="noLiquidtyProvidersFound";h.noSaversFound="noSaversFound";h.noInboundAddressesFound="noInboundAddressesFound";h.noInboundAddressFoundForChain="noInboundAddressFoundForChain";h.noLastBlocksFound="noLastBlocksFound";h.noVersionFound="noVersionFound";h.noConstantsFound="noConstantsFound";h.noMimirsFound="noMimirsFound";h.noRoutesFound="noRoutesFound";h.quoteNotFound="quoteNotFound";h.ledgerSignFailed="ledgerSignFailed";h.ledgerFetchSwapFailed="ledgerFetchSwapFailed";h.failedToFetchTx="failedToFetchTx";h.failedBuildTransactionDetails="failedBuildTransactionDetails";h.noLegsForRoute="noLegsForRoute";h.noRouterAddressFound="noRouterAddressFound";h.noAggregatorAddressFound="noAggregatorAddressFound";h.noContractInstanceFound="noContractInstanceFound";h.noContractAddressFound="noContractAddressFound";h.invalidAffiliate="invalidAffiliate";h.providerNotfound="No provider found";h.noRecordFound="No Record found";h.slippageTooLow="Slippage too low";h.tradingHalted="tradingHalted";h.noWrappedGasAsset="noWrappedGasAsset";h.aggregatorAddressNotFound="aggregatorAddressNotFound";h.routerAddressNotFound="routerAddressNotFound";h.dummyAddressNotFound="dummyAddressNotFound";h.trackerError="trackerError";h.noOhlcvDataFound="noOhlcvDataFound";h.noTradingPairs="noTradingPairs";h.noLoanPositionFound="noLoanPositionFound";h.noLendingAvailability="noLendingAvailability";h.lendingRepayTooSmall="lendingRepayTooSmall";h.missingState="missingState";h.ledgerSwapNotFound="ledgerSwapNotFound";h.ledgerSwapNotReadyForTracking="ledgerSwapNotReadyForTracking";h.errorEstimatingGas="errorEstimatingGas";h.apiKeyInvalid="apiKeyInvalid";h.apiKeyFailedToUpdate="apiKeyFailedToUpdate";h.apiKeyExpired="apiKeyExpired";h.unauthorized="unauthorized";h.failedToCreateMemo="failedToCreateMemo";h.radixIncorrectInstructions="radixIncorrectInstructions";h.invalidAddressForChain="invalidAddressForChain"})(wx||={});var Qx;((H)=>{H.highSlippage="highSlippage";H.highPriceImpact="highPriceImpact"})(Qx||={});var qx;((J)=>{J.CHAINFLIP="CHAINFLIP";J.MAYACHAIN="MAYACHAIN";J.MAYACHAIN_STREAMING="MAYACHAIN_STREAMING";J.ONEINCH="ONEINCH";J.PANCAKESWAP="PANCAKESWAP";J.PANGOLIN_V1="PANGOLIN_V1";J.SUSHISWAP_V2="SUSHISWAP_V2";J.THORCHAIN="THORCHAIN";J.THORCHAIN_STREAMING="THORCHAIN_STREAMING";J.TRADERJOE_V2="TRADERJOE_V2";J.UNISWAP_V2="UNISWAP_V2";J.UNISWAP_V3="UNISWAP_V3";J.CAVIAR_V1="CAVIAR_V1"})(qx||={});var Bx;((I)=>{I.LIQUIDITY="liquidity";I.NETWORK="network";I.INBOUND="inbound";I.OUTBOUND="outbound";I.AFFILIATE="affiliate";I.TAX="tax"})(Bx||={});import{red as kx,yellow as Vx}from"picocolors";var Wx={core_estimated_max_spendable_chain_not_supported:10002,core_extend_error:10003,core_inbound_data_not_found:10004,core_approve_asset_address_or_from_not_found:10005,core_plugin_not_found:10006,core_plugin_swap_not_found:10007,core_approve_asset_target_invalid:10008,core_explorer_unsupported_chain:10009,core_verify_message_not_supported:10010,core_chain_halted:10099,core_wallet_connection_not_found:10100,core_wallet_xdefi_not_installed:10101,core_wallet_evmwallet_not_installed:10102,core_wallet_walletconnect_not_installed:10103,core_wallet_keystore_not_installed:10104,core_wallet_ledger_not_installed:10105,core_wallet_trezor_not_installed:10106,core_wallet_keplr_not_installed:10107,core_wallet_okx_not_installed:10108,core_wallet_keepkey_not_installed:10109,core_wallet_talisman_not_installed:10110,core_wallet_not_keypair_wallet:10111,core_wallet_sign_message_not_supported:10110,core_swap_invalid_params:10200,core_swap_route_not_complete:10201,core_swap_asset_not_recognized:10202,core_swap_contract_not_found:10203,core_swap_route_transaction_not_found:10204,core_swap_contract_not_supported:10205,core_swap_transaction_error:10206,core_swap_quote_mode_not_supported:10207,core_transaction_deposit_error:10301,core_transaction_create_liquidity_base_error:10302,core_transaction_create_liquidity_asset_error:10303,core_transaction_create_liquidity_invalid_params:10304,core_transaction_add_liquidity_invalid_params:10305,core_transaction_add_liquidity_base_address:10306,core_transaction_add_liquidity_base_error:10307,core_transaction_add_liquidity_asset_error:10308,core_transaction_withdraw_error:10309,core_transaction_deposit_to_pool_error:10310,core_transaction_deposit_insufficient_funds_error:10311,core_transaction_deposit_gas_error:10312,core_transaction_invalid_sender_address:10313,core_transaction_deposit_server_error:10314,core_transaction_user_rejected:10315,core_transaction_failed:10316,wallet_connection_rejected_by_user:20000,wallet_missing_api_key:20001,wallet_chain_not_supported:20002,wallet_missing_params:20003,wallet_provider_not_found:20004,wallet_failed_to_add_or_switch_network:20005,wallet_ledger_connection_error:20101,wallet_ledger_connection_claimed:20102,wallet_ledger_get_address_error:20103,wallet_ledger_device_not_found:20104,wallet_ledger_device_locked:20105,wallet_phantom_not_found:20201,wallet_xdefi_not_found:20301,wallet_xdefi_send_transaction_no_address:20302,wallet_xdefi_contract_address_not_provided:20303,wallet_xdefi_asset_not_defined:20304,wallet_walletconnect_project_id_not_specified:20401,wallet_walletconnect_connection_not_established:20402,wallet_walletconnect_namespace_not_supported:20403,wallet_trezor_failed_to_sign_transaction:20501,wallet_trezor_derivation_path_not_supported:20502,wallet_trezor_failed_to_get_address:20503,wallet_talisman_not_enabled:20601,wallet_talisman_not_found:20602,wallet_polkadot_not_found:20701,chainflip_channel_error:30001,chainflip_unknown_asset:30002,chainflip_broker_invalid_params:30100,chainflip_broker_recipient_error:30101,chainflip_broker_register:30102,chainflip_broker_tx_error:30103,chainflip_broker_withdraw:30104,chainflip_broker_fund_only_flip_supported:30105,chainflip_broker_fund_invalid_address:30106,thorchain_chain_halted:40001,thorchain_trading_halted:40002,thorchain_swapin_router_required:40100,thorchain_swapin_vault_required:40101,thorchain_swapin_memo_required:40102,thorchain_swapin_token_required:40103,api_v2_invalid_response:50001,api_v2_server_error:50002,toolbox_cosmos_signer_not_defined:90101,toolbox_cosmos_no_accounts_found:90102,toolbox_cosmos_verify_signature_no_pubkey:90103,toolbox_evm_no_abi_fragment:90201,toolbox_evm_no_signer:90202,toolbox_evm_no_signer_address:90203,toolbox_evm_no_from_address:90204,toolbox_evm_no_contract_address:90205,toolbox_evm_no_fee_data:90206,toolbox_evm_no_gas_price:90207,toolbox_evm_no_to_address:90208,toolbox_evm_invalid_gas_asset_address:90209,toolbox_evm_provider_not_eip1193_compatible:90210,toolbox_evm_error_estimating_gas_limit:90211,toolbox_evm_error_sending_transaction:90212,helpers_invalid_number_different_decimals:99000,helpers_invalid_number_of_years:99001,helpers_invalid_identifier:99002,helpers_invalid_asset_url:99003,helpers_invalid_asset_identifier:99004,helpers_invalid_memo_type:99005,helpers_failed_to_switch_network:99103,helpers_not_found_provider:99200,not_implemented:99999};class j extends Error{static ErrorCode=Wx;constructor(x,F){const H=typeof x==="string",n=H?x:x.errorKey;if(F)console.error(F,{stack:F?.stack,message:F?.message});super(n,{cause:{code:j.ErrorCode[n],message:`${n}${H?"":`: ${JSON.stringify(x.info)}`}`}});Object.setPrototypeOf(this,j.prototype)}}function yF(x){if(x<0)throw new j({errorKey:"helpers_invalid_number_of_years",info:{numberOfYears:x}});return 10+x}function vF(x){if(x<0)throw new j({errorKey:"helpers_invalid_number_of_years",info:{numberOfYears:x}});return Math.round((10+x*1.0512)*10000000000)/10000000000}function oF(x,F){try{return x()}catch(H){if(F)throw new j(F,H);return console.error(H)}}function EF(x){switch(x){case"THOR":return`${x}.RUNE`;case"GAIA":return`${x}.ATOM`;case"BSC":return`${x}`;default:return`${x}.${x}`}}function Nx(x,F){if(!Kx&&x){if(nx.has(F))return;nx.add(F),console.warn(F)}}var Kx=["production","test"].includes("development"),nx=new Set;function Rx(x=""){const F=x.toUpperCase(),[H]=F.split(".");if(hx.includes(H))return!0;const[n]=F.split("/");if(hx.includes(n))return!0;throw new j({errorKey:"helpers_invalid_identifier",info:{message:`Invalid identifier: ${x}. Expected format: <Chain>.<Ticker> or <Chain>.<Ticker>-<ContractAddress>`,identifier:x}})}function dF(x){if(x.length>30)return!1;const F=/^[a-zA-Z0-9+_-]+$/g;return!!x.match(F)}var hx=[...Object.values(Y),"TERRA"];function M({value:x,bigIntDecimal:F=U,decimal:H=U}){if(H===0)return x.toString();const n=x<0n;let N=x.toString().substring(n?1:0);const R=H-(N.length-1);if(R>0)N="0".repeat(R)+N;const I=N.length-H;let _=N.slice(-H);if(Number.parseInt(_[F]||"0")>=5)_=`${_.substring(0,F-1)}${(Number.parseInt(_[F-1]||"0")+1).toString()}`;else _=_.substring(0,F);return`${n?"-":""}${N.slice(0,I)}.${_}`.replace(/\.?0*$/,"")}function o(x){const H=`${typeof x==="number"?Mx.format(x):i(x)}`.replaceAll(",",".").split(".");return H.length>1?`${H.slice(0,-1).join("")}.${H.at(-1)}`:H[0]||"0"}function Ix(x){const F=x.split(".")[1]?.length||0;return Math.max(F,U)}function i(x){return typeof x==="object"?"getValue"in x?x.getValue("string"):x.value:x}var U=8,W=(x)=>10n**BigInt(x),S=(x)=>Math.log10(Number.parseFloat(x.toString()));class B{decimalMultiplier=10n**8n;bigIntValue=0n;decimal;static fromBigInt(x,F){return new B({decimal:F,value:M({value:x,bigIntDecimal:F,decimal:F})})}static shiftDecimals({value:x,from:F,to:H}){return B.fromBigInt(x.getBaseValue("bigint")*W(H)/W(F),H)}constructor(x){const F=i(x),H=typeof x==="object";this.decimal=H?x.decimal:void 0,this.decimalMultiplier=H&&"decimalMultiplier"in x?x.decimalMultiplier:W(Math.max(Ix(o(F)),this.decimal||0)),this.#N(F)}set(x){return new this.constructor({decimal:this.decimal,value:x,identifier:this.toString()})}add(...x){return this.#F("add",...x)}sub(...x){return this.#F("sub",...x)}mul(...x){return this.#F("mul",...x)}div(...x){return this.#F("div",...x)}gt(x){return this.#x("gt",x)}gte(x){return this.#x("gte",x)}lt(x){return this.#x("lt",x)}lte(x){return this.#x("lte",x)}eqValue(x){return this.#x("eqValue",x)}getValue(x){const F=this.formatBigIntToSafeValue(this.bigIntValue,this.decimal||S(this.decimalMultiplier));switch(x){case"number":return Number(F);case"string":return F;case"bigint":return this.bigIntValue*10n**BigInt(this.decimal||8n)/this.decimalMultiplier}}getBaseValue(x){const F=this.decimalMultiplier/W(this.decimal||8),H=this.bigIntValue/F;switch(x){case"number":return Number(H);case"string":return H.toString();case"bigint":return H}}getBigIntValue(x,F){if(!F&&typeof x==="object")return x.bigIntValue;const H=i(x),n=o(H);if(n==="0"||n==="undefined")return 0n;return this.#n(n,F)}toSignificant(x=6){const[F,H]=this.getValue("string").split("."),n=F||"",N=H||"";if((Number.parseInt(n)?n.length+N.length:N.length)<=x)return this.getValue("string");if(n.length>=x)return n.slice(0,x).padEnd(n.length,"0");if(Number.parseInt(n))return`${n}.${N.slice(0,x-n.length)}`.padEnd(x-n.length,"0");const I=Number.parseInt(N),_=`${I}`.slice(0,x);return`0.${_.padStart(N.length-`${I}`.length+_.length,"0")}`}toFixed(x=6){const[F,H]=this.getValue("string").split("."),n=F||"",N=H||"";if(Number.parseInt(n))return`${n}.${N.slice(0,x)}`.padEnd(x,"0");const R=Number.parseInt(N),I=`${R}`.slice(0,x);return`0.${I.padStart(N.length-`${R}`.length+I.length,"0")}`}toAbbreviation(x=2){const F=this.getValue("number"),H=["","K","M","B","T","Q","Qi","S"],n=Math.floor(Math.log10(Math.abs(F))/3),N=H[n];if(!N)return this.getValue("string");const R=10**(n*3);return`${(F/R).toFixed(x)}${N}`}toCurrency(x="$",{currencyPosition:F="start",decimal:H=2,decimalSeparator:n=".",thousandSeparator:N=","}={}){const R=this.getValue("number"),[I="",_=""]=R.toFixed(6).split("."),O=I.replace(/\B(?=(\d{3})+(?!\d))/g,N),G=I||_?I==="0"?`${Number.parseFloat(`0.${_}`)}`.replace(".",n):`${O}${Number.parseInt(_)?`${n}${_.slice(0,H)}`:""}`:"0.00";return`${F==="start"?x:""}${G}${F==="end"?x:""}`}formatBigIntToSafeValue(x,F){const H=F||this.decimal||U,n=Math.max(H,S(this.decimalMultiplier)),N=x<0n,R=x.toString().substring(N?1:0),I=n-(R.length-1),_=I>0?"0".repeat(I)+R:R,O=_.length-n;let G=_.slice(-n);if(Number.parseInt(G[H]||"0")>=5)G=`${G.substring(0,H-1)}${(Number.parseInt(G[H-1]||"0")+1).toString()}`;else G=G.substring(0,H);return`${N?"-":""}${_.slice(0,O)}.${G}`.replace(/\.?0*$/,"")}#F(x,...F){const H=this.#H(this,...F),n=Math.max(H,S(this.decimalMultiplier)),N=W(n),R=F.reduce((_,O)=>{const G=this.getBigIntValue(O,n);switch(x){case"add":return _+G;case"sub":return _-G;case"mul":return _*G/N;case"div":{if(G===0n)throw new RangeError("Division by zero");return _*N/G}default:return _}},this.bigIntValue*N/this.decimalMultiplier),I=M({bigIntDecimal:n,decimal:n,value:R});return new this.constructor({decimalMultiplier:W(n),decimal:this.decimal,value:I,identifier:this.toString()})}#x(x,...F){const H=this.#H(this,...F),n=this.getBigIntValue(F[0]||"0",H),N=this.getBigIntValue(this,H);switch(x){case"gt":return N>n;case"gte":return N>=n;case"lt":return N<n;case"lte":return N<=n;case"eqValue":return N===n}}#N(x){const F=o(x)||"0";this.bigIntValue=this.#n(F)}#H(...x){const F=x.map((H)=>{return typeof H==="object"?H.decimal||S(H.decimalMultiplier):Ix(o(H))}).filter(Boolean);return Math.max(...F,U)}#n(x,F){const H=F?W(F):this.decimalMultiplier,n=S(H),[N="",R=""]=x.split(".");return BigInt(`${N}${R.padEnd(n,"0")}`)}}var Mx=Intl.NumberFormat("fullwide",{useGrouping:!1,maximumFractionDigits:20});function HH(x){const F=$.from({chain:x});switch(x){case"BTC":case"LTC":case"BCH":case"DASH":return F.set(0.00010001);case"DOGE":return F.set(1.00000001);case"AVAX":case"ETH":case"ARB":case"BSC":return F.set(0.00000001);case"THOR":case"MAYA":return F.set(0);case"GAIA":case"KUJI":return F.set(0.000001);default:return F.set(0.00000001)}}async function Cx(x,F=0){Rx(x);const H=E.get(x.toUpperCase()),n=H?.decimal||await _x(l(x));if(!H)E.set(x.toUpperCase(),{identifier:x,decimal:n});return new $({decimal:n,value:b(F,n),identifier:x})}function Sx(x,F=0){const H=x.split(".")?.[0]?.toUpperCase(),n=H?["MAYA","THOR"].includes(H):!1,[N,R]=n?x.split(".").slice(1).join().split("/"):x.split("/");if(!(N&&R))throw new j({errorKey:"helpers_invalid_asset_identifier",info:{identifier:x}});return new $({decimal:8,value:b(F,8),identifier:`${H||"THOR"}.${N}/${R}`})}function b(x,F){return typeof x==="bigint"?M({value:x,bigIntDecimal:F,decimal:F}):x}function l(x){const F=x.slice(0,14).includes("/"),H=x.split(".")?.[0]?.toUpperCase()==="THOR",n=x.split(".")?.[0]?.toUpperCase()==="MAYA",[N,R=""]=H||n?x.split(".").slice(1).join().split("/"):x.split("/");if(F&&!(N&&R))throw new j({errorKey:"helpers_invalid_asset_identifier",info:{identifier:x}});const I=x.includes(".")&&!F?x:`${n?"MAYA":"THOR"}.${R}`,[_,...O]=I.split("."),G=F?R:O.join("."),L=G.split("-"),Z=L.length===1?L[0]:L.slice(0,-1).join("-"),Q=L.length===1?void 0:L[L.length-1];return{address:Q?.toLowerCase(),chain:_,isGasAsset:a({chain:_,symbol:G}),isSynthetic:F,ticker:Z,symbol:(F?`${N}/`:"")+(Q?`${Z}-${Q?.toLowerCase()??""}`:G)}}var E=new Map;class $ extends B{address;chain;isGasAsset=!1;isSynthetic=!1;symbol;tax;ticker;type;chainId;constructor({value:x,decimal:F,tax:H,chain:n,symbol:N,identifier:R}){super(typeof x==="object"?x:{decimal:F,value:x});const I=l(R||`${n}.${N}`);this.type=Lx(I),this.tax=H,this.chain=I.chain,this.ticker=I.ticker,this.symbol=I.symbol,this.address=I.address,this.isSynthetic=I.isSynthetic,this.isGasAsset=I.isGasAsset,this.chainId=xx[I.chain]}toString({includeSynthProtocol:x}={}){return this.isSynthetic&&!x?this.symbol:`${this.chain}.${this.symbol}`}toUrl(){return this.isSynthetic?`${this.chain}.${this.symbol.replace("/",".")}`:this.toString()}eqAsset({chain:x,symbol:F}){return this.chain===x&&this.symbol===F}eq(x){return this.eqAsset(x)&&this.eqValue(x)}static fromUrl(x,F=0){const[H,n,N]=x.split(".");if(!(H&&n))throw new j({errorKey:"helpers_invalid_asset_url",info:{urlAsset:x}});const R=H==="THOR"&&N?`${H}.${n}/${N}`:x;return $.from({asset:R,value:F})}static from({value:x=0,fromBaseDecimal:F,asyncTokenLookup:H,...n}){const N=x instanceof B?x.getValue("string"):x,R="chain"in n,I=R?n.chain:n.asset,_=R||Tx.includes(I),{identifier:O,decimal:G}=_?Gx(I):{identifier:I,decimal:void 0},{chain:L,isSynthetic:Z}=l(O),Q=E.get(O.toUpperCase()),J=Q?.decimal||G;Nx(!(H||J),Vx(`Couldn't find static decimal for ${kx(O)} (Using default ${kx(z[L])} decimal as fallback). | ||
var e=((n)=>typeof require!=="undefined"?require:typeof Proxy!=="undefined"?new Proxy(n,{get:(h,t)=>(typeof require!=="undefined"?require:h)[t]}):n)(function(n){if(typeof require!=="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});export*from"@swapkit/contracts";var a;((k)=>{k.Arbitrum="https://arb1.arbitrum.io/rpc";k.Avalanche="https://node-router.thorswap.net/avalanche-c";k.Base="https://base.llamarpc.com";k.BinanceSmartChain="https://bsc-dataseed.binance.org";k.Bitcoin="https://node-router.thorswap.net/bitcoin";k.BitcoinCash="https://node-router.thorswap.net/bitcoin-cash";k.Chainflip="wss://mainnet-archive.chainflip.io";k.Cosmos="https://node-router.thorswap.net/cosmos/rpc";k.Dash="https://node-router.thorswap.net/dash";k.Dogecoin="https://node-router.thorswap.net/dogecoin";k.Ethereum="https://node-router.thorswap.net/ethereum";k.Kujira="https://rpc-kujira.synergynodes.com/";k.Litecoin="https://node-router.thorswap.net/litecoin";k.Maya="https://tendermint.mayachain.info";k.MayaStagenet="https://stagenet.tendermint.mayachain.info";k.Optimism="https://mainnet.optimism.io";k.Polkadot="wss://rpc.polkadot.io";k.Polygon="https://polygon-rpc.com";k.Radix="https://radix-mainnet.rpc.grove.city/v1/326002fc/core";k.THORChain="https://rpc.thorswap.net";k.THORChainStagenet="https://stagenet-rpc.ninerealms.com";k.Solana="https://mainnet.helius-rpc.com/?api-key=2cbe3ae6-cfc5-4141-a093-0055d0fa3d80"})(a||={});var d;((s)=>{s.Arbitrum="https://arbiscan.io";s.Avalanche="https://snowtrace.io";s.Base="https://basescan.org";s.BinanceSmartChain="https://bscscan.com";s.Bitcoin="https://blockchair.com/bitcoin";s.BitcoinCash="https://www.blockchair.com/bitcoin-cash";s.Chainflip="https://explorer.polkascan.io/polkadot";s.Cosmos="https://www.mintscan.io/cosmos";s.Dash="https://blockchair.com/dash";s.Dogecoin="https://blockchair.com/dogecoin";s.Ethereum="https://etherscan.io";s.Kujira="https://finder.kujira.network/kaiyo-1";s.Litecoin="https://blockchair.com/litecoin";s.Maya="https://www.mayascan.org";s.Optimism="https://optimistic.etherscan.io";s.Polkadot="https://polkadot.subscan.io";s.Polygon="https://polygonscan.com";s.Radix="https://dashboard.radixdlt.com";s.THORChain="https://runescan.io";s.Solana="https://solscan.io"})(d||={});var G;((s)=>{s.Arbitrum="ARB";s.Avalanche="AVAX";s.Base="BASE";s.BinanceSmartChain="BSC";s.Bitcoin="BTC";s.BitcoinCash="BCH";s.Cosmos="GAIA";s.Dash="DASH";s.Dogecoin="DOGE";s.Ethereum="ETH";s.Kujira="KUJI";s.Litecoin="LTC";s.Maya="MAYA";s.Optimism="OP";s.Polkadot="DOT";s.Chainflip="FLIP";s.Polygon="MATIC";s.Radix="XRD";s.THORChain="THOR";s.Solana="SOL"})(G||={});var q;((A)=>{A.Arbitrum="42161";A.ArbitrumHex="0xa4b1";A.Avalanche="43114";A.AvalancheHex="0xa86a";A.Base="8453";A.BaseHex="0x2105";A.BinanceSmartChain="56";A.BinanceSmartChainHex="0x38";A.Bitcoin="bitcoin";A.BitcoinCash="bitcoincash";A.Chainflip="chainflip";A.Cosmos="cosmoshub-4";A.Dash="dash";A.Dogecoin="dogecoin";A.Kujira="kaiyo-1";A.Ethereum="1";A.EthereumHex="0x1";A.Litecoin="litecoin";A.Maya="mayachain-mainnet-v1";A.MayaStagenet="mayachain-stagenet-v1";A.Optimism="10";A.OptimismHex="0xa";A.Polkadot="polkadot";A.Polygon="137";A.PolygonHex="0x89";A.Radix="radix-mainnet";A.THORChain="thorchain-mainnet-v1";A.THORChainStagenet="thorchain-stagenet-v2";A.Solana="solana"})(q||={});var Fh={["0xa4b1"]:"ARB",["42161"]:"ARB",["0xa86a"]:"AVAX",["43114"]:"AVAX",["0x2105"]:"BASE",["8453"]:"BASE",["0x38"]:"BSC",["56"]:"BSC",["bitcoincash"]:"BCH",["bitcoin"]:"BTC",["chainflip"]:"FLIP",["cosmoshub-4"]:"GAIA",["dash"]:"DASH",["dogecoin"]:"DOGE",["0x1"]:"ETH",["kaiyo-1"]:"KUJI",["1"]:"ETH",["litecoin"]:"LTC",["mayachain-stagenet-v1"]:"MAYA",["mayachain-mainnet-v1"]:"MAYA",["0xa"]:"OP",["10"]:"OP",["polkadot"]:"DOT",["0x89"]:"MATIC",["137"]:"MATIC",["radix-mainnet"]:"XRD",["thorchain-stagenet-v2"]:"THOR",["thorchain-mainnet-v1"]:"THOR",["solana"]:"SOL"},On=Object.keys(G),w=Object.values(G),B={ARB:18,AVAX:18,BASE:18,BCH:8,BSC:18,BTC:8,DASH:8,DOGE:8,DOT:10,ETH:18,FLIP:18,GAIA:6,KUJI:6,LTC:8,MATIC:18,MAYA:8,OP:18,SOL:9,THOR:8,XRD:18},Ch=["DOT","FLIP"],Q=["ARB","AVAX","BASE","BSC","ETH","OP","MATIC"],Nh=["BTC","BCH","DASH","DOGE","LTC"],Ah=["GAIA","THOR","MAYA","KUJI"],Bh=["AVAX","BSC","BTC","BCH","GAIA","DOGE","ETH","LTC","THOR"],Th=["ARB","DASH","ETH","KUJI","MAYA","THOR"],W=w.reduce((n,h)=>{const t=On.find((o)=>G[o]===h);if(t)n[h]=t;return n},{}),l=w.reduce((n,h)=>{return n[h]=q[W[h]],n},{}),U=w.reduce((n,h)=>{return n[h]=a[W[h]],n},{}),kh=w.reduce((n,h)=>{const t=`${W[h]}Hex`;return n[h]=q[t],n},{}),Oh=w.reduce((n,h)=>{return n[h]=d[W[h]],n},{});var $n;(($)=>{$.TC_SUPPORTED_TO_TC_SUPPORTED="TC-TC";$.TC_SUPPORTED_TO_ETH="TC-ERC20";$.TC_SUPPORTED_TO_AVAX="TC-ARC20";$.TC_SUPPORTED_TO_BSC="TC-BEP20";$.ETH_TO_TC_SUPPORTED="ERC20-TC";$.ETH_TO_ETH="ERC20-ERC20";$.ETH_TO_AVAX="ERC20-ARC20";$.ETH_TO_BSC="ERC20-BEP20";$.AVAX_TO_TC_SUPPORTED="ARC20-TC";$.AVAX_TO_ETH="ARC20-ERC20";$.AVAX_TO_AVAX="ARC20-ARC20";$.AVAX_TO_BSC="ARC20-BEP20";$.BSC_TO_TC_SUPPORTED="BEP20-TC";$.BSC_TO_ETH="BEP20-ERC20";$.BSC_TO_AVAX="BEP20-ARC20";$.BSC_TO_BSC="BEP20-BEP20"})($n||={});var Ih=["ERC20-ERC20","ARC20-ARC20","BEP20-BEP20"],Lh=["ERC20-TC","ERC20-ARC20","ERC20-BEP20","ARC20-TC","ARC20-ERC20","ARC20-BEP20","BEP20-TC","BEP20-ERC20","BEP20-ARC20"],_h=["TC-TC","TC-ERC20","TC-ARC20","TC-BEP20"];var In;((F)=>{F.ARB="0x0000000000000000000000000000000000000000";F.AVAX="0x0000000000000000000000000000000000000000";F.BASE="0x0000000000000000000000000000000000000000";F.ETH="0x0000000000000000000000000000000000000000";F.BSC="0x0000000000000000000000000000000000000000";F.MATIC="0x0000000000000000000000000000000000001010";F.OP="0x4200000000000000000000000000000000000042"})(In||={});var Ln;((s)=>{s.ARB="m/44'/60'/0'/0";s.AVAX="m/44'/60'/0'/0";s.BASE="m/44'/60'/0'/0";s.BCH="m/44'/145'/0'/0";s.BSC="m/44'/60'/0'/0";s.BTC="m/84'/0'/0'/0";s.DASH="m/44'/5'/0'/0";s.DOGE="m/44'/3'/0'/0";s.DOT="////";s.ETH="m/44'/60'/0'/0";s.FLIP="////";s.GAIA="m/44'/118'/0'/0";s.KUJI="m/44'/118'/0'/0";s.LTC="m/84'/2'/0'/0";s.MATIC="m/44'/60'/0'/0";s.MAYA="m/44'/931'/0'/0";s.OP="m/44'/60'/0'/0";s.SOL="m/44'/501'/0'/0";s.THOR="m/44'/931'/0'/0";s.XRD="////"})(Ln||={});var i={ARB:[44,60,0,0,0],AVAX:[44,60,0,0,0],BASE:[44,60,0,0,0],BCH:[44,145,0,0,0],BSC:[44,60,0,0,0],BTC:[84,0,0,0,0],DASH:[44,5,0,0,0],DOGE:[44,3,0,0,0],ETH:[44,60,0,0,0],GAIA:[44,118,0,0,0],KUJI:[44,118,0,0,0],LTC:[84,2,0,0,0],MATIC:[44,60,0,0,0],MAYA:[44,931,0,0,0],OP:[44,60,0,0,0],SOL:[44,501,0,0,0],THOR:[44,931,0,0,0],XRD:[0,0,0,0,0],DOT:[0,0,0,0,0],FLIP:[0,0,0,0,0]};var nn;((s)=>{s.BRAVE="BRAVE";s.COINBASE_MOBILE="COINBASE_MOBILE";s.COINBASE_WEB="COINBASE_WEB";s.EIP6963="EIP6963";s.EXODUS="EXODUS";s.KEEPKEY="KEEPKEY";s.KEPLR="KEPLR";s.KEYSTORE="KEYSTORE";s.LEDGER="LEDGER";s.METAMASK="METAMASK";s.OKX="OKX";s.OKX_MOBILE="OKX_MOBILE";s.PHANTOM="PHANTOM";s.POLKADOT_JS="POLKADOT_JS";s.RADIX_WALLET="RADIX_WALLET";s.TREZOR="TREZOR";s.TALISMAN="TALISMAN";s.TRUSTWALLET_WEB="TRUSTWALLET_WEB";s.WALLETCONNECT="WALLETCONNECT";s.XDEFI="XDEFI"})(nn||={});var _n;((o)=>{o[o.NoError=36864]="NoError";o[o.LockedDevice=21781]="LockedDevice";o[o.TC_NotFound=65535]="TC_NotFound"})(_n||={});var Gn;((o)=>{o.Average="average";o.Fast="fast";o.Fastest="fastest"})(Gn||={});var gn;((t)=>{t.Approve="approve";t.CheckOnly="checkOnly"})(gn||={});var hn;((N)=>{N.NAME_REGISTER="~";N.BOND="BOND";N.DEPOSIT="+";N.LEAVE="LEAVE";N.UNBOND="UNBOND";N.WITHDRAW="-";N.OPEN_LOAN="$+";N.CLOSE_LOAN="$-";N.RUNEPOOL_DEPOSIT="POOL+";N.RUNEPOOL_WITHDRAW="POOL-"})(hn||={});var Pn;((c)=>{c.unknownError="unknownError";c.test_error="test_error";c.providerDetailsError="providerDetailsError";c.blockHeaderNotFound="blockHeaderNotFound";c.blockHashNotFoundAtHeight="blockHashNotFoundAtHeight";c.blockHashNotFoundAtHash="blockHashNotFoundAtHash";c.txHashMissing="txHashMissing";c.assetValueMissingInfo="assetValueMissingInfo";c.invalidAsset="invalidAsset";c.blockIsRequired="blockIsRequired";c.currentBlockHeaderNotFound="currentBlockHeaderNotFound";c.failedToRetrieveBalance="failedToRetrieveBalance";c.failedToRetrieveBlock="failedToRetrieveBlock";c.failedToRetrieveFees="failedToRetrieveFees";c.notImplementedBCH="notImplementedBCH";c.notImplementedDoge="notImplementedDoge";c.noPoolsFound="noPoolsFound";c.noVaultsFound="noVaultsFound";c.noTxFound="noTxFound";c.noInputCoinFound="noInputCoinFound";c.noBlockDataFound="noBlockDataFound";c.multipleCosmosMessages="multipleCosmosMessages";c.heightOrHashNotProvided="heightOrHashNotProvided";c.unknownDenom="unknownDenom";c.invalidBlockHeight="invalidBlockHeight";c.timestampExtrinsicNoArgumentsForBlock="timestampExtrinsicNoArgumentsForBlock";c.timestampExtrinsicNoTimestampForBlock="timestampExtrinsicNoTimestampForBlock";c.noTimestampExtrinsicForHash="noTimestampExtrinsicForHash";c.timestampExtrinsicNoArgumentsForHash="timestampExtrinsicNoArgumentsForHash";c.txMemoUndefined="txMemoUndefined";c.txMemoIncorrect="txMemoIncorrect";c.txTypeNotFound="txTypeNotFound";c.txNoMessage="txNoMessage";c.txNotFound="txNotFound";c.txReceiptNotFound="txReceiptNotFound";c.txParsingError="txParsingError";c.blockNotFound="blockNotFound";c.balanceNotFound="balanceNotFound";c.configError="configError";c.noQuoteResponse="noQuoteResponse";c.noPoolAssetsFound="noPoolAssetsFound";c.noThorchainPools="noThorchainPools";c.noMayachainPools="noMayachainPools";c.invalidAffiliateFee="invalidAffiliateFee";c.invalidBuyAssetAddress="invalidBuyAssetAddress";c.invalidSellAssetAddress="invalidSellAssetAddress";c.invalidSourceAddress="invalidSourceAddress";c.invalidDestinationAddress="invalidDestinationAddress";c.sourceAddressIsSmartContract="sourceAddressIsSmartContract";c.destinationAddressIsSmartContract="destinationAddressIsSmartContract";c.invalidChainId="invalidChainId";c.unsupportedChainId="unsupportedChainId";c.unsupportedEVMChainId="unsupportedEVMChainId";c.noWhitelistTokens="noWhitelistTokens";c.failedFetchGasPrice="failedFetchGasPrice";c.failedToCreateDepositChannel="failedToCreateDepositChannel";c.noProviderDetailsFound="noProviderDetailsFound";c.noTokenListsFound="noTokenListsFound";c.tokenNotFound="tokenNotFound";c.tokenPriceNotFound="tokenPriceNotFound";c.swapAmountTooSmall="swapAmountTooSmall";c.legsArrayIsEmpty="legsArrayIsEmpty";c.failedToFetchQuoteForLeg="failedToFetchQuoteForLeg";c.noBlockHeaderFound="noBlockHeaderFound";c.failedToSimulateSwap="failedToSimulateSwap";c.addressScreeningFailed="addressScreeningFailed";c.noLiquidtyProvidersFound="noLiquidtyProvidersFound";c.noSaversFound="noSaversFound";c.noInboundAddressesFound="noInboundAddressesFound";c.noInboundAddressFoundForChain="noInboundAddressFoundForChain";c.noLastBlocksFound="noLastBlocksFound";c.noVersionFound="noVersionFound";c.noConstantsFound="noConstantsFound";c.noMimirsFound="noMimirsFound";c.noRoutesFound="noRoutesFound";c.quoteNotFound="quoteNotFound";c.ledgerSignFailed="ledgerSignFailed";c.ledgerFetchSwapFailed="ledgerFetchSwapFailed";c.failedToFetchTx="failedToFetchTx";c.failedBuildTransactionDetails="failedBuildTransactionDetails";c.noLegsForRoute="noLegsForRoute";c.noRouterAddressFound="noRouterAddressFound";c.noAggregatorAddressFound="noAggregatorAddressFound";c.noContractInstanceFound="noContractInstanceFound";c.noContractAddressFound="noContractAddressFound";c.invalidAffiliate="invalidAffiliate";c.providerNotfound="No provider found";c.noRecordFound="No Record found";c.slippageTooLow="Slippage too low";c.tradingHalted="tradingHalted";c.noWrappedGasAsset="noWrappedGasAsset";c.aggregatorAddressNotFound="aggregatorAddressNotFound";c.routerAddressNotFound="routerAddressNotFound";c.dummyAddressNotFound="dummyAddressNotFound";c.trackerError="trackerError";c.noOhlcvDataFound="noOhlcvDataFound";c.noTradingPairs="noTradingPairs";c.noLoanPositionFound="noLoanPositionFound";c.noLendingAvailability="noLendingAvailability";c.lendingRepayTooSmall="lendingRepayTooSmall";c.missingState="missingState";c.ledgerSwapNotFound="ledgerSwapNotFound";c.ledgerSwapNotReadyForTracking="ledgerSwapNotReadyForTracking";c.errorEstimatingGas="errorEstimatingGas";c.apiKeyInvalid="apiKeyInvalid";c.apiKeyFailedToUpdate="apiKeyFailedToUpdate";c.apiKeyExpired="apiKeyExpired";c.unauthorized="unauthorized";c.failedToCreateMemo="failedToCreateMemo";c.radixIncorrectInstructions="radixIncorrectInstructions";c.invalidAddressForChain="invalidAddressForChain"})(Pn||={});var un;((t)=>{t.highSlippage="highSlippage";t.highPriceImpact="highPriceImpact"})(un||={});var Sn;((L)=>{L.CHAINFLIP="CHAINFLIP";L.MAYACHAIN="MAYACHAIN";L.MAYACHAIN_STREAMING="MAYACHAIN_STREAMING";L.ONEINCH="ONEINCH";L.PANCAKESWAP="PANCAKESWAP";L.PANGOLIN_V1="PANGOLIN_V1";L.SUSHISWAP_V2="SUSHISWAP_V2";L.THORCHAIN="THORCHAIN";L.THORCHAIN_STREAMING="THORCHAIN_STREAMING";L.TRADERJOE_V2="TRADERJOE_V2";L.UNISWAP_V2="UNISWAP_V2";L.UNISWAP_V3="UNISWAP_V3";L.CAVIAR_V1="CAVIAR_V1"})(Sn||={});var jn;((R)=>{R.LIQUIDITY="liquidity";R.NETWORK="network";R.INBOUND="inbound";R.OUTBOUND="outbound";R.AFFILIATE="affiliate";R.TAX="tax"})(jn||={});import{red as sn,yellow as wn}from"picocolors";var pn={core_estimated_max_spendable_chain_not_supported:10002,core_extend_error:10003,core_inbound_data_not_found:10004,core_approve_asset_address_or_from_not_found:10005,core_plugin_not_found:10006,core_plugin_swap_not_found:10007,core_approve_asset_target_invalid:10008,core_explorer_unsupported_chain:10009,core_verify_message_not_supported:10010,core_chain_halted:10099,core_wallet_connection_not_found:10100,core_wallet_xdefi_not_installed:10101,core_wallet_evmwallet_not_installed:10102,core_wallet_walletconnect_not_installed:10103,core_wallet_keystore_not_installed:10104,core_wallet_ledger_not_installed:10105,core_wallet_trezor_not_installed:10106,core_wallet_keplr_not_installed:10107,core_wallet_okx_not_installed:10108,core_wallet_keepkey_not_installed:10109,core_wallet_talisman_not_installed:10110,core_wallet_not_keypair_wallet:10111,core_wallet_sign_message_not_supported:10110,core_swap_invalid_params:10200,core_swap_route_not_complete:10201,core_swap_asset_not_recognized:10202,core_swap_contract_not_found:10203,core_swap_route_transaction_not_found:10204,core_swap_contract_not_supported:10205,core_swap_transaction_error:10206,core_swap_quote_mode_not_supported:10207,core_transaction_deposit_error:10301,core_transaction_create_liquidity_base_error:10302,core_transaction_create_liquidity_asset_error:10303,core_transaction_create_liquidity_invalid_params:10304,core_transaction_add_liquidity_invalid_params:10305,core_transaction_add_liquidity_base_address:10306,core_transaction_add_liquidity_base_error:10307,core_transaction_add_liquidity_asset_error:10308,core_transaction_withdraw_error:10309,core_transaction_deposit_to_pool_error:10310,core_transaction_deposit_insufficient_funds_error:10311,core_transaction_deposit_gas_error:10312,core_transaction_invalid_sender_address:10313,core_transaction_deposit_server_error:10314,core_transaction_user_rejected:10315,core_transaction_failed:10316,wallet_connection_rejected_by_user:20000,wallet_missing_api_key:20001,wallet_chain_not_supported:20002,wallet_missing_params:20003,wallet_provider_not_found:20004,wallet_failed_to_add_or_switch_network:20005,wallet_ledger_connection_error:20101,wallet_ledger_connection_claimed:20102,wallet_ledger_get_address_error:20103,wallet_ledger_device_not_found:20104,wallet_ledger_device_locked:20105,wallet_phantom_not_found:20201,wallet_xdefi_not_found:20301,wallet_xdefi_send_transaction_no_address:20302,wallet_xdefi_contract_address_not_provided:20303,wallet_xdefi_asset_not_defined:20304,wallet_walletconnect_project_id_not_specified:20401,wallet_walletconnect_connection_not_established:20402,wallet_walletconnect_namespace_not_supported:20403,wallet_trezor_failed_to_sign_transaction:20501,wallet_trezor_derivation_path_not_supported:20502,wallet_trezor_failed_to_get_address:20503,wallet_talisman_not_enabled:20601,wallet_talisman_not_found:20602,wallet_polkadot_not_found:20701,chainflip_channel_error:30001,chainflip_unknown_asset:30002,chainflip_broker_invalid_params:30100,chainflip_broker_recipient_error:30101,chainflip_broker_register:30102,chainflip_broker_tx_error:30103,chainflip_broker_withdraw:30104,chainflip_broker_fund_only_flip_supported:30105,chainflip_broker_fund_invalid_address:30106,thorchain_chain_halted:40001,thorchain_trading_halted:40002,thorchain_swapin_router_required:40100,thorchain_swapin_vault_required:40101,thorchain_swapin_memo_required:40102,thorchain_swapin_token_required:40103,api_v2_invalid_response:50001,api_v2_server_error:50002,toolbox_cosmos_signer_not_defined:90101,toolbox_cosmos_no_accounts_found:90102,toolbox_cosmos_verify_signature_no_pubkey:90103,toolbox_evm_no_abi_fragment:90201,toolbox_evm_no_signer:90202,toolbox_evm_no_signer_address:90203,toolbox_evm_no_from_address:90204,toolbox_evm_no_contract_address:90205,toolbox_evm_no_fee_data:90206,toolbox_evm_no_gas_price:90207,toolbox_evm_no_to_address:90208,toolbox_evm_invalid_gas_asset_address:90209,toolbox_evm_provider_not_eip1193_compatible:90210,toolbox_evm_error_estimating_gas_limit:90211,toolbox_evm_error_sending_transaction:90212,helpers_invalid_number_different_decimals:99000,helpers_invalid_number_of_years:99001,helpers_invalid_identifier:99002,helpers_invalid_asset_url:99003,helpers_invalid_asset_identifier:99004,helpers_invalid_memo_type:99005,helpers_failed_to_switch_network:99103,helpers_not_found_provider:99200,not_implemented:99999};class I extends Error{static ErrorCode=pn;constructor(n,h){const t=typeof n==="string",o=t?n:n.errorKey;if(h)console.error(h,{stack:h?.stack,message:h?.message});super(o,{cause:{code:I.ErrorCode[o],message:`${o}${t?"":`: ${JSON.stringify(n.info)}`}`}});Object.setPrototypeOf(this,I.prototype)}}function Mh(n){if(n<0)throw new I({errorKey:"helpers_invalid_number_of_years",info:{numberOfYears:n}});return 10+n}function Vh(n){if(n<0)throw new I({errorKey:"helpers_invalid_number_of_years",info:{numberOfYears:n}});return Math.round((10+n*1.0512)*10000000000)/10000000000}function bh(n,h){try{return n()}catch(t){if(h)throw new I(h,t);return console.error(t)}}function Kh(n){switch(n){case"THOR":return`${n}.RUNE`;case"GAIA":return`${n}.ATOM`;case"BSC":return`${n}`;default:return`${n}.${n}`}}function on(n,h){if(!Xn&&n){if(tn.has(h))return;tn.add(h),console.warn(h)}}var Xn=["production","test"].includes("development"),tn=new Set;function cn(n=""){const h=n.toUpperCase(),[t]=h.split(".");if(xn.includes(t))return!0;const[o]=h.split("/");if(xn.includes(o))return!0;throw new I({errorKey:"helpers_invalid_identifier",info:{message:`Invalid identifier: ${n}. Expected format: <Chain>.<Ticker> or <Chain>.<Ticker>-<ContractAddress>`,identifier:n}})}function Uh(n){if(n.length>30)return!1;const h=/^[a-zA-Z0-9+_-]+$/g;return!!n.match(h)}var xn=[...Object.values(G),"TERRA"];function X({value:n,bigIntDecimal:h=y,decimal:t=y}){if(t===0)return n.toString();const o=n<0n;let x=n.toString().substring(o?1:0);const H=t-(x.length-1);if(H>0)x="0".repeat(H)+x;const R=x.length-t;let F=x.slice(-t);if(Number.parseInt(F[h]||"0")>=5)F=`${F.substring(0,h-1)}${(Number.parseInt(F[h-1]||"0")+1).toString()}`;else F=F.substring(0,h);return`${o?"-":""}${x.slice(0,R)}.${F}`.replace(/\.?0*$/,"")}function M(n){const t=`${typeof n==="number"?Jn.format(n):E(n)}`.replaceAll(",",".").split(".");return t.length>1?`${t.slice(0,-1).join("")}.${t.at(-1)}`:t[0]||"0"}function Hn(n){const h=n.split(".")[1]?.length||0;return Math.max(h,y)}function E(n){return typeof n==="object"?"getValue"in n?n.getValue("string"):n.value:n}var y=8,j=(n)=>10n**BigInt(n),z=(n)=>Math.log10(Number.parseFloat(n.toString()));class S{decimalMultiplier=10n**8n;bigIntValue=0n;decimal;static fromBigInt(n,h){return new S({decimal:h,value:X({value:n,bigIntDecimal:h,decimal:h})})}static shiftDecimals({value:n,from:h,to:t}){return S.fromBigInt(n.getBaseValue("bigint")*j(t)/j(h),t)}constructor(n){const h=E(n),t=typeof n==="object";this.decimal=t?n.decimal:void 0,this.decimalMultiplier=t&&"decimalMultiplier"in n?n.decimalMultiplier:j(Math.max(Hn(M(h)),this.decimal||0)),this.#x(h)}set(n){return new this.constructor({decimal:this.decimal,value:n,identifier:this.toString()})}add(...n){return this.#h("add",...n)}sub(...n){return this.#h("sub",...n)}mul(...n){return this.#h("mul",...n)}div(...n){return this.#h("div",...n)}gt(n){return this.#n("gt",n)}gte(n){return this.#n("gte",n)}lt(n){return this.#n("lt",n)}lte(n){return this.#n("lte",n)}eqValue(n){return this.#n("eqValue",n)}getValue(n){const h=this.formatBigIntToSafeValue(this.bigIntValue,this.decimal||z(this.decimalMultiplier));switch(n){case"number":return Number(h);case"string":return h;case"bigint":return this.bigIntValue*10n**BigInt(this.decimal||8n)/this.decimalMultiplier}}getBaseValue(n){const h=this.decimalMultiplier/j(this.decimal||B.THOR),t=this.bigIntValue/h;switch(n){case"number":return Number(t);case"string":return t.toString();case"bigint":return t}}getBigIntValue(n,h){if(!h&&typeof n==="object")return n.bigIntValue;const t=E(n),o=M(t);if(o==="0"||o==="undefined")return 0n;return this.#o(o,h)}toSignificant(n=6){const[h,t]=this.getValue("string").split("."),o=h||"",x=t||"";if((Number.parseInt(o)?o.length+x.length:x.length)<=n)return this.getValue("string");if(o.length>=n)return o.slice(0,n).padEnd(o.length,"0");if(Number.parseInt(o))return`${o}.${x.slice(0,n-o.length)}`.padEnd(n-o.length,"0");const R=Number.parseInt(x),F=`${R}`.slice(0,n);return`0.${F.padStart(x.length-`${R}`.length+F.length,"0")}`}toFixed(n=6){const[h,t]=this.getValue("string").split("."),o=h||"",x=t||"";if(Number.parseInt(o))return`${o}.${x.slice(0,n)}`.padEnd(n,"0");const H=Number.parseInt(x),R=`${H}`.slice(0,n);return`0.${R.padStart(x.length-`${H}`.length+R.length,"0")}`}toAbbreviation(n=2){const h=this.getValue("number"),t=["","K","M","B","T","Q","Qi","S"],o=Math.floor(Math.log10(Math.abs(h))/3),x=t[o];if(!x)return this.getValue("string");const H=10**(o*3);return`${(h/H).toFixed(n)}${x}`}toCurrency(n="$",{currencyPosition:h="start",decimal:t=2,decimalSeparator:o=".",thousandSeparator:x=","}={}){const H=this.getValue("number"),[R="",F=""]=H.toFixed(6).split("."),T=R.replace(/\B(?=(\d{3})+(?!\d))/g,x),C=R||F?R==="0"?`${Number.parseFloat(`0.${F}`)}`.replace(".",o):`${T}${Number.parseInt(F)?`${o}${F.slice(0,t)}`:""}`:"0.00";return`${h==="start"?n:""}${C}${h==="end"?n:""}`}formatBigIntToSafeValue(n,h){const t=h||this.decimal||y,o=Math.max(t,z(this.decimalMultiplier)),x=n<0n,H=n.toString().substring(x?1:0),R=o-(H.length-1),F=R>0?"0".repeat(R)+H:H,T=F.length-o;let C=F.slice(-o);if(Number.parseInt(C[t]||"0")>=5)C=`${C.substring(0,t-1)}${(Number.parseInt(C[t-1]||"0")+1).toString()}`;else C=C.substring(0,t);return`${x?"-":""}${F.slice(0,T)}.${C}`.replace(/\.?0*$/,"")}#h(n,...h){const t=this.#t(this,...h),o=Math.max(t,z(this.decimalMultiplier)),x=j(o),H=h.reduce((F,T)=>{const C=this.getBigIntValue(T,o);switch(n){case"add":return F+C;case"sub":return F-C;case"mul":return F*C/x;case"div":{if(C===0n)throw new RangeError("Division by zero");return F*x/C}default:return F}},this.bigIntValue*x/this.decimalMultiplier),R=X({bigIntDecimal:o,decimal:o,value:H});return new this.constructor({decimalMultiplier:j(o),decimal:this.decimal,value:R,identifier:this.toString()})}#n(n,...h){const t=this.#t(this,...h),o=this.getBigIntValue(h[0]||"0",t),x=this.getBigIntValue(this,t);switch(n){case"gt":return x>o;case"gte":return x>=o;case"lt":return x<o;case"lte":return x<=o;case"eqValue":return x===o}}#x(n){const h=M(n)||"0";this.bigIntValue=this.#o(h)}#t(...n){const h=n.map((t)=>{return typeof t==="object"?t.decimal||z(t.decimalMultiplier):Hn(M(t))}).filter(Boolean);return Math.max(...h,y)}#o(n,h){const t=h?j(h):this.decimalMultiplier,o=z(t),[x="",H=""]=n.split(".");return BigInt(`${x}${H.padEnd(o,"0")}`)}}var Jn=Intl.NumberFormat("fullwide",{useGrouping:!1,maximumFractionDigits:20});function ot(n){const h=O.from({chain:n});switch(n){case"BTC":case"LTC":case"BCH":case"DASH":return h.set(0.00010001);case"DOGE":return h.set(1.00000001);case"AVAX":case"ETH":case"ARB":case"BSC":return h.set(0.00000001);case"THOR":case"MAYA":return h.set(0);case"GAIA":case"KUJI":return h.set(0.000001);default:return h.set(0.00000001)}}async function zn(n,h=0){cn(n);const t=V.get(n.toUpperCase()),o=t?.decimal||await Fn(v(n));if(!t)V.set(n.toUpperCase(),{identifier:n,decimal:o});return new O({decimal:o,value:b(h,o),identifier:n})}function yn(n,h=0){const t=n.split(".")?.[0]?.toUpperCase(),o=t?["MAYA","THOR"].includes(t):!1,[x,H]=o?n.split(".").slice(1).join().split("/"):n.split("/");if(!(x&&H))throw new I({errorKey:"helpers_invalid_asset_identifier",info:{identifier:n}});return new O({decimal:8,value:b(h,8),identifier:`${t||"THOR"}.${x}/${H}`})}function b(n,h){return typeof n==="bigint"?X({value:n,bigIntDecimal:h,decimal:h}):n}function v(n){const h=n.slice(0,14).includes("/"),t=n.split(".")?.[0]?.toUpperCase()==="THOR",o=n.split(".")?.[0]?.toUpperCase()==="MAYA",[x,H=""]=t||o?n.split(".").slice(1).join().split("/"):n.split("/");if(h&&!(x&&H))throw new I({errorKey:"helpers_invalid_asset_identifier",info:{identifier:n}});const R=n.includes(".")&&!h?n:`${o?"MAYA":"THOR"}.${H}`,[F,...T]=R.split("."),C=h?H:T.join("."),N=C.split("-"),_=N.length===1?N[0]:N.slice(0,-1).join("-"),P=N.length===1?void 0:N[N.length-1];return{address:P?.toLowerCase(),chain:F,isGasAsset:m({chain:F,symbol:C}),isSynthetic:h,ticker:_,symbol:(h?`${x}/`:"")+(P?`${_}-${P?.toLowerCase()??""}`:C)}}var V=new Map;class O extends S{address;chain;isGasAsset=!1;isSynthetic=!1;symbol;tax;ticker;type;chainId;constructor({value:n,decimal:h,tax:t,chain:o,symbol:x,identifier:H}){super(typeof n==="object"?n:{decimal:h,value:n});const R=v(H||`${o}.${x}`);this.type=Nn(R),this.tax=t,this.chain=R.chain,this.ticker=R.ticker,this.symbol=R.symbol,this.address=R.address,this.isSynthetic=R.isSynthetic,this.isGasAsset=R.isGasAsset,this.chainId=l[R.chain]}toString({includeSynthProtocol:n}={}){return this.isSynthetic&&!n?this.symbol:`${this.chain}.${this.symbol}`}toUrl(){return this.isSynthetic?`${this.chain}.${this.symbol.replace("/",".")}`:this.toString()}eqAsset({chain:n,symbol:h}){return this.chain===n&&this.symbol===h}eq(n){return this.eqAsset(n)&&this.eqValue(n)}static fromUrl(n,h=0){const[t,o,x]=n.split(".");if(!(t&&o))throw new I({errorKey:"helpers_invalid_asset_url",info:{urlAsset:n}});const H=t==="THOR"&&x?`${t}.${o}/${x}`:n;return O.from({asset:H,value:h})}static from({value:n=0,fromBaseDecimal:h,asyncTokenLookup:t,...o}){const x=n instanceof S?n.getValue("string"):n,H="chain"in o,R=H?o.chain:o.asset,F=H||Rn.includes(R),{identifier:T,decimal:C}=F?Cn(R):{identifier:R,decimal:void 0},{chain:N,isSynthetic:_}=v(T),P=V.get(T.toUpperCase()),L=P?.decimal||C;on(!(t||L),wn(`Couldn't find static decimal for ${sn(T)} (Using default ${sn(B[N])} decimal as fallback). | ||
This can result in incorrect calculations and mess with amount sent on transactions. | ||
You can load static assets by installing @swapkit/tokens package and calling AssetValue.loadStaticAssets() | ||
or by passing asyncTokenLookup: true to the from() function, which will make it async and return a promise.`));const{decimal:p,identifier:V,tax:X}=Q||{decimal:J||z[L],identifier:O},K=F?b(BigInt(N),F):b(N,p);return H?Cx(V,F?K:N):Z?Sx(V,K):new $({tax:X,decimal:p,identifier:V,value:K})}static loadStaticAssets(){return new Promise((x,F)=>{try{import("@swapkit/tokens").then((H)=>{for(let n of Object.values(H))for(let{identifier:N,chain:R,...I}of n.tokens)E.set(N.toUpperCase(),{identifier:N,decimal:"decimals"in I?I.decimals:z[R]});x({ok:!0})})}catch(H){console.error(H),F({ok:!1,error:H,message:"Couldn't load static assets. Ensure you have installed @swapkit/tokens package"})}})}static fromString(x,F=0){return $.from({asset:x,value:F,asyncTokenLookup:!0})}static fromIdentifier(x,F=0){return $.from({asset:x,value:F,asyncTokenLookup:!0})}static fromStringSync(x,F=0){return $.from({asset:x,value:F})}static fromStringWithBase(x,F=0n,H=8){return $.from({asyncTokenLookup:!0,asset:x,value:F,fromBaseDecimal:H})}static fromStringWithBaseSync(x,F=0n,H=8){return $.from({asset:x,value:F,fromBaseDecimal:H})}static fromIdentifierSync(x,F=0){return $.from({asset:x,value:F})}static fromChainOrSignature(x,F=0){if(Object.values(Y).includes(x))return $.from({chain:x,value:F});return $.from({asset:x,value:F})}}function NH({apiKey:x,...F}){r={...F,apiKey:x}}async function D(x,F){const{apiKey:H,...n}=r,{searchParams:N,json:R,body:I}=F,_={...Ux,...n.headers,...F.headers,...R?{"Content-Type":"application/json"}:{}},O=R?JSON.stringify(R):I,G=new URL(x);if(N)G.search=new URLSearchParams(N).toString();if(H)_["x-api-key"]=H;try{const Z=await(await fetch(G.toString(),{...n,...F,body:O,headers:_})).json();if(F.responseHandler)return F.responseHandler(Z);return Z}catch(L){if(F.onError)return F.onError(L);console.error(L)}}var r={},Ux=typeof window!=="undefined"?{}:{referrer:"https://sk.thorswap.net",referer:"https://sk.thorswap.net"},c={get:async(x,F)=>D(x,{...F,method:"GET"}),post:async(x,F)=>D(x,{...F,method:"POST"}),extend:(x)=>{const F={...r,...x};return{get:async(H,n)=>D(H,{...F,...n,method:"GET"}),post:async(H,n)=>D(H,{...F,...n,method:"POST"}),extend:(H)=>c.extend({...F,...H})}}};async function LH(x){const F=await import("@swapkit/tokens");for(let H of Object.values(F))for(let{identifier:n,chain:N,...R}of H.tokens){if("identifier"in x&&n===x.identifier)return n;if("address"in R&&"chain"in x&&N===x.chain&&R.address.toLowerCase()===x.contract.toLowerCase())return n}return}var fx="0x313ce567",Tx=[`${"MAYA"}.MAYA`,`${"ETH"}.THOR`,`${"ETH"}.vTHOR`,`${"KUJI"}.USK`],Ax=async({chain:x,to:F})=>{try{const{result:H}=await c.post(m[x],{headers:{accept:"*/*","content-type":"application/json","cache-control":"no-cache"},body:JSON.stringify({id:44,jsonrpc:"2.0",method:"eth_call",params:[{to:F.toLowerCase(),data:fx},"latest"]})});return Number.parseInt(BigInt(H||z[x]).toString())}catch(H){return console.error(H),z[x]}},px=async({symbol:x})=>{try{const F=x.split("-")[1]?.toLowerCase(),{manager:H}=await c.post(`${m["XRD"]}/state/resource`,{headers:{Accept:"*/*","Content-Type":"application/json"},body:JSON.stringify({network:"mainnet",resource_address:F})});return H.divisibility.value.divisibility}catch(F){return console.error(F),z["XRD"]}},gx=(x)=>{if(x==="ETH")return 18;const F=x.split("-"),H=F.length===1?void 0:F[F.length-1]?.toLowerCase();return H?.startsWith("0x")?Ax({chain:"ETH",to:H}):18},ux=(x)=>{const F=x.split("-"),H=F.length===1?void 0:F[F.length-1];return H?.startsWith("0x")?Ax({chain:"AVAX",to:H.toLowerCase()}):18},yx=(x)=>{if(x==="BSC")return 18;return 18},vx=(x)=>{if(x==="XRD")return 18;return px({symbol:x})},_x=({chain:x,symbol:F})=>{switch(x){case"ETH":return gx(F);case"AVAX":return ux(F);case"BSC":return yx(F);case"XRD":return vx(F);default:return z[x]}},TH=({chain:x})=>{switch(x){case"ARB":case"OP":return $.from({asset:`${x}.ETH`});case"MAYA":return $.from({asset:`${x}.CACAO`});case"GAIA":return $.from({asset:`${x}.ATOM`});case"BSC":return $.from({asset:`${x}.BNB`});case"THOR":return $.from({asset:`${x}.RUNE`});default:return $.from({asset:`${x}.${x}`})}},a=({chain:x,symbol:F})=>{switch(x){case"ARB":case"OP":return F==="ETH";case"MAYA":return F==="CACAO";case"GAIA":return F==="ATOM";case"BSC":return F==="BNB";case"THOR":return F==="RUNE";default:return F===x}},Gx=(x)=>{switch(x){case"ARB":case"OP":return{identifier:`${x}.ETH`,decimal:z[x]};case`${"ETH"}.THOR`:return{identifier:"ETH.THOR-0xa5f2211b9b8170f694421f2046281775e8468044",decimal:18};case`${"ETH"}.vTHOR`:return{identifier:"ETH.vTHOR-0x815c23eca83261b6ec689b60cc4a58b54bc24d8d",decimal:18};case"GAIA":return{identifier:`${x}.ATOM`,decimal:z[x]};case"THOR":return{identifier:`${x}.RUNE`,decimal:z[x]};case"BSC":return{identifier:`${x}.BNB`,decimal:z[x]};case"MAYA":return{identifier:`${x}.CACAO`,decimal:10};case"XRD":return{identifier:`${"XRD"}.XRD`,decimal:z[x]};case`${"MAYA"}.MAYA`:return{identifier:x,decimal:4};case`${"KUJI"}.USK`:return{identifier:x,decimal:6};default:return{identifier:`${x}.${x}`,decimal:z[x]}}},Lx=({chain:x,symbol:F})=>{if(F.includes("/"))return"Synth";switch(x){case"GAIA":return F==="ATOM"?"Native":"GAIA";case"KUJI":return F==="KUJI"?"Native":"KUJI";case"BSC":return F==="BNB"?"Native":"BEP20";case"ETH":return F==="ETH"?"Native":"ERC20";case"AVAX":return F==="AVAX"?"Native":"AVAX";case"MATIC":return F==="MATIC"?"Native":"POLYGON";case"ARB":return["ETH","ARB"].includes(F)?"Native":"ARBITRUM";case"OP":return["ETH","OP"].includes(F)?"Native":"OPTIMISM";case"XRD":return F==="XRD"?"Native":"RADIX";default:return"Native"}},_H=(x)=>{const[F,...H]=x.split("."),n=x.includes("/"),N=H.join("."),R=N?.split("-"),I=R?.length?R.length===1?R[0]:R.slice(0,-1).join("-"):void 0;return{chain:F,symbol:N,ticker:I,synth:n}},ox=new RegExp(/(.)\1{6}|\.ORG|\.NET|\.FINANCE|\.COM|WWW|HTTP|\\\\|\/\/|[\s$%:[\]]/,"gmi"),Ex=(x)=>{const[F,H]=x.split(".");if(!y.includes(F))return!0;const n=H.split("-"),N=n.length===1?void 0:n[n.length-1];return a({chain:F,symbol:H})||!!N},GH=(x)=>x.filter(({chain:F,value:H,symbol:n})=>{const N=`${F}.${n}`;return!ox.test(N)&&Ex(N)&&H!=="0"});function PH([x,F,H,n,N]){return`m/${x}'/${F}'/${H}'/${n}${typeof N!=="number"?"":`/${N}`}`}function $H({chain:x,index:F,addressIndex:H=0,type:n}){if(y.includes(x)){if(n==="legacy")return[44,60,0,F];if(n==="ledgerLive")return[44,60,F,0,H];return Ox(s[x],F)}const N=x==="LTC"?2:0;switch(n){case"nativeSegwitMiddleAccount":return[84,N,F,0,H];case"segwit":return[49,N,0,0,F];case"legacy":return[44,N,0,0,F];default:return Ox(s[x],F)}}function XH(x){const[F,H,n]=x.split("/").map((N)=>Number.parseInt(N,10));switch(H){case 44:return"legacy";case 49:return"p2sh";default:return"bech32"}}var Ox=(x,F)=>{return[...x.slice(0,x.length-1),F]};function bx({liquidityUnits:x,poolUnits:F,runeDepth:H}){const n=w(x),N=w(F),R=w(H),I=n.mul(R),_=N.mul(N).mul(2),O=N.mul(n).mul(2),G=n.mul(n),L=N.mul(N).mul(N);return I.mul(_.sub(O).add(G)).div(L)}function Dx({liquidityUnits:x,poolUnits:F,assetDepth:H}){const n=w(x),N=w(F),R=w(H),I=n.mul(R),_=N.mul(N).mul(2),O=N.mul(n).mul(2),G=n.mul(n),L=I.mul(_.sub(O).add(G)),Z=N.mul(N).mul(N);return L.div(Z)}function ZH({percent:x,runeDepth:F,liquidityUnits:H,poolUnits:n}){return bx({runeDepth:F,liquidityUnits:H,poolUnits:n}).mul(x)}function YH({percent:x,assetDepth:F,liquidityUnits:H,poolUnits:n}){return Dx({assetDepth:F,liquidityUnits:H,poolUnits:n}).mul(x)}function w(x){return q.fromBigInt(BigInt(x),8)}function cx({liquidityUnits:x,poolUnits:F,runeDepth:H,assetDepth:n}){return{assetAmount:w(n).mul(x).div(F),runeAmount:w(H).mul(x).div(F)}}function wH({liquidityUnits:x,poolUnits:F,runeDepth:H,assetDepth:n,percent:N}){return Object.fromEntries(Object.entries(cx({liquidityUnits:x,poolUnits:F,runeDepth:H,assetDepth:n})).map(([R,I])=>[R,I.mul(N)]))}function QH({runeDepth:x,poolUnits:F,assetDepth:H,liquidityUnits:n,runeAmount:N,assetAmount:R}){const I=new q({value:x,decimal:8}),_=new q({value:H,decimal:8}),O=new q({value:F,decimal:8}),G=new q({value:N,decimal:8}),L=new q({value:R,decimal:8}),Z=G.mul(_),Q=L.mul(I),J=G.mul(L),p=I.mul(_),V=O.mul(Z.add(Q.add(J.mul(2)))),X=Z.add(Q.add(p.mul(2))),K=V.div(X),g=w(n).add(K);if(K.getBaseValue("number")===0)return g.div(O).getBaseValue("number");const k=O.add(g);return g.div(k).getBaseValue("number")}function qH({runeAmount:x,assetAmount:F,runeDepth:H,assetDepth:n}){if(x==="0"||F==="0"||H==="0"||n==="0")return 0;const N=w(H),R=w(n),I=w(F),_=w(x),O=I.mul(N).sub(R.mul(_)),G=R.mul(_).add(N.mul(R));return Math.abs(O.div(G).getBaseValue("number"))}function dx({type:x,address:F}){return`${x}:${F}`}function tx({address:x,unbondAmount:F}){return`${"UNBOND"}:${x}:${F}`}function VH(x){return f("POOL+",x)}function mx({chain:x,symbol:F,...H}){return f(`${"+"}:${x}/${F}`,H)}function sx({chain:x,symbol:F,address:H,...n}){const N=ex({chain:x,symbol:F}),R=H?`:${H}:`:":";return f(`${"+"}:${N}${R}`,n)}function ix({chain:x,symbol:F,basisPoints:H}){return`${"-"}:${x}/${F}:${H}`}function lx({chain:x,symbol:F,ticker:H,basisPoints:n,targetAsset:N}){const R=x==="ETH"&&H!=="ETH"?`${H}-${F.slice(-3)}`:F,I=N?`:${N}`:"";return`${"-"}:${x}.${R}:${n}${I}`}function CH({basisPoints:x,...F}){return f(`${"POOL-"}:${x}`,F)}function ax({name:x,chain:F,address:H,owner:n}){const N=`${"~"}:${x}:${F}:${H}`,R=n?`:${n}`:"";return`${N}${R}`}function SH({name:x,chain:F,asset:H,payout:n,owner:N}){return`${"~"}:${x}:${F}:${n}:${N}:${H}`}function rx(x,{asset:F,address:H,minAmount:n,...N}){const R=`${x}:${F}:${H}`,I=n?`:${n}`:"";return f(`${R}${I}`,N)}function f(x,{affiliateAddress:F,affiliateBasisPoints:H}={}){const n=`${x}${F?`:${F}:${H||0}`:""}`;return n.endsWith(":")?n.slice(0,-1):n}function ex({chain:x,symbol:F}){switch(x){case"BTC":case"DOGE":case"LTC":return x.slice(0,1).toLowerCase();case"BCH":return"c";default:return`${x}.${F}`}}var UH=(x,F)=>{switch(x){case"LEAVE":case"BOND":return dx({type:x,address:F?.address});case"UNBOND":return tx({address:F?.address,unbondAmount:F?.unbondAmount});case"~":return ax(F);case"$+":case"$-":return rx(x,F);case"+":{const{chain:H,symbol:n,address:N,singleSide:R}=F;if(R)return mx({chain:H,symbol:n});return sx({chain:H,symbol:n,address:N})}case"-":{const{chain:H,ticker:n,symbol:N,basisPoints:R,targetAssetString:I,singleSide:_}=F;if(_)return ix({chain:H,symbol:N,basisPoints:R});return lx({chain:H,ticker:n,symbol:N,basisPoints:R,targetAsset:I})}default:throw new j({errorKey:"helpers_invalid_memo_type",info:{memoType:x}})}};function bH({chain:x,covalentApiKey:F,ethplorerApiKey:H}){const n=x!=="ETH"&&!F?"covalentApiKey":H?void 0:"ethplorerApiKey";if(n)throw new j({errorKey:"wallet_missing_api_key",info:{missingKey:n}});return{covalentApiKey:F,ethplorerApiKey:H}}function DH(){const x=[];function F(n){if(x.map((N)=>N.info.uuid).includes(n.detail.info.uuid))return;x.push(n.detail)}window.addEventListener("eip6963:announceProvider",F),window.dispatchEvent(new Event("eip6963:requestProvider"));function H(){window.removeEventListener("eip6963:announceProvider",F)}return{providers:x,removeEIP6963EventListener:H}}var xF=["approve","approvedAmount","call","sendTransaction","transfer","isApproved","approvedAmount","EIP1193SendTransaction","getFeeData","broadcastTransaction","estimateCall","estimateGasLimit","estimateGasPrices","createContractTxObject"],FF=(x,F,H)=>async(...n)=>{try{await HF(F,H)}catch(N){throw new j({errorKey:"helpers_failed_to_switch_network",info:{error:N}})}return x(...n)},Px=({provider:x,params:F,method:H})=>{if(!x?.send)throw new j("helpers_not_found_provider");const n=F?Array.isArray(F)?F:[F]:[];return x.send(H,n)},uH=({toolbox:x,chainId:F,provider:H=window.ethereum})=>{const n=xF.reduce((N,R)=>{if(!x[R])return N;const I=x[R];if(typeof I!=="function")return N;return{...N,[R]:FF(I,H,F)}},{});return{...x,...n}},yH=(x,F)=>Px({provider:x,method:"wallet_addEthereumChain",params:[F]}),HF=(x,F="0x1")=>Px({provider:x,method:"wallet_switchEthereumChain",params:[{chainId:F}]}),vH=(x)=>{window.ethereum?.on("accountsChanged",()=>x()),window.xfi?.ethereum.on("accountsChanged",()=>x())},oH=()=>{const{isTrust:x,isBraveWallet:F,__XDEFI:H,overrideIsMetaMask:n,selectedProvider:N}=window?.ethereum||{};if(x)return"TRUSTWALLET_WEB";if(F)return"BRAVE";if(n&&N?.isCoinbaseWallet)return"COINBASE_WEB";if(H)"XDEFI";return"METAMASK"},EH=(x)=>{return nF().includes(x)},nF=()=>{const x=window?.ethereum&&!window.ethereum?.isBraveWallet,F=window?.xfi||window?.ethereum?.__XDEFI,H=window?.ethereum?.isBraveWallet,n=window?.ethereum?.isTrust||window?.trustwallet,N=window?.ethereum?.overrideIsMetaMask&&window?.ethereum?.selectedProvider?.isCoinbaseWallet||window?.coinbaseWalletExtension,R=[];if(x)R.push("METAMASK");if(F)R.push("XDEFI");if(H)R.push("BRAVE");if(n)R.push("TRUSTWALLET_WEB");if(N)R.push("COINBASE_WEB");if(NF())R.push("OKX_MOBILE");return R},NF=()=>{const x=navigator.userAgent,F=/iphone|ipad|ipod|ios/i.test(x),H=/android|XiaoMi|MiuiBrowser/i.test(x),n=F||H,N=/OKApp/i.test(x);return n&&N},cH=()=>typeof window.ethereum!=="undefined";class q extends B{eq(x){return this.eqValue(x)}static fromBigInt(x,F){return new q({decimal:F,value:M({value:x,bigIntDecimal:F,decimal:F})})}}export{oF as wrapWithThrow,FF as wrapMethodWithNetworkSwitch,Nx as warnOnce,dF as validateTNS,Rx as validateIdentifier,HF as switchEVMWalletNetwork,NH as setRequestClientConfig,uH as prepareNetworkSwitch,NF as okxMobileEnabled,nF as listWeb3EVMWallets,cH as isWeb3Detected,a as isGasAsset,EH as isDetected,XH as getWalletFormatFor,yF as getTHORNameCost,wH as getSymmetricWithdraw,cx as getSymmetricPoolShare,HH as getMinAmountByChain,lx as getMemoForWithdraw,tx as getMemoForUnbond,ix as getMemoForSaverWithdraw,mx as getMemoForSaverDeposit,CH as getMemoForRunePoolWithdraw,VH as getMemoForRunePoolDeposit,ax as getMemoForNameRegister,SH as getMemoForNamePreferredAssetRegister,rx as getMemoForLoan,dx as getMemoForLeaveAndBond,sx as getMemoForDeposit,UH as getMemoFor,vF as getMAYANameCost,qH as getLiquiditySlippage,TH as getGasAsset,QH as getEstimatedPoolShare,oH as getETHDefaultWallet,DH as getEIP6963Wallets,$H as getDerivationPathFor,_x as getDecimal,Gx as getCommonAssetInfo,EF as getChainIdentifier,ZH as getAsymmetricRuneWithdrawAmount,bx as getAsymmetricRuneShare,YH as getAsymmetricAssetWithdrawAmount,Dx as getAsymmetricAssetShare,Lx as getAssetType,M as formatBigIntToSafeValue,LH as findAssetBy,GH as filterAssets,bH as ensureEVMApiKeys,PH as derivationPathToString,Ux as defaultRequestHeaders,_H as assetFromString,yH as addEVMWalletNetwork,vH as addAccountsChangedCallback,Qx as WarningCodeEnum,Fx as WalletOption,_F as UTXOChains,LF as TCSupportedChains,q as SwapKitNumber,j as SwapKitError,TF as SubstrateChains,JF as SWAP_OUT,jF as SWAP_IN,c as RequestClient,d as RPCUrl,Xx as QuoteMode,qx as ProviderName,s as NetworkDerivationPath,Hx as MemoType,AF as MAYASupportedChains,zx as LedgerErrorCode,Bx as FeeTypeEnum,Zx as FeeOption,t as ExplorerUrl,wx as ErrorCode,y as EVMChains,Jx as DerivationPath,GF as CosmosChains,jx as ContractAddress,Tx as CommonAssetStrings,m as ChainToRPC,OF as ChainToHexChainId,PF as ChainToExplorerUrl,xx as ChainToChainId,kF as ChainIdToChain,u as ChainId,Y as Chain,B as BigIntArithmetics,z as BaseDecimal,$ as AssetValue,Yx as ApproveMode,XF as AGG_SWAP}; | ||
or by passing asyncTokenLookup: true to the from() function, which will make it async and return a promise.`));const{decimal:f,identifier:J,tax:$}=P||{decimal:L||B[N],identifier:T},p=h?b(BigInt(x),h):b(x,f);return t?zn(J,h?p:x):_?yn(J,p):new O({tax:$,decimal:f,identifier:J,value:p})}static loadStaticAssets(){return new Promise((n,h)=>{try{import("@swapkit/tokens").then((t)=>{for(let o of Object.values(t))for(let{identifier:x,chain:H,...R}of o.tokens)V.set(x.toUpperCase(),{identifier:x,decimal:"decimals"in R?R.decimals:B[H]});n({ok:!0})})}catch(t){console.error(t),h({ok:!1,error:t,message:"Couldn't load static assets. Ensure you have installed @swapkit/tokens package"})}})}static fromString(n,h=0){return O.from({asset:n,value:h,asyncTokenLookup:!0})}static fromIdentifier(n,h=0){return O.from({asset:n,value:h,asyncTokenLookup:!0})}static fromStringSync(n,h=0){return O.from({asset:n,value:h})}static fromStringWithBase(n,h=0n,t=B.THOR){return O.from({asyncTokenLookup:!0,asset:n,value:h,fromBaseDecimal:t})}static fromStringWithBaseSync(n,h=0n,t=B.THOR){return O.from({asset:n,value:h,fromBaseDecimal:t})}static fromIdentifierSync(n,h=0){return O.from({asset:n,value:h})}static fromChainOrSignature(n,h=0){if(Object.values(G).includes(n))return O.from({chain:n,value:h});return O.from({asset:n,value:h})}}function ct({apiKey:n,...h}){r={...h,apiKey:n}}async function K(n,h){const{apiKey:t,...o}=r,{searchParams:x,json:H,body:R}=h,F={...Zn,...o.headers,...h.headers,...H?{"Content-Type":"application/json"}:{}},T=H?JSON.stringify(H):R,C=new URL(n);if(x)C.search=new URLSearchParams(x).toString();if(t)F["x-api-key"]=t;try{const _=await(await fetch(C.toString(),{...o,...h,body:T,headers:F})).json();if(h.responseHandler)return h.responseHandler(_);return _}catch(N){if(h.onError)return h.onError(N);console.error(N)}}var r={},Zn=typeof window!=="undefined"?{}:{referrer:"https://sk.thorswap.net",referer:"https://sk.thorswap.net"},D={get:async(n,h)=>K(n,{...h,method:"GET"}),post:async(n,h)=>K(n,{...h,method:"POST"}),extend:(n)=>{const h={...r,...n};return{get:async(t,o)=>K(t,{...h,...o,method:"GET"}),post:async(t,o)=>K(t,{...h,...o,method:"POST"}),extend:(t)=>D.extend({...h,...t})}}};async function Bt(n){const h=await import("@swapkit/tokens");for(let t of Object.values(h))for(let{identifier:o,chain:x,...H}of t.tokens){if("identifier"in n&&o===n.identifier)return o;if("address"in H&&"chain"in n&&x===n.chain&&H.address.toLowerCase()===n.contract.toLowerCase())return o}return}var fn="0x313ce567",Rn=[`${"MAYA"}.MAYA`,`${"ETH"}.THOR`,`${"ETH"}.vTHOR`,`${"KUJI"}.USK`],An=async({chain:n,to:h})=>{try{const{result:t}=await D.post(U[n],{headers:{accept:"*/*","content-type":"application/json","cache-control":"no-cache"},body:JSON.stringify({id:44,jsonrpc:"2.0",method:"eth_call",params:[{to:h.toLowerCase(),data:fn},"latest"]})});return Number.parseInt(BigInt(t||B[n]).toString())}catch(t){return console.error(t),B[n]}},Yn=async({symbol:n})=>{try{const h=n.split("-")[1]?.toLowerCase(),{manager:t}=await D.post(`${U["XRD"]}/state/resource`,{headers:{Accept:"*/*","Content-Type":"application/json"},body:JSON.stringify({network:"mainnet",resource_address:h})});return t.divisibility.value.divisibility}catch(h){return console.error(h),B["XRD"]}},qn=(n)=>{if(n==="ETH")return B.ETH;const h=n.split("-"),t=h.length===1?void 0:h[h.length-1]?.toLowerCase();return t?.startsWith("0x")?An({chain:"ETH",to:t}):B.ETH},Qn=(n)=>{const h=n.split("-"),t=h.length===1?void 0:h[h.length-1];return t?.startsWith("0x")?An({chain:"AVAX",to:t.toLowerCase()}):B.AVAX},Wn=(n)=>{if(n==="BSC")return B.BSC;return B.BSC},Mn=(n)=>{if(n==="XRD")return B.XRD;return Yn({symbol:n})},Fn=({chain:n,symbol:h})=>{switch(n){case"ETH":return qn(h);case"AVAX":return Qn(h);case"BSC":return Wn(h);case"XRD":return Mn(h);default:return B[n]}},Ct=({chain:n})=>{switch(n){case"ARB":case"BASE":case"OP":return O.from({asset:`${n}.ETH`});case"MAYA":return O.from({asset:`${n}.CACAO`});case"GAIA":return O.from({asset:`${n}.ATOM`});case"BSC":return O.from({asset:`${n}.BNB`});case"THOR":return O.from({asset:`${n}.RUNE`});default:return O.from({asset:`${n}.${n}`})}},m=({chain:n,symbol:h})=>{switch(n){case"ARB":case"BASE":case"OP":return h==="ETH";case"MAYA":return h==="CACAO";case"GAIA":return h==="ATOM";case"BSC":return h==="BNB";case"THOR":return h==="RUNE";default:return h===n}},Cn=(n)=>{switch(n){case"ARB":case"BASE":case"OP":return{identifier:`${n}.ETH`,decimal:B[n]};case`${"ETH"}.THOR`:return{identifier:"ETH.THOR-0xa5f2211b9b8170f694421f2046281775e8468044",decimal:18};case`${"ETH"}.vTHOR`:return{identifier:"ETH.vTHOR-0x815c23eca83261b6ec689b60cc4a58b54bc24d8d",decimal:18};case"GAIA":return{identifier:`${n}.ATOM`,decimal:B[n]};case"THOR":return{identifier:`${n}.RUNE`,decimal:B[n]};case"BSC":return{identifier:`${n}.BNB`,decimal:B[n]};case"MAYA":return{identifier:`${n}.CACAO`,decimal:10};case"XRD":return{identifier:`${"XRD"}.XRD`,decimal:B[n]};case`${"MAYA"}.MAYA`:return{identifier:n,decimal:4};case`${"KUJI"}.USK`:return{identifier:n,decimal:6};default:return{identifier:`${n}.${n}`,decimal:B[n]}}},Nn=({chain:n,symbol:h})=>{if(h.includes("/"))return"Synth";switch(n){case"ARB":case"OP":case"BASE":return h==="ETH"?"Native":n;case"GAIA":return h==="ATOM"?"Native":n;case"BSC":return h==="BNB"?"Native":n;case"MAYA":return h==="CACAO"?"Native":n;case"THOR":return h==="RUNE"?"Native":n;default:return h===n?"Native":n}},Nt=(n)=>{const[h,...t]=n.split("."),o=n.includes("/"),x=t.join("."),H=x?.split("-"),R=H?.length?H.length===1?H[0]:H.slice(0,-1).join("-"):void 0;return{chain:h,symbol:x,ticker:R,synth:o}},Vn=new RegExp(/(.)\1{6}|\.ORG|\.NET|\.FINANCE|\.COM|WWW|HTTP|\\\\|\/\/|[\s$%:[\]]/,"gmi"),bn=(n)=>{const[h,t]=n.split(".");if(!Q.includes(h))return!0;const o=t.split("-"),x=o.length===1?void 0:o[o.length-1];return m({chain:h,symbol:t})||!!x},At=(n)=>n.filter(({chain:h,value:t,symbol:o})=>{const x=`${h}.${o}`;return!Vn.test(x)&&bn(x)&&t!=="0"});function Ot([n,h,t,o,x]){return`m/${n}'/${h}'/${t}'/${o}${typeof x!=="number"?"":`/${x}`}`}function $t({chain:n,index:h,addressIndex:t=0,type:o}){if(Q.includes(n)){if(o==="legacy")return[44,60,0,h];if(o==="ledgerLive")return[44,60,h,0,t];return Bn(i[n],h)}const x=n==="LTC"?2:0;switch(o){case"nativeSegwitMiddleAccount":return[84,x,h,0,t];case"segwit":return[49,x,0,0,h];case"legacy":return[44,x,0,0,h];default:return Bn(i[n],h)}}function It(n){const[h,t,o]=n.split("/").map((x)=>Number.parseInt(x,10));switch(t){case 44:return"legacy";case 49:return"p2sh";default:return"bech32"}}var Bn=(n,h)=>{return[...n.slice(0,n.length-1),h]};function Kn({liquidityUnits:n,poolUnits:h,runeDepth:t}){const o=g(n),x=g(h),H=g(t),R=o.mul(H),F=x.mul(x).mul(2),T=x.mul(o).mul(2),C=o.mul(o),N=x.mul(x).mul(x);return R.mul(F.sub(T).add(C)).div(N)}function Dn({liquidityUnits:n,poolUnits:h,assetDepth:t}){const o=g(n),x=g(h),H=g(t),R=o.mul(H),F=x.mul(x).mul(2),T=x.mul(o).mul(2),C=o.mul(o),N=R.mul(F.sub(T).add(C)),_=x.mul(x).mul(x);return N.div(_)}function gt({percent:n,runeDepth:h,liquidityUnits:t,poolUnits:o}){return Kn({runeDepth:h,liquidityUnits:t,poolUnits:o}).mul(n)}function Pt({percent:n,assetDepth:h,liquidityUnits:t,poolUnits:o}){return Dn({assetDepth:h,liquidityUnits:t,poolUnits:o}).mul(n)}function g(n){return u.fromBigInt(BigInt(n),B.THOR)}function an({liquidityUnits:n,poolUnits:h,runeDepth:t,assetDepth:o}){return{assetAmount:g(o).mul(n).div(h),runeAmount:g(t).mul(n).div(h)}}function ut({liquidityUnits:n,poolUnits:h,runeDepth:t,assetDepth:o,percent:x}){return Object.fromEntries(Object.entries(an({liquidityUnits:n,poolUnits:h,runeDepth:t,assetDepth:o})).map(([H,R])=>[H,R.mul(x)]))}function St({runeDepth:n,poolUnits:h,assetDepth:t,liquidityUnits:o,runeAmount:x,assetAmount:H}){const R=new u({value:n,decimal:8}),F=new u({value:t,decimal:8}),T=new u({value:h,decimal:8}),C=new u({value:x,decimal:8}),N=new u({value:H,decimal:8}),_=C.mul(F),P=N.mul(R),L=C.mul(N),f=R.mul(F),J=T.mul(_.add(P.add(L.mul(2)))),$=_.add(P.add(f.mul(2))),p=J.div($),Y=g(o).add(p);if(p.getBaseValue("number")===0)return Y.div(T).getBaseValue("number");const kn=T.add(Y);return Y.div(kn).getBaseValue("number")}function jt({runeAmount:n,assetAmount:h,runeDepth:t,assetDepth:o}){if(n==="0"||h==="0"||t==="0"||o==="0")return 0;const x=g(t),H=g(o),R=g(h),F=g(n),T=R.mul(x).sub(H.mul(F)),C=H.mul(F).add(x.mul(H));return Math.abs(T.div(C).getBaseValue("number"))}function dn({type:n,address:h}){return`${n}:${h}`}function Un({address:n,unbondAmount:h}){return`${"UNBOND"}:${n}:${h}`}function zt(n){return Z("POOL+",n)}function En({chain:n,symbol:h,...t}){return Z(`${"+"}:${n}/${h}`,t)}function vn({chain:n,symbol:h,address:t,...o}){const x=nh({chain:n,symbol:h}),H=t?`:${t}:`:":";return Z(`${"+"}:${x}${H}`,o)}function mn({chain:n,symbol:h,basisPoints:t}){return`${"-"}:${n}/${h}:${t}`}function rn({chain:n,symbol:h,ticker:t,basisPoints:o,targetAsset:x}){const H=n==="ETH"&&t!=="ETH"?`${t}-${h.slice(-3)}`:h,R=x?`:${x}`:"";return`${"-"}:${n}.${H}:${o}${R}`}function yt({basisPoints:n,...h}){return Z(`${"POOL-"}:${n}`,h)}function en({name:n,chain:h,address:t,owner:o}){const x=`${"~"}:${n}:${h}:${t}`,H=o?`:${o}`:"";return`${x}${H}`}function Zt({name:n,chain:h,asset:t,payout:o,owner:x}){return`${"~"}:${n}:${h}:${o}:${x}:${t}`}function ln(n,{asset:h,address:t,minAmount:o,...x}){const H=`${n}:${h}:${t}`,R=o?`:${o}`:"";return Z(`${H}${R}`,x)}function Z(n,{affiliateAddress:h,affiliateBasisPoints:t}={}){const o=`${n}${h?`:${h}:${t||0}`:""}`;return o.endsWith(":")?o.slice(0,-1):o}function nh({chain:n,symbol:h}){switch(n){case"BTC":case"DOGE":case"LTC":return n.slice(0,1).toLowerCase();case"BCH":return"c";default:return`${n}.${h}`}}var ft=(n,h)=>{switch(n){case"LEAVE":case"BOND":return dn({type:n,address:h?.address});case"UNBOND":return Un({address:h?.address,unbondAmount:h?.unbondAmount});case"~":return en(h);case"$+":case"$-":return ln(n,h);case"+":{const{chain:t,symbol:o,address:x,singleSide:H}=h;if(H)return En({chain:t,symbol:o});return vn({chain:t,symbol:o,address:x})}case"-":{const{chain:t,ticker:o,symbol:x,basisPoints:H,targetAssetString:R,singleSide:F}=h;if(F)return mn({chain:t,symbol:x,basisPoints:H});return rn({chain:t,ticker:o,symbol:x,basisPoints:H,targetAsset:R})}default:throw new I({errorKey:"helpers_invalid_memo_type",info:{memoType:n}})}};function Dt({chain:n,covalentApiKey:h,ethplorerApiKey:t}){const o=n!=="ETH"&&!h?"covalentApiKey":t?void 0:"ethplorerApiKey";if(o)throw new I({errorKey:"wallet_missing_api_key",info:{missingKey:o}});return{covalentApiKey:h,ethplorerApiKey:t}}function at(){const n=[];function h(o){if(n.map((x)=>x.info.uuid).includes(o.detail.info.uuid))return;n.push(o.detail)}window.addEventListener("eip6963:announceProvider",h),window.dispatchEvent(new Event("eip6963:requestProvider"));function t(){window.removeEventListener("eip6963:announceProvider",h)}return{providers:n,removeEIP6963EventListener:t}}var hh=["approve","approvedAmount","call","sendTransaction","transfer","isApproved","approvedAmount","EIP1193SendTransaction","getFeeData","broadcastTransaction","estimateCall","estimateGasLimit","estimateGasPrices","createContractTxObject"],th=(n,h,t)=>async(...o)=>{try{await oh(h,t)}catch(x){throw new I({errorKey:"helpers_failed_to_switch_network",info:{error:x}})}return n(...o)},Tn=({provider:n,params:h,method:t})=>{if(!n?.send)throw new I("helpers_not_found_provider");const o=h?Array.isArray(h)?h:[h]:[];return n.send(t,o)},Wt=({toolbox:n,chainId:h,provider:t=window.ethereum})=>{const o=hh.reduce((x,H)=>{if(!n[H])return x;const R=n[H];if(typeof R!=="function")return x;return{...x,[H]:th(R,t,h)}},{});return{...n,...o}},Mt=(n,h)=>Tn({provider:n,method:"wallet_addEthereumChain",params:[h]}),oh=(n,h="0x1")=>Tn({provider:n,method:"wallet_switchEthereumChain",params:[{chainId:h}]}),Vt=(n)=>{window.ethereum?.on("accountsChanged",()=>n()),window.xfi?.ethereum.on("accountsChanged",()=>n())},bt=()=>{const{isTrust:n,isBraveWallet:h,__XDEFI:t,overrideIsMetaMask:o,selectedProvider:x}=window?.ethereum||{};if(n)return"TRUSTWALLET_WEB";if(h)return"BRAVE";if(o&&x?.isCoinbaseWallet)return"COINBASE_WEB";if(t)"XDEFI";return"METAMASK"},Kt=(n)=>{return xh().includes(n)},xh=()=>{const n=window?.ethereum&&!window.ethereum?.isBraveWallet,h=window?.xfi||window?.ethereum?.__XDEFI,t=window?.ethereum?.isBraveWallet,o=window?.ethereum?.isTrust||window?.trustwallet,x=window?.ethereum?.overrideIsMetaMask&&window?.ethereum?.selectedProvider?.isCoinbaseWallet||window?.coinbaseWalletExtension,H=[];if(n)H.push("METAMASK");if(h)H.push("XDEFI");if(t)H.push("BRAVE");if(o)H.push("TRUSTWALLET_WEB");if(x)H.push("COINBASE_WEB");if(ch())H.push("OKX_MOBILE");return H},ch=()=>{const n=navigator.userAgent,h=/iphone|ipad|ipod|ios/i.test(n),t=/android|XiaoMi|MiuiBrowser/i.test(n),o=h||t,x=/OKApp/i.test(n);return o&&x},dt=()=>typeof window.ethereum!=="undefined";class u extends S{eq(n){return this.eqValue(n)}static fromBigInt(n,h){return new u({decimal:h,value:X({value:n,bigIntDecimal:h,decimal:h})})}}export{bh as wrapWithThrow,th as wrapMethodWithNetworkSwitch,on as warnOnce,Uh as validateTNS,cn as validateIdentifier,oh as switchEVMWalletNetwork,ct as setRequestClientConfig,Wt as prepareNetworkSwitch,ch as okxMobileEnabled,xh as listWeb3EVMWallets,dt as isWeb3Detected,m as isGasAsset,Kt as isDetected,It as getWalletFormatFor,Mh as getTHORNameCost,ut as getSymmetricWithdraw,an as getSymmetricPoolShare,ot as getMinAmountByChain,rn as getMemoForWithdraw,Un as getMemoForUnbond,mn as getMemoForSaverWithdraw,En as getMemoForSaverDeposit,yt as getMemoForRunePoolWithdraw,zt as getMemoForRunePoolDeposit,en as getMemoForNameRegister,Zt as getMemoForNamePreferredAssetRegister,ln as getMemoForLoan,dn as getMemoForLeaveAndBond,vn as getMemoForDeposit,ft as getMemoFor,Vh as getMAYANameCost,jt as getLiquiditySlippage,Ct as getGasAsset,St as getEstimatedPoolShare,bt as getETHDefaultWallet,at as getEIP6963Wallets,$t as getDerivationPathFor,Fn as getDecimal,Cn as getCommonAssetInfo,Kh as getChainIdentifier,gt as getAsymmetricRuneWithdrawAmount,Kn as getAsymmetricRuneShare,Pt as getAsymmetricAssetWithdrawAmount,Dn as getAsymmetricAssetShare,Nn as getAssetType,X as formatBigIntToSafeValue,Bt as findAssetBy,At as filterAssets,Dt as ensureEVMApiKeys,Ot as derivationPathToString,Zn as defaultRequestHeaders,Nt as assetFromString,Mt as addEVMWalletNetwork,Vt as addAccountsChangedCallback,un as WarningCodeEnum,nn as WalletOption,Nh as UTXOChains,Bh as TCSupportedChains,u as SwapKitNumber,I as SwapKitError,Ch as SubstrateChains,_h as SWAP_OUT,Lh as SWAP_IN,D as RequestClient,a as RPCUrl,$n as QuoteMode,Sn as ProviderName,i as NetworkDerivationPath,hn as MemoType,Th as MAYASupportedChains,_n as LedgerErrorCode,jn as FeeTypeEnum,Gn as FeeOption,d as ExplorerUrl,Pn as ErrorCode,Q as EVMChains,Ln as DerivationPath,Ah as CosmosChains,In as ContractAddress,Rn as CommonAssetStrings,U as ChainToRPC,kh as ChainToHexChainId,Oh as ChainToExplorerUrl,l as ChainToChainId,Fh as ChainIdToChain,q as ChainId,G as Chain,S as BigIntArithmetics,B as BaseDecimal,O as AssetValue,gn as ApproveMode,Ih as AGG_SWAP}; | ||
//# debugId=C55BBF00179D322464756E2164756E21 | ||
//# debugId=7BCCE44FE6AAA7A764756E2164756E21 |
@@ -10,8 +10,8 @@ { | ||
"devDependencies": { | ||
"@swapkit/toolbox-cosmos": "1.0.23", | ||
"@swapkit/toolbox-evm": "1.2.4", | ||
"@swapkit/toolbox-solana": "1.0.21", | ||
"@swapkit/toolbox-radix": "1.0.21", | ||
"@swapkit/toolbox-substrate": "1.1.16", | ||
"@swapkit/toolbox-utxo": "1.1.4" | ||
"@swapkit/toolbox-cosmos": "1.1.0", | ||
"@swapkit/toolbox-evm": "1.3.0", | ||
"@swapkit/toolbox-solana": "1.0.22", | ||
"@swapkit/toolbox-radix": "1.0.22", | ||
"@swapkit/toolbox-substrate": "1.2.0", | ||
"@swapkit/toolbox-utxo": "1.1.5" | ||
}, | ||
@@ -41,3 +41,3 @@ "files": [ | ||
"types": "./src/index.ts", | ||
"version": "1.5.1" | ||
"version": "1.6.0" | ||
} |
@@ -10,2 +10,6 @@ import { describe, expect, test } from "bun:test"; | ||
[Chain.BinanceSmartChain]: "BNB", | ||
[Chain.Maya]: "CACAO", | ||
[Chain.Optimism]: "ETH", | ||
[Chain.Arbitrum]: "ETH", | ||
[Chain.Base]: "ETH", | ||
}; | ||
@@ -22,3 +26,3 @@ | ||
describe("when isSynth is false", () => { | ||
describe("for native chains and their assets", () => { | ||
describe("for gas assets on given chain", () => { | ||
for (const chain of Object.values(Chain)) { | ||
@@ -34,36 +38,11 @@ test(`should return "Native" for chain ${chain} asset`, () => { | ||
describe("for Cosmos chain", () => { | ||
test('should return "GAIA" for non-ATOM tickers', () => { | ||
const result = getAssetType({ chain: Chain.Cosmos, symbol: "NOT_ATOM" }); | ||
expect(result).toBe("GAIA"); | ||
}); | ||
}); | ||
describe("for non-gas assets on given chain", () => { | ||
for (const chain of Object.values(Chain)) { | ||
test(`should return ${chain} for chain ${chain} asset`, () => { | ||
const result = getAssetType({ chain: chain as Chain, symbol: "USDT" }); | ||
describe("for Binance Smart Chain", () => { | ||
test('should return "BEP20" for non-BNB tickers', () => { | ||
const result = getAssetType({ chain: Chain.BinanceSmartChain, symbol: "NOT_BNB" }); | ||
expect(result).toBe("BEP20"); | ||
}); | ||
expect(result).toBe(chain); | ||
}); | ||
} | ||
}); | ||
describe("for Ethereum chain", () => { | ||
test('should return "ERC20" for non-ETH tickers', () => { | ||
const result = getAssetType({ chain: Chain.Ethereum, symbol: "NOT_ETH" }); | ||
expect(result).toBe("ERC20"); | ||
}); | ||
}); | ||
describe("for Avalanche chain", () => { | ||
test('should return "AVAX" for non-AVAX tickers', () => { | ||
const result = getAssetType({ chain: Chain.Avalanche, symbol: "NOT_AVAX" }); | ||
expect(result).toBe("AVAX"); | ||
}); | ||
}); | ||
describe("for Radix chain", () => { | ||
test('should return "RADIX" for non-XRD tickers', () => { | ||
const result = getAssetType({ chain: Chain.Radix, symbol: "NOT_XRD" }); | ||
expect(result).toBe("RADIX"); | ||
}); | ||
}); | ||
}); | ||
@@ -70,0 +49,0 @@ }); |
@@ -120,2 +120,3 @@ import { AssetValue } from "../modules/assetValue.ts"; | ||
case Chain.Arbitrum: | ||
case Chain.Base: | ||
case Chain.Optimism: | ||
@@ -140,2 +141,3 @@ return AssetValue.from({ asset: `${chain}.ETH` }); | ||
case Chain.Arbitrum: | ||
case Chain.Base: | ||
case Chain.Optimism: | ||
@@ -162,2 +164,3 @@ return symbol === "ETH"; | ||
case Chain.Arbitrum: | ||
case Chain.Base: | ||
case Chain.Optimism: | ||
@@ -191,3 +194,2 @@ return { identifier: `${assetString}.ETH`, decimal: BaseDecimal[assetString] }; | ||
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: TODO: Refactor | ||
export const getAssetType = ({ chain, symbol }: { chain: Chain; symbol: string }) => { | ||
@@ -197,23 +199,18 @@ if (symbol.includes("/")) return "Synth"; | ||
switch (chain) { | ||
case Chain.Cosmos: | ||
return symbol === "ATOM" ? "Native" : Chain.Cosmos; | ||
case Chain.Kujira: | ||
return symbol === Chain.Kujira ? "Native" : Chain.Kujira; | ||
case Chain.BinanceSmartChain: | ||
return symbol === "BNB" ? "Native" : "BEP20"; | ||
case Chain.Ethereum: | ||
return symbol === Chain.Ethereum ? "Native" : "ERC20"; | ||
case Chain.Avalanche: | ||
return symbol === Chain.Avalanche ? "Native" : Chain.Avalanche; | ||
case Chain.Polygon: | ||
return symbol === Chain.Polygon ? "Native" : "POLYGON"; | ||
case Chain.Arbitrum: | ||
return [Chain.Ethereum, Chain.Arbitrum].includes(symbol as Chain) ? "Native" : "ARBITRUM"; | ||
case Chain.Optimism: | ||
return [Chain.Ethereum, Chain.Optimism].includes(symbol as Chain) ? "Native" : "OPTIMISM"; | ||
case Chain.Radix: | ||
return symbol === Chain.Radix ? "Native" : "RADIX"; | ||
case Chain.Base: | ||
return symbol === Chain.Ethereum ? "Native" : chain; | ||
case Chain.Cosmos: | ||
return symbol === "ATOM" ? "Native" : chain; | ||
case Chain.BinanceSmartChain: | ||
return symbol === "BNB" ? "Native" : chain; | ||
case Chain.Maya: | ||
return symbol === "CACAO" ? "Native" : chain; | ||
case Chain.THORChain: | ||
return symbol === "RUNE" ? "Native" : chain; | ||
default: | ||
return "Native"; | ||
return symbol === chain ? "Native" : chain; | ||
} | ||
@@ -220,0 +217,0 @@ }; |
@@ -6,2 +6,3 @@ import { ExplorerUrl, RPCUrl } from "./network"; | ||
Avalanche = "AVAX", | ||
Base = "BASE", | ||
BinanceSmartChain = "BSC", | ||
@@ -33,2 +34,4 @@ Bitcoin = "BTC", | ||
AvalancheHex = "0xa86a", | ||
Base = "8453", | ||
BaseHex = "0x2105", | ||
BinanceSmartChain = "56", | ||
@@ -64,2 +67,4 @@ BinanceSmartChainHex = "0x38", | ||
[ChainId.Avalanche]: Chain.Avalanche, | ||
[ChainId.BaseHex]: Chain.Base, | ||
[ChainId.Base]: Chain.Base, | ||
[ChainId.BinanceSmartChainHex]: Chain.BinanceSmartChain, | ||
@@ -94,24 +99,24 @@ [ChainId.BinanceSmartChain]: Chain.BinanceSmartChain, | ||
export enum BaseDecimal { | ||
ARB = 18, | ||
AVAX = 18, | ||
BCH = 8, | ||
BSC = 18, | ||
BTC = 8, | ||
DASH = 8, | ||
DOGE = 8, | ||
DOT = 10, | ||
ETH = 18, | ||
FLIP = 18, | ||
GAIA = 6, | ||
KUJI = 6, | ||
LTC = 8, | ||
MATIC = 18, | ||
MAYA = 8, | ||
OP = 18, | ||
SOL = 9, | ||
THOR = 8, | ||
XRD = 18, | ||
ZEC = 8, | ||
} | ||
export const BaseDecimal: Record<Chain, number> = { | ||
ARB: 18, | ||
AVAX: 18, | ||
BASE: 18, | ||
BCH: 8, | ||
BSC: 18, | ||
BTC: 8, | ||
DASH: 8, | ||
DOGE: 8, | ||
DOT: 10, | ||
ETH: 18, | ||
FLIP: 18, | ||
GAIA: 6, | ||
KUJI: 6, | ||
LTC: 8, | ||
MATIC: 18, | ||
MAYA: 8, | ||
OP: 18, | ||
SOL: 9, | ||
THOR: 8, | ||
XRD: 18, | ||
}; | ||
@@ -122,13 +127,15 @@ export type SubstrateChain = Chain.Polkadot | Chain.Chainflip; | ||
export type EVMChain = | ||
| Chain.Ethereum | ||
| Chain.Arbitrum | ||
| Chain.Avalanche | ||
| Chain.Base | ||
| Chain.BinanceSmartChain | ||
| Chain.Arbitrum | ||
| Chain.Ethereum | ||
| Chain.Optimism | ||
| Chain.Polygon; | ||
export const EVMChains = [ | ||
Chain.Ethereum, | ||
Chain.Arbitrum, | ||
Chain.Avalanche, | ||
Chain.Base, | ||
Chain.BinanceSmartChain, | ||
Chain.Arbitrum, | ||
Chain.Ethereum, | ||
Chain.Optimism, | ||
@@ -135,0 +142,0 @@ Chain.Polygon, |
@@ -6,2 +6,3 @@ import type { Chain } from "./chains"; | ||
AVAX = "0x0000000000000000000000000000000000000000", | ||
BASE = "0x0000000000000000000000000000000000000000", | ||
ETH = "0x0000000000000000000000000000000000000000", | ||
@@ -16,2 +17,3 @@ BSC = "0x0000000000000000000000000000000000000000", | ||
AVAX = "m/44'/60'/0'/0", | ||
BASE = "m/44'/60'/0'/0", | ||
BCH = "m/44'/145'/0'/0", | ||
@@ -41,2 +43,3 @@ BSC = "m/44'/60'/0'/0", | ||
AVAX: [44, 60, 0, 0, 0], | ||
BASE: [44, 60, 0, 0, 0], | ||
BCH: [44, 145, 0, 0, 0], | ||
@@ -43,0 +46,0 @@ BSC: [44, 60, 0, 0, 0], |
export enum RPCUrl { | ||
Arbitrum = "https://arb1.arbitrum.io/rpc", | ||
Avalanche = "https://node-router.thorswap.net/avalanche-c", | ||
Base = "https://base.llamarpc.com", | ||
BinanceSmartChain = "https://bsc-dataseed.binance.org", | ||
@@ -28,2 +29,3 @@ Bitcoin = "https://node-router.thorswap.net/bitcoin", | ||
Avalanche = "https://snowtrace.io", | ||
Base = "https://basescan.org", | ||
BinanceSmartChain = "https://bscscan.com", | ||
@@ -30,0 +32,0 @@ Bitcoin = "https://blockchair.com/bitcoin", |
@@ -8,2 +8,3 @@ import type { CovalentApiType, EthplorerApiType } from "@swapkit/toolbox-evm"; | ||
type CovalentChains = | ||
| Chain.Base | ||
| Chain.BinanceSmartChain | ||
@@ -10,0 +11,0 @@ | Chain.Polygon |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
315674
4224