/** Swap direction. */ type SwapMode = "ExactIn" | "ExactOut"; /** Optional instruction format version for the swap-instructions endpoint. */ type InstructionVersion = "V1" | "V2"; /** Query parameters for `GET /quote`. */ interface QuoteGetRequest { inputMint: string; outputMint: string; amount: number; slippageBps?: number; swapMode?: SwapMode; dexes?: Array; excludeDexes?: Array; restrictIntermediateTokens?: boolean; onlyDirectRoutes?: boolean; asLegacyTransaction?: boolean; platformFeeBps?: number; maxAccounts?: number; instructionVersion?: InstructionVersion; dynamicSlippage?: boolean; /** * Set to true if the quote will be consumed in a Jito bundle. Excludes DEXes * that are incompatible with Jito bundles (e.g. HumidiFi). Flashloan swaps in * this SDK always execute inside a Jito bundle, so they set this to true. */ forJitoBundle?: boolean; } interface PlatformFee { amount?: string; feeBps?: number; } interface SwapInfo { ammKey: string; label?: string; inputMint: string; outputMint: string; inAmount: string; outAmount: string; } interface RoutePlanStep { swapInfo: SwapInfo; percent?: number | null; bps?: number; } /** Response from `GET /quote`. */ interface QuoteResponse { inputMint: string; inAmount: string; outputMint: string; outAmount: string; otherAmountThreshold: string; swapMode: SwapMode; slippageBps: number; platformFee?: PlatformFee; priceImpactPct: string; routePlan: Array; contextSlot?: number; timeTaken?: number; } interface AccountMeta { pubkey: string; isSigner: boolean; isWritable: boolean; } interface Instruction { programId: string; accounts: Array; data: string; } /** * Body for `POST /swap-instructions`. Only the fields the SDK sets are modelled * explicitly; the remaining optional knobs are passed through loosely so we * don't have to track every Jupiter request option. */ interface SwapRequest { quoteResponse: QuoteResponse; userPublicKey: string; payer?: string; wrapAndUnwrapSol?: boolean; useSharedAccounts?: boolean; feeAccount?: string; trackingAccount?: string; prioritizationFeeLamports?: unknown; asLegacyTransaction?: boolean; destinationTokenAccount?: string; nativeDestinationAccount?: string; dynamicComputeUnitLimit?: boolean; skipUserAccountsRpcCalls?: boolean; dynamicSlippage?: boolean; computeUnitPriceMicroLamports?: number; blockhashSlotsToExpiry?: number; } /** Response from `POST /swap-instructions`. */ interface SwapInstructionsResponse { otherInstructions: Array; computeBudgetInstructions: Array; setupInstructions: Array; swapInstruction: Instruction; cleanupInstruction?: Instruction; addressLookupTableAddresses: Array; } /** Query parameters for `GET /swap/v2/build`. */ interface BuildGetRequest { inputMint: string; outputMint: string; amount: number; /** The account performing the swap (replaces Metis `userPublicKey`). */ taker: string; slippageBps?: number; /** "fast" trades route optimality for lower latency. */ mode?: "fast"; dexes?: Array; excludeDexes?: Array; platformFeeBps?: number; feeAccount?: string; maxAccounts?: number; payer?: string; wrapAndUnwrapSol?: boolean; destinationTokenAccount?: string; /** * Set to true if the transaction will be submitted as part of a Jito bundle. * Excludes DEXes that are incompatible with Jito bundles (their routes can * lock vote accounts, which Jito rejects with "bundles cannot lock any vote * accounts"). Defaults to false on the API side. */ forJitoBundle?: boolean; } /** Response from `GET /swap/v2/build`. */ interface BuildResponse { inputMint: string; outputMint: string; inAmount: string; outAmount: string; otherAmountThreshold: string; swapMode: string; slippageBps: number; routePlan: Array; computeBudgetInstructions: Array; setupInstructions: Array; swapInstruction: Instruction; cleanupInstruction?: Instruction | null; otherInstructions?: Array; tipInstruction?: Instruction | null; /** Map of ALT address -> the addresses stored inside it (in order). */ addressesByLookupTableAddress?: Record | null; blockhashWithMetadata?: { blockhash: number[]; lastValidBlockHeight: number; }; } interface JupiterClientConfig { /** Override the API base URL (e.g. the paid `https://api.jup.ag/swap/v1`). */ basePath?: string; /** Override the Router base URL for `/build` (default `.../swap/v2`). */ routerBasePath?: string; /** API key, sent as the `x-api-key` header. */ apiKey?: string; /** Extra headers applied to every request. */ headers?: Record; } declare class JupiterApiError extends Error { status: number; body: string; constructor(status: number, body: string); } interface JupiterClient { quoteGet(request: QuoteGetRequest): Promise; swapInstructionsPost(request: { swapRequest: SwapRequest; }): Promise; /** Router: one-call quote + raw instructions. ExactIn only. */ buildGet(request: BuildGetRequest): Promise; } declare function createJupiterClient(config?: JupiterClientConfig): JupiterClient; export { type AccountMeta, type BuildGetRequest, type BuildResponse, type Instruction, type InstructionVersion, JupiterApiError, type JupiterClient, type JupiterClientConfig, type PlatformFee, type QuoteGetRequest, type QuoteResponse, type RoutePlanStep, type SwapInfo, type SwapInstructionsResponse, type SwapMode, type SwapRequest, createJupiterClient };