onchain_jupiter_order
Jupiter Swap v2 — get a Solana SAME-CHAIN swap quote and unsigned transaction. Wraps GET https://api.jup.ag/swap/v2/order.
ROUTING — pick the right swap tool, do not guess:
• Solana → Solana (same chain, both mints are SPL or wSOL): USE THIS TOOL (onchain_jupiter_order + onchain_jupiter_execute).
• EVM ↔ EVM same chain (e.g. USDC → USDT on Polygon, ETH → USDC on Base): use relay_get_quote / relay_execute with originChainId === destinationChainId.
• Any cross-chain (EVM ↔ EVM different chains, EVM ↔ Solana, Solana ↔ EVM, Solana ↔ BTC, etc.): use relay_get_quote / relay_execute.
Never use Jupiter for non-Solana swaps; never use Relay for Solana same-chain swaps — Relay's Solana same-chain pricing is worse and Jupiter handles SPL routing natively.
PRE-SWAP CHECKLIST — do all six steps in order, do not skip. Stop and ask the user if any step is ambiguous.
RESOLVE TOKEN ADDRESSES. If the user named a token by symbol/name ("buy PEPE", "swap into BONK") and not by mint, call
onchain_search_tokenswith the symbol (omitnetworkIds— search all chains, then filter the response to Solana entries only by checking each result's chain/network field). Pick the highest-liquidity / highest-marketCap match on Solana. If multiple candidates exist with similar liquidity, show the top 3 with priceUSD + marketCap + mint and ask the user which one. If the canonical match isn't on Solana, switch torelay_get_quoteinstead (per the routing rule above).DEFAULT THE OTHER SIDE TO wSOL. If the user only named one token (e.g. "buy PEPE for $50", "sell my BONK"), default the unspecified side to wrapped SOL
So11111111111111111111111111111111111111112. Examples: "buy PEPE for $50 worth of SOL" → inputMint=wSOL, outputMint=PEPE_mint "sell 1000 BONK" → inputMint=BONK_mint, outputMint=wSOL For ANY swap where the counterparty wasn't explicit, wSOL is the default — never substitute USDC, USDT, or any other token unless the user explicitly asked.SHOW THE DEXSCREENER LINK. Before any quote, surface a DexScreener URL for the non-wSOL token so the user can verify the project / chart / liquidity: https://dexscreener.com/solana/<token_mint_lowercased> Example:
https://dexscreener.com/solana/etmhxtenfkmk85tacveebzdbv9htziwzdsddmshrp2wb. Present it as a clickable line in your reply (the user clicks if they want to verify).ALWAYS SHOW MARKET CAP. Quote the marketCap from the search result inline (e.g. "PEPE on Solana — mcap $4.2M, liquidity $890K, 24h vol $2.1M"). Always — even for blue-chip tokens. Numbers anchor the user.
WARN ON THIN / VOLATILE TOKENS. If marketCap < $10M OR |change24| > 30% OR liquidity < $250K, surface this verbatim BEFORE the confirmation prompt: ⚠️ THIN / VOLATILE TOKEN — has marketCap $, liquidity $, 24h change %. Slippage and rug risk are elevated. Only swap an amount you're willing to lose. Adjust the message wording slightly if only one of the conditions trips, but always include the three numbers.
EXPLICIT CONFIRMATION GATE. Show input token + amount, output token + estimated amount (from the quote), price impact, slippage, route, DexScreener link, mcap, and any warning. Then ask the user "type 'yes' to confirm". Do not call
onchain_jupiter_executeuntil they reply yes. For known blue chips (SOL, USDC, USDT, JUP, JTO, RAY, BONK with mcap >$100M), a brief summary + confirmation is enough; for everything else use the warning template above.
The caller's Privy Solana address is auto-filled as taker if you don't pass one — that's required by Jupiter for the response to include a signable transaction field. Returns the full Jupiter order: inAmount / outAmount / priceImpact / routePlan (route splits across AMMs) / fees / transaction (base64 UNSIGNED — sign + execute via onchain_jupiter_execute) / requestId (required by /execute) / lastValidBlockHeight. Amounts are in the smallest unit of inputMint (USDC has 6 decimals: 1000000 = 1 USDC; SOL has 9 decimals: 1000000000 = 1 SOL).
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"inputMint": "<inputMint>",
"outputMint": "<outputMint>",
"amount": "<amount>"
},
"name": "onchain_jupiter_order"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| payer | No | Account covering gas-related fees. | |
| taker | No | Override the caller Solana address. Leave blank to use the caller wallet (required for a signable transaction). | |
| amount | Yes | Amount of inputMint to swap, in smallest unit (string-encoded integer). | |
| receiver | No | Account that receives the output token. Must differ from taker if provided. | |
| swapMode | No | Currently only ExactIn is supported. | |
| inputMint | Yes | SPL mint address of the token being sold (e.g. USDC = EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v, wSOL = So11111111111111111111111111111111111111112). | |
| outputMint | Yes | SPL mint address of the token being bought. | |
| slippageBps | No | Slippage tolerance in basis points (50 = 0.5%). Default ~auto. | |
| excludeDexes | No | Comma-separated DEX IDs to exclude from the Metis router. | |
| excludeRouters | No | Comma-separated router IDs to exclude. | |
| jitoTipLamports | No | ||
| broadcastFeeType | No | ||
| priorityFeeLamports | No |