@swapkit/helpers 4.0.5 → 4.0.6

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.cjs CHANGED
@@ -1,7 +1,7 @@
1
- var L={};W(L,{wrapWithThrow:()=>T$,wrapMethodWithNetworkSwitch:()=>lF,warnOnce:()=>y,validateTNS:()=>V$,validateIdentifier:()=>JF,updateDerivationPath:()=>NF,switchEVMWalletNetwork:()=>cF,providerRequest:()=>qF,prepareNetworkSwitch:()=>Ax,okxMobileEnabled:()=>sF,listWeb3EVMWallets:()=>hF,isWeb3Detected:()=>Px,isGasAsset:()=>YF,isDetected:()=>Hx,initializeRPCUrlsWithFallback:()=>Y$,getWalletFormatFor:()=>v$,getTHORNameCost:()=>G$,getSymmetricWithdraw:()=>m$,getSymmetricPoolShare:()=>oF,getRPCUrl:()=>i,getMinAmountByChain:()=>w$,getMemoForWithdraw:()=>i$,getMemoForUnbond:()=>s$,getMemoForTcyStake:()=>xx,getMemoForTcyClaim:()=>$x,getMemoForRunePoolWithdraw:()=>a$,getMemoForRunePoolDeposit:()=>t$,getMemoForNameRegister:()=>e$,getMemoForNamePreferredAssetRegister:()=>Fx,getMemoForLeaveAndBond:()=>n$,getMemoForDeposit:()=>r$,getMAYANameCost:()=>B$,getLiquiditySlippage:()=>h$,getFeeMultiplierAsBigInt:()=>uF,getFeeMultiplier:()=>jF,getExplorerTxUrl:()=>y$,getExplorerAddressUrl:()=>u$,getEstimatedPoolShare:()=>o$,getETHDefaultWallet:()=>Gx,getEIP6963Wallets:()=>Bx,getDerivationPathFor:()=>f$,getDecimal:()=>ZF,getCommonAssetInfo:()=>n,getChainIdentifier:()=>Q$,getAsymmetricRuneWithdrawAmount:()=>C$,getAsymmetricRuneShare:()=>dF,getAsymmetricAssetWithdrawAmount:()=>d$,getAsymmetricAssetShare:()=>mF,getAssetType:()=>e,formatBigIntToSafeValue:()=>u,findAssetBy:()=>j$,filterSupportedChains:()=>Rx,derivationPathToString:()=>pF,assetFromString:()=>FF,applyFeeMultiplierToBigInt:()=>O$,applyFeeMultiplier:()=>D$,addEVMWalletNetwork:()=>nF,addAccountsChangedCallback:()=>_x,WarningCodeEnum:()=>IF,WalletOption:()=>c,UTXOChains:()=>h,SwapKitNumber:()=>S,SwapKitError:()=>M,SubstrateChains:()=>eF,StagenetChain:()=>HF,SKConfig:()=>w,RequestClient:()=>l,RPC_URLS:()=>_F,ProviderName:()=>wF,NetworkDerivationPath:()=>E,NODE_URLS:()=>o,MemoType:()=>QF,LedgerErrorCode:()=>DF,FeeTypeEnum:()=>KF,FeeOption:()=>TF,FALLBACK_URLS:()=>GF,ErrorCode:()=>UF,EXPLORER_URLS:()=>t,EVMChains:()=>D,DerivationPath:()=>b$,DEFAULT_FEE_MULTIPLIERS:()=>yF,CosmosChains:()=>AF,CosmosChainPrefixes:()=>F$,ContractAddress:()=>kF,CommonAssetStrings:()=>X$,ChainToHexChainId:()=>r,ChainToExplorerUrl:()=>x$,ChainToChainId:()=>BF,ChainIdToChain:()=>iF,ChainId:()=>s,Chain:()=>q,BlockTimes:()=>aF,BigIntArithmetics:()=>g,BaseDecimal:()=>X,AssetValue:()=>p,ApproveMode:()=>OF});module.exports=yx(L);j(L,require("@swapkit/tokens"),module.exports);var K$={};W(K$,{getMinAmountByChain:()=>w$,AssetValue:()=>p});var vF=require("ethers"),EF=require("ts-pattern");var q;((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"})(q||={});var HF;((x)=>{x.THORChain="THOR_STAGENET";x.Maya="MAYA_STAGENET"})(HF||={});var s;((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"})(s||={});var iF={["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"},Yx=Object.keys(q),RF=Object.values(q),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},aF={["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},eF=["DOT","FLIP"],D=["ARB","AURORA","AVAX","BASE","BERA","BSC","ETH","GNO","OP","POL"],h=["BTC","BCH","DASH","DOGE","LTC","ZEC"],AF=["GAIA","THOR","MAYA","KUJI","NOBLE"],F$={["GAIA"]:"cosmos",["THOR"]:"thor",["MAYA"]:"maya",["KUJI"]:"kujira",["NOBLE"]:"noble"},_F={["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.thorswap.net",["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.thorswap.net",["MAYA"]:"https://mayanode.mayachain.info",["THOR_STAGENET"]:"https://stagenet-thornode.ninerealms.com",["MAYA_STAGENET"]:"https://stagenet.mayanode.mayachain.info"},GF={["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"]:[]},t={["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"},$$=RF.reduce((F,$)=>{let x=Yx.find((N)=>q[N]===$);if(x)F[$]=x;return F},{}),BF=RF.reduce((F,$)=>{return F[$]=s[$$[$]],F},{}),r=RF.reduce((F,$)=>{let x=`${$$[$]}Hex`;return F[$]=s[x],F},{}),x$=RF.reduce((F,$)=>{return F[$]=t[$],F},{});var W$={};W(W$,{isGasAsset:()=>YF,getDecimal:()=>ZF,getCommonAssetInfo:()=>n,getAssetType:()=>e,findAssetBy:()=>j$,assetFromString:()=>FF,CommonAssetStrings:()=>X$});var a=require("ts-pattern");var A$={};W(A$,{RequestClient:()=>l});var H$={};W(H$,{SKConfig:()=>w});var P$=require("zustand/vanilla");var N$={};W(N$,{WarningCodeEnum:()=>IF,WalletOption:()=>c,UTXOChains:()=>h,SubstrateChains:()=>eF,StagenetChain:()=>HF,RPC_URLS:()=>_F,ProviderName:()=>wF,NetworkDerivationPath:()=>E,NODE_URLS:()=>o,MemoType:()=>QF,LedgerErrorCode:()=>DF,FeeTypeEnum:()=>KF,FeeOption:()=>TF,FALLBACK_URLS:()=>GF,ErrorCode:()=>UF,EXPLORER_URLS:()=>t,EVMChains:()=>D,CosmosChains:()=>AF,CosmosChainPrefixes:()=>F$,ContractAddress:()=>kF,ChainToHexChainId:()=>r,ChainToExplorerUrl:()=>x$,ChainToChainId:()=>BF,ChainIdToChain:()=>iF,ChainId:()=>s,Chain:()=>q,BlockTimes:()=>aF,BaseDecimal:()=>X,ApproveMode:()=>OF});var kF;((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"})(kF||={});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 UF;((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"})(UF||={});var IF;((x)=>{x.highSlippage="highSlippage";x.highPriceImpact="highPriceImpact"})(IF||={});var wF;((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"})(wF||={});var KF;((_)=>{_.LIQUIDITY="liquidity";_.NETWORK="network";_.INBOUND="inbound";_.OUTBOUND="outbound";_.AFFILIATE="affiliate";_.TAX="tax";_.PRIORITY="priority"})(KF||={});var TF;((N)=>{N.Average="average";N.Fast="fast";N.Fastest="fastest"})(TF||={});var OF;((x)=>{x.Approve="approve";x.CheckOnly="checkOnly"})(OF||={});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 c;((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"})(c||={});var DF;((N)=>{N[N.NoError=36864]="NoError";N[N.LockedDevice=21781]="LockedDevice";N[N.TC_NotFound=65535]="TC_NotFound"})(DF||={});var Jx={apiKeys:{blockchair:"",keepKey:"",swapKit:"",walletConnectProjectId:"",xaman:""},apis:{},chains:Object.values(q),envs:{apiUrl:"https://api.swapkit.dev",devApiUrl:"https://dev-api.swapkit.dev",isDev:!1,isStagenet:!1},explorerUrls:t,fallbackRpcUrls:GF,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:_F,wallets:Object.values(c)},I=P$.createStore((F)=>({...Jx,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}}))})),w={get:(F)=>I.getState()[F],getState:I.getState,set:(F)=>I.getState().setConfig(F),setApiKey:(F,$)=>I.getState().setApiKey(F,$),setEnv:(F,$)=>I.getState().setEnv(F,$),setExplorerUrl:(F,$)=>I.getState().setExplorerUrl(F,$),setFallbackRpcUrls:(F,$)=>I.getState().setFallbackRpcUrls(F,$),setFeeMultipliers:(F)=>I.getState().setFeeMultipliers(F),setIntegrationConfig:(F,$)=>I.getState().setIntegrationConfig(F,$),setNodeUrl:(F,$)=>I.getState().setNodeUrl(F,$),setRequestOptions:(F)=>I.getState().setRequestOptions(F),setRpcUrl:(F,$)=>I.getState().setRpcUrl(F,$)};var R$={};W(R$,{SwapKitError:()=>M});var Mx={api_v2_invalid_method_key_hash:60003,api_v2_invalid_response:60001,api_v2_server_error:60002,chainflip_broker_fund_invalid_address:30107,chainflip_broker_fund_only_flip_supported:30106,chainflip_broker_invalid_params:30101,chainflip_broker_recipient_error:30102,chainflip_broker_register:30103,chainflip_broker_tx_error:30104,chainflip_broker_withdraw:30105,chainflip_channel_error:30001,chainflip_unknown_asset:30002,core_approve_asset_address_or_from_not_found:10004,core_approve_asset_target_invalid:10007,core_chain_halted:10010,core_estimated_max_spendable_chain_not_supported:10001,core_explorer_unsupported_chain:10008,core_extend_error:10002,core_inbound_data_not_found:10003,core_plugin_not_found:10005,core_plugin_swap_not_found:10006,core_swap_asset_not_recognized:10203,core_swap_contract_not_found:10204,core_swap_contract_not_supported:10206,core_swap_invalid_params:10201,core_swap_quote_mode_not_supported:10208,core_swap_route_not_complete:10202,core_swap_route_transaction_not_found:10205,core_swap_transaction_error:10207,core_transaction_add_liquidity_asset_error:10308,core_transaction_add_liquidity_base_address:10306,core_transaction_add_liquidity_base_error:10307,core_transaction_add_liquidity_invalid_params:10305,core_transaction_create_liquidity_asset_error:10303,core_transaction_create_liquidity_base_error:10302,core_transaction_create_liquidity_invalid_params:10304,core_transaction_deposit_error:10301,core_transaction_deposit_gas_error:10312,core_transaction_deposit_insufficient_funds_error:10311,core_transaction_deposit_server_error:10314,core_transaction_deposit_to_pool_error:10310,core_transaction_failed:10316,core_transaction_invalid_recipient_address:10317,core_transaction_invalid_sender_address:10313,core_transaction_user_rejected:10315,core_transaction_withdraw_error:10309,core_verify_message_not_supported:10009,core_wallet_connection_failed:10114,core_wallet_connection_not_found:10101,core_wallet_ctrl_not_installed:10102,core_wallet_evmwallet_not_installed:10103,core_wallet_keepkey_not_installed:10110,core_wallet_keplr_not_installed:10108,core_wallet_keystore_not_installed:10105,core_wallet_ledger_not_installed:10106,core_wallet_not_keypair_wallet:10112,core_wallet_okx_not_installed:10109,core_wallet_sign_message_not_supported:10113,core_wallet_talisman_not_installed:10111,core_wallet_trezor_not_installed:10107,core_wallet_walletconnect_not_installed:10104,helpers_chain_not_supported:70009,helpers_failed_to_switch_network:70007,helpers_invalid_asset_identifier:70005,helpers_invalid_asset_url:70004,helpers_invalid_identifier:70003,helpers_invalid_memo_type:70006,helpers_invalid_number_different_decimals:70001,helpers_invalid_number_of_years:70002,helpers_invalid_params:70010,helpers_invalid_response:70011,helpers_not_found_provider:70008,not_implemented:99999,plugin_near_invalid_name:41001,plugin_near_name_unavailable:41003,plugin_near_no_connection:41002,plugin_near_registration_failed:41004,plugin_near_transfer_failed:41005,thorchain_asset_is_not_tcy:40003,thorchain_chain_halted:40001,thorchain_preferred_asset_payout_required:40105,thorchain_swapin_memo_required:40103,thorchain_swapin_router_required:40101,thorchain_swapin_token_required:40104,thorchain_swapin_vault_required:40102,thorchain_trading_halted:40002,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:50213,toolbox_evm_no_signer_address:50212,toolbox_evm_no_to_address:50214,toolbox_evm_not_supported:50215,toolbox_evm_provider_not_eip1193_compatible:50216,toolbox_near_access_key_error:90605,toolbox_near_balance_failed:90608,toolbox_near_empty_batch:90607,toolbox_near_invalid_address:90602,toolbox_near_invalid_amount:90603,toolbox_near_invalid_gas_params:90612,toolbox_near_invalid_name:90609,toolbox_near_missing_contract_address:90610,toolbox_near_no_account:90611,toolbox_near_no_rpc_url:90606,toolbox_near_no_signer:90601,toolbox_near_transfer_failed:90604,toolbox_not_supported:59901,toolbox_radix_method_not_supported:50601,toolbox_ripple_asset_not_supported:50704,toolbox_ripple_broadcast_error:50705,toolbox_ripple_get_balance_error:50701,toolbox_ripple_rpc_not_configured:50702,toolbox_ripple_signer_not_found:50703,toolbox_solana_fee_estimation_failed:50402,toolbox_solana_no_signer:50401,toolbox_substrate_not_supported:50501,toolbox_tron_allowance_check_failed:50809,toolbox_tron_approve_failed:50807,toolbox_tron_fee_estimation_failed:50805,toolbox_tron_invalid_token_contract:50808,toolbox_tron_invalid_token_identifier:50802,toolbox_tron_no_signer:50801,toolbox_tron_token_transfer_failed:50803,toolbox_tron_transaction_creation_failed:50804,toolbox_tron_trongrid_api_error:50806,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,wallet_bitkeep_failed_to_switch_network:21002,wallet_bitkeep_no_accounts:21003,wallet_bitkeep_not_found:21001,wallet_chain_not_supported:20003,wallet_coinbase_chain_not_supported:21702,wallet_coinbase_method_not_supported:21703,wallet_coinbase_no_accounts:21704,wallet_coinbase_not_found:21701,wallet_connection_rejected_by_user:20001,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_not_found:21501,wallet_cosmostation_signer_not_found:21508,wallet_ctrl_asset_not_defined:20304,wallet_ctrl_contract_address_not_provided:20303,wallet_ctrl_not_found:20301,wallet_ctrl_send_transaction_no_address:20302,wallet_evm_extensions_failed_to_switch_network:21801,wallet_evm_extensions_no_provider:21802,wallet_evm_extensions_not_found:21803,wallet_exodus_chain_not_supported:21107,wallet_exodus_failed_to_switch_network:21106,wallet_exodus_instance_missing:21108,wallet_exodus_no_address:21103,wallet_exodus_not_found:21102,wallet_exodus_request_canceled:21104,wallet_exodus_sign_transaction_error:21101,wallet_exodus_signature_canceled:21105,wallet_failed_to_add_or_switch_network:20006,wallet_keepkey_account_not_found:20917,wallet_keepkey_asset_not_defined:20902,wallet_keepkey_chain_not_supported:20910,wallet_keepkey_config_not_found:20915,wallet_keepkey_contract_address_not_provided:20903,wallet_keepkey_derivation_path_error:20905,wallet_keepkey_invalid_params:20914,wallet_keepkey_invalid_response:20909,wallet_keepkey_method_not_supported:20913,wallet_keepkey_no_accounts:20912,wallet_keepkey_no_provider:20916,wallet_keepkey_not_found:20901,wallet_keepkey_send_transaction_no_address:20904,wallet_keepkey_signer_not_found:20911,wallet_keepkey_signing_error:20906,wallet_keepkey_transport_error:20907,wallet_keepkey_unsupported_chain:20908,wallet_keplr_chain_not_supported:21402,wallet_keplr_no_accounts:21404,wallet_keplr_not_found:21401,wallet_keplr_signer_not_found:21403,wallet_keystore_invalid_password:21901,wallet_keystore_unsupported_version:21902,wallet_ledger_address_not_found:20122,wallet_ledger_app_not_open:20110,wallet_ledger_chain_not_supported:20119,wallet_ledger_connection_claimed:20102,wallet_ledger_connection_error:20101,wallet_ledger_derivation_path_error:20108,wallet_ledger_device_locked:20105,wallet_ledger_device_not_found:20104,wallet_ledger_failed_to_get_address:20123,wallet_ledger_get_address_error:20103,wallet_ledger_invalid_account:20121,wallet_ledger_invalid_asset:20120,wallet_ledger_invalid_params:20113,wallet_ledger_invalid_response:20111,wallet_ledger_invalid_signature:20114,wallet_ledger_method_not_supported:20112,wallet_ledger_no_provider:20115,wallet_ledger_pubkey_not_found:20116,wallet_ledger_public_key_error:20107,wallet_ledger_signing_error:20109,wallet_ledger_transport_error:20106,wallet_ledger_transport_not_defined:20117,wallet_ledger_webusb_not_supported:20118,wallet_locked:20007,wallet_missing_api_key:20002,wallet_missing_params:20004,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_okx_chain_not_supported:21302,wallet_okx_failed_to_switch_network:21303,wallet_okx_no_accounts:21304,wallet_okx_not_found:21301,wallet_onekey_not_found:21201,wallet_onekey_sign_transaction_error:21202,wallet_phantom_not_found:20201,wallet_polkadot_not_found:20701,wallet_provider_not_found:20005,wallet_radix_invalid_manifest:20803,wallet_radix_method_not_supported:20804,wallet_radix_no_account:20805,wallet_radix_not_found:20801,wallet_radix_transaction_failed:20802,wallet_talisman_not_enabled:20601,wallet_talisman_not_found:20602,wallet_trezor_derivation_path_not_supported:20502,wallet_trezor_failed_to_get_address:20503,wallet_trezor_failed_to_sign_transaction:20501,wallet_trezor_method_not_supported:20505,wallet_trezor_transport_error:20504,wallet_vultisig_asset_not_defined:22103,wallet_vultisig_contract_address_not_provided:22102,wallet_vultisig_not_found:22101,wallet_vultisig_send_transaction_no_address:22104,wallet_walletconnect_chain_not_supported:20404,wallet_walletconnect_connection_not_established:20402,wallet_walletconnect_invalid_method:20405,wallet_walletconnect_method_not_supported:20406,wallet_walletconnect_namespace_not_supported:20403,wallet_walletconnect_project_id_not_specified:20401,wallet_xaman_auth_failed:23003,wallet_xaman_connection_failed:23004,wallet_xaman_monitoring_failed:23006,wallet_xaman_not_configured:23001,wallet_xaman_not_connected:23002,wallet_xaman_transaction_failed:23005,wallet_xdefi_chain_not_supported:21602,wallet_xdefi_not_found:21601};class M extends Error{static ErrorCode=Mx;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 Xx=(F)=>new Promise(($)=>setTimeout($,F)),Lx=(F,{baseDelay:$,backoffMultiplier:x,maxDelay:N})=>Math.min($*x**F,N),jx=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 zF(F,$={}){return async function x(N,P={}){let{searchParams:R,json:A,body:_,headers:B,dynamicHeader:Q,retry:Y,timeoutMs:Z,abortController:f,onError:V,onSuccess:k,responseHandler:b,...K}={...$,...P},O=w.get("requestOptions"),v={...O.retry,...Y},J=!!A||N.endsWith(".json"),Qx=qx(N,R),zx=Wx(J,{...B,...Q?.()}),Zx=J?JSON.stringify(A):_,VF;for(let PF=0;PF<=v.maxRetries;PF++){let tF=f||new AbortController,rF=setTimeout(()=>tF.abort(),Z||O.timeoutMs);try{let C=await jx(Qx,{...K,body:Zx,headers:zx,method:F,signal:tF.signal});return clearTimeout(rF),k?.(C)||b?.(C)||C}catch(C){if(clearTimeout(rF),VF=C,PF>=v.maxRetries)return V?V(C):Promise.reject(C);await Xx(Lx(PF,v))}}return V?V(VF):Promise.reject(VF)}}function Wx(F,$){return{...$,...F&&{"Content-Type":"application/json"}}}function qx(F,$){let x=new URL(F);if($)x.search=new URLSearchParams($).toString();return x.toString()}var l={extend:(F)=>({extend:($)=>l.extend({...F,...$}),get:zF("GET",F),post:zF("POST",F)}),get:zF("GET"),post:zF("POST")};var J$={};W(J$,{initializeRPCUrlsWithFallback:()=>Y$,getRPCUrl:()=>i});var gF=require("ts-pattern");var z$={};W(z$,{wrapWithThrow:()=>T$,warnOnce:()=>y,getTHORNameCost:()=>G$,getMAYANameCost:()=>B$,getChainIdentifier:()=>Q$});function G$(F){if(F<0)throw new M({errorKey:"helpers_invalid_number_of_years",info:{numberOfYears:F}});return 10+F}function B$(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 T$(F,$){try{return F()}catch(x){if($)throw new M($,x);return}}function Q$(F){switch(F){case"THOR":return`${F}.RUNE`;case"GAIA":return`${F}.ATOM`;case"BSC":return`${F}`;default:return`${F}.${F}`}}var _$=new Set;function y({condition:F,id:$,warning:x}){if(F){if(_$.has($))return;console.warn(x),_$.add($)}}function Vx(F){return gF.match(F).with(...D,()=>({id:1,jsonrpc:"2.0",method:"eth_blockNumber",params:[]})).with(...h,()=>({id:"test",jsonrpc:"1.0",method:"getblockchaininfo",params:[]})).with(...AF,"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 kx(F){return gF.match(F).with("XRD",()=>"/status/network-configuration").with("TRON",()=>"/wallet/getnowblock").otherwise(()=>"")}async function Z$(F,$){try{let x=$.startsWith("wss")?$.replace("wss","https"):$;return(await fetch(`${x}${kx(F)}`,{body:JSON.stringify(Vx(F)),headers:{"Content-Type":"application/json"},method:"POST",signal:AbortSignal.timeout(3000)})).ok}catch{return!1}}var SF=new Map,Ux=120000;async function i(F){let{isStagenet:$}=w.get("envs"),x=w.get("rpcUrls"),N=w.get("fallbackRpcUrls");if($)return x[F];let P=SF.get(F);if(P&&Date.now()-P.timestamp<Ux)return P.url;let R=x[F];if(!await Z$(F,R)){for(let _ of N[F])if(await Z$(F,_))return SF.set(F,{timestamp:Date.now(),url:_}),_}return SF.set(F,{timestamp:Date.now(),url:R}),R}function Y$(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 X$=[`${"MAYA"}.MAYA`,`${"MAYA"}.CACAO`,`${"ETH"}.THOR`,`${"ETH"}.vTHOR`,`${"KUJI"}.USK`,`${"ETH"}.FLIP`,`${"XRD"}.XRD`],L$=["ARB","AURORA","BASE","ETH","OP"];async function Ix({chain:F,to:$}){try{let N=await i(F),{result:P}=await l.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 wx(F){if(F==="XRD")return X.XRD;try{let $=F.split("-")[1]?.toLowerCase(),x=await i("XRD"),{manager:N}=await l.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 Kx({chain:F,symbol:$}){if(D.includes($))return X[$];let x=$.split("-"),N=x.length===1?void 0:x[x.length-1]?.toLowerCase();return await(N?.startsWith("0x")?Ix({chain:F,to:N}):X[F])}function ZF({chain:F,symbol:$}){return a.match(F).with(...D,(x)=>Kx({chain:x,symbol:$})).with("XRD",()=>wx($)).otherwise(()=>X[F])}function YF({chain:F,symbol:$}){return a.match(F).with(...L$,()=>$==="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}.${$}`===n(F).identifier).otherwise(()=>$===F)}var n=(F)=>{let $=X[F];return a.match(F.toUpperCase()).with(...L$,(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(...h,"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 e({chain:F,symbol:$}){if($.includes("/"))return"Synth";if($.includes("~"))return"Trade";return a.match(F).with("XRD",()=>$==="XRD"||`${F}.${$}`===n(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 FF=(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 j$(F){let{loadTokenLists:$}=await import("./tokens.cjs"),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 k$={};W(k$,{validateTNS:()=>V$,validateIdentifier:()=>JF});var q$=["TERRA",...w.get("chains")];function JF(F=""){let $=F.toUpperCase(),[x]=$.split(".");if(q$.includes(x))return!0;let[N]=$.split("/");if(q$.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 V$(F){if(F.length>30)return!1;let $=/^[a-zA-Z0-9+_-]+$/g;return!!F.match($)}var I$={};W(I$,{formatBigIntToSafeValue:()=>u,BigIntArithmetics:()=>g});var xF=8,d=(F)=>10n**BigInt(F),$F=(F)=>Math.log10(Number.parseFloat(F.toString()));function u({value:F,bigIntDecimal:$=xF,decimal:x=xF}){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 Ox(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")*d(x)/d($),x)}constructor(F){let $=fF(F),x=typeof F==="object";this.decimal=x?F.decimal:void 0,this.decimalMultiplier=x&&"decimalMultiplier"in F?F.decimalMultiplier:d(Math.max(U$(MF($)),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||$F(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/d($||this.decimal||X.THOR),N=Ox(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=fF(F),N=MF(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||xF,N=Math.max(x,$F(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,$F(this.decimalMultiplier)),P=d(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:d(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 $=MF(F)||"0";this.bigIntValue=this.#N($)}#x(...F){let $=F.map((x)=>{return typeof x==="object"?x.decimal||$F(x.decimalMultiplier):U$(MF(x))}).filter(Boolean);return Math.max(...$,xF)}#N(F,$){let x=$?d($):this.decimalMultiplier,N=$F(x),[P="",R=""]=F.split(".");return BigInt(`${P}${R.padEnd(N,"0")}`)}}var Dx=Intl.NumberFormat("fullwide",{maximumFractionDigits:20,useGrouping:!1});function MF(F){let x=`${typeof F==="number"?Dx.format(F):fF(F)}`.replaceAll(",",".").split(".");return x.length>1?`${x.slice(0,-1).join("")}.${x.at(-1)}`:x[0]||"0"}function U$(F){let $=F.split(".")[1]?.length||0;return Math.max($,xF)}function fF(F){return typeof F==="object"?"getValue"in F?F.getValue("string"):F.value:F}var XF=["SOL","TRON"],m=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=e(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=BF[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 m.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=vx(N),{identifier:A,decimal:_}=n(R),{chain:B,isSynthetic:Q,isTradeAsset:Y}=bF(A),Z=m.get(XF.includes(B)?A:A.toUpperCase()),f=Z?.decimal||_;y({condition:!(x||f),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
+ var L={};W(L,{wrapWithThrow:()=>T$,wrapMethodWithNetworkSwitch:()=>lF,warnOnce:()=>y,validateTNS:()=>V$,validateIdentifier:()=>JF,updateDerivationPath:()=>NF,switchEVMWalletNetwork:()=>cF,providerRequest:()=>qF,prepareNetworkSwitch:()=>Ax,okxMobileEnabled:()=>sF,listWeb3EVMWallets:()=>hF,isWeb3Detected:()=>Px,isGasAsset:()=>YF,isDetected:()=>Hx,initializeRPCUrlsWithFallback:()=>Y$,getWalletFormatFor:()=>v$,getTHORNameCost:()=>G$,getSymmetricWithdraw:()=>m$,getSymmetricPoolShare:()=>oF,getRPCUrl:()=>i,getMinAmountByChain:()=>w$,getMemoForWithdraw:()=>i$,getMemoForUnbond:()=>s$,getMemoForTcyStake:()=>xx,getMemoForTcyClaim:()=>$x,getMemoForRunePoolWithdraw:()=>a$,getMemoForRunePoolDeposit:()=>t$,getMemoForNameRegister:()=>e$,getMemoForNamePreferredAssetRegister:()=>Fx,getMemoForLeaveAndBond:()=>n$,getMemoForDeposit:()=>r$,getMAYANameCost:()=>B$,getLiquiditySlippage:()=>h$,getFeeMultiplierAsBigInt:()=>uF,getFeeMultiplier:()=>jF,getExplorerTxUrl:()=>y$,getExplorerAddressUrl:()=>u$,getEstimatedPoolShare:()=>o$,getETHDefaultWallet:()=>Gx,getEIP6963Wallets:()=>Bx,getDerivationPathFor:()=>f$,getDecimal:()=>ZF,getCommonAssetInfo:()=>n,getChainIdentifier:()=>Q$,getAsymmetricRuneWithdrawAmount:()=>C$,getAsymmetricRuneShare:()=>dF,getAsymmetricAssetWithdrawAmount:()=>d$,getAsymmetricAssetShare:()=>mF,getAssetType:()=>e,formatBigIntToSafeValue:()=>u,findAssetBy:()=>j$,filterSupportedChains:()=>Rx,derivationPathToString:()=>pF,assetFromString:()=>FF,applyFeeMultiplierToBigInt:()=>O$,applyFeeMultiplier:()=>D$,addEVMWalletNetwork:()=>nF,addAccountsChangedCallback:()=>_x,WarningCodeEnum:()=>IF,WalletOption:()=>c,UTXOChains:()=>h,SwapKitNumber:()=>S,SwapKitError:()=>M,SubstrateChains:()=>eF,StagenetChain:()=>HF,SKConfig:()=>w,RequestClient:()=>l,RPC_URLS:()=>_F,ProviderName:()=>wF,NetworkDerivationPath:()=>E,NODE_URLS:()=>o,MemoType:()=>QF,LedgerErrorCode:()=>DF,FeeTypeEnum:()=>KF,FeeOption:()=>TF,FALLBACK_URLS:()=>GF,ErrorCode:()=>UF,EXPLORER_URLS:()=>t,EVMChains:()=>D,DerivationPath:()=>b$,DEFAULT_FEE_MULTIPLIERS:()=>yF,CosmosChains:()=>AF,CosmosChainPrefixes:()=>F$,ContractAddress:()=>kF,CommonAssetStrings:()=>X$,ChainToHexChainId:()=>r,ChainToExplorerUrl:()=>x$,ChainToChainId:()=>BF,ChainIdToChain:()=>iF,ChainId:()=>s,Chain:()=>q,BlockTimes:()=>aF,BigIntArithmetics:()=>g,BaseDecimal:()=>X,AssetValue:()=>p,ApproveMode:()=>OF});module.exports=yx(L);j(L,require("@swapkit/tokens"),module.exports);var K$={};W(K$,{getMinAmountByChain:()=>w$,AssetValue:()=>p});var vF=require("ethers"),EF=require("ts-pattern");var q;((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"})(q||={});var HF;((x)=>{x.THORChain="THOR_STAGENET";x.Maya="MAYA_STAGENET"})(HF||={});var s;((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"})(s||={});var iF={["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"},Yx=Object.keys(q),RF=Object.values(q),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},aF={["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},eF=["DOT","FLIP"],D=["ARB","AURORA","AVAX","BASE","BERA","BSC","ETH","GNO","OP","POL"],h=["BTC","BCH","DASH","DOGE","LTC","ZEC"],AF=["GAIA","THOR","MAYA","KUJI","NOBLE"],F$={["GAIA"]:"cosmos",["THOR"]:"thor",["MAYA"]:"maya",["KUJI"]:"kujira",["NOBLE"]:"noble"},_F={["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.thorswap.net",["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"},GF={["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"]:[]},t={["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"},$$=RF.reduce((F,$)=>{let x=Yx.find((N)=>q[N]===$);if(x)F[$]=x;return F},{}),BF=RF.reduce((F,$)=>{return F[$]=s[$$[$]],F},{}),r=RF.reduce((F,$)=>{let x=`${$$[$]}Hex`;return F[$]=s[x],F},{}),x$=RF.reduce((F,$)=>{return F[$]=t[$],F},{});var W$={};W(W$,{isGasAsset:()=>YF,getDecimal:()=>ZF,getCommonAssetInfo:()=>n,getAssetType:()=>e,findAssetBy:()=>j$,assetFromString:()=>FF,CommonAssetStrings:()=>X$});var a=require("ts-pattern");var A$={};W(A$,{RequestClient:()=>l});var H$={};W(H$,{SKConfig:()=>w});var P$=require("zustand/vanilla");var N$={};W(N$,{WarningCodeEnum:()=>IF,WalletOption:()=>c,UTXOChains:()=>h,SubstrateChains:()=>eF,StagenetChain:()=>HF,RPC_URLS:()=>_F,ProviderName:()=>wF,NetworkDerivationPath:()=>E,NODE_URLS:()=>o,MemoType:()=>QF,LedgerErrorCode:()=>DF,FeeTypeEnum:()=>KF,FeeOption:()=>TF,FALLBACK_URLS:()=>GF,ErrorCode:()=>UF,EXPLORER_URLS:()=>t,EVMChains:()=>D,CosmosChains:()=>AF,CosmosChainPrefixes:()=>F$,ContractAddress:()=>kF,ChainToHexChainId:()=>r,ChainToExplorerUrl:()=>x$,ChainToChainId:()=>BF,ChainIdToChain:()=>iF,ChainId:()=>s,Chain:()=>q,BlockTimes:()=>aF,BaseDecimal:()=>X,ApproveMode:()=>OF});var kF;((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"})(kF||={});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 UF;((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"})(UF||={});var IF;((x)=>{x.highSlippage="highSlippage";x.highPriceImpact="highPriceImpact"})(IF||={});var wF;((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"})(wF||={});var KF;((_)=>{_.LIQUIDITY="liquidity";_.NETWORK="network";_.INBOUND="inbound";_.OUTBOUND="outbound";_.AFFILIATE="affiliate";_.TAX="tax";_.PRIORITY="priority"})(KF||={});var TF;((N)=>{N.Average="average";N.Fast="fast";N.Fastest="fastest"})(TF||={});var OF;((x)=>{x.Approve="approve";x.CheckOnly="checkOnly"})(OF||={});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 c;((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"})(c||={});var DF;((N)=>{N[N.NoError=36864]="NoError";N[N.LockedDevice=21781]="LockedDevice";N[N.TC_NotFound=65535]="TC_NotFound"})(DF||={});var Jx={apiKeys:{blockchair:"",keepKey:"",swapKit:"",walletConnectProjectId:"",xaman:""},apis:{},chains:Object.values(q),envs:{apiUrl:"https://api.swapkit.dev",devApiUrl:"https://dev-api.swapkit.dev",isDev:!1,isStagenet:!1},explorerUrls:t,fallbackRpcUrls:GF,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:_F,wallets:Object.values(c)},I=P$.createStore((F)=>({...Jx,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}}))})),w={get:(F)=>I.getState()[F],getState:I.getState,set:(F)=>I.getState().setConfig(F),setApiKey:(F,$)=>I.getState().setApiKey(F,$),setEnv:(F,$)=>I.getState().setEnv(F,$),setExplorerUrl:(F,$)=>I.getState().setExplorerUrl(F,$),setFallbackRpcUrls:(F,$)=>I.getState().setFallbackRpcUrls(F,$),setFeeMultipliers:(F)=>I.getState().setFeeMultipliers(F),setIntegrationConfig:(F,$)=>I.getState().setIntegrationConfig(F,$),setNodeUrl:(F,$)=>I.getState().setNodeUrl(F,$),setRequestOptions:(F)=>I.getState().setRequestOptions(F),setRpcUrl:(F,$)=>I.getState().setRpcUrl(F,$)};var R$={};W(R$,{SwapKitError:()=>M});var Mx={api_v2_invalid_method_key_hash:60003,api_v2_invalid_response:60001,api_v2_server_error:60002,chainflip_broker_fund_invalid_address:30107,chainflip_broker_fund_only_flip_supported:30106,chainflip_broker_invalid_params:30101,chainflip_broker_recipient_error:30102,chainflip_broker_register:30103,chainflip_broker_tx_error:30104,chainflip_broker_withdraw:30105,chainflip_channel_error:30001,chainflip_unknown_asset:30002,core_approve_asset_address_or_from_not_found:10004,core_approve_asset_target_invalid:10007,core_chain_halted:10010,core_estimated_max_spendable_chain_not_supported:10001,core_explorer_unsupported_chain:10008,core_extend_error:10002,core_inbound_data_not_found:10003,core_plugin_not_found:10005,core_plugin_swap_not_found:10006,core_swap_asset_not_recognized:10203,core_swap_contract_not_found:10204,core_swap_contract_not_supported:10206,core_swap_invalid_params:10201,core_swap_quote_mode_not_supported:10208,core_swap_route_not_complete:10202,core_swap_route_transaction_not_found:10205,core_swap_transaction_error:10207,core_transaction_add_liquidity_asset_error:10308,core_transaction_add_liquidity_base_address:10306,core_transaction_add_liquidity_base_error:10307,core_transaction_add_liquidity_invalid_params:10305,core_transaction_create_liquidity_asset_error:10303,core_transaction_create_liquidity_base_error:10302,core_transaction_create_liquidity_invalid_params:10304,core_transaction_deposit_error:10301,core_transaction_deposit_gas_error:10312,core_transaction_deposit_insufficient_funds_error:10311,core_transaction_deposit_server_error:10314,core_transaction_deposit_to_pool_error:10310,core_transaction_failed:10316,core_transaction_invalid_recipient_address:10317,core_transaction_invalid_sender_address:10313,core_transaction_user_rejected:10315,core_transaction_withdraw_error:10309,core_verify_message_not_supported:10009,core_wallet_connection_failed:10114,core_wallet_connection_not_found:10101,core_wallet_ctrl_not_installed:10102,core_wallet_evmwallet_not_installed:10103,core_wallet_keepkey_not_installed:10110,core_wallet_keplr_not_installed:10108,core_wallet_keystore_not_installed:10105,core_wallet_ledger_not_installed:10106,core_wallet_not_keypair_wallet:10112,core_wallet_okx_not_installed:10109,core_wallet_sign_message_not_supported:10113,core_wallet_talisman_not_installed:10111,core_wallet_trezor_not_installed:10107,core_wallet_walletconnect_not_installed:10104,helpers_chain_not_supported:70009,helpers_failed_to_switch_network:70007,helpers_invalid_asset_identifier:70005,helpers_invalid_asset_url:70004,helpers_invalid_identifier:70003,helpers_invalid_memo_type:70006,helpers_invalid_number_different_decimals:70001,helpers_invalid_number_of_years:70002,helpers_invalid_params:70010,helpers_invalid_response:70011,helpers_not_found_provider:70008,not_implemented:99999,plugin_near_invalid_name:41001,plugin_near_name_unavailable:41003,plugin_near_no_connection:41002,plugin_near_registration_failed:41004,plugin_near_transfer_failed:41005,thorchain_asset_is_not_tcy:40003,thorchain_chain_halted:40001,thorchain_preferred_asset_payout_required:40105,thorchain_swapin_memo_required:40103,thorchain_swapin_router_required:40101,thorchain_swapin_token_required:40104,thorchain_swapin_vault_required:40102,thorchain_trading_halted:40002,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:50213,toolbox_evm_no_signer_address:50212,toolbox_evm_no_to_address:50214,toolbox_evm_not_supported:50215,toolbox_evm_provider_not_eip1193_compatible:50216,toolbox_near_access_key_error:90605,toolbox_near_balance_failed:90608,toolbox_near_empty_batch:90607,toolbox_near_invalid_address:90602,toolbox_near_invalid_amount:90603,toolbox_near_invalid_gas_params:90612,toolbox_near_invalid_name:90609,toolbox_near_missing_contract_address:90610,toolbox_near_no_account:90611,toolbox_near_no_rpc_url:90606,toolbox_near_no_signer:90601,toolbox_near_transfer_failed:90604,toolbox_not_supported:59901,toolbox_radix_method_not_supported:50601,toolbox_ripple_asset_not_supported:50704,toolbox_ripple_broadcast_error:50705,toolbox_ripple_get_balance_error:50701,toolbox_ripple_rpc_not_configured:50702,toolbox_ripple_signer_not_found:50703,toolbox_solana_fee_estimation_failed:50402,toolbox_solana_no_signer:50401,toolbox_substrate_not_supported:50501,toolbox_tron_allowance_check_failed:50809,toolbox_tron_approve_failed:50807,toolbox_tron_fee_estimation_failed:50805,toolbox_tron_invalid_token_contract:50808,toolbox_tron_invalid_token_identifier:50802,toolbox_tron_no_signer:50801,toolbox_tron_token_transfer_failed:50803,toolbox_tron_transaction_creation_failed:50804,toolbox_tron_trongrid_api_error:50806,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,wallet_bitkeep_failed_to_switch_network:21002,wallet_bitkeep_no_accounts:21003,wallet_bitkeep_not_found:21001,wallet_chain_not_supported:20003,wallet_coinbase_chain_not_supported:21702,wallet_coinbase_method_not_supported:21703,wallet_coinbase_no_accounts:21704,wallet_coinbase_not_found:21701,wallet_connection_rejected_by_user:20001,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_not_found:21501,wallet_cosmostation_signer_not_found:21508,wallet_ctrl_asset_not_defined:20304,wallet_ctrl_contract_address_not_provided:20303,wallet_ctrl_not_found:20301,wallet_ctrl_send_transaction_no_address:20302,wallet_evm_extensions_failed_to_switch_network:21801,wallet_evm_extensions_no_provider:21802,wallet_evm_extensions_not_found:21803,wallet_exodus_chain_not_supported:21107,wallet_exodus_failed_to_switch_network:21106,wallet_exodus_instance_missing:21108,wallet_exodus_no_address:21103,wallet_exodus_not_found:21102,wallet_exodus_request_canceled:21104,wallet_exodus_sign_transaction_error:21101,wallet_exodus_signature_canceled:21105,wallet_failed_to_add_or_switch_network:20006,wallet_keepkey_account_not_found:20917,wallet_keepkey_asset_not_defined:20902,wallet_keepkey_chain_not_supported:20910,wallet_keepkey_config_not_found:20915,wallet_keepkey_contract_address_not_provided:20903,wallet_keepkey_derivation_path_error:20905,wallet_keepkey_invalid_params:20914,wallet_keepkey_invalid_response:20909,wallet_keepkey_method_not_supported:20913,wallet_keepkey_no_accounts:20912,wallet_keepkey_no_provider:20916,wallet_keepkey_not_found:20901,wallet_keepkey_send_transaction_no_address:20904,wallet_keepkey_signer_not_found:20911,wallet_keepkey_signing_error:20906,wallet_keepkey_transport_error:20907,wallet_keepkey_unsupported_chain:20908,wallet_keplr_chain_not_supported:21402,wallet_keplr_no_accounts:21404,wallet_keplr_not_found:21401,wallet_keplr_signer_not_found:21403,wallet_keystore_invalid_password:21901,wallet_keystore_unsupported_version:21902,wallet_ledger_address_not_found:20122,wallet_ledger_app_not_open:20110,wallet_ledger_chain_not_supported:20119,wallet_ledger_connection_claimed:20102,wallet_ledger_connection_error:20101,wallet_ledger_derivation_path_error:20108,wallet_ledger_device_locked:20105,wallet_ledger_device_not_found:20104,wallet_ledger_failed_to_get_address:20123,wallet_ledger_get_address_error:20103,wallet_ledger_invalid_account:20121,wallet_ledger_invalid_asset:20120,wallet_ledger_invalid_params:20113,wallet_ledger_invalid_response:20111,wallet_ledger_invalid_signature:20114,wallet_ledger_method_not_supported:20112,wallet_ledger_no_provider:20115,wallet_ledger_pubkey_not_found:20116,wallet_ledger_public_key_error:20107,wallet_ledger_signing_error:20109,wallet_ledger_transport_error:20106,wallet_ledger_transport_not_defined:20117,wallet_ledger_webusb_not_supported:20118,wallet_locked:20007,wallet_missing_api_key:20002,wallet_missing_params:20004,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_okx_chain_not_supported:21302,wallet_okx_failed_to_switch_network:21303,wallet_okx_no_accounts:21304,wallet_okx_not_found:21301,wallet_onekey_not_found:21201,wallet_onekey_sign_transaction_error:21202,wallet_phantom_not_found:20201,wallet_polkadot_not_found:20701,wallet_provider_not_found:20005,wallet_radix_invalid_manifest:20803,wallet_radix_method_not_supported:20804,wallet_radix_no_account:20805,wallet_radix_not_found:20801,wallet_radix_transaction_failed:20802,wallet_talisman_not_enabled:20601,wallet_talisman_not_found:20602,wallet_trezor_derivation_path_not_supported:20502,wallet_trezor_failed_to_get_address:20503,wallet_trezor_failed_to_sign_transaction:20501,wallet_trezor_method_not_supported:20505,wallet_trezor_transport_error:20504,wallet_vultisig_asset_not_defined:22103,wallet_vultisig_contract_address_not_provided:22102,wallet_vultisig_not_found:22101,wallet_vultisig_send_transaction_no_address:22104,wallet_walletconnect_chain_not_supported:20404,wallet_walletconnect_connection_not_established:20402,wallet_walletconnect_invalid_method:20405,wallet_walletconnect_method_not_supported:20406,wallet_walletconnect_namespace_not_supported:20403,wallet_walletconnect_project_id_not_specified:20401,wallet_xaman_auth_failed:23003,wallet_xaman_connection_failed:23004,wallet_xaman_monitoring_failed:23006,wallet_xaman_not_configured:23001,wallet_xaman_not_connected:23002,wallet_xaman_transaction_failed:23005,wallet_xdefi_chain_not_supported:21602,wallet_xdefi_not_found:21601};class M extends Error{static ErrorCode=Mx;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 Xx=(F)=>new Promise(($)=>setTimeout($,F)),Lx=(F,{baseDelay:$,backoffMultiplier:x,maxDelay:N})=>Math.min($*x**F,N),jx=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 zF(F,$={}){return async function x(N,P={}){let{searchParams:R,json:A,body:_,headers:B,dynamicHeader:Q,retry:Y,timeoutMs:Z,abortController:f,onError:V,onSuccess:k,responseHandler:b,...K}={...$,...P},O=w.get("requestOptions"),v={...O.retry,...Y},J=!!A||N.endsWith(".json"),Qx=qx(N,R),zx=Wx(J,{...B,...Q?.()}),Zx=J?JSON.stringify(A):_,VF;for(let PF=0;PF<=v.maxRetries;PF++){let tF=f||new AbortController,rF=setTimeout(()=>tF.abort(),Z||O.timeoutMs);try{let C=await jx(Qx,{...K,body:Zx,headers:zx,method:F,signal:tF.signal});return clearTimeout(rF),k?.(C)||b?.(C)||C}catch(C){if(clearTimeout(rF),VF=C,PF>=v.maxRetries)return V?V(C):Promise.reject(C);await Xx(Lx(PF,v))}}return V?V(VF):Promise.reject(VF)}}function Wx(F,$){return{...$,...F&&{"Content-Type":"application/json"}}}function qx(F,$){let x=new URL(F);if($)x.search=new URLSearchParams($).toString();return x.toString()}var l={extend:(F)=>({extend:($)=>l.extend({...F,...$}),get:zF("GET",F),post:zF("POST",F)}),get:zF("GET"),post:zF("POST")};var J$={};W(J$,{initializeRPCUrlsWithFallback:()=>Y$,getRPCUrl:()=>i});var gF=require("ts-pattern");var z$={};W(z$,{wrapWithThrow:()=>T$,warnOnce:()=>y,getTHORNameCost:()=>G$,getMAYANameCost:()=>B$,getChainIdentifier:()=>Q$});function G$(F){if(F<0)throw new M({errorKey:"helpers_invalid_number_of_years",info:{numberOfYears:F}});return 10+F}function B$(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 T$(F,$){try{return F()}catch(x){if($)throw new M($,x);return}}function Q$(F){switch(F){case"THOR":return`${F}.RUNE`;case"GAIA":return`${F}.ATOM`;case"BSC":return`${F}`;default:return`${F}.${F}`}}var _$=new Set;function y({condition:F,id:$,warning:x}){if(F){if(_$.has($))return;console.warn(x),_$.add($)}}function Vx(F){return gF.match(F).with(...D,()=>({id:1,jsonrpc:"2.0",method:"eth_blockNumber",params:[]})).with(...h,()=>({id:"test",jsonrpc:"1.0",method:"getblockchaininfo",params:[]})).with(...AF,"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 kx(F){return gF.match(F).with("XRD",()=>"/status/network-configuration").with("TRON",()=>"/wallet/getnowblock").otherwise(()=>"")}async function Z$(F,$){try{let x=$.startsWith("wss")?$.replace("wss","https"):$;return(await fetch(`${x}${kx(F)}`,{body:JSON.stringify(Vx(F)),headers:{"Content-Type":"application/json"},method:"POST",signal:AbortSignal.timeout(3000)})).ok}catch{return!1}}var SF=new Map,Ux=120000;async function i(F){let{isStagenet:$}=w.get("envs"),x=w.get("rpcUrls"),N=w.get("fallbackRpcUrls");if($)return x[F];let P=SF.get(F);if(P&&Date.now()-P.timestamp<Ux)return P.url;let R=x[F];if(!await Z$(F,R)){for(let _ of N[F])if(await Z$(F,_))return SF.set(F,{timestamp:Date.now(),url:_}),_}return SF.set(F,{timestamp:Date.now(),url:R}),R}function Y$(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 X$=[`${"MAYA"}.MAYA`,`${"MAYA"}.CACAO`,`${"ETH"}.THOR`,`${"ETH"}.vTHOR`,`${"KUJI"}.USK`,`${"ETH"}.FLIP`,`${"XRD"}.XRD`],L$=["ARB","AURORA","BASE","ETH","OP"];async function Ix({chain:F,to:$}){try{let N=await i(F),{result:P}=await l.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 wx(F){if(F==="XRD")return X.XRD;try{let $=F.split("-")[1]?.toLowerCase(),x=await i("XRD"),{manager:N}=await l.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 Kx({chain:F,symbol:$}){if(D.includes($))return X[$];let x=$.split("-"),N=x.length===1?void 0:x[x.length-1]?.toLowerCase();return await(N?.startsWith("0x")?Ix({chain:F,to:N}):X[F])}function ZF({chain:F,symbol:$}){return a.match(F).with(...D,(x)=>Kx({chain:x,symbol:$})).with("XRD",()=>wx($)).otherwise(()=>X[F])}function YF({chain:F,symbol:$}){return a.match(F).with(...L$,()=>$==="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}.${$}`===n(F).identifier).otherwise(()=>$===F)}var n=(F)=>{let $=X[F];return a.match(F.toUpperCase()).with(...L$,(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(...h,"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 e({chain:F,symbol:$}){if($.includes("/"))return"Synth";if($.includes("~"))return"Trade";return a.match(F).with("XRD",()=>$==="XRD"||`${F}.${$}`===n(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 FF=(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 j$(F){let{loadTokenLists:$}=await import("./tokens.cjs"),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 k$={};W(k$,{validateTNS:()=>V$,validateIdentifier:()=>JF});var q$=["TERRA",...w.get("chains")];function JF(F=""){let $=F.toUpperCase(),[x]=$.split(".");if(q$.includes(x))return!0;let[N]=$.split("/");if(q$.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 V$(F){if(F.length>30)return!1;let $=/^[a-zA-Z0-9+_-]+$/g;return!!F.match($)}var I$={};W(I$,{formatBigIntToSafeValue:()=>u,BigIntArithmetics:()=>g});var xF=8,d=(F)=>10n**BigInt(F),$F=(F)=>Math.log10(Number.parseFloat(F.toString()));function u({value:F,bigIntDecimal:$=xF,decimal:x=xF}){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 Ox(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")*d(x)/d($),x)}constructor(F){let $=fF(F),x=typeof F==="object";this.decimal=x?F.decimal:void 0,this.decimalMultiplier=x&&"decimalMultiplier"in F?F.decimalMultiplier:d(Math.max(U$(MF($)),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||$F(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/d($||this.decimal||X.THOR),N=Ox(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=fF(F),N=MF(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||xF,N=Math.max(x,$F(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,$F(this.decimalMultiplier)),P=d(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:d(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 $=MF(F)||"0";this.bigIntValue=this.#N($)}#x(...F){let $=F.map((x)=>{return typeof x==="object"?x.decimal||$F(x.decimalMultiplier):U$(MF(x))}).filter(Boolean);return Math.max(...$,xF)}#N(F,$){let x=$?d($):this.decimalMultiplier,N=$F(x),[P="",R=""]=F.split(".");return BigInt(`${P}${R.padEnd(N,"0")}`)}}var Dx=Intl.NumberFormat("fullwide",{maximumFractionDigits:20,useGrouping:!1});function MF(F){let x=`${typeof F==="number"?Dx.format(F):fF(F)}`.replaceAll(",",".").split(".");return x.length>1?`${x.slice(0,-1).join("")}.${x.at(-1)}`:x[0]||"0"}function U$(F){let $=F.split(".")[1]?.length||0;return Math.max($,xF)}function fF(F){return typeof F==="object"?"getValue"in F?F.getValue("string"):F.value:F}var XF=["SOL","TRON"],m=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=e(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=BF[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 m.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=vx(N),{identifier:A,decimal:_}=n(R),{chain:B,isSynthetic:Q,isTradeAsset:Y}=bF(A),Z=m.get(XF.includes(B)?A:A.toUpperCase()),f=Z?.decimal||_;y({condition:!(x||f),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).
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
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:b}=Z||{decimal:f||X[B],identifier:A},K=Q||Y,O=$?LF(BigInt(P),$):LF(P,V);return x?Sx(k,$?O:P):K?gx(k,O):new p({decimal:V,identifier:k,tax:b,value:O})}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 _=XF.includes(R)?P:P.toUpperCase(),B="decimals"in A?A.decimals:X[R];m.set(_,{decimal:B,identifier:P})}return!0}static setStaticAssets(F){m.clear();for(let[$,x]of F.entries()){let N=XF.includes(x.chain)?x.identifier:x.identifier.toUpperCase(),P="decimals"in x?x.decimals:x.decimal;m.set($,{...x,decimal:P,identifier:N})}return!0}}function w$(F){let $=p.from({chain:F});return EF.match(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 Sx(F,$=0){JF(F);let N=F.includes("SOL.")?F:F.toUpperCase(),P=m.get(N),R=P?.decimal||await ZF(bF(F));if(!P)m.set(N,{decimal:R,identifier:F});return new p({decimal:R,identifier:F,value:LF($,R)})}function gx(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:LF($,8)})}function LF(F,$){return typeof F==="bigint"?u({bigIntDecimal:$,decimal:$,value:F}):F}function fx(F){let $=EF.match(F).when((x)=>("chain"in x)&&x.chain!==void 0,({chain:x})=>x).otherwise((x)=>{let N=FF(x.asset);return N.synth?"THOR":N.chain});if(!Object.values(q).includes($.toUpperCase()))throw new M({errorKey:"helpers_invalid_asset_identifier",info:{message:"Please use the AssetValue constructor for unsupported chains"}})}function vx(F){if(fx(F),"chain"in F)return F.chain;let{chain:$,symbol:x}=FF(F.asset);return e({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,...f]=(F.includes(".")&&!_?F:`${N}.${Y}`).split("."),V=_?Y:f.join("."),{address:k,ticker:b}=bx({chain:Z,symbol:V}),K;try{K=k&&D.includes(Z)&&vF.getAddress(k)?vF.getAddress(k):k}catch(v){K=k}let O=(_?`${Q}${B}`:"")+(K?`${b}-${K??""}`:V);return{address:K,chain:Z,isGasAsset:YF({chain:Z,symbol:V}),isSynthetic:R,isSynthOrTrade:_,isTradeAsset:A,symbol:O,ticker:b}}function bx({symbol:F,chain:$}){let x=F.split("-"),N=x.length===1?void 0:x[x.length-1],P=XF.includes($)?N:N?.toLowerCase(),R=x.length===1?x[0]:x.slice(0,-1).join("-");return{address:P,ticker:R}}var S$={};W(S$,{getFeeMultiplierAsBigInt:()=>uF,getFeeMultiplier:()=>jF,applyFeeMultiplierToBigInt:()=>O$,applyFeeMultiplier:()=>D$,DEFAULT_FEE_MULTIPLIERS:()=>yF});var yF={average:1,fast:1.5,fastest:2};function jF(F="average"){let $=w.get("feeMultipliers");if($&&$[F]!==void 0)return $[F];return yF[F]}function uF(F="average"){let $=jF(F),x=10n,N=BigInt(Math.round($*10));return{denominator:x,numerator:N}}function O$(F,$="average"){let{numerator:x,denominator:N}=uF($);return F*x/N}function D$(F,$="average",x=!1){let N=jF($),P=F*N;return x?Math.floor(P):P}var g$={};W(g$,{SwapKitNumber:()=>S});class S extends g{eq(F){return this.eqValue(F)}static fromBigInt(F,$){return new S({decimal:$,value:u({bigIntDecimal:$,decimal:$,value:F})})}}var E$={};W(E$,{updateDerivationPath:()=>NF,getWalletFormatFor:()=>v$,getDerivationPathFor:()=>f$,derivationPathToString:()=>pF,DerivationPath:()=>b$});function NF(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 pF([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 f$({chain:F,index:$,addressIndex:x=0,type:N}){if(D.includes(F)){if(N&&["legacy","account"].includes(N))return[44,60,0,$];if(N==="ledgerLive")return[44,60,$,0,x];return NF(E[F],{index:$})}if(F==="SOL"){if(N==="account")return[44,501,0,$];return NF(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 NF(E[F],{index:$})}}function v$(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 b$=Object.keys(E).reduce((F,$)=>{return F[$]=pF(E[$]),F},{});var p$={};W(p$,{getExplorerTxUrl:()=>y$,getExplorerAddressUrl:()=>u$});var z=require("@swapkit/helpers"),CF=require("ts-pattern");function y$({chain:F,txHash:$}){let x=z.ChainToExplorerUrl[F];return CF.match(F).with(z.Chain.Maya,z.Chain.Kujira,z.Chain.Noble,z.Chain.Cosmos,z.Chain.THORChain,z.Chain.Solana,()=>`${x}/tx/${$.startsWith("0x")?$.slice(2):$}`).with(z.Chain.Arbitrum,z.Chain.Aurora,z.Chain.Avalanche,z.Chain.BinanceSmartChain,z.Chain.Base,z.Chain.Berachain,z.Chain.Ethereum,z.Chain.Gnosis,z.Chain.Optimism,z.Chain.Polkadot,z.Chain.Polygon,()=>`${x}/tx/${$.startsWith("0x")?$:`0x${$}`}`).with(z.Chain.Litecoin,z.Chain.Bitcoin,z.Chain.BitcoinCash,z.Chain.Dogecoin,z.Chain.Zcash,z.Chain.Radix,()=>`${x}/transaction/${$.toLowerCase()}`).with(z.Chain.Near,()=>`${x}/txns/${$}`).with(z.Chain.Ripple,()=>`${x}/transactions/${$}`).with(z.Chain.Tron,()=>`${x}/#/transaction/${$}`).otherwise(()=>"")}function u$({chain:F,address:$}){let x=z.ChainToExplorerUrl[F];return CF.match(F).with(z.Chain.Solana,z.Chain.Radix,()=>`${x}/account/${$}`).with(z.Chain.Tron,()=>`${x}/#/address/${$}`).otherwise(()=>`${x}/address/${$}`)}var c$={};W(c$,{getSymmetricWithdraw:()=>m$,getSymmetricPoolShare:()=>oF,getLiquiditySlippage:()=>h$,getEstimatedPoolShare:()=>o$,getAsymmetricRuneWithdrawAmount:()=>C$,getAsymmetricRuneShare:()=>dF,getAsymmetricAssetWithdrawAmount:()=>d$,getAsymmetricAssetShare:()=>mF});function dF({liquidityUnits:F,poolUnits:$,runeDepth:x}){let N=U(F),P=U($),R=U(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 mF({liquidityUnits:F,poolUnits:$,assetDepth:x}){let N=U(F),P=U($),R=U(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 C$({percent:F,runeDepth:$,liquidityUnits:x,poolUnits:N}){return dF({liquidityUnits:x,poolUnits:N,runeDepth:$}).mul(F)}function d$({percent:F,assetDepth:$,liquidityUnits:x,poolUnits:N}){return mF({assetDepth:$,liquidityUnits:x,poolUnits:N}).mul(F)}function U(F){return S.fromBigInt(BigInt(F),X.THOR)}function oF({liquidityUnits:F,poolUnits:$,runeDepth:x,assetDepth:N}){return{assetAmount:U(N).mul(F).div($),runeAmount:U(x).mul(F).div($)}}function m$({liquidityUnits:F,poolUnits:$,runeDepth:x,assetDepth:N,percent:P}){return Object.fromEntries(Object.entries(oF({assetDepth:N,liquidityUnits:F,poolUnits:$,runeDepth:x})).map(([R,A])=>[R,A.mul(P)]))}function o$({runeDepth:F,poolUnits:$,assetDepth:x,liquidityUnits:N,runeAmount:P,assetAmount:R}){let A=new S({decimal:8,value:F}),_=new S({decimal:8,value:x}),B=new S({decimal:8,value:$}),Q=new S({decimal:8,value:P}),Y=new S({decimal:8,value:R}),Z=Q.mul(_),f=Y.mul(A),V=Q.mul(Y),k=A.mul(_),b=B.mul(Z.add(f.add(V.mul(2)))),K=Z.add(f.add(k.mul(2))),O=b.div(K),v=U(N).add(O);if(O.getBaseValue("number")===0)return v.div(B).getBaseValue("number");let J=B.add(v);return v.div(J).getBaseValue("number")}function h$({runeAmount:F,assetAmount:$,runeDepth:x,assetDepth:N}){if(F==="0"||$==="0"||x==="0"||N==="0")return 0;let P=U(x),R=U(N),A=U($),_=U(F),B=A.mul(P).sub(R.mul(_)),Q=R.mul(_).add(P.mul(R));return Math.abs(B.div(Q).getBaseValue("number"))}var Nx={};W(Nx,{getMemoForWithdraw:()=>i$,getMemoForUnbond:()=>s$,getMemoForTcyStake:()=>xx,getMemoForTcyClaim:()=>$x,getMemoForRunePoolWithdraw:()=>a$,getMemoForRunePoolDeposit:()=>t$,getMemoForNameRegister:()=>e$,getMemoForNamePreferredAssetRegister:()=>Fx,getMemoForLeaveAndBond:()=>n$,getMemoForDeposit:()=>r$});var l$=require("ts-pattern");function n$({type:F,address:$}){return`${F}:${$}`}function s$({address:F,unbondAmount:$}){return`${"UNBOND"}:${F}:${$}`}function t$(F){return WF("POOL+",F)}function r$({chain:F,symbol:$,address:x,...N}){let P=Ex({chain:F,symbol:$}),R=x?`:${x}:`:":";return WF(`${"+"}:${P}${R}`,N)}function i$({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 a$({basisPoints:F,...$}){return WF(`${"POOL-"}:${F}`,$)}function e$({name:F,chain:$,address:x,owner:N}){let P=`${"~"}:${F}:${$}:${x}`,R=N?`:${N}`:"";return`${P}${R}`}function Fx({name:F,chain:$,asset:x,payout:N,owner:P}){return`${"~"}:${F}:${$}:${N}:${P}:${x}`}function $x(F,{address:$}){return`${F}:${$}`}function xx(F,{unstakeBps:$,...x}){let N=$?`:${$}`:"",P=`${F}${N}`;return WF(`${P}`,x)}function WF(F,{affiliateAddress:$,affiliateBasisPoints:x}={}){let N=`${F}${$?`:${$}:${x||0}`:""}`;return N.endsWith(":")?N.slice(0,-1):N}function Ex({chain:F,symbol:$}){return l$.match(F).with("BTC","DOGE","LTC",()=>F.slice(0,1).toLowerCase()).with("BCH",()=>"c").otherwise(()=>`${F}.${$}`)}var Tx={};W(Tx,{wrapMethodWithNetworkSwitch:()=>lF,switchEVMWalletNetwork:()=>cF,providerRequest:()=>qF,prepareNetworkSwitch:()=>Ax,okxMobileEnabled:()=>sF,listWeb3EVMWallets:()=>hF,isWeb3Detected:()=>Px,isDetected:()=>Hx,getETHDefaultWallet:()=>Gx,getEIP6963Wallets:()=>Bx,filterSupportedChains:()=>Rx,addEVMWalletNetwork:()=>nF,addAccountsChangedCallback:()=>_x});function Px(){return typeof window.ethereum!=="undefined"}function Hx(F){return hF().includes(F)}function hF(){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(sF())B.push("OKX_MOBILE");if(A)B.push("BITGET");if(_)B.push("ONEKEY");return B}async function cF(F,$,x){try{await qF({method:"wallet_switchEthereumChain",params:[{chainId:r[$]}],provider:F})}catch(N){if(!x)throw new M("helpers_failed_to_switch_network",{error:N,reason:"networkParams not provided"});await nF(F,x)}}function Rx({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 lF(F,$,x){return async(...N)=>{if((await $.getNetwork()).chainId.toString()===r[x])return F(...N);try{await cF($,x)}catch(P){throw new M({errorKey:"helpers_failed_to_switch_network",info:{error:P}})}return F(...N)}}function Ax({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=lF(B,x,$);return{...A,[_]:Q}},{});return{...F,...R}}function nF(F,$){return qF({method:"wallet_addEthereumChain",params:[$],provider:F})}function _x(F){window.ethereum?.on("accountsChanged",()=>F()),window.xfi?.ethereum.on("accountsChanged",()=>F())}function Gx(){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 Bx(){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 sF(){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 qF({provider:F,params:$,method:x}){if(!F?.send)throw new M("helpers_not_found_provider");let N=$?Array.isArray($)?$:[$]:[];return F.send(x,N)}
5
5
 
6
- //# debugId=9063E798CF50E69064756E2164756E21
6
+ //# debugId=267D72DCC5021ECB64756E2164756E21
7
7
  //# sourceMappingURL=index.cjs.map