import { PublicKey, Signer, Keypair, TransactionSignature, VersionedTransactionResponse, BlockhashWithExpiryBlockHeight, Connection, Transaction, VersionedTransaction, ConfirmedTransactionMeta, Blockhash, TransactionInstruction, AddressLookupTableAccount, Cluster, FeeCalculator } from '@solana/web3.js'; import { TransactionError } from '@mercurial-finance/optimist'; import { SignerWalletAdapter } from '@solana/wallet-adapter-base'; import JSBI from 'jsbi'; import { Event } from '@coral-xyz/anchor'; type _Owner = Keypair | PublicKey; declare class Owner { private readonly _owner; constructor(owner: _Owner); get publicKey(): PublicKey; get signer(): Signer | undefined; get isKeyPair(): boolean; get isPublicKey(): boolean; static isKeyPair(owner: _Owner): owner is Keypair; static isPublicKey(owner: _Owner): owner is PublicKey; } type TokenMintAddress = string; type PlatformFeeAndAccounts = { /** Provide referralAccount for automatic referral token account check */ referralAccount?: PublicKey; feeBps: number; /** Initial fee accounts */ feeAccounts?: Map; }; type PlatformFee = { feeBps: number; feeAccount: PublicKey; }; type QuoteMintToReferrer = Map; interface Fee { amount: JSBI; mint: string; pct: number; } type SwapResult = { txid: string; inputAddress: PublicKey; outputAddress: PublicKey; inputAmount: number; outputAmount: number; } | { error?: TransactionError; }; declare enum SwapMode { ExactIn = "ExactIn", ExactOut = "ExactOut" } type OnTransaction = (txid: TransactionSignature, awaiter: Promise) => void; type ExecuteParams = { wallet?: Pick; /** * Allows to customize control of sending and awaiting confirmation in the single/multi transaction flow */ onTransaction?: OnTransaction; }; interface TransactionFeeInfo { signatureFee: number; openOrdersDeposits: number[]; ataDeposits: number[]; totalFeeAndDeposits: number; minimumSOLForTransaction: number; } interface ExchangeParams { quoteResponseMeta: T; /** * This will overwrite the default Jupiter.setUser, useful for stateless usage like API */ userPublicKey?: PublicKey; /** * This will overwrite the default fee account, useful for stateless usage like API */ feeAccount?: PublicKey; /** * This will overwrite the default wrapUnwrapSOL, useful for stateless usage like API */ wrapUnwrapSOL?: boolean; /** * The transaction will use the blockhash and valid blockheight to create transaction */ blockhashWithExpiryBlockHeight?: BlockhashWithExpiryBlockHeight; /** * Produces a legacy transaction */ asLegacyTransaction?: boolean; /** * compute unit price in micro lamports, the swap transaction will cost consumed compute units * computeUnitPriceMicroLamports in addition to the signatures fee, see https://docs.solana.com/developing/programming-model/runtime#prioritization-fees */ computeUnitPriceMicroLamports?: number | 'auto'; /** * prioritization fee in lamports * Preferred over computeUnitPriceMicroLamports for UIs */ prioritizationFeeLamports?: number | 'auto' | { autoMultiplier: number; } | { jitoTipLamports: number; }; /** * Use the shared program accounts for swapping so the user doesn't need to create their own intermediate token accounts or open orders accounts. */ useSharedAccounts?: boolean; /** * Use the optimized wrapped SOL token account for swapping */ allowOptimizedWrappedSolTokenAccount?: boolean; } type SetupInstructions = { openOrders: ((Instruction & { address: PublicKey; }) | undefined)[]; intermediates: (Instruction & { address: PublicKey; })[]; destination: Instruction & { address: PublicKey; }; }; /** sign, send and await confirmation for an exchange */ declare const executeTransaction: ({ connection, wallet, onTransaction, inputMint, outputMint, sourceAddress, destinationAddress, swapTransaction, blockhashWithExpiryBlockHeight, owner, wrapUnwrapSOL, minContextSlot, }: { connection: Connection; wallet: ExecuteParams['wallet']; onTransaction?: OnTransaction | undefined; inputMint: PublicKey; outputMint: PublicKey; sourceAddress: PublicKey; destinationAddress: PublicKey; swapTransaction: Transaction | VersionedTransaction; blockhashWithExpiryBlockHeight: BlockhashWithExpiryBlockHeight; owner: Owner; wrapUnwrapSOL?: boolean | undefined; minContextSlot?: number | undefined; }) => Promise; declare const mapCommonErrorToJupiterError: (error: TransactionError) => TransactionError; declare function extractTokenBalanceChangeFromTransaction(meta: ConfirmedTransactionMeta, user: PublicKey, mint: PublicKey): number | undefined; /** Assumption: user is the signer so it can never be rolled */ declare function extractSOLChangeFromTransaction(meta: ConfirmedTransactionMeta, keyMap: Map, user: PublicKey): number; declare function extractTokenBalanceChangesFromEvents(events: Event[], inputMint: PublicKey, outputMint: PublicKey): [number, number]; declare function getTokenBalanceChangesFromTransactionResponse({ txid, user, inputMint, outputMint, transactionResponse, hasWrappedSOL, }: { txid: TransactionSignature; user: PublicKey; inputMint: PublicKey; outputMint: PublicKey; transactionResponse: VersionedTransactionResponse | null; hasWrappedSOL: boolean; }): [number, number]; declare function getUnixTs(): number; declare function getSignature(transaction: Transaction | VersionedTransaction): string; declare function getTransactionBlockhash(transaction: Transaction | VersionedTransaction): Blockhash; declare function signTransaction(transaction: Transaction | VersionedTransaction, signers: Signer[]): TransactionSignature; declare const wait: (time: number) => Promise; interface IndexedRouteMap { mintKeys: string[]; indexedRouteMap: { [key: number]: number[]; }; } /** An indexed route map which is light (less data to compress/decompress) and can quickly be inflated into the full route map */ declare function routeMapToIndexedRouteMap(routeMap: Map): { mintKeys: string[]; indexedRouteMap: Record; }; declare function indexedRouteMapToRouteMap(indexedRouteMap: IndexedRouteMap): Map; declare function getRemoteRouteMap({ onlyDirectRoutes, asLegacyTransaction }: { onlyDirectRoutes?: boolean; asLegacyTransaction?: boolean; }, indexedRouteMapUrl?: string): Promise>; declare const getEmptyInstruction: () => Instruction; type Instruction = { setupInstructions: TransactionInstruction[]; instructions: TransactionInstruction[]; cleanupInstructions: TransactionInstruction[]; signers: Signer[]; }; type TransactionPayload = { transaction: Transaction | VersionedTransaction; signers: Signer[]; execute: () => Promise; }; declare class TransactionBuilder { private connection; private feePayer; private instructions; private owner; constructor(connection: Connection, feePayer: PublicKey, owner: Owner); addInstruction(instruction: Instruction): TransactionBuilder; build(blockhashWithExpiryBlockHeight: BlockhashWithExpiryBlockHeight, addressLookupTables: AddressLookupTableAccount[], asLegacyTransaction?: boolean): Promise; private buildLegacyTransaction; private buildVersionedTransaction; } declare function createAndCloseWSOLAccount({ connection, amount, owner: { publicKey }, }: { connection: Connection; owner: Owner; amount: JSBI; }): Promise; declare function findOrCreateAssociatedAccountByMint({ connection, payer, owner: { publicKey }, mintAddress, unwrapSOL, }: { connection: Connection; payer: PublicKey; owner: Owner; mintAddress: PublicKey | string; unwrapSOL: boolean; }): Promise; declare function createAssociatedTokenAccountIdempotentInstruction(payer: PublicKey, associatedToken: PublicKey, owner: PublicKey, mint: PublicKey, programId?: PublicKey, associatedTokenProgramId?: PublicKey): TransactionInstruction; declare const findAssociatedTokenAddress: ({ walletAddress, tokenMintAddress, }: { walletAddress: PublicKey; tokenMintAddress: PublicKey; }) => PublicKey; declare function getEvents(transactionResponse: VersionedTransactionResponse): Event[]; type Jupiter = { version: '0.1.0'; name: 'jupiter'; instructions: [ { name: 'route'; docs: ['route_plan Topologically sorted trade DAG']; accounts: [ { name: 'tokenProgram'; isMut: false; isSigner: false; }, { name: 'userTransferAuthority'; isMut: false; isSigner: true; }, { name: 'userSourceTokenAccount'; isMut: false; isSigner: false; }, { name: 'userDestinationTokenAccount'; isMut: false; isSigner: false; }, { name: 'destinationTokenAccount'; isMut: false; isSigner: false; isOptional: true; }, { name: 'destinationMint'; isMut: false; isSigner: false; }, { name: 'platformFeeAccount'; isMut: true; isSigner: false; isOptional: true; }, { name: 'eventAuthority'; isMut: false; isSigner: false; }, { name: 'program'; isMut: false; isSigner: false; } ]; args: [ { name: 'routePlan'; type: { vec: { defined: 'RoutePlanStep'; }; }; }, { name: 'inAmount'; type: 'u64'; }, { name: 'quotedOutAmount'; type: 'u64'; }, { name: 'slippageBps'; type: 'u16'; }, { name: 'platformFeeBps'; type: 'u8'; } ]; returns: 'u64'; }, { name: 'routeWithTokenLedger'; accounts: [ { name: 'tokenProgram'; isMut: false; isSigner: false; }, { name: 'userTransferAuthority'; isMut: false; isSigner: true; }, { name: 'userSourceTokenAccount'; isMut: false; isSigner: false; }, { name: 'userDestinationTokenAccount'; isMut: false; isSigner: false; }, { name: 'destinationTokenAccount'; isMut: false; isSigner: false; isOptional: true; }, { name: 'destinationMint'; isMut: false; isSigner: false; }, { name: 'platformFeeAccount'; isMut: true; isSigner: false; isOptional: true; }, { name: 'tokenLedger'; isMut: false; isSigner: false; }, { name: 'eventAuthority'; isMut: false; isSigner: false; }, { name: 'program'; isMut: false; isSigner: false; } ]; args: [ { name: 'routePlan'; type: { vec: { defined: 'RoutePlanStep'; }; }; }, { name: 'quotedOutAmount'; type: 'u64'; }, { name: 'slippageBps'; type: 'u16'; }, { name: 'platformFeeBps'; type: 'u8'; } ]; returns: 'u64'; }, { name: 'sharedAccountsRoute'; docs: ['Route by using program owned token accounts and open orders accounts.']; accounts: [ { name: 'tokenProgram'; isMut: false; isSigner: false; }, { name: 'programAuthority'; isMut: false; isSigner: false; }, { name: 'userTransferAuthority'; isMut: false; isSigner: true; }, { name: 'sourceTokenAccount'; isMut: true; isSigner: false; }, { name: 'programSourceTokenAccount'; isMut: true; isSigner: false; }, { name: 'programDestinationTokenAccount'; isMut: true; isSigner: false; }, { name: 'destinationTokenAccount'; isMut: true; isSigner: false; }, { name: 'sourceMint'; isMut: false; isSigner: false; }, { name: 'destinationMint'; isMut: false; isSigner: false; }, { name: 'platformFeeAccount'; isMut: true; isSigner: false; isOptional: true; }, { name: 'token2022Program'; isMut: false; isSigner: false; isOptional: true; }, { name: 'eventAuthority'; isMut: false; isSigner: false; }, { name: 'program'; isMut: false; isSigner: false; } ]; args: [ { name: 'id'; type: 'u8'; }, { name: 'routePlan'; type: { vec: { defined: 'RoutePlanStep'; }; }; }, { name: 'inAmount'; type: 'u64'; }, { name: 'quotedOutAmount'; type: 'u64'; }, { name: 'slippageBps'; type: 'u16'; }, { name: 'platformFeeBps'; type: 'u8'; } ]; returns: 'u64'; }, { name: 'sharedAccountsRouteWithTokenLedger'; accounts: [ { name: 'tokenProgram'; isMut: false; isSigner: false; }, { name: 'programAuthority'; isMut: false; isSigner: false; }, { name: 'userTransferAuthority'; isMut: false; isSigner: true; }, { name: 'sourceTokenAccount'; isMut: true; isSigner: false; }, { name: 'programSourceTokenAccount'; isMut: true; isSigner: false; }, { name: 'programDestinationTokenAccount'; isMut: true; isSigner: false; }, { name: 'destinationTokenAccount'; isMut: true; isSigner: false; }, { name: 'sourceMint'; isMut: false; isSigner: false; }, { name: 'destinationMint'; isMut: false; isSigner: false; }, { name: 'platformFeeAccount'; isMut: true; isSigner: false; isOptional: true; }, { name: 'token2022Program'; isMut: false; isSigner: false; isOptional: true; }, { name: 'tokenLedger'; isMut: false; isSigner: false; }, { name: 'eventAuthority'; isMut: false; isSigner: false; }, { name: 'program'; isMut: false; isSigner: false; } ]; args: [ { name: 'id'; type: 'u8'; }, { name: 'routePlan'; type: { vec: { defined: 'RoutePlanStep'; }; }; }, { name: 'quotedOutAmount'; type: 'u64'; }, { name: 'slippageBps'; type: 'u16'; }, { name: 'platformFeeBps'; type: 'u8'; } ]; returns: 'u64'; }, { name: 'exactOutRoute'; accounts: [ { name: 'tokenProgram'; isMut: false; isSigner: false; }, { name: 'userTransferAuthority'; isMut: false; isSigner: true; }, { name: 'userSourceTokenAccount'; isMut: false; isSigner: false; }, { name: 'userDestinationTokenAccount'; isMut: false; isSigner: false; }, { name: 'destinationTokenAccount'; isMut: false; isSigner: false; isOptional: true; }, { name: 'sourceMint'; isMut: false; isSigner: false; }, { name: 'destinationMint'; isMut: false; isSigner: false; }, { name: 'platformFeeAccount'; isMut: true; isSigner: false; isOptional: true; }, { name: 'token2022Program'; isMut: false; isSigner: false; isOptional: true; }, { name: 'eventAuthority'; isMut: false; isSigner: false; }, { name: 'program'; isMut: false; isSigner: false; } ]; args: [ { name: 'routePlan'; type: { vec: { defined: 'RoutePlanStep'; }; }; }, { name: 'outAmount'; type: 'u64'; }, { name: 'quotedInAmount'; type: 'u64'; }, { name: 'slippageBps'; type: 'u16'; }, { name: 'platformFeeBps'; type: 'u8'; } ]; returns: 'u64'; }, { name: 'sharedAccountsExactOutRoute'; docs: ['Route by using program owned token accounts and open orders accounts.']; accounts: [ { name: 'tokenProgram'; isMut: false; isSigner: false; }, { name: 'programAuthority'; isMut: false; isSigner: false; }, { name: 'userTransferAuthority'; isMut: false; isSigner: true; }, { name: 'sourceTokenAccount'; isMut: true; isSigner: false; }, { name: 'programSourceTokenAccount'; isMut: true; isSigner: false; }, { name: 'programDestinationTokenAccount'; isMut: true; isSigner: false; }, { name: 'destinationTokenAccount'; isMut: true; isSigner: false; }, { name: 'sourceMint'; isMut: false; isSigner: false; }, { name: 'destinationMint'; isMut: false; isSigner: false; }, { name: 'platformFeeAccount'; isMut: true; isSigner: false; isOptional: true; }, { name: 'token2022Program'; isMut: false; isSigner: false; isOptional: true; }, { name: 'eventAuthority'; isMut: false; isSigner: false; }, { name: 'program'; isMut: false; isSigner: false; } ]; args: [ { name: 'id'; type: 'u8'; }, { name: 'routePlan'; type: { vec: { defined: 'RoutePlanStep'; }; }; }, { name: 'outAmount'; type: 'u64'; }, { name: 'quotedInAmount'; type: 'u64'; }, { name: 'slippageBps'; type: 'u16'; }, { name: 'platformFeeBps'; type: 'u8'; } ]; returns: 'u64'; }, { name: 'setTokenLedger'; accounts: [ { name: 'tokenLedger'; isMut: true; isSigner: false; }, { name: 'tokenAccount'; isMut: false; isSigner: false; } ]; args: []; }, { name: 'createOpenOrders'; accounts: [ { name: 'openOrders'; isMut: true; isSigner: false; }, { name: 'payer'; isMut: true; isSigner: true; }, { name: 'dexProgram'; isMut: false; isSigner: false; }, { name: 'systemProgram'; isMut: false; isSigner: false; }, { name: 'rent'; isMut: false; isSigner: false; }, { name: 'market'; isMut: false; isSigner: false; } ]; args: []; }, { name: 'createProgramOpenOrders'; accounts: [ { name: 'openOrders'; isMut: true; isSigner: false; }, { name: 'payer'; isMut: true; isSigner: true; }, { name: 'programAuthority'; isMut: false; isSigner: false; }, { name: 'dexProgram'; isMut: false; isSigner: false; }, { name: 'systemProgram'; isMut: false; isSigner: false; }, { name: 'rent'; isMut: false; isSigner: false; }, { name: 'market'; isMut: false; isSigner: false; } ]; args: [ { name: 'id'; type: 'u8'; } ]; }, { name: 'claim'; accounts: [ { name: 'wallet'; isMut: true; isSigner: false; }, { name: 'programAuthority'; isMut: true; isSigner: false; }, { name: 'systemProgram'; isMut: false; isSigner: false; } ]; args: [ { name: 'id'; type: 'u8'; } ]; returns: 'u64'; }, { name: 'claimToken'; accounts: [ { name: 'payer'; isMut: true; isSigner: true; }, { name: 'wallet'; isMut: false; isSigner: false; }, { name: 'programAuthority'; isMut: false; isSigner: false; }, { name: 'programTokenAccount'; isMut: true; isSigner: false; }, { name: 'destinationTokenAccount'; isMut: true; isSigner: false; }, { name: 'mint'; isMut: false; isSigner: false; }, { name: 'associatedTokenTokenProgram'; isMut: false; isSigner: false; }, { name: 'associatedTokenProgram'; isMut: false; isSigner: false; }, { name: 'systemProgram'; isMut: false; isSigner: false; } ]; args: [ { name: 'id'; type: 'u8'; } ]; returns: 'u64'; }, { name: 'createTokenLedger'; accounts: [ { name: 'tokenLedger'; isMut: true; isSigner: true; }, { name: 'payer'; isMut: true; isSigner: true; }, { name: 'systemProgram'; isMut: false; isSigner: false; } ]; args: []; } ]; accounts: [ { name: 'tokenLedger'; type: { kind: 'struct'; fields: [ { name: 'tokenAccount'; type: 'publicKey'; }, { name: 'amount'; type: 'u64'; } ]; }; } ]; types: [ { name: 'AmountWithSlippage'; type: { kind: 'struct'; fields: [ { name: 'amount'; type: 'u64'; }, { name: 'slippageBps'; type: 'u16'; } ]; }; }, { name: 'RoutePlanStep'; type: { kind: 'struct'; fields: [ { name: 'swap'; type: { defined: 'Swap'; }; }, { name: 'percent'; type: 'u8'; }, { name: 'inputIndex'; type: 'u8'; }, { name: 'outputIndex'; type: 'u8'; } ]; }; }, { name: 'Side'; type: { kind: 'enum'; variants: [ { name: 'Bid'; }, { name: 'Ask'; } ]; }; }, { 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: 'aToB'; 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: 'aToB'; type: 'bool'; } ]; }, { name: 'Invariant'; fields: [ { name: 'xToY'; type: 'bool'; } ]; }, { name: 'Meteora'; }, { name: 'GooseFX'; }, { name: 'DeltaFi'; fields: [ { name: 'stable'; type: 'bool'; } ]; }, { name: 'Balansol'; }, { name: 'MarcoPolo'; fields: [ { name: 'xToY'; 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: 'Symmetry'; fields: [ { name: 'fromTokenId'; type: 'u64'; }, { name: 'toTokenId'; type: 'u64'; } ]; }, { name: 'TokenSwapV2'; }, { name: 'HeliumTreasuryManagementRedeemV0'; }, { name: 'StakeDexStakeWrappedSol'; }, { name: 'StakeDexSwapViaStake'; fields: [ { name: 'bridgeStakeSeed'; type: 'u32'; } ]; }, { name: 'GooseFXV2'; }, { name: 'Perps'; }, { name: 'PerpsAddLiquidity'; }, { name: 'PerpsRemoveLiquidity'; }, { name: 'MeteoraDlmm'; }, { name: 'OpenBookV2'; fields: [ { name: 'side'; type: { defined: 'Side'; }; } ]; }, { name: 'RaydiumClmmV2'; }, { name: 'StakeDexPrefundWithdrawStakeAndDepositStake'; fields: [ { name: 'bridgeStakeSeed'; type: 'u32'; } ]; }, { name: 'Clone'; fields: [ { name: 'poolIndex'; type: 'u8'; }, { name: 'quantityIsInput'; type: 'bool'; }, { name: 'quantityIsCollateral'; type: 'bool'; } ]; }, { name: 'SanctumS'; fields: [ { name: 'srcLstValueCalcAccs'; type: 'u8'; }, { name: 'dstLstValueCalcAccs'; type: 'u8'; }, { name: 'srcLstIndex'; type: 'u32'; }, { name: 'dstLstIndex'; type: 'u32'; } ]; }, { name: 'SanctumSAddLiquidity'; fields: [ { name: 'lstValueCalcAccs'; type: 'u8'; }, { name: 'lstIndex'; type: 'u32'; } ]; }, { name: 'SanctumSRemoveLiquidity'; fields: [ { name: 'lstValueCalcAccs'; type: 'u8'; }, { name: 'lstIndex'; type: 'u32'; } ]; }, { name: 'RaydiumCP'; }, { name: 'WhirlpoolSwapV2'; fields: [ { name: 'aToB'; type: 'bool'; }, { name: 'remainingAccountsInfo'; type: { option: { defined: 'RemainingAccountsInfo'; }; }; } ]; }, { name: 'OneIntro'; } ]; }; }, { name: 'RemainingAccountsSlice'; type: { kind: 'struct'; fields: [ { name: 'accountsType'; type: { defined: 'AccountsType'; }; }, { name: 'length'; type: 'u8'; } ]; }; }, { name: 'RemainingAccountsInfo'; type: { kind: 'struct'; fields: [ { name: 'slices'; type: { vec: { defined: 'RemainingAccountsSlice'; }; }; } ]; }; }, { name: 'AccountsType'; type: { kind: 'enum'; variants: [ { name: 'TransferHookA'; }, { name: 'TransferHookB'; } ]; }; } ]; events: [ { name: 'SwapEvent'; fields: [ { name: 'amm'; type: 'publicKey'; index: false; }, { name: 'inputMint'; type: 'publicKey'; index: false; }, { name: 'inputAmount'; type: 'u64'; index: false; }, { name: 'outputMint'; type: 'publicKey'; index: false; }, { name: 'outputAmount'; type: 'u64'; index: false; } ]; }, { name: 'FeeEvent'; fields: [ { name: 'account'; type: 'publicKey'; index: false; }, { name: 'mint'; type: 'publicKey'; index: false; }, { name: 'amount'; type: 'u64'; index: false; } ]; } ]; errors: [ { code: 6000; 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: 'InvalidInputIndex'; msg: 'Token input index is invalid'; }, { code: 6007; name: 'InvalidOutputIndex'; msg: 'Token output index is invalid'; }, { code: 6008; name: 'NotEnoughAccountKeys'; msg: 'Not Enough Account keys'; }, { code: 6009; name: 'NonZeroMinimumOutAmountNotSupported'; msg: 'Non zero minimum out amount not supported'; }, { code: 6010; name: 'InvalidRoutePlan'; msg: 'Invalid route plan'; }, { code: 6011; name: 'InvalidReferralAuthority'; msg: 'Invalid referral authority'; }, { code: 6012; name: 'LedgerTokenAccountDoesNotMatch'; msg: "Token account doesn't match the ledger"; }, { code: 6013; name: 'InvalidTokenLedger'; msg: 'Invalid token ledger'; }, { code: 6014; name: 'IncorrectTokenProgramID'; msg: 'Token program ID is invalid'; }, { code: 6015; name: 'TokenProgramNotProvided'; msg: 'Token program not provided'; }, { code: 6016; name: 'SwapNotSupported'; msg: 'Swap not supported'; }, { code: 6017; name: 'ExactOutAmountNotMatched'; msg: "Exact out amount doesn't match"; }, { code: 6018; name: 'SourceAndDestinationMintCannotBeTheSame'; msg: 'Source mint and destination mint cannot the same'; } ]; }; declare const IDL_V6: Jupiter; declare const JUPITER_PROGRAM_V4_ID: PublicKey; declare const JUPITER_PROGRAM_V6_ID: PublicKey; declare const JUPITER_PROGRAM_ID_DEVNET: PublicKey; declare const JUPITER_PROGRAM_ID_STAGING: PublicKey; declare const MAINNET_SERUM_DEX_PROGRAM: PublicKey; declare const DEVNET_SERUM_DEX_PROGRAM: PublicKey; declare const RAYDIUM_AMM_V4_PROGRAM_ID: PublicKey; declare const ALDRIN_SWAP_PROGRAM_ID: PublicKey; declare const ALDRIN_SWAP_V2_PROGRAM_ID: PublicKey; declare const SABER_ADD_DECIMALS_PROGRAM_ID: PublicKey; declare const CROPPER_PROGRAM_ID: PublicKey; declare const SENCHA_PROGRAM_ID: PublicKey; declare const LIFINITY_PROGRAM_ID: PublicKey; declare const CREMA_PROGRAM_ID: PublicKey; declare const CREMA_PARTNER_ACCOUNT: PublicKey; declare const MERCURIAL_SWAP_PROGRAM_ID: PublicKey; declare const WHIRLPOOL_PROGRAM_ID: PublicKey; declare const INVARIANT_PROGRAM_ID: PublicKey; declare const INVARIANT_STATE_ID: PublicKey; declare const INVARIANT_PROGRAM_AUTHORITY_ID: PublicKey; declare const CYKURA_PROGRAM_ID: PublicKey; declare const CYKURA_FACTORY_STATE_ADDRESS: PublicKey; declare const MARINADE_PROGRAM_ID: PublicKey; declare const STEPN_PROGRAM_ID: PublicKey; declare const ORCA_V1_PROGRAM_ID: PublicKey; declare const ORCA_V2_PROGRAM_ID: PublicKey; declare const STEP_TOKEN_SWAP_PROGRAM_ID: PublicKey; declare const PENGUIN_PROGRAM_ID: PublicKey; declare const SAROS_PROGRAM_ID: PublicKey; declare const METEORA_PROGRAM_ID: PublicKey; declare const METEORA_VAULT_PROGRAM_ID: PublicKey; declare const DELTA_FI_PROGRAM_ID: PublicKey; declare const DELTA_FI_USER_ID: PublicKey; declare const GOOSE_FX_PROGRAM_ID: PublicKey; declare const GOOSE_FX_CONTROLLER_ID: PublicKey; declare const BALANSOL_PROGRAM_ID: PublicKey; declare const DRADEX_PROGRAM_ID: PublicKey; declare const DRADEX_LOGGER_PROGRAM_ID: PublicKey; declare const DRADEX_MASTER_ID: PublicKey; declare const LIFINITY_V2_PROGRAM_ID: PublicKey; declare const DRADEX_DEX_USER: PublicKey; declare const RAYDIUM_CLMM_PROGRAM_ID: PublicKey; declare const OPENBOOK_PROGRAM_ID: PublicKey; declare const MARCO_POLO_PROGRAM_ID: PublicKey; declare const MARCO_POLO_STATE_ID: PublicKey; declare const MARCO_POLO_PROGRAM_AUTHORITY: PublicKey; declare const BONK_SWAP_PROGRAM_ID: PublicKey; declare const BONK_SWAP_STATE_ID: PublicKey; declare const BONK_SWAP_PROGRAM_AUTHORITY: PublicKey; declare const PHOENIX_PROGRAM_ID: PublicKey; declare const SYMMETRY_PROGRAM_ID: PublicKey; declare const WRAPPED_SOL_MINT: PublicKey; declare const MARKETS_URL: Record; declare const INDEXED_ROUTE_MAP_URL = "https://cache.jup.ag/indexed-route-maps-v3"; declare const TOKEN_LIST_URL: Record; declare const LAMPORTS_PER_SIGNATURE = 5000; declare const JUPITER_FEE_OWNER: PublicKey; interface ErrorDetails { code: number; name: string; msg: string; } type COMMON_ERRORS = keyof typeof JUPITER_COMMON_ERRORS; type JUPITER_V6_ERROR_TYPES = COMMON_ERRORS | (typeof IDL_V6.errors)[number]['name']; declare const JUPITER_COMMON_ERRORS: { AlreadyInUse: { code: number; name: string; msg: string; }; InsufficientSOL: { code: number; name: string; msg: string; }; TransactionNotConfirmed: { code: number; name: string; msg: string; }; BalancesNotExtractedProperly: { code: number; name: string; msg: string; }; TooManyAccountLocked: { code: number; name: string; msg: string; }; FrozenAccount: { code: number; name: string; msg: string; }; }; declare const JUPITER_V6_ERRORS: Record; declare const calculateTransactionDepositAndFee: ({ intermediates, destination, openOrders, hasWrapUnwrapSOL, feeCalculator, }: SetupInstructions & { hasWrapUnwrapSOL: boolean; feeCalculator: FeeCalculator; }) => TransactionFeeInfo; interface CalculateTransactionFeeAndDepositParams { numOfAtasToBeCreated: number; numOfOpenOrdersToBeCreated: number; isInputMintSOL: boolean; } declare const calculateTransactionDepositAndFeeV2: ({ numOfAtasToBeCreated, numOfOpenOrdersToBeCreated, isInputMintSOL, }: CalculateTransactionFeeAndDepositParams) => TransactionFeeInfo; interface GetReferralTokenAccountParams { connection: Connection; referralAccount: PublicKey; mint: PublicKey; } /** Provides the referral token account address if the account exists and is not frozen */ declare const getReferralTokenAccount: ({ connection, referralAccount, mint }: GetReferralTokenAccountParams) => Promise; export { ALDRIN_SWAP_PROGRAM_ID, ALDRIN_SWAP_V2_PROGRAM_ID, BALANSOL_PROGRAM_ID, BONK_SWAP_PROGRAM_AUTHORITY, BONK_SWAP_PROGRAM_ID, BONK_SWAP_STATE_ID, CREMA_PARTNER_ACCOUNT, CREMA_PROGRAM_ID, CROPPER_PROGRAM_ID, CYKURA_FACTORY_STATE_ADDRESS, CYKURA_PROGRAM_ID, DELTA_FI_PROGRAM_ID, DELTA_FI_USER_ID, DEVNET_SERUM_DEX_PROGRAM, DRADEX_DEX_USER, DRADEX_LOGGER_PROGRAM_ID, DRADEX_MASTER_ID, DRADEX_PROGRAM_ID, type ErrorDetails, type ExchangeParams, type ExecuteParams, type Fee, GOOSE_FX_CONTROLLER_ID, GOOSE_FX_PROGRAM_ID, IDL_V6, INDEXED_ROUTE_MAP_URL, INVARIANT_PROGRAM_AUTHORITY_ID, INVARIANT_PROGRAM_ID, INVARIANT_STATE_ID, type IndexedRouteMap, type Instruction, JUPITER_COMMON_ERRORS, JUPITER_FEE_OWNER, JUPITER_PROGRAM_ID_DEVNET, JUPITER_PROGRAM_ID_STAGING, JUPITER_PROGRAM_V4_ID, JUPITER_PROGRAM_V6_ID, JUPITER_V6_ERRORS, type Jupiter, LAMPORTS_PER_SIGNATURE, LIFINITY_PROGRAM_ID, LIFINITY_V2_PROGRAM_ID, MAINNET_SERUM_DEX_PROGRAM, MARCO_POLO_PROGRAM_AUTHORITY, MARCO_POLO_PROGRAM_ID, MARCO_POLO_STATE_ID, MARINADE_PROGRAM_ID, MARKETS_URL, MERCURIAL_SWAP_PROGRAM_ID, METEORA_PROGRAM_ID, METEORA_VAULT_PROGRAM_ID, OPENBOOK_PROGRAM_ID, ORCA_V1_PROGRAM_ID, ORCA_V2_PROGRAM_ID, type OnTransaction, Owner, PENGUIN_PROGRAM_ID, PHOENIX_PROGRAM_ID, type PlatformFee, type PlatformFeeAndAccounts, type QuoteMintToReferrer, RAYDIUM_AMM_V4_PROGRAM_ID, RAYDIUM_CLMM_PROGRAM_ID, SABER_ADD_DECIMALS_PROGRAM_ID, SAROS_PROGRAM_ID, SENCHA_PROGRAM_ID, STEPN_PROGRAM_ID, STEP_TOKEN_SWAP_PROGRAM_ID, SYMMETRY_PROGRAM_ID, type SetupInstructions, SwapMode, type SwapResult, TOKEN_LIST_URL, type TokenMintAddress, TransactionBuilder, type TransactionFeeInfo, type TransactionPayload, WHIRLPOOL_PROGRAM_ID, WRAPPED_SOL_MINT, calculateTransactionDepositAndFee, calculateTransactionDepositAndFeeV2, createAndCloseWSOLAccount, createAssociatedTokenAccountIdempotentInstruction, executeTransaction, extractSOLChangeFromTransaction, extractTokenBalanceChangeFromTransaction, extractTokenBalanceChangesFromEvents, findAssociatedTokenAddress, findOrCreateAssociatedAccountByMint, getEmptyInstruction, getEvents, getReferralTokenAccount, getRemoteRouteMap, getSignature, getTokenBalanceChangesFromTransactionResponse, getTransactionBlockhash, getUnixTs, indexedRouteMapToRouteMap, mapCommonErrorToJupiterError, routeMapToIndexedRouteMap, signTransaction, wait };