@swapkit/helpers 5.0.1 → 5.1.0

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,18 @@
1
1
  # @swapkit/helpers
2
2
 
3
+ ## 5.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#346](https://github.com/swapkit/sdk/pull/346) [`8cca094`](https://github.com/swapkit/sdk/commit/8cca094c278b7d89dff8625b4ced3664f8a51209) Thanks [@towanTG](https://github.com/towanTG)! - Make wallet options and SwapKit error keys extensible through module augmentation plus runtime registration. Extension error codes should use the reserved 80000-89999 range, and wallet registrations are automatically added to the default `SKConfig` wallet list.
8
+ - Update generated token lists. (via @swapkit/tokens@5.0.3)
9
+
10
+ ## 5.0.2
11
+
12
+ ### Patch Changes
13
+
14
+ - Update generated token lists. (via @swapkit/tokens@5.0.2)
15
+
3
16
  ## 5.0.1
4
17
 
5
18
  ### Patch Changes
package/dist/api/index.js CHANGED
@@ -1 +1 @@
1
- import{$ as m,$a as ma,Aa as N,Ba as O,Ca as P,Da as Q,Ea as R,Fa as S,Ga as T,Ha as U,Ia as V,Ja as W,Ka as X,La as Y,Ma as Z,Na as _,Oa as $,P as a,Pa as aa,Q as b,Qa as ba,R as c,Ra as ca,S as d,Sa as da,T as e,Ta as ea,U as f,Ua as fa,V as g,Va as ga,W as h,Wa as ha,X as i,Xa as ia,Y as j,Ya as ja,Z as k,Za as ka,_ as l,_a as la,aa as n,ab as na,ba as o,ca as p,da as q,ea as r,fa as s,ga as t,ha as u,ia as v,ja as w,ka as x,la as y,ma as z,na as A,oa as B,pa as C,qa as D,ra as E,sa as F,ta as G,ua as H,va as I,wa as J,xa as K,ya as L,za as M}from"../chunk-g60m4sgr.js";export{D as toHexTransactionValue,C as parseTransactionValue,B as isTransactionValue,c as TxnType,e as TxnStatus,F 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,L as TONTransactionSchema,K as TONTransactionMessageSchema,ia as SwapToResponseSchema,ga as SwapToRequestSchema,ha as SwapToAssetSchema,ma as SwapRouteV2ResponseSchema,na as SwapKitApi,ea as SwapApprovalTransactionSchema,da as StellarApprovalTransactionSchema,J as StarknetTransactionSchema,X as RouteQuoteWarningSchema,b as RouteQuoteTxType,ka as RouteQuoteProviderErrorSchema,W as RouteQuoteMetadataV2Schema,V as RouteQuoteMetadataSchema,T as RouteQuoteMetadataAssetSchema,S as RouteLegWithoutAddressesSchema,R as RouteLegSchema,fa as QuoteV3ResponseSchema,la as QuoteV2ResponseSchema,ja as QuoteRouteV2Response,Z as QuoteResponseSchema,Y 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,P as HyperCoreTypedDataTransactionSchema,Q as HyperCoreSendAssetTransactionSchema,O as HyperCoreSendAssetActionSchema,N as HyperCoreEip712TypedDataSchema,M as HYPERCORE_USDC_TOKEN_ID,_ as GasSchema,$ as GasResponseSchema,z as FeesSchema,A as EstimatedTimeSchema,E as EVMTransactionSchema,H as EVMTransactionDetailsSchema,G as EVMTransactionDetailsParamsSchema,s as DepositChannelResponseSchema,q as DepositChannelParamsSchema,I as CosmosTransactionSchema,l as CoinGeckoMetadataSchema,U as ChainflipMetadataSchema,r as BrokerDepositChannelParamsSchema,k as AssetValueSchema,ba as ApproveResponseSchema,aa as ApproveRequestParams,ca as ApprovalTransactionSchema,j as ApiV2ErrorSchema};
1
+ import{$ as j,$a as ja,Aa as K,Ba as L,Ca as M,Da as N,Ea as O,Fa as P,Ga as Q,Ha as R,Ia as S,Ja as T,Ka as U,La as V,Ma as W,Na as X,Oa as Y,Pa as Z,Qa as _,Ra as $,S as a,Sa as aa,T as b,Ta as ba,U as c,Ua as ca,V as d,Va as da,W as e,Wa as ea,X as f,Xa as fa,Y as g,Ya as ga,Z as h,Za as ha,_ as i,_a as ia,aa as k,ab as ka,ba as l,bb as la,ca as m,cb as ma,da as n,db as na,ea as o,fa as p,ga as q,ha as r,ia as s,ja as t,ka as u,la as v,ma as w,na as x,oa as y,pa as z,qa as A,ra as B,sa as C,ta as D,ua as E,va as F,wa as G,xa as H,ya as I,za as J}from"../chunk-sht0fjw7.js";export{D as toHexTransactionValue,C as parseTransactionValue,B as isTransactionValue,c as TxnType,e as TxnStatus,F 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,L as TONTransactionSchema,K as TONTransactionMessageSchema,ia as SwapToResponseSchema,ga as SwapToRequestSchema,ha as SwapToAssetSchema,ma as SwapRouteV2ResponseSchema,na as SwapKitApi,ea as SwapApprovalTransactionSchema,da as StellarApprovalTransactionSchema,J as StarknetTransactionSchema,X as RouteQuoteWarningSchema,b as RouteQuoteTxType,ka as RouteQuoteProviderErrorSchema,W as RouteQuoteMetadataV2Schema,V as RouteQuoteMetadataSchema,T as RouteQuoteMetadataAssetSchema,S as RouteLegWithoutAddressesSchema,R as RouteLegSchema,fa as QuoteV3ResponseSchema,la as QuoteV2ResponseSchema,ja as QuoteRouteV2Response,Z as QuoteResponseSchema,Y 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,P as HyperCoreTypedDataTransactionSchema,Q as HyperCoreSendAssetTransactionSchema,O as HyperCoreSendAssetActionSchema,N as HyperCoreEip712TypedDataSchema,M as HYPERCORE_USDC_TOKEN_ID,_ as GasSchema,$ as GasResponseSchema,z as FeesSchema,A as EstimatedTimeSchema,E as EVMTransactionSchema,H as EVMTransactionDetailsSchema,G as EVMTransactionDetailsParamsSchema,s as DepositChannelResponseSchema,q as DepositChannelParamsSchema,I as CosmosTransactionSchema,l as CoinGeckoMetadataSchema,U as ChainflipMetadataSchema,r as BrokerDepositChannelParamsSchema,k as AssetValueSchema,ba as ApproveResponseSchema,aa as ApproveRequestParams,ca as ApprovalTransactionSchema,j as ApiV2ErrorSchema};
@@ -0,0 +1,5 @@
1
+ var HT=Object.defineProperty;var PT=(N)=>N;function LT(N,A){this[N]=PT.bind(null,A)}var lN=(N,A)=>{for(var T in A)HT(N,T,{get:A[T],enumerable:!0,configurable:!0,set:LT.bind(A,T)})};var rN=((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 bN,getChainConfig as AH}from"@swapkit/types";import{AllChains as oT,Chain as b,EVMChains as CT,getChainConfig as RN}from"@swapkit/types";import{match as tN}from"ts-pattern";import{Chain as B,EVMChains as jT,getChainConfig as p,UTXOChains as VT}from"@swapkit/types";import{match as LN}from"ts-pattern";import{AllChains as aN,Chain as eN,getChainConfig as $T,MAYAConfig as YT,StagenetChain as _N,StagenetMAYAConfig as NA,StagenetTHORConfig as AA,THORConfig as MT}from"@swapkit/types";import{createStore as _T}from"zustand/vanilla";import{AllChains as FT,getChainConfig as OT}from"@swapkit/types";var dP=FT.reduce((N,A)=>{return N[A]=OT(A).networkDerivationPath,N},{});var PN;((R)=>{R.unknownError="unknownError";R.test_error="test_error";R.providerDetailsError="providerDetailsError";R.blockHeaderNotFound="blockHeaderNotFound";R.blockHashNotFoundAtHeight="blockHashNotFoundAtHeight";R.blockHashNotFoundAtHash="blockHashNotFoundAtHash";R.txHashMissing="txHashMissing";R.assetValueMissingInfo="assetValueMissingInfo";R.invalidAsset="invalidAsset";R.blockIsRequired="blockIsRequired";R.currentBlockHeaderNotFound="currentBlockHeaderNotFound";R.failedToRetrieveBalance="failedToRetrieveBalance";R.failedToRetrieveBlock="failedToRetrieveBlock";R.failedToRetrieveFees="failedToRetrieveFees";R.notImplementedBCH="notImplementedBCH";R.notImplementedDoge="notImplementedDoge";R.noPoolsFound="noPoolsFound";R.noVaultsFound="noVaultsFound";R.noTxFound="noTxFound";R.noInputCoinFound="noInputCoinFound";R.noBlockDataFound="noBlockDataFound";R.multipleCosmosMessages="multipleCosmosMessages";R.heightOrHashNotProvided="heightOrHashNotProvided";R.unknownDenom="unknownDenom";R.invalidBlockHeight="invalidBlockHeight";R.timestampExtrinsicNoArgumentsForBlock="timestampExtrinsicNoArgumentsForBlock";R.timestampExtrinsicNoTimestampForBlock="timestampExtrinsicNoTimestampForBlock";R.noTimestampExtrinsicForHash="noTimestampExtrinsicForHash";R.timestampExtrinsicNoArgumentsForHash="timestampExtrinsicNoArgumentsForHash";R.txMemoUndefined="txMemoUndefined";R.txMemoIncorrect="txMemoIncorrect";R.txTypeNotFound="txTypeNotFound";R.txNoMessage="txNoMessage";R.txNotFound="txNotFound";R.txReceiptNotFound="txReceiptNotFound";R.txParsingError="txParsingError";R.txLogsParsingError="txLogsParsingError";R.blockNotFound="blockNotFound";R.balanceNotFound="balanceNotFound";R.configError="configError";R.synthSwapDisallowed="synthSwapDisallowed";R.providerQuoteTimeout="providerQuoteTimeout";R.noQuoteResponse="noQuoteResponse";R.noPoolAssetsFound="noPoolAssetsFound";R.noThorchainPools="noThorchainPools";R.noMayachainPools="noMayachainPools";R.noThorchainNetworkInfo="noThorchainNetworkInfo";R.invalidAffiliateFee="invalidAffiliateFee";R.invalidBuyAssetAddress="invalidBuyAssetAddress";R.invalidSellAssetAddress="invalidSellAssetAddress";R.invalidSourceAddress="invalidSourceAddress";R.invalidDestinationAddress="invalidDestinationAddress";R.sourceAddressIsSmartContract="sourceAddressIsSmartContract";R.destinationAddressIsSmartContract="destinationAddressIsSmartContract";R.invalidChainId="invalidChainId";R.unsupportedChainId="unsupportedChainId";R.unsupportedEVMChainId="unsupportedEVMChainId";R.unsupportedMethod="unsupportedMethod";R.unsupportedProvider="unsupportedProvider";R.invalidParamsForMethod="invalidParamsForMethod";R.unsupportedAdapter="unsupportedAdapter";R.noWhitelistTokens="noWhitelistTokens";R.failedFetchGasPrice="failedFetchGasPrice";R.failedToCreateDepositChannel="failedToCreateDepositChannel";R.noProviderDetailsFound="noProviderDetailsFound";R.noTokenListsFound="noTokenListsFound";R.tokenNotFound="tokenNotFound";R.tokenPriceNotFound="tokenPriceNotFound";R.tokenPriceFailedToUpdate="tokenPriceFailedToUpdate";R.swapAmountTooSmall="swapAmountTooSmall";R.legsArrayIsEmpty="legsArrayIsEmpty";R.failedToFetchQuoteForLeg="failedToFetchQuoteForLeg";R.noBlockHeaderFound="noBlockHeaderFound";R.failedToSimulateSwap="failedToSimulateSwap";R.addressScreeningFailed="addressScreeningFailed";R.noLiquidtyProvidersFound="noLiquidtyProvidersFound";R.insufficientLiquidity="insufficientLiquidity";R.noInboundDataFound="noInbounDataFound";R.noInboundAddressesFound="noInboundAddressesFound";R.noInboundAddressFoundForChain="noInboundAddressFoundForChain";R.noLastBlocksFound="noLastBlocksFound";R.noVersionFound="noVersionFound";R.noConstantsFound="noConstantsFound";R.noMimirsFound="noMimirsFound";R.noRoutesFound="noRoutesFound";R.quoteNotFound="quoteNotFound";R.ledgerSignFailed="ledgerSignFailed";R.ledgerWrongPayload="ledgerWrongPayload";R.ledgerFetchSwapFailed="ledgerFetchSwapFailed";R.failedToFetchTx="failedToFetchTx";R.failedBuildTransactionDetails="failedBuildTransactionDetails";R.noLegsForRoute="noLegsForRoute";R.noRouterAddressFound="noRouterAddressFound";R.noAggregatorAddressFound="noAggregatorAddressFound";R.noContractInstanceFound="noContractInstanceFound";R.noContractAddressFound="noContractAddressFound";R.invalidAffiliate="invalidAffiliate";R.thornameAffiliate="thornameAffiliate";R.providerNotfound="No provider found";R.noRecordFound="No Record found";R.slippageTooLow="Slippage too low";R.tradingHalted="tradingHalted";R.noWrappedGasAsset="noWrappedGasAsset";R.aggregatorAddressNotFound="aggregatorAddressNotFound";R.routerAddressNotFound="routerAddressNotFound";R.dummyAddressNotFound="dummyAddressNotFound";R.trackerError="trackerError";R.thorchainPoolUnavailable="thorchainPoolUnavailable";R.noOhlcvDataFound="noOhlcvDataFound";R.noTradingPairs="noTradingPairs";R.noLendingAvailability="noLendingAvailability";R.lendingRepayTooSmall="lendingRepayTooSmall";R.missingState="missingState";R.ledgerSwapNotFound="ledgerSwapNotFound";R.ledgerSwapNotReadyForTracking="ledgerSwapNotReadyForTracking";R.errorEstimatingGas="errorEstimatingGas";R.apiKeyInvalid="apiKeyInvalid";R.apiKeyFailedToUpdate="apiKeyFailedToUpdate";R.apiKeyExpired="apiKeyExpired";R.unauthorized="unauthorized";R.failedToCreateMemo="failedToCreateMemo";R.radixIncorrectInstructions="radixIncorrectInstructions";R.radixTxMissedParam="radixTxMissedParam";R.radixTxMissedAccount="radixTxMissedAccount";R.radixManifestParseError="radixManifestParseError";R.radixManifestBuildError="radixManifestBuildError";R.invalidAddressForChain="invalidAddressForChain";R.riskyAddress="riskyAddress";R.noRoutesToProcess="noRoutesToProcess";R.sellAssetAmountTooSmall="sellAssetAmountTooSmall";R.missingPrivateKey="missingPrivateKey";R.noMemoPriceProtection="noMemoPriceProtection"})(PN||={});var JN;((H)=>{H.highSlippage="highSlippage";H.highPriceImpact="highPriceImpact";H.insufficientBalance="insufficientBalance"})(JN||={});var Z;((n)=>{n.CHAINFLIP="CHAINFLIP";n.CHAINFLIP_STREAMING="CHAINFLIP_STREAMING";n.JUPITER="JUPITER";n.MAYACHAIN="MAYACHAIN";n.MAYACHAIN_STREAMING="MAYACHAIN_STREAMING";n.ONEINCH="ONEINCH";n.PANCAKESWAP="PANCAKESWAP";n.SUSHISWAP_V2="SUSHISWAP_V2";n.THORCHAIN="THORCHAIN";n.THORCHAIN_STREAMING="THORCHAIN_STREAMING";n.TRADERJOE_V2="TRADERJOE_V2";n.UNISWAP_V2="UNISWAP_V2";n.UNISWAP_V3="UNISWAP_V3";n.NEAR="NEAR";n.GARDEN="GARDEN";n.OKX="OKX";n.HARBOR="HARBOR";n.FLASHNET="FLASHNET";n.MAYAN="MAYAN"})(Z||={});var QN;((M)=>{M.LIQUIDITY="liquidity";M.NETWORK="network";M.INBOUND="inbound";M.OUTBOUND="outbound";M.AFFILIATE="affiliate";M.TAX="tax";M.PRIORITY="priority";M.SERVICE="service"})(QN||={});var RT;((H)=>{H.Average="average";H.Fast="fast";H.Fastest="fastest"})(RT||={});var IT;((T)=>{T.Approve="approve";T.CheckOnly="checkOnly"})(IT||={});var BT;((X)=>{X.NAME_REGISTER="~";X.BOND="BOND";X.DEPOSIT="+";X.LEAVE="LEAVE";X.UNBOND="UNBOND";X.WITHDRAW="-";X.RUNEPOOL_DEPOSIT="POOL+";X.RUNEPOOL_WITHDRAW="POOL-";X.CLAIM_TCY="tcy";X.STAKE_TCY="tcy+";X.UNSTAKE_TCY="tcy-"})(BT||={});var iN={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_hypercore_payload_mismatch:51002,toolbox_hypercore_insufficient_balance:51003,toolbox_hypercore_destination_sanctioned:51004,toolbox_hypercore_transfer_hash_not_found:51005,toolbox_hypercore_pre_transfer_check_failed:51006,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_stellar_trustline_asset_invalid:91112,toolbox_aleo_no_signer:91201,toolbox_aleo_invalid_address:91202,toolbox_aleo_balance_error:91203,toolbox_aleo_fee_estimation_failed:91204,toolbox_aleo_broadcast_error:91205,toolbox_aleo_transaction_failed:91206,toolbox_aleo_wasm_init_failed:91207,toolbox_aleo_unsupported_token:91208,toolbox_aleo_token_transfer_rejected:91209,toolbox_aleo_insufficient_fee_balance:91210,toolbox_aleo_no_unspent_records:91211,toolbox_aleo_conflicting_signers:91212,toolbox_aleo_no_rpc_urls:91213,toolbox_not_supported:59901,toolbox_fee_estimation_failed:59902,toolbox_sweep_amount_too_low:59903,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,plugin_swapkit_stellar_destination_wallet_not_found:43003,plugin_swapkit_unsupported_tx_type:43004,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 u extends Error{static ErrorCode=iN;errorKey;info;constructor(N,A){let T=typeof N==="string",H=T?N:N.errorKey,P=T?void 0:N.info,O=`${H}${P?`: ${ZN(P)}`:""}`;super(O);if(Object.setPrototypeOf(this,u.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)}`)}}function iP(N){let A=iN;for(let[T,H]of Object.entries(N)){if(Object.hasOwn(A,T)){if(A[T]===H)continue;throw new u({errorKey:"helpers_invalid_params",info:{code:H,existingCode:A[T],key:T}})}let P=Object.keys(A).find((O)=>A[O]===H);if(P)throw new u({errorKey:"helpers_invalid_params",info:{code:H,existingKey:P,key:T}});A[T]=H}}var MN={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",PASSKEY_WALLET:"PASSKEY_WALLET",PASSKEYS:"PASSKEYS",PETRA:"PETRA",PHANTOM:"PHANTOM",POLKADOT_JS:"POLKADOT_JS",RADIX_WALLET:"RADIX_WALLET",TALISMAN:"TALISMAN",TREZOR:"TREZOR",TRONLINK:"TRONLINK",TRUSTWALLET_WEB:"TRUSTWALLET_WEB",VULTISIG:"VULTISIG",WALLET_SELECTOR:"WALLET_SELECTOR",WALLETCONNECT:"WALLETCONNECT",XAMAN:"XAMAN"},jN=new Set;function sN(N){return jN.add(N),()=>jN.delete(N)}function aP(N,A){let T=MN;if(Object.hasOwn(T,N)){if(T[N]===A)return;throw new u({errorKey:"helpers_invalid_params",info:{existingValue:T[N],key:N,value:A}})}T[N]=A;for(let H of jN)H(A)}var GT;((H)=>{H[H.NoError=36864]="NoError";H[H.LockedDevice=21781]="LockedDevice";H[H.TC_NotFound=65535]="TC_NotFound"})(GT||={});var DT=aN.reduce((N,A)=>{if(!N.THOR_STAGENET)N[_N.Maya]=NA.rpcUrls,N[_N.THORChain]=AA.rpcUrls;return N[A]=$T(A).rpcUrls,N},{}),ST={[eN.THORChain]:MT.nodeUrl,[eN.Maya]:YT.nodeUrl,[_N.THORChain]:AA.nodeUrl,[_N.Maya]:NA.nodeUrl},TA={apiKeys:{blockchair:"",keepKey:"",passkeys:"",swapKit:"",walletConnectProjectId:"",xaman:""},chains:aN,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:DT,thornodeUrls:ST,v3SwapFlow:{enabled:typeof process<"u"&&process.env?.SWAPKIT_V3_SWAP_FLOW==="true"},wallets:Object.values(MN),widgetId:"",widgetKey:""},j=_T((N)=>({...TA,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})}));sN((N)=>{j.setState((A)=>A.wallets.includes(N)?A:{wallets:[...A.wallets,N]})});var g={get:(N)=>j.getState()[N],getState:j.getState,reinitialize:()=>j.setState({...TA,wallets:Object.values(MN)}),set:(N)=>j.getState().setConfig(N),setApiKey:(N,A)=>j.getState().setApiKey(N,A),setEndpoint:(N,A)=>j.getState().setEndpoint(N,A),setEnv:(N,A)=>j.getState().setEnv(N,A),setFeeMultipliers:(N)=>j.getState().setFeeMultipliers(N),setIntegrationConfig:(N,A)=>j.getState().setIntegrationConfig(N,A),setRequestOptions:(N)=>j.getState().setRequestOptions(N),setRpcUrl:(N,A)=>j.getState().setRpcUrl(N,A),setThornodeUrl:(N,A)=>j.getState().setThornodeUrl(N,A),setWidgetId:(N)=>j.getState().setWidgetId(N),setWidgetKey:(N)=>j.getState().setWidgetKey(N)};var uT=(N)=>new Promise((A)=>setTimeout(A,N)),UT=(N,{baseDelay:A,backoffMultiplier:T,maxDelay:H})=>Math.min(A*T**N,H);function XT(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 gT=async(N,A)=>{let T=await fetch(N,A),H;try{H=await T.json()}catch{if(!T.ok)throw new u({errorKey:"helpers_invalid_response",info:{status:T.status,statusText:T.statusText}},{status:T.status,statusText:T.statusText});return{}}if(!T.ok){let O={data:H?.data,error:H?.error,message:H?.message,status:T.status};throw new u({errorKey:H?.error||"helpers_invalid_response",info:O},O)}let P=H?.routes?.length||H?.result||H?.data&&!H?.error;if(H?.error&&!P){let O={data:H.data,error:H.error,message:H.message,status:T.status};throw new u({errorKey:H.error,info:O},O)}if(H?.providerErrors?.length||H?.error&&P)console.warn("[SwapKit] Partial errors in response:",H.providerErrors||H.error);return H};function DN(N,A={}){return async function(H,P={}){let{searchParams:O,json:I,body:$,headers:M,dynamicHeader:w,retry:U,timeoutMs:X,abortController:Q,onError:E,onSuccess:t,responseHandler:z,...J}={...A,...P},TN=g.get("requestOptions"),h={...TN.retry,...U},n=!!I||H.endsWith(".json"),$N=ET(H,O),hN=w?await w():{},HN=WT(n,{...M,...hN}),d=n?JSON.stringify(I):$,zN;for(let YN=0;YN<=h.maxRetries;YN++){let dN=Q||new AbortController,cN=setTimeout(()=>dN.abort(),X||TN.timeoutMs);try{let k=await gT($N,{...J,body:d,headers:HN,method:N,signal:dN.signal});return clearTimeout(cN),t?.(k)||z?.(k)||k}catch(k){clearTimeout(cN),zN=k;let TT=k?.cause?.status;if(YN>=h.maxRetries||!XT(k,TT))return E?E(k):Promise.reject(k);await uT(UT(YN,h))}}return E?E(zN):Promise.reject(zN)}}function WT(N,A){return{...A,...N&&{"Content-Type":"application/json"}}}function ET(N,A){let T=new URL(N);if(A)T.search=new URLSearchParams(A).toString();return T.toString()}var _={extend:(N)=>({extend:(A)=>_.extend({...N,...A}),get:DN("GET",N),post:DN("POST",N)}),get:DN("GET"),post:DN("POST")};async function HA(N,A,T,H){let P=`${A}:${T}:${H}`,O=new TextEncoder,I=await crypto.subtle.importKey("raw",O.encode(N),{hash:"SHA-256",name:"HMAC"},!1,["sign"]),$=await crypto.subtle.sign("HMAC",I,O.encode(P));return Array.from(new Uint8Array($)).map((M)=>M.toString(16).padStart(2,"0")).join("")}import{Chain as S,CosmosChains as OA,EVMChains as RA,getChainConfig as IA,StagenetChains as bT,SubstrateChains as nT,UTXOChains as BA}from"@swapkit/types";import{match as SN}from"ts-pattern";function _L(N,A){try{return N()}catch(T){if(A)throw new u(A,T);return}}var PA=new Set;function c({condition:N,id:A,warning:T}){if(N){if(PA.has(A))return;console.warn(T),PA.add(A)}}function wT(N){return SN(N).with(...RA,()=>({id:1,jsonrpc:"2.0",method:"eth_blockNumber",params:[]})).with(...BA,()=>({id:"test",jsonrpc:"1.0",method:"getblockchaininfo",params:[]})).with(...OA,...bT,()=>({id:1,jsonrpc:"2.0",method:"status",params:{}})).with(S.Polkadot,S.Chainflip,()=>({id:1,jsonrpc:"2.0",method:"system_health",params:[]})).with(S.Solana,()=>({id:1,jsonrpc:"2.0",method:"getHealth"})).with(S.Sui,()=>({id:1,jsonrpc:"2.0",method:"sui_getSystemState",params:[]})).with(S.Ton,()=>({id:1,jsonrpc:"2.0",method:"getAddressInformation",params:{address:""}})).with(S.Aleo,S.Aptos,S.Tron,S.Radix,S.Stellar,()=>"").with(S.Hype,()=>({type:"meta"})).with(S.Near,()=>({id:"dontcare",jsonrpc:"2.0",method:"status",params:[]})).with(S.Ripple,()=>({id:1,jsonrpc:"2.0",method:"ping",params:[{}]})).with(S.Starknet,()=>({id:1,jsonrpc:"2.0",method:"starknet_chainId",params:[]})).otherwise(()=>{throw new u("helpers_chain_not_supported",{chain:N})})}function LA(N){return SN(N).with(S.Aptos,()=>"/-/healthy").with(S.Aleo,()=>"/mainnet/block/height/latest").with(S.Hype,()=>"/info").with(S.Radix,()=>"/status/network-configuration").with(S.Stellar,()=>"").with(S.Tron,()=>"/wallet/getnowblock").otherwise(()=>"")}async function FA(N,A){try{let T=A.startsWith("wss")?A.replace("wss","https"):A;if(N===S.Aleo||N===S.Stellar)return(await fetch(`${T}${LA(N)}`,{cache:"no-store",method:"GET",signal:AbortSignal.timeout(3000)})).ok;return(await fetch(`${T}${LA(N)}`,{body:JSON.stringify(wT(N)),cache:"no-store",headers:{"Content-Type":"application/json"},method:"POST",signal:AbortSignal.timeout(3000)})).ok}catch{return!1}}var VN=new Map,zT=120000;function JT(N){let[A=""]=g.get("rpcUrls")[N];if(!A)throw c({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 u("helpers_chain_no_public_or_set_rpc_url",{chain:N});let T=VN.get(N);if(T&&Date.now()-T.timestamp<zT)return T.url;return VN.set(N,{timestamp:Date.now(),url:A}),A}async function l(N){let A=JT(N),[,...T]=g.get("rpcUrls")[N];if(await FA(N,A))return A;for(let P of T)if(await FA(N,P))return VN.set(N,{timestamp:Date.now(),url:P}),P;throw new u("helpers_chain_rpc_connection_failed",{chain:N,fallbackUrls:T,primaryRpcUrl:A})}function WL(N){c({condition:!0,id:"initializeRPCUrlsWithFallback",warning:"initializeRPCUrlsWithFallback is deprecated. Use static { rpcUrls, fallbackRpcUrls } SwapKit init config or dynamic SKConfig.setRpcUrl/setFallbackRpcUrl to configure RPC endpoints."})}function EL({chain:N,txHash:A}){let{explorerUrl:T}=IA(N);return SN(N).with(...OA,S.Solana,()=>`${T}/tx/${A.startsWith("0x")?A.slice(2):A}`).with(...RA,...nT,()=>`${T}/tx/${A.startsWith("0x")?A:`0x${A}`}`).with(...BA,S.Radix,S.Tron,()=>`${T}/transaction/${A.toLowerCase()}`).with(S.Near,()=>`${T}/txns/${A}`).with(S.Ripple,()=>`${T}/transactions/${A}`).with(S.Stellar,()=>`${T}/explorer/public/tx/${A}`).with(S.Sui,()=>`${T}/txblock/${A}`).with(S.Cardano,S.Hype,S.Spark,S.Ton,()=>`${T}/tx/${A}`).otherwise(()=>"")}function bL({chain:N,address:A}){let{explorerUrl:T}=IA(N);return SN(N).with(S.Solana,S.Sui,S.Radix,()=>`${T}/account/${A}`).with(S.Stellar,()=>`${T}/explorer/public/account/${A}`).otherwise(()=>`${T}/address/${A}`)}function nL(N){switch(N){case S.THORChain:return`${N}.RUNE`;case S.Cosmos:return`${N}.ATOM`;case S.BinanceSmartChain:return`${N}`;default:return`${N}.${N}`}}import{keccak_256 as QT}from"@noble/hashes/sha3.js";import{bytesToHex as ZT}from"@noble/hashes/utils.js";var GA=/^(0x)?[0-9a-fA-F]{40}$/;function uN(N){if(typeof N!=="string"||!GA.test(N))throw Error(`invalid address: ${N}`);let A=N.toLowerCase().replace(/^0x/,""),T=ZT(QT(new TextEncoder().encode(A))),H=[...A].map((O,I)=>Number.parseInt(T[I]??"0",16)>=8?O.toUpperCase():O).join(""),P=N.replace(/^0x/,"");if(/[A-F]/.test(P)&&/[a-f]/.test(P)&&P!==H)throw Error(`bad address checksum: ${N}`);return`0x${H}`}function $A(N){if(typeof N!=="string"||!GA.test(N))return!1;try{return uN(N),!0}catch{return!1}}var tL=[`${B.Maya}.MAYA`,`${B.Maya}.CACAO`,`${B.Ethereum}.THOR`,`${B.Ethereum}.vTHOR`,`${B.Kujira}.USK`,`${B.Ethereum}.FLIP`,`${B.Radix}.XRD`],_A=[B.Arbitrum,B.Aurora,B.Base,B.Ethereum,B.Optimism,B.Robinhood];async function xT(N){let{baseDecimal:A}=p(B.Radix);try{let T=await l(B.Radix),{manager:H}=await _.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 qT(N){try{let A=await l(B.Radix);return(await _.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 DA({chain:N,address:A,methodHex:T,id:H}){let P=await l(N);return _.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"}})}function vT(N){if(!N||N==="0x")return"UNKNOWN";try{return SA(N.replace(/^0x/,""))?.trim()||"UNKNOWN"}catch(A){return console.warn(`Failed to decode ABI string from ${N}: ${A}`),"UNKNOWN"}}function tT(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 KT({chain:N,address:A}){let{baseDecimal:T}=p(N),H=A.toLowerCase();if(A===""||!H.startsWith("0x"))return T;let P=await DA({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 tT(P.result,T)}async function kT({chain:N,address:A}){let T=A.toLowerCase();if(T===""||!T.startsWith("0x"))return;let H=await DA({address:A,chain:N,id:1,methodHex:"0x95d89b41"}).catch((O)=>{return console.warn(`Could not fetch symbol for ${A} on ${N}: ${O.message}`),{result:""}});return vT(H.result)}async function YA({rpcUrl:N,contractAddress:A,functionSelector:T}){return(await _.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 MA(N){let A=N.match(/.{2}/g)?.map((T)=>Number.parseInt(T,16))??[];return new TextDecoder().decode(new Uint8Array(A))}function SA(N){return LN(N).with(void 0,()=>{return}).when((A)=>A.length>=128,(A)=>{let T=Number.parseInt(A.slice(64,128),16),H=A.slice(128,128+T*2).replace(/(00)+$/,"");return H?MA(H):void 0}).when((A)=>A.length===64,(A)=>{let T=A.replace(/(00)+$/,"");if(T.length>0&&T.length%2===0)return MA(T);return}).otherwise(()=>{return})}function uA({chain:N,address:A}){let{baseDecimal:T}=p(N),H={decimals:T,ticker:void 0};return LN(N).with(...jT,async()=>{try{if(!$A(A.replace(/^0X/,"0x")))return H;let[P,O]=await Promise.all([kT({address:A,chain:N}),KT({address:A,chain:N})]);return{decimals:O,ticker:P}}catch(P){return console.warn(`Failed to fetch token info for ${A} on ${N}: ${P?.code} ${P?.message}`),H}}).with(B.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 O=await P.json(),I=Array.isArray(O)?O[0]:O;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(B.Tron,async()=>{if(!A)return H;try{let P=await l(B.Tron),[O,I]=await Promise.all([YA({contractAddress:A,functionSelector:"symbol()",rpcUrl:P}),YA({contractAddress:A,functionSelector:"decimals()",rpcUrl:P})]),$=SA(O);return{decimals:O!==void 0&&I?Number(BigInt(`0x${I}`)):T,ticker:$}}catch(P){let O=P instanceof Error?P.message:String(P);return console.warn(`Failed to fetch Tron token info for ${A}: ${O}`),H}}).with(B.Near,async()=>{if(!A)return H;try{let P=await l(B.Near),O=await _.post(P,{body:JSON.stringify({id:"dontcare",jsonrpc:"2.0",method:"query",params:{account_id:A,args_base64:"e30=",finality:"final",method_name:"ft_metadata",request_type:"call_function"}}),headers:{accept:"application/json","content-type":"application/json"}});if(!O.result?.result)throw Error("NEAR ft_metadata returned no result");let I=JSON.parse(new TextDecoder().decode(new Uint8Array(O.result.result)));return{decimals:I?.decimals||T,ticker:I?.symbol}}catch(P){let O=P instanceof Error?P.message:String(P);return console.warn(`Failed to fetch Near token info for ${A}: ${O}`),H}}).with(B.Radix,async()=>{if(!A)return H;try{let[P,O]=await Promise.all([qT(A),xT(A)]);return{decimals:O,ticker:P}}catch(P){let O=P instanceof Error?P.message:String(P);return console.warn(`Failed to fetch Radix token info for ${A}: ${O}`),H}}).otherwise(async()=>H)}function UA({chain:N,symbol:A}){return LN(N).with(..._A,()=>A==="ETH").with(B.Avalanche,()=>A==="AVAX").with(B.Berachain,()=>A==="BERA").with(B.Hyperevm,()=>A==="HYPE").with(B.Hype,()=>A==="HYPE").with(B.Spark,()=>A==="BTC").with(B.BinanceSmartChain,()=>A==="BNB").with(B.Gnosis,()=>A==="xDAI"||A==="XDAI").with(B.Monad,()=>A==="MON").with(B.XLayer,()=>A==="OKB").with(B.Maya,()=>A==="CACAO").with(B.Cosmos,()=>A==="ATOM").with(B.THORChain,()=>A==="RUNE").with(B.Tron,()=>A==="TRX").with(B.Ripple,()=>A==="XRP").with(B.Radix,()=>`${N}.${A}`===UN(N).identifier).otherwise(()=>A===N)}var UN=(N)=>{let{baseDecimal:A}=p(N);return LN(N.toUpperCase()).with(..._A,(H)=>({decimal:A,identifier:`${H}.ETH`})).with(B.THORChain,(H)=>({decimal:A,identifier:`${H}.RUNE`})).with(B.Cosmos,(H)=>({decimal:A,identifier:`${H}.ATOM`})).with(B.Maya,(H)=>({decimal:10,identifier:`${H}.CACAO`})).with(B.BinanceSmartChain,(H)=>({decimal:A,identifier:`${H}.BNB`})).with(B.Monad,(H)=>({decimal:A,identifier:`${H}.MON`})).with(B.Avalanche,(H)=>({decimal:A,identifier:`${H}.AVAX`})).with(B.Gnosis,(H)=>({decimal:A,identifier:`${H}.xDAI`})).with(B.XLayer,(H)=>({decimal:A,identifier:`${H}.OKB`})).with(B.Berachain,(H)=>({decimal:A,identifier:`${H}.BERA`})).with(B.Hyperevm,(H)=>({decimal:A,identifier:`${H}.HYPE`})).with(B.Hype,(H)=>({decimal:A,identifier:`${H}.HYPE`})).with(B.Spark,(H)=>({decimal:A,identifier:`${H}.BTC`})).with(B.Tron,(H)=>({decimal:A,identifier:`${H}.TRX`})).with(B.Solana,B.Chainflip,B.Kujira,B.Ripple,B.Polkadot,B.Near,...VT,(H)=>({decimal:A,identifier:`${H}.${H}`})).with(B.Radix,"XRD.XRD",()=>({decimal:A,identifier:"XRD.XRD"})).with(B.Polygon,"POL.POL",()=>({decimal:A,identifier:"POL.POL"})).with("KUJI.USK",(H)=>({decimal:6,identifier:H})).with("ETH.FLIP",()=>({decimal:p(B.Ethereum).baseDecimal,identifier:"ETH.FLIP-0x826180541412D574cf1336d22c0C0a287822678A"})).with("ETH.THOR",()=>({decimal:p(B.Ethereum).baseDecimal,identifier:"ETH.THOR-0xa5f2211b9b8170f694421f2046281775e8468044"})).with("ETH.vTHOR",()=>({decimal:p(B.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 xN({chain:N,symbol:A}){if(A.includes("/"))return"Synth";if(A.includes("~"))return"Trade";return LN(N).with(B.Radix,()=>A===B.Radix||`${N}.${A}`===UN(N).identifier).with(B.Arbitrum,B.Optimism,B.Base,B.Aurora,B.Robinhood,()=>A===B.Ethereum).with(B.Cosmos,()=>A==="ATOM").with(B.BinanceSmartChain,()=>A==="BNB").with(B.Maya,()=>A==="CACAO").with(B.Monad,()=>A==="MON").with(B.THORChain,()=>A==="RUNE").with(B.Tron,()=>A==="TRX").with(B.Hyperevm,()=>A==="HYPE").with(B.Hype,()=>A==="HYPE").with(B.Spark,()=>A==="BTC").with(B.XLayer,()=>A==="OKB").otherwise(()=>A===N)?"Native":N}var y=(N)=>{let[A,...T]=N.split("."),H=N.includes("/"),P=T.join("."),O=P?.split("-"),I=O?.length?O.length===1?O[0]:O.slice(0,-1).join("-"):void 0;return{chain:A,symbol:P,synth:H,ticker:I}};function FN(N,A){let H=A===B.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 KL(N){return`https://storage.googleapis.com/token-list-swapkit-dev/images/${N.toLowerCase()}.png`}async function kL(N){let{loadTokenLists:A}=await import("./tokens.js"),T=await A(void 0,{source:g.get("envs").isDev?"dev":"prod"}),H=Object.values(T).flatMap((O)=>O.tokens);if("identifier"in N)return H.find((O)=>O.identifier===N.identifier)?.identifier;let P=N.contract.toLowerCase();for(let O of H){let{chain:I,symbol:$}=y(O.identifier);if(I!==N.chain)continue;let{address:M}=FN($,I);if(M?.toLowerCase()===P)return O.identifier}return}import{match as XN}from"ts-pattern";var r=8,mT=10,fT=64;function C({value:N,bigIntDecimal:A=r,decimal:T=r}){if(T===0)return N.toString();let H=N<0n,P=N.toString().substring(H?1:0),O=T-(P.length-1);if(O>0)P="0".repeat(O)+P;let I=P.length-T,$=P.slice(-T);if(Number.parseInt($[A]||"0",10)>=5){let w=Number.parseInt($[A-1]||"0",10);$=`${$.substring(0,A-1)}${w+1}`}else $=$.substring(0,A);return`${H?"-":""}${P.slice(0,I)}.${$}`.replace(/\.?0*$/,"")}class m{decimalMultiplier=10n**8n;bigIntValue=0n;decimal;static fromBigInt(N,A){return new m({decimal:A,value:C({bigIntDecimal:A,decimal:A,value:N})})}static shiftDecimals({value:N,from:A,to:T}){return m.fromBigInt(N.getBaseValue("bigint")*o(T)/o(A),T)}constructor(N){let A=qN(N),T=typeof N==="object";this.decimal=T?N.decimal:void 0,this.decimalMultiplier=T&&"decimalMultiplier"in N?N.decimalMultiplier:o(Math.max(XA(gN(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=ON(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 O=this.formatBigIntToSafeValue(this.bigIntValue,P);return XN(N).with("number",()=>Number(O)).with("string",()=>O).with("bigint",()=>{return this.bigIntValue*10n**BigInt(this.decimal||8n)/this.decimalMultiplier}).otherwise(()=>O)}getBaseValue(N,A){let T=this.decimalMultiplier/o(A||this.decimal||r),H=yT(this.bigIntValue,T);return XN(N).with("number",()=>Number(H)).with("string",()=>H.toString()).otherwise(()=>H)}getBigIntValue(N,A){if(!A&&typeof N==="object")return N.bigIntValue;let T=qN(N),H=gN(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=H.replace(/^0+/,"")||"0",$=I.slice(0,N),M=H.length-I.length;return`0.${$.padStart(M+$.length,"0")}`}toFixed(N=6){let A=this.getValue("string"),T=A.startsWith("-"),[H="0",P=""]=(T?A.slice(1):A).split("."),O=H==="0"&&Number.parseInt(P.slice(0,N),10)===0,I=T&&!O?"-":"";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 $=P[N];if(!($&&Number.parseInt($,10)>=5))return`${I}${H}.${P.slice(0,N).padEnd(N,"0")}`;let w=BigInt(P.slice(0,N).padEnd(N,"0"))+1n,U=10n**BigInt(N);if(w>=U)return`${I}${BigInt(H)+1n}.${"0".repeat(N)}`;return`${I}${H}.${w.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:O=!0}={}){let I=this.toFixed(T),$=A==="end",[M="0",w=""]=I.split("."),U=M.replace(/\B(?=(\d{3})+(?!\d))/g,P),X=w&&Number.parseInt(w,10)>0,Q=X?`${U}${H}${w}`:U,t=Q.length<100&&O&&X?Q.replace(/\.?0*$/,""):Q;return $?`${t}${N}`:`${N}${t}`}formatBigIntToSafeValue(N,A){let T=A||this.decimal||r,H=Math.max(T,ON(this.decimalMultiplier));return C({bigIntDecimal:T,decimal:H,value:N})}#A(N,...A){let T=this.#T(this,...A),H=ON(this.decimalMultiplier),P=Math.max(T,H),O=Math.min(P+mT,fT),I=o(O),$=A.reduce((U,X)=>{let Q=this.getBigIntValue(X,O);return XN(N).with("add",()=>U+Q).with("sub",()=>U-Q).with("mul",()=>U*Q/I).with("div",()=>{if(Q===0n)throw RangeError("Division by zero");return U*I/Q}).otherwise(()=>U)},this.bigIntValue*I/this.decimalMultiplier),M=C({bigIntDecimal:O,decimal:O,value:$}),w=this.decimal===void 0?void 0:Math.min(this.decimal,O);return new this.constructor({decimal:w,decimalMultiplier:o(O),identifier:this.toString(),value:M})}#N(N,...A){let T=this.#T(this,...A),H=this.getBigIntValue(A[0]||"0",T),P=this.getBigIntValue(this,T);return XN(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=gN(N)||"0";this.bigIntValue=this.#H(A)}#T(...N){let A=N.map((T)=>{return typeof T==="object"?T.decimal||ON(T.decimalMultiplier):XA(gN(T))}).filter(Boolean);return Math.max(...A,r)}#H(N,A){let T=A?o(A):this.decimalMultiplier,H=ON(T),[P="",O=""]=N.split(".");return BigInt(`${P}${O.padEnd(H,"0")}`)}}var pT=Intl.NumberFormat("fullwide",{maximumFractionDigits:20,useGrouping:!1});function gN(N){let T=`${typeof N==="number"?pT.format(N):qN(N)}`.replaceAll(",",".").split(".");return T.length>1?`${T.slice(0,-1).join("")}.${T.at(-1)}`:T[0]||"0"}function XA(N){let A=N.split(".")[1]?.length||0;return Math.max(A,r)}function qN(N){return typeof N==="object"?"getValue"in N?N.getValue("string"):N.value:N}function yT(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 o(N){return 10n**BigInt(N)}function ON(N){return N.toString().length-1}function hT(N=""){let A=N.toUpperCase(),T=g.get("chains"),[H]=A.split(".");if(T.includes(H))return!0;let[P]=A.split("/");if(T.includes(P))return!0;throw new u({errorKey:"helpers_invalid_identifier",info:{identifier:N,message:`Invalid identifier: ${N}. Expected format: <Chain>.<Ticker> or <Chain>.<Ticker>-<ContractAddress>`}})}var f=[b.Hype,b.Near,b.Ripple,b.Solana,b.Stellar,b.Sui,b.Ton,b.Tron],KN=[b.THORChain,b.Maya],i=new Map,WN=new Map,s=new Map,dT=3600000;function cT(N){let A=s.get(N);if(A?.timestamp&&Date.now()-A.timestamp>dT){s.delete(N);return}return A}function lT(N,A){if(s.size>1000){let T=s.keys().next().value;if(T)s.delete(T)}s.set(N,{...A,timestamp:Date.now()})}class q extends m{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:O}){super(typeof N==="object"?N:{decimal:A,value:N});let I=gA(O||`${H}.${P}`);this.type=xN(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=RN(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 i.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 u({errorKey:"helpers_invalid_asset_url",info:{urlAsset:N}});let H=N.slice(0,T),P=N.slice(T+1),O=tN({chain:H,rest:P}).when(({rest:I})=>I.includes(".."),({chain:I,rest:$})=>`${I}.${$.replace(/\.\./g,"~")}`).when(({chain:I,rest:$})=>KN.includes(I)&&$.includes("."),({chain:I,rest:$})=>`${I}.${$.replace(/\./g,"/")}`).otherwise(({chain:I,rest:$})=>`${I}.${$.replace(/__/g,".")}`);return q.from({asset:O,value:A})}static from({value:N=0,fromBaseDecimal:A,asyncTokenLookup:T,...H}){let P=N instanceof m?N.getValue("string"):N,O="address"in H&&"chain"in H,I=eT(H);if(I===null&&T&&O){let{chain:HN,address:d}=H;return iT({address:d,chain:HN,fromBaseDecimal:A,parsedValue:P})}let $=O&&!I?`${H.chain}.UNKNOWN-${H.address}`:I,{identifier:M,decimal:w}=UN($),{chain:U,isSynthetic:X,isTradeAsset:Q,address:E}=gA(M),{baseDecimal:t}=RN(U),z=i.get(f.includes(U)?M:M.toUpperCase());if(!z&&T&&!X&&!Q)return(async()=>{let{ticker:HN}=y(M),d=await WA({address:E,chain:U,ticker:HN});return vN({decimal:d.decimals,identifier:d.identifier,value:A?e(BigInt(P),A):P})})();let J=z?.decimal||w;c({condition:!J&&!T,id:`assetValue_static_decimal_not_found_${U}`,warning:`Couldn't find static decimal for one or more tokens on ${U} (Using default ${t} 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:TN,identifier:h,tax:n}=z||{decimal:J||t,identifier:M},$N=A?e(BigInt(P),A):e(P,TN);return X||Q?rT(h,$N):vN({decimal:TN,identifier:h,tax:n,value:$N})}static async loadStaticAssets(N){let{loadTokenLists:A}=await import("@swapkit/tokens"),T=await A(N,{source:g.get("envs").isDev?"dev":"prod"});for(let{tokens:H}of Object.values(T))for(let P of H){let{identifier:O}=P,{chain:I,symbol:$}=y(O),{address:M}=FN($,I),{baseDecimal:w}=RN(I),U=f.includes(I)?O:O.toUpperCase(),X="decimals"in P&&P.decimals!==void 0?P.decimals:w,Q="logoURI"in P&&P.logoURI?P.logoURI:`https://storage.googleapis.com/token-list-swapkit-dev/images/${O.toLowerCase()}.png`,E={decimal:X,identifier:O,logoURI:Q,tax:"tax"in P?P.tax:void 0};if(i.set(U,E),M){let t=f.includes(I)?`${I}:${M}`:`${I}:${M.toUpperCase()}`;WN.set(t,O)}}return!0}static setStaticAssets(N){i.clear(),WN.clear();for(let[A,T]of N.entries()){let{identifier:H}=T,{chain:P,symbol:O}=y(H),{address:I}=FN(O,P),{baseDecimal:$}=RN(P),M=T.chain??P,w=T.address??I,U=f.includes(M)?H:H.toUpperCase(),X=T.decimals??T.decimal??$,Q=T.logoURI??`https://storage.googleapis.com/token-list-swapkit-dev/images/${H.toLowerCase()}.png`,E={decimal:X,identifier:U,logoURI:Q,tax:T.tax};if(i.set(U,E),w){let t=f.includes(M)?`${M}:${w}`:`${M}:${w.toUpperCase()}`;WN.set(t,H)}}return!0}static get staticAssets(){return i}}function iL(N){let A=q.from({chain:N});return tN(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 WA({chain:N,address:A,ticker:T}){let P=f.includes(N)?`${N}:${A||T}`:`${N}:${A||T}`.toUpperCase(),O=cT(P);if(O)return O;if(!A){let{baseDecimal:M}=RN(N);return{decimals:M,identifier:`${N}.${T||"UNKNOWN"}`}}let I=await uA({address:A,chain:N}),$=`${N}.${I.ticker||T||"UNKNOWN"}-${A}`;return c({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&&lT(P,{decimals:I.decimals,identifier:$}),{decimals:I.decimals,identifier:$}}function vN({identifier:N,decimal:A,value:T,tax:H}){return hT(N),new q({decimal:A,identifier:N,tax:H,value:e(T,A)})}function rT(N,A=0){let T=N.includes(".")?N.split(".")?.[0]?.toUpperCase():void 0,H=T?KN.includes(T):!1,P=N.slice(0,14).includes("~")?"~":"/",[O,I]=H?N.split(".").slice(1).join().split(P):N.split(P);if(!(O&&I))throw new u({errorKey:"helpers_invalid_asset_identifier",info:{identifier:N}});return new q({decimal:8,identifier:`${T||b.THORChain}.${O}${P}${I}`,value:e(A,8)})}async function iT({address:N,chain:A,fromBaseDecimal:T,parsedValue:H}){let{decimals:P,identifier:O}=await WA({address:N,chain:A}),I=T?e(BigInt(H),T):H;return vN({decimal:P,identifier:O,value:I})}function e(N,A){return typeof N==="bigint"?C({bigIntDecimal:A,decimal:A,value:N}):N}function sT(N){let A=tN(N).when((T)=>("chain"in T)&&T.chain!==void 0,({chain:T})=>T).otherwise((T)=>{let H=y(T.asset);return H.synth?b.THORChain:H.chain});if(!oT.includes(A.toUpperCase())){let T="asset"in N?N.asset:A;throw new u({errorKey:"helpers_invalid_asset_identifier",info:{identifier:T,message:`Unsupported chain "${A}" - use the AssetValue constructor directly`}})}}function eT(N){if(sT(N),"chain"in N){let{chain:P,address:O}=N;if(O){let I=f.includes(P)?`${P}:${O}`:`${P}:${O.toUpperCase()}`,$=WN.get(I);if($)return $;return null}return P}let{chain:A,symbol:T}=y(N.asset);return xN({chain:A,symbol:T})==="Native"?A:N.asset}function aT(N,A,T){let H=N.split("."),P=H[0]?.toUpperCase(),O=KN.includes(P),I=T?"~":"/",[$,M=""]=O?H.slice(1).join(".").split(I):N.split(I);if(!($&&M))throw new u({errorKey:"helpers_invalid_asset_identifier",info:{identifier:N}});let{ticker:w,address:U}=EA({chain:$,symbol:M}),X=`${$}${I}${M}`;return{address:U,chain:P,isGasAsset:!1,isSynthetic:A,isTradeAsset:T,symbol:X,ticker:w}}function NH(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:O}=EA({chain:T,symbol:H}),I;try{I=P&&CT.includes(T)&&uN(P)?uN(P):P}catch{I=P}let $=I?`${O}-${I}`:H;return{address:I,chain:T,isGasAsset:UA({chain:T,symbol:H}),isSynthetic:!1,isTradeAsset:!1,symbol:$,ticker:O}}function gA(N){let A=N.slice(0,14),T=A.includes("/"),H=A.includes("~");if(T||H)return aT(N,T,H);return NH(N)}function EA({symbol:N,chain:A}){let{ticker:T,address:H}=FN(N,A);return{address:H&&!f.includes(A)?H.toLowerCase():H,ticker:T}}class EN extends m{eq(N){return this.eqValue(N)}static fromBigInt(N,A){return new EN({decimal:A,value:C({bigIntDecimal:A,decimal:A,value:N})})}}function bA(N=!0){return N?"https://gateway.liquify.com/chain/thorchain_midgard":"https://midgard.mayachain.info"}function TH(N=!0){let A=bA(N);return N?`${A}/v2/thorname`:`${A}/v2/mayaname`}function HH(N){return function(T){let H=T?`?status=${T}`:"";return _.get(`${N}/v2/pools${H}`)}}function PH(N){return function(T){return _.get(`${N}/v2/pool/${T}`)}}function LH(N){return function(T,H){let P=H?`?period=${H}`:"";return _.get(`${N}/v2/pool/${T}/stats${P}`)}}function FH(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 O=P.toString()?`?${P.toString()}`:"";return _.get(`${N}/v2/history/depths/${T}${O}`)}}function OH(N){return function(){return _.get(`${N}/v2/network`)}}function RH(N){return function(){return _.get(`${N}/v2/health`)}}function IH(N){return function(){return _.get(`${N}/v2/nodes`)}}function BH(N){return function(T){return _.get(`${N}/v2/node/${T}`)}}function GH(N){return function(){return _.get(`${N}/v2/mimir/votes`)}}function $H(N){return function(){return _.get(`${N}/v2/mimir`)}}function YH(N){return function(){return _.get(`${N}/v2/constants`)}}function MH(N){return function(){return _.get(`${N}/v2/stats`)}}function _H(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 _.get(`${N}/v2/history/earnings${P}`)}}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 O=P.toString()?`?${P.toString()}`:"",I=T?`/swaps/${T}`:"/swaps";return _.get(`${N}/v2/history${I}${O}`)}}function SH(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 _.get(`${N}/v2/history/tvl${P}`)}}function uH(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 UH(N){return function(T){let H=uH(T);return _.get(`${N}/v2/actions${H}`)}}function XH(N){return function(T){return _.get(`${N}/v2/member/${T}`)}}function gH(N){return function(T){let H=T?`/${T}`:"";return _.get(`${N}/v2/members${H}`)}}function WH(N){return function(T,H){let P=H?`&asset=${H}`:"";return _.get(`${N}/v2/saver/${T}${P?`?${P.substring(1)}`:""}`)}}function EH(N){return function(T){return _.get(`${N}/v2/savers/${T}`)}}function bH(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 O=P.toString()?`?${P.toString()}`:"",I=T?`/savers/${T}`:"/savers";return _.get(`${N}/v2/history${I}${O}`)}}function nH(N){return function(T){return _.get(`${N}/v2/balance/${T}`)}}function wH(N){return async function(T){let H=(P)=>{if(P?.cause?.status===404)return;throw P};return await _.get(`${N}/lookup/${T}`,{onError:H,retry:{maxRetries:1}})}}function zH(N){return async function(T){let H=(P)=>{if(P?.cause?.status===404)return[];throw P};return await _.get(`${N}/rlookup/${T}`,{onError:H,retry:{maxRetries:1}})}}function JH(N){return async function(T){let H=(P)=>{if(P?.cause?.status===404)return[];throw P};return await _.get(`${N}/owner/${T}`,{onError:H,retry:{maxRetries:1}})}}function a({asset:N,value:A}){return q.from({asset:N,fromBaseDecimal:AH(bN.THORChain).baseDecimal,value:A})}function QH({liquidityPositionGetter:N,isThorchain:A}){return async function(H){let P=await N(H),O=A?"rune":"cacao";return P.pools.map((I)=>({[`${O}Pending`]:a({asset:"THOR.RUNE",value:I.runePending}),[`${O}RegisteredAddress`]:I.runeAddress,[`${O}Withdrawn`]:a({asset:"THOR.RUNE",value:I.runeWithdrawn}),[O]:a({asset:"THOR.RUNE",value:I.runeAdded}),asset:a({asset:I.pool,value:I.assetAdded}),assetPending:a({asset:I.pool,value:I.assetPending}),assetRegisteredAddress:I.assetAddress,assetWithdrawn:a({asset:I.pool,value:I.assetWithdrawn}),dateFirstAdded:I.dateFirstAdded,dateLastAdded:I.dateLastAdded,poolShare:new EN(I.liquidityUnits).div(I.pool)}))}}function nA(N){let A=N===bN.THORChain,T=bA(A),H=TH(A),P=XH(T);return{getActions:UH(T),getBalance:nH(T),getConstants:YH(T),getEarningsHistory:_H(T),getHealth:RH(T),getLiquidityPosition:QH({isThorchain:A,liquidityPositionGetter:P}),getLiquidityPositionRaw:P,getMembers:gH(T),getMimir:$H(T),getMimirVotes:GH(T),getNameDetails:wH(H),getNamesByAddress:zH(H),getNamesByOwner:JH(H),getNetworkInfo:OH(T),getNode:BH(T),getNodes:IH(T),getPool:PH(T),getPoolDepthHistory:FH(T),getPoolStats:LH(T),getPools:HH(T),getSaverDetails:WH(T),getSavers:EH(T),getSaversHistory:bH(T),getStats:MH(T),getSwapHistory:DH(T),getTVLHistory:SH(T)}}var wA=nA(bN.THORChain),zA=nA(bN.Maya);var oN={};lN(oN,{searchTokens:()=>XP,getTrackerDetails:()=>YP,getTokenListProviders:()=>uP,getTokenList:()=>UP,getTokenApproval:()=>SP,getSwapTo:()=>QP,getSwapQuote:()=>MP,getRouteWithTx:()=>_P,getPrice:()=>gP,getNearDepositChannel:()=>bP,getGasRate:()=>WP,getChainflipDepositChannel:()=>EP,getChainBalance:()=>DP,SKRequestClient:()=>x});import{EVMChains as yN}from"@swapkit/types";import{match as $P,P as GN}from"ts-pattern";import{Chain as nN,ChainId as IN}from"@swapkit/types";import{array as W,boolean as K,coerce as jA,number as D,object as Y,optional as G,string as F,union as kN,unknown as mN,z as L}from"zod";var VA;((H)=>{H.CHEAPEST="CHEAPEST";H.FASTEST="FASTEST";H.RECOMMENDED="RECOMMENDED"})(VA||={});var wN;((U)=>{U.PSBT="PSBT";U.EVM="EVM";U.COSMOS="COSMOS";U.RADIX="RADIX";U.NEAR="NEAR";U.STELLAR="STELLAR";U.TON="TON";U.TRON="TRON";U.EIP_712_HYPE_SEND_ASSET="EIP_712_HYPE_SEND_ASSET";U.EIP_712_HYPE_WITHDRAW="EIP_712_HYPE_WITHDRAW"})(wN||={});var xA;((J)=>{J.approve="approve";J.claim="claim";J.deposit="deposit";J.donate="donate";J.lending="lending";J.lp_action="lp_action";J.native_contract_call="native_contract_call";J.native_send="native_send";J.stake="stake";J.streaming_swap="streaming_swap";J.swap="swap";J.thorname_action="thorname_action";J.token_contract_call="token_contract_call";J.token_transfer="token_transfer";J.unknown="unknown";J.unstake="unstake"})(xA||={});var qA;((E)=>{E.swap="swap";E.aggregation="aggregation";E.addLiquidity="addLiquidity";E.withdrawLiquidity="withdrawLiquidity";E.addSavers="addSavers";E.withdrawSavers="withdrawSavers";E.borrow="borrow";E.repay="repay";E.name="name";E.donate="donate";E.claim="claim";E.stake="stake";E.unstake="unstake"})(qA||={});var vA;(($)=>{$.unknown="unknown";$.not_started="not_started";$.pending="pending";$.swapping="swapping";$.completed="completed";$.refunded="refunded";$.failed="failed"})(vA||={});var tA;((z)=>{z.not_started="not_started";z.starting="starting";z.broadcasted="broadcasted";z.mempool="mempool";z.inbound="inbound";z.outbound="outbound";z.swapping="swapping";z.completed="completed";z.refunded="refunded";z.partially_refunded="partially_refunded";z.dropped="dropped";z.reverted="reverted";z.replaced="replaced";z.retries_exceeded="retries_exceeded";z.parsing_error="parsing_error"})(tA||={});var RF=Y({address:G(F()),chain:L.enum(nN).optional(),chainId:L.enum(IN),coingeckoId:G(F()),decimals:jA.number(),extensions:G(L.looseObject({})),identifier:F(),logoURI:G(F()),name:G(F()),shortCode:G(F()),symbol:G(F()),ticker:F()}),IF=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"}),BF=L.object({forceUpdate:L.string().toLowerCase().transform((N)=>N==="true").pipe(L.boolean()).optional()}),GF=Y({error:F(),message:F()}),NN=Y({address:G(F()),chain:L.enum(nN),decimal:G(D()),isGasAsset:K(),isSynthetic:K(),symbol:F(),tax:G(Y({buy:D(),sell:D()})),ticker:F()}),KA=Y({id:F(),market_cap:D(),name:F(),price_change_24h_usd:D(),price_change_percentage_24h_usd:D(),sparkline_in_7d:W(D()),timestamp:F(),total_volume:D()}).partial(),$F=Y({cg:G(KA),identifier:F(),price_usd:D(),provider:F(),timestamp:D()}),kA=W(Y({cg:G(KA),identifier:F(),price_usd:D(),provider:F(),timestamp:D()}).partial()),YF=Y({affiliate:G(F().describe("Affiliate thorname")),affiliateFee:G(D().describe("Affiliate fee in basis points").refine((N)=>N===Math.floor(N)&&N>=0,{message:"affiliateFee must be a positive integer",path:["affiliateFee"]})),allowSmartContractReceiver:G(K().describe("Allow smart contract as recipient")),allowSmartContractSender:G(K().describe("Allow smart contract as sender")),buyAsset:F().describe("Asset to buy"),cfBoost:G(K().describe("Set to true to enable CF boost to speed up Chainflip swaps. BTC only.")),destinationAddress:G(F().describe("Address to send asset to")),disableSecurityChecks:G(K().describe("Disable security checks")),includeTx:G(K().describe("Set to true to include an transaction object (EVM only)")),providers:G(W(F().describe("List of providers to use").refine((N)=>Z[N]!==void 0,{message:"Invalid provider",path:["providers"]}))),referrer:G(F().describe("Referrer address (referral program)")),sellAmount:F().describe("Amount of asset to sell").refine((N)=>+N>0,{message:"sellAmount must be greater than 0",path:["sellAmount"]}),sellAsset:F().describe("Asset to sell"),slippage:G(D().describe("Slippage tolerance as a percentage. Default is 3%.")),sourceAddress:G(F().describe("Address to send asset from"))}).refine((N)=>N.sellAsset!==N.buyAsset,{message:"Must be different",path:["sellAsset","buyAsset"]}),MF=Y({metadata:K(),tokens:W(Y({identifier:F()}))}),mA=Y({destinationAddress:F()}),ZH=mA.extend({affiliateFees:W(Y({brokerAddress:F(),feeBps:D()})).optional(),brokerCommissionBps:D().optional(),buyAsset:Y({asset:F(),chain:F()}),channelMetadata:Y({cfParameters:F().optional(),gasBudget:F().optional(),message:F().optional()}).optional(),dcaParameters:Y({chunkInterval:D().optional(),numberOfChunks:D().optional()}).optional(),maxBoostFeeBps:D().optional(),refundParameters:Y({minPrice:F().optional(),refundAddress:F().optional(),retryDuration:D().optional()}).optional(),sellAsset:Y({asset:F(),chain:F()})}),fA=Y({channelId:F(),depositAddress:F()}),JA=mA.extend({affiliateFees:Y({feeBps:D(),nearId:F()}).optional(),buyAsset:F(),sellAmount:F(),sellAsset:F(),slippage:jA.number(),sourceAddress:F()}),QA=Y({amountIn:F(),amountInFormatted:F(),amountInUsd:F(),amountOut:F(),amountOutFormatted:F(),amountOutUsd:F(),deadline:F().optional(),minAmountIn:F(),minAmountOut:F(),timeEstimate:D().optional(),timeWhenInactive:F().optional()}),_F=QA.extend({depositAddress:F(),quote:QA,signature:F(),timestamp:F(),tx:mN()}),pA=Y({buyAsset:F(),buyAssetAmount:F(),buyAssetAmountMaxSlippage:F(),deadline:F().optional(),depositAddress:F(),depositAmount:F(),depositAsset:F(),tx:mN()}),jH=Y({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())}),VH=Y({currentStage:F(),inboundConfirmation:D(),inboundObservation:D(),outboundDelay:D(),outboundObservation:D(),streamingSwap:D()}),xH=Y({count:G(D()),interval:G(D()),quantity:G(D()),subSwapsMap:G(W(D()))}),qH=L.object({currentLegIndex:L.optional(L.number()),estimatedTimeToComplete:L.number(),estimates:L.optional(VH),providerDetails:L.optional(L.object({streamingDetails:L.optional(xH)}))}),vH=Y({affiliate:G(NN),liquidity:G(NN),network:G(NN),protocol:G(NN),tax:G(NN)}),tH=Y({affiliate:F(),bps:F(),isReferrer:K()}),KH=Y({affiliate:G(F()),affiliateFees:G(W(tH)),broadcastedAt:G(D()),explorerUrl:G(F()),fees:G(vH),images:G(Y({chain:G(F()),from:G(F()),provider:G(F()),to:G(F())})),provider:G(L.enum(Z)),providerAction:L.optional(L.enum(qA)),quoteId:G(F()),wallet:G(F())}),AN=L.object({block:L.number(),chainId:L.enum(IN),finalAddress:L.optional(L.string()),finalAsset:L.optional(NN),finalisedAt:L.number(),fromAddress:L.string(),fromAmount:L.string(),fromAsset:L.string(),hash:L.string(),meta:L.optional(KH),payload:L.optional(jH),status:L.enum(vA),toAddress:L.string(),toAmount:L.string(),toAsset:L.string(),trackingStatus:L.optional(L.enum(tA)),transient:L.optional(qH),type:L.enum(xA)}),yA=AN.extend({legs:L.array(AN)}),DF=AN.extend({legs:W(AN)}),SF=AN.extend({legs:W(AN)}),fN=W(Y({amount:F(),asset:F(),chain:F(),protocol:L.enum(Z),type:L.enum(QN)})),pN=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")}),kH=/^(?:0x[0-9a-fA-F]+|[0-9]+)$/;function mH(N){return N===""||kH.test(N)}function uF(N){return N?BigInt(N):0n}function UF(N){let A=typeof N==="bigint"?N:BigInt(N);return A>0n?`0x${A.toString(16)}`:"0x0"}var BN=F().refine(mH,{message:"Value must be a base-10 integer string or 0x-prefixed hex integer string"}).describe("Value to send in base units as a base-10 integer string or 0x-prefixed hex integer string"),fH=Y({data:F().describe("Data to send"),from:F().describe("Address of the sender"),to:F().describe("Address of the recipient"),value:BN}),pH=L.object({data:L.string().optional(),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(),value:BN.optional(),visible:L.boolean()}),yH=W(kN([F(),D(),W(F()),Y({from:F(),value:BN}).describe("Parameters to pass to the contract method")])),XF=Y({approvalSpender:G(F().describe("Address of the spender to approve")),approvalToken:G(F().describe("Address of the token to approve spending of")),contractAddress:F().describe("Address of the contract to interact with"),contractMethod:F().describe("Name of the method to call"),contractParamNames:W(F().describe("Names of the parameters to pass to the contract method")),contractParams:yH}),oH=Y({typeUrl:F("/types.MsgDeposit"),value:Y({coins:W(Y({amount:F(),asset:Y({chain:F(),symbol:F(),synth:K(),ticker:F()})})),memo:F(),signer:F()})}),CH=Y({typeUrl:F("/types.MsgSend"),value:Y({amount:W(Y({amount:F(),denom:F()})),fromAddress:F(),toAddress:F()})}),hH=Y({typeUrl:F(),value:CH.shape.value.or(oH.shape.value)}),dH=Y({amount:W(Y({amount:F(),denom:F()})),gas:F()}),cH=Y({accountNumber:D(),chainId:L.enum(IN),fee:dH,memo:F(),msgs:W(hH),sequence:D()}),lH=L.array(L.object({calldata:L.array(L.string()),contractAddress:L.string(),entrypoint:L.string()})),rH=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")}),iH=L.object({messages:L.array(rH),sendMode:L.number().describe("TON wallet send mode for the whole transfer")}),gF="USDC:0x6d1e7cde53ba9467b783cb7c530ce054",sH=L.looseObject({domain:L.looseObject({chainId:G(kN([D(),F()])),name:G(F()),verifyingContract:G(F()),version:G(F())}),message:L.record(F(),mN()),primaryType:F(),types:L.record(F(),W(L.looseObject({name:F(),type:F()})))}),eH=L.looseObject({amount:F(),destination:F(),destinationDex:F(),fromSubAccount:F(),hyperliquidChain:F(),nonce:D().int(),signatureChainId:F(),sourceDex:F(),token:F(),type:L.literal("sendAsset")}),oA=L.looseObject({action:L.looseObject({type:F()}),submitTo:F(),typedData:sH}),WF=oA.extend({action:eH}),CA=kN([fH,cH,pH,iH,oA,F()]),aH=CA.or(lH),NP=Y({affiliate:F().describe("Affiliate address").optional(),affiliateFee:D().describe("Affiliate fee").optional(),buyAsset:F().describe("Asset to buy"),destinationAddress:F().describe("Destination address"),estimatedTime:pN.optional(),provider:L.enum(Z),sellAsset:F().describe("Asset to sell"),slipPercentage:D().describe("Slippage as a percentage"),sourceAddress:F().describe("Source address")}),EF=NP.omit({destinationAddress:!0,slipPercentage:!0,sourceAddress:!0}),AP=Y({asset:F().describe("Asset name"),image:F().describe("Asset image"),price:D().describe("Price in USD")}),TP=ZH,hA=Y({assets:G(W(AP)),maxStreamingQuantity:D().optional(),referrer:F().optional(),streamingInterval:D().optional(),tags:W(L.enum(VA))}),dA=hA.extend({affiliate:G(F()),affiliateFee:G(F()),approvalAddress:G(F().describe("Approval address for swap")),chainflip:TP.optional(),garden:JA.optional(),near:JA.optional(),priceImpact:G(D().describe("Price impact")),referrer:G(F()),txType:G(L.enum(wN))}),cA=W(Y({code:L.enum(JN),display:F(),tooltip:F().optional()})),HP=Y({buyAmount:F().describe("Buy amount"),buyAmountMaxSlippage:F().describe("Buy amount max slippage"),buyAsset:F().describe("Asset to buy"),fees:G(fN),provider:L.enum(Z),sellAmount:F().describe("Sell amount"),sellAsset:F().describe("Asset to sell")}),PP=Y({buyAsset:F().describe("Asset to buy"),destinationAddress:G(F().describe("Destination address")),estimatedTime:G(pN),expectedBuyAmount:F().describe("Expected Buy amount"),expectedBuyAmountMaxSlippage:F().describe("Expected Buy amount max slippage"),expiration:G(F().describe("Expiration")),fees:fN,inboundAddress:G(F().describe("Inbound address")),legs:W(HP),memo:G(F().describe("Memo")),meta:dA,providers:W(L.enum(Z)),routeId:F().describe("Route ID"),sellAmount:F().describe("Sell amount"),sellAsset:F().describe("Asset to sell"),sourceAddress:G(F().describe("Source address")),targetAddress:G(F().describe("Target address")),totalSlippageBps:D().describe("Total slippage in bps"),tx:G(aH),txType:G(L.enum(wN)),warnings:cA}),lA=Y({error:G(F().describe("Error message")),providerErrors:G(W(Y({errorCode:G(L.enum(PN)),message:G(F()),provider:L.enum(Z).optional()}))),quoteId:F().describe("Quote ID"),routes:W(PP)}),rA=L.object({chainId:L.enum(IN),createdAt:L.date(),id:L.number(),unit:L.string(),value:L.string()}),LP=L.array(rA),iA=L.union([rA,LP]),bF=W(Y({chain:L.enum(nN),decimal:D(),identifier:F(),symbol:F(),ticker:F(),value:F()})),nF=L.union([L.object({amount:L.string(),spender:L.string(),tokenIdentifier:L.string(),userWalletAddress:L.string()}),L.object({amount:L.string(),chainId:L.enum(IN),spender:L.string(),tokenContractAddress:L.string(),userWalletAddress:L.string()}),L.object({routeId:L.string()})]),wF=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:BN})),approvedAmount:L.string(),isApproved:L.boolean()}),FP=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:BN.describe("ETH value (always '0' for approvals)")}),OP=L.object({tx:L.string(),txType:L.literal("STELLAR")}),RP=L.union([FP,OP]),ZA=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:fN,provider:L.enum(Z),sellAmount:L.string().describe("Sell amount"),sellAsset:L.string().describe("Asset to sell")}),sA=ZA.extend({estimatedTime:L.optional(pN),expiration:L.optional(L.string().describe("Expiration")),legs:L.array(ZA),providers:L.array(L.enum(Z)),routeId:L.string().describe("Route ID"),totalSlippageBps:L.number().describe("Total slippage in bps"),warnings:cA}).omit({provider:!0}),eA=L.object({method:L.string(),payload:L.optional(L.unknown()),url:L.string()}),IP=sA.extend({meta:hA,nextActions:L.optional(L.array(eA))}),zF=L.object({error:L.optional(L.string().describe("Error message")),providerErrors:L.optional(L.array(L.object({errorCode:L.optional(L.enum(PN)),message:L.optional(L.string()),provider:L.enum(Z).optional()}))),quoteId:L.string().describe("Quote ID"),routes:L.array(IP)}),JF=L.object({providers:L.array(L.enum(Z)).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')")}),BP=L.object({chain:L.enum(nN).describe("Chain the asset is on"),identifier:L.string().describe("Asset identifier (e.g., 'ETH.USDC-0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48')"),providers:L.array(L.enum(Z)).describe("Providers that support this trading pair"),symbol:L.string().describe("Asset symbol"),ticker:L.string().describe("Asset ticker")}),QF=L.object({buyAssets:L.array(BP).describe("List of assets that can be swapped to"),sellAsset:L.string().describe("The input sell asset identifier")}),aA=sA.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:dA,sourceAddress:L.string().describe("Source address"),targetAddress:L.optional(L.string().describe("Target address")),tx:G(CA),txType:L.optional(L.enum(wN))}),GP=L.object({data:L.optional(L.record(L.string(),L.string().optional())),errorCode:L.enum(PN),message:L.string().optional(),provider:L.enum(Z).optional()}),ZF=L.object({error:L.optional(L.string().describe("Error message")),providerErrors:L.optional(L.array(GP)),quoteId:L.string().describe("Quote ID"),routes:L.array(aA)}),NT=aA.extend({approvalTx:RP.optional().describe("Optional approval transaction required before swap execution"),nextActions:L.optional(L.array(eA)),swapId:L.string().describe("The unique swap ID for tracking")});var x=_.extend({dynamicHeader:async()=>{let N=g.get("widgetId"),A=g.get("widgetKey");if(N&&A&&typeof window<"u"){let H=Math.floor(Date.now()/1000),P=window.location.origin,O=await HA(A,N,P,H);return{Origin:P,"X-Signature":O,"X-Timestamp":H.toString(),"x-widget-id":N}}let{swapKit:T}=g.get("apiKeys");return T?{"x-api-key":T}:{}}});async function YP(N){let A=await x.post(V("/track"),{json:N});try{let T=yA.safeParse(A);if(!T.success)throw new u("api_v2_invalid_response",T.error);return T.data}catch(T){return A}}async function MP(N){let{getQuote:A}=g.get("endpoints");if(A)return A(N);let H=g.get("v3SwapFlow")?.enabled?"/v3/quote":"/quote",P=await x.post(V(H),{json:N});if(P.error)throw new u("api_v2_server_error",{message:P.error});try{let O=lA.safeParse(P);if(!O.success)throw new u("api_v2_invalid_response",O.error);return O.data}catch{return P}}async function _P(N){let{getRouteWithTx:A}=g.get("endpoints");if(A)return A(N);let H=g.get("v3SwapFlow")?.enabled?"/v3/swap":"/swap",P=await x.post(V(H),{json:N});try{let O=NT.safeParse(P);if(!O.success)throw new u("api_v2_invalid_response",O.error);return O.data}catch(O){return console.error(new u("api_v2_invalid_response",O)),P}}async function DP({chain:N,address:A,scamFilter:T=!0}){let{getBalance:H}=g.get("endpoints");if(H)return H({address:A,chain:N});let P=V(`/balance?chain=${N}&address=${A}`),O=await x.get(P),I=Array.isArray(O)?O:[];return T?JP(I):I}function SP(N){let A=$P(N).with({routeId:GN.string,spender:GN.string},({routeId:T,spender:H})=>V(`/approve?routeId=${T}&sourceAddress=${H}`)).with({assetValue:GN.instanceOf(q),spender:GN.string,userWallet:GN.string},({spender:T,userWallet:H,assetValue:P})=>V(`/approve?tokenIdentifier=${P.toString()}&userWalletAddress=${H}&spender=${T}&amount=${P.getValue("string")}`)).exhaustive();return x.get(A)}function uP(){let N=V("/providers");return x.get(N)}function UP(N){let A=V(`/tokens?provider=${N}`);return x.get(A)}function XP({query:N,chain:A,page:T,limit:H}){let P=new URLSearchParams({query:N});if(A!==void 0)P.set("chain",A);if(T!==void 0)P.set("page",T.toString());if(H!==void 0)P.set("limit",H.toString());let O=V(`/tokens/search?${P.toString()}`);return x.get(O)}async function gP(N){let A=V("/price"),T=await x.post(A,{json:N});try{let H=kA.safeParse(T);if(!H.success)throw new u("api_v2_invalid_response",H.error);return H.data}catch(H){throw new u("api_v2_invalid_response",H)}}async function WP(){let N=V("/gas"),A=await x.get(N);try{let T=iA.safeParse(A);if(!T.success)throw new u("api_v2_invalid_response",T.error);return Array.isArray(T)?T:[T]}catch(T){throw new u("api_v2_invalid_response",T)}}async function EP(N){let{destinationAddress:A}=N;if(!A)throw new u("chainflip_broker_invalid_params");let T=g.get("integrations").chainflip?.brokerUrl||V("/chainflip/broker/channel"),H=await x.post(T,{json:N});try{let P=fA.safeParse(H);if(!P.success)throw new u("api_v2_invalid_response",P.error);return P.data}catch(P){throw new u("api_v2_invalid_response",P)}}async function bP(N){let{destinationAddress:A}=N;if(!A)throw new u("chainflip_broker_invalid_params");let T=V("/near/channel"),H=await x.post(T,{json:N});try{let P=pA.safeParse(H);if(!P.success)throw new u("api_v2_invalid_response",P.error);return P.data}catch(P){throw new u("api_v2_invalid_response",P)}}function V(N){let{isDev:A,apiUrl:T,devApiUrl:H}=g.get("envs"),{enabled:P,quoteUrl:O,swapUrl:I}=g.get("localMode");if(P&&N){let[M]=N.split("?");if(M==="/quote"||M==="/v3/quote")return`${O}${N}`;if(M==="/swap"||M==="/v3/swap")return`${I}${N}`}return`${A?H:T}${N}`}function nP(N){try{return q.from({asset:N.identifier})}catch{return}}var wP=new Set(["OP.OP"]),zP=/(.)\1{6}|\.ORG|\.NET|\.FINANCE|\.COM|WWW|HTTP|\\\\|\/\/|[\s$%:[\]]/im;function JP(N){return N.filter((A)=>{let T=nP(A);if(!T)return!1;if(wP.has(T.toString().toUpperCase()))return!0;return(!yN.includes(T.chain)||T.isGasAsset||!!T.address)&&!zP.test(T.ticker)})}async function QP(N){let{getSwapTo:A}=g.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=V(`/swapTo?${T.toString()}`),P=await x.get(H);if(!Array.isArray(P))return{buyAssets:[],sellAsset:N.sellAsset};let O=[];for(let I of P)try{let $=q.from({asset:I});O.push({chain:$.chain,identifier:$.toString(),providers:[],symbol:$.symbol,ticker:$.ticker})}catch{}return{buyAssets:O,sellAsset:N.sellAsset}}var CN={};lN(CN,{getThorchainQueue:()=>xP,getTcyStakers:()=>pP,getTcyStaker:()=>fP,getTcyClaimers:()=>oP,getTcyClaimer:()=>yP,getTNSPreferredAsset:()=>KP,getTHORNodeTNSDetails:()=>AT,getRunePoolProviderInfo:()=>mP,getRunePoolInfo:()=>kP,getNodes:()=>qP,getMimirInfo:()=>vP,getLastBlock:()=>VP,getInboundAddresses:()=>tP});import{match as ZP}from"ts-pattern";function v(N){let{isStagenet:A}=g.get("envs"),T=g.get("thornodeUrls");return`${ZP({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 jP(N){let A=N==="mayachain"?"mayaname":"thorname";return`${v(N)}/${A}`}function VP(N="thorchain"){return _.get(`${v(N)}/lastblock`)}function xP(N){return _.get(`${v(N)}/queue`)}function qP(N){return _.get(`${v(N)}/nodes`)}function vP(N){return _.get(`${v(N)}/mimir`)}function tP(N){return _.get(`${v(N)}/inbound_addresses`)}async function AT({type:N,name:A}){try{return await _.get(`${jP(N)}/${A}`)}catch{return{affiliate_collector_rune:"",aliases:[],expire_block_height:0,name:A,owner:"",preferred_asset:""}}}async function KP({type:N,tns:A}){let T=await AT({name:A,type:N});if(!T.preferred_asset||T.preferred_asset===".")return;return q.from({asset:T.preferred_asset,asyncTokenLookup:!0})}function kP(N){return _.get(`${v(N)}/runepool`)}function mP({type:N,thorAddress:A}){return _.get(`${v(N)}/rune_provider/${A}`)}function fP({type:N,address:A}){return _.get(`${v(N)}/tcy_staker/${A}`)}function pP(N){return _.get(`${v(N)}/tcy_stakers`)}function yP({type:N,address:A}){return _.get(`${v(N)}/tcy_claimer/${A}`)}function oP(N){return _.get(`${v(N)}/tcy_claimers`)}var CF={...oN,mayachainMidgard:zA,thorchainMidgard:wA,thornode:CN};
5
+ export{dP as a,PN as b,JN as c,Z as d,QN as e,RT as f,IT as g,BT as h,u as i,iP as j,MN as k,sN as l,aP as m,GT as n,j as o,g as p,_ as q,HA as r,_L as s,c as t,VN as u,JT as v,l as w,WL as x,EL as y,bL as z,nL as A,tL as B,vT as C,SA as D,uA as E,UA as F,UN as G,xN as H,y as I,FN as J,KL as K,kL as L,C as M,m as N,hT as O,q as P,iL as Q,EN as R,VA as S,wN as T,xA as U,qA as V,vA as W,tA as X,RF as Y,IF as Z,BF as _,GF as $,NN as aa,KA as ba,$F as ca,kA as da,YF as ea,MF as fa,mA as ga,ZH as ha,fA as ia,JA as ja,_F as ka,pA as la,yA as ma,DF as na,SF as oa,fN as pa,pN as qa,mH as ra,uF as sa,UF as ta,fH as ua,pH as va,yH as wa,XF as xa,cH as ya,lH as za,rH as Aa,iH as Ba,gF as Ca,sH as Da,eH as Ea,oA as Fa,WF as Ga,NP as Ha,EF as Ia,AP as Ja,TP as Ka,hA as La,dA as Ma,cA as Na,PP as Oa,lA as Pa,rA as Qa,iA as Ra,nF as Sa,wF as Ta,FP as Ua,OP as Va,RP as Wa,zF as Xa,JF as Ya,BP as Za,QF as _a,aA as $a,GP as ab,ZF as bb,NT as cb,CF as db};
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{$ as QJ,$a as QQ,A as TG,Aa as kJ,B as OG,Ba as TJ,C as vG,Ca as OJ,D as AG,Da as vJ,E as fG,Ea as AJ,F as yG,Fa as fJ,G as wG,Ga as yJ,H as bG,Ha as wJ,I as cG,Ia as bJ,J as hG,Ja as cJ,K as mG,Ka as hJ,L as uG,La as mJ,M as dG,Ma as uJ,N as lG,Na as dJ,O as L,Oa as lJ,P as pG,Pa as pJ,Q as oG,Qa as oJ,R as rG,Ra as rJ,S as sG,Sa as sJ,T as nG,Ta as nJ,U as iG,Ua as iJ,V as aG,Va as aJ,W as tG,Wa as tJ,X as eG,Xa as eJ,Y as zJ,Ya as zQ,Z as GJ,Za as GQ,_ as JJ,_a as JQ,a as Y,aa as ZJ,ab as ZQ,b as LG,ba as $J,c as RG,ca as XJ,d as YG,da as HJ,e as FG,ea as VJ,f as v,fa as jJ,g as xG,ga as _J,h as d,ha as BJ,i as o,ia as LJ,j as WG,ja as RJ,k as qG,ka as YJ,l as E,la as FJ,m as B,ma as xJ,n as IG,na as WJ,o as KG,oa as qJ,p as MG,pa as IJ,q as S,qa as KJ,r as EG,ra as MJ,s as NG,sa as EJ,t as PG,ta as NJ,u as SG,ua as PJ,v as CG,va as SJ,w as DG,wa as CJ,x as gG,xa as DJ,y as UG,ya as gJ,z as kG,za as UJ}from"./chunk-g60m4sgr.js";export*from"@swapkit/tokens";export*from"@swapkit/types";var A={average:1,fast:1.5,fastest:2};function N(z="average"){let G=E.get("feeMultipliers");if(G&&G[z]!==void 0)return G[z];return A[z]}function f(z="average"){let G=N(z),Q=10n,J=BigInt(Math.round(G*10));return{denominator:Q,numerator:J}}function zz(z,G="average"){let{numerator:Q,denominator:J}=f(G);return z*Q/J}function Gz(z,G="average",Q=!1){let J=N(G),Z=z*J;return Q?Math.floor(Z):Z}import{Chain as P,EVMChains as y}from"@swapkit/types";function I(z,G){if("index"in G)return[...z.slice(0,z.length-1),G.index];if("change"in G){let[Q,J,Z,,$]=z;return[Q,J,Z,G.change,$]}if("account"in G){let[Q,J,,Z,$]=z;return[Q,J,G.account,Z,$]}return z}function w([z,G,Q,J,Z],{allHardened:$}={}){let H=$?"'":"",V=typeof Z!=="number";if(typeof J!=="number")return`m/${z}'/${G}'/${Q}'`;return`m/${z}'/${G}'/${Q}'/${J}${H}${V?"":`/${Z}${H}`}`}function $z({chain:z,index:G,addressIndex:Q=0,type:J}){if(y.includes(z)){if(J&&["legacy","account"].includes(J))return[44,60,0,G];if(J==="ledgerLive")return[44,60,G,0,Q];return I(Y[z],{index:G})}if(z===P.Solana){if(J==="account")return[44,501,0,G];return I(Y[z],{index:G})}let Z=z===P.Litecoin?2:0;switch(J){case"nativeSegwitMiddleAccount":return[84,Z,G,0,Q];case"segwit":return[49,Z,0,0,G];case"legacy":return[44,Z,0,0,G];default:return I(Y[z],{index:G})}}function Xz(z){let[G,Q,J]=z.split("/").map((Z)=>Number.parseInt(Z,10));switch(Q){case 44:return"legacy";case 49:return"p2sh";default:return"bech32"}}var Hz=Object.keys(Y).reduce((z,G)=>{return z[G]=w(Y[G]),z},{});import{Chain as b,getChainConfig as c}from"@swapkit/types";function h({liquidityUnits:z,poolUnits:G,runeDepth:Q}){let J=j(z),Z=j(G),$=j(Q),H=J.mul($),V=Z.mul(Z).mul(2),X=Z.mul(J).mul(2),_=J.mul(J),R=Z.mul(Z).mul(Z);return H.mul(V.sub(X).add(_)).div(R)}function m({liquidityUnits:z,poolUnits:G,assetDepth:Q}){let J=j(z),Z=j(G),$=j(Q),H=J.mul($),V=Z.mul(Z).mul(2),X=Z.mul(J).mul(2),_=J.mul(J),R=H.mul(V.sub(X).add(_)),F=Z.mul(Z).mul(Z);return R.div(F)}function Bz({percent:z,runeDepth:G,liquidityUnits:Q,poolUnits:J}){return h({liquidityUnits:Q,poolUnits:J,runeDepth:G}).mul(z)}function Lz({percent:z,assetDepth:G,liquidityUnits:Q,poolUnits:J}){return m({assetDepth:G,liquidityUnits:Q,poolUnits:J}).mul(z)}function j(z){return L.fromBigInt(BigInt(z),c(b.THORChain).baseDecimal)}function u({liquidityUnits:z,poolUnits:G,runeDepth:Q,assetDepth:J}){return{assetAmount:j(J).mul(z).div(G),runeAmount:j(Q).mul(z).div(G)}}function Rz({liquidityUnits:z,poolUnits:G,runeDepth:Q,assetDepth:J,percent:Z}){return Object.fromEntries(Object.entries(u({assetDepth:J,liquidityUnits:z,poolUnits:G,runeDepth:Q})).map(([$,H])=>[$,H.mul(Z)]))}function Yz({runeDepth:z,poolUnits:G,assetDepth:Q,liquidityUnits:J,runeAmount:Z,assetAmount:$}){let H=new L({decimal:8,value:z}),V=new L({decimal:8,value:Q}),X=new L({decimal:8,value:G}),_=new L({decimal:8,value:Z}),R=new L({decimal:8,value:$}),F=_.mul(V),K=R.mul(H),g=_.mul(R),U=H.mul(V),k=X.mul(F.add(K.add(g.mul(2)))),T=F.add(K.add(U.mul(2))),M=k.div(T),q=j(J).add(M);if(M.getBaseValue("number")===0)return q.div(X).getBaseValue("number");let O=X.add(q);return q.div(O).getBaseValue("number")}function Fz({runeAmount:z,assetAmount:G,runeDepth:Q,assetDepth:J}){if(z==="0"||G==="0"||Q==="0"||J==="0")return 0;let Z=j(Q),$=j(J),H=j(G),V=j(z),X=H.mul(Z).sub($.mul(V)),_=$.mul(V).add(Z.mul($));return Math.abs(X.div(_).getBaseValue("number"))}import{Chain as x}from"@swapkit/types";import{match as l}from"ts-pattern";function Mz({type:z,address:G}){return`${z}:${G}`}function Ez({address:z,unbondAmount:G}){return`${"UNBOND"}:${z}:${G}`}function Nz(z){return W("POOL+",z)}function Pz({chain:z,symbol:G,address:Q,...J}){let Z=p({chain:z,symbol:G}),$=Q?`:${Q}:`:":";return W(`${"+"}:${Z}${$}`,J)}function Sz({chain:z,symbol:G,ticker:Q,basisPoints:J,targetAsset:Z}){let $=z==="ETH"&&Q!=="ETH"?`${Q}-${G.slice(-3)}`:G,H=Z?`:${Z}`:"";return`${"-"}:${z}.${$}:${J}${H}`}function Cz({basisPoints:z,...G}){return W(`${"POOL-"}:${z}`,G)}function Dz({name:z,chain:G,address:Q,owner:J}){let Z=`${"~"}:${z}:${G}:${Q}`,$=J?`:${J}`:"";return`${Z}${$}`}function gz({name:z,chain:G,asset:Q,payout:J,owner:Z}){return`${"~"}:${z}:${G}:${J}:${Z}:${Q}`}function Uz(z,{address:G}){return`${z}:${G}`}function kz(z,{unstakeBps:G,...Q}){let J=G?`:${G}`:"",Z=`${z}${J}`;return W(`${Z}`,Q)}function W(z,{affiliateAddress:G,affiliateBasisPoints:Q}={}){let J=`${z}${G?`:${G}:${Q||0}`:""}`;return J.endsWith(":")?J.slice(0,-1):J}function p({chain:z,symbol:G}){return l(z).with(x.Bitcoin,x.Dogecoin,x.Litecoin,()=>z.slice(0,1).toLowerCase()).with(x.BitcoinCash,()=>"c").otherwise(()=>`${z}.${G}`)}function Tz(z){if(z<0)throw new B({errorKey:"helpers_invalid_number_of_years",info:{numberOfYears:z}});return 10+z}function Oz(z){if(z<0)throw new B({errorKey:"helpers_invalid_number_of_years",info:{numberOfYears:z}});return Math.round((10+z*1.0512)*10000000000)/10000000000}function vz(z){if(z.length>30)return!1;let G=/^[a-zA-Z0-9+_-]+$/g;return!!z.match(G)}import{getChainConfig as C}from"@swapkit/types";function cz(){return typeof window.ethereum<"u"}function hz(z){return r().includes(z)}function r(){let z=window?.ethereum&&!window.ethereum?.isBraveWallet,G=window?.ctrl||window?.ethereum?.__XDEFI,Q=window?.vultisig,J=window?.ethereum?.isBraveWallet,Z=window?.ethereum?.isTrust||window?.trustwallet,$=window?.ethereum?.overrideIsMetaMask&&window?.ethereum?.selectedProvider?.isCoinbaseWallet||window?.coinbaseWalletExtension,H=window?.bitkeep?.ethereum,V=window?.$onekey?.ethereum,X=[];if(z)X.push("METAMASK");if(G)X.push("CTRL");if(Q)X.push("VULTISIG");if(J)X.push("BRAVE");if(Z)X.push("TRUSTWALLET_WEB");if($)X.push("COINBASE_WEB");if(a())X.push("OKX_MOBILE");if(H)X.push("BITGET");if(V)X.push("ONEKEY");return X}async function s(z,G,Q){let J=C(G);try{await D({method:"wallet_switchEthereumChain",params:[{chainId:J.chainIdHex}],provider:z})}catch(Z){if(!Q)throw new B("helpers_failed_to_switch_network",{error:Z,reason:"networkParams not provided"});await i(z,Q)}}function mz({chains:z,supportedChains:G,walletType:Q}){let J=z.filter(($)=>!$||G.includes($));if(J.length===0)throw new B("wallet_chain_not_supported",{chain:z.join(", "),wallet:Q});let Z=z.filter(($)=>!G.includes($));return S({condition:Z.length>0,id:`wallet_chain_not_supported_${Q}`,warning:`${Q} wallet does not support the following chains: ${Z.join(", ")}. These chains will be ignored.`}),J}function n(z,G,Q){return async(...J)=>{let{chainIdHex:Z}=C(Q);if((await G.getNetwork()).chainId.toString()===Z)return z(...J);try{await s(G,Q)}catch($){throw new B({errorKey:"helpers_failed_to_switch_network",info:{error:$}})}return z(...J)}}function uz({toolbox:z,chain:G,provider:Q,methodNames:J=[]}){let $=[...J,"approve","approvedAmount","call","sendTransaction","transfer","isApproved","approvedAmount","EIP1193SendTransaction","getFeeData","broadcastTransaction","estimateCall","estimateGasLimit","estimateGasPrices","createContractTxObject"].reduce((H,V)=>{if(!z[V])return H;let X=z[V];if(typeof X!=="function")return H;let _=n(X,Q,G);return{...H,[V]:_}},{});return{...z,...$}}function i(z,G){return D({method:"wallet_addEthereumChain",params:[G],provider:z})}function dz(z){window.ethereum?.on("accountsChanged",()=>z()),window.ctrl?.ethereum.on("accountsChanged",()=>z())}function lz(){let{isTrust:z,isBraveWallet:G,__XDEFI:Q,overrideIsMetaMask:J,selectedProvider:Z}=window?.ethereum||{};if(z)return"TRUSTWALLET_WEB";if(G)return"BRAVE";if(J&&Z?.isCoinbaseWallet)return"COINBASE_WEB";if(Q)return"CTRL";if(window?.$onekey?.ethereum)return"ONEKEY";return"METAMASK"}function pz(){let z=[];function G(J){if(z.map((Z)=>Z.info.uuid).includes(J.detail.info.uuid))return;z.push(J.detail)}window.addEventListener("eip6963:announceProvider",G),window.dispatchEvent(new Event("eip6963:requestProvider"));function Q(){window.removeEventListener("eip6963:announceProvider",G)}return{providers:z,removeEIP6963EventListener:Q}}function a(){let z=navigator.userAgent,G=/iphone|ipad|ipod|ios/i.test(z),Q=/android|XiaoMi|MiuiBrowser/i.test(z),J=G||Q,Z=/OKApp/i.test(z);return J&&Z}function D({provider:z,params:G,method:Q}){if(!z?.send)throw new B("helpers_not_found_provider");let J=G?Array.isArray(G)?G:[G]:[];return z.send(Q,J)}export{MG as wrapWithThrow,n as wrapMethodWithNetworkSwitch,S as warnOnce,vz as validateTNS,uG as validateIdentifier,I as updateDerivationPath,KJ as toHexTransactionValue,s as switchEVMWalletNetwork,qG as swapKitConfigStore,KG as signWidgetRequest,D as providerRequest,uz as prepareNetworkSwitch,IJ as parseTransactionValue,wG as parseSymbolForAddress,a as okxMobileEnabled,r as listWeb3EVMWallets,cz as isWeb3Detected,qJ as isTransactionValue,vG as isGasAsset,hz as isDetected,SG as initializeRPCUrlsWithFallback,Xz as getWalletFormatFor,bG as getTokenLogoURI,Tz as getTHORNameCost,Rz as getSymmetricWithdraw,u as getSymmetricPoolShare,NG as getRPCUrlSync,PG as getRPCUrl,lG as getMinAmountByChain,Sz as getMemoForWithdraw,Ez as getMemoForUnbond,kz as getMemoForTcyStake,Uz as getMemoForTcyClaim,Cz as getMemoForRunePoolWithdraw,Nz as getMemoForRunePoolDeposit,Dz as getMemoForNameRegister,gz as getMemoForNamePreferredAssetRegister,Mz as getMemoForLeaveAndBond,Pz as getMemoForDeposit,Oz as getMAYANameCost,Fz as getLiquiditySlippage,f as getFeeMultiplierAsBigInt,N as getFeeMultiplier,CG as getExplorerTxUrl,DG as getExplorerAddressUrl,Yz as getEstimatedPoolShare,lz as getETHDefaultWallet,pz as getEIP6963Wallets,$z as getDerivationPathFor,AG as getCommonAssetInfo,gG as getChainIdentifier,Bz as getAsymmetricRuneWithdrawAmount,h as getAsymmetricRuneShare,Lz as getAsymmetricAssetWithdrawAmount,m as getAsymmetricAssetShare,fG as getAssetType,hG as formatBigIntToSafeValue,cG as findAssetBy,mz as filterSupportedChains,OG as fetchTokenInfo,w as derivationPathToString,kG as decodeABIString,TG as decodeABIDynamicString,yG as assetFromString,zz as applyFeeMultiplierToBigInt,Gz as applyFeeMultiplier,i as addEVMWalletNetwork,dz as addAccountsChangedCallback,EG as _rpcCache,RG as WarningCodeEnum,o as WalletOption,rG as TxnType,nG as TxnStatus,EJ as TronTransactionSchema,YJ as TransactionSchema,FJ as TransactionDTOSchema,iG as TrackingStatus,tG as TrackingRequestSchema,eG as TrackingRequestQuerySchema,RJ as TrackerResponseSchema,aG as TokenSchema,QJ as TokenDetailsMetadataSchema,gJ as TONTransactionSchema,DJ as TONTransactionMessageSchema,eJ as SwapToResponseSchema,aJ as SwapToRequestSchema,tJ as SwapToAssetSchema,QQ as SwapRouteV2ResponseSchema,L as SwapKitNumber,B as SwapKitError,ZQ as SwapKitApi,nJ as SwapApprovalTransactionSchema,sJ as StellarApprovalTransactionSchema,CJ as StarknetTransactionSchema,E as SKConfig,hJ as RouteQuoteWarningSchema,oG as RouteQuoteTxType,GQ as RouteQuoteProviderErrorSchema,cJ as RouteQuoteMetadataV2Schema,bJ as RouteQuoteMetadataSchema,yJ as RouteQuoteMetadataAssetSchema,fJ as RouteLegWithoutAddressesSchema,AJ as RouteLegSchema,IG as RequestClient,iJ as QuoteV3ResponseSchema,JQ as QuoteV2ResponseSchema,zQ as QuoteRouteV2Response,uJ as QuoteResponseSchema,mJ as QuoteResponseRouteItem,$J as QuoteRequestSchema,YG as ProviderName,sG as ProviderAction,pG as PriorityLabel,ZJ as PriceResponseSchema,XJ as PriceRequestSchema,Y as NetworkDerivationPath,LJ as NearSwapResponseSchema,BJ as NearDepositChannelResultSchema,_J as NearDepositChannelParamsSchema,d as MemoType,WG as LedgerErrorCode,OJ as HyperCoreTypedDataTransactionSchema,vJ as HyperCoreSendAssetTransactionSchema,TJ as HyperCoreSendAssetActionSchema,kJ as HyperCoreEip712TypedDataSchema,UJ as HYPERCORE_USDC_TOKEN_ID,dJ as GasSchema,lJ as GasResponseSchema,xJ as FeesSchema,FG as FeeTypeEnum,v as FeeOption,WJ as EstimatedTimeSchema,LG as ErrorCode,MJ as EVMTransactionSchema,PJ as EVMTransactionDetailsSchema,NJ as EVMTransactionDetailsParamsSchema,Hz as DerivationPath,jJ as DepositChannelResponseSchema,HJ as DepositChannelParamsSchema,A as DEFAULT_FEE_MULTIPLIERS,SJ as CosmosTransactionSchema,UG as CommonAssetStrings,JJ as CoinGeckoMetadataSchema,wJ as ChainflipMetadataSchema,VJ as BrokerDepositChannelParamsSchema,mG as BigIntArithmetics,GJ as AssetValueSchema,dG as AssetValue,oJ as ApproveResponseSchema,pJ as ApproveRequestParams,xG as ApproveMode,rJ as ApprovalTransactionSchema,zJ as ApiV2ErrorSchema};
1
+ import{$ as QJ,$a as QQ,A as TG,Aa as kJ,B as OG,Ba as TJ,C as vG,Ca as OJ,D as AG,Da as vJ,E as fG,Ea as AJ,F as yG,Fa as fJ,G as wG,Ga as yJ,H as bG,Ha as wJ,I as cG,Ia as bJ,J as hG,Ja as cJ,K as mG,Ka as hJ,L as uG,La as mJ,M as dG,Ma as uJ,N as lG,Na as dJ,O as pG,Oa as lJ,P as oG,Pa as pJ,Q as rG,Qa as oJ,R,Ra as rJ,S as sG,Sa as sJ,T as nG,Ta as nJ,U as iG,Ua as iJ,V as aG,Va as aJ,W as tG,Wa as tJ,X as eG,Xa as eJ,Y as zJ,Ya as zQ,Z as GJ,Za as GQ,_ as JJ,_a as JQ,a as F,aa as ZJ,ab as ZQ,b as LG,ba as $J,bb as $Q,c as RG,ca as XJ,cb as XQ,d as YG,da as HJ,db as HQ,e as FG,ea as VJ,f as A,fa as jJ,g as xG,ga as _J,h as l,ha as BJ,i as L,ia as LJ,j as WG,ja as RJ,k as j,ka as YJ,l as qG,la as FJ,m as IG,ma as xJ,n as KG,na as WJ,o as MG,oa as qJ,p as N,pa as IJ,q as EG,qa as KJ,r as NG,ra as MJ,s as PG,sa as EJ,t as C,ta as NJ,u as SG,ua as PJ,v as CG,va as SJ,w as DG,wa as CJ,x as gG,xa as DJ,y as UG,ya as gJ,z as kG,za as UJ}from"./chunk-sht0fjw7.js";export*from"@swapkit/tokens";export*from"@swapkit/types";var f={average:1,fast:1.5,fastest:2};function P(z="average"){let G=N.get("feeMultipliers");if(G&&G[z]!==void 0)return G[z];return f[z]}function y(z="average"){let G=P(z),Q=10n,J=BigInt(Math.round(G*10));return{denominator:Q,numerator:J}}function zz(z,G="average"){let{numerator:Q,denominator:J}=y(G);return z*Q/J}function Gz(z,G="average",Q=!1){let J=P(G),Z=z*J;return Q?Math.floor(Z):Z}import{Chain as S,EVMChains as w}from"@swapkit/types";function K(z,G){if("index"in G)return[...z.slice(0,z.length-1),G.index];if("change"in G){let[Q,J,Z,,$]=z;return[Q,J,Z,G.change,$]}if("account"in G){let[Q,J,,Z,$]=z;return[Q,J,G.account,Z,$]}return z}function b([z,G,Q,J,Z],{allHardened:$}={}){let H=$?"'":"",V=typeof Z!=="number";if(typeof J!=="number")return`m/${z}'/${G}'/${Q}'`;return`m/${z}'/${G}'/${Q}'/${J}${H}${V?"":`/${Z}${H}`}`}function $z({chain:z,index:G,addressIndex:Q=0,type:J}){if(w.includes(z)){if(J&&["legacy","account"].includes(J))return[44,60,0,G];if(J==="ledgerLive")return[44,60,G,0,Q];return K(F[z],{index:G})}if(z===S.Solana){if(J==="account")return[44,501,0,G];return K(F[z],{index:G})}let Z=z===S.Litecoin?2:0;switch(J){case"nativeSegwitMiddleAccount":return[84,Z,G,0,Q];case"segwit":return[49,Z,0,0,G];case"legacy":return[44,Z,0,0,G];default:return K(F[z],{index:G})}}function Xz(z){let[G,Q,J]=z.split("/").map((Z)=>Number.parseInt(Z,10));switch(Q){case 44:return"legacy";case 49:return"p2sh";default:return"bech32"}}var Hz=Object.keys(F).reduce((z,G)=>{return z[G]=b(F[G]),z},{});import{Chain as c,getChainConfig as h}from"@swapkit/types";function m({liquidityUnits:z,poolUnits:G,runeDepth:Q}){let J=_(z),Z=_(G),$=_(Q),H=J.mul($),V=Z.mul(Z).mul(2),X=Z.mul(J).mul(2),B=J.mul(J),Y=Z.mul(Z).mul(Z);return H.mul(V.sub(X).add(B)).div(Y)}function u({liquidityUnits:z,poolUnits:G,assetDepth:Q}){let J=_(z),Z=_(G),$=_(Q),H=J.mul($),V=Z.mul(Z).mul(2),X=Z.mul(J).mul(2),B=J.mul(J),Y=H.mul(V.sub(X).add(B)),x=Z.mul(Z).mul(Z);return Y.div(x)}function Bz({percent:z,runeDepth:G,liquidityUnits:Q,poolUnits:J}){return m({liquidityUnits:Q,poolUnits:J,runeDepth:G}).mul(z)}function Lz({percent:z,assetDepth:G,liquidityUnits:Q,poolUnits:J}){return u({assetDepth:G,liquidityUnits:Q,poolUnits:J}).mul(z)}function _(z){return R.fromBigInt(BigInt(z),h(c.THORChain).baseDecimal)}function d({liquidityUnits:z,poolUnits:G,runeDepth:Q,assetDepth:J}){return{assetAmount:_(J).mul(z).div(G),runeAmount:_(Q).mul(z).div(G)}}function Rz({liquidityUnits:z,poolUnits:G,runeDepth:Q,assetDepth:J,percent:Z}){return Object.fromEntries(Object.entries(d({assetDepth:J,liquidityUnits:z,poolUnits:G,runeDepth:Q})).map(([$,H])=>[$,H.mul(Z)]))}function Yz({runeDepth:z,poolUnits:G,assetDepth:Q,liquidityUnits:J,runeAmount:Z,assetAmount:$}){let H=new R({decimal:8,value:z}),V=new R({decimal:8,value:Q}),X=new R({decimal:8,value:G}),B=new R({decimal:8,value:Z}),Y=new R({decimal:8,value:$}),x=B.mul(V),M=Y.mul(H),U=B.mul(Y),k=H.mul(V),T=X.mul(x.add(M.add(U.mul(2)))),O=x.add(M.add(k.mul(2))),E=T.div(O),I=_(J).add(E);if(E.getBaseValue("number")===0)return I.div(X).getBaseValue("number");let v=X.add(I);return I.div(v).getBaseValue("number")}function Fz({runeAmount:z,assetAmount:G,runeDepth:Q,assetDepth:J}){if(z==="0"||G==="0"||Q==="0"||J==="0")return 0;let Z=_(Q),$=_(J),H=_(G),V=_(z),X=H.mul(Z).sub($.mul(V)),B=$.mul(V).add(Z.mul($));return Math.abs(X.div(B).getBaseValue("number"))}import{Chain as W}from"@swapkit/types";import{match as p}from"ts-pattern";function Mz({type:z,address:G}){return`${z}:${G}`}function Ez({address:z,unbondAmount:G}){return`${"UNBOND"}:${z}:${G}`}function Nz(z){return q("POOL+",z)}function Pz({chain:z,symbol:G,address:Q,...J}){let Z=o({chain:z,symbol:G}),$=Q?`:${Q}:`:":";return q(`${"+"}:${Z}${$}`,J)}function Sz({chain:z,symbol:G,ticker:Q,basisPoints:J,targetAsset:Z}){let $=z==="ETH"&&Q!=="ETH"?`${Q}-${G.slice(-3)}`:G,H=Z?`:${Z}`:"";return`${"-"}:${z}.${$}:${J}${H}`}function Cz({basisPoints:z,...G}){return q(`${"POOL-"}:${z}`,G)}function Dz({name:z,chain:G,address:Q,owner:J}){let Z=`${"~"}:${z}:${G}:${Q}`,$=J?`:${J}`:"";return`${Z}${$}`}function gz({name:z,chain:G,asset:Q,payout:J,owner:Z}){return`${"~"}:${z}:${G}:${J}:${Z}:${Q}`}function Uz(z,{address:G}){return`${z}:${G}`}function kz(z,{unstakeBps:G,...Q}){let J=G?`:${G}`:"",Z=`${z}${J}`;return q(`${Z}`,Q)}function q(z,{affiliateAddress:G,affiliateBasisPoints:Q}={}){let J=`${z}${G?`:${G}:${Q||0}`:""}`;return J.endsWith(":")?J.slice(0,-1):J}function o({chain:z,symbol:G}){return p(z).with(W.Bitcoin,W.Dogecoin,W.Litecoin,()=>z.slice(0,1).toLowerCase()).with(W.BitcoinCash,()=>"c").otherwise(()=>`${z}.${G}`)}function Tz(z){if(z<0)throw new L({errorKey:"helpers_invalid_number_of_years",info:{numberOfYears:z}});return 10+z}function Oz(z){if(z<0)throw new L({errorKey:"helpers_invalid_number_of_years",info:{numberOfYears:z}});return Math.round((10+z*1.0512)*10000000000)/10000000000}function vz(z){if(z.length>30)return!1;let G=/^[a-zA-Z0-9+_-]+$/g;return!!z.match(G)}import{getChainConfig as D}from"@swapkit/types";function cz(){return typeof window.ethereum<"u"}function hz(z){return r().includes(z)}function r(){let z=window?.ethereum&&!window.ethereum?.isBraveWallet,G=window?.ctrl||window?.ethereum?.__XDEFI,Q=window?.vultisig,J=window?.ethereum?.isBraveWallet,Z=window?.ethereum?.isTrust||window?.trustwallet,$=window?.ethereum?.overrideIsMetaMask&&window?.ethereum?.selectedProvider?.isCoinbaseWallet||window?.coinbaseWalletExtension,H=window?.bitkeep?.ethereum,V=window?.$onekey?.ethereum,X=[];if(z)X.push(j.METAMASK);if(G)X.push(j.CTRL);if(Q)X.push(j.VULTISIG);if(J)X.push(j.BRAVE);if(Z)X.push(j.TRUSTWALLET_WEB);if($)X.push(j.COINBASE_WEB);if(a())X.push(j.OKX_MOBILE);if(H)X.push(j.BITGET);if(V)X.push(j.ONEKEY);return X}async function s(z,G,Q){let J=D(G);try{await g({method:"wallet_switchEthereumChain",params:[{chainId:J.chainIdHex}],provider:z})}catch(Z){if(!Q)throw new L("helpers_failed_to_switch_network",{error:Z,reason:"networkParams not provided"});await i(z,Q)}}function mz({chains:z,supportedChains:G,walletType:Q}){let J=z.filter(($)=>!$||G.includes($));if(J.length===0)throw new L("wallet_chain_not_supported",{chain:z.join(", "),wallet:Q});let Z=z.filter(($)=>!G.includes($));return C({condition:Z.length>0,id:`wallet_chain_not_supported_${Q}`,warning:`${Q} wallet does not support the following chains: ${Z.join(", ")}. These chains will be ignored.`}),J}function n(z,G,Q){return async(...J)=>{let{chainIdHex:Z}=D(Q);if((await G.getNetwork()).chainId.toString()===Z)return z(...J);try{await s(G,Q)}catch($){throw new L({errorKey:"helpers_failed_to_switch_network",info:{error:$}})}return z(...J)}}function uz({toolbox:z,chain:G,provider:Q,methodNames:J=[]}){let $=[...J,"approve","approvedAmount","call","sendTransaction","transfer","isApproved","approvedAmount","EIP1193SendTransaction","getFeeData","broadcastTransaction","estimateCall","estimateGasLimit","estimateGasPrices","createContractTxObject"].reduce((H,V)=>{if(!z[V])return H;let X=z[V];if(typeof X!=="function")return H;let B=n(X,Q,G);return{...H,[V]:B}},{});return{...z,...$}}function i(z,G){return g({method:"wallet_addEthereumChain",params:[G],provider:z})}function dz(z){window.ethereum?.on("accountsChanged",()=>z()),window.ctrl?.ethereum.on("accountsChanged",()=>z())}function lz(){let{isTrust:z,isBraveWallet:G,__XDEFI:Q,overrideIsMetaMask:J,selectedProvider:Z}=window?.ethereum||{};if(z)return j.TRUSTWALLET_WEB;if(G)return j.BRAVE;if(J&&Z?.isCoinbaseWallet)return j.COINBASE_WEB;if(Q)return j.CTRL;if(window?.$onekey?.ethereum)return j.ONEKEY;return j.METAMASK}function pz(){let z=[];function G(J){if(z.map((Z)=>Z.info.uuid).includes(J.detail.info.uuid))return;z.push(J.detail)}window.addEventListener("eip6963:announceProvider",G),window.dispatchEvent(new Event("eip6963:requestProvider"));function Q(){window.removeEventListener("eip6963:announceProvider",G)}return{providers:z,removeEIP6963EventListener:Q}}function a(){let z=navigator.userAgent,G=/iphone|ipad|ipod|ios/i.test(z),Q=/android|XiaoMi|MiuiBrowser/i.test(z),J=G||Q,Z=/OKApp/i.test(z);return J&&Z}function g({provider:z,params:G,method:Q}){if(!z?.send)throw new L("helpers_not_found_provider");let J=G?Array.isArray(G)?G:[G]:[];return z.send(Q,J)}export{PG as wrapWithThrow,n as wrapMethodWithNetworkSwitch,C as warnOnce,vz as validateTNS,pG as validateIdentifier,K as updateDerivationPath,NJ as toHexTransactionValue,s as switchEVMWalletNetwork,MG as swapKitConfigStore,qG as subscribeWalletOptionRegistration,NG as signWidgetRequest,IG as registerWalletOption,WG as registerErrorCodes,g as providerRequest,uz as prepareNetworkSwitch,EJ as parseTransactionValue,hG as parseSymbolForAddress,a as okxMobileEnabled,r as listWeb3EVMWallets,cz as isWeb3Detected,MJ as isTransactionValue,yG as isGasAsset,hz as isDetected,gG as initializeRPCUrlsWithFallback,Xz as getWalletFormatFor,mG as getTokenLogoURI,Tz as getTHORNameCost,Rz as getSymmetricWithdraw,d as getSymmetricPoolShare,CG as getRPCUrlSync,DG as getRPCUrl,rG as getMinAmountByChain,Sz as getMemoForWithdraw,Ez as getMemoForUnbond,kz as getMemoForTcyStake,Uz as getMemoForTcyClaim,Cz as getMemoForRunePoolWithdraw,Nz as getMemoForRunePoolDeposit,Dz as getMemoForNameRegister,gz as getMemoForNamePreferredAssetRegister,Mz as getMemoForLeaveAndBond,Pz as getMemoForDeposit,Oz as getMAYANameCost,Fz as getLiquiditySlippage,y as getFeeMultiplierAsBigInt,P as getFeeMultiplier,UG as getExplorerTxUrl,kG as getExplorerAddressUrl,Yz as getEstimatedPoolShare,lz as getETHDefaultWallet,pz as getEIP6963Wallets,$z as getDerivationPathFor,wG as getCommonAssetInfo,TG as getChainIdentifier,Bz as getAsymmetricRuneWithdrawAmount,m as getAsymmetricRuneShare,Lz as getAsymmetricAssetWithdrawAmount,u as getAsymmetricAssetShare,bG as getAssetType,dG as formatBigIntToSafeValue,uG as findAssetBy,mz as filterSupportedChains,fG as fetchTokenInfo,b as derivationPathToString,vG as decodeABIString,AG as decodeABIDynamicString,cG as assetFromString,zz as applyFeeMultiplierToBigInt,Gz as applyFeeMultiplier,i as addEVMWalletNetwork,dz as addAccountsChangedCallback,SG as _rpcCache,RG as WarningCodeEnum,j as WalletOption,iG as TxnType,tG as TxnStatus,SJ as TronTransactionSchema,WJ as TransactionSchema,qJ as TransactionDTOSchema,eG as TrackingStatus,GJ as TrackingRequestSchema,JJ as TrackingRequestQuerySchema,xJ as TrackerResponseSchema,zJ as TokenSchema,XJ as TokenDetailsMetadataSchema,TJ as TONTransactionSchema,kJ as TONTransactionMessageSchema,JQ as SwapToResponseSchema,zQ as SwapToRequestSchema,GQ as SwapToAssetSchema,XQ as SwapRouteV2ResponseSchema,R as SwapKitNumber,L as SwapKitError,HQ as SwapKitApi,tJ as SwapApprovalTransactionSchema,aJ as StellarApprovalTransactionSchema,UJ as StarknetTransactionSchema,N as SKConfig,dJ as RouteQuoteWarningSchema,nG as RouteQuoteTxType,ZQ as RouteQuoteProviderErrorSchema,uJ as RouteQuoteMetadataV2Schema,mJ as RouteQuoteMetadataSchema,cJ as RouteQuoteMetadataAssetSchema,bJ as RouteLegWithoutAddressesSchema,wJ as RouteLegSchema,EG as RequestClient,eJ as QuoteV3ResponseSchema,$Q as QuoteV2ResponseSchema,QQ as QuoteRouteV2Response,pJ as QuoteResponseSchema,lJ as QuoteResponseRouteItem,VJ as QuoteRequestSchema,YG as ProviderName,aG as ProviderAction,sG as PriorityLabel,HJ as PriceResponseSchema,jJ as PriceRequestSchema,F as NetworkDerivationPath,FJ as NearSwapResponseSchema,YJ as NearDepositChannelResultSchema,RJ as NearDepositChannelParamsSchema,l as MemoType,KG as LedgerErrorCode,fJ as HyperCoreTypedDataTransactionSchema,yJ as HyperCoreSendAssetTransactionSchema,AJ as HyperCoreSendAssetActionSchema,vJ as HyperCoreEip712TypedDataSchema,OJ as HYPERCORE_USDC_TOKEN_ID,oJ as GasSchema,rJ as GasResponseSchema,IJ as FeesSchema,FG as FeeTypeEnum,A as FeeOption,KJ as EstimatedTimeSchema,LG as ErrorCode,PJ as EVMTransactionSchema,DJ as EVMTransactionDetailsSchema,CJ as EVMTransactionDetailsParamsSchema,Hz as DerivationPath,LJ as DepositChannelResponseSchema,_J as DepositChannelParamsSchema,f as DEFAULT_FEE_MULTIPLIERS,gJ as CosmosTransactionSchema,OG as CommonAssetStrings,$J as CoinGeckoMetadataSchema,hJ as ChainflipMetadataSchema,BJ as BrokerDepositChannelParamsSchema,lG as BigIntArithmetics,ZJ as AssetValueSchema,oG as AssetValue,nJ as ApproveResponseSchema,sJ as ApproveRequestParams,xG as ApproveMode,iJ as ApprovalTransactionSchema,QJ as ApiV2ErrorSchema};