Cobo Agentic Wallet
Jupiter Swap Sol

Jupiter Swap Sol

Route token swaps through Jupiter aggregation on Solana for best execution.

CategoryTradingDeFi
ChainsSOLSOL_DEVNET
C
Cobo· Author
147 views·45 uses

Overview

Route token swaps through Jupiter aggregation on Solana for best execution.

SOL: real assets, real liquidity — default for production use
SOL_DEVNET: same program ID and API; no real liquidity — use for tx-flow testing only

Facts

jupiter_v6: JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4identical on SOL and SOL_DEVNET
api.quote: https://quote-api.jup.ag/v6/quote (same endpoint for both networks)
api.swap: https://quote-api.jup.ag/v6/swap (same endpoint for both networks)
target program_in: jupiter_v6
quotes expire: fetch immediately before submit
output ATA auto-created if needed
SOL_DEVNET: most pairs return no route; get Devnet SOL via solana airdrop 2 <addr> --url devnet
amount unit: integer base units — USDC × 10^6, SOL/WSOL × 10^9 (match decimals from token metadata)
quote param slippageBps: 50 (stable pairs), 100–200 (volatile); or set autoSlippage: true
swap body option prioritizationFeeLamports: set "auto" or integer to boost tx inclusion
swap body option dynamicComputeUnitLimit: set true for multi-hop routes to avoid compute overrun
tx format: Jupiter returns base64-encoded VersionedTransaction; deserialize → sign → sendRawTransaction

Typical Flows

Swap — 1 atomic tx (no approve step):

1.GET /v6/quote?inputMint=&outputMint=&amount=&slippageBps= — get route; check priceImpactPct
2.POST /v6/swap {quoteResponse, userPublicKey} — get base64-serialized VersionedTransaction
3.Submit via caw tx call --pact-id targeting Jupiter program

Policy Controls

Slippage is agent's responsibility: Policy validates program ID + USD value only; set slippageBps and minimum output correctly.
Price impact: Check priceImpactPct in quote response; reject if >1% for large swaps.
Compute budget: Complex multi-hop routes may exceed limits; use dynamicComputeUnitLimit: true.
SOL_DEVNET — no liquidity: Most pairs return "no route" on Devnet; expected behavior.
Policy denial: Parse reason (per-tx or cumulative cap exceeded); retry with compliant amount.
Not applicable for: EVM chain swaps — use uniswap-v3-swap; SOL_DEVNET in production — no real liquidity available
Partial reference: use web search for unlisted tokens, contracts, parameters, or up-to-date addresses

References

Docs: https://docs.jup.ag/llms.txt — Quote/swap API, versioned transaction format, slippage params, multi-hop route encoding.