diff --git a/sdk/src/driftClient.ts b/sdk/src/driftClient.ts index 6a3bd76af..fd1c77c23 100644 --- a/sdk/src/driftClient.ts +++ b/sdk/src/driftClient.ts @@ -3733,6 +3733,10 @@ export class DriftClient { quote = fetchedQuote; } + if (!quote) { + throw new Error("Could not fetch Jupiter's quote. Please try again."); + } + const transaction = await jupiterClient.getSwap({ quote, userPublicKey: this.provider.wallet.publicKey, diff --git a/sdk/src/jupiter/jupiterClient.ts b/sdk/src/jupiter/jupiterClient.ts index 5a2759ba3..796f51349 100644 --- a/sdk/src/jupiter/jupiterClient.ts +++ b/sdk/src/jupiter/jupiterClient.ts @@ -319,6 +319,10 @@ export class JupiterClient { userPublicKey: PublicKey; slippageBps?: number; }): Promise { + if (!quote) { + throw new Error("Jupiter swap quote not provided. Please try again."); + } + const resp = await ( await fetch(`${this.url}/v6/swap`, { method: 'POST',