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 2.0.0 to 2.1.0

6

dist/index.js

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

var Pn=Object.create;var{getPrototypeOf:_n,defineProperty:tn,getOwnPropertyNames:$n}=Object;var Ln=Object.prototype.hasOwnProperty;var on=(n,h,t)=>{t=n!=null?Pn(_n(n)):{};let o=h||!n||!n.__esModule?tn(t,"default",{value:n,enumerable:!0}):t;for(let c of $n(n))if(!Ln.call(o,c))tn(o,c,{get:()=>n[c],enumerable:!0});return o};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 P;((O)=>{O.Arbitrum="ARB";O.Avalanche="AVAX";O.Base="BASE";O.BinanceSmartChain="BSC";O.Bitcoin="BTC";O.BitcoinCash="BCH";O.Cosmos="GAIA";O.Dash="DASH";O.Dogecoin="DOGE";O.Ethereum="ETH";O.Fiat="FIAT";O.Kujira="KUJI";O.Litecoin="LTC";O.Maya="MAYA";O.Optimism="OP";O.Polkadot="DOT";O.Chainflip="FLIP";O.Polygon="MATIC";O.Radix="XRD";O.THORChain="THOR";O.Solana="SOL"})(P||={});var v;((t)=>{t.THORChain="THOR_STAGENET";t.Maya="MAYA_STAGENET"})(v||={});var z;((H)=>{H.Arbitrum="42161";H.ArbitrumHex="0xa4b1";H.Avalanche="43114";H.AvalancheHex="0xa86a";H.Base="8453";H.BaseHex="0x2105";H.BinanceSmartChain="56";H.BinanceSmartChainHex="0x38";H.Bitcoin="bitcoin";H.BitcoinCash="bitcoincash";H.Chainflip="chainflip";H.Cosmos="cosmoshub-4";H.Dash="dash";H.Dogecoin="dogecoin";H.Kujira="kaiyo-1";H.Ethereum="1";H.EthereumHex="0x1";H.Fiat="fiat";H.Litecoin="litecoin";H.Maya="mayachain-mainnet-v1";H.MayaStagenet="mayachain-stagenet-v1";H.Optimism="10";H.OptimismHex="0xa";H.Polkadot="polkadot";H.Polygon="137";H.PolygonHex="0x89";H.Radix="radix-mainnet";H.THORChain="thorchain-1";H.THORChainStagenet="thorchain-stagenet-v2";H.Solana="solana"})(z||={});var Ph={["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",["fiat"]:"FIAT",["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"},jn=Object.keys(P),f=Object.values(P),p={ARB:18,AVAX:18,BASE:18,BCH:8,BSC:18,BTC:8,DASH:8,DOGE:8,DOT:10,ETH:18,FIAT:2,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,["FIAT"]:60,["KUJI"]:2.2,["LTC"]:150,["MAYA"]:6,["OP"]:2,["DOT"]:6,["MATIC"]:2.1,["XRD"]:5,["SOL"]:0.4,["THOR"]:6},$h=["DOT","FLIP"],Q=["ARB","AVAX","BASE","BSC","ETH","OP","MATIC"],Lh=["BTC","BCH","DASH","DOGE","LTC"],jh=["GAIA","THOR","MAYA","KUJI"],Gh=["AVAX","BSC","BTC","BCH","GAIA","DOGE","ETH","LTC","THOR"],Ih=["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",["FIAT"]:"",["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"},Gn={["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"],["FIAT"]:[],["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"]},In={["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",["FIAT"]:"",["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,W=(n)=>{return d[n]},wn=(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 yn(n){switch(n){case"XRD":return"/status/network-configuration";default:return""}}var sn=async(n,h)=>{try{let t=h.startsWith("wss")?h.replace("wss","https"):h;return(await fetch(`${t}${yn(n)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(wn(n)),signal:AbortSignal.timeout(3000)})).ok}catch{return!1}},Xn=async(n)=>{let h=Cn[n];if(await sn(n,h))return h;for(let t of Gn[n])if(await sn(n,t))return t;return h},wh=async(n=[...Object.values(P),...Object.values(v)])=>{let h={};await Promise.all(n.map(async(t)=>{let o=await Xn(t);h[t]=o})),d={...d,...h}},an=f.reduce((n,h)=>{let t=jn.find((o)=>P[o]===h);if(t)n[h]=t;return n},{}),xn=f.reduce((n,h)=>{return n[h]=z[an[h]],n},{}),E=f.reduce((n,h)=>{return n[h]=W(h),n},{}),yh=f.reduce((n,h)=>{let t=`${an[h]}Hex`;return n[h]=z[t],n},{}),Xh=f.reduce((n,h)=>{return n[h]=In[h],n},{});var bn;((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"})(bn||={});var Jh=["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"],fh=["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 zn;((i)=>{i.ARB="m/44'/60'/0'/0";i.AVAX="m/44'/60'/0'/0";i.BASE="m/44'/60'/0'/0";i.BCH="m/44'/145'/0'/0";i.BSC="m/44'/60'/0'/0";i.BTC="m/84'/0'/0'/0";i.DASH="m/44'/5'/0'/0";i.DOGE="m/44'/3'/0'/0";i.DOT="////";i.ETH="m/44'/60'/0'/0";i.FLIP="////";i.GAIA="m/44'/118'/0'/0";i.KUJI="m/44'/118'/0'/0";i.LTC="m/84'/2'/0'/0";i.MATIC="m/44'/60'/0'/0";i.MAYA="m/44'/931'/0'/0";i.OP="m/44'/60'/0'/0";i.SOL="m/44'/501'/0'/0";i.THOR="m/44'/931'/0'/0";i.XRD="////"})(zn||={});var K={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],DOT:[0,0,0,0,0],FIAT:[0,0,0,0,0],FLIP:[0,0,0,0,0],XRD:[0,0,0,0,0]};var fn;((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"})(fn||={});var Zn;((i)=>{i.Arbitrum="https://arbiscan.io";i.Avalanche="https://snowtrace.io";i.Base="https://basescan.org";i.BinanceSmartChain="https://bscscan.com";i.Bitcoin="https://blockchair.com/bitcoin";i.BitcoinCash="https://www.blockchair.com/bitcoin-cash";i.Chainflip="https://explorer.polkascan.io/polkadot";i.Cosmos="https://www.mintscan.io/cosmos";i.Dash="https://blockchair.com/dash";i.Dogecoin="https://blockchair.com/dogecoin";i.Ethereum="https://etherscan.io";i.Kujira="https://finder.kujira.network/kaiyo-1";i.Litecoin="https://blockchair.com/litecoin";i.Maya="https://www.mayascan.org";i.Optimism="https://optimistic.etherscan.io";i.Polkadot="https://polkadot.subscan.io";i.Polygon="https://polygonscan.com";i.Radix="https://dashboard.radixdlt.com";i.THORChain="https://runescan.io";i.Solana="https://solscan.io"})(Zn||={});var Rn;((B)=>{B.BRAVE="BRAVE";B.COINBASE_MOBILE="COINBASE_MOBILE";B.COINBASE_WEB="COINBASE_WEB";B.CTRL="CTRL";B.EIP6963="EIP6963";B.EXODUS="EXODUS";B.KEEPKEY="KEEPKEY";B.KEEPKEY_BEX="KEEPKEY_BEX";B.KEPLR="KEPLR";B.KEYSTORE="KEYSTORE";B.LEAP="LEAP";B.LEDGER="LEDGER";B.LEDGER_LIVE="LEDGER_LIVE";B.METAMASK="METAMASK";B.OKX="OKX";B.OKX_MOBILE="OKX_MOBILE";B.PHANTOM="PHANTOM";B.POLKADOT_JS="POLKADOT_JS";B.RADIX_WALLET="RADIX_WALLET";B.TREZOR="TREZOR";B.TALISMAN="TALISMAN";B.TRUSTWALLET_WEB="TRUSTWALLET_WEB";B.WALLETCONNECT="WALLETCONNECT"})(Rn||={});var Yn;((o)=>{o[o.NoError=36864]="NoError";o[o.LockedDevice=21781]="LockedDevice";o[o.TC_NotFound=65535]="TC_NotFound"})(Yn||={});var Mn;((o)=>{o.Average="average";o.Fast="fast";o.Fastest="fastest"})(Mn||={});var qn;((t)=>{t.Approve="approve";t.CheckOnly="checkOnly"})(qn||={});var Hn;((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-"})(Hn||={});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 Wn;((t)=>{t.highSlippage="highSlippage";t.highPriceImpact="highPriceImpact"})(Wn||={});var Kn;((k)=>{k.CAVIAR_V1="CAVIAR_V1";k.CAMELOT_V3="CAMELOT_V3";k.CHAINFLIP="CHAINFLIP";k.CHAINFLIP_STREAMING="CHAINFLIP_STREAMING";k.JUPITER="JUPITER";k.MAYACHAIN="MAYACHAIN";k.MAYACHAIN_STREAMING="MAYACHAIN_STREAMING";k.OCISWAP_V1="OCISWAP_V1";k.ONEINCH="ONEINCH";k.OPENOCEAN_V2="OPENOCEAN_V2";k.PANCAKESWAP="PANCAKESWAP";k.PANGOLIN_V1="PANGOLIN_V1";k.SUSHISWAP_V2="SUSHISWAP_V2";k.THORCHAIN="THORCHAIN";k.THORCHAIN_STREAMING="THORCHAIN_STREAMING";k.TRADERJOE_V2="TRADERJOE_V2";k.UNISWAP_V2="UNISWAP_V2";k.UNISWAP_V3="UNISWAP_V3";k.KADO="KADO"})(Kn||={});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 l={},mn=typeof window!=="undefined"?{}:{referrer:"https://sk.thorswap.net",referer:"https://sk.thorswap.net"};function eh({apiKey:n,...h}){l={...h,apiKey:n}}async function V(n,h){let{apiKey:t,...o}=l,{searchParams:c,json:C,body:a}=h,x={...mn,...o.headers,...h.headers,...C?{"Content-Type":"application/json"}:{}},A=C?JSON.stringify(C):a,R=new URL(n);if(c)R.search=new URLSearchParams(c).toString();if(t)x["x-api-key"]=t;try{let S=await(await fetch(R.toString(),{...o,...h,body:A,headers:x})).json();if(h.responseHandler)return h.responseHandler(S);return S}catch(F){if(h.onError)return h.onError(F);console.error(F)}}var b={get:async(n,h)=>V(n,{...h,method:"GET"}),post:async(n,h)=>V(n,{...h,method:"POST"}),extend:(n)=>{let h={...l,...n};return{get:async(t,o)=>V(t,{...h,...o,method:"GET"}),post:async(t,o)=>V(t,{...h,...o,method:"POST"}),extend:(t)=>b.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_ctrl_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_ctrl_not_found:20301,wallet_ctrl_send_transaction_no_address:20302,wallet_ctrl_contract_address_not_provided:20303,wallet_ctrl_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,api_v2_invalid_method_key_hash:50003,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 u extends Error{static ErrorCode=Un;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:u.ErrorCode[o],message:`${o}${t?"":`: ${JSON.stringify(n.info)}`}`}});Object.setPrototypeOf(this,u.prototype)}}function st(n){if(n<0)throw new u({errorKey:"helpers_invalid_number_of_years",info:{numberOfYears:n}});return 10+n}function Ct(n){if(n<0)throw new u({errorKey:"helpers_invalid_number_of_years",info:{numberOfYears:n}});return Math.round((10+n*1.0512)*10000000000)/10000000000}function at(n,h){try{return n()}catch(t){if(h)throw new u(h,t);return console.error(t)}}function xt(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 pn(n,h){if(!Dn&&n){if(Fn.has(h))return;Fn.add(h),console.warn(h)}}async function it(n="thorchain-1"){if(!["thorchain-stagenet-v2","thorchain-1","thorchain-mainnet-v1"].includes(n))return n;try{return(await b.get(`${n!=="thorchain-1"?W("THOR_STAGENET"):W("THOR")}/status`)).result.node_info.network}catch(h){return n}}var An=[...Object.values(P),"TERRA"];function Bn(n=""){let h=n.toUpperCase(),[t]=h.split(".");if(An.includes(t))return!0;let[o]=h.split("/");if(An.includes(o))return!0;throw new u({errorKey:"helpers_invalid_identifier",info:{message:`Invalid identifier: ${n}. Expected format: <Chain>.<Ticker> or <Chain>.<Ticker>-<ContractAddress>`,identifier:n}})}function pt(n){if(n.length>30)return!1;let h=/^[a-zA-Z0-9+_-]+$/g;return!!n.match(h)}var Y=8,X=(n)=>10n**BigInt(n),Z=(n)=>Math.log10(Number.parseFloat(n.toString()));function J({value:n,bigIntDecimal:h=Y,decimal:t=Y}){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 G{decimalMultiplier=10n**8n;bigIntValue=0n;decimal;static fromBigInt(n,h){return new G({decimal:h,value:J({value:n,bigIntDecimal:h,decimal:h})})}static shiftDecimals({value:n,from:h,to:t}){return G.fromBigInt(n.getBaseValue("bigint")*X(t)/X(h),t)}constructor(n){let h=r(n),t=typeof n==="object";this.decimal=t?n.decimal:void 0,this.decimalMultiplier=t&&"decimalMultiplier"in n?n.decimalMultiplier:X(Math.max(Tn(m(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/X(h||this.decimal||p.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=r(n),o=m(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("."),A=a.replace(/\B(?=(\d{3})+(?!\d))/g,c),R=a||x?a==="0"?`${Number.parseFloat(`0.${x}`)}`.replace(".",o):`${A}${Number.parseInt(x)?`${o}${x.slice(0,t)}`:""}`:"0.00";return`${h==="start"?n:""}${R}${h==="end"?n:""}`}formatBigIntToSafeValue(n,h){let t=h||this.decimal||Y,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,A=x.length-o,R=x.slice(-o);if(Number.parseInt(R[t]||"0")>=5)R=`${R.substring(0,t-1)}${(Number.parseInt(R[t-1]||"0")+1).toString()}`;else R=R.substring(0,t);return`${c?"-":""}${x.slice(0,A)}.${R}`.replace(/\.?0*$/,"")}#h(n,...h){let t=this.#t(this,...h),o=Math.max(t,Z(this.decimalMultiplier)),c=X(o),C=h.reduce((x,A)=>{let R=this.getBigIntValue(A,o);switch(n){case"add":return x+R;case"sub":return x-R;case"mul":return x*R/c;case"div":{if(R===0n)throw new RangeError("Division by zero");return x*c/R}default:return x}},this.bigIntValue*c/this.decimalMultiplier),a=J({bigIntDecimal:o,decimal:o,value:C});return new this.constructor({decimalMultiplier:X(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=m(n)||"0";this.bigIntValue=this.#o(h)}#t(...n){let h=n.map((t)=>{return typeof t==="object"?t.decimal||Z(t.decimalMultiplier):Tn(m(t))}).filter(Boolean);return Math.max(...h,Y)}#o(n,h){let t=h?X(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 m(n){let t=`${typeof n==="number"?dn.format(n):r(n)}`.replaceAll(",",".").split(".");return t.length>1?`${t.slice(0,-1).join("")}.${t.at(-1)}`:t[0]||"0"}function Tn(n){let h=n.split(".")[1]?.length||0;return Math.max(h,Y)}function r(n){return typeof n==="object"?"getValue"in n?n.getValue("string"):n.value:n}var U=new Map;class g extends G{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=e(C||`${o}.${c}`);this.type=gn(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=xn[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 u({errorKey:"helpers_invalid_asset_url",info:{urlAsset:n}});let C=t==="THOR"&&c?`${t}.${o}/${c}`:n;return g.from({asset:C,value:h})}static from({value:n=0,fromBaseDecimal:h,asyncTokenLookup:t,...o}){let c=n instanceof G?n.getValue("string"):n,C="chain"in o,a=C?o.chain:o.asset,x=C||kn.includes(a),{identifier:A,decimal:R}=x?On(a):{identifier:a,decimal:void 0},{chain:F,isSynthetic:S,isTradeAsset:$}=e(A),I=U.get(F==="SOL"?A:A.toUpperCase()),w=I?.decimal||R;pn(!(t||w),`Couldn't find static decimal for ${A} (Using default ${p[F]} decimal as fallback).
var _n=Object.create;var{getPrototypeOf:Pn,defineProperty:tn,getOwnPropertyNames:$n}=Object;var Ln=Object.prototype.hasOwnProperty;var on=(n,h,t)=>{t=n!=null?_n(Pn(n)):{};let o=h||!n||!n.__esModule?tn(t,"default",{value:n,enumerable:!0}):t;for(let c of $n(n))if(!Ln.call(o,c))tn(o,c,{get:()=>n[c],enumerable:!0});return o};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 _;((i)=>{i.Arbitrum="ARB";i.Avalanche="AVAX";i.Base="BASE";i.BinanceSmartChain="BSC";i.Bitcoin="BTC";i.BitcoinCash="BCH";i.Cosmos="GAIA";i.Dash="DASH";i.Dogecoin="DOGE";i.Ethereum="ETH";i.Fiat="FIAT";i.Kujira="KUJI";i.Litecoin="LTC";i.Maya="MAYA";i.Optimism="OP";i.Polkadot="DOT";i.Chainflip="FLIP";i.Polygon="MATIC";i.Radix="XRD";i.THORChain="THOR";i.Solana="SOL"})(_||={});var v;((t)=>{t.THORChain="THOR_STAGENET";t.Maya="MAYA_STAGENET"})(v||={});var f;((H)=>{H.Arbitrum="42161";H.ArbitrumHex="0xa4b1";H.Avalanche="43114";H.AvalancheHex="0xa86a";H.Base="8453";H.BaseHex="0x2105";H.BinanceSmartChain="56";H.BinanceSmartChainHex="0x38";H.Bitcoin="bitcoin";H.BitcoinCash="bitcoincash";H.Chainflip="chainflip";H.Cosmos="cosmoshub-4";H.Dash="dash";H.Dogecoin="dogecoin";H.Kujira="kaiyo-1";H.Ethereum="1";H.EthereumHex="0x1";H.Fiat="fiat";H.Litecoin="litecoin";H.Maya="mayachain-mainnet-v1";H.MayaStagenet="mayachain-stagenet-v1";H.Optimism="10";H.OptimismHex="0xa";H.Polkadot="polkadot";H.Polygon="137";H.PolygonHex="0x89";H.Radix="radix-mainnet";H.THORChain="thorchain-1";H.THORChainStagenet="thorchain-stagenet-v2";H.Solana="solana"})(f||={});var _h={["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",["fiat"]:"FIAT",["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"},jn=Object.keys(_),z=Object.values(_),A={ARB:18,AVAX:18,BASE:18,BCH:8,BSC:18,BTC:8,DASH:8,DOGE:8,DOT:10,ETH:18,FIAT:2,FLIP:18,GAIA:6,KUJI:6,LTC:8,MATIC:18,MAYA:8,OP:18,SOL:9,THOR:8,XRD:18},Ph={["ARB"]:0.3,["AVAX"]:3,["BASE"]:2,["BSC"]:3,["BTC"]:600,["BCH"]:600,["FLIP"]:5,["GAIA"]:2,["DASH"]:150,["DOGE"]:600,["ETH"]:12.5,["FIAT"]:60,["KUJI"]:2.2,["LTC"]:150,["MAYA"]:6,["OP"]:2,["DOT"]:6,["MATIC"]:2.1,["XRD"]:5,["SOL"]:0.4,["THOR"]:6},$h=["DOT","FLIP"],Q=["ARB","AVAX","BASE","BSC","ETH","OP","MATIC"],Lh=["BTC","BCH","DASH","DOGE","LTC"],jh=["GAIA","THOR","MAYA","KUJI"],Gh=["AVAX","BSC","BTC","BCH","GAIA","DOGE","ETH","LTC","THOR"],Ih=["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",["FIAT"]:"",["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"},Gn={["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"],["FIAT"]:[],["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"]},In={["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",["FIAT"]:"",["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,W=(n)=>{return d[n]},wn=(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 yn(n){switch(n){case"XRD":return"/status/network-configuration";default:return""}}var sn=async(n,h)=>{try{let t=h.startsWith("wss")?h.replace("wss","https"):h;return(await fetch(`${t}${yn(n)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(wn(n)),signal:AbortSignal.timeout(3000)})).ok}catch{return!1}},Xn=async(n)=>{let h=Cn[n];if(await sn(n,h))return h;for(let t of Gn[n])if(await sn(n,t))return t;return h},wh=async(n=[...Object.values(_),...Object.values(v)])=>{let h={};await Promise.all(n.map(async(t)=>{let o=await Xn(t);h[t]=o})),d={...d,...h}},an=z.reduce((n,h)=>{let t=jn.find((o)=>_[o]===h);if(t)n[h]=t;return n},{}),xn=z.reduce((n,h)=>{return n[h]=f[an[h]],n},{}),E=z.reduce((n,h)=>{return n[h]=W(h),n},{}),yh=z.reduce((n,h)=>{let t=`${an[h]}Hex`;return n[h]=f[t],n},{}),Xh=z.reduce((n,h)=>{return n[h]=In[h],n},{});var bn;((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"})(bn||={});var Jh=["ERC20-ERC20","ARC20-ARC20","BEP20-BEP20"],fh=["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 fn;((i)=>{i.ARB="m/44'/60'/0'/0";i.AVAX="m/44'/60'/0'/0";i.BASE="m/44'/60'/0'/0";i.BCH="m/44'/145'/0'/0";i.BSC="m/44'/60'/0'/0";i.BTC="m/84'/0'/0'/0";i.DASH="m/44'/5'/0'/0";i.DOGE="m/44'/3'/0'/0";i.DOT="////";i.ETH="m/44'/60'/0'/0";i.FLIP="////";i.GAIA="m/44'/118'/0'/0";i.KUJI="m/44'/118'/0'/0";i.LTC="m/84'/2'/0'/0";i.MATIC="m/44'/60'/0'/0";i.MAYA="m/44'/931'/0'/0";i.OP="m/44'/60'/0'/0";i.SOL="m/44'/501'/0'/0";i.THOR="m/44'/931'/0'/0";i.XRD="////";i.FIAT="////"})(fn||={});var K={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],DOT:[0,0,0,0,0],FIAT:[0,0,0,0,0],FLIP:[0,0,0,0,0],XRD:[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;((g)=>{g.Arbitrum="https://arbiscan.io";g.Avalanche="https://snowtrace.io";g.Base="https://basescan.org";g.BinanceSmartChain="https://bscscan.com";g.Bitcoin="https://blockchair.com/bitcoin";g.BitcoinCash="https://www.blockchair.com/bitcoin-cash";g.Chainflip="https://explorer.polkascan.io/polkadot";g.Cosmos="https://www.mintscan.io/cosmos";g.Dash="https://blockchair.com/dash";g.Dogecoin="https://blockchair.com/dogecoin";g.Ethereum="https://etherscan.io";g.Kujira="https://finder.kujira.network/kaiyo-1";g.Litecoin="https://blockchair.com/litecoin";g.Maya="https://www.mayascan.org";g.Optimism="https://optimistic.etherscan.io";g.Polkadot="https://polkadot.subscan.io";g.Polygon="https://polygonscan.com";g.Radix="https://dashboard.radixdlt.com";g.THORChain="https://runescan.io";g.Solana="https://solscan.io"})(Zn||={});var Rn;((B)=>{B.BRAVE="BRAVE";B.COINBASE_MOBILE="COINBASE_MOBILE";B.COINBASE_WEB="COINBASE_WEB";B.CTRL="CTRL";B.EIP6963="EIP6963";B.EXODUS="EXODUS";B.KEEPKEY="KEEPKEY";B.KEEPKEY_BEX="KEEPKEY_BEX";B.KEPLR="KEPLR";B.KEYSTORE="KEYSTORE";B.LEAP="LEAP";B.LEDGER="LEDGER";B.LEDGER_LIVE="LEDGER_LIVE";B.METAMASK="METAMASK";B.OKX="OKX";B.OKX_MOBILE="OKX_MOBILE";B.PHANTOM="PHANTOM";B.POLKADOT_JS="POLKADOT_JS";B.RADIX_WALLET="RADIX_WALLET";B.TREZOR="TREZOR";B.TALISMAN="TALISMAN";B.TRUSTWALLET_WEB="TRUSTWALLET_WEB";B.WALLETCONNECT="WALLETCONNECT"})(Rn||={});var Yn;((o)=>{o[o.NoError=36864]="NoError";o[o.LockedDevice=21781]="LockedDevice";o[o.TC_NotFound=65535]="TC_NotFound"})(Yn||={});var Mn;((o)=>{o.Average="average";o.Fast="fast";o.Fastest="fastest"})(Mn||={});var qn;((t)=>{t.Approve="approve";t.CheckOnly="checkOnly"})(qn||={});var Hn;((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-"})(Hn||={});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 Wn;((t)=>{t.highSlippage="highSlippage";t.highPriceImpact="highPriceImpact"})(Wn||={});var Kn;((k)=>{k.CAVIAR_V1="CAVIAR_V1";k.CAMELOT_V3="CAMELOT_V3";k.CHAINFLIP="CHAINFLIP";k.CHAINFLIP_STREAMING="CHAINFLIP_STREAMING";k.JUPITER="JUPITER";k.MAYACHAIN="MAYACHAIN";k.MAYACHAIN_STREAMING="MAYACHAIN_STREAMING";k.OCISWAP_V1="OCISWAP_V1";k.ONEINCH="ONEINCH";k.OPENOCEAN_V2="OPENOCEAN_V2";k.PANCAKESWAP="PANCAKESWAP";k.PANGOLIN_V1="PANGOLIN_V1";k.SUSHISWAP_V2="SUSHISWAP_V2";k.THORCHAIN="THORCHAIN";k.THORCHAIN_STREAMING="THORCHAIN_STREAMING";k.TRADERJOE_V2="TRADERJOE_V2";k.UNISWAP_V2="UNISWAP_V2";k.UNISWAP_V3="UNISWAP_V3";k.KADO="KADO"})(Kn||={});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 l={},mn=typeof window!=="undefined"?{}:{referrer:"https://sk.thorswap.net",referer:"https://sk.thorswap.net"};function eh({apiKey:n,...h}){l={...h,apiKey:n}}async function V(n,h){let{apiKey:t,...o}=l,{searchParams:c,json:C,body:a}=h,x={...mn,...o.headers,...h.headers,...C?{"Content-Type":"application/json"}:{}},p=C?JSON.stringify(C):a,R=new URL(n);if(c)R.search=new URLSearchParams(c).toString();if(t)x["x-api-key"]=t;try{let S=await(await fetch(R.toString(),{...o,...h,body:p,headers:x})).json();if(h.responseHandler)return h.responseHandler(S);return S}catch(F){if(h.onError)return h.onError(F);console.error(F)}}var b={get:async(n,h)=>V(n,{...h,method:"GET"}),post:async(n,h)=>V(n,{...h,method:"POST"}),extend:(n)=>{let h={...l,...n};return{get:async(t,o)=>V(t,{...h,...o,method:"GET"}),post:async(t,o)=>V(t,{...h,...o,method:"POST"}),extend:(t)=>b.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_ctrl_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_ctrl_not_found:20301,wallet_ctrl_send_transaction_no_address:20302,wallet_ctrl_contract_address_not_provided:20303,wallet_ctrl_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,api_v2_invalid_method_key_hash:50003,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 u extends Error{static ErrorCode=Un;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:u.ErrorCode[o],message:`${o}${t?"":`: ${JSON.stringify(n.info)}`}`}});Object.setPrototypeOf(this,u.prototype)}}function st(n){if(n<0)throw new u({errorKey:"helpers_invalid_number_of_years",info:{numberOfYears:n}});return 10+n}function Ct(n){if(n<0)throw new u({errorKey:"helpers_invalid_number_of_years",info:{numberOfYears:n}});return Math.round((10+n*1.0512)*10000000000)/10000000000}function at(n,h){try{return n()}catch(t){if(h)throw new u(h,t);return console.error(t)}}function xt(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 An(n,h){if(!Dn&&n){if(Fn.has(h))return;Fn.add(h),console.warn(h)}}async function it(n="thorchain-1"){if(!["thorchain-stagenet-v2","thorchain-1","thorchain-mainnet-v1"].includes(n))return n;try{return(await b.get(`${n!=="thorchain-1"?W("THOR_STAGENET"):W("THOR")}/status`)).result.node_info.network}catch(h){return n}}var pn=[...Object.values(_),"TERRA"];function Bn(n=""){let h=n.toUpperCase(),[t]=h.split(".");if(pn.includes(t))return!0;let[o]=h.split("/");if(pn.includes(o))return!0;throw new u({errorKey:"helpers_invalid_identifier",info:{message:`Invalid identifier: ${n}. Expected format: <Chain>.<Ticker> or <Chain>.<Ticker>-<ContractAddress>`,identifier:n}})}function At(n){if(n.length>30)return!1;let h=/^[a-zA-Z0-9+_-]+$/g;return!!n.match(h)}var Y=8,X=(n)=>10n**BigInt(n),Z=(n)=>Math.log10(Number.parseFloat(n.toString()));function J({value:n,bigIntDecimal:h=Y,decimal:t=Y}){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 G{decimalMultiplier=10n**8n;bigIntValue=0n;decimal;static fromBigInt(n,h){return new G({decimal:h,value:J({value:n,bigIntDecimal:h,decimal:h})})}static shiftDecimals({value:n,from:h,to:t}){return G.fromBigInt(n.getBaseValue("bigint")*X(t)/X(h),t)}constructor(n){let h=r(n),t=typeof n==="object";this.decimal=t?n.decimal:void 0,this.decimalMultiplier=t&&"decimalMultiplier"in n?n.decimalMultiplier:X(Math.max(Tn(m(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/X(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=r(n),o=m(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("."),p=a.replace(/\B(?=(\d{3})+(?!\d))/g,c),R=a||x?a==="0"?`${Number.parseFloat(`0.${x}`)}`.replace(".",o):`${p}${Number.parseInt(x)?`${o}${x.slice(0,t)}`:""}`:"0.00";return`${h==="start"?n:""}${R}${h==="end"?n:""}`}formatBigIntToSafeValue(n,h){let t=h||this.decimal||Y,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,p=x.length-o,R=x.slice(-o);if(Number.parseInt(R[t]||"0")>=5)R=`${R.substring(0,t-1)}${(Number.parseInt(R[t-1]||"0")+1).toString()}`;else R=R.substring(0,t);return`${c?"-":""}${x.slice(0,p)}.${R}`.replace(/\.?0*$/,"")}#h(n,...h){let t=this.#t(this,...h),o=Math.max(t,Z(this.decimalMultiplier)),c=X(o),C=h.reduce((x,p)=>{let R=this.getBigIntValue(p,o);switch(n){case"add":return x+R;case"sub":return x-R;case"mul":return x*R/c;case"div":{if(R===0n)throw new RangeError("Division by zero");return x*c/R}default:return x}},this.bigIntValue*c/this.decimalMultiplier),a=J({bigIntDecimal:o,decimal:o,value:C});return new this.constructor({decimalMultiplier:X(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=m(n)||"0";this.bigIntValue=this.#o(h)}#t(...n){let h=n.map((t)=>{return typeof t==="object"?t.decimal||Z(t.decimalMultiplier):Tn(m(t))}).filter(Boolean);return Math.max(...h,Y)}#o(n,h){let t=h?X(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 m(n){let t=`${typeof n==="number"?dn.format(n):r(n)}`.replaceAll(",",".").split(".");return t.length>1?`${t.slice(0,-1).join("")}.${t.at(-1)}`:t[0]||"0"}function Tn(n){let h=n.split(".")[1]?.length||0;return Math.max(h,Y)}function r(n){return typeof n==="object"?"getValue"in n?n.getValue("string"):n.value:n}var U=new Map;class O extends G{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=e(C||`${o}.${c}`);this.type=gn(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=xn[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 u({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 G?n.getValue("string"):n,C="chain"in o,a=C?o.chain:o.asset,x=C||kn.includes(a),{identifier:p,decimal:R}=x?On(a):{identifier:a,decimal:void 0},{chain:F,isSynthetic:S,isTradeAsset:$}=e(p),I=U.get(F==="SOL"?p:p.toUpperCase()),w=I?.decimal||R;An(!(t||w),`Couldn't find static decimal for ${p} (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:j,identifier:T,tax:q}=I||{decimal:w||p[F],identifier:A},y=h?D(BigInt(c),h):D(c,j);return t?vn(T,h?y:c):S||$?En(T,y):new g({tax:q,decimal:j,identifier:T,value:y})}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)U.set(C!=="SOL"?c.toUpperCase():c,{identifier:c,decimal:"decimals"in a?a.decimals:p[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 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(P).includes(n))return g.from({chain:n,value:h});return g.from({asset:n,value:h})}}function Pt(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 vn(n,h=0){Bn(n);let o=n.includes("SOL.")?n:n.toUpperCase(),c=U.get(o),C=c?.decimal||await Nn(e(n));if(!c)U.set(o,{identifier:n,decimal:C});return new g({decimal:C,value:D(h,C),identifier:n})}function En(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 u({errorKey:"helpers_invalid_asset_identifier",info:{identifier:n}});return new g({decimal:8,value:D(h,8),identifier:`${t||"THOR"}.${C}${c}${a}`})}function D(n,h){return typeof n==="bigint"?J({value:n,bigIntDecimal:h,decimal:h}):n}function e(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 u({errorKey:"helpers_invalid_asset_identifier",info:{identifier:n}});let A=n.includes(".")&&!h&&!t?n:`${C?"MAYA":"THOR"}.${x}`,[R,...F]=A.split("."),S=h||t?x:F.join("."),$=S.split("-"),I=$.length===1?$[0]:$.slice(0,-1).join("-"),w=$.length===1?void 0:$[$.length-1],j=R==="SOL"?w:w?.toLowerCase();return{address:j,chain:R,isGasAsset:nn({chain:R,symbol:S}),isSynthetic:h,isTradeAsset:t,ticker:I,symbol:(h||t?`${a}${o}`:"")+(j?`${I}-${j??""}`:S)}}var ln="0x313ce567",kn=[`${"MAYA"}.MAYA`,`${"ETH"}.THOR`,`${"ETH"}.vTHOR`,`${"KUJI"}.USK`],un=async({chain:n,to:h})=>{try{let{result:t}=await b.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:ln},"latest"]})});return Number.parseInt(BigInt(t||p[n]).toString())}catch(t){return console.error(t),p[n]}},rn=async({symbol:n})=>{try{let h=n.split("-")[1]?.toLowerCase(),{manager:t}=await b.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"]}},en=(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")?un({chain:"ETH",to:t}):p.ETH},nh=(n)=>{let h=n.split("-"),t=h.length===1?void 0:h[h.length-1];return t?.startsWith("0x")?un({chain:"AVAX",to:t.toLowerCase()}):p.AVAX},hh=(n)=>{if(n==="BSC")return p.BSC;return p.BSC},th=(n)=>{if(n==="XRD")return p.XRD;return rn({symbol:n})},Nn=({chain:n,symbol:h})=>{switch(n){case"ETH":return en(h);case"AVAX":return nh(h);case"BSC":return hh(h);case"XRD":return th(h);default:return p[n]}},Gt=({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}`})}},nn=({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}},On=(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]}}},gn=({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}},It=(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}},oh=new RegExp(/(.)\1{6}|\.ORG|\.NET|\.FINANCE|\.COM|WWW|HTTP|\\\\|\/\/|[\s$%:[\]]/,"gmi"),ch=(n)=>{let[h,t]=n.split(".");if(!Q.includes(h))return!0;let o=t.split("-"),c=o.length===1?void 0:o[o.length-1];return nn({chain:h,symbol:t})||!!c},wt=(n)=>n.filter(({chain:h,value:t,symbol:o})=>{let c=`${h}.${o}`;return!oh.test(c)&&ch(c)&&t!=="0"});async function yt(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 Xt={ARB:1,AVAX:3,BASE:1,BSC:3,BTC:600,BCH:600,FLIP:5,GAIA:1.5,DASH:150,DOGE:600,ETH:12.5,FIAT:60,KUJI:2.2,LTC:150,MAYA:6,OP:1,DOT:6,MATIC:2.1,XRD:5,SOL:1,THOR:6};var hn=(n,h)=>{return[...n.slice(0,n.length-1),h]};function zt([n,h,t,o,c]){return`m/${n}'/${h}'/${t}'/${o}${typeof c!=="number"?"":`/${c}`}`}function ft({chain:n,index:h,addressIndex:t=0,type:o}){if(Q.includes(n)){if(o&&["legacy","account"].includes(o))return[44,60,0,h];if(o==="ledgerLive")return[44,60,h,0,t];return hn(K[n],h)}if(n==="SOL"){if(o==="account")return[44,501,0,h];return hn(K[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 hn(K[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 sh({liquidityUnits:n,poolUnits:h,runeDepth:t}){let o=_(n),c=_(h),C=_(t),a=o.mul(C),x=c.mul(c).mul(2),A=c.mul(o).mul(2),R=o.mul(o),F=c.mul(c).mul(c);return a.mul(x.sub(A).add(R)).div(F)}function Ch({liquidityUnits:n,poolUnits:h,assetDepth:t}){let o=_(n),c=_(h),C=_(t),a=o.mul(C),x=c.mul(c).mul(2),A=c.mul(o).mul(2),R=o.mul(o),F=a.mul(x.sub(A).add(R)),S=c.mul(c).mul(c);return F.div(S)}function Qt({percent:n,runeDepth:h,liquidityUnits:t,poolUnits:o}){return sh({runeDepth:h,liquidityUnits:t,poolUnits:o}).mul(n)}function Wt({percent:n,assetDepth:h,liquidityUnits:t,poolUnits:o}){return Ch({assetDepth:h,liquidityUnits:t,poolUnits:o}).mul(n)}function _(n){return L.fromBigInt(BigInt(n),p.THOR)}function ah({liquidityUnits:n,poolUnits:h,runeDepth:t,assetDepth:o}){return{assetAmount:_(o).mul(n).div(h),runeAmount:_(t).mul(n).div(h)}}function Kt({liquidityUnits:n,poolUnits:h,runeDepth:t,assetDepth:o,percent:c}){return Object.fromEntries(Object.entries(ah({liquidityUnits:n,poolUnits:h,runeDepth:t,assetDepth:o})).map(([C,a])=>[C,a.mul(c)]))}function Vt({runeDepth:n,poolUnits:h,assetDepth:t,liquidityUnits:o,runeAmount:c,assetAmount:C}){let a=new L({value:n,decimal:8}),x=new L({value:t,decimal:8}),A=new L({value:h,decimal:8}),R=new L({value:c,decimal:8}),F=new L({value:C,decimal:8}),S=R.mul(x),$=F.mul(a),I=R.mul(F),w=a.mul(x),j=A.mul(S.add($.add(I.mul(2)))),T=S.add($.add(w.mul(2))),q=j.div(T),y=_(o).add(q);if(q.getBaseValue("number")===0)return y.div(A).getBaseValue("number");let k=A.add(y);return y.div(k).getBaseValue("number")}function mt({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),A=a.mul(c).sub(C.mul(x)),R=C.mul(x).add(c.mul(C));return Math.abs(A.div(R).getBaseValue("number"))}function xh({type:n,address:h}){return`${n}:${h}`}function ih({address:n,unbondAmount:h}){return`${"UNBOND"}:${n}:${h}`}function Et(n){return M("POOL+",n)}function Rh({chain:n,symbol:h,...t}){return M(`${"+"}:${n}/${h}`,t)}function Hh({chain:n,symbol:h,address:t,...o}){let c=Th({chain:n,symbol:h}),C=t?`:${t}:`:":";return M(`${"+"}:${c}${C}`,o)}function Fh({chain:n,symbol:h,basisPoints:t}){return`${"-"}:${n}/${h}:${t}`}function ph({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 lt({basisPoints:n,...h}){return M(`${"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 rt({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 M(`${C}${a}`,c)}function M(n,{affiliateAddress:h,affiliateBasisPoints:t}={}){let o=`${n}${h?`:${h}:${t||0}`:""}`;return o.endsWith(":")?o.slice(0,-1):o}function Th({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 et=(n,h)=>{switch(n){case"LEAVE":case"BOND":return xh({type:n,address:h?.address});case"UNBOND":return ih({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 Fh({chain:t,symbol:c,basisPoints:C});return ph({chain:t,ticker:o,symbol:c,basisPoints:C,targetAsset:a})}default:throw new u({errorKey:"helpers_invalid_memo_type",info:{memoType:n}})}};var kh=["approve","approvedAmount","call","sendTransaction","transfer","isApproved","approvedAmount","EIP1193SendTransaction","getFeeData","broadcastTransaction","estimateCall","estimateGasLimit","estimateGasPrices","createContractTxObject"],Nh=(n,h,t)=>async(...o)=>{try{await Oh(h,t)}catch(c){throw new u({errorKey:"helpers_failed_to_switch_network",info:{error:c}})}return n(...o)},Sn=({provider:n,params:h,method:t})=>{if(!n?.send)throw new u("helpers_not_found_provider");let o=h?Array.isArray(h)?h:[h]:[];return n.send(t,o)},oo=({toolbox:n,chainId:h,provider:t=window.ethereum})=>{let o=kh.reduce((c,C)=>{if(!n[C])return c;let a=n[C];if(typeof a!=="function")return c;return{...c,[C]:Nh(a,t,h)}},{});return{...n,...o}},co=(n,h)=>Sn({provider:n,method:"wallet_addEthereumChain",params:[h]}),Oh=(n,h="0x1")=>Sn({provider:n,method:"wallet_switchEthereumChain",params:[{chainId:h}]}),so=(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)"CTRL";return"METAMASK"},ao=(n)=>{return gh().includes(n)},gh=()=>{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("CTRL");if(t)C.push("BRAVE");if(o)C.push("TRUSTWALLET_WEB");if(c)C.push("COINBASE_WEB");if(uh())C.push("OKX_MOBILE");return C};function xo({chain:n,covalentApiKey:h,ethplorerApiKey:t}){let o=n!=="ETH"&&!h?"covalentApiKey":t?void 0:"ethplorerApiKey";if(o)throw new u({errorKey:"wallet_missing_api_key",info:{missingKey:o}});return{covalentApiKey:h,ethplorerApiKey:t}}function io(){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 uh=()=>{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},Ro=()=>typeof window.ethereum!=="undefined";class L extends G{eq(n){return this.eqValue(n)}static fromBigInt(n,h){return new L({decimal:h,value:J({value:n,bigIntDecimal:h,decimal:h})})}}export{at as wrapWithThrow,Nh as wrapMethodWithNetworkSwitch,pn as warnOnce,pt as validateTNS,Bn as validateIdentifier,hn as updatedLastIndex,Oh as switchEVMWalletNetwork,eh as setRequestClientConfig,oo as prepareNetworkSwitch,uh as okxMobileEnabled,gh as listWeb3EVMWallets,Ro as isWeb3Detected,nn as isGasAsset,ao as isDetected,wh as initializeRPCUrlsWithFallback,Zt as getWalletFormatFor,st as getTHORNameCost,Kt as getSymmetricWithdraw,ah as getSymmetricPoolShare,W as getRPCUrl,Pt as getMinAmountByChain,ph as getMemoForWithdraw,ih as getMemoForUnbond,Fh as getMemoForSaverWithdraw,Rh as getMemoForSaverDeposit,lt as getMemoForRunePoolWithdraw,Et as getMemoForRunePoolDeposit,Ah as getMemoForNameRegister,rt as getMemoForNamePreferredAssetRegister,Bh as getMemoForLoan,xh as getMemoForLeaveAndBond,Hh as getMemoForDeposit,et as getMemoFor,Ct as getMAYANameCost,mt as getLiquiditySlippage,Gt as getGasAsset,Vt as getEstimatedPoolShare,Co as getETHDefaultWallet,io as getEIP6963Wallets,it as getDynamicChainId,ft as getDerivationPathFor,Nn as getDecimal,On as getCommonAssetInfo,xt as getChainIdentifier,Qt as getAsymmetricRuneWithdrawAmount,sh as getAsymmetricRuneShare,Wt as getAsymmetricAssetWithdrawAmount,Ch as getAsymmetricAssetShare,gn as getAssetType,J as formatBigIntToSafeValue,yt as findAssetBy,wt as filterAssets,xo as ensureEVMApiKeys,zt as derivationPathToString,mn as defaultRequestHeaders,Xt as blockTimes,It as assetFromString,co as addEVMWalletNetwork,so as addAccountsChangedCallback,Wn as WarningCodeEnum,Rn as WalletOption,Lh as UTXOChains,Gh as TCSupportedChains,L as SwapKitNumber,u as SwapKitError,$h as SubstrateChains,v as StagenetChain,fh as SWAP_OUT,zh as SWAP_IN,b as RequestClient,Cn as RPC_URLS,fn as RPCUrl,bn as QuoteMode,Kn as ProviderName,K as NetworkDerivationPath,Hn as MemoType,Ih as MAYASupportedChains,Yn as LedgerErrorCode,Vn as FeeTypeEnum,Mn as FeeOption,Gn as FALLBACK_URLS,Zn as ExplorerUrl,Qn as ErrorCode,In as EXPLORER_URLS,Q as EVMChains,zn as DerivationPath,jh as CosmosChains,Jn as ContractAddress,kn as CommonAssetStrings,E as ChainToRPC,yh as ChainToHexChainId,Xh as ChainToExplorerUrl,xn as ChainToChainId,Ph as ChainIdToChain,z as ChainId,P as Chain,_h as BlockTimes,G as BigIntArithmetics,p as BaseDecimal,g as AssetValue,qn as ApproveMode,Jh as AGG_SWAP};
or by passing asyncTokenLookup: true to the from() function, which will make it async and return a promise.`);let{decimal:j,identifier:T,tax:q}=I||{decimal:w||A[F],identifier:p},y=h?D(BigInt(c),h):D(c,j);return t?vn(T,h?y:c):S||$?En(T,y):new O({tax:q,decimal:j,identifier:T,value:y})}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)U.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(_).includes(n))return O.from({chain:n,value:h});return O.from({asset:n,value:h})}}function _t(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 vn(n,h=0){Bn(n);let o=n.includes("SOL.")?n:n.toUpperCase(),c=U.get(o),C=c?.decimal||await Nn(e(n));if(!c)U.set(o,{identifier:n,decimal:C});return new O({decimal:C,value:D(h,C),identifier:n})}function En(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 u({errorKey:"helpers_invalid_asset_identifier",info:{identifier:n}});return new O({decimal:8,value:D(h,8),identifier:`${t||"THOR"}.${C}${c}${a}`})}function D(n,h){return typeof n==="bigint"?J({value:n,bigIntDecimal:h,decimal:h}):n}function e(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 u({errorKey:"helpers_invalid_asset_identifier",info:{identifier:n}});let p=n.includes(".")&&!h&&!t?n:`${C?"MAYA":"THOR"}.${x}`,[R,...F]=p.split("."),S=h||t?x:F.join("."),$=S.split("-"),I=$.length===1?$[0]:$.slice(0,-1).join("-"),w=$.length===1?void 0:$[$.length-1],j=R==="SOL"?w:w?.toLowerCase();return{address:j,chain:R,isGasAsset:nn({chain:R,symbol:S}),isSynthetic:h,isTradeAsset:t,ticker:I,symbol:(h||t?`${a}${o}`:"")+(j?`${I}-${j??""}`:S)}}var ln="0x313ce567",kn=[`${"MAYA"}.MAYA`,`${"ETH"}.THOR`,`${"ETH"}.vTHOR`,`${"KUJI"}.USK`],un=async({chain:n,to:h})=>{try{let{result:t}=await b.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:ln},"latest"]})});return Number.parseInt(BigInt(t||A[n]).toString())}catch(t){return console.error(t),A[n]}},rn=async({symbol:n})=>{try{let h=n.split("-")[1]?.toLowerCase(),{manager:t}=await b.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),A["XRD"]}},en=(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")?un({chain:"ETH",to:t}):A.ETH},nh=(n)=>{let h=n.split("-"),t=h.length===1?void 0:h[h.length-1];return t?.startsWith("0x")?un({chain:"AVAX",to:t.toLowerCase()}):A.AVAX},hh=(n)=>{if(n==="BSC")return A.BSC;return A.BSC},th=(n)=>{if(n==="XRD")return A.XRD;return rn({symbol:n})},Nn=({chain:n,symbol:h})=>{switch(n){case"ETH":return en(h);case"AVAX":return nh(h);case"BSC":return hh(h);case"XRD":return th(h);default:return A[n]}},Gt=({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}`})}},nn=({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}},On=(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]}}},gn=({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}},It=(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}},oh=new RegExp(/(.)\1{6}|\.ORG|\.NET|\.FINANCE|\.COM|WWW|HTTP|\\\\|\/\/|[\s$%:[\]]/,"gmi"),ch=(n)=>{let[h,t]=n.split(".");if(!Q.includes(h))return!0;let o=t.split("-"),c=o.length===1?void 0:o[o.length-1];return nn({chain:h,symbol:t})||!!c},wt=(n)=>n.filter(({chain:h,value:t,symbol:o})=>{let c=`${h}.${o}`;return!oh.test(c)&&ch(c)&&t!=="0"});async function yt(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 Xt={ARB:1,AVAX:3,BASE:1,BSC:3,BTC:600,BCH:600,FLIP:5,GAIA:1.5,DASH:150,DOGE:600,ETH:12.5,FIAT:60,KUJI:2.2,LTC:150,MAYA:6,OP:1,DOT:6,MATIC:2.1,XRD:5,SOL:1,THOR:6};var hn=(n,h)=>{return[...n.slice(0,n.length-1),h]};function ft([n,h,t,o,c]){return`m/${n}'/${h}'/${t}'/${o}${typeof c!=="number"?"":`/${c}`}`}function zt({chain:n,index:h,addressIndex:t=0,type:o}){if(Q.includes(n)){if(o&&["legacy","account"].includes(o))return[44,60,0,h];if(o==="ledgerLive")return[44,60,h,0,t];return hn(K[n],h)}if(n==="SOL"){if(o==="account")return[44,501,0,h];return hn(K[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 hn(K[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 sh({liquidityUnits:n,poolUnits:h,runeDepth:t}){let o=P(n),c=P(h),C=P(t),a=o.mul(C),x=c.mul(c).mul(2),p=c.mul(o).mul(2),R=o.mul(o),F=c.mul(c).mul(c);return a.mul(x.sub(p).add(R)).div(F)}function Ch({liquidityUnits:n,poolUnits:h,assetDepth:t}){let o=P(n),c=P(h),C=P(t),a=o.mul(C),x=c.mul(c).mul(2),p=c.mul(o).mul(2),R=o.mul(o),F=a.mul(x.sub(p).add(R)),S=c.mul(c).mul(c);return F.div(S)}function Qt({percent:n,runeDepth:h,liquidityUnits:t,poolUnits:o}){return sh({runeDepth:h,liquidityUnits:t,poolUnits:o}).mul(n)}function Wt({percent:n,assetDepth:h,liquidityUnits:t,poolUnits:o}){return Ch({assetDepth:h,liquidityUnits:t,poolUnits:o}).mul(n)}function P(n){return L.fromBigInt(BigInt(n),A.THOR)}function ah({liquidityUnits:n,poolUnits:h,runeDepth:t,assetDepth:o}){return{assetAmount:P(o).mul(n).div(h),runeAmount:P(t).mul(n).div(h)}}function Kt({liquidityUnits:n,poolUnits:h,runeDepth:t,assetDepth:o,percent:c}){return Object.fromEntries(Object.entries(ah({liquidityUnits:n,poolUnits:h,runeDepth:t,assetDepth:o})).map(([C,a])=>[C,a.mul(c)]))}function Vt({runeDepth:n,poolUnits:h,assetDepth:t,liquidityUnits:o,runeAmount:c,assetAmount:C}){let a=new L({value:n,decimal:8}),x=new L({value:t,decimal:8}),p=new L({value:h,decimal:8}),R=new L({value:c,decimal:8}),F=new L({value:C,decimal:8}),S=R.mul(x),$=F.mul(a),I=R.mul(F),w=a.mul(x),j=p.mul(S.add($.add(I.mul(2)))),T=S.add($.add(w.mul(2))),q=j.div(T),y=P(o).add(q);if(q.getBaseValue("number")===0)return y.div(p).getBaseValue("number");let k=p.add(y);return y.div(k).getBaseValue("number")}function mt({runeAmount:n,assetAmount:h,runeDepth:t,assetDepth:o}){if(n==="0"||h==="0"||t==="0"||o==="0")return 0;let c=P(t),C=P(o),a=P(h),x=P(n),p=a.mul(c).sub(C.mul(x)),R=C.mul(x).add(c.mul(C));return Math.abs(p.div(R).getBaseValue("number"))}function xh({type:n,address:h}){return`${n}:${h}`}function ih({address:n,unbondAmount:h}){return`${"UNBOND"}:${n}:${h}`}function Et(n){return M("POOL+",n)}function Rh({chain:n,symbol:h,...t}){return M(`${"+"}:${n}/${h}`,t)}function Hh({chain:n,symbol:h,address:t,...o}){let c=Th({chain:n,symbol:h}),C=t?`:${t}:`:":";return M(`${"+"}:${c}${C}`,o)}function Fh({chain:n,symbol:h,basisPoints:t}){return`${"-"}:${n}/${h}:${t}`}function Ah({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 lt({basisPoints:n,...h}){return M(`${"POOL-"}:${n}`,h)}function ph({name:n,chain:h,address:t,owner:o}){let c=`${"~"}:${n}:${h}:${t}`,C=o?`:${o}`:"";return`${c}${C}`}function rt({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 M(`${C}${a}`,c)}function M(n,{affiliateAddress:h,affiliateBasisPoints:t}={}){let o=`${n}${h?`:${h}:${t||0}`:""}`;return o.endsWith(":")?o.slice(0,-1):o}function Th({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 et=(n,h)=>{switch(n){case"LEAVE":case"BOND":return xh({type:n,address:h?.address});case"UNBOND":return ih({address:h?.address,unbondAmount:h?.unbondAmount});case"~":return ph(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 Fh({chain:t,symbol:c,basisPoints:C});return Ah({chain:t,ticker:o,symbol:c,basisPoints:C,targetAsset:a})}default:throw new u({errorKey:"helpers_invalid_memo_type",info:{memoType:n}})}};var kh=["approve","approvedAmount","call","sendTransaction","transfer","isApproved","approvedAmount","EIP1193SendTransaction","getFeeData","broadcastTransaction","estimateCall","estimateGasLimit","estimateGasPrices","createContractTxObject"],Nh=(n,h,t)=>async(...o)=>{try{await Oh(h,t)}catch(c){throw new u({errorKey:"helpers_failed_to_switch_network",info:{error:c}})}return n(...o)},Sn=({provider:n,params:h,method:t})=>{if(!n?.send)throw new u("helpers_not_found_provider");let o=h?Array.isArray(h)?h:[h]:[];return n.send(t,o)},oo=({toolbox:n,chainId:h,provider:t=window.ethereum})=>{let o=kh.reduce((c,C)=>{if(!n[C])return c;let a=n[C];if(typeof a!=="function")return c;return{...c,[C]:Nh(a,t,h)}},{});return{...n,...o}},co=(n,h)=>Sn({provider:n,method:"wallet_addEthereumChain",params:[h]}),Oh=(n,h="0x1")=>Sn({provider:n,method:"wallet_switchEthereumChain",params:[{chainId:h}]}),so=(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)"CTRL";return"METAMASK"},ao=(n)=>{return gh().includes(n)},gh=()=>{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("CTRL");if(t)C.push("BRAVE");if(o)C.push("TRUSTWALLET_WEB");if(c)C.push("COINBASE_WEB");if(uh())C.push("OKX_MOBILE");return C};function xo({chain:n,covalentApiKey:h,ethplorerApiKey:t}){let o=n!=="ETH"&&!h?"covalentApiKey":t?void 0:"ethplorerApiKey";if(o)throw new u({errorKey:"wallet_missing_api_key",info:{missingKey:o}});return{covalentApiKey:h,ethplorerApiKey:t}}function io(){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 uh=()=>{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},Ro=()=>typeof window.ethereum!=="undefined";class L extends G{eq(n){return this.eqValue(n)}static fromBigInt(n,h){return new L({decimal:h,value:J({value:n,bigIntDecimal:h,decimal:h})})}}export{at as wrapWithThrow,Nh as wrapMethodWithNetworkSwitch,An as warnOnce,At as validateTNS,Bn as validateIdentifier,hn as updatedLastIndex,Oh as switchEVMWalletNetwork,eh as setRequestClientConfig,oo as prepareNetworkSwitch,uh as okxMobileEnabled,gh as listWeb3EVMWallets,Ro as isWeb3Detected,nn as isGasAsset,ao as isDetected,wh as initializeRPCUrlsWithFallback,Zt as getWalletFormatFor,st as getTHORNameCost,Kt as getSymmetricWithdraw,ah as getSymmetricPoolShare,W as getRPCUrl,_t as getMinAmountByChain,Ah as getMemoForWithdraw,ih as getMemoForUnbond,Fh as getMemoForSaverWithdraw,Rh as getMemoForSaverDeposit,lt as getMemoForRunePoolWithdraw,Et as getMemoForRunePoolDeposit,ph as getMemoForNameRegister,rt as getMemoForNamePreferredAssetRegister,Bh as getMemoForLoan,xh as getMemoForLeaveAndBond,Hh as getMemoForDeposit,et as getMemoFor,Ct as getMAYANameCost,mt as getLiquiditySlippage,Gt as getGasAsset,Vt as getEstimatedPoolShare,Co as getETHDefaultWallet,io as getEIP6963Wallets,it as getDynamicChainId,zt as getDerivationPathFor,Nn as getDecimal,On as getCommonAssetInfo,xt as getChainIdentifier,Qt as getAsymmetricRuneWithdrawAmount,sh as getAsymmetricRuneShare,Wt as getAsymmetricAssetWithdrawAmount,Ch as getAsymmetricAssetShare,gn as getAssetType,J as formatBigIntToSafeValue,yt as findAssetBy,wt as filterAssets,xo as ensureEVMApiKeys,ft as derivationPathToString,mn as defaultRequestHeaders,Xt as blockTimes,It as assetFromString,co as addEVMWalletNetwork,so as addAccountsChangedCallback,Wn as WarningCodeEnum,Rn as WalletOption,Lh as UTXOChains,Gh as TCSupportedChains,L as SwapKitNumber,u as SwapKitError,$h as SubstrateChains,v as StagenetChain,zh as SWAP_OUT,fh as SWAP_IN,b as RequestClient,Cn as RPC_URLS,zn as RPCUrl,bn as QuoteMode,Kn as ProviderName,K as NetworkDerivationPath,Hn as MemoType,Ih as MAYASupportedChains,Yn as LedgerErrorCode,Vn as FeeTypeEnum,Mn as FeeOption,Gn as FALLBACK_URLS,Zn as ExplorerUrl,Qn as ErrorCode,In as EXPLORER_URLS,Q as EVMChains,fn as DerivationPath,jh as CosmosChains,Jn as ContractAddress,kn as CommonAssetStrings,E as ChainToRPC,yh as ChainToHexChainId,Xh as ChainToExplorerUrl,xn as ChainToChainId,_h as ChainIdToChain,f as ChainId,_ as Chain,Ph as BlockTimes,G as BigIntArithmetics,A as BaseDecimal,O as AssetValue,qn as ApproveMode,Jh as AGG_SWAP};
//# debugId=CA139A65C7D8F7DB64756E2164756E21
//# debugId=457B4B13B60E7F4364756E2164756E21

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

"devDependencies": {
"@swapkit/toolbox-cosmos": "1.6.2",
"@swapkit/toolbox-evm": "1.7.8",
"@swapkit/toolbox-radix": "1.2.24",
"@swapkit/toolbox-solana": "1.3.8",
"@swapkit/toolbox-substrate": "1.3.8",
"@swapkit/toolbox-utxo": "1.2.8"
"@swapkit/toolbox-cosmos": "1.6.3",
"@swapkit/toolbox-evm": "1.7.9",
"@swapkit/toolbox-radix": "1.2.25",
"@swapkit/toolbox-solana": "1.3.9",
"@swapkit/toolbox-substrate": "1.3.9",
"@swapkit/toolbox-utxo": "1.2.9"
},

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

"types": "./src/index.ts",
"version": "2.0.0"
"version": "2.1.0"
}

@@ -30,4 +30,2 @@ export enum Chain {

export type WalletChain = Exclude<Chain, Chain.Fiat>;
export enum ChainId {

@@ -34,0 +32,0 @@ Arbitrum = "42161",

import type { RadixNetwork } from "@swapkit/toolbox-radix";
import type { Chain, WalletChain } from "./chains";
import type { Chain } from "./chains";
import type { ChainApis } from "./sdk";
import type { ChainWallet } from "./wallet";
import type { ChainWallet, CryptoChain } from "./wallet";

@@ -89,6 +89,6 @@ /**

export type ConnectWalletParams<M = { [key in string]: any }> = {
addChain: <T extends WalletChain>(params: ChainWallet<T> & M) => void;
addChain: <T extends CryptoChain>(params: ChainWallet<T> & M) => void;
apis: ChainApis;
config: ConnectConfig;
rpcUrls: { [chain in Chain]?: string };
rpcUrls: { [chain in CryptoChain]?: string };
};

@@ -95,0 +95,0 @@

@@ -34,2 +34,3 @@ import type { Chain } from "./chains";

XRD = "////",
FIAT = "////",
}

@@ -36,0 +37,0 @@

@@ -21,2 +21,4 @@ import type { CovalentApiType, EthplorerApiType } from "@swapkit/toolbox-evm";

[key in CosmosChain | Chain.Solana | Chain.Radix | Chain.Polkadot | Chain.Chainflip]?: string;
} & {
[key in Chain.Fiat]?: undefined;
};

@@ -23,0 +25,0 @@

@@ -10,3 +10,3 @@ import type { CosmosWallets, ThorchainWallets } from "@swapkit/toolbox-cosmos";

import type { AssetValue } from "../modules/assetValue";
import type { Chain, WalletChain } from "./chains";
import type { Chain } from "./chains";
import type { ConnectWalletParams } from "./commonTypes";

@@ -61,2 +61,4 @@

export type CryptoChain = Exclude<Chain, Chain.Fiat>;
export type ChainWallet<T extends Chain> = {

@@ -71,5 +73,5 @@ chain: T;

export type EmptyWallet = { [key in WalletChain]?: unknown };
export type EmptyWallet = { [key in Chain]?: unknown };
export type BaseWallet<T extends EmptyWallet | Record<string, unknown>> = {
[key in WalletChain]: ChainWallet<key> & (T extends EmptyWallet ? T[key] : never);
[key in Chain]: ChainWallet<key> & (T extends EmptyWallet ? T[key] : never);
};

@@ -97,3 +99,3 @@

export type SwapKitPluginParams<Config = {}> = {
getWallet: <T extends WalletChain>(chain: T) => FullWallet[T];
getWallet: <T extends CryptoChain>(chain: T) => FullWallet[T];
stagenet?: boolean;

@@ -100,0 +102,0 @@ config: Config;

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