You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The cookbook currently has no reference for executing swaps programmatically via Jupiter — the most widely used DEX aggregator on Solana. This is one of the most common things Solana developers need to do in client code, and a frequent source of confusion (especially around versioned transactions, ATA creation, and endpoint changes).
What I want to add
A new entry under References → Tokens (or a standalone guide) covering:
1. Get a swap quote
// GET /swap/v1/quoteconstparams=newURLSearchParams({ inputMint, outputMint, amount, slippageBps });constquote=awaitfetch(`https://lite-api.jup.ag/swap/v1/quote?${params}`).then(r=>r.json());
2. Build and execute the swap transaction
// POST /swap/v1/swap — returns a VersionedTransactionconst{ swapTransaction }=awaitfetch('https://lite-api.jup.ag/swap/v1/swap',{method: 'POST',body: JSON.stringify({quoteResponse: quote,userPublicKey: wallet.publicKey.toString(),wrapAndUnwrapSol: true})}).then(r=>r.json());// Deserialize, sign, sendconsttx=VersionedTransaction.deserialize(Buffer.from(swapTransaction,'base64'));tx.sign([keypair]);constsig=awaitconnection.sendRawTransaction(tx.serialize());
wrapAndUnwrapSol: true — handles ATA creation automatically, required for first-time token purchases
Price impact check — reject trades where priceImpactPct > 1-3%
Endpoint tiers: lite-api.jup.ag (free) vs api.jup.ag (paid)
Blockhash confirmation pattern for reliable tx confirmation
Why this is needed
Jupiter processes billions in volume — it's the de facto swap standard on Solana
The v6 API endpoint (quote-api.jup.ag) now requires auth; the free endpoint changed and many existing guides are stale
VersionedTransaction confusion is the Initial MVP layout #1 issue I see new Solana devs hit when working with Jupiter
My background
I have a working production implementation of this (a live trading bot) — this guide would be based on real, battle-tested code rather than untested examples.
I'll submit a PR if this is in scope for the cookbook.
Summary
The cookbook currently has no reference for executing swaps programmatically via Jupiter — the most widely used DEX aggregator on Solana. This is one of the most common things Solana developers need to do in client code, and a frequent source of confusion (especially around versioned transactions, ATA creation, and endpoint changes).
What I want to add
A new entry under References → Tokens (or a standalone guide) covering:
1. Get a swap quote
2. Build and execute the swap transaction
Key things to document
VersionedTransaction(notTransaction) — Jupiter uses v0 transactions with Address Lookup TableswrapAndUnwrapSol: true— handles ATA creation automatically, required for first-time token purchasespriceImpactPct > 1-3%lite-api.jup.ag(free) vsapi.jup.ag(paid)Why this is needed
quote-api.jup.ag) now requires auth; the free endpoint changed and many existing guides are staleMy background
I have a working production implementation of this (a live trading bot) — this guide would be based on real, battle-tested code rather than untested examples.
I'll submit a PR if this is in scope for the cookbook.