diff --git a/sdk/src/adminClient.ts b/sdk/src/adminClient.ts index bb2fb35ae..77225f57f 100644 --- a/sdk/src/adminClient.ts +++ b/sdk/src/adminClient.ts @@ -6043,7 +6043,7 @@ export class AdminClient extends DriftClient { } if (!quote) { - throw new Error("Could not fetch Jupiter's quote. Please try again."); + throw new Error('Could not fetch swap quote. Please try again.'); } const isExactOut = swapMode === 'ExactOut' || quote.swapMode === 'ExactOut'; diff --git a/sdk/src/driftClient.ts b/sdk/src/driftClient.ts index 595d68a34..bd58bff9a 100644 --- a/sdk/src/driftClient.ts +++ b/sdk/src/driftClient.ts @@ -5768,15 +5768,15 @@ export class DriftClient { * @param jupiterClient @deprecated Use swapClient instead. Legacy parameter for backward compatibility * @param outMarketIndex the market index of the token you're buying * @param inMarketIndex the market index of the token you're selling - * @param outAssociatedTokenAccount the token account to receive the token being sold on titan or jupiter + * @param outAssociatedTokenAccount the token account to receive the token being sold on the swap provider * @param inAssociatedTokenAccount the token account to * @param amount the amount of TokenIn, regardless of swapMode - * @param slippageBps the max slippage passed to titan or jupiter api - * @param swapMode titan or jupiter swapMode (ExactIn or ExactOut), default is ExactIn - * @param route the titan or jupiter route to use for the swap + * @param slippageBps the max slippage passed to the swap provider api + * @param swapMode swap provider swapMode (ExactIn or ExactOut), default is ExactIn + * @param route the swap provider route to use for the swap * @param reduceOnly specify if In or Out token on the drift account must reduceOnly, checked at end of swap - * @param v6 pass in the quote response from Jupiter quote's API (deprecated, use quote instead) - * @param quote pass in the quote response from Jupiter quote's API + * @param v6 pass in the quote response from swap provider quote's API (deprecated, use quote instead) + * @param quote pass in the quote response from swap provider quote's API * @param txParams */ public async swap({ @@ -6059,7 +6059,7 @@ export class DriftClient { } if (!quote) { - throw new Error("Could not fetch Jupiter's quote. Please try again."); + throw new Error('Could not fetch swap quote. Please try again.'); } const isExactOut = swapMode === 'ExactOut' || quote.swapMode === 'ExactOut'; @@ -8910,7 +8910,7 @@ export class DriftClient { } if (!quote) { - throw new Error("Could not fetch Jupiter's quote. Please try again."); + throw new Error('Could not fetch swap quote. Please try again.'); } const amountIn = new BN(quote.inAmount); diff --git a/sdk/src/math/superStake.ts b/sdk/src/math/superStake.ts index 464c27000..1614f1b3a 100644 --- a/sdk/src/math/superStake.ts +++ b/sdk/src/math/superStake.ts @@ -223,7 +223,7 @@ export async function findBestJitoSolSuperStakeIxs({ } /** - * Finds best Jupiter Swap instructions for a generic lstMint + * Finds best swap instructions for a generic lstMint * * Without doing any extra steps like checking if you can get a better rate by staking directly with that LST platform */ diff --git a/sdk/src/swap/UnifiedSwapClient.ts b/sdk/src/swap/UnifiedSwapClient.ts index 966f7e71b..e73cc4a69 100644 --- a/sdk/src/swap/UnifiedSwapClient.ts +++ b/sdk/src/swap/UnifiedSwapClient.ts @@ -20,7 +20,29 @@ import { export type SwapMode = 'ExactIn' | 'ExactOut'; export type SwapClientType = 'jupiter' | 'titan'; -export type UnifiedQuoteResponse = JupiterQuoteResponse | TitanQuoteResponse; +/** + * Unified quote response interface that combines properties from both Jupiter and Titan + * This provides a consistent interface while allowing for provider-specific fields + */ +export interface UnifiedQuoteResponse { + // Core properties available in both providers + inputMint: string; + inAmount: string; + outputMint: string; + outAmount: string; + swapMode: SwapMode; + slippageBps: number; + routePlan: Array<{ swapInfo: any; percent: number }>; + + // Optional properties that may not be available in all providers + otherAmountThreshold?: string; // Jupiter has this, Titan doesn't + priceImpactPct?: string; // Jupiter provides this, Titan doesn't (we calculate it) + platformFee?: { amount?: string; feeBps?: number }; // Format varies between providers + contextSlot?: number; + timeTaken?: number; + error?: string; + errorCode?: string; +} export interface SwapQuoteParams { inputMint: PublicKey; @@ -135,7 +157,7 @@ export class UnifiedSwapClient { ): Promise { if (this.clientType === 'jupiter') { const jupiterClient = this.client as JupiterClient; - // Cast the quote to Jupiter's QuoteResponse type + // Cast the quote to Jupiter's specific QuoteResponse type const jupiterParams = { ...params, quote: params.quote as JupiterQuoteResponse, @@ -213,7 +235,7 @@ export class UnifiedSwapClient { } if (!finalQuote) { - throw new Error("Could not fetch Jupiter's quote. Please try again."); + throw new Error('Could not fetch swap quote. Please try again.'); } // Get swap transaction and extract instructions