Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@swapkit/helpers

Package Overview
Dependencies
Maintainers
0
Versions
221
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@swapkit/helpers - npm Package Compare versions

Comparing version 1.9.0 to 1.10.0

6

dist/index.js

@@ -1,6 +0,6 @@

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 M;((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"})(M||={});var d;((F)=>{F.Arbitrum="https://arbiscan.io";F.Avalanche="https://snowtrace.io";F.Base="https://basescan.org";F.BinanceSmartChain="https://bscscan.com";F.Bitcoin="https://blockchair.com/bitcoin";F.BitcoinCash="https://www.blockchair.com/bitcoin-cash";F.Chainflip="https://explorer.polkascan.io/polkadot";F.Cosmos="https://www.mintscan.io/cosmos";F.Dash="https://blockchair.com/dash";F.Dogecoin="https://blockchair.com/dogecoin";F.Ethereum="https://etherscan.io";F.Kujira="https://finder.kujira.network/kaiyo-1";F.Litecoin="https://blockchair.com/litecoin";F.Maya="https://www.mayascan.org";F.Optimism="https://optimistic.etherscan.io";F.Polkadot="https://polkadot.subscan.io";F.Polygon="https://polygonscan.com";F.Radix="https://dashboard.radixdlt.com";F.THORChain="https://runescan.io";F.Solana="https://solscan.io"})(d||={});var g;((F)=>{F.Arbitrum="ARB";F.Avalanche="AVAX";F.Base="BASE";F.BinanceSmartChain="BSC";F.Bitcoin="BTC";F.BitcoinCash="BCH";F.Cosmos="GAIA";F.Dash="DASH";F.Dogecoin="DOGE";F.Ethereum="ETH";F.Kujira="KUJI";F.Litecoin="LTC";F.Maya="MAYA";F.Optimism="OP";F.Polkadot="DOT";F.Chainflip="FLIP";F.Polygon="MATIC";F.Radix="XRD";F.THORChain="THOR";F.Solana="SOL"})(g||={});var z;((B)=>{B.Arbitrum="42161";B.ArbitrumHex="0xa4b1";B.Avalanche="43114";B.AvalancheHex="0xa86a";B.Base="8453";B.BaseHex="0x2105";B.BinanceSmartChain="56";B.BinanceSmartChainHex="0x38";B.Bitcoin="bitcoin";B.BitcoinCash="bitcoincash";B.Chainflip="chainflip";B.Cosmos="cosmoshub-4";B.Dash="dash";B.Dogecoin="dogecoin";B.Kujira="kaiyo-1";B.Ethereum="1";B.EthereumHex="0x1";B.Litecoin="litecoin";B.Maya="mayachain-mainnet-v1";B.MayaStagenet="mayachain-stagenet-v1";B.Optimism="10";B.OptimismHex="0xa";B.Polkadot="polkadot";B.Polygon="137";B.PolygonHex="0x89";B.Radix="radix-mainnet";B.THORChain="thorchain-1";B.THORChainStagenet="thorchain-stagenet-v2";B.Solana="solana"})(z||={});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-1"]:"THOR",["solana"]:"SOL"},On=Object.keys(g),Z=Object.values(g),N={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},Rh=["DOT","FLIP"],V=["ARB","AVAX","BASE","BSC","ETH","OP","MATIC"],Ah=["BTC","BCH","DASH","DOGE","LTC"],Ch=["GAIA","THOR","MAYA","KUJI"],Bh=["AVAX","BSC","BTC","BCH","GAIA","DOGE","ETH","LTC","THOR"],Nh=["ARB","DASH","ETH","KUJI","MAYA","THOR"],b=Z.reduce((n,h)=>{const t=On.find((o)=>g[o]===h);if(t)n[h]=t;return n},{}),nn=Z.reduce((n,h)=>{return n[h]=z[b[h]],n},{}),E=Z.reduce((n,h)=>{return n[h]=M[b[h]],n},{}),Th=Z.reduce((n,h)=>{const t=`${b[h]}Hex`;return n[h]=z[t],n},{}),kh=Z.reduce((n,h)=>{return n[h]=d[b[h]],n},{});var $n;((I)=>{I.TC_SUPPORTED_TO_TC_SUPPORTED="TC-TC";I.TC_SUPPORTED_TO_ETH="TC-ERC20";I.TC_SUPPORTED_TO_AVAX="TC-ARC20";I.TC_SUPPORTED_TO_BSC="TC-BEP20";I.ETH_TO_TC_SUPPORTED="ERC20-TC";I.ETH_TO_ETH="ERC20-ERC20";I.ETH_TO_AVAX="ERC20-ARC20";I.ETH_TO_BSC="ERC20-BEP20";I.AVAX_TO_TC_SUPPORTED="ARC20-TC";I.AVAX_TO_ETH="ARC20-ERC20";I.AVAX_TO_AVAX="ARC20-ARC20";I.AVAX_TO_BSC="ARC20-BEP20";I.BSC_TO_TC_SUPPORTED="BEP20-TC";I.BSC_TO_ETH="BEP20-ERC20";I.BSC_TO_AVAX="BEP20-ARC20";I.BSC_TO_BSC="BEP20-BEP20"})($n||={});var $h=["ERC20-ERC20","ARC20-ARC20","BEP20-BEP20"],Ih=["ERC20-TC","ERC20-ARC20","ERC20-BEP20","ARC20-TC","ARC20-ERC20","ARC20-BEP20","BEP20-TC","BEP20-ERC20","BEP20-ARC20"],Lh=["TC-TC","TC-ERC20","TC-ARC20","TC-BEP20"];var In;((R)=>{R.ARB="0x0000000000000000000000000000000000000000";R.AVAX="0x0000000000000000000000000000000000000000";R.BASE="0x0000000000000000000000000000000000000000";R.ETH="0x0000000000000000000000000000000000000000";R.BSC="0x0000000000000000000000000000000000000000";R.MATIC="0x0000000000000000000000000000000000001010";R.OP="0x4200000000000000000000000000000000000042"})(In||={});var Ln;((F)=>{F.ARB="m/44'/60'/0'/0";F.AVAX="m/44'/60'/0'/0";F.BASE="m/44'/60'/0'/0";F.BCH="m/44'/145'/0'/0";F.BSC="m/44'/60'/0'/0";F.BTC="m/84'/0'/0'/0";F.DASH="m/44'/5'/0'/0";F.DOGE="m/44'/3'/0'/0";F.DOT="////";F.ETH="m/44'/60'/0'/0";F.FLIP="////";F.GAIA="m/44'/118'/0'/0";F.KUJI="m/44'/118'/0'/0";F.LTC="m/84'/2'/0'/0";F.MATIC="m/44'/60'/0'/0";F.MAYA="m/44'/931'/0'/0";F.OP="m/44'/60'/0'/0";F.SOL="m/44'/501'/0'/0";F.THOR="m/44'/931'/0'/0";F.XRD="////"})(Ln||={});var v={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 hn;((O)=>{O.BRAVE="BRAVE";O.COINBASE_MOBILE="COINBASE_MOBILE";O.COINBASE_WEB="COINBASE_WEB";O.EIP6963="EIP6963";O.EXODUS="EXODUS";O.KEEPKEY="KEEPKEY";O.KEPLR="KEPLR";O.KEYSTORE="KEYSTORE";O.LEDGER="LEDGER";O.LEDGER_LIVE="LEDGER_LIVE";O.METAMASK="METAMASK";O.OKX="OKX";O.OKX_MOBILE="OKX_MOBILE";O.PHANTOM="PHANTOM";O.POLKADOT_JS="POLKADOT_JS";O.RADIX_WALLET="RADIX_WALLET";O.TREZOR="TREZOR";O.TALISMAN="TALISMAN";O.TRUSTWALLET_WEB="TRUSTWALLET_WEB";O.WALLETCONNECT="WALLETCONNECT";O.XDEFI="XDEFI"})(hn||={});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 tn;((C)=>{C.NAME_REGISTER="~";C.BOND="BOND";C.DEPOSIT="+";C.LEAVE="LEAVE";C.UNBOND="UNBOND";C.WITHDRAW="-";C.OPEN_LOAN="$+";C.CLOSE_LOAN="$-";C.RUNEPOOL_DEPOSIT="POOL+";C.RUNEPOOL_WITHDRAW="POOL-"})(tn||={});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 Sn;((t)=>{t.highSlippage="highSlippage";t.highPriceImpact="highPriceImpact"})(Sn||={});var jn;((_)=>{_.CHAINFLIP="CHAINFLIP";_.MAYACHAIN="MAYACHAIN";_.MAYACHAIN_STREAMING="MAYACHAIN_STREAMING";_.ONEINCH="ONEINCH";_.PANCAKESWAP="PANCAKESWAP";_.PANGOLIN_V1="PANGOLIN_V1";_.SUSHISWAP_V2="SUSHISWAP_V2";_.THORCHAIN="THORCHAIN";_.THORCHAIN_STREAMING="THORCHAIN_STREAMING";_.TRADERJOE_V2="TRADERJOE_V2";_.UNISWAP_V2="UNISWAP_V2";_.UNISWAP_V3="UNISWAP_V3";_.CAVIAR_V1="CAVIAR_V1"})(jn||={});var un;((H)=>{H.LIQUIDITY="liquidity";H.NETWORK="network";H.INBOUND="inbound";H.OUTBOUND="outbound";H.AFFILIATE="affiliate";H.TAX="tax"})(un||={});function fh({apiKey:n,...h}){m={...h,apiKey:n}}async function K(n,h){const{apiKey:t,...o}=m,{searchParams:x,json:s,body:H}=h,R={...Xn,...o.headers,...h.headers,...s?{"Content-Type":"application/json"}:{}},T=s?JSON.stringify(s):H,A=new URL(n);if(x)A.search=new URLSearchParams(x).toString();if(t)R["x-api-key"]=t;try{const G=await(await fetch(A.toString(),{...o,...h,body:T,headers:R})).json();if(h.responseHandler)return h.responseHandler(G);return G}catch(C){if(h.onError)return h.onError(C);console.error(C)}}var m={},Xn=typeof window!=="undefined"?{}:{referrer:"https://sk.thorswap.net",referer:"https://sk.thorswap.net"},y={get:async(n,h)=>K(n,{...h,method:"GET"}),post:async(n,h)=>K(n,{...h,method:"POST"}),extend:(n)=>{const h={...m,...n};return{get:async(t,o)=>K(t,{...h,...o,method:"GET"}),post:async(t,o)=>K(t,{...h,...o,method:"POST"}),extend:(t)=>y.extend({...h,...t})}}};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,wallet_radix_not_found:20801,wallet_radix_transaction_failed:20802,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,toolbox_radix_signer_not_defined:90301,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 L 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:L.ErrorCode[o],message:`${o}${t?"":`: ${JSON.stringify(n.info)}`}`}});Object.setPrototypeOf(this,L.prototype)}}function bh(n){if(n<0)throw new L({errorKey:"helpers_invalid_number_of_years",info:{numberOfYears:n}});return 10+n}function Kh(n){if(n<0)throw new L({errorKey:"helpers_invalid_number_of_years",info:{numberOfYears:n}});return Math.round((10+n*1.0512)*10000000000)/10000000000}function Dh(n,h){try{return n()}catch(t){if(h)throw new L(h,t);return console.error(t)}}function Uh(n){switch(n){case"THOR":return`${n}.RUNE`;case"GAIA":return`${n}.ATOM`;case"BSC":return`${n}`;default:return`${n}.${n}`}}function xn(n,h){if(!yn&&n){if(on.has(h))return;on.add(h),console.warn(h)}}async function ah(n="thorchain-1"){if(!["thorchain-stagenet-v2","thorchain-1","thorchain-mainnet-v1"].includes(n))return n;try{return(await y.get(`${n!=="thorchain-1"?"https://stagenet-rpc.ninerealms.com":"https://rpc.thorswap.net"}/status`)).result.node_info.network}catch(h){return n}}var yn=["production","test"].includes("development"),on=new Set;function sn(n=""){const h=n.toUpperCase(),[t]=h.split(".");if(cn.includes(t))return!0;const[o]=h.split("/");if(cn.includes(o))return!0;throw new L({errorKey:"helpers_invalid_identifier",info:{message:`Invalid identifier: ${n}. Expected format: <Chain>.<Ticker> or <Chain>.<Ticker>-<ContractAddress>`,identifier:n}})}function mh(n){if(n.length>30)return!1;const h=/^[a-zA-Z0-9+_-]+$/g;return!!n.match(h)}var cn=[...Object.values(g),"TERRA"];function J({value:n,bigIntDecimal:h=f,decimal:t=f}){if(t===0)return n.toString();const o=n<0n;let x=n.toString().substring(o?1:0);const s=t-(x.length-1);if(s>0)x="0".repeat(s)+x;const H=x.length-t;let R=x.slice(-t);if(Number.parseInt(R[h]||"0")>=5)R=`${R.substring(0,h-1)}${(Number.parseInt(R[h-1]||"0")+1).toString()}`;else R=R.substring(0,h);return`${o?"-":""}${x.slice(0,H)}.${R}`.replace(/\.?0*$/,"")}function D(n){const t=`${typeof n==="number"?Jn.format(n):i(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,f)}function i(n){return typeof n==="object"?"getValue"in n?n.getValue("string"):n.value:n}var f=8,X=(n)=>10n**BigInt(n),Y=(n)=>Math.log10(Number.parseFloat(n.toString()));class u{decimalMultiplier=10n**8n;bigIntValue=0n;decimal;static fromBigInt(n,h){return new u({decimal:h,value:J({value:n,bigIntDecimal:h,decimal:h})})}static shiftDecimals({value:n,from:h,to:t}){return u.fromBigInt(n.getBaseValue("bigint")*X(t)/X(h),t)}constructor(n){const h=i(n),t=typeof n==="object";this.decimal=t?n.decimal:void 0,this.decimalMultiplier=t&&"decimalMultiplier"in n?n.decimalMultiplier:X(Math.max(Hn(D(h)),this.decimal||0)),this.#x(h)}set(n){return new this.constructor({decimal:this.decimal,value:n,identifier:this.toString({includeSynthProtocol:!0})})}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||Y(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/X(this.decimal||N.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=i(n),o=D(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 H=Number.parseInt(x),R=`${H}`.slice(0,n);return`0.${R.padStart(x.length-`${H}`.length+R.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 s=Number.parseInt(x),H=`${s}`.slice(0,n);return`0.${H.padStart(x.length-`${s}`.length+H.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 s=10**(o*3);return`${(h/s).toFixed(n)}${x}`}toCurrency(n="$",{currencyPosition:h="start",decimal:t=2,decimalSeparator:o=".",thousandSeparator:x=","}={}){const s=this.getValue("number"),[H="",R=""]=s.toFixed(6).split("."),T=H.replace(/\B(?=(\d{3})+(?!\d))/g,x),A=H||R?H==="0"?`${Number.parseFloat(`0.${R}`)}`.replace(".",o):`${T}${Number.parseInt(R)?`${o}${R.slice(0,t)}`:""}`:"0.00";return`${h==="start"?n:""}${A}${h==="end"?n:""}`}formatBigIntToSafeValue(n,h){const t=h||this.decimal||f,o=Math.max(t,Y(this.decimalMultiplier)),x=n<0n,s=n.toString().substring(x?1:0),H=o-(s.length-1),R=H>0?"0".repeat(H)+s:s,T=R.length-o;let A=R.slice(-o);if(Number.parseInt(A[t]||"0")>=5)A=`${A.substring(0,t-1)}${(Number.parseInt(A[t-1]||"0")+1).toString()}`;else A=A.substring(0,t);return`${x?"-":""}${R.slice(0,T)}.${A}`.replace(/\.?0*$/,"")}#h(n,...h){const t=this.#t(this,...h),o=Math.max(t,Y(this.decimalMultiplier)),x=X(o),s=h.reduce((R,T)=>{const A=this.getBigIntValue(T,o);switch(n){case"add":return R+A;case"sub":return R-A;case"mul":return R*A/x;case"div":{if(A===0n)throw new RangeError("Division by zero");return R*x/A}default:return R}},this.bigIntValue*x/this.decimalMultiplier),H=J({bigIntDecimal:o,decimal:o,value:s});return new this.constructor({decimalMultiplier:X(o),decimal:this.decimal,value:H,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=D(n)||"0";this.bigIntValue=this.#o(h)}#t(...n){const h=n.map((t)=>{return typeof t==="object"?t.decimal||Y(t.decimalMultiplier):Hn(D(t))}).filter(Boolean);return Math.max(...h,f)}#o(n,h){const t=h?X(h):this.decimalMultiplier,o=Y(t),[x="",s=""]=n.split(".");return BigInt(`${x}${s.padEnd(o,"0")}`)}}var Jn=Intl.NumberFormat("fullwide",{useGrouping:!1,maximumFractionDigits:20});function ct(n){const h=$.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 wn(n,h=0){sn(n);const t=U.get(n.toUpperCase()),o=t?.decimal||await Rn(r(n));if(!t)U.set(n.toUpperCase(),{identifier:n,decimal:o});return new $({decimal:o,value:a(h,o),identifier:n})}function zn(n,h=0){const t=n.includes(".")?n.split(".")?.[0]?.toUpperCase():void 0,o=t?["MAYA","THOR"].includes(t):!1,[x,s]=o?n.split(".").slice(1).join().split("/"):n.split("/");if(!(x&&s))throw new L({errorKey:"helpers_invalid_asset_identifier",info:{identifier:n}});return new $({decimal:8,value:a(h,8),identifier:`${t||"THOR"}.${x}/${s}`})}function a(n,h){return typeof n==="bigint"?J({value:n,bigIntDecimal:h,decimal:h}):n}function r(n){const h=n.slice(0,14).includes("/"),t=n.split(".")?.[0]?.toUpperCase()==="THOR",o=n.split(".")?.[0]?.toUpperCase()==="MAYA",[x,s=""]=t||o?n.split(".").slice(1).join().split("/"):n.split("/");if(h&&!(x&&s))throw new L({errorKey:"helpers_invalid_asset_identifier",info:{identifier:n}});const H=n.includes(".")&&!h?n:`${o?"MAYA":"THOR"}.${s}`,[R,...T]=H.split("."),A=h?s:T.join("."),C=A.split("-"),G=C.length===1?C[0]:C.slice(0,-1).join("-"),S=C.length===1?void 0:C[C.length-1];return{address:S?.toLowerCase(),chain:R,isGasAsset:l({chain:R,symbol:A}),isSynthetic:h,ticker:G,symbol:(h?`${x}/`:"")+(S?`${G}-${S?.toLowerCase()??""}`:A)}}var U=new Map;class $ extends u{address;chain;isGasAsset=!1;isSynthetic=!1;symbol;tax;ticker;type;chainId;constructor({value:n,decimal:h,tax:t,chain:o,symbol:x,identifier:s}){super(typeof n==="object"?n:{decimal:h,value:n});const H=r(s||`${o}.${x}`);this.type=Cn(H),this.tax=t,this.chain=H.chain,this.ticker=H.ticker,this.symbol=H.symbol,this.address=H.address,this.isSynthetic=H.isSynthetic,this.isGasAsset=H.isGasAsset,this.chainId=nn[H.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 L({errorKey:"helpers_invalid_asset_url",info:{urlAsset:n}});const s=t==="THOR"&&x?`${t}.${o}/${x}`:n;return $.from({asset:s,value:h})}static from({value:n=0,fromBaseDecimal:h,asyncTokenLookup:t,...o}){const x=n instanceof u?n.getValue("string"):n,s="chain"in o,H=s?o.chain:o.asset,R=s||Fn.includes(H),{identifier:T,decimal:A}=R?An(H):{identifier:H,decimal:void 0},{chain:C,isSynthetic:G}=r(T),S=U.get(T.toUpperCase()),_=S?.decimal||A;xn(!(t||_),`Couldn't find static decimal for ${T} (Using default ${N[C]} 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 M;((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"})(M||={});var d;((F)=>{F.Arbitrum="https://arbiscan.io";F.Avalanche="https://snowtrace.io";F.Base="https://basescan.org";F.BinanceSmartChain="https://bscscan.com";F.Bitcoin="https://blockchair.com/bitcoin";F.BitcoinCash="https://www.blockchair.com/bitcoin-cash";F.Chainflip="https://explorer.polkascan.io/polkadot";F.Cosmos="https://www.mintscan.io/cosmos";F.Dash="https://blockchair.com/dash";F.Dogecoin="https://blockchair.com/dogecoin";F.Ethereum="https://etherscan.io";F.Kujira="https://finder.kujira.network/kaiyo-1";F.Litecoin="https://blockchair.com/litecoin";F.Maya="https://www.mayascan.org";F.Optimism="https://optimistic.etherscan.io";F.Polkadot="https://polkadot.subscan.io";F.Polygon="https://polygonscan.com";F.Radix="https://dashboard.radixdlt.com";F.THORChain="https://runescan.io";F.Solana="https://solscan.io"})(d||={});var g;((F)=>{F.Arbitrum="ARB";F.Avalanche="AVAX";F.Base="BASE";F.BinanceSmartChain="BSC";F.Bitcoin="BTC";F.BitcoinCash="BCH";F.Cosmos="GAIA";F.Dash="DASH";F.Dogecoin="DOGE";F.Ethereum="ETH";F.Kujira="KUJI";F.Litecoin="LTC";F.Maya="MAYA";F.Optimism="OP";F.Polkadot="DOT";F.Chainflip="FLIP";F.Polygon="MATIC";F.Radix="XRD";F.THORChain="THOR";F.Solana="SOL"})(g||={});var z;((B)=>{B.Arbitrum="42161";B.ArbitrumHex="0xa4b1";B.Avalanche="43114";B.AvalancheHex="0xa86a";B.Base="8453";B.BaseHex="0x2105";B.BinanceSmartChain="56";B.BinanceSmartChainHex="0x38";B.Bitcoin="bitcoin";B.BitcoinCash="bitcoincash";B.Chainflip="chainflip";B.Cosmos="cosmoshub-4";B.Dash="dash";B.Dogecoin="dogecoin";B.Kujira="kaiyo-1";B.Ethereum="1";B.EthereumHex="0x1";B.Litecoin="litecoin";B.Maya="mayachain-mainnet-v1";B.MayaStagenet="mayachain-stagenet-v1";B.Optimism="10";B.OptimismHex="0xa";B.Polkadot="polkadot";B.Polygon="137";B.PolygonHex="0x89";B.Radix="radix-mainnet";B.THORChain="thorchain-1";B.THORChainStagenet="thorchain-stagenet-v2";B.Solana="solana"})(z||={});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-1"]:"THOR",["solana"]:"SOL"},On=Object.keys(g),Z=Object.values(g),N={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},Rh=["DOT","FLIP"],V=["ARB","AVAX","BASE","BSC","ETH","OP","MATIC"],Ah=["BTC","BCH","DASH","DOGE","LTC"],Ch=["GAIA","THOR","MAYA","KUJI"],Bh=["AVAX","BSC","BTC","BCH","GAIA","DOGE","ETH","LTC","THOR"],Nh=["ARB","DASH","ETH","KUJI","MAYA","THOR"],b=Z.reduce((n,h)=>{const t=On.find((o)=>g[o]===h);if(t)n[h]=t;return n},{}),nn=Z.reduce((n,h)=>{return n[h]=z[b[h]],n},{}),E=Z.reduce((n,h)=>{return n[h]=M[b[h]],n},{}),Th=Z.reduce((n,h)=>{const t=`${b[h]}Hex`;return n[h]=z[t],n},{}),kh=Z.reduce((n,h)=>{return n[h]=d[b[h]],n},{});var $n;((I)=>{I.TC_SUPPORTED_TO_TC_SUPPORTED="TC-TC";I.TC_SUPPORTED_TO_ETH="TC-ERC20";I.TC_SUPPORTED_TO_AVAX="TC-ARC20";I.TC_SUPPORTED_TO_BSC="TC-BEP20";I.ETH_TO_TC_SUPPORTED="ERC20-TC";I.ETH_TO_ETH="ERC20-ERC20";I.ETH_TO_AVAX="ERC20-ARC20";I.ETH_TO_BSC="ERC20-BEP20";I.AVAX_TO_TC_SUPPORTED="ARC20-TC";I.AVAX_TO_ETH="ARC20-ERC20";I.AVAX_TO_AVAX="ARC20-ARC20";I.AVAX_TO_BSC="ARC20-BEP20";I.BSC_TO_TC_SUPPORTED="BEP20-TC";I.BSC_TO_ETH="BEP20-ERC20";I.BSC_TO_AVAX="BEP20-ARC20";I.BSC_TO_BSC="BEP20-BEP20"})($n||={});var $h=["ERC20-ERC20","ARC20-ARC20","BEP20-BEP20"],Ih=["ERC20-TC","ERC20-ARC20","ERC20-BEP20","ARC20-TC","ARC20-ERC20","ARC20-BEP20","BEP20-TC","BEP20-ERC20","BEP20-ARC20"],Lh=["TC-TC","TC-ERC20","TC-ARC20","TC-BEP20"];var In;((R)=>{R.ARB="0x0000000000000000000000000000000000000000";R.AVAX="0x0000000000000000000000000000000000000000";R.BASE="0x0000000000000000000000000000000000000000";R.ETH="0x0000000000000000000000000000000000000000";R.BSC="0x0000000000000000000000000000000000000000";R.MATIC="0x0000000000000000000000000000000000001010";R.OP="0x4200000000000000000000000000000000000042"})(In||={});var Ln;((F)=>{F.ARB="m/44'/60'/0'/0";F.AVAX="m/44'/60'/0'/0";F.BASE="m/44'/60'/0'/0";F.BCH="m/44'/145'/0'/0";F.BSC="m/44'/60'/0'/0";F.BTC="m/84'/0'/0'/0";F.DASH="m/44'/5'/0'/0";F.DOGE="m/44'/3'/0'/0";F.DOT="////";F.ETH="m/44'/60'/0'/0";F.FLIP="////";F.GAIA="m/44'/118'/0'/0";F.KUJI="m/44'/118'/0'/0";F.LTC="m/84'/2'/0'/0";F.MATIC="m/44'/60'/0'/0";F.MAYA="m/44'/931'/0'/0";F.OP="m/44'/60'/0'/0";F.SOL="m/44'/501'/0'/0";F.THOR="m/44'/931'/0'/0";F.XRD="////"})(Ln||={});var v={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 hn;((O)=>{O.BRAVE="BRAVE";O.COINBASE_MOBILE="COINBASE_MOBILE";O.COINBASE_WEB="COINBASE_WEB";O.EIP6963="EIP6963";O.EXODUS="EXODUS";O.KEEPKEY="KEEPKEY";O.KEPLR="KEPLR";O.KEYSTORE="KEYSTORE";O.LEDGER="LEDGER";O.LEDGER_LIVE="LEDGER_LIVE";O.METAMASK="METAMASK";O.OKX="OKX";O.OKX_MOBILE="OKX_MOBILE";O.PHANTOM="PHANTOM";O.POLKADOT_JS="POLKADOT_JS";O.RADIX_WALLET="RADIX_WALLET";O.TREZOR="TREZOR";O.TALISMAN="TALISMAN";O.TRUSTWALLET_WEB="TRUSTWALLET_WEB";O.WALLETCONNECT="WALLETCONNECT";O.XDEFI="XDEFI"})(hn||={});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 tn;((C)=>{C.NAME_REGISTER="~";C.BOND="BOND";C.DEPOSIT="+";C.LEAVE="LEAVE";C.UNBOND="UNBOND";C.WITHDRAW="-";C.OPEN_LOAN="$+";C.CLOSE_LOAN="$-";C.RUNEPOOL_DEPOSIT="POOL+";C.RUNEPOOL_WITHDRAW="POOL-"})(tn||={});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 Sn;((t)=>{t.highSlippage="highSlippage";t.highPriceImpact="highPriceImpact"})(Sn||={});var jn;((_)=>{_.CHAINFLIP="CHAINFLIP";_.MAYACHAIN="MAYACHAIN";_.MAYACHAIN_STREAMING="MAYACHAIN_STREAMING";_.ONEINCH="ONEINCH";_.PANCAKESWAP="PANCAKESWAP";_.PANGOLIN_V1="PANGOLIN_V1";_.SUSHISWAP_V2="SUSHISWAP_V2";_.THORCHAIN="THORCHAIN";_.THORCHAIN_STREAMING="THORCHAIN_STREAMING";_.TRADERJOE_V2="TRADERJOE_V2";_.UNISWAP_V2="UNISWAP_V2";_.UNISWAP_V3="UNISWAP_V3";_.CAVIAR_V1="CAVIAR_V1"})(jn||={});var pn;((H)=>{H.LIQUIDITY="liquidity";H.NETWORK="network";H.INBOUND="inbound";H.OUTBOUND="outbound";H.AFFILIATE="affiliate";H.TAX="tax"})(pn||={});function fh({apiKey:n,...h}){i={...h,apiKey:n}}async function K(n,h){const{apiKey:t,...o}=i,{searchParams:x,json:s,body:H}=h,R={...un,...o.headers,...h.headers,...s?{"Content-Type":"application/json"}:{}},T=s?JSON.stringify(s):H,A=new URL(n);if(x)A.search=new URLSearchParams(x).toString();if(t)R["x-api-key"]=t;try{const G=await(await fetch(A.toString(),{...o,...h,body:T,headers:R})).json();if(h.responseHandler)return h.responseHandler(G);return G}catch(C){if(h.onError)return h.onError(C);console.error(C)}}var i={},un=typeof window!=="undefined"?{}:{referrer:"https://sk.thorswap.net",referer:"https://sk.thorswap.net"},y={get:async(n,h)=>K(n,{...h,method:"GET"}),post:async(n,h)=>K(n,{...h,method:"POST"}),extend:(n)=>{const h={...i,...n};return{get:async(t,o)=>K(t,{...h,...o,method:"GET"}),post:async(t,o)=>K(t,{...h,...o,method:"POST"}),extend:(t)=>y.extend({...h,...t})}}};var Xn={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,wallet_radix_not_found:20801,wallet_radix_transaction_failed:20802,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,toolbox_radix_signer_not_defined:90301,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 L extends Error{static ErrorCode=Xn;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:L.ErrorCode[o],message:`${o}${t?"":`: ${JSON.stringify(n.info)}`}`}});Object.setPrototypeOf(this,L.prototype)}}function bh(n){if(n<0)throw new L({errorKey:"helpers_invalid_number_of_years",info:{numberOfYears:n}});return 10+n}function Kh(n){if(n<0)throw new L({errorKey:"helpers_invalid_number_of_years",info:{numberOfYears:n}});return Math.round((10+n*1.0512)*10000000000)/10000000000}function Dh(n,h){try{return n()}catch(t){if(h)throw new L(h,t);return console.error(t)}}function Uh(n){switch(n){case"THOR":return`${n}.RUNE`;case"GAIA":return`${n}.ATOM`;case"BSC":return`${n}`;default:return`${n}.${n}`}}function xn(n,h){if(!yn&&n){if(on.has(h))return;on.add(h),console.warn(h)}}async function ah(n="thorchain-1"){if(!["thorchain-stagenet-v2","thorchain-1","thorchain-mainnet-v1"].includes(n))return n;try{return(await y.get(`${n!=="thorchain-1"?"https://stagenet-rpc.ninerealms.com":"https://rpc.thorswap.net"}/status`)).result.node_info.network}catch(h){return n}}var yn=["production","test"].includes("development"),on=new Set;function sn(n=""){const h=n.toUpperCase(),[t]=h.split(".");if(cn.includes(t))return!0;const[o]=h.split("/");if(cn.includes(o))return!0;throw new L({errorKey:"helpers_invalid_identifier",info:{message:`Invalid identifier: ${n}. Expected format: <Chain>.<Ticker> or <Chain>.<Ticker>-<ContractAddress>`,identifier:n}})}function ih(n){if(n.length>30)return!1;const h=/^[a-zA-Z0-9+_-]+$/g;return!!n.match(h)}var cn=[...Object.values(g),"TERRA"];function J({value:n,bigIntDecimal:h=f,decimal:t=f}){if(t===0)return n.toString();const o=n<0n;let x=n.toString().substring(o?1:0);const s=t-(x.length-1);if(s>0)x="0".repeat(s)+x;const H=x.length-t;let R=x.slice(-t);if(Number.parseInt(R[h]||"0")>=5)R=`${R.substring(0,h-1)}${(Number.parseInt(R[h-1]||"0")+1).toString()}`;else R=R.substring(0,h);return`${o?"-":""}${x.slice(0,H)}.${R}`.replace(/\.?0*$/,"")}function D(n){const t=`${typeof n==="number"?Jn.format(n):m(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,f)}function m(n){return typeof n==="object"?"getValue"in n?n.getValue("string"):n.value:n}var f=8,u=(n)=>10n**BigInt(n),Y=(n)=>Math.log10(Number.parseFloat(n.toString()));class p{decimalMultiplier=10n**8n;bigIntValue=0n;decimal;static fromBigInt(n,h){return new p({decimal:h,value:J({value:n,bigIntDecimal:h,decimal:h})})}static shiftDecimals({value:n,from:h,to:t}){return p.fromBigInt(n.getBaseValue("bigint")*u(t)/u(h),t)}constructor(n){const h=m(n),t=typeof n==="object";this.decimal=t?n.decimal:void 0,this.decimalMultiplier=t&&"decimalMultiplier"in n?n.decimalMultiplier:u(Math.max(Hn(D(h)),this.decimal||0)),this.#x(h)}set(n){return new this.constructor({decimal:this.decimal,value:n,identifier:this.toString({includeSynthProtocol:!0})})}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||Y(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/u(this.decimal||N.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=m(n),o=D(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 H=Number.parseInt(x),R=`${H}`.slice(0,n);return`0.${R.padStart(x.length-`${H}`.length+R.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 s=Number.parseInt(x),H=`${s}`.slice(0,n);return`0.${H.padStart(x.length-`${s}`.length+H.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 s=10**(o*3);return`${(h/s).toFixed(n)}${x}`}toCurrency(n="$",{currencyPosition:h="start",decimal:t=2,decimalSeparator:o=".",thousandSeparator:x=","}={}){const s=this.getValue("number"),[H="",R=""]=s.toFixed(6).split("."),T=H.replace(/\B(?=(\d{3})+(?!\d))/g,x),A=H||R?H==="0"?`${Number.parseFloat(`0.${R}`)}`.replace(".",o):`${T}${Number.parseInt(R)?`${o}${R.slice(0,t)}`:""}`:"0.00";return`${h==="start"?n:""}${A}${h==="end"?n:""}`}formatBigIntToSafeValue(n,h){const t=h||this.decimal||f,o=Math.max(t,Y(this.decimalMultiplier)),x=n<0n,s=n.toString().substring(x?1:0),H=o-(s.length-1),R=H>0?"0".repeat(H)+s:s,T=R.length-o;let A=R.slice(-o);if(Number.parseInt(A[t]||"0")>=5)A=`${A.substring(0,t-1)}${(Number.parseInt(A[t-1]||"0")+1).toString()}`;else A=A.substring(0,t);return`${x?"-":""}${R.slice(0,T)}.${A}`.replace(/\.?0*$/,"")}#h(n,...h){const t=this.#t(this,...h),o=Math.max(t,Y(this.decimalMultiplier)),x=u(o),s=h.reduce((R,T)=>{const A=this.getBigIntValue(T,o);switch(n){case"add":return R+A;case"sub":return R-A;case"mul":return R*A/x;case"div":{if(A===0n)throw new RangeError("Division by zero");return R*x/A}default:return R}},this.bigIntValue*x/this.decimalMultiplier),H=J({bigIntDecimal:o,decimal:o,value:s});return new this.constructor({decimalMultiplier:u(o),decimal:this.decimal,value:H,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=D(n)||"0";this.bigIntValue=this.#o(h)}#t(...n){const h=n.map((t)=>{return typeof t==="object"?t.decimal||Y(t.decimalMultiplier):Hn(D(t))}).filter(Boolean);return Math.max(...h,f)}#o(n,h){const t=h?u(h):this.decimalMultiplier,o=Y(t),[x="",s=""]=n.split(".");return BigInt(`${x}${s.padEnd(o,"0")}`)}}var Jn=Intl.NumberFormat("fullwide",{useGrouping:!1,maximumFractionDigits:20});function ct(n){const h=$.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 wn(n,h=0){sn(n);const t=U.get(n.toUpperCase()),o=t?.decimal||await Rn(r(n));if(!t)U.set(n.toUpperCase(),{identifier:n,decimal:o});return new $({decimal:o,value:a(h,o),identifier:n})}function zn(n,h=0){const t=n.includes(".")?n.split(".")?.[0]?.toUpperCase():void 0,o=t?["MAYA","THOR"].includes(t):!1,[x,s]=o?n.split(".").slice(1).join().split("/"):n.split("/");if(!(x&&s))throw new L({errorKey:"helpers_invalid_asset_identifier",info:{identifier:n}});return new $({decimal:8,value:a(h,8),identifier:`${t||"THOR"}.${x}/${s}`})}function a(n,h){return typeof n==="bigint"?J({value:n,bigIntDecimal:h,decimal:h}):n}function r(n){const h=n.slice(0,14).includes("/"),t=n.split(".")?.[0]?.toUpperCase()==="THOR",o=n.split(".")?.[0]?.toUpperCase()==="MAYA",[x,s=""]=t||o?n.split(".").slice(1).join().split("/"):n.split("/");if(h&&!(x&&s))throw new L({errorKey:"helpers_invalid_asset_identifier",info:{identifier:n}});const H=n.includes(".")&&!h?n:`${o?"MAYA":"THOR"}.${s}`,[R,...T]=H.split("."),A=h?s:T.join("."),C=A.split("-"),G=C.length===1?C[0]:C.slice(0,-1).join("-"),S=C.length===1?void 0:C[C.length-1];return{address:S?.toLowerCase(),chain:R,isGasAsset:l({chain:R,symbol:A}),isSynthetic:h,ticker:G,symbol:(h?`${x}/`:"")+(S?`${G}-${S?.toLowerCase()??""}`:A)}}var U=new Map;class $ extends p{address;chain;isGasAsset=!1;isSynthetic=!1;symbol;tax;ticker;type;chainId;constructor({value:n,decimal:h,tax:t,chain:o,symbol:x,identifier:s}){super(typeof n==="object"?n:{decimal:h,value:n});const H=r(s||`${o}.${x}`);this.type=Cn(H),this.tax=t,this.chain=H.chain,this.ticker=H.ticker,this.symbol=H.symbol,this.address=H.address,this.isSynthetic=H.isSynthetic,this.isGasAsset=H.isGasAsset,this.chainId=nn[H.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 L({errorKey:"helpers_invalid_asset_url",info:{urlAsset:n}});const s=t==="THOR"&&x?`${t}.${o}/${x}`:n;return $.from({asset:s,value:h})}static from({value:n=0,fromBaseDecimal:h,asyncTokenLookup:t,...o}){const x=n instanceof p?n.getValue("string"):n,s="chain"in o,H=s?o.chain:o.asset,R=s||Fn.includes(H),{identifier:T,decimal:A}=R?An(H):{identifier:H,decimal:void 0},{chain:C,isSynthetic:G}=r(T),S=U.get(T.toUpperCase()),_=S?.decimal||A;xn(!(t||_),`Couldn't find static decimal for ${T} (Using default ${N[C]} 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:Q,identifier:w,tax:I}=S||{decimal:_||N[C],identifier:T},p=h?a(BigInt(x),h):a(x,Q);return t?wn(w,h?p:x):G?zn(w,p):new $({tax:I,decimal:Q,identifier:w,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:s,...H}of o.tokens)U.set(x.toUpperCase(),{identifier:x,decimal:"decimals"in H?H.decimals:N[s]});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 $.from({asset:n,value:h,asyncTokenLookup:!0})}static fromIdentifier(n,h=0){return $.from({asset:n,value:h,asyncTokenLookup:!0})}static fromStringSync(n,h=0){return $.from({asset:n,value:h})}static fromStringWithBase(n,h=0n,t=N.THOR){return $.from({asyncTokenLookup:!0,asset:n,value:h,fromBaseDecimal:t})}static fromStringWithBaseSync(n,h=0n,t=N.THOR){return $.from({asset:n,value:h,fromBaseDecimal:t})}static fromIdentifierSync(n,h=0){return $.from({asset:n,value:h})}static fromChainOrSignature(n,h=0){if(Object.values(g).includes(n))return $.from({chain:n,value:h});return $.from({asset:n,value:h})}}async function Nt(n){const h=await import("@swapkit/tokens");for(let t of Object.values(h))for(let{identifier:o,chain:x,...s}of t.tokens){if("identifier"in n&&o===n.identifier)return o;if("address"in s&&"chain"in n&&x===n.chain&&s.address.toLowerCase()===n.contract.toLowerCase())return o}return}var Zn="0x313ce567",Fn=[`${"MAYA"}.MAYA`,`${"ETH"}.THOR`,`${"ETH"}.vTHOR`,`${"KUJI"}.USK`],Bn=async({chain:n,to:h})=>{try{const{result:t}=await y.post(E[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:Zn},"latest"]})});return Number.parseInt(BigInt(t||N[n]).toString())}catch(t){return console.error(t),N[n]}},Yn=async({symbol:n})=>{try{const h=n.split("-")[1]?.toLowerCase(),{manager:t}=await y.post(`${E["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),N["XRD"]}},fn=(n)=>{if(n==="ETH")return N.ETH;const h=n.split("-"),t=h.length===1?void 0:h[h.length-1]?.toLowerCase();return t?.startsWith("0x")?Bn({chain:"ETH",to:t}):N.ETH},qn=(n)=>{const h=n.split("-"),t=h.length===1?void 0:h[h.length-1];return t?.startsWith("0x")?Bn({chain:"AVAX",to:t.toLowerCase()}):N.AVAX},Qn=(n)=>{if(n==="BSC")return N.BSC;return N.BSC},Wn=(n)=>{if(n==="XRD")return N.XRD;return Yn({symbol:n})},Rn=({chain:n,symbol:h})=>{switch(n){case"ETH":return fn(h);case"AVAX":return qn(h);case"BSC":return Qn(h);case"XRD":return Wn(h);default:return N[n]}},At=({chain:n})=>{switch(n){case"ARB":case"BASE":case"OP":return $.from({asset:`${n}.ETH`});case"MAYA":return $.from({asset:`${n}.CACAO`});case"GAIA":return $.from({asset:`${n}.ATOM`});case"BSC":return $.from({asset:`${n}.BNB`});case"THOR":return $.from({asset:`${n}.RUNE`});default:return $.from({asset:`${n}.${n}`})}},l=({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}},An=(n)=>{switch(n){case"ARB":case"BASE":case"OP":return{identifier:`${n}.ETH`,decimal:N[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:N[n]};case"THOR":return{identifier:`${n}.RUNE`,decimal:N[n]};case"BSC":return{identifier:`${n}.BNB`,decimal:N[n]};case"MAYA":return{identifier:`${n}.CACAO`,decimal:10};case"XRD":return{identifier:`${"XRD"}.XRD`,decimal:N[n]};case`${"MAYA"}.MAYA`:return{identifier:n,decimal:4};case`${"KUJI"}.USK`:return{identifier:n,decimal:6};default:return{identifier:`${n}.${n}`,decimal:N[n]}}},Cn=({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}},Ct=(n)=>{const[h,...t]=n.split("."),o=n.includes("/"),x=t.join("."),s=x?.split("-"),H=s?.length?s.length===1?s[0]:s.slice(0,-1).join("-"):void 0;return{chain:h,symbol:x,ticker:H,synth:o}},Mn=new RegExp(/(.)\1{6}|\.ORG|\.NET|\.FINANCE|\.COM|WWW|HTTP|\\\\|\/\/|[\s$%:[\]]/,"gmi"),Vn=(n)=>{const[h,t]=n.split(".");if(!V.includes(h))return!0;const o=t.split("-"),x=o.length===1?void 0:o[o.length-1];return l({chain:h,symbol:t})||!!x},Bt=(n)=>n.filter(({chain:h,value:t,symbol:o})=>{const x=`${h}.${o}`;return!Mn.test(x)&&Vn(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(V.includes(n)){if(o==="legacy")return[44,60,0,h];if(o==="ledgerLive")return[44,60,h,0,t];return Nn(v[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 Nn(v[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 Nn=(n,h)=>{return[...n.slice(0,n.length-1),h]};function bn({liquidityUnits:n,poolUnits:h,runeDepth:t}){const o=P(n),x=P(h),s=P(t),H=o.mul(s),R=x.mul(x).mul(2),T=x.mul(o).mul(2),A=o.mul(o),C=x.mul(x).mul(x);return H.mul(R.sub(T).add(A)).div(C)}function Kn({liquidityUnits:n,poolUnits:h,assetDepth:t}){const o=P(n),x=P(h),s=P(t),H=o.mul(s),R=x.mul(x).mul(2),T=x.mul(o).mul(2),A=o.mul(o),C=H.mul(R.sub(T).add(A)),G=x.mul(x).mul(x);return C.div(G)}function gt({percent:n,runeDepth:h,liquidityUnits:t,poolUnits:o}){return bn({runeDepth:h,liquidityUnits:t,poolUnits:o}).mul(n)}function Pt({percent:n,assetDepth:h,liquidityUnits:t,poolUnits:o}){return Kn({assetDepth:h,liquidityUnits:t,poolUnits:o}).mul(n)}function P(n){return j.fromBigInt(BigInt(n),N.THOR)}function Dn({liquidityUnits:n,poolUnits:h,runeDepth:t,assetDepth:o}){return{assetAmount:P(o).mul(n).div(h),runeAmount:P(t).mul(n).div(h)}}function St({liquidityUnits:n,poolUnits:h,runeDepth:t,assetDepth:o,percent:x}){return Object.fromEntries(Object.entries(Dn({liquidityUnits:n,poolUnits:h,runeDepth:t,assetDepth:o})).map(([s,H])=>[s,H.mul(x)]))}function jt({runeDepth:n,poolUnits:h,assetDepth:t,liquidityUnits:o,runeAmount:x,assetAmount:s}){const H=new j({value:n,decimal:8}),R=new j({value:t,decimal:8}),T=new j({value:h,decimal:8}),A=new j({value:x,decimal:8}),C=new j({value:s,decimal:8}),G=A.mul(R),S=C.mul(H),_=A.mul(C),Q=H.mul(R),w=T.mul(G.add(S.add(_.mul(2)))),I=G.add(S.add(Q.mul(2))),p=w.div(I),W=P(o).add(p);if(p.getBaseValue("number")===0)return W.div(T).getBaseValue("number");const kn=T.add(W);return W.div(kn).getBaseValue("number")}function ut({runeAmount:n,assetAmount:h,runeDepth:t,assetDepth:o}){if(n==="0"||h==="0"||t==="0"||o==="0")return 0;const x=P(t),s=P(o),H=P(h),R=P(n),T=H.mul(x).sub(s.mul(R)),A=s.mul(R).add(x.mul(s));return Math.abs(T.div(A).getBaseValue("number"))}function Un({type:n,address:h}){return`${n}:${h}`}function an({address:n,unbondAmount:h}){return`${"UNBOND"}:${n}:${h}`}function wt(n){return q("POOL+",n)}function dn({chain:n,symbol:h,...t}){return q(`${"+"}:${n}/${h}`,t)}function En({chain:n,symbol:h,address:t,...o}){const x=en({chain:n,symbol:h}),s=t?`:${t}:`:":";return q(`${"+"}:${x}${s}`,o)}function vn({chain:n,symbol:h,basisPoints:t}){return`${"-"}:${n}/${h}:${t}`}function mn({chain:n,symbol:h,ticker:t,basisPoints:o,targetAsset:x}){const s=n==="ETH"&&t!=="ETH"?`${t}-${h.slice(-3)}`:h,H=x?`:${x}`:"";return`${"-"}:${n}.${s}:${o}${H}`}function zt({basisPoints:n,...h}){return q(`${"POOL-"}:${n}`,h)}function rn({name:n,chain:h,address:t,owner:o}){const x=`${"~"}:${n}:${h}:${t}`,s=o?`:${o}`:"";return`${x}${s}`}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 s=`${n}:${h}:${t}`,H=o?`:${o}`:"";return q(`${s}${H}`,x)}function q(n,{affiliateAddress:h,affiliateBasisPoints:t}={}){const o=`${n}${h?`:${h}:${t||0}`:""}`;return o.endsWith(":")?o.slice(0,-1):o}function en({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 Yt=(n,h)=>{switch(n){case"LEAVE":case"BOND":return Un({type:n,address:h?.address});case"UNBOND":return an({address:h?.address,unbondAmount:h?.unbondAmount});case"~":return rn(h);case"$+":case"$-":return ln(n,h);case"+":{const{chain:t,symbol:o,address:x,singleSide:s}=h;if(s)return dn({chain:t,symbol:o});return En({chain:t,symbol:o,address:x})}case"-":{const{chain:t,ticker:o,symbol:x,basisPoints:s,targetAssetString:H,singleSide:R}=h;if(R)return vn({chain:t,symbol:x,basisPoints:s});return mn({chain:t,ticker:o,symbol:x,basisPoints:s,targetAsset:H})}default:throw new L({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 L({errorKey:"wallet_missing_api_key",info:{missingKey:o}});return{covalentApiKey:h,ethplorerApiKey:t}}function Ut(){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 nh=["approve","approvedAmount","call","sendTransaction","transfer","isApproved","approvedAmount","EIP1193SendTransaction","getFeeData","broadcastTransaction","estimateCall","estimateGasLimit","estimateGasPrices","createContractTxObject"],hh=(n,h,t)=>async(...o)=>{try{await th(h,t)}catch(x){throw new L({errorKey:"helpers_failed_to_switch_network",info:{error:x}})}return n(...o)},Tn=({provider:n,params:h,method:t})=>{if(!n?.send)throw new L("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=nh.reduce((x,s)=>{if(!n[s])return x;const H=n[s];if(typeof H!=="function")return x;return{...x,[s]:hh(H,t,h)}},{});return{...n,...o}},Mt=(n,h)=>Tn({provider:n,method:"wallet_addEthereumChain",params:[h]}),th=(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 oh().includes(n)},oh=()=>{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,s=[];if(n)s.push("METAMASK");if(h)s.push("XDEFI");if(t)s.push("BRAVE");if(o)s.push("TRUSTWALLET_WEB");if(x)s.push("COINBASE_WEB");if(xh())s.push("OKX_MOBILE");return s},xh=()=>{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},at=()=>typeof window.ethereum!=="undefined";class j extends u{eq(n){return this.eqValue(n)}static fromBigInt(n,h){return new j({decimal:h,value:J({value:n,bigIntDecimal:h,decimal:h})})}}export{Dh as wrapWithThrow,hh as wrapMethodWithNetworkSwitch,xn as warnOnce,mh as validateTNS,sn as validateIdentifier,th as switchEVMWalletNetwork,fh as setRequestClientConfig,Wt as prepareNetworkSwitch,xh as okxMobileEnabled,oh as listWeb3EVMWallets,at as isWeb3Detected,l as isGasAsset,Kt as isDetected,It as getWalletFormatFor,bh as getTHORNameCost,St as getSymmetricWithdraw,Dn as getSymmetricPoolShare,ct as getMinAmountByChain,mn as getMemoForWithdraw,an as getMemoForUnbond,vn as getMemoForSaverWithdraw,dn as getMemoForSaverDeposit,zt as getMemoForRunePoolWithdraw,wt as getMemoForRunePoolDeposit,rn as getMemoForNameRegister,Zt as getMemoForNamePreferredAssetRegister,ln as getMemoForLoan,Un as getMemoForLeaveAndBond,En as getMemoForDeposit,Yt as getMemoFor,Kh as getMAYANameCost,ut as getLiquiditySlippage,At as getGasAsset,jt as getEstimatedPoolShare,bt as getETHDefaultWallet,Ut as getEIP6963Wallets,ah as getDynamicChainId,$t as getDerivationPathFor,Rn as getDecimal,An as getCommonAssetInfo,Uh as getChainIdentifier,gt as getAsymmetricRuneWithdrawAmount,bn as getAsymmetricRuneShare,Pt as getAsymmetricAssetWithdrawAmount,Kn as getAsymmetricAssetShare,Cn as getAssetType,J as formatBigIntToSafeValue,Nt as findAssetBy,Bt as filterAssets,Dt as ensureEVMApiKeys,Ot as derivationPathToString,Xn as defaultRequestHeaders,Ct as assetFromString,Mt as addEVMWalletNetwork,Vt as addAccountsChangedCallback,Sn as WarningCodeEnum,hn as WalletOption,Ah as UTXOChains,Bh as TCSupportedChains,j as SwapKitNumber,L as SwapKitError,Rh as SubstrateChains,Lh as SWAP_OUT,Ih as SWAP_IN,y as RequestClient,M as RPCUrl,$n as QuoteMode,jn as ProviderName,v as NetworkDerivationPath,tn as MemoType,Nh as MAYASupportedChains,_n as LedgerErrorCode,un as FeeTypeEnum,Gn as FeeOption,d as ExplorerUrl,Pn as ErrorCode,V as EVMChains,Ln as DerivationPath,Ch as CosmosChains,In as ContractAddress,Fn as CommonAssetStrings,E as ChainToRPC,Th as ChainToHexChainId,kh as ChainToExplorerUrl,nn as ChainToChainId,Fh as ChainIdToChain,z as ChainId,g as Chain,u as BigIntArithmetics,N as BaseDecimal,$ as AssetValue,gn as ApproveMode,$h as AGG_SWAP};
or by passing asyncTokenLookup: true to the from() function, which will make it async and return a promise.`);const{decimal:Q,identifier:w,tax:I}=S||{decimal:_||N[C],identifier:T},X=h?a(BigInt(x),h):a(x,Q);return t?wn(w,h?X:x):G?zn(w,X):new $({tax:I,decimal:Q,identifier:w,value:X})}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:s,...H}of o.tokens)U.set(x.toUpperCase(),{identifier:x,decimal:"decimals"in H?H.decimals:N[s]});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 $.from({asset:n,value:h,asyncTokenLookup:!0})}static fromIdentifier(n,h=0){return $.from({asset:n,value:h,asyncTokenLookup:!0})}static fromStringSync(n,h=0){return $.from({asset:n,value:h})}static fromStringWithBase(n,h=0n,t=N.THOR){return $.from({asyncTokenLookup:!0,asset:n,value:h,fromBaseDecimal:t})}static fromStringWithBaseSync(n,h=0n,t=N.THOR){return $.from({asset:n,value:h,fromBaseDecimal:t})}static fromIdentifierSync(n,h=0){return $.from({asset:n,value:h})}static fromChainOrSignature(n,h=0){if(Object.values(g).includes(n))return $.from({chain:n,value:h});return $.from({asset:n,value:h})}}async function Nt(n){const h=await import("@swapkit/tokens");for(let t of Object.values(h))for(let{identifier:o,chain:x,...s}of t.tokens){if("identifier"in n&&o===n.identifier)return o;if("address"in s&&"chain"in n&&x===n.chain&&s.address.toLowerCase()===n.contract.toLowerCase())return o}return}var Zn="0x313ce567",Fn=[`${"MAYA"}.MAYA`,`${"ETH"}.THOR`,`${"ETH"}.vTHOR`,`${"KUJI"}.USK`],Bn=async({chain:n,to:h})=>{try{const{result:t}=await y.post(E[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:Zn},"latest"]})});return Number.parseInt(BigInt(t||N[n]).toString())}catch(t){return console.error(t),N[n]}},Yn=async({symbol:n})=>{try{const h=n.split("-")[1]?.toLowerCase(),{manager:t}=await y.post(`${E["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),N["XRD"]}},fn=(n)=>{if(n==="ETH")return N.ETH;const h=n.split("-"),t=h.length===1?void 0:h[h.length-1]?.toLowerCase();return t?.startsWith("0x")?Bn({chain:"ETH",to:t}):N.ETH},qn=(n)=>{const h=n.split("-"),t=h.length===1?void 0:h[h.length-1];return t?.startsWith("0x")?Bn({chain:"AVAX",to:t.toLowerCase()}):N.AVAX},Qn=(n)=>{if(n==="BSC")return N.BSC;return N.BSC},Wn=(n)=>{if(n==="XRD")return N.XRD;return Yn({symbol:n})},Rn=({chain:n,symbol:h})=>{switch(n){case"ETH":return fn(h);case"AVAX":return qn(h);case"BSC":return Qn(h);case"XRD":return Wn(h);default:return N[n]}},At=({chain:n})=>{switch(n){case"ARB":case"BASE":case"OP":return $.from({asset:`${n}.ETH`});case"MAYA":return $.from({asset:`${n}.CACAO`});case"GAIA":return $.from({asset:`${n}.ATOM`});case"BSC":return $.from({asset:`${n}.BNB`});case"THOR":return $.from({asset:`${n}.RUNE`});default:return $.from({asset:`${n}.${n}`})}},l=({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}},An=(n)=>{switch(n){case"ARB":case"BASE":case"OP":return{identifier:`${n}.ETH`,decimal:N[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:N[n]};case"THOR":return{identifier:`${n}.RUNE`,decimal:N[n]};case"BSC":return{identifier:`${n}.BNB`,decimal:N[n]};case"MAYA":return{identifier:`${n}.CACAO`,decimal:10};case"XRD":return{identifier:`${"XRD"}.XRD`,decimal:N[n]};case`${"MAYA"}.MAYA`:return{identifier:n,decimal:4};case`${"KUJI"}.USK`:return{identifier:n,decimal:6};default:return{identifier:`${n}.${n}`,decimal:N[n]}}},Cn=({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}},Ct=(n)=>{const[h,...t]=n.split("."),o=n.includes("/"),x=t.join("."),s=x?.split("-"),H=s?.length?s.length===1?s[0]:s.slice(0,-1).join("-"):void 0;return{chain:h,symbol:x,ticker:H,synth:o}},Mn=new RegExp(/(.)\1{6}|\.ORG|\.NET|\.FINANCE|\.COM|WWW|HTTP|\\\\|\/\/|[\s$%:[\]]/,"gmi"),Vn=(n)=>{const[h,t]=n.split(".");if(!V.includes(h))return!0;const o=t.split("-"),x=o.length===1?void 0:o[o.length-1];return l({chain:h,symbol:t})||!!x},Bt=(n)=>n.filter(({chain:h,value:t,symbol:o})=>{const x=`${h}.${o}`;return!Mn.test(x)&&Vn(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(V.includes(n)){if(o==="legacy")return[44,60,0,h];if(o==="ledgerLive")return[44,60,h,0,t];return Nn(v[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 Nn(v[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 Nn=(n,h)=>{return[...n.slice(0,n.length-1),h]};function bn({liquidityUnits:n,poolUnits:h,runeDepth:t}){const o=P(n),x=P(h),s=P(t),H=o.mul(s),R=x.mul(x).mul(2),T=x.mul(o).mul(2),A=o.mul(o),C=x.mul(x).mul(x);return H.mul(R.sub(T).add(A)).div(C)}function Kn({liquidityUnits:n,poolUnits:h,assetDepth:t}){const o=P(n),x=P(h),s=P(t),H=o.mul(s),R=x.mul(x).mul(2),T=x.mul(o).mul(2),A=o.mul(o),C=H.mul(R.sub(T).add(A)),G=x.mul(x).mul(x);return C.div(G)}function gt({percent:n,runeDepth:h,liquidityUnits:t,poolUnits:o}){return bn({runeDepth:h,liquidityUnits:t,poolUnits:o}).mul(n)}function Pt({percent:n,assetDepth:h,liquidityUnits:t,poolUnits:o}){return Kn({assetDepth:h,liquidityUnits:t,poolUnits:o}).mul(n)}function P(n){return j.fromBigInt(BigInt(n),N.THOR)}function Dn({liquidityUnits:n,poolUnits:h,runeDepth:t,assetDepth:o}){return{assetAmount:P(o).mul(n).div(h),runeAmount:P(t).mul(n).div(h)}}function St({liquidityUnits:n,poolUnits:h,runeDepth:t,assetDepth:o,percent:x}){return Object.fromEntries(Object.entries(Dn({liquidityUnits:n,poolUnits:h,runeDepth:t,assetDepth:o})).map(([s,H])=>[s,H.mul(x)]))}function jt({runeDepth:n,poolUnits:h,assetDepth:t,liquidityUnits:o,runeAmount:x,assetAmount:s}){const H=new j({value:n,decimal:8}),R=new j({value:t,decimal:8}),T=new j({value:h,decimal:8}),A=new j({value:x,decimal:8}),C=new j({value:s,decimal:8}),G=A.mul(R),S=C.mul(H),_=A.mul(C),Q=H.mul(R),w=T.mul(G.add(S.add(_.mul(2)))),I=G.add(S.add(Q.mul(2))),X=w.div(I),W=P(o).add(X);if(X.getBaseValue("number")===0)return W.div(T).getBaseValue("number");const kn=T.add(W);return W.div(kn).getBaseValue("number")}function pt({runeAmount:n,assetAmount:h,runeDepth:t,assetDepth:o}){if(n==="0"||h==="0"||t==="0"||o==="0")return 0;const x=P(t),s=P(o),H=P(h),R=P(n),T=H.mul(x).sub(s.mul(R)),A=s.mul(R).add(x.mul(s));return Math.abs(T.div(A).getBaseValue("number"))}function Un({type:n,address:h}){return`${n}:${h}`}function an({address:n,unbondAmount:h}){return`${"UNBOND"}:${n}:${h}`}function wt(n){return q("POOL+",n)}function dn({chain:n,symbol:h,...t}){return q(`${"+"}:${n}/${h}`,t)}function En({chain:n,symbol:h,address:t,...o}){const x=en({chain:n,symbol:h}),s=t?`:${t}:`:":";return q(`${"+"}:${x}${s}`,o)}function vn({chain:n,symbol:h,basisPoints:t}){return`${"-"}:${n}/${h}:${t}`}function mn({chain:n,symbol:h,ticker:t,basisPoints:o,targetAsset:x}){const s=n==="ETH"&&t!=="ETH"?`${t}-${h.slice(-3)}`:h,H=x?`:${x}`:"";return`${"-"}:${n}.${s}:${o}${H}`}function zt({basisPoints:n,...h}){return q(`${"POOL-"}:${n}`,h)}function rn({name:n,chain:h,address:t,owner:o}){const x=`${"~"}:${n}:${h}:${t}`,s=o?`:${o}`:"";return`${x}${s}`}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 s=`${n}:${h}:${t}`,H=o?`:${o}`:"";return q(`${s}${H}`,x)}function q(n,{affiliateAddress:h,affiliateBasisPoints:t}={}){const o=`${n}${h?`:${h}:${t||0}`:""}`;return o.endsWith(":")?o.slice(0,-1):o}function en({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 Yt=(n,h)=>{switch(n){case"LEAVE":case"BOND":return Un({type:n,address:h?.address});case"UNBOND":return an({address:h?.address,unbondAmount:h?.unbondAmount});case"~":return rn(h);case"$+":case"$-":return ln(n,h);case"+":{const{chain:t,symbol:o,address:x,singleSide:s}=h;if(s)return dn({chain:t,symbol:o});return En({chain:t,symbol:o,address:x})}case"-":{const{chain:t,ticker:o,symbol:x,basisPoints:s,targetAssetString:H,singleSide:R}=h;if(R)return vn({chain:t,symbol:x,basisPoints:s});return mn({chain:t,ticker:o,symbol:x,basisPoints:s,targetAsset:H})}default:throw new L({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 L({errorKey:"wallet_missing_api_key",info:{missingKey:o}});return{covalentApiKey:h,ethplorerApiKey:t}}function Ut(){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 nh=["approve","approvedAmount","call","sendTransaction","transfer","isApproved","approvedAmount","EIP1193SendTransaction","getFeeData","broadcastTransaction","estimateCall","estimateGasLimit","estimateGasPrices","createContractTxObject"],hh=(n,h,t)=>async(...o)=>{try{await th(h,t)}catch(x){throw new L({errorKey:"helpers_failed_to_switch_network",info:{error:x}})}return n(...o)},Tn=({provider:n,params:h,method:t})=>{if(!n?.send)throw new L("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=nh.reduce((x,s)=>{if(!n[s])return x;const H=n[s];if(typeof H!=="function")return x;return{...x,[s]:hh(H,t,h)}},{});return{...n,...o}},Mt=(n,h)=>Tn({provider:n,method:"wallet_addEthereumChain",params:[h]}),th=(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 oh().includes(n)},oh=()=>{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,s=[];if(n)s.push("METAMASK");if(h)s.push("XDEFI");if(t)s.push("BRAVE");if(o)s.push("TRUSTWALLET_WEB");if(x)s.push("COINBASE_WEB");if(xh())s.push("OKX_MOBILE");return s},xh=()=>{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},at=()=>typeof window.ethereum!=="undefined";class j extends p{eq(n){return this.eqValue(n)}static fromBigInt(n,h){return new j({decimal:h,value:J({value:n,bigIntDecimal:h,decimal:h})})}}export{Dh as wrapWithThrow,hh as wrapMethodWithNetworkSwitch,xn as warnOnce,ih as validateTNS,sn as validateIdentifier,th as switchEVMWalletNetwork,fh as setRequestClientConfig,Wt as prepareNetworkSwitch,xh as okxMobileEnabled,oh as listWeb3EVMWallets,at as isWeb3Detected,l as isGasAsset,Kt as isDetected,It as getWalletFormatFor,bh as getTHORNameCost,St as getSymmetricWithdraw,Dn as getSymmetricPoolShare,ct as getMinAmountByChain,mn as getMemoForWithdraw,an as getMemoForUnbond,vn as getMemoForSaverWithdraw,dn as getMemoForSaverDeposit,zt as getMemoForRunePoolWithdraw,wt as getMemoForRunePoolDeposit,rn as getMemoForNameRegister,Zt as getMemoForNamePreferredAssetRegister,ln as getMemoForLoan,Un as getMemoForLeaveAndBond,En as getMemoForDeposit,Yt as getMemoFor,Kh as getMAYANameCost,pt as getLiquiditySlippage,At as getGasAsset,jt as getEstimatedPoolShare,bt as getETHDefaultWallet,Ut as getEIP6963Wallets,ah as getDynamicChainId,$t as getDerivationPathFor,Rn as getDecimal,An as getCommonAssetInfo,Uh as getChainIdentifier,gt as getAsymmetricRuneWithdrawAmount,bn as getAsymmetricRuneShare,Pt as getAsymmetricAssetWithdrawAmount,Kn as getAsymmetricAssetShare,Cn as getAssetType,J as formatBigIntToSafeValue,Nt as findAssetBy,Bt as filterAssets,Dt as ensureEVMApiKeys,Ot as derivationPathToString,un as defaultRequestHeaders,Ct as assetFromString,Mt as addEVMWalletNetwork,Vt as addAccountsChangedCallback,Sn as WarningCodeEnum,hn as WalletOption,Ah as UTXOChains,Bh as TCSupportedChains,j as SwapKitNumber,L as SwapKitError,Rh as SubstrateChains,Lh as SWAP_OUT,Ih as SWAP_IN,y as RequestClient,M as RPCUrl,$n as QuoteMode,jn as ProviderName,v as NetworkDerivationPath,tn as MemoType,Nh as MAYASupportedChains,_n as LedgerErrorCode,pn as FeeTypeEnum,Gn as FeeOption,d as ExplorerUrl,Pn as ErrorCode,V as EVMChains,Ln as DerivationPath,Ch as CosmosChains,In as ContractAddress,Fn as CommonAssetStrings,E as ChainToRPC,Th as ChainToHexChainId,kh as ChainToExplorerUrl,nn as ChainToChainId,Fh as ChainIdToChain,z as ChainId,g as Chain,p as BigIntArithmetics,N as BaseDecimal,$ as AssetValue,gn as ApproveMode,$h as AGG_SWAP};
//# debugId=C65B6EADBEDA957F64756E2164756E21
//# debugId=98E5C564E900349F64756E2164756E21

@@ -6,11 +6,11 @@ {

"@swapkit/contracts": "1.0.5",
"@swapkit/tokens": "1.6.0"
"@swapkit/tokens": "1.7.0"
},
"devDependencies": {
"@swapkit/toolbox-cosmos": "1.3.1",
"@swapkit/toolbox-evm": "1.4.0",
"@swapkit/toolbox-radix": "1.1.0",
"@swapkit/toolbox-solana": "1.1.0",
"@swapkit/toolbox-substrate": "1.2.7",
"@swapkit/toolbox-utxo": "1.1.12"
"@swapkit/toolbox-cosmos": "1.3.2",
"@swapkit/toolbox-evm": "1.4.1",
"@swapkit/toolbox-radix": "1.2.0",
"@swapkit/toolbox-solana": "1.1.1",
"@swapkit/toolbox-substrate": "1.2.8",
"@swapkit/toolbox-utxo": "1.1.13"
},

@@ -40,3 +40,3 @@ "files": [

"types": "./src/index.ts",
"version": "1.9.0"
"version": "1.10.0"
}

@@ -91,3 +91,3 @@ import { describe, expect, test } from "bun:test";

// TODO: this times out
// TODO: if too many requests, this will fail due to timeout
// const kindDecimal = await getDecimal({

@@ -132,10 +132,10 @@ // chain: Chain.Ethereum,

const timeDecimal = await getDecimal({
chain: Chain.Avalanche,
symbol: "TIME-0xb54f16fB19478766A268F172C9480f8da1a7c9C3",
});
expect(timeDecimal).toBe(9);
await Bun.sleep(500);
// TODO: if too many requests, this will fail due to timeout
// const timeDecimal = await getDecimal({
// chain: Chain.Avalanche,
// symbol: "TIME-0xb54f16fB19478766A268F172C9480f8da1a7c9C3",
// });
// expect(timeDecimal).toBe(9);
// await Bun.sleep(500);
// TODO: this times out
// const usdtDecimal = await getDecimal({

@@ -142,0 +142,0 @@ // chain: Chain.Avalanche,

@@ -0,1 +1,2 @@

import type { RadixNetwork } from "@swapkit/toolbox-radix";
import type { Chain } from "./chains";

@@ -51,3 +52,3 @@ import type { ChainApis } from "./sdk";

/**
* @optional for setting the chainflip radix dapp config
* @optional for setting the radix wallet
*/

@@ -58,2 +59,3 @@ radixDappConfig?: {

applicationVersion: string;
network: RadixNetwork;
};

@@ -60,0 +62,0 @@ };

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc