@swapkit/helpers 4.13.3 → 4.13.4

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.
@@ -1,5 +1,5 @@
1
1
  var rA=Object.defineProperty;var iA=(N)=>N;function sA(N,A){this[N]=iA.bind(null,A)}var dN=(N,A)=>{for(var T in A)rA(N,T,{get:A[T],enumerable:!0,configurable:!0,set:sA.bind(A,T)})};var PN=((N)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(N,{get:(A,T)=>(typeof require<"u"?require:A)[T]}):N)(function(N){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+N+'" is not supported')});import{Chain as XN,getChainConfig as lT}from"@swapkit/types";import{AllChains as kT,Chain as E,EVMChains as KT,getChainConfig as IN}from"@swapkit/types";import{getAddress as IA}from"ethers";import{match as qN}from"ts-pattern";import{Chain as n,EVMChains as wT,getChainConfig as o,UTXOChains as QT}from"@swapkit/types";import{match as RN}from"ts-pattern";import{AllChains as lN,Chain as cN,getChainConfig as PT,MAYAConfig as LT,StagenetChain as gN,StagenetMAYAConfig as rN,StagenetTHORConfig as iN,THORConfig as RT}from"@swapkit/types";import{createStore as uT}from"zustand/vanilla";import{AllChains as eA,getChainConfig as aA}from"@swapkit/types";var xP=eA.reduce((N,A)=>{return N[A]=aA(A).networkDerivationPath,N},{});var LN;((u)=>{u.unknownError="unknownError";u.test_error="test_error";u.providerDetailsError="providerDetailsError";u.blockHeaderNotFound="blockHeaderNotFound";u.blockHashNotFoundAtHeight="blockHashNotFoundAtHeight";u.blockHashNotFoundAtHash="blockHashNotFoundAtHash";u.txHashMissing="txHashMissing";u.assetValueMissingInfo="assetValueMissingInfo";u.invalidAsset="invalidAsset";u.blockIsRequired="blockIsRequired";u.currentBlockHeaderNotFound="currentBlockHeaderNotFound";u.failedToRetrieveBalance="failedToRetrieveBalance";u.failedToRetrieveBlock="failedToRetrieveBlock";u.failedToRetrieveFees="failedToRetrieveFees";u.notImplementedBCH="notImplementedBCH";u.notImplementedDoge="notImplementedDoge";u.noPoolsFound="noPoolsFound";u.noVaultsFound="noVaultsFound";u.noTxFound="noTxFound";u.noInputCoinFound="noInputCoinFound";u.noBlockDataFound="noBlockDataFound";u.multipleCosmosMessages="multipleCosmosMessages";u.heightOrHashNotProvided="heightOrHashNotProvided";u.unknownDenom="unknownDenom";u.invalidBlockHeight="invalidBlockHeight";u.timestampExtrinsicNoArgumentsForBlock="timestampExtrinsicNoArgumentsForBlock";u.timestampExtrinsicNoTimestampForBlock="timestampExtrinsicNoTimestampForBlock";u.noTimestampExtrinsicForHash="noTimestampExtrinsicForHash";u.timestampExtrinsicNoArgumentsForHash="timestampExtrinsicNoArgumentsForHash";u.txMemoUndefined="txMemoUndefined";u.txMemoIncorrect="txMemoIncorrect";u.txTypeNotFound="txTypeNotFound";u.txNoMessage="txNoMessage";u.txNotFound="txNotFound";u.txReceiptNotFound="txReceiptNotFound";u.txParsingError="txParsingError";u.txLogsParsingError="txLogsParsingError";u.blockNotFound="blockNotFound";u.balanceNotFound="balanceNotFound";u.configError="configError";u.synthSwapDisallowed="synthSwapDisallowed";u.providerQuoteTimeout="providerQuoteTimeout";u.noQuoteResponse="noQuoteResponse";u.noPoolAssetsFound="noPoolAssetsFound";u.noThorchainPools="noThorchainPools";u.noMayachainPools="noMayachainPools";u.noThorchainNetworkInfo="noThorchainNetworkInfo";u.invalidAffiliateFee="invalidAffiliateFee";u.invalidBuyAssetAddress="invalidBuyAssetAddress";u.invalidSellAssetAddress="invalidSellAssetAddress";u.invalidSourceAddress="invalidSourceAddress";u.invalidDestinationAddress="invalidDestinationAddress";u.sourceAddressIsSmartContract="sourceAddressIsSmartContract";u.destinationAddressIsSmartContract="destinationAddressIsSmartContract";u.invalidChainId="invalidChainId";u.unsupportedChainId="unsupportedChainId";u.unsupportedEVMChainId="unsupportedEVMChainId";u.unsupportedMethod="unsupportedMethod";u.unsupportedProvider="unsupportedProvider";u.invalidParamsForMethod="invalidParamsForMethod";u.unsupportedAdapter="unsupportedAdapter";u.noWhitelistTokens="noWhitelistTokens";u.failedFetchGasPrice="failedFetchGasPrice";u.failedToCreateDepositChannel="failedToCreateDepositChannel";u.noProviderDetailsFound="noProviderDetailsFound";u.noTokenListsFound="noTokenListsFound";u.tokenNotFound="tokenNotFound";u.tokenPriceNotFound="tokenPriceNotFound";u.tokenPriceFailedToUpdate="tokenPriceFailedToUpdate";u.swapAmountTooSmall="swapAmountTooSmall";u.legsArrayIsEmpty="legsArrayIsEmpty";u.failedToFetchQuoteForLeg="failedToFetchQuoteForLeg";u.noBlockHeaderFound="noBlockHeaderFound";u.failedToSimulateSwap="failedToSimulateSwap";u.addressScreeningFailed="addressScreeningFailed";u.noLiquidtyProvidersFound="noLiquidtyProvidersFound";u.insufficientLiquidity="insufficientLiquidity";u.noInboundDataFound="noInbounDataFound";u.noInboundAddressesFound="noInboundAddressesFound";u.noInboundAddressFoundForChain="noInboundAddressFoundForChain";u.noLastBlocksFound="noLastBlocksFound";u.noVersionFound="noVersionFound";u.noConstantsFound="noConstantsFound";u.noMimirsFound="noMimirsFound";u.noRoutesFound="noRoutesFound";u.quoteNotFound="quoteNotFound";u.ledgerSignFailed="ledgerSignFailed";u.ledgerWrongPayload="ledgerWrongPayload";u.ledgerFetchSwapFailed="ledgerFetchSwapFailed";u.failedToFetchTx="failedToFetchTx";u.failedBuildTransactionDetails="failedBuildTransactionDetails";u.noLegsForRoute="noLegsForRoute";u.noRouterAddressFound="noRouterAddressFound";u.noAggregatorAddressFound="noAggregatorAddressFound";u.noContractInstanceFound="noContractInstanceFound";u.noContractAddressFound="noContractAddressFound";u.invalidAffiliate="invalidAffiliate";u.thornameAffiliate="thornameAffiliate";u.providerNotfound="No provider found";u.noRecordFound="No Record found";u.slippageTooLow="Slippage too low";u.tradingHalted="tradingHalted";u.noWrappedGasAsset="noWrappedGasAsset";u.aggregatorAddressNotFound="aggregatorAddressNotFound";u.routerAddressNotFound="routerAddressNotFound";u.dummyAddressNotFound="dummyAddressNotFound";u.trackerError="trackerError";u.thorchainPoolUnavailable="thorchainPoolUnavailable";u.noOhlcvDataFound="noOhlcvDataFound";u.noTradingPairs="noTradingPairs";u.noLendingAvailability="noLendingAvailability";u.lendingRepayTooSmall="lendingRepayTooSmall";u.missingState="missingState";u.ledgerSwapNotFound="ledgerSwapNotFound";u.ledgerSwapNotReadyForTracking="ledgerSwapNotReadyForTracking";u.errorEstimatingGas="errorEstimatingGas";u.apiKeyInvalid="apiKeyInvalid";u.apiKeyFailedToUpdate="apiKeyFailedToUpdate";u.apiKeyExpired="apiKeyExpired";u.unauthorized="unauthorized";u.failedToCreateMemo="failedToCreateMemo";u.radixIncorrectInstructions="radixIncorrectInstructions";u.radixTxMissedParam="radixTxMissedParam";u.radixTxMissedAccount="radixTxMissedAccount";u.radixManifestParseError="radixManifestParseError";u.radixManifestBuildError="radixManifestBuildError";u.invalidAddressForChain="invalidAddressForChain";u.riskyAddress="riskyAddress";u.noRoutesToProcess="noRoutesToProcess";u.sellAssetAmountTooSmall="sellAssetAmountTooSmall";u.missingPrivateKey="missingPrivateKey";u.noMemoPriceProtection="noMemoPriceProtection"})(LN||={});var xN;((T)=>{T.highSlippage="highSlippage";T.highPriceImpact="highPriceImpact"})(xN||={});var J;((S)=>{S.CHAINFLIP="CHAINFLIP";S.CHAINFLIP_STREAMING="CHAINFLIP_STREAMING";S.JUPITER="JUPITER";S.MAYACHAIN="MAYACHAIN";S.MAYACHAIN_STREAMING="MAYACHAIN_STREAMING";S.ONEINCH="ONEINCH";S.PANCAKESWAP="PANCAKESWAP";S.SUSHISWAP_V2="SUSHISWAP_V2";S.THORCHAIN="THORCHAIN";S.THORCHAIN_STREAMING="THORCHAIN_STREAMING";S.TRADERJOE_V2="TRADERJOE_V2";S.UNISWAP_V2="UNISWAP_V2";S.UNISWAP_V3="UNISWAP_V3";S.NEAR="NEAR";S.GARDEN="GARDEN";S.OKX="OKX";S.HARBOR="HARBOR";S.FLASHNET="FLASHNET"})(J||={});var bN;((g)=>{g.LIQUIDITY="liquidity";g.NETWORK="network";g.INBOUND="inbound";g.OUTBOUND="outbound";g.AFFILIATE="affiliate";g.TAX="tax";g.PRIORITY="priority";g.SERVICE="service"})(bN||={});var NT;((H)=>{H.Average="average";H.Fast="fast";H.Fastest="fastest"})(NT||={});var AT;((T)=>{T.Approve="approve";T.CheckOnly="checkOnly"})(AT||={});var TT;((_)=>{_.NAME_REGISTER="~";_.BOND="BOND";_.DEPOSIT="+";_.LEAVE="LEAVE";_.UNBOND="UNBOND";_.WITHDRAW="-";_.RUNEPOOL_DEPOSIT="POOL+";_.RUNEPOOL_WITHDRAW="POOL-";_.CLAIM_TCY="tcy";_.STAKE_TCY="tcy+";_.UNSTAKE_TCY="tcy-"})(TT||={});var zN;((D)=>{D.BITGET="BITGET";D.BRAVE="BRAVE";D.COINBASE_MOBILE="COINBASE_MOBILE";D.COINBASE_WEB="COINBASE_WEB";D.COSMOSTATION="COSMOSTATION";D.CTRL="CTRL";D.EIP6963="EIP6963";D.EXODUS="EXODUS";D.KEEPKEY="KEEPKEY";D.KEEPKEY_BEX="KEEPKEY_BEX";D.KEPLR="KEPLR";D.KEYSTORE="KEYSTORE";D.LEAP="LEAP";D.LEDGER="LEDGER";D.METAMASK="METAMASK";D.OKX="OKX";D.OKX_MOBILE="OKX_MOBILE";D.ONEKEY="ONEKEY";D.PASSKEYS="PASSKEYS";D.PETRA="PETRA";D.PHANTOM="PHANTOM";D.POLKADOT_JS="POLKADOT_JS";D.RADIX_WALLET="RADIX_WALLET";D.TALISMAN="TALISMAN";D.TREZOR="TREZOR";D.TRONLINK="TRONLINK";D.TRUSTWALLET_WEB="TRUSTWALLET_WEB";D.VULTISIG="VULTISIG";D.WALLETCONNECT="WALLETCONNECT";D.WALLET_SELECTOR="WALLET_SELECTOR";D.XAMAN="XAMAN"})(zN||={});var HT;((H)=>{H[H.NoError=36864]="NoError";H[H.LockedDevice=21781]="LockedDevice";H[H.TC_NotFound=65535]="TC_NotFound"})(HT||={});var FT=lN.reduce((N,A)=>{if(!N.THOR_STAGENET)N[gN.Maya]=rN.rpcUrls,N[gN.THORChain]=iN.rpcUrls;return N[A]=PT(A).rpcUrls,N},{}),IT={[cN.THORChain]:RT.nodeUrl,[cN.Maya]:LT.nodeUrl,[gN.THORChain]:iN.nodeUrl,[gN.Maya]:rN.nodeUrl},sN={apiKeys:{blockchair:"",keepKey:"",passkeys:"",swapKit:"",walletConnectProjectId:"",xaman:""},chains:lN,endpoints:{},envs:{apiUrl:"https://api.swapkit.dev",devApiUrl:"https://dev-api.swapkit.dev",isDev:!1,isStagenet:!1},feeMultipliers:void 0,integrations:{radix:{applicationName:"Swapkit Playground",applicationVersion:"0.0.1",dAppDefinitionAddress:"account_rdx128r289p58222hcvev7frs6kue76pl7pdcnw8725aw658v0zggkh9ws",network:{dashboardBase:"https://dashboard.radixdlt.com",networkId:1,networkName:"mainnet"}}},requestOptions:{retry:{backoffMultiplier:2,baseDelay:300,maxDelay:5000,maxRetries:3},timeoutMs:30000},rpcUrls:FT,thornodeUrls:IT,v3SwapFlow:{enabled:typeof process<"u"&&process.env?.SWAPKIT_V3_SWAP_FLOW==="true"},wallets:Object.values(zN),widgetKey:""},Z=uT((N)=>({...sN,setApiKey:(A,T)=>N((H)=>({apiKeys:{...H.apiKeys,[A]:T}})),setConfig:(A)=>N((T)=>({apiKeys:{...T.apiKeys,...A?.apiKeys},chains:T.chains.concat(A?.chains||[]),endpoints:{...T.endpoints,...A?.endpoints},envs:{...T.envs,...A?.envs},feeMultipliers:A?.feeMultipliers||T.feeMultipliers,integrations:{...T.integrations,...A?.integrations},rpcUrls:{...T.rpcUrls,...A?.rpcUrls},thornodeUrls:{...T.thornodeUrls,...A?.thornodeUrls},v3SwapFlow:{...T.v3SwapFlow,...A?.v3SwapFlow},wallets:T.wallets.concat(A?.wallets||[]),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}})),setWidgetKey:(A)=>N({widgetKey:A})})),w={get:(N)=>Z.getState()[N],getState:Z.getState,reinitialize:()=>Z.setState(sN),set:(N)=>Z.getState().setConfig(N),setApiKey:(N,A)=>Z.getState().setApiKey(N,A),setEndpoint:(N,A)=>Z.getState().setEndpoint(N,A),setEnv:(N,A)=>Z.getState().setEnv(N,A),setFeeMultipliers:(N)=>Z.getState().setFeeMultipliers(N),setIntegrationConfig:(N,A)=>Z.getState().setIntegrationConfig(N,A),setRequestOptions:(N)=>Z.getState().setRequestOptions(N),setRpcUrl:(N,A)=>Z.getState().setRpcUrl(N,A),setThornodeUrl:(N,A)=>Z.getState().setThornodeUrl(N,A),setWidgetKey:(N)=>Z.getState().setWidgetKey(N)};var nT={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_coinbase_not_found:21701,wallet_coinbase_chain_not_supported:21702,wallet_coinbase_method_not_supported:21703,wallet_coinbase_no_accounts:21704,wallet_evm_extensions_failed_to_switch_network:21801,wallet_evm_extensions_no_provider:21802,wallet_evm_extensions_not_found:21803,wallet_keystore_invalid_password:21901,wallet_keystore_unsupported_version:21902,wallet_near_extensions_failed_to_switch_network:22001,wallet_near_extensions_no_provider:22002,wallet_near_extensions_not_found:22003,wallet_near_method_not_supported:22004,wallet_petra_not_found:22201,wallet_vultisig_not_found:22101,wallet_vultisig_contract_address_not_provided:22102,wallet_vultisig_asset_not_defined:22103,wallet_vultisig_send_transaction_no_address:22104,wallet_xaman_not_configured:23001,wallet_xaman_not_connected:23002,wallet_xaman_auth_failed:23003,wallet_xaman_connection_failed:23004,wallet_xaman_transaction_failed:23005,wallet_xaman_monitoring_failed:23006,wallet_tronlink_request_accounts_failed:24001,wallet_tronlink_locked:24002,chainflip_channel_error:30001,chainflip_unknown_asset:30002,chainflip_broker_invalid_params:30101,chainflip_broker_recipient_error:30102,chainflip_broker_register:30103,chainflip_broker_tx_error:30104,chainflip_broker_withdraw:30105,chainflip_broker_fund_only_flip_supported:30106,chainflip_broker_fund_invalid_address:30107,thorchain_chain_halted:40001,thorchain_trading_halted:40002,thorchain_asset_is_not_tcy:40003,thorchain_swapin_router_required:40101,thorchain_swapin_vault_required:40102,thorchain_swapin_memo_required:40103,thorchain_swapin_token_required:40104,thorchain_preferred_asset_payout_required:40105,toolbox_cosmos_account_not_found:50101,toolbox_cosmos_invalid_fee:50102,toolbox_cosmos_invalid_params:50103,toolbox_cosmos_no_signer:50104,toolbox_cosmos_not_supported:50105,toolbox_cosmos_signer_not_defined:50106,toolbox_cosmos_validate_address_prefix_not_found:50107,toolbox_cosmos_verify_signature_no_pubkey:50108,toolbox_evm_error_estimating_gas_limit:50201,toolbox_evm_error_sending_transaction:50202,toolbox_evm_gas_estimation_error:50203,toolbox_evm_invalid_gas_asset_address:50204,toolbox_evm_invalid_params:50205,toolbox_evm_invalid_transaction:50206,toolbox_evm_no_abi_fragment:50207,toolbox_evm_no_contract_address:50208,toolbox_evm_no_fee_data:50209,toolbox_evm_no_from_address:50210,toolbox_evm_no_gas_price:50211,toolbox_evm_no_signer_address:50212,toolbox_evm_no_signer:50213,toolbox_evm_no_to_address:50214,toolbox_evm_not_supported:50215,toolbox_evm_provider_not_eip1193_compatible:50216,toolbox_evm_invalid_eip7702_authorization:50217,toolbox_utxo_api_error:50301,toolbox_utxo_broadcast_failed:50302,toolbox_utxo_insufficient_balance:50303,toolbox_utxo_invalid_address:50304,toolbox_utxo_invalid_params:50305,toolbox_utxo_invalid_transaction:50306,toolbox_utxo_no_signer:50307,toolbox_utxo_not_supported:50308,toolbox_utxo_tx_not_found:50309,toolbox_utxo_rbf_not_supported:50310,toolbox_utxo_tx_not_replaceable:50311,toolbox_utxo_tx_already_confirmed:50312,toolbox_utxo_rbf_fee_too_low:50313,toolbox_utxo_rbf_insufficient_change:50314,toolbox_solana_no_signer:50401,toolbox_substrate_not_supported:50501,toolbox_substrate_transfer_error:50502,toolbox_radix_method_not_supported:50601,toolbox_ripple_get_balance_error:50701,toolbox_ripple_rpc_not_configured:50702,toolbox_ripple_signer_not_found:50703,toolbox_ripple_asset_not_supported:50704,toolbox_ripple_broadcast_error:50705,toolbox_ripple_get_trust_lines_error:50706,toolbox_ripple_invalid_trust_line_limit:50707,toolbox_tron_no_signer:50801,toolbox_tron_invalid_token_identifier:50802,toolbox_tron_token_transfer_failed:50803,toolbox_tron_transaction_creation_failed:50804,toolbox_tron_trongrid_api_error:50805,toolbox_tron_approve_failed:50806,toolbox_tron_invalid_token_contract:50807,toolbox_tron_allowance_check_failed:50808,toolbox_tron_invalid_transaction_integrity:50809,toolbox_tron_broadcast_failed:50810,toolbox_hypercore_no_signer:51001,toolbox_cardano_sign_transaction_failed:50901,toolbox_near_no_signer:90601,toolbox_near_invalid_address:90602,toolbox_near_invalid_amount:90603,toolbox_near_transfer_failed:90604,toolbox_near_access_key_error:90605,toolbox_near_no_rpc_url:90606,toolbox_near_empty_batch:90607,toolbox_near_balance_failed:90608,toolbox_near_invalid_name:90609,toolbox_near_missing_contract_address:90610,toolbox_near_no_account:90611,toolbox_near_invalid_gas_params:90612,toolbox_near_no_public_key_found:90613,toolbox_sui_address_required:90701,toolbox_sui_keypair_required:90702,toolbox_sui_balance_error:90703,toolbox_sui_transaction_creation_error:90704,toolbox_sui_signing_error:90705,toolbox_sui_broadcast_error:90706,toolbox_sui_no_signer:90707,toolbox_sui_no_sender:90708,toolbox_sui_missing_coin_type:90709,toolbox_sui_no_coins_found:90710,toolbox_sui_insufficient_balance:90711,toolbox_starknet_no_signer:90801,toolbox_starknet_invalid_address:90802,toolbox_starknet_fee_estimation_failed:90803,toolbox_starknet_account_not_deployed:90804,toolbox_starknet_transaction_failed:90805,toolbox_ton_no_signer:90901,toolbox_ton_invalid_address:90902,toolbox_ton_missing_jetton_address:90903,toolbox_ton_jetton_transfer_failed:90904,toolbox_ton_transaction_failed:90905,toolbox_aptos_address_required:91001,toolbox_aptos_keypair_required:91002,toolbox_aptos_balance_error:91003,toolbox_aptos_transaction_creation_error:91004,toolbox_aptos_signing_error:91005,toolbox_aptos_broadcast_error:91006,toolbox_aptos_no_signer:91007,toolbox_aptos_no_sender:91008,toolbox_aptos_missing_asset_type:91009,toolbox_aptos_insufficient_balance:91010,toolbox_stellar_no_signer:91101,toolbox_stellar_broadcast_error:91102,toolbox_stellar_invalid_address:91103,toolbox_stellar_account_not_found:91104,toolbox_stellar_transaction_failed:91105,toolbox_stellar_balance_error:91106,toolbox_not_supported:59901,toolbox_fee_estimation_failed:59902,plugin_near_invalid_name:41001,plugin_near_no_connection:41002,plugin_near_name_unavailable:41003,plugin_near_registration_failed:41004,plugin_near_transfer_failed:41005,plugin_garden_missing_data:42001,plugin_swapkit_swap_invalid_data:43001,plugin_swapkit_invalid_transaction:43002,api_v2_invalid_response:60001,api_v2_server_error:60002,api_v2_invalid_method_key_hash:60003,helpers_invalid_number_different_decimals:70001,helpers_invalid_number_of_years:70002,helpers_invalid_identifier:70003,helpers_invalid_asset_url:70004,helpers_invalid_asset_identifier:70005,helpers_invalid_memo_type:70006,helpers_failed_to_switch_network:70007,helpers_not_found_provider:70008,helpers_chain_not_supported:70009,helpers_invalid_params:70010,helpers_invalid_response:70011,helpers_chain_no_public_or_set_rpc_url:70012,helpers_chain_rpc_connection_failed:70013,mcp_wallet_not_configured:90001,not_implemented:99999};function JN(N){return JSON.stringify(N,(A,T)=>typeof T==="bigint"?T.toString():T)}class t extends Error{static ErrorCode=nT;errorKey;info;constructor(N,A){let T=typeof N==="string",H=T?N:N.errorKey,P=T?void 0:N.info,I=`${H}${P?`: ${JN(P)}`:""}`;super(I);if(Object.setPrototypeOf(this,t.prototype),this.name="SwapKitError",this.errorKey=H,this.info=P,this.cause=A,A){let F=A instanceof Error?`${A.message}${A.cause?` (${A.cause})`:""}`:JN(A);console.error(`SwapKitError [${H}]: ${F}`)}else if(P)console.error(`SwapKitError [${H}]: ${JN(P)}`)}}var BT=(N)=>new Promise((A)=>setTimeout(A,N)),OT=(N,{baseDelay:A,backoffMultiplier:T,maxDelay:H})=>Math.min(A*T**N,H);function $T(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 t({errorKey:"helpers_invalid_response",info:{status:T.status,statusText:T.statusText}},{status:T.status,statusText:T.statusText});return{}}if(!T.ok){let I={data:H?.data,error:H?.error,message:H?.message,status:T.status};throw new t({errorKey:H?.error||"helpers_invalid_response",info:I},I)}let P=H?.routes?.length||H?.result||H?.data&&!H?.error;if(H?.error&&!P){let I={data:H.data,error:H.error,message:H.message,status:T.status};throw new t({errorKey:H.error,info:I},I)}if(H?.providerErrors?.length||H?.error&&P)console.warn("[SwapKit] Partial errors in response:",H.providerErrors||H.error);return H};function MN(N,A={}){return async function(H,P={}){let{searchParams:I,json:F,body:O,headers:g,dynamicHeader:Y,retry:Q,timeoutMs:_,abortController:j,onError:U,onSuccess:k,responseHandler:x,...b}={...A,...P},TN=w.get("requestOptions"),S={...TN.retry,...Q},ON=!!F||H.endsWith(".json"),$N=MT(H,I),fN=Y?await Y():{},HN=gT(ON,{...g,...fN}),d=ON?JSON.stringify(F):O,QN;for(let GN=0;GN<=S.maxRetries;GN++){let CN=j||new AbortController,hN=setTimeout(()=>CN.abort(),_||TN.timeoutMs);try{let m=await GT($N,{...b,body:d,headers:HN,method:N,signal:CN.signal});return clearTimeout(hN),k?.(m)||x?.(m)||m}catch(m){clearTimeout(hN),QN=m;let lA=m?.cause?.status;if(GN>=S.maxRetries||!$T(m,lA))return U?U(m):Promise.reject(m);await BT(OT(GN,S))}}return U?U(QN):Promise.reject(QN)}}function gT(N,A){return{...A,...N&&{"Content-Type":"application/json"}}}function MT(N,A){let T=new URL(N);if(A)T.search=new URLSearchParams(A).toString();return T.toString()}var G={extend:(N)=>({extend:(A)=>G.extend({...N,...A}),get:MN("GET",N),post:MN("POST",N)}),get:MN("GET"),post:MN("POST")};import{Chain as z,CosmosChains as tT,EVMChains as _T,StagenetChains as DT,UTXOChains as YT}from"@swapkit/types";import{match as NA}from"ts-pattern";import{Chain as ZN}from"@swapkit/types";function lP(N){if(N<0)throw new t({errorKey:"helpers_invalid_number_of_years",info:{numberOfYears:N}});return 10+N}function rP(N){if(N<0)throw new t({errorKey:"helpers_invalid_number_of_years",info:{numberOfYears:N}});return Math.round((10+N*1.0512)*10000000000)/10000000000}function iP(N,A){try{return N()}catch(T){if(A)throw new t(A,T);return}}function sP(N){switch(N){case ZN.THORChain:return`${N}.RUNE`;case ZN.Cosmos:return`${N}.ATOM`;case ZN.BinanceSmartChain:return`${N}`;default:return`${N}.${N}`}}var eN=new Set;function c({condition:N,id:A,warning:T}){if(N){if(eN.has(A))return;console.warn(T),eN.add(A)}}function UT(N){return NA(N).with(..._T,()=>({id:1,jsonrpc:"2.0",method:"eth_blockNumber",params:[]})).with(...YT,()=>({id:"test",jsonrpc:"1.0",method:"getblockchaininfo",params:[]})).with(...tT,...DT,()=>({id:1,jsonrpc:"2.0",method:"status",params:{}})).with(z.Polkadot,z.Chainflip,()=>({id:1,jsonrpc:"2.0",method:"system_health",params:[]})).with(z.Solana,()=>({id:1,jsonrpc:"2.0",method:"getHealth"})).with(z.Sui,()=>({id:1,jsonrpc:"2.0",method:"sui_getSystemState",params:[]})).with(z.Ton,()=>({id:1,jsonrpc:"2.0",method:"getAddressInformation",params:{address:""}})).with(z.Aptos,z.Tron,z.Radix,z.Stellar,()=>"").with(z.HyperCore,()=>({type:"meta"})).with(z.Near,()=>({id:"dontcare",jsonrpc:"2.0",method:"status",params:[]})).with(z.Ripple,()=>({id:1,jsonrpc:"2.0",method:"ping",params:[{}]})).with(z.Starknet,()=>({id:1,jsonrpc:"2.0",method:"starknet_chainId",params:[]})).otherwise(()=>{throw new t("helpers_chain_not_supported",{chain:N})})}function ST(N){return NA(N).with(z.Aptos,()=>"/-/healthy").with(z.HyperCore,()=>"/info").with(z.Radix,()=>"/status/network-configuration").with(z.Stellar,()=>"").with(z.Tron,()=>"/wallet/getnowblock").otherwise(()=>"")}async function aN(N,A){try{let T=A.startsWith("wss")?A.replace("wss","https"):A;return(await fetch(`${T}${ST(N)}`,{body:JSON.stringify(UT(N)),cache:"no-store",headers:{"Content-Type":"application/json"},method:"POST",signal:AbortSignal.timeout(3000)})).ok}catch{return!1}}var VN=new Map,XT=120000;function ET(N){let[A=""]=w.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 t("helpers_chain_no_public_or_set_rpc_url",{chain:N});let T=VN.get(N);if(T&&Date.now()-T.timestamp<XT)return T.url;return VN.set(N,{timestamp:Date.now(),url:A}),A}async function l(N){let A=ET(N),[,...T]=w.get("rpcUrls")[N];if(await aN(N,A))return A;for(let P of T)if(await aN(N,P))return VN.set(N,{timestamp:Date.now(),url:P}),P;throw new t("helpers_chain_rpc_connection_failed",{chain:N,fallbackUrls:T,primaryRpcUrl:A})}function PL(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."})}var nL=[`${n.Maya}.MAYA`,`${n.Maya}.CACAO`,`${n.Ethereum}.THOR`,`${n.Ethereum}.vTHOR`,`${n.Kujira}.USK`,`${n.Ethereum}.FLIP`,`${n.Radix}.XRD`],HA=[n.Arbitrum,n.Aurora,n.Base,n.Ethereum,n.Optimism];async function xT(N){let{baseDecimal:A}=o(n.Radix);try{let T=await l(n.Radix),{manager:H}=await G.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 bT(N){try{let A=await l(n.Radix);return(await G.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 PA({chain:N,address:A,methodHex:T,id:H}){let P=await l(N);return G.post(P,{body:JSON.stringify({id:H,jsonrpc:"2.0",method:"eth_call",params:[{data:T,to:A.toLowerCase()},"latest"]}),headers:{accept:"*/*","cache-control":"no-cache","content-type":"application/json"}})}async function zT(N){if(!N||N==="0x")return"UNKNOWN";try{let{AbiCoder:A}=await import("ethers");return A.defaultAbiCoder().decode(["string"],N)[0].trim()}catch(A){return console.warn(`Failed to decode ABI string from ${N}: ${A}`),"UNKNOWN"}}function JT(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 ZT({chain:N,address:A}){let{baseDecimal:T}=o(N),H=A.toLowerCase();if(A===""||!H.startsWith("0x"))return T;let P=await PA({address:A,chain:N,id:2,methodHex:"0x313ce567"}).catch((F)=>{return console.warn(`Could not fetch decimals for ${A} on ${N}: ${F.message}`),{result:""}});return JT(P.result,T)}async function VT({chain:N,address:A}){let T=A.toLowerCase();if(T===""||!T.startsWith("0x"))return;let H=await PA({address:A,chain:N,id:1,methodHex:"0x95d89b41"}).catch((I)=>{return console.warn(`Could not fetch symbol for ${A} on ${N}: ${I.message}`),{result:""}});return await zT(H.result)}async function AA({rpcUrl:N,contractAddress:A,functionSelector:T}){return(await G.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 TA(N){let A=N.match(/.{2}/g)?.map((T)=>Number.parseInt(T,16))??[];return new TextDecoder().decode(new Uint8Array(A))}function WT(N){return RN(N).with(void 0,()=>{return}).when((A)=>A.length>=128,(A)=>{let T=Number.parseInt(A.slice(64,128),16);return TA(A.slice(128,128+T*2))}).when((A)=>A.length===64,(A)=>{let T=A.replace(/0+$/,"");if(T.length>0&&T.length%2===0)return TA(T);return}).otherwise(()=>{return})}function LA({chain:N,address:A}){let{baseDecimal:T}=o(N),H={decimals:T,ticker:void 0};return RN(N).with(...wT,async()=>{try{let{isAddress:P,getAddress:I}=await import("ethers");if(!P(I(A.replace(/^0X/,"0x"))))return H;let[F,O]=await Promise.all([VT({address:A,chain:N}),ZT({address:A,chain:N})]);return{decimals:O,ticker:F}}catch(P){return console.warn(`Failed to fetch token info for ${A} on ${N}: ${P?.code} ${P?.message}`),H}}).with(n.Solana,async()=>{if(!A)return H;try{let P=await fetch(`https://lite-api.jup.ag/tokens/v2/search?query=${A}`);if(P.ok){let I=await P.json(),F=Array.isArray(I)?I[0]:I;if(F)return{decimals:F.decimals??T,ticker:F.symbol||void 0}}}catch(P){console.warn(`Failed to fetch Solana token info for ${A}: ${P?.code} ${P?.message}`)}return H}).with(n.Tron,async()=>{if(!A)return H;try{let P=await l(n.Tron),[I,F]=await Promise.all([AA({contractAddress:A,functionSelector:"symbol()",rpcUrl:P}),AA({contractAddress:A,functionSelector:"decimals()",rpcUrl:P})]),O=WT(I);return{decimals:I!==void 0&&F?Number(BigInt(`0x${F}`)):T,ticker:O}}catch(P){let I=P instanceof Error?P.message:String(P);return console.warn(`Failed to fetch Tron token info for ${A}: ${I}`),H}}).with(n.Near,async()=>{if(!A)return H;try{let{JsonRpcProvider:P}=await import("@near-js/providers"),I=await l(n.Near),O=await new P({url:I}).query({account_id:A,args_base64:Buffer.from("{}").toString("base64"),finality:"final",method_name:"ft_metadata",request_type:"call_function"}),g=JSON.parse(Buffer.from(O.result).toString());return{decimals:g?.decimals||T,ticker:g?.symbol}}catch(P){let I=P instanceof Error?P.message:String(P);return console.warn(`Failed to fetch Near token info for ${A}: ${I}`),H}}).with(n.Radix,async()=>{if(!A)return H;try{let[P,I]=await Promise.all([bT(A),xT(A)]);return{decimals:I,ticker:P}}catch(P){let I=P instanceof Error?P.message:String(P);return console.warn(`Failed to fetch Radix token info for ${A}: ${I}`),H}}).otherwise(async()=>H)}function tN({chain:N,symbol:A}){return RN(N).with(...HA,()=>A==="ETH").with(n.Avalanche,()=>A==="AVAX").with(n.Berachain,()=>A==="BERA").with(n.Hyperevm,()=>A==="HYPE").with(n.HyperCore,()=>A==="HYPE").with(n.BinanceSmartChain,()=>A==="BNB").with(n.Gnosis,()=>A==="xDAI"||A==="XDAI").with(n.Monad,()=>A==="MON").with(n.XLayer,()=>A==="OKB").with(n.Maya,()=>A==="CACAO").with(n.Cosmos,()=>A==="ATOM").with(n.THORChain,()=>A==="RUNE").with(n.Tron,()=>A==="TRX").with(n.Ripple,()=>A==="XRP").with(n.Radix,()=>`${N}.${A}`===_N(N).identifier).otherwise(()=>A===N)}var _N=(N)=>{let{baseDecimal:A}=o(N);return RN(N.toUpperCase()).with(...HA,(H)=>({decimal:A,identifier:`${H}.ETH`})).with(n.THORChain,(H)=>({decimal:A,identifier:`${H}.RUNE`})).with(n.Cosmos,(H)=>({decimal:A,identifier:`${H}.ATOM`})).with(n.Maya,(H)=>({decimal:10,identifier:`${H}.CACAO`})).with(n.BinanceSmartChain,(H)=>({decimal:A,identifier:`${H}.BNB`})).with(n.Monad,(H)=>({decimal:A,identifier:`${H}.MON`})).with(n.Avalanche,(H)=>({decimal:A,identifier:`${H}.AVAX`})).with(n.Gnosis,(H)=>({decimal:A,identifier:`${H}.xDAI`})).with(n.XLayer,(H)=>({decimal:A,identifier:`${H}.OKB`})).with(n.Berachain,(H)=>({decimal:A,identifier:`${H}.BERA`})).with(n.Hyperevm,(H)=>({decimal:A,identifier:`${H}.HYPE`})).with(n.HyperCore,(H)=>({decimal:A,identifier:`${H}.HYPE`})).with(n.Tron,(H)=>({decimal:A,identifier:`${H}.TRX`})).with(n.Solana,n.Chainflip,n.Kujira,n.Ripple,n.Polkadot,n.Near,...QT,(H)=>({decimal:A,identifier:`${H}.${H}`})).with(n.Radix,"XRD.XRD",()=>({decimal:A,identifier:"XRD.XRD"})).with(n.Polygon,"POL.POL",()=>({decimal:A,identifier:"POL.POL"})).with("KUJI.USK",(H)=>({decimal:6,identifier:H})).with("ETH.FLIP",()=>({decimal:o(n.Ethereum).baseDecimal,identifier:"ETH.FLIP-0x826180541412D574cf1336d22c0C0a287822678A"})).with("ETH.THOR",()=>({decimal:o(n.Ethereum).baseDecimal,identifier:"ETH.THOR-0xa5f2211b9b8170f694421f2046281775e8468044"})).with("ETH.vTHOR",()=>({decimal:o(n.Ethereum).baseDecimal,identifier:"ETH.vTHOR-0x815c23eca83261b6ec689b60cc4a58b54bc24d8d"})).with("MAYA.CACAO",(H)=>({decimal:10,identifier:H})).with("MAYA.MAYA",(H)=>({decimal:4,identifier:H})).otherwise(()=>({decimal:A,identifier:N}))};function WN({chain:N,symbol:A}){if(A.includes("/"))return"Synth";if(A.includes("~"))return"Trade";return RN(N).with(n.Radix,()=>A===n.Radix||`${N}.${A}`===_N(N).identifier).with(n.Arbitrum,n.Optimism,n.Base,n.Aurora,()=>A===n.Ethereum).with(n.Cosmos,()=>A==="ATOM").with(n.BinanceSmartChain,()=>A==="BNB").with(n.Maya,()=>A==="CACAO").with(n.Monad,()=>A==="MON").with(n.THORChain,()=>A==="RUNE").with(n.Tron,()=>A==="TRX").with(n.Hyperevm,()=>A==="HYPE").with(n.HyperCore,()=>A==="HYPE").with(n.XLayer,()=>A==="OKB").otherwise(()=>A===N)?"Native":N}var f=(N)=>{let[A,...T]=N.split("."),H=N.includes("/"),P=T.join("."),I=P?.split("-"),F=I?.length?I.length===1?I[0]:I.slice(0,-1).join("-"):void 0;return{chain:A,symbol:P,synth:H,ticker:F}};function uN(N,A){let H=A===n.Near?N.indexOf("-"):N.lastIndexOf("-");if(H===-1)return{address:void 0,ticker:N};return{address:N.slice(H+1),ticker:N.slice(0,H)}}function BL(N){return`https://storage.googleapis.com/token-list-swapkit-dev/images/${N.toLowerCase()}.png`}async function OL(N){let{loadTokenLists:A}=await import("./tokens.js"),T=await A(),H=Object.values(T).flatMap((I)=>I.tokens);if("identifier"in N)return H.find((I)=>I.identifier===N.identifier)?.identifier;let P=N.contract.toLowerCase();for(let I of H){let{chain:F,symbol:O}=f(I.identifier);if(F!==N.chain)continue;let{address:g}=uN(O,F);if(g?.toLowerCase()===P)return I.identifier}return}var RA=["TERRA",...w.get("chains")];function uA(N=""){let A=N.toUpperCase(),[T]=A.split(".");if(RA.includes(T))return!0;let[H]=A.split("/");if(RA.includes(H))return!0;throw new t({errorKey:"helpers_invalid_identifier",info:{identifier:N,message:`Invalid identifier: ${N}. Expected format: <Chain>.<Ticker> or <Chain>.<Ticker>-<ContractAddress>`}})}function ML(N){if(N.length>30)return!1;let A=/^[a-zA-Z0-9+_-]+$/g;return!!N.match(A)}import{match as DN}from"ts-pattern";var r=8,jT=10;function h({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),I=T-(P.length-1);if(I>0)P="0".repeat(I)+P;let F=P.length-T,O=P.slice(-T);if(Number.parseInt(O[A]||"0",10)>=5){let Y=Number.parseInt(O[A-1]||"0",10);O=`${O.substring(0,A-1)}${Y+1}`}else O=O.substring(0,A);return`${H?"-":""}${P.slice(0,F)}.${O}`.replace(/\.?0*$/,"")}class p{decimalMultiplier=10n**8n;bigIntValue=0n;decimal;static fromBigInt(N,A){return new p({decimal:A,value:h({bigIntDecimal:A,decimal:A,value:N})})}static shiftDecimals({value:N,from:A,to:T}){return p.fromBigInt(N.getBaseValue("bigint")*C(T)/C(A),T)}constructor(N){let A=jN(N),T=typeof N==="object";this.decimal=T?N.decimal:void 0,this.decimalMultiplier=T&&"decimalMultiplier"in N?N.decimalMultiplier:C(Math.max(FA(YN(A)),this.decimal||0)),this.#P(A)}set(N){return new this.constructor({decimal:this.decimal,identifier:this.toString?.({includeSynthProtocol:!0}),value:N})}add(...N){return this.#A("add",...N)}sub(...N){return this.#A("sub",...N)}mul(...N){return this.#A("mul",...N)}div(...N){return this.#A("div",...N)}gt(N){return this.#N("gt",N)}gte(N){return this.#N("gte",N)}lt(N){return this.#N("lt",N)}lte(N){return this.#N("lte",N)}eqValue(N){return this.#N("eqValue",N)}getValue(N,A){let T=FN(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 I=this.formatBigIntToSafeValue(this.bigIntValue,P);return DN(N).with("number",()=>Number(I)).with("string",()=>I).with("bigint",()=>{return this.bigIntValue*10n**BigInt(this.decimal||8n)/this.decimalMultiplier}).otherwise(()=>I)}getBaseValue(N,A){let T=this.decimalMultiplier/C(A||this.decimal||r),H=qT(this.bigIntValue,T);return DN(N).with("number",()=>Number(H)).with("string",()=>H.toString()).otherwise(()=>H)}getBigIntValue(N,A){if(!A&&typeof N==="object")return N.bigIntValue;let T=jN(N),H=YN(T);if(H==="0"||H==="undefined")return 0n;return this.#H(H,A)}toSignificant(N=6){let A=this.getValue("string"),[T="",H=""]=A.split("."),P=Number.parseInt(T,10)>0;if((P?T.length+H.length:H.length)<=N)return A;if(T.length>=N)return T.slice(0,N).padEnd(T.length,"0");if(P)return`${T}.${H.slice(0,N-T.length)}`;let F=Number.parseInt(H,10).toString(),O=F.slice(0,N),g=H.length-F.length;return`0.${O.padStart(g+O.length,"0")}`}toFixed(N=6){let A=this.getValue("string"),T=A.startsWith("-"),[H="0",P=""]=(T?A.slice(1):A).split("."),I=H==="0"&&Number.parseInt(P.slice(0,N),10)===0,F=T&&!I?"-":"";if(N===0){if(H==="0"&&!P)return"0";return P&&Number.parseInt(P[0]||"0",10)>=5?`${F}${BigInt(H)+1n}.0`:`${F}${H}.0`}if(!P)return`${F}${H}.${"0".repeat(N)}`;let O=P[N];if(!(O&&Number.parseInt(O,10)>=5))return`${F}${H}.${P.slice(0,N).padEnd(N,"0")}`;let Y=BigInt(P.slice(0,N).padEnd(N,"0"))+1n,Q=10n**BigInt(N);if(Y>=Q)return`${F}${BigInt(H)+1n}.${"0".repeat(N)}`;return`${F}${H}.${Y.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:I=!0}={}){let F=this.toFixed(T),O=A==="end",[g="0",Y=""]=F.split("."),Q=g.replace(/\B(?=(\d{3})+(?!\d))/g,P),_=Y&&Number.parseInt(Y,10)>0,j=_?`${Q}${H}${Y}`:Q,k=j.length<100&&I&&_?j.replace(/\.?0*$/,""):j;return O?`${k}${N}`:`${N}${k}`}formatBigIntToSafeValue(N,A){let T=A||this.decimal||r,H=Math.max(T,FN(this.decimalMultiplier));return h({bigIntDecimal:T,decimal:H,value:N})}#A(N,...A){let T=this.#T(this,...A),H=FN(this.decimalMultiplier),I=Math.max(T,H)+jT,F=C(I),O=A.reduce((Y,Q)=>{let _=this.getBigIntValue(Q,I);return DN(N).with("add",()=>Y+_).with("sub",()=>Y-_).with("mul",()=>Y*_/F).with("div",()=>{if(_===0n)throw RangeError("Division by zero");return Y*F/_}).otherwise(()=>Y)},this.bigIntValue*F/this.decimalMultiplier),g=h({bigIntDecimal:I,decimal:I,value:O});return new this.constructor({decimal:this.decimal,decimalMultiplier:C(I),identifier:this.toString(),value:g})}#N(N,...A){let T=this.#T(this,...A),H=this.getBigIntValue(A[0]||"0",T),P=this.getBigIntValue(this,T);return DN(N).with("gt",()=>P>H).with("gte",()=>P>=H).with("lt",()=>P<H).with("lte",()=>P<=H).with("eqValue",()=>P===H).otherwise(()=>!1)}#P(N){let A=YN(N)||"0";this.bigIntValue=this.#H(A)}#T(...N){let A=N.map((T)=>{return typeof T==="object"?T.decimal||FN(T.decimalMultiplier):FA(YN(T))}).filter(Boolean);return Math.max(...A,r)}#H(N,A){let T=A?C(A):this.decimalMultiplier,H=FN(T),[P="",I=""]=N.split(".");return BigInt(`${P}${I.padEnd(H,"0")}`)}}var vT=Intl.NumberFormat("fullwide",{maximumFractionDigits:20,useGrouping:!1});function YN(N){let T=`${typeof N==="number"?vT.format(N):jN(N)}`.replaceAll(",",".").split(".");return T.length>1?`${T.slice(0,-1).join("")}.${T.at(-1)}`:T[0]||"0"}function FA(N){let A=N.split(".")[1]?.length||0;return Math.max(A,r)}function jN(N){return typeof N==="object"?"getValue"in N?N.getValue("string"):N.value:N}function qT(N,A){if(A===0n)throw Error("Cannot divide by zero");let T=A/2n;return N>=0n&&A>=0n||N<0n&&A<0n?(N+T)/A:(N-T)/A}function C(N){return 10n**BigInt(N)}function FN(N){return Math.log10(Number.parseFloat(N.toString()))}var y=[E.HyperCore,E.Near,E.Ripple,E.Solana,E.Sui,E.Ton,E.Tron],kN=[E.THORChain,E.Maya],i=new Map,UN=new Map,s=new Map,mT=3600000;function pT(N){let A=s.get(N);if(A?.timestamp&&Date.now()-A.timestamp>mT){s.delete(N);return}return A}function yT(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 v extends p{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:I}){super(typeof N==="object"?N:{decimal:A,value:N});let F=nA(I||`${H}.${P}`);this.type=WN(F),this.tax=T,this.chain=F.chain,this.ticker=F.ticker,this.symbol=F.symbol,this.address=F.address,this.isSynthetic=F.isSynthetic,this.isTradeAsset=F.isTradeAsset,this.isGasAsset=F.isGasAsset,this.chainId=IN(F.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 t({errorKey:"helpers_invalid_asset_url",info:{urlAsset:N}});let H=N.slice(0,T),P=N.slice(T+1),I=qN({chain:H,rest:P}).when(({rest:F})=>F.includes(".."),({chain:F,rest:O})=>`${F}.${O.replace(/\.\./g,"~")}`).when(({chain:F,rest:O})=>kN.includes(F)&&O.includes("."),({chain:F,rest:O})=>`${F}.${O.replace(/\./g,"/")}`).otherwise(({chain:F,rest:O})=>`${F}.${O.replace(/__/g,".")}`);return v.from({asset:I,value:A})}static from({value:N=0,fromBaseDecimal:A,asyncTokenLookup:T,...H}){let P=N instanceof p?N.getValue("string"):N,I="address"in H&&"chain"in H,F=hT(H);if(F===null&&T&&I){let{chain:HN,address:d}=H;return fT({address:d,chain:HN,fromBaseDecimal:A,parsedValue:P})}let O=I&&!F?`${H.chain}.UNKNOWN-${H.address}`:F,{identifier:g,decimal:Y}=_N(O),{chain:Q,isSynthetic:_,isTradeAsset:j,address:U}=nA(g),{baseDecimal:k}=IN(Q),x=i.get(y.includes(Q)?g:g.toUpperCase());if(!x&&T&&!_&&!j)return(async()=>{let{ticker:HN}=f(g),d=await BA({address:U,chain:Q,ticker:HN});return vN({decimal:d.decimals,identifier:d.identifier,value:A?e(BigInt(P),A):P})})();let b=x?.decimal||Y;c({condition:!b&&!T,id:`assetValue_static_decimal_not_found_${Q}`,warning:`Couldn't find static decimal for one or more tokens on ${Q} (Using default ${k} decimal as fallback).
2
2
  This can result in incorrect calculations and mess with amount sent on transactions.
3
3
  You can load static assets by installing @swapkit/tokens package and calling AssetValue.loadStaticAssets()
4
- or by passing asyncTokenLookup: true to the from() function, which will make it async and return a promise.`});let{decimal:TN,identifier:S,tax:ON}=x||{decimal:b||k,identifier:g},$N=A?e(BigInt(P),A):e(P,TN);return _||j?oT(S,$N):vN({decimal:TN,identifier:S,tax:ON,value:$N})}static async loadStaticAssets(N){let{loadTokenLists:A}=await import("@swapkit/tokens"),T=await A(N);for(let{tokens:H}of Object.values(T))for(let P of H){let{identifier:I}=P,{chain:F,symbol:O}=f(I),{address:g}=uN(O,F),{baseDecimal:Y}=IN(F),Q=y.includes(F)?I:I.toUpperCase(),_="decimals"in P&&P.decimals!==void 0?P.decimals:Y,j="logoURI"in P&&P.logoURI?P.logoURI:`https://storage.googleapis.com/token-list-swapkit-dev/images/${I.toLowerCase()}.png`,U={decimal:_,identifier:I,logoURI:j,tax:"tax"in P?P.tax:void 0};if(i.set(Q,U),g){let k=y.includes(F)?`${F}:${g}`:`${F}:${g.toUpperCase()}`;UN.set(k,I)}}return!0}static setStaticAssets(N){i.clear(),UN.clear();for(let[A,T]of N.entries()){let{identifier:H}=T,{chain:P,symbol:I}=f(H),{address:F}=uN(I,P),{baseDecimal:O}=IN(P),g=T.chain??P,Y=T.address??F,Q=y.includes(g)?H:H.toUpperCase(),_=T.decimals??T.decimal??O,j=T.logoURI??`https://storage.googleapis.com/token-list-swapkit-dev/images/${H.toLowerCase()}.png`,U={decimal:_,identifier:Q,logoURI:j,tax:T.tax};if(i.set(Q,U),Y){let k=y.includes(g)?`${g}:${Y}`:`${g}:${Y.toUpperCase()}`;UN.set(k,H)}}return!0}static get staticAssets(){return i}}function bL(N){let A=v.from({chain:N});return qN(N).with(E.Bitcoin,E.Litecoin,E.BitcoinCash,E.Dash,()=>A.set(0.00010001)).with(E.Dogecoin,()=>A.set(1.00000001)).with(E.Avalanche,E.Ethereum,E.Arbitrum,E.BinanceSmartChain,()=>A.set(0.00000001)).with(E.THORChain,E.Maya,()=>A.set(0)).with(E.Cosmos,E.Kujira,()=>A.set(0.000001)).otherwise(()=>A.set(0.00000001))}async function BA({chain:N,address:A,ticker:T}){let P=y.includes(N)?`${N}:${A||T}`:`${N}:${A||T}`.toUpperCase(),I=pT(P);if(I)return I;if(!A){let{baseDecimal:g}=IN(N);return{decimals:g,identifier:`${N}.${T||"UNKNOWN"}`}}let F=await LA({address:A,chain:N}),O=`${N}.${F.ticker||T||"UNKNOWN"}-${A}`;return c({condition:!!(!F.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 (${F.decimals}).`}),F.ticker&&yT(P,{decimals:F.decimals,identifier:O}),{decimals:F.decimals,identifier:O}}function vN({identifier:N,decimal:A,value:T,tax:H}){return uA(N),new v({decimal:A,identifier:N,tax:H,value:e(T,A)})}function oT(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("~")?"~":"/",[I,F]=H?N.split(".").slice(1).join().split(P):N.split(P);if(!(I&&F))throw new t({errorKey:"helpers_invalid_asset_identifier",info:{identifier:N}});return new v({decimal:8,identifier:`${T||E.THORChain}.${I}${P}${F}`,value:e(A,8)})}async function fT({address:N,chain:A,fromBaseDecimal:T,parsedValue:H}){let{decimals:P,identifier:I}=await BA({address:N,chain:A}),F=T?e(BigInt(H),T):H;return vN({decimal:P,identifier:I,value:F})}function e(N,A){return typeof N==="bigint"?h({bigIntDecimal:A,decimal:A,value:N}):N}function CT(N){let A=qN(N).when((T)=>("chain"in T)&&T.chain!==void 0,({chain:T})=>T).otherwise((T)=>{let H=f(T.asset);return H.synth?E.THORChain:H.chain});if(!kT.includes(A.toUpperCase())){let T="asset"in N?N.asset:A;throw new t({errorKey:"helpers_invalid_asset_identifier",info:{identifier:T,message:`Unsupported chain "${A}" - use the AssetValue constructor directly`}})}}function hT(N){if(CT(N),"chain"in N){let{chain:P,address:I}=N;if(I){let F=y.includes(P)?`${P}:${I}`:`${P}:${I.toUpperCase()}`,O=UN.get(F);if(O)return O;return null}return P}let{chain:A,symbol:T}=f(N.asset);return WN({chain:A,symbol:T})==="Native"?A:N.asset}function dT(N,A,T){let H=N.split("."),P=H[0]?.toUpperCase(),I=kN.includes(P),F=T?"~":"/",[O,g=""]=I?H.slice(1).join(".").split(F):N.split(F);if(!(O&&g))throw new t({errorKey:"helpers_invalid_asset_identifier",info:{identifier:N}});let{ticker:Y,address:Q}=OA({chain:O,symbol:g}),_=`${O}${F}${g}`;return{address:Q,chain:P,isGasAsset:!1,isSynthetic:A,isTradeAsset:T,symbol:_,ticker:Y}}function cT(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:I}=OA({chain:T,symbol:H}),F;try{F=P&&KT.includes(T)&&IA(P)?IA(P):P}catch{F=P}let O=F?`${I}-${F}`:H;return{address:F,chain:T,isGasAsset:tN({chain:T,symbol:H}),isSynthetic:!1,isTradeAsset:!1,symbol:O,ticker:I}}function nA(N){let A=N.slice(0,14),T=A.includes("/"),H=A.includes("~");if(T||H)return dT(N,T,H);return cT(N)}function OA({symbol:N,chain:A}){let{ticker:T,address:H}=uN(N,A);return{address:H&&!y.includes(A)?H.toLowerCase():H,ticker:T}}class SN extends p{eq(N){return this.eqValue(N)}static fromBigInt(N,A){return new SN({decimal:A,value:h({bigIntDecimal:A,decimal:A,value:N})})}}function $A(N=!0){return N?"https://midgard.thorchain.network":"https://midgard.mayachain.info"}function rT(N=!0){let A=$A(N);return N?`${A}/v2/thorname`:`${A}/v2/mayaname`}function iT(N){return function(T){let H=T?`?status=${T}`:"";return G.get(`${N}/v2/pools${H}`)}}function sT(N){return function(T){return G.get(`${N}/v2/pool/${T}`)}}function eT(N){return function(T,H){let P=H?`?period=${H}`:"";return G.get(`${N}/v2/pool/${T}/stats${P}`)}}function aT(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 I=P.toString()?`?${P.toString()}`:"";return G.get(`${N}/v2/history/depths/${T}${I}`)}}function NH(N){return function(){return G.get(`${N}/v2/network`)}}function AH(N){return function(){return G.get(`${N}/v2/health`)}}function TH(N){return function(){return G.get(`${N}/v2/nodes`)}}function HH(N){return function(T){return G.get(`${N}/v2/node/${T}`)}}function PH(N){return function(){return G.get(`${N}/v2/mimir/votes`)}}function LH(N){return function(){return G.get(`${N}/v2/mimir`)}}function RH(N){return function(){return G.get(`${N}/v2/constants`)}}function uH(N){return function(){return G.get(`${N}/v2/stats`)}}function FH(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 G.get(`${N}/v2/history/earnings${P}`)}}function IH(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 I=P.toString()?`?${P.toString()}`:"",F=T?`/swaps/${T}`:"/swaps";return G.get(`${N}/v2/history${F}${I}`)}}function nH(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 G.get(`${N}/v2/history/tvl${P}`)}}function BH(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 OH(N){return function(T){let H=BH(T);return G.get(`${N}/v2/actions${H}`)}}function $H(N){return function(T){return G.get(`${N}/v2/member/${T}`)}}function GH(N){return function(T){let H=T?`/${T}`:"";return G.get(`${N}/v2/members${H}`)}}function gH(N){return function(T,H){let P=H?`&asset=${H}`:"";return G.get(`${N}/v2/saver/${T}${P?`?${P.substring(1)}`:""}`)}}function MH(N){return function(T){return G.get(`${N}/v2/savers/${T}`)}}function tH(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 I=P.toString()?`?${P.toString()}`:"",F=T?`/savers/${T}`:"/savers";return G.get(`${N}/v2/history${F}${I}`)}}function _H(N){return function(T){return G.get(`${N}/v2/balance/${T}`)}}function DH(N){return async function(T){let H=(P)=>{if(P?.cause?.status===404)return;throw P};return await G.get(`${N}/lookup/${T}`,{onError:H,retry:{maxRetries:1}})}}function YH(N){return async function(T){let H=(P)=>{if(P?.cause?.status===404)return[];throw P};return await G.get(`${N}/rlookup/${T}`,{onError:H,retry:{maxRetries:1}})}}function UH(N){return async function(T){let H=(P)=>{if(P?.cause?.status===404)return[];throw P};return await G.get(`${N}/owner/${T}`,{onError:H,retry:{maxRetries:1}})}}function a({asset:N,value:A}){return v.from({asset:N,fromBaseDecimal:lT(XN.THORChain).baseDecimal,value:A})}function SH({liquidityPositionGetter:N,isThorchain:A}){return async function(H){let P=await N(H),I=A?"rune":"cacao";return P.pools.map((F)=>({[`${I}Pending`]:a({asset:"THOR.RUNE",value:F.runePending}),[`${I}RegisteredAddress`]:F.runeAddress,[`${I}Withdrawn`]:a({asset:"THOR.RUNE",value:F.runeWithdrawn}),[I]:a({asset:"THOR.RUNE",value:F.runeAdded}),asset:a({asset:F.pool,value:F.assetAdded}),assetPending:a({asset:F.pool,value:F.assetPending}),assetRegisteredAddress:F.assetAddress,assetWithdrawn:a({asset:F.pool,value:F.assetWithdrawn}),dateFirstAdded:F.dateFirstAdded,dateLastAdded:F.dateLastAdded,poolShare:new SN(F.liquidityUnits).div(F.pool)}))}}function GA(N){let A=N===XN.THORChain,T=$A(A),H=rT(A),P=$H(T);return{getActions:OH(T),getBalance:_H(T),getConstants:RH(T),getEarningsHistory:FH(T),getHealth:AH(T),getLiquidityPosition:SH({isThorchain:A,liquidityPositionGetter:P}),getLiquidityPositionRaw:P,getMembers:GH(T),getMimir:LH(T),getMimirVotes:PH(T),getNameDetails:DH(H),getNamesByAddress:YH(H),getNamesByOwner:UH(H),getNetworkInfo:NH(T),getNode:HH(T),getNodes:TH(T),getPool:sT(T),getPoolDepthHistory:aT(T),getPoolStats:eT(T),getPools:iT(T),getSaverDetails:gH(T),getSavers:MH(T),getSaversHistory:tH(T),getStats:uH(T),getSwapHistory:IH(T),getTVLHistory:nH(T)}}var gA=GA(XN.THORChain),MA=GA(XN.Maya);var yN={};dN(yN,{getTrackerDetails:()=>iH,getTokenListProviders:()=>AP,getTokenList:()=>TP,getTokenApproval:()=>NP,getSwapTo:()=>nP,getSwapQuote:()=>sH,getRouteWithTx:()=>eH,getPrice:()=>HP,getNearDepositChannel:()=>RP,getGasRate:()=>PP,getChainflipDepositChannel:()=>LP,getChainBalance:()=>aH,SKRequestClient:()=>W});import{EVMChains as lH}from"@swapkit/types";import{match as rH,P as BN}from"ts-pattern";async function tA(N,A,T){let H=`${A}:${T}`,P=new TextEncoder,I=await crypto.subtle.importKey("raw",P.encode(N),{hash:"SHA-256",name:"HMAC"},!1,["sign"]),F=await crypto.subtle.sign("HMAC",I,P.encode(H));return Array.from(new Uint8Array(F)).map((O)=>O.toString(16).padStart(2,"0")).join("")}import{Chain as EN,ChainId as nN}from"@swapkit/types";import{array as X,boolean as K,coerce as UA,number as M,object as $,optional as B,string as R,union as KN,unknown as SA,z as L}from"zod/v4";var XA;((H)=>{H.CHEAPEST="CHEAPEST";H.FASTEST="FASTEST";H.RECOMMENDED="RECOMMENDED"})(XA||={});var wN;((P)=>{P.PSBT="PSBT";P.EVM="EVM";P.COSMOS="COSMOS";P.RADIX="RADIX"})(wN||={});var EA;((b)=>{b.approve="approve";b.claim="claim";b.deposit="deposit";b.donate="donate";b.lending="lending";b.lp_action="lp_action";b.native_contract_call="native_contract_call";b.native_send="native_send";b.stake="stake";b.streaming_swap="streaming_swap";b.swap="swap";b.thorname_action="thorname_action";b.token_contract_call="token_contract_call";b.token_transfer="token_transfer";b.unknown="unknown";b.unstake="unstake"})(EA||={});var wA;((U)=>{U.swap="swap";U.aggregation="aggregation";U.addLiquidity="addLiquidity";U.withdrawLiquidity="withdrawLiquidity";U.addSavers="addSavers";U.withdrawSavers="withdrawSavers";U.borrow="borrow";U.repay="repay";U.name="name";U.donate="donate";U.claim="claim";U.stake="stake";U.unstake="unstake"})(wA||={});var QA;((O)=>{O.unknown="unknown";O.not_started="not_started";O.pending="pending";O.swapping="swapping";O.completed="completed";O.refunded="refunded";O.failed="failed"})(QA||={});var xA;((x)=>{x.not_started="not_started";x.starting="starting";x.broadcasted="broadcasted";x.mempool="mempool";x.inbound="inbound";x.outbound="outbound";x.swapping="swapping";x.completed="completed";x.refunded="refunded";x.partially_refunded="partially_refunded";x.dropped="dropped";x.reverted="reverted";x.replaced="replaced";x.retries_exceeded="retries_exceeded";x.parsing_error="parsing_error"})(xA||={});var yL=$({address:B(R()),chain:L.enum(EN).optional(),chainId:L.enum(nN),coingeckoId:B(R()),decimals:UA.number(),extensions:B(L.looseObject({})),identifier:R(),logoURI:B(R()),name:B(R()),shortCode:B(R()),symbol:B(R()),ticker:R()}),oL=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"}),fL=L.object({forceUpdate:L.string().toLowerCase().transform((N)=>N==="true").pipe(L.boolean()).optional()}),CL=$({error:R(),message:R()}),NN=$({address:B(R()),chain:L.enum(EN),decimal:B(M()),isGasAsset:K(),isSynthetic:K(),symbol:R(),tax:B($({buy:M(),sell:M()})),ticker:R()}),bA=$({id:R(),market_cap:M(),name:R(),price_change_24h_usd:M(),price_change_percentage_24h_usd:M(),sparkline_in_7d:X(M()),timestamp:R(),total_volume:M()}).partial(),hL=$({cg:B(bA),identifier:R(),price_usd:M(),provider:R(),timestamp:M()}),zA=X($({cg:B(bA),identifier:R(),price_usd:M(),provider:R(),timestamp:M()}).partial()),dL=$({affiliate:B(R().describe("Affiliate thorname")),affiliateFee:B(M().describe("Affiliate fee in basis points").refine((N)=>N===Math.floor(N)&&N>=0,{message:"affiliateFee must be a positive integer",path:["affiliateFee"]})),allowSmartContractReceiver:B(K().describe("Allow smart contract as recipient")),allowSmartContractSender:B(K().describe("Allow smart contract as sender")),buyAsset:R().describe("Asset to buy"),cfBoost:B(K().describe("Set to true to enable CF boost to speed up Chainflip swaps. BTC only.")),destinationAddress:B(R().describe("Address to send asset to")),disableSecurityChecks:B(K().describe("Disable security checks")),includeTx:B(K().describe("Set to true to include an transaction object (EVM only)")),providers:B(X(R().describe("List of providers to use").refine((N)=>J[N]!==void 0,{message:"Invalid provider",path:["providers"]}))),referrer:B(R().describe("Referrer address (referral program)")),sellAmount:R().describe("Amount of asset to sell").refine((N)=>+N>0,{message:"sellAmount must be greater than 0",path:["sellAmount"]}),sellAsset:R().describe("Asset to sell"),slippage:B(M().describe("Slippage tolerance as a percentage. Default is 3%.")),sourceAddress:B(R().describe("Address to send asset from"))}).refine((N)=>N.sellAsset!==N.buyAsset,{message:"Must be different",path:["sellAsset","buyAsset"]}),cL=$({metadata:K(),tokens:X($({identifier:R()}))}),JA=$({destinationAddress:R()}),XH=JA.extend({affiliateFees:X($({brokerAddress:R(),feeBps:M()})).optional(),brokerCommissionBps:M().optional(),buyAsset:$({asset:R(),chain:R()}),channelMetadata:$({cfParameters:R().optional(),gasBudget:R().optional(),message:R().optional()}).optional(),dcaParameters:$({chunkInterval:M().optional(),numberOfChunks:M().optional()}).optional(),maxBoostFeeBps:M().optional(),refundParameters:$({minPrice:R().optional(),refundAddress:R().optional(),retryDuration:M().optional()}).optional(),sellAsset:$({asset:R(),chain:R()})}),ZA=$({channelId:R(),depositAddress:R()}),_A=JA.extend({affiliateFees:$({feeBps:M(),nearId:R()}).optional(),buyAsset:R(),sellAmount:R(),sellAsset:R(),slippage:UA.number(),sourceAddress:R()}),DA=$({amountIn:R(),amountInFormatted:R(),amountInUsd:R(),amountOut:R(),amountOutFormatted:R(),amountOutUsd:R(),deadline:R().optional(),minAmountIn:R(),minAmountOut:R(),timeEstimate:M().optional(),timeWhenInactive:R().optional()}),lL=DA.extend({depositAddress:R(),quote:DA,signature:R(),timestamp:R(),tx:SA()}),VA=$({buyAsset:R(),buyAssetAmount:R(),buyAssetAmountMaxSlippage:R(),deadline:R().optional(),depositAddress:R(),depositAmount:R(),depositAsset:R(),tx:SA()}),EH=$({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())}),wH=$({currentStage:R(),inboundConfirmation:M(),inboundObservation:M(),outboundDelay:M(),outboundObservation:M(),streamingSwap:M()}),QH=$({count:B(M()),interval:B(M()),quantity:B(M()),subSwapsMap:B(X(M()))}),xH=L.object({currentLegIndex:L.optional(L.number()),estimatedTimeToComplete:L.number(),estimates:L.optional(wH),providerDetails:L.optional(L.object({streamingDetails:L.optional(QH)}))}),bH=$({affiliate:B(NN),liquidity:B(NN),network:B(NN),protocol:B(NN),tax:B(NN)}),zH=$({affiliate:R(),bps:R(),isReferrer:K()}),JH=$({affiliate:B(R()),affiliateFees:B(X(zH)),broadcastedAt:B(M()),explorerUrl:B(R()),fees:B(bH),images:B($({chain:B(R()),from:B(R()),provider:B(R()),to:B(R())})),provider:B(L.enum(J)),providerAction:L.optional(L.enum(wA)),quoteId:B(R()),wallet:B(R())}),AN=L.object({block:L.number(),chainId:L.enum(nN),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(JH),payload:L.optional(EH),status:L.enum(QA),toAddress:L.string(),toAmount:L.string(),toAsset:L.string(),trackingStatus:L.optional(L.enum(xA)),transient:L.optional(xH),type:L.enum(EA)}),WA=AN.extend({legs:L.array(AN)}),rL=AN.extend({legs:X(AN)}),iL=AN.extend({legs:X(AN)}),mN=X($({amount:R(),asset:R(),chain:R(),protocol:L.enum(J),type:L.enum(bN)})),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")}),jA=$({data:R().describe("Data to send"),from:R().describe("Address of the sender"),to:R().describe("Address of the recipient"),value:R().describe("Value to send")}),vA=L.object({raw_data:L.object({contract:L.any(),data:L.string().optional(),expiration:L.number(),fee_limit:L.number().optional(),ref_block_bytes:L.string(),ref_block_hash:L.string(),timestamp:L.number()}).passthrough(),raw_data_hex:L.string(),txID:L.string(),visible:L.boolean()}),ZH=X(KN([R(),M(),X(R()),$({from:R(),value:R()}).describe("Parameters to pass to the contract method")])),sL=$({approvalSpender:B(R().describe("Address of the spender to approve")),approvalToken:B(R().describe("Address of the token to approve spending of")),contractAddress:R().describe("Address of the contract to interact with"),contractMethod:R().describe("Name of the method to call"),contractParamNames:X(R().describe("Names of the parameters to pass to the contract method")),contractParams:ZH}),VH=$({typeUrl:R("/types.MsgDeposit"),value:$({coins:X($({amount:R(),asset:$({chain:R(),symbol:R(),synth:K(),ticker:R()})})),memo:R(),signer:R()})}),WH=$({typeUrl:R("/types.MsgSend"),value:$({amount:X($({amount:R(),denom:R()})),fromAddress:R(),toAddress:R()})}),jH=$({typeUrl:R(),value:WH.or(VH)}),vH=$({amount:X($({amount:R(),denom:R()})),gas:R()}),qA=$({accountNumber:M(),chainId:L.enum(nN),fee:vH,memo:R(),msgs:X(jH),sequence:M()}),qH=L.array(L.object({calldata:L.array(L.string()),contractAddress:L.string(),entrypoint:L.string()})),kA=L.array(L.object({address:L.string().describe("Destination address in friendly format"),amount:L.string().describe("Amount in nanotons"),payload:L.string().optional().describe("Base64 BOC of body cell"),stateInit:L.string().optional().describe("Base64 BOC of state init")})),kH=$({affiliate:R().describe("Affiliate address").optional(),affiliateFee:M().describe("Affiliate fee").optional(),buyAsset:R().describe("Asset to buy"),destinationAddress:R().describe("Destination address"),estimatedTime:pN.optional(),provider:L.enum(J),sellAsset:R().describe("Asset to sell"),slipPercentage:M().describe("Slippage as a percentage"),sourceAddress:R().describe("Source address")}),eL=kH.omit({destinationAddress:!0,slipPercentage:!0,sourceAddress:!0}),KH=$({asset:R().describe("Asset name"),image:R().describe("Asset image"),price:M().describe("Price in USD")}),mH=XH,KA=$({assets:B(X(KH)),maxStreamingQuantity:M().optional(),referrer:R().optional(),streamingInterval:M().optional(),tags:X(L.enum(XA))}),mA=KA.extend({affiliate:B(R()),affiliateFee:B(R()),approvalAddress:B(R().describe("Approval address for swap")),chainflip:mH.optional(),garden:_A.optional(),near:_A.optional(),priceImpact:B(M().describe("Price impact")),referrer:B(R()),txType:B(L.enum(wN))}),pA=X($({code:L.enum(xN),display:R(),tooltip:R().optional()})),pH=$({buyAmount:R().describe("Buy amount"),buyAmountMaxSlippage:R().describe("Buy amount max slippage"),buyAsset:R().describe("Asset to buy"),fees:B(mN),provider:L.enum(J),sellAmount:R().describe("Sell amount"),sellAsset:R().describe("Asset to sell")}),yH=$({buyAsset:R().describe("Asset to buy"),destinationAddress:B(R().describe("Destination address")),estimatedTime:B(pN),expectedBuyAmount:R().describe("Expected Buy amount"),expectedBuyAmountMaxSlippage:R().describe("Expected Buy amount max slippage"),expiration:B(R().describe("Expiration")),fees:mN,inboundAddress:B(R().describe("Inbound address")),legs:X(pH),memo:B(R().describe("Memo")),meta:mA,providers:X(L.enum(J)),routeId:R().describe("Route ID"),sellAmount:R().describe("Sell amount"),sellAsset:R().describe("Asset to sell"),sourceAddress:B(R().describe("Source address")),targetAddress:B(R().describe("Target address")),totalSlippageBps:M().describe("Total slippage in bps"),tx:B(KN([jA,qA,vA,qH,kA,R()])),txType:B(L.enum(wN)),warnings:pA}),yA=$({error:B(R().describe("Error message")),providerErrors:B(X($({errorCode:B(L.enum(LN)),message:B(R()),provider:L.enum(J).optional()}))),quoteId:R().describe("Quote ID"),routes:X(yH)}),oA=L.object({chainId:L.enum(nN),createdAt:L.date(),id:L.number(),unit:L.string(),value:L.string()}),oH=L.array(oA),fA=L.union([oA,oH]),aL=X($({chain:L.enum(EN),decimal:M(),identifier:R(),symbol:R(),ticker:R(),value:R()})),NR=L.union([L.object({amount:L.string(),spender:L.string(),tokenIdentifier:L.string(),userWalletAddress:L.string()}),L.object({amount:L.string(),chainId:L.enum(nN),spender:L.string(),tokenContractAddress:L.string(),userWalletAddress:L.string()}),L.object({routeId:L.string()})]),AR=L.object({approvalTransaction:L.optional(L.object({data:L.string(),from:L.string(),gasLimit:L.optional(L.string()),gasPrice:L.optional(L.string()),to:L.string(),value:L.string()})),approvedAmount:L.string(),isApproved:L.boolean()}),fH=L.object({data:L.string().describe("Encoded approval call data"),from:L.string().describe("User wallet address"),gasLimit:L.string().optional().describe("Estimated gas limit"),gasPrice:L.string().optional().describe("Current gas price"),to:L.string().describe("Token contract address"),value:L.string().describe("ETH value (always '0' for approvals)")}),YA=L.object({buyAmount:L.string().describe("Buy amount"),buyAmountMaxSlippage:L.string().describe("Buy amount max slippage"),buyAsset:L.string().describe("Asset to buy"),expectedBuyAmount:L.string().describe("Expected Buy amount"),expectedBuyAmountMaxSlippage:L.string().describe("Expected Buy amount max slippage"),fees:mN,provider:L.enum(J),sellAmount:L.string().describe("Sell amount"),sellAsset:L.string().describe("Asset to sell")}),CA=YA.extend({estimatedTime:L.optional(pN),expiration:L.optional(L.string().describe("Expiration")),legs:L.array(YA),providers:L.array(L.enum(J)),routeId:L.string().describe("Route ID"),totalSlippageBps:L.number().describe("Total slippage in bps"),warnings:pA}).omit({provider:!0}),CH=L.object({method:L.string(),payload:L.optional(L.unknown()),url:L.string()}),hH=CA.extend({meta:KA,nextActions:L.optional(L.array(CH))}),TR=L.object({error:L.optional(L.string().describe("Error message")),providerErrors:L.optional(L.array(L.object({errorCode:L.optional(L.enum(LN)),message:L.optional(L.string()),provider:L.enum(J).optional()}))),quoteId:L.string().describe("Quote ID"),routes:L.array(hH)}),HR=L.object({providers:L.array(L.enum(J)).optional().describe("Optional list of providers to query for trading pairs"),sellAsset:L.string().describe("Asset identifier to sell (e.g., 'BTC.BTC' or 'ETH.ETH')")}),dH=L.object({chain:L.enum(EN).describe("Chain the asset is on"),identifier:L.string().describe("Asset identifier (e.g., 'ETH.USDC-0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48')"),providers:L.array(L.enum(J)).describe("Providers that support this trading pair"),symbol:L.string().describe("Asset symbol"),ticker:L.string().describe("Asset ticker")}),PR=L.object({buyAssets:L.array(dH).describe("List of assets that can be swapped to"),sellAsset:L.string().describe("The input sell asset identifier")}),hA=CA.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:mA,sourceAddress:L.string().describe("Source address"),targetAddress:L.optional(L.string().describe("Target address")),tx:B(KN([jA,qA,vA,kA,R()])),txType:L.optional(L.enum(wN))}),cH=L.object({data:L.optional(L.record(L.string(),L.string().optional())),errorCode:L.enum(LN),message:L.string().optional(),provider:L.enum(J).optional()}),LR=L.object({error:L.optional(L.string().describe("Error message")),providerErrors:L.optional(L.array(cH)),quoteId:L.string().describe("Quote ID"),routes:L.array(hA)}),dA=hA.extend({approvalTx:fH.optional().describe("Optional approval transaction if ERC-20 approval is required before swap"),swapId:L.string().describe("The unique swap ID for tracking")});var W=G.extend({dynamicHeader:async()=>{let N=w.get("widgetKey");if(N&&typeof window<"u"){let T=Math.floor(Date.now()/1000),H=window.location.origin;return{"X-Signature":await tA(N,H,T),"X-Timestamp":T.toString()}}let{swapKit:A}=w.get("apiKeys");return A?{"x-api-key":A}:{}}});async function iH(N){let A=await W.post(V("/track"),{json:N});try{let T=WA.safeParse(A);if(!T.success)throw new t("api_v2_invalid_response",T.error);return T.data}catch(T){return A}}async function sH(N){let{getQuote:A}=w.get("endpoints");if(A)return A(N);let H=w.get("v3SwapFlow")?.enabled?"/v3/quote":"/quote",P=await W.post(V(H),{json:N});if(P.error)throw new t("api_v2_server_error",{message:P.error});try{let I=yA.safeParse(P);if(!I.success)throw new t("api_v2_invalid_response",I.error);return I.data}catch{return P}}async function eH(N){let{getRouteWithTx:A}=w.get("endpoints");if(A)return A(N);let H=w.get("v3SwapFlow")?.enabled?"/v3/swap":"/swap",P=await W.post(V(H),{json:N});try{let I=dA.safeParse(P);if(!I.success)throw new t("api_v2_invalid_response",I.error);return I.data}catch(I){return console.error(new t("api_v2_invalid_response",I)),P}}async function aH({chain:N,address:A,scamFilter:T=!0}){let{getBalance:H}=w.get("endpoints");if(H)return H({address:A,chain:N});let P=V(`/balance?chain=${N}&address=${A}`),I=await W.get(P),F=Array.isArray(I)?I:[];return T?IP(F):F}function NP(N){let A=rH(N).with({routeId:BN.string,spender:BN.string},({routeId:T,spender:H})=>V(`/approve?routeId=${T}&sourceAddress=${H}`)).with({assetValue:BN.instanceOf(v),spender:BN.string,userWallet:BN.string},({spender:T,userWallet:H,assetValue:P})=>V(`/approve?tokenIdentifier=${P.toString()}&userWalletAddress=${H}&spender=${T}&amount=${P.getValue("string")}`)).exhaustive();return W.get(A)}function AP(){let N=V("/providers");return W.get(N)}function TP(N){let A=V(`/tokens?provider=${N}`);return W.get(A)}async function HP(N){let A=V("/price"),T=await W.post(A,{json:N});try{let H=zA.safeParse(T);if(!H.success)throw new t("api_v2_invalid_response",H.error);return H.data}catch(H){throw new t("api_v2_invalid_response",H)}}async function PP(){let N=V("/gas"),A=await W.get(N);try{let T=fA.safeParse(A);if(!T.success)throw new t("api_v2_invalid_response",T.error);return Array.isArray(T)?T:[T]}catch(T){throw new t("api_v2_invalid_response",T)}}async function LP(N){let{destinationAddress:A}=N;if(!A)throw new t("chainflip_broker_invalid_params");let T=w.get("integrations").chainflip?.brokerUrl||V("/chainflip/broker/channel"),H=await W.post(T,{json:N});try{let P=ZA.safeParse(H);if(!P.success)throw new t("api_v2_invalid_response",P.error);return P.data}catch(P){throw new t("api_v2_invalid_response",P)}}async function RP(N){let{destinationAddress:A}=N;if(!A)throw new t("chainflip_broker_invalid_params");let T=V("/near/channel"),H=await W.post(T,{json:N});try{let P=VA.safeParse(H);if(!P.success)throw new t("api_v2_invalid_response",P.error);return P.data}catch(P){throw new t("api_v2_invalid_response",P)}}function V(N){let{isDev:A,apiUrl:T,devApiUrl:H}=w.get("envs");return`${A?H:T}${N}`}function uP(N){let[A,T]=N.split(".");if(!lH.includes(A))return!0;let H=T.split("-"),P=H.length===1?void 0:H[H.length-1];return tN({chain:A,symbol:T})||!!P}var FP=new RegExp(/(.)\1{6}|\.ORG|\.NET|\.FINANCE|\.COM|WWW|HTTP|\\\\|\/\/|[\s$%:[\]]/,"gmi");function IP(N){return N.filter((A)=>{return!FP.test(A.identifier)&&uP(A.identifier)})}async function nP(N){let{getSwapTo:A}=w.get("endpoints");if(A)return A(N);let T=new URLSearchParams({sellAsset:N.sellAsset});if(N.providers?.length)for(let F of N.providers)T.append("providers",F);let H=V(`/swapTo?${T.toString()}`),P=await W.get(H);if(!Array.isArray(P))return{buyAssets:[],sellAsset:N.sellAsset};let I=[];for(let F of P)try{let O=v.from({asset:F});I.push({chain:O.chain,identifier:O.toString(),providers:[],symbol:O.symbol,ticker:O.ticker})}catch{}return{buyAssets:I,sellAsset:N.sellAsset}}var oN={};dN(oN,{getThorchainQueue:()=>GP,getTcyStakers:()=>SP,getTcyStaker:()=>UP,getTcyClaimers:()=>EP,getTcyClaimer:()=>XP,getTNSPreferredAsset:()=>_P,getTHORNodeTNSDetails:()=>cA,getRunePoolProviderInfo:()=>YP,getRunePoolInfo:()=>DP,getNodes:()=>gP,getMimirInfo:()=>MP,getLastBlock:()=>$P,getInboundAddresses:()=>tP});import{match as BP}from"ts-pattern";function q(N){let{isStagenet:A}=w.get("envs"),T=w.get("thornodeUrls");return`${BP({isStagenet:A,type:N}).with({type:"mayachain"},({isStagenet:P})=>P?T.MAYA_STAGENET:T.MAYA).with({type:"thorchain"},({isStagenet:P})=>P?T.THOR_STAGENET:T.THOR)}/${N}`}function OP(N){let A=N==="mayachain"?"mayaname":"thorname";return`${q(N)}/${A}`}function $P(N="thorchain"){return G.get(`${q(N)}/lastblock`)}function GP(N){return G.get(`${q(N)}/queue`)}function gP(N){return G.get(`${q(N)}/nodes`)}function MP(N){return G.get(`${q(N)}/mimir`)}function tP(N){return G.get(`${q(N)}/inbound_addresses`)}async function cA({type:N,name:A}){try{return await G.get(`${OP(N)}/${A}`)}catch{return{affiliate_collector_rune:"",aliases:[],expire_block_height:0,name:A,owner:"",preferred_asset:""}}}async function _P({type:N,tns:A}){let T=await cA({name:A,type:N});if(!T.preferred_asset||T.preferred_asset===".")return;return v.from({asset:T.preferred_asset,asyncTokenLookup:!0})}function DP(N){return G.get(`${q(N)}/runepool`)}function YP({type:N,thorAddress:A}){return G.get(`${q(N)}/rune_provider/${A}`)}function UP({type:N,address:A}){return G.get(`${q(N)}/tcy_staker/${A}`)}function SP(N){return G.get(`${q(N)}/tcy_stakers`)}function XP({type:N,address:A}){return G.get(`${q(N)}/tcy_claimer/${A}`)}function EP(N){return G.get(`${q(N)}/tcy_claimers`)}var UR={...yN,mayachainMidgard:MA,thorchainMidgard:gA,thornode:oN};
4
+ or by passing asyncTokenLookup: true to the from() function, which will make it async and return a promise.`});let{decimal:TN,identifier:S,tax:ON}=x||{decimal:b||k,identifier:g},$N=A?e(BigInt(P),A):e(P,TN);return _||j?oT(S,$N):vN({decimal:TN,identifier:S,tax:ON,value:$N})}static async loadStaticAssets(N){let{loadTokenLists:A}=await import("@swapkit/tokens"),T=await A(N);for(let{tokens:H}of Object.values(T))for(let P of H){let{identifier:I}=P,{chain:F,symbol:O}=f(I),{address:g}=uN(O,F),{baseDecimal:Y}=IN(F),Q=y.includes(F)?I:I.toUpperCase(),_="decimals"in P&&P.decimals!==void 0?P.decimals:Y,j="logoURI"in P&&P.logoURI?P.logoURI:`https://storage.googleapis.com/token-list-swapkit-dev/images/${I.toLowerCase()}.png`,U={decimal:_,identifier:I,logoURI:j,tax:"tax"in P?P.tax:void 0};if(i.set(Q,U),g){let k=y.includes(F)?`${F}:${g}`:`${F}:${g.toUpperCase()}`;UN.set(k,I)}}return!0}static setStaticAssets(N){i.clear(),UN.clear();for(let[A,T]of N.entries()){let{identifier:H}=T,{chain:P,symbol:I}=f(H),{address:F}=uN(I,P),{baseDecimal:O}=IN(P),g=T.chain??P,Y=T.address??F,Q=y.includes(g)?H:H.toUpperCase(),_=T.decimals??T.decimal??O,j=T.logoURI??`https://storage.googleapis.com/token-list-swapkit-dev/images/${H.toLowerCase()}.png`,U={decimal:_,identifier:Q,logoURI:j,tax:T.tax};if(i.set(Q,U),Y){let k=y.includes(g)?`${g}:${Y}`:`${g}:${Y.toUpperCase()}`;UN.set(k,H)}}return!0}static get staticAssets(){return i}}function bL(N){let A=v.from({chain:N});return qN(N).with(E.Bitcoin,E.Litecoin,E.BitcoinCash,E.Dash,()=>A.set(0.00010001)).with(E.Dogecoin,()=>A.set(1.00000001)).with(E.Avalanche,E.Ethereum,E.Arbitrum,E.BinanceSmartChain,()=>A.set(0.00000001)).with(E.THORChain,E.Maya,()=>A.set(0)).with(E.Cosmos,E.Kujira,()=>A.set(0.000001)).otherwise(()=>A.set(0.00000001))}async function BA({chain:N,address:A,ticker:T}){let P=y.includes(N)?`${N}:${A||T}`:`${N}:${A||T}`.toUpperCase(),I=pT(P);if(I)return I;if(!A){let{baseDecimal:g}=IN(N);return{decimals:g,identifier:`${N}.${T||"UNKNOWN"}`}}let F=await LA({address:A,chain:N}),O=`${N}.${F.ticker||T||"UNKNOWN"}-${A}`;return c({condition:!!(!F.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 (${F.decimals}).`}),F.ticker&&yT(P,{decimals:F.decimals,identifier:O}),{decimals:F.decimals,identifier:O}}function vN({identifier:N,decimal:A,value:T,tax:H}){return uA(N),new v({decimal:A,identifier:N,tax:H,value:e(T,A)})}function oT(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("~")?"~":"/",[I,F]=H?N.split(".").slice(1).join().split(P):N.split(P);if(!(I&&F))throw new t({errorKey:"helpers_invalid_asset_identifier",info:{identifier:N}});return new v({decimal:8,identifier:`${T||E.THORChain}.${I}${P}${F}`,value:e(A,8)})}async function fT({address:N,chain:A,fromBaseDecimal:T,parsedValue:H}){let{decimals:P,identifier:I}=await BA({address:N,chain:A}),F=T?e(BigInt(H),T):H;return vN({decimal:P,identifier:I,value:F})}function e(N,A){return typeof N==="bigint"?h({bigIntDecimal:A,decimal:A,value:N}):N}function CT(N){let A=qN(N).when((T)=>("chain"in T)&&T.chain!==void 0,({chain:T})=>T).otherwise((T)=>{let H=f(T.asset);return H.synth?E.THORChain:H.chain});if(!kT.includes(A.toUpperCase())){let T="asset"in N?N.asset:A;throw new t({errorKey:"helpers_invalid_asset_identifier",info:{identifier:T,message:`Unsupported chain "${A}" - use the AssetValue constructor directly`}})}}function hT(N){if(CT(N),"chain"in N){let{chain:P,address:I}=N;if(I){let F=y.includes(P)?`${P}:${I}`:`${P}:${I.toUpperCase()}`,O=UN.get(F);if(O)return O;return null}return P}let{chain:A,symbol:T}=f(N.asset);return WN({chain:A,symbol:T})==="Native"?A:N.asset}function dT(N,A,T){let H=N.split("."),P=H[0]?.toUpperCase(),I=kN.includes(P),F=T?"~":"/",[O,g=""]=I?H.slice(1).join(".").split(F):N.split(F);if(!(O&&g))throw new t({errorKey:"helpers_invalid_asset_identifier",info:{identifier:N}});let{ticker:Y,address:Q}=OA({chain:O,symbol:g}),_=`${O}${F}${g}`;return{address:Q,chain:P,isGasAsset:!1,isSynthetic:A,isTradeAsset:T,symbol:_,ticker:Y}}function cT(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:I}=OA({chain:T,symbol:H}),F;try{F=P&&KT.includes(T)&&IA(P)?IA(P):P}catch{F=P}let O=F?`${I}-${F}`:H;return{address:F,chain:T,isGasAsset:tN({chain:T,symbol:H}),isSynthetic:!1,isTradeAsset:!1,symbol:O,ticker:I}}function nA(N){let A=N.slice(0,14),T=A.includes("/"),H=A.includes("~");if(T||H)return dT(N,T,H);return cT(N)}function OA({symbol:N,chain:A}){let{ticker:T,address:H}=uN(N,A);return{address:H&&!y.includes(A)?H.toLowerCase():H,ticker:T}}class SN extends p{eq(N){return this.eqValue(N)}static fromBigInt(N,A){return new SN({decimal:A,value:h({bigIntDecimal:A,decimal:A,value:N})})}}function $A(N=!0){return N?"https://midgard.thorchain.network":"https://midgard.mayachain.info"}function rT(N=!0){let A=$A(N);return N?`${A}/v2/thorname`:`${A}/v2/mayaname`}function iT(N){return function(T){let H=T?`?status=${T}`:"";return G.get(`${N}/v2/pools${H}`)}}function sT(N){return function(T){return G.get(`${N}/v2/pool/${T}`)}}function eT(N){return function(T,H){let P=H?`?period=${H}`:"";return G.get(`${N}/v2/pool/${T}/stats${P}`)}}function aT(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 I=P.toString()?`?${P.toString()}`:"";return G.get(`${N}/v2/history/depths/${T}${I}`)}}function NH(N){return function(){return G.get(`${N}/v2/network`)}}function AH(N){return function(){return G.get(`${N}/v2/health`)}}function TH(N){return function(){return G.get(`${N}/v2/nodes`)}}function HH(N){return function(T){return G.get(`${N}/v2/node/${T}`)}}function PH(N){return function(){return G.get(`${N}/v2/mimir/votes`)}}function LH(N){return function(){return G.get(`${N}/v2/mimir`)}}function RH(N){return function(){return G.get(`${N}/v2/constants`)}}function uH(N){return function(){return G.get(`${N}/v2/stats`)}}function FH(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 G.get(`${N}/v2/history/earnings${P}`)}}function IH(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 I=P.toString()?`?${P.toString()}`:"",F=T?`/swaps/${T}`:"/swaps";return G.get(`${N}/v2/history${F}${I}`)}}function nH(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 G.get(`${N}/v2/history/tvl${P}`)}}function BH(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 OH(N){return function(T){let H=BH(T);return G.get(`${N}/v2/actions${H}`)}}function $H(N){return function(T){return G.get(`${N}/v2/member/${T}`)}}function GH(N){return function(T){let H=T?`/${T}`:"";return G.get(`${N}/v2/members${H}`)}}function gH(N){return function(T,H){let P=H?`&asset=${H}`:"";return G.get(`${N}/v2/saver/${T}${P?`?${P.substring(1)}`:""}`)}}function MH(N){return function(T){return G.get(`${N}/v2/savers/${T}`)}}function tH(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 I=P.toString()?`?${P.toString()}`:"",F=T?`/savers/${T}`:"/savers";return G.get(`${N}/v2/history${F}${I}`)}}function _H(N){return function(T){return G.get(`${N}/v2/balance/${T}`)}}function DH(N){return async function(T){let H=(P)=>{if(P?.cause?.status===404)return;throw P};return await G.get(`${N}/lookup/${T}`,{onError:H,retry:{maxRetries:1}})}}function YH(N){return async function(T){let H=(P)=>{if(P?.cause?.status===404)return[];throw P};return await G.get(`${N}/rlookup/${T}`,{onError:H,retry:{maxRetries:1}})}}function UH(N){return async function(T){let H=(P)=>{if(P?.cause?.status===404)return[];throw P};return await G.get(`${N}/owner/${T}`,{onError:H,retry:{maxRetries:1}})}}function a({asset:N,value:A}){return v.from({asset:N,fromBaseDecimal:lT(XN.THORChain).baseDecimal,value:A})}function SH({liquidityPositionGetter:N,isThorchain:A}){return async function(H){let P=await N(H),I=A?"rune":"cacao";return P.pools.map((F)=>({[`${I}Pending`]:a({asset:"THOR.RUNE",value:F.runePending}),[`${I}RegisteredAddress`]:F.runeAddress,[`${I}Withdrawn`]:a({asset:"THOR.RUNE",value:F.runeWithdrawn}),[I]:a({asset:"THOR.RUNE",value:F.runeAdded}),asset:a({asset:F.pool,value:F.assetAdded}),assetPending:a({asset:F.pool,value:F.assetPending}),assetRegisteredAddress:F.assetAddress,assetWithdrawn:a({asset:F.pool,value:F.assetWithdrawn}),dateFirstAdded:F.dateFirstAdded,dateLastAdded:F.dateLastAdded,poolShare:new SN(F.liquidityUnits).div(F.pool)}))}}function GA(N){let A=N===XN.THORChain,T=$A(A),H=rT(A),P=$H(T);return{getActions:OH(T),getBalance:_H(T),getConstants:RH(T),getEarningsHistory:FH(T),getHealth:AH(T),getLiquidityPosition:SH({isThorchain:A,liquidityPositionGetter:P}),getLiquidityPositionRaw:P,getMembers:GH(T),getMimir:LH(T),getMimirVotes:PH(T),getNameDetails:DH(H),getNamesByAddress:YH(H),getNamesByOwner:UH(H),getNetworkInfo:NH(T),getNode:HH(T),getNodes:TH(T),getPool:sT(T),getPoolDepthHistory:aT(T),getPoolStats:eT(T),getPools:iT(T),getSaverDetails:gH(T),getSavers:MH(T),getSaversHistory:tH(T),getStats:uH(T),getSwapHistory:IH(T),getTVLHistory:nH(T)}}var gA=GA(XN.THORChain),MA=GA(XN.Maya);var yN={};dN(yN,{getTrackerDetails:()=>iH,getTokenListProviders:()=>AP,getTokenList:()=>TP,getTokenApproval:()=>NP,getSwapTo:()=>nP,getSwapQuote:()=>sH,getRouteWithTx:()=>eH,getPrice:()=>HP,getNearDepositChannel:()=>RP,getGasRate:()=>PP,getChainflipDepositChannel:()=>LP,getChainBalance:()=>aH,SKRequestClient:()=>W});import{EVMChains as lH}from"@swapkit/types";import{match as rH,P as BN}from"ts-pattern";async function tA(N,A,T){let H=`${A}:${T}`,P=new TextEncoder,I=await crypto.subtle.importKey("raw",P.encode(N),{hash:"SHA-256",name:"HMAC"},!1,["sign"]),F=await crypto.subtle.sign("HMAC",I,P.encode(H));return Array.from(new Uint8Array(F)).map((O)=>O.toString(16).padStart(2,"0")).join("")}import{Chain as EN,ChainId as nN}from"@swapkit/types";import{array as X,boolean as K,coerce as UA,number as M,object as $,optional as B,string as R,union as KN,unknown as SA,z as L}from"zod/v4";var XA;((H)=>{H.CHEAPEST="CHEAPEST";H.FASTEST="FASTEST";H.RECOMMENDED="RECOMMENDED"})(XA||={});var wN;((P)=>{P.PSBT="PSBT";P.EVM="EVM";P.COSMOS="COSMOS";P.RADIX="RADIX"})(wN||={});var EA;((b)=>{b.approve="approve";b.claim="claim";b.deposit="deposit";b.donate="donate";b.lending="lending";b.lp_action="lp_action";b.native_contract_call="native_contract_call";b.native_send="native_send";b.stake="stake";b.streaming_swap="streaming_swap";b.swap="swap";b.thorname_action="thorname_action";b.token_contract_call="token_contract_call";b.token_transfer="token_transfer";b.unknown="unknown";b.unstake="unstake"})(EA||={});var wA;((U)=>{U.swap="swap";U.aggregation="aggregation";U.addLiquidity="addLiquidity";U.withdrawLiquidity="withdrawLiquidity";U.addSavers="addSavers";U.withdrawSavers="withdrawSavers";U.borrow="borrow";U.repay="repay";U.name="name";U.donate="donate";U.claim="claim";U.stake="stake";U.unstake="unstake"})(wA||={});var QA;((O)=>{O.unknown="unknown";O.not_started="not_started";O.pending="pending";O.swapping="swapping";O.completed="completed";O.refunded="refunded";O.failed="failed"})(QA||={});var xA;((x)=>{x.not_started="not_started";x.starting="starting";x.broadcasted="broadcasted";x.mempool="mempool";x.inbound="inbound";x.outbound="outbound";x.swapping="swapping";x.completed="completed";x.refunded="refunded";x.partially_refunded="partially_refunded";x.dropped="dropped";x.reverted="reverted";x.replaced="replaced";x.retries_exceeded="retries_exceeded";x.parsing_error="parsing_error"})(xA||={});var yL=$({address:B(R()),chain:L.enum(EN).optional(),chainId:L.enum(nN),coingeckoId:B(R()),decimals:UA.number(),extensions:B(L.looseObject({})),identifier:R(),logoURI:B(R()),name:B(R()),shortCode:B(R()),symbol:B(R()),ticker:R()}),oL=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"}),fL=L.object({forceUpdate:L.string().toLowerCase().transform((N)=>N==="true").pipe(L.boolean()).optional()}),CL=$({error:R(),message:R()}),NN=$({address:B(R()),chain:L.enum(EN),decimal:B(M()),isGasAsset:K(),isSynthetic:K(),symbol:R(),tax:B($({buy:M(),sell:M()})),ticker:R()}),bA=$({id:R(),market_cap:M(),name:R(),price_change_24h_usd:M(),price_change_percentage_24h_usd:M(),sparkline_in_7d:X(M()),timestamp:R(),total_volume:M()}).partial(),hL=$({cg:B(bA),identifier:R(),price_usd:M(),provider:R(),timestamp:M()}),zA=X($({cg:B(bA),identifier:R(),price_usd:M(),provider:R(),timestamp:M()}).partial()),dL=$({affiliate:B(R().describe("Affiliate thorname")),affiliateFee:B(M().describe("Affiliate fee in basis points").refine((N)=>N===Math.floor(N)&&N>=0,{message:"affiliateFee must be a positive integer",path:["affiliateFee"]})),allowSmartContractReceiver:B(K().describe("Allow smart contract as recipient")),allowSmartContractSender:B(K().describe("Allow smart contract as sender")),buyAsset:R().describe("Asset to buy"),cfBoost:B(K().describe("Set to true to enable CF boost to speed up Chainflip swaps. BTC only.")),destinationAddress:B(R().describe("Address to send asset to")),disableSecurityChecks:B(K().describe("Disable security checks")),includeTx:B(K().describe("Set to true to include an transaction object (EVM only)")),providers:B(X(R().describe("List of providers to use").refine((N)=>J[N]!==void 0,{message:"Invalid provider",path:["providers"]}))),referrer:B(R().describe("Referrer address (referral program)")),sellAmount:R().describe("Amount of asset to sell").refine((N)=>+N>0,{message:"sellAmount must be greater than 0",path:["sellAmount"]}),sellAsset:R().describe("Asset to sell"),slippage:B(M().describe("Slippage tolerance as a percentage. Default is 3%.")),sourceAddress:B(R().describe("Address to send asset from"))}).refine((N)=>N.sellAsset!==N.buyAsset,{message:"Must be different",path:["sellAsset","buyAsset"]}),cL=$({metadata:K(),tokens:X($({identifier:R()}))}),JA=$({destinationAddress:R()}),XH=JA.extend({affiliateFees:X($({brokerAddress:R(),feeBps:M()})).optional(),brokerCommissionBps:M().optional(),buyAsset:$({asset:R(),chain:R()}),channelMetadata:$({cfParameters:R().optional(),gasBudget:R().optional(),message:R().optional()}).optional(),dcaParameters:$({chunkInterval:M().optional(),numberOfChunks:M().optional()}).optional(),maxBoostFeeBps:M().optional(),refundParameters:$({minPrice:R().optional(),refundAddress:R().optional(),retryDuration:M().optional()}).optional(),sellAsset:$({asset:R(),chain:R()})}),ZA=$({channelId:R(),depositAddress:R()}),_A=JA.extend({affiliateFees:$({feeBps:M(),nearId:R()}).optional(),buyAsset:R(),sellAmount:R(),sellAsset:R(),slippage:UA.number(),sourceAddress:R()}),DA=$({amountIn:R(),amountInFormatted:R(),amountInUsd:R(),amountOut:R(),amountOutFormatted:R(),amountOutUsd:R(),deadline:R().optional(),minAmountIn:R(),minAmountOut:R(),timeEstimate:M().optional(),timeWhenInactive:R().optional()}),lL=DA.extend({depositAddress:R(),quote:DA,signature:R(),timestamp:R(),tx:SA()}),VA=$({buyAsset:R(),buyAssetAmount:R(),buyAssetAmountMaxSlippage:R(),deadline:R().optional(),depositAddress:R(),depositAmount:R(),depositAsset:R(),tx:SA()}),EH=$({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())}),wH=$({currentStage:R(),inboundConfirmation:M(),inboundObservation:M(),outboundDelay:M(),outboundObservation:M(),streamingSwap:M()}),QH=$({count:B(M()),interval:B(M()),quantity:B(M()),subSwapsMap:B(X(M()))}),xH=L.object({currentLegIndex:L.optional(L.number()),estimatedTimeToComplete:L.number(),estimates:L.optional(wH),providerDetails:L.optional(L.object({streamingDetails:L.optional(QH)}))}),bH=$({affiliate:B(NN),liquidity:B(NN),network:B(NN),protocol:B(NN),tax:B(NN)}),zH=$({affiliate:R(),bps:R(),isReferrer:K()}),JH=$({affiliate:B(R()),affiliateFees:B(X(zH)),broadcastedAt:B(M()),explorerUrl:B(R()),fees:B(bH),images:B($({chain:B(R()),from:B(R()),provider:B(R()),to:B(R())})),provider:B(L.enum(J)),providerAction:L.optional(L.enum(wA)),quoteId:B(R()),wallet:B(R())}),AN=L.object({block:L.number(),chainId:L.enum(nN),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(JH),payload:L.optional(EH),status:L.enum(QA),toAddress:L.string(),toAmount:L.string(),toAsset:L.string(),trackingStatus:L.optional(L.enum(xA)),transient:L.optional(xH),type:L.enum(EA)}),WA=AN.extend({legs:L.array(AN)}),rL=AN.extend({legs:X(AN)}),iL=AN.extend({legs:X(AN)}),mN=X($({amount:R(),asset:R(),chain:R(),protocol:L.enum(J),type:L.enum(bN)})),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")}),jA=$({data:R().describe("Data to send"),from:R().describe("Address of the sender"),to:R().describe("Address of the recipient"),value:R().describe("Value to send")}),vA=L.object({raw_data:L.object({contract:L.any(),data:L.string().optional(),expiration:L.number(),fee_limit:L.number().optional(),ref_block_bytes:L.string(),ref_block_hash:L.string(),timestamp:L.number()}).passthrough(),raw_data_hex:L.string(),txID:L.string(),visible:L.boolean()}),ZH=X(KN([R(),M(),X(R()),$({from:R(),value:R()}).describe("Parameters to pass to the contract method")])),sL=$({approvalSpender:B(R().describe("Address of the spender to approve")),approvalToken:B(R().describe("Address of the token to approve spending of")),contractAddress:R().describe("Address of the contract to interact with"),contractMethod:R().describe("Name of the method to call"),contractParamNames:X(R().describe("Names of the parameters to pass to the contract method")),contractParams:ZH}),VH=$({typeUrl:R("/types.MsgDeposit"),value:$({coins:X($({amount:R(),asset:$({chain:R(),symbol:R(),synth:K(),ticker:R()})})),memo:R(),signer:R()})}),WH=$({typeUrl:R("/types.MsgSend"),value:$({amount:X($({amount:R(),denom:R()})),fromAddress:R(),toAddress:R()})}),jH=$({typeUrl:R(),value:WH.shape.value.or(VH.shape.value)}),vH=$({amount:X($({amount:R(),denom:R()})),gas:R()}),qA=$({accountNumber:M(),chainId:L.enum(nN),fee:vH,memo:R(),msgs:X(jH),sequence:M()}),qH=L.array(L.object({calldata:L.array(L.string()),contractAddress:L.string(),entrypoint:L.string()})),kA=L.array(L.object({address:L.string().describe("Destination address in friendly format"),amount:L.string().describe("Amount in nanotons"),payload:L.string().optional().describe("Base64 BOC of body cell"),stateInit:L.string().optional().describe("Base64 BOC of state init")})),kH=$({affiliate:R().describe("Affiliate address").optional(),affiliateFee:M().describe("Affiliate fee").optional(),buyAsset:R().describe("Asset to buy"),destinationAddress:R().describe("Destination address"),estimatedTime:pN.optional(),provider:L.enum(J),sellAsset:R().describe("Asset to sell"),slipPercentage:M().describe("Slippage as a percentage"),sourceAddress:R().describe("Source address")}),eL=kH.omit({destinationAddress:!0,slipPercentage:!0,sourceAddress:!0}),KH=$({asset:R().describe("Asset name"),image:R().describe("Asset image"),price:M().describe("Price in USD")}),mH=XH,KA=$({assets:B(X(KH)),maxStreamingQuantity:M().optional(),referrer:R().optional(),streamingInterval:M().optional(),tags:X(L.enum(XA))}),mA=KA.extend({affiliate:B(R()),affiliateFee:B(R()),approvalAddress:B(R().describe("Approval address for swap")),chainflip:mH.optional(),garden:_A.optional(),near:_A.optional(),priceImpact:B(M().describe("Price impact")),referrer:B(R()),txType:B(L.enum(wN))}),pA=X($({code:L.enum(xN),display:R(),tooltip:R().optional()})),pH=$({buyAmount:R().describe("Buy amount"),buyAmountMaxSlippage:R().describe("Buy amount max slippage"),buyAsset:R().describe("Asset to buy"),fees:B(mN),provider:L.enum(J),sellAmount:R().describe("Sell amount"),sellAsset:R().describe("Asset to sell")}),yH=$({buyAsset:R().describe("Asset to buy"),destinationAddress:B(R().describe("Destination address")),estimatedTime:B(pN),expectedBuyAmount:R().describe("Expected Buy amount"),expectedBuyAmountMaxSlippage:R().describe("Expected Buy amount max slippage"),expiration:B(R().describe("Expiration")),fees:mN,inboundAddress:B(R().describe("Inbound address")),legs:X(pH),memo:B(R().describe("Memo")),meta:mA,providers:X(L.enum(J)),routeId:R().describe("Route ID"),sellAmount:R().describe("Sell amount"),sellAsset:R().describe("Asset to sell"),sourceAddress:B(R().describe("Source address")),targetAddress:B(R().describe("Target address")),totalSlippageBps:M().describe("Total slippage in bps"),tx:B(KN([jA,qA,vA,qH,kA,R()])),txType:B(L.enum(wN)),warnings:pA}),yA=$({error:B(R().describe("Error message")),providerErrors:B(X($({errorCode:B(L.enum(LN)),message:B(R()),provider:L.enum(J).optional()}))),quoteId:R().describe("Quote ID"),routes:X(yH)}),oA=L.object({chainId:L.enum(nN),createdAt:L.date(),id:L.number(),unit:L.string(),value:L.string()}),oH=L.array(oA),fA=L.union([oA,oH]),aL=X($({chain:L.enum(EN),decimal:M(),identifier:R(),symbol:R(),ticker:R(),value:R()})),NR=L.union([L.object({amount:L.string(),spender:L.string(),tokenIdentifier:L.string(),userWalletAddress:L.string()}),L.object({amount:L.string(),chainId:L.enum(nN),spender:L.string(),tokenContractAddress:L.string(),userWalletAddress:L.string()}),L.object({routeId:L.string()})]),AR=L.object({approvalTransaction:L.optional(L.object({data:L.string(),from:L.string(),gasLimit:L.optional(L.string()),gasPrice:L.optional(L.string()),to:L.string(),value:L.string()})),approvedAmount:L.string(),isApproved:L.boolean()}),fH=L.object({data:L.string().describe("Encoded approval call data"),from:L.string().describe("User wallet address"),gasLimit:L.string().optional().describe("Estimated gas limit"),gasPrice:L.string().optional().describe("Current gas price"),to:L.string().describe("Token contract address"),value:L.string().describe("ETH value (always '0' for approvals)")}),YA=L.object({buyAmount:L.string().describe("Buy amount"),buyAmountMaxSlippage:L.string().describe("Buy amount max slippage"),buyAsset:L.string().describe("Asset to buy"),expectedBuyAmount:L.string().describe("Expected Buy amount"),expectedBuyAmountMaxSlippage:L.string().describe("Expected Buy amount max slippage"),fees:mN,provider:L.enum(J),sellAmount:L.string().describe("Sell amount"),sellAsset:L.string().describe("Asset to sell")}),CA=YA.extend({estimatedTime:L.optional(pN),expiration:L.optional(L.string().describe("Expiration")),legs:L.array(YA),providers:L.array(L.enum(J)),routeId:L.string().describe("Route ID"),totalSlippageBps:L.number().describe("Total slippage in bps"),warnings:pA}).omit({provider:!0}),CH=L.object({method:L.string(),payload:L.optional(L.unknown()),url:L.string()}),hH=CA.extend({meta:KA,nextActions:L.optional(L.array(CH))}),TR=L.object({error:L.optional(L.string().describe("Error message")),providerErrors:L.optional(L.array(L.object({errorCode:L.optional(L.enum(LN)),message:L.optional(L.string()),provider:L.enum(J).optional()}))),quoteId:L.string().describe("Quote ID"),routes:L.array(hH)}),HR=L.object({providers:L.array(L.enum(J)).optional().describe("Optional list of providers to query for trading pairs"),sellAsset:L.string().describe("Asset identifier to sell (e.g., 'BTC.BTC' or 'ETH.ETH')")}),dH=L.object({chain:L.enum(EN).describe("Chain the asset is on"),identifier:L.string().describe("Asset identifier (e.g., 'ETH.USDC-0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48')"),providers:L.array(L.enum(J)).describe("Providers that support this trading pair"),symbol:L.string().describe("Asset symbol"),ticker:L.string().describe("Asset ticker")}),PR=L.object({buyAssets:L.array(dH).describe("List of assets that can be swapped to"),sellAsset:L.string().describe("The input sell asset identifier")}),hA=CA.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:mA,sourceAddress:L.string().describe("Source address"),targetAddress:L.optional(L.string().describe("Target address")),tx:B(KN([jA,qA,vA,kA,R()])),txType:L.optional(L.enum(wN))}),cH=L.object({data:L.optional(L.record(L.string(),L.string().optional())),errorCode:L.enum(LN),message:L.string().optional(),provider:L.enum(J).optional()}),LR=L.object({error:L.optional(L.string().describe("Error message")),providerErrors:L.optional(L.array(cH)),quoteId:L.string().describe("Quote ID"),routes:L.array(hA)}),dA=hA.extend({approvalTx:fH.optional().describe("Optional approval transaction if ERC-20 approval is required before swap"),swapId:L.string().describe("The unique swap ID for tracking")});var W=G.extend({dynamicHeader:async()=>{let N=w.get("widgetKey");if(N&&typeof window<"u"){let T=Math.floor(Date.now()/1000),H=window.location.origin;return{"X-Signature":await tA(N,H,T),"X-Timestamp":T.toString()}}let{swapKit:A}=w.get("apiKeys");return A?{"x-api-key":A}:{}}});async function iH(N){let A=await W.post(V("/track"),{json:N});try{let T=WA.safeParse(A);if(!T.success)throw new t("api_v2_invalid_response",T.error);return T.data}catch(T){return A}}async function sH(N){let{getQuote:A}=w.get("endpoints");if(A)return A(N);let H=w.get("v3SwapFlow")?.enabled?"/v3/quote":"/quote",P=await W.post(V(H),{json:N});if(P.error)throw new t("api_v2_server_error",{message:P.error});try{let I=yA.safeParse(P);if(!I.success)throw new t("api_v2_invalid_response",I.error);return I.data}catch{return P}}async function eH(N){let{getRouteWithTx:A}=w.get("endpoints");if(A)return A(N);let H=w.get("v3SwapFlow")?.enabled?"/v3/swap":"/swap",P=await W.post(V(H),{json:N});try{let I=dA.safeParse(P);if(!I.success)throw new t("api_v2_invalid_response",I.error);return I.data}catch(I){return console.error(new t("api_v2_invalid_response",I)),P}}async function aH({chain:N,address:A,scamFilter:T=!0}){let{getBalance:H}=w.get("endpoints");if(H)return H({address:A,chain:N});let P=V(`/balance?chain=${N}&address=${A}`),I=await W.get(P),F=Array.isArray(I)?I:[];return T?IP(F):F}function NP(N){let A=rH(N).with({routeId:BN.string,spender:BN.string},({routeId:T,spender:H})=>V(`/approve?routeId=${T}&sourceAddress=${H}`)).with({assetValue:BN.instanceOf(v),spender:BN.string,userWallet:BN.string},({spender:T,userWallet:H,assetValue:P})=>V(`/approve?tokenIdentifier=${P.toString()}&userWalletAddress=${H}&spender=${T}&amount=${P.getValue("string")}`)).exhaustive();return W.get(A)}function AP(){let N=V("/providers");return W.get(N)}function TP(N){let A=V(`/tokens?provider=${N}`);return W.get(A)}async function HP(N){let A=V("/price"),T=await W.post(A,{json:N});try{let H=zA.safeParse(T);if(!H.success)throw new t("api_v2_invalid_response",H.error);return H.data}catch(H){throw new t("api_v2_invalid_response",H)}}async function PP(){let N=V("/gas"),A=await W.get(N);try{let T=fA.safeParse(A);if(!T.success)throw new t("api_v2_invalid_response",T.error);return Array.isArray(T)?T:[T]}catch(T){throw new t("api_v2_invalid_response",T)}}async function LP(N){let{destinationAddress:A}=N;if(!A)throw new t("chainflip_broker_invalid_params");let T=w.get("integrations").chainflip?.brokerUrl||V("/chainflip/broker/channel"),H=await W.post(T,{json:N});try{let P=ZA.safeParse(H);if(!P.success)throw new t("api_v2_invalid_response",P.error);return P.data}catch(P){throw new t("api_v2_invalid_response",P)}}async function RP(N){let{destinationAddress:A}=N;if(!A)throw new t("chainflip_broker_invalid_params");let T=V("/near/channel"),H=await W.post(T,{json:N});try{let P=VA.safeParse(H);if(!P.success)throw new t("api_v2_invalid_response",P.error);return P.data}catch(P){throw new t("api_v2_invalid_response",P)}}function V(N){let{isDev:A,apiUrl:T,devApiUrl:H}=w.get("envs");return`${A?H:T}${N}`}function uP(N){let[A,T]=N.split(".");if(!lH.includes(A))return!0;let H=T.split("-"),P=H.length===1?void 0:H[H.length-1];return tN({chain:A,symbol:T})||!!P}var FP=new RegExp(/(.)\1{6}|\.ORG|\.NET|\.FINANCE|\.COM|WWW|HTTP|\\\\|\/\/|[\s$%:[\]]/,"gmi");function IP(N){return N.filter((A)=>{return!FP.test(A.identifier)&&uP(A.identifier)})}async function nP(N){let{getSwapTo:A}=w.get("endpoints");if(A)return A(N);let T=new URLSearchParams({sellAsset:N.sellAsset});if(N.providers?.length)for(let F of N.providers)T.append("providers",F);let H=V(`/swapTo?${T.toString()}`),P=await W.get(H);if(!Array.isArray(P))return{buyAssets:[],sellAsset:N.sellAsset};let I=[];for(let F of P)try{let O=v.from({asset:F});I.push({chain:O.chain,identifier:O.toString(),providers:[],symbol:O.symbol,ticker:O.ticker})}catch{}return{buyAssets:I,sellAsset:N.sellAsset}}var oN={};dN(oN,{getThorchainQueue:()=>GP,getTcyStakers:()=>SP,getTcyStaker:()=>UP,getTcyClaimers:()=>EP,getTcyClaimer:()=>XP,getTNSPreferredAsset:()=>_P,getTHORNodeTNSDetails:()=>cA,getRunePoolProviderInfo:()=>YP,getRunePoolInfo:()=>DP,getNodes:()=>gP,getMimirInfo:()=>MP,getLastBlock:()=>$P,getInboundAddresses:()=>tP});import{match as BP}from"ts-pattern";function q(N){let{isStagenet:A}=w.get("envs"),T=w.get("thornodeUrls");return`${BP({isStagenet:A,type:N}).with({type:"mayachain"},({isStagenet:P})=>P?T.MAYA_STAGENET:T.MAYA).with({type:"thorchain"},({isStagenet:P})=>P?T.THOR_STAGENET:T.THOR)}/${N}`}function OP(N){let A=N==="mayachain"?"mayaname":"thorname";return`${q(N)}/${A}`}function $P(N="thorchain"){return G.get(`${q(N)}/lastblock`)}function GP(N){return G.get(`${q(N)}/queue`)}function gP(N){return G.get(`${q(N)}/nodes`)}function MP(N){return G.get(`${q(N)}/mimir`)}function tP(N){return G.get(`${q(N)}/inbound_addresses`)}async function cA({type:N,name:A}){try{return await G.get(`${OP(N)}/${A}`)}catch{return{affiliate_collector_rune:"",aliases:[],expire_block_height:0,name:A,owner:"",preferred_asset:""}}}async function _P({type:N,tns:A}){let T=await cA({name:A,type:N});if(!T.preferred_asset||T.preferred_asset===".")return;return v.from({asset:T.preferred_asset,asyncTokenLookup:!0})}function DP(N){return G.get(`${q(N)}/runepool`)}function YP({type:N,thorAddress:A}){return G.get(`${q(N)}/rune_provider/${A}`)}function UP({type:N,address:A}){return G.get(`${q(N)}/tcy_staker/${A}`)}function SP(N){return G.get(`${q(N)}/tcy_stakers`)}function XP({type:N,address:A}){return G.get(`${q(N)}/tcy_claimer/${A}`)}function EP(N){return G.get(`${q(N)}/tcy_claimers`)}var UR={...yN,mayachainMidgard:MA,thorchainMidgard:gA,thornode:oN};
5
5
  export{xP as a,LN as b,xN as c,J as d,bN as e,NT as f,AT as g,TT as h,zN as i,HT as j,Z as k,w as l,t as m,G as n,lP as o,rP as p,iP as q,sP as r,c as s,VN as t,ET as u,l as v,PL as w,nL as x,LA as y,tN as z,_N as A,WN as B,f as C,uN as D,BL as E,OL as F,uA as G,ML as H,h as I,p as J,v as K,bL as L,SN as M,tA as N,XA as O,wN as P,EA as Q,wA as R,QA as S,xA as T,yL as U,oL as V,fL as W,CL as X,NN as Y,bA as Z,hL as _,zA as $,dL as aa,cL as ba,JA as ca,XH as da,ZA as ea,_A as fa,lL as ga,VA as ha,WA as ia,rL as ja,iL as ka,mN as la,pN as ma,jA as na,vA as oa,ZH as pa,sL as qa,qA as ra,qH as sa,kA as ta,kH as ua,eL as va,KH as wa,mH as xa,KA as ya,mA as za,pA as Aa,yH as Ba,yA as Ca,oA as Da,fA as Ea,NR as Fa,AR as Ga,fH as Ha,TR as Ia,HR as Ja,dH as Ka,PR as La,hA as Ma,cH as Na,LR as Oa,dA as Pa,UR as Qa};
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{$ as Zg,A as hf,Aa as hg,B as of,Ba as og,C as uf,Ca as ug,D as sf,Da as sg,E as df,Ea as dg,F as lf,Fa as lg,G as nf,Ga as ng,H as pf,Ha as pg,I as tf,Ia as ig,J as af,Ja as tg,K as ef,Ka as ag,L as $g,La as eg,M as P,Ma as $R,N as fg,Na as fR,O as gg,Oa as gR,P as Rg,Pa as RR,Q as Bg,Qa as BR,R as xg,S as Mg,T as Yg,U as Gg,V as zg,W as Jg,X as Lg,Y as Pg,Z as Qg,_ as Xg,a as X,aa as _g,b as Ef,ba as Vg,c as If,ca as Cg,d as Tf,da as Wg,e as Sf,ea as jg,f as b,fa as Fg,g as qf,ga as Hg,h as i,ha as Eg,i as e,ia as Ig,j as Nf,ja as Tg,k as Kf,ka as Sg,l as E,la as qg,m as _,ma as Ng,n as Af,na as Kg,o as Of,oa as Ag,p as Uf,pa as Og,q as Df,qa as Ug,r as yf,ra as Dg,s as N,sa as yg,t as kf,ta as kg,u as bf,ua as bg,v as mf,va as mg,w as vf,wa as vg,x as wf,xa as wg,y as cf,ya as cg,z as rf,za as rg}from"./chunk-8bhcxwrv.js";export*from"@swapkit/tokens";export*from"@swapkit/types";var m={average:1,fast:1.5,fastest:2};function I($="average"){let f=E.get("feeMultipliers");if(f&&f[$]!==void 0)return f[$];return m[$]}function v($="average"){let f=I($),g=10n,R=BigInt(Math.round(f*10));return{denominator:g,numerator:R}}function Y$($,f="average"){let{numerator:g,denominator:R}=v(f);return $*g/R}function G$($,f="average",g=!1){let R=I(f),B=$*R;return g?Math.floor(B):B}import{Chain as T,EVMChains as w}from"@swapkit/types";function j($,f){if("index"in f)return[...$.slice(0,$.length-1),f.index];if("change"in f){let[g,R,B,,x]=$;return[g,R,B,f.change,x]}if("account"in f){let[g,R,,B,x]=$;return[g,R,f.account,B,x]}return $}function c([$,f,g,R,B],{allHardened:x}={}){let Y=x?"'":"",G=typeof B!=="number";if(typeof R!=="number")return`m/${$}'/${f}'/${g}'`;return`m/${$}'/${f}'/${g}'/${R}${Y}${G?"":`/${B}${Y}`}`}function P$({chain:$,index:f,addressIndex:g=0,type:R}){if(w.includes($)){if(R&&["legacy","account"].includes(R))return[44,60,0,f];if(R==="ledgerLive")return[44,60,f,0,g];return j(X[$],{index:f})}if($===T.Solana){if(R==="account")return[44,501,0,f];return j(X[$],{index:f})}let B=$===T.Litecoin?2:0;switch(R){case"nativeSegwitMiddleAccount":return[84,B,f,0,g];case"segwit":return[49,B,0,0,f];case"legacy":return[44,B,0,0,f];default:return j(X[$],{index:f})}}function Q$($){let[f,g,R]=$.split("/").map((B)=>Number.parseInt(B,10));switch(g){case 44:return"legacy";case 49:return"p2sh";default:return"bech32"}}var X$=Object.keys(X).reduce(($,f)=>{return $[f]=c(X[f]),$},{});import{Chain as J,CosmosChains as r,EVMChains as h,getChainConfig as S,SubstrateChains as o,UTXOChains as u}from"@swapkit/types";import{match as q}from"ts-pattern";function C$({chain:$,txHash:f}){let{explorerUrl:g}=S($);return q($).with(...r,J.Solana,()=>`${g}/tx/${f.startsWith("0x")?f.slice(2):f}`).with(...h,...o,()=>`${g}/tx/${f.startsWith("0x")?f:`0x${f}`}`).with(...u,J.Radix,J.Tron,()=>`${g}/transaction/${f.toLowerCase()}`).with(J.Near,()=>`${g}/txns/${f}`).with(J.Ripple,()=>`${g}/transactions/${f}`).with(J.Sui,()=>`${g}/txblock/${f}`).with(J.Cardano,J.HyperCore,J.Ton,()=>`${g}/tx/${f}`).otherwise(()=>"")}function W$({chain:$,address:f}){let{explorerUrl:g}=S($);return q($).with(J.Solana,J.Sui,J.Radix,()=>`${g}/account/${f}`).otherwise(()=>`${g}/address/${f}`)}import{Chain as s,getChainConfig as d}from"@swapkit/types";function l({liquidityUnits:$,poolUnits:f,runeDepth:g}){let R=z($),B=z(f),x=z(g),Y=R.mul(x),G=B.mul(B).mul(2),M=B.mul(R).mul(2),L=R.mul(R),Q=B.mul(B).mul(B);return Y.mul(G.sub(M).add(L)).div(Q)}function n({liquidityUnits:$,poolUnits:f,assetDepth:g}){let R=z($),B=z(f),x=z(g),Y=R.mul(x),G=B.mul(B).mul(2),M=B.mul(R).mul(2),L=R.mul(R),Q=Y.mul(G.sub(M).add(L)),Z=B.mul(B).mul(B);return Q.div(Z)}function E$({percent:$,runeDepth:f,liquidityUnits:g,poolUnits:R}){return l({liquidityUnits:g,poolUnits:R,runeDepth:f}).mul($)}function I$({percent:$,assetDepth:f,liquidityUnits:g,poolUnits:R}){return n({assetDepth:f,liquidityUnits:g,poolUnits:R}).mul($)}function z($){return P.fromBigInt(BigInt($),d(s.THORChain).baseDecimal)}function p({liquidityUnits:$,poolUnits:f,runeDepth:g,assetDepth:R}){return{assetAmount:z(R).mul($).div(f),runeAmount:z(g).mul($).div(f)}}function T$({liquidityUnits:$,poolUnits:f,runeDepth:g,assetDepth:R,percent:B}){return Object.fromEntries(Object.entries(p({assetDepth:R,liquidityUnits:$,poolUnits:f,runeDepth:g})).map(([x,Y])=>[x,Y.mul(B)]))}function S$({runeDepth:$,poolUnits:f,assetDepth:g,liquidityUnits:R,runeAmount:B,assetAmount:x}){let Y=new P({decimal:8,value:$}),G=new P({decimal:8,value:g}),M=new P({decimal:8,value:f}),L=new P({decimal:8,value:B}),Q=new P({decimal:8,value:x}),Z=L.mul(G),F=Q.mul(Y),O=L.mul(Q),U=Y.mul(G),D=M.mul(Z.add(F.add(O.mul(2)))),y=Z.add(F.add(U.mul(2))),H=D.div(y),W=z(R).add(H);if(H.getBaseValue("number")===0)return W.div(M).getBaseValue("number");let k=M.add(W);return W.div(k).getBaseValue("number")}function q$({runeAmount:$,assetAmount:f,runeDepth:g,assetDepth:R}){if($==="0"||f==="0"||g==="0"||R==="0")return 0;let B=z(g),x=z(R),Y=z(f),G=z($),M=Y.mul(B).sub(x.mul(G)),L=x.mul(G).add(B.mul(x));return Math.abs(M.div(L).getBaseValue("number"))}import{Chain as V}from"@swapkit/types";import{match as t}from"ts-pattern";function U$({type:$,address:f}){return`${$}:${f}`}function D$({address:$,unbondAmount:f}){return`${"UNBOND"}:${$}:${f}`}function y$($){return C("POOL+",$)}function k$({chain:$,symbol:f,address:g,...R}){let B=a({chain:$,symbol:f}),x=g?`:${g}:`:":";return C(`${"+"}:${B}${x}`,R)}function b$({chain:$,symbol:f,ticker:g,basisPoints:R,targetAsset:B}){let x=$==="ETH"&&g!=="ETH"?`${g}-${f.slice(-3)}`:f,Y=B?`:${B}`:"";return`${"-"}:${$}.${x}:${R}${Y}`}function m$({basisPoints:$,...f}){return C(`${"POOL-"}:${$}`,f)}function v$({name:$,chain:f,address:g,owner:R}){let B=`${"~"}:${$}:${f}:${g}`,x=R?`:${R}`:"";return`${B}${x}`}function w$({name:$,chain:f,asset:g,payout:R,owner:B}){return`${"~"}:${$}:${f}:${R}:${B}:${g}`}function c$($,{address:f}){return`${$}:${f}`}function r$($,{unstakeBps:f,...g}){let R=f?`:${f}`:"",B=`${$}${R}`;return C(`${B}`,g)}function C($,{affiliateAddress:f,affiliateBasisPoints:g}={}){let R=`${$}${f?`:${f}:${g||0}`:""}`;return R.endsWith(":")?R.slice(0,-1):R}function a({chain:$,symbol:f}){return t($).with(V.Bitcoin,V.Dogecoin,V.Litecoin,()=>$.slice(0,1).toLowerCase()).with(V.BitcoinCash,()=>"c").otherwise(()=>`${$}.${f}`)}import{getChainConfig as K}from"@swapkit/types";function l$(){return typeof window.ethereum<"u"}function n$($){return $$().includes($)}function $$(){let $=window?.ethereum&&!window.ethereum?.isBraveWallet,f=window?.ctrl||window?.ethereum?.__XDEFI,g=window?.vultisig,R=window?.ethereum?.isBraveWallet,B=window?.ethereum?.isTrust||window?.trustwallet,x=window?.ethereum?.overrideIsMetaMask&&window?.ethereum?.selectedProvider?.isCoinbaseWallet||window?.coinbaseWalletExtension,Y=window?.bitkeep?.ethereum,G=window?.$onekey?.ethereum,M=[];if($)M.push("METAMASK");if(f)M.push("CTRL");if(g)M.push("VULTISIG");if(R)M.push("BRAVE");if(B)M.push("TRUSTWALLET_WEB");if(x)M.push("COINBASE_WEB");if(B$())M.push("OKX_MOBILE");if(Y)M.push("BITGET");if(G)M.push("ONEKEY");return M}async function f$($,f,g){let R=K(f);try{await A({method:"wallet_switchEthereumChain",params:[{chainId:R.chainIdHex}],provider:$})}catch(B){if(!g)throw new _("helpers_failed_to_switch_network",{error:B,reason:"networkParams not provided"});await R$($,g)}}function p$({chains:$,supportedChains:f,walletType:g}){let R=$.filter((x)=>!x||f.includes(x));if(R.length===0)throw new _("wallet_chain_not_supported",{chain:$.join(", "),wallet:g});let B=$.filter((x)=>!f.includes(x));return N({condition:B.length>0,id:`wallet_chain_not_supported_${g}`,warning:`${g} wallet does not support the following chains: ${B.join(", ")}. These chains will be ignored.`}),R}function g$($,f,g){return async(...R)=>{let{chainIdHex:B}=K(g);if((await f.getNetwork()).chainId.toString()===B)return $(...R);try{await f$(f,g)}catch(x){throw new _({errorKey:"helpers_failed_to_switch_network",info:{error:x}})}return $(...R)}}function i$({toolbox:$,chain:f,provider:g=window.ethereum,methodNames:R=[]}){let x=[...R,"approve","approvedAmount","call","sendTransaction","transfer","isApproved","approvedAmount","EIP1193SendTransaction","getFeeData","broadcastTransaction","estimateCall","estimateGasLimit","estimateGasPrices","createContractTxObject"].reduce((Y,G)=>{if(!$[G])return Y;let M=$[G];if(typeof M!=="function")return Y;let L=g$(M,g,f);return{...Y,[G]:L}},{});return{...$,...x}}function R$($,f){return A({method:"wallet_addEthereumChain",params:[f],provider:$})}function t$($){window.ethereum?.on("accountsChanged",()=>$()),window.ctrl?.ethereum.on("accountsChanged",()=>$())}function a$(){let{isTrust:$,isBraveWallet:f,__XDEFI:g,overrideIsMetaMask:R,selectedProvider:B}=window?.ethereum||{};if($)return"TRUSTWALLET_WEB";if(f)return"BRAVE";if(R&&B?.isCoinbaseWallet)return"COINBASE_WEB";if(g)return"CTRL";if(window?.$onekey?.ethereum)return"ONEKEY";return"METAMASK"}function e$(){let $=[];function f(R){if($.map((B)=>B.info.uuid).includes(R.detail.info.uuid))return;$.push(R.detail)}window.addEventListener("eip6963:announceProvider",f),window.dispatchEvent(new Event("eip6963:requestProvider"));function g(){window.removeEventListener("eip6963:announceProvider",f)}return{providers:$,removeEIP6963EventListener:g}}function B$(){let $=navigator.userAgent,f=/iphone|ipad|ipod|ios/i.test($),g=/android|XiaoMi|MiuiBrowser/i.test($),R=f||g,B=/OKApp/i.test($);return R&&B}function A({provider:$,params:f,method:g}){if(!$?.send)throw new _("helpers_not_found_provider");let R=f?Array.isArray(f)?f:[f]:[];return $.send(g,R)}export{Df as wrapWithThrow,g$ as wrapMethodWithNetworkSwitch,N as warnOnce,pf as validateTNS,nf as validateIdentifier,j as updateDerivationPath,f$ as switchEVMWalletNetwork,Kf as swapKitConfigStore,fg as signWidgetRequest,A as providerRequest,i$ as prepareNetworkSwitch,sf as parseSymbolForAddress,B$ as okxMobileEnabled,$$ as listWeb3EVMWallets,l$ as isWeb3Detected,rf as isGasAsset,n$ as isDetected,vf as initializeRPCUrlsWithFallback,Q$ as getWalletFormatFor,df as getTokenLogoURI,Of as getTHORNameCost,T$ as getSymmetricWithdraw,p as getSymmetricPoolShare,bf as getRPCUrlSync,mf as getRPCUrl,$g as getMinAmountByChain,b$ as getMemoForWithdraw,D$ as getMemoForUnbond,r$ as getMemoForTcyStake,c$ as getMemoForTcyClaim,m$ as getMemoForRunePoolWithdraw,y$ as getMemoForRunePoolDeposit,v$ as getMemoForNameRegister,w$ as getMemoForNamePreferredAssetRegister,U$ as getMemoForLeaveAndBond,k$ as getMemoForDeposit,Uf as getMAYANameCost,q$ as getLiquiditySlippage,v as getFeeMultiplierAsBigInt,I as getFeeMultiplier,C$ as getExplorerTxUrl,W$ as getExplorerAddressUrl,S$ as getEstimatedPoolShare,a$ as getETHDefaultWallet,e$ as getEIP6963Wallets,P$ as getDerivationPathFor,hf as getCommonAssetInfo,yf as getChainIdentifier,E$ as getAsymmetricRuneWithdrawAmount,l as getAsymmetricRuneShare,I$ as getAsymmetricAssetWithdrawAmount,n as getAsymmetricAssetShare,of as getAssetType,tf as formatBigIntToSafeValue,lf as findAssetBy,p$ as filterSupportedChains,cf as fetchTokenInfo,c as derivationPathToString,uf as assetFromString,Y$ as applyFeeMultiplierToBigInt,G$ as applyFeeMultiplier,R$ as addEVMWalletNetwork,t$ as addAccountsChangedCallback,kf as _rpcCache,If as WarningCodeEnum,e as WalletOption,Bg as TxnType,Mg as TxnStatus,Ag as TronTransactionSchema,Tg as TransactionSchema,Sg as TransactionDTOSchema,Yg as TrackingStatus,zg as TrackingRequestSchema,Jg as TrackingRequestQuerySchema,Ig as TrackerResponseSchema,Gg as TokenSchema,Xg as TokenDetailsMetadataSchema,kg as TONTransactionSchema,eg as SwapToResponseSchema,tg as SwapToRequestSchema,ag as SwapToAssetSchema,RR as SwapRouteV2ResponseSchema,P as SwapKitNumber,_ as SwapKitError,BR as SwapKitApi,yg as StarknetTransactionSchema,E as SKConfig,hg as RouteQuoteWarningSchema,Rg as RouteQuoteTxType,fR as RouteQuoteProviderErrorSchema,rg as RouteQuoteMetadataV2Schema,cg as RouteQuoteMetadataSchema,vg as RouteQuoteMetadataAssetSchema,mg as RouteLegWithoutAddressesSchema,bg as RouteLegSchema,Af as RequestClient,ig as QuoteV3ResponseSchema,gR as QuoteV2ResponseSchema,$R as QuoteRouteV2Response,ug as QuoteResponseSchema,og as QuoteResponseRouteItem,_g as QuoteRequestSchema,Tf as ProviderName,xg as ProviderAction,gg as PriorityLabel,Zg as PriceResponseSchema,Vg as PriceRequestSchema,X as NetworkDerivationPath,Eg as NearSwapResponseSchema,Hg as NearDepositChannelResultSchema,Fg as NearDepositChannelParamsSchema,i as MemoType,Nf as LedgerErrorCode,sg as GasSchema,dg as GasResponseSchema,qg as FeesSchema,Sf as FeeTypeEnum,b as FeeOption,Ng as EstimatedTimeSchema,Ef as ErrorCode,Kg as EVMTransactionSchema,Ug as EVMTransactionDetailsSchema,Og as EVMTransactionDetailsParamsSchema,X$ as DerivationPath,jg as DepositChannelResponseSchema,Cg as DepositChannelParamsSchema,m as DEFAULT_FEE_MULTIPLIERS,Dg as CosmosTransactionSchema,wf as CommonAssetStrings,Qg as CoinGeckoMetadataSchema,wg as ChainflipMetadataSchema,Wg as BrokerDepositChannelParamsSchema,af as BigIntArithmetics,Pg as AssetValueSchema,ef as AssetValue,ng as ApproveResponseSchema,lg as ApproveRequestParams,qf as ApproveMode,pg as ApprovalTransactionSchema,Lg as ApiV2ErrorSchema};
1
+ import{$ as Zg,A as hf,Aa as hg,B as of,Ba as og,C as uf,Ca as ug,D as sf,Da as sg,E as df,Ea as dg,F as lf,Fa as lg,G as nf,Ga as ng,H as pf,Ha as pg,I as tf,Ia as ig,J as af,Ja as tg,K as ef,Ka as ag,L as $g,La as eg,M as P,Ma as $R,N as fg,Na as fR,O as gg,Oa as gR,P as Rg,Pa as RR,Q as Bg,Qa as BR,R as xg,S as Mg,T as Yg,U as Gg,V as zg,W as Jg,X as Lg,Y as Pg,Z as Qg,_ as Xg,a as X,aa as _g,b as Ef,ba as Vg,c as If,ca as Cg,d as Tf,da as Wg,e as Sf,ea as jg,f as b,fa as Fg,g as qf,ga as Hg,h as i,ha as Eg,i as e,ia as Ig,j as Nf,ja as Tg,k as Kf,ka as Sg,l as E,la as qg,m as _,ma as Ng,n as Af,na as Kg,o as Of,oa as Ag,p as Uf,pa as Og,q as Df,qa as Ug,r as yf,ra as Dg,s as N,sa as yg,t as kf,ta as kg,u as bf,ua as bg,v as mf,va as mg,w as vf,wa as vg,x as wf,xa as wg,y as cf,ya as cg,z as rf,za as rg}from"./chunk-xrrf9q4d.js";export*from"@swapkit/tokens";export*from"@swapkit/types";var m={average:1,fast:1.5,fastest:2};function I($="average"){let f=E.get("feeMultipliers");if(f&&f[$]!==void 0)return f[$];return m[$]}function v($="average"){let f=I($),g=10n,R=BigInt(Math.round(f*10));return{denominator:g,numerator:R}}function Y$($,f="average"){let{numerator:g,denominator:R}=v(f);return $*g/R}function G$($,f="average",g=!1){let R=I(f),B=$*R;return g?Math.floor(B):B}import{Chain as T,EVMChains as w}from"@swapkit/types";function j($,f){if("index"in f)return[...$.slice(0,$.length-1),f.index];if("change"in f){let[g,R,B,,x]=$;return[g,R,B,f.change,x]}if("account"in f){let[g,R,,B,x]=$;return[g,R,f.account,B,x]}return $}function c([$,f,g,R,B],{allHardened:x}={}){let Y=x?"'":"",G=typeof B!=="number";if(typeof R!=="number")return`m/${$}'/${f}'/${g}'`;return`m/${$}'/${f}'/${g}'/${R}${Y}${G?"":`/${B}${Y}`}`}function P$({chain:$,index:f,addressIndex:g=0,type:R}){if(w.includes($)){if(R&&["legacy","account"].includes(R))return[44,60,0,f];if(R==="ledgerLive")return[44,60,f,0,g];return j(X[$],{index:f})}if($===T.Solana){if(R==="account")return[44,501,0,f];return j(X[$],{index:f})}let B=$===T.Litecoin?2:0;switch(R){case"nativeSegwitMiddleAccount":return[84,B,f,0,g];case"segwit":return[49,B,0,0,f];case"legacy":return[44,B,0,0,f];default:return j(X[$],{index:f})}}function Q$($){let[f,g,R]=$.split("/").map((B)=>Number.parseInt(B,10));switch(g){case 44:return"legacy";case 49:return"p2sh";default:return"bech32"}}var X$=Object.keys(X).reduce(($,f)=>{return $[f]=c(X[f]),$},{});import{Chain as J,CosmosChains as r,EVMChains as h,getChainConfig as S,SubstrateChains as o,UTXOChains as u}from"@swapkit/types";import{match as q}from"ts-pattern";function C$({chain:$,txHash:f}){let{explorerUrl:g}=S($);return q($).with(...r,J.Solana,()=>`${g}/tx/${f.startsWith("0x")?f.slice(2):f}`).with(...h,...o,()=>`${g}/tx/${f.startsWith("0x")?f:`0x${f}`}`).with(...u,J.Radix,J.Tron,()=>`${g}/transaction/${f.toLowerCase()}`).with(J.Near,()=>`${g}/txns/${f}`).with(J.Ripple,()=>`${g}/transactions/${f}`).with(J.Sui,()=>`${g}/txblock/${f}`).with(J.Cardano,J.HyperCore,J.Ton,()=>`${g}/tx/${f}`).otherwise(()=>"")}function W$({chain:$,address:f}){let{explorerUrl:g}=S($);return q($).with(J.Solana,J.Sui,J.Radix,()=>`${g}/account/${f}`).otherwise(()=>`${g}/address/${f}`)}import{Chain as s,getChainConfig as d}from"@swapkit/types";function l({liquidityUnits:$,poolUnits:f,runeDepth:g}){let R=z($),B=z(f),x=z(g),Y=R.mul(x),G=B.mul(B).mul(2),M=B.mul(R).mul(2),L=R.mul(R),Q=B.mul(B).mul(B);return Y.mul(G.sub(M).add(L)).div(Q)}function n({liquidityUnits:$,poolUnits:f,assetDepth:g}){let R=z($),B=z(f),x=z(g),Y=R.mul(x),G=B.mul(B).mul(2),M=B.mul(R).mul(2),L=R.mul(R),Q=Y.mul(G.sub(M).add(L)),Z=B.mul(B).mul(B);return Q.div(Z)}function E$({percent:$,runeDepth:f,liquidityUnits:g,poolUnits:R}){return l({liquidityUnits:g,poolUnits:R,runeDepth:f}).mul($)}function I$({percent:$,assetDepth:f,liquidityUnits:g,poolUnits:R}){return n({assetDepth:f,liquidityUnits:g,poolUnits:R}).mul($)}function z($){return P.fromBigInt(BigInt($),d(s.THORChain).baseDecimal)}function p({liquidityUnits:$,poolUnits:f,runeDepth:g,assetDepth:R}){return{assetAmount:z(R).mul($).div(f),runeAmount:z(g).mul($).div(f)}}function T$({liquidityUnits:$,poolUnits:f,runeDepth:g,assetDepth:R,percent:B}){return Object.fromEntries(Object.entries(p({assetDepth:R,liquidityUnits:$,poolUnits:f,runeDepth:g})).map(([x,Y])=>[x,Y.mul(B)]))}function S$({runeDepth:$,poolUnits:f,assetDepth:g,liquidityUnits:R,runeAmount:B,assetAmount:x}){let Y=new P({decimal:8,value:$}),G=new P({decimal:8,value:g}),M=new P({decimal:8,value:f}),L=new P({decimal:8,value:B}),Q=new P({decimal:8,value:x}),Z=L.mul(G),F=Q.mul(Y),O=L.mul(Q),U=Y.mul(G),D=M.mul(Z.add(F.add(O.mul(2)))),y=Z.add(F.add(U.mul(2))),H=D.div(y),W=z(R).add(H);if(H.getBaseValue("number")===0)return W.div(M).getBaseValue("number");let k=M.add(W);return W.div(k).getBaseValue("number")}function q$({runeAmount:$,assetAmount:f,runeDepth:g,assetDepth:R}){if($==="0"||f==="0"||g==="0"||R==="0")return 0;let B=z(g),x=z(R),Y=z(f),G=z($),M=Y.mul(B).sub(x.mul(G)),L=x.mul(G).add(B.mul(x));return Math.abs(M.div(L).getBaseValue("number"))}import{Chain as V}from"@swapkit/types";import{match as t}from"ts-pattern";function U$({type:$,address:f}){return`${$}:${f}`}function D$({address:$,unbondAmount:f}){return`${"UNBOND"}:${$}:${f}`}function y$($){return C("POOL+",$)}function k$({chain:$,symbol:f,address:g,...R}){let B=a({chain:$,symbol:f}),x=g?`:${g}:`:":";return C(`${"+"}:${B}${x}`,R)}function b$({chain:$,symbol:f,ticker:g,basisPoints:R,targetAsset:B}){let x=$==="ETH"&&g!=="ETH"?`${g}-${f.slice(-3)}`:f,Y=B?`:${B}`:"";return`${"-"}:${$}.${x}:${R}${Y}`}function m$({basisPoints:$,...f}){return C(`${"POOL-"}:${$}`,f)}function v$({name:$,chain:f,address:g,owner:R}){let B=`${"~"}:${$}:${f}:${g}`,x=R?`:${R}`:"";return`${B}${x}`}function w$({name:$,chain:f,asset:g,payout:R,owner:B}){return`${"~"}:${$}:${f}:${R}:${B}:${g}`}function c$($,{address:f}){return`${$}:${f}`}function r$($,{unstakeBps:f,...g}){let R=f?`:${f}`:"",B=`${$}${R}`;return C(`${B}`,g)}function C($,{affiliateAddress:f,affiliateBasisPoints:g}={}){let R=`${$}${f?`:${f}:${g||0}`:""}`;return R.endsWith(":")?R.slice(0,-1):R}function a({chain:$,symbol:f}){return t($).with(V.Bitcoin,V.Dogecoin,V.Litecoin,()=>$.slice(0,1).toLowerCase()).with(V.BitcoinCash,()=>"c").otherwise(()=>`${$}.${f}`)}import{getChainConfig as K}from"@swapkit/types";function l$(){return typeof window.ethereum<"u"}function n$($){return $$().includes($)}function $$(){let $=window?.ethereum&&!window.ethereum?.isBraveWallet,f=window?.ctrl||window?.ethereum?.__XDEFI,g=window?.vultisig,R=window?.ethereum?.isBraveWallet,B=window?.ethereum?.isTrust||window?.trustwallet,x=window?.ethereum?.overrideIsMetaMask&&window?.ethereum?.selectedProvider?.isCoinbaseWallet||window?.coinbaseWalletExtension,Y=window?.bitkeep?.ethereum,G=window?.$onekey?.ethereum,M=[];if($)M.push("METAMASK");if(f)M.push("CTRL");if(g)M.push("VULTISIG");if(R)M.push("BRAVE");if(B)M.push("TRUSTWALLET_WEB");if(x)M.push("COINBASE_WEB");if(B$())M.push("OKX_MOBILE");if(Y)M.push("BITGET");if(G)M.push("ONEKEY");return M}async function f$($,f,g){let R=K(f);try{await A({method:"wallet_switchEthereumChain",params:[{chainId:R.chainIdHex}],provider:$})}catch(B){if(!g)throw new _("helpers_failed_to_switch_network",{error:B,reason:"networkParams not provided"});await R$($,g)}}function p$({chains:$,supportedChains:f,walletType:g}){let R=$.filter((x)=>!x||f.includes(x));if(R.length===0)throw new _("wallet_chain_not_supported",{chain:$.join(", "),wallet:g});let B=$.filter((x)=>!f.includes(x));return N({condition:B.length>0,id:`wallet_chain_not_supported_${g}`,warning:`${g} wallet does not support the following chains: ${B.join(", ")}. These chains will be ignored.`}),R}function g$($,f,g){return async(...R)=>{let{chainIdHex:B}=K(g);if((await f.getNetwork()).chainId.toString()===B)return $(...R);try{await f$(f,g)}catch(x){throw new _({errorKey:"helpers_failed_to_switch_network",info:{error:x}})}return $(...R)}}function i$({toolbox:$,chain:f,provider:g=window.ethereum,methodNames:R=[]}){let x=[...R,"approve","approvedAmount","call","sendTransaction","transfer","isApproved","approvedAmount","EIP1193SendTransaction","getFeeData","broadcastTransaction","estimateCall","estimateGasLimit","estimateGasPrices","createContractTxObject"].reduce((Y,G)=>{if(!$[G])return Y;let M=$[G];if(typeof M!=="function")return Y;let L=g$(M,g,f);return{...Y,[G]:L}},{});return{...$,...x}}function R$($,f){return A({method:"wallet_addEthereumChain",params:[f],provider:$})}function t$($){window.ethereum?.on("accountsChanged",()=>$()),window.ctrl?.ethereum.on("accountsChanged",()=>$())}function a$(){let{isTrust:$,isBraveWallet:f,__XDEFI:g,overrideIsMetaMask:R,selectedProvider:B}=window?.ethereum||{};if($)return"TRUSTWALLET_WEB";if(f)return"BRAVE";if(R&&B?.isCoinbaseWallet)return"COINBASE_WEB";if(g)return"CTRL";if(window?.$onekey?.ethereum)return"ONEKEY";return"METAMASK"}function e$(){let $=[];function f(R){if($.map((B)=>B.info.uuid).includes(R.detail.info.uuid))return;$.push(R.detail)}window.addEventListener("eip6963:announceProvider",f),window.dispatchEvent(new Event("eip6963:requestProvider"));function g(){window.removeEventListener("eip6963:announceProvider",f)}return{providers:$,removeEIP6963EventListener:g}}function B$(){let $=navigator.userAgent,f=/iphone|ipad|ipod|ios/i.test($),g=/android|XiaoMi|MiuiBrowser/i.test($),R=f||g,B=/OKApp/i.test($);return R&&B}function A({provider:$,params:f,method:g}){if(!$?.send)throw new _("helpers_not_found_provider");let R=f?Array.isArray(f)?f:[f]:[];return $.send(g,R)}export{Df as wrapWithThrow,g$ as wrapMethodWithNetworkSwitch,N as warnOnce,pf as validateTNS,nf as validateIdentifier,j as updateDerivationPath,f$ as switchEVMWalletNetwork,Kf as swapKitConfigStore,fg as signWidgetRequest,A as providerRequest,i$ as prepareNetworkSwitch,sf as parseSymbolForAddress,B$ as okxMobileEnabled,$$ as listWeb3EVMWallets,l$ as isWeb3Detected,rf as isGasAsset,n$ as isDetected,vf as initializeRPCUrlsWithFallback,Q$ as getWalletFormatFor,df as getTokenLogoURI,Of as getTHORNameCost,T$ as getSymmetricWithdraw,p as getSymmetricPoolShare,bf as getRPCUrlSync,mf as getRPCUrl,$g as getMinAmountByChain,b$ as getMemoForWithdraw,D$ as getMemoForUnbond,r$ as getMemoForTcyStake,c$ as getMemoForTcyClaim,m$ as getMemoForRunePoolWithdraw,y$ as getMemoForRunePoolDeposit,v$ as getMemoForNameRegister,w$ as getMemoForNamePreferredAssetRegister,U$ as getMemoForLeaveAndBond,k$ as getMemoForDeposit,Uf as getMAYANameCost,q$ as getLiquiditySlippage,v as getFeeMultiplierAsBigInt,I as getFeeMultiplier,C$ as getExplorerTxUrl,W$ as getExplorerAddressUrl,S$ as getEstimatedPoolShare,a$ as getETHDefaultWallet,e$ as getEIP6963Wallets,P$ as getDerivationPathFor,hf as getCommonAssetInfo,yf as getChainIdentifier,E$ as getAsymmetricRuneWithdrawAmount,l as getAsymmetricRuneShare,I$ as getAsymmetricAssetWithdrawAmount,n as getAsymmetricAssetShare,of as getAssetType,tf as formatBigIntToSafeValue,lf as findAssetBy,p$ as filterSupportedChains,cf as fetchTokenInfo,c as derivationPathToString,uf as assetFromString,Y$ as applyFeeMultiplierToBigInt,G$ as applyFeeMultiplier,R$ as addEVMWalletNetwork,t$ as addAccountsChangedCallback,kf as _rpcCache,If as WarningCodeEnum,e as WalletOption,Bg as TxnType,Mg as TxnStatus,Ag as TronTransactionSchema,Tg as TransactionSchema,Sg as TransactionDTOSchema,Yg as TrackingStatus,zg as TrackingRequestSchema,Jg as TrackingRequestQuerySchema,Ig as TrackerResponseSchema,Gg as TokenSchema,Xg as TokenDetailsMetadataSchema,kg as TONTransactionSchema,eg as SwapToResponseSchema,tg as SwapToRequestSchema,ag as SwapToAssetSchema,RR as SwapRouteV2ResponseSchema,P as SwapKitNumber,_ as SwapKitError,BR as SwapKitApi,yg as StarknetTransactionSchema,E as SKConfig,hg as RouteQuoteWarningSchema,Rg as RouteQuoteTxType,fR as RouteQuoteProviderErrorSchema,rg as RouteQuoteMetadataV2Schema,cg as RouteQuoteMetadataSchema,vg as RouteQuoteMetadataAssetSchema,mg as RouteLegWithoutAddressesSchema,bg as RouteLegSchema,Af as RequestClient,ig as QuoteV3ResponseSchema,gR as QuoteV2ResponseSchema,$R as QuoteRouteV2Response,ug as QuoteResponseSchema,og as QuoteResponseRouteItem,_g as QuoteRequestSchema,Tf as ProviderName,xg as ProviderAction,gg as PriorityLabel,Zg as PriceResponseSchema,Vg as PriceRequestSchema,X as NetworkDerivationPath,Eg as NearSwapResponseSchema,Hg as NearDepositChannelResultSchema,Fg as NearDepositChannelParamsSchema,i as MemoType,Nf as LedgerErrorCode,sg as GasSchema,dg as GasResponseSchema,qg as FeesSchema,Sf as FeeTypeEnum,b as FeeOption,Ng as EstimatedTimeSchema,Ef as ErrorCode,Kg as EVMTransactionSchema,Ug as EVMTransactionDetailsSchema,Og as EVMTransactionDetailsParamsSchema,X$ as DerivationPath,jg as DepositChannelResponseSchema,Cg as DepositChannelParamsSchema,m as DEFAULT_FEE_MULTIPLIERS,Dg as CosmosTransactionSchema,wf as CommonAssetStrings,Qg as CoinGeckoMetadataSchema,wg as ChainflipMetadataSchema,Wg as BrokerDepositChannelParamsSchema,af as BigIntArithmetics,Pg as AssetValueSchema,ef as AssetValue,ng as ApproveResponseSchema,lg as ApproveRequestParams,qf as ApproveMode,pg as ApprovalTransactionSchema,Lg as ApiV2ErrorSchema};
@@ -219,30 +219,24 @@ export declare const SwapKitApi: {
219
219
  msgs: {
220
220
  typeUrl: string;
221
221
  value: {
222
- typeUrl: string;
223
- value: {
224
- coins: {
225
- amount: string;
226
- asset: {
227
- chain: string;
228
- symbol: string;
229
- synth: boolean;
230
- ticker: string;
231
- };
232
- }[];
233
- memo: string;
234
- signer: string;
235
- };
222
+ amount: {
223
+ amount: string;
224
+ denom: string;
225
+ }[];
226
+ fromAddress: string;
227
+ toAddress: string;
236
228
  } | {
237
- typeUrl: string;
238
- value: {
239
- amount: {
240
- amount: string;
241
- denom: string;
242
- }[];
243
- fromAddress: string;
244
- toAddress: string;
245
- };
229
+ coins: {
230
+ amount: string;
231
+ asset: {
232
+ chain: string;
233
+ symbol: string;
234
+ synth: boolean;
235
+ ticker: string;
236
+ };
237
+ }[];
238
+ memo: string;
239
+ signer: string;
246
240
  };
247
241
  }[];
248
242
  sequence: number;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,QAAQ,MAAM,sBAAsB,CAAC;AAEjD,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AAEjC,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBACwnH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAD1jH,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,QAAQ,MAAM,sBAAsB,CAAC;AAEjD,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AAEjC,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBACwnH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAD1jH,CAAC"}
@@ -193,30 +193,24 @@ export declare function getSwapQuote(json: QuoteRequest): Promise<{
193
193
  msgs: {
194
194
  typeUrl: string;
195
195
  value: {
196
- typeUrl: string;
197
- value: {
198
- coins: {
199
- amount: string;
200
- asset: {
201
- chain: string;
202
- symbol: string;
203
- synth: boolean;
204
- ticker: string;
205
- };
206
- }[];
207
- memo: string;
208
- signer: string;
209
- };
196
+ amount: {
197
+ amount: string;
198
+ denom: string;
199
+ }[];
200
+ fromAddress: string;
201
+ toAddress: string;
210
202
  } | {
211
- typeUrl: string;
212
- value: {
213
- amount: {
214
- amount: string;
215
- denom: string;
216
- }[];
217
- fromAddress: string;
218
- toAddress: string;
219
- };
203
+ coins: {
204
+ amount: string;
205
+ asset: {
206
+ chain: string;
207
+ symbol: string;
208
+ synth: boolean;
209
+ ticker: string;
210
+ };
211
+ }[];
212
+ memo: string;
213
+ signer: string;
220
214
  };
221
215
  }[];
222
216
  sequence: number;
@@ -1 +1 @@
1
- {"version":3,"file":"endpoints.d.ts","sourceRoot":"","sources":["../../../../src/api/swapkitApi/endpoints.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAA4B,MAAM,gBAAgB,CAAC;AAEtE,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAKtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,EAGL,KAAK,0BAA0B,EAK/B,KAAK,wBAAwB,EAG7B,KAAK,YAAY,EAGjB,KAAK,YAAY,EAGjB,KAAK,mBAAmB,EAGxB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,0BAA0B,EAC/B,KAAK,gBAAgB,EAGrB,KAAK,eAAe,EACrB,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiB1B,CAAC;AAEH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,eAAe,6CAc5D;AAED,wBAAsB,YAAY,CAAC,IAAI,EAAE,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyBpD;AAED,wBAAsB,cAAc,CAAC,IAAI,EAAE;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,EAAE,MAAM,CAAC;CAC5B,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAqB/B;AAED,wBAAsB,eAAe,CAAC,CAAC,SAAS,KAAK,EAAE,EACrD,KAAK,EACL,OAAO,EACP,UAAiB,GAClB,EAAE;IACD,KAAK,EAAE,CAAC,CAAC;IACT,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;;;;;;;KAQA;AAED,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,UAAU,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;GAgB/G;AAED,wBAAgB,qBAAqB,wCAGpC;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,YAAY,6BAGlD;AAED,wBAAsB,QAAQ,CAAC,IAAI,EAAE,YAAY;;;;;;;;;;;;;;;KAehD;AAED,wBAAsB,UAAU;;;;;;;;;;;;;;;;;;;;;;;;QAgB/B;AAED,wBAAsB,0BAA0B,CAAC,IAAI,EAAE,0BAA0B;;;GAqBhF;AAED,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,wBAAwB;;;;;;;;;GAqBzE;AA0BD,wBAAsB,SAAS,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC,CAsC9E"}
1
+ {"version":3,"file":"endpoints.d.ts","sourceRoot":"","sources":["../../../../src/api/swapkitApi/endpoints.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAA4B,MAAM,gBAAgB,CAAC;AAEtE,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAKtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,EAGL,KAAK,0BAA0B,EAK/B,KAAK,wBAAwB,EAG7B,KAAK,YAAY,EAGjB,KAAK,YAAY,EAGjB,KAAK,mBAAmB,EAGxB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,0BAA0B,EAC/B,KAAK,gBAAgB,EAGrB,KAAK,eAAe,EACrB,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiB1B,CAAC;AAEH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,eAAe,6CAc5D;AAED,wBAAsB,YAAY,CAAC,IAAI,EAAE,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyBpD;AAED,wBAAsB,cAAc,CAAC,IAAI,EAAE;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,EAAE,MAAM,CAAC;CAC5B,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAqB/B;AAED,wBAAsB,eAAe,CAAC,CAAC,SAAS,KAAK,EAAE,EACrD,KAAK,EACL,OAAO,EACP,UAAiB,GAClB,EAAE;IACD,KAAK,EAAE,CAAC,CAAC;IACT,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;;;;;;;KAQA;AAED,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,UAAU,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;GAgB/G;AAED,wBAAgB,qBAAqB,wCAGpC;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,YAAY,6BAGlD;AAED,wBAAsB,QAAQ,CAAC,IAAI,EAAE,YAAY;;;;;;;;;;;;;;;KAehD;AAED,wBAAsB,UAAU;;;;;;;;;;;;;;;;;;;;;;;;QAgB/B;AAED,wBAAsB,0BAA0B,CAAC,IAAI,EAAE,0BAA0B;;;GAqBhF;AAED,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,wBAAwB;;;;;;;;;GAqBzE;AA0BD,wBAAsB,SAAS,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC,CAsC9E"}