@swapkit/helpers 4.14.1 → 4.15.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @swapkit/helpers
2
2
 
3
+ ## 4.15.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#288](https://github.com/swapkit/sdk/pull/288) [`3172029`](https://github.com/swapkit/sdk/commit/3172029e6349e82b128719a640604ef89e4645ab) Thanks [@ice-chillios](https://github.com/ice-chillios)! - Add Linea (`59144`) and Plasma (`9745`) EVM chains: chain/chainId enums, chain configs, and EVM toolbox wiring. (via @swapkit/types@0.9.0)
8
+
9
+ ## 4.15.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#278](https://github.com/swapkit/sdk/pull/278) [`02cec19`](https://github.com/swapkit/sdk/commit/02cec190fa5688a75be4ec00d9fdf33f871a7962) Thanks [@towanTG](https://github.com/towanTG)! - Add `localMode` to SKConfig for routing quote and swap requests to locally running API services. When enabled, quote requests go to `http://localhost:3000` and swap requests to `http://localhost:3001` by default (both configurable via `quoteUrl`/`swapUrl`), while all other endpoints keep using the configured `apiUrl`.
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies []:
18
+ - @swapkit/tokens@4.3.1
19
+
3
20
  ## 4.14.1
4
21
 
5
22
  ### Patch Changes
@@ -0,0 +1,4 @@
1
+ var{defineProperty:FN,getOwnPropertyNames:YA,getOwnPropertyDescriptor:FT}=Object,ZN=Object.prototype.hasOwnProperty;function WN(A){return this[A]}var MN=(A,T,H)=>{var P=YA(T);for(let L of P)if(!ZN.call(A,L)&&L!=="default")FN(A,L,{get:WN.bind(T,L),enumerable:!0});if(H){for(let L of P)if(!ZN.call(H,L)&&L!=="default")FN(H,L,{get:WN.bind(T,L),enumerable:!0});return H}};var SA=(A)=>{var T=(DA??=new WeakMap).get(A),H;if(T)return T;if(T=FN({},"__esModule",{value:!0}),A&&typeof A==="object"||typeof A==="function"){for(var P of YA(A))if(!ZN.call(T,P))FN(T,P,{get:WN.bind(A,P),enumerable:!(H=FT(A,P))||H.enumerable})}return DA.set(A,T),T},DA;var uT=(A)=>A;function IT(A,T){this[A]=uT.bind(null,T)}var Q=(A,T)=>{for(var H in T)FN(A,H,{get:T[H],enumerable:!0,configurable:!0,set:IT.bind(T,H)})};var nT=(A,T)=>()=>(A&&(T=A(A=0)),T);var r={};module.exports=SA(r);var UA=nT(()=>{MN(r,require("@swapkit/tokens"),module.exports)});var cP={};Q(cP,{TxnType:()=>hN,TxnStatus:()=>cN,TronTransactionSchema:()=>TA,TransactionSchema:()=>aH,TransactionDTOSchema:()=>NP,TrackingStatus:()=>lN,TrackingRequestSchema:()=>mH,TrackingRequestQuerySchema:()=>yH,TrackerResponseSchema:()=>NA,TokenSchema:()=>KH,TokenDetailsMetadataSchema:()=>oH,TONTransactionSchema:()=>PA,SwapToResponseSchema:()=>MP,SwapToRequestSchema:()=>GP,SwapToAssetSchema:()=>TT,SwapRouteV2ResponseSchema:()=>OA,SwapKitApi:()=>dP,StarknetTransactionSchema:()=>rA,RouteQuoteWarningSchema:()=>FA,RouteQuoteTxType:()=>ON,RouteQuoteProviderErrorSchema:()=>HT,RouteQuoteMetadataV2Schema:()=>RA,RouteQuoteMetadataSchema:()=>LA,RouteQuoteMetadataAssetSchema:()=>sA,RouteLegWithoutAddressesSchema:()=>RP,RouteLegSchema:()=>iA,QuoteV3ResponseSchema:()=>$P,QuoteV2ResponseSchema:()=>_P,QuoteRouteV2Response:()=>BA,QuoteResponseSchema:()=>uA,QuoteResponseRouteItem:()=>aA,QuoteRequestSchema:()=>fH,ProviderAction:()=>dN,PriorityLabel:()=>CN,PriceResponseSchema:()=>iN,PriceRequestSchema:()=>CH,NearSwapResponseSchema:()=>aN,NearDepositChannelResultSchema:()=>hH,NearDepositChannelParamsSchema:()=>fN,GasSchema:()=>IA,GasResponseSchema:()=>nA,FeesSchema:()=>QN,EstimatedTimeSchema:()=>wN,EVMTransactionSchema:()=>AA,EVMTransactionDetailsSchema:()=>AP,EVMTransactionDetailsParamsSchema:()=>lA,DepositChannelResponseSchema:()=>eN,DepositChannelParamsSchema:()=>sN,CosmosTransactionSchema:()=>HA,CoinGeckoMetadataSchema:()=>rN,ChainflipMetadataSchema:()=>eA,BrokerDepositChannelParamsSchema:()=>cA,AssetValueSchema:()=>d,ApproveResponseSchema:()=>nP,ApproveRequestParams:()=>IP,ApprovalTransactionSchema:()=>NT,ApiV2ErrorSchema:()=>pH});module.exports=SA(cP);var h=require("@swapkit/types");var FH={};Q(FH,{getMinAmountByChain:()=>NH,AssetValue:()=>z});var G=require("@swapkit/types"),mN=require("ethers"),bN=require("ts-pattern");var CT={};Q(CT,{parseSymbolForAddress:()=>e,isGasAsset:()=>qN,getTokenLogoURI:()=>oT,getCommonAssetInfo:()=>uN,getAssetType:()=>tN,findAssetBy:()=>fT,fetchTokenInfo:()=>vN,assetFromString:()=>K,CommonAssetStrings:()=>VT});var I=require("@swapkit/types"),s=require("ts-pattern");var ET={};Q(ET,{RequestClient:()=>O});var MT={};Q(MT,{swapKitConfigStore:()=>w,SKConfig:()=>Y});var X=require("@swapkit/types"),bA=require("zustand/vanilla");var OT={};Q(OT,{WarningCodeEnum:()=>gN,WalletOption:()=>YN,ProviderName:()=>b,NetworkDerivationPath:()=>BT,MemoType:()=>EA,LedgerErrorCode:()=>xA,FeeTypeEnum:()=>DN,FeeOption:()=>XA,ErrorCode:()=>i,ApproveMode:()=>tA});var _N=require("@swapkit/types"),BT=_N.AllChains.reduce((A,T)=>{return A[T]=_N.getChainConfig(T).networkDerivationPath,A},{});var i;((F)=>{F.unknownError="unknownError";F.test_error="test_error";F.providerDetailsError="providerDetailsError";F.blockHeaderNotFound="blockHeaderNotFound";F.blockHashNotFoundAtHeight="blockHashNotFoundAtHeight";F.blockHashNotFoundAtHash="blockHashNotFoundAtHash";F.txHashMissing="txHashMissing";F.assetValueMissingInfo="assetValueMissingInfo";F.invalidAsset="invalidAsset";F.blockIsRequired="blockIsRequired";F.currentBlockHeaderNotFound="currentBlockHeaderNotFound";F.failedToRetrieveBalance="failedToRetrieveBalance";F.failedToRetrieveBlock="failedToRetrieveBlock";F.failedToRetrieveFees="failedToRetrieveFees";F.notImplementedBCH="notImplementedBCH";F.notImplementedDoge="notImplementedDoge";F.noPoolsFound="noPoolsFound";F.noVaultsFound="noVaultsFound";F.noTxFound="noTxFound";F.noInputCoinFound="noInputCoinFound";F.noBlockDataFound="noBlockDataFound";F.multipleCosmosMessages="multipleCosmosMessages";F.heightOrHashNotProvided="heightOrHashNotProvided";F.unknownDenom="unknownDenom";F.invalidBlockHeight="invalidBlockHeight";F.timestampExtrinsicNoArgumentsForBlock="timestampExtrinsicNoArgumentsForBlock";F.timestampExtrinsicNoTimestampForBlock="timestampExtrinsicNoTimestampForBlock";F.noTimestampExtrinsicForHash="noTimestampExtrinsicForHash";F.timestampExtrinsicNoArgumentsForHash="timestampExtrinsicNoArgumentsForHash";F.txMemoUndefined="txMemoUndefined";F.txMemoIncorrect="txMemoIncorrect";F.txTypeNotFound="txTypeNotFound";F.txNoMessage="txNoMessage";F.txNotFound="txNotFound";F.txReceiptNotFound="txReceiptNotFound";F.txParsingError="txParsingError";F.txLogsParsingError="txLogsParsingError";F.blockNotFound="blockNotFound";F.balanceNotFound="balanceNotFound";F.configError="configError";F.synthSwapDisallowed="synthSwapDisallowed";F.providerQuoteTimeout="providerQuoteTimeout";F.noQuoteResponse="noQuoteResponse";F.noPoolAssetsFound="noPoolAssetsFound";F.noThorchainPools="noThorchainPools";F.noMayachainPools="noMayachainPools";F.noThorchainNetworkInfo="noThorchainNetworkInfo";F.invalidAffiliateFee="invalidAffiliateFee";F.invalidBuyAssetAddress="invalidBuyAssetAddress";F.invalidSellAssetAddress="invalidSellAssetAddress";F.invalidSourceAddress="invalidSourceAddress";F.invalidDestinationAddress="invalidDestinationAddress";F.sourceAddressIsSmartContract="sourceAddressIsSmartContract";F.destinationAddressIsSmartContract="destinationAddressIsSmartContract";F.invalidChainId="invalidChainId";F.unsupportedChainId="unsupportedChainId";F.unsupportedEVMChainId="unsupportedEVMChainId";F.unsupportedMethod="unsupportedMethod";F.unsupportedProvider="unsupportedProvider";F.invalidParamsForMethod="invalidParamsForMethod";F.unsupportedAdapter="unsupportedAdapter";F.noWhitelistTokens="noWhitelistTokens";F.failedFetchGasPrice="failedFetchGasPrice";F.failedToCreateDepositChannel="failedToCreateDepositChannel";F.noProviderDetailsFound="noProviderDetailsFound";F.noTokenListsFound="noTokenListsFound";F.tokenNotFound="tokenNotFound";F.tokenPriceNotFound="tokenPriceNotFound";F.tokenPriceFailedToUpdate="tokenPriceFailedToUpdate";F.swapAmountTooSmall="swapAmountTooSmall";F.legsArrayIsEmpty="legsArrayIsEmpty";F.failedToFetchQuoteForLeg="failedToFetchQuoteForLeg";F.noBlockHeaderFound="noBlockHeaderFound";F.failedToSimulateSwap="failedToSimulateSwap";F.addressScreeningFailed="addressScreeningFailed";F.noLiquidtyProvidersFound="noLiquidtyProvidersFound";F.insufficientLiquidity="insufficientLiquidity";F.noInboundDataFound="noInbounDataFound";F.noInboundAddressesFound="noInboundAddressesFound";F.noInboundAddressFoundForChain="noInboundAddressFoundForChain";F.noLastBlocksFound="noLastBlocksFound";F.noVersionFound="noVersionFound";F.noConstantsFound="noConstantsFound";F.noMimirsFound="noMimirsFound";F.noRoutesFound="noRoutesFound";F.quoteNotFound="quoteNotFound";F.ledgerSignFailed="ledgerSignFailed";F.ledgerWrongPayload="ledgerWrongPayload";F.ledgerFetchSwapFailed="ledgerFetchSwapFailed";F.failedToFetchTx="failedToFetchTx";F.failedBuildTransactionDetails="failedBuildTransactionDetails";F.noLegsForRoute="noLegsForRoute";F.noRouterAddressFound="noRouterAddressFound";F.noAggregatorAddressFound="noAggregatorAddressFound";F.noContractInstanceFound="noContractInstanceFound";F.noContractAddressFound="noContractAddressFound";F.invalidAffiliate="invalidAffiliate";F.thornameAffiliate="thornameAffiliate";F.providerNotfound="No provider found";F.noRecordFound="No Record found";F.slippageTooLow="Slippage too low";F.tradingHalted="tradingHalted";F.noWrappedGasAsset="noWrappedGasAsset";F.aggregatorAddressNotFound="aggregatorAddressNotFound";F.routerAddressNotFound="routerAddressNotFound";F.dummyAddressNotFound="dummyAddressNotFound";F.trackerError="trackerError";F.thorchainPoolUnavailable="thorchainPoolUnavailable";F.noOhlcvDataFound="noOhlcvDataFound";F.noTradingPairs="noTradingPairs";F.noLendingAvailability="noLendingAvailability";F.lendingRepayTooSmall="lendingRepayTooSmall";F.missingState="missingState";F.ledgerSwapNotFound="ledgerSwapNotFound";F.ledgerSwapNotReadyForTracking="ledgerSwapNotReadyForTracking";F.errorEstimatingGas="errorEstimatingGas";F.apiKeyInvalid="apiKeyInvalid";F.apiKeyFailedToUpdate="apiKeyFailedToUpdate";F.apiKeyExpired="apiKeyExpired";F.unauthorized="unauthorized";F.failedToCreateMemo="failedToCreateMemo";F.radixIncorrectInstructions="radixIncorrectInstructions";F.radixTxMissedParam="radixTxMissedParam";F.radixTxMissedAccount="radixTxMissedAccount";F.radixManifestParseError="radixManifestParseError";F.radixManifestBuildError="radixManifestBuildError";F.invalidAddressForChain="invalidAddressForChain";F.riskyAddress="riskyAddress";F.noRoutesToProcess="noRoutesToProcess";F.sellAssetAmountTooSmall="sellAssetAmountTooSmall";F.missingPrivateKey="missingPrivateKey";F.noMemoPriceProtection="noMemoPriceProtection"})(i||={});var gN;((H)=>{H.highSlippage="highSlippage";H.highPriceImpact="highPriceImpact"})(gN||={});var b;((U)=>{U.CHAINFLIP="CHAINFLIP";U.CHAINFLIP_STREAMING="CHAINFLIP_STREAMING";U.JUPITER="JUPITER";U.MAYACHAIN="MAYACHAIN";U.MAYACHAIN_STREAMING="MAYACHAIN_STREAMING";U.ONEINCH="ONEINCH";U.PANCAKESWAP="PANCAKESWAP";U.SUSHISWAP_V2="SUSHISWAP_V2";U.THORCHAIN="THORCHAIN";U.THORCHAIN_STREAMING="THORCHAIN_STREAMING";U.TRADERJOE_V2="TRADERJOE_V2";U.UNISWAP_V2="UNISWAP_V2";U.UNISWAP_V3="UNISWAP_V3";U.NEAR="NEAR";U.GARDEN="GARDEN";U.OKX="OKX";U.HARBOR="HARBOR";U.FLASHNET="FLASHNET";U.MAYAN="MAYAN"})(b||={});var DN;((B)=>{B.LIQUIDITY="liquidity";B.NETWORK="network";B.INBOUND="inbound";B.OUTBOUND="outbound";B.AFFILIATE="affiliate";B.TAX="tax";B.PRIORITY="priority";B.SERVICE="service"})(DN||={});var XA;((P)=>{P.Average="average";P.Fast="fast";P.Fastest="fastest"})(XA||={});var tA;((H)=>{H.Approve="approve";H.CheckOnly="checkOnly"})(tA||={});var EA;((M)=>{M.NAME_REGISTER="~";M.BOND="BOND";M.DEPOSIT="+";M.LEAVE="LEAVE";M.UNBOND="UNBOND";M.WITHDRAW="-";M.RUNEPOOL_DEPOSIT="POOL+";M.RUNEPOOL_WITHDRAW="POOL-";M.CLAIM_TCY="tcy";M.STAKE_TCY="tcy+";M.UNSTAKE_TCY="tcy-"})(EA||={});var YN;((_)=>{_.BITGET="BITGET";_.BRAVE="BRAVE";_.COINBASE_MOBILE="COINBASE_MOBILE";_.COINBASE_WEB="COINBASE_WEB";_.COSMOSTATION="COSMOSTATION";_.CTRL="CTRL";_.EIP6963="EIP6963";_.EXODUS="EXODUS";_.KEEPKEY="KEEPKEY";_.KEEPKEY_BEX="KEEPKEY_BEX";_.KEPLR="KEPLR";_.KEYSTORE="KEYSTORE";_.LEAP="LEAP";_.LEDGER="LEDGER";_.METAMASK="METAMASK";_.OKX="OKX";_.OKX_MOBILE="OKX_MOBILE";_.ONEKEY="ONEKEY";_.PASSKEYS="PASSKEYS";_.PASSKEY_WALLET="PASSKEY_WALLET";_.PETRA="PETRA";_.PHANTOM="PHANTOM";_.POLKADOT_JS="POLKADOT_JS";_.RADIX_WALLET="RADIX_WALLET";_.TALISMAN="TALISMAN";_.TREZOR="TREZOR";_.TRONLINK="TRONLINK";_.TRUSTWALLET_WEB="TRUSTWALLET_WEB";_.VULTISIG="VULTISIG";_.WALLETCONNECT="WALLETCONNECT";_.WALLET_SELECTOR="WALLET_SELECTOR";_.XAMAN="XAMAN"})(YN||={});var xA;((P)=>{P[P.NoError=36864]="NoError";P[P.LockedDevice=21781]="LockedDevice";P[P.TC_NotFound=65535]="TC_NotFound"})(xA||={});var $T=X.AllChains.reduce((A,T)=>{if(!A.THOR_STAGENET)A[X.StagenetChain.Maya]=X.StagenetMAYAConfig.rpcUrls,A[X.StagenetChain.THORChain]=X.StagenetTHORConfig.rpcUrls;return A[T]=X.getChainConfig(T).rpcUrls,A},{}),GT={[X.Chain.THORChain]:X.THORConfig.nodeUrl,[X.Chain.Maya]:X.MAYAConfig.nodeUrl,[X.StagenetChain.THORChain]:X.StagenetTHORConfig.nodeUrl,[X.StagenetChain.Maya]:X.StagenetMAYAConfig.nodeUrl},QA={apiKeys:{blockchair:"",keepKey:"",passkeys:"",swapKit:"",walletConnectProjectId:"",xaman:""},chains:X.AllChains,endpoints:{},envs:{apiUrl:"https://api.swapkit.dev",devApiUrl:"https://dev-api.swapkit.dev",isDev:!1,isStagenet:!1},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"}}},localMode:{enabled:!1,quoteUrl:"http://localhost:3000",swapUrl:"http://localhost:3001"},requestOptions:{retry:{backoffMultiplier:2,baseDelay:300,maxDelay:5000,maxRetries:3},timeoutMs:30000},rpcUrls:$T,thornodeUrls:GT,v3SwapFlow:{enabled:typeof process<"u"&&process.env?.SWAPKIT_V3_SWAP_FLOW==="true"},wallets:Object.values(YN),widgetId:"",widgetKey:""},w=bA.createStore((A)=>({...QA,setApiKey:(T,H)=>A((P)=>({apiKeys:{...P.apiKeys,[T]:H}})),setConfig:(T)=>A((H)=>({apiKeys:{...H.apiKeys,...T?.apiKeys},chains:H.chains.concat(T?.chains||[]),endpoints:{...H.endpoints,...T?.endpoints},envs:{...H.envs,...T?.envs},feeMultipliers:T?.feeMultipliers||H.feeMultipliers,integrations:{...H.integrations,...T?.integrations},localMode:{...H.localMode,...T?.localMode},rpcUrls:{...H.rpcUrls,...T?.rpcUrls},thornodeUrls:{...H.thornodeUrls,...T?.thornodeUrls},v3SwapFlow:{...H.v3SwapFlow,...T?.v3SwapFlow},wallets:H.wallets.concat(T?.wallets||[]),widgetId:T?.widgetId||H.widgetId,widgetKey:T?.widgetKey||H.widgetKey})),setEndpoint:(T,H)=>A((P)=>({endpoints:{...P.endpoints,[T]:H}})),setEnv:(T,H)=>A((P)=>({envs:{...P.envs,[T]:H}})),setFeeMultipliers:(T)=>A(()=>({feeMultipliers:T})),setIntegrationConfig:(T,H)=>A((P)=>({integrations:{...P.integrations,[T]:H}})),setRequestOptions:(T)=>A((H)=>({requestOptions:{retry:{...H.requestOptions.retry,...T.retry},timeoutMs:T.timeoutMs||H.requestOptions.timeoutMs}})),setRpcUrl:(T,H)=>A((P)=>({rpcUrls:{...P.rpcUrls,[T]:H}})),setThornodeUrl:(T,H)=>A((P)=>({thornodeUrls:{...P.thornodeUrls,[T]:H}})),setWidgetId:(T)=>A({widgetId:T}),setWidgetKey:(T)=>A({widgetKey:T})})),Y={get:(A)=>w.getState()[A],getState:w.getState,reinitialize:()=>w.setState(QA),set:(A)=>w.getState().setConfig(A),setApiKey:(A,T)=>w.getState().setApiKey(A,T),setEndpoint:(A,T)=>w.getState().setEndpoint(A,T),setEnv:(A,T)=>w.getState().setEnv(A,T),setFeeMultipliers:(A)=>w.getState().setFeeMultipliers(A),setIntegrationConfig:(A,T)=>w.getState().setIntegrationConfig(A,T),setRequestOptions:(A)=>w.getState().setRequestOptions(A),setRpcUrl:(A,T)=>w.getState().setRpcUrl(A,T),setThornodeUrl:(A,T)=>w.getState().setThornodeUrl(A,T),setWidgetId:(A)=>w.getState().setWidgetId(A),setWidgetKey:(A)=>w.getState().setWidgetKey(A)};var gT={};Q(gT,{SwapKitError:()=>$});var _T={core_estimated_max_spendable_chain_not_supported:10001,core_extend_error:10002,core_inbound_data_not_found:10003,core_approve_asset_address_or_from_not_found:10004,core_plugin_not_found:10005,core_plugin_swap_not_found:10006,core_approve_asset_target_invalid:10007,core_explorer_unsupported_chain:10008,core_verify_message_not_supported:10009,core_chain_halted:10010,core_wallet_connection_not_found:10101,core_wallet_ctrl_not_installed:10102,core_wallet_evmwallet_not_installed:10103,core_wallet_walletconnect_not_installed:10104,core_wallet_keystore_not_installed:10105,core_wallet_ledger_not_installed:10106,core_wallet_trezor_not_installed:10107,core_wallet_keplr_not_installed:10108,core_wallet_okx_not_installed:10109,core_wallet_keepkey_not_installed:10110,core_wallet_talisman_not_installed:10111,core_wallet_not_keypair_wallet:10112,core_wallet_sign_message_not_supported:10113,core_wallet_connection_failed:10114,core_wallet_create_not_supported:10115,core_wallet_sign_typed_data_not_supported:10116,core_swap_invalid_params:10201,core_swap_route_not_complete:10202,core_swap_asset_not_recognized:10203,core_swap_contract_not_found:10204,core_swap_route_transaction_not_found:10205,core_swap_contract_not_supported:10206,core_swap_transaction_error:10207,core_swap_quote_mode_not_supported:10208,core_transaction_deposit_error:10301,core_transaction_create_liquidity_base_error:10302,core_transaction_create_liquidity_asset_error:10303,core_transaction_create_liquidity_invalid_params:10304,core_transaction_add_liquidity_invalid_params:10305,core_transaction_add_liquidity_base_address:10306,core_transaction_add_liquidity_base_error:10307,core_transaction_add_liquidity_asset_error:10308,core_transaction_withdraw_error:10309,core_transaction_deposit_to_pool_error:10310,core_transaction_deposit_insufficient_funds_error:10311,core_transaction_deposit_gas_error:10312,core_transaction_invalid_sender_address:10313,core_transaction_deposit_server_error:10314,core_transaction_user_rejected:10315,core_transaction_failed:10316,core_transaction_invalid_recipient_address:10317,wallet_connection_rejected_by_user:20001,wallet_missing_api_key:20002,wallet_chain_not_supported:20003,wallet_missing_params:20004,wallet_provider_not_found:20005,wallet_failed_to_add_or_switch_network:20006,wallet_ledger_connection_error:20101,wallet_ledger_connection_claimed:20102,wallet_ledger_get_address_error:20103,wallet_ledger_device_not_found:20104,wallet_ledger_device_locked:20105,wallet_ledger_transport_error:20106,wallet_ledger_public_key_error:20107,wallet_ledger_derivation_path_error:20108,wallet_ledger_signing_error:20109,wallet_ledger_app_not_open:20110,wallet_ledger_invalid_response:20111,wallet_ledger_method_not_supported:20112,wallet_ledger_invalid_params:20113,wallet_ledger_invalid_signature:20114,wallet_ledger_no_provider:20115,wallet_ledger_pubkey_not_found:20116,wallet_ledger_transport_not_defined:20117,wallet_ledger_webusb_not_supported:20118,wallet_ledger_chain_not_supported:20119,wallet_ledger_invalid_asset:20120,wallet_ledger_invalid_account:20121,wallet_ledger_address_not_found:20122,wallet_ledger_failed_to_get_address:20123,wallet_ledger_webhid_not_supported:20124,wallet_phantom_not_found:20201,wallet_ctrl_not_found:20301,wallet_ctrl_send_transaction_no_address:20302,wallet_ctrl_contract_address_not_provided:20303,wallet_ctrl_asset_not_defined:20304,wallet_walletconnect_project_id_not_specified:20401,wallet_walletconnect_connection_not_established:20402,wallet_walletconnect_namespace_not_supported:20403,wallet_walletconnect_chain_not_supported:20404,wallet_walletconnect_invalid_method:20405,wallet_walletconnect_method_not_supported:20406,wallet_trezor_failed_to_sign_transaction:20501,wallet_trezor_derivation_path_not_supported:20502,wallet_trezor_failed_to_get_address:20503,wallet_trezor_transport_error:20504,wallet_trezor_method_not_supported:20505,wallet_trezor_failed_to_get_public_key:20506,wallet_talisman_not_enabled:20601,wallet_talisman_not_found:20602,wallet_polkadot_not_found:20701,wallet_radix_not_found:20801,wallet_radix_transaction_failed:20802,wallet_radix_invalid_manifest:20803,wallet_radix_method_not_supported:20804,wallet_radix_no_account:20805,wallet_keepkey_not_found:20901,wallet_keepkey_asset_not_defined:20902,wallet_keepkey_contract_address_not_provided:20903,wallet_keepkey_send_transaction_no_address:20904,wallet_keepkey_derivation_path_error:20905,wallet_keepkey_signing_error:20906,wallet_keepkey_transport_error:20907,wallet_keepkey_unsupported_chain:20908,wallet_keepkey_invalid_response:20909,wallet_keepkey_chain_not_supported:20910,wallet_keepkey_signer_not_found:20911,wallet_keepkey_no_accounts:20912,wallet_keepkey_method_not_supported:20913,wallet_keepkey_invalid_params:20914,wallet_keepkey_config_not_found:20915,wallet_keepkey_no_provider:20916,wallet_keepkey_account_not_found:20917,wallet_keepkey_failed_to_get_public_key:20918,wallet_bitkeep_not_found:21001,wallet_bitkeep_failed_to_switch_network:21002,wallet_bitkeep_no_accounts:21003,wallet_passkeys_sign_transaction_error:21101,wallet_passkeys_not_found:21102,wallet_passkeys_no_address:21103,wallet_passkeys_request_canceled:21104,wallet_passkeys_signature_canceled:21105,wallet_passkeys_failed_to_switch_network:21106,wallet_passkeys_chain_not_supported:21107,wallet_passkeys_instance_missing:21108,wallet_onekey_not_found:21201,wallet_onekey_sign_transaction_error:21202,wallet_okx_not_found:21301,wallet_okx_chain_not_supported:21302,wallet_okx_failed_to_switch_network:21303,wallet_okx_no_accounts:21304,wallet_keplr_not_found:21401,wallet_keplr_chain_not_supported:21402,wallet_keplr_signer_not_found:21403,wallet_keplr_no_accounts:21404,wallet_cosmostation_not_found:21501,wallet_cosmostation_chain_not_supported:21502,wallet_cosmostation_evm_provider_not_found:21503,wallet_cosmostation_keplr_provider_not_found:21504,wallet_cosmostation_no_accounts:21505,wallet_cosmostation_no_evm_accounts:21506,wallet_cosmostation_no_evm_address:21507,wallet_cosmostation_signer_not_found:21508,wallet_passkey_not_supported:21601,wallet_passkey_connection_failed:21602,wallet_coinbase_not_found:21701,wallet_coinbase_chain_not_supported:21702,wallet_coinbase_method_not_supported:21703,wallet_coinbase_no_accounts:21704,wallet_evm_extensions_failed_to_switch_network:21801,wallet_evm_extensions_no_provider:21802,wallet_evm_extensions_not_found:21803,wallet_keystore_invalid_password:21901,wallet_keystore_unsupported_version:21902,wallet_near_extensions_failed_to_switch_network:22001,wallet_near_extensions_no_provider:22002,wallet_near_extensions_not_found:22003,wallet_near_method_not_supported:22004,wallet_petra_not_found:22201,wallet_vultisig_not_found:22101,wallet_vultisig_contract_address_not_provided:22102,wallet_vultisig_asset_not_defined:22103,wallet_vultisig_send_transaction_no_address:22104,wallet_xaman_not_configured:23001,wallet_xaman_not_connected:23002,wallet_xaman_auth_failed:23003,wallet_xaman_connection_failed:23004,wallet_xaman_transaction_failed:23005,wallet_xaman_monitoring_failed:23006,wallet_tronlink_request_accounts_failed:24001,wallet_tronlink_locked:24002,chainflip_channel_error:30001,chainflip_unknown_asset:30002,chainflip_broker_invalid_params:30101,chainflip_broker_recipient_error:30102,chainflip_broker_register:30103,chainflip_broker_tx_error:30104,chainflip_broker_withdraw:30105,chainflip_broker_fund_only_flip_supported:30106,chainflip_broker_fund_invalid_address:30107,thorchain_chain_halted:40001,thorchain_trading_halted:40002,thorchain_asset_is_not_tcy:40003,thorchain_swapin_router_required:40101,thorchain_swapin_vault_required:40102,thorchain_swapin_memo_required:40103,thorchain_swapin_token_required:40104,thorchain_preferred_asset_payout_required:40105,toolbox_cosmos_account_not_found:50101,toolbox_cosmos_invalid_fee:50102,toolbox_cosmos_invalid_params:50103,toolbox_cosmos_no_signer:50104,toolbox_cosmos_not_supported:50105,toolbox_cosmos_signer_not_defined:50106,toolbox_cosmos_validate_address_prefix_not_found:50107,toolbox_cosmos_verify_signature_no_pubkey:50108,toolbox_evm_error_estimating_gas_limit:50201,toolbox_evm_error_sending_transaction:50202,toolbox_evm_gas_estimation_error:50203,toolbox_evm_invalid_gas_asset_address:50204,toolbox_evm_invalid_params:50205,toolbox_evm_invalid_transaction:50206,toolbox_evm_no_abi_fragment:50207,toolbox_evm_no_contract_address:50208,toolbox_evm_no_fee_data:50209,toolbox_evm_no_from_address:50210,toolbox_evm_no_gas_price:50211,toolbox_evm_no_signer_address:50212,toolbox_evm_no_signer:50213,toolbox_evm_no_to_address:50214,toolbox_evm_not_supported:50215,toolbox_evm_provider_not_eip1193_compatible:50216,toolbox_evm_invalid_eip7702_authorization:50217,toolbox_utxo_api_error:50301,toolbox_utxo_broadcast_failed:50302,toolbox_utxo_insufficient_balance:50303,toolbox_utxo_invalid_address:50304,toolbox_utxo_invalid_params:50305,toolbox_utxo_invalid_transaction:50306,toolbox_utxo_no_signer:50307,toolbox_utxo_not_supported:50308,toolbox_utxo_tx_not_found:50309,toolbox_utxo_rbf_not_supported:50310,toolbox_utxo_tx_not_replaceable:50311,toolbox_utxo_tx_already_confirmed:50312,toolbox_utxo_rbf_fee_too_low:50313,toolbox_utxo_rbf_insufficient_change:50314,toolbox_solana_no_signer:50401,toolbox_substrate_not_supported:50501,toolbox_substrate_transfer_error:50502,toolbox_radix_method_not_supported:50601,toolbox_ripple_get_balance_error:50701,toolbox_ripple_rpc_not_configured:50702,toolbox_ripple_signer_not_found:50703,toolbox_ripple_asset_not_supported:50704,toolbox_ripple_broadcast_error:50705,toolbox_ripple_get_trust_lines_error:50706,toolbox_ripple_invalid_trust_line_limit:50707,toolbox_tron_no_signer:50801,toolbox_tron_invalid_token_identifier:50802,toolbox_tron_token_transfer_failed:50803,toolbox_tron_transaction_creation_failed:50804,toolbox_tron_trongrid_api_error:50805,toolbox_tron_approve_failed:50806,toolbox_tron_invalid_token_contract:50807,toolbox_tron_allowance_check_failed:50808,toolbox_tron_invalid_transaction_integrity:50809,toolbox_tron_broadcast_failed:50810,toolbox_hypercore_no_signer:51001,toolbox_cardano_sign_transaction_failed:50901,toolbox_near_no_signer:90601,toolbox_near_invalid_address:90602,toolbox_near_invalid_amount:90603,toolbox_near_transfer_failed:90604,toolbox_near_access_key_error:90605,toolbox_near_no_rpc_url:90606,toolbox_near_empty_batch:90607,toolbox_near_balance_failed:90608,toolbox_near_invalid_name:90609,toolbox_near_missing_contract_address:90610,toolbox_near_no_account:90611,toolbox_near_invalid_gas_params:90612,toolbox_near_no_public_key_found:90613,toolbox_near_sign_transaction_failed:90614,toolbox_sui_address_required:90701,toolbox_sui_keypair_required:90702,toolbox_sui_balance_error:90703,toolbox_sui_transaction_creation_error:90704,toolbox_sui_signing_error:90705,toolbox_sui_broadcast_error:90706,toolbox_sui_no_signer:90707,toolbox_sui_no_sender:90708,toolbox_sui_missing_coin_type:90709,toolbox_sui_no_coins_found:90710,toolbox_sui_insufficient_balance:90711,toolbox_starknet_no_signer:90801,toolbox_starknet_invalid_address:90802,toolbox_starknet_fee_estimation_failed:90803,toolbox_starknet_account_not_deployed:90804,toolbox_starknet_transaction_failed:90805,toolbox_ton_no_signer:90901,toolbox_ton_invalid_address:90902,toolbox_ton_missing_jetton_address:90903,toolbox_ton_jetton_transfer_failed:90904,toolbox_ton_transaction_failed:90905,toolbox_aptos_address_required:91001,toolbox_aptos_keypair_required:91002,toolbox_aptos_balance_error:91003,toolbox_aptos_transaction_creation_error:91004,toolbox_aptos_signing_error:91005,toolbox_aptos_broadcast_error:91006,toolbox_aptos_no_signer:91007,toolbox_aptos_no_sender:91008,toolbox_aptos_missing_asset_type:91009,toolbox_aptos_insufficient_balance:91010,toolbox_stellar_no_signer:91101,toolbox_stellar_broadcast_error:91102,toolbox_stellar_invalid_address:91103,toolbox_stellar_account_not_found:91104,toolbox_stellar_transaction_failed:91105,toolbox_stellar_balance_error:91106,toolbox_not_supported:59901,toolbox_fee_estimation_failed:59902,plugin_near_invalid_name:41001,plugin_near_no_connection:41002,plugin_near_name_unavailable:41003,plugin_near_registration_failed:41004,plugin_near_transfer_failed:41005,plugin_garden_missing_data:42001,plugin_swapkit_swap_invalid_data:43001,plugin_swapkit_invalid_transaction:43002,api_v2_invalid_response:60001,api_v2_server_error:60002,api_v2_invalid_method_key_hash:60003,helpers_invalid_number_different_decimals:70001,helpers_invalid_number_of_years:70002,helpers_invalid_identifier:70003,helpers_invalid_asset_url:70004,helpers_invalid_asset_identifier:70005,helpers_invalid_memo_type:70006,helpers_failed_to_switch_network:70007,helpers_not_found_provider:70008,helpers_chain_not_supported:70009,helpers_invalid_params:70010,helpers_invalid_response:70011,helpers_chain_no_public_or_set_rpc_url:70012,helpers_chain_rpc_connection_failed:70013,mcp_wallet_not_configured:90001,not_implemented:99999};function jN(A){return JSON.stringify(A,(T,H)=>typeof H==="bigint"?H.toString():H)}class $ extends Error{static ErrorCode=_T;errorKey;info;constructor(A,T){let H=typeof A==="string",P=H?A:A.errorKey,L=H?void 0:A.info,R=`${P}${L?`: ${jN(L)}`:""}`;super(R);if(Object.setPrototypeOf(this,$.prototype),this.name="SwapKitError",this.errorKey=P,this.info=L,this.cause=T,T){let u=T instanceof Error?`${T.message}${T.cause?` (${T.cause})`:""}`:jN(T);console.error(`SwapKitError [${P}]: ${u}`)}else if(L)console.error(`SwapKitError [${P}]: ${jN(L)}`)}}var DT=(A)=>new Promise((T)=>setTimeout(T,A)),YT=(A,{baseDelay:T,backoffMultiplier:H,maxDelay:P})=>Math.min(T*H**A,P);function ST(A,T){if(A instanceof Error&&A.name==="AbortError")return!0;if(A instanceof TypeError)return!0;if(T===429)return!0;if(T&&T>=500&&T<600)return!0;return!1}var UT=async(A,T)=>{let H=await fetch(A,T),P;try{P=await H.json()}catch{if(!H.ok)throw new $({errorKey:"helpers_invalid_response",info:{status:H.status,statusText:H.statusText}},{status:H.status,statusText:H.statusText});return{}}if(!H.ok){let R={data:P?.data,error:P?.error,message:P?.message,status:H.status};throw new $({errorKey:P?.error||"helpers_invalid_response",info:R},R)}let L=P?.routes?.length||P?.result||P?.data&&!P?.error;if(P?.error&&!L){let R={data:P.data,error:P.error,message:P.message,status:H.status};throw new $({errorKey:P.error,info:R},R)}if(P?.providerErrors?.length||P?.error&&L)console.warn("[SwapKit] Partial errors in response:",P.providerErrors||P.error);return P};function SN(A,T={}){return async function(P,L={}){let{searchParams:R,json:u,body:n,headers:B,dynamicHeader:D,retry:t,timeoutMs:M,abortController:W,onError:S,onSuccess:V,responseHandler:E,...x}={...T,...L},LN=Y.get("requestOptions"),c={...LN.retry,...t},U=!!u||P.endsWith(".json"),$N=tT(P,R),MA=D?await D():{},RN=XT(U,{...B,...MA}),l=U?JSON.stringify(u):n,JN;for(let GN=0;GN<=c.maxRetries;GN++){let _A=W||new AbortController,gA=setTimeout(()=>_A.abort(),M||LN.timeoutMs);try{let q=await UT($N,{...x,body:l,headers:RN,method:A,signal:_A.signal});return clearTimeout(gA),V?.(q)||E?.(q)||q}catch(q){clearTimeout(gA),JN=q;let RT=q?.cause?.status;if(GN>=c.maxRetries||!ST(q,RT))return S?S(q):Promise.reject(q);await DT(YT(GN,c))}}return S?S(JN):Promise.reject(JN)}}function XT(A,T){return{...T,...A&&{"Content-Type":"application/json"}}}function tT(A,T){let H=new URL(A);if(T)H.search=new URLSearchParams(T).toString();return H.toString()}var O={extend:(A)=>({extend:(T)=>O.extend({...A,...T}),get:SN("GET",A),post:SN("POST",A)}),get:SN("GET"),post:SN("POST")};var jT={};Q(jT,{initializeRPCUrlsWithFallback:()=>WT,getRPCUrlSync:()=>ZA,getRPCUrl:()=>f,_rpcCache:()=>XN});var g=require("@swapkit/types"),VN=require("ts-pattern");var zT={};Q(zT,{wrapWithThrow:()=>QT,warnOnce:()=>o,getTHORNameCost:()=>xT,getMAYANameCost:()=>bT,getChainIdentifier:()=>wT});var UN=require("@swapkit/types");function xT(A){if(A<0)throw new $({errorKey:"helpers_invalid_number_of_years",info:{numberOfYears:A}});return 10+A}function bT(A){if(A<0)throw new $({errorKey:"helpers_invalid_number_of_years",info:{numberOfYears:A}});return Math.round((10+A*1.0512)*10000000000)/10000000000}function QT(A,T){try{return A()}catch(H){if(T)throw new $(T,H);return}}function wT(A){switch(A){case UN.Chain.THORChain:return`${A}.RUNE`;case UN.Chain.Cosmos:return`${A}.ATOM`;case UN.Chain.BinanceSmartChain:return`${A}`;default:return`${A}.${A}`}}var wA=new Set;function o({condition:A,id:T,warning:H}){if(A){if(wA.has(T))return;console.warn(H),wA.add(T)}}function JT(A){return VN.match(A).with(...g.EVMChains,()=>({id:1,jsonrpc:"2.0",method:"eth_blockNumber",params:[]})).with(...g.UTXOChains,()=>({id:"test",jsonrpc:"1.0",method:"getblockchaininfo",params:[]})).with(...g.CosmosChains,...g.StagenetChains,()=>({id:1,jsonrpc:"2.0",method:"status",params:{}})).with(g.Chain.Polkadot,g.Chain.Chainflip,()=>({id:1,jsonrpc:"2.0",method:"system_health",params:[]})).with(g.Chain.Solana,()=>({id:1,jsonrpc:"2.0",method:"getHealth"})).with(g.Chain.Sui,()=>({id:1,jsonrpc:"2.0",method:"sui_getSystemState",params:[]})).with(g.Chain.Ton,()=>({id:1,jsonrpc:"2.0",method:"getAddressInformation",params:{address:""}})).with(g.Chain.Aptos,g.Chain.Tron,g.Chain.Radix,g.Chain.Stellar,()=>"").with(g.Chain.Hype,()=>({type:"meta"})).with(g.Chain.Near,()=>({id:"dontcare",jsonrpc:"2.0",method:"status",params:[]})).with(g.Chain.Ripple,()=>({id:1,jsonrpc:"2.0",method:"ping",params:[{}]})).with(g.Chain.Starknet,()=>({id:1,jsonrpc:"2.0",method:"starknet_chainId",params:[]})).otherwise(()=>{throw new $("helpers_chain_not_supported",{chain:A})})}function zA(A){return VN.match(A).with(g.Chain.Aptos,()=>"/-/healthy").with(g.Chain.Hype,()=>"/info").with(g.Chain.Radix,()=>"/status/network-configuration").with(g.Chain.Stellar,()=>"").with(g.Chain.Tron,()=>"/wallet/getnowblock").otherwise(()=>"")}async function JA(A,T){try{let H=T.startsWith("wss")?T.replace("wss","https"):T;if(A===g.Chain.Stellar)return(await fetch(`${H}${zA(A)}`,{cache:"no-store",method:"GET",signal:AbortSignal.timeout(3000)})).ok;return(await fetch(`${H}${zA(A)}`,{body:JSON.stringify(JT(A)),cache:"no-store",headers:{"Content-Type":"application/json"},method:"POST",signal:AbortSignal.timeout(3000)})).ok}catch{return!1}}var XN=new Map,ZT=120000;function ZA(A){let[T=""]=Y.get("rpcUrls")[A];if(!T)throw o({condition:!0,id:"helpers_chain_no_public_or_set_rpc_url",warning:`No public or set RPC URL found for chain. Please ensure you configured rpcUrls for ${A}.`}),new $("helpers_chain_no_public_or_set_rpc_url",{chain:A});let H=XN.get(A);if(H&&Date.now()-H.timestamp<ZT)return H.url;return XN.set(A,{timestamp:Date.now(),url:T}),T}async function f(A){let T=ZA(A),[,...H]=Y.get("rpcUrls")[A];if(await JA(A,T))return T;for(let L of H)if(await JA(A,L))return XN.set(A,{timestamp:Date.now(),url:L}),L;throw new $("helpers_chain_rpc_connection_failed",{chain:A,fallbackUrls:H,primaryRpcUrl:T})}function WT(A){o({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 VT=[`${I.Chain.Maya}.MAYA`,`${I.Chain.Maya}.CACAO`,`${I.Chain.Ethereum}.THOR`,`${I.Chain.Ethereum}.vTHOR`,`${I.Chain.Kujira}.USK`,`${I.Chain.Ethereum}.FLIP`,`${I.Chain.Radix}.XRD`],VA=[I.Chain.Arbitrum,I.Chain.Aurora,I.Chain.Base,I.Chain.Ethereum,I.Chain.Optimism];async function vT(A){let{baseDecimal:T}=I.getChainConfig(I.Chain.Radix);try{let H=await f(I.Chain.Radix),{manager:P}=await O.post(`${H}/state/resource`,{body:JSON.stringify({network:"mainnet",resource_address:A}),headers:{Accept:"*/*","Content-Type":"application/json"}});return P?.divisibility?.value?.divisibility}catch(H){let P=H instanceof Error?H.message:String(H);return console.warn(`Failed to fetch Radix asset decimals for ${A}: ${P}`),T}}async function qT(A){try{let T=await f(I.Chain.Radix);return(await O.post(`${T}/state/entity/details`,{body:JSON.stringify({addresses:[A],opt_ins:{explicit_metadata:["symbol"]}}),headers:{Accept:"*/*","Content-Type":"application/json"}})).items[0]?.explicit_metadata?.items.find((L)=>L.key==="symbol")?.value.typed.value||void 0}catch(T){let H=T instanceof Error?T.message:String(T);return console.warn(`Failed to fetch Radix asset symbol for ${A}: ${H}`),""}}async function vA({chain:A,address:T,methodHex:H,id:P}){let L=await f(A);return O.post(L,{body:JSON.stringify({id:P,jsonrpc:"2.0",method:"eth_call",params:[{data:H,to:T.toLowerCase()},"latest"]}),headers:{accept:"*/*","cache-control":"no-cache","content-type":"application/json"}})}async function kT(A){if(!A||A==="0x")return"UNKNOWN";try{let{AbiCoder:T}=await import("ethers");return T.defaultAbiCoder().decode(["string"],A)[0].trim()}catch(T){return console.warn(`Failed to decode ABI string from ${A}: ${T}`),"UNKNOWN"}}function KT(A,T){if(!A||A==="0x")return T;try{return Number(A)}catch(H){return console.warn(`Failed to decode ABI uint8 from ${A}: ${H}`),T}}async function mT({chain:A,address:T}){let{baseDecimal:H}=I.getChainConfig(A),P=T.toLowerCase();if(T===""||!P.startsWith("0x"))return H;let L=await vA({address:T,chain:A,id:2,methodHex:"0x313ce567"}).catch((u)=>{return console.warn(`Could not fetch decimals for ${T} on ${A}: ${u.message}`),{result:""}});return KT(L.result,H)}async function yT({chain:A,address:T}){let H=T.toLowerCase();if(H===""||!H.startsWith("0x"))return;let P=await vA({address:T,chain:A,id:1,methodHex:"0x95d89b41"}).catch((R)=>{return console.warn(`Could not fetch symbol for ${T} on ${A}: ${R.message}`),{result:""}});return await kT(P.result)}async function WA({rpcUrl:A,contractAddress:T,functionSelector:H}){return(await O.post(`${A}/wallet/triggerconstantcontract`,{body:JSON.stringify({contract_address:T,function_selector:H,owner_address:T,parameter:"",visible:!0}),headers:{accept:"application/json","content-type":"application/json"}}).catch(()=>{return}))?.constant_result?.[0]}function jA(A){let T=A.match(/.{2}/g)?.map((H)=>Number.parseInt(H,16))??[];return new TextDecoder().decode(new Uint8Array(T))}function pT(A){return s.match(A).with(void 0,()=>{return}).when((T)=>T.length>=128,(T)=>{let H=Number.parseInt(T.slice(64,128),16);return jA(T.slice(128,128+H*2))}).when((T)=>T.length===64,(T)=>{let H=T.replace(/0+$/,"");if(H.length>0&&H.length%2===0)return jA(H);return}).otherwise(()=>{return})}function vN({chain:A,address:T}){let{baseDecimal:H}=I.getChainConfig(A),P={decimals:H,ticker:void 0};return s.match(A).with(...I.EVMChains,async()=>{try{let{isAddress:L,getAddress:R}=await import("ethers");if(!L(R(T.replace(/^0X/,"0x"))))return P;let[u,n]=await Promise.all([yT({address:T,chain:A}),mT({address:T,chain:A})]);return{decimals:n,ticker:u}}catch(L){return console.warn(`Failed to fetch token info for ${T} on ${A}: ${L?.code} ${L?.message}`),P}}).with(I.Chain.Solana,async()=>{if(!T)return P;try{let L=await fetch(`https://lite-api.jup.ag/tokens/v2/search?query=${T}`);if(L.ok){let R=await L.json(),u=Array.isArray(R)?R[0]:R;if(u)return{decimals:u.decimals??H,ticker:u.symbol||void 0}}}catch(L){console.warn(`Failed to fetch Solana token info for ${T}: ${L?.code} ${L?.message}`)}return P}).with(I.Chain.Tron,async()=>{if(!T)return P;try{let L=await f(I.Chain.Tron),[R,u]=await Promise.all([WA({contractAddress:T,functionSelector:"symbol()",rpcUrl:L}),WA({contractAddress:T,functionSelector:"decimals()",rpcUrl:L})]),n=pT(R);return{decimals:R!==void 0&&u?Number(BigInt(`0x${u}`)):H,ticker:n}}catch(L){let R=L instanceof Error?L.message:String(L);return console.warn(`Failed to fetch Tron token info for ${T}: ${R}`),P}}).with(I.Chain.Near,async()=>{if(!T)return P;try{let{JsonRpcProvider:L}=await import("@near-js/providers"),R=await f(I.Chain.Near),n=await new L({url:R}).query({account_id:T,args_base64:Buffer.from("{}").toString("base64"),finality:"final",method_name:"ft_metadata",request_type:"call_function"}),B=JSON.parse(Buffer.from(n.result).toString());return{decimals:B?.decimals||H,ticker:B?.symbol}}catch(L){let R=L instanceof Error?L.message:String(L);return console.warn(`Failed to fetch Near token info for ${T}: ${R}`),P}}).with(I.Chain.Radix,async()=>{if(!T)return P;try{let[L,R]=await Promise.all([qT(T),vT(T)]);return{decimals:R,ticker:L}}catch(L){let R=L instanceof Error?L.message:String(L);return console.warn(`Failed to fetch Radix token info for ${T}: ${R}`),P}}).otherwise(async()=>P)}function qN({chain:A,symbol:T}){return s.match(A).with(...VA,()=>T==="ETH").with(I.Chain.Avalanche,()=>T==="AVAX").with(I.Chain.Berachain,()=>T==="BERA").with(I.Chain.Hyperevm,()=>T==="HYPE").with(I.Chain.Hype,()=>T==="HYPE").with(I.Chain.Spark,()=>T==="BTC").with(I.Chain.BinanceSmartChain,()=>T==="BNB").with(I.Chain.Gnosis,()=>T==="xDAI"||T==="XDAI").with(I.Chain.Monad,()=>T==="MON").with(I.Chain.XLayer,()=>T==="OKB").with(I.Chain.Maya,()=>T==="CACAO").with(I.Chain.Cosmos,()=>T==="ATOM").with(I.Chain.THORChain,()=>T==="RUNE").with(I.Chain.Tron,()=>T==="TRX").with(I.Chain.Ripple,()=>T==="XRP").with(I.Chain.Radix,()=>`${A}.${T}`===uN(A).identifier).otherwise(()=>T===A)}var uN=(A)=>{let{baseDecimal:T}=I.getChainConfig(A);return s.match(A.toUpperCase()).with(...VA,(P)=>({decimal:T,identifier:`${P}.ETH`})).with(I.Chain.THORChain,(P)=>({decimal:T,identifier:`${P}.RUNE`})).with(I.Chain.Cosmos,(P)=>({decimal:T,identifier:`${P}.ATOM`})).with(I.Chain.Maya,(P)=>({decimal:10,identifier:`${P}.CACAO`})).with(I.Chain.BinanceSmartChain,(P)=>({decimal:T,identifier:`${P}.BNB`})).with(I.Chain.Monad,(P)=>({decimal:T,identifier:`${P}.MON`})).with(I.Chain.Avalanche,(P)=>({decimal:T,identifier:`${P}.AVAX`})).with(I.Chain.Gnosis,(P)=>({decimal:T,identifier:`${P}.xDAI`})).with(I.Chain.XLayer,(P)=>({decimal:T,identifier:`${P}.OKB`})).with(I.Chain.Berachain,(P)=>({decimal:T,identifier:`${P}.BERA`})).with(I.Chain.Hyperevm,(P)=>({decimal:T,identifier:`${P}.HYPE`})).with(I.Chain.Hype,(P)=>({decimal:T,identifier:`${P}.HYPE`})).with(I.Chain.Spark,(P)=>({decimal:T,identifier:`${P}.BTC`})).with(I.Chain.Tron,(P)=>({decimal:T,identifier:`${P}.TRX`})).with(I.Chain.Solana,I.Chain.Chainflip,I.Chain.Kujira,I.Chain.Ripple,I.Chain.Polkadot,I.Chain.Near,...I.UTXOChains,(P)=>({decimal:T,identifier:`${P}.${P}`})).with(I.Chain.Radix,"XRD.XRD",()=>({decimal:T,identifier:"XRD.XRD"})).with(I.Chain.Polygon,"POL.POL",()=>({decimal:T,identifier:"POL.POL"})).with("KUJI.USK",(P)=>({decimal:6,identifier:P})).with("ETH.FLIP",()=>({decimal:I.getChainConfig(I.Chain.Ethereum).baseDecimal,identifier:"ETH.FLIP-0x826180541412D574cf1336d22c0C0a287822678A"})).with("ETH.THOR",()=>({decimal:I.getChainConfig(I.Chain.Ethereum).baseDecimal,identifier:"ETH.THOR-0xa5f2211b9b8170f694421f2046281775e8468044"})).with("ETH.vTHOR",()=>({decimal:I.getChainConfig(I.Chain.Ethereum).baseDecimal,identifier:"ETH.vTHOR-0x815c23eca83261b6ec689b60cc4a58b54bc24d8d"})).with("MAYA.CACAO",(P)=>({decimal:10,identifier:P})).with("MAYA.MAYA",(P)=>({decimal:4,identifier:P})).otherwise(()=>({decimal:T,identifier:A}))};function tN({chain:A,symbol:T}){if(T.includes("/"))return"Synth";if(T.includes("~"))return"Trade";return s.match(A).with(I.Chain.Radix,()=>T===I.Chain.Radix||`${A}.${T}`===uN(A).identifier).with(I.Chain.Arbitrum,I.Chain.Optimism,I.Chain.Base,I.Chain.Aurora,()=>T===I.Chain.Ethereum).with(I.Chain.Cosmos,()=>T==="ATOM").with(I.Chain.BinanceSmartChain,()=>T==="BNB").with(I.Chain.Maya,()=>T==="CACAO").with(I.Chain.Monad,()=>T==="MON").with(I.Chain.THORChain,()=>T==="RUNE").with(I.Chain.Tron,()=>T==="TRX").with(I.Chain.Hyperevm,()=>T==="HYPE").with(I.Chain.Hype,()=>T==="HYPE").with(I.Chain.Spark,()=>T==="BTC").with(I.Chain.XLayer,()=>T==="OKB").otherwise(()=>T===A)?"Native":A}var K=(A)=>{let[T,...H]=A.split("."),P=A.includes("/"),L=H.join("."),R=L?.split("-"),u=R?.length?R.length===1?R[0]:R.slice(0,-1).join("-"):void 0;return{chain:T,symbol:L,synth:P,ticker:u}};function e(A,T){let P=T===I.Chain.Near?A.indexOf("-"):A.lastIndexOf("-");if(P===-1)return{address:void 0,ticker:A};return{address:A.slice(P+1),ticker:A.slice(0,P)}}function oT(A){return`https://storage.googleapis.com/token-list-swapkit-dev/images/${A.toLowerCase()}.png`}async function fT(A){let{loadTokenLists:T}=await Promise.resolve().then(() => (UA(),r)),H=await T(),P=Object.values(H).flatMap((R)=>R.tokens);if("identifier"in A)return P.find((R)=>R.identifier===A.identifier)?.identifier;let L=A.contract.toLowerCase();for(let R of P){let{chain:u,symbol:n}=K(R.identifier);if(u!==A.chain)continue;let{address:B}=e(n,u);if(B?.toLowerCase()===L)return R.identifier}return}var dT={};Q(dT,{validateTNS:()=>hT,validateIdentifier:()=>kN});var qA=["TERRA",...Y.get("chains")];function kN(A=""){let T=A.toUpperCase(),[H]=T.split(".");if(qA.includes(H))return!0;let[P]=T.split("/");if(qA.includes(P))return!0;throw new $({errorKey:"helpers_invalid_identifier",info:{identifier:A,message:`Invalid identifier: ${A}. Expected format: <Chain>.<Ticker> or <Chain>.<Ticker>-<ContractAddress>`}})}function hT(A){if(A.length>30)return!1;let T=/^[a-zA-Z0-9+_-]+$/g;return!!A.match(T)}var iT={};Q(iT,{formatBigIntToSafeValue:()=>m,BigIntArithmetics:()=>k});var nN=require("ts-pattern"),a=8,cT=10;function m({value:A,bigIntDecimal:T=a,decimal:H=a}){if(H===0)return A.toString();let P=A<0n,L=A.toString().substring(P?1:0),R=H-(L.length-1);if(R>0)L="0".repeat(R)+L;let u=L.length-H,n=L.slice(-H);if(Number.parseInt(n[T]||"0",10)>=5){let D=Number.parseInt(n[T-1]||"0",10);n=`${n.substring(0,T-1)}${D+1}`}else n=n.substring(0,T);return`${P?"-":""}${L.slice(0,u)}.${n}`.replace(/\.?0*$/,"")}class k{decimalMultiplier=10n**8n;bigIntValue=0n;decimal;static fromBigInt(A,T){return new k({decimal:T,value:m({bigIntDecimal:T,decimal:T,value:A})})}static shiftDecimals({value:A,from:T,to:H}){return k.fromBigInt(A.getBaseValue("bigint")*C(H)/C(T),H)}constructor(A){let T=KN(A),H=typeof A==="object";this.decimal=H?A.decimal:void 0,this.decimalMultiplier=H&&"decimalMultiplier"in A?A.decimalMultiplier:C(Math.max(kA(EN(T)),this.decimal||0)),this.#P(T)}set(A){return new this.constructor({decimal:this.decimal,identifier:this.toString?.({includeSynthProtocol:!0}),value:A})}add(...A){return this.#A("add",...A)}sub(...A){return this.#A("sub",...A)}mul(...A){return this.#A("mul",...A)}div(...A){return this.#A("div",...A)}gt(A){return this.#N("gt",A)}gte(A){return this.#N("gte",A)}lt(A){return this.#N("lt",A)}lte(A){return this.#N("lte",A)}eqValue(A){return this.#N("eqValue",A)}getValue(A,T){let H=IN(this.decimalMultiplier),P=T!==void 0?T:this.decimal,L=P!==void 0?P:H;if(P!==void 0&&P<H){if(this.formatBigIntToSafeValue(this.bigIntValue,P)==="0"&&this.bigIntValue!==0n)L=H}let R=this.formatBigIntToSafeValue(this.bigIntValue,L);return nN.match(A).with("number",()=>Number(R)).with("string",()=>R).with("bigint",()=>{return this.bigIntValue*10n**BigInt(this.decimal||8n)/this.decimalMultiplier}).otherwise(()=>R)}getBaseValue(A,T){let H=this.decimalMultiplier/C(T||this.decimal||a),P=rT(this.bigIntValue,H);return nN.match(A).with("number",()=>Number(P)).with("string",()=>P.toString()).otherwise(()=>P)}getBigIntValue(A,T){if(!T&&typeof A==="object")return A.bigIntValue;let H=KN(A),P=EN(H);if(P==="0"||P==="undefined")return 0n;return this.#H(P,T)}toSignificant(A=6){let T=this.getValue("string"),[H="",P=""]=T.split("."),L=Number.parseInt(H,10)>0;if((L?H.length+P.length:P.length)<=A)return T;if(H.length>=A)return H.slice(0,A).padEnd(H.length,"0");if(L)return`${H}.${P.slice(0,A-H.length)}`;let u=Number.parseInt(P,10).toString(),n=u.slice(0,A),B=P.length-u.length;return`0.${n.padStart(B+n.length,"0")}`}toFixed(A=6){let T=this.getValue("string"),H=T.startsWith("-"),[P="0",L=""]=(H?T.slice(1):T).split("."),R=P==="0"&&Number.parseInt(L.slice(0,A),10)===0,u=H&&!R?"-":"";if(A===0){if(P==="0"&&!L)return"0";return L&&Number.parseInt(L[0]||"0",10)>=5?`${u}${BigInt(P)+1n}.0`:`${u}${P}.0`}if(!L)return`${u}${P}.${"0".repeat(A)}`;let n=L[A];if(!(n&&Number.parseInt(n,10)>=5))return`${u}${P}.${L.slice(0,A).padEnd(A,"0")}`;let D=BigInt(L.slice(0,A).padEnd(A,"0"))+1n,t=10n**BigInt(A);if(D>=t)return`${u}${BigInt(P)+1n}.${"0".repeat(A)}`;return`${u}${P}.${D.toString().padStart(A,"0")}`}toAbbreviation(A=2){let T=this.getValue("string"),H=Number(T),P=["","K","M","B","T","Q","Qi","S"],L=Math.floor(Math.log10(Math.abs(H))/3);if(L===0||!P[L])return T;return`${(H/10**(L*3)).toFixed(A)}${P[L]}`}toCurrency(A="$",{currencyPosition:T="start",decimal:H=2,decimalSeparator:P=".",thousandSeparator:L=",",trimTrailingZeros:R=!0}={}){let u=this.toFixed(H),n=T==="end",[B="0",D=""]=u.split("."),t=B.replace(/\B(?=(\d{3})+(?!\d))/g,L),M=D&&Number.parseInt(D,10)>0,W=M?`${t}${P}${D}`:t,V=W.length<100&&R&&M?W.replace(/\.?0*$/,""):W;return n?`${V}${A}`:`${A}${V}`}formatBigIntToSafeValue(A,T){let H=T||this.decimal||a,P=Math.max(H,IN(this.decimalMultiplier));return m({bigIntDecimal:H,decimal:P,value:A})}#A(A,...T){let H=this.#T(this,...T),P=IN(this.decimalMultiplier),R=Math.max(H,P)+cT,u=C(R),n=T.reduce((D,t)=>{let M=this.getBigIntValue(t,R);return nN.match(A).with("add",()=>D+M).with("sub",()=>D-M).with("mul",()=>D*M/u).with("div",()=>{if(M===0n)throw RangeError("Division by zero");return D*u/M}).otherwise(()=>D)},this.bigIntValue*u/this.decimalMultiplier),B=m({bigIntDecimal:R,decimal:R,value:n});return new this.constructor({decimal:this.decimal,decimalMultiplier:C(R),identifier:this.toString(),value:B})}#N(A,...T){let H=this.#T(this,...T),P=this.getBigIntValue(T[0]||"0",H),L=this.getBigIntValue(this,H);return nN.match(A).with("gt",()=>L>P).with("gte",()=>L>=P).with("lt",()=>L<P).with("lte",()=>L<=P).with("eqValue",()=>L===P).otherwise(()=>!1)}#P(A){let T=EN(A)||"0";this.bigIntValue=this.#H(T)}#T(...A){let T=A.map((H)=>{return typeof H==="object"?H.decimal||IN(H.decimalMultiplier):kA(EN(H))}).filter(Boolean);return Math.max(...T,a)}#H(A,T){let H=T?C(T):this.decimalMultiplier,P=IN(H),[L="",R=""]=A.split(".");return BigInt(`${L}${R.padEnd(P,"0")}`)}}var lT=Intl.NumberFormat("fullwide",{maximumFractionDigits:20,useGrouping:!1});function EN(A){let H=`${typeof A==="number"?lT.format(A):KN(A)}`.replaceAll(",",".").split(".");return H.length>1?`${H.slice(0,-1).join("")}.${H.at(-1)}`:H[0]||"0"}function kA(A){let T=A.split(".")[1]?.length||0;return Math.max(T,a)}function KN(A){return typeof A==="object"?"getValue"in A?A.getValue("string"):A.value:A}function rT(A,T){if(T===0n)throw Error("Cannot divide by zero");let H=T/2n;return A>=0n&&T>=0n||A<0n&&T<0n?(A+H)/T:(A-H)/T}function C(A){return 10n**BigInt(A)}function IN(A){return Math.log10(Number.parseFloat(A.toString()))}var y=[G.Chain.Hype,G.Chain.Near,G.Chain.Ripple,G.Chain.Solana,G.Chain.Sui,G.Chain.Ton,G.Chain.Tron],pN=[G.Chain.THORChain,G.Chain.Maya],NN=new Map,xN=new Map,AN=new Map,sT=3600000;function eT(A){let T=AN.get(A);if(T?.timestamp&&Date.now()-T.timestamp>sT){AN.delete(A);return}return T}function aT(A,T){if(AN.size>1000){let H=AN.keys().next().value;if(H)AN.delete(H)}AN.set(A,{...T,timestamp:Date.now()})}class z extends k{address;chain;isGasAsset=!1;isSynthetic=!1;isTradeAsset=!1;symbol;tax;ticker;type;chainId;constructor({value:A,decimal:T,tax:H,chain:P,symbol:L,identifier:R}){super(typeof A==="object"?A:{decimal:T,value:A});let u=KA(R||`${P}.${L}`);this.type=tN(u),this.tax=H,this.chain=u.chain,this.ticker=u.ticker,this.symbol=u.symbol,this.address=u.address,this.isSynthetic=u.isSynthetic,this.isTradeAsset=u.isTradeAsset,this.isGasAsset=u.isGasAsset,this.chainId=G.getChainConfig(u.chain).chainId}toString({includeSynthProtocol:A}={}){return(this.isSynthetic||this.isTradeAsset)&&!A?this.symbol:`${this.chain}.${this.symbol}`}toUrl(){if(this.isSynthetic)return`${this.chain}.${this.symbol.replace(/\//g,".")}`;if(this.isTradeAsset)return`${this.chain}.${this.symbol.replace(/~/g,"..")}`;let A=this.symbol.replace(/\./g,"__");return`${this.chain}.${A}`}getIconUrl(){return NN.get(this.toString())?.logoURI}eqAsset({chain:A,symbol:T}){return this.chain===A&&this.symbol===T}eq(A){return this.eqAsset(A)&&this.eqValue(A)}static fromUrl(A,T=0){let H=A.indexOf(".");if(H===-1)throw new $({errorKey:"helpers_invalid_asset_url",info:{urlAsset:A}});let P=A.slice(0,H),L=A.slice(H+1),R=bN.match({chain:P,rest:L}).when(({rest:u})=>u.includes(".."),({chain:u,rest:n})=>`${u}.${n.replace(/\.\./g,"~")}`).when(({chain:u,rest:n})=>pN.includes(u)&&n.includes("."),({chain:u,rest:n})=>`${u}.${n.replace(/\./g,"/")}`).otherwise(({chain:u,rest:n})=>`${u}.${n.replace(/__/g,".")}`);return z.from({asset:R,value:T})}static from({value:A=0,fromBaseDecimal:T,asyncTokenLookup:H,...P}){let L=A instanceof k?A.getValue("string"):A,R="address"in P&&"chain"in P,u=PH(P);if(u===null&&H&&R){let{chain:RN,address:l}=P;return TH({address:l,chain:RN,fromBaseDecimal:T,parsedValue:L})}let n=R&&!u?`${P.chain}.UNKNOWN-${P.address}`:u,{identifier:B,decimal:D}=uN(n),{chain:t,isSynthetic:M,isTradeAsset:W,address:S}=KA(B),{baseDecimal:V}=G.getChainConfig(t),E=NN.get(y.includes(t)?B:B.toUpperCase());if(!E&&H&&!M&&!W)return(async()=>{let{ticker:RN}=K(B),l=await mA({address:S,chain:t,ticker:RN});return yN({decimal:l.decimals,identifier:l.identifier,value:T?TN(BigInt(L),T):L})})();let x=E?.decimal||D;o({condition:!x&&!H,id:`assetValue_static_decimal_not_found_${t}`,warning:`Couldn't find static decimal for one or more tokens on ${t} (Using default ${V} decimal as fallback).
2
+ This can result in incorrect calculations and mess with amount sent on transactions.
3
+ You can load static assets by installing @swapkit/tokens package and calling AssetValue.loadStaticAssets()
4
+ or by passing asyncTokenLookup: true to the from() function, which will make it async and return a promise.`});let{decimal:LN,identifier:c,tax:U}=E||{decimal:x||V,identifier:B},$N=T?TN(BigInt(L),T):TN(L,LN);return M||W?AH(c,$N):yN({decimal:LN,identifier:c,tax:U,value:$N})}static async loadStaticAssets(A){let{loadTokenLists:T}=await import("@swapkit/tokens"),H=await T(A);for(let{tokens:P}of Object.values(H))for(let L of P){let{identifier:R}=L,{chain:u,symbol:n}=K(R),{address:B}=e(n,u),{baseDecimal:D}=G.getChainConfig(u),t=y.includes(u)?R:R.toUpperCase(),M="decimals"in L&&L.decimals!==void 0?L.decimals:D,W="logoURI"in L&&L.logoURI?L.logoURI:`https://storage.googleapis.com/token-list-swapkit-dev/images/${R.toLowerCase()}.png`,S={decimal:M,identifier:R,logoURI:W,tax:"tax"in L?L.tax:void 0};if(NN.set(t,S),B){let V=y.includes(u)?`${u}:${B}`:`${u}:${B.toUpperCase()}`;xN.set(V,R)}}return!0}static setStaticAssets(A){NN.clear(),xN.clear();for(let[T,H]of A.entries()){let{identifier:P}=H,{chain:L,symbol:R}=K(P),{address:u}=e(R,L),{baseDecimal:n}=G.getChainConfig(L),B=H.chain??L,D=H.address??u,t=y.includes(B)?P:P.toUpperCase(),M=H.decimals??H.decimal??n,W=H.logoURI??`https://storage.googleapis.com/token-list-swapkit-dev/images/${P.toLowerCase()}.png`,S={decimal:M,identifier:t,logoURI:W,tax:H.tax};if(NN.set(t,S),D){let V=y.includes(B)?`${B}:${D}`:`${B}:${D.toUpperCase()}`;xN.set(V,P)}}return!0}static get staticAssets(){return NN}}function NH(A){let T=z.from({chain:A});return bN.match(A).with(G.Chain.Bitcoin,G.Chain.Litecoin,G.Chain.BitcoinCash,G.Chain.Dash,()=>T.set(0.00010001)).with(G.Chain.Dogecoin,()=>T.set(1.00000001)).with(G.Chain.Avalanche,G.Chain.Ethereum,G.Chain.Arbitrum,G.Chain.BinanceSmartChain,()=>T.set(0.00000001)).with(G.Chain.THORChain,G.Chain.Maya,()=>T.set(0)).with(G.Chain.Cosmos,G.Chain.Kujira,()=>T.set(0.000001)).otherwise(()=>T.set(0.00000001))}async function mA({chain:A,address:T,ticker:H}){let L=y.includes(A)?`${A}:${T||H}`:`${A}:${T||H}`.toUpperCase(),R=eT(L);if(R)return R;if(!T){let{baseDecimal:B}=G.getChainConfig(A);return{decimals:B,identifier:`${A}.${H||"UNKNOWN"}`}}let u=await vN({address:T,chain:A}),n=`${A}.${u.ticker||H||"UNKNOWN"}-${T}`;return o({condition:!!(!u.ticker&&H),id:`async_token_lookup_failed_${A}_${T}`,warning:`Could not fetch token metadata for ${A}:${T} from chain. Using user-provided ticker (${H}) with baseDecimal (${u.decimals}).`}),u.ticker&&aT(L,{decimals:u.decimals,identifier:n}),{decimals:u.decimals,identifier:n}}function yN({identifier:A,decimal:T,value:H,tax:P}){return kN(A),new z({decimal:T,identifier:A,tax:P,value:TN(H,T)})}function AH(A,T=0){let H=A.includes(".")?A.split(".")?.[0]?.toUpperCase():void 0,P=H?pN.includes(H):!1,L=A.slice(0,14).includes("~")?"~":"/",[R,u]=P?A.split(".").slice(1).join().split(L):A.split(L);if(!(R&&u))throw new $({errorKey:"helpers_invalid_asset_identifier",info:{identifier:A}});return new z({decimal:8,identifier:`${H||G.Chain.THORChain}.${R}${L}${u}`,value:TN(T,8)})}async function TH({address:A,chain:T,fromBaseDecimal:H,parsedValue:P}){let{decimals:L,identifier:R}=await mA({address:A,chain:T}),u=H?TN(BigInt(P),H):P;return yN({decimal:L,identifier:R,value:u})}function TN(A,T){return typeof A==="bigint"?m({bigIntDecimal:T,decimal:T,value:A}):A}function HH(A){let T=bN.match(A).when((H)=>("chain"in H)&&H.chain!==void 0,({chain:H})=>H).otherwise((H)=>{let P=K(H.asset);return P.synth?G.Chain.THORChain:P.chain});if(!G.AllChains.includes(T.toUpperCase())){let H="asset"in A?A.asset:T;throw new $({errorKey:"helpers_invalid_asset_identifier",info:{identifier:H,message:`Unsupported chain "${T}" - use the AssetValue constructor directly`}})}}function PH(A){if(HH(A),"chain"in A){let{chain:L,address:R}=A;if(R){let u=y.includes(L)?`${L}:${R}`:`${L}:${R.toUpperCase()}`,n=xN.get(u);if(n)return n;return null}return L}let{chain:T,symbol:H}=K(A.asset);return tN({chain:T,symbol:H})==="Native"?T:A.asset}function LH(A,T,H){let P=A.split("."),L=P[0]?.toUpperCase(),R=pN.includes(L),u=H?"~":"/",[n,B=""]=R?P.slice(1).join(".").split(u):A.split(u);if(!(n&&B))throw new $({errorKey:"helpers_invalid_asset_identifier",info:{identifier:A}});let{ticker:D,address:t}=yA({chain:n,symbol:B}),M=`${n}${u}${B}`;return{address:t,chain:L,isGasAsset:!1,isSynthetic:T,isTradeAsset:H,symbol:M,ticker:D}}function RH(A){let T=A.indexOf("."),H=(T===-1?A:A.slice(0,T)).toUpperCase(),P=T===-1?A:A.slice(T+1),{address:L,ticker:R}=yA({chain:H,symbol:P}),u;try{u=L&&G.EVMChains.includes(H)&&mN.getAddress(L)?mN.getAddress(L):L}catch{u=L}let n=u?`${R}-${u}`:P;return{address:u,chain:H,isGasAsset:qN({chain:H,symbol:P}),isSynthetic:!1,isTradeAsset:!1,symbol:n,ticker:R}}function KA(A){let T=A.slice(0,14),H=T.includes("/"),P=T.includes("~");if(H||P)return LH(A,H,P);return RH(A)}function yA({symbol:A,chain:T}){let{ticker:H,address:P}=e(A,T);return{address:P&&!y.includes(T)?P.toLowerCase():P,ticker:H}}var uH={};Q(uH,{SwapKitNumber:()=>BN});class BN extends k{eq(A){return this.eqValue(A)}static fromBigInt(A,T){return new BN({decimal:T,value:m({bigIntDecimal:T,decimal:T,value:A})})}}function pA(A=!0){return A?"https://midgard.thorchain.network":"https://midgard.mayachain.info"}function IH(A=!0){let T=pA(A);return A?`${T}/v2/thorname`:`${T}/v2/mayaname`}function nH(A){return function(H){let P=H?`?status=${H}`:"";return O.get(`${A}/v2/pools${P}`)}}function BH(A){return function(H){return O.get(`${A}/v2/pool/${H}`)}}function OH(A){return function(H,P){let L=P?`?period=${P}`:"";return O.get(`${A}/v2/pool/${H}/stats${L}`)}}function $H(A){return function(H,P){let L=new URLSearchParams;if(P?.interval)L.append("interval",P.interval);if(P?.count)L.append("count",P.count.toString());if(P?.from)L.append("from",P.from.toString());if(P?.to)L.append("to",P.to.toString());let R=L.toString()?`?${L.toString()}`:"";return O.get(`${A}/v2/history/depths/${H}${R}`)}}function GH(A){return function(){return O.get(`${A}/v2/network`)}}function MH(A){return function(){return O.get(`${A}/v2/health`)}}function _H(A){return function(){return O.get(`${A}/v2/nodes`)}}function gH(A){return function(H){return O.get(`${A}/v2/node/${H}`)}}function DH(A){return function(){return O.get(`${A}/v2/mimir/votes`)}}function YH(A){return function(){return O.get(`${A}/v2/mimir`)}}function SH(A){return function(){return O.get(`${A}/v2/constants`)}}function UH(A){return function(){return O.get(`${A}/v2/stats`)}}function XH(A){return function(H){let P=new URLSearchParams;if(H?.interval)P.append("interval",H.interval);if(H?.count)P.append("count",H.count.toString());if(H?.from)P.append("from",H.from.toString());if(H?.to)P.append("to",H.to.toString());let L=P.toString()?`?${P.toString()}`:"";return O.get(`${A}/v2/history/earnings${L}`)}}function tH(A){return function(H,P){let L=new URLSearchParams;if(P?.interval)L.append("interval",P.interval);if(P?.count)L.append("count",P.count.toString());if(P?.from)L.append("from",P.from.toString());if(P?.to)L.append("to",P.to.toString());let R=L.toString()?`?${L.toString()}`:"",u=H?`/swaps/${H}`:"/swaps";return O.get(`${A}/v2/history${u}${R}`)}}function EH(A){return function(H){let P=new URLSearchParams;if(H?.interval)P.append("interval",H.interval);if(H?.count)P.append("count",H.count.toString());if(H?.from)P.append("from",H.from.toString());if(H?.to)P.append("to",H.to.toString());let L=P.toString()?`?${P.toString()}`:"";return O.get(`${A}/v2/history/tvl${L}`)}}function xH(A){if(!A)return"";let T=new URLSearchParams,H=(P,L)=>{if(L!==void 0)T.append(P,typeof L==="number"?L.toString():L)};return H("address",A.address),H("txid",A.txid),H("asset",A.asset),H("type",A.type),H("affiliate",A.affiliate),H("limit",A.limit),H("offset",A.offset),T.toString()?`?${T.toString()}`:""}function bH(A){return function(H){let P=xH(H);return O.get(`${A}/v2/actions${P}`)}}function QH(A){return function(H){return O.get(`${A}/v2/member/${H}`)}}function wH(A){return function(H){let P=H?`/${H}`:"";return O.get(`${A}/v2/members${P}`)}}function zH(A){return function(H,P){let L=P?`&asset=${P}`:"";return O.get(`${A}/v2/saver/${H}${L?`?${L.substring(1)}`:""}`)}}function JH(A){return function(H){return O.get(`${A}/v2/savers/${H}`)}}function ZH(A){return function(H,P){let L=new URLSearchParams;if(P?.interval)L.append("interval",P.interval);if(P?.count)L.append("count",P.count.toString());if(P?.from)L.append("from",P.from.toString());if(P?.to)L.append("to",P.to.toString());let R=L.toString()?`?${L.toString()}`:"",u=H?`/savers/${H}`:"/savers";return O.get(`${A}/v2/history${u}${R}`)}}function WH(A){return function(H){return O.get(`${A}/v2/balance/${H}`)}}function jH(A){return async function(H){let P=(L)=>{if(L?.cause?.status===404)return;throw L};return await O.get(`${A}/lookup/${H}`,{onError:P,retry:{maxRetries:1}})}}function VH(A){return async function(H){let P=(L)=>{if(L?.cause?.status===404)return[];throw L};return await O.get(`${A}/rlookup/${H}`,{onError:P,retry:{maxRetries:1}})}}function vH(A){return async function(H){let P=(L)=>{if(L?.cause?.status===404)return[];throw L};return await O.get(`${A}/owner/${H}`,{onError:P,retry:{maxRetries:1}})}}function HN({asset:A,value:T}){return z.from({asset:A,fromBaseDecimal:h.getChainConfig(h.Chain.THORChain).baseDecimal,value:T})}function qH({liquidityPositionGetter:A,isThorchain:T}){return async function(P){let L=await A(P),R=T?"rune":"cacao";return L.pools.map((u)=>({[`${R}Pending`]:HN({asset:"THOR.RUNE",value:u.runePending}),[`${R}RegisteredAddress`]:u.runeAddress,[`${R}Withdrawn`]:HN({asset:"THOR.RUNE",value:u.runeWithdrawn}),[R]:HN({asset:"THOR.RUNE",value:u.runeAdded}),asset:HN({asset:u.pool,value:u.assetAdded}),assetPending:HN({asset:u.pool,value:u.assetPending}),assetRegisteredAddress:u.assetAddress,assetWithdrawn:HN({asset:u.pool,value:u.assetWithdrawn}),dateFirstAdded:u.dateFirstAdded,dateLastAdded:u.dateLastAdded,poolShare:new BN(u.liquidityUnits).div(u.pool)}))}}function oA(A){let T=A===h.Chain.THORChain,H=pA(T),P=IH(T),L=QH(H);return{getActions:bH(H),getBalance:WH(H),getConstants:SH(H),getEarningsHistory:XH(H),getHealth:MH(H),getLiquidityPosition:qH({isThorchain:T,liquidityPositionGetter:L}),getLiquidityPositionRaw:L,getMembers:wH(H),getMimir:YH(H),getMimirVotes:DH(H),getNameDetails:jH(P),getNamesByAddress:VH(P),getNamesByOwner:vH(P),getNetworkInfo:GH(H),getNode:gH(H),getNodes:_H(H),getPool:BH(H),getPoolDepthHistory:$H(H),getPoolStats:OH(H),getPools:nH(H),getSaverDetails:zH(H),getSavers:JH(H),getSaversHistory:ZH(H),getStats:UH(H),getSwapHistory:tH(H),getTVLHistory:EH(H)}}var fA=oA(h.Chain.THORChain),CA=oA(h.Chain.Maya);var $A={};Q($A,{getTrackerDetails:()=>gP,getTokenListProviders:()=>XP,getTokenList:()=>tP,getTokenApproval:()=>UP,getSwapTo:()=>WP,getSwapQuote:()=>DP,getRouteWithTx:()=>YP,getPrice:()=>EP,getNearDepositChannel:()=>QP,getGasRate:()=>xP,getChainflipDepositChannel:()=>bP,getChainBalance:()=>SP,SKRequestClient:()=>Z});var zN=require("@swapkit/types"),p=require("ts-pattern");var kH={};Q(kH,{signWidgetRequest:()=>oN});async function oN(A,T,H,P){let L=`${T}:${H}:${P}`,R=new TextEncoder,u=await crypto.subtle.importKey("raw",R.encode(A),{hash:"SHA-256",name:"HMAC"},!1,["sign"]),n=await crypto.subtle.sign("HMAC",u,R.encode(L));return Array.from(new Uint8Array(n)).map((B)=>B.toString(16).padStart(2,"0")).join("")}var v=require("@swapkit/types"),N=require("zod");var CN;((P)=>{P.CHEAPEST="CHEAPEST";P.FASTEST="FASTEST";P.RECOMMENDED="RECOMMENDED"})(CN||={});var ON;((R)=>{R.PSBT="PSBT";R.EVM="EVM";R.COSMOS="COSMOS";R.RADIX="RADIX";R.NEAR="NEAR"})(ON||={});var hN;((x)=>{x.approve="approve";x.claim="claim";x.deposit="deposit";x.donate="donate";x.lending="lending";x.lp_action="lp_action";x.native_contract_call="native_contract_call";x.native_send="native_send";x.stake="stake";x.streaming_swap="streaming_swap";x.swap="swap";x.thorname_action="thorname_action";x.token_contract_call="token_contract_call";x.token_transfer="token_transfer";x.unknown="unknown";x.unstake="unstake"})(hN||={});var dN;((S)=>{S.swap="swap";S.aggregation="aggregation";S.addLiquidity="addLiquidity";S.withdrawLiquidity="withdrawLiquidity";S.addSavers="addSavers";S.withdrawSavers="withdrawSavers";S.borrow="borrow";S.repay="repay";S.name="name";S.donate="donate";S.claim="claim";S.stake="stake";S.unstake="unstake"})(dN||={});var cN;((n)=>{n.unknown="unknown";n.not_started="not_started";n.pending="pending";n.swapping="swapping";n.completed="completed";n.refunded="refunded";n.failed="failed"})(cN||={});var lN;((E)=>{E.not_started="not_started";E.starting="starting";E.broadcasted="broadcasted";E.mempool="mempool";E.inbound="inbound";E.outbound="outbound";E.swapping="swapping";E.completed="completed";E.refunded="refunded";E.partially_refunded="partially_refunded";E.dropped="dropped";E.reverted="reverted";E.replaced="replaced";E.retries_exceeded="retries_exceeded";E.parsing_error="parsing_error"})(lN||={});var KH=N.object({address:N.optional(N.string()),chain:N.z.enum(v.Chain).optional(),chainId:N.z.enum(v.ChainId),coingeckoId:N.optional(N.string()),decimals:N.coerce.number(),extensions:N.optional(N.z.looseObject({})),identifier:N.string(),logoURI:N.optional(N.string()),name:N.optional(N.string()),shortCode:N.optional(N.string()),symbol:N.optional(N.string()),ticker:N.string()}),mH=N.z.object({block:N.z.optional(N.z.number().describe("Block number. Required for Polkadot chain. e.g. `123456`")),chainId:N.z.optional(N.z.string().describe("ChainId for the hash. e.g. `thorchain-1`")),depositChannelId:N.z.optional(N.z.string().describe("Deposit channel ID, required for Chainflip if tx was broadcasted without wallet connection")),hash:N.z.optional(N.z.string().describe("Hash for the first transaction broadcasted by the end user. e.g. `88D1819378ECD09E5284C54937CDC1E99B52F253C007617A02DD1200710CE677`"))}).refine((A)=>A.hash&&A.chainId||A.depositChannelId,{message:"Either `hash` and `chainId` or `depositChannelId` must be provided"}),yH=N.z.object({forceUpdate:N.z.string().toLowerCase().transform((A)=>A==="true").pipe(N.z.boolean()).optional()}),pH=N.object({error:N.string(),message:N.string()}),d=N.object({address:N.optional(N.string()),chain:N.z.enum(v.Chain),decimal:N.optional(N.number()),isGasAsset:N.boolean(),isSynthetic:N.boolean(),symbol:N.string(),tax:N.optional(N.object({buy:N.number(),sell:N.number()})),ticker:N.string()}),rN=N.object({id:N.string(),market_cap:N.number(),name:N.string(),price_change_24h_usd:N.number(),price_change_percentage_24h_usd:N.number(),sparkline_in_7d:N.array(N.number()),timestamp:N.string(),total_volume:N.number()}).partial(),oH=N.object({cg:N.optional(rN),identifier:N.string(),price_usd:N.number(),provider:N.string(),timestamp:N.number()}),iN=N.array(N.object({cg:N.optional(rN),identifier:N.string(),price_usd:N.number(),provider:N.string(),timestamp:N.number()}).partial()),fH=N.object({affiliate:N.optional(N.string().describe("Affiliate thorname")),affiliateFee:N.optional(N.number().describe("Affiliate fee in basis points").refine((A)=>A===Math.floor(A)&&A>=0,{message:"affiliateFee must be a positive integer",path:["affiliateFee"]})),allowSmartContractReceiver:N.optional(N.boolean().describe("Allow smart contract as recipient")),allowSmartContractSender:N.optional(N.boolean().describe("Allow smart contract as sender")),buyAsset:N.string().describe("Asset to buy"),cfBoost:N.optional(N.boolean().describe("Set to true to enable CF boost to speed up Chainflip swaps. BTC only.")),destinationAddress:N.optional(N.string().describe("Address to send asset to")),disableSecurityChecks:N.optional(N.boolean().describe("Disable security checks")),includeTx:N.optional(N.boolean().describe("Set to true to include an transaction object (EVM only)")),providers:N.optional(N.array(N.string().describe("List of providers to use").refine((A)=>b[A]!==void 0,{message:"Invalid provider",path:["providers"]}))),referrer:N.optional(N.string().describe("Referrer address (referral program)")),sellAmount:N.string().describe("Amount of asset to sell").refine((A)=>+A>0,{message:"sellAmount must be greater than 0",path:["sellAmount"]}),sellAsset:N.string().describe("Asset to sell"),slippage:N.optional(N.number().describe("Slippage tolerance as a percentage. Default is 3%.")),sourceAddress:N.optional(N.string().describe("Address to send asset from"))}).refine((A)=>A.sellAsset!==A.buyAsset,{message:"Must be different",path:["sellAsset","buyAsset"]}),CH=N.object({metadata:N.boolean(),tokens:N.array(N.object({identifier:N.string()}))}),sN=N.object({destinationAddress:N.string()}),cA=sN.extend({affiliateFees:N.array(N.object({brokerAddress:N.string(),feeBps:N.number()})).optional(),brokerCommissionBps:N.number().optional(),buyAsset:N.object({asset:N.string(),chain:N.string()}),channelMetadata:N.object({cfParameters:N.string().optional(),gasBudget:N.string().optional(),message:N.string().optional()}).optional(),dcaParameters:N.object({chunkInterval:N.number().optional(),numberOfChunks:N.number().optional()}).optional(),maxBoostFeeBps:N.number().optional(),refundParameters:N.object({minPrice:N.string().optional(),refundAddress:N.string().optional(),retryDuration:N.number().optional()}).optional(),sellAsset:N.object({asset:N.string(),chain:N.string()})}),eN=N.object({channelId:N.string(),depositAddress:N.string()}),fN=sN.extend({affiliateFees:N.object({feeBps:N.number(),nearId:N.string()}).optional(),buyAsset:N.string(),sellAmount:N.string(),sellAsset:N.string(),slippage:N.coerce.number(),sourceAddress:N.string()}),hA=N.object({amountIn:N.string(),amountInFormatted:N.string(),amountInUsd:N.string(),amountOut:N.string(),amountOutFormatted:N.string(),amountOutUsd:N.string(),deadline:N.string().optional(),minAmountIn:N.string(),minAmountOut:N.string(),timeEstimate:N.number().optional(),timeWhenInactive:N.string().optional()}),hH=hA.extend({depositAddress:N.string(),quote:hA,signature:N.string(),timestamp:N.string(),tx:N.unknown()}),aN=N.object({buyAsset:N.string(),buyAssetAmount:N.string(),buyAssetAmountMaxSlippage:N.string(),deadline:N.string().optional(),depositAddress:N.string(),depositAmount:N.string(),depositAsset:N.string(),tx:N.unknown()}),dH=N.object({evmCalldata:N.z.optional(N.z.string()),intentHash:N.z.optional(N.z.string()),logs:N.z.optional(N.z.unknown()),manifest:N.z.optional(N.z.unknown()),memo:N.z.optional(N.z.string()),spender:N.z.optional(N.z.string()),thorname:N.z.optional(N.z.string())}),cH=N.object({currentStage:N.string(),inboundConfirmation:N.number(),inboundObservation:N.number(),outboundDelay:N.number(),outboundObservation:N.number(),streamingSwap:N.number()}),lH=N.object({count:N.optional(N.number()),interval:N.optional(N.number()),quantity:N.optional(N.number()),subSwapsMap:N.optional(N.array(N.number()))}),rH=N.z.object({currentLegIndex:N.z.optional(N.z.number()),estimatedTimeToComplete:N.z.number(),estimates:N.z.optional(cH),providerDetails:N.z.optional(N.z.object({streamingDetails:N.z.optional(lH)}))}),iH=N.object({affiliate:N.optional(d),liquidity:N.optional(d),network:N.optional(d),protocol:N.optional(d),tax:N.optional(d)}),sH=N.object({affiliate:N.string(),bps:N.string(),isReferrer:N.boolean()}),eH=N.object({affiliate:N.optional(N.string()),affiliateFees:N.optional(N.array(sH)),broadcastedAt:N.optional(N.number()),explorerUrl:N.optional(N.string()),fees:N.optional(iH),images:N.optional(N.object({chain:N.optional(N.string()),from:N.optional(N.string()),provider:N.optional(N.string()),to:N.optional(N.string())})),provider:N.optional(N.z.enum(b)),providerAction:N.z.optional(N.z.enum(dN)),quoteId:N.optional(N.string()),wallet:N.optional(N.string())}),PN=N.z.object({block:N.z.number(),chainId:N.z.enum(v.ChainId),finalAddress:N.z.optional(N.z.string()),finalAsset:N.z.optional(d),finalisedAt:N.z.number(),fromAddress:N.z.string(),fromAmount:N.z.string(),fromAsset:N.z.string(),hash:N.z.string(),meta:N.z.optional(eH),payload:N.z.optional(dH),status:N.z.enum(cN),toAddress:N.z.string(),toAmount:N.z.string(),toAsset:N.z.string(),trackingStatus:N.z.optional(N.z.enum(lN)),transient:N.z.optional(rH),type:N.z.enum(hN)}),NA=PN.extend({legs:N.z.array(PN)}),aH=PN.extend({legs:N.array(PN)}),NP=PN.extend({legs:N.array(PN)}),QN=N.array(N.object({amount:N.string(),asset:N.string(),chain:N.string(),protocol:N.z.enum(b),type:N.z.enum(DN)})),wN=N.z.object({inbound:N.z.optional(N.z.number().describe("Time to receive inbound asset in seconds")),outbound:N.z.optional(N.z.number().describe("Time to receive outbound asset in seconds")),swap:N.z.optional(N.z.number().describe("Time to swap assets in seconds")),total:N.z.number().describe("Total time in seconds")}),AA=N.object({data:N.string().describe("Data to send"),from:N.string().describe("Address of the sender"),to:N.string().describe("Address of the recipient"),value:N.string().describe("Value to send")}),TA=N.z.object({raw_data:N.z.object({contract:N.z.any(),data:N.z.string().optional(),expiration:N.z.number(),fee_limit:N.z.number().optional(),ref_block_bytes:N.z.string(),ref_block_hash:N.z.string(),timestamp:N.z.number()}).passthrough(),raw_data_hex:N.z.string(),txID:N.z.string(),visible:N.z.boolean()}),lA=N.array(N.union([N.string(),N.number(),N.array(N.string()),N.object({from:N.string(),value:N.string()}).describe("Parameters to pass to the contract method")])),AP=N.object({approvalSpender:N.optional(N.string().describe("Address of the spender to approve")),approvalToken:N.optional(N.string().describe("Address of the token to approve spending of")),contractAddress:N.string().describe("Address of the contract to interact with"),contractMethod:N.string().describe("Name of the method to call"),contractParamNames:N.array(N.string().describe("Names of the parameters to pass to the contract method")),contractParams:lA}),TP=N.object({typeUrl:N.string("/types.MsgDeposit"),value:N.object({coins:N.array(N.object({amount:N.string(),asset:N.object({chain:N.string(),symbol:N.string(),synth:N.boolean(),ticker:N.string()})})),memo:N.string(),signer:N.string()})}),HP=N.object({typeUrl:N.string("/types.MsgSend"),value:N.object({amount:N.array(N.object({amount:N.string(),denom:N.string()})),fromAddress:N.string(),toAddress:N.string()})}),PP=N.object({typeUrl:N.string(),value:HP.shape.value.or(TP.shape.value)}),LP=N.object({amount:N.array(N.object({amount:N.string(),denom:N.string()})),gas:N.string()}),HA=N.object({accountNumber:N.number(),chainId:N.z.enum(v.ChainId),fee:LP,memo:N.string(),msgs:N.array(PP),sequence:N.number()}),rA=N.z.array(N.z.object({calldata:N.z.array(N.z.string()),contractAddress:N.z.string(),entrypoint:N.z.string()})),PA=N.z.array(N.z.object({address:N.z.string().describe("Destination address in friendly format"),amount:N.z.string().describe("Amount in nanotons"),payload:N.z.string().optional().describe("Base64 BOC of body cell"),stateInit:N.z.string().optional().describe("Base64 BOC of state init")})),iA=N.object({affiliate:N.string().describe("Affiliate address").optional(),affiliateFee:N.number().describe("Affiliate fee").optional(),buyAsset:N.string().describe("Asset to buy"),destinationAddress:N.string().describe("Destination address"),estimatedTime:wN.optional(),provider:N.z.enum(b),sellAsset:N.string().describe("Asset to sell"),slipPercentage:N.number().describe("Slippage as a percentage"),sourceAddress:N.string().describe("Source address")}),RP=iA.omit({destinationAddress:!0,slipPercentage:!0,sourceAddress:!0}),sA=N.object({asset:N.string().describe("Asset name"),image:N.string().describe("Asset image"),price:N.number().describe("Price in USD")}),eA=cA,LA=N.object({assets:N.optional(N.array(sA)),maxStreamingQuantity:N.number().optional(),referrer:N.string().optional(),streamingInterval:N.number().optional(),tags:N.array(N.z.enum(CN))}),RA=LA.extend({affiliate:N.optional(N.string()),affiliateFee:N.optional(N.string()),approvalAddress:N.optional(N.string().describe("Approval address for swap")),chainflip:eA.optional(),garden:fN.optional(),near:fN.optional(),priceImpact:N.optional(N.number().describe("Price impact")),referrer:N.optional(N.string()),txType:N.optional(N.z.enum(ON))}),FA=N.array(N.object({code:N.z.enum(gN),display:N.string(),tooltip:N.string().optional()})),FP=N.object({buyAmount:N.string().describe("Buy amount"),buyAmountMaxSlippage:N.string().describe("Buy amount max slippage"),buyAsset:N.string().describe("Asset to buy"),fees:N.optional(QN),provider:N.z.enum(b),sellAmount:N.string().describe("Sell amount"),sellAsset:N.string().describe("Asset to sell")}),aA=N.object({buyAsset:N.string().describe("Asset to buy"),destinationAddress:N.optional(N.string().describe("Destination address")),estimatedTime:N.optional(wN),expectedBuyAmount:N.string().describe("Expected Buy amount"),expectedBuyAmountMaxSlippage:N.string().describe("Expected Buy amount max slippage"),expiration:N.optional(N.string().describe("Expiration")),fees:QN,inboundAddress:N.optional(N.string().describe("Inbound address")),legs:N.array(FP),memo:N.optional(N.string().describe("Memo")),meta:RA,providers:N.array(N.z.enum(b)),routeId:N.string().describe("Route ID"),sellAmount:N.string().describe("Sell amount"),sellAsset:N.string().describe("Asset to sell"),sourceAddress:N.optional(N.string().describe("Source address")),targetAddress:N.optional(N.string().describe("Target address")),totalSlippageBps:N.number().describe("Total slippage in bps"),tx:N.optional(N.union([AA,HA,TA,rA,PA,N.string()])),txType:N.optional(N.z.enum(ON)),warnings:FA}),uA=N.object({error:N.optional(N.string().describe("Error message")),providerErrors:N.optional(N.array(N.object({errorCode:N.optional(N.z.enum(i)),message:N.optional(N.string()),provider:N.z.enum(b).optional()}))),quoteId:N.string().describe("Quote ID"),routes:N.array(aA)}),IA=N.z.object({chainId:N.z.enum(v.ChainId),createdAt:N.z.date(),id:N.z.number(),unit:N.z.string(),value:N.z.string()}),uP=N.z.array(IA),nA=N.z.union([IA,uP]),QL=N.array(N.object({chain:N.z.enum(v.Chain),decimal:N.number(),identifier:N.string(),symbol:N.string(),ticker:N.string(),value:N.string()})),IP=N.z.union([N.z.object({amount:N.z.string(),spender:N.z.string(),tokenIdentifier:N.z.string(),userWalletAddress:N.z.string()}),N.z.object({amount:N.z.string(),chainId:N.z.enum(v.ChainId),spender:N.z.string(),tokenContractAddress:N.z.string(),userWalletAddress:N.z.string()}),N.z.object({routeId:N.z.string()})]),nP=N.z.object({approvalTransaction:N.z.optional(N.z.object({data:N.z.string(),from:N.z.string(),gasLimit:N.z.optional(N.z.string()),gasPrice:N.z.optional(N.z.string()),to:N.z.string(),value:N.z.string()})),approvedAmount:N.z.string(),isApproved:N.z.boolean()}),NT=N.z.object({data:N.z.string().describe("Encoded approval call data"),from:N.z.string().describe("User wallet address"),gasLimit:N.z.string().optional().describe("Estimated gas limit"),gasPrice:N.z.string().optional().describe("Current gas price"),to:N.z.string().describe("Token contract address"),value:N.z.string().describe("ETH value (always '0' for approvals)")}),dA=N.z.object({buyAmount:N.z.string().describe("Buy amount").optional(),buyAmountMaxSlippage:N.z.string().describe("Buy amount max slippage").optional(),buyAsset:N.z.string().describe("Asset to buy"),expectedBuyAmount:N.z.string().describe("Expected Buy amount").optional(),expectedBuyAmountMaxSlippage:N.z.string().describe("Expected Buy amount max slippage").optional(),fees:QN,provider:N.z.enum(b),sellAmount:N.z.string().describe("Sell amount"),sellAsset:N.z.string().describe("Asset to sell")}),AT=dA.extend({estimatedTime:N.z.optional(wN),expiration:N.z.optional(N.z.string().describe("Expiration")),legs:N.z.array(dA),providers:N.z.array(N.z.enum(b)),routeId:N.z.string().describe("Route ID"),totalSlippageBps:N.z.number().describe("Total slippage in bps"),warnings:FA}).omit({provider:!0}),BP=N.z.object({method:N.z.string(),payload:N.z.optional(N.z.unknown()),url:N.z.string()}),OP=AT.extend({meta:LA,nextActions:N.z.optional(N.z.array(BP))}),$P=N.z.object({error:N.z.optional(N.z.string().describe("Error message")),providerErrors:N.z.optional(N.z.array(N.z.object({errorCode:N.z.optional(N.z.enum(i)),message:N.z.optional(N.z.string()),provider:N.z.enum(b).optional()}))),quoteId:N.z.string().describe("Quote ID"),routes:N.z.array(OP)}),GP=N.z.object({providers:N.z.array(N.z.enum(b)).optional().describe("Optional list of providers to query for trading pairs"),sellAsset:N.z.string().describe("Asset identifier to sell (e.g., 'BTC.BTC' or 'ETH.ETH')")}),TT=N.z.object({chain:N.z.enum(v.Chain).describe("Chain the asset is on"),identifier:N.z.string().describe("Asset identifier (e.g., 'ETH.USDC-0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48')"),providers:N.z.array(N.z.enum(b)).describe("Providers that support this trading pair"),symbol:N.z.string().describe("Asset symbol"),ticker:N.z.string().describe("Asset ticker")}),MP=N.z.object({buyAssets:N.z.array(TT).describe("List of assets that can be swapped to"),sellAsset:N.z.string().describe("The input sell asset identifier")}),BA=AT.extend({destinationAddress:N.z.string().describe("Destination address"),inboundAddress:N.z.optional(N.z.string().describe("Inbound address")),memo:N.z.optional(N.z.string().describe("Memo to include in the transaction")),meta:RA,sourceAddress:N.z.string().describe("Source address"),targetAddress:N.z.optional(N.z.string().describe("Target address")),tx:N.optional(N.union([AA,HA,TA,PA,N.string()])),txType:N.z.optional(N.z.enum(ON))}),HT=N.z.object({data:N.z.optional(N.z.record(N.z.string(),N.z.string().optional())),errorCode:N.z.enum(i),message:N.z.string().optional(),provider:N.z.enum(b).optional()}),_P=N.z.object({error:N.z.optional(N.z.string().describe("Error message")),providerErrors:N.z.optional(N.z.array(HT)),quoteId:N.z.string().describe("Quote ID"),routes:N.z.array(BA)}),OA=BA.extend({approvalTx:NT.optional().describe("Optional approval transaction if ERC-20 approval is required before swap"),swapId:N.z.string().describe("The unique swap ID for tracking")});var Z=O.extend({dynamicHeader:async()=>{let A=Y.get("widgetId"),T=Y.get("widgetKey");if(A&&T&&typeof window<"u"){let P=Math.floor(Date.now()/1000),L=window.location.origin,R=await oN(T,A,L,P);return{Origin:L,"X-Signature":R,"X-Timestamp":P.toString(),"x-widget-id":A}}let{swapKit:H}=Y.get("apiKeys");return H?{"x-api-key":H}:{}}});async function gP(A){let T=await Z.post(J("/track"),{json:A});try{let H=NA.safeParse(T);if(!H.success)throw new $("api_v2_invalid_response",H.error);return H.data}catch(H){return T}}async function DP(A){let{getQuote:T}=Y.get("endpoints");if(T)return T(A);let P=Y.get("v3SwapFlow")?.enabled?"/v3/quote":"/quote",L=await Z.post(J(P),{json:A});if(L.error)throw new $("api_v2_server_error",{message:L.error});try{let R=uA.safeParse(L);if(!R.success)throw new $("api_v2_invalid_response",R.error);return R.data}catch{return L}}async function YP(A){let{getRouteWithTx:T}=Y.get("endpoints");if(T)return T(A);let P=Y.get("v3SwapFlow")?.enabled?"/v3/swap":"/swap",L=await Z.post(J(P),{json:A});try{let R=OA.safeParse(L);if(!R.success)throw new $("api_v2_invalid_response",R.error);return R.data}catch(R){return console.error(new $("api_v2_invalid_response",R)),L}}async function SP({chain:A,address:T,scamFilter:H=!0}){let{getBalance:P}=Y.get("endpoints");if(P)return P({address:T,chain:A});let L=J(`/balance?chain=${A}&address=${T}`),R=await Z.get(L),u=Array.isArray(R)?R:[];return H?ZP(u):u}function UP(A){let T=p.match(A).with({routeId:p.P.string,spender:p.P.string},({routeId:H,spender:P})=>J(`/approve?routeId=${H}&sourceAddress=${P}`)).with({assetValue:p.P.instanceOf(z),spender:p.P.string,userWallet:p.P.string},({spender:H,userWallet:P,assetValue:L})=>J(`/approve?tokenIdentifier=${L.toString()}&userWalletAddress=${P}&spender=${H}&amount=${L.getValue("string")}`)).exhaustive();return Z.get(T)}function XP(){let A=J("/providers");return Z.get(A)}function tP(A){let T=J(`/tokens?provider=${A}`);return Z.get(T)}async function EP(A){let T=J("/price"),H=await Z.post(T,{json:A});try{let P=iN.safeParse(H);if(!P.success)throw new $("api_v2_invalid_response",P.error);return P.data}catch(P){throw new $("api_v2_invalid_response",P)}}async function xP(){let A=J("/gas"),T=await Z.get(A);try{let H=nA.safeParse(T);if(!H.success)throw new $("api_v2_invalid_response",H.error);return Array.isArray(H)?H:[H]}catch(H){throw new $("api_v2_invalid_response",H)}}async function bP(A){let{destinationAddress:T}=A;if(!T)throw new $("chainflip_broker_invalid_params");let H=Y.get("integrations").chainflip?.brokerUrl||J("/chainflip/broker/channel"),P=await Z.post(H,{json:A});try{let L=eN.safeParse(P);if(!L.success)throw new $("api_v2_invalid_response",L.error);return L.data}catch(L){throw new $("api_v2_invalid_response",L)}}async function QP(A){let{destinationAddress:T}=A;if(!T)throw new $("chainflip_broker_invalid_params");let H=J("/near/channel"),P=await Z.post(H,{json:A});try{let L=aN.safeParse(P);if(!L.success)throw new $("api_v2_invalid_response",L.error);return L.data}catch(L){throw new $("api_v2_invalid_response",L)}}function J(A){let{isDev:T,apiUrl:H,devApiUrl:P}=Y.get("envs"),{enabled:L,quoteUrl:R,swapUrl:u}=Y.get("localMode");if(L&&A){let[B]=A.split("?");if(B==="/quote"||B==="/v3/quote")return`${R}${A}`;if(B==="/swap"||B==="/v3/swap")return`${u}${A}`}return`${T?P:H}${A}`}function wP(A){try{return z.from({asset:A.identifier})}catch{return}}var zP=new Set(["OP.OP"]),JP=/(.)\1{6}|\.ORG|\.NET|\.FINANCE|\.COM|WWW|HTTP|\\\\|\/\/|[\s$%:[\]]/im;function ZP(A){return A.filter((T)=>{let H=wP(T);if(!H)return!1;if(zP.has(H.toString().toUpperCase()))return!0;return(!zN.EVMChains.includes(H.chain)||H.isGasAsset||!!H.address)&&!JP.test(H.ticker)})}async function WP(A){let{getSwapTo:T}=Y.get("endpoints");if(T)return T(A);let H=new URLSearchParams({sellAsset:A.sellAsset});if(A.providers?.length)for(let u of A.providers)H.append("providers",u);let P=J(`/swapTo?${H.toString()}`),L=await Z.get(P);if(!Array.isArray(L))return{buyAssets:[],sellAsset:A.sellAsset};let R=[];for(let u of L)try{let n=z.from({asset:u});R.push({chain:n.chain,identifier:n.toString(),providers:[],symbol:n.symbol,ticker:n.ticker})}catch{}return{buyAssets:R,sellAsset:A.sellAsset}}var GA={};Q(GA,{getThorchainQueue:()=>vP,getTcyStakers:()=>fP,getTcyStaker:()=>oP,getTcyClaimers:()=>hP,getTcyClaimer:()=>CP,getTNSPreferredAsset:()=>mP,getTHORNodeTNSDetails:()=>LT,getRunePoolProviderInfo:()=>pP,getRunePoolInfo:()=>yP,getNodes:()=>qP,getMimirInfo:()=>kP,getLastBlock:()=>VP,getInboundAddresses:()=>KP});var PT=require("ts-pattern");function j(A){let{isStagenet:T}=Y.get("envs"),H=Y.get("thornodeUrls");return`${PT.match({isStagenet:T,type:A}).with({type:"mayachain"},({isStagenet:L})=>L?H.MAYA_STAGENET:H.MAYA).otherwise(({isStagenet:L})=>L?H.THOR_STAGENET:H.THOR)}/${A??"thorchain"}`}function jP(A){let T=A==="mayachain"?"mayaname":"thorname";return`${j(A)}/${T}`}function VP(A="thorchain"){return O.get(`${j(A)}/lastblock`)}function vP(A){return O.get(`${j(A)}/queue`)}function qP(A){return O.get(`${j(A)}/nodes`)}function kP(A){return O.get(`${j(A)}/mimir`)}function KP(A){return O.get(`${j(A)}/inbound_addresses`)}async function LT({type:A,name:T}){try{return await O.get(`${jP(A)}/${T}`)}catch{return{affiliate_collector_rune:"",aliases:[],expire_block_height:0,name:T,owner:"",preferred_asset:""}}}async function mP({type:A,tns:T}){let H=await LT({name:T,type:A});if(!H.preferred_asset||H.preferred_asset===".")return;return z.from({asset:H.preferred_asset,asyncTokenLookup:!0})}function yP(A){return O.get(`${j(A)}/runepool`)}function pP({type:A,thorAddress:T}){return O.get(`${j(A)}/rune_provider/${T}`)}function oP({type:A,address:T}){return O.get(`${j(A)}/tcy_staker/${T}`)}function fP(A){return O.get(`${j(A)}/tcy_stakers`)}function CP({type:A,address:T}){return O.get(`${j(A)}/tcy_claimer/${T}`)}function hP(A){return O.get(`${j(A)}/tcy_claimers`)}var dP={...$A,mayachainMidgard:CA,thorchainMidgard:fA,thornode:GA};
package/dist/api/index.js CHANGED
@@ -1 +1 @@
1
- import{$ as n,Aa as O,Ba as P,Ca as Q,Da as R,Ea as S,Fa as T,Ga as U,Ha as V,Ia as W,Ja as X,Ka as Y,La as Z,Ma as _,Na as $,O as a,Oa as aa,P as b,Pa as ba,Q as c,Qa as ca,R as d,S as e,T as f,U as g,V as h,W as i,X as j,Y as k,Z as l,_ as m,aa as o,ba as p,ca as q,da as r,ea as s,fa as t,ga as u,ha as v,ia as w,ja as x,ka as y,la as z,ma as A,na as B,oa as C,pa as D,qa as E,ra as F,sa as G,ta as H,ua as I,va as J,wa as K,xa as L,ya as M,za as N}from"../chunk-5havr91f.js";export{c as TxnType,e as TxnStatus,C as TronTransactionSchema,x as TransactionSchema,y as TransactionDTOSchema,f as TrackingStatus,h as TrackingRequestSchema,i as TrackingRequestQuerySchema,w as TrackerResponseSchema,g as TokenSchema,m as TokenDetailsMetadataSchema,H as TONTransactionSchema,Z as SwapToResponseSchema,X as SwapToRequestSchema,Y as SwapToAssetSchema,ba as SwapRouteV2ResponseSchema,ca as SwapKitApi,G as StarknetTransactionSchema,O as RouteQuoteWarningSchema,b as RouteQuoteTxType,$ as RouteQuoteProviderErrorSchema,N as RouteQuoteMetadataV2Schema,M as RouteQuoteMetadataSchema,K as RouteQuoteMetadataAssetSchema,J as RouteLegWithoutAddressesSchema,I as RouteLegSchema,W as QuoteV3ResponseSchema,aa as QuoteV2ResponseSchema,_ as QuoteRouteV2Response,Q as QuoteResponseSchema,P as QuoteResponseRouteItem,o as QuoteRequestSchema,d as ProviderAction,a as PriorityLabel,n as PriceResponseSchema,p as PriceRequestSchema,v as NearSwapResponseSchema,u as NearDepositChannelResultSchema,t as NearDepositChannelParamsSchema,R as GasSchema,S as GasResponseSchema,z as FeesSchema,A as EstimatedTimeSchema,B as EVMTransactionSchema,E as EVMTransactionDetailsSchema,D as EVMTransactionDetailsParamsSchema,s as DepositChannelResponseSchema,q as DepositChannelParamsSchema,F as CosmosTransactionSchema,l as CoinGeckoMetadataSchema,L as ChainflipMetadataSchema,r as BrokerDepositChannelParamsSchema,k as AssetValueSchema,U as ApproveResponseSchema,T as ApproveRequestParams,V as ApprovalTransactionSchema,j as ApiV2ErrorSchema};
1
+ import{$ as n,Aa as O,Ba as P,Ca as Q,Da as R,Ea as S,Fa as T,Ga as U,Ha as V,Ia as W,Ja as X,Ka as Y,La as Z,Ma as _,Na as $,O as a,Oa as aa,P as b,Pa as ba,Q as c,Qa as ca,R as d,S as e,T as f,U as g,V as h,W as i,X as j,Y as k,Z as l,_ as m,aa as o,ba as p,ca as q,da as r,ea as s,fa as t,ga as u,ha as v,ia as w,ja as x,ka as y,la as z,ma as A,na as B,oa as C,pa as D,qa as E,ra as F,sa as G,ta as H,ua as I,va as J,wa as K,xa as L,ya as M,za as N}from"../chunk-tf9f4rzs.js";export{c as TxnType,e as TxnStatus,C as TronTransactionSchema,x as TransactionSchema,y as TransactionDTOSchema,f as TrackingStatus,h as TrackingRequestSchema,i as TrackingRequestQuerySchema,w as TrackerResponseSchema,g as TokenSchema,m as TokenDetailsMetadataSchema,H as TONTransactionSchema,Z as SwapToResponseSchema,X as SwapToRequestSchema,Y as SwapToAssetSchema,ba as SwapRouteV2ResponseSchema,ca as SwapKitApi,G as StarknetTransactionSchema,O as RouteQuoteWarningSchema,b as RouteQuoteTxType,$ as RouteQuoteProviderErrorSchema,N as RouteQuoteMetadataV2Schema,M as RouteQuoteMetadataSchema,K as RouteQuoteMetadataAssetSchema,J as RouteLegWithoutAddressesSchema,I as RouteLegSchema,W as QuoteV3ResponseSchema,aa as QuoteV2ResponseSchema,_ as QuoteRouteV2Response,Q as QuoteResponseSchema,P as QuoteResponseRouteItem,o as QuoteRequestSchema,d as ProviderAction,a as PriorityLabel,n as PriceResponseSchema,p as PriceRequestSchema,v as NearSwapResponseSchema,u as NearDepositChannelResultSchema,t as NearDepositChannelParamsSchema,R as GasSchema,S as GasResponseSchema,z as FeesSchema,A as EstimatedTimeSchema,B as EVMTransactionSchema,E as EVMTransactionDetailsSchema,D as EVMTransactionDetailsParamsSchema,s as DepositChannelResponseSchema,q as DepositChannelParamsSchema,F as CosmosTransactionSchema,l as CoinGeckoMetadataSchema,L as ChainflipMetadataSchema,r as BrokerDepositChannelParamsSchema,k as AssetValueSchema,U as ApproveResponseSchema,T as ApproveRequestParams,V as ApprovalTransactionSchema,j as ApiV2ErrorSchema};
@@ -0,0 +1,5 @@
1
+ var sA=Object.defineProperty;var eA=(N)=>N;function aA(N,A){this[N]=eA.bind(null,A)}var dN=(N,A)=>{for(var T in A)sA(N,T,{get:A[T],enumerable:!0,configurable:!0,set:aA.bind(A,T)})};var LN=((N)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(N,{get:(A,T)=>(typeof require<"u"?require:A)[T]}):N)(function(N){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+N+'" is not supported')});import{Chain as XN,getChainConfig as rT}from"@swapkit/types";import{AllChains as KT,Chain as b,EVMChains as mT,getChainConfig as nN}from"@swapkit/types";import{getAddress as BA}from"ethers";import{match as vN}from"ts-pattern";import{Chain as n,EVMChains as xT,getChainConfig as o,UTXOChains as QT}from"@swapkit/types";import{match as FN}from"ts-pattern";import{AllChains as lN,Chain as cN,getChainConfig as RT,MAYAConfig as FT,StagenetChain as MN,StagenetMAYAConfig as rN,StagenetTHORConfig as iN,THORConfig as uT}from"@swapkit/types";import{createStore as IT}from"zustand/vanilla";import{AllChains as NT,getChainConfig as AT}from"@swapkit/types";var wP=NT.reduce((N,A)=>{return N[A]=AT(A).networkDerivationPath,N},{});var RN;((u)=>{u.unknownError="unknownError";u.test_error="test_error";u.providerDetailsError="providerDetailsError";u.blockHeaderNotFound="blockHeaderNotFound";u.blockHashNotFoundAtHeight="blockHashNotFoundAtHeight";u.blockHashNotFoundAtHash="blockHashNotFoundAtHash";u.txHashMissing="txHashMissing";u.assetValueMissingInfo="assetValueMissingInfo";u.invalidAsset="invalidAsset";u.blockIsRequired="blockIsRequired";u.currentBlockHeaderNotFound="currentBlockHeaderNotFound";u.failedToRetrieveBalance="failedToRetrieveBalance";u.failedToRetrieveBlock="failedToRetrieveBlock";u.failedToRetrieveFees="failedToRetrieveFees";u.notImplementedBCH="notImplementedBCH";u.notImplementedDoge="notImplementedDoge";u.noPoolsFound="noPoolsFound";u.noVaultsFound="noVaultsFound";u.noTxFound="noTxFound";u.noInputCoinFound="noInputCoinFound";u.noBlockDataFound="noBlockDataFound";u.multipleCosmosMessages="multipleCosmosMessages";u.heightOrHashNotProvided="heightOrHashNotProvided";u.unknownDenom="unknownDenom";u.invalidBlockHeight="invalidBlockHeight";u.timestampExtrinsicNoArgumentsForBlock="timestampExtrinsicNoArgumentsForBlock";u.timestampExtrinsicNoTimestampForBlock="timestampExtrinsicNoTimestampForBlock";u.noTimestampExtrinsicForHash="noTimestampExtrinsicForHash";u.timestampExtrinsicNoArgumentsForHash="timestampExtrinsicNoArgumentsForHash";u.txMemoUndefined="txMemoUndefined";u.txMemoIncorrect="txMemoIncorrect";u.txTypeNotFound="txTypeNotFound";u.txNoMessage="txNoMessage";u.txNotFound="txNotFound";u.txReceiptNotFound="txReceiptNotFound";u.txParsingError="txParsingError";u.txLogsParsingError="txLogsParsingError";u.blockNotFound="blockNotFound";u.balanceNotFound="balanceNotFound";u.configError="configError";u.synthSwapDisallowed="synthSwapDisallowed";u.providerQuoteTimeout="providerQuoteTimeout";u.noQuoteResponse="noQuoteResponse";u.noPoolAssetsFound="noPoolAssetsFound";u.noThorchainPools="noThorchainPools";u.noMayachainPools="noMayachainPools";u.noThorchainNetworkInfo="noThorchainNetworkInfo";u.invalidAffiliateFee="invalidAffiliateFee";u.invalidBuyAssetAddress="invalidBuyAssetAddress";u.invalidSellAssetAddress="invalidSellAssetAddress";u.invalidSourceAddress="invalidSourceAddress";u.invalidDestinationAddress="invalidDestinationAddress";u.sourceAddressIsSmartContract="sourceAddressIsSmartContract";u.destinationAddressIsSmartContract="destinationAddressIsSmartContract";u.invalidChainId="invalidChainId";u.unsupportedChainId="unsupportedChainId";u.unsupportedEVMChainId="unsupportedEVMChainId";u.unsupportedMethod="unsupportedMethod";u.unsupportedProvider="unsupportedProvider";u.invalidParamsForMethod="invalidParamsForMethod";u.unsupportedAdapter="unsupportedAdapter";u.noWhitelistTokens="noWhitelistTokens";u.failedFetchGasPrice="failedFetchGasPrice";u.failedToCreateDepositChannel="failedToCreateDepositChannel";u.noProviderDetailsFound="noProviderDetailsFound";u.noTokenListsFound="noTokenListsFound";u.tokenNotFound="tokenNotFound";u.tokenPriceNotFound="tokenPriceNotFound";u.tokenPriceFailedToUpdate="tokenPriceFailedToUpdate";u.swapAmountTooSmall="swapAmountTooSmall";u.legsArrayIsEmpty="legsArrayIsEmpty";u.failedToFetchQuoteForLeg="failedToFetchQuoteForLeg";u.noBlockHeaderFound="noBlockHeaderFound";u.failedToSimulateSwap="failedToSimulateSwap";u.addressScreeningFailed="addressScreeningFailed";u.noLiquidtyProvidersFound="noLiquidtyProvidersFound";u.insufficientLiquidity="insufficientLiquidity";u.noInboundDataFound="noInbounDataFound";u.noInboundAddressesFound="noInboundAddressesFound";u.noInboundAddressFoundForChain="noInboundAddressFoundForChain";u.noLastBlocksFound="noLastBlocksFound";u.noVersionFound="noVersionFound";u.noConstantsFound="noConstantsFound";u.noMimirsFound="noMimirsFound";u.noRoutesFound="noRoutesFound";u.quoteNotFound="quoteNotFound";u.ledgerSignFailed="ledgerSignFailed";u.ledgerWrongPayload="ledgerWrongPayload";u.ledgerFetchSwapFailed="ledgerFetchSwapFailed";u.failedToFetchTx="failedToFetchTx";u.failedBuildTransactionDetails="failedBuildTransactionDetails";u.noLegsForRoute="noLegsForRoute";u.noRouterAddressFound="noRouterAddressFound";u.noAggregatorAddressFound="noAggregatorAddressFound";u.noContractInstanceFound="noContractInstanceFound";u.noContractAddressFound="noContractAddressFound";u.invalidAffiliate="invalidAffiliate";u.thornameAffiliate="thornameAffiliate";u.providerNotfound="No provider found";u.noRecordFound="No Record found";u.slippageTooLow="Slippage too low";u.tradingHalted="tradingHalted";u.noWrappedGasAsset="noWrappedGasAsset";u.aggregatorAddressNotFound="aggregatorAddressNotFound";u.routerAddressNotFound="routerAddressNotFound";u.dummyAddressNotFound="dummyAddressNotFound";u.trackerError="trackerError";u.thorchainPoolUnavailable="thorchainPoolUnavailable";u.noOhlcvDataFound="noOhlcvDataFound";u.noTradingPairs="noTradingPairs";u.noLendingAvailability="noLendingAvailability";u.lendingRepayTooSmall="lendingRepayTooSmall";u.missingState="missingState";u.ledgerSwapNotFound="ledgerSwapNotFound";u.ledgerSwapNotReadyForTracking="ledgerSwapNotReadyForTracking";u.errorEstimatingGas="errorEstimatingGas";u.apiKeyInvalid="apiKeyInvalid";u.apiKeyFailedToUpdate="apiKeyFailedToUpdate";u.apiKeyExpired="apiKeyExpired";u.unauthorized="unauthorized";u.failedToCreateMemo="failedToCreateMemo";u.radixIncorrectInstructions="radixIncorrectInstructions";u.radixTxMissedParam="radixTxMissedParam";u.radixTxMissedAccount="radixTxMissedAccount";u.radixManifestParseError="radixManifestParseError";u.radixManifestBuildError="radixManifestBuildError";u.invalidAddressForChain="invalidAddressForChain";u.riskyAddress="riskyAddress";u.noRoutesToProcess="noRoutesToProcess";u.sellAssetAmountTooSmall="sellAssetAmountTooSmall";u.missingPrivateKey="missingPrivateKey";u.noMemoPriceProtection="noMemoPriceProtection"})(RN||={});var xN;((T)=>{T.highSlippage="highSlippage";T.highPriceImpact="highPriceImpact"})(xN||={});var J;((E)=>{E.CHAINFLIP="CHAINFLIP";E.CHAINFLIP_STREAMING="CHAINFLIP_STREAMING";E.JUPITER="JUPITER";E.MAYACHAIN="MAYACHAIN";E.MAYACHAIN_STREAMING="MAYACHAIN_STREAMING";E.ONEINCH="ONEINCH";E.PANCAKESWAP="PANCAKESWAP";E.SUSHISWAP_V2="SUSHISWAP_V2";E.THORCHAIN="THORCHAIN";E.THORCHAIN_STREAMING="THORCHAIN_STREAMING";E.TRADERJOE_V2="TRADERJOE_V2";E.UNISWAP_V2="UNISWAP_V2";E.UNISWAP_V3="UNISWAP_V3";E.NEAR="NEAR";E.GARDEN="GARDEN";E.OKX="OKX";E.HARBOR="HARBOR";E.FLASHNET="FLASHNET";E.MAYAN="MAYAN"})(J||={});var QN;(($)=>{$.LIQUIDITY="liquidity";$.NETWORK="network";$.INBOUND="inbound";$.OUTBOUND="outbound";$.AFFILIATE="affiliate";$.TAX="tax";$.PRIORITY="priority";$.SERVICE="service"})(QN||={});var TT;((H)=>{H.Average="average";H.Fast="fast";H.Fastest="fastest"})(TT||={});var HT;((T)=>{T.Approve="approve";T.CheckOnly="checkOnly"})(HT||={});var PT;((D)=>{D.NAME_REGISTER="~";D.BOND="BOND";D.DEPOSIT="+";D.LEAVE="LEAVE";D.UNBOND="UNBOND";D.WITHDRAW="-";D.RUNEPOOL_DEPOSIT="POOL+";D.RUNEPOOL_WITHDRAW="POOL-";D.CLAIM_TCY="tcy";D.STAKE_TCY="tcy+";D.UNSTAKE_TCY="tcy-"})(PT||={});var wN;((Y)=>{Y.BITGET="BITGET";Y.BRAVE="BRAVE";Y.COINBASE_MOBILE="COINBASE_MOBILE";Y.COINBASE_WEB="COINBASE_WEB";Y.COSMOSTATION="COSMOSTATION";Y.CTRL="CTRL";Y.EIP6963="EIP6963";Y.EXODUS="EXODUS";Y.KEEPKEY="KEEPKEY";Y.KEEPKEY_BEX="KEEPKEY_BEX";Y.KEPLR="KEPLR";Y.KEYSTORE="KEYSTORE";Y.LEAP="LEAP";Y.LEDGER="LEDGER";Y.METAMASK="METAMASK";Y.OKX="OKX";Y.OKX_MOBILE="OKX_MOBILE";Y.ONEKEY="ONEKEY";Y.PASSKEYS="PASSKEYS";Y.PASSKEY_WALLET="PASSKEY_WALLET";Y.PETRA="PETRA";Y.PHANTOM="PHANTOM";Y.POLKADOT_JS="POLKADOT_JS";Y.RADIX_WALLET="RADIX_WALLET";Y.TALISMAN="TALISMAN";Y.TREZOR="TREZOR";Y.TRONLINK="TRONLINK";Y.TRUSTWALLET_WEB="TRUSTWALLET_WEB";Y.VULTISIG="VULTISIG";Y.WALLETCONNECT="WALLETCONNECT";Y.WALLET_SELECTOR="WALLET_SELECTOR";Y.XAMAN="XAMAN"})(wN||={});var LT;((H)=>{H[H.NoError=36864]="NoError";H[H.LockedDevice=21781]="LockedDevice";H[H.TC_NotFound=65535]="TC_NotFound"})(LT||={});var nT=lN.reduce((N,A)=>{if(!N.THOR_STAGENET)N[MN.Maya]=rN.rpcUrls,N[MN.THORChain]=iN.rpcUrls;return N[A]=RT(A).rpcUrls,N},{}),BT={[cN.THORChain]:uT.nodeUrl,[cN.Maya]:FT.nodeUrl,[MN.THORChain]:iN.nodeUrl,[MN.Maya]:rN.nodeUrl},sN={apiKeys:{blockchair:"",keepKey:"",passkeys:"",swapKit:"",walletConnectProjectId:"",xaman:""},chains:lN,endpoints:{},envs:{apiUrl:"https://api.swapkit.dev",devApiUrl:"https://dev-api.swapkit.dev",isDev:!1,isStagenet:!1},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"}}},localMode:{enabled:!1,quoteUrl:"http://localhost:3000",swapUrl:"http://localhost:3001"},requestOptions:{retry:{backoffMultiplier:2,baseDelay:300,maxDelay:5000,maxRetries:3},timeoutMs:30000},rpcUrls:nT,thornodeUrls:BT,v3SwapFlow:{enabled:typeof process<"u"&&process.env?.SWAPKIT_V3_SWAP_FLOW==="true"},wallets:Object.values(wN),widgetId:"",widgetKey:""},Z=IT((N)=>({...sN,setApiKey:(A,T)=>N((H)=>({apiKeys:{...H.apiKeys,[A]:T}})),setConfig:(A)=>N((T)=>({apiKeys:{...T.apiKeys,...A?.apiKeys},chains:T.chains.concat(A?.chains||[]),endpoints:{...T.endpoints,...A?.endpoints},envs:{...T.envs,...A?.envs},feeMultipliers:A?.feeMultipliers||T.feeMultipliers,integrations:{...T.integrations,...A?.integrations},localMode:{...T.localMode,...A?.localMode},rpcUrls:{...T.rpcUrls,...A?.rpcUrls},thornodeUrls:{...T.thornodeUrls,...A?.thornodeUrls},v3SwapFlow:{...T.v3SwapFlow,...A?.v3SwapFlow},wallets:T.wallets.concat(A?.wallets||[]),widgetId:A?.widgetId||T.widgetId,widgetKey:A?.widgetKey||T.widgetKey})),setEndpoint:(A,T)=>N((H)=>({endpoints:{...H.endpoints,[A]:T}})),setEnv:(A,T)=>N((H)=>({envs:{...H.envs,[A]:T}})),setFeeMultipliers:(A)=>N(()=>({feeMultipliers:A})),setIntegrationConfig:(A,T)=>N((H)=>({integrations:{...H.integrations,[A]:T}})),setRequestOptions:(A)=>N((T)=>({requestOptions:{retry:{...T.requestOptions.retry,...A.retry},timeoutMs:A.timeoutMs||T.requestOptions.timeoutMs}})),setRpcUrl:(A,T)=>N((H)=>({rpcUrls:{...H.rpcUrls,[A]:T}})),setThornodeUrl:(A,T)=>N((H)=>({thornodeUrls:{...H.thornodeUrls,[A]:T}})),setWidgetId:(A)=>N({widgetId:A}),setWidgetKey:(A)=>N({widgetKey:A})})),X={get:(N)=>Z.getState()[N],getState:Z.getState,reinitialize:()=>Z.setState(sN),set:(N)=>Z.getState().setConfig(N),setApiKey:(N,A)=>Z.getState().setApiKey(N,A),setEndpoint:(N,A)=>Z.getState().setEndpoint(N,A),setEnv:(N,A)=>Z.getState().setEnv(N,A),setFeeMultipliers:(N)=>Z.getState().setFeeMultipliers(N),setIntegrationConfig:(N,A)=>Z.getState().setIntegrationConfig(N,A),setRequestOptions:(N)=>Z.getState().setRequestOptions(N),setRpcUrl:(N,A)=>Z.getState().setRpcUrl(N,A),setThornodeUrl:(N,A)=>Z.getState().setThornodeUrl(N,A),setWidgetId:(N)=>Z.getState().setWidgetId(N),setWidgetKey:(N)=>Z.getState().setWidgetKey(N)};var OT={core_estimated_max_spendable_chain_not_supported:10001,core_extend_error:10002,core_inbound_data_not_found:10003,core_approve_asset_address_or_from_not_found:10004,core_plugin_not_found:10005,core_plugin_swap_not_found:10006,core_approve_asset_target_invalid:10007,core_explorer_unsupported_chain:10008,core_verify_message_not_supported:10009,core_chain_halted:10010,core_wallet_connection_not_found:10101,core_wallet_ctrl_not_installed:10102,core_wallet_evmwallet_not_installed:10103,core_wallet_walletconnect_not_installed:10104,core_wallet_keystore_not_installed:10105,core_wallet_ledger_not_installed:10106,core_wallet_trezor_not_installed:10107,core_wallet_keplr_not_installed:10108,core_wallet_okx_not_installed:10109,core_wallet_keepkey_not_installed:10110,core_wallet_talisman_not_installed:10111,core_wallet_not_keypair_wallet:10112,core_wallet_sign_message_not_supported:10113,core_wallet_connection_failed:10114,core_wallet_create_not_supported:10115,core_wallet_sign_typed_data_not_supported:10116,core_swap_invalid_params:10201,core_swap_route_not_complete:10202,core_swap_asset_not_recognized:10203,core_swap_contract_not_found:10204,core_swap_route_transaction_not_found:10205,core_swap_contract_not_supported:10206,core_swap_transaction_error:10207,core_swap_quote_mode_not_supported:10208,core_transaction_deposit_error:10301,core_transaction_create_liquidity_base_error:10302,core_transaction_create_liquidity_asset_error:10303,core_transaction_create_liquidity_invalid_params:10304,core_transaction_add_liquidity_invalid_params:10305,core_transaction_add_liquidity_base_address:10306,core_transaction_add_liquidity_base_error:10307,core_transaction_add_liquidity_asset_error:10308,core_transaction_withdraw_error:10309,core_transaction_deposit_to_pool_error:10310,core_transaction_deposit_insufficient_funds_error:10311,core_transaction_deposit_gas_error:10312,core_transaction_invalid_sender_address:10313,core_transaction_deposit_server_error:10314,core_transaction_user_rejected:10315,core_transaction_failed:10316,core_transaction_invalid_recipient_address:10317,wallet_connection_rejected_by_user:20001,wallet_missing_api_key:20002,wallet_chain_not_supported:20003,wallet_missing_params:20004,wallet_provider_not_found:20005,wallet_failed_to_add_or_switch_network:20006,wallet_ledger_connection_error:20101,wallet_ledger_connection_claimed:20102,wallet_ledger_get_address_error:20103,wallet_ledger_device_not_found:20104,wallet_ledger_device_locked:20105,wallet_ledger_transport_error:20106,wallet_ledger_public_key_error:20107,wallet_ledger_derivation_path_error:20108,wallet_ledger_signing_error:20109,wallet_ledger_app_not_open:20110,wallet_ledger_invalid_response:20111,wallet_ledger_method_not_supported:20112,wallet_ledger_invalid_params:20113,wallet_ledger_invalid_signature:20114,wallet_ledger_no_provider:20115,wallet_ledger_pubkey_not_found:20116,wallet_ledger_transport_not_defined:20117,wallet_ledger_webusb_not_supported:20118,wallet_ledger_chain_not_supported:20119,wallet_ledger_invalid_asset:20120,wallet_ledger_invalid_account:20121,wallet_ledger_address_not_found:20122,wallet_ledger_failed_to_get_address:20123,wallet_ledger_webhid_not_supported:20124,wallet_phantom_not_found:20201,wallet_ctrl_not_found:20301,wallet_ctrl_send_transaction_no_address:20302,wallet_ctrl_contract_address_not_provided:20303,wallet_ctrl_asset_not_defined:20304,wallet_walletconnect_project_id_not_specified:20401,wallet_walletconnect_connection_not_established:20402,wallet_walletconnect_namespace_not_supported:20403,wallet_walletconnect_chain_not_supported:20404,wallet_walletconnect_invalid_method:20405,wallet_walletconnect_method_not_supported:20406,wallet_trezor_failed_to_sign_transaction:20501,wallet_trezor_derivation_path_not_supported:20502,wallet_trezor_failed_to_get_address:20503,wallet_trezor_transport_error:20504,wallet_trezor_method_not_supported:20505,wallet_trezor_failed_to_get_public_key:20506,wallet_talisman_not_enabled:20601,wallet_talisman_not_found:20602,wallet_polkadot_not_found:20701,wallet_radix_not_found:20801,wallet_radix_transaction_failed:20802,wallet_radix_invalid_manifest:20803,wallet_radix_method_not_supported:20804,wallet_radix_no_account:20805,wallet_keepkey_not_found:20901,wallet_keepkey_asset_not_defined:20902,wallet_keepkey_contract_address_not_provided:20903,wallet_keepkey_send_transaction_no_address:20904,wallet_keepkey_derivation_path_error:20905,wallet_keepkey_signing_error:20906,wallet_keepkey_transport_error:20907,wallet_keepkey_unsupported_chain:20908,wallet_keepkey_invalid_response:20909,wallet_keepkey_chain_not_supported:20910,wallet_keepkey_signer_not_found:20911,wallet_keepkey_no_accounts:20912,wallet_keepkey_method_not_supported:20913,wallet_keepkey_invalid_params:20914,wallet_keepkey_config_not_found:20915,wallet_keepkey_no_provider:20916,wallet_keepkey_account_not_found:20917,wallet_keepkey_failed_to_get_public_key:20918,wallet_bitkeep_not_found:21001,wallet_bitkeep_failed_to_switch_network:21002,wallet_bitkeep_no_accounts:21003,wallet_passkeys_sign_transaction_error:21101,wallet_passkeys_not_found:21102,wallet_passkeys_no_address:21103,wallet_passkeys_request_canceled:21104,wallet_passkeys_signature_canceled:21105,wallet_passkeys_failed_to_switch_network:21106,wallet_passkeys_chain_not_supported:21107,wallet_passkeys_instance_missing:21108,wallet_onekey_not_found:21201,wallet_onekey_sign_transaction_error:21202,wallet_okx_not_found:21301,wallet_okx_chain_not_supported:21302,wallet_okx_failed_to_switch_network:21303,wallet_okx_no_accounts:21304,wallet_keplr_not_found:21401,wallet_keplr_chain_not_supported:21402,wallet_keplr_signer_not_found:21403,wallet_keplr_no_accounts:21404,wallet_cosmostation_not_found:21501,wallet_cosmostation_chain_not_supported:21502,wallet_cosmostation_evm_provider_not_found:21503,wallet_cosmostation_keplr_provider_not_found:21504,wallet_cosmostation_no_accounts:21505,wallet_cosmostation_no_evm_accounts:21506,wallet_cosmostation_no_evm_address:21507,wallet_cosmostation_signer_not_found:21508,wallet_passkey_not_supported:21601,wallet_passkey_connection_failed:21602,wallet_coinbase_not_found:21701,wallet_coinbase_chain_not_supported:21702,wallet_coinbase_method_not_supported:21703,wallet_coinbase_no_accounts:21704,wallet_evm_extensions_failed_to_switch_network:21801,wallet_evm_extensions_no_provider:21802,wallet_evm_extensions_not_found:21803,wallet_keystore_invalid_password:21901,wallet_keystore_unsupported_version:21902,wallet_near_extensions_failed_to_switch_network:22001,wallet_near_extensions_no_provider:22002,wallet_near_extensions_not_found:22003,wallet_near_method_not_supported:22004,wallet_petra_not_found:22201,wallet_vultisig_not_found:22101,wallet_vultisig_contract_address_not_provided:22102,wallet_vultisig_asset_not_defined:22103,wallet_vultisig_send_transaction_no_address:22104,wallet_xaman_not_configured:23001,wallet_xaman_not_connected:23002,wallet_xaman_auth_failed:23003,wallet_xaman_connection_failed:23004,wallet_xaman_transaction_failed:23005,wallet_xaman_monitoring_failed:23006,wallet_tronlink_request_accounts_failed:24001,wallet_tronlink_locked:24002,chainflip_channel_error:30001,chainflip_unknown_asset:30002,chainflip_broker_invalid_params:30101,chainflip_broker_recipient_error:30102,chainflip_broker_register:30103,chainflip_broker_tx_error:30104,chainflip_broker_withdraw:30105,chainflip_broker_fund_only_flip_supported:30106,chainflip_broker_fund_invalid_address:30107,thorchain_chain_halted:40001,thorchain_trading_halted:40002,thorchain_asset_is_not_tcy:40003,thorchain_swapin_router_required:40101,thorchain_swapin_vault_required:40102,thorchain_swapin_memo_required:40103,thorchain_swapin_token_required:40104,thorchain_preferred_asset_payout_required:40105,toolbox_cosmos_account_not_found:50101,toolbox_cosmos_invalid_fee:50102,toolbox_cosmos_invalid_params:50103,toolbox_cosmos_no_signer:50104,toolbox_cosmos_not_supported:50105,toolbox_cosmos_signer_not_defined:50106,toolbox_cosmos_validate_address_prefix_not_found:50107,toolbox_cosmos_verify_signature_no_pubkey:50108,toolbox_evm_error_estimating_gas_limit:50201,toolbox_evm_error_sending_transaction:50202,toolbox_evm_gas_estimation_error:50203,toolbox_evm_invalid_gas_asset_address:50204,toolbox_evm_invalid_params:50205,toolbox_evm_invalid_transaction:50206,toolbox_evm_no_abi_fragment:50207,toolbox_evm_no_contract_address:50208,toolbox_evm_no_fee_data:50209,toolbox_evm_no_from_address:50210,toolbox_evm_no_gas_price:50211,toolbox_evm_no_signer_address:50212,toolbox_evm_no_signer:50213,toolbox_evm_no_to_address:50214,toolbox_evm_not_supported:50215,toolbox_evm_provider_not_eip1193_compatible:50216,toolbox_evm_invalid_eip7702_authorization:50217,toolbox_utxo_api_error:50301,toolbox_utxo_broadcast_failed:50302,toolbox_utxo_insufficient_balance:50303,toolbox_utxo_invalid_address:50304,toolbox_utxo_invalid_params:50305,toolbox_utxo_invalid_transaction:50306,toolbox_utxo_no_signer:50307,toolbox_utxo_not_supported:50308,toolbox_utxo_tx_not_found:50309,toolbox_utxo_rbf_not_supported:50310,toolbox_utxo_tx_not_replaceable:50311,toolbox_utxo_tx_already_confirmed:50312,toolbox_utxo_rbf_fee_too_low:50313,toolbox_utxo_rbf_insufficient_change:50314,toolbox_solana_no_signer:50401,toolbox_substrate_not_supported:50501,toolbox_substrate_transfer_error:50502,toolbox_radix_method_not_supported:50601,toolbox_ripple_get_balance_error:50701,toolbox_ripple_rpc_not_configured:50702,toolbox_ripple_signer_not_found:50703,toolbox_ripple_asset_not_supported:50704,toolbox_ripple_broadcast_error:50705,toolbox_ripple_get_trust_lines_error:50706,toolbox_ripple_invalid_trust_line_limit:50707,toolbox_tron_no_signer:50801,toolbox_tron_invalid_token_identifier:50802,toolbox_tron_token_transfer_failed:50803,toolbox_tron_transaction_creation_failed:50804,toolbox_tron_trongrid_api_error:50805,toolbox_tron_approve_failed:50806,toolbox_tron_invalid_token_contract:50807,toolbox_tron_allowance_check_failed:50808,toolbox_tron_invalid_transaction_integrity:50809,toolbox_tron_broadcast_failed:50810,toolbox_hypercore_no_signer:51001,toolbox_cardano_sign_transaction_failed:50901,toolbox_near_no_signer:90601,toolbox_near_invalid_address:90602,toolbox_near_invalid_amount:90603,toolbox_near_transfer_failed:90604,toolbox_near_access_key_error:90605,toolbox_near_no_rpc_url:90606,toolbox_near_empty_batch:90607,toolbox_near_balance_failed:90608,toolbox_near_invalid_name:90609,toolbox_near_missing_contract_address:90610,toolbox_near_no_account:90611,toolbox_near_invalid_gas_params:90612,toolbox_near_no_public_key_found:90613,toolbox_near_sign_transaction_failed:90614,toolbox_sui_address_required:90701,toolbox_sui_keypair_required:90702,toolbox_sui_balance_error:90703,toolbox_sui_transaction_creation_error:90704,toolbox_sui_signing_error:90705,toolbox_sui_broadcast_error:90706,toolbox_sui_no_signer:90707,toolbox_sui_no_sender:90708,toolbox_sui_missing_coin_type:90709,toolbox_sui_no_coins_found:90710,toolbox_sui_insufficient_balance:90711,toolbox_starknet_no_signer:90801,toolbox_starknet_invalid_address:90802,toolbox_starknet_fee_estimation_failed:90803,toolbox_starknet_account_not_deployed:90804,toolbox_starknet_transaction_failed:90805,toolbox_ton_no_signer:90901,toolbox_ton_invalid_address:90902,toolbox_ton_missing_jetton_address:90903,toolbox_ton_jetton_transfer_failed:90904,toolbox_ton_transaction_failed:90905,toolbox_aptos_address_required:91001,toolbox_aptos_keypair_required:91002,toolbox_aptos_balance_error:91003,toolbox_aptos_transaction_creation_error:91004,toolbox_aptos_signing_error:91005,toolbox_aptos_broadcast_error:91006,toolbox_aptos_no_signer:91007,toolbox_aptos_no_sender:91008,toolbox_aptos_missing_asset_type:91009,toolbox_aptos_insufficient_balance:91010,toolbox_stellar_no_signer:91101,toolbox_stellar_broadcast_error:91102,toolbox_stellar_invalid_address:91103,toolbox_stellar_account_not_found:91104,toolbox_stellar_transaction_failed:91105,toolbox_stellar_balance_error:91106,toolbox_not_supported:59901,toolbox_fee_estimation_failed:59902,plugin_near_invalid_name:41001,plugin_near_no_connection:41002,plugin_near_name_unavailable:41003,plugin_near_registration_failed:41004,plugin_near_transfer_failed:41005,plugin_garden_missing_data:42001,plugin_swapkit_swap_invalid_data:43001,plugin_swapkit_invalid_transaction:43002,api_v2_invalid_response:60001,api_v2_server_error:60002,api_v2_invalid_method_key_hash:60003,helpers_invalid_number_different_decimals:70001,helpers_invalid_number_of_years:70002,helpers_invalid_identifier:70003,helpers_invalid_asset_url:70004,helpers_invalid_asset_identifier:70005,helpers_invalid_memo_type:70006,helpers_failed_to_switch_network:70007,helpers_not_found_provider:70008,helpers_chain_not_supported:70009,helpers_invalid_params:70010,helpers_invalid_response:70011,helpers_chain_no_public_or_set_rpc_url:70012,helpers_chain_rpc_connection_failed:70013,mcp_wallet_not_configured:90001,not_implemented:99999};function zN(N){return JSON.stringify(N,(A,T)=>typeof T==="bigint"?T.toString():T)}class g extends Error{static ErrorCode=OT;errorKey;info;constructor(N,A){let T=typeof N==="string",H=T?N:N.errorKey,P=T?void 0:N.info,F=`${H}${P?`: ${zN(P)}`:""}`;super(F);if(Object.setPrototypeOf(this,g.prototype),this.name="SwapKitError",this.errorKey=H,this.info=P,this.cause=A,A){let I=A instanceof Error?`${A.message}${A.cause?` (${A.cause})`:""}`:zN(A);console.error(`SwapKitError [${H}]: ${I}`)}else if(P)console.error(`SwapKitError [${H}]: ${zN(P)}`)}}var $T=(N)=>new Promise((A)=>setTimeout(A,N)),GT=(N,{baseDelay:A,backoffMultiplier:T,maxDelay:H})=>Math.min(A*T**N,H);function MT(N,A){if(N instanceof Error&&N.name==="AbortError")return!0;if(N instanceof TypeError)return!0;if(A===429)return!0;if(A&&A>=500&&A<600)return!0;return!1}var _T=async(N,A)=>{let T=await fetch(N,A),H;try{H=await T.json()}catch{if(!T.ok)throw new g({errorKey:"helpers_invalid_response",info:{status:T.status,statusText:T.statusText}},{status:T.status,statusText:T.statusText});return{}}if(!T.ok){let F={data:H?.data,error:H?.error,message:H?.message,status:T.status};throw new g({errorKey:H?.error||"helpers_invalid_response",info:F},F)}let P=H?.routes?.length||H?.result||H?.data&&!H?.error;if(H?.error&&!P){let F={data:H.data,error:H.error,message:H.message,status:T.status};throw new g({errorKey:H.error,info:F},F)}if(H?.providerErrors?.length||H?.error&&P)console.warn("[SwapKit] Partial errors in response:",H.providerErrors||H.error);return H};function _N(N,A={}){return async function(H,P={}){let{searchParams:F,json:I,body:O,headers:$,dynamicHeader:S,retry:x,timeoutMs:D,abortController:v,onError:U,onSuccess:k,responseHandler:Q,...w}={...A,...P},HN=X.get("requestOptions"),d={...HN.retry,...x},E=!!I||H.endsWith(".json"),$N=DT(H,F),fN=S?await S():{},PN=gT(E,{...$,...fN}),c=E?JSON.stringify(I):O,bN;for(let GN=0;GN<=d.maxRetries;GN++){let CN=v||new AbortController,hN=setTimeout(()=>CN.abort(),D||HN.timeoutMs);try{let m=await _T($N,{...w,body:c,headers:PN,method:N,signal:CN.signal});return clearTimeout(hN),k?.(m)||Q?.(m)||m}catch(m){clearTimeout(hN),bN=m;let iA=m?.cause?.status;if(GN>=d.maxRetries||!MT(m,iA))return U?U(m):Promise.reject(m);await $T(GT(GN,d))}}return U?U(bN):Promise.reject(bN)}}function gT(N,A){return{...A,...N&&{"Content-Type":"application/json"}}}function DT(N,A){let T=new URL(N);if(A)T.search=new URLSearchParams(A).toString();return T.toString()}var M={extend:(N)=>({extend:(A)=>M.extend({...N,...A}),get:_N("GET",N),post:_N("POST",N)}),get:_N("GET"),post:_N("POST")};import{Chain as z,CosmosChains as YT,EVMChains as ST,StagenetChains as UT,UTXOChains as XT}from"@swapkit/types";import{match as AA}from"ts-pattern";import{Chain as JN}from"@swapkit/types";function rP(N){if(N<0)throw new g({errorKey:"helpers_invalid_number_of_years",info:{numberOfYears:N}});return 10+N}function iP(N){if(N<0)throw new g({errorKey:"helpers_invalid_number_of_years",info:{numberOfYears:N}});return Math.round((10+N*1.0512)*10000000000)/10000000000}function sP(N,A){try{return N()}catch(T){if(A)throw new g(A,T);return}}function eP(N){switch(N){case JN.THORChain:return`${N}.RUNE`;case JN.Cosmos:return`${N}.ATOM`;case JN.BinanceSmartChain:return`${N}`;default:return`${N}.${N}`}}var eN=new Set;function l({condition:N,id:A,warning:T}){if(N){if(eN.has(A))return;console.warn(T),eN.add(A)}}function tT(N){return AA(N).with(...ST,()=>({id:1,jsonrpc:"2.0",method:"eth_blockNumber",params:[]})).with(...XT,()=>({id:"test",jsonrpc:"1.0",method:"getblockchaininfo",params:[]})).with(...YT,...UT,()=>({id:1,jsonrpc:"2.0",method:"status",params:{}})).with(z.Polkadot,z.Chainflip,()=>({id:1,jsonrpc:"2.0",method:"system_health",params:[]})).with(z.Solana,()=>({id:1,jsonrpc:"2.0",method:"getHealth"})).with(z.Sui,()=>({id:1,jsonrpc:"2.0",method:"sui_getSystemState",params:[]})).with(z.Ton,()=>({id:1,jsonrpc:"2.0",method:"getAddressInformation",params:{address:""}})).with(z.Aptos,z.Tron,z.Radix,z.Stellar,()=>"").with(z.Hype,()=>({type:"meta"})).with(z.Near,()=>({id:"dontcare",jsonrpc:"2.0",method:"status",params:[]})).with(z.Ripple,()=>({id:1,jsonrpc:"2.0",method:"ping",params:[{}]})).with(z.Starknet,()=>({id:1,jsonrpc:"2.0",method:"starknet_chainId",params:[]})).otherwise(()=>{throw new g("helpers_chain_not_supported",{chain:N})})}function aN(N){return AA(N).with(z.Aptos,()=>"/-/healthy").with(z.Hype,()=>"/info").with(z.Radix,()=>"/status/network-configuration").with(z.Stellar,()=>"").with(z.Tron,()=>"/wallet/getnowblock").otherwise(()=>"")}async function NA(N,A){try{let T=A.startsWith("wss")?A.replace("wss","https"):A;if(N===z.Stellar)return(await fetch(`${T}${aN(N)}`,{cache:"no-store",method:"GET",signal:AbortSignal.timeout(3000)})).ok;return(await fetch(`${T}${aN(N)}`,{body:JSON.stringify(tT(N)),cache:"no-store",headers:{"Content-Type":"application/json"},method:"POST",signal:AbortSignal.timeout(3000)})).ok}catch{return!1}}var ZN=new Map,ET=120000;function bT(N){let[A=""]=X.get("rpcUrls")[N];if(!A)throw l({condition:!0,id:"helpers_chain_no_public_or_set_rpc_url",warning:`No public or set RPC URL found for chain. Please ensure you configured rpcUrls for ${N}.`}),new g("helpers_chain_no_public_or_set_rpc_url",{chain:N});let T=ZN.get(N);if(T&&Date.now()-T.timestamp<ET)return T.url;return ZN.set(N,{timestamp:Date.now(),url:A}),A}async function r(N){let A=bT(N),[,...T]=X.get("rpcUrls")[N];if(await NA(N,A))return A;for(let P of T)if(await NA(N,P))return ZN.set(N,{timestamp:Date.now(),url:P}),P;throw new g("helpers_chain_rpc_connection_failed",{chain:N,fallbackUrls:T,primaryRpcUrl:A})}function LL(N){l({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 BL=[`${n.Maya}.MAYA`,`${n.Maya}.CACAO`,`${n.Ethereum}.THOR`,`${n.Ethereum}.vTHOR`,`${n.Kujira}.USK`,`${n.Ethereum}.FLIP`,`${n.Radix}.XRD`],PA=[n.Arbitrum,n.Aurora,n.Base,n.Ethereum,n.Optimism];async function wT(N){let{baseDecimal:A}=o(n.Radix);try{let T=await r(n.Radix),{manager:H}=await M.post(`${T}/state/resource`,{body:JSON.stringify({network:"mainnet",resource_address:N}),headers:{Accept:"*/*","Content-Type":"application/json"}});return H?.divisibility?.value?.divisibility}catch(T){let H=T instanceof Error?T.message:String(T);return console.warn(`Failed to fetch Radix asset decimals for ${N}: ${H}`),A}}async function zT(N){try{let A=await r(n.Radix);return(await M.post(`${A}/state/entity/details`,{body:JSON.stringify({addresses:[N],opt_ins:{explicit_metadata:["symbol"]}}),headers:{Accept:"*/*","Content-Type":"application/json"}})).items[0]?.explicit_metadata?.items.find((P)=>P.key==="symbol")?.value.typed.value||void 0}catch(A){let T=A instanceof Error?A.message:String(A);return console.warn(`Failed to fetch Radix asset symbol for ${N}: ${T}`),""}}async function LA({chain:N,address:A,methodHex:T,id:H}){let P=await r(N);return M.post(P,{body:JSON.stringify({id:H,jsonrpc:"2.0",method:"eth_call",params:[{data:T,to:A.toLowerCase()},"latest"]}),headers:{accept:"*/*","cache-control":"no-cache","content-type":"application/json"}})}async function JT(N){if(!N||N==="0x")return"UNKNOWN";try{let{AbiCoder:A}=await import("ethers");return A.defaultAbiCoder().decode(["string"],N)[0].trim()}catch(A){return console.warn(`Failed to decode ABI string from ${N}: ${A}`),"UNKNOWN"}}function ZT(N,A){if(!N||N==="0x")return A;try{return Number(N)}catch(T){return console.warn(`Failed to decode ABI uint8 from ${N}: ${T}`),A}}async function WT({chain:N,address:A}){let{baseDecimal:T}=o(N),H=A.toLowerCase();if(A===""||!H.startsWith("0x"))return T;let P=await LA({address:A,chain:N,id:2,methodHex:"0x313ce567"}).catch((I)=>{return console.warn(`Could not fetch decimals for ${A} on ${N}: ${I.message}`),{result:""}});return ZT(P.result,T)}async function jT({chain:N,address:A}){let T=A.toLowerCase();if(T===""||!T.startsWith("0x"))return;let H=await LA({address:A,chain:N,id:1,methodHex:"0x95d89b41"}).catch((F)=>{return console.warn(`Could not fetch symbol for ${A} on ${N}: ${F.message}`),{result:""}});return await JT(H.result)}async function TA({rpcUrl:N,contractAddress:A,functionSelector:T}){return(await M.post(`${N}/wallet/triggerconstantcontract`,{body:JSON.stringify({contract_address:A,function_selector:T,owner_address:A,parameter:"",visible:!0}),headers:{accept:"application/json","content-type":"application/json"}}).catch(()=>{return}))?.constant_result?.[0]}function HA(N){let A=N.match(/.{2}/g)?.map((T)=>Number.parseInt(T,16))??[];return new TextDecoder().decode(new Uint8Array(A))}function VT(N){return FN(N).with(void 0,()=>{return}).when((A)=>A.length>=128,(A)=>{let T=Number.parseInt(A.slice(64,128),16);return HA(A.slice(128,128+T*2))}).when((A)=>A.length===64,(A)=>{let T=A.replace(/0+$/,"");if(T.length>0&&T.length%2===0)return HA(T);return}).otherwise(()=>{return})}function RA({chain:N,address:A}){let{baseDecimal:T}=o(N),H={decimals:T,ticker:void 0};return FN(N).with(...xT,async()=>{try{let{isAddress:P,getAddress:F}=await import("ethers");if(!P(F(A.replace(/^0X/,"0x"))))return H;let[I,O]=await Promise.all([jT({address:A,chain:N}),WT({address:A,chain:N})]);return{decimals:O,ticker:I}}catch(P){return console.warn(`Failed to fetch token info for ${A} on ${N}: ${P?.code} ${P?.message}`),H}}).with(n.Solana,async()=>{if(!A)return H;try{let P=await fetch(`https://lite-api.jup.ag/tokens/v2/search?query=${A}`);if(P.ok){let F=await P.json(),I=Array.isArray(F)?F[0]:F;if(I)return{decimals:I.decimals??T,ticker:I.symbol||void 0}}}catch(P){console.warn(`Failed to fetch Solana token info for ${A}: ${P?.code} ${P?.message}`)}return H}).with(n.Tron,async()=>{if(!A)return H;try{let P=await r(n.Tron),[F,I]=await Promise.all([TA({contractAddress:A,functionSelector:"symbol()",rpcUrl:P}),TA({contractAddress:A,functionSelector:"decimals()",rpcUrl:P})]),O=VT(F);return{decimals:F!==void 0&&I?Number(BigInt(`0x${I}`)):T,ticker:O}}catch(P){let F=P instanceof Error?P.message:String(P);return console.warn(`Failed to fetch Tron token info for ${A}: ${F}`),H}}).with(n.Near,async()=>{if(!A)return H;try{let{JsonRpcProvider:P}=await import("@near-js/providers"),F=await r(n.Near),O=await new P({url:F}).query({account_id:A,args_base64:Buffer.from("{}").toString("base64"),finality:"final",method_name:"ft_metadata",request_type:"call_function"}),$=JSON.parse(Buffer.from(O.result).toString());return{decimals:$?.decimals||T,ticker:$?.symbol}}catch(P){let F=P instanceof Error?P.message:String(P);return console.warn(`Failed to fetch Near token info for ${A}: ${F}`),H}}).with(n.Radix,async()=>{if(!A)return H;try{let[P,F]=await Promise.all([zT(A),wT(A)]);return{decimals:F,ticker:P}}catch(P){let F=P instanceof Error?P.message:String(P);return console.warn(`Failed to fetch Radix token info for ${A}: ${F}`),H}}).otherwise(async()=>H)}function FA({chain:N,symbol:A}){return FN(N).with(...PA,()=>A==="ETH").with(n.Avalanche,()=>A==="AVAX").with(n.Berachain,()=>A==="BERA").with(n.Hyperevm,()=>A==="HYPE").with(n.Hype,()=>A==="HYPE").with(n.Spark,()=>A==="BTC").with(n.BinanceSmartChain,()=>A==="BNB").with(n.Gnosis,()=>A==="xDAI"||A==="XDAI").with(n.Monad,()=>A==="MON").with(n.XLayer,()=>A==="OKB").with(n.Maya,()=>A==="CACAO").with(n.Cosmos,()=>A==="ATOM").with(n.THORChain,()=>A==="RUNE").with(n.Tron,()=>A==="TRX").with(n.Ripple,()=>A==="XRP").with(n.Radix,()=>`${N}.${A}`===gN(N).identifier).otherwise(()=>A===N)}var gN=(N)=>{let{baseDecimal:A}=o(N);return FN(N.toUpperCase()).with(...PA,(H)=>({decimal:A,identifier:`${H}.ETH`})).with(n.THORChain,(H)=>({decimal:A,identifier:`${H}.RUNE`})).with(n.Cosmos,(H)=>({decimal:A,identifier:`${H}.ATOM`})).with(n.Maya,(H)=>({decimal:10,identifier:`${H}.CACAO`})).with(n.BinanceSmartChain,(H)=>({decimal:A,identifier:`${H}.BNB`})).with(n.Monad,(H)=>({decimal:A,identifier:`${H}.MON`})).with(n.Avalanche,(H)=>({decimal:A,identifier:`${H}.AVAX`})).with(n.Gnosis,(H)=>({decimal:A,identifier:`${H}.xDAI`})).with(n.XLayer,(H)=>({decimal:A,identifier:`${H}.OKB`})).with(n.Berachain,(H)=>({decimal:A,identifier:`${H}.BERA`})).with(n.Hyperevm,(H)=>({decimal:A,identifier:`${H}.HYPE`})).with(n.Hype,(H)=>({decimal:A,identifier:`${H}.HYPE`})).with(n.Spark,(H)=>({decimal:A,identifier:`${H}.BTC`})).with(n.Tron,(H)=>({decimal:A,identifier:`${H}.TRX`})).with(n.Solana,n.Chainflip,n.Kujira,n.Ripple,n.Polkadot,n.Near,...QT,(H)=>({decimal:A,identifier:`${H}.${H}`})).with(n.Radix,"XRD.XRD",()=>({decimal:A,identifier:"XRD.XRD"})).with(n.Polygon,"POL.POL",()=>({decimal:A,identifier:"POL.POL"})).with("KUJI.USK",(H)=>({decimal:6,identifier:H})).with("ETH.FLIP",()=>({decimal:o(n.Ethereum).baseDecimal,identifier:"ETH.FLIP-0x826180541412D574cf1336d22c0C0a287822678A"})).with("ETH.THOR",()=>({decimal:o(n.Ethereum).baseDecimal,identifier:"ETH.THOR-0xa5f2211b9b8170f694421f2046281775e8468044"})).with("ETH.vTHOR",()=>({decimal:o(n.Ethereum).baseDecimal,identifier:"ETH.vTHOR-0x815c23eca83261b6ec689b60cc4a58b54bc24d8d"})).with("MAYA.CACAO",(H)=>({decimal:10,identifier:H})).with("MAYA.MAYA",(H)=>({decimal:4,identifier:H})).otherwise(()=>({decimal:A,identifier:N}))};function WN({chain:N,symbol:A}){if(A.includes("/"))return"Synth";if(A.includes("~"))return"Trade";return FN(N).with(n.Radix,()=>A===n.Radix||`${N}.${A}`===gN(N).identifier).with(n.Arbitrum,n.Optimism,n.Base,n.Aurora,()=>A===n.Ethereum).with(n.Cosmos,()=>A==="ATOM").with(n.BinanceSmartChain,()=>A==="BNB").with(n.Maya,()=>A==="CACAO").with(n.Monad,()=>A==="MON").with(n.THORChain,()=>A==="RUNE").with(n.Tron,()=>A==="TRX").with(n.Hyperevm,()=>A==="HYPE").with(n.Hype,()=>A==="HYPE").with(n.Spark,()=>A==="BTC").with(n.XLayer,()=>A==="OKB").otherwise(()=>A===N)?"Native":N}var f=(N)=>{let[A,...T]=N.split("."),H=N.includes("/"),P=T.join("."),F=P?.split("-"),I=F?.length?F.length===1?F[0]:F.slice(0,-1).join("-"):void 0;return{chain:A,symbol:P,synth:H,ticker:I}};function uN(N,A){let H=A===n.Near?N.indexOf("-"):N.lastIndexOf("-");if(H===-1)return{address:void 0,ticker:N};return{address:N.slice(H+1),ticker:N.slice(0,H)}}function OL(N){return`https://storage.googleapis.com/token-list-swapkit-dev/images/${N.toLowerCase()}.png`}async function $L(N){let{loadTokenLists:A}=await import("./tokens.js"),T=await A(),H=Object.values(T).flatMap((F)=>F.tokens);if("identifier"in N)return H.find((F)=>F.identifier===N.identifier)?.identifier;let P=N.contract.toLowerCase();for(let F of H){let{chain:I,symbol:O}=f(F.identifier);if(I!==N.chain)continue;let{address:$}=uN(O,I);if($?.toLowerCase()===P)return F.identifier}return}var uA=["TERRA",...X.get("chains")];function IA(N=""){let A=N.toUpperCase(),[T]=A.split(".");if(uA.includes(T))return!0;let[H]=A.split("/");if(uA.includes(H))return!0;throw new g({errorKey:"helpers_invalid_identifier",info:{identifier:N,message:`Invalid identifier: ${N}. Expected format: <Chain>.<Ticker> or <Chain>.<Ticker>-<ContractAddress>`}})}function gL(N){if(N.length>30)return!1;let A=/^[a-zA-Z0-9+_-]+$/g;return!!N.match(A)}import{match as DN}from"ts-pattern";var i=8,vT=10;function h({value:N,bigIntDecimal:A=i,decimal:T=i}){if(T===0)return N.toString();let H=N<0n,P=N.toString().substring(H?1:0),F=T-(P.length-1);if(F>0)P="0".repeat(F)+P;let I=P.length-T,O=P.slice(-T);if(Number.parseInt(O[A]||"0",10)>=5){let S=Number.parseInt(O[A-1]||"0",10);O=`${O.substring(0,A-1)}${S+1}`}else O=O.substring(0,A);return`${H?"-":""}${P.slice(0,I)}.${O}`.replace(/\.?0*$/,"")}class y{decimalMultiplier=10n**8n;bigIntValue=0n;decimal;static fromBigInt(N,A){return new y({decimal:A,value:h({bigIntDecimal:A,decimal:A,value:N})})}static shiftDecimals({value:N,from:A,to:T}){return y.fromBigInt(N.getBaseValue("bigint")*C(T)/C(A),T)}constructor(N){let A=jN(N),T=typeof N==="object";this.decimal=T?N.decimal:void 0,this.decimalMultiplier=T&&"decimalMultiplier"in N?N.decimalMultiplier:C(Math.max(nA(YN(A)),this.decimal||0)),this.#P(A)}set(N){return new this.constructor({decimal:this.decimal,identifier:this.toString?.({includeSynthProtocol:!0}),value:N})}add(...N){return this.#A("add",...N)}sub(...N){return this.#A("sub",...N)}mul(...N){return this.#A("mul",...N)}div(...N){return this.#A("div",...N)}gt(N){return this.#N("gt",N)}gte(N){return this.#N("gte",N)}lt(N){return this.#N("lt",N)}lte(N){return this.#N("lte",N)}eqValue(N){return this.#N("eqValue",N)}getValue(N,A){let T=IN(this.decimalMultiplier),H=A!==void 0?A:this.decimal,P=H!==void 0?H:T;if(H!==void 0&&H<T){if(this.formatBigIntToSafeValue(this.bigIntValue,H)==="0"&&this.bigIntValue!==0n)P=T}let F=this.formatBigIntToSafeValue(this.bigIntValue,P);return DN(N).with("number",()=>Number(F)).with("string",()=>F).with("bigint",()=>{return this.bigIntValue*10n**BigInt(this.decimal||8n)/this.decimalMultiplier}).otherwise(()=>F)}getBaseValue(N,A){let T=this.decimalMultiplier/C(A||this.decimal||i),H=kT(this.bigIntValue,T);return DN(N).with("number",()=>Number(H)).with("string",()=>H.toString()).otherwise(()=>H)}getBigIntValue(N,A){if(!A&&typeof N==="object")return N.bigIntValue;let T=jN(N),H=YN(T);if(H==="0"||H==="undefined")return 0n;return this.#H(H,A)}toSignificant(N=6){let A=this.getValue("string"),[T="",H=""]=A.split("."),P=Number.parseInt(T,10)>0;if((P?T.length+H.length:H.length)<=N)return A;if(T.length>=N)return T.slice(0,N).padEnd(T.length,"0");if(P)return`${T}.${H.slice(0,N-T.length)}`;let I=Number.parseInt(H,10).toString(),O=I.slice(0,N),$=H.length-I.length;return`0.${O.padStart($+O.length,"0")}`}toFixed(N=6){let A=this.getValue("string"),T=A.startsWith("-"),[H="0",P=""]=(T?A.slice(1):A).split("."),F=H==="0"&&Number.parseInt(P.slice(0,N),10)===0,I=T&&!F?"-":"";if(N===0){if(H==="0"&&!P)return"0";return P&&Number.parseInt(P[0]||"0",10)>=5?`${I}${BigInt(H)+1n}.0`:`${I}${H}.0`}if(!P)return`${I}${H}.${"0".repeat(N)}`;let O=P[N];if(!(O&&Number.parseInt(O,10)>=5))return`${I}${H}.${P.slice(0,N).padEnd(N,"0")}`;let S=BigInt(P.slice(0,N).padEnd(N,"0"))+1n,x=10n**BigInt(N);if(S>=x)return`${I}${BigInt(H)+1n}.${"0".repeat(N)}`;return`${I}${H}.${S.toString().padStart(N,"0")}`}toAbbreviation(N=2){let A=this.getValue("string"),T=Number(A),H=["","K","M","B","T","Q","Qi","S"],P=Math.floor(Math.log10(Math.abs(T))/3);if(P===0||!H[P])return A;return`${(T/10**(P*3)).toFixed(N)}${H[P]}`}toCurrency(N="$",{currencyPosition:A="start",decimal:T=2,decimalSeparator:H=".",thousandSeparator:P=",",trimTrailingZeros:F=!0}={}){let I=this.toFixed(T),O=A==="end",[$="0",S=""]=I.split("."),x=$.replace(/\B(?=(\d{3})+(?!\d))/g,P),D=S&&Number.parseInt(S,10)>0,v=D?`${x}${H}${S}`:x,k=v.length<100&&F&&D?v.replace(/\.?0*$/,""):v;return O?`${k}${N}`:`${N}${k}`}formatBigIntToSafeValue(N,A){let T=A||this.decimal||i,H=Math.max(T,IN(this.decimalMultiplier));return h({bigIntDecimal:T,decimal:H,value:N})}#A(N,...A){let T=this.#T(this,...A),H=IN(this.decimalMultiplier),F=Math.max(T,H)+vT,I=C(F),O=A.reduce((S,x)=>{let D=this.getBigIntValue(x,F);return DN(N).with("add",()=>S+D).with("sub",()=>S-D).with("mul",()=>S*D/I).with("div",()=>{if(D===0n)throw RangeError("Division by zero");return S*I/D}).otherwise(()=>S)},this.bigIntValue*I/this.decimalMultiplier),$=h({bigIntDecimal:F,decimal:F,value:O});return new this.constructor({decimal:this.decimal,decimalMultiplier:C(F),identifier:this.toString(),value:$})}#N(N,...A){let T=this.#T(this,...A),H=this.getBigIntValue(A[0]||"0",T),P=this.getBigIntValue(this,T);return DN(N).with("gt",()=>P>H).with("gte",()=>P>=H).with("lt",()=>P<H).with("lte",()=>P<=H).with("eqValue",()=>P===H).otherwise(()=>!1)}#P(N){let A=YN(N)||"0";this.bigIntValue=this.#H(A)}#T(...N){let A=N.map((T)=>{return typeof T==="object"?T.decimal||IN(T.decimalMultiplier):nA(YN(T))}).filter(Boolean);return Math.max(...A,i)}#H(N,A){let T=A?C(A):this.decimalMultiplier,H=IN(T),[P="",F=""]=N.split(".");return BigInt(`${P}${F.padEnd(H,"0")}`)}}var qT=Intl.NumberFormat("fullwide",{maximumFractionDigits:20,useGrouping:!1});function YN(N){let T=`${typeof N==="number"?qT.format(N):jN(N)}`.replaceAll(",",".").split(".");return T.length>1?`${T.slice(0,-1).join("")}.${T.at(-1)}`:T[0]||"0"}function nA(N){let A=N.split(".")[1]?.length||0;return Math.max(A,i)}function jN(N){return typeof N==="object"?"getValue"in N?N.getValue("string"):N.value:N}function kT(N,A){if(A===0n)throw Error("Cannot divide by zero");let T=A/2n;return N>=0n&&A>=0n||N<0n&&A<0n?(N+T)/A:(N-T)/A}function C(N){return 10n**BigInt(N)}function IN(N){return Math.log10(Number.parseFloat(N.toString()))}var p=[b.Hype,b.Near,b.Ripple,b.Solana,b.Sui,b.Ton,b.Tron],qN=[b.THORChain,b.Maya],s=new Map,SN=new Map,e=new Map,yT=3600000;function pT(N){let A=e.get(N);if(A?.timestamp&&Date.now()-A.timestamp>yT){e.delete(N);return}return A}function oT(N,A){if(e.size>1000){let T=e.keys().next().value;if(T)e.delete(T)}e.set(N,{...A,timestamp:Date.now()})}class W extends y{address;chain;isGasAsset=!1;isSynthetic=!1;isTradeAsset=!1;symbol;tax;ticker;type;chainId;constructor({value:N,decimal:A,tax:T,chain:H,symbol:P,identifier:F}){super(typeof N==="object"?N:{decimal:A,value:N});let I=OA(F||`${H}.${P}`);this.type=WN(I),this.tax=T,this.chain=I.chain,this.ticker=I.ticker,this.symbol=I.symbol,this.address=I.address,this.isSynthetic=I.isSynthetic,this.isTradeAsset=I.isTradeAsset,this.isGasAsset=I.isGasAsset,this.chainId=nN(I.chain).chainId}toString({includeSynthProtocol:N}={}){return(this.isSynthetic||this.isTradeAsset)&&!N?this.symbol:`${this.chain}.${this.symbol}`}toUrl(){if(this.isSynthetic)return`${this.chain}.${this.symbol.replace(/\//g,".")}`;if(this.isTradeAsset)return`${this.chain}.${this.symbol.replace(/~/g,"..")}`;let N=this.symbol.replace(/\./g,"__");return`${this.chain}.${N}`}getIconUrl(){return s.get(this.toString())?.logoURI}eqAsset({chain:N,symbol:A}){return this.chain===N&&this.symbol===A}eq(N){return this.eqAsset(N)&&this.eqValue(N)}static fromUrl(N,A=0){let T=N.indexOf(".");if(T===-1)throw new g({errorKey:"helpers_invalid_asset_url",info:{urlAsset:N}});let H=N.slice(0,T),P=N.slice(T+1),F=vN({chain:H,rest:P}).when(({rest:I})=>I.includes(".."),({chain:I,rest:O})=>`${I}.${O.replace(/\.\./g,"~")}`).when(({chain:I,rest:O})=>qN.includes(I)&&O.includes("."),({chain:I,rest:O})=>`${I}.${O.replace(/\./g,"/")}`).otherwise(({chain:I,rest:O})=>`${I}.${O.replace(/__/g,".")}`);return W.from({asset:F,value:A})}static from({value:N=0,fromBaseDecimal:A,asyncTokenLookup:T,...H}){let P=N instanceof y?N.getValue("string"):N,F="address"in H&&"chain"in H,I=dT(H);if(I===null&&T&&F){let{chain:PN,address:c}=H;return CT({address:c,chain:PN,fromBaseDecimal:A,parsedValue:P})}let O=F&&!I?`${H.chain}.UNKNOWN-${H.address}`:I,{identifier:$,decimal:S}=gN(O),{chain:x,isSynthetic:D,isTradeAsset:v,address:U}=OA($),{baseDecimal:k}=nN(x),Q=s.get(p.includes(x)?$:$.toUpperCase());if(!Q&&T&&!D&&!v)return(async()=>{let{ticker:PN}=f($),c=await $A({address:U,chain:x,ticker:PN});return VN({decimal:c.decimals,identifier:c.identifier,value:A?a(BigInt(P),A):P})})();let w=Q?.decimal||S;l({condition:!w&&!T,id:`assetValue_static_decimal_not_found_${x}`,warning:`Couldn't find static decimal for one or more tokens on ${x} (Using default ${k} decimal as fallback).
2
+ This can result in incorrect calculations and mess with amount sent on transactions.
3
+ You can load static assets by installing @swapkit/tokens package and calling AssetValue.loadStaticAssets()
4
+ or by passing asyncTokenLookup: true to the from() function, which will make it async and return a promise.`});let{decimal:HN,identifier:d,tax:E}=Q||{decimal:w||k,identifier:$},$N=A?a(BigInt(P),A):a(P,HN);return D||v?fT(d,$N):VN({decimal:HN,identifier:d,tax:E,value:$N})}static async loadStaticAssets(N){let{loadTokenLists:A}=await import("@swapkit/tokens"),T=await A(N);for(let{tokens:H}of Object.values(T))for(let P of H){let{identifier:F}=P,{chain:I,symbol:O}=f(F),{address:$}=uN(O,I),{baseDecimal:S}=nN(I),x=p.includes(I)?F:F.toUpperCase(),D="decimals"in P&&P.decimals!==void 0?P.decimals:S,v="logoURI"in P&&P.logoURI?P.logoURI:`https://storage.googleapis.com/token-list-swapkit-dev/images/${F.toLowerCase()}.png`,U={decimal:D,identifier:F,logoURI:v,tax:"tax"in P?P.tax:void 0};if(s.set(x,U),$){let k=p.includes(I)?`${I}:${$}`:`${I}:${$.toUpperCase()}`;SN.set(k,F)}}return!0}static setStaticAssets(N){s.clear(),SN.clear();for(let[A,T]of N.entries()){let{identifier:H}=T,{chain:P,symbol:F}=f(H),{address:I}=uN(F,P),{baseDecimal:O}=nN(P),$=T.chain??P,S=T.address??I,x=p.includes($)?H:H.toUpperCase(),D=T.decimals??T.decimal??O,v=T.logoURI??`https://storage.googleapis.com/token-list-swapkit-dev/images/${H.toLowerCase()}.png`,U={decimal:D,identifier:x,logoURI:v,tax:T.tax};if(s.set(x,U),S){let k=p.includes($)?`${$}:${S}`:`${$}:${S.toUpperCase()}`;SN.set(k,H)}}return!0}static get staticAssets(){return s}}function zL(N){let A=W.from({chain:N});return vN(N).with(b.Bitcoin,b.Litecoin,b.BitcoinCash,b.Dash,()=>A.set(0.00010001)).with(b.Dogecoin,()=>A.set(1.00000001)).with(b.Avalanche,b.Ethereum,b.Arbitrum,b.BinanceSmartChain,()=>A.set(0.00000001)).with(b.THORChain,b.Maya,()=>A.set(0)).with(b.Cosmos,b.Kujira,()=>A.set(0.000001)).otherwise(()=>A.set(0.00000001))}async function $A({chain:N,address:A,ticker:T}){let P=p.includes(N)?`${N}:${A||T}`:`${N}:${A||T}`.toUpperCase(),F=pT(P);if(F)return F;if(!A){let{baseDecimal:$}=nN(N);return{decimals:$,identifier:`${N}.${T||"UNKNOWN"}`}}let I=await RA({address:A,chain:N}),O=`${N}.${I.ticker||T||"UNKNOWN"}-${A}`;return l({condition:!!(!I.ticker&&T),id:`async_token_lookup_failed_${N}_${A}`,warning:`Could not fetch token metadata for ${N}:${A} from chain. Using user-provided ticker (${T}) with baseDecimal (${I.decimals}).`}),I.ticker&&oT(P,{decimals:I.decimals,identifier:O}),{decimals:I.decimals,identifier:O}}function VN({identifier:N,decimal:A,value:T,tax:H}){return IA(N),new W({decimal:A,identifier:N,tax:H,value:a(T,A)})}function fT(N,A=0){let T=N.includes(".")?N.split(".")?.[0]?.toUpperCase():void 0,H=T?qN.includes(T):!1,P=N.slice(0,14).includes("~")?"~":"/",[F,I]=H?N.split(".").slice(1).join().split(P):N.split(P);if(!(F&&I))throw new g({errorKey:"helpers_invalid_asset_identifier",info:{identifier:N}});return new W({decimal:8,identifier:`${T||b.THORChain}.${F}${P}${I}`,value:a(A,8)})}async function CT({address:N,chain:A,fromBaseDecimal:T,parsedValue:H}){let{decimals:P,identifier:F}=await $A({address:N,chain:A}),I=T?a(BigInt(H),T):H;return VN({decimal:P,identifier:F,value:I})}function a(N,A){return typeof N==="bigint"?h({bigIntDecimal:A,decimal:A,value:N}):N}function hT(N){let A=vN(N).when((T)=>("chain"in T)&&T.chain!==void 0,({chain:T})=>T).otherwise((T)=>{let H=f(T.asset);return H.synth?b.THORChain:H.chain});if(!KT.includes(A.toUpperCase())){let T="asset"in N?N.asset:A;throw new g({errorKey:"helpers_invalid_asset_identifier",info:{identifier:T,message:`Unsupported chain "${A}" - use the AssetValue constructor directly`}})}}function dT(N){if(hT(N),"chain"in N){let{chain:P,address:F}=N;if(F){let I=p.includes(P)?`${P}:${F}`:`${P}:${F.toUpperCase()}`,O=SN.get(I);if(O)return O;return null}return P}let{chain:A,symbol:T}=f(N.asset);return WN({chain:A,symbol:T})==="Native"?A:N.asset}function cT(N,A,T){let H=N.split("."),P=H[0]?.toUpperCase(),F=qN.includes(P),I=T?"~":"/",[O,$=""]=F?H.slice(1).join(".").split(I):N.split(I);if(!(O&&$))throw new g({errorKey:"helpers_invalid_asset_identifier",info:{identifier:N}});let{ticker:S,address:x}=GA({chain:O,symbol:$}),D=`${O}${I}${$}`;return{address:x,chain:P,isGasAsset:!1,isSynthetic:A,isTradeAsset:T,symbol:D,ticker:S}}function lT(N){let A=N.indexOf("."),T=(A===-1?N:N.slice(0,A)).toUpperCase(),H=A===-1?N:N.slice(A+1),{address:P,ticker:F}=GA({chain:T,symbol:H}),I;try{I=P&&mT.includes(T)&&BA(P)?BA(P):P}catch{I=P}let O=I?`${F}-${I}`:H;return{address:I,chain:T,isGasAsset:FA({chain:T,symbol:H}),isSynthetic:!1,isTradeAsset:!1,symbol:O,ticker:F}}function OA(N){let A=N.slice(0,14),T=A.includes("/"),H=A.includes("~");if(T||H)return cT(N,T,H);return lT(N)}function GA({symbol:N,chain:A}){let{ticker:T,address:H}=uN(N,A);return{address:H&&!p.includes(A)?H.toLowerCase():H,ticker:T}}class UN extends y{eq(N){return this.eqValue(N)}static fromBigInt(N,A){return new UN({decimal:A,value:h({bigIntDecimal:A,decimal:A,value:N})})}}function MA(N=!0){return N?"https://midgard.thorchain.network":"https://midgard.mayachain.info"}function iT(N=!0){let A=MA(N);return N?`${A}/v2/thorname`:`${A}/v2/mayaname`}function sT(N){return function(T){let H=T?`?status=${T}`:"";return M.get(`${N}/v2/pools${H}`)}}function eT(N){return function(T){return M.get(`${N}/v2/pool/${T}`)}}function aT(N){return function(T,H){let P=H?`?period=${H}`:"";return M.get(`${N}/v2/pool/${T}/stats${P}`)}}function NH(N){return function(T,H){let P=new URLSearchParams;if(H?.interval)P.append("interval",H.interval);if(H?.count)P.append("count",H.count.toString());if(H?.from)P.append("from",H.from.toString());if(H?.to)P.append("to",H.to.toString());let F=P.toString()?`?${P.toString()}`:"";return M.get(`${N}/v2/history/depths/${T}${F}`)}}function AH(N){return function(){return M.get(`${N}/v2/network`)}}function TH(N){return function(){return M.get(`${N}/v2/health`)}}function HH(N){return function(){return M.get(`${N}/v2/nodes`)}}function PH(N){return function(T){return M.get(`${N}/v2/node/${T}`)}}function LH(N){return function(){return M.get(`${N}/v2/mimir/votes`)}}function RH(N){return function(){return M.get(`${N}/v2/mimir`)}}function FH(N){return function(){return M.get(`${N}/v2/constants`)}}function uH(N){return function(){return M.get(`${N}/v2/stats`)}}function IH(N){return function(T){let H=new URLSearchParams;if(T?.interval)H.append("interval",T.interval);if(T?.count)H.append("count",T.count.toString());if(T?.from)H.append("from",T.from.toString());if(T?.to)H.append("to",T.to.toString());let P=H.toString()?`?${H.toString()}`:"";return M.get(`${N}/v2/history/earnings${P}`)}}function nH(N){return function(T,H){let P=new URLSearchParams;if(H?.interval)P.append("interval",H.interval);if(H?.count)P.append("count",H.count.toString());if(H?.from)P.append("from",H.from.toString());if(H?.to)P.append("to",H.to.toString());let F=P.toString()?`?${P.toString()}`:"",I=T?`/swaps/${T}`:"/swaps";return M.get(`${N}/v2/history${I}${F}`)}}function BH(N){return function(T){let H=new URLSearchParams;if(T?.interval)H.append("interval",T.interval);if(T?.count)H.append("count",T.count.toString());if(T?.from)H.append("from",T.from.toString());if(T?.to)H.append("to",T.to.toString());let P=H.toString()?`?${H.toString()}`:"";return M.get(`${N}/v2/history/tvl${P}`)}}function OH(N){if(!N)return"";let A=new URLSearchParams,T=(H,P)=>{if(P!==void 0)A.append(H,typeof P==="number"?P.toString():P)};return T("address",N.address),T("txid",N.txid),T("asset",N.asset),T("type",N.type),T("affiliate",N.affiliate),T("limit",N.limit),T("offset",N.offset),A.toString()?`?${A.toString()}`:""}function $H(N){return function(T){let H=OH(T);return M.get(`${N}/v2/actions${H}`)}}function GH(N){return function(T){return M.get(`${N}/v2/member/${T}`)}}function MH(N){return function(T){let H=T?`/${T}`:"";return M.get(`${N}/v2/members${H}`)}}function _H(N){return function(T,H){let P=H?`&asset=${H}`:"";return M.get(`${N}/v2/saver/${T}${P?`?${P.substring(1)}`:""}`)}}function gH(N){return function(T){return M.get(`${N}/v2/savers/${T}`)}}function DH(N){return function(T,H){let P=new URLSearchParams;if(H?.interval)P.append("interval",H.interval);if(H?.count)P.append("count",H.count.toString());if(H?.from)P.append("from",H.from.toString());if(H?.to)P.append("to",H.to.toString());let F=P.toString()?`?${P.toString()}`:"",I=T?`/savers/${T}`:"/savers";return M.get(`${N}/v2/history${I}${F}`)}}function YH(N){return function(T){return M.get(`${N}/v2/balance/${T}`)}}function SH(N){return async function(T){let H=(P)=>{if(P?.cause?.status===404)return;throw P};return await M.get(`${N}/lookup/${T}`,{onError:H,retry:{maxRetries:1}})}}function UH(N){return async function(T){let H=(P)=>{if(P?.cause?.status===404)return[];throw P};return await M.get(`${N}/rlookup/${T}`,{onError:H,retry:{maxRetries:1}})}}function XH(N){return async function(T){let H=(P)=>{if(P?.cause?.status===404)return[];throw P};return await M.get(`${N}/owner/${T}`,{onError:H,retry:{maxRetries:1}})}}function NN({asset:N,value:A}){return W.from({asset:N,fromBaseDecimal:rT(XN.THORChain).baseDecimal,value:A})}function tH({liquidityPositionGetter:N,isThorchain:A}){return async function(H){let P=await N(H),F=A?"rune":"cacao";return P.pools.map((I)=>({[`${F}Pending`]:NN({asset:"THOR.RUNE",value:I.runePending}),[`${F}RegisteredAddress`]:I.runeAddress,[`${F}Withdrawn`]:NN({asset:"THOR.RUNE",value:I.runeWithdrawn}),[F]:NN({asset:"THOR.RUNE",value:I.runeAdded}),asset:NN({asset:I.pool,value:I.assetAdded}),assetPending:NN({asset:I.pool,value:I.assetPending}),assetRegisteredAddress:I.assetAddress,assetWithdrawn:NN({asset:I.pool,value:I.assetWithdrawn}),dateFirstAdded:I.dateFirstAdded,dateLastAdded:I.dateLastAdded,poolShare:new UN(I.liquidityUnits).div(I.pool)}))}}function _A(N){let A=N===XN.THORChain,T=MA(A),H=iT(A),P=GH(T);return{getActions:$H(T),getBalance:YH(T),getConstants:FH(T),getEarningsHistory:IH(T),getHealth:TH(T),getLiquidityPosition:tH({isThorchain:A,liquidityPositionGetter:P}),getLiquidityPositionRaw:P,getMembers:MH(T),getMimir:RH(T),getMimirVotes:LH(T),getNameDetails:SH(H),getNamesByAddress:UH(H),getNamesByOwner:XH(H),getNetworkInfo:AH(T),getNode:PH(T),getNodes:HH(T),getPool:eT(T),getPoolDepthHistory:NH(T),getPoolStats:aT(T),getPools:sT(T),getSaverDetails:_H(T),getSavers:gH(T),getSaversHistory:DH(T),getStats:uH(T),getSwapHistory:nH(T),getTVLHistory:BH(T)}}var gA=_A(XN.THORChain),DA=_A(XN.Maya);var pN={};dN(pN,{getTrackerDetails:()=>iH,getTokenListProviders:()=>AP,getTokenList:()=>TP,getTokenApproval:()=>NP,getSwapTo:()=>BP,getSwapQuote:()=>sH,getRouteWithTx:()=>eH,getPrice:()=>HP,getNearDepositChannel:()=>RP,getGasRate:()=>PP,getChainflipDepositChannel:()=>LP,getChainBalance:()=>aH,SKRequestClient:()=>V});import{EVMChains as yN}from"@swapkit/types";import{match as rH,P as ON}from"ts-pattern";async function YA(N,A,T,H){let P=`${A}:${T}:${H}`,F=new TextEncoder,I=await crypto.subtle.importKey("raw",F.encode(N),{hash:"SHA-256",name:"HMAC"},!1,["sign"]),O=await crypto.subtle.sign("HMAC",I,F.encode(P));return Array.from(new Uint8Array(O)).map(($)=>$.toString(16).padStart(2,"0")).join("")}import{Chain as tN,ChainId as BN}from"@swapkit/types";import{array as t,boolean as K,coerce as tA,number as _,object as G,optional as B,string as R,union as kN,unknown as EA,z as L}from"zod";var bA;((H)=>{H.CHEAPEST="CHEAPEST";H.FASTEST="FASTEST";H.RECOMMENDED="RECOMMENDED"})(bA||={});var EN;((F)=>{F.PSBT="PSBT";F.EVM="EVM";F.COSMOS="COSMOS";F.RADIX="RADIX";F.NEAR="NEAR"})(EN||={});var xA;((w)=>{w.approve="approve";w.claim="claim";w.deposit="deposit";w.donate="donate";w.lending="lending";w.lp_action="lp_action";w.native_contract_call="native_contract_call";w.native_send="native_send";w.stake="stake";w.streaming_swap="streaming_swap";w.swap="swap";w.thorname_action="thorname_action";w.token_contract_call="token_contract_call";w.token_transfer="token_transfer";w.unknown="unknown";w.unstake="unstake"})(xA||={});var QA;((U)=>{U.swap="swap";U.aggregation="aggregation";U.addLiquidity="addLiquidity";U.withdrawLiquidity="withdrawLiquidity";U.addSavers="addSavers";U.withdrawSavers="withdrawSavers";U.borrow="borrow";U.repay="repay";U.name="name";U.donate="donate";U.claim="claim";U.stake="stake";U.unstake="unstake"})(QA||={});var wA;((O)=>{O.unknown="unknown";O.not_started="not_started";O.pending="pending";O.swapping="swapping";O.completed="completed";O.refunded="refunded";O.failed="failed"})(wA||={});var zA;((Q)=>{Q.not_started="not_started";Q.starting="starting";Q.broadcasted="broadcasted";Q.mempool="mempool";Q.inbound="inbound";Q.outbound="outbound";Q.swapping="swapping";Q.completed="completed";Q.refunded="refunded";Q.partially_refunded="partially_refunded";Q.dropped="dropped";Q.reverted="reverted";Q.replaced="replaced";Q.retries_exceeded="retries_exceeded";Q.parsing_error="parsing_error"})(zA||={});var oL=G({address:B(R()),chain:L.enum(tN).optional(),chainId:L.enum(BN),coingeckoId:B(R()),decimals:tA.number(),extensions:B(L.looseObject({})),identifier:R(),logoURI:B(R()),name:B(R()),shortCode:B(R()),symbol:B(R()),ticker:R()}),fL=L.object({block:L.optional(L.number().describe("Block number. Required for Polkadot chain. e.g. `123456`")),chainId:L.optional(L.string().describe("ChainId for the hash. e.g. `thorchain-1`")),depositChannelId:L.optional(L.string().describe("Deposit channel ID, required for Chainflip if tx was broadcasted without wallet connection")),hash:L.optional(L.string().describe("Hash for the first transaction broadcasted by the end user. e.g. `88D1819378ECD09E5284C54937CDC1E99B52F253C007617A02DD1200710CE677`"))}).refine((N)=>N.hash&&N.chainId||N.depositChannelId,{message:"Either `hash` and `chainId` or `depositChannelId` must be provided"}),CL=L.object({forceUpdate:L.string().toLowerCase().transform((N)=>N==="true").pipe(L.boolean()).optional()}),hL=G({error:R(),message:R()}),AN=G({address:B(R()),chain:L.enum(tN),decimal:B(_()),isGasAsset:K(),isSynthetic:K(),symbol:R(),tax:B(G({buy:_(),sell:_()})),ticker:R()}),JA=G({id:R(),market_cap:_(),name:R(),price_change_24h_usd:_(),price_change_percentage_24h_usd:_(),sparkline_in_7d:t(_()),timestamp:R(),total_volume:_()}).partial(),dL=G({cg:B(JA),identifier:R(),price_usd:_(),provider:R(),timestamp:_()}),ZA=t(G({cg:B(JA),identifier:R(),price_usd:_(),provider:R(),timestamp:_()}).partial()),cL=G({affiliate:B(R().describe("Affiliate thorname")),affiliateFee:B(_().describe("Affiliate fee in basis points").refine((N)=>N===Math.floor(N)&&N>=0,{message:"affiliateFee must be a positive integer",path:["affiliateFee"]})),allowSmartContractReceiver:B(K().describe("Allow smart contract as recipient")),allowSmartContractSender:B(K().describe("Allow smart contract as sender")),buyAsset:R().describe("Asset to buy"),cfBoost:B(K().describe("Set to true to enable CF boost to speed up Chainflip swaps. BTC only.")),destinationAddress:B(R().describe("Address to send asset to")),disableSecurityChecks:B(K().describe("Disable security checks")),includeTx:B(K().describe("Set to true to include an transaction object (EVM only)")),providers:B(t(R().describe("List of providers to use").refine((N)=>J[N]!==void 0,{message:"Invalid provider",path:["providers"]}))),referrer:B(R().describe("Referrer address (referral program)")),sellAmount:R().describe("Amount of asset to sell").refine((N)=>+N>0,{message:"sellAmount must be greater than 0",path:["sellAmount"]}),sellAsset:R().describe("Asset to sell"),slippage:B(_().describe("Slippage tolerance as a percentage. Default is 3%.")),sourceAddress:B(R().describe("Address to send asset from"))}).refine((N)=>N.sellAsset!==N.buyAsset,{message:"Must be different",path:["sellAsset","buyAsset"]}),lL=G({metadata:K(),tokens:t(G({identifier:R()}))}),WA=G({destinationAddress:R()}),EH=WA.extend({affiliateFees:t(G({brokerAddress:R(),feeBps:_()})).optional(),brokerCommissionBps:_().optional(),buyAsset:G({asset:R(),chain:R()}),channelMetadata:G({cfParameters:R().optional(),gasBudget:R().optional(),message:R().optional()}).optional(),dcaParameters:G({chunkInterval:_().optional(),numberOfChunks:_().optional()}).optional(),maxBoostFeeBps:_().optional(),refundParameters:G({minPrice:R().optional(),refundAddress:R().optional(),retryDuration:_().optional()}).optional(),sellAsset:G({asset:R(),chain:R()})}),jA=G({channelId:R(),depositAddress:R()}),SA=WA.extend({affiliateFees:G({feeBps:_(),nearId:R()}).optional(),buyAsset:R(),sellAmount:R(),sellAsset:R(),slippage:tA.number(),sourceAddress:R()}),UA=G({amountIn:R(),amountInFormatted:R(),amountInUsd:R(),amountOut:R(),amountOutFormatted:R(),amountOutUsd:R(),deadline:R().optional(),minAmountIn:R(),minAmountOut:R(),timeEstimate:_().optional(),timeWhenInactive:R().optional()}),rL=UA.extend({depositAddress:R(),quote:UA,signature:R(),timestamp:R(),tx:EA()}),VA=G({buyAsset:R(),buyAssetAmount:R(),buyAssetAmountMaxSlippage:R(),deadline:R().optional(),depositAddress:R(),depositAmount:R(),depositAsset:R(),tx:EA()}),bH=G({evmCalldata:L.optional(L.string()),intentHash:L.optional(L.string()),logs:L.optional(L.unknown()),manifest:L.optional(L.unknown()),memo:L.optional(L.string()),spender:L.optional(L.string()),thorname:L.optional(L.string())}),xH=G({currentStage:R(),inboundConfirmation:_(),inboundObservation:_(),outboundDelay:_(),outboundObservation:_(),streamingSwap:_()}),QH=G({count:B(_()),interval:B(_()),quantity:B(_()),subSwapsMap:B(t(_()))}),wH=L.object({currentLegIndex:L.optional(L.number()),estimatedTimeToComplete:L.number(),estimates:L.optional(xH),providerDetails:L.optional(L.object({streamingDetails:L.optional(QH)}))}),zH=G({affiliate:B(AN),liquidity:B(AN),network:B(AN),protocol:B(AN),tax:B(AN)}),JH=G({affiliate:R(),bps:R(),isReferrer:K()}),ZH=G({affiliate:B(R()),affiliateFees:B(t(JH)),broadcastedAt:B(_()),explorerUrl:B(R()),fees:B(zH),images:B(G({chain:B(R()),from:B(R()),provider:B(R()),to:B(R())})),provider:B(L.enum(J)),providerAction:L.optional(L.enum(QA)),quoteId:B(R()),wallet:B(R())}),TN=L.object({block:L.number(),chainId:L.enum(BN),finalAddress:L.optional(L.string()),finalAsset:L.optional(AN),finalisedAt:L.number(),fromAddress:L.string(),fromAmount:L.string(),fromAsset:L.string(),hash:L.string(),meta:L.optional(ZH),payload:L.optional(bH),status:L.enum(wA),toAddress:L.string(),toAmount:L.string(),toAsset:L.string(),trackingStatus:L.optional(L.enum(zA)),transient:L.optional(wH),type:L.enum(xA)}),vA=TN.extend({legs:L.array(TN)}),iL=TN.extend({legs:t(TN)}),sL=TN.extend({legs:t(TN)}),KN=t(G({amount:R(),asset:R(),chain:R(),protocol:L.enum(J),type:L.enum(QN)})),mN=L.object({inbound:L.optional(L.number().describe("Time to receive inbound asset in seconds")),outbound:L.optional(L.number().describe("Time to receive outbound asset in seconds")),swap:L.optional(L.number().describe("Time to swap assets in seconds")),total:L.number().describe("Total time in seconds")}),qA=G({data:R().describe("Data to send"),from:R().describe("Address of the sender"),to:R().describe("Address of the recipient"),value:R().describe("Value to send")}),kA=L.object({raw_data:L.object({contract:L.any(),data:L.string().optional(),expiration:L.number(),fee_limit:L.number().optional(),ref_block_bytes:L.string(),ref_block_hash:L.string(),timestamp:L.number()}).passthrough(),raw_data_hex:L.string(),txID:L.string(),visible:L.boolean()}),WH=t(kN([R(),_(),t(R()),G({from:R(),value:R()}).describe("Parameters to pass to the contract method")])),eL=G({approvalSpender:B(R().describe("Address of the spender to approve")),approvalToken:B(R().describe("Address of the token to approve spending of")),contractAddress:R().describe("Address of the contract to interact with"),contractMethod:R().describe("Name of the method to call"),contractParamNames:t(R().describe("Names of the parameters to pass to the contract method")),contractParams:WH}),jH=G({typeUrl:R("/types.MsgDeposit"),value:G({coins:t(G({amount:R(),asset:G({chain:R(),symbol:R(),synth:K(),ticker:R()})})),memo:R(),signer:R()})}),VH=G({typeUrl:R("/types.MsgSend"),value:G({amount:t(G({amount:R(),denom:R()})),fromAddress:R(),toAddress:R()})}),vH=G({typeUrl:R(),value:VH.shape.value.or(jH.shape.value)}),qH=G({amount:t(G({amount:R(),denom:R()})),gas:R()}),KA=G({accountNumber:_(),chainId:L.enum(BN),fee:qH,memo:R(),msgs:t(vH),sequence:_()}),kH=L.array(L.object({calldata:L.array(L.string()),contractAddress:L.string(),entrypoint:L.string()})),mA=L.array(L.object({address:L.string().describe("Destination address in friendly format"),amount:L.string().describe("Amount in nanotons"),payload:L.string().optional().describe("Base64 BOC of body cell"),stateInit:L.string().optional().describe("Base64 BOC of state init")})),KH=G({affiliate:R().describe("Affiliate address").optional(),affiliateFee:_().describe("Affiliate fee").optional(),buyAsset:R().describe("Asset to buy"),destinationAddress:R().describe("Destination address"),estimatedTime:mN.optional(),provider:L.enum(J),sellAsset:R().describe("Asset to sell"),slipPercentage:_().describe("Slippage as a percentage"),sourceAddress:R().describe("Source address")}),aL=KH.omit({destinationAddress:!0,slipPercentage:!0,sourceAddress:!0}),mH=G({asset:R().describe("Asset name"),image:R().describe("Asset image"),price:_().describe("Price in USD")}),yH=EH,yA=G({assets:B(t(mH)),maxStreamingQuantity:_().optional(),referrer:R().optional(),streamingInterval:_().optional(),tags:t(L.enum(bA))}),pA=yA.extend({affiliate:B(R()),affiliateFee:B(R()),approvalAddress:B(R().describe("Approval address for swap")),chainflip:yH.optional(),garden:SA.optional(),near:SA.optional(),priceImpact:B(_().describe("Price impact")),referrer:B(R()),txType:B(L.enum(EN))}),oA=t(G({code:L.enum(xN),display:R(),tooltip:R().optional()})),pH=G({buyAmount:R().describe("Buy amount"),buyAmountMaxSlippage:R().describe("Buy amount max slippage"),buyAsset:R().describe("Asset to buy"),fees:B(KN),provider:L.enum(J),sellAmount:R().describe("Sell amount"),sellAsset:R().describe("Asset to sell")}),oH=G({buyAsset:R().describe("Asset to buy"),destinationAddress:B(R().describe("Destination address")),estimatedTime:B(mN),expectedBuyAmount:R().describe("Expected Buy amount"),expectedBuyAmountMaxSlippage:R().describe("Expected Buy amount max slippage"),expiration:B(R().describe("Expiration")),fees:KN,inboundAddress:B(R().describe("Inbound address")),legs:t(pH),memo:B(R().describe("Memo")),meta:pA,providers:t(L.enum(J)),routeId:R().describe("Route ID"),sellAmount:R().describe("Sell amount"),sellAsset:R().describe("Asset to sell"),sourceAddress:B(R().describe("Source address")),targetAddress:B(R().describe("Target address")),totalSlippageBps:_().describe("Total slippage in bps"),tx:B(kN([qA,KA,kA,kH,mA,R()])),txType:B(L.enum(EN)),warnings:oA}),fA=G({error:B(R().describe("Error message")),providerErrors:B(t(G({errorCode:B(L.enum(RN)),message:B(R()),provider:L.enum(J).optional()}))),quoteId:R().describe("Quote ID"),routes:t(oH)}),CA=L.object({chainId:L.enum(BN),createdAt:L.date(),id:L.number(),unit:L.string(),value:L.string()}),fH=L.array(CA),hA=L.union([CA,fH]),NR=t(G({chain:L.enum(tN),decimal:_(),identifier:R(),symbol:R(),ticker:R(),value:R()})),AR=L.union([L.object({amount:L.string(),spender:L.string(),tokenIdentifier:L.string(),userWalletAddress:L.string()}),L.object({amount:L.string(),chainId:L.enum(BN),spender:L.string(),tokenContractAddress:L.string(),userWalletAddress:L.string()}),L.object({routeId:L.string()})]),TR=L.object({approvalTransaction:L.optional(L.object({data:L.string(),from:L.string(),gasLimit:L.optional(L.string()),gasPrice:L.optional(L.string()),to:L.string(),value:L.string()})),approvedAmount:L.string(),isApproved:L.boolean()}),CH=L.object({data:L.string().describe("Encoded approval call data"),from:L.string().describe("User wallet address"),gasLimit:L.string().optional().describe("Estimated gas limit"),gasPrice:L.string().optional().describe("Current gas price"),to:L.string().describe("Token contract address"),value:L.string().describe("ETH value (always '0' for approvals)")}),XA=L.object({buyAmount:L.string().describe("Buy amount").optional(),buyAmountMaxSlippage:L.string().describe("Buy amount max slippage").optional(),buyAsset:L.string().describe("Asset to buy"),expectedBuyAmount:L.string().describe("Expected Buy amount").optional(),expectedBuyAmountMaxSlippage:L.string().describe("Expected Buy amount max slippage").optional(),fees:KN,provider:L.enum(J),sellAmount:L.string().describe("Sell amount"),sellAsset:L.string().describe("Asset to sell")}),dA=XA.extend({estimatedTime:L.optional(mN),expiration:L.optional(L.string().describe("Expiration")),legs:L.array(XA),providers:L.array(L.enum(J)),routeId:L.string().describe("Route ID"),totalSlippageBps:L.number().describe("Total slippage in bps"),warnings:oA}).omit({provider:!0}),hH=L.object({method:L.string(),payload:L.optional(L.unknown()),url:L.string()}),dH=dA.extend({meta:yA,nextActions:L.optional(L.array(hH))}),HR=L.object({error:L.optional(L.string().describe("Error message")),providerErrors:L.optional(L.array(L.object({errorCode:L.optional(L.enum(RN)),message:L.optional(L.string()),provider:L.enum(J).optional()}))),quoteId:L.string().describe("Quote ID"),routes:L.array(dH)}),PR=L.object({providers:L.array(L.enum(J)).optional().describe("Optional list of providers to query for trading pairs"),sellAsset:L.string().describe("Asset identifier to sell (e.g., 'BTC.BTC' or 'ETH.ETH')")}),cH=L.object({chain:L.enum(tN).describe("Chain the asset is on"),identifier:L.string().describe("Asset identifier (e.g., 'ETH.USDC-0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48')"),providers:L.array(L.enum(J)).describe("Providers that support this trading pair"),symbol:L.string().describe("Asset symbol"),ticker:L.string().describe("Asset ticker")}),LR=L.object({buyAssets:L.array(cH).describe("List of assets that can be swapped to"),sellAsset:L.string().describe("The input sell asset identifier")}),cA=dA.extend({destinationAddress:L.string().describe("Destination address"),inboundAddress:L.optional(L.string().describe("Inbound address")),memo:L.optional(L.string().describe("Memo to include in the transaction")),meta:pA,sourceAddress:L.string().describe("Source address"),targetAddress:L.optional(L.string().describe("Target address")),tx:B(kN([qA,KA,kA,mA,R()])),txType:L.optional(L.enum(EN))}),lH=L.object({data:L.optional(L.record(L.string(),L.string().optional())),errorCode:L.enum(RN),message:L.string().optional(),provider:L.enum(J).optional()}),RR=L.object({error:L.optional(L.string().describe("Error message")),providerErrors:L.optional(L.array(lH)),quoteId:L.string().describe("Quote ID"),routes:L.array(cA)}),lA=cA.extend({approvalTx:CH.optional().describe("Optional approval transaction if ERC-20 approval is required before swap"),swapId:L.string().describe("The unique swap ID for tracking")});var V=M.extend({dynamicHeader:async()=>{let N=X.get("widgetId"),A=X.get("widgetKey");if(N&&A&&typeof window<"u"){let H=Math.floor(Date.now()/1000),P=window.location.origin,F=await YA(A,N,P,H);return{Origin:P,"X-Signature":F,"X-Timestamp":H.toString(),"x-widget-id":N}}let{swapKit:T}=X.get("apiKeys");return T?{"x-api-key":T}:{}}});async function iH(N){let A=await V.post(j("/track"),{json:N});try{let T=vA.safeParse(A);if(!T.success)throw new g("api_v2_invalid_response",T.error);return T.data}catch(T){return A}}async function sH(N){let{getQuote:A}=X.get("endpoints");if(A)return A(N);let H=X.get("v3SwapFlow")?.enabled?"/v3/quote":"/quote",P=await V.post(j(H),{json:N});if(P.error)throw new g("api_v2_server_error",{message:P.error});try{let F=fA.safeParse(P);if(!F.success)throw new g("api_v2_invalid_response",F.error);return F.data}catch{return P}}async function eH(N){let{getRouteWithTx:A}=X.get("endpoints");if(A)return A(N);let H=X.get("v3SwapFlow")?.enabled?"/v3/swap":"/swap",P=await V.post(j(H),{json:N});try{let F=lA.safeParse(P);if(!F.success)throw new g("api_v2_invalid_response",F.error);return F.data}catch(F){return console.error(new g("api_v2_invalid_response",F)),P}}async function aH({chain:N,address:A,scamFilter:T=!0}){let{getBalance:H}=X.get("endpoints");if(H)return H({address:A,chain:N});let P=j(`/balance?chain=${N}&address=${A}`),F=await V.get(P),I=Array.isArray(F)?F:[];return T?nP(I):I}function NP(N){let A=rH(N).with({routeId:ON.string,spender:ON.string},({routeId:T,spender:H})=>j(`/approve?routeId=${T}&sourceAddress=${H}`)).with({assetValue:ON.instanceOf(W),spender:ON.string,userWallet:ON.string},({spender:T,userWallet:H,assetValue:P})=>j(`/approve?tokenIdentifier=${P.toString()}&userWalletAddress=${H}&spender=${T}&amount=${P.getValue("string")}`)).exhaustive();return V.get(A)}function AP(){let N=j("/providers");return V.get(N)}function TP(N){let A=j(`/tokens?provider=${N}`);return V.get(A)}async function HP(N){let A=j("/price"),T=await V.post(A,{json:N});try{let H=ZA.safeParse(T);if(!H.success)throw new g("api_v2_invalid_response",H.error);return H.data}catch(H){throw new g("api_v2_invalid_response",H)}}async function PP(){let N=j("/gas"),A=await V.get(N);try{let T=hA.safeParse(A);if(!T.success)throw new g("api_v2_invalid_response",T.error);return Array.isArray(T)?T:[T]}catch(T){throw new g("api_v2_invalid_response",T)}}async function LP(N){let{destinationAddress:A}=N;if(!A)throw new g("chainflip_broker_invalid_params");let T=X.get("integrations").chainflip?.brokerUrl||j("/chainflip/broker/channel"),H=await V.post(T,{json:N});try{let P=jA.safeParse(H);if(!P.success)throw new g("api_v2_invalid_response",P.error);return P.data}catch(P){throw new g("api_v2_invalid_response",P)}}async function RP(N){let{destinationAddress:A}=N;if(!A)throw new g("chainflip_broker_invalid_params");let T=j("/near/channel"),H=await V.post(T,{json:N});try{let P=VA.safeParse(H);if(!P.success)throw new g("api_v2_invalid_response",P.error);return P.data}catch(P){throw new g("api_v2_invalid_response",P)}}function j(N){let{isDev:A,apiUrl:T,devApiUrl:H}=X.get("envs"),{enabled:P,quoteUrl:F,swapUrl:I}=X.get("localMode");if(P&&N){let[$]=N.split("?");if($==="/quote"||$==="/v3/quote")return`${F}${N}`;if($==="/swap"||$==="/v3/swap")return`${I}${N}`}return`${A?H:T}${N}`}function FP(N){try{return W.from({asset:N.identifier})}catch{return}}var uP=new Set(["OP.OP"]),IP=/(.)\1{6}|\.ORG|\.NET|\.FINANCE|\.COM|WWW|HTTP|\\\\|\/\/|[\s$%:[\]]/im;function nP(N){return N.filter((A)=>{let T=FP(A);if(!T)return!1;if(uP.has(T.toString().toUpperCase()))return!0;return(!yN.includes(T.chain)||T.isGasAsset||!!T.address)&&!IP.test(T.ticker)})}async function BP(N){let{getSwapTo:A}=X.get("endpoints");if(A)return A(N);let T=new URLSearchParams({sellAsset:N.sellAsset});if(N.providers?.length)for(let I of N.providers)T.append("providers",I);let H=j(`/swapTo?${T.toString()}`),P=await V.get(H);if(!Array.isArray(P))return{buyAssets:[],sellAsset:N.sellAsset};let F=[];for(let I of P)try{let O=W.from({asset:I});F.push({chain:O.chain,identifier:O.toString(),providers:[],symbol:O.symbol,ticker:O.ticker})}catch{}return{buyAssets:F,sellAsset:N.sellAsset}}var oN={};dN(oN,{getThorchainQueue:()=>MP,getTcyStakers:()=>tP,getTcyStaker:()=>XP,getTcyClaimers:()=>bP,getTcyClaimer:()=>EP,getTNSPreferredAsset:()=>YP,getTHORNodeTNSDetails:()=>rA,getRunePoolProviderInfo:()=>UP,getRunePoolInfo:()=>SP,getNodes:()=>_P,getMimirInfo:()=>gP,getLastBlock:()=>GP,getInboundAddresses:()=>DP});import{match as OP}from"ts-pattern";function q(N){let{isStagenet:A}=X.get("envs"),T=X.get("thornodeUrls");return`${OP({isStagenet:A,type:N}).with({type:"mayachain"},({isStagenet:P})=>P?T.MAYA_STAGENET:T.MAYA).otherwise(({isStagenet:P})=>P?T.THOR_STAGENET:T.THOR)}/${N??"thorchain"}`}function $P(N){let A=N==="mayachain"?"mayaname":"thorname";return`${q(N)}/${A}`}function GP(N="thorchain"){return M.get(`${q(N)}/lastblock`)}function MP(N){return M.get(`${q(N)}/queue`)}function _P(N){return M.get(`${q(N)}/nodes`)}function gP(N){return M.get(`${q(N)}/mimir`)}function DP(N){return M.get(`${q(N)}/inbound_addresses`)}async function rA({type:N,name:A}){try{return await M.get(`${$P(N)}/${A}`)}catch{return{affiliate_collector_rune:"",aliases:[],expire_block_height:0,name:A,owner:"",preferred_asset:""}}}async function YP({type:N,tns:A}){let T=await rA({name:A,type:N});if(!T.preferred_asset||T.preferred_asset===".")return;return W.from({asset:T.preferred_asset,asyncTokenLookup:!0})}function SP(N){return M.get(`${q(N)}/runepool`)}function UP({type:N,thorAddress:A}){return M.get(`${q(N)}/rune_provider/${A}`)}function XP({type:N,address:A}){return M.get(`${q(N)}/tcy_staker/${A}`)}function tP(N){return M.get(`${q(N)}/tcy_stakers`)}function EP({type:N,address:A}){return M.get(`${q(N)}/tcy_claimer/${A}`)}function bP(N){return M.get(`${q(N)}/tcy_claimers`)}var UR={...pN,mayachainMidgard:DA,thorchainMidgard:gA,thornode:oN};
5
+ export{wP as a,RN as b,xN as c,J as d,QN as e,TT as f,HT as g,PT as h,wN as i,LT as j,Z as k,X as l,g as m,M as n,rP as o,iP as p,sP as q,eP as r,l as s,ZN as t,bT as u,r as v,LL as w,BL as x,RA as y,FA as z,gN as A,WN as B,f as C,uN as D,OL as E,$L as F,IA as G,gL as H,h as I,y as J,W as K,zL as L,UN as M,YA as N,bA as O,EN as P,xA as Q,QA as R,wA as S,zA as T,oL as U,fL as V,CL as W,hL as X,AN as Y,JA as Z,dL as _,ZA as $,cL as aa,lL as ba,WA as ca,EH as da,jA as ea,SA as fa,rL as ga,VA as ha,vA as ia,iL as ja,sL as ka,KN as la,mN as ma,qA as na,kA as oa,WH as pa,eL as qa,KA as ra,kH as sa,mA as ta,KH as ua,aL as va,mH as wa,yH as xa,yA as ya,pA as za,oA as Aa,oH as Ba,fA as Ca,CA as Da,hA as Ea,AR as Fa,TR as Ga,CH as Ha,HR as Ia,PR as Ja,cH as Ka,LR as La,cA as Ma,lH as Na,RR as Oa,lA as Pa,UR as Qa};
@@ -1 +1 @@
1
- var o={};module.exports=e(o);r(o,require("@swapkit/contracts"),module.exports);
1
+ var{defineProperty:p,getOwnPropertyNames:d,getOwnPropertyDescriptor:g}=Object,x=Object.prototype.hasOwnProperty;function a(o){return this[o]}var b=(o,r,e)=>{var m=d(r);for(let f of m)if(!x.call(o,f)&&f!=="default")p(o,f,{get:a.bind(r,f),enumerable:!0});if(e){for(let f of m)if(!x.call(e,f)&&f!=="default")p(e,f,{get:a.bind(r,f),enumerable:!0});return e}};var h=(o)=>{var r=(c??=new WeakMap).get(o),e;if(r)return r;if(r=p({},"__esModule",{value:!0}),o&&typeof o==="object"||typeof o==="function"){for(var m of d(o))if(!x.call(r,m))p(r,m,{get:a.bind(o,m),enumerable:!(e=g(o,m))||e.enumerable})}return c.set(o,r),r},c;var i=(o)=>o;function j(o,r){this[o]=i.bind(null,r)}var k=(o,r)=>{for(var e in r)p(o,e,{get:r[e],enumerable:!0,configurable:!0,set:j.bind(r,e)})};var l=(o,r)=>()=>(o&&(r=o(o=0)),r);var t={};module.exports=h(t);b(t,require("@swapkit/contracts"),module.exports);