import * as _jup_ag_common from '@jup-ag/common'; import { SwapMode, ExchangeParams, ExecuteParams, SwapResult, PlatformFeeAndAccounts } from '@jup-ag/common'; export { ErrorDetails, Fee, IndexedRouteMap, Instruction, JUPITER_FEE_OWNER, JUPITER_PROGRAM_V4_ID, JUPITER_PROGRAM_V6_ID, JUPITER_V6_ERRORS, LAMPORTS_PER_SIGNATURE, MARKETS_URL, OPENBOOK_PROGRAM_ID, OnTransaction, Owner, SwapMode, SwapResult, TOKEN_LIST_URL, TransactionFeeInfo } from '@jup-ag/common'; import * as _jup_ag_api from '@jup-ag/api'; import { DefaultApi, PriorityFeeWithMaxLamports } from '@jup-ag/api'; import { TransactionError } from '@mercurial-finance/optimist'; import { PublicKey, VersionedTransaction, Transaction, Blockhash, Connection } from '@solana/web3.js'; import JSBI from 'jsbi'; import React from 'react'; import * as superstruct from 'superstruct'; import { Infer } from 'superstruct'; declare const Errors: { readonly INITIALIZE_ERROR: "INITIALIZE_ERROR"; readonly FETCH_ROUTES_ERROR: "FETCH_ROUTES_ERROR"; readonly NO_ROUTES_ERROR: "NO_ROUTES_ERROR"; readonly TOKEN_NOT_TRADABLE: "TOKEN_NOT_TRADABLE"; readonly COULD_NOT_FIND_ANY_ROUTE: "COULD_NOT_FIND_ANY_ROUTE"; readonly INVALID_REQUEST: "INVALID_REQUEST"; readonly ROUTE_PLAN_DOES_NOT_CONSUME_ALL_THE_AMOUNT: "ROUTE_PLAN_DOES_NOT_CONSUME_ALL_THE_AMOUNT"; }; type SwapInfo = Infer; declare const SwapInfo: superstruct.Struct<{ inputMint: string; inAmount: JSBI; outputMint: string; outAmount: JSBI; ammKey: PublicKey; label: string; feeAmount: JSBI; feeMint: PublicKey; }, { ammKey: superstruct.Struct; label: superstruct.Struct; inputMint: superstruct.Struct; outputMint: superstruct.Struct; inAmount: superstruct.Struct; outAmount: superstruct.Struct; feeAmount: superstruct.Struct; feeMint: superstruct.Struct; }>; type RoutePlanStep = Infer; declare const RoutePlanStep: superstruct.Struct<{ swapInfo: { inputMint: string; inAmount: JSBI; outputMint: string; outAmount: JSBI; ammKey: PublicKey; label: string; feeAmount: JSBI; feeMint: PublicKey; }; percent: number; }, { swapInfo: superstruct.Struct<{ inputMint: string; inAmount: JSBI; outputMint: string; outAmount: JSBI; ammKey: PublicKey; label: string; feeAmount: JSBI; feeMint: PublicKey; }, { ammKey: superstruct.Struct; label: superstruct.Struct; inputMint: superstruct.Struct; outputMint: superstruct.Struct; inAmount: superstruct.Struct; outAmount: superstruct.Struct; feeAmount: superstruct.Struct; feeMint: superstruct.Struct; }>; percent: superstruct.Struct; }>; type RoutePlanWithMetadata = Infer; declare const RoutePlanWithMetadata: superstruct.Struct<{ swapInfo: { inputMint: string; inAmount: JSBI; outputMint: string; outAmount: JSBI; ammKey: PublicKey; label: string; feeAmount: JSBI; feeMint: PublicKey; }; percent: number; }[], superstruct.Struct<{ swapInfo: { inputMint: string; inAmount: JSBI; outputMint: string; outAmount: JSBI; ammKey: PublicKey; label: string; feeAmount: JSBI; feeMint: PublicKey; }; percent: number; }, { swapInfo: superstruct.Struct<{ inputMint: string; inAmount: JSBI; outputMint: string; outAmount: JSBI; ammKey: PublicKey; label: string; feeAmount: JSBI; feeMint: PublicKey; }, { ammKey: superstruct.Struct; label: superstruct.Struct; inputMint: superstruct.Struct; outputMint: superstruct.Struct; inAmount: superstruct.Struct; outAmount: superstruct.Struct; feeAmount: superstruct.Struct; feeMint: superstruct.Struct; }>; percent: superstruct.Struct; }>>; type QuoteResponse = Infer; declare const QuoteResponse: superstruct.Struct<{ inputMint: PublicKey; inAmount: JSBI; outputMint: PublicKey; outAmount: JSBI; otherAmountThreshold: JSBI; priceImpactPct: string; swapMode: "ExactIn" | "ExactOut"; routePlan: { swapInfo: { inputMint: string; inAmount: JSBI; outputMint: string; outAmount: JSBI; ammKey: PublicKey; label: string; feeAmount: JSBI; feeMint: PublicKey; }; percent: number; }[]; slippageBps: number; contextSlot: number; computedAutoSlippage?: number | undefined; }, { inputMint: superstruct.Struct; inAmount: superstruct.Struct; outputMint: superstruct.Struct; outAmount: superstruct.Struct; otherAmountThreshold: superstruct.Struct; priceImpactPct: superstruct.Struct; swapMode: superstruct.Struct<"ExactIn" | "ExactOut", { ExactIn: "ExactIn"; ExactOut: "ExactOut"; }>; routePlan: superstruct.Struct<{ swapInfo: { inputMint: string; inAmount: JSBI; outputMint: string; outAmount: JSBI; ammKey: PublicKey; label: string; feeAmount: JSBI; feeMint: PublicKey; }; percent: number; }[], superstruct.Struct<{ swapInfo: { inputMint: string; inAmount: JSBI; outputMint: string; outAmount: JSBI; ammKey: PublicKey; label: string; feeAmount: JSBI; feeMint: PublicKey; }; percent: number; }, { swapInfo: superstruct.Struct<{ inputMint: string; inAmount: JSBI; outputMint: string; outAmount: JSBI; ammKey: PublicKey; label: string; feeAmount: JSBI; feeMint: PublicKey; }, { ammKey: superstruct.Struct; label: superstruct.Struct; inputMint: superstruct.Struct; outputMint: superstruct.Struct; inAmount: superstruct.Struct; outAmount: superstruct.Struct; feeAmount: superstruct.Struct; feeMint: superstruct.Struct; }>; percent: superstruct.Struct; }>>; slippageBps: superstruct.Struct; contextSlot: superstruct.Struct; computedAutoSlippage: superstruct.Struct; }>; type QuoteResponseMeta = { quoteResponse: QuoteResponse; original: any; }; type JupiterError = (typeof Errors)[keyof typeof Errors]; interface UseJupiterResult { /** The quote response deserialized and the original */ quoteResponseMeta?: QuoteResponseMeta; /** exchange function to submit transaction */ exchange: (params: ExchangeParams & ExecuteParams & { prioritizationFeeLamports: ExchangeParams['prioritizationFeeLamports'] | { priorityLevelWithMaxLamports: PriorityFeeWithMaxLamports; } | undefined; }) => Promise; fetchQuote: () => Promise<{ quoteResponse: QuoteResponse; original: any; timestamp: number; } | null>; /** fetchSwapTransaction function to fetch the transaction */ fetchSwapTransaction: (params: Pick, 'quoteResponseMeta' | 'userPublicKey' | 'wrapUnwrapSOL' | 'allowOptimizedWrappedSolTokenAccount'> & { enableSwapEndpointFee?: boolean; prioritizationFeeLamports: ExchangeParams['prioritizationFeeLamports'] | { priorityLevelWithMaxLamports: PriorityFeeWithMaxLamports; } | undefined; dynamicSlippage?: { minBps?: number; maxBps?: number; }; }) => Promise<{ dynamicSlippageReport?: { slippageBps?: number; otherAmount?: number; simulatedIncurredSlippageBps?: number; amplificationRatio?: string; }; swapTransaction: VersionedTransaction | Transaction; blockhash: Blockhash; lastValidBlockHeight: number; } | { error: TransactionError; }>; /** refresh function to refetch the prices */ refresh: () => void; /** last refresh timestamp */ lastRefreshTimestamp: number; /** loading state */ loading: boolean; error: JupiterError | undefined; programIdToLabelMap: Map; programIdsExcluded: Set; setProgramIdsExcluded: React.Dispatch>>; } interface JupiterProps { connection: Connection; platformFeeAndAccounts?: PlatformFeeAndAccounts; wrapUnwrapSOL?: boolean; onlyDirectRoutes?: boolean; asLegacyTransaction?: boolean; useSharedAccounts?: boolean; userPublicKey?: PublicKey; routeCacheDuration?: number; jupiterQuoteApiUrl?: string; children?: React.ReactNode; computeAutoSlippage?: boolean; whitelistedFeeMints?: string[]; } declare const JupiterProvider: React.FC; interface UseJupiterProps { amount: JSBI; inputMint: PublicKey | undefined; outputMint: PublicKey | undefined; autoSlippage?: boolean; maxAutoSlippageBps?: number; autoSlippageCollisionUsdValue?: number; slippageBps?: number; debounceTime?: number; swapMode?: SwapMode; maxAccounts?: number; disabledProgramIds?: string[]; computeAutoSlippage?: boolean; minimizeSlippage?: boolean; preferLiquidDexes?: boolean; } declare const useJupiterClient: () => DefaultApi; declare const useJupiter: ({ amount, inputMint, outputMint, autoSlippage, maxAutoSlippageBps, autoSlippageCollisionUsdValue, slippageBps, swapMode, debounceTime, maxAccounts, disabledProgramIds, computeAutoSlippage, minimizeSlippage, preferLiquidDexes, }: UseJupiterProps) => UseJupiterResult; declare const useJupiterExchange: (swapMode: SwapMode | undefined) => { exchange: (params: ExchangeParams & ExecuteParams & { prioritizationFeeLamports: ExchangeParams['prioritizationFeeLamports'] | { priorityLevelWithMaxLamports: PriorityFeeWithMaxLamports; } | undefined; }) => Promise; fetchSwapTransaction: ({ quoteResponseMeta, userPublicKey, wrapUnwrapSOL: propsWrapUnwrapSOL, prioritizationFeeLamports, allowOptimizedWrappedSolTokenAccount, dynamicSlippage, }: Parameters[0]) => Promise<{ error: TransactionError; } | { swapTransaction: VersionedTransaction | Transaction; blockhash: string; lastValidBlockHeight: number; dynamicSlippageReport: _jup_ag_api.SwapResponseDynamicSlippageReport | undefined; }>; }; declare const calculateFeeForSwap: (quoteResponse: QuoteResponse | undefined, mintToAtaMap: Map, openbookMarketToOpenOrderMap: Map, wrapUnwrapSOL: boolean, useSharedAccounts: boolean) => _jup_ag_common.TransactionFeeInfo; export { Errors, type JupiterError, JupiterProvider, QuoteResponse, type QuoteResponseMeta, RoutePlanStep, RoutePlanWithMetadata, SwapInfo, type UseJupiterProps, calculateFeeForSwap, useJupiter, useJupiterClient, useJupiterExchange };