New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@swapkit/helpers

Package Overview
Dependencies
Maintainers
0
Versions
259
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.16.0 to 1.17.0

6

dist/index.js

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

var _n=Object.create;var{getPrototypeOf:Sn,defineProperty:hn,getOwnPropertyNames:jn}=Object;var Ln=Object.prototype.hasOwnProperty;var tn=(n,h,t)=>{t=n!=null?_n(Sn(n)):{};let c=h||!n||!n.__esModule?hn(t,"default",{value:n,enumerable:!0}):t;for(let o of jn(n))if(!Ln.call(c,o))hn(c,o,{get:()=>n[o],enumerable:!0});return c};var cn=((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 S;((R)=>{R.Arbitrum="ARB";R.Avalanche="AVAX";R.Base="BASE";R.BinanceSmartChain="BSC";R.Bitcoin="BTC";R.BitcoinCash="BCH";R.Cosmos="GAIA";R.Dash="DASH";R.Dogecoin="DOGE";R.Ethereum="ETH";R.Kujira="KUJI";R.Litecoin="LTC";R.Maya="MAYA";R.Optimism="OP";R.Polkadot="DOT";R.Chainflip="FLIP";R.Polygon="MATIC";R.Radix="XRD";R.THORChain="THOR";R.Solana="SOL"})(S||={});var m;((t)=>{t.THORChain="THOR_STAGENET";t.Maya="MAYA_STAGENET"})(m||={});var b;((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"})(b||={});var Sh={["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"},Gn=Object.keys(S),Z=Object.values(S),p={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},jh=["DOT","FLIP"],i=["ARB","AVAX","BASE","BSC","ETH","OP","MATIC"],Lh=["BTC","BCH","DASH","DOGE","LTC"],Gh=["GAIA","THOR","MAYA","KUJI"],uh=["AVAX","BSC","BTC","BCH","GAIA","DOGE","ETH","LTC","THOR"],wh=["ARB","DASH","ETH","KUJI","MAYA","THOR"],Cn={["ARB"]:"https://arb1.arbitrum.io/rpc",["AVAX"]:"https://avalanche-c-chain-rpc.publicnode.com",["BASE"]:"https://base.llamarpc.com",["BSC"]:"https://bsc-dataseed.binance.org",["BTC"]:"https://bitcoin-rpc.publicnode.com",["BCH"]:"https://node-router.thorswap.net/bitcoin-cash",["FLIP"]:"wss://mainnet-archive.chainflip.io",["GAIA"]:"https://node-router.thorswap.net/cosmos/rpc",["DASH"]:"https://dash-rpc.publicnode.com",["DOGE"]:"https://node-router.thorswap.net/dogecoin",["ETH"]:"https://ethereum-rpc.publicnode.com",["KUJI"]:"https://rpc-kujira.synergynodes.com/",["LTC"]:"https://node-router.thorswap.net/litecoin",["MAYA"]:"https://tendermint.mayachain.info",["OP"]:"https://mainnet.optimism.io",["DOT"]:"wss://rpc.polkadot.io",["MATIC"]:"https://polygon-rpc.com",["XRD"]:"https://radix-mainnet.rpc.grove.city/v1/326002fc/core",["THOR"]:"https://rpc.thorswap.net",["THOR_STAGENET"]:"https://stagenet-rpc.ninerealms.com",["MAYA_STAGENET"]:"https://stagenet.tendermint.mayachain.info",["SOL"]:"https://solana-rpc.publicnode.com"},un={["ARB"]:["https://arb-mainnet.g.alchemy.com/v2/demo","https://arbitrum.blockpi.network/v1/rpc/public"],["AVAX"]:["https://api.avax.network/ext/bc/C/rpc","https://avalanche-c-chain-rpc.publicnode.com"],["BASE"]:["https://base.blockpi.network/v1/rpc/public","https://1rpc.io/base"],["BSC"]:["https://bsc-rpc.gateway.pokt.network","https://bsc-dataseed2.binance.org"],["BTC"]:["https://bitcoin.publicnode.com"],["BCH"]:["https://bch-dataseed.binance.org","https://bch.getblock.io/mainnet"],["FLIP"]:["wss://archive-1.mainnet.chainflip.io","wss://archive-2.mainnet.chainflip.io"],["GAIA"]:["https://cosmos-rpc.quickapi.com","https://cosmos-rpc.publicnode.com"],["DASH"]:["https://dash-rpc.publicnode.com"],["DOGE"]:["https://doge.getblock.io/mainnet","https://dogecoin.publicnode.com"],["ETH"]:["https://eth.llamarpc.com","https://rpc.ankr.com/eth"],["KUJI"]:["https://kujira-rpc.polkachu.com","https://kujira-rpc.ibs.team"],["LTC"]:["https://ltc.getblock.io/mainnet","https://litecoin.publicnode.com"],["MAYA"]:["https://tendermint.mayachain.info","https://maya-tendermint.publicnode.com"],["MAYA_STAGENET"]:[],["OP"]:["https://optimism.llamarpc.com","https://1rpc.io/op"],["DOT"]:["wss://polkadot-rpc.dwellir.com","wss://polkadot.api.onfinality.io/public-ws"],["MATIC"]:["https://polygon.llamarpc.com","https://rpc.ankr.com/polygon"],["XRD"]:["https://mainnet.radixdlt.com","https://radix-mainnet.rpc.grove.city/v1"],["THOR"]:["https://thornode.ninerealms.com","https://thornode.thorswap.net"],["THOR_STAGENET"]:[],["SOL"]:["https://api.mainnet-beta.solana.com","https://rpc.ankr.com/solana"]},wn={["ARB"]:"https://arbiscan.io",["AVAX"]:"https://snowtrace.io",["BASE"]:"https://basescan.org",["BSC"]:"https://bscscan.com",["BTC"]:"https://blockchair.com/bitcoin",["BCH"]:"https://www.blockchair.com/bitcoin-cash",["FLIP"]:"https://explorer.polkascan.io/polkadot",["GAIA"]:"https://www.mintscan.io/cosmos",["DASH"]:"https://blockchair.com/dash",["DOGE"]:"https://blockchair.com/dogecoin",["ETH"]:"https://etherscan.io",["KUJI"]:"https://finder.kujira.network/kaiyo-1",["LTC"]:"https://blockchair.com/litecoin",["MAYA"]:"https://www.mayascan.org",["OP"]:"https://optimistic.etherscan.io",["DOT"]:"https://polkadot.subscan.io",["MATIC"]:"https://polygonscan.com",["XRD"]:"https://dashboard.radixdlt.com",["THOR"]:"https://runescan.io",["SOL"]:"https://solscan.io"},D=Cn,f=(n)=>{return D[n]},Xn=(n)=>{switch(n){case"ARB":case"AVAX":case"BASE":case"BSC":case"ETH":case"OP":case"MATIC":return{jsonrpc:"2.0",method:"eth_blockNumber",params:[],id:1};case"BTC":case"DOGE":case"BCH":case"DASH":case"LTC":return{jsonrpc:"1.0",id:"test",method:"getblockchaininfo",params:[]};case"GAIA":case"KUJI":case"MAYA":case"THOR":case"MAYA_STAGENET":case"THOR_STAGENET":return{id:1,jsonrpc:"2.0",method:"status",params:{}};case"DOT":return{jsonrpc:"2.0",id:1,method:"system_health",params:[]};case"XRD":return"";case"SOL":return{jsonrpc:"2.0",id:1,method:"getHealth"};default:throw new Error(`Unsupported chain: ${n}`)}};function In(n){switch(n){case"XRD":return"/status/network-configuration";default:return""}}var on=async(n,h)=>{try{let t=h.startsWith("wss")?h.replace("wss","https"):h;return(await fetch(`${t}${In(n)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Xn(n)),signal:AbortSignal.timeout(3000)})).ok}catch{return!1}},Jn=async(n)=>{let h=Cn[n];if(await on(n,h))return h;for(let t of un[n])if(await on(n,t))return t;return h},Xh=async(n=[...Object.values(S),...Object.values(m)])=>{let h={};await Promise.all(n.map(async(t)=>{let c=await Jn(t);h[t]=c})),D={...D,...h}},sn=Z.reduce((n,h)=>{let t=Gn.find((c)=>S[c]===h);if(t)n[h]=t;return n},{}),Hn=Z.reduce((n,h)=>{return n[h]=b[sn[h]],n},{}),E=Z.reduce((n,h)=>{return n[h]=f(h),n},{}),Ih=Z.reduce((n,h)=>{let t=`${sn[h]}Hex`;return n[h]=b[t],n},{}),Jh=Z.reduce((n,h)=>{return n[h]=wn[h],n},{});var Pn;((T)=>{T.TC_SUPPORTED_TO_TC_SUPPORTED="TC-TC";T.TC_SUPPORTED_TO_ETH="TC-ERC20";T.TC_SUPPORTED_TO_AVAX="TC-ARC20";T.TC_SUPPORTED_TO_BSC="TC-BEP20";T.ETH_TO_TC_SUPPORTED="ERC20-TC";T.ETH_TO_ETH="ERC20-ERC20";T.ETH_TO_AVAX="ERC20-ARC20";T.ETH_TO_BSC="ERC20-BEP20";T.AVAX_TO_TC_SUPPORTED="ARC20-TC";T.AVAX_TO_ETH="ARC20-ERC20";T.AVAX_TO_AVAX="ARC20-ARC20";T.AVAX_TO_BSC="ARC20-BEP20";T.BSC_TO_TC_SUPPORTED="BEP20-TC";T.BSC_TO_ETH="BEP20-ERC20";T.BSC_TO_AVAX="BEP20-ARC20";T.BSC_TO_BSC="BEP20-BEP20"})(Pn||={});var yh=["ERC20-ERC20","ARC20-ARC20","BEP20-BEP20"],zh=["ERC20-TC","ERC20-ARC20","ERC20-BEP20","ARC20-TC","ARC20-ERC20","ARC20-BEP20","BEP20-TC","BEP20-ERC20","BEP20-ARC20"],bh=["TC-TC","TC-ERC20","TC-ARC20","TC-BEP20"];var yn;((x)=>{x.ARB="0x0000000000000000000000000000000000000000";x.AVAX="0x0000000000000000000000000000000000000000";x.BASE="0x0000000000000000000000000000000000000000";x.ETH="0x0000000000000000000000000000000000000000";x.BSC="0x0000000000000000000000000000000000000000";x.MATIC="0x0000000000000000000000000000000000001010";x.OP="0x4200000000000000000000000000000000000042"})(yn||={});var zn;((R)=>{R.ARB="m/44'/60'/0'/0";R.AVAX="m/44'/60'/0'/0";R.BASE="m/44'/60'/0'/0";R.BCH="m/44'/145'/0'/0";R.BSC="m/44'/60'/0'/0";R.BTC="m/84'/0'/0'/0";R.DASH="m/44'/5'/0'/0";R.DOGE="m/44'/3'/0'/0";R.DOT="////";R.ETH="m/44'/60'/0'/0";R.FLIP="////";R.GAIA="m/44'/118'/0'/0";R.KUJI="m/44'/118'/0'/0";R.LTC="m/84'/2'/0'/0";R.MATIC="m/44'/60'/0'/0";R.MAYA="m/44'/931'/0'/0";R.OP="m/44'/60'/0'/0";R.SOL="m/44'/501'/0'/0";R.THOR="m/44'/931'/0'/0";R.XRD="////"})(zn||={});var W={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 bn;((O)=>{O.Arbitrum="https://arb1.arbitrum.io/rpc";O.Avalanche="https://avalanche-c-chain-rpc.publicnode.com";O.Base="https://base.llamarpc.com";O.BinanceSmartChain="https://bsc-dataseed.binance.org";O.Bitcoin="https://bitcoin-rpc.publicnode.com";O.BitcoinCash="https://node-router.thorswap.net/bitcoin-cash";O.Chainflip="wss://mainnet-archive.chainflip.io";O.Cosmos="https://node-router.thorswap.net/cosmos/rpc";O.Dash="https://dash-rpc.publicnode.com";O.Dogecoin="https://node-router.thorswap.net/dogecoin";O.Ethereum="https://ethereum-rpc.publicnode.com";O.Kujira="https://rpc-kujira.synergynodes.com/";O.Litecoin="https://node-router.thorswap.net/litecoin";O.Maya="https://tendermint.mayachain.info";O.MayaStagenet="https://stagenet.tendermint.mayachain.info";O.Optimism="https://mainnet.optimism.io";O.Polkadot="wss://rpc.polkadot.io";O.Polygon="https://polygon-rpc.com";O.Radix="https://radix-mainnet.rpc.grove.city/v1/326002fc/core";O.THORChain="https://rpc.thorswap.net";O.THORChainStagenet="https://stagenet-rpc.ninerealms.com";O.Solana="https://solana-rpc.publicnode.com"})(bn||={});var Zn;((R)=>{R.Arbitrum="https://arbiscan.io";R.Avalanche="https://snowtrace.io";R.Base="https://basescan.org";R.BinanceSmartChain="https://bscscan.com";R.Bitcoin="https://blockchair.com/bitcoin";R.BitcoinCash="https://www.blockchair.com/bitcoin-cash";R.Chainflip="https://explorer.polkascan.io/polkadot";R.Cosmos="https://www.mintscan.io/cosmos";R.Dash="https://blockchair.com/dash";R.Dogecoin="https://blockchair.com/dogecoin";R.Ethereum="https://etherscan.io";R.Kujira="https://finder.kujira.network/kaiyo-1";R.Litecoin="https://blockchair.com/litecoin";R.Maya="https://www.mayascan.org";R.Optimism="https://optimistic.etherscan.io";R.Polkadot="https://polkadot.subscan.io";R.Polygon="https://polygonscan.com";R.Radix="https://dashboard.radixdlt.com";R.THORChain="https://runescan.io";R.Solana="https://solscan.io"})(Zn||={});var Rn;((k)=>{k.BRAVE="BRAVE";k.COINBASE_MOBILE="COINBASE_MOBILE";k.COINBASE_WEB="COINBASE_WEB";k.EIP6963="EIP6963";k.EXODUS="EXODUS";k.KEEPKEY="KEEPKEY";k.KEEPKEY_BEX="KEEPKEY_BEX";k.KEPLR="KEPLR";k.KEYSTORE="KEYSTORE";k.LEAP="LEAP";k.LEDGER="LEDGER";k.LEDGER_LIVE="LEDGER_LIVE";k.METAMASK="METAMASK";k.OKX="OKX";k.OKX_MOBILE="OKX_MOBILE";k.PHANTOM="PHANTOM";k.POLKADOT_JS="POLKADOT_JS";k.RADIX_WALLET="RADIX_WALLET";k.TREZOR="TREZOR";k.TALISMAN="TALISMAN";k.TRUSTWALLET_WEB="TRUSTWALLET_WEB";k.WALLETCONNECT="WALLETCONNECT";k.XDEFI="XDEFI"})(Rn||={});var Yn;((c)=>{c[c.NoError=36864]="NoError";c[c.LockedDevice=21781]="LockedDevice";c[c.TC_NotFound=65535]="TC_NotFound"})(Yn||={});var qn;((c)=>{c.Average="average";c.Fast="fast";c.Fastest="fastest"})(qn||={});var Qn;((t)=>{t.Approve="approve";t.CheckOnly="checkOnly"})(Qn||={});var xn;((A)=>{A.NAME_REGISTER="~";A.BOND="BOND";A.DEPOSIT="+";A.LEAVE="LEAVE";A.UNBOND="UNBOND";A.WITHDRAW="-";A.OPEN_LOAN="$+";A.CLOSE_LOAN="$-";A.RUNEPOOL_DEPOSIT="POOL+";A.RUNEPOOL_WITHDRAW="POOL-"})(xn||={});var fn;((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"})(fn||={});var Wn;((t)=>{t.highSlippage="highSlippage";t.highPriceImpact="highPriceImpact"})(Wn||={});var Mn;((a)=>{a.CAVIAR_V1="CAVIAR_V1";a.CAMELOT_V3="CAMELOT_V3";a.CHAINFLIP="CHAINFLIP";a.JUPITER="JUPITER";a.MAYACHAIN="MAYACHAIN";a.MAYACHAIN_STREAMING="MAYACHAIN_STREAMING";a.OCISWAP_V1="OCISWAP_V1";a.ONEINCH="ONEINCH";a.OPENOCEAN_V2="OPENOCEAN_V2";a.PANCAKESWAP="PANCAKESWAP";a.PANGOLIN_V1="PANGOLIN_V1";a.SUSHISWAP_V2="SUSHISWAP_V2";a.THORCHAIN="THORCHAIN";a.THORCHAIN_STREAMING="THORCHAIN_STREAMING";a.TRADERJOE_V2="TRADERJOE_V2";a.UNISWAP_V2="UNISWAP_V2";a.UNISWAP_V3="UNISWAP_V3"})(Mn||={});var Vn;((H)=>{H.LIQUIDITY="liquidity";H.NETWORK="network";H.INBOUND="inbound";H.OUTBOUND="outbound";H.AFFILIATE="affiliate";H.TAX="tax"})(Vn||={});var v={},Kn=typeof window!=="undefined"?{}:{referrer:"https://sk.thorswap.net",referer:"https://sk.thorswap.net"};function lh({apiKey:n,...h}){v={...h,apiKey:n}}async function M(n,h){let{apiKey:t,...c}=v,{searchParams:o,json:s,body:H}=h,x={...Kn,...c.headers,...h.headers,...s?{"Content-Type":"application/json"}:{}},N=s?JSON.stringify(s):H,F=new URL(n);if(o)F.search=new URLSearchParams(o).toString();if(t)x["x-api-key"]=t;try{let _=await(await fetch(F.toString(),{...c,...h,body:N,headers:x})).json();if(h.responseHandler)return h.responseHandler(_);return _}catch(A){if(h.onError)return h.onError(A);console.error(A)}}var y={get:async(n,h)=>M(n,{...h,method:"GET"}),post:async(n,h)=>M(n,{...h,method:"POST"}),extend:(n)=>{let h={...v,...n};return{get:async(t,c)=>M(t,{...h,...c,method:"GET"}),post:async(t,c)=>M(t,{...h,...c,method:"POST"}),extend:(t)=>y.extend({...h,...t})}}};var Un={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,core_transaction_invalid_recipient_address:10317,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,wallet_keepkey_not_found:20900,wallet_keepkey_asset_not_defined:20901,wallet_keepkey_contract_address_not_provided:20902,wallet_keepkey_send_transaction_no_address:20903,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,thorchain_preferred_asset_payout_required:40104,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 $ extends Error{static ErrorCode=Un;constructor(n,h){let t=typeof n==="string",c=t?n:n.errorKey;if(h)console.error(h,{stack:h?.stack,message:h?.message});super(c,{cause:{code:$.ErrorCode[c],message:`${c}${t?"":`: ${JSON.stringify(n.info)}`}`}});Object.setPrototypeOf(this,$.prototype)}}function ct(n){if(n<0)throw new $({errorKey:"helpers_invalid_number_of_years",info:{numberOfYears:n}});return 10+n}function ot(n){if(n<0)throw new $({errorKey:"helpers_invalid_number_of_years",info:{numberOfYears:n}});return Math.round((10+n*1.0512)*10000000000)/10000000000}function Ct(n,h){try{return n()}catch(t){if(h)throw new $(h,t);return console.error(t)}}function st(n){switch(n){case"THOR":return`${n}.RUNE`;case"GAIA":return`${n}.ATOM`;case"BSC":return`${n}`;default:return`${n}.${n}`}}var Dn=["production","test"].includes("development"),Fn=new Set;function Bn(n,h){if(!Dn&&n){if(Fn.has(h))return;Fn.add(h),console.warn(h)}}async function Ht(n="thorchain-1"){if(!["thorchain-stagenet-v2","thorchain-1","thorchain-mainnet-v1"].includes(n))return n;try{return(await y.get(`${n!=="thorchain-1"?f("THOR_STAGENET"):f("THOR")}/status`)).result.node_info.network}catch(h){return n}}var An=[...Object.values(S),"TERRA"];function pn(n=""){let h=n.toUpperCase(),[t]=h.split(".");if(An.includes(t))return!0;let[c]=h.split("/");if(An.includes(c))return!0;throw new $({errorKey:"helpers_invalid_identifier",info:{message:`Invalid identifier: ${n}. Expected format: <Chain>.<Ticker> or <Chain>.<Ticker>-<ContractAddress>`,identifier:n}})}function Bt(n){if(n.length>30)return!1;let h=/^[a-zA-Z0-9+_-]+$/g;return!!n.match(h)}var q=8,P=(n)=>10n**BigInt(n),Y=(n)=>Math.log10(Number.parseFloat(n.toString()));function z({value:n,bigIntDecimal:h=q,decimal:t=q}){if(t===0)return n.toString();let c=n<0n,o=n.toString().substring(c?1:0),s=t-(o.length-1);if(s>0)o="0".repeat(s)+o;let H=o.length-t,x=o.slice(-t);if(Number.parseInt(x[h]||"0")>=5)x=`${x.substring(0,h-1)}${(Number.parseInt(x[h-1]||"0")+1).toString()}`;else x=x.substring(0,h);return`${c?"-":""}${o.slice(0,H)}.${x}`.replace(/\.?0*$/,"")}class w{decimalMultiplier=10n**8n;bigIntValue=0n;decimal;static fromBigInt(n,h){return new w({decimal:h,value:z({value:n,bigIntDecimal:h,decimal:h})})}static shiftDecimals({value:n,from:h,to:t}){return w.fromBigInt(n.getBaseValue("bigint")*P(t)/P(h),t)}constructor(n){let h=d(n),t=typeof n==="object";this.decimal=t?n.decimal:void 0,this.decimalMultiplier=t&&"decimalMultiplier"in n?n.decimalMultiplier:P(Math.max(Nn(V(h)),this.decimal||0)),this.#o(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,h){let t=this.formatBigIntToSafeValue(this.bigIntValue,h||this.decimal||Y(this.decimalMultiplier));switch(n){case"number":return Number(t);case"string":return t;case"bigint":return this.bigIntValue*10n**BigInt(this.decimal||8n)/this.decimalMultiplier}}getBaseValue(n,h){let t=this.decimalMultiplier/P(h||this.decimal||p.THOR),c=this.bigIntValue/t;switch(n){case"number":return Number(c);case"string":return c.toString();case"bigint":return c}}getBigIntValue(n,h){if(!h&&typeof n==="object")return n.bigIntValue;let t=d(n),c=V(t);if(c==="0"||c==="undefined")return 0n;return this.#c(c,h)}toSignificant(n=6){let[h,t]=this.getValue("string").split("."),c=h||"",o=t||"";if((Number.parseInt(c)?c.length+o.length:o.length)<=n)return this.getValue("string");if(c.length>=n)return c.slice(0,n).padEnd(c.length,"0");if(Number.parseInt(c))return`${c}.${o.slice(0,n-c.length)}`.padEnd(n-c.length,"0");let H=Number.parseInt(o),x=`${H}`.slice(0,n);return`0.${x.padStart(o.length-`${H}`.length+x.length,"0")}`}toFixed(n=6){let[h,t]=this.getValue("string").split("."),c=h||"",o=t||"";if(Number.parseInt(c))return`${c}.${o.slice(0,n)}`.padEnd(n,"0");let s=Number.parseInt(o),H=`${s}`.slice(0,n);return`0.${H.padStart(o.length-`${s}`.length+H.length,"0")}`}toAbbreviation(n=2){let h=this.getValue("number"),t=["","K","M","B","T","Q","Qi","S"],c=Math.floor(Math.log10(Math.abs(h))/3),o=t[c];if(!o)return this.getValue("string");let s=10**(c*3);return`${(h/s).toFixed(n)}${o}`}toCurrency(n="$",{currencyPosition:h="start",decimal:t=2,decimalSeparator:c=".",thousandSeparator:o=","}={}){let s=this.getValue("number"),[H="",x=""]=s.toFixed(6).split("."),N=H.replace(/\B(?=(\d{3})+(?!\d))/g,o),F=H||x?H==="0"?`${Number.parseFloat(`0.${x}`)}`.replace(".",c):`${N}${Number.parseInt(x)?`${c}${x.slice(0,t)}`:""}`:"0.00";return`${h==="start"?n:""}${F}${h==="end"?n:""}`}formatBigIntToSafeValue(n,h){let t=h||this.decimal||q,c=Math.max(t,Y(this.decimalMultiplier)),o=n<0n,s=n.toString().substring(o?1:0),H=c-(s.length-1),x=H>0?"0".repeat(H)+s:s,N=x.length-c,F=x.slice(-c);if(Number.parseInt(F[t]||"0")>=5)F=`${F.substring(0,t-1)}${(Number.parseInt(F[t-1]||"0")+1).toString()}`;else F=F.substring(0,t);return`${o?"-":""}${x.slice(0,N)}.${F}`.replace(/\.?0*$/,"")}#h(n,...h){let t=this.#t(this,...h),c=Math.max(t,Y(this.decimalMultiplier)),o=P(c),s=h.reduce((x,N)=>{let F=this.getBigIntValue(N,c);switch(n){case"add":return x+F;case"sub":return x-F;case"mul":return x*F/o;case"div":{if(F===0n)throw new RangeError("Division by zero");return x*o/F}default:return x}},this.bigIntValue*o/this.decimalMultiplier),H=z({bigIntDecimal:c,decimal:c,value:s});return new this.constructor({decimalMultiplier:P(c),decimal:this.decimal,value:H,identifier:this.toString()})}#n(n,...h){let t=this.#t(this,...h),c=this.getBigIntValue(h[0]||"0",t),o=this.getBigIntValue(this,t);switch(n){case"gt":return o>c;case"gte":return o>=c;case"lt":return o<c;case"lte":return o<=c;case"eqValue":return o===c}}#o(n){let h=V(n)||"0";this.bigIntValue=this.#c(h)}#t(...n){let h=n.map((t)=>{return typeof t==="object"?t.decimal||Y(t.decimalMultiplier):Nn(V(t))}).filter(Boolean);return Math.max(...h,q)}#c(n,h){let t=h?P(h):this.decimalMultiplier,c=Y(t),[o="",s=""]=n.split(".");return BigInt(`${o}${s.padEnd(c,"0")}`)}}var mn=Intl.NumberFormat("fullwide",{useGrouping:!1,maximumFractionDigits:20});function V(n){let t=`${typeof n==="number"?mn.format(n):d(n)}`.replaceAll(",",".").split(".");return t.length>1?`${t.slice(0,-1).join("")}.${t.at(-1)}`:t[0]||"0"}function Nn(n){let h=n.split(".")[1]?.length||0;return Math.max(h,q)}function d(n){return typeof n==="object"?"getValue"in n?n.getValue("string"):n.value:n}var K=new Map;class g extends w{address;chain;isGasAsset=!1;isSynthetic=!1;isTradeAsset=!1;symbol;tax;ticker;type;chainId;constructor({value:n,decimal:h,tax:t,chain:c,symbol:o,identifier:s}){super(typeof n==="object"?n:{decimal:h,value:n});let H=l(s||`${c}.${o}`);this.type=On(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.isTradeAsset=H.isTradeAsset,this.isGasAsset=H.isGasAsset,this.chainId=Hn[H.chain]}toString({includeSynthProtocol:n}={}){return(this.isSynthetic||this.isTradeAsset)&&!n?this.symbol:`${this.chain}.${this.symbol}`}toUrl(){return this.isSynthetic?`${this.chain}.${this.symbol.replace("/",".")}`:this.isTradeAsset?`${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){let[t,c,o]=n.split(".");if(!(t&&c))throw new $({errorKey:"helpers_invalid_asset_url",info:{urlAsset:n}});let s=t==="THOR"&&o?`${t}.${c}/${o}`:n;return g.from({asset:s,value:h})}static from({value:n=0,fromBaseDecimal:h,asyncTokenLookup:t,...c}){let o=n instanceof w?n.getValue("string"):n,s="chain"in c,H=s?c.chain:c.asset,x=s||kn.includes(H),{identifier:N,decimal:F}=x?an(H):{identifier:H,decimal:void 0},{chain:A,isSynthetic:_,isTradeAsset:L}=l(N),X=K.get(A==="SOL"?N:N.toUpperCase()),I=X?.decimal||F;Bn(!(t||I),`Couldn't find static decimal for ${N} (Using default ${p[A]} decimal as fallback).
var Sn=Object.create;var{getPrototypeOf:_n,defineProperty:hn,getOwnPropertyNames:Pn}=Object;var $n=Object.prototype.hasOwnProperty;var tn=(n,h,t)=>{t=n!=null?Sn(_n(n)):{};let o=h||!n||!n.__esModule?hn(t,"default",{value:n,enumerable:!0}):t;for(let c of Pn(n))if(!$n.call(o,c))hn(o,c,{get:()=>n[c],enumerable:!0});return o};var on=((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 S;((R)=>{R.Arbitrum="ARB";R.Avalanche="AVAX";R.Base="BASE";R.BinanceSmartChain="BSC";R.Bitcoin="BTC";R.BitcoinCash="BCH";R.Cosmos="GAIA";R.Dash="DASH";R.Dogecoin="DOGE";R.Ethereum="ETH";R.Kujira="KUJI";R.Litecoin="LTC";R.Maya="MAYA";R.Optimism="OP";R.Polkadot="DOT";R.Chainflip="FLIP";R.Polygon="MATIC";R.Radix="XRD";R.THORChain="THOR";R.Solana="SOL"})(S||={});var D;((t)=>{t.THORChain="THOR_STAGENET";t.Maya="MAYA_STAGENET"})(D||={});var J;((p)=>{p.Arbitrum="42161";p.ArbitrumHex="0xa4b1";p.Avalanche="43114";p.AvalancheHex="0xa86a";p.Base="8453";p.BaseHex="0x2105";p.BinanceSmartChain="56";p.BinanceSmartChainHex="0x38";p.Bitcoin="bitcoin";p.BitcoinCash="bitcoincash";p.Chainflip="chainflip";p.Cosmos="cosmoshub-4";p.Dash="dash";p.Dogecoin="dogecoin";p.Kujira="kaiyo-1";p.Ethereum="1";p.EthereumHex="0x1";p.Litecoin="litecoin";p.Maya="mayachain-mainnet-v1";p.MayaStagenet="mayachain-stagenet-v1";p.Optimism="10";p.OptimismHex="0xa";p.Polkadot="polkadot";p.Polygon="137";p.PolygonHex="0x89";p.Radix="radix-mainnet";p.THORChain="thorchain-1";p.THORChainStagenet="thorchain-stagenet-v2";p.Solana="solana"})(J||={});var Sh={["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"},Ln=Object.keys(S),b=Object.values(S),A={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},_h={["ARB"]:0.3,["AVAX"]:3,["BASE"]:2,["BSC"]:3,["BTC"]:600,["BCH"]:600,["FLIP"]:5,["GAIA"]:2,["DASH"]:150,["DOGE"]:600,["ETH"]:12.5,["KUJI"]:2.2,["LTC"]:150,["MAYA"]:6,["OP"]:2,["DOT"]:6,["MATIC"]:2.1,["XRD"]:5,["SOL"]:0.4,["THOR"]:6},Ph=["DOT","FLIP"],M=["ARB","AVAX","BASE","BSC","ETH","OP","MATIC"],$h=["BTC","BCH","DASH","DOGE","LTC"],Lh=["GAIA","THOR","MAYA","KUJI"],jh=["AVAX","BSC","BTC","BCH","GAIA","DOGE","ETH","LTC","THOR"],Gh=["ARB","DASH","ETH","KUJI","MAYA","THOR"],sn={["ARB"]:"https://arb1.arbitrum.io/rpc",["AVAX"]:"https://avalanche-c-chain-rpc.publicnode.com",["BASE"]:"https://base.llamarpc.com",["BSC"]:"https://bsc-dataseed.binance.org",["BTC"]:"https://bitcoin-rpc.publicnode.com",["BCH"]:"https://node-router.thorswap.net/bitcoin-cash",["FLIP"]:"wss://mainnet-archive.chainflip.io",["GAIA"]:"https://node-router.thorswap.net/cosmos/rpc",["DASH"]:"https://dash-rpc.publicnode.com",["DOGE"]:"https://node-router.thorswap.net/dogecoin",["ETH"]:"https://ethereum-rpc.publicnode.com",["KUJI"]:"https://rpc-kujira.synergynodes.com/",["LTC"]:"https://node-router.thorswap.net/litecoin",["MAYA"]:"https://tendermint.mayachain.info",["OP"]:"https://mainnet.optimism.io",["DOT"]:"wss://rpc.polkadot.io",["MATIC"]:"https://polygon-rpc.com",["XRD"]:"https://radix-mainnet.rpc.grove.city/v1/326002fc/core",["THOR"]:"https://rpc.thorswap.net",["THOR_STAGENET"]:"https://stagenet-rpc.ninerealms.com",["MAYA_STAGENET"]:"https://stagenet.tendermint.mayachain.info",["SOL"]:"https://solana-rpc.publicnode.com"},jn={["ARB"]:["https://arb-mainnet.g.alchemy.com/v2/demo","https://arbitrum.blockpi.network/v1/rpc/public"],["AVAX"]:["https://api.avax.network/ext/bc/C/rpc","https://avalanche-c-chain-rpc.publicnode.com"],["BASE"]:["https://base.blockpi.network/v1/rpc/public","https://1rpc.io/base"],["BSC"]:["https://bsc-rpc.gateway.pokt.network","https://bsc-dataseed2.binance.org"],["BTC"]:["https://bitcoin.publicnode.com"],["BCH"]:["https://bch-dataseed.binance.org","https://bch.getblock.io/mainnet"],["FLIP"]:["wss://archive-1.mainnet.chainflip.io","wss://archive-2.mainnet.chainflip.io"],["GAIA"]:["https://cosmos-rpc.quickapi.com","https://cosmos-rpc.publicnode.com"],["DASH"]:["https://dash-rpc.publicnode.com"],["DOGE"]:["https://doge.getblock.io/mainnet","https://dogecoin.publicnode.com"],["ETH"]:["https://eth.llamarpc.com","https://rpc.ankr.com/eth"],["KUJI"]:["https://kujira-rpc.polkachu.com","https://kujira-rpc.ibs.team"],["LTC"]:["https://ltc.getblock.io/mainnet","https://litecoin.publicnode.com"],["MAYA"]:["https://tendermint.mayachain.info","https://maya-tendermint.publicnode.com"],["MAYA_STAGENET"]:[],["OP"]:["https://optimism.llamarpc.com","https://1rpc.io/op"],["DOT"]:["wss://polkadot-rpc.dwellir.com","wss://polkadot.api.onfinality.io/public-ws"],["MATIC"]:["https://polygon.llamarpc.com","https://rpc.ankr.com/polygon"],["XRD"]:["https://mainnet.radixdlt.com","https://radix-mainnet.rpc.grove.city/v1"],["THOR"]:["https://thornode.ninerealms.com","https://thornode.thorswap.net"],["THOR_STAGENET"]:[],["SOL"]:["https://api.mainnet-beta.solana.com","https://rpc.ankr.com/solana"]},Gn={["ARB"]:"https://arbiscan.io",["AVAX"]:"https://snowtrace.io",["BASE"]:"https://basescan.org",["BSC"]:"https://bscscan.com",["BTC"]:"https://blockchair.com/bitcoin",["BCH"]:"https://www.blockchair.com/bitcoin-cash",["FLIP"]:"https://explorer.polkascan.io/polkadot",["GAIA"]:"https://www.mintscan.io/cosmos",["DASH"]:"https://blockchair.com/dash",["DOGE"]:"https://blockchair.com/dogecoin",["ETH"]:"https://etherscan.io",["KUJI"]:"https://finder.kujira.network/kaiyo-1",["LTC"]:"https://blockchair.com/litecoin",["MAYA"]:"https://www.mayascan.org",["OP"]:"https://optimistic.etherscan.io",["DOT"]:"https://polkadot.subscan.io",["MATIC"]:"https://polygonscan.com",["XRD"]:"https://dashboard.radixdlt.com",["THOR"]:"https://runescan.io",["SOL"]:"https://solscan.io"},U=sn,q=(n)=>{return U[n]},In=(n)=>{switch(n){case"ARB":case"AVAX":case"BASE":case"BSC":case"ETH":case"OP":case"MATIC":return{jsonrpc:"2.0",method:"eth_blockNumber",params:[],id:1};case"BTC":case"DOGE":case"BCH":case"DASH":case"LTC":return{jsonrpc:"1.0",id:"test",method:"getblockchaininfo",params:[]};case"GAIA":case"KUJI":case"MAYA":case"THOR":case"MAYA_STAGENET":case"THOR_STAGENET":return{id:1,jsonrpc:"2.0",method:"status",params:{}};case"DOT":return{jsonrpc:"2.0",id:1,method:"system_health",params:[]};case"XRD":return"";case"SOL":return{jsonrpc:"2.0",id:1,method:"getHealth"};default:throw new Error(`Unsupported chain: ${n}`)}};function wn(n){switch(n){case"XRD":return"/status/network-configuration";default:return""}}var cn=async(n,h)=>{try{let t=h.startsWith("wss")?h.replace("wss","https"):h;return(await fetch(`${t}${wn(n)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(In(n)),signal:AbortSignal.timeout(3000)})).ok}catch{return!1}},yn=async(n)=>{let h=sn[n];if(await cn(n,h))return h;for(let t of jn[n])if(await cn(n,t))return t;return h},Ih=async(n=[...Object.values(S),...Object.values(D)])=>{let h={};await Promise.all(n.map(async(t)=>{let o=await yn(t);h[t]=o})),U={...U,...h}},Cn=b.reduce((n,h)=>{let t=Ln.find((o)=>S[o]===h);if(t)n[h]=t;return n},{}),an=b.reduce((n,h)=>{return n[h]=J[Cn[h]],n},{}),d=b.reduce((n,h)=>{return n[h]=q(h),n},{}),wh=b.reduce((n,h)=>{let t=`${Cn[h]}Hex`;return n[h]=J[t],n},{}),yh=b.reduce((n,h)=>{return n[h]=Gn[h],n},{});var Xn;((k)=>{k.TC_SUPPORTED_TO_TC_SUPPORTED="TC-TC";k.TC_SUPPORTED_TO_ETH="TC-ERC20";k.TC_SUPPORTED_TO_AVAX="TC-ARC20";k.TC_SUPPORTED_TO_BSC="TC-BEP20";k.ETH_TO_TC_SUPPORTED="ERC20-TC";k.ETH_TO_ETH="ERC20-ERC20";k.ETH_TO_AVAX="ERC20-ARC20";k.ETH_TO_BSC="ERC20-BEP20";k.AVAX_TO_TC_SUPPORTED="ARC20-TC";k.AVAX_TO_ETH="ARC20-ERC20";k.AVAX_TO_AVAX="ARC20-ARC20";k.AVAX_TO_BSC="ARC20-BEP20";k.BSC_TO_TC_SUPPORTED="BEP20-TC";k.BSC_TO_ETH="BEP20-ERC20";k.BSC_TO_AVAX="BEP20-ARC20";k.BSC_TO_BSC="BEP20-BEP20"})(Xn||={});var Jh=["ERC20-ERC20","ARC20-ARC20","BEP20-BEP20"],bh=["ERC20-TC","ERC20-ARC20","ERC20-BEP20","ARC20-TC","ARC20-ERC20","ARC20-BEP20","BEP20-TC","BEP20-ERC20","BEP20-ARC20"],zh=["TC-TC","TC-ERC20","TC-ARC20","TC-BEP20"];var Jn;((x)=>{x.ARB="0x0000000000000000000000000000000000000000";x.AVAX="0x0000000000000000000000000000000000000000";x.BASE="0x0000000000000000000000000000000000000000";x.ETH="0x0000000000000000000000000000000000000000";x.BSC="0x0000000000000000000000000000000000000000";x.MATIC="0x0000000000000000000000000000000000001010";x.OP="0x4200000000000000000000000000000000000042"})(Jn||={});var bn;((R)=>{R.ARB="m/44'/60'/0'/0";R.AVAX="m/44'/60'/0'/0";R.BASE="m/44'/60'/0'/0";R.BCH="m/44'/145'/0'/0";R.BSC="m/44'/60'/0'/0";R.BTC="m/84'/0'/0'/0";R.DASH="m/44'/5'/0'/0";R.DOGE="m/44'/3'/0'/0";R.DOT="////";R.ETH="m/44'/60'/0'/0";R.FLIP="////";R.GAIA="m/44'/118'/0'/0";R.KUJI="m/44'/118'/0'/0";R.LTC="m/84'/2'/0'/0";R.MATIC="m/44'/60'/0'/0";R.MAYA="m/44'/931'/0'/0";R.OP="m/44'/60'/0'/0";R.SOL="m/44'/501'/0'/0";R.THOR="m/44'/931'/0'/0";R.XRD="////"})(bn||={});var Q={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 zn;((N)=>{N.Arbitrum="https://arb1.arbitrum.io/rpc";N.Avalanche="https://avalanche-c-chain-rpc.publicnode.com";N.Base="https://base.llamarpc.com";N.BinanceSmartChain="https://bsc-dataseed.binance.org";N.Bitcoin="https://bitcoin-rpc.publicnode.com";N.BitcoinCash="https://node-router.thorswap.net/bitcoin-cash";N.Chainflip="wss://mainnet-archive.chainflip.io";N.Cosmos="https://node-router.thorswap.net/cosmos/rpc";N.Dash="https://dash-rpc.publicnode.com";N.Dogecoin="https://node-router.thorswap.net/dogecoin";N.Ethereum="https://ethereum-rpc.publicnode.com";N.Kujira="https://rpc-kujira.synergynodes.com/";N.Litecoin="https://node-router.thorswap.net/litecoin";N.Maya="https://tendermint.mayachain.info";N.MayaStagenet="https://stagenet.tendermint.mayachain.info";N.Optimism="https://mainnet.optimism.io";N.Polkadot="wss://rpc.polkadot.io";N.Polygon="https://polygon-rpc.com";N.Radix="https://radix-mainnet.rpc.grove.city/v1/326002fc/core";N.THORChain="https://rpc.thorswap.net";N.THORChainStagenet="https://stagenet-rpc.ninerealms.com";N.Solana="https://solana-rpc.publicnode.com"})(zn||={});var Zn;((R)=>{R.Arbitrum="https://arbiscan.io";R.Avalanche="https://snowtrace.io";R.Base="https://basescan.org";R.BinanceSmartChain="https://bscscan.com";R.Bitcoin="https://blockchair.com/bitcoin";R.BitcoinCash="https://www.blockchair.com/bitcoin-cash";R.Chainflip="https://explorer.polkascan.io/polkadot";R.Cosmos="https://www.mintscan.io/cosmos";R.Dash="https://blockchair.com/dash";R.Dogecoin="https://blockchair.com/dogecoin";R.Ethereum="https://etherscan.io";R.Kujira="https://finder.kujira.network/kaiyo-1";R.Litecoin="https://blockchair.com/litecoin";R.Maya="https://www.mayascan.org";R.Optimism="https://optimistic.etherscan.io";R.Polkadot="https://polkadot.subscan.io";R.Polygon="https://polygonscan.com";R.Radix="https://dashboard.radixdlt.com";R.THORChain="https://runescan.io";R.Solana="https://solscan.io"})(Zn||={});var xn;((T)=>{T.BRAVE="BRAVE";T.COINBASE_MOBILE="COINBASE_MOBILE";T.COINBASE_WEB="COINBASE_WEB";T.EIP6963="EIP6963";T.EXODUS="EXODUS";T.KEEPKEY="KEEPKEY";T.KEEPKEY_BEX="KEEPKEY_BEX";T.KEPLR="KEPLR";T.KEYSTORE="KEYSTORE";T.LEAP="LEAP";T.LEDGER="LEDGER";T.LEDGER_LIVE="LEDGER_LIVE";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"})(xn||={});var Yn;((o)=>{o[o.NoError=36864]="NoError";o[o.LockedDevice=21781]="LockedDevice";o[o.TC_NotFound=65535]="TC_NotFound"})(Yn||={});var fn;((o)=>{o.Average="average";o.Fast="fast";o.Fastest="fastest"})(fn||={});var Mn;((t)=>{t.Approve="approve";t.CheckOnly="checkOnly"})(Mn||={});var Rn;((F)=>{F.NAME_REGISTER="~";F.BOND="BOND";F.DEPOSIT="+";F.LEAVE="LEAVE";F.UNBOND="UNBOND";F.WITHDRAW="-";F.OPEN_LOAN="$+";F.CLOSE_LOAN="$-";F.RUNEPOOL_DEPOSIT="POOL+";F.RUNEPOOL_WITHDRAW="POOL-"})(Rn||={});var qn;((s)=>{s.unknownError="unknownError";s.test_error="test_error";s.providerDetailsError="providerDetailsError";s.blockHeaderNotFound="blockHeaderNotFound";s.blockHashNotFoundAtHeight="blockHashNotFoundAtHeight";s.blockHashNotFoundAtHash="blockHashNotFoundAtHash";s.txHashMissing="txHashMissing";s.assetValueMissingInfo="assetValueMissingInfo";s.invalidAsset="invalidAsset";s.blockIsRequired="blockIsRequired";s.currentBlockHeaderNotFound="currentBlockHeaderNotFound";s.failedToRetrieveBalance="failedToRetrieveBalance";s.failedToRetrieveBlock="failedToRetrieveBlock";s.failedToRetrieveFees="failedToRetrieveFees";s.notImplementedBCH="notImplementedBCH";s.notImplementedDoge="notImplementedDoge";s.noPoolsFound="noPoolsFound";s.noVaultsFound="noVaultsFound";s.noTxFound="noTxFound";s.noInputCoinFound="noInputCoinFound";s.noBlockDataFound="noBlockDataFound";s.multipleCosmosMessages="multipleCosmosMessages";s.heightOrHashNotProvided="heightOrHashNotProvided";s.unknownDenom="unknownDenom";s.invalidBlockHeight="invalidBlockHeight";s.timestampExtrinsicNoArgumentsForBlock="timestampExtrinsicNoArgumentsForBlock";s.timestampExtrinsicNoTimestampForBlock="timestampExtrinsicNoTimestampForBlock";s.noTimestampExtrinsicForHash="noTimestampExtrinsicForHash";s.timestampExtrinsicNoArgumentsForHash="timestampExtrinsicNoArgumentsForHash";s.txMemoUndefined="txMemoUndefined";s.txMemoIncorrect="txMemoIncorrect";s.txTypeNotFound="txTypeNotFound";s.txNoMessage="txNoMessage";s.txNotFound="txNotFound";s.txReceiptNotFound="txReceiptNotFound";s.txParsingError="txParsingError";s.txLogsParsingError="txLogsParsingError";s.blockNotFound="blockNotFound";s.balanceNotFound="balanceNotFound";s.configError="configError";s.synthSwapDisallowed="synthSwapDisallowed";s.providerQuoteTimeout="providerQuoteTimeout";s.noQuoteResponse="noQuoteResponse";s.noPoolAssetsFound="noPoolAssetsFound";s.noThorchainPools="noThorchainPools";s.noMayachainPools="noMayachainPools";s.noThorchainNetworkInfo="noThorchainNetworkInfo";s.invalidAffiliateFee="invalidAffiliateFee";s.invalidBuyAssetAddress="invalidBuyAssetAddress";s.invalidSellAssetAddress="invalidSellAssetAddress";s.invalidSourceAddress="invalidSourceAddress";s.invalidDestinationAddress="invalidDestinationAddress";s.sourceAddressIsSmartContract="sourceAddressIsSmartContract";s.destinationAddressIsSmartContract="destinationAddressIsSmartContract";s.invalidChainId="invalidChainId";s.unsupportedChainId="unsupportedChainId";s.unsupportedEVMChainId="unsupportedEVMChainId";s.unsupportedMethod="unsupportedMethod";s.unsupportedProvider="unsupportedProvider";s.invalidParamsForMethod="invalidParamsForMethod";s.unsupportedAdapter="unsupportedAdapter";s.noWhitelistTokens="noWhitelistTokens";s.failedFetchGasPrice="failedFetchGasPrice";s.failedToCreateDepositChannel="failedToCreateDepositChannel";s.noProviderDetailsFound="noProviderDetailsFound";s.noTokenListsFound="noTokenListsFound";s.tokenNotFound="tokenNotFound";s.tokenPriceNotFound="tokenPriceNotFound";s.tokenPriceFailedToUpdate="tokenPriceFailedToUpdate";s.swapAmountTooSmall="swapAmountTooSmall";s.legsArrayIsEmpty="legsArrayIsEmpty";s.failedToFetchQuoteForLeg="failedToFetchQuoteForLeg";s.noBlockHeaderFound="noBlockHeaderFound";s.failedToSimulateSwap="failedToSimulateSwap";s.addressScreeningFailed="addressScreeningFailed";s.noLiquidtyProvidersFound="noLiquidtyProvidersFound";s.insufficientLiquidity="insufficientLiquidity";s.noSaversFound="noSaversFound";s.noInboundDataFound="noInbounDataFound";s.noInboundAddressesFound="noInboundAddressesFound";s.noInboundAddressFoundForChain="noInboundAddressFoundForChain";s.noLastBlocksFound="noLastBlocksFound";s.noVersionFound="noVersionFound";s.noConstantsFound="noConstantsFound";s.noMimirsFound="noMimirsFound";s.noRoutesFound="noRoutesFound";s.quoteNotFound="quoteNotFound";s.ledgerSignFailed="ledgerSignFailed";s.ledgerWrongPayload="ledgerWrongPayload";s.ledgerFetchSwapFailed="ledgerFetchSwapFailed";s.failedToFetchTx="failedToFetchTx";s.failedBuildTransactionDetails="failedBuildTransactionDetails";s.noLegsForRoute="noLegsForRoute";s.noRouterAddressFound="noRouterAddressFound";s.noAggregatorAddressFound="noAggregatorAddressFound";s.noContractInstanceFound="noContractInstanceFound";s.noContractAddressFound="noContractAddressFound";s.invalidAffiliate="invalidAffiliate";s.thornameAffiliate="thornameAffiliate";s.providerNotfound="No provider found";s.noRecordFound="No Record found";s.slippageTooLow="Slippage too low";s.tradingHalted="tradingHalted";s.noWrappedGasAsset="noWrappedGasAsset";s.aggregatorAddressNotFound="aggregatorAddressNotFound";s.routerAddressNotFound="routerAddressNotFound";s.dummyAddressNotFound="dummyAddressNotFound";s.trackerError="trackerError";s.thorchainPoolUnavailable="thorchainPoolUnavailable";s.noOhlcvDataFound="noOhlcvDataFound";s.noTradingPairs="noTradingPairs";s.noLoanPositionFound="noLoanPositionFound";s.noLendingAvailability="noLendingAvailability";s.lendingRepayTooSmall="lendingRepayTooSmall";s.missingState="missingState";s.ledgerSwapNotFound="ledgerSwapNotFound";s.ledgerSwapNotReadyForTracking="ledgerSwapNotReadyForTracking";s.errorEstimatingGas="errorEstimatingGas";s.apiKeyInvalid="apiKeyInvalid";s.apiKeyFailedToUpdate="apiKeyFailedToUpdate";s.apiKeyExpired="apiKeyExpired";s.unauthorized="unauthorized";s.failedToCreateMemo="failedToCreateMemo";s.radixIncorrectInstructions="radixIncorrectInstructions";s.radixTxMissedParam="radixTxMissedParam";s.radixTxMissedAccount="radixTxMissedAccount";s.radixManifestParseError="radixManifestParseError";s.radixManifestBuildError="radixManifestBuildError";s.invalidAddressForChain="invalidAddressForChain";s.riskyAddress="riskyAddress";s.noRoutesToProcess="noRoutesToProcess";s.sellAssetAmountTooSmall="sellAssetAmountTooSmall";s.missingPrivateKey="missingPrivateKey";s.noMemoPriceProtection="noMemoPriceProtection"})(qn||={});var Qn;((t)=>{t.highSlippage="highSlippage";t.highPriceImpact="highPriceImpact"})(Qn||={});var Wn;((B)=>{B.CAVIAR_V1="CAVIAR_V1";B.CAMELOT_V3="CAMELOT_V3";B.CHAINFLIP="CHAINFLIP";B.CHAINFLIP_STREAMING="CHAINFLIP_STREAMING";B.JUPITER="JUPITER";B.MAYACHAIN="MAYACHAIN";B.MAYACHAIN_STREAMING="MAYACHAIN_STREAMING";B.OCISWAP_V1="OCISWAP_V1";B.ONEINCH="ONEINCH";B.OPENOCEAN_V2="OPENOCEAN_V2";B.PANCAKESWAP="PANCAKESWAP";B.PANGOLIN_V1="PANGOLIN_V1";B.SUSHISWAP_V2="SUSHISWAP_V2";B.THORCHAIN="THORCHAIN";B.THORCHAIN_STREAMING="THORCHAIN_STREAMING";B.TRADERJOE_V2="TRADERJOE_V2";B.UNISWAP_V2="UNISWAP_V2";B.UNISWAP_V3="UNISWAP_V3"})(Wn||={});var Vn;((x)=>{x.LIQUIDITY="liquidity";x.NETWORK="network";x.INBOUND="inbound";x.OUTBOUND="outbound";x.AFFILIATE="affiliate";x.TAX="tax";x.PRIORITY="priority"})(Vn||={});var v={},Kn=typeof window!=="undefined"?{}:{referrer:"https://sk.thorswap.net",referer:"https://sk.thorswap.net"};function rh({apiKey:n,...h}){v={...h,apiKey:n}}async function W(n,h){let{apiKey:t,...o}=v,{searchParams:c,json:C,body:a}=h,x={...Kn,...o.headers,...h.headers,...C?{"Content-Type":"application/json"}:{}},i=C?JSON.stringify(C):a,H=new URL(n);if(c)H.search=new URLSearchParams(c).toString();if(t)x["x-api-key"]=t;try{let u=await(await fetch(H.toString(),{...o,...h,body:i,headers:x})).json();if(h.responseHandler)return h.responseHandler(u);return u}catch(F){if(h.onError)return h.onError(F);console.error(F)}}var y={get:async(n,h)=>W(n,{...h,method:"GET"}),post:async(n,h)=>W(n,{...h,method:"POST"}),extend:(n)=>{let h={...v,...n};return{get:async(t,o)=>W(t,{...h,...o,method:"GET"}),post:async(t,o)=>W(t,{...h,...o,method:"POST"}),extend:(t)=>y.extend({...h,...t})}}};var mn={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,core_transaction_invalid_recipient_address:10317,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,wallet_keepkey_not_found:20900,wallet_keepkey_asset_not_defined:20901,wallet_keepkey_contract_address_not_provided:20902,wallet_keepkey_send_transaction_no_address:20903,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,thorchain_preferred_asset_payout_required:40104,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 g extends Error{static ErrorCode=mn;constructor(n,h){let t=typeof n==="string",o=t?n:n.errorKey;if(h)console.error(h,{stack:h?.stack,message:h?.message});super(o,{cause:{code:g.ErrorCode[o],message:`${o}${t?"":`: ${JSON.stringify(n.info)}`}`}});Object.setPrototypeOf(this,g.prototype)}}function ct(n){if(n<0)throw new g({errorKey:"helpers_invalid_number_of_years",info:{numberOfYears:n}});return 10+n}function st(n){if(n<0)throw new g({errorKey:"helpers_invalid_number_of_years",info:{numberOfYears:n}});return Math.round((10+n*1.0512)*10000000000)/10000000000}function Ct(n,h){try{return n()}catch(t){if(h)throw new g(h,t);return console.error(t)}}function at(n){switch(n){case"THOR":return`${n}.RUNE`;case"GAIA":return`${n}.ATOM`;case"BSC":return`${n}`;default:return`${n}.${n}`}}var Un=["production","test"].includes("development"),Hn=new Set;function pn(n,h){if(!Un&&n){if(Hn.has(h))return;Hn.add(h),console.warn(h)}}async function xt(n="thorchain-1"){if(!["thorchain-stagenet-v2","thorchain-1","thorchain-mainnet-v1"].includes(n))return n;try{return(await y.get(`${n!=="thorchain-1"?q("THOR_STAGENET"):q("THOR")}/status`)).result.node_info.network}catch(h){return n}}var Fn=[...Object.values(S),"TERRA"];function An(n=""){let h=n.toUpperCase(),[t]=h.split(".");if(Fn.includes(t))return!0;let[o]=h.split("/");if(Fn.includes(o))return!0;throw new g({errorKey:"helpers_invalid_identifier",info:{message:`Invalid identifier: ${n}. Expected format: <Chain>.<Ticker> or <Chain>.<Ticker>-<ContractAddress>`,identifier:n}})}function Ft(n){if(n.length>30)return!1;let h=/^[a-zA-Z0-9+_-]+$/g;return!!n.match(h)}var Z=8,w=(n)=>10n**BigInt(n),z=(n)=>Math.log10(Number.parseFloat(n.toString()));function X({value:n,bigIntDecimal:h=Z,decimal:t=Z}){if(t===0)return n.toString();let o=n<0n,c=n.toString().substring(o?1:0),C=t-(c.length-1);if(C>0)c="0".repeat(C)+c;let a=c.length-t,x=c.slice(-t);if(Number.parseInt(x[h]||"0")>=5)x=`${x.substring(0,h-1)}${(Number.parseInt(x[h-1]||"0")+1).toString()}`;else x=x.substring(0,h);return`${o?"-":""}${c.slice(0,a)}.${x}`.replace(/\.?0*$/,"")}class j{decimalMultiplier=10n**8n;bigIntValue=0n;decimal;static fromBigInt(n,h){return new j({decimal:h,value:X({value:n,bigIntDecimal:h,decimal:h})})}static shiftDecimals({value:n,from:h,to:t}){return j.fromBigInt(n.getBaseValue("bigint")*w(t)/w(h),t)}constructor(n){let h=E(n),t=typeof n==="object";this.decimal=t?n.decimal:void 0,this.decimalMultiplier=t&&"decimalMultiplier"in n?n.decimalMultiplier:w(Math.max(Bn(V(h)),this.decimal||0)),this.#c(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,h){let t=this.formatBigIntToSafeValue(this.bigIntValue,h||this.decimal||z(this.decimalMultiplier));switch(n){case"number":return Number(t);case"string":return t;case"bigint":return this.bigIntValue*10n**BigInt(this.decimal||8n)/this.decimalMultiplier}}getBaseValue(n,h){let t=this.decimalMultiplier/w(h||this.decimal||A.THOR),o=this.bigIntValue/t;switch(n){case"number":return Number(o);case"string":return o.toString();case"bigint":return o}}getBigIntValue(n,h){if(!h&&typeof n==="object")return n.bigIntValue;let t=E(n),o=V(t);if(o==="0"||o==="undefined")return 0n;return this.#o(o,h)}toSignificant(n=6){let[h,t]=this.getValue("string").split("."),o=h||"",c=t||"";if((Number.parseInt(o)?o.length+c.length:c.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}.${c.slice(0,n-o.length)}`.padEnd(n-o.length,"0");let a=Number.parseInt(c),x=`${a}`.slice(0,n);return`0.${x.padStart(c.length-`${a}`.length+x.length,"0")}`}toFixed(n=6){let[h,t]=this.getValue("string").split("."),o=h||"",c=t||"";if(Number.parseInt(o))return`${o}.${c.slice(0,n)}`.padEnd(n,"0");let C=Number.parseInt(c),a=`${C}`.slice(0,n);return`0.${a.padStart(c.length-`${C}`.length+a.length,"0")}`}toAbbreviation(n=2){let h=this.getValue("number"),t=["","K","M","B","T","Q","Qi","S"],o=Math.floor(Math.log10(Math.abs(h))/3),c=t[o];if(!c)return this.getValue("string");let C=10**(o*3);return`${(h/C).toFixed(n)}${c}`}toCurrency(n="$",{currencyPosition:h="start",decimal:t=2,decimalSeparator:o=".",thousandSeparator:c=","}={}){let C=this.getValue("number"),[a="",x=""]=C.toFixed(6).split("."),i=a.replace(/\B(?=(\d{3})+(?!\d))/g,c),H=a||x?a==="0"?`${Number.parseFloat(`0.${x}`)}`.replace(".",o):`${i}${Number.parseInt(x)?`${o}${x.slice(0,t)}`:""}`:"0.00";return`${h==="start"?n:""}${H}${h==="end"?n:""}`}formatBigIntToSafeValue(n,h){let t=h||this.decimal||Z,o=Math.max(t,z(this.decimalMultiplier)),c=n<0n,C=n.toString().substring(c?1:0),a=o-(C.length-1),x=a>0?"0".repeat(a)+C:C,i=x.length-o,H=x.slice(-o);if(Number.parseInt(H[t]||"0")>=5)H=`${H.substring(0,t-1)}${(Number.parseInt(H[t-1]||"0")+1).toString()}`;else H=H.substring(0,t);return`${c?"-":""}${x.slice(0,i)}.${H}`.replace(/\.?0*$/,"")}#h(n,...h){let t=this.#t(this,...h),o=Math.max(t,z(this.decimalMultiplier)),c=w(o),C=h.reduce((x,i)=>{let H=this.getBigIntValue(i,o);switch(n){case"add":return x+H;case"sub":return x-H;case"mul":return x*H/c;case"div":{if(H===0n)throw new RangeError("Division by zero");return x*c/H}default:return x}},this.bigIntValue*c/this.decimalMultiplier),a=X({bigIntDecimal:o,decimal:o,value:C});return new this.constructor({decimalMultiplier:w(o),decimal:this.decimal,value:a,identifier:this.toString()})}#n(n,...h){let t=this.#t(this,...h),o=this.getBigIntValue(h[0]||"0",t),c=this.getBigIntValue(this,t);switch(n){case"gt":return c>o;case"gte":return c>=o;case"lt":return c<o;case"lte":return c<=o;case"eqValue":return c===o}}#c(n){let h=V(n)||"0";this.bigIntValue=this.#o(h)}#t(...n){let h=n.map((t)=>{return typeof t==="object"?t.decimal||z(t.decimalMultiplier):Bn(V(t))}).filter(Boolean);return Math.max(...h,Z)}#o(n,h){let t=h?w(h):this.decimalMultiplier,o=z(t),[c="",C=""]=n.split(".");return BigInt(`${c}${C.padEnd(o,"0")}`)}}var Dn=Intl.NumberFormat("fullwide",{useGrouping:!1,maximumFractionDigits:20});function V(n){let t=`${typeof n==="number"?Dn.format(n):E(n)}`.replaceAll(",",".").split(".");return t.length>1?`${t.slice(0,-1).join("")}.${t.at(-1)}`:t[0]||"0"}function Bn(n){let h=n.split(".")[1]?.length||0;return Math.max(h,Z)}function E(n){return typeof n==="object"?"getValue"in n?n.getValue("string"):n.value:n}var K=new Map;class O extends j{address;chain;isGasAsset=!1;isSynthetic=!1;isTradeAsset=!1;symbol;tax;ticker;type;chainId;constructor({value:n,decimal:h,tax:t,chain:o,symbol:c,identifier:C}){super(typeof n==="object"?n:{decimal:h,value:n});let a=l(C||`${o}.${c}`);this.type=On(a),this.tax=t,this.chain=a.chain,this.ticker=a.ticker,this.symbol=a.symbol,this.address=a.address,this.isSynthetic=a.isSynthetic,this.isTradeAsset=a.isTradeAsset,this.isGasAsset=a.isGasAsset,this.chainId=an[a.chain]}toString({includeSynthProtocol:n}={}){return(this.isSynthetic||this.isTradeAsset)&&!n?this.symbol:`${this.chain}.${this.symbol}`}toUrl(){return this.isSynthetic?`${this.chain}.${this.symbol.replace("/",".")}`:this.isTradeAsset?`${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){let[t,o,c]=n.split(".");if(!(t&&o))throw new g({errorKey:"helpers_invalid_asset_url",info:{urlAsset:n}});let C=t==="THOR"&&c?`${t}.${o}/${c}`:n;return O.from({asset:C,value:h})}static from({value:n=0,fromBaseDecimal:h,asyncTokenLookup:t,...o}){let c=n instanceof j?n.getValue("string"):n,C="chain"in o,a=C?o.chain:o.asset,x=C||Tn.includes(a),{identifier:i,decimal:H}=x?Nn(a):{identifier:a,decimal:void 0},{chain:F,isSynthetic:u,isTradeAsset:P}=l(i),G=K.get(F==="SOL"?i:i.toUpperCase()),I=G?.decimal||H;pn(!(t||I),`Couldn't find static decimal for ${i} (Using default ${A[F]} 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.`);let{decimal:u,identifier:T,tax:a}=X||{decimal:I||p[A],identifier:N},J=h?U(BigInt(o),h):U(o,u);return t?En(T,h?J:o):_||L?vn(T,J):new g({tax:a,decimal:u,identifier:T,value:J})}static loadStaticAssets(){return new Promise((n,h)=>{try{import("@swapkit/tokens").then((t)=>{for(let c of Object.values(t))for(let{identifier:o,chain:s,...H}of c.tokens)K.set(s!=="SOL"?o.toUpperCase():o,{identifier:o,decimal:"decimals"in H?H.decimals:p[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 g.from({asset:n,value:h,asyncTokenLookup:!0})}static fromIdentifier(n,h=0){return g.from({asset:n,value:h,asyncTokenLookup:!0})}static fromStringSync(n,h=0){return g.from({asset:n,value:h})}static fromStringWithBase(n,h=0n,t=p.THOR){return g.from({asyncTokenLookup:!0,asset:n,value:h,fromBaseDecimal:t})}static fromStringWithBaseSync(n,h=0n,t=p.THOR){return g.from({asset:n,value:h,fromBaseDecimal:t})}static fromIdentifierSync(n,h=0){return g.from({asset:n,value:h})}static fromChainOrSignature(n,h=0){if(Object.values(S).includes(n))return g.from({chain:n,value:h});return g.from({asset:n,value:h})}}function _t(n){let h=g.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 En(n,h=0){pn(n);let c=n.includes("SOL.")?n:n.toUpperCase(),o=K.get(c),s=o?.decimal||await Tn(l(n));if(!o)K.set(c,{identifier:n,decimal:s});return new g({decimal:s,value:U(h,s),identifier:n})}function vn(n,h=0){let t=n.includes(".")?n.split(".")?.[0]?.toUpperCase():void 0,c=t?["MAYA","THOR"].includes(t):!1,o=n.slice(0,14).includes("~")?"~":"/",[s,H]=c?n.split(".").slice(1).join().split(o):n.split(o);if(!(s&&H))throw new $({errorKey:"helpers_invalid_asset_identifier",info:{identifier:n}});return new g({decimal:8,value:U(h,8),identifier:`${t||"THOR"}.${s}${o}${H}`})}function U(n,h){return typeof n==="bigint"?z({value:n,bigIntDecimal:h,decimal:h}):n}function l(n){let h=n.slice(0,14).includes("/"),t=n.slice(0,14).includes("~"),c=t?"~":"/",o=n.split(".")?.[0]?.toUpperCase()==="THOR",s=n.split(".")?.[0]?.toUpperCase()==="MAYA",[H,x=""]=o||s?n.split(".").slice(1).join().split(c):n.split(c);if((h||t)&&!(H&&x))throw new $({errorKey:"helpers_invalid_asset_identifier",info:{identifier:n}});let N=n.includes(".")&&!h&&!t?n:`${s?"MAYA":"THOR"}.${x}`,[F,...A]=N.split("."),_=h||t?x:A.join("."),L=_.split("-"),X=L.length===1?L[0]:L.slice(0,-1).join("-"),I=L.length===1?void 0:L[L.length-1],u=F==="SOL"?I:I?.toLowerCase();return{address:u,chain:F,isGasAsset:r({chain:F,symbol:_}),isSynthetic:h,isTradeAsset:t,ticker:X,symbol:(h||t?`${H}${c}`:"")+(u?`${X}-${u??""}`:_)}}var dn="0x313ce567",kn=[`${"MAYA"}.MAYA`,`${"ETH"}.THOR`,`${"ETH"}.vTHOR`,`${"KUJI"}.USK`],gn=async({chain:n,to:h})=>{try{let{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:dn},"latest"]})});return Number.parseInt(BigInt(t||p[n]).toString())}catch(t){return console.error(t),p[n]}},ln=async({symbol:n})=>{try{let 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),p["XRD"]}},rn=(n)=>{if(n==="ETH")return p.ETH;let h=n.split("-"),t=h.length===1?void 0:h[h.length-1]?.toLowerCase();return t?.startsWith("0x")?gn({chain:"ETH",to:t}):p.ETH},en=(n)=>{let h=n.split("-"),t=h.length===1?void 0:h[h.length-1];return t?.startsWith("0x")?gn({chain:"AVAX",to:t.toLowerCase()}):p.AVAX},nh=(n)=>{if(n==="BSC")return p.BSC;return p.BSC},hh=(n)=>{if(n==="XRD")return p.XRD;return ln({symbol:n})},Tn=({chain:n,symbol:h})=>{switch(n){case"ETH":return rn(h);case"AVAX":return en(h);case"BSC":return nh(h);case"XRD":return hh(h);default:return p[n]}},ut=({chain:n})=>{switch(n){case"ARB":case"BASE":case"OP":return g.from({asset:`${n}.ETH`});case"MAYA":return g.from({asset:`${n}.CACAO`});case"GAIA":return g.from({asset:`${n}.ATOM`});case"BSC":return g.from({asset:`${n}.BNB`});case"THOR":return g.from({asset:`${n}.RUNE`});default:return g.from({asset:`${n}.${n}`})}},r=({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:p[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:p[n]};case"THOR":return{identifier:`${n}.RUNE`,decimal:p[n]};case"BSC":return{identifier:`${n}.BNB`,decimal:p[n]};case"MAYA":return{identifier:`${n}.CACAO`,decimal:10};case"XRD":return{identifier:`${"XRD"}.XRD`,decimal:p[n]};case`${"MAYA"}.MAYA`:return{identifier:n,decimal:4};case`${"KUJI"}.USK`:return{identifier:n,decimal:6};default:return{identifier:`${n}.${n}`,decimal:p[n]}}},On=({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}},wt=(n)=>{let[h,...t]=n.split("."),c=n.includes("/"),o=t.join("."),s=o?.split("-"),H=s?.length?s.length===1?s[0]:s.slice(0,-1).join("-"):void 0;return{chain:h,symbol:o,ticker:H,synth:c}},th=new RegExp(/(.)\1{6}|\.ORG|\.NET|\.FINANCE|\.COM|WWW|HTTP|\\\\|\/\/|[\s$%:[\]]/,"gmi"),ch=(n)=>{let[h,t]=n.split(".");if(!i.includes(h))return!0;let c=t.split("-"),o=c.length===1?void 0:c[c.length-1];return r({chain:h,symbol:t})||!!o},Xt=(n)=>n.filter(({chain:h,value:t,symbol:c})=>{let o=`${h}.${c}`;return!th.test(o)&&ch(o)&&t!=="0"});async function It(n){let h=await import("@swapkit/tokens");for(let t of Object.values(h))for(let{identifier:c,chain:o,...s}of t.tokens){if("identifier"in n&&c===n.identifier)return c;if("address"in s&&"chain"in n&&o===n.chain&&s.address.toLowerCase()===n.contract.toLowerCase())return c}return}var e=(n,h)=>{return[...n.slice(0,n.length-1),h]};function yt([n,h,t,c,o]){return`m/${n}'/${h}'/${t}'/${c}${typeof o!=="number"?"":`/${o}`}`}function zt({chain:n,index:h,addressIndex:t=0,type:c}){if(i.includes(n)){if(c&&["legacy","account"].includes(c))return[44,60,0,h];if(c==="ledgerLive")return[44,60,h,0,t];return e(W[n],h)}if(n==="SOL"){if(c==="account")return[44,501,0,h];return e(W[n],h)}let o=n==="LTC"?2:0;switch(c){case"nativeSegwitMiddleAccount":return[84,o,h,0,t];case"segwit":return[49,o,0,0,h];case"legacy":return[44,o,0,0,h];default:return e(W[n],h)}}function bt(n){let[h,t,c]=n.split("/").map((o)=>Number.parseInt(o,10));switch(t){case 44:return"legacy";case 49:return"p2sh";default:return"bech32"}}function oh({liquidityUnits:n,poolUnits:h,runeDepth:t}){let c=j(n),o=j(h),s=j(t),H=c.mul(s),x=o.mul(o).mul(2),N=o.mul(c).mul(2),F=c.mul(c),A=o.mul(o).mul(o);return H.mul(x.sub(N).add(F)).div(A)}function Ch({liquidityUnits:n,poolUnits:h,assetDepth:t}){let c=j(n),o=j(h),s=j(t),H=c.mul(s),x=o.mul(o).mul(2),N=o.mul(c).mul(2),F=c.mul(c),A=H.mul(x.sub(N).add(F)),_=o.mul(o).mul(o);return A.div(_)}function Qt({percent:n,runeDepth:h,liquidityUnits:t,poolUnits:c}){return oh({runeDepth:h,liquidityUnits:t,poolUnits:c}).mul(n)}function it({percent:n,assetDepth:h,liquidityUnits:t,poolUnits:c}){return Ch({assetDepth:h,liquidityUnits:t,poolUnits:c}).mul(n)}function j(n){return G.fromBigInt(BigInt(n),p.THOR)}function sh({liquidityUnits:n,poolUnits:h,runeDepth:t,assetDepth:c}){return{assetAmount:j(c).mul(n).div(h),runeAmount:j(t).mul(n).div(h)}}function ft({liquidityUnits:n,poolUnits:h,runeDepth:t,assetDepth:c,percent:o}){return Object.fromEntries(Object.entries(sh({liquidityUnits:n,poolUnits:h,runeDepth:t,assetDepth:c})).map(([s,H])=>[s,H.mul(o)]))}function Wt({runeDepth:n,poolUnits:h,assetDepth:t,liquidityUnits:c,runeAmount:o,assetAmount:s}){let H=new G({value:n,decimal:8}),x=new G({value:t,decimal:8}),N=new G({value:h,decimal:8}),F=new G({value:o,decimal:8}),A=new G({value:s,decimal:8}),_=F.mul(x),L=A.mul(H),X=F.mul(A),I=H.mul(x),u=N.mul(_.add(L.add(X.mul(2)))),T=_.add(L.add(I.mul(2))),a=u.div(T),J=j(c).add(a);if(a.getBaseValue("number")===0)return J.div(N).getBaseValue("number");let nn=N.add(J);return J.div(nn).getBaseValue("number")}function Mt({runeAmount:n,assetAmount:h,runeDepth:t,assetDepth:c}){if(n==="0"||h==="0"||t==="0"||c==="0")return 0;let o=j(t),s=j(c),H=j(h),x=j(n),N=H.mul(o).sub(s.mul(x)),F=s.mul(x).add(o.mul(s));return Math.abs(N.div(F).getBaseValue("number"))}function Hh({type:n,address:h}){return`${n}:${h}`}function Rh({address:n,unbondAmount:h}){return`${"UNBOND"}:${n}:${h}`}function mt(n){return Q("POOL+",n)}function xh({chain:n,symbol:h,...t}){return Q(`${"+"}:${n}/${h}`,t)}function Fh({chain:n,symbol:h,address:t,...c}){let o=kh({chain:n,symbol:h}),s=t?`:${t}:`:":";return Q(`${"+"}:${o}${s}`,c)}function Bh({chain:n,symbol:h,basisPoints:t}){return`${"-"}:${n}/${h}:${t}`}function Ah({chain:n,symbol:h,ticker:t,basisPoints:c,targetAsset:o}){let s=n==="ETH"&&t!=="ETH"?`${t}-${h.slice(-3)}`:h,H=o?`:${o}`:"";return`${"-"}:${n}.${s}:${c}${H}`}function Et({basisPoints:n,...h}){return Q(`${"POOL-"}:${n}`,h)}function ph({name:n,chain:h,address:t,owner:c}){let o=`${"~"}:${n}:${h}:${t}`,s=c?`:${c}`:"";return`${o}${s}`}function vt({name:n,chain:h,asset:t,payout:c,owner:o}){return`${"~"}:${n}:${h}:${c}:${o}:${t}`}function Nh(n,{asset:h,address:t,minAmount:c,...o}){let s=`${n}:${h}:${t}`,H=c?`:${c}`:"";return Q(`${s}${H}`,o)}function Q(n,{affiliateAddress:h,affiliateBasisPoints:t}={}){let c=`${n}${h?`:${h}:${t||0}`:""}`;return c.endsWith(":")?c.slice(0,-1):c}function kh({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 dt=(n,h)=>{switch(n){case"LEAVE":case"BOND":return Hh({type:n,address:h?.address});case"UNBOND":return Rh({address:h?.address,unbondAmount:h?.unbondAmount});case"~":return ph(h);case"$+":case"$-":return Nh(n,h);case"+":{let{chain:t,symbol:c,address:o,singleSide:s}=h;if(s)return xh({chain:t,symbol:c});return Fh({chain:t,symbol:c,address:o})}case"-":{let{chain:t,ticker:c,symbol:o,basisPoints:s,targetAssetString:H,singleSide:x}=h;if(x)return Bh({chain:t,symbol:o,basisPoints:s});return Ah({chain:t,ticker:c,symbol:o,basisPoints:s,targetAsset:H})}default:throw new $({errorKey:"helpers_invalid_memo_type",info:{memoType:n}})}};var Th=["approve","approvedAmount","call","sendTransaction","transfer","isApproved","approvedAmount","EIP1193SendTransaction","getFeeData","broadcastTransaction","estimateCall","estimateGasLimit","estimateGasPrices","createContractTxObject"],ah=(n,h,t)=>async(...c)=>{try{await Oh(h,t)}catch(o){throw new $({errorKey:"helpers_failed_to_switch_network",info:{error:o}})}return n(...c)},$n=({provider:n,params:h,method:t})=>{if(!n?.send)throw new $("helpers_not_found_provider");let c=h?Array.isArray(h)?h:[h]:[];return n.send(t,c)},nc=({toolbox:n,chainId:h,provider:t=window.ethereum})=>{let c=Th.reduce((o,s)=>{if(!n[s])return o;let H=n[s];if(typeof H!=="function")return o;return{...o,[s]:ah(H,t,h)}},{});return{...n,...c}},hc=(n,h)=>$n({provider:n,method:"wallet_addEthereumChain",params:[h]}),Oh=(n,h="0x1")=>$n({provider:n,method:"wallet_switchEthereumChain",params:[{chainId:h}]}),tc=(n)=>{window.ethereum?.on("accountsChanged",()=>n()),window.xfi?.ethereum.on("accountsChanged",()=>n())},cc=()=>{let{isTrust:n,isBraveWallet:h,__XDEFI:t,overrideIsMetaMask:c,selectedProvider:o}=window?.ethereum||{};if(n)return"TRUSTWALLET_WEB";if(h)return"BRAVE";if(c&&o?.isCoinbaseWallet)return"COINBASE_WEB";if(t)"XDEFI";return"METAMASK"},oc=(n)=>{return gh().includes(n)},gh=()=>{let n=window?.ethereum&&!window.ethereum?.isBraveWallet,h=window?.xfi||window?.ethereum?.__XDEFI,t=window?.ethereum?.isBraveWallet,c=window?.ethereum?.isTrust||window?.trustwallet,o=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(c)s.push("TRUSTWALLET_WEB");if(o)s.push("COINBASE_WEB");if($h())s.push("OKX_MOBILE");return s};function Cc({chain:n,covalentApiKey:h,ethplorerApiKey:t}){let c=n!=="ETH"&&!h?"covalentApiKey":t?void 0:"ethplorerApiKey";if(c)throw new $({errorKey:"wallet_missing_api_key",info:{missingKey:c}});return{covalentApiKey:h,ethplorerApiKey:t}}function sc(){let n=[];function h(c){if(n.map((o)=>o.info.uuid).includes(c.detail.info.uuid))return;n.push(c.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 $h=()=>{let n=navigator.userAgent,h=/iphone|ipad|ipod|ios/i.test(n),t=/android|XiaoMi|MiuiBrowser/i.test(n),c=h||t,o=/OKApp/i.test(n);return c&&o},Hc=()=>typeof window.ethereum!=="undefined";class G extends w{eq(n){return this.eqValue(n)}static fromBigInt(n,h){return new G({decimal:h,value:z({value:n,bigIntDecimal:h,decimal:h})})}}export{Ct as wrapWithThrow,ah as wrapMethodWithNetworkSwitch,Bn as warnOnce,Bt as validateTNS,pn as validateIdentifier,e as updatedLastIndex,Oh as switchEVMWalletNetwork,lh as setRequestClientConfig,nc as prepareNetworkSwitch,$h as okxMobileEnabled,gh as listWeb3EVMWallets,Hc as isWeb3Detected,r as isGasAsset,oc as isDetected,Xh as initializeRPCUrlsWithFallback,bt as getWalletFormatFor,ct as getTHORNameCost,ft as getSymmetricWithdraw,sh as getSymmetricPoolShare,f as getRPCUrl,_t as getMinAmountByChain,Ah as getMemoForWithdraw,Rh as getMemoForUnbond,Bh as getMemoForSaverWithdraw,xh as getMemoForSaverDeposit,Et as getMemoForRunePoolWithdraw,mt as getMemoForRunePoolDeposit,ph as getMemoForNameRegister,vt as getMemoForNamePreferredAssetRegister,Nh as getMemoForLoan,Hh as getMemoForLeaveAndBond,Fh as getMemoForDeposit,dt as getMemoFor,ot as getMAYANameCost,Mt as getLiquiditySlippage,ut as getGasAsset,Wt as getEstimatedPoolShare,cc as getETHDefaultWallet,sc as getEIP6963Wallets,Ht as getDynamicChainId,zt as getDerivationPathFor,Tn as getDecimal,an as getCommonAssetInfo,st as getChainIdentifier,Qt as getAsymmetricRuneWithdrawAmount,oh as getAsymmetricRuneShare,it as getAsymmetricAssetWithdrawAmount,Ch as getAsymmetricAssetShare,On as getAssetType,z as formatBigIntToSafeValue,It as findAssetBy,Xt as filterAssets,Cc as ensureEVMApiKeys,yt as derivationPathToString,Kn as defaultRequestHeaders,wt as assetFromString,hc as addEVMWalletNetwork,tc as addAccountsChangedCallback,Wn as WarningCodeEnum,Rn as WalletOption,Lh as UTXOChains,uh as TCSupportedChains,G as SwapKitNumber,$ as SwapKitError,jh as SubstrateChains,m as StagenetChain,bh as SWAP_OUT,zh as SWAP_IN,y as RequestClient,Cn as RPC_URLS,bn as RPCUrl,Pn as QuoteMode,Mn as ProviderName,W as NetworkDerivationPath,xn as MemoType,wh as MAYASupportedChains,Yn as LedgerErrorCode,Vn as FeeTypeEnum,qn as FeeOption,un as FALLBACK_URLS,Zn as ExplorerUrl,fn as ErrorCode,wn as EXPLORER_URLS,i as EVMChains,zn as DerivationPath,Gh as CosmosChains,yn as ContractAddress,kn as CommonAssetStrings,E as ChainToRPC,Ih as ChainToHexChainId,Jh as ChainToExplorerUrl,Hn as ChainToChainId,Sh as ChainIdToChain,b as ChainId,S as Chain,w as BigIntArithmetics,p as BaseDecimal,g as AssetValue,Qn as ApproveMode,yh as AGG_SWAP};
or by passing asyncTokenLookup: true to the from() function, which will make it async and return a promise.`);let{decimal:L,identifier:k,tax:f}=G||{decimal:I||A[F],identifier:i},B=h?m(BigInt(c),h):m(c,L);return t?dn(k,h?B:c):u||P?vn(k,B):new O({tax:f,decimal:L,identifier:k,value:B})}static loadStaticAssets(){return new Promise((n,h)=>{try{import("@swapkit/tokens").then((t)=>{for(let o of Object.values(t))for(let{identifier:c,chain:C,...a}of o.tokens)K.set(C!=="SOL"?c.toUpperCase():c,{identifier:c,decimal:"decimals"in a?a.decimals:A[C]});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=A.THOR){return O.from({asyncTokenLookup:!0,asset:n,value:h,fromBaseDecimal:t})}static fromStringWithBaseSync(n,h=0n,t=A.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(S).includes(n))return O.from({chain:n,value:h});return O.from({asset:n,value:h})}}function St(n){let 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 dn(n,h=0){An(n);let o=n.includes("SOL.")?n:n.toUpperCase(),c=K.get(o),C=c?.decimal||await kn(l(n));if(!c)K.set(o,{identifier:n,decimal:C});return new O({decimal:C,value:m(h,C),identifier:n})}function vn(n,h=0){let t=n.includes(".")?n.split(".")?.[0]?.toUpperCase():void 0,o=t?["MAYA","THOR"].includes(t):!1,c=n.slice(0,14).includes("~")?"~":"/",[C,a]=o?n.split(".").slice(1).join().split(c):n.split(c);if(!(C&&a))throw new g({errorKey:"helpers_invalid_asset_identifier",info:{identifier:n}});return new O({decimal:8,value:m(h,8),identifier:`${t||"THOR"}.${C}${c}${a}`})}function m(n,h){return typeof n==="bigint"?X({value:n,bigIntDecimal:h,decimal:h}):n}function l(n){let h=n.slice(0,14).includes("/"),t=n.slice(0,14).includes("~"),o=t?"~":"/",c=n.split(".")?.[0]?.toUpperCase()==="THOR",C=n.split(".")?.[0]?.toUpperCase()==="MAYA",[a,x=""]=c||C?n.split(".").slice(1).join().split(o):n.split(o);if((h||t)&&!(a&&x))throw new g({errorKey:"helpers_invalid_asset_identifier",info:{identifier:n}});let i=n.includes(".")&&!h&&!t?n:`${C?"MAYA":"THOR"}.${x}`,[H,...F]=i.split("."),u=h||t?x:F.join("."),P=u.split("-"),G=P.length===1?P[0]:P.slice(0,-1).join("-"),I=P.length===1?void 0:P[P.length-1],L=H==="SOL"?I:I?.toLowerCase();return{address:L,chain:H,isGasAsset:r({chain:H,symbol:u}),isSynthetic:h,isTradeAsset:t,ticker:G,symbol:(h||t?`${a}${o}`:"")+(L?`${G}-${L??""}`:u)}}var En="0x313ce567",Tn=[`${"MAYA"}.MAYA`,`${"ETH"}.THOR`,`${"ETH"}.vTHOR`,`${"KUJI"}.USK`],gn=async({chain:n,to:h})=>{try{let{result:t}=await y.post(d[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:En},"latest"]})});return Number.parseInt(BigInt(t||A[n]).toString())}catch(t){return console.error(t),A[n]}},ln=async({symbol:n})=>{try{let h=n.split("-")[1]?.toLowerCase(),{manager:t}=await y.post(`${d["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),A["XRD"]}},rn=(n)=>{if(n==="ETH")return A.ETH;let h=n.split("-"),t=h.length===1?void 0:h[h.length-1]?.toLowerCase();return t?.startsWith("0x")?gn({chain:"ETH",to:t}):A.ETH},en=(n)=>{let h=n.split("-"),t=h.length===1?void 0:h[h.length-1];return t?.startsWith("0x")?gn({chain:"AVAX",to:t.toLowerCase()}):A.AVAX},nh=(n)=>{if(n==="BSC")return A.BSC;return A.BSC},hh=(n)=>{if(n==="XRD")return A.XRD;return ln({symbol:n})},kn=({chain:n,symbol:h})=>{switch(n){case"ETH":return rn(h);case"AVAX":return en(h);case"BSC":return nh(h);case"XRD":return hh(h);default:return A[n]}},jt=({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}`})}},r=({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}},Nn=(n)=>{switch(n){case"ARB":case"BASE":case"OP":return{identifier:`${n}.ETH`,decimal:A[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:A[n]};case"THOR":return{identifier:`${n}.RUNE`,decimal:A[n]};case"BSC":return{identifier:`${n}.BNB`,decimal:A[n]};case"MAYA":return{identifier:`${n}.CACAO`,decimal:10};case"XRD":return{identifier:`${"XRD"}.XRD`,decimal:A[n]};case`${"MAYA"}.MAYA`:return{identifier:n,decimal:4};case`${"KUJI"}.USK`:return{identifier:n,decimal:6};default:return{identifier:`${n}.${n}`,decimal:A[n]}}},On=({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}},Gt=(n)=>{let[h,...t]=n.split("."),o=n.includes("/"),c=t.join("."),C=c?.split("-"),a=C?.length?C.length===1?C[0]:C.slice(0,-1).join("-"):void 0;return{chain:h,symbol:c,ticker:a,synth:o}},th=new RegExp(/(.)\1{6}|\.ORG|\.NET|\.FINANCE|\.COM|WWW|HTTP|\\\\|\/\/|[\s$%:[\]]/,"gmi"),oh=(n)=>{let[h,t]=n.split(".");if(!M.includes(h))return!0;let o=t.split("-"),c=o.length===1?void 0:o[o.length-1];return r({chain:h,symbol:t})||!!c},It=(n)=>n.filter(({chain:h,value:t,symbol:o})=>{let c=`${h}.${o}`;return!th.test(c)&&oh(c)&&t!=="0"});async function wt(n){let h=await import("@swapkit/tokens");for(let t of Object.values(h))for(let{identifier:o,chain:c,...C}of t.tokens){if("identifier"in n&&o===n.identifier)return o;if("address"in C&&"chain"in n&&c===n.chain&&C.address.toLowerCase()===n.contract.toLowerCase())return o}return}var e=(n,h)=>{return[...n.slice(0,n.length-1),h]};function Jt([n,h,t,o,c]){return`m/${n}'/${h}'/${t}'/${o}${typeof c!=="number"?"":`/${c}`}`}function bt({chain:n,index:h,addressIndex:t=0,type:o}){if(M.includes(n)){if(o&&["legacy","account"].includes(o))return[44,60,0,h];if(o==="ledgerLive")return[44,60,h,0,t];return e(Q[n],h)}if(n==="SOL"){if(o==="account")return[44,501,0,h];return e(Q[n],h)}let c=n==="LTC"?2:0;switch(o){case"nativeSegwitMiddleAccount":return[84,c,h,0,t];case"segwit":return[49,c,0,0,h];case"legacy":return[44,c,0,0,h];default:return e(Q[n],h)}}function zt(n){let[h,t,o]=n.split("/").map((c)=>Number.parseInt(c,10));switch(t){case 44:return"legacy";case 49:return"p2sh";default:return"bech32"}}function ch({liquidityUnits:n,poolUnits:h,runeDepth:t}){let o=_(n),c=_(h),C=_(t),a=o.mul(C),x=c.mul(c).mul(2),i=c.mul(o).mul(2),H=o.mul(o),F=c.mul(c).mul(c);return a.mul(x.sub(i).add(H)).div(F)}function sh({liquidityUnits:n,poolUnits:h,assetDepth:t}){let o=_(n),c=_(h),C=_(t),a=o.mul(C),x=c.mul(c).mul(2),i=c.mul(o).mul(2),H=o.mul(o),F=a.mul(x.sub(i).add(H)),u=c.mul(c).mul(c);return F.div(u)}function Mt({percent:n,runeDepth:h,liquidityUnits:t,poolUnits:o}){return ch({runeDepth:h,liquidityUnits:t,poolUnits:o}).mul(n)}function qt({percent:n,assetDepth:h,liquidityUnits:t,poolUnits:o}){return sh({assetDepth:h,liquidityUnits:t,poolUnits:o}).mul(n)}function _(n){return $.fromBigInt(BigInt(n),A.THOR)}function Ch({liquidityUnits:n,poolUnits:h,runeDepth:t,assetDepth:o}){return{assetAmount:_(o).mul(n).div(h),runeAmount:_(t).mul(n).div(h)}}function Qt({liquidityUnits:n,poolUnits:h,runeDepth:t,assetDepth:o,percent:c}){return Object.fromEntries(Object.entries(Ch({liquidityUnits:n,poolUnits:h,runeDepth:t,assetDepth:o})).map(([C,a])=>[C,a.mul(c)]))}function Wt({runeDepth:n,poolUnits:h,assetDepth:t,liquidityUnits:o,runeAmount:c,assetAmount:C}){let a=new $({value:n,decimal:8}),x=new $({value:t,decimal:8}),i=new $({value:h,decimal:8}),H=new $({value:c,decimal:8}),F=new $({value:C,decimal:8}),u=H.mul(x),P=F.mul(a),G=H.mul(F),I=a.mul(x),L=i.mul(u.add(P.add(G.mul(2)))),k=u.add(P.add(I.mul(2))),f=L.div(k),B=_(o).add(f);if(f.getBaseValue("number")===0)return B.div(i).getBaseValue("number");let nn=i.add(B);return B.div(nn).getBaseValue("number")}function Vt({runeAmount:n,assetAmount:h,runeDepth:t,assetDepth:o}){if(n==="0"||h==="0"||t==="0"||o==="0")return 0;let c=_(t),C=_(o),a=_(h),x=_(n),i=a.mul(c).sub(C.mul(x)),H=C.mul(x).add(c.mul(C));return Math.abs(i.div(H).getBaseValue("number"))}function ah({type:n,address:h}){return`${n}:${h}`}function xh({address:n,unbondAmount:h}){return`${"UNBOND"}:${n}:${h}`}function dt(n){return Y("POOL+",n)}function Rh({chain:n,symbol:h,...t}){return Y(`${"+"}:${n}/${h}`,t)}function Hh({chain:n,symbol:h,address:t,...o}){let c=ih({chain:n,symbol:h}),C=t?`:${t}:`:":";return Y(`${"+"}:${c}${C}`,o)}function ph({chain:n,symbol:h,basisPoints:t}){return`${"-"}:${n}/${h}:${t}`}function Fh({chain:n,symbol:h,ticker:t,basisPoints:o,targetAsset:c}){let C=n==="ETH"&&t!=="ETH"?`${t}-${h.slice(-3)}`:h,a=c?`:${c}`:"";return`${"-"}:${n}.${C}:${o}${a}`}function vt({basisPoints:n,...h}){return Y(`${"POOL-"}:${n}`,h)}function Ah({name:n,chain:h,address:t,owner:o}){let c=`${"~"}:${n}:${h}:${t}`,C=o?`:${o}`:"";return`${c}${C}`}function Et({name:n,chain:h,asset:t,payout:o,owner:c}){return`${"~"}:${n}:${h}:${o}:${c}:${t}`}function Bh(n,{asset:h,address:t,minAmount:o,...c}){let C=`${n}:${h}:${t}`,a=o?`:${o}`:"";return Y(`${C}${a}`,c)}function Y(n,{affiliateAddress:h,affiliateBasisPoints:t}={}){let o=`${n}${h?`:${h}:${t||0}`:""}`;return o.endsWith(":")?o.slice(0,-1):o}function ih({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 lt=(n,h)=>{switch(n){case"LEAVE":case"BOND":return ah({type:n,address:h?.address});case"UNBOND":return xh({address:h?.address,unbondAmount:h?.unbondAmount});case"~":return Ah(h);case"$+":case"$-":return Bh(n,h);case"+":{let{chain:t,symbol:o,address:c,singleSide:C}=h;if(C)return Rh({chain:t,symbol:o});return Hh({chain:t,symbol:o,address:c})}case"-":{let{chain:t,ticker:o,symbol:c,basisPoints:C,targetAssetString:a,singleSide:x}=h;if(x)return ph({chain:t,symbol:c,basisPoints:C});return Fh({chain:t,ticker:o,symbol:c,basisPoints:C,targetAsset:a})}default:throw new g({errorKey:"helpers_invalid_memo_type",info:{memoType:n}})}};var Th=["approve","approvedAmount","call","sendTransaction","transfer","isApproved","approvedAmount","EIP1193SendTransaction","getFeeData","broadcastTransaction","estimateCall","estimateGasLimit","estimateGasPrices","createContractTxObject"],kh=(n,h,t)=>async(...o)=>{try{await Nh(h,t)}catch(c){throw new g({errorKey:"helpers_failed_to_switch_network",info:{error:c}})}return n(...o)},un=({provider:n,params:h,method:t})=>{if(!n?.send)throw new g("helpers_not_found_provider");let o=h?Array.isArray(h)?h:[h]:[];return n.send(t,o)},ho=({toolbox:n,chainId:h,provider:t=window.ethereum})=>{let o=Th.reduce((c,C)=>{if(!n[C])return c;let a=n[C];if(typeof a!=="function")return c;return{...c,[C]:kh(a,t,h)}},{});return{...n,...o}},to=(n,h)=>un({provider:n,method:"wallet_addEthereumChain",params:[h]}),Nh=(n,h="0x1")=>un({provider:n,method:"wallet_switchEthereumChain",params:[{chainId:h}]}),oo=(n)=>{window.ethereum?.on("accountsChanged",()=>n()),window.xfi?.ethereum.on("accountsChanged",()=>n())},co=()=>{let{isTrust:n,isBraveWallet:h,__XDEFI:t,overrideIsMetaMask:o,selectedProvider:c}=window?.ethereum||{};if(n)return"TRUSTWALLET_WEB";if(h)return"BRAVE";if(o&&c?.isCoinbaseWallet)return"COINBASE_WEB";if(t)"XDEFI";return"METAMASK"},so=(n)=>{return Oh().includes(n)},Oh=()=>{let n=window?.ethereum&&!window.ethereum?.isBraveWallet,h=window?.xfi||window?.ethereum?.__XDEFI,t=window?.ethereum?.isBraveWallet,o=window?.ethereum?.isTrust||window?.trustwallet,c=window?.ethereum?.overrideIsMetaMask&&window?.ethereum?.selectedProvider?.isCoinbaseWallet||window?.coinbaseWalletExtension,C=[];if(n)C.push("METAMASK");if(h)C.push("XDEFI");if(t)C.push("BRAVE");if(o)C.push("TRUSTWALLET_WEB");if(c)C.push("COINBASE_WEB");if(gh())C.push("OKX_MOBILE");return C};function Co({chain:n,covalentApiKey:h,ethplorerApiKey:t}){let o=n!=="ETH"&&!h?"covalentApiKey":t?void 0:"ethplorerApiKey";if(o)throw new g({errorKey:"wallet_missing_api_key",info:{missingKey:o}});return{covalentApiKey:h,ethplorerApiKey:t}}function ao(){let n=[];function h(o){if(n.map((c)=>c.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 gh=()=>{let n=navigator.userAgent,h=/iphone|ipad|ipod|ios/i.test(n),t=/android|XiaoMi|MiuiBrowser/i.test(n),o=h||t,c=/OKApp/i.test(n);return o&&c},xo=()=>typeof window.ethereum!=="undefined";class $ extends j{eq(n){return this.eqValue(n)}static fromBigInt(n,h){return new $({decimal:h,value:X({value:n,bigIntDecimal:h,decimal:h})})}}export{Ct as wrapWithThrow,kh as wrapMethodWithNetworkSwitch,pn as warnOnce,Ft as validateTNS,An as validateIdentifier,e as updatedLastIndex,Nh as switchEVMWalletNetwork,rh as setRequestClientConfig,ho as prepareNetworkSwitch,gh as okxMobileEnabled,Oh as listWeb3EVMWallets,xo as isWeb3Detected,r as isGasAsset,so as isDetected,Ih as initializeRPCUrlsWithFallback,zt as getWalletFormatFor,ct as getTHORNameCost,Qt as getSymmetricWithdraw,Ch as getSymmetricPoolShare,q as getRPCUrl,St as getMinAmountByChain,Fh as getMemoForWithdraw,xh as getMemoForUnbond,ph as getMemoForSaverWithdraw,Rh as getMemoForSaverDeposit,vt as getMemoForRunePoolWithdraw,dt as getMemoForRunePoolDeposit,Ah as getMemoForNameRegister,Et as getMemoForNamePreferredAssetRegister,Bh as getMemoForLoan,ah as getMemoForLeaveAndBond,Hh as getMemoForDeposit,lt as getMemoFor,st as getMAYANameCost,Vt as getLiquiditySlippage,jt as getGasAsset,Wt as getEstimatedPoolShare,co as getETHDefaultWallet,ao as getEIP6963Wallets,xt as getDynamicChainId,bt as getDerivationPathFor,kn as getDecimal,Nn as getCommonAssetInfo,at as getChainIdentifier,Mt as getAsymmetricRuneWithdrawAmount,ch as getAsymmetricRuneShare,qt as getAsymmetricAssetWithdrawAmount,sh as getAsymmetricAssetShare,On as getAssetType,X as formatBigIntToSafeValue,wt as findAssetBy,It as filterAssets,Co as ensureEVMApiKeys,Jt as derivationPathToString,Kn as defaultRequestHeaders,Gt as assetFromString,to as addEVMWalletNetwork,oo as addAccountsChangedCallback,Qn as WarningCodeEnum,xn as WalletOption,$h as UTXOChains,jh as TCSupportedChains,$ as SwapKitNumber,g as SwapKitError,Ph as SubstrateChains,D as StagenetChain,zh as SWAP_OUT,bh as SWAP_IN,y as RequestClient,sn as RPC_URLS,zn as RPCUrl,Xn as QuoteMode,Wn as ProviderName,Q as NetworkDerivationPath,Rn as MemoType,Gh as MAYASupportedChains,Yn as LedgerErrorCode,Vn as FeeTypeEnum,fn as FeeOption,jn as FALLBACK_URLS,Zn as ExplorerUrl,qn as ErrorCode,Gn as EXPLORER_URLS,M as EVMChains,bn as DerivationPath,Lh as CosmosChains,Jn as ContractAddress,Tn as CommonAssetStrings,d as ChainToRPC,wh as ChainToHexChainId,yh as ChainToExplorerUrl,an as ChainToChainId,Sh as ChainIdToChain,J as ChainId,S as Chain,_h as BlockTimes,j as BigIntArithmetics,A as BaseDecimal,O as AssetValue,Mn as ApproveMode,Jh as AGG_SWAP};
//# debugId=42C1CF396DCEFFFB64756E2164756E21
//# debugId=4979AA11F158DE2F64756E2164756E21

@@ -9,8 +9,8 @@ {

"devDependencies": {
"@swapkit/toolbox-cosmos": "1.5.2",
"@swapkit/toolbox-evm": "1.7.2",
"@swapkit/toolbox-radix": "1.2.18",
"@swapkit/toolbox-solana": "1.3.2",
"@swapkit/toolbox-substrate": "1.3.2",
"@swapkit/toolbox-utxo": "1.2.2"
"@swapkit/toolbox-cosmos": "1.5.3",
"@swapkit/toolbox-evm": "1.7.3",
"@swapkit/toolbox-radix": "1.2.19",
"@swapkit/toolbox-solana": "1.3.3",
"@swapkit/toolbox-substrate": "1.3.3",
"@swapkit/toolbox-utxo": "1.2.3"
},

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

"types": "./src/index.ts",
"version": "1.16.0"
"version": "1.17.0"
}

@@ -122,2 +122,25 @@ export enum Chain {

export const BlockTimes: Record<Partial<Chain>, number> = {
[Chain.Arbitrum]: 0.3,
[Chain.Avalanche]: 3,
[Chain.Base]: 2,
[Chain.BinanceSmartChain]: 3,
[Chain.Bitcoin]: 600,
[Chain.BitcoinCash]: 600,
[Chain.Chainflip]: 5,
[Chain.Cosmos]: 2,
[Chain.Dash]: 150,
[Chain.Dogecoin]: 600,
[Chain.Ethereum]: 12.5,
[Chain.Kujira]: 2.2,
[Chain.Litecoin]: 150,
[Chain.Maya]: 6,
[Chain.Optimism]: 2,
[Chain.Polkadot]: 6,
[Chain.Polygon]: 2.1,
[Chain.Radix]: 5,
[Chain.Solana]: 0.4,
[Chain.THORChain]: 6,
};
export type SubstrateChain = Chain.Polkadot | Chain.Chainflip;

@@ -124,0 +147,0 @@ export const SubstrateChains = [Chain.Polkadot, Chain.Chainflip];

@@ -38,5 +38,8 @@ export enum ErrorCode {

txParsingError = "txParsingError",
txLogsParsingError = "txLogsParsingError",
blockNotFound = "blockNotFound",
balanceNotFound = "balanceNotFound",
configError = "configError",
synthSwapDisallowed = "synthSwapDisallowed",
providerQuoteTimeout = "providerQuoteTimeout",
noQuoteResponse = "noQuoteResponse",

@@ -46,2 +49,3 @@ noPoolAssetsFound = "noPoolAssetsFound",

noMayachainPools = "noMayachainPools",
noThorchainNetworkInfo = "noThorchainNetworkInfo",
invalidAffiliateFee = "invalidAffiliateFee",

@@ -57,2 +61,6 @@ invalidBuyAssetAddress = "invalidBuyAssetAddress",

unsupportedEVMChainId = "unsupportedEVMChainId",
unsupportedMethod = "unsupportedMethod",
unsupportedProvider = "unsupportedProvider",
invalidParamsForMethod = "invalidParamsForMethod",
unsupportedAdapter = "unsupportedAdapter",
noWhitelistTokens = "noWhitelistTokens",

@@ -65,2 +73,3 @@ failedFetchGasPrice = "failedFetchGasPrice",

tokenPriceNotFound = "tokenPriceNotFound",
tokenPriceFailedToUpdate = "tokenPriceFailedToUpdate",
swapAmountTooSmall = "swapAmountTooSmall",

@@ -73,3 +82,5 @@ legsArrayIsEmpty = "legsArrayIsEmpty",

noLiquidtyProvidersFound = "noLiquidtyProvidersFound",
insufficientLiquidity = "insufficientLiquidity",
noSaversFound = "noSaversFound",
noInboundDataFound = "noInbounDataFound",
noInboundAddressesFound = "noInboundAddressesFound",

@@ -84,2 +95,3 @@ noInboundAddressFoundForChain = "noInboundAddressFoundForChain",

ledgerSignFailed = "ledgerSignFailed",
ledgerWrongPayload = "ledgerWrongPayload",
ledgerFetchSwapFailed = "ledgerFetchSwapFailed",

@@ -94,2 +106,3 @@ failedToFetchTx = "failedToFetchTx",

invalidAffiliate = "invalidAffiliate",
thornameAffiliate = "thornameAffiliate",
providerNotfound = "No provider found",

@@ -104,2 +117,3 @@ noRecordFound = "No Record found",

trackerError = "trackerError",
thorchainPoolUnavailable = "thorchainPoolUnavailable",
noOhlcvDataFound = "noOhlcvDataFound",

@@ -120,3 +134,12 @@ noTradingPairs = "noTradingPairs",

radixIncorrectInstructions = "radixIncorrectInstructions",
radixTxMissedParam = "radixTxMissedParam",
radixTxMissedAccount = "radixTxMissedAccount",
radixManifestParseError = "radixManifestParseError",
radixManifestBuildError = "radixManifestBuildError",
invalidAddressForChain = "invalidAddressForChain",
riskyAddress = "riskyAddress",
noRoutesToProcess = "noRoutesToProcess",
sellAssetAmountTooSmall = "sellAssetAmountTooSmall",
missingPrivateKey = "missingPrivateKey",
noMemoPriceProtection = "noMemoPriceProtection",
}

@@ -133,2 +156,3 @@

CHAINFLIP = "CHAINFLIP",
CHAINFLIP_STREAMING = "CHAINFLIP_STREAMING",
JUPITER = "JUPITER",

@@ -157,2 +181,3 @@ MAYACHAIN = "MAYACHAIN",

TAX = "tax",
PRIORITY = "priority",
}

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