Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@jup-ag/common

Package Overview
Dependencies
Maintainers
5
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jup-ag/common - npm Package Compare versions

Comparing version 4.0.0-beta.15-test.3 to 4.0.0-beta.16-test.0

dist/fee.d.ts

2

dist/common.cjs.production.min.js

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@mercurial-finance/optimist"),n=require("@solana/web3.js"),t=require("@project-serum/anchor/dist/cjs/utils/bytes"),i=require("@solana/spl-token"),r={version:"0.1.0",name:"jupiter",instructions:[{name:"route",accounts:[{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"userTransferAuthority",isMut:!1,isSigner:!0},{name:"destinationTokenAccount",isMut:!1,isSigner:!1}],args:[{name:"swapLeg",type:{defined:"SwapLeg"}},{name:"inAmount",type:"u64"},{name:"quotedOutAmount",type:"u64"},{name:"slippageBps",type:"u16"},{name:"platformFeeBps",type:"u8"}]},{name:"whirlpoolSwapExactOutput",accounts:[{name:"swapProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"tokenAuthority",isMut:!1,isSigner:!0},{name:"whirlpool",isMut:!0,isSigner:!1},{name:"tokenOwnerAccountA",isMut:!0,isSigner:!1},{name:"tokenVaultA",isMut:!0,isSigner:!1},{name:"tokenOwnerAccountB",isMut:!0,isSigner:!1},{name:"tokenVaultB",isMut:!0,isSigner:!1},{name:"tickArray0",isMut:!0,isSigner:!1},{name:"tickArray1",isMut:!0,isSigner:!1},{name:"tickArray2",isMut:!0,isSigner:!1},{name:"oracle",isMut:!1,isSigner:!1}],args:[{name:"outAmount",type:"u64"},{name:"inAmountWithSlippage",type:{defined:"AmountWithSlippage"}},{name:"aToB",type:"bool"},{name:"platformFeeBps",type:"u8"}]},{name:"raydiumSwapExactOutput",accounts:[{name:"swapProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"ammId",isMut:!0,isSigner:!1},{name:"ammAuthority",isMut:!1,isSigner:!1},{name:"ammOpenOrders",isMut:!0,isSigner:!1},{name:"poolCoinTokenAccount",isMut:!0,isSigner:!1},{name:"poolPcTokenAccount",isMut:!0,isSigner:!1},{name:"serumProgramId",isMut:!1,isSigner:!1},{name:"serumMarket",isMut:!0,isSigner:!1},{name:"serumBids",isMut:!0,isSigner:!1},{name:"serumAsks",isMut:!0,isSigner:!1},{name:"serumEventQueue",isMut:!0,isSigner:!1},{name:"serumCoinVaultAccount",isMut:!0,isSigner:!1},{name:"serumPcVaultAccount",isMut:!0,isSigner:!1},{name:"serumVaultSigner",isMut:!1,isSigner:!1},{name:"userSourceTokenAccount",isMut:!0,isSigner:!1},{name:"userDestinationTokenAccount",isMut:!0,isSigner:!1},{name:"userSourceOwner",isMut:!1,isSigner:!0}],args:[{name:"outAmount",type:"u64"},{name:"inAmountWithSlippage",type:{defined:"AmountWithSlippage"}},{name:"platformFeeBps",type:"u8"}]},{name:"raydiumClmmSwapExactOutput",accounts:[{name:"swapProgram",isMut:!1,isSigner:!1},{name:"payer",isMut:!1,isSigner:!0},{name:"ammConfig",isMut:!1,isSigner:!1},{name:"poolState",isMut:!0,isSigner:!1},{name:"inputTokenAccount",isMut:!0,isSigner:!1},{name:"outputTokenAccount",isMut:!0,isSigner:!1},{name:"inputVault",isMut:!0,isSigner:!1},{name:"outputVault",isMut:!0,isSigner:!1},{name:"observationState",isMut:!0,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"tickArray",isMut:!0,isSigner:!1}],args:[{name:"outAmount",type:"u64"},{name:"inAmountWithSlippage",type:{defined:"AmountWithSlippage"}},{name:"platformFeeBps",type:"u8"}]},{name:"createOpenOrders",accounts:[{name:"openOrders",isMut:!0,isSigner:!1},{name:"payer",isMut:!0,isSigner:!0},{name:"dexProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1},{name:"market",isMut:!1,isSigner:!1}],args:[]},{name:"mercurialSwap",accounts:[{name:"swapProgram",isMut:!1,isSigner:!1},{name:"swapState",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"poolAuthority",isMut:!1,isSigner:!1},{name:"userTransferAuthority",isMut:!1,isSigner:!0},{name:"sourceTokenAccount",isMut:!0,isSigner:!1},{name:"destinationTokenAccount",isMut:!0,isSigner:!1}],args:[]},{name:"cykuraSwap",accounts:[{name:"swapProgram",isMut:!1,isSigner:!1},{name:"signer",isMut:!1,isSigner:!0},{name:"factoryState",isMut:!1,isSigner:!1},{name:"poolState",isMut:!0,isSigner:!1},{name:"inputTokenAccount",isMut:!0,isSigner:!1},{name:"outputTokenAccount",isMut:!0,isSigner:!1},{name:"inputVault",isMut:!0,isSigner:!1},{name:"outputVault",isMut:!0,isSigner:!1},{name:"lastObservationState",isMut:!0,isSigner:!1},{name:"coreProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1}],args:[]},{name:"serumSwap",accounts:[{name:"market",accounts:[{name:"market",isMut:!0,isSigner:!1},{name:"openOrders",isMut:!0,isSigner:!1},{name:"requestQueue",isMut:!0,isSigner:!1},{name:"eventQueue",isMut:!0,isSigner:!1},{name:"bids",isMut:!0,isSigner:!1},{name:"asks",isMut:!0,isSigner:!1},{name:"coinVault",isMut:!0,isSigner:!1},{name:"pcVault",isMut:!0,isSigner:!1},{name:"vaultSigner",isMut:!1,isSigner:!1}]},{name:"authority",isMut:!1,isSigner:!0},{name:"orderPayerTokenAccount",isMut:!0,isSigner:!1},{name:"coinWallet",isMut:!0,isSigner:!1},{name:"pcWallet",isMut:!0,isSigner:!1},{name:"dexProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1}],args:[]},{name:"saberSwap",accounts:[{name:"swapProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"swap",isMut:!1,isSigner:!1},{name:"swapAuthority",isMut:!1,isSigner:!1},{name:"userAuthority",isMut:!1,isSigner:!1},{name:"inputUserAccount",isMut:!0,isSigner:!1},{name:"inputTokenAccount",isMut:!0,isSigner:!1},{name:"outputUserAccount",isMut:!0,isSigner:!1},{name:"outputTokenAccount",isMut:!0,isSigner:!1},{name:"feesTokenAccount",isMut:!0,isSigner:!1}],args:[]},{name:"saberAddDecimals",accounts:[{name:"addDecimalsProgram",isMut:!1,isSigner:!1},{name:"wrapper",isMut:!1,isSigner:!1},{name:"wrapperMint",isMut:!0,isSigner:!1},{name:"wrapperUnderlyingTokens",isMut:!0,isSigner:!1},{name:"owner",isMut:!1,isSigner:!0},{name:"userUnderlyingTokens",isMut:!0,isSigner:!1},{name:"userWrappedTokens",isMut:!0,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1}],args:[]},{name:"tokenSwap",accounts:[{name:"tokenSwapProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"swap",isMut:!1,isSigner:!1},{name:"authority",isMut:!1,isSigner:!1},{name:"userTransferAuthority",isMut:!1,isSigner:!0},{name:"source",isMut:!0,isSigner:!1},{name:"swapSource",isMut:!0,isSigner:!1},{name:"swapDestination",isMut:!0,isSigner:!1},{name:"destination",isMut:!0,isSigner:!1},{name:"poolMint",isMut:!0,isSigner:!1},{name:"poolFee",isMut:!0,isSigner:!1}],args:[]},{name:"senchaSwap",accounts:[{name:"swapProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"swap",isMut:!0,isSigner:!1},{name:"userAuthority",isMut:!1,isSigner:!1},{name:"inputUserAccount",isMut:!0,isSigner:!1},{name:"inputTokenAccount",isMut:!0,isSigner:!1},{name:"inputFeesAccount",isMut:!0,isSigner:!1},{name:"outputUserAccount",isMut:!0,isSigner:!1},{name:"outputTokenAccount",isMut:!0,isSigner:!1},{name:"outputFeesAccount",isMut:!0,isSigner:!1}],args:[]},{name:"stepSwap",accounts:[{name:"tokenSwapProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"swap",isMut:!1,isSigner:!1},{name:"authority",isMut:!1,isSigner:!1},{name:"userTransferAuthority",isMut:!1,isSigner:!0},{name:"source",isMut:!0,isSigner:!1},{name:"swapSource",isMut:!0,isSigner:!1},{name:"swapDestination",isMut:!0,isSigner:!1},{name:"destination",isMut:!0,isSigner:!1},{name:"poolMint",isMut:!0,isSigner:!1},{name:"poolFee",isMut:!0,isSigner:!1}],args:[]},{name:"cropperSwap",accounts:[{name:"tokenSwapProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"swap",isMut:!1,isSigner:!1},{name:"swapState",isMut:!1,isSigner:!1},{name:"authority",isMut:!1,isSigner:!1},{name:"userTransferAuthority",isMut:!1,isSigner:!0},{name:"source",isMut:!0,isSigner:!1},{name:"swapSource",isMut:!0,isSigner:!1},{name:"swapDestination",isMut:!0,isSigner:!1},{name:"destination",isMut:!0,isSigner:!1},{name:"poolMint",isMut:!0,isSigner:!1},{name:"poolFee",isMut:!0,isSigner:!1}],args:[]},{name:"raydiumSwap",accounts:[{name:"swapProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"ammId",isMut:!0,isSigner:!1},{name:"ammAuthority",isMut:!1,isSigner:!1},{name:"ammOpenOrders",isMut:!0,isSigner:!1},{name:"poolCoinTokenAccount",isMut:!0,isSigner:!1},{name:"poolPcTokenAccount",isMut:!0,isSigner:!1},{name:"serumProgramId",isMut:!1,isSigner:!1},{name:"serumMarket",isMut:!0,isSigner:!1},{name:"serumBids",isMut:!0,isSigner:!1},{name:"serumAsks",isMut:!0,isSigner:!1},{name:"serumEventQueue",isMut:!0,isSigner:!1},{name:"serumCoinVaultAccount",isMut:!0,isSigner:!1},{name:"serumPcVaultAccount",isMut:!0,isSigner:!1},{name:"serumVaultSigner",isMut:!1,isSigner:!1},{name:"userSourceTokenAccount",isMut:!0,isSigner:!1},{name:"userDestinationTokenAccount",isMut:!0,isSigner:!1},{name:"userSourceOwner",isMut:!1,isSigner:!0}],args:[]},{name:"cremaSwap",accounts:[{name:"swapProgram",isMut:!1,isSigner:!1},{name:"clmmConfig",isMut:!1,isSigner:!1},{name:"clmmpool",isMut:!0,isSigner:!1},{name:"tokenA",isMut:!1,isSigner:!1},{name:"tokenB",isMut:!1,isSigner:!1},{name:"accountA",isMut:!0,isSigner:!1},{name:"accountB",isMut:!0,isSigner:!1},{name:"tokenAVault",isMut:!0,isSigner:!1},{name:"tokenBVault",isMut:!0,isSigner:!1},{name:"tickArrayMap",isMut:!0,isSigner:!1},{name:"owner",isMut:!1,isSigner:!0},{name:"partner",isMut:!1,isSigner:!1},{name:"partnerAtaA",isMut:!0,isSigner:!1},{name:"partnerAtaB",isMut:!0,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1}],args:[]},{name:"lifinitySwap",accounts:[{name:"swapProgram",isMut:!1,isSigner:!1},{name:"authority",isMut:!1,isSigner:!1},{name:"amm",isMut:!1,isSigner:!1},{name:"userTransferAuthority",isMut:!1,isSigner:!0},{name:"sourceInfo",isMut:!0,isSigner:!1},{name:"destinationInfo",isMut:!0,isSigner:!1},{name:"swapSource",isMut:!0,isSigner:!1},{name:"swapDestination",isMut:!0,isSigner:!1},{name:"poolMint",isMut:!0,isSigner:!1},{name:"feeAccount",isMut:!0,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"pythAccount",isMut:!1,isSigner:!1},{name:"pythPcAccount",isMut:!1,isSigner:!1},{name:"configAccount",isMut:!0,isSigner:!1}],args:[]},{name:"marinadeDeposit",accounts:[{name:"marinadeFinanceProgram",isMut:!1,isSigner:!1},{name:"state",isMut:!0,isSigner:!1},{name:"msolMint",isMut:!0,isSigner:!1},{name:"liqPoolSolLegPda",isMut:!0,isSigner:!1},{name:"liqPoolMsolLeg",isMut:!0,isSigner:!1},{name:"liqPoolMsolLegAuthority",isMut:!1,isSigner:!1},{name:"reservePda",isMut:!0,isSigner:!1},{name:"transferFrom",isMut:!0,isSigner:!1},{name:"mintTo",isMut:!0,isSigner:!1},{name:"msolMintAuthority",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"userWsolTokenAccount",isMut:!0,isSigner:!1},{name:"tempWsolTokenAccount",isMut:!0,isSigner:!1},{name:"userTransferAuthority",isMut:!0,isSigner:!0},{name:"wsolMint",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1}],args:[]},{name:"marinadeUnstake",accounts:[{name:"marinadeFinanceProgram",isMut:!1,isSigner:!1},{name:"state",isMut:!0,isSigner:!1},{name:"msolMint",isMut:!0,isSigner:!1},{name:"liqPoolSolLegPda",isMut:!0,isSigner:!1},{name:"liqPoolMsolLeg",isMut:!0,isSigner:!1},{name:"treasuryMsolAccount",isMut:!0,isSigner:!1},{name:"getMsolFrom",isMut:!0,isSigner:!1},{name:"getMsolFromAuthority",isMut:!1,isSigner:!0},{name:"transferSolTo",isMut:!0,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"userWsolTokenAccount",isMut:!0,isSigner:!1}],args:[]},{name:"aldrinSwap",accounts:[{name:"swapProgram",isMut:!1,isSigner:!1},{name:"pool",isMut:!1,isSigner:!1},{name:"poolSigner",isMut:!1,isSigner:!1},{name:"poolMint",isMut:!0,isSigner:!1},{name:"baseTokenVault",isMut:!0,isSigner:!1},{name:"quoteTokenVault",isMut:!0,isSigner:!1},{name:"feePoolTokenAccount",isMut:!0,isSigner:!1},{name:"walletAuthority",isMut:!1,isSigner:!0},{name:"userBaseTokenAccount",isMut:!0,isSigner:!1},{name:"userQuoteTokenAccount",isMut:!0,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1}],args:[]},{name:"aldrinV2Swap",accounts:[{name:"swapProgram",isMut:!1,isSigner:!1},{name:"pool",isMut:!1,isSigner:!1},{name:"poolSigner",isMut:!1,isSigner:!1},{name:"poolMint",isMut:!0,isSigner:!1},{name:"baseTokenVault",isMut:!0,isSigner:!1},{name:"quoteTokenVault",isMut:!0,isSigner:!1},{name:"feePoolTokenAccount",isMut:!0,isSigner:!1},{name:"walletAuthority",isMut:!1,isSigner:!0},{name:"userBaseTokenAccount",isMut:!0,isSigner:!1},{name:"userQuoteTokenAccount",isMut:!0,isSigner:!1},{name:"curve",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1}],args:[]},{name:"whirlpoolSwap",accounts:[{name:"swapProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"tokenAuthority",isMut:!1,isSigner:!0},{name:"whirlpool",isMut:!0,isSigner:!1},{name:"tokenOwnerAccountA",isMut:!0,isSigner:!1},{name:"tokenVaultA",isMut:!0,isSigner:!1},{name:"tokenOwnerAccountB",isMut:!0,isSigner:!1},{name:"tokenVaultB",isMut:!0,isSigner:!1},{name:"tickArray0",isMut:!0,isSigner:!1},{name:"tickArray1",isMut:!0,isSigner:!1},{name:"tickArray2",isMut:!0,isSigner:!1},{name:"oracle",isMut:!1,isSigner:!1}],args:[]},{name:"invariantSwap",accounts:[{name:"swapProgram",isMut:!1,isSigner:!1},{name:"state",isMut:!1,isSigner:!1},{name:"pool",isMut:!0,isSigner:!1},{name:"tickmap",isMut:!0,isSigner:!1},{name:"accountX",isMut:!0,isSigner:!1},{name:"accountY",isMut:!0,isSigner:!1},{name:"reserveX",isMut:!0,isSigner:!1},{name:"reserveY",isMut:!0,isSigner:!1},{name:"owner",isMut:!1,isSigner:!0},{name:"programAuthority",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1}],args:[]},{name:"meteoraSwap",accounts:[{name:"swapProgram",isMut:!1,isSigner:!1},{name:"pool",isMut:!0,isSigner:!1},{name:"userSourceToken",isMut:!0,isSigner:!1},{name:"userDestinationToken",isMut:!0,isSigner:!1},{name:"aVault",isMut:!0,isSigner:!1},{name:"bVault",isMut:!0,isSigner:!1},{name:"aTokenVault",isMut:!0,isSigner:!1},{name:"bTokenVault",isMut:!0,isSigner:!1},{name:"aVaultLpMint",isMut:!0,isSigner:!1},{name:"bVaultLpMint",isMut:!0,isSigner:!1},{name:"aVaultLp",isMut:!0,isSigner:!1},{name:"bVaultLp",isMut:!0,isSigner:!1},{name:"adminTokenFee",isMut:!0,isSigner:!1},{name:"user",isMut:!1,isSigner:!0},{name:"vaultProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1}],args:[]},{name:"goosefxSwap",accounts:[{name:"swapProgram",isMut:!1,isSigner:!1},{name:"controller",isMut:!1,isSigner:!1},{name:"pair",isMut:!0,isSigner:!1},{name:"sslIn",isMut:!0,isSigner:!1},{name:"sslOut",isMut:!0,isSigner:!1},{name:"liabilityVaultIn",isMut:!0,isSigner:!1},{name:"swappedLiabilityVaultIn",isMut:!0,isSigner:!1},{name:"liabilityVaultOut",isMut:!0,isSigner:!1},{name:"swappedLiabilityVaultOut",isMut:!0,isSigner:!1},{name:"userInAta",isMut:!0,isSigner:!1},{name:"userOutAta",isMut:!0,isSigner:!1},{name:"feeCollectorAta",isMut:!0,isSigner:!1},{name:"userWallet",isMut:!1,isSigner:!0},{name:"feeCollector",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1}],args:[]},{name:"deltafiSwap",accounts:[{name:"swapProgram",isMut:!1,isSigner:!1},{name:"marketConfig",isMut:!1,isSigner:!1},{name:"swapInfo",isMut:!0,isSigner:!1},{name:"userSourceToken",isMut:!0,isSigner:!1},{name:"userDestinationToken",isMut:!0,isSigner:!1},{name:"swapSourceToken",isMut:!0,isSigner:!1},{name:"swapDestinationToken",isMut:!0,isSigner:!1},{name:"deltafiUser",isMut:!0,isSigner:!1},{name:"adminDestinationToken",isMut:!0,isSigner:!1},{name:"pythPriceBase",isMut:!1,isSigner:!1},{name:"pythPriceQuote",isMut:!1,isSigner:!1},{name:"userAuthority",isMut:!1,isSigner:!0},{name:"tokenProgram",isMut:!1,isSigner:!1}],args:[]},{name:"balansolSwap",accounts:[{name:"swapProgram",isMut:!1,isSigner:!1},{name:"authority",isMut:!0,isSigner:!0},{name:"pool",isMut:!0,isSigner:!1},{name:"taxMan",isMut:!0,isSigner:!1},{name:"bidMint",isMut:!1,isSigner:!1},{name:"treasurer",isMut:!1,isSigner:!1},{name:"srcTreasury",isMut:!0,isSigner:!1},{name:"srcAssociatedTokenAccount",isMut:!0,isSigner:!1},{name:"askMint",isMut:!1,isSigner:!1},{name:"dstTreasury",isMut:!0,isSigner:!1},{name:"dstAssociatedTokenAccount",isMut:!0,isSigner:!1},{name:"dstTokenAccountTaxman",isMut:!0,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"associatedTokenProgram",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1}],args:[]},{name:"marcoPoloSwap",accounts:[{name:"swapProgram",isMut:!1,isSigner:!1},{name:"state",isMut:!1,isSigner:!1},{name:"pool",isMut:!0,isSigner:!1},{name:"tokenX",isMut:!1,isSigner:!1},{name:"tokenY",isMut:!1,isSigner:!1},{name:"poolXAccount",isMut:!0,isSigner:!1},{name:"poolYAccount",isMut:!0,isSigner:!1},{name:"swapperXAccount",isMut:!0,isSigner:!1},{name:"swapperYAccount",isMut:!0,isSigner:!1},{name:"swapper",isMut:!0,isSigner:!0},{name:"referrerXAccount",isMut:!0,isSigner:!1},{name:"referrerYAccount",isMut:!0,isSigner:!1},{name:"referrer",isMut:!0,isSigner:!1},{name:"programAuthority",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"associatedTokenProgram",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1}],args:[]},{name:"dradexSwap",accounts:[{name:"swapProgram",isMut:!1,isSigner:!1},{name:"pair",isMut:!0,isSigner:!1},{name:"market",isMut:!0,isSigner:!1},{name:"eventQueue",isMut:!0,isSigner:!1},{name:"dexUser",isMut:!1,isSigner:!1},{name:"marketUser",isMut:!0,isSigner:!1},{name:"bids",isMut:!0,isSigner:!1},{name:"asks",isMut:!0,isSigner:!1},{name:"t0Vault",isMut:!0,isSigner:!1},{name:"t1Vault",isMut:!0,isSigner:!1},{name:"t0User",isMut:!0,isSigner:!1},{name:"t1User",isMut:!0,isSigner:!1},{name:"master",isMut:!1,isSigner:!1},{name:"signer",isMut:!0,isSigner:!0},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"logger",isMut:!1,isSigner:!1}],args:[]},{name:"lifinityV2Swap",accounts:[{name:"swapProgram",isMut:!1,isSigner:!1},{name:"authority",isMut:!1,isSigner:!1},{name:"amm",isMut:!0,isSigner:!1},{name:"userTransferAuthority",isMut:!1,isSigner:!0},{name:"sourceInfo",isMut:!0,isSigner:!1},{name:"destinationInfo",isMut:!0,isSigner:!1},{name:"swapSource",isMut:!0,isSigner:!1},{name:"swapDestination",isMut:!0,isSigner:!1},{name:"poolMint",isMut:!0,isSigner:!1},{name:"feeAccount",isMut:!0,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"oracleMainAccount",isMut:!1,isSigner:!1},{name:"oracleSubAccount",isMut:!1,isSigner:!1},{name:"oraclePcAccount",isMut:!1,isSigner:!1}],args:[]},{name:"raydiumClmmSwap",accounts:[{name:"swapProgram",isMut:!1,isSigner:!1},{name:"payer",isMut:!1,isSigner:!0},{name:"ammConfig",isMut:!1,isSigner:!1},{name:"poolState",isMut:!0,isSigner:!1},{name:"inputTokenAccount",isMut:!0,isSigner:!1},{name:"outputTokenAccount",isMut:!0,isSigner:!1},{name:"inputVault",isMut:!0,isSigner:!1},{name:"outputVault",isMut:!0,isSigner:!1},{name:"observationState",isMut:!0,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"tickArray",isMut:!0,isSigner:!1}],args:[]},{name:"phoenixSwap",accounts:[{name:"swapProgram",isMut:!1,isSigner:!1},{name:"logAuthority",isMut:!1,isSigner:!1},{name:"market",isMut:!0,isSigner:!1},{name:"trader",isMut:!1,isSigner:!0},{name:"baseAccount",isMut:!0,isSigner:!1},{name:"quoteAccount",isMut:!0,isSigner:!1},{name:"baseVault",isMut:!0,isSigner:!1},{name:"quoteVault",isMut:!0,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1}],args:[]}],types:[{name:"AmountWithSlippage",type:{kind:"struct",fields:[{name:"amount",type:"u64"},{name:"slippageBps",type:"u16"}]}},{name:"SplitLegDeeper",type:{kind:"struct",fields:[{name:"percent",type:"u8"},{name:"swapLeg",type:{defined:"SwapLegSwap"}}]}},{name:"SplitLeg",type:{kind:"struct",fields:[{name:"percent",type:"u8"},{name:"swapLeg",type:{defined:"SwapLegDeeper"}}]}},{name:"SwapInstrution",type:{kind:"enum",variants:[{name:"Swap",fields:[{defined:"Swap"}]}]}},{name:"Side",type:{kind:"enum",variants:[{name:"Bid"},{name:"Ask"}]}},{name:"SwapLegSwap",type:{kind:"enum",variants:[{name:"PlaceholderOne"},{name:"PlaceholderTwo"},{name:"Swap",fields:[{name:"swap",type:{defined:"Swap"}}]}]}},{name:"SwapLegDeeper",type:{kind:"enum",variants:[{name:"Chain",fields:[{name:"swap_legs",type:{vec:{defined:"SwapLegSwap"}}}]},{name:"Split",fields:[{name:"split_legs",type:{vec:{defined:"SplitLegDeeper"}}}]},{name:"Swap",fields:[{name:"swap",type:{defined:"Swap"}}]}]}},{name:"SwapLeg",type:{kind:"enum",variants:[{name:"Chain",fields:[{name:"swap_legs",type:{vec:{defined:"SwapLegDeeper"}}}]},{name:"Split",fields:[{name:"split_legs",type:{vec:{defined:"SplitLeg"}}}]},{name:"Swap",fields:[{name:"swap",type:{defined:"Swap"}}]}]}},{name:"Swap",type:{kind:"enum",variants:[{name:"Saber"},{name:"SaberAddDecimalsDeposit"},{name:"SaberAddDecimalsWithdraw"},{name:"TokenSwap"},{name:"Sencha"},{name:"Step"},{name:"Cropper"},{name:"Raydium"},{name:"Crema",fields:[{name:"a_to_b",type:"bool"}]},{name:"Lifinity"},{name:"Mercurial"},{name:"Cykura"},{name:"Serum",fields:[{name:"side",type:{defined:"Side"}}]},{name:"MarinadeDeposit"},{name:"MarinadeUnstake"},{name:"Aldrin",fields:[{name:"side",type:{defined:"Side"}}]},{name:"AldrinV2",fields:[{name:"side",type:{defined:"Side"}}]},{name:"Whirlpool",fields:[{name:"a_to_b",type:"bool"}]},{name:"Invariant",fields:[{name:"x_to_y",type:"bool"}]},{name:"Meteora"},{name:"GooseFX"},{name:"DeltaFi",fields:[{name:"stable",type:"bool"}]},{name:"Balansol"},{name:"MarcoPolo",fields:[{name:"x_to_y",type:"bool"}]},{name:"Dradex",fields:[{name:"side",type:{defined:"Side"}}]},{name:"LifinityV2"},{name:"RaydiumClmm"},{name:"Openbook",fields:[{name:"side",type:{defined:"Side"}}]},{name:"Phoenix",fields:[{name:"side",type:{defined:"Side"}}]}]}},{name:"SwapAction",type:{kind:"enum",variants:[{name:"SetupSplit",fields:[{name:"percents",type:"bytes"}]},{name:"NextSplitLeg"},{name:"MergeSplit"},{name:"Swap",fields:[{name:"swap",type:{defined:"Swap"}}]}]}}],events:[{name:"Swap",fields:[{name:"amm",type:"publicKey",index:!1},{name:"inputMint",type:"publicKey",index:!1},{name:"inputAmount",type:"u64",index:!1},{name:"outputMint",type:"publicKey",index:!1},{name:"outputAmount",type:"u64",index:!1}]},{name:"Fee",fields:[{name:"account",type:"publicKey",index:!1},{name:"mint",type:"publicKey",index:!1},{name:"amount",type:"u64",index:!1}]}],errors:[{code:6e3,name:"EmptyRoute",msg:"Empty route"},{code:6001,name:"SlippageToleranceExceeded",msg:"Slippage tolerance exceeded"},{code:6002,name:"InvalidCalculation",msg:"Invalid calculation"},{code:6003,name:"MissingPlatformFeeAccount",msg:"Missing platform fee account"},{code:6004,name:"InvalidSlippage",msg:"Invalid slippage"},{code:6005,name:"NotEnoughPercent",msg:"Not enough percent to 100"},{code:6006,name:"InAmountsStackIsEmpty",msg:"In amounts stack is empty"},{code:6007,name:"OutAmountsStackIsEmpty",msg:"Out amounts stack is empty"},{code:6008,name:"NotEnoughAccountKeys",msg:"Not Enough Account keys"}]};function a(){a=function(){return e};var e={},n=Object.prototype,t=n.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},r=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",o=i.toStringTag||"@@toStringTag";function u(e,n,t){return Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}),e[n]}try{u({},"")}catch(e){u=function(e,n,t){return e[n]=t}}function m(e,n,t,i){var r=Object.create((n&&n.prototype instanceof p?n:p).prototype),a=new x(i||[]);return r._invoke=function(e,n,t){var i="suspendedStart";return function(r,a){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw a;return{value:void 0,done:!0}}for(t.method=r,t.arg=a;;){var s=t.delegate;if(s){var o=k(s,t);if(o){if(o===g)continue;return o}}if("next"===t.method)t.sent=t._sent=t.arg;else if("throw"===t.method){if("suspendedStart"===i)throw i="completed",t.arg;t.dispatchException(t.arg)}else"return"===t.method&&t.abrupt("return",t.arg);i="executing";var u=c(e,n,t);if("normal"===u.type){if(i=t.done?"completed":"suspendedYield",u.arg===g)continue;return{value:u.arg,done:t.done}}"throw"===u.type&&(i="completed",t.method="throw",t.arg=u.arg)}}}(e,t,a),r}function c(e,n,t){try{return{type:"normal",arg:e.call(n,t)}}catch(e){return{type:"throw",arg:e}}}e.wrap=m;var g={};function p(){}function S(){}function l(){}var M={};u(M,r,(function(){return this}));var d=Object.getPrototypeOf,f=d&&d(d(P([])));f&&f!==n&&t.call(f,r)&&(M=f);var y=l.prototype=p.prototype=Object.create(M);function h(e){["next","throw","return"].forEach((function(n){u(e,n,(function(e){return this._invoke(n,e)}))}))}function w(e,n){function i(r,a,s,o){var u=c(e[r],e,a);if("throw"!==u.type){var m=u.arg,g=m.value;return g&&"object"==typeof g&&t.call(g,"__await")?n.resolve(g.__await).then((function(e){i("next",e,s,o)}),(function(e){i("throw",e,s,o)})):n.resolve(g).then((function(e){m.value=e,s(m)}),(function(e){return i("throw",e,s,o)}))}o(u.arg)}var r;this._invoke=function(e,t){function a(){return new n((function(n,r){i(e,t,n,r)}))}return r=r?r.then(a,a):a()}}function k(e,n){var t=e.iterator[n.method];if(void 0===t){if(n.delegate=null,"throw"===n.method){if(e.iterator.return&&(n.method="return",n.arg=void 0,k(e,n),"throw"===n.method))return g;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return g}var i=c(t,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,g;var r=i.arg;return r?r.done?(n[e.resultName]=r.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,g):r:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function v(e){var n={tryLoc:e[0]};1 in e&&(n.catchLoc=e[1]),2 in e&&(n.finallyLoc=e[2],n.afterLoc=e[3]),this.tryEntries.push(n)}function A(e){var n=e.completion||{};n.type="normal",delete n.arg,e.completion=n}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(v,this),this.reset(!0)}function P(e){if(e){var n=e[r];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,a=function n(){for(;++i<e.length;)if(t.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=void 0,n.done=!0,n};return a.next=a}}return{next:T}}function T(){return{value:void 0,done:!0}}return S.prototype=l,u(y,"constructor",l),u(l,"constructor",S),S.displayName=u(l,o,"GeneratorFunction"),e.isGeneratorFunction=function(e){var n="function"==typeof e&&e.constructor;return!!n&&(n===S||"GeneratorFunction"===(n.displayName||n.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,u(e,o,"GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},h(w.prototype),u(w.prototype,s,(function(){return this})),e.AsyncIterator=w,e.async=function(n,t,i,r,a){void 0===a&&(a=Promise);var s=new w(m(n,t,i,r),a);return e.isGeneratorFunction(t)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},h(y),u(y,o,"Generator"),u(y,r,(function(){return this})),u(y,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var n=[];for(var t in e)n.push(t);return n.reverse(),function t(){for(;n.length;){var i=n.pop();if(i in e)return t.value=i,t.done=!1,t}return t.done=!0,t}},e.values=P,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(A),!e)for(var n in this)"t"===n.charAt(0)&&t.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(t,i){return s.type="throw",s.arg=e,n.next=t,i&&(n.method="next",n.arg=void 0),!!i}for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var o=t.call(a,"catchLoc"),u=t.call(a,"finallyLoc");if(o&&u){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(o){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,n){for(var i=this.tryEntries.length-1;i>=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&t.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var a=r;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=n&&n<=a.finallyLoc&&(a=null);var s=a?a.completion:{};return s.type=e,s.arg=n,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(s)},complete:function(e,n){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&n&&(this.next=n),g},finish:function(e){for(var n=this.tryEntries.length-1;n>=0;--n){var t=this.tryEntries[n];if(t.finallyLoc===e)return this.complete(t.completion,t.afterLoc),A(t),g}},catch:function(e){for(var n=this.tryEntries.length-1;n>=0;--n){var t=this.tryEntries[n];if(t.tryLoc===e){var i=t.completion;if("throw"===i.type){var r=i.arg;A(t)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,t){return this.delegate={iterator:P(e),resultName:n,nextLoc:t},"next"===this.method&&(this.arg=void 0),g}},e}function s(e,n,t,i,r,a,s){try{var o=e[a](s),u=o.value}catch(e){return void t(e)}o.done?n(u):Promise.resolve(u).then(i,r)}function o(e){return function(){var n=this,t=arguments;return new Promise((function(i,r){var a=e.apply(n,t);function o(e){s(a,i,r,o,u,"next",e)}function u(e){s(a,i,r,o,u,"throw",e)}o(void 0)}))}}function u(){return u=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},u.apply(this,arguments)}function m(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,i=new Array(n);t<n;t++)i[t]=e[t];return i}var c=new n.PublicKey("BHzPYvC5J38kUeqkcUXwfraLWJ68cmGWm43ksF3i8bmk"),g=new n.PublicKey("JUPSjgjMFjU4453KMgxhqVmzep6W352bQpE4RsNqXAx"),p=new n.PublicKey("JUP4Fb2cqiRUcaTHdrPC8h2gNsA2ETXiPDD33WcGuJB"),S=p,l=new n.PublicKey("So11111111111111111111111111111111111111112"),M="https://cache.jup.ag/indexed-route-maps-v2",d=new n.PublicKey("BUX7s2ef2htTGb2KKoPHWkmzxPj4nTWMWRgs5CSbQxf9"),f=Object.freeze(u({AlreadyInUse:{code:1,name:"AlreadyInUsed",msg:"Account already In Used"},InsufficientSOL:{code:1,name:"InsufficientSOL",msg:"Insufficient SOL"},TransactionNotConfirmed:{code:7e3,name:"TransactionNotConfirmed",msg:"Transaction was not confirmed"},BalancesNotExtractedProperly:{code:7001,name:"BalancesNotExtractedProperly",msg:"Balances cannot be extracted properly"}},r.errors.reduce((function(e,n){var t;return u({},e,((t={})[n.name]=n,t))}),{}))),y=Object.values(f).reduce((function(e,n){return e[n.code]=n,e}),{});function h(e){return w.apply(this,arguments)}function w(){return(w=o(a().mark((function n(t){var i,r,s,o,u,m,c;return a().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r=t.txid,s=t.transactionResponse){n.next=3;break}return n.abrupt("return",new e.TransactionError("Transaction was not confirmed",r));case 3:if(null==s||null==(i=s.meta)||!i.err){n.next=8;break}return o=e.parseErrorForTransaction(s),u=o.message,m=o.code,o.programId===S.toBase58()&&m&&(u=null==(c=y[m])?void 0:c.msg),u||(u=e.UNKNOWN_ERROR),n.abrupt("return",new e.TransactionError(u||"Something went wrong",r,m));case 8:return n.abrupt("return",s);case 9:case"end":return n.stop()}}),n)})))).apply(this,arguments)}var k=function(e){return new Promise((function(n){return setTimeout(n,e)}))};function v(e,n){return e.getAccountKeys({accountKeysFromLookups:n}).keySegments().flat().reduce((function(e,n,t){return e.set(n.toBase58(),t),e}),new Map)}function A(e,n,t){if(e){var i=n.get(t.toBase58());if(void 0!==i)return function(e,n){var t,i,r,a,s=null==(t=n.postTokenBalances)||null==(i=t.find((function(n){return n.accountIndex===e})))?void 0:i.uiTokenAmount.amount,o=null==(r=n.preTokenBalances)||null==(a=r.find((function(n){return n.accountIndex===e})))?void 0:a.uiTokenAmount.amount;if(s)return Math.abs(parseInt(s)-(void 0!==o?parseInt(o):0))}(i,e)}}function x(e,n,t){var i=n.get(t.toBase58());return void 0!==i?Math.abs(e.postBalances[i]-e.preBalances[i]):0}function P(e){return T.apply(this,arguments)}function T(){return(T=o(a().mark((function n(t){var i,r,s,o,u,m,c,g,p,S,M,d,y;return a().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(i=t.txid,r=t.inputMint,s=t.outputMint,o=t.user,u=t.sourceAddress,m=t.destinationAddress,g=t.hasWrappedSOL,(c=t.transactionResponse)&&(d=c.transaction,(M=c.meta)&&(y=v(d.message,M.loadedAddresses),p=r.equals(l)&&!g?x(M,y,o):A(M,y,u),S=s.equals(l)&&!g?x(M,y,o):A(M,y,m))),p&&S){n.next=4;break}throw new e.TransactionError("Cannot find source or destination token account balance change",i,f.BalancesNotExtractedProperly.code);case 4:return n.abrupt("return",[p,S]);case 5:case"end":return n.stop()}}),n)})))).apply(this,arguments)}function b(){return(new Date).getTime()}var E={skipPreflight:!0,maxRetries:2};function L(e,n,t,i,r,a){return I.apply(this,arguments)}function I(){return(I=o(a().mark((function e(n,t,i,r,s,o){var u,m,c,g,p,S,l;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===i&&(i=12e4),void 0===r&&(r=500),void 0===s&&(s=2e3),void 0===o&&(o=40),u=t.serialize(),e.next=7,n.sendRawTransaction(u,E);case 7:m=e.sent,c=b(),g=b(),p=0;case 11:if(!(b()-c<i)){e.next=27;break}if(S=b(),!(p<o&&S-g>s)){e.next=18;break}return g=S,p+=1,e.next=18,n.sendRawTransaction(u,E);case 18:return e.next=20,Promise.any([n.getTransaction(m,{commitment:"confirmed",maxSupportedTransactionVersion:0}),k(5e3)]);case 20:if(!(l=e.sent)){e.next=23;break}return e.abrupt("return",{txid:m,transactionResponse:l});case 23:return e.next=25,k(r);case 25:e.next=11;break;case 27:return e.abrupt("return",{txid:m,transactionResponse:null});case 28:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function O(e){var n="signature"in e?e.signature:e.signatures[0];if(!n)throw new Error("Transaction has no signature");return t.bs58.encode(n)}function _(e,n){return"message"in e?e.sign(n):e.sign.apply(e,n),O(e)}var R=function(){var e=o(a().mark((function e(n){var t,i,r,s,u,m,c,g,p,S,l,M,d,f,y,w,k;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=n.connection,i=n.wallet,r=n.onTransaction,s=n.inputMint,u=n.outputMint,m=n.sourceAddress,c=n.destinationAddress,g=n.swapTransaction,p=n.owner,S=n.wrapUnwrapSOL,l=void 0,M=void 0,e.prev=3,!p.signer){e.next=8;break}_(g,[p.signer]),e.next=13;break;case 8:if(i){e.next=10;break}throw new Error("Signer wallet not found");case 10:return e.next=12,i.signTransaction(g);case 12:g=e.sent;case 13:return d=O(g),e.prev=14,f=function(){var e=o(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=h,e.next=3,L(t,g);case 3:return e.t1=e.sent,e.next=6,(0,e.t0)(e.t1);case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),y=f(),null==r||r(d,1,"SWAP",y),e.next=20,y;case 20:if(!((w=e.sent)instanceof Error)){e.next=23;break}throw w;case 23:return e.next=25,P({txid:d,inputMint:s,outputMint:u,user:p.publicKey,sourceAddress:m,destinationAddress:c,transactionResponse:w,hasWrappedSOL:!S});case 25:M={txid:d,inputAddress:m,outputAddress:c,inputAmount:(k=e.sent)[0],outputAmount:k[1]},e.next=35;break;case 31:e.prev=31,e.t0=e.catch(14),console.error(e.t0),l=e.t0;case 35:return e.prev=35,e.finish(35);case 37:if(!l&&M){e.next=39;break}throw l||new Error("Swap failed");case 39:return e.abrupt("return",M);case 42:return e.prev=42,e.t1=e.catch(3),e.abrupt("return",{error:e.t1});case 45:case"end":return e.stop()}}),e,null,[[3,42],[14,31,35,37]])})));return function(n){return e.apply(this,arguments)}}();function V(){return(V=o(a().mark((function n(t,r){var s;return a().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,t.getTokenAccountsByOwner(r,{programId:i.TOKEN_PROGRAM_ID});case 2:return s=n.sent.value.reduce((function(n,t){var i=e.deserializeAccount(t.account.data);return i&&n.set(i.mint.toBase58(),t.pubkey),n}),new Map),n.abrupt("return",s);case 5:case"end":return n.stop()}}),n)})))).apply(this,arguments)}var B=function(){function e(e){this._owner=void 0,this._owner=e}var n,t;return e.isKeyPair=function(e){return void 0!==e.secretKey},e.isPublicKey=function(n){return!e.isKeyPair(n)},n=e,(t=[{key:"publicKey",get:function(){return e.isKeyPair(this._owner)?this._owner.publicKey:this._owner}},{key:"signer",get:function(){return e.isKeyPair(this._owner)?this._owner:void 0}},{key:"isKeyPair",get:function(){return e.isKeyPair(this._owner)}},{key:"isPublicKey",get:function(){return e.isPublicKey(this._owner)}}])&&function(e,n){for(var t=0;t<n.length;t++){var i=n[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}(n.prototype,t),Object.defineProperty(n,"prototype",{writable:!1}),e}();function D(e,n){var t=n.get(e);return void 0===t&&n.set(e,t=n.size),t}function j(e){var n=function(n){return e.mintKeys[n]},t=new Map;return Object.keys(e.indexedRouteMap).forEach((function(i){t.set(n(i),e.indexedRouteMap[i].map((function(e){return n(e)})))})),t}function U(){return(U=o(a().mark((function e(n,t){var i,r,s;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=n.restrictIntermediateTokens,r=n.asLegacyTransaction,s=t||M,n.onlyDirectRoutes?s=s.concat("?onlyDirectRoutes=true"):i&&(s=s.concat("?restrictIntermediateTokens=true")),r&&(s=s.concat("?asLegacyTransaction=true")),e.next=6,fetch(s);case 6:return e.next=8,e.sent.json();case 8:return e.abrupt("return",j(e.sent));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var K,F=function(){function e(e,n,t){this.connection=void 0,this.feePayer=void 0,this.instructions=void 0,this.owner=void 0,this.connection=e,this.feePayer=n,this.instructions=[],this.owner=t}var t=e.prototype;return t.addInstruction=function(e){return this.instructions.push(e),this},t.build=function(){var e=o(a().mark((function e(t,i,r){var s,m,c,g,p,S,l=this;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=[],m=[],c=[],g=[],this.instructions.forEach((function(e){m=m.concat(e.setupInstructions),s=s.concat(e.instructions),c=c.concat(e.cleanupInstructions),g=g.concat(e.signers)})),p=m.concat(s).concat(c),S=r?this.buildLegacyTransaction({transactionInstructions:p,blockhashWithExpiryBlockHeight:t}):this.buildVersionedTransaction({transactionInstructions:p,blockhashWithExpiryBlockHeight:t,addressLookupTables:i}),e.abrupt("return",{transaction:S,signers:g,execute:this.owner.isKeyPair?function(){var e=_(S,[l.owner.signer].concat(g)),i=S.serialize();return n.sendAndConfirmRawTransaction(l.connection,Buffer.from(i),u({signature:e},t))}:o(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Error("Please use a Keypair for the owner parameter to enable the execute function");case 1:case"end":return e.stop()}}),e)})))});case 8:case"end":return e.stop()}}),e,this)})));return function(n,t,i){return e.apply(this,arguments)}}(),t.buildLegacyTransaction=function(e){var t,i=e.transactionInstructions;return(t=new n.Transaction(u({feePayer:this.feePayer},e.blockhashWithExpiryBlockHeight))).add.apply(t,i)},t.buildVersionedTransaction=function(e){var t=e.addressLookupTables,i=new n.TransactionMessage({payerKey:this.feePayer,instructions:e.transactionInstructions,recentBlockhash:e.blockhashWithExpiryBlockHeight.blockhash}).compileToV0Message(t);return new n.VersionedTransaction(i)},e}();exports.SwapMode=void 0,(K=exports.SwapMode||(exports.SwapMode={})).ExactIn="ExactIn",K.ExactOut="ExactOut",exports.IDL=r,exports.INDEXED_ROUTE_MAP_URL=M,exports.JUPITER_ERRORS=f,exports.JUPITER_FEE_OWNER=d,exports.JUPITER_PROGRAM_ID=S,exports.JUPITER_PROGRAM_ID_DEVNET=c,exports.JUPITER_PROGRAM_ID_PRODUCTION=p,exports.JUPITER_PROGRAM_ID_STAGING=g,exports.LAMPORTS_PER_SIGNATURE=5e3,exports.MARKETS_URL={devnet:"https://jupiter-devnet.zhen8558.workers.dev/markets?v=3","mainnet-beta":"https://cache.jup.ag/markets?v=3",testnet:"https://api.jup.ag/api/markets/cache/devnet"},exports.Owner=B,exports.TOKEN_LIST_URL={devnet:"https://api.jup.ag/api/tokens/devnet",testnet:"https://api.jup.ag/api/markets/devnet","mainnet-beta":"https://cache.jup.ag/tokens"},exports.TransactionBuilder=F,exports.WRAPPED_SOL_MINT=l,exports.executeTransaction=R,exports.extractSOLChangeFromTransaction=x,exports.extractTokenBalanceChangeFromTransaction=A,exports.getEmptyInstruction=function(){return{setupInstructions:[],instructions:[],cleanupInstructions:[],signers:[]}},exports.getPlatformFeeAccounts=function(e,n){return V.apply(this,arguments)},exports.getRemoteRouteMap=function(e,n){return U.apply(this,arguments)},exports.getSignature=O,exports.getTokenBalanceChangesFromTransactionResponse=P,exports.getUnixTs=b,exports.indexedRouteMapToRouteMap=j,exports.routeMapToIndexedRouteMap=function(e){var n=Array.from(e).reduce((function(e,n){for(var t,i=e.mintToIndexMap,r=e.indexedRouteMap,a=n[1],s=D(n[0],i),o=[],u=function(e,n){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(t)return(t=t.call(e)).next.bind(t);if(Array.isArray(e)||(t=function(e,n){if(e){if("string"==typeof e)return m(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?m(e,n):void 0}}(e))){t&&(e=t);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(a);!(t=u()).done;){var c=D(t.value,i);o.push(c)}return r[s]=o,{mintToIndexMap:i,indexedRouteMap:r}}),{mintToIndexMap:new Map,indexedRouteMap:{}}),t=n.indexedRouteMap;return{mintKeys:Array.from(n.mintToIndexMap.keys()),indexedRouteMap:t}},exports.signTransaction=_,exports.transactionSenderAndConfirmationWaiter=L,exports.validateTransactionResponse=h,exports.wait=k;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@mercurial-finance/optimist"),n=require("@project-serum/anchor"),t=require("@solana/web3.js"),i=require("@project-serum/anchor/dist/cjs/utils/bytes"),r=require("@solana/spl-token");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=s(require("jsbi")),o={version:"0.1.0",name:"jupiter",instructions:[{name:"route",accounts:[{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"userTransferAuthority",isMut:!1,isSigner:!0},{name:"destinationTokenAccount",isMut:!1,isSigner:!1}],args:[{name:"swapLeg",type:{defined:"SwapLeg"}},{name:"inAmount",type:"u64"},{name:"quotedOutAmount",type:"u64"},{name:"slippageBps",type:"u16"},{name:"platformFeeBps",type:"u8"}]},{name:"whirlpoolSwapExactOutput",accounts:[{name:"swapProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"tokenAuthority",isMut:!1,isSigner:!0},{name:"whirlpool",isMut:!0,isSigner:!1},{name:"tokenOwnerAccountA",isMut:!0,isSigner:!1},{name:"tokenVaultA",isMut:!0,isSigner:!1},{name:"tokenOwnerAccountB",isMut:!0,isSigner:!1},{name:"tokenVaultB",isMut:!0,isSigner:!1},{name:"tickArray0",isMut:!0,isSigner:!1},{name:"tickArray1",isMut:!0,isSigner:!1},{name:"tickArray2",isMut:!0,isSigner:!1},{name:"oracle",isMut:!1,isSigner:!1}],args:[{name:"outAmount",type:"u64"},{name:"inAmountWithSlippage",type:{defined:"AmountWithSlippage"}},{name:"aToB",type:"bool"},{name:"platformFeeBps",type:"u8"}]},{name:"raydiumSwapExactOutput",accounts:[{name:"swapProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"ammId",isMut:!0,isSigner:!1},{name:"ammAuthority",isMut:!1,isSigner:!1},{name:"ammOpenOrders",isMut:!0,isSigner:!1},{name:"poolCoinTokenAccount",isMut:!0,isSigner:!1},{name:"poolPcTokenAccount",isMut:!0,isSigner:!1},{name:"serumProgramId",isMut:!1,isSigner:!1},{name:"serumMarket",isMut:!0,isSigner:!1},{name:"serumBids",isMut:!0,isSigner:!1},{name:"serumAsks",isMut:!0,isSigner:!1},{name:"serumEventQueue",isMut:!0,isSigner:!1},{name:"serumCoinVaultAccount",isMut:!0,isSigner:!1},{name:"serumPcVaultAccount",isMut:!0,isSigner:!1},{name:"serumVaultSigner",isMut:!1,isSigner:!1},{name:"userSourceTokenAccount",isMut:!0,isSigner:!1},{name:"userDestinationTokenAccount",isMut:!0,isSigner:!1},{name:"userSourceOwner",isMut:!1,isSigner:!0}],args:[{name:"outAmount",type:"u64"},{name:"inAmountWithSlippage",type:{defined:"AmountWithSlippage"}},{name:"platformFeeBps",type:"u8"}]},{name:"raydiumClmmSwapExactOutput",accounts:[{name:"swapProgram",isMut:!1,isSigner:!1},{name:"payer",isMut:!1,isSigner:!0},{name:"ammConfig",isMut:!1,isSigner:!1},{name:"poolState",isMut:!0,isSigner:!1},{name:"inputTokenAccount",isMut:!0,isSigner:!1},{name:"outputTokenAccount",isMut:!0,isSigner:!1},{name:"inputVault",isMut:!0,isSigner:!1},{name:"outputVault",isMut:!0,isSigner:!1},{name:"observationState",isMut:!0,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"tickArray",isMut:!0,isSigner:!1}],args:[{name:"outAmount",type:"u64"},{name:"inAmountWithSlippage",type:{defined:"AmountWithSlippage"}},{name:"platformFeeBps",type:"u8"}]},{name:"createOpenOrders",accounts:[{name:"openOrders",isMut:!0,isSigner:!1},{name:"payer",isMut:!0,isSigner:!0},{name:"dexProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1},{name:"market",isMut:!1,isSigner:!1}],args:[]},{name:"mercurialSwap",accounts:[{name:"swapProgram",isMut:!1,isSigner:!1},{name:"swapState",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"poolAuthority",isMut:!1,isSigner:!1},{name:"userTransferAuthority",isMut:!1,isSigner:!0},{name:"sourceTokenAccount",isMut:!0,isSigner:!1},{name:"destinationTokenAccount",isMut:!0,isSigner:!1}],args:[]},{name:"cykuraSwap",accounts:[{name:"swapProgram",isMut:!1,isSigner:!1},{name:"signer",isMut:!1,isSigner:!0},{name:"factoryState",isMut:!1,isSigner:!1},{name:"poolState",isMut:!0,isSigner:!1},{name:"inputTokenAccount",isMut:!0,isSigner:!1},{name:"outputTokenAccount",isMut:!0,isSigner:!1},{name:"inputVault",isMut:!0,isSigner:!1},{name:"outputVault",isMut:!0,isSigner:!1},{name:"lastObservationState",isMut:!0,isSigner:!1},{name:"coreProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1}],args:[]},{name:"serumSwap",accounts:[{name:"market",accounts:[{name:"market",isMut:!0,isSigner:!1},{name:"openOrders",isMut:!0,isSigner:!1},{name:"requestQueue",isMut:!0,isSigner:!1},{name:"eventQueue",isMut:!0,isSigner:!1},{name:"bids",isMut:!0,isSigner:!1},{name:"asks",isMut:!0,isSigner:!1},{name:"coinVault",isMut:!0,isSigner:!1},{name:"pcVault",isMut:!0,isSigner:!1},{name:"vaultSigner",isMut:!1,isSigner:!1}]},{name:"authority",isMut:!1,isSigner:!0},{name:"orderPayerTokenAccount",isMut:!0,isSigner:!1},{name:"coinWallet",isMut:!0,isSigner:!1},{name:"pcWallet",isMut:!0,isSigner:!1},{name:"dexProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1}],args:[]},{name:"saberSwap",accounts:[{name:"swapProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"swap",isMut:!1,isSigner:!1},{name:"swapAuthority",isMut:!1,isSigner:!1},{name:"userAuthority",isMut:!1,isSigner:!1},{name:"inputUserAccount",isMut:!0,isSigner:!1},{name:"inputTokenAccount",isMut:!0,isSigner:!1},{name:"outputUserAccount",isMut:!0,isSigner:!1},{name:"outputTokenAccount",isMut:!0,isSigner:!1},{name:"feesTokenAccount",isMut:!0,isSigner:!1}],args:[]},{name:"saberAddDecimals",accounts:[{name:"addDecimalsProgram",isMut:!1,isSigner:!1},{name:"wrapper",isMut:!1,isSigner:!1},{name:"wrapperMint",isMut:!0,isSigner:!1},{name:"wrapperUnderlyingTokens",isMut:!0,isSigner:!1},{name:"owner",isMut:!1,isSigner:!0},{name:"userUnderlyingTokens",isMut:!0,isSigner:!1},{name:"userWrappedTokens",isMut:!0,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1}],args:[]},{name:"tokenSwap",accounts:[{name:"tokenSwapProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"swap",isMut:!1,isSigner:!1},{name:"authority",isMut:!1,isSigner:!1},{name:"userTransferAuthority",isMut:!1,isSigner:!0},{name:"source",isMut:!0,isSigner:!1},{name:"swapSource",isMut:!0,isSigner:!1},{name:"swapDestination",isMut:!0,isSigner:!1},{name:"destination",isMut:!0,isSigner:!1},{name:"poolMint",isMut:!0,isSigner:!1},{name:"poolFee",isMut:!0,isSigner:!1}],args:[]},{name:"senchaSwap",accounts:[{name:"swapProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"swap",isMut:!0,isSigner:!1},{name:"userAuthority",isMut:!1,isSigner:!1},{name:"inputUserAccount",isMut:!0,isSigner:!1},{name:"inputTokenAccount",isMut:!0,isSigner:!1},{name:"inputFeesAccount",isMut:!0,isSigner:!1},{name:"outputUserAccount",isMut:!0,isSigner:!1},{name:"outputTokenAccount",isMut:!0,isSigner:!1},{name:"outputFeesAccount",isMut:!0,isSigner:!1}],args:[]},{name:"stepSwap",accounts:[{name:"tokenSwapProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"swap",isMut:!1,isSigner:!1},{name:"authority",isMut:!1,isSigner:!1},{name:"userTransferAuthority",isMut:!1,isSigner:!0},{name:"source",isMut:!0,isSigner:!1},{name:"swapSource",isMut:!0,isSigner:!1},{name:"swapDestination",isMut:!0,isSigner:!1},{name:"destination",isMut:!0,isSigner:!1},{name:"poolMint",isMut:!0,isSigner:!1},{name:"poolFee",isMut:!0,isSigner:!1}],args:[]},{name:"cropperSwap",accounts:[{name:"tokenSwapProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"swap",isMut:!1,isSigner:!1},{name:"swapState",isMut:!1,isSigner:!1},{name:"authority",isMut:!1,isSigner:!1},{name:"userTransferAuthority",isMut:!1,isSigner:!0},{name:"source",isMut:!0,isSigner:!1},{name:"swapSource",isMut:!0,isSigner:!1},{name:"swapDestination",isMut:!0,isSigner:!1},{name:"destination",isMut:!0,isSigner:!1},{name:"poolMint",isMut:!0,isSigner:!1},{name:"poolFee",isMut:!0,isSigner:!1}],args:[]},{name:"raydiumSwap",accounts:[{name:"swapProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"ammId",isMut:!0,isSigner:!1},{name:"ammAuthority",isMut:!1,isSigner:!1},{name:"ammOpenOrders",isMut:!0,isSigner:!1},{name:"poolCoinTokenAccount",isMut:!0,isSigner:!1},{name:"poolPcTokenAccount",isMut:!0,isSigner:!1},{name:"serumProgramId",isMut:!1,isSigner:!1},{name:"serumMarket",isMut:!0,isSigner:!1},{name:"serumBids",isMut:!0,isSigner:!1},{name:"serumAsks",isMut:!0,isSigner:!1},{name:"serumEventQueue",isMut:!0,isSigner:!1},{name:"serumCoinVaultAccount",isMut:!0,isSigner:!1},{name:"serumPcVaultAccount",isMut:!0,isSigner:!1},{name:"serumVaultSigner",isMut:!1,isSigner:!1},{name:"userSourceTokenAccount",isMut:!0,isSigner:!1},{name:"userDestinationTokenAccount",isMut:!0,isSigner:!1},{name:"userSourceOwner",isMut:!1,isSigner:!0}],args:[]},{name:"cremaSwap",accounts:[{name:"swapProgram",isMut:!1,isSigner:!1},{name:"clmmConfig",isMut:!1,isSigner:!1},{name:"clmmpool",isMut:!0,isSigner:!1},{name:"tokenA",isMut:!1,isSigner:!1},{name:"tokenB",isMut:!1,isSigner:!1},{name:"accountA",isMut:!0,isSigner:!1},{name:"accountB",isMut:!0,isSigner:!1},{name:"tokenAVault",isMut:!0,isSigner:!1},{name:"tokenBVault",isMut:!0,isSigner:!1},{name:"tickArrayMap",isMut:!0,isSigner:!1},{name:"owner",isMut:!1,isSigner:!0},{name:"partner",isMut:!1,isSigner:!1},{name:"partnerAtaA",isMut:!0,isSigner:!1},{name:"partnerAtaB",isMut:!0,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1}],args:[]},{name:"lifinitySwap",accounts:[{name:"swapProgram",isMut:!1,isSigner:!1},{name:"authority",isMut:!1,isSigner:!1},{name:"amm",isMut:!1,isSigner:!1},{name:"userTransferAuthority",isMut:!1,isSigner:!0},{name:"sourceInfo",isMut:!0,isSigner:!1},{name:"destinationInfo",isMut:!0,isSigner:!1},{name:"swapSource",isMut:!0,isSigner:!1},{name:"swapDestination",isMut:!0,isSigner:!1},{name:"poolMint",isMut:!0,isSigner:!1},{name:"feeAccount",isMut:!0,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"pythAccount",isMut:!1,isSigner:!1},{name:"pythPcAccount",isMut:!1,isSigner:!1},{name:"configAccount",isMut:!0,isSigner:!1}],args:[]},{name:"marinadeDeposit",accounts:[{name:"marinadeFinanceProgram",isMut:!1,isSigner:!1},{name:"state",isMut:!0,isSigner:!1},{name:"msolMint",isMut:!0,isSigner:!1},{name:"liqPoolSolLegPda",isMut:!0,isSigner:!1},{name:"liqPoolMsolLeg",isMut:!0,isSigner:!1},{name:"liqPoolMsolLegAuthority",isMut:!1,isSigner:!1},{name:"reservePda",isMut:!0,isSigner:!1},{name:"transferFrom",isMut:!0,isSigner:!1},{name:"mintTo",isMut:!0,isSigner:!1},{name:"msolMintAuthority",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"userWsolTokenAccount",isMut:!0,isSigner:!1},{name:"tempWsolTokenAccount",isMut:!0,isSigner:!1},{name:"userTransferAuthority",isMut:!0,isSigner:!0},{name:"wsolMint",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1}],args:[]},{name:"marinadeUnstake",accounts:[{name:"marinadeFinanceProgram",isMut:!1,isSigner:!1},{name:"state",isMut:!0,isSigner:!1},{name:"msolMint",isMut:!0,isSigner:!1},{name:"liqPoolSolLegPda",isMut:!0,isSigner:!1},{name:"liqPoolMsolLeg",isMut:!0,isSigner:!1},{name:"treasuryMsolAccount",isMut:!0,isSigner:!1},{name:"getMsolFrom",isMut:!0,isSigner:!1},{name:"getMsolFromAuthority",isMut:!1,isSigner:!0},{name:"transferSolTo",isMut:!0,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"userWsolTokenAccount",isMut:!0,isSigner:!1}],args:[]},{name:"aldrinSwap",accounts:[{name:"swapProgram",isMut:!1,isSigner:!1},{name:"pool",isMut:!1,isSigner:!1},{name:"poolSigner",isMut:!1,isSigner:!1},{name:"poolMint",isMut:!0,isSigner:!1},{name:"baseTokenVault",isMut:!0,isSigner:!1},{name:"quoteTokenVault",isMut:!0,isSigner:!1},{name:"feePoolTokenAccount",isMut:!0,isSigner:!1},{name:"walletAuthority",isMut:!1,isSigner:!0},{name:"userBaseTokenAccount",isMut:!0,isSigner:!1},{name:"userQuoteTokenAccount",isMut:!0,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1}],args:[]},{name:"aldrinV2Swap",accounts:[{name:"swapProgram",isMut:!1,isSigner:!1},{name:"pool",isMut:!1,isSigner:!1},{name:"poolSigner",isMut:!1,isSigner:!1},{name:"poolMint",isMut:!0,isSigner:!1},{name:"baseTokenVault",isMut:!0,isSigner:!1},{name:"quoteTokenVault",isMut:!0,isSigner:!1},{name:"feePoolTokenAccount",isMut:!0,isSigner:!1},{name:"walletAuthority",isMut:!1,isSigner:!0},{name:"userBaseTokenAccount",isMut:!0,isSigner:!1},{name:"userQuoteTokenAccount",isMut:!0,isSigner:!1},{name:"curve",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1}],args:[]},{name:"whirlpoolSwap",accounts:[{name:"swapProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"tokenAuthority",isMut:!1,isSigner:!0},{name:"whirlpool",isMut:!0,isSigner:!1},{name:"tokenOwnerAccountA",isMut:!0,isSigner:!1},{name:"tokenVaultA",isMut:!0,isSigner:!1},{name:"tokenOwnerAccountB",isMut:!0,isSigner:!1},{name:"tokenVaultB",isMut:!0,isSigner:!1},{name:"tickArray0",isMut:!0,isSigner:!1},{name:"tickArray1",isMut:!0,isSigner:!1},{name:"tickArray2",isMut:!0,isSigner:!1},{name:"oracle",isMut:!1,isSigner:!1}],args:[]},{name:"invariantSwap",accounts:[{name:"swapProgram",isMut:!1,isSigner:!1},{name:"state",isMut:!1,isSigner:!1},{name:"pool",isMut:!0,isSigner:!1},{name:"tickmap",isMut:!0,isSigner:!1},{name:"accountX",isMut:!0,isSigner:!1},{name:"accountY",isMut:!0,isSigner:!1},{name:"reserveX",isMut:!0,isSigner:!1},{name:"reserveY",isMut:!0,isSigner:!1},{name:"owner",isMut:!1,isSigner:!0},{name:"programAuthority",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1}],args:[]},{name:"meteoraSwap",accounts:[{name:"swapProgram",isMut:!1,isSigner:!1},{name:"pool",isMut:!0,isSigner:!1},{name:"userSourceToken",isMut:!0,isSigner:!1},{name:"userDestinationToken",isMut:!0,isSigner:!1},{name:"aVault",isMut:!0,isSigner:!1},{name:"bVault",isMut:!0,isSigner:!1},{name:"aTokenVault",isMut:!0,isSigner:!1},{name:"bTokenVault",isMut:!0,isSigner:!1},{name:"aVaultLpMint",isMut:!0,isSigner:!1},{name:"bVaultLpMint",isMut:!0,isSigner:!1},{name:"aVaultLp",isMut:!0,isSigner:!1},{name:"bVaultLp",isMut:!0,isSigner:!1},{name:"adminTokenFee",isMut:!0,isSigner:!1},{name:"user",isMut:!1,isSigner:!0},{name:"vaultProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1}],args:[]},{name:"goosefxSwap",accounts:[{name:"swapProgram",isMut:!1,isSigner:!1},{name:"controller",isMut:!1,isSigner:!1},{name:"pair",isMut:!0,isSigner:!1},{name:"sslIn",isMut:!0,isSigner:!1},{name:"sslOut",isMut:!0,isSigner:!1},{name:"liabilityVaultIn",isMut:!0,isSigner:!1},{name:"swappedLiabilityVaultIn",isMut:!0,isSigner:!1},{name:"liabilityVaultOut",isMut:!0,isSigner:!1},{name:"swappedLiabilityVaultOut",isMut:!0,isSigner:!1},{name:"userInAta",isMut:!0,isSigner:!1},{name:"userOutAta",isMut:!0,isSigner:!1},{name:"feeCollectorAta",isMut:!0,isSigner:!1},{name:"userWallet",isMut:!1,isSigner:!0},{name:"feeCollector",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1}],args:[]},{name:"deltafiSwap",accounts:[{name:"swapProgram",isMut:!1,isSigner:!1},{name:"marketConfig",isMut:!1,isSigner:!1},{name:"swapInfo",isMut:!0,isSigner:!1},{name:"userSourceToken",isMut:!0,isSigner:!1},{name:"userDestinationToken",isMut:!0,isSigner:!1},{name:"swapSourceToken",isMut:!0,isSigner:!1},{name:"swapDestinationToken",isMut:!0,isSigner:!1},{name:"deltafiUser",isMut:!0,isSigner:!1},{name:"adminDestinationToken",isMut:!0,isSigner:!1},{name:"pythPriceBase",isMut:!1,isSigner:!1},{name:"pythPriceQuote",isMut:!1,isSigner:!1},{name:"userAuthority",isMut:!1,isSigner:!0},{name:"tokenProgram",isMut:!1,isSigner:!1}],args:[]},{name:"balansolSwap",accounts:[{name:"swapProgram",isMut:!1,isSigner:!1},{name:"authority",isMut:!0,isSigner:!0},{name:"pool",isMut:!0,isSigner:!1},{name:"taxMan",isMut:!0,isSigner:!1},{name:"bidMint",isMut:!1,isSigner:!1},{name:"treasurer",isMut:!1,isSigner:!1},{name:"srcTreasury",isMut:!0,isSigner:!1},{name:"srcAssociatedTokenAccount",isMut:!0,isSigner:!1},{name:"askMint",isMut:!1,isSigner:!1},{name:"dstTreasury",isMut:!0,isSigner:!1},{name:"dstAssociatedTokenAccount",isMut:!0,isSigner:!1},{name:"dstTokenAccountTaxman",isMut:!0,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"associatedTokenProgram",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1}],args:[]},{name:"marcoPoloSwap",accounts:[{name:"swapProgram",isMut:!1,isSigner:!1},{name:"state",isMut:!1,isSigner:!1},{name:"pool",isMut:!0,isSigner:!1},{name:"tokenX",isMut:!1,isSigner:!1},{name:"tokenY",isMut:!1,isSigner:!1},{name:"poolXAccount",isMut:!0,isSigner:!1},{name:"poolYAccount",isMut:!0,isSigner:!1},{name:"swapperXAccount",isMut:!0,isSigner:!1},{name:"swapperYAccount",isMut:!0,isSigner:!1},{name:"swapper",isMut:!0,isSigner:!0},{name:"referrerXAccount",isMut:!0,isSigner:!1},{name:"referrerYAccount",isMut:!0,isSigner:!1},{name:"referrer",isMut:!0,isSigner:!1},{name:"programAuthority",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"associatedTokenProgram",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1}],args:[]},{name:"dradexSwap",accounts:[{name:"swapProgram",isMut:!1,isSigner:!1},{name:"pair",isMut:!0,isSigner:!1},{name:"market",isMut:!0,isSigner:!1},{name:"eventQueue",isMut:!0,isSigner:!1},{name:"dexUser",isMut:!1,isSigner:!1},{name:"marketUser",isMut:!0,isSigner:!1},{name:"bids",isMut:!0,isSigner:!1},{name:"asks",isMut:!0,isSigner:!1},{name:"t0Vault",isMut:!0,isSigner:!1},{name:"t1Vault",isMut:!0,isSigner:!1},{name:"t0User",isMut:!0,isSigner:!1},{name:"t1User",isMut:!0,isSigner:!1},{name:"master",isMut:!1,isSigner:!1},{name:"signer",isMut:!0,isSigner:!0},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"logger",isMut:!1,isSigner:!1}],args:[]},{name:"lifinityV2Swap",accounts:[{name:"swapProgram",isMut:!1,isSigner:!1},{name:"authority",isMut:!1,isSigner:!1},{name:"amm",isMut:!0,isSigner:!1},{name:"userTransferAuthority",isMut:!1,isSigner:!0},{name:"sourceInfo",isMut:!0,isSigner:!1},{name:"destinationInfo",isMut:!0,isSigner:!1},{name:"swapSource",isMut:!0,isSigner:!1},{name:"swapDestination",isMut:!0,isSigner:!1},{name:"poolMint",isMut:!0,isSigner:!1},{name:"feeAccount",isMut:!0,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"oracleMainAccount",isMut:!1,isSigner:!1},{name:"oracleSubAccount",isMut:!1,isSigner:!1},{name:"oraclePcAccount",isMut:!1,isSigner:!1}],args:[]},{name:"raydiumClmmSwap",accounts:[{name:"swapProgram",isMut:!1,isSigner:!1},{name:"payer",isMut:!1,isSigner:!0},{name:"ammConfig",isMut:!1,isSigner:!1},{name:"poolState",isMut:!0,isSigner:!1},{name:"inputTokenAccount",isMut:!0,isSigner:!1},{name:"outputTokenAccount",isMut:!0,isSigner:!1},{name:"inputVault",isMut:!0,isSigner:!1},{name:"outputVault",isMut:!0,isSigner:!1},{name:"observationState",isMut:!0,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"tickArray",isMut:!0,isSigner:!1}],args:[]},{name:"phoenixSwap",accounts:[{name:"swapProgram",isMut:!1,isSigner:!1},{name:"logAuthority",isMut:!1,isSigner:!1},{name:"market",isMut:!0,isSigner:!1},{name:"trader",isMut:!1,isSigner:!0},{name:"baseAccount",isMut:!0,isSigner:!1},{name:"quoteAccount",isMut:!0,isSigner:!1},{name:"baseVault",isMut:!0,isSigner:!1},{name:"quoteVault",isMut:!0,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1}],args:[]}],types:[{name:"AmountWithSlippage",type:{kind:"struct",fields:[{name:"amount",type:"u64"},{name:"slippageBps",type:"u16"}]}},{name:"SplitLegDeeper",type:{kind:"struct",fields:[{name:"percent",type:"u8"},{name:"swapLeg",type:{defined:"SwapLegSwap"}}]}},{name:"SplitLeg",type:{kind:"struct",fields:[{name:"percent",type:"u8"},{name:"swapLeg",type:{defined:"SwapLegDeeper"}}]}},{name:"SwapInstrution",type:{kind:"enum",variants:[{name:"Swap",fields:[{defined:"Swap"}]}]}},{name:"Side",type:{kind:"enum",variants:[{name:"Bid"},{name:"Ask"}]}},{name:"SwapLegSwap",type:{kind:"enum",variants:[{name:"PlaceholderOne"},{name:"PlaceholderTwo"},{name:"Swap",fields:[{name:"swap",type:{defined:"Swap"}}]}]}},{name:"SwapLegDeeper",type:{kind:"enum",variants:[{name:"Chain",fields:[{name:"swap_legs",type:{vec:{defined:"SwapLegSwap"}}}]},{name:"Split",fields:[{name:"split_legs",type:{vec:{defined:"SplitLegDeeper"}}}]},{name:"Swap",fields:[{name:"swap",type:{defined:"Swap"}}]}]}},{name:"SwapLeg",type:{kind:"enum",variants:[{name:"Chain",fields:[{name:"swap_legs",type:{vec:{defined:"SwapLegDeeper"}}}]},{name:"Split",fields:[{name:"split_legs",type:{vec:{defined:"SplitLeg"}}}]},{name:"Swap",fields:[{name:"swap",type:{defined:"Swap"}}]}]}},{name:"Swap",type:{kind:"enum",variants:[{name:"Saber"},{name:"SaberAddDecimalsDeposit"},{name:"SaberAddDecimalsWithdraw"},{name:"TokenSwap"},{name:"Sencha"},{name:"Step"},{name:"Cropper"},{name:"Raydium"},{name:"Crema",fields:[{name:"a_to_b",type:"bool"}]},{name:"Lifinity"},{name:"Mercurial"},{name:"Cykura"},{name:"Serum",fields:[{name:"side",type:{defined:"Side"}}]},{name:"MarinadeDeposit"},{name:"MarinadeUnstake"},{name:"Aldrin",fields:[{name:"side",type:{defined:"Side"}}]},{name:"AldrinV2",fields:[{name:"side",type:{defined:"Side"}}]},{name:"Whirlpool",fields:[{name:"a_to_b",type:"bool"}]},{name:"Invariant",fields:[{name:"x_to_y",type:"bool"}]},{name:"Meteora"},{name:"GooseFX"},{name:"DeltaFi",fields:[{name:"stable",type:"bool"}]},{name:"Balansol"},{name:"MarcoPolo",fields:[{name:"x_to_y",type:"bool"}]},{name:"Dradex",fields:[{name:"side",type:{defined:"Side"}}]},{name:"LifinityV2"},{name:"RaydiumClmm"},{name:"Openbook",fields:[{name:"side",type:{defined:"Side"}}]},{name:"Phoenix",fields:[{name:"side",type:{defined:"Side"}}]}]}},{name:"SwapAction",type:{kind:"enum",variants:[{name:"SetupSplit",fields:[{name:"percents",type:"bytes"}]},{name:"NextSplitLeg"},{name:"MergeSplit"},{name:"Swap",fields:[{name:"swap",type:{defined:"Swap"}}]}]}}],events:[{name:"Swap",fields:[{name:"amm",type:"publicKey",index:!1},{name:"inputMint",type:"publicKey",index:!1},{name:"inputAmount",type:"u64",index:!1},{name:"outputMint",type:"publicKey",index:!1},{name:"outputAmount",type:"u64",index:!1}]},{name:"Fee",fields:[{name:"account",type:"publicKey",index:!1},{name:"mint",type:"publicKey",index:!1},{name:"amount",type:"u64",index:!1}]}],errors:[{code:6e3,name:"EmptyRoute",msg:"Empty route"},{code:6001,name:"SlippageToleranceExceeded",msg:"Slippage tolerance exceeded"},{code:6002,name:"InvalidCalculation",msg:"Invalid calculation"},{code:6003,name:"MissingPlatformFeeAccount",msg:"Missing platform fee account"},{code:6004,name:"InvalidSlippage",msg:"Invalid slippage"},{code:6005,name:"NotEnoughPercent",msg:"Not enough percent to 100"},{code:6006,name:"InAmountsStackIsEmpty",msg:"In amounts stack is empty"},{code:6007,name:"OutAmountsStackIsEmpty",msg:"Out amounts stack is empty"},{code:6008,name:"NotEnoughAccountKeys",msg:"Not Enough Account keys"}]};function u(){u=function(){return e};var e={},n=Object.prototype,t=n.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},r=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",a=i.toStringTag||"@@toStringTag";function o(e,n,t){return Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}),e[n]}try{o({},"")}catch(e){o=function(e,n,t){return e[n]=t}}function c(e,n,t,i){var r=Object.create((n&&n.prototype instanceof g?n:g).prototype),s=new b(i||[]);return r._invoke=function(e,n,t){var i="suspendedStart";return function(r,s){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw s;return{value:void 0,done:!0}}for(t.method=r,t.arg=s;;){var a=t.delegate;if(a){var o=A(a,t);if(o){if(o===p)continue;return o}}if("next"===t.method)t.sent=t._sent=t.arg;else if("throw"===t.method){if("suspendedStart"===i)throw i="completed",t.arg;t.dispatchException(t.arg)}else"return"===t.method&&t.abrupt("return",t.arg);i="executing";var u=m(e,n,t);if("normal"===u.type){if(i=t.done?"completed":"suspendedYield",u.arg===p)continue;return{value:u.arg,done:t.done}}"throw"===u.type&&(i="completed",t.method="throw",t.arg=u.arg)}}}(e,t,s),r}function m(e,n,t){try{return{type:"normal",arg:e.call(n,t)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var p={};function g(){}function l(){}function S(){}var M={};o(M,r,(function(){return this}));var d=Object.getPrototypeOf,f=d&&d(d(x([])));f&&f!==n&&t.call(f,r)&&(M=f);var y=S.prototype=g.prototype=Object.create(M);function h(e){["next","throw","return"].forEach((function(n){o(e,n,(function(e){return this._invoke(n,e)}))}))}function w(e,n){function i(r,s,a,o){var u=m(e[r],e,s);if("throw"!==u.type){var c=u.arg,p=c.value;return p&&"object"==typeof p&&t.call(p,"__await")?n.resolve(p.__await).then((function(e){i("next",e,a,o)}),(function(e){i("throw",e,a,o)})):n.resolve(p).then((function(e){c.value=e,a(c)}),(function(e){return i("throw",e,a,o)}))}o(u.arg)}var r;this._invoke=function(e,t){function s(){return new n((function(n,r){i(e,t,n,r)}))}return r=r?r.then(s,s):s()}}function A(e,n){var t=e.iterator[n.method];if(void 0===t){if(n.delegate=null,"throw"===n.method){if(e.iterator.return&&(n.method="return",n.arg=void 0,A(e,n),"throw"===n.method))return p;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return p}var i=m(t,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,p;var r=i.arg;return r?r.done?(n[e.resultName]=r.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,p):r:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,p)}function P(e){var n={tryLoc:e[0]};1 in e&&(n.catchLoc=e[1]),2 in e&&(n.finallyLoc=e[2],n.afterLoc=e[3]),this.tryEntries.push(n)}function k(e){var n=e.completion||{};n.type="normal",delete n.arg,e.completion=n}function b(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function x(e){if(e){var n=e[r];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,s=function n(){for(;++i<e.length;)if(t.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=void 0,n.done=!0,n};return s.next=s}}return{next:v}}function v(){return{value:void 0,done:!0}}return l.prototype=S,o(y,"constructor",S),o(S,"constructor",l),l.displayName=o(S,a,"GeneratorFunction"),e.isGeneratorFunction=function(e){var n="function"==typeof e&&e.constructor;return!!n&&(n===l||"GeneratorFunction"===(n.displayName||n.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,S):(e.__proto__=S,o(e,a,"GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},h(w.prototype),o(w.prototype,s,(function(){return this})),e.AsyncIterator=w,e.async=function(n,t,i,r,s){void 0===s&&(s=Promise);var a=new w(c(n,t,i,r),s);return e.isGeneratorFunction(t)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},h(y),o(y,a,"Generator"),o(y,r,(function(){return this})),o(y,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var n=[];for(var t in e)n.push(t);return n.reverse(),function t(){for(;n.length;){var i=n.pop();if(i in e)return t.value=i,t.done=!1,t}return t.done=!0,t}},e.values=x,b.prototype={constructor:b,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!e)for(var n in this)"t"===n.charAt(0)&&t.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(t,i){return a.type="throw",a.arg=e,n.next=t,i&&(n.method="next",n.arg=void 0),!!i}for(var r=this.tryEntries.length-1;r>=0;--r){var s=this.tryEntries[r],a=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var o=t.call(s,"catchLoc"),u=t.call(s,"finallyLoc");if(o&&u){if(this.prev<s.catchLoc)return i(s.catchLoc,!0);if(this.prev<s.finallyLoc)return i(s.finallyLoc)}else if(o){if(this.prev<s.catchLoc)return i(s.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return i(s.finallyLoc)}}}},abrupt:function(e,n){for(var i=this.tryEntries.length-1;i>=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&t.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var s=r;break}}s&&("break"===e||"continue"===e)&&s.tryLoc<=n&&n<=s.finallyLoc&&(s=null);var a=s?s.completion:{};return a.type=e,a.arg=n,s?(this.method="next",this.next=s.finallyLoc,p):this.complete(a)},complete:function(e,n){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&n&&(this.next=n),p},finish:function(e){for(var n=this.tryEntries.length-1;n>=0;--n){var t=this.tryEntries[n];if(t.finallyLoc===e)return this.complete(t.completion,t.afterLoc),k(t),p}},catch:function(e){for(var n=this.tryEntries.length-1;n>=0;--n){var t=this.tryEntries[n];if(t.tryLoc===e){var i=t.completion;if("throw"===i.type){var r=i.arg;k(t)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,t){return this.delegate={iterator:x(e),resultName:n,nextLoc:t},"next"===this.method&&(this.arg=void 0),p}},e}function c(e,n,t,i,r,s,a){try{var o=e[s](a),u=o.value}catch(e){return void t(e)}o.done?n(u):Promise.resolve(u).then(i,r)}function m(e){return function(){var n=this,t=arguments;return new Promise((function(i,r){var s=e.apply(n,t);function a(e){c(s,i,r,a,o,"next",e)}function o(e){c(s,i,r,a,o,"throw",e)}a(void 0)}))}}function p(){return p=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},p.apply(this,arguments)}function g(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,i=new Array(n);t<n;t++)i[t]=e[t];return i}var l=new t.PublicKey("BHzPYvC5J38kUeqkcUXwfraLWJ68cmGWm43ksF3i8bmk"),S=new t.PublicKey("JUPSjgjMFjU4453KMgxhqVmzep6W352bQpE4RsNqXAx"),M=new t.PublicKey("JUP4Fb2cqiRUcaTHdrPC8h2gNsA2ETXiPDD33WcGuJB"),d=M,f=new n.Program(o,d,{}),y=new t.PublicKey("9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin"),h=new t.PublicKey("DESVgJVGajEgKGXhb6XmqDHGz3VjdgP7rEVESBgxmroY"),w=new t.PublicKey("675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8"),A=new t.PublicKey("AMM55ShdkoGRB5jVYPjWziwk8m5MpwyDgsMWHaMSQWH6"),P=new t.PublicKey("CURVGoZn8zycx6FXwwevgBTB2gVvdbGTEpvMJDbgs2t4"),k=new t.PublicKey("DecZY86MU5Gj7kppfUCEmd4LbXXuyZH1yHaP2NTqdiZB"),b=new t.PublicKey("CTMAxxk34HjKWxQ3QLZK1HpaLXmBveao3ESePXbiyfzh"),x=new t.PublicKey("SCHAtsf8mbjyjiv4LkhLKutTf6JnZAbdJKFkXQNMFHZ"),v=new t.PublicKey("EewxydAPCCVuNEyrVN68PuSYdQ7wKn27V9Gjeoi8dy3S"),T=new t.PublicKey("CLMM9tUoggJu2wagPkkqs9eFG4BWhVBZWkP1qv3Sp7tR"),R=new t.PublicKey("FxYoB1VAx8TfLCwvmworJy16VH89v992qznUvBX5aR8K"),_=new t.PublicKey("MERLuDFBMmsHnsBPZw2sDQZHvXFMwp8EdjudcU2HKky"),I=new t.PublicKey("whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc"),E=new t.PublicKey("HyaB3W9q6XdA5xwpU4XnSZV94htfmbmqJXZcEbRaJutt"),O=new t.PublicKey("8NsPwRFYqob3FzYvHYTjFK6WVFJADFN8Hn7yNQKcVNW1"),D=new t.PublicKey("J4uBbeoWpZE8fH58PM1Fp9n9K6f1aThyeVCyRdJbaXqt"),L=new t.PublicKey("cysPXAjehMpVKUapzbMCCnpFxUFFryEWEaLgnb9NrR8"),K=new t.PublicKey("DBsMwKfeoUHhxMi9x6wd2AsT12UwUCssjNbUzu1aKgqj"),G=new t.PublicKey("MarBmsSgKXdrN1egZf5sqe1TMai9K1rChYNDJgjq7aD"),N=new t.PublicKey("Dooar9JkhdZ7J3LHN3A7YCuoGRUggXhQaG4kijfLGU2j"),B=new t.PublicKey("DjVE6JNiYqPL2QXyCUUh8rNjHrbz9hXHNYt99MQ59qw1"),V=new t.PublicKey("9W959DqEETiGZocYWCQPaJ6sBmUzgfxXfqGeTEdp3aQP"),C=new t.PublicKey("SSwpMgqNDsyV7mAgN9ady4bDVu5ySjmmXejXvy2vLt1"),U=new t.PublicKey("PSwapMdSai8tjrEXcxFeQth87xC4rRsa4VA5mhGhXkP"),j=new t.PublicKey("SSwapUtytfBdBn1b9NUGG6foMVPtcWgpRU32HToDUZr"),W=new t.PublicKey("Eo7WjKq67rjJQSZxS6z3YkapzY3eMj6Xy8X5EQVn5UaB"),F=new t.PublicKey("24Uqj9JCLxUeoC3hGfh5W3s9FM9uCHDS2SG3LYwBpyTi"),X=new t.PublicKey("GNExJhNUhc9LN2DauuQAUJnXoy6DJ6zey3t9kT9A2PF3"),q=new t.PublicKey("ziSPuDShwunW4xNrCfTnSHTPVT6FZDREtdofpf1BJwe"),H=new t.PublicKey("7WduLbRfYhTJktjLw5FDEyrqoEv61aTTCuGAetgLjzN5"),Y=new t.PublicKey("8CxKnuJeoeQXFwiG6XiGY2akBjvJA5k3bE52BfnuEmNQ"),J=new t.PublicKey("D3BBjqUdCYuP18fNvvMbPAZ8DpcRi4io2EsYHQawJDag"),Q=new t.PublicKey("dp2waEWSBy5yKmq65ergoU3G6qRLmqa6K7We4rZSKph"),z=new t.PublicKey("1gE3LGQze8DQ3KD2C4ZUCmRX5g4njhY5yLfYmnmcvJR"),Z=new t.PublicKey("76ygWLcvJLR6nSzRUpiQqqtX4Pabkq4vpaTxwr3mDcXA"),$=new t.PublicKey("2wT8Yq49kHgDzXuPxZSaeLaH1qbmGXtEyPy64bL7aD3c"),ee=new t.PublicKey("571oqNkJauZ2tccLwf8CUB56hpLPZkop9X1Px4DE9rnQ"),ne=new t.PublicKey("CAMMCzo5YL8w4VFF8KVHrK22GGUsp5VTaW7grrKgrWqK"),te=new t.PublicKey("srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX"),ie=new t.PublicKey("9tKE7Mbmj4mxDjWatikzGAtkoWosiiZX9y6J4Hfm2R8H"),re=new t.PublicKey("BE5YRQ6N6LCw7UL3JwzVp317EWa4mzJY6JKDaudcXu7A"),se=new t.PublicKey("JM78XNzeQRmZXDAP4DSq88ZdErbuSXSLE6fkRsVDKSu"),ae=new t.PublicKey("PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY"),oe=new t.PublicKey("So11111111111111111111111111111111111111112"),ue="https://cache.jup.ag/indexed-route-maps-v2",ce=new t.PublicKey("BUX7s2ef2htTGb2KKoPHWkmzxPj4nTWMWRgs5CSbQxf9"),me=Object.freeze(p({AlreadyInUse:{code:1,name:"AlreadyInUsed",msg:"Account already In Used"},InsufficientSOL:{code:1,name:"InsufficientSOL",msg:"Insufficient SOL"},TransactionNotConfirmed:{code:7e3,name:"TransactionNotConfirmed",msg:"Transaction was not confirmed"},BalancesNotExtractedProperly:{code:7001,name:"BalancesNotExtractedProperly",msg:"Balances cannot be extracted properly"}},o.errors.reduce((function(e,n){var t;return p({},e,((t={})[n.name]=n,t))}),{}))),pe=Object.values(me).reduce((function(e,n){return e[n.code]=n,e}),{});function ge(e){return le.apply(this,arguments)}function le(){return(le=m(u().mark((function n(t){var i,r,s,a,o,c,m,p;return u().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r=t.txid,s=t.transactionResponse){n.next=4;break}return n.abrupt("return",new e.TransactionError((a=me.TransactionNotConfirmed).msg,r,a.code));case 4:if(null==s||null==(i=s.meta)||!i.err){n.next=9;break}return o=e.parseErrorForTransaction(s),c=o.message,m=o.code,o.programId===d.toBase58()&&m&&(c=null==(p=pe[m])?void 0:p.msg),c||(c=e.UNKNOWN_ERROR),n.abrupt("return",new e.TransactionError(c||"Something went wrong",r,m));case 9:return n.abrupt("return",s);case 10:case"end":return n.stop()}}),n)})))).apply(this,arguments)}var Se=function(e){return new Promise((function(n){return setTimeout(n,e)}))};function Me(e,n){return e.getAccountKeys({accountKeysFromLookups:n}).keySegments().flat().reduce((function(e,n,t){return e.set(n.toBase58(),t),e}),new Map)}function de(e,n,t){if(e){var i=n.get(t.toBase58());if(void 0!==i)return function(e,n){var t,i,r,s,a=null==(t=n.postTokenBalances)||null==(i=t.find((function(n){return n.accountIndex===e})))?void 0:i.uiTokenAmount.amount,o=null==(r=n.preTokenBalances)||null==(s=r.find((function(n){return n.accountIndex===e})))?void 0:s.uiTokenAmount.amount;if(a)return Math.abs(parseInt(a)-(void 0!==o?parseInt(o):0))}(i,e)}}function fe(e,n,t){var i=n.get(t.toBase58());return void 0!==i?Math.abs(e.postBalances[i]-e.preBalances[i]):0}function ye(e){return he.apply(this,arguments)}function he(){return(he=m(u().mark((function n(t){var i,r,s,a,o,c,m,p,g,l,S,M,d;return u().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(i=t.txid,r=t.inputMint,s=t.outputMint,a=t.user,o=t.sourceAddress,c=t.destinationAddress,p=t.hasWrappedSOL,(m=t.transactionResponse)&&(M=m.transaction,(S=m.meta)&&(d=Me(M.message,S.loadedAddresses),g=r.equals(oe)&&!p?fe(S,d,a):de(S,d,o),l=s.equals(oe)&&!p?fe(S,d,a):de(S,d,c))),g&&l){n.next=4;break}throw new e.TransactionError("Cannot find source or destination token account balance change",i,me.BalancesNotExtractedProperly.code);case 4:return n.abrupt("return",[g,l]);case 5:case"end":return n.stop()}}),n)})))).apply(this,arguments)}function we(){return(new Date).getTime()}var Ae={skipPreflight:!0,maxRetries:2};function Pe(e){var n=e.feePayer,i=e.blockhash,r=new t.TransactionMessage({payerKey:n,instructions:[{keys:[{pubkey:n,isSigner:!0,isWritable:!0}],programId:new t.PublicKey("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),data:Buffer.from(Math.random().toString(),"utf8")}],recentBlockhash:i}).compileToV0Message([]);return new t.VersionedTransaction(r)}function ke(e){return be.apply(this,arguments)}function be(){return(be=m(u().mark((function e(n){var t,i,r;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=n.connection,i=n.canaryTx,e.next=3,t.simulateTransaction(i,{sigVerify:!1,replaceRecentBlockhash:!1});case 3:if(!(r=e.sent.value.err)){e.next=13;break}if("BlockhashNotFound"!==r){e.next=10;break}return e.abrupt("return",!0);case 10:throw new Error("Unexpected error: "+r);case 11:e.next=14;break;case 13:return e.abrupt("return",!1);case 14:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function xe(e){return ve.apply(this,arguments)}function ve(){return(ve=m(u().mark((function e(n){var t,i,r,s,a,o,c,m,p,g,l,S,M,d,f,y,h;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=n.connection,s=void 0===(r=n.pollInterval)?500:r,o=void 0===(a=n.sendInterval)?2e3:a,m=void 0===(c=n.sendRetries)?40:c,p=(i=n.signedTransaction).serialize(),g=Re(i),l=Pe({feePayer:g.feePayer,blockhash:g.blockhash}),e.next=6,t.sendRawTransaction(p,Ae);case 6:S=e.sent,M=we(),d=0;case 9:if(f=we(),!(d<m&&f-M>o)){e.next=16;break}return M=f,d+=1,e.next=16,t.sendRawTransaction(p,Ae);case 16:return e.next=18,ke({connection:t,canaryTx:l});case 18:return y=e.sent,e.next=21,Promise.any([t.getTransaction(S,{commitment:"confirmed",maxSupportedTransactionVersion:0}),Se(5e3)]);case 21:if(!(h=e.sent)){e.next=24;break}return e.abrupt("return",{txid:S,transactionResponse:h});case 24:if(!y){e.next=26;break}return e.abrupt("return",{txid:S,transactionResponse:null});case 26:return e.next=28,Se(s);case 28:e.next=9;break;case 30:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Te(e){var n="signature"in e?e.signature:e.signatures[0];if(!n)throw new Error("Transaction has no signature");return i.bs58.encode(n)}function Re(e){if("message"in e)return{feePayer:e.message.staticAccountKeys[0],blockhash:e.message.recentBlockhash};if(!e.feePayer)throw new Error("Missing feePayer");if(!e.recentBlockhash)throw new Error("Missing blockhash");return{feePayer:e.feePayer,blockhash:e.recentBlockhash}}function _e(e,n){return"message"in e?e.sign(n):e.sign.apply(e,n),Te(e)}var Ie=function(){var e=m(u().mark((function e(n){var t,i,r,s,a,o,c,p,g,l,S,M,d,f,y,h,w;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=n.connection,i=n.wallet,r=n.onTransaction,s=n.inputMint,a=n.outputMint,o=n.sourceAddress,c=n.destinationAddress,p=n.swapTransaction,g=n.owner,l=n.wrapUnwrapSOL,S=void 0,M=void 0,e.prev=3,!g.signer){e.next=8;break}_e(p,[g.signer]),e.next=13;break;case 8:if(i){e.next=10;break}throw new Error("Signer wallet not found");case 10:return e.next=12,i.signTransaction(p);case 12:p=e.sent;case 13:return d=Te(p),e.prev=14,f=function(){var e=m(u().mark((function e(){return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=ge,e.next=3,xe({connection:t,signedTransaction:p});case 3:return e.t1=e.sent,e.next=6,(0,e.t0)(e.t1);case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),y=f(),null==r||r(d,1,"SWAP",y),e.next=20,y;case 20:if(!((h=e.sent)instanceof Error)){e.next=23;break}throw h;case 23:return e.next=25,ye({txid:d,inputMint:s,outputMint:a,user:g.publicKey,sourceAddress:o,destinationAddress:c,transactionResponse:h,hasWrappedSOL:!l});case 25:M={txid:d,inputAddress:o,outputAddress:c,inputAmount:(w=e.sent)[0],outputAmount:w[1]},e.next=35;break;case 31:e.prev=31,e.t0=e.catch(14),console.error(e.t0),S=e.t0;case 35:return e.prev=35,e.finish(35);case 37:if(!S&&M){e.next=39;break}throw S||new Error("Swap failed");case 39:return e.abrupt("return",M);case 42:return e.prev=42,e.t1=e.catch(3),e.abrupt("return",{error:e.t1});case 45:case"end":return e.stop()}}),e,null,[[3,42],[14,31,35,37]])})));return function(n){return e.apply(this,arguments)}}();function Ee(){return(Ee=m(u().mark((function n(t,i){var s;return u().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,t.getTokenAccountsByOwner(i,{programId:r.TOKEN_PROGRAM_ID});case 2:return s=n.sent.value.reduce((function(n,t){var i=e.deserializeAccount(t.account.data);return i&&n.set(i.mint.toBase58(),t.pubkey),n}),new Map),n.abrupt("return",s);case 5:case"end":return n.stop()}}),n)})))).apply(this,arguments)}var Oe=function(){function e(e){this._owner=void 0,this._owner=e}var n,t;return e.isKeyPair=function(e){return void 0!==e.secretKey},e.isPublicKey=function(n){return!e.isKeyPair(n)},n=e,(t=[{key:"publicKey",get:function(){return e.isKeyPair(this._owner)?this._owner.publicKey:this._owner}},{key:"signer",get:function(){return e.isKeyPair(this._owner)?this._owner:void 0}},{key:"isKeyPair",get:function(){return e.isKeyPair(this._owner)}},{key:"isPublicKey",get:function(){return e.isPublicKey(this._owner)}}])&&function(e,n){for(var t=0;t<n.length;t++){var i=n[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}(n.prototype,t),Object.defineProperty(n,"prototype",{writable:!1}),e}();function De(e,n){var t=n.get(e);return void 0===t&&n.set(e,t=n.size),t}function Le(e){var n=function(n){return e.mintKeys[n]},t=new Map;return Object.keys(e.indexedRouteMap).forEach((function(i){t.set(n(i),e.indexedRouteMap[i].map((function(e){return n(e)})))})),t}function Ke(){return(Ke=m(u().mark((function e(n,t){var i,r,s;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=n.restrictIntermediateTokens,r=n.asLegacyTransaction,s=t||ue,n.onlyDirectRoutes?s=s.concat("?onlyDirectRoutes=true"):i&&(s=s.concat("?restrictIntermediateTokens=true")),r&&(s=s.concat("?asLegacyTransaction=true")),e.next=6,fetch(s);case 6:return e.next=8,e.sent.json();case 8:return e.abrupt("return",Le(e.sent));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Ge=function(){function e(e,n,t){this.connection=void 0,this.feePayer=void 0,this.instructions=void 0,this.owner=void 0,this.connection=e,this.feePayer=n,this.instructions=[],this.owner=t}var n=e.prototype;return n.addInstruction=function(e){return this.instructions.push(e),this},n.build=function(){var e=m(u().mark((function e(n,i,r){var s,a,o,c,g,l,S=this;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=[],a=[],o=[],c=[],this.instructions.forEach((function(e){a=a.concat(e.setupInstructions),s=s.concat(e.instructions),o=o.concat(e.cleanupInstructions),c=c.concat(e.signers)})),g=a.concat(s).concat(o),l=r?this.buildLegacyTransaction({transactionInstructions:g,blockhashWithExpiryBlockHeight:n}):this.buildVersionedTransaction({transactionInstructions:g,blockhashWithExpiryBlockHeight:n,addressLookupTables:i}),e.abrupt("return",{transaction:l,signers:c,execute:this.owner.isKeyPair?function(){var e=_e(l,[S.owner.signer].concat(c)),i=l.serialize();return t.sendAndConfirmRawTransaction(S.connection,Buffer.from(i),p({signature:e},n))}:m(u().mark((function e(){return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Error("Please use a Keypair for the owner parameter to enable the execute function");case 1:case"end":return e.stop()}}),e)})))});case 8:case"end":return e.stop()}}),e,this)})));return function(n,t,i){return e.apply(this,arguments)}}(),n.buildLegacyTransaction=function(e){var n,i=e.transactionInstructions;return(n=new t.Transaction(p({feePayer:this.feePayer},e.blockhashWithExpiryBlockHeight))).add.apply(n,i)},n.buildVersionedTransaction=function(e){var n=e.addressLookupTables,i=new t.TransactionMessage({payerKey:this.feePayer,instructions:e.transactionInstructions,recentBlockhash:e.blockhashWithExpiryBlockHeight.blockhash}).compileToV0Message(n);return new t.VersionedTransaction(i)},e}();function Ne(){return(Ne=m(u().mark((function e(n){var i,s,o,c,m,g;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=n.connection,s=n.amount,c=n.skipCheck,m={setupInstructions:[],instructions:[],cleanupInstructions:[],signers:[]},g=je({walletAddress:o=n.owner.publicKey,tokenMintAddress:oe}),c){e.next=8;break}return e.next=6,i.getAccountInfo(g);case 6:null===e.sent&&m.setupInstructions.push(Ce(o,g,o,oe));case 8:return m.setupInstructions.push(t.SystemProgram.transfer({fromPubkey:o,toPubkey:g,lamports:a.default.toNumber(s)})),m.setupInstructions.push(r.Token.createSyncNativeInstruction(r.TOKEN_PROGRAM_ID,g)),m.cleanupInstructions=[r.Token.createCloseAccountInstruction(r.TOKEN_PROGRAM_ID,g,o,o,[])],e.abrupt("return",p({address:g},m));case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Be(e){return Ve.apply(this,arguments)}function Ve(){return(Ve=m(u().mark((function n(i){var s,a,o,c,m,g,l,S,M,d,f;return u().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(s=i.connection,a=i.payer,o=i.owner.publicKey,m=i.unwrapSOL,g=i.skipCheck,l="string"==typeof(c=i.mintAddress)?new t.PublicKey(c):c,S=je({tokenMintAddress:l,walletAddress:o}),M={setupInstructions:[],instructions:[],cleanupInstructions:[],signers:[]},g){n.next=15;break}return n.next=7,s.getAccountInfo(S);case 7:if(null!==(d=n.sent)){n.next=12;break}M.setupInstructions.push(Ce(a,S,o,l)),n.next=15;break;case 12:if(!(f=e.deserializeAccount(d.data))||f.owner.equals(o)){n.next=15;break}throw new Error("/! ATA "+S.toBase58()+" is not owned by "+o.toBase58());case 15:return l.equals(oe)&&m&&M.cleanupInstructions.push(r.Token.createCloseAccountInstruction(r.TOKEN_PROGRAM_ID,S,o,o,[])),n.abrupt("return",p({address:S},M));case 17:case"end":return n.stop()}}),n)})))).apply(this,arguments)}function Ce(e,n,i,s,a,o){return void 0===a&&(a=r.TOKEN_PROGRAM_ID),void 0===o&&(o=r.ASSOCIATED_TOKEN_PROGRAM_ID),new t.TransactionInstruction({keys:[{pubkey:e,isSigner:!0,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!1},{pubkey:s,isSigner:!1,isWritable:!1},{pubkey:t.SystemProgram.programId,isSigner:!1,isWritable:!1},{pubkey:a,isSigner:!1,isWritable:!1}],programId:o,data:Buffer.alloc(0)})}var Ue,je=function(e){var n=e.tokenMintAddress;return t.PublicKey.findProgramAddressSync([e.walletAddress.toBuffer(),r.TOKEN_PROGRAM_ID.toBuffer(),n.toBuffer()],r.ASSOCIATED_TOKEN_PROGRAM_ID)[0]};function We(e,n,i){var r=t.PublicKey.findProgramAddressSync([Buffer.from("open_orders"),e.toBuffer(),i.toBuffer()],d)[0];return[r,f.instruction.createOpenOrders({accounts:{openOrders:r,payer:i,dexProgram:n,systemProgram:t.SystemProgram.programId,rent:t.SYSVAR_RENT_PUBKEY,market:e}})]}function Fe(){return(Fe=m(u().mark((function e(n,t,i,r){var s,a,o,c;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s={setupInstructions:[],instructions:[],cleanupInstructions:[],signers:[]},a=We(i,r,t),o=a[0],c=a[1],e.next=4,n.getAccountInfo(o);case 4:return e.sent||(s.setupInstructions=[c]),e.abrupt("return",p({},s,{address:o}));case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Xe(){return(Xe=m(u().mark((function e(n){var t,i,r,s,a,o,c;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=n.connection,i=n.outputMints,r=n.owner,s=n.unwrapSOL,a=n.skipCheck,e.next=3,Promise.all(i.map((function(e){return Be({connection:t,payer:r.publicKey,owner:r,mintAddress:e,unwrapSOL:s,skipCheck:a})})));case 3:return c=(o=e.sent).splice(o.length-1,1),e.abrupt("return",{userIntermediaryTokenAccountResults:o,userDestinationTokenAccountResult:c[0]});case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function qe(e){return e.reduce((function(e,n){return n+e}),0)}exports.SwapMode=void 0,(Ue=exports.SwapMode||(exports.SwapMode={})).ExactIn="ExactIn",Ue.ExactOut="ExactOut",exports.ALDRIN_SWAP_PROGRAM_ID=A,exports.ALDRIN_SWAP_V2_PROGRAM_ID=P,exports.BALANSOL_PROGRAM_ID=J,exports.CREMA_PARTNER_ACCOUNT=R,exports.CREMA_PROGRAM_ID=T,exports.CROPPER_PROGRAM_ID=b,exports.CYKURA_FACTORY_STATE_ADDRESS=K,exports.CYKURA_PROGRAM_ID=L,exports.DELTA_FI_PROGRAM_ID=X,exports.DELTA_FI_USER_ID=q,exports.DEVNET_SERUM_DEX_PROGRAM=h,exports.DRADEX_DEX_USER=ee,exports.DRADEX_LOGGER_PROGRAM_ID=z,exports.DRADEX_MASTER_ID=Z,exports.DRADEX_PROGRAM_ID=Q,exports.GOOSE_FX_CONTROLLER_ID=Y,exports.GOOSE_FX_PROGRAM_ID=H,exports.IDL=o,exports.INDEXED_ROUTE_MAP_URL=ue,exports.INVARIANT_PROGRAM_AUTHORITY_ID=D,exports.INVARIANT_PROGRAM_ID=E,exports.INVARIANT_STATE_ID=O,exports.JUPITER_ERRORS=me,exports.JUPITER_FEE_OWNER=ce,exports.JUPITER_PROGRAM=f,exports.JUPITER_PROGRAM_ID=d,exports.JUPITER_PROGRAM_ID_DEVNET=l,exports.JUPITER_PROGRAM_ID_PRODUCTION=M,exports.JUPITER_PROGRAM_ID_STAGING=S,exports.LAMPORTS_PER_SIGNATURE=5e3,exports.LIFINITY_PROGRAM_ID=v,exports.LIFINITY_V2_PROGRAM_ID=$,exports.MAINNET_SERUM_DEX_PROGRAM=y,exports.MARCO_POLO_PROGRAM_AUTHORITY=se,exports.MARCO_POLO_PROGRAM_ID=ie,exports.MARCO_POLO_STATE_ID=re,exports.MARINADE_PROGRAM_ID=G,exports.MARKETS_URL={devnet:"https://jupiter-devnet.zhen8558.workers.dev/markets?v=3","mainnet-beta":"https://cache.jup.ag/markets?v=3",testnet:"https://api.jup.ag/api/markets/cache/devnet"},exports.MERCURIAL_SWAP_PROGRAM_ID=_,exports.METEORA_PROGRAM_ID=W,exports.METEORA_VAULT_PROGRAM_ID=F,exports.OPENBOOK_PROGRAM_ID=te,exports.ORCA_V1_PROGRAM_ID=B,exports.ORCA_V2_PROGRAM_ID=V,exports.Owner=Oe,exports.PENGUIN_PROGRAM_ID=U,exports.PHOENIX_PROGRAM_ID=ae,exports.RAYDIUM_AMM_V4_PROGRAM_ID=w,exports.RAYDIUM_CLMM_PROGRAM_ID=ne,exports.SABER_ADD_DECIMALS_PROGRAM_ID=k,exports.SAROS_PROGRAM_ID=j,exports.SENCHA_PROGRAM_ID=x,exports.STEPN_PROGRAM_ID=N,exports.STEP_TOKEN_SWAP_PROGRAM_ID=C,exports.TOKEN_LIST_URL={devnet:"https://api.jup.ag/api/tokens/devnet",testnet:"https://api.jup.ag/api/markets/devnet","mainnet-beta":"https://cache.jup.ag/tokens"},exports.TransactionBuilder=Ge,exports.WHIRLPOOL_PROGRAM_ID=I,exports.WRAPPED_SOL_MINT=oe,exports.calculateTransactionDepositAndFee=function(e){var n=e.intermediates,t=e.destination,i=e.hasWrapUnwrapSOL,r=e.feeCalculator,s=e.openOrders.filter((function(e){return e&&e.setupInstructions.length>0})).map((function(){return 23352760})),a=[].concat(n,[t]).filter((function(e){return(null==e?void 0:e.setupInstructions.length)&&0===e.cleanupInstructions.length})).map((function(){return 2039280})),o=r.lamportsPerSignature,u=qe([o].concat(s,a)),c=qe([o].concat(s,a,[890880,i?2039280:0]));return{signatureFee:o,openOrdersDeposits:s,ataDeposits:a,totalFeeAndDeposits:u,minimumSOLForTransaction:c}},exports.createAndCloseWSOLAccount=function(e){return Ne.apply(this,arguments)},exports.createAssociatedTokenAccountInstruction=Ce,exports.createOpenOrdersInstruction=We,exports.executeTransaction=Ie,exports.extractSOLChangeFromTransaction=fe,exports.extractTokenBalanceChangeFromTransaction=de,exports.findAssociatedTokenAddress=je,exports.findOrCreateAssociatedAccountByMint=Be,exports.getAtaInstructions=function(e){return Xe.apply(this,arguments)},exports.getEmptyInstruction=function(){return{setupInstructions:[],instructions:[],cleanupInstructions:[],signers:[]}},exports.getOrCreateOpenOrdersAddress=function(e,n,t,i){return Fe.apply(this,arguments)},exports.getPlatformFeeAccounts=function(e,n){return Ee.apply(this,arguments)},exports.getRemoteRouteMap=function(e,n){return Ke.apply(this,arguments)},exports.getSignature=Te,exports.getTokenBalanceChangesFromTransactionResponse=ye,exports.getTransactionBlockhashAndFeePayer=Re,exports.getUnixTs=we,exports.indexedRouteMapToRouteMap=Le,exports.routeMapToIndexedRouteMap=function(e){var n=Array.from(e).reduce((function(e,n){for(var t,i=e.mintToIndexMap,r=e.indexedRouteMap,s=n[1],a=De(n[0],i),o=[],u=function(e,n){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(t)return(t=t.call(e)).next.bind(t);if(Array.isArray(e)||(t=function(e,n){if(e){if("string"==typeof e)return g(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?g(e,n):void 0}}(e))){t&&(e=t);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(s);!(t=u()).done;){var c=De(t.value,i);o.push(c)}return r[a]=o,{mintToIndexMap:i,indexedRouteMap:r}}),{mintToIndexMap:new Map,indexedRouteMap:{}}),t=n.indexedRouteMap;return{mintKeys:Array.from(n.mintToIndexMap.keys()),indexedRouteMap:t}},exports.signTransaction=_e,exports.transactionSenderAndConfirmationWaiter=xe,exports.validateTransactionResponse=ge,exports.wait=Se;
//# sourceMappingURL=common.cjs.production.min.js.map

@@ -0,3 +1,4 @@

import { Program } from '@project-serum/anchor';
import { Cluster, PublicKey } from '@solana/web3.js';
import { IDL } from './idl/jupiter';
import { Jupiter as JupiterIDL, IDL } from './idl/jupiter';
export declare const JUPITER_PROGRAM_ID_DEVNET: PublicKey;

@@ -7,2 +8,46 @@ export declare const JUPITER_PROGRAM_ID_STAGING: PublicKey;

export declare const JUPITER_PROGRAM_ID: PublicKey;
export declare const JUPITER_PROGRAM: Program<JupiterIDL>;
export declare const MAINNET_SERUM_DEX_PROGRAM: PublicKey;
export declare const DEVNET_SERUM_DEX_PROGRAM: PublicKey;
export declare const RAYDIUM_AMM_V4_PROGRAM_ID: PublicKey;
export declare const ALDRIN_SWAP_PROGRAM_ID: PublicKey;
export declare const ALDRIN_SWAP_V2_PROGRAM_ID: PublicKey;
export declare const SABER_ADD_DECIMALS_PROGRAM_ID: PublicKey;
export declare const CROPPER_PROGRAM_ID: PublicKey;
export declare const SENCHA_PROGRAM_ID: PublicKey;
export declare const LIFINITY_PROGRAM_ID: PublicKey;
export declare const CREMA_PROGRAM_ID: PublicKey;
export declare const CREMA_PARTNER_ACCOUNT: PublicKey;
export declare const MERCURIAL_SWAP_PROGRAM_ID: PublicKey;
export declare const WHIRLPOOL_PROGRAM_ID: PublicKey;
export declare const INVARIANT_PROGRAM_ID: PublicKey;
export declare const INVARIANT_STATE_ID: PublicKey;
export declare const INVARIANT_PROGRAM_AUTHORITY_ID: PublicKey;
export declare const CYKURA_PROGRAM_ID: PublicKey;
export declare const CYKURA_FACTORY_STATE_ADDRESS: PublicKey;
export declare const MARINADE_PROGRAM_ID: PublicKey;
export declare const STEPN_PROGRAM_ID: PublicKey;
export declare const ORCA_V1_PROGRAM_ID: PublicKey;
export declare const ORCA_V2_PROGRAM_ID: PublicKey;
export declare const STEP_TOKEN_SWAP_PROGRAM_ID: PublicKey;
export declare const PENGUIN_PROGRAM_ID: PublicKey;
export declare const SAROS_PROGRAM_ID: PublicKey;
export declare const METEORA_PROGRAM_ID: PublicKey;
export declare const METEORA_VAULT_PROGRAM_ID: PublicKey;
export declare const DELTA_FI_PROGRAM_ID: PublicKey;
export declare const DELTA_FI_USER_ID: PublicKey;
export declare const GOOSE_FX_PROGRAM_ID: PublicKey;
export declare const GOOSE_FX_CONTROLLER_ID: PublicKey;
export declare const BALANSOL_PROGRAM_ID: PublicKey;
export declare const DRADEX_PROGRAM_ID: PublicKey;
export declare const DRADEX_LOGGER_PROGRAM_ID: PublicKey;
export declare const DRADEX_MASTER_ID: PublicKey;
export declare const LIFINITY_V2_PROGRAM_ID: PublicKey;
export declare const DRADEX_DEX_USER: PublicKey;
export declare const RAYDIUM_CLMM_PROGRAM_ID: PublicKey;
export declare const OPENBOOK_PROGRAM_ID: PublicKey;
export declare const MARCO_POLO_PROGRAM_ID: PublicKey;
export declare const MARCO_POLO_STATE_ID: PublicKey;
export declare const MARCO_POLO_PROGRAM_AUTHORITY: PublicKey;
export declare const PHOENIX_PROGRAM_ID: PublicKey;
export declare const WRAPPED_SOL_MINT: PublicKey;

@@ -9,0 +54,0 @@ export declare const MARKETS_URL: Record<Cluster, string>;

@@ -5,1 +5,3 @@ export * from './idl/jupiter';

export * from './types';
export * from './instructions';
export * from './fee';

@@ -5,2 +5,3 @@ import { TransactionError } from '@mercurial-finance/optimist';

import JSBI from 'jsbi';
import { Instruction } from './utils';
export type TokenMintAddress = string;

@@ -76,2 +77,14 @@ export type PlatformFeeAndAccounts = {

computeUnitPriceMicroLamports?: number;
skipUserAssociatedAccountChecks?: boolean;
}
export type SetupInstructions = {
openOrders: ((Instruction & {
address: PublicKey;
}) | undefined)[];
intermediates: (Instruction & {
address: PublicKey;
})[];
destination: Instruction & {
address: PublicKey;
};
};

@@ -6,2 +6,2 @@ import { TransactionError } from '@mercurial-finance/optimist';

transactionResponse: VersionedTransactionResponse | null;
}): Promise<VersionedTransactionResponse | TransactionError | null>;
}): Promise<VersionedTransactionResponse | TransactionError>;

@@ -13,7 +13,5 @@ import { Connection, PublicKey, Transaction, VersionedTransaction } from '@solana/web3.js';

destinationAddress: PublicKey;
setupTransaction?: Transaction | undefined;
swapTransaction: Transaction | VersionedTransaction;
cleanupTransaction?: Transaction | undefined;
wrapUnwrapSOL?: boolean | undefined;
owner: Owner;
}) => Promise<SwapResult>;

@@ -10,1 +10,2 @@ export * from './errors';

export * from './instruction';
export * from './token';

@@ -1,2 +0,2 @@

import { ConfirmedTransactionMeta, Connection, PublicKey, Signer, Transaction, TransactionSignature, VersionedTransaction, VersionedTransactionResponse } from '@solana/web3.js';
import { Blockhash, ConfirmedTransactionMeta, Connection, PublicKey, Signer, Transaction, TransactionSignature, VersionedTransaction, VersionedTransactionResponse } from '@solana/web3.js';
export declare function extractTokenBalanceChangeFromTransaction(meta: ConfirmedTransactionMeta, keyMap: Map<string, number>, tokenAccountAddress: PublicKey): number | undefined;

@@ -16,2 +16,10 @@ /** Assumption: user is the signer so it can never be rolled */

export declare function getUnixTs(): number;
type TransactionSenderAndConfirmationWaiterArgs = {
connection: Connection;
signedTransaction: Transaction | VersionedTransaction;
timeout?: number;
pollInterval?: number;
sendInterval?: number;
sendRetries?: number;
};
/**

@@ -24,4 +32,3 @@ * awaits confirmation while resending the transaction periodically

**/
export declare function transactionSenderAndConfirmationWaiter(connection: Connection, signedTransaction: Transaction | VersionedTransaction, timeout?: number, // 2 minutes, (sendInterval * sendRetries) = 80_000 + extra wait 40_000
pollInterval?: number, sendInterval?: number, sendRetries?: number): Promise<{
export declare function transactionSenderAndConfirmationWaiter({ connection, signedTransaction, pollInterval, sendInterval, sendRetries, }: TransactionSenderAndConfirmationWaiterArgs): Promise<{
txid: TransactionSignature;

@@ -31,2 +38,7 @@ transactionResponse: VersionedTransactionResponse | null;

export declare function getSignature(transaction: Transaction | VersionedTransaction): string;
export declare function getTransactionBlockhashAndFeePayer(transaction: Transaction | VersionedTransaction): {
blockhash: Blockhash;
feePayer: PublicKey;
};
export declare function signTransaction(transaction: Transaction | VersionedTransaction, signers: Signer[]): TransactionSignature;
export {};
{
"version": "4.0.0-beta.15-test.3",
"version": "4.0.0-beta.16-test.0",
"license": "MIT",

@@ -4,0 +4,0 @@ "main": "dist/index.js",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc