@swapkit/helpers 4.0.10 → 4.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import{a as UF,c as IF}from"./chunk-hm14bfyg.js";export*from"@swapkit/tokens";import{getAddress as fF}from"ethers";import{match as vF}from"ts-pattern";var W;((G)=>{G.Arbitrum="ARB";G.Aurora="AURORA";G.Avalanche="AVAX";G.Base="BASE";G.Berachain="BERA";G.BinanceSmartChain="BSC";G.Bitcoin="BTC";G.BitcoinCash="BCH";G.Cosmos="GAIA";G.Dash="DASH";G.Dogecoin="DOGE";G.Ethereum="ETH";G.Fiat="FIAT";G.Gnosis="GNO";G.Kujira="KUJI";G.Litecoin="LTC";G.Maya="MAYA";G.Near="NEAR";G.Noble="NOBLE";G.Optimism="OP";G.Polkadot="DOT";G.Chainflip="FLIP";G.Polygon="POL";G.Radix="XRD";G.Ripple="XRP";G.THORChain="THOR";G.Solana="SOL";G.Tron="TRON";G.Zcash="ZEC"})(W||={});var ZF;((x)=>{x.THORChain="THOR_STAGENET";x.Maya="MAYA_STAGENET"})(ZF||={});var xF;((T)=>{T.Arbitrum="42161";T.ArbitrumHex="0xa4b1";T.Aurora="1313161554";T.AuroraHex="0x4e454152";T.Avalanche="43114";T.AvalancheHex="0xa86a";T.Base="8453";T.BaseHex="0x2105";T.Berachain="80094";T.BerachainHex="0x138de";T.BinanceSmartChain="56";T.BinanceSmartChainHex="0x38";T.Bitcoin="bitcoin";T.BitcoinCash="bitcoincash";T.Chainflip="chainflip";T.Cosmos="cosmoshub-4";T.Dash="dash";T.Dogecoin="dogecoin";T.Ethereum="1";T.EthereumHex="0x1";T.Fiat="fiat";T.Gnosis="100";T.GnosisHex="0x64";T.Kujira="kaiyo-1";T.Litecoin="litecoin";T.Maya="mayachain-mainnet-v1";T.MayaStagenet="mayachain-stagenet-v1";T.Near="near";T.Noble="noble-1";T.Optimism="10";T.OptimismHex="0xa";T.Polkadot="polkadot";T.Polygon="137";T.PolygonHex="0x89";T.Radix="radix-mainnet";T.Ripple="ripple";T.THORChain="thorchain-1";T.THORChainStagenet="thorchain-stagenet-v2";T.Solana="solana";T.Tron="728126428";T.TronHex="0x2b6653dc";T.Zcash="zcash"})(xF||={});var D$={["0xa4b1"]:"ARB",["42161"]:"ARB",["0x4e454152"]:"AURORA",["1313161554"]:"AURORA",["0xa86a"]:"AVAX",["43114"]:"AVAX",["0x2105"]:"BASE",["8453"]:"BASE",["0x138de"]:"BERA",["80094"]:"BERA",["0x38"]:"BSC",["56"]:"BSC",["bitcoincash"]:"BCH",["bitcoin"]:"BTC",["chainflip"]:"FLIP",["cosmoshub-4"]:"GAIA",["dash"]:"DASH",["dogecoin"]:"DOGE",["0x1"]:"ETH",["1"]:"ETH",["fiat"]:"FIAT",["0x64"]:"GNO",["100"]:"GNO",["kaiyo-1"]:"KUJI",["litecoin"]:"LTC",["mayachain-stagenet-v1"]:"MAYA",["mayachain-mainnet-v1"]:"MAYA",["near"]:"NEAR",["noble-1"]:"NOBLE",["0xa"]:"OP",["10"]:"OP",["polkadot"]:"DOT",["0x89"]:"POL",["137"]:"POL",["radix-mainnet"]:"XRD",["ripple"]:"XRP",["solana"]:"SOL",["thorchain-stagenet-v2"]:"THOR",["thorchain-1"]:"THOR",["728126428"]:"TRON",["0x2b6653dc"]:"TRON",["zcash"]:"ZEC"},mF=Object.keys(W),h=Object.values(W),X={ARB:18,AURORA:18,AVAX:18,BASE:18,BCH:8,BERA:18,BSC:18,BTC:8,DASH:8,DOGE:8,DOT:10,ETH:18,FIAT:2,FLIP:18,GAIA:6,GNO:18,KUJI:6,LTC:8,MAYA:8,NEAR:24,NOBLE:6,OP:18,POL:18,SOL:9,THOR:8,TRON:6,XRD:18,XRP:6,ZEC:8},S$={["ARB"]:0.3,["AURORA"]:1,["AVAX"]:3,["BASE"]:2,["BERA"]:2,["BSC"]:3,["BTC"]:600,["BCH"]:600,["FLIP"]:5,["GAIA"]:2,["DASH"]:150,["DOGE"]:600,["ETH"]:12.5,["FIAT"]:60,["GNO"]:5.2,["KUJI"]:2.2,["LTC"]:150,["MAYA"]:6,["NEAR"]:1,["NOBLE"]:1.3,["OP"]:2,["DOT"]:6,["POL"]:2.1,["XRD"]:5,["XRP"]:5,["SOL"]:0.4,["THOR"]:6,["TRON"]:3,["ZEC"]:150},g$=["DOT","FLIP"],O=["ARB","AURORA","AVAX","BASE","BERA","BSC","ETH","GNO","OP","POL"],c=["BTC","BCH","DASH","DOGE","LTC","ZEC"],YF=["GAIA","THOR","MAYA","KUJI","NOBLE"],f$={["GAIA"]:"cosmos",["THOR"]:"thor",["MAYA"]:"maya",["KUJI"]:"kujira",["NOBLE"]:"noble"},JF={["ARB"]:"https://arb1.arbitrum.io/rpc",["AURORA"]:"https://aurora-rpc.publicnode.com",["AVAX"]:"https://api.avax.network/ext/bc/C/rpc",["BASE"]:"https://base-rpc.publicnode.com",["BERA"]:"https://berachain-rpc.publicnode.com",["BSC"]:"https://bsc-dataseed.binance.org",["BCH"]:"https://node-router.thorswap.net/bitcoin-cash",["BTC"]:"https://bitcoin-rpc.publicnode.com",["FLIP"]:"wss://mainnet-archive.chainflip.io",["GAIA"]:"https://cosmos-rpc.publicnode.com:443",["DASH"]:"https://dash-rpc.publicnode.com",["DOGE"]:"https://node-router.thorswap.net/dogecoin",["ETH"]:"https://ethereum-rpc.publicnode.com",["FIAT"]:"",["GNO"]:"https://gnosis-rpc.publicnode.com",["KUJI"]:"https://kujira-rpc.ibs.team",["LTC"]:"https://node-router.thorswap.net/litecoin",["MAYA"]:"https://tendermint.mayachain.info",["NEAR"]:"https://rpc.mainnet.near.org",["NOBLE"]:"https://noble-rpc.polkachu.com",["OP"]:"https://mainnet.optimism.io",["DOT"]:"wss://rpc.polkadot.io",["POL"]:"https://polygon-rpc.com",["XRD"]:"https://radix-mainnet.rpc.grove.city/v1/326002fc/core",["XRP"]:"wss://xrpl.ws/",["SOL"]:"https://solana-rpc.publicnode.com",["THOR"]:"https://rpc.ninerealms.com",["TRON"]:"https://tron-rpc.publicnode.com",["ZEC"]:"https://api.tatum.io/v3/blockchain/node/zcash-mainnet/t-6894a2ae7fc90cccfd3ce71b-2fce88aa7f4a41a5b1e93874",["MAYA_STAGENET"]:"",["THOR_STAGENET"]:"https://stagenet-rpc.ninerealms.com"},o={["THOR"]:"https://thornode.ninerealms.com",["MAYA"]:"https://mayanode.mayachain.info",["THOR_STAGENET"]:"https://stagenet-thornode.ninerealms.com",["MAYA_STAGENET"]:"https://stagenet.mayanode.mayachain.info"},MF={["ARB"]:["https://arb-mainnet.g.alchemy.com/v2/demo","https://arbitrum.blockpi.network/v1/rpc/public"],["AURORA"]:["https://1rpc.io/aurora","https://mainnet.aurora.dev"],["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"],["BERA"]:["https://rpc.berachain.com","https://berachain.drpc.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.publicnode.com"],["DASH"]:["https://dash-rpc.publicnode.com"],["DOGE"]:["https://doge.getblock.io/mainnet","https://dogecoin.publicnode.com"],["ETH"]:["https://eth.llamarpc.com","https://cloudflare-eth.com"],["FIAT"]:[],["GNO"]:["https://gnosis.drpc.org","https://rpc.ankr.com/gnosis"],["KUJI"]:["https://kujira-rpc.polkachu.com","https://rpc-kujira.synergynodes.com/"],["LTC"]:["https://ltc.getblock.io/mainnet","https://litecoin.publicnode.com"],["MAYA"]:["https://tendermint.mayachain.info","https://maya-tendermint.publicnode.com"],["MAYA_STAGENET"]:[],["NEAR"]:["https://1rpc.io/near","https://near.lava.build","https://near-mainnet.infura.io/v3/3cbfcafa5e1e48b7bb0ea41f2fbc4abf"],["NOBLE"]:["https://rpc.noble.xyz","https://rpc.cosmos.directory/noble"],["OP"]:["https://optimism.llamarpc.com","https://1rpc.io/op"],["DOT"]:["wss://polkadot-rpc.dwellir.com","wss://polkadot.api.onfinality.io/public-ws"],["POL"]:["https://polygon.llamarpc.com","https://polygon-bor-rpc.publicnode.com"],["XRD"]:["https://mainnet.radixdlt.com","https://radix-mainnet.rpc.grove.city/v1"],["XRP"]:["wss://s1.ripple.com/","wss://s2.ripple.com/"],["THOR"]:["https://thornode.ninerealms.com",o.THOR],["THOR_STAGENET"]:[],["SOL"]:["https://api.mainnet-beta.solana.com","https://solana-mainnet.rpc.extrnode.com"],["TRON"]:["https://api.tronstack.io","https://api.tron.network"],["ZEC"]:[]},NF={["ARB"]:"https://arbiscan.io",["AURORA"]:"https://explorer.mainnet.aurora.dev",["AVAX"]:"https://snowtrace.io",["BASE"]:"https://basescan.org",["BERA"]:"https://berascan.com",["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"]:"",["GNO"]:"https://gnosisscan.io",["KUJI"]:"https://finder.kujira.network/kaiyo-1",["LTC"]:"https://blockchair.com/litecoin",["MAYA"]:"https://www.mayascan.org",["NEAR"]:"https://nearblocks.io",["NOBLE"]:"https://www.mintscan.io/noble",["OP"]:"https://optimistic.etherscan.io",["DOT"]:"https://polkadot.subscan.io",["POL"]:"https://polygonscan.com",["XRD"]:"https://dashboard.radixdlt.com",["XRP"]:"https://livenet.xrpl.org/",["THOR"]:"https://runescan.io",["SOL"]:"https://solscan.io",["TRON"]:"https://tronscan.org",["ZEC"]:"https://blockchair.com/zcash"},XF=h.reduce((F,$)=>{let x=mF.find((N)=>W[N]===$);if(x)F[$]=x;return F},{}),LF=h.reduce((F,$)=>{return F[$]=xF[XF[$]],F},{}),PF=h.reduce((F,$)=>{let x=`${XF[$]}Hex`;return F[$]=xF[x],F},{}),v$=h.reduce((F,$)=>{return F[$]=NF[$],F},{});import{match as t}from"ts-pattern";import{createStore as rF}from"zustand/vanilla";var oF;((Y)=>{Y.ARB="0x0000000000000000000000000000000000000000";Y.AURORA="0x0000000000000000000000000000000000000000";Y.AVAX="0x0000000000000000000000000000000000000000";Y.BASE="0x0000000000000000000000000000000000000000";Y.BERA="0x0000000000000000000000000000000000000000";Y.ETH="0x0000000000000000000000000000000000000000";Y.BSC="0x0000000000000000000000000000000000000000";Y.GNO="0x0000000000000000000000000000000000000000";Y.MATIC="0x0000000000000000000000000000000000001010";Y.OP="0x4200000000000000000000000000000000000042"})(oF||={});var E={ARB:[44,60,0,0,0],AURORA:[44,60,0,0,0],AVAX:[44,60,0,0,0],BASE:[44,60,0,0,0],BCH:[44,145,0,0,0],BERA:[44,60,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],DOT:[0,0,0,0,0],ETH:[44,60,0,0,0],FIAT:[0,0,0,0,0],FLIP:[0,0,0,0,0],GAIA:[44,118,0,0,0],GNO:[44,60,0,0,0],KUJI:[44,118,0,0,0],LTC:[84,2,0,0,0],MAYA:[44,931,0,0,0],NEAR:[44,397,0,0,0],NOBLE:[44,118,0,0,0],OP:[44,60,0,0,0],POL:[44,60,0,0,0],SOL:[44,501,0,0,0],THOR:[44,931,0,0,0],TRON:[44,195,0,0,0],XRD:[0,0,0,0,0],XRP:[44,144,0,0,0],ZEC:[44,133,0,0,0]};var hF;((H)=>{H.unknownError="unknownError";H.test_error="test_error";H.providerDetailsError="providerDetailsError";H.blockHeaderNotFound="blockHeaderNotFound";H.blockHashNotFoundAtHeight="blockHashNotFoundAtHeight";H.blockHashNotFoundAtHash="blockHashNotFoundAtHash";H.txHashMissing="txHashMissing";H.assetValueMissingInfo="assetValueMissingInfo";H.invalidAsset="invalidAsset";H.blockIsRequired="blockIsRequired";H.currentBlockHeaderNotFound="currentBlockHeaderNotFound";H.failedToRetrieveBalance="failedToRetrieveBalance";H.failedToRetrieveBlock="failedToRetrieveBlock";H.failedToRetrieveFees="failedToRetrieveFees";H.notImplementedBCH="notImplementedBCH";H.notImplementedDoge="notImplementedDoge";H.noPoolsFound="noPoolsFound";H.noVaultsFound="noVaultsFound";H.noTxFound="noTxFound";H.noInputCoinFound="noInputCoinFound";H.noBlockDataFound="noBlockDataFound";H.multipleCosmosMessages="multipleCosmosMessages";H.heightOrHashNotProvided="heightOrHashNotProvided";H.unknownDenom="unknownDenom";H.invalidBlockHeight="invalidBlockHeight";H.timestampExtrinsicNoArgumentsForBlock="timestampExtrinsicNoArgumentsForBlock";H.timestampExtrinsicNoTimestampForBlock="timestampExtrinsicNoTimestampForBlock";H.noTimestampExtrinsicForHash="noTimestampExtrinsicForHash";H.timestampExtrinsicNoArgumentsForHash="timestampExtrinsicNoArgumentsForHash";H.txMemoUndefined="txMemoUndefined";H.txMemoIncorrect="txMemoIncorrect";H.txTypeNotFound="txTypeNotFound";H.txNoMessage="txNoMessage";H.txNotFound="txNotFound";H.txReceiptNotFound="txReceiptNotFound";H.txParsingError="txParsingError";H.txLogsParsingError="txLogsParsingError";H.blockNotFound="blockNotFound";H.balanceNotFound="balanceNotFound";H.configError="configError";H.synthSwapDisallowed="synthSwapDisallowed";H.providerQuoteTimeout="providerQuoteTimeout";H.noQuoteResponse="noQuoteResponse";H.noPoolAssetsFound="noPoolAssetsFound";H.noThorchainPools="noThorchainPools";H.noMayachainPools="noMayachainPools";H.noThorchainNetworkInfo="noThorchainNetworkInfo";H.invalidAffiliateFee="invalidAffiliateFee";H.invalidBuyAssetAddress="invalidBuyAssetAddress";H.invalidSellAssetAddress="invalidSellAssetAddress";H.invalidSourceAddress="invalidSourceAddress";H.invalidDestinationAddress="invalidDestinationAddress";H.sourceAddressIsSmartContract="sourceAddressIsSmartContract";H.destinationAddressIsSmartContract="destinationAddressIsSmartContract";H.invalidChainId="invalidChainId";H.unsupportedChainId="unsupportedChainId";H.unsupportedEVMChainId="unsupportedEVMChainId";H.unsupportedMethod="unsupportedMethod";H.unsupportedProvider="unsupportedProvider";H.invalidParamsForMethod="invalidParamsForMethod";H.unsupportedAdapter="unsupportedAdapter";H.noWhitelistTokens="noWhitelistTokens";H.failedFetchGasPrice="failedFetchGasPrice";H.failedToCreateDepositChannel="failedToCreateDepositChannel";H.noProviderDetailsFound="noProviderDetailsFound";H.noTokenListsFound="noTokenListsFound";H.tokenNotFound="tokenNotFound";H.tokenPriceNotFound="tokenPriceNotFound";H.tokenPriceFailedToUpdate="tokenPriceFailedToUpdate";H.swapAmountTooSmall="swapAmountTooSmall";H.legsArrayIsEmpty="legsArrayIsEmpty";H.failedToFetchQuoteForLeg="failedToFetchQuoteForLeg";H.noBlockHeaderFound="noBlockHeaderFound";H.failedToSimulateSwap="failedToSimulateSwap";H.addressScreeningFailed="addressScreeningFailed";H.noLiquidtyProvidersFound="noLiquidtyProvidersFound";H.insufficientLiquidity="insufficientLiquidity";H.noInboundDataFound="noInbounDataFound";H.noInboundAddressesFound="noInboundAddressesFound";H.noInboundAddressFoundForChain="noInboundAddressFoundForChain";H.noLastBlocksFound="noLastBlocksFound";H.noVersionFound="noVersionFound";H.noConstantsFound="noConstantsFound";H.noMimirsFound="noMimirsFound";H.noRoutesFound="noRoutesFound";H.quoteNotFound="quoteNotFound";H.ledgerSignFailed="ledgerSignFailed";H.ledgerWrongPayload="ledgerWrongPayload";H.ledgerFetchSwapFailed="ledgerFetchSwapFailed";H.failedToFetchTx="failedToFetchTx";H.failedBuildTransactionDetails="failedBuildTransactionDetails";H.noLegsForRoute="noLegsForRoute";H.noRouterAddressFound="noRouterAddressFound";H.noAggregatorAddressFound="noAggregatorAddressFound";H.noContractInstanceFound="noContractInstanceFound";H.noContractAddressFound="noContractAddressFound";H.invalidAffiliate="invalidAffiliate";H.thornameAffiliate="thornameAffiliate";H.providerNotfound="No provider found";H.noRecordFound="No Record found";H.slippageTooLow="Slippage too low";H.tradingHalted="tradingHalted";H.noWrappedGasAsset="noWrappedGasAsset";H.aggregatorAddressNotFound="aggregatorAddressNotFound";H.routerAddressNotFound="routerAddressNotFound";H.dummyAddressNotFound="dummyAddressNotFound";H.trackerError="trackerError";H.thorchainPoolUnavailable="thorchainPoolUnavailable";H.noOhlcvDataFound="noOhlcvDataFound";H.noTradingPairs="noTradingPairs";H.noLendingAvailability="noLendingAvailability";H.lendingRepayTooSmall="lendingRepayTooSmall";H.missingState="missingState";H.ledgerSwapNotFound="ledgerSwapNotFound";H.ledgerSwapNotReadyForTracking="ledgerSwapNotReadyForTracking";H.errorEstimatingGas="errorEstimatingGas";H.apiKeyInvalid="apiKeyInvalid";H.apiKeyFailedToUpdate="apiKeyFailedToUpdate";H.apiKeyExpired="apiKeyExpired";H.unauthorized="unauthorized";H.failedToCreateMemo="failedToCreateMemo";H.radixIncorrectInstructions="radixIncorrectInstructions";H.radixTxMissedParam="radixTxMissedParam";H.radixTxMissedAccount="radixTxMissedAccount";H.radixManifestParseError="radixManifestParseError";H.radixManifestBuildError="radixManifestBuildError";H.invalidAddressForChain="invalidAddressForChain";H.riskyAddress="riskyAddress";H.noRoutesToProcess="noRoutesToProcess";H.sellAssetAmountTooSmall="sellAssetAmountTooSmall";H.missingPrivateKey="missingPrivateKey";H.noMemoPriceProtection="noMemoPriceProtection"})(hF||={});var cF;((x)=>{x.highSlippage="highSlippage";x.highPriceImpact="highPriceImpact"})(cF||={});var lF;((J)=>{J.CAVIAR_V1="CAVIAR_V1";J.CAMELOT_V3="CAMELOT_V3";J.CHAINFLIP="CHAINFLIP";J.CHAINFLIP_STREAMING="CHAINFLIP_STREAMING";J.JUPITER="JUPITER";J.MAYACHAIN="MAYACHAIN";J.MAYACHAIN_STREAMING="MAYACHAIN_STREAMING";J.OCISWAP_V1="OCISWAP_V1";J.ONEINCH="ONEINCH";J.OPENOCEAN_V2="OPENOCEAN_V2";J.PANCAKESWAP="PANCAKESWAP";J.PANGOLIN_V1="PANGOLIN_V1";J.SUSHISWAP_V2="SUSHISWAP_V2";J.THORCHAIN="THORCHAIN";J.THORCHAIN_STREAMING="THORCHAIN_STREAMING";J.TRADERJOE_V2="TRADERJOE_V2";J.UNISWAP_V2="UNISWAP_V2";J.UNISWAP_V3="UNISWAP_V3";J.NEAR="NEAR"})(lF||={});var nF;((_)=>{_.LIQUIDITY="liquidity";_.NETWORK="network";_.INBOUND="inbound";_.OUTBOUND="outbound";_.AFFILIATE="affiliate";_.TAX="tax";_.PRIORITY="priority"})(nF||={});var jF;((N)=>{N.Average="average";N.Fast="fast";N.Fastest="fastest"})(jF||={});var sF;((x)=>{x.Approve="approve";x.CheckOnly="checkOnly"})(sF||={});var WF;((Z)=>{Z.NAME_REGISTER="~";Z.BOND="BOND";Z.DEPOSIT="+";Z.LEAVE="LEAVE";Z.UNBOND="UNBOND";Z.WITHDRAW="-";Z.RUNEPOOL_DEPOSIT="POOL+";Z.RUNEPOOL_WITHDRAW="POOL-";Z.CLAIM_TCY="tcy";Z.STAKE_TCY="tcy+";Z.UNSTAKE_TCY="tcy-"})(WF||={});var l;((G)=>{G.BITGET="BITGET";G.BRAVE="BRAVE";G.COINBASE_MOBILE="COINBASE_MOBILE";G.COINBASE_WEB="COINBASE_WEB";G.COSMOSTATION="COSMOSTATION";G.CTRL="CTRL";G.EIP6963="EIP6963";G.EXODUS="EXODUS";G.KEEPKEY="KEEPKEY";G.KEEPKEY_BEX="KEEPKEY_BEX";G.KEPLR="KEPLR";G.KEYSTORE="KEYSTORE";G.LEAP="LEAP";G.LEDGER="LEDGER";G.LEDGER_LIVE="LEDGER_LIVE";G.METAMASK="METAMASK";G.OKX="OKX";G.OKX_MOBILE="OKX_MOBILE";G.ONEKEY="ONEKEY";G.PHANTOM="PHANTOM";G.POLKADOT_JS="POLKADOT_JS";G.RADIX_WALLET="RADIX_WALLET";G.TREZOR="TREZOR";G.TALISMAN="TALISMAN";G.TRONLINK="TRONLINK";G.TRUSTWALLET_WEB="TRUSTWALLET_WEB";G.VULTISIG="VULTISIG";G.WALLETCONNECT="WALLETCONNECT";G.XAMAN="XAMAN"})(l||={});var tF;((N)=>{N[N.NoError=36864]="NoError";N[N.LockedDevice=21781]="LockedDevice";N[N.TC_NotFound=65535]="TC_NotFound"})(tF||={});var iF={apiKeys:{blockchair:"",keepKey:"",swapKit:"",walletConnectProjectId:"",xaman:""},apis:{},chains:Object.values(W),envs:{apiUrl:"https://api.swapkit.dev",devApiUrl:"https://dev-api.swapkit.dev",isDev:!1,isStagenet:!1},explorerUrls:NF,fallbackRpcUrls:MF,feeMultipliers:void 0,integrations:{radix:{applicationName:"Swapkit Playground",applicationVersion:"0.0.1",dAppDefinitionAddress:"account_rdx128r289p58222hcvev7frs6kue76pl7pdcnw8725aw658v0zggkh9ws",network:{dashboardBase:"https://dashboard.radixdlt.com",networkId:1,networkName:"mainnet"}}},nodeUrls:o,requestOptions:{retry:{backoffMultiplier:2,baseDelay:300,maxDelay:5000,maxRetries:3},timeoutMs:30000},rpcUrls:JF,wallets:Object.values(l)},V=rF((F)=>({...iF,setApiKey:($,x)=>F((N)=>({apiKeys:{...N.apiKeys,[$]:x}})),setConfig:($)=>F((x)=>({apiKeys:{...x.apiKeys,...$.apiKeys},chains:x.chains.concat($.chains||[]),envs:{...x.envs,...$.envs},explorerUrls:{...x.explorerUrls,...$.explorerUrls},feeMultipliers:$.feeMultipliers||x.feeMultipliers,integrations:{...x.integrations,...$.integrations},nodeUrls:{...x.nodeUrls,...$.nodeUrls},rpcUrls:{...x.rpcUrls,...$.rpcUrls},wallets:x.wallets.concat($.wallets||[])})),setEnv:($,x)=>F((N)=>({envs:{...N.envs,[$]:x}})),setExplorerUrl:($,x)=>F((N)=>({explorerUrls:{...N.explorerUrls,[$]:x}})),setFallbackRpcUrls:($,x)=>F((N)=>({fallbackRpcUrls:{...N.fallbackRpcUrls,[$]:x}})),setFeeMultipliers:($)=>F(()=>({feeMultipliers:$})),setIntegrationConfig:($,x)=>F((N)=>({integrations:{...N.integrations,[$]:x}})),setNodeUrl:($,x)=>F((N)=>({nodeUrls:{...N.nodeUrls,[$]:x}})),setRequestOptions:($)=>F((x)=>({requestOptions:{retry:{...x.requestOptions.retry,...$.retry},timeoutMs:$.timeoutMs||x.requestOptions.timeoutMs}})),setRpcUrl:($,x)=>F((N)=>({rpcUrls:{...N.rpcUrls,[$]:x}}))})),I={get:(F)=>V.getState()[F],getState:V.getState,set:(F)=>V.getState().setConfig(F),setApiKey:(F,$)=>V.getState().setApiKey(F,$),setEnv:(F,$)=>V.getState().setEnv(F,$),setExplorerUrl:(F,$)=>V.getState().setExplorerUrl(F,$),setFallbackRpcUrls:(F,$)=>V.getState().setFallbackRpcUrls(F,$),setFeeMultipliers:(F)=>V.getState().setFeeMultipliers(F),setIntegrationConfig:(F,$)=>V.getState().setIntegrationConfig(F,$),setNodeUrl:(F,$)=>V.getState().setNodeUrl(F,$),setRequestOptions:(F)=>V.getState().setRequestOptions(F),setRpcUrl:(F,$)=>V.getState().setRpcUrl(F,$)};var aF={core_estimated_max_spendable_chain_not_supported:10001,core_extend_error:10002,core_inbound_data_not_found:10003,core_approve_asset_address_or_from_not_found:10004,core_plugin_not_found:10005,core_plugin_swap_not_found:10006,core_approve_asset_target_invalid:10007,core_explorer_unsupported_chain:10008,core_verify_message_not_supported:10009,core_chain_halted:10010,core_wallet_connection_not_found:10101,core_wallet_ctrl_not_installed:10102,core_wallet_evmwallet_not_installed:10103,core_wallet_walletconnect_not_installed:10104,core_wallet_keystore_not_installed:10105,core_wallet_ledger_not_installed:10106,core_wallet_trezor_not_installed:10107,core_wallet_keplr_not_installed:10108,core_wallet_okx_not_installed:10109,core_wallet_keepkey_not_installed:10110,core_wallet_talisman_not_installed:10111,core_wallet_not_keypair_wallet:10112,core_wallet_sign_message_not_supported:10113,core_wallet_connection_failed:10114,core_swap_invalid_params:10201,core_swap_route_not_complete:10202,core_swap_asset_not_recognized:10203,core_swap_contract_not_found:10204,core_swap_route_transaction_not_found:10205,core_swap_contract_not_supported:10206,core_swap_transaction_error:10207,core_swap_quote_mode_not_supported:10208,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:20001,wallet_missing_api_key:20002,wallet_chain_not_supported:20003,wallet_missing_params:20004,wallet_provider_not_found:20005,wallet_failed_to_add_or_switch_network:20006,wallet_locked:20007,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_ledger_transport_error:20106,wallet_ledger_public_key_error:20107,wallet_ledger_derivation_path_error:20108,wallet_ledger_signing_error:20109,wallet_ledger_app_not_open:20110,wallet_ledger_invalid_response:20111,wallet_ledger_method_not_supported:20112,wallet_ledger_invalid_params:20113,wallet_ledger_invalid_signature:20114,wallet_ledger_no_provider:20115,wallet_ledger_pubkey_not_found:20116,wallet_ledger_transport_not_defined:20117,wallet_ledger_webusb_not_supported:20118,wallet_ledger_chain_not_supported:20119,wallet_ledger_invalid_asset:20120,wallet_ledger_invalid_account:20121,wallet_ledger_address_not_found:20122,wallet_ledger_failed_to_get_address:20123,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_walletconnect_chain_not_supported:20404,wallet_walletconnect_invalid_method:20405,wallet_walletconnect_method_not_supported:20406,wallet_trezor_failed_to_sign_transaction:20501,wallet_trezor_derivation_path_not_supported:20502,wallet_trezor_failed_to_get_address:20503,wallet_trezor_transport_error:20504,wallet_trezor_method_not_supported:20505,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_radix_invalid_manifest:20803,wallet_radix_method_not_supported:20804,wallet_radix_no_account:20805,wallet_keepkey_not_found:20901,wallet_keepkey_asset_not_defined:20902,wallet_keepkey_contract_address_not_provided:20903,wallet_keepkey_send_transaction_no_address:20904,wallet_keepkey_derivation_path_error:20905,wallet_keepkey_signing_error:20906,wallet_keepkey_transport_error:20907,wallet_keepkey_unsupported_chain:20908,wallet_keepkey_invalid_response:20909,wallet_keepkey_chain_not_supported:20910,wallet_keepkey_signer_not_found:20911,wallet_keepkey_no_accounts:20912,wallet_keepkey_method_not_supported:20913,wallet_keepkey_invalid_params:20914,wallet_keepkey_config_not_found:20915,wallet_keepkey_no_provider:20916,wallet_keepkey_account_not_found:20917,wallet_bitkeep_not_found:21001,wallet_bitkeep_failed_to_switch_network:21002,wallet_bitkeep_no_accounts:21003,wallet_exodus_sign_transaction_error:21101,wallet_exodus_not_found:21102,wallet_exodus_no_address:21103,wallet_exodus_request_canceled:21104,wallet_exodus_signature_canceled:21105,wallet_exodus_failed_to_switch_network:21106,wallet_exodus_chain_not_supported:21107,wallet_exodus_instance_missing:21108,wallet_onekey_not_found:21201,wallet_onekey_sign_transaction_error:21202,wallet_okx_not_found:21301,wallet_okx_chain_not_supported:21302,wallet_okx_failed_to_switch_network:21303,wallet_okx_no_accounts:21304,wallet_keplr_not_found:21401,wallet_keplr_chain_not_supported:21402,wallet_keplr_signer_not_found:21403,wallet_keplr_no_accounts:21404,wallet_cosmostation_not_found:21501,wallet_cosmostation_chain_not_supported:21502,wallet_cosmostation_evm_provider_not_found:21503,wallet_cosmostation_keplr_provider_not_found:21504,wallet_cosmostation_no_accounts:21505,wallet_cosmostation_no_evm_accounts:21506,wallet_cosmostation_no_evm_address:21507,wallet_cosmostation_signer_not_found:21508,wallet_xdefi_not_found:21601,wallet_xdefi_chain_not_supported:21602,wallet_coinbase_not_found:21701,wallet_coinbase_chain_not_supported:21702,wallet_coinbase_method_not_supported:21703,wallet_coinbase_no_accounts:21704,wallet_evm_extensions_failed_to_switch_network:21801,wallet_evm_extensions_no_provider:21802,wallet_evm_extensions_not_found:21803,wallet_keystore_invalid_password:21901,wallet_keystore_unsupported_version:21902,wallet_near_extensions_failed_to_switch_network:22001,wallet_near_extensions_no_provider:22002,wallet_near_extensions_not_found:22003,wallet_near_method_not_supported:22003,wallet_vultisig_not_found:22101,wallet_vultisig_contract_address_not_provided:22102,wallet_vultisig_asset_not_defined:22103,wallet_vultisig_send_transaction_no_address:22104,wallet_xaman_not_configured:23001,wallet_xaman_not_connected:23002,wallet_xaman_auth_failed:23003,wallet_xaman_connection_failed:23004,wallet_xaman_transaction_failed:23005,wallet_xaman_monitoring_failed:23006,chainflip_channel_error:30001,chainflip_unknown_asset:30002,chainflip_broker_invalid_params:30101,chainflip_broker_recipient_error:30102,chainflip_broker_register:30103,chainflip_broker_tx_error:30104,chainflip_broker_withdraw:30105,chainflip_broker_fund_only_flip_supported:30106,chainflip_broker_fund_invalid_address:30107,thorchain_chain_halted:40001,thorchain_trading_halted:40002,thorchain_asset_is_not_tcy:40003,thorchain_swapin_router_required:40101,thorchain_swapin_vault_required:40102,thorchain_swapin_memo_required:40103,thorchain_swapin_token_required:40104,thorchain_preferred_asset_payout_required:40105,toolbox_cosmos_account_not_found:50101,toolbox_cosmos_invalid_fee:50102,toolbox_cosmos_invalid_params:50103,toolbox_cosmos_no_signer:50104,toolbox_cosmos_not_supported:50105,toolbox_cosmos_signer_not_defined:50106,toolbox_cosmos_validate_address_prefix_not_found:50107,toolbox_cosmos_verify_signature_no_pubkey:50108,toolbox_evm_error_estimating_gas_limit:50201,toolbox_evm_error_sending_transaction:50202,toolbox_evm_gas_estimation_error:50203,toolbox_evm_invalid_gas_asset_address:50204,toolbox_evm_invalid_params:50205,toolbox_evm_invalid_transaction:50206,toolbox_evm_no_abi_fragment:50207,toolbox_evm_no_contract_address:50208,toolbox_evm_no_fee_data:50209,toolbox_evm_no_from_address:50210,toolbox_evm_no_gas_price:50211,toolbox_evm_no_signer_address:50212,toolbox_evm_no_signer:50213,toolbox_evm_no_to_address:50214,toolbox_evm_not_supported:50215,toolbox_evm_provider_not_eip1193_compatible:50216,toolbox_utxo_api_error:50301,toolbox_utxo_broadcast_failed:50302,toolbox_utxo_insufficient_balance:50303,toolbox_utxo_invalid_address:50304,toolbox_utxo_invalid_params:50305,toolbox_utxo_invalid_transaction:50306,toolbox_utxo_no_signer:50307,toolbox_utxo_not_supported:50308,toolbox_solana_no_signer:50401,toolbox_solana_fee_estimation_failed:50402,toolbox_substrate_not_supported:50501,toolbox_substrate_transfer_error:50502,toolbox_radix_method_not_supported:50601,toolbox_ripple_get_balance_error:50701,toolbox_ripple_rpc_not_configured:50702,toolbox_ripple_signer_not_found:50703,toolbox_ripple_asset_not_supported:50704,toolbox_ripple_broadcast_error:50705,toolbox_tron_no_signer:50801,toolbox_tron_invalid_token_identifier:50802,toolbox_tron_token_transfer_failed:50803,toolbox_tron_transaction_creation_failed:50804,toolbox_tron_fee_estimation_failed:50805,toolbox_tron_trongrid_api_error:50806,toolbox_tron_approve_failed:50807,toolbox_tron_invalid_token_contract:50808,toolbox_tron_allowance_check_failed:50809,toolbox_near_no_signer:90601,toolbox_near_invalid_address:90602,toolbox_near_invalid_amount:90603,toolbox_near_transfer_failed:90604,toolbox_near_access_key_error:90605,toolbox_near_no_rpc_url:90606,toolbox_near_empty_batch:90607,toolbox_near_balance_failed:90608,toolbox_near_invalid_name:90609,toolbox_near_missing_contract_address:90610,toolbox_near_no_account:90611,toolbox_near_invalid_gas_params:90612,toolbox_not_supported:59901,plugin_near_invalid_name:41001,plugin_near_no_connection:41002,plugin_near_name_unavailable:41003,plugin_near_registration_failed:41004,plugin_near_transfer_failed:41005,api_v2_invalid_response:60001,api_v2_server_error:60002,api_v2_invalid_method_key_hash:60003,helpers_invalid_number_different_decimals:70001,helpers_invalid_number_of_years:70002,helpers_invalid_identifier:70003,helpers_invalid_asset_url:70004,helpers_invalid_asset_identifier:70005,helpers_invalid_memo_type:70006,helpers_failed_to_switch_network:70007,helpers_not_found_provider:70008,helpers_chain_not_supported:70009,helpers_invalid_params:70010,helpers_invalid_response:70011,not_implemented:99999};class M extends Error{static ErrorCode=aF;constructor(F,$){let x=typeof F==="string",N=x?F:F.errorKey,P=x?void 0:F.info,R=`${N}${P?`: ${JSON.stringify(P)}`:""}`;super(R);if(Object.setPrototypeOf(this,M.prototype),this.name="SwapKitError",this.cause=$,$)console.error(`SwapKitError [${N}]:`,$);else if(P)console.error(`SwapKitError [${N}]:`,P)}}var eF=(F)=>new Promise(($)=>setTimeout($,F)),F$=(F,{baseDelay:$,backoffMultiplier:x,maxDelay:N})=>Math.min($*x**F,N),$$=async(F,$)=>{let x=await fetch(F,$);if(!x.ok){let P={message:await x.text(),status:x.status,statusText:x.statusText};throw new M({errorKey:"helpers_invalid_response",info:P},P)}return x.json()};function n(F,$={}){return async function x(N,P={}){let{searchParams:R,json:A,body:_,headers:B,dynamicHeader:Q,retry:Y,timeoutMs:Z,abortController:w,onError:L,onSuccess:j,responseHandler:S,...k}={...$,...P},U=I.get("requestOptions"),K={...U.retry,...Y},J=!!A||N.endsWith(".json"),pF=N$(N,R),CF=x$(J,{...B,...Q?.()}),dF=J?JSON.stringify(A):_,$F;for(let m=0;m<=K.maxRetries;m++){let QF=w||new AbortController,zF=setTimeout(()=>QF.abort(),Z||U.timeoutMs);try{let f=await $$(pF,{...k,body:dF,headers:CF,method:F,signal:QF.signal});return clearTimeout(zF),j?.(f)||S?.(f)||f}catch(f){if(clearTimeout(zF),$F=f,m>=K.maxRetries)return L?L(f):Promise.reject(f);await eF(F$(m,K))}}return L?L($F):Promise.reject($F)}}function x$(F,$){return{...$,...F&&{"Content-Type":"application/json"}}}function N$(F,$){let x=new URL(F);if($)x.search=new URLSearchParams($).toString();return x.toString()}var s={extend:(F)=>({extend:($)=>s.extend({...F,...$}),get:n("GET",F),post:n("POST",F)}),get:n("GET"),post:n("POST")};import{match as kF}from"ts-pattern";function Nx(F){if(F<0)throw new M({errorKey:"helpers_invalid_number_of_years",info:{numberOfYears:F}});return 10+F}function Px(F){if(F<0)throw new M({errorKey:"helpers_invalid_number_of_years",info:{numberOfYears:F}});return Math.round((10+F*1.0512)*10000000000)/10000000000}function Hx(F,$){try{return F()}catch(x){if($)throw new M($,x);return}}function Rx(F){switch(F){case"THOR":return`${F}.RUNE`;case"GAIA":return`${F}.ATOM`;case"BSC":return`${F}`;default:return`${F}.${F}`}}var qF=new Set;function y({condition:F,id:$,warning:x}){if(F){if(qF.has($))return;console.warn(x),qF.add($)}}function P$(F){return kF(F).with(...O,()=>({id:1,jsonrpc:"2.0",method:"eth_blockNumber",params:[]})).with(...c,()=>({id:"test",jsonrpc:"1.0",method:"getblockchaininfo",params:[]})).with(...YF,"MAYA_STAGENET","THOR_STAGENET",()=>({id:1,jsonrpc:"2.0",method:"status",params:{}})).with("DOT","FLIP",()=>({id:1,jsonrpc:"2.0",method:"system_health",params:[]})).with("SOL",()=>({id:1,jsonrpc:"2.0",method:"getHealth"})).with("TRON","XRD","FIAT",()=>"").with("NEAR",()=>({id:"dontcare",jsonrpc:"2.0",method:"status",params:[]})).with("XRP",()=>({id:1,jsonrpc:"2.0",method:"ping",params:[{}]})).otherwise(()=>{throw new M("helpers_chain_not_supported",{chain:F})})}function H$(F){return kF(F).with("XRD",()=>"/status/network-configuration").with("TRON",()=>"/wallet/getnowblock").otherwise(()=>"")}async function VF(F,$){try{let x=$.startsWith("wss")?$.replace("wss","https"):$;return(await fetch(`${x}${H$(F)}`,{body:JSON.stringify(P$(F)),headers:{"Content-Type":"application/json"},method:"POST",signal:AbortSignal.timeout(3000)})).ok}catch{return!1}}var HF=new Map,R$=120000;async function RF(F){let{isStagenet:$}=I.get("envs"),x=I.get("rpcUrls"),N=I.get("fallbackRpcUrls");if($)return x[F];let P=HF.get(F);if(P&&Date.now()-P.timestamp<R$)return P.url;let R=x[F];if(!await VF(F,R)){for(let _ of N[F])if(await VF(F,_))return HF.set(F,{timestamp:Date.now(),url:_}),_}return HF.set(F,{timestamp:Date.now(),url:R}),R}function zx(F){y({condition:!0,id:"initializeRPCUrlsWithFallback",warning:"initializeRPCUrlsWithFallback is deprecated. Use static { rpcUrls, fallbackRpcUrls } SwapKit init config or dynamic SKConfig.setRpcUrl/setFallbackRpcUrl to configure RPC endpoints."})}var Lx=[`${"MAYA"}.MAYA`,`${"MAYA"}.CACAO`,`${"ETH"}.THOR`,`${"ETH"}.vTHOR`,`${"KUJI"}.USK`,`${"ETH"}.FLIP`,`${"XRD"}.XRD`],wF=["ARB","AURORA","BASE","ETH","OP"];async function A$({chain:F,to:$}){try{let N=await RF(F),{result:P}=await s.post(N,{body:JSON.stringify({id:44,jsonrpc:"2.0",method:"eth_call",params:[{data:"0x313ce567",to:$.toLowerCase()},"latest"]}),headers:{accept:"*/*","cache-control":"no-cache","content-type":"application/json"}});return Number.parseInt(BigInt(P||X[F]).toString(),10)}catch(N){return console.error(`Failed to fetch contract decimals for ${$} on ${F}:`,N),X[F]}}async function _$(F){if(F==="XRD")return X.XRD;try{let $=F.split("-")[1]?.toLowerCase(),x=await RF("XRD"),{manager:N}=await s.post(`${x}/state/resource`,{body:JSON.stringify({network:"mainnet",resource_address:$}),headers:{Accept:"*/*","Content-Type":"application/json"}});return N.divisibility.value.divisibility}catch($){return console.error(`Failed to fetch Radix asset decimal for ${F}:`,$),X["XRD"]}}async function G$({chain:F,symbol:$}){if(O.includes($))return X[$];let x=$.split("-"),N=x.length===1?void 0:x[x.length-1]?.toLowerCase();return await(N?.startsWith("0x")?A$({chain:F,to:N}):X[F])}function KF({chain:F,symbol:$}){return t(F).with(...O,(x)=>G$({chain:x,symbol:$})).with("XRD",()=>_$($)).otherwise(()=>X[F])}function OF({chain:F,symbol:$}){return t(F).with(...wF,()=>$==="ETH").with("AVAX",()=>$==="AVAX").with("BERA",()=>$==="BERA").with("BSC",()=>$==="BNB").with("GNO",()=>$==="XDAI").with("MAYA",()=>$==="CACAO").with("GAIA",()=>$==="ATOM").with("THOR",()=>$==="RUNE").with("TRON",()=>$==="TRX").with("XRD",()=>`${F}.${$}`===r(F).identifier).otherwise(()=>$===F)}var r=(F)=>{let $=X[F];return t(F.toUpperCase()).with(...wF,(N)=>({decimal:$,identifier:`${N}.ETH`})).with("THOR",(N)=>({decimal:$,identifier:`${N}.RUNE`})).with("GAIA",(N)=>({decimal:$,identifier:`${N}.ATOM`})).with("MAYA",(N)=>({decimal:10,identifier:`${N}.CACAO`})).with("BSC",(N)=>({decimal:$,identifier:`${N}.BNB`})).with("AVAX",(N)=>({decimal:$,identifier:`${N}.AVAX`})).with("GNO",(N)=>({decimal:$,identifier:`${N}.XDAI`})).with("BERA",(N)=>({decimal:$,identifier:`${N}.BERA`})).with("TRON",(N)=>({decimal:$,identifier:`${N}.TRX`})).with(...c,"SOL","FLIP","KUJI","XRP","DOT","NEAR",(N)=>({decimal:$,identifier:`${N}.${N}`})).with("XRD","XRD.XRD",()=>({decimal:$,identifier:"XRD.XRD"})).with("POL","POL.POL",()=>({decimal:$,identifier:"POL.POL"})).with("KUJI.USK",(N)=>({decimal:6,identifier:N})).with("ETH.FLIP",()=>({decimal:X.ETH,identifier:"ETH.FLIP-0x826180541412D574cf1336d22c0C0a287822678A"})).with("ETH.THOR",()=>({decimal:X.ETH,identifier:"ETH.THOR-0xa5f2211b9b8170f694421f2046281775e8468044"})).with("ETH.vTHOR",()=>({decimal:X.ETH,identifier:"ETH.vTHOR-0x815c23eca83261b6ec689b60cc4a58b54bc24d8d"})).with("MAYA.CACAO",(N)=>({decimal:10,identifier:N})).with("MAYA.MAYA",(N)=>({decimal:4,identifier:N})).otherwise(()=>({decimal:$,identifier:F}))};function AF({chain:F,symbol:$}){if($.includes("/"))return"Synth";if($.includes("~"))return"Trade";return t(F).with("XRD",()=>$==="XRD"||`${F}.${$}`===r(F).identifier).with("ARB","OP","BASE","AURORA",()=>$==="ETH").with("GAIA",()=>$==="ATOM").with("BSC",()=>$==="BNB").with("MAYA",()=>$==="CACAO").with("THOR",()=>$==="RUNE").with("TRON",()=>$==="TRX").otherwise(()=>$===F)?"Native":F}var _F=(F)=>{let[$,...x]=F.split("."),N=F.includes("/"),P=x.join("."),R=P?.split("-"),A=R?.length?R.length===1?R[0]:R.slice(0,-1).join("-"):void 0;return{chain:$,symbol:P,synth:N,ticker:A}};async function jx(F){let{loadTokenLists:$}=await import("./tokens.js"),x=await $();for(let N of Object.values(x))for(let{identifier:P,chain:R,...A}of N.tokens){if("identifier"in F&&P===F.identifier)return P;if("address"in A&&"chain"in F&&R===F.chain&&A.address&&A.address.toLowerCase()===F.contract.toLowerCase())return P}return}var DF=["TERRA",...I.get("chains")];function SF(F=""){let $=F.toUpperCase(),[x]=$.split(".");if(DF.includes(x))return!0;let[N]=$.split("/");if(DF.includes(N))return!0;throw new M({errorKey:"helpers_invalid_identifier",info:{identifier:F,message:`Invalid identifier: ${F}. Expected format: <Chain>.<Ticker> or <Chain>.<Ticker>-<ContractAddress>`}})}function kx(F){if(F.length>30)return!1;let $=/^[a-zA-Z0-9+_-]+$/g;return!!F.match($)}var d=8,v=(F)=>10n**BigInt(F),C=(F)=>Math.log10(Number.parseFloat(F.toString()));function u({value:F,bigIntDecimal:$=d,decimal:x=d}){if(x===0)return F.toString();let N=F<0n,P=F.toString().substring(N?1:0),R=x-(P.length-1);if(R>0)P="0".repeat(R)+P;let A=P.length-x,_=P.slice(-x);if(Number.parseInt(_[$]||"0",10)>=5)_=`${_.substring(0,$-1)}${(Number.parseInt(_[$-1]||"0",10)+1).toString()}`;else _=_.substring(0,$);return`${N?"-":""}${P.slice(0,A)}.${_}`.replace(/\.?0*$/,"")}function B$(F,$){if($===0n)throw new Error("Cannot divide by zero");let x=$/2n;if(F>=0n&&$>=0n||F<0n&&$<0n)return(F+x)/$;return(F-x)/$}class g{decimalMultiplier=10n**8n;bigIntValue=0n;decimal;static fromBigInt(F,$){return new g({decimal:$,value:u({bigIntDecimal:$,decimal:$,value:F})})}static shiftDecimals({value:F,from:$,to:x}){return g.fromBigInt(F.getBaseValue("bigint")*v(x)/v($),x)}constructor(F){let $=GF(F),x=typeof F==="object";this.decimal=x?F.decimal:void 0,this.decimalMultiplier=x&&"decimalMultiplier"in F?F.decimalMultiplier:v(Math.max(gF(i($)),this.decimal||0)),this.#P($)}set(F){return new this.constructor({decimal:this.decimal,identifier:this.toString({includeSynthProtocol:!0}),value:F})}add(...F){return this.#$("add",...F)}sub(...F){return this.#$("sub",...F)}mul(...F){return this.#$("mul",...F)}div(...F){return this.#$("div",...F)}gt(F){return this.#F("gt",F)}gte(F){return this.#F("gte",F)}lt(F){return this.#F("lt",F)}lte(F){return this.#F("lte",F)}eqValue(F){return this.#F("eqValue",F)}getValue(F,$){let x=this.formatBigIntToSafeValue(this.bigIntValue,$||this.decimal||C(this.decimalMultiplier));switch(F){case"number":return Number(x);case"string":return x;case"bigint":return this.bigIntValue*10n**BigInt(this.decimal||8n)/this.decimalMultiplier;default:return x}}getBaseValue(F,$){let x=this.decimalMultiplier/v($||this.decimal||X.THOR),N=B$(this.bigIntValue,x);switch(F){case"number":return Number(N);case"string":return N.toString();case"bigint":return N;default:return N}}getBigIntValue(F,$){if(!$&&typeof F==="object")return F.bigIntValue;let x=GF(F),N=i(x);if(N==="0"||N==="undefined")return 0n;return this.#N(N,$)}toSignificant(F=6){let[$,x]=this.getValue("string").split("."),N=$||"",P=x||"";if((Number.parseInt(N,10)?N.length+P.length:P.length)<=F)return this.getValue("string");if(N.length>=F)return N.slice(0,F).padEnd(N.length,"0");if(Number.parseInt(N,10))return`${N}.${P.slice(0,F-N.length)}`.padEnd(F-N.length,"0");let A=Number.parseInt(P,10),_=`${A}`.slice(0,F);return`0.${_.padStart(P.length-`${A}`.length+_.length,"0")}`}toFixed(F=6){let[$,x]=this.getValue("string").split("."),N=$||"",P=x||"";if(Number.parseInt(N,10))return`${N}.${P.slice(0,F)}`.padEnd(F,"0");let R=Number.parseInt(P,10),A=`${R}`.slice(0,F);return`0.${A.padStart(P.length-`${R}`.length+A.length,"0")}`}toAbbreviation(F=2){let $=this.getValue("number"),x=["","K","M","B","T","Q","Qi","S"],N=Math.floor(Math.log10(Math.abs($))/3),P=x[N];if(!P)return this.getValue("string");let R=10**(N*3);return`${($/R).toFixed(F)}${P}`}toCurrency(F="$",{currencyPosition:$="start",decimal:x=2,decimalSeparator:N=".",thousandSeparator:P=","}={}){let R=this.getValue("number"),[A="",_=""]=R.toFixed(6).split("."),B=A.replace(/\B(?=(\d{3})+(?!\d))/g,P),Q=A||_?A==="0"?`${Number.parseFloat(`0.${_}`)}`.replace(".",N):`${B}${Number.parseInt(_,10)?`${N}${_.slice(0,x)}`:""}`:"0.00";return`${$==="start"?F:""}${Q}${$==="end"?F:""}`}formatBigIntToSafeValue(F,$){let x=$||this.decimal||d,N=Math.max(x,C(this.decimalMultiplier)),P=F<0n,R=F.toString().substring(P?1:0),A=N-(R.length-1),_=A>0?"0".repeat(A)+R:R,B=_.length-N,Q=_.slice(-N);if(Number.parseInt(Q[x]||"0",10)>=5)Q=`${Q.substring(0,x-1)}${(Number.parseInt(Q[x-1]||"0",10)+1).toString()}`;else Q=Q.substring(0,x);return`${P?"-":""}${_.slice(0,B)}.${Q}`.replace(/\.?0*$/,"")}#$(F,...$){let x=this.#x(this,...$),N=Math.max(x,C(this.decimalMultiplier)),P=v(N),R=$.reduce((_,B)=>{let Q=this.getBigIntValue(B,N);switch(F){case"add":return _+Q;case"sub":return _-Q;case"mul":return _*Q/P;case"div":{if(Q===0n)throw new RangeError("Division by zero");return _*P/Q}default:return _}},this.bigIntValue*P/this.decimalMultiplier),A=u({bigIntDecimal:N,decimal:N,value:R});return new this.constructor({decimal:this.decimal,decimalMultiplier:v(N),identifier:this.toString(),value:A})}#F(F,...$){let x=this.#x(this,...$),N=this.getBigIntValue($[0]||"0",x),P=this.getBigIntValue(this,x);switch(F){case"gt":return P>N;case"gte":return P>=N;case"lt":return P<N;case"lte":return P<=N;case"eqValue":return P===N;default:return!1}}#P(F){let $=i(F)||"0";this.bigIntValue=this.#N($)}#x(...F){let $=F.map((x)=>{return typeof x==="object"?x.decimal||C(x.decimalMultiplier):gF(i(x))}).filter(Boolean);return Math.max(...$,d)}#N(F,$){let x=$?v($):this.decimalMultiplier,N=C(x),[P="",R=""]=F.split(".");return BigInt(`${P}${R.padEnd(N,"0")}`)}}var T$=Intl.NumberFormat("fullwide",{maximumFractionDigits:20,useGrouping:!1});function i(F){let x=`${typeof F==="number"?T$.format(F):GF(F)}`.replaceAll(",",".").split(".");return x.length>1?`${x.slice(0,-1).join("")}.${x.at(-1)}`:x[0]||"0"}function gF(F){let $=F.split(".")[1]?.length||0;return Math.max($,d)}function GF(F){return typeof F==="object"?"getValue"in F?F.getValue("string"):F.value:F}var a=["SOL","TRON"],b=new Map;class p extends g{address;chain;isGasAsset=!1;isSynthetic=!1;isTradeAsset=!1;symbol;tax;ticker;type;chainId;constructor({value:F,decimal:$,tax:x,chain:N,symbol:P,identifier:R}){super(typeof F==="object"?F:{decimal:$,value:F});let A=BF(R||`${N}.${P}`);this.type=AF(A),this.tax=x,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=LF[A.chain]}toString({includeSynthProtocol:F}={}){return(this.isSynthetic||this.isTradeAsset)&&!F?this.symbol:`${this.chain}.${this.symbol}`}toUrl(){return this.isSynthetic?`${this.chain}.${this.symbol.replace("/",".")}`:this.isTradeAsset?`${this.chain}.${this.symbol.replace("~","..")}`:this.toString()}getIconUrl(){return b.get(this.toString())?.logoURI}eqAsset({chain:F,symbol:$}){return this.chain===F&&this.symbol===$}eq(F){return this.eqAsset(F)&&this.eqValue(F)}static fromUrl(F,$=0){let[x,N,P]=F.split(".");if(!(x&&N))throw new M({errorKey:"helpers_invalid_asset_url",info:{urlAsset:F}});let R=x==="THOR"&&P?`${x}.${N}/${P}`:F;return p.from({asset:R,value:$})}static from({value:F=0,fromBaseDecimal:$,asyncTokenLookup:x,...N}){let P=F instanceof g?F.getValue("string"):F,R=Y$(N),{identifier:A,decimal:_}=r(R),{chain:B,isSynthetic:Q,isTradeAsset:Y}=BF(A),Z=b.get(a.includes(B)?A:A.toUpperCase()),w=Z?.decimal||_;y({condition:!(x||w),id:`assetValue_static_decimal_not_found_${B}`,warning:`Couldn't find static decimal for one or more tokens on ${B} (Using default ${X[B]} decimal as fallback).
1
+ import{a as wF,c as IF}from"./chunk-hm14bfyg.js";export*from"@swapkit/tokens";import{getAddress as fF}from"ethers";import{match as BF}from"ts-pattern";var L;((G)=>{G.Arbitrum="ARB";G.Aurora="AURORA";G.Avalanche="AVAX";G.Base="BASE";G.Berachain="BERA";G.BinanceSmartChain="BSC";G.Bitcoin="BTC";G.BitcoinCash="BCH";G.Cosmos="GAIA";G.Dash="DASH";G.Dogecoin="DOGE";G.Ethereum="ETH";G.Fiat="FIAT";G.Gnosis="GNO";G.Kujira="KUJI";G.Litecoin="LTC";G.Maya="MAYA";G.Near="NEAR";G.Noble="NOBLE";G.Optimism="OP";G.Polkadot="DOT";G.Chainflip="FLIP";G.Polygon="POL";G.Radix="XRD";G.Ripple="XRP";G.THORChain="THOR";G.Solana="SOL";G.Tron="TRON";G.Zcash="ZEC"})(L||={});var YF;((N)=>{N.THORChain="THOR_STAGENET";N.Maya="MAYA_STAGENET"})(YF||={});var NF;((B)=>{B.Arbitrum="42161";B.ArbitrumHex="0xa4b1";B.Aurora="1313161554";B.AuroraHex="0x4e454152";B.Avalanche="43114";B.AvalancheHex="0xa86a";B.Base="8453";B.BaseHex="0x2105";B.Berachain="80094";B.BerachainHex="0x138de";B.BinanceSmartChain="56";B.BinanceSmartChainHex="0x38";B.Bitcoin="bitcoin";B.BitcoinCash="bitcoincash";B.Chainflip="chainflip";B.Cosmos="cosmoshub-4";B.Dash="dash";B.Dogecoin="dogecoin";B.Ethereum="1";B.EthereumHex="0x1";B.Fiat="fiat";B.Gnosis="100";B.GnosisHex="0x64";B.Kujira="kaiyo-1";B.Litecoin="litecoin";B.Maya="mayachain-mainnet-v1";B.MayaStagenet="mayachain-stagenet-v1";B.Near="near";B.Noble="noble-1";B.Optimism="10";B.OptimismHex="0xa";B.Polkadot="polkadot";B.Polygon="137";B.PolygonHex="0x89";B.Radix="radix-mainnet";B.Ripple="ripple";B.THORChain="thorchain-1";B.THORChainStagenet="thorchain-stagenet-v2";B.Solana="solana";B.Tron="728126428";B.TronHex="0x2b6653dc";B.Zcash="zcash"})(NF||={});var v$={["0xa4b1"]:"ARB",["42161"]:"ARB",["0x4e454152"]:"AURORA",["1313161554"]:"AURORA",["0xa86a"]:"AVAX",["43114"]:"AVAX",["0x2105"]:"BASE",["8453"]:"BASE",["0x138de"]:"BERA",["80094"]:"BERA",["0x38"]:"BSC",["56"]:"BSC",["bitcoincash"]:"BCH",["bitcoin"]:"BTC",["chainflip"]:"FLIP",["cosmoshub-4"]:"GAIA",["dash"]:"DASH",["dogecoin"]:"DOGE",["0x1"]:"ETH",["1"]:"ETH",["fiat"]:"FIAT",["0x64"]:"GNO",["100"]:"GNO",["kaiyo-1"]:"KUJI",["litecoin"]:"LTC",["mayachain-stagenet-v1"]:"MAYA",["mayachain-mainnet-v1"]:"MAYA",["near"]:"NEAR",["noble-1"]:"NOBLE",["0xa"]:"OP",["10"]:"OP",["polkadot"]:"DOT",["0x89"]:"POL",["137"]:"POL",["radix-mainnet"]:"XRD",["ripple"]:"XRP",["solana"]:"SOL",["thorchain-stagenet-v2"]:"THOR",["thorchain-1"]:"THOR",["728126428"]:"TRON",["0x2b6653dc"]:"TRON",["zcash"]:"ZEC"},oF=Object.keys(L),h=Object.values(L),X={ARB:18,AURORA:18,AVAX:18,BASE:18,BCH:8,BERA:18,BSC:18,BTC:8,DASH:8,DOGE:8,DOT:10,ETH:18,FIAT:2,FLIP:18,GAIA:6,GNO:18,KUJI:6,LTC:8,MAYA:8,NEAR:24,NOBLE:6,OP:18,POL:18,SOL:9,THOR:8,TRON:6,XRD:18,XRP:6,ZEC:8},f$={["ARB"]:0.3,["AURORA"]:1,["AVAX"]:3,["BASE"]:2,["BERA"]:2,["BSC"]:3,["BTC"]:600,["BCH"]:600,["FLIP"]:5,["GAIA"]:2,["DASH"]:150,["DOGE"]:600,["ETH"]:12.5,["FIAT"]:60,["GNO"]:5.2,["KUJI"]:2.2,["LTC"]:150,["MAYA"]:6,["NEAR"]:1,["NOBLE"]:1.3,["OP"]:2,["DOT"]:6,["POL"]:2.1,["XRD"]:5,["XRP"]:5,["SOL"]:0.4,["THOR"]:6,["TRON"]:3,["ZEC"]:150},b$=["DOT","FLIP"],k=["ARB","AURORA","AVAX","BASE","BERA","BSC","ETH","GNO","OP","POL"],c=["BTC","BCH","DASH","DOGE","LTC","ZEC"],JF=["GAIA","THOR","MAYA","KUJI","NOBLE"],E$={["GAIA"]:"cosmos",["THOR"]:"thor",["MAYA"]:"maya",["KUJI"]:"kujira",["NOBLE"]:"noble"},MF={["ARB"]:"https://arb1.arbitrum.io/rpc",["AURORA"]:"https://aurora-rpc.publicnode.com",["AVAX"]:"https://api.avax.network/ext/bc/C/rpc",["BASE"]:"https://base-rpc.publicnode.com",["BERA"]:"https://berachain-rpc.publicnode.com",["BSC"]:"https://bsc-dataseed.binance.org",["BCH"]:"https://node-router.thorswap.net/bitcoin-cash",["BTC"]:"https://bitcoin-rpc.publicnode.com",["FLIP"]:"wss://mainnet-archive.chainflip.io",["GAIA"]:"https://cosmos-rpc.publicnode.com:443",["DASH"]:"https://dash-rpc.publicnode.com",["DOGE"]:"https://node-router.thorswap.net/dogecoin",["ETH"]:"https://ethereum-rpc.publicnode.com",["FIAT"]:"",["GNO"]:"https://gnosis-rpc.publicnode.com",["KUJI"]:"https://kujira-rpc.ibs.team",["LTC"]:"https://node-router.thorswap.net/litecoin",["MAYA"]:"https://tendermint.mayachain.info",["NEAR"]:"https://rpc.mainnet.near.org",["NOBLE"]:"https://noble-rpc.polkachu.com",["OP"]:"https://mainnet.optimism.io",["DOT"]:"wss://rpc.polkadot.io",["POL"]:"https://polygon-rpc.com",["XRD"]:"https://radix-mainnet.rpc.grove.city/v1/326002fc/core",["XRP"]:"wss://xrpl.ws/",["SOL"]:"https://solana-rpc.publicnode.com",["THOR"]:"https://rpc.ninerealms.com",["TRON"]:"https://tron-rpc.publicnode.com",["ZEC"]:"https://api.tatum.io/v3/blockchain/node/zcash-mainnet/t-6894a2ae7fc90cccfd3ce71b-2fce88aa7f4a41a5b1e93874",["MAYA_STAGENET"]:"",["THOR_STAGENET"]:"https://stagenet-rpc.ninerealms.com"},o={["THOR"]:"https://thornode.ninerealms.com",["MAYA"]:"https://mayanode.mayachain.info",["THOR_STAGENET"]:"https://stagenet-thornode.ninerealms.com",["MAYA_STAGENET"]:"https://stagenet.mayanode.mayachain.info"},XF={["ARB"]:["https://arb-mainnet.g.alchemy.com/v2/demo","https://arbitrum.blockpi.network/v1/rpc/public"],["AURORA"]:["https://1rpc.io/aurora","https://mainnet.aurora.dev"],["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"],["BERA"]:["https://rpc.berachain.com","https://berachain.drpc.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.publicnode.com"],["DASH"]:["https://dash-rpc.publicnode.com"],["DOGE"]:["https://doge.getblock.io/mainnet","https://dogecoin.publicnode.com"],["ETH"]:["https://eth.llamarpc.com","https://cloudflare-eth.com"],["FIAT"]:[],["GNO"]:["https://gnosis.drpc.org","https://rpc.ankr.com/gnosis"],["KUJI"]:["https://kujira-rpc.polkachu.com","https://rpc-kujira.synergynodes.com/"],["LTC"]:["https://ltc.getblock.io/mainnet","https://litecoin.publicnode.com"],["MAYA"]:["https://tendermint.mayachain.info","https://maya-tendermint.publicnode.com"],["MAYA_STAGENET"]:[],["NEAR"]:["https://1rpc.io/near","https://near.lava.build","https://near-mainnet.infura.io/v3/3cbfcafa5e1e48b7bb0ea41f2fbc4abf"],["NOBLE"]:["https://rpc.noble.xyz","https://rpc.cosmos.directory/noble"],["OP"]:["https://optimism.llamarpc.com","https://1rpc.io/op"],["DOT"]:["wss://polkadot-rpc.dwellir.com","wss://polkadot.api.onfinality.io/public-ws"],["POL"]:["https://polygon.llamarpc.com","https://polygon-bor-rpc.publicnode.com"],["XRD"]:["https://mainnet.radixdlt.com","https://radix-mainnet.rpc.grove.city/v1"],["XRP"]:["wss://s1.ripple.com/","wss://s2.ripple.com/"],["THOR"]:["https://thornode.ninerealms.com",o.THOR],["THOR_STAGENET"]:[],["SOL"]:["https://api.mainnet-beta.solana.com","https://solana-mainnet.rpc.extrnode.com"],["TRON"]:["https://api.tronstack.io","https://api.tron.network"],["ZEC"]:[]},PF={["ARB"]:"https://arbiscan.io",["AURORA"]:"https://explorer.mainnet.aurora.dev",["AVAX"]:"https://snowtrace.io",["BASE"]:"https://basescan.org",["BERA"]:"https://berascan.com",["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"]:"",["GNO"]:"https://gnosisscan.io",["KUJI"]:"https://finder.kujira.network/kaiyo-1",["LTC"]:"https://blockchair.com/litecoin",["MAYA"]:"https://www.mayascan.org",["NEAR"]:"https://nearblocks.io",["NOBLE"]:"https://www.mintscan.io/noble",["OP"]:"https://optimistic.etherscan.io",["DOT"]:"https://polkadot.subscan.io",["POL"]:"https://polygonscan.com",["XRD"]:"https://dashboard.radixdlt.com",["XRP"]:"https://livenet.xrpl.org/",["THOR"]:"https://runescan.io",["SOL"]:"https://solscan.io",["TRON"]:"https://tronscan.org",["ZEC"]:"https://blockchair.com/zcash"},LF=h.reduce((F,$)=>{let N=oF.find((P)=>L[P]===$);if(N)F[$]=N;return F},{}),jF=h.reduce((F,$)=>{return F[$]=NF[LF[$]],F},{}),HF=h.reduce((F,$)=>{let N=`${LF[$]}Hex`;return F[$]=NF[N],F},{}),y$=h.reduce((F,$)=>{return F[$]=PF[$],F},{});import{match as t}from"ts-pattern";import{createStore as iF}from"zustand/vanilla";var hF;((J)=>{J.ARB="0x0000000000000000000000000000000000000000";J.AURORA="0x0000000000000000000000000000000000000000";J.AVAX="0x0000000000000000000000000000000000000000";J.BASE="0x0000000000000000000000000000000000000000";J.BERA="0x0000000000000000000000000000000000000000";J.ETH="0x0000000000000000000000000000000000000000";J.BSC="0x0000000000000000000000000000000000000000";J.GNO="0x0000000000000000000000000000000000000000";J.MATIC="0x0000000000000000000000000000000000001010";J.OP="0x4200000000000000000000000000000000000042"})(hF||={});var b={ARB:[44,60,0,0,0],AURORA:[44,60,0,0,0],AVAX:[44,60,0,0,0],BASE:[44,60,0,0,0],BCH:[44,145,0,0,0],BERA:[44,60,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],DOT:[0,0,0,0,0],ETH:[44,60,0,0,0],FIAT:[0,0,0,0,0],FLIP:[0,0,0,0,0],GAIA:[44,118,0,0,0],GNO:[44,60,0,0,0],KUJI:[44,118,0,0,0],LTC:[84,2,0,0,0],MAYA:[44,931,0,0,0],NEAR:[44,397,0,0,0],NOBLE:[44,118,0,0,0],OP:[44,60,0,0,0],POL:[44,60,0,0,0],SOL:[44,501,0,0,0],THOR:[44,931,0,0,0],TRON:[44,195,0,0,0],XRD:[0,0,0,0,0],XRP:[44,144,0,0,0],ZEC:[44,133,0,0,0]};var cF;((R)=>{R.unknownError="unknownError";R.test_error="test_error";R.providerDetailsError="providerDetailsError";R.blockHeaderNotFound="blockHeaderNotFound";R.blockHashNotFoundAtHeight="blockHashNotFoundAtHeight";R.blockHashNotFoundAtHash="blockHashNotFoundAtHash";R.txHashMissing="txHashMissing";R.assetValueMissingInfo="assetValueMissingInfo";R.invalidAsset="invalidAsset";R.blockIsRequired="blockIsRequired";R.currentBlockHeaderNotFound="currentBlockHeaderNotFound";R.failedToRetrieveBalance="failedToRetrieveBalance";R.failedToRetrieveBlock="failedToRetrieveBlock";R.failedToRetrieveFees="failedToRetrieveFees";R.notImplementedBCH="notImplementedBCH";R.notImplementedDoge="notImplementedDoge";R.noPoolsFound="noPoolsFound";R.noVaultsFound="noVaultsFound";R.noTxFound="noTxFound";R.noInputCoinFound="noInputCoinFound";R.noBlockDataFound="noBlockDataFound";R.multipleCosmosMessages="multipleCosmosMessages";R.heightOrHashNotProvided="heightOrHashNotProvided";R.unknownDenom="unknownDenom";R.invalidBlockHeight="invalidBlockHeight";R.timestampExtrinsicNoArgumentsForBlock="timestampExtrinsicNoArgumentsForBlock";R.timestampExtrinsicNoTimestampForBlock="timestampExtrinsicNoTimestampForBlock";R.noTimestampExtrinsicForHash="noTimestampExtrinsicForHash";R.timestampExtrinsicNoArgumentsForHash="timestampExtrinsicNoArgumentsForHash";R.txMemoUndefined="txMemoUndefined";R.txMemoIncorrect="txMemoIncorrect";R.txTypeNotFound="txTypeNotFound";R.txNoMessage="txNoMessage";R.txNotFound="txNotFound";R.txReceiptNotFound="txReceiptNotFound";R.txParsingError="txParsingError";R.txLogsParsingError="txLogsParsingError";R.blockNotFound="blockNotFound";R.balanceNotFound="balanceNotFound";R.configError="configError";R.synthSwapDisallowed="synthSwapDisallowed";R.providerQuoteTimeout="providerQuoteTimeout";R.noQuoteResponse="noQuoteResponse";R.noPoolAssetsFound="noPoolAssetsFound";R.noThorchainPools="noThorchainPools";R.noMayachainPools="noMayachainPools";R.noThorchainNetworkInfo="noThorchainNetworkInfo";R.invalidAffiliateFee="invalidAffiliateFee";R.invalidBuyAssetAddress="invalidBuyAssetAddress";R.invalidSellAssetAddress="invalidSellAssetAddress";R.invalidSourceAddress="invalidSourceAddress";R.invalidDestinationAddress="invalidDestinationAddress";R.sourceAddressIsSmartContract="sourceAddressIsSmartContract";R.destinationAddressIsSmartContract="destinationAddressIsSmartContract";R.invalidChainId="invalidChainId";R.unsupportedChainId="unsupportedChainId";R.unsupportedEVMChainId="unsupportedEVMChainId";R.unsupportedMethod="unsupportedMethod";R.unsupportedProvider="unsupportedProvider";R.invalidParamsForMethod="invalidParamsForMethod";R.unsupportedAdapter="unsupportedAdapter";R.noWhitelistTokens="noWhitelistTokens";R.failedFetchGasPrice="failedFetchGasPrice";R.failedToCreateDepositChannel="failedToCreateDepositChannel";R.noProviderDetailsFound="noProviderDetailsFound";R.noTokenListsFound="noTokenListsFound";R.tokenNotFound="tokenNotFound";R.tokenPriceNotFound="tokenPriceNotFound";R.tokenPriceFailedToUpdate="tokenPriceFailedToUpdate";R.swapAmountTooSmall="swapAmountTooSmall";R.legsArrayIsEmpty="legsArrayIsEmpty";R.failedToFetchQuoteForLeg="failedToFetchQuoteForLeg";R.noBlockHeaderFound="noBlockHeaderFound";R.failedToSimulateSwap="failedToSimulateSwap";R.addressScreeningFailed="addressScreeningFailed";R.noLiquidtyProvidersFound="noLiquidtyProvidersFound";R.insufficientLiquidity="insufficientLiquidity";R.noInboundDataFound="noInbounDataFound";R.noInboundAddressesFound="noInboundAddressesFound";R.noInboundAddressFoundForChain="noInboundAddressFoundForChain";R.noLastBlocksFound="noLastBlocksFound";R.noVersionFound="noVersionFound";R.noConstantsFound="noConstantsFound";R.noMimirsFound="noMimirsFound";R.noRoutesFound="noRoutesFound";R.quoteNotFound="quoteNotFound";R.ledgerSignFailed="ledgerSignFailed";R.ledgerWrongPayload="ledgerWrongPayload";R.ledgerFetchSwapFailed="ledgerFetchSwapFailed";R.failedToFetchTx="failedToFetchTx";R.failedBuildTransactionDetails="failedBuildTransactionDetails";R.noLegsForRoute="noLegsForRoute";R.noRouterAddressFound="noRouterAddressFound";R.noAggregatorAddressFound="noAggregatorAddressFound";R.noContractInstanceFound="noContractInstanceFound";R.noContractAddressFound="noContractAddressFound";R.invalidAffiliate="invalidAffiliate";R.thornameAffiliate="thornameAffiliate";R.providerNotfound="No provider found";R.noRecordFound="No Record found";R.slippageTooLow="Slippage too low";R.tradingHalted="tradingHalted";R.noWrappedGasAsset="noWrappedGasAsset";R.aggregatorAddressNotFound="aggregatorAddressNotFound";R.routerAddressNotFound="routerAddressNotFound";R.dummyAddressNotFound="dummyAddressNotFound";R.trackerError="trackerError";R.thorchainPoolUnavailable="thorchainPoolUnavailable";R.noOhlcvDataFound="noOhlcvDataFound";R.noTradingPairs="noTradingPairs";R.noLendingAvailability="noLendingAvailability";R.lendingRepayTooSmall="lendingRepayTooSmall";R.missingState="missingState";R.ledgerSwapNotFound="ledgerSwapNotFound";R.ledgerSwapNotReadyForTracking="ledgerSwapNotReadyForTracking";R.errorEstimatingGas="errorEstimatingGas";R.apiKeyInvalid="apiKeyInvalid";R.apiKeyFailedToUpdate="apiKeyFailedToUpdate";R.apiKeyExpired="apiKeyExpired";R.unauthorized="unauthorized";R.failedToCreateMemo="failedToCreateMemo";R.radixIncorrectInstructions="radixIncorrectInstructions";R.radixTxMissedParam="radixTxMissedParam";R.radixTxMissedAccount="radixTxMissedAccount";R.radixManifestParseError="radixManifestParseError";R.radixManifestBuildError="radixManifestBuildError";R.invalidAddressForChain="invalidAddressForChain";R.riskyAddress="riskyAddress";R.noRoutesToProcess="noRoutesToProcess";R.sellAssetAmountTooSmall="sellAssetAmountTooSmall";R.missingPrivateKey="missingPrivateKey";R.noMemoPriceProtection="noMemoPriceProtection"})(cF||={});var lF;((N)=>{N.highSlippage="highSlippage";N.highPriceImpact="highPriceImpact"})(lF||={});var nF;((Y)=>{Y.CAVIAR_V1="CAVIAR_V1";Y.CAMELOT_V3="CAMELOT_V3";Y.CHAINFLIP="CHAINFLIP";Y.CHAINFLIP_STREAMING="CHAINFLIP_STREAMING";Y.JUPITER="JUPITER";Y.MAYACHAIN="MAYACHAIN";Y.MAYACHAIN_STREAMING="MAYACHAIN_STREAMING";Y.OCISWAP_V1="OCISWAP_V1";Y.ONEINCH="ONEINCH";Y.OPENOCEAN_V2="OPENOCEAN_V2";Y.PANCAKESWAP="PANCAKESWAP";Y.PANGOLIN_V1="PANGOLIN_V1";Y.SUSHISWAP_V2="SUSHISWAP_V2";Y.THORCHAIN="THORCHAIN";Y.THORCHAIN_STREAMING="THORCHAIN_STREAMING";Y.TRADERJOE_V2="TRADERJOE_V2";Y.UNISWAP_V2="UNISWAP_V2";Y.UNISWAP_V3="UNISWAP_V3";Y.NEAR="NEAR"})(nF||={});var sF;((_)=>{_.LIQUIDITY="liquidity";_.NETWORK="network";_.INBOUND="inbound";_.OUTBOUND="outbound";_.AFFILIATE="affiliate";_.TAX="tax";_.PRIORITY="priority"})(sF||={});var WF;((P)=>{P.Average="average";P.Fast="fast";P.Fastest="fastest"})(WF||={});var tF;((N)=>{N.Approve="approve";N.CheckOnly="checkOnly"})(tF||={});var qF;((Z)=>{Z.NAME_REGISTER="~";Z.BOND="BOND";Z.DEPOSIT="+";Z.LEAVE="LEAVE";Z.UNBOND="UNBOND";Z.WITHDRAW="-";Z.RUNEPOOL_DEPOSIT="POOL+";Z.RUNEPOOL_WITHDRAW="POOL-";Z.CLAIM_TCY="tcy";Z.STAKE_TCY="tcy+";Z.UNSTAKE_TCY="tcy-"})(qF||={});var l;((G)=>{G.BITGET="BITGET";G.BRAVE="BRAVE";G.COINBASE_MOBILE="COINBASE_MOBILE";G.COINBASE_WEB="COINBASE_WEB";G.COSMOSTATION="COSMOSTATION";G.CTRL="CTRL";G.EIP6963="EIP6963";G.EXODUS="EXODUS";G.KEEPKEY="KEEPKEY";G.KEEPKEY_BEX="KEEPKEY_BEX";G.KEPLR="KEPLR";G.KEYSTORE="KEYSTORE";G.LEAP="LEAP";G.LEDGER="LEDGER";G.LEDGER_LIVE="LEDGER_LIVE";G.METAMASK="METAMASK";G.OKX="OKX";G.OKX_MOBILE="OKX_MOBILE";G.ONEKEY="ONEKEY";G.PHANTOM="PHANTOM";G.POLKADOT_JS="POLKADOT_JS";G.RADIX_WALLET="RADIX_WALLET";G.TREZOR="TREZOR";G.TALISMAN="TALISMAN";G.TRONLINK="TRONLINK";G.TRUSTWALLET_WEB="TRUSTWALLET_WEB";G.VULTISIG="VULTISIG";G.WALLETCONNECT="WALLETCONNECT";G.XAMAN="XAMAN"})(l||={});var rF;((P)=>{P[P.NoError=36864]="NoError";P[P.LockedDevice=21781]="LockedDevice";P[P.TC_NotFound=65535]="TC_NotFound"})(rF||={});var aF={apiKeys:{blockchair:"",keepKey:"",swapKit:"",walletConnectProjectId:"",xaman:""},apis:{},chains:Object.values(L),envs:{apiUrl:"https://api.swapkit.dev",devApiUrl:"https://dev-api.swapkit.dev",isDev:!1,isStagenet:!1},explorerUrls:PF,fallbackRpcUrls:XF,feeMultipliers:void 0,integrations:{radix:{applicationName:"Swapkit Playground",applicationVersion:"0.0.1",dAppDefinitionAddress:"account_rdx128r289p58222hcvev7frs6kue76pl7pdcnw8725aw658v0zggkh9ws",network:{dashboardBase:"https://dashboard.radixdlt.com",networkId:1,networkName:"mainnet"}}},nodeUrls:o,requestOptions:{retry:{backoffMultiplier:2,baseDelay:300,maxDelay:5000,maxRetries:3},timeoutMs:30000},rpcUrls:MF,wallets:Object.values(l)},W=iF((F)=>({...aF,setApiKey:($,N)=>F((P)=>({apiKeys:{...P.apiKeys,[$]:N}})),setConfig:($)=>F((N)=>({apiKeys:{...N.apiKeys,...$.apiKeys},chains:N.chains.concat($.chains||[]),envs:{...N.envs,...$.envs},explorerUrls:{...N.explorerUrls,...$.explorerUrls},feeMultipliers:$.feeMultipliers||N.feeMultipliers,integrations:{...N.integrations,...$.integrations},nodeUrls:{...N.nodeUrls,...$.nodeUrls},rpcUrls:{...N.rpcUrls,...$.rpcUrls},wallets:N.wallets.concat($.wallets||[])})),setEnv:($,N)=>F((P)=>({envs:{...P.envs,[$]:N}})),setExplorerUrl:($,N)=>F((P)=>({explorerUrls:{...P.explorerUrls,[$]:N}})),setFallbackRpcUrls:($,N)=>F((P)=>({fallbackRpcUrls:{...P.fallbackRpcUrls,[$]:N}})),setFeeMultipliers:($)=>F(()=>({feeMultipliers:$})),setIntegrationConfig:($,N)=>F((P)=>({integrations:{...P.integrations,[$]:N}})),setNodeUrl:($,N)=>F((P)=>({nodeUrls:{...P.nodeUrls,[$]:N}})),setRequestOptions:($)=>F((N)=>({requestOptions:{retry:{...N.requestOptions.retry,...$.retry},timeoutMs:$.timeoutMs||N.requestOptions.timeoutMs}})),setRpcUrl:($,N)=>F((P)=>({rpcUrls:{...P.rpcUrls,[$]:N}}))})),q={get:(F)=>W.getState()[F],getState:W.getState,set:(F)=>W.getState().setConfig(F),setApiKey:(F,$)=>W.getState().setApiKey(F,$),setEnv:(F,$)=>W.getState().setEnv(F,$),setExplorerUrl:(F,$)=>W.getState().setExplorerUrl(F,$),setFallbackRpcUrls:(F,$)=>W.getState().setFallbackRpcUrls(F,$),setFeeMultipliers:(F)=>W.getState().setFeeMultipliers(F),setIntegrationConfig:(F,$)=>W.getState().setIntegrationConfig(F,$),setNodeUrl:(F,$)=>W.getState().setNodeUrl(F,$),setRequestOptions:(F)=>W.getState().setRequestOptions(F),setRpcUrl:(F,$)=>W.getState().setRpcUrl(F,$)};var eF={core_estimated_max_spendable_chain_not_supported:10001,core_extend_error:10002,core_inbound_data_not_found:10003,core_approve_asset_address_or_from_not_found:10004,core_plugin_not_found:10005,core_plugin_swap_not_found:10006,core_approve_asset_target_invalid:10007,core_explorer_unsupported_chain:10008,core_verify_message_not_supported:10009,core_chain_halted:10010,core_wallet_connection_not_found:10101,core_wallet_ctrl_not_installed:10102,core_wallet_evmwallet_not_installed:10103,core_wallet_walletconnect_not_installed:10104,core_wallet_keystore_not_installed:10105,core_wallet_ledger_not_installed:10106,core_wallet_trezor_not_installed:10107,core_wallet_keplr_not_installed:10108,core_wallet_okx_not_installed:10109,core_wallet_keepkey_not_installed:10110,core_wallet_talisman_not_installed:10111,core_wallet_not_keypair_wallet:10112,core_wallet_sign_message_not_supported:10113,core_wallet_connection_failed:10114,core_swap_invalid_params:10201,core_swap_route_not_complete:10202,core_swap_asset_not_recognized:10203,core_swap_contract_not_found:10204,core_swap_route_transaction_not_found:10205,core_swap_contract_not_supported:10206,core_swap_transaction_error:10207,core_swap_quote_mode_not_supported:10208,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:20001,wallet_missing_api_key:20002,wallet_chain_not_supported:20003,wallet_missing_params:20004,wallet_provider_not_found:20005,wallet_failed_to_add_or_switch_network:20006,wallet_locked:20007,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_ledger_transport_error:20106,wallet_ledger_public_key_error:20107,wallet_ledger_derivation_path_error:20108,wallet_ledger_signing_error:20109,wallet_ledger_app_not_open:20110,wallet_ledger_invalid_response:20111,wallet_ledger_method_not_supported:20112,wallet_ledger_invalid_params:20113,wallet_ledger_invalid_signature:20114,wallet_ledger_no_provider:20115,wallet_ledger_pubkey_not_found:20116,wallet_ledger_transport_not_defined:20117,wallet_ledger_webusb_not_supported:20118,wallet_ledger_chain_not_supported:20119,wallet_ledger_invalid_asset:20120,wallet_ledger_invalid_account:20121,wallet_ledger_address_not_found:20122,wallet_ledger_failed_to_get_address:20123,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_walletconnect_chain_not_supported:20404,wallet_walletconnect_invalid_method:20405,wallet_walletconnect_method_not_supported:20406,wallet_trezor_failed_to_sign_transaction:20501,wallet_trezor_derivation_path_not_supported:20502,wallet_trezor_failed_to_get_address:20503,wallet_trezor_transport_error:20504,wallet_trezor_method_not_supported:20505,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_radix_invalid_manifest:20803,wallet_radix_method_not_supported:20804,wallet_radix_no_account:20805,wallet_keepkey_not_found:20901,wallet_keepkey_asset_not_defined:20902,wallet_keepkey_contract_address_not_provided:20903,wallet_keepkey_send_transaction_no_address:20904,wallet_keepkey_derivation_path_error:20905,wallet_keepkey_signing_error:20906,wallet_keepkey_transport_error:20907,wallet_keepkey_unsupported_chain:20908,wallet_keepkey_invalid_response:20909,wallet_keepkey_chain_not_supported:20910,wallet_keepkey_signer_not_found:20911,wallet_keepkey_no_accounts:20912,wallet_keepkey_method_not_supported:20913,wallet_keepkey_invalid_params:20914,wallet_keepkey_config_not_found:20915,wallet_keepkey_no_provider:20916,wallet_keepkey_account_not_found:20917,wallet_bitkeep_not_found:21001,wallet_bitkeep_failed_to_switch_network:21002,wallet_bitkeep_no_accounts:21003,wallet_exodus_sign_transaction_error:21101,wallet_exodus_not_found:21102,wallet_exodus_no_address:21103,wallet_exodus_request_canceled:21104,wallet_exodus_signature_canceled:21105,wallet_exodus_failed_to_switch_network:21106,wallet_exodus_chain_not_supported:21107,wallet_exodus_instance_missing:21108,wallet_onekey_not_found:21201,wallet_onekey_sign_transaction_error:21202,wallet_okx_not_found:21301,wallet_okx_chain_not_supported:21302,wallet_okx_failed_to_switch_network:21303,wallet_okx_no_accounts:21304,wallet_keplr_not_found:21401,wallet_keplr_chain_not_supported:21402,wallet_keplr_signer_not_found:21403,wallet_keplr_no_accounts:21404,wallet_cosmostation_not_found:21501,wallet_cosmostation_chain_not_supported:21502,wallet_cosmostation_evm_provider_not_found:21503,wallet_cosmostation_keplr_provider_not_found:21504,wallet_cosmostation_no_accounts:21505,wallet_cosmostation_no_evm_accounts:21506,wallet_cosmostation_no_evm_address:21507,wallet_cosmostation_signer_not_found:21508,wallet_xdefi_not_found:21601,wallet_xdefi_chain_not_supported:21602,wallet_coinbase_not_found:21701,wallet_coinbase_chain_not_supported:21702,wallet_coinbase_method_not_supported:21703,wallet_coinbase_no_accounts:21704,wallet_evm_extensions_failed_to_switch_network:21801,wallet_evm_extensions_no_provider:21802,wallet_evm_extensions_not_found:21803,wallet_keystore_invalid_password:21901,wallet_keystore_unsupported_version:21902,wallet_near_extensions_failed_to_switch_network:22001,wallet_near_extensions_no_provider:22002,wallet_near_extensions_not_found:22003,wallet_near_method_not_supported:22003,wallet_vultisig_not_found:22101,wallet_vultisig_contract_address_not_provided:22102,wallet_vultisig_asset_not_defined:22103,wallet_vultisig_send_transaction_no_address:22104,wallet_xaman_not_configured:23001,wallet_xaman_not_connected:23002,wallet_xaman_auth_failed:23003,wallet_xaman_connection_failed:23004,wallet_xaman_transaction_failed:23005,wallet_xaman_monitoring_failed:23006,chainflip_channel_error:30001,chainflip_unknown_asset:30002,chainflip_broker_invalid_params:30101,chainflip_broker_recipient_error:30102,chainflip_broker_register:30103,chainflip_broker_tx_error:30104,chainflip_broker_withdraw:30105,chainflip_broker_fund_only_flip_supported:30106,chainflip_broker_fund_invalid_address:30107,thorchain_chain_halted:40001,thorchain_trading_halted:40002,thorchain_asset_is_not_tcy:40003,thorchain_swapin_router_required:40101,thorchain_swapin_vault_required:40102,thorchain_swapin_memo_required:40103,thorchain_swapin_token_required:40104,thorchain_preferred_asset_payout_required:40105,toolbox_cosmos_account_not_found:50101,toolbox_cosmos_invalid_fee:50102,toolbox_cosmos_invalid_params:50103,toolbox_cosmos_no_signer:50104,toolbox_cosmos_not_supported:50105,toolbox_cosmos_signer_not_defined:50106,toolbox_cosmos_validate_address_prefix_not_found:50107,toolbox_cosmos_verify_signature_no_pubkey:50108,toolbox_evm_error_estimating_gas_limit:50201,toolbox_evm_error_sending_transaction:50202,toolbox_evm_gas_estimation_error:50203,toolbox_evm_invalid_gas_asset_address:50204,toolbox_evm_invalid_params:50205,toolbox_evm_invalid_transaction:50206,toolbox_evm_no_abi_fragment:50207,toolbox_evm_no_contract_address:50208,toolbox_evm_no_fee_data:50209,toolbox_evm_no_from_address:50210,toolbox_evm_no_gas_price:50211,toolbox_evm_no_signer_address:50212,toolbox_evm_no_signer:50213,toolbox_evm_no_to_address:50214,toolbox_evm_not_supported:50215,toolbox_evm_provider_not_eip1193_compatible:50216,toolbox_utxo_api_error:50301,toolbox_utxo_broadcast_failed:50302,toolbox_utxo_insufficient_balance:50303,toolbox_utxo_invalid_address:50304,toolbox_utxo_invalid_params:50305,toolbox_utxo_invalid_transaction:50306,toolbox_utxo_no_signer:50307,toolbox_utxo_not_supported:50308,toolbox_solana_no_signer:50401,toolbox_solana_fee_estimation_failed:50402,toolbox_substrate_not_supported:50501,toolbox_substrate_transfer_error:50502,toolbox_radix_method_not_supported:50601,toolbox_ripple_get_balance_error:50701,toolbox_ripple_rpc_not_configured:50702,toolbox_ripple_signer_not_found:50703,toolbox_ripple_asset_not_supported:50704,toolbox_ripple_broadcast_error:50705,toolbox_tron_no_signer:50801,toolbox_tron_invalid_token_identifier:50802,toolbox_tron_token_transfer_failed:50803,toolbox_tron_transaction_creation_failed:50804,toolbox_tron_fee_estimation_failed:50805,toolbox_tron_trongrid_api_error:50806,toolbox_tron_approve_failed:50807,toolbox_tron_invalid_token_contract:50808,toolbox_tron_allowance_check_failed:50809,toolbox_near_no_signer:90601,toolbox_near_invalid_address:90602,toolbox_near_invalid_amount:90603,toolbox_near_transfer_failed:90604,toolbox_near_access_key_error:90605,toolbox_near_no_rpc_url:90606,toolbox_near_empty_batch:90607,toolbox_near_balance_failed:90608,toolbox_near_invalid_name:90609,toolbox_near_missing_contract_address:90610,toolbox_near_no_account:90611,toolbox_near_invalid_gas_params:90612,toolbox_not_supported:59901,plugin_near_invalid_name:41001,plugin_near_no_connection:41002,plugin_near_name_unavailable:41003,plugin_near_registration_failed:41004,plugin_near_transfer_failed:41005,api_v2_invalid_response:60001,api_v2_server_error:60002,api_v2_invalid_method_key_hash:60003,helpers_invalid_number_different_decimals:70001,helpers_invalid_number_of_years:70002,helpers_invalid_identifier:70003,helpers_invalid_asset_url:70004,helpers_invalid_asset_identifier:70005,helpers_invalid_memo_type:70006,helpers_failed_to_switch_network:70007,helpers_not_found_provider:70008,helpers_chain_not_supported:70009,helpers_invalid_params:70010,helpers_invalid_response:70011,not_implemented:99999};class M extends Error{static ErrorCode=eF;constructor(F,$){let N=typeof F==="string",P=N?F:F.errorKey,H=N?void 0:F.info,A=`${P}${H?`: ${JSON.stringify(H)}`:""}`;super(A);if(Object.setPrototypeOf(this,M.prototype),this.name="SwapKitError",this.cause=$,$)console.error(`SwapKitError [${P}]:`,$);else if(H)console.error(`SwapKitError [${P}]:`,H)}}var F$=(F)=>new Promise(($)=>setTimeout($,F)),$$=(F,{baseDelay:$,backoffMultiplier:N,maxDelay:P})=>Math.min($*N**F,P),N$=async(F,$)=>{let N=await fetch(F,$);if(!N.ok){let H={message:await N.text(),status:N.status,statusText:N.statusText};throw new M({errorKey:"helpers_invalid_response",info:H},H)}return N.json()};function n(F,$={}){return async function N(P,H={}){let{searchParams:A,json:x,body:_,headers:T,dynamicHeader:Q,retry:J,timeoutMs:Z,abortController:I,onError:V,onSuccess:K,responseHandler:p,...O}={...$,...H},f=q.get("requestOptions"),D={...f.retry,...J},Y=!!x||P.endsWith(".json"),CF=H$(P,A),mF=P$(Y,{...T,...Q?.()}),dF=Y?JSON.stringify(x):_,$F;for(let d=0;d<=D.maxRetries;d++){let zF=I||new AbortController,ZF=setTimeout(()=>zF.abort(),Z||f.timeoutMs);try{let S=await N$(CF,{...O,body:dF,headers:mF,method:F,signal:zF.signal});return clearTimeout(ZF),K?.(S)||p?.(S)||S}catch(S){if(clearTimeout(ZF),$F=S,d>=D.maxRetries)return V?V(S):Promise.reject(S);await F$($$(d,D))}}return V?V($F):Promise.reject($F)}}function P$(F,$){return{...$,...F&&{"Content-Type":"application/json"}}}function H$(F,$){let N=new URL(F);if($)N.search=new URLSearchParams($).toString();return N.toString()}var s={extend:(F)=>({extend:($)=>s.extend({...F,...$}),get:n("GET",F),post:n("POST",F)}),get:n("GET"),post:n("POST")};import{match as UF}from"ts-pattern";function xN(F){if(F<0)throw new M({errorKey:"helpers_invalid_number_of_years",info:{numberOfYears:F}});return 10+F}function AN(F){if(F<0)throw new M({errorKey:"helpers_invalid_number_of_years",info:{numberOfYears:F}});return Math.round((10+F*1.0512)*10000000000)/10000000000}function _N(F,$){try{return F()}catch(N){if($)throw new M($,N);return}}function GN(F){switch(F){case"THOR":return`${F}.RUNE`;case"GAIA":return`${F}.ATOM`;case"BSC":return`${F}`;default:return`${F}.${F}`}}var VF=new Set;function E({condition:F,id:$,warning:N}){if(F){if(VF.has($))return;console.warn(N),VF.add($)}}function R$(F){return UF(F).with(...k,()=>({id:1,jsonrpc:"2.0",method:"eth_blockNumber",params:[]})).with(...c,()=>({id:"test",jsonrpc:"1.0",method:"getblockchaininfo",params:[]})).with(...JF,"MAYA_STAGENET","THOR_STAGENET",()=>({id:1,jsonrpc:"2.0",method:"status",params:{}})).with("DOT","FLIP",()=>({id:1,jsonrpc:"2.0",method:"system_health",params:[]})).with("SOL",()=>({id:1,jsonrpc:"2.0",method:"getHealth"})).with("TRON","XRD","FIAT",()=>"").with("NEAR",()=>({id:"dontcare",jsonrpc:"2.0",method:"status",params:[]})).with("XRP",()=>({id:1,jsonrpc:"2.0",method:"ping",params:[{}]})).otherwise(()=>{throw new M("helpers_chain_not_supported",{chain:F})})}function x$(F){return UF(F).with("XRD",()=>"/status/network-configuration").with("TRON",()=>"/wallet/getnowblock").otherwise(()=>"")}async function kF(F,$){try{let N=$.startsWith("wss")?$.replace("wss","https"):$;return(await fetch(`${N}${x$(F)}`,{body:JSON.stringify(R$(F)),headers:{"Content-Type":"application/json"},method:"POST",signal:AbortSignal.timeout(3000)})).ok}catch{return!1}}var RF=new Map,A$=120000;async function xF(F){let{isStagenet:$}=q.get("envs"),N=q.get("rpcUrls"),P=q.get("fallbackRpcUrls");if($)return N[F];let H=RF.get(F);if(H&&Date.now()-H.timestamp<A$)return H.url;let A=N[F];if(!await kF(F,A)){for(let _ of P[F])if(await kF(F,_))return RF.set(F,{timestamp:Date.now(),url:_}),_}return RF.set(F,{timestamp:Date.now(),url:A}),A}function JN(F){E({condition:!0,id:"initializeRPCUrlsWithFallback",warning:"initializeRPCUrlsWithFallback is deprecated. Use static { rpcUrls, fallbackRpcUrls } SwapKit init config or dynamic SKConfig.setRpcUrl/setFallbackRpcUrl to configure RPC endpoints."})}var qN=[`${"MAYA"}.MAYA`,`${"MAYA"}.CACAO`,`${"ETH"}.THOR`,`${"ETH"}.vTHOR`,`${"KUJI"}.USK`,`${"ETH"}.FLIP`,`${"XRD"}.XRD`],KF=["ARB","AURORA","BASE","ETH","OP"];async function _$({chain:F,to:$}){try{let P=await xF(F),{result:H}=await s.post(P,{body:JSON.stringify({id:44,jsonrpc:"2.0",method:"eth_call",params:[{data:"0x313ce567",to:$.toLowerCase()},"latest"]}),headers:{accept:"*/*","cache-control":"no-cache","content-type":"application/json"}});return Number.parseInt(BigInt(H||X[F]).toString(),10)}catch(P){return console.error(`Failed to fetch contract decimals for ${$} on ${F}:`,P),X[F]}}async function G$(F){if(F==="XRD")return X.XRD;try{let $=F.split("-")[1]?.toLowerCase(),N=await xF("XRD"),{manager:P}=await s.post(`${N}/state/resource`,{body:JSON.stringify({network:"mainnet",resource_address:$}),headers:{Accept:"*/*","Content-Type":"application/json"}});return P.divisibility.value.divisibility}catch($){return console.error(`Failed to fetch Radix asset decimal for ${F}:`,$),X["XRD"]}}async function T$({chain:F,symbol:$}){if(k.includes($))return X[$];let N=$.split("-"),P=N.length===1?void 0:N[N.length-1]?.toLowerCase();return await(P?.startsWith("0x")?_$({chain:F,to:P}):X[F])}function OF({chain:F,symbol:$}){return t(F).with(...k,(N)=>T$({chain:N,symbol:$})).with("XRD",()=>G$($)).otherwise(()=>X[F])}function DF({chain:F,symbol:$}){return t(F).with(...KF,()=>$==="ETH").with("AVAX",()=>$==="AVAX").with("BERA",()=>$==="BERA").with("BSC",()=>$==="BNB").with("GNO",()=>$==="XDAI").with("MAYA",()=>$==="CACAO").with("GAIA",()=>$==="ATOM").with("THOR",()=>$==="RUNE").with("TRON",()=>$==="TRX").with("XRD",()=>`${F}.${$}`===r(F).identifier).otherwise(()=>$===F)}var r=(F)=>{let $=X[F];return t(F.toUpperCase()).with(...KF,(P)=>({decimal:$,identifier:`${P}.ETH`})).with("THOR",(P)=>({decimal:$,identifier:`${P}.RUNE`})).with("GAIA",(P)=>({decimal:$,identifier:`${P}.ATOM`})).with("MAYA",(P)=>({decimal:10,identifier:`${P}.CACAO`})).with("BSC",(P)=>({decimal:$,identifier:`${P}.BNB`})).with("AVAX",(P)=>({decimal:$,identifier:`${P}.AVAX`})).with("GNO",(P)=>({decimal:$,identifier:`${P}.XDAI`})).with("BERA",(P)=>({decimal:$,identifier:`${P}.BERA`})).with("TRON",(P)=>({decimal:$,identifier:`${P}.TRX`})).with(...c,"SOL","FLIP","KUJI","XRP","DOT","NEAR",(P)=>({decimal:$,identifier:`${P}.${P}`})).with("XRD","XRD.XRD",()=>({decimal:$,identifier:"XRD.XRD"})).with("POL","POL.POL",()=>({decimal:$,identifier:"POL.POL"})).with("KUJI.USK",(P)=>({decimal:6,identifier:P})).with("ETH.FLIP",()=>({decimal:X.ETH,identifier:"ETH.FLIP-0x826180541412D574cf1336d22c0C0a287822678A"})).with("ETH.THOR",()=>({decimal:X.ETH,identifier:"ETH.THOR-0xa5f2211b9b8170f694421f2046281775e8468044"})).with("ETH.vTHOR",()=>({decimal:X.ETH,identifier:"ETH.vTHOR-0x815c23eca83261b6ec689b60cc4a58b54bc24d8d"})).with("MAYA.CACAO",(P)=>({decimal:10,identifier:P})).with("MAYA.MAYA",(P)=>({decimal:4,identifier:P})).otherwise(()=>({decimal:$,identifier:F}))};function AF({chain:F,symbol:$}){if($.includes("/"))return"Synth";if($.includes("~"))return"Trade";return t(F).with("XRD",()=>$==="XRD"||`${F}.${$}`===r(F).identifier).with("ARB","OP","BASE","AURORA",()=>$==="ETH").with("GAIA",()=>$==="ATOM").with("BSC",()=>$==="BNB").with("MAYA",()=>$==="CACAO").with("THOR",()=>$==="RUNE").with("TRON",()=>$==="TRX").otherwise(()=>$===F)?"Native":F}var _F=(F)=>{let[$,...N]=F.split("."),P=F.includes("/"),H=N.join("."),A=H?.split("-"),x=A?.length?A.length===1?A[0]:A.slice(0,-1).join("-"):void 0;return{chain:$,symbol:H,synth:P,ticker:x}};async function VN(F){let{loadTokenLists:$}=await import("./tokens.js"),N=await $();for(let P of Object.values(N))for(let{identifier:H,chain:A,...x}of P.tokens){if("identifier"in F&&H===F.identifier)return H;if("address"in x&&"chain"in F&&A===F.chain&&x.address&&x.address.toLowerCase()===F.contract.toLowerCase())return H}return}var SF=["TERRA",...q.get("chains")];function gF(F=""){let $=F.toUpperCase(),[N]=$.split(".");if(SF.includes(N))return!0;let[P]=$.split("/");if(SF.includes(P))return!0;throw new M({errorKey:"helpers_invalid_identifier",info:{identifier:F,message:`Invalid identifier: ${F}. Expected format: <Chain>.<Ticker> or <Chain>.<Ticker>-<ContractAddress>`}})}function IN(F){if(F.length>30)return!1;let $=/^[a-zA-Z0-9+_-]+$/g;return!!F.match($)}var m=8,g=(F)=>10n**BigInt(F),C=(F)=>Math.log10(Number.parseFloat(F.toString()));function y({value:F,bigIntDecimal:$=m,decimal:N=m}){if(N===0)return F.toString();let P=F<0n,H=F.toString().substring(P?1:0),A=N-(H.length-1);if(A>0)H="0".repeat(A)+H;let x=H.length-N,_=H.slice(-N);if(Number.parseInt(_[$]||"0",10)>=5)_=`${_.substring(0,$-1)}${(Number.parseInt(_[$-1]||"0",10)+1).toString()}`;else _=_.substring(0,$);return`${P?"-":""}${H.slice(0,x)}.${_}`.replace(/\.?0*$/,"")}function B$(F,$){if($===0n)throw new Error("Cannot divide by zero");let N=$/2n;if(F>=0n&&$>=0n||F<0n&&$<0n)return(F+N)/$;return(F-N)/$}class w{decimalMultiplier=10n**8n;bigIntValue=0n;decimal;static fromBigInt(F,$){return new w({decimal:$,value:y({bigIntDecimal:$,decimal:$,value:F})})}static shiftDecimals({value:F,from:$,to:N}){return w.fromBigInt(F.getBaseValue("bigint")*g(N)/g($),N)}constructor(F){let $=GF(F),N=typeof F==="object";this.decimal=N?F.decimal:void 0,this.decimalMultiplier=N&&"decimalMultiplier"in F?F.decimalMultiplier:g(Math.max(vF(i($)),this.decimal||0)),this.#H($)}set(F){return new this.constructor({decimal:this.decimal,identifier:this.toString({includeSynthProtocol:!0}),value:F})}add(...F){return this.#$("add",...F)}sub(...F){return this.#$("sub",...F)}mul(...F){return this.#$("mul",...F)}div(...F){return this.#$("div",...F)}gt(F){return this.#F("gt",F)}gte(F){return this.#F("gte",F)}lt(F){return this.#F("lt",F)}lte(F){return this.#F("lte",F)}eqValue(F){return this.#F("eqValue",F)}getValue(F,$){let N=this.formatBigIntToSafeValue(this.bigIntValue,$||this.decimal||C(this.decimalMultiplier));switch(F){case"number":return Number(N);case"string":return N;case"bigint":return this.bigIntValue*10n**BigInt(this.decimal||8n)/this.decimalMultiplier;default:return N}}getBaseValue(F,$){let N=this.decimalMultiplier/g($||this.decimal||X.THOR),P=B$(this.bigIntValue,N);switch(F){case"number":return Number(P);case"string":return P.toString();case"bigint":return P;default:return P}}getBigIntValue(F,$){if(!$&&typeof F==="object")return F.bigIntValue;let N=GF(F),P=i(N);if(P==="0"||P==="undefined")return 0n;return this.#P(P,$)}toSignificant(F=6){let[$,N]=this.getValue("string").split("."),P=$||"",H=N||"";if((Number.parseInt(P,10)?P.length+H.length:H.length)<=F)return this.getValue("string");if(P.length>=F)return P.slice(0,F).padEnd(P.length,"0");if(Number.parseInt(P,10))return`${P}.${H.slice(0,F-P.length)}`.padEnd(F-P.length,"0");let x=Number.parseInt(H,10),_=`${x}`.slice(0,F);return`0.${_.padStart(H.length-`${x}`.length+_.length,"0")}`}toFixed(F=6){let[$,N]=this.getValue("string").split("."),P=$||"",H=N||"";if(Number.parseInt(P,10))return`${P}.${H.slice(0,F)}`.padEnd(F,"0");let A=Number.parseInt(H,10),x=`${A}`.slice(0,F);return`0.${x.padStart(H.length-`${A}`.length+x.length,"0")}`}toAbbreviation(F=2){let $=this.getValue("number"),N=["","K","M","B","T","Q","Qi","S"],P=Math.floor(Math.log10(Math.abs($))/3),H=N[P];if(!H)return this.getValue("string");let A=10**(P*3);return`${($/A).toFixed(F)}${H}`}toCurrency(F="$",{currencyPosition:$="start",decimal:N=2,decimalSeparator:P=".",thousandSeparator:H=","}={}){let A=this.getValue("number"),[x="",_=""]=A.toFixed(6).split("."),T=x.replace(/\B(?=(\d{3})+(?!\d))/g,H),Q=x||_?x==="0"?`${Number.parseFloat(`0.${_}`)}`.replace(".",P):`${T}${Number.parseInt(_,10)?`${P}${_.slice(0,N)}`:""}`:"0.00";return`${$==="start"?F:""}${Q}${$==="end"?F:""}`}formatBigIntToSafeValue(F,$){let N=$||this.decimal||m,P=Math.max(N,C(this.decimalMultiplier)),H=F<0n,A=F.toString().substring(H?1:0),x=P-(A.length-1),_=x>0?"0".repeat(x)+A:A,T=_.length-P,Q=_.slice(-P);if(Number.parseInt(Q[N]||"0",10)>=5)Q=`${Q.substring(0,N-1)}${(Number.parseInt(Q[N-1]||"0",10)+1).toString()}`;else Q=Q.substring(0,N);return`${H?"-":""}${_.slice(0,T)}.${Q}`.replace(/\.?0*$/,"")}#$(F,...$){let N=this.#N(this,...$),P=Math.max(N,C(this.decimalMultiplier)),H=g(P),A=$.reduce((_,T)=>{let Q=this.getBigIntValue(T,P);switch(F){case"add":return _+Q;case"sub":return _-Q;case"mul":return _*Q/H;case"div":{if(Q===0n)throw new RangeError("Division by zero");return _*H/Q}default:return _}},this.bigIntValue*H/this.decimalMultiplier),x=y({bigIntDecimal:P,decimal:P,value:A});return new this.constructor({decimal:this.decimal,decimalMultiplier:g(P),identifier:this.toString(),value:x})}#F(F,...$){let N=this.#N(this,...$),P=this.getBigIntValue($[0]||"0",N),H=this.getBigIntValue(this,N);switch(F){case"gt":return H>P;case"gte":return H>=P;case"lt":return H<P;case"lte":return H<=P;case"eqValue":return H===P;default:return!1}}#H(F){let $=i(F)||"0";this.bigIntValue=this.#P($)}#N(...F){let $=F.map((N)=>{return typeof N==="object"?N.decimal||C(N.decimalMultiplier):vF(i(N))}).filter(Boolean);return Math.max(...$,m)}#P(F,$){let N=$?g($):this.decimalMultiplier,P=C(N),[H="",A=""]=F.split(".");return BigInt(`${H}${A.padEnd(P,"0")}`)}}var Q$=Intl.NumberFormat("fullwide",{maximumFractionDigits:20,useGrouping:!1});function i(F){let N=`${typeof F==="number"?Q$.format(F):GF(F)}`.replaceAll(",",".").split(".");return N.length>1?`${N.slice(0,-1).join("")}.${N.at(-1)}`:N[0]||"0"}function vF(F){let $=F.split(".")[1]?.length||0;return Math.max($,m)}function GF(F){return typeof F==="object"?"getValue"in F?F.getValue("string"):F.value:F}var a=["SOL","TRON","NEAR"],v=new Map;class u extends w{address;chain;isGasAsset=!1;isSynthetic=!1;isTradeAsset=!1;symbol;tax;ticker;type;chainId;constructor({value:F,decimal:$,tax:N,chain:P,symbol:H,identifier:A}){super(typeof F==="object"?F:{decimal:$,value:F});let x=TF(A||`${P}.${H}`);this.type=AF(x),this.tax=N,this.chain=x.chain,this.ticker=x.ticker,this.symbol=x.symbol,this.address=x.address,this.isSynthetic=x.isSynthetic,this.isTradeAsset=x.isTradeAsset,this.isGasAsset=x.isGasAsset,this.chainId=jF[x.chain]}toString({includeSynthProtocol:F}={}){return(this.isSynthetic||this.isTradeAsset)&&!F?this.symbol:`${this.chain}.${this.symbol}`}toUrl(){if(this.isSynthetic)return`${this.chain}.${this.symbol.replace(/\//g,".")}`;if(this.isTradeAsset)return`${this.chain}.${this.symbol.replace(/~/g,"..")}`;let F=this.symbol.replace(/\./g,"__");return`${this.chain}.${F}`}getIconUrl(){return v.get(this.toString())?.logoURI}eqAsset({chain:F,symbol:$}){return this.chain===F&&this.symbol===$}eq(F){return this.eqAsset(F)&&this.eqValue(F)}static fromUrl(F,$=0){let N=F.indexOf(".");if(N===-1)throw new M({errorKey:"helpers_invalid_asset_url",info:{urlAsset:F}});let P=F.slice(0,N),H=F.slice(N+1),A=BF({chain:P,rest:H}).when(({rest:x})=>x.includes(".."),({chain:x,rest:_})=>`${x}.${_.replace(/\.\./g,"~")}`).when(({chain:x,rest:_})=>["THOR","MAYA"].includes(x)&&_.includes("."),({chain:x,rest:_})=>`${x}.${_.replace(/\./g,"/")}`).otherwise(({chain:x,rest:_})=>`${x}.${_.replace(/__/g,".")}`);return u.from({asset:A,value:$})}static from({value:F=0,fromBaseDecimal:$,asyncTokenLookup:N,...P}){let H=F instanceof w?F.getValue("string"):F,A=J$(P),{identifier:x,decimal:_}=r(A),{chain:T,isSynthetic:Q,isTradeAsset:J}=TF(x),Z=v.get(a.includes(T)?x:x.toUpperCase()),I=Z?.decimal||_;E({condition:!(N||I),id:`assetValue_static_decimal_not_found_${T}`,warning:`Couldn't find static decimal for one or more tokens on ${T} (Using default ${X[T]} decimal as fallback).
2
2
  This can result in incorrect calculations and mess with amount sent on transactions.
3
3
  You can load static assets by installing @swapkit/tokens package and calling AssetValue.loadStaticAssets()
4
- or by passing asyncTokenLookup: true to the from() function, which will make it async and return a promise.`});let{decimal:L,identifier:j,tax:S}=Z||{decimal:w||X[B],identifier:A},k=Q||Y,U=$?e(BigInt(P),$):e(P,L);return x?Q$(j,$?U:P):k?z$(j,U):new p({decimal:L,identifier:j,tax:S,value:U})}static async loadStaticAssets(F){let{loadTokenLists:$}=await import("@swapkit/tokens"),x=await $(F);for(let{tokens:N}of Object.values(x))for(let{identifier:P,chain:R,...A}of N){let _=a.includes(R)?P:P.toUpperCase(),B="decimals"in A?A.decimals:X[R];b.set(_,{decimal:B,identifier:P})}return!0}static setStaticAssets(F){b.clear();for(let[$,x]of F.entries()){let N=a.includes(x.chain)?x.identifier:x.identifier.toUpperCase(),P="decimals"in x?x.decimals:x.decimal;b.set($,{...x,decimal:P,identifier:N})}return!0}}function Ex(F){let $=p.from({chain:F});return vF(F).with("BTC","LTC","BCH","DASH",()=>$.set(0.00010001)).with("DOGE",()=>$.set(1.00000001)).with("AVAX","ETH","ARB","BSC",()=>$.set(0.00000001)).with("THOR","MAYA",()=>$.set(0)).with("GAIA","KUJI",()=>$.set(0.000001)).otherwise(()=>$.set(0.00000001))}async function Q$(F,$=0){SF(F);let N=F.includes("SOL.")?F:F.toUpperCase(),P=b.get(N),R=P?.decimal||await KF(BF(F));if(!P)b.set(N,{decimal:R,identifier:F});return new p({decimal:R,identifier:F,value:e($,R)})}function z$(F,$=0){let x=F.includes(".")?F.split(".")?.[0]?.toUpperCase():void 0,N=x?["MAYA","THOR"].includes(x):!1,P=F.slice(0,14).includes("~")?"~":"/",[R,A]=N?F.split(".").slice(1).join().split(P):F.split(P);if(!(R&&A))throw new M({errorKey:"helpers_invalid_asset_identifier",info:{identifier:F}});return new p({decimal:8,identifier:`${x||"THOR"}.${R}${P}${A}`,value:e($,8)})}function e(F,$){return typeof F==="bigint"?u({bigIntDecimal:$,decimal:$,value:F}):F}function Z$(F){let $=vF(F).when((x)=>("chain"in x)&&x.chain!==void 0,({chain:x})=>x).otherwise((x)=>{let N=_F(x.asset);return N.synth?"THOR":N.chain});if(!Object.values(W).includes($.toUpperCase()))throw new M({errorKey:"helpers_invalid_asset_identifier",info:{message:"Please use the AssetValue constructor for unsupported chains"}})}function Y$(F){if(Z$(F),"chain"in F)return F.chain;let{chain:$,symbol:x}=_F(F.asset);return AF({chain:$,symbol:x})==="Native"?$:F.asset}function BF(F){let $=F.slice(0,14),x=F.split("."),N=x[0]?.toUpperCase(),P=["THOR","MAYA"].includes(N),R=$.includes("/"),A=$.includes("~"),_=R||A,B=A?"~":"/",[Q,Y=""]=P?x.slice(1).join().split(B):F.split(B);if(_&&!(Q&&Y))throw new M({errorKey:"helpers_invalid_asset_identifier",info:{identifier:F}});let[Z,...w]=(F.includes(".")&&!_?F:`${N}.${Y}`).split("."),L=_?Y:w.join("."),{address:j,ticker:S}=J$({chain:Z,symbol:L}),k;try{k=j&&O.includes(Z)&&fF(j)?fF(j):j}catch(K){k=j}let U=(_?`${Q}${B}`:"")+(k?`${S}-${k??""}`:L);return{address:k,chain:Z,isGasAsset:OF({chain:Z,symbol:L}),isSynthetic:R,isSynthOrTrade:_,isTradeAsset:A,symbol:U,ticker:S}}function J$({symbol:F,chain:$}){let x=F.split("-"),N=x.length===1?void 0:x[x.length-1],P=a.includes($)?N:N?.toLowerCase(),R=x.length===1?x[0]:x.slice(0,-1).join("-");return{address:P,ticker:R}}var M$={average:1,fast:1.5,fastest:2};function bF(F="average"){let $=I.get("feeMultipliers");if($&&$[F]!==void 0)return $[F];return M$[F]}function X$(F="average"){let $=bF(F),x=10n,N=BigInt(Math.round($*10));return{denominator:x,numerator:N}}function Cx(F,$="average"){let{numerator:x,denominator:N}=X$($);return F*x/N}function dx(F,$="average",x=!1){let N=bF($),P=F*N;return x?Math.floor(P):P}class D extends g{eq(F){return this.eqValue(F)}static fromBigInt(F,$){return new D({decimal:$,value:u({bigIntDecimal:$,decimal:$,value:F})})}}function TF(F,$){if("index"in $)return[...F.slice(0,F.length-1),$.index];if("change"in $){let[x,N,P,,R]=F;return[x,N,P,$.change,R]}if("account"in $){let[x,N,,P,R]=F;return[x,N,$.account,P,R]}return F}function L$([F,$,x,N,P]){let R=typeof P!=="number";if(typeof N!=="number")return`m/${F}'/${$}'/${x}'`;return`m/${F}'/${$}'/${x}'/${N}${R?"":`/${P}`}`}function lx({chain:F,index:$,addressIndex:x=0,type:N}){if(O.includes(F)){if(N&&["legacy","account"].includes(N))return[44,60,0,$];if(N==="ledgerLive")return[44,60,$,0,x];return TF(E[F],{index:$})}if(F==="SOL"){if(N==="account")return[44,501,0,$];return TF(E[F],{index:$})}let P=F==="LTC"?2:0;switch(N){case"nativeSegwitMiddleAccount":return[84,P,$,0,x];case"segwit":return[49,P,0,0,$];case"legacy":return[44,P,0,0,$];default:return TF(E[F],{index:$})}}function nx(F){let[$,x,N]=F.split("/").map((P)=>Number.parseInt(P,10));switch(x){case 44:return"legacy";case 49:return"p2sh";default:return"bech32"}}var sx=Object.keys(E).reduce((F,$)=>{return F[$]=L$(E[$]),F},{});import{Chain as z,ChainToExplorerUrl as EF}from"@swapkit/helpers";import{match as yF}from"ts-pattern";function ax({chain:F,txHash:$}){let x=EF[F];return yF(F).with(z.Maya,z.Kujira,z.Noble,z.Cosmos,z.THORChain,z.Solana,()=>`${x}/tx/${$.startsWith("0x")?$.slice(2):$}`).with(z.Arbitrum,z.Aurora,z.Avalanche,z.BinanceSmartChain,z.Base,z.Berachain,z.Ethereum,z.Gnosis,z.Optimism,z.Polkadot,z.Polygon,()=>`${x}/tx/${$.startsWith("0x")?$:`0x${$}`}`).with(z.Litecoin,z.Bitcoin,z.BitcoinCash,z.Dogecoin,z.Zcash,z.Radix,()=>`${x}/transaction/${$.toLowerCase()}`).with(z.Near,()=>`${x}/txns/${$}`).with(z.Ripple,()=>`${x}/transactions/${$}`).with(z.Tron,()=>`${x}/#/transaction/${$}`).otherwise(()=>"")}function ex({chain:F,address:$}){let x=EF[F];return yF(F).with(z.Solana,z.Radix,()=>`${x}/account/${$}`).with(z.Tron,()=>`${x}/#/address/${$}`).otherwise(()=>`${x}/address/${$}`)}function j$({liquidityUnits:F,poolUnits:$,runeDepth:x}){let N=q(F),P=q($),R=q(x),A=N.mul(R),_=P.mul(P).mul(2),B=P.mul(N).mul(2),Q=N.mul(N),Y=P.mul(P).mul(P);return A.mul(_.sub(B).add(Q)).div(Y)}function W$({liquidityUnits:F,poolUnits:$,assetDepth:x}){let N=q(F),P=q($),R=q(x),A=N.mul(R),_=P.mul(P).mul(2),B=P.mul(N).mul(2),Q=N.mul(N),Y=A.mul(_.sub(B).add(Q)),Z=P.mul(P).mul(P);return Y.div(Z)}function NN({percent:F,runeDepth:$,liquidityUnits:x,poolUnits:N}){return j$({liquidityUnits:x,poolUnits:N,runeDepth:$}).mul(F)}function PN({percent:F,assetDepth:$,liquidityUnits:x,poolUnits:N}){return W$({assetDepth:$,liquidityUnits:x,poolUnits:N}).mul(F)}function q(F){return D.fromBigInt(BigInt(F),X.THOR)}function q$({liquidityUnits:F,poolUnits:$,runeDepth:x,assetDepth:N}){return{assetAmount:q(N).mul(F).div($),runeAmount:q(x).mul(F).div($)}}function HN({liquidityUnits:F,poolUnits:$,runeDepth:x,assetDepth:N,percent:P}){return Object.fromEntries(Object.entries(q$({assetDepth:N,liquidityUnits:F,poolUnits:$,runeDepth:x})).map(([R,A])=>[R,A.mul(P)]))}function RN({runeDepth:F,poolUnits:$,assetDepth:x,liquidityUnits:N,runeAmount:P,assetAmount:R}){let A=new D({decimal:8,value:F}),_=new D({decimal:8,value:x}),B=new D({decimal:8,value:$}),Q=new D({decimal:8,value:P}),Y=new D({decimal:8,value:R}),Z=Q.mul(_),w=Y.mul(A),L=Q.mul(Y),j=A.mul(_),S=B.mul(Z.add(w.add(L.mul(2)))),k=Z.add(w.add(j.mul(2))),U=S.div(k),K=q(N).add(U);if(U.getBaseValue("number")===0)return K.div(B).getBaseValue("number");let J=B.add(K);return K.div(J).getBaseValue("number")}function AN({runeAmount:F,assetAmount:$,runeDepth:x,assetDepth:N}){if(F==="0"||$==="0"||x==="0"||N==="0")return 0;let P=q(x),R=q(N),A=q($),_=q(F),B=A.mul(P).sub(R.mul(_)),Q=R.mul(_).add(P.mul(R));return Math.abs(B.div(Q).getBaseValue("number"))}import{match as V$}from"ts-pattern";function QN({type:F,address:$}){return`${F}:${$}`}function zN({address:F,unbondAmount:$}){return`${"UNBOND"}:${F}:${$}`}function ZN(F){return FF("POOL+",F)}function YN({chain:F,symbol:$,address:x,...N}){let P=k$({chain:F,symbol:$}),R=x?`:${x}:`:":";return FF(`${"+"}:${P}${R}`,N)}function JN({chain:F,symbol:$,ticker:x,basisPoints:N,targetAsset:P}){let R=F==="ETH"&&x!=="ETH"?`${x}-${$.slice(-3)}`:$,A=P?`:${P}`:"";return`${"-"}:${F}.${R}:${N}${A}`}function MN({basisPoints:F,...$}){return FF(`${"POOL-"}:${F}`,$)}function XN({name:F,chain:$,address:x,owner:N}){let P=`${"~"}:${F}:${$}:${x}`,R=N?`:${N}`:"";return`${P}${R}`}function LN({name:F,chain:$,asset:x,payout:N,owner:P}){return`${"~"}:${F}:${$}:${N}:${P}:${x}`}function jN(F,{address:$}){return`${F}:${$}`}function WN(F,{unstakeBps:$,...x}){let N=$?`:${$}`:"",P=`${F}${N}`;return FF(`${P}`,x)}function FF(F,{affiliateAddress:$,affiliateBasisPoints:x}={}){let N=`${F}${$?`:${$}:${x||0}`:""}`;return N.endsWith(":")?N.slice(0,-1):N}function k$({chain:F,symbol:$}){return V$(F).with("BTC","DOGE","LTC",()=>F.slice(0,1).toLowerCase()).with("BCH",()=>"c").otherwise(()=>`${F}.${$}`)}function IN(){return typeof window.ethereum!=="undefined"}function wN(F){return U$().includes(F)}function U$(){let F=window?.ethereum&&!window.ethereum?.isBraveWallet,$=window?.xfi||window?.ethereum?.__XDEFI,x=window?.vultisig,N=window?.ethereum?.isBraveWallet,P=window?.ethereum?.isTrust||window?.trustwallet,R=window?.ethereum?.overrideIsMetaMask&&window?.ethereum?.selectedProvider?.isCoinbaseWallet||window?.coinbaseWalletExtension,A=window?.bitkeep?.ethereum,_=window?.$onekey?.ethereum,B=[];if(F)B.push("METAMASK");if($)B.push("CTRL");if(x)B.push("VULTISIG");if(N)B.push("BRAVE");if(P)B.push("TRUSTWALLET_WEB");if(R)B.push("COINBASE_WEB");if(O$())B.push("OKX_MOBILE");if(A)B.push("BITGET");if(_)B.push("ONEKEY");return B}async function I$(F,$,x){try{await uF({method:"wallet_switchEthereumChain",params:[{chainId:PF[$]}],provider:F})}catch(N){if(!x)throw new M("helpers_failed_to_switch_network",{error:N,reason:"networkParams not provided"});await K$(F,x)}}function KN({chains:F,supportedChains:$,walletType:x}){let N=F.filter((R)=>!R||$.includes(R));if(N.length===0)throw new M("wallet_chain_not_supported",{chain:F.join(", "),wallet:x});let P=F.filter((R)=>!$.includes(R));return y({condition:P.length>0,id:`wallet_chain_not_supported_${x}`,warning:`${x} wallet does not support the following chains: ${P.join(", ")}. These chains will be ignored.`}),N}function w$(F,$,x){return async(...N)=>{if((await $.getNetwork()).chainId.toString()===PF[x])return F(...N);try{await I$($,x)}catch(P){throw new M({errorKey:"helpers_failed_to_switch_network",info:{error:P}})}return F(...N)}}function ON({toolbox:F,chain:$,provider:x=window.ethereum,methodNames:N=[]}){let R=[...N,"approve","approvedAmount","call","sendTransaction","transfer","isApproved","approvedAmount","EIP1193SendTransaction","getFeeData","broadcastTransaction","estimateCall","estimateGasLimit","estimateGasPrices","createContractTxObject"].reduce((A,_)=>{if(!F[_])return A;let B=F[_];if(typeof B!=="function")return A;let Q=w$(B,x,$);return{...A,[_]:Q}},{});return{...F,...R}}function K$(F,$){return uF({method:"wallet_addEthereumChain",params:[$],provider:F})}function DN(F){window.ethereum?.on("accountsChanged",()=>F()),window.xfi?.ethereum.on("accountsChanged",()=>F())}function SN(){let{isTrust:F,isBraveWallet:$,__XDEFI:x,overrideIsMetaMask:N,selectedProvider:P}=window?.ethereum||{};if(F)return"TRUSTWALLET_WEB";if($)return"BRAVE";if(N&&P?.isCoinbaseWallet)return"COINBASE_WEB";if(x)"CTRL";if(window?.$onekey?.ethereum)return"ONEKEY";return"METAMASK"}function gN(){let F=[];function $(N){if(F.map((P)=>P.info.uuid).includes(N.detail.info.uuid))return;F.push(N.detail)}window.addEventListener("eip6963:announceProvider",$),window.dispatchEvent(new Event("eip6963:requestProvider"));function x(){window.removeEventListener("eip6963:announceProvider",$)}return{providers:F,removeEIP6963EventListener:x}}function O$(){let F=navigator.userAgent,$=/iphone|ipad|ipod|ios/i.test(F),x=/android|XiaoMi|MiuiBrowser/i.test(F),N=$||x,P=/OKApp/i.test(F);return N&&P}function uF({provider:F,params:$,method:x}){if(!F?.send)throw new M("helpers_not_found_provider");let N=$?Array.isArray($)?$:[$]:[];return F.send(x,N)}export{Hx as wrapWithThrow,w$ as wrapMethodWithNetworkSwitch,y as warnOnce,kx as validateTNS,SF as validateIdentifier,TF as updateDerivationPath,I$ as switchEVMWalletNetwork,uF as providerRequest,ON as prepareNetworkSwitch,O$ as okxMobileEnabled,U$ as listWeb3EVMWallets,IN as isWeb3Detected,OF as isGasAsset,wN as isDetected,zx as initializeRPCUrlsWithFallback,nx as getWalletFormatFor,Nx as getTHORNameCost,HN as getSymmetricWithdraw,q$ as getSymmetricPoolShare,RF as getRPCUrl,Ex as getMinAmountByChain,JN as getMemoForWithdraw,zN as getMemoForUnbond,WN as getMemoForTcyStake,jN as getMemoForTcyClaim,MN as getMemoForRunePoolWithdraw,ZN as getMemoForRunePoolDeposit,XN as getMemoForNameRegister,LN as getMemoForNamePreferredAssetRegister,QN as getMemoForLeaveAndBond,YN as getMemoForDeposit,Px as getMAYANameCost,AN as getLiquiditySlippage,X$ as getFeeMultiplierAsBigInt,bF as getFeeMultiplier,ax as getExplorerTxUrl,ex as getExplorerAddressUrl,RN as getEstimatedPoolShare,SN as getETHDefaultWallet,gN as getEIP6963Wallets,lx as getDerivationPathFor,KF as getDecimal,r as getCommonAssetInfo,Rx as getChainIdentifier,NN as getAsymmetricRuneWithdrawAmount,j$ as getAsymmetricRuneShare,PN as getAsymmetricAssetWithdrawAmount,W$ as getAsymmetricAssetShare,AF as getAssetType,u as formatBigIntToSafeValue,jx as findAssetBy,KN as filterSupportedChains,L$ as derivationPathToString,_F as assetFromString,Cx as applyFeeMultiplierToBigInt,dx as applyFeeMultiplier,K$ as addEVMWalletNetwork,DN as addAccountsChangedCallback,cF as WarningCodeEnum,l as WalletOption,c as UTXOChains,D as SwapKitNumber,M as SwapKitError,g$ as SubstrateChains,ZF as StagenetChain,I as SKConfig,s as RequestClient,JF as RPC_URLS,lF as ProviderName,E as NetworkDerivationPath,o as NODE_URLS,WF as MemoType,tF as LedgerErrorCode,nF as FeeTypeEnum,jF as FeeOption,MF as FALLBACK_URLS,hF as ErrorCode,NF as EXPLORER_URLS,O as EVMChains,sx as DerivationPath,M$ as DEFAULT_FEE_MULTIPLIERS,YF as CosmosChains,f$ as CosmosChainPrefixes,oF as ContractAddress,Lx as CommonAssetStrings,PF as ChainToHexChainId,v$ as ChainToExplorerUrl,LF as ChainToChainId,D$ as ChainIdToChain,xF as ChainId,W as Chain,S$ as BlockTimes,g as BigIntArithmetics,X as BaseDecimal,p as AssetValue,sF as ApproveMode};
4
+ or by passing asyncTokenLookup: true to the from() function, which will make it async and return a promise.`});let{decimal:V,identifier:K,tax:p}=Z||{decimal:I||X[T],identifier:x},O=$?e(BigInt(H),$):e(H,V);return N?z$(K,$?O:H):Q||J?Z$(K,O):new u({decimal:V,identifier:K,tax:p,value:O})}static async loadStaticAssets(F){let{loadTokenLists:$}=await import("@swapkit/tokens"),N=await $(F);for(let{tokens:P}of Object.values(N))for(let{identifier:H,chain:A,...x}of P){let _=a.includes(A)?H:H.toUpperCase(),T="decimals"in x?x.decimals:X[A];v.set(_,{decimal:T,identifier:H})}return!0}static setStaticAssets(F){v.clear();for(let[$,N]of F.entries()){let P=a.includes(N.chain)?N.identifier:N.identifier.toUpperCase(),H="decimals"in N?N.decimals:N.decimal;v.set($,{...N,decimal:H,identifier:P})}return!0}}function pN(F){let $=u.from({chain:F});return BF(F).with("BTC","LTC","BCH","DASH",()=>$.set(0.00010001)).with("DOGE",()=>$.set(1.00000001)).with("AVAX","ETH","ARB","BSC",()=>$.set(0.00000001)).with("THOR","MAYA",()=>$.set(0)).with("GAIA","KUJI",()=>$.set(0.000001)).otherwise(()=>$.set(0.00000001))}async function z$(F,$=0){gF(F);let P=F.includes("SOL.")?F:F.toUpperCase(),H=v.get(P),A=H?.decimal||await OF(TF(F));if(!H)v.set(P,{decimal:A,identifier:F});return new u({decimal:A,identifier:F,value:e($,A)})}function Z$(F,$=0){let N=F.includes(".")?F.split(".")?.[0]?.toUpperCase():void 0,P=N?["MAYA","THOR"].includes(N):!1,H=F.slice(0,14).includes("~")?"~":"/",[A,x]=P?F.split(".").slice(1).join().split(H):F.split(H);if(!(A&&x))throw new M({errorKey:"helpers_invalid_asset_identifier",info:{identifier:F}});return new u({decimal:8,identifier:`${N||"THOR"}.${A}${H}${x}`,value:e($,8)})}function e(F,$){return typeof F==="bigint"?y({bigIntDecimal:$,decimal:$,value:F}):F}function Y$(F){let $=BF(F).when((N)=>("chain"in N)&&N.chain!==void 0,({chain:N})=>N).otherwise((N)=>{let P=_F(N.asset);return P.synth?"THOR":P.chain});if(!Object.values(L).includes($.toUpperCase()))throw new M({errorKey:"helpers_invalid_asset_identifier",info:{message:"Please use the AssetValue constructor for unsupported chains"}})}function J$(F){if(Y$(F),"chain"in F)return F.chain;let{chain:$,symbol:N}=_F(F.asset);return AF({chain:$,symbol:N})==="Native"?$:F.asset}function M$(F,$,N){let P=F.split("."),H=P[0]?.toUpperCase(),A=["THOR","MAYA"].includes(H),x=N?"~":"/",[_,T=""]=A?P.slice(1).join(".").split(x):F.split(x);if(!(_&&T))throw new M({errorKey:"helpers_invalid_asset_identifier",info:{identifier:F}});let{ticker:Q,address:J}=bF({chain:_,symbol:T}),Z=`${_}${x}${T}`;return{address:J,chain:H,isGasAsset:!1,isSynthetic:$,isTradeAsset:N,symbol:Z,ticker:Q}}function X$(F){let $=F.indexOf("."),N=($===-1?F:F.slice(0,$)).toUpperCase(),P=$===-1?F:F.slice($+1),{address:H,ticker:A}=bF({chain:N,symbol:P}),x;try{x=H&&k.includes(N)&&fF(H)?fF(H):H}catch(T){x=H}let _=x?`${A}-${x}`:P;return{address:x,chain:N,isGasAsset:DF({chain:N,symbol:P}),isSynthetic:!1,isTradeAsset:!1,symbol:_,ticker:A}}function TF(F){let $=F.slice(0,14),N=$.includes("/"),P=$.includes("~");if(N||P)return M$(F,N,P);return X$(F)}function L$(F,$=!1){let N=$?F.indexOf("-"):F.lastIndexOf("-");if(N===-1)return{address:void 0,ticker:F};let P=F.slice(0,N);return{address:F.slice(N+1),ticker:P}}function bF({symbol:F,chain:$}){let{ticker:N,address:P}=L$(F,$==="NEAR");return{address:P&&!a.includes($)?P.toLowerCase():P,ticker:N}}var j$={average:1,fast:1.5,fastest:2};function EF(F="average"){let $=q.get("feeMultipliers");if($&&$[F]!==void 0)return $[F];return j$[F]}function W$(F="average"){let $=EF(F),N=10n,P=BigInt(Math.round($*10));return{denominator:N,numerator:P}}function oN(F,$="average"){let{numerator:N,denominator:P}=W$($);return F*N/P}function hN(F,$="average",N=!1){let P=EF($),H=F*P;return N?Math.floor(H):H}class U extends w{eq(F){return this.eqValue(F)}static fromBigInt(F,$){return new U({decimal:$,value:y({bigIntDecimal:$,decimal:$,value:F})})}}function QF(F,$){if("index"in $)return[...F.slice(0,F.length-1),$.index];if("change"in $){let[N,P,H,,A]=F;return[N,P,H,$.change,A]}if("account"in $){let[N,P,,H,A]=F;return[N,P,$.account,H,A]}return F}function q$([F,$,N,P,H]){let A=typeof H!=="number";if(typeof P!=="number")return`m/${F}'/${$}'/${N}'`;return`m/${F}'/${$}'/${N}'/${P}${A?"":`/${H}`}`}function tN({chain:F,index:$,addressIndex:N=0,type:P}){if(k.includes(F)){if(P&&["legacy","account"].includes(P))return[44,60,0,$];if(P==="ledgerLive")return[44,60,$,0,N];return QF(b[F],{index:$})}if(F==="SOL"){if(P==="account")return[44,501,0,$];return QF(b[F],{index:$})}let H=F==="LTC"?2:0;switch(P){case"nativeSegwitMiddleAccount":return[84,H,$,0,N];case"segwit":return[49,H,0,0,$];case"legacy":return[44,H,0,0,$];default:return QF(b[F],{index:$})}}function rN(F){let[$,N,P]=F.split("/").map((H)=>Number.parseInt(H,10));switch(N){case 44:return"legacy";case 49:return"p2sh";default:return"bech32"}}var iN=Object.keys(b).reduce((F,$)=>{return F[$]=q$(b[$]),F},{});import{Chain as z,ChainToExplorerUrl as yF}from"@swapkit/helpers";import{match as uF}from"ts-pattern";function $P({chain:F,txHash:$}){let N=yF[F];return uF(F).with(z.Maya,z.Kujira,z.Noble,z.Cosmos,z.THORChain,z.Solana,()=>`${N}/tx/${$.startsWith("0x")?$.slice(2):$}`).with(z.Arbitrum,z.Aurora,z.Avalanche,z.BinanceSmartChain,z.Base,z.Berachain,z.Ethereum,z.Gnosis,z.Optimism,z.Polkadot,z.Polygon,()=>`${N}/tx/${$.startsWith("0x")?$:`0x${$}`}`).with(z.Litecoin,z.Bitcoin,z.BitcoinCash,z.Dogecoin,z.Zcash,z.Radix,()=>`${N}/transaction/${$.toLowerCase()}`).with(z.Near,()=>`${N}/txns/${$}`).with(z.Ripple,()=>`${N}/transactions/${$}`).with(z.Tron,()=>`${N}/#/transaction/${$}`).otherwise(()=>"")}function NP({chain:F,address:$}){let N=yF[F];return uF(F).with(z.Solana,z.Radix,()=>`${N}/account/${$}`).with(z.Tron,()=>`${N}/#/address/${$}`).otherwise(()=>`${N}/address/${$}`)}function V$({liquidityUnits:F,poolUnits:$,runeDepth:N}){let P=j(F),H=j($),A=j(N),x=P.mul(A),_=H.mul(H).mul(2),T=H.mul(P).mul(2),Q=P.mul(P),J=H.mul(H).mul(H);return x.mul(_.sub(T).add(Q)).div(J)}function k$({liquidityUnits:F,poolUnits:$,assetDepth:N}){let P=j(F),H=j($),A=j(N),x=P.mul(A),_=H.mul(H).mul(2),T=H.mul(P).mul(2),Q=P.mul(P),J=x.mul(_.sub(T).add(Q)),Z=H.mul(H).mul(H);return J.div(Z)}function xP({percent:F,runeDepth:$,liquidityUnits:N,poolUnits:P}){return V$({liquidityUnits:N,poolUnits:P,runeDepth:$}).mul(F)}function AP({percent:F,assetDepth:$,liquidityUnits:N,poolUnits:P}){return k$({assetDepth:$,liquidityUnits:N,poolUnits:P}).mul(F)}function j(F){return U.fromBigInt(BigInt(F),X.THOR)}function U$({liquidityUnits:F,poolUnits:$,runeDepth:N,assetDepth:P}){return{assetAmount:j(P).mul(F).div($),runeAmount:j(N).mul(F).div($)}}function _P({liquidityUnits:F,poolUnits:$,runeDepth:N,assetDepth:P,percent:H}){return Object.fromEntries(Object.entries(U$({assetDepth:P,liquidityUnits:F,poolUnits:$,runeDepth:N})).map(([A,x])=>[A,x.mul(H)]))}function GP({runeDepth:F,poolUnits:$,assetDepth:N,liquidityUnits:P,runeAmount:H,assetAmount:A}){let x=new U({decimal:8,value:F}),_=new U({decimal:8,value:N}),T=new U({decimal:8,value:$}),Q=new U({decimal:8,value:H}),J=new U({decimal:8,value:A}),Z=Q.mul(_),I=J.mul(x),V=Q.mul(J),K=x.mul(_),p=T.mul(Z.add(I.add(V.mul(2)))),O=Z.add(I.add(K.mul(2))),f=p.div(O),D=j(P).add(f);if(f.getBaseValue("number")===0)return D.div(T).getBaseValue("number");let Y=T.add(D);return D.div(Y).getBaseValue("number")}function TP({runeAmount:F,assetAmount:$,runeDepth:N,assetDepth:P}){if(F==="0"||$==="0"||N==="0"||P==="0")return 0;let H=j(N),A=j(P),x=j($),_=j(F),T=x.mul(H).sub(A.mul(_)),Q=A.mul(_).add(H.mul(A));return Math.abs(T.div(Q).getBaseValue("number"))}import{match as w$}from"ts-pattern";function YP({type:F,address:$}){return`${F}:${$}`}function JP({address:F,unbondAmount:$}){return`${"UNBOND"}:${F}:${$}`}function MP(F){return FF("POOL+",F)}function XP({chain:F,symbol:$,address:N,...P}){let H=I$({chain:F,symbol:$}),A=N?`:${N}:`:":";return FF(`${"+"}:${H}${A}`,P)}function LP({chain:F,symbol:$,ticker:N,basisPoints:P,targetAsset:H}){let A=F==="ETH"&&N!=="ETH"?`${N}-${$.slice(-3)}`:$,x=H?`:${H}`:"";return`${"-"}:${F}.${A}:${P}${x}`}function jP({basisPoints:F,...$}){return FF(`${"POOL-"}:${F}`,$)}function WP({name:F,chain:$,address:N,owner:P}){let H=`${"~"}:${F}:${$}:${N}`,A=P?`:${P}`:"";return`${H}${A}`}function qP({name:F,chain:$,asset:N,payout:P,owner:H}){return`${"~"}:${F}:${$}:${P}:${H}:${N}`}function VP(F,{address:$}){return`${F}:${$}`}function kP(F,{unstakeBps:$,...N}){let P=$?`:${$}`:"",H=`${F}${P}`;return FF(`${H}`,N)}function FF(F,{affiliateAddress:$,affiliateBasisPoints:N}={}){let P=`${F}${$?`:${$}:${N||0}`:""}`;return P.endsWith(":")?P.slice(0,-1):P}function I$({chain:F,symbol:$}){return w$(F).with("BTC","DOGE","LTC",()=>F.slice(0,1).toLowerCase()).with("BCH",()=>"c").otherwise(()=>`${F}.${$}`)}function OP(){return typeof window.ethereum!=="undefined"}function DP(F){return K$().includes(F)}function K$(){let F=window?.ethereum&&!window.ethereum?.isBraveWallet,$=window?.xfi||window?.ethereum?.__XDEFI,N=window?.vultisig,P=window?.ethereum?.isBraveWallet,H=window?.ethereum?.isTrust||window?.trustwallet,A=window?.ethereum?.overrideIsMetaMask&&window?.ethereum?.selectedProvider?.isCoinbaseWallet||window?.coinbaseWalletExtension,x=window?.bitkeep?.ethereum,_=window?.$onekey?.ethereum,T=[];if(F)T.push("METAMASK");if($)T.push("CTRL");if(N)T.push("VULTISIG");if(P)T.push("BRAVE");if(H)T.push("TRUSTWALLET_WEB");if(A)T.push("COINBASE_WEB");if(g$())T.push("OKX_MOBILE");if(x)T.push("BITGET");if(_)T.push("ONEKEY");return T}async function O$(F,$,N){try{await pF({method:"wallet_switchEthereumChain",params:[{chainId:HF[$]}],provider:F})}catch(P){if(!N)throw new M("helpers_failed_to_switch_network",{error:P,reason:"networkParams not provided"});await S$(F,N)}}function SP({chains:F,supportedChains:$,walletType:N}){let P=F.filter((A)=>!A||$.includes(A));if(P.length===0)throw new M("wallet_chain_not_supported",{chain:F.join(", "),wallet:N});let H=F.filter((A)=>!$.includes(A));return E({condition:H.length>0,id:`wallet_chain_not_supported_${N}`,warning:`${N} wallet does not support the following chains: ${H.join(", ")}. These chains will be ignored.`}),P}function D$(F,$,N){return async(...P)=>{if((await $.getNetwork()).chainId.toString()===HF[N])return F(...P);try{await O$($,N)}catch(H){throw new M({errorKey:"helpers_failed_to_switch_network",info:{error:H}})}return F(...P)}}function gP({toolbox:F,chain:$,provider:N=window.ethereum,methodNames:P=[]}){let A=[...P,"approve","approvedAmount","call","sendTransaction","transfer","isApproved","approvedAmount","EIP1193SendTransaction","getFeeData","broadcastTransaction","estimateCall","estimateGasLimit","estimateGasPrices","createContractTxObject"].reduce((x,_)=>{if(!F[_])return x;let T=F[_];if(typeof T!=="function")return x;let Q=D$(T,N,$);return{...x,[_]:Q}},{});return{...F,...A}}function S$(F,$){return pF({method:"wallet_addEthereumChain",params:[$],provider:F})}function vP(F){window.ethereum?.on("accountsChanged",()=>F()),window.xfi?.ethereum.on("accountsChanged",()=>F())}function fP(){let{isTrust:F,isBraveWallet:$,__XDEFI:N,overrideIsMetaMask:P,selectedProvider:H}=window?.ethereum||{};if(F)return"TRUSTWALLET_WEB";if($)return"BRAVE";if(P&&H?.isCoinbaseWallet)return"COINBASE_WEB";if(N)"CTRL";if(window?.$onekey?.ethereum)return"ONEKEY";return"METAMASK"}function bP(){let F=[];function $(P){if(F.map((H)=>H.info.uuid).includes(P.detail.info.uuid))return;F.push(P.detail)}window.addEventListener("eip6963:announceProvider",$),window.dispatchEvent(new Event("eip6963:requestProvider"));function N(){window.removeEventListener("eip6963:announceProvider",$)}return{providers:F,removeEIP6963EventListener:N}}function g$(){let F=navigator.userAgent,$=/iphone|ipad|ipod|ios/i.test(F),N=/android|XiaoMi|MiuiBrowser/i.test(F),P=$||N,H=/OKApp/i.test(F);return P&&H}function pF({provider:F,params:$,method:N}){if(!F?.send)throw new M("helpers_not_found_provider");let P=$?Array.isArray($)?$:[$]:[];return F.send(N,P)}export{_N as wrapWithThrow,D$ as wrapMethodWithNetworkSwitch,E as warnOnce,IN as validateTNS,gF as validateIdentifier,QF as updateDerivationPath,O$ as switchEVMWalletNetwork,pF as providerRequest,gP as prepareNetworkSwitch,g$ as okxMobileEnabled,K$ as listWeb3EVMWallets,OP as isWeb3Detected,DF as isGasAsset,DP as isDetected,JN as initializeRPCUrlsWithFallback,rN as getWalletFormatFor,xN as getTHORNameCost,_P as getSymmetricWithdraw,U$ as getSymmetricPoolShare,xF as getRPCUrl,pN as getMinAmountByChain,LP as getMemoForWithdraw,JP as getMemoForUnbond,kP as getMemoForTcyStake,VP as getMemoForTcyClaim,jP as getMemoForRunePoolWithdraw,MP as getMemoForRunePoolDeposit,WP as getMemoForNameRegister,qP as getMemoForNamePreferredAssetRegister,YP as getMemoForLeaveAndBond,XP as getMemoForDeposit,AN as getMAYANameCost,TP as getLiquiditySlippage,W$ as getFeeMultiplierAsBigInt,EF as getFeeMultiplier,$P as getExplorerTxUrl,NP as getExplorerAddressUrl,GP as getEstimatedPoolShare,fP as getETHDefaultWallet,bP as getEIP6963Wallets,tN as getDerivationPathFor,OF as getDecimal,r as getCommonAssetInfo,GN as getChainIdentifier,xP as getAsymmetricRuneWithdrawAmount,V$ as getAsymmetricRuneShare,AP as getAsymmetricAssetWithdrawAmount,k$ as getAsymmetricAssetShare,AF as getAssetType,y as formatBigIntToSafeValue,VN as findAssetBy,SP as filterSupportedChains,q$ as derivationPathToString,_F as assetFromString,oN as applyFeeMultiplierToBigInt,hN as applyFeeMultiplier,S$ as addEVMWalletNetwork,vP as addAccountsChangedCallback,lF as WarningCodeEnum,l as WalletOption,c as UTXOChains,U as SwapKitNumber,M as SwapKitError,b$ as SubstrateChains,YF as StagenetChain,q as SKConfig,s as RequestClient,MF as RPC_URLS,nF as ProviderName,b as NetworkDerivationPath,o as NODE_URLS,qF as MemoType,rF as LedgerErrorCode,sF as FeeTypeEnum,WF as FeeOption,XF as FALLBACK_URLS,cF as ErrorCode,PF as EXPLORER_URLS,k as EVMChains,iN as DerivationPath,j$ as DEFAULT_FEE_MULTIPLIERS,JF as CosmosChains,E$ as CosmosChainPrefixes,hF as ContractAddress,qN as CommonAssetStrings,HF as ChainToHexChainId,y$ as ChainToExplorerUrl,jF as ChainToChainId,v$ as ChainIdToChain,NF as ChainId,L as Chain,f$ as BlockTimes,w as BigIntArithmetics,X as BaseDecimal,u as AssetValue,tF as ApproveMode};
5
5
 
6
- //# debugId=1808AD2FD4CEB78D64756E2164756E21
6
+ //# debugId=A44D9EB0F991626764756E2164756E21
7
7
  //# sourceMappingURL=index.js.map