internet-court/internet-court-skill / vendored/jupiter/jupiter-swap-migration
jupiter-swap-migration
VerifiedMigration guide from Jupiter Metis (v1) or Ultra to Swap API v2. Use when migrating existing Jupiter swap integrations, updating base URLs, or transitioning from quote+swap-instructions to the unified build endpoint.
| File | Kind | Size |
|---|---|---|
| LICENSE | other | 1.0 KB |
| README.md | markdown | 1.1 KB |
| SKILL.md | skill md | 4.8 KB |
| examples/metis-to-build.md | markdown | 4.2 KB |
| examples/metis-to-order.md | markdown | 2.4 KB |
| examples/ultra-to-order.md | markdown | 2.1 KB |
examples/metis-to-build.md
View on GitHub# Path 2: Metis → Swap v2 `/build`
**Effort**: Moderate — consolidates two API calls into one, with parameter and response mapping changes.
| Element | Before (Metis v1) | After (Swap v2) |
|---------|-------------------|-----------------|
| Base URL | `https://api.jup.ag/swap/v1` | `https://api.jup.ag/swap/v2` |
| Flow | `GET /quote` → `POST /swap-instructions` | `GET /build` (single call) |
| Transaction control | Full | Full (unchanged) |
| Jupiter fee | None | None |
## Parameter mapping
| Metis v1 (`/quote`) | Swap v2 (`/build`) | Notes |
|----------------------|-------------------|-------|
| `inputMint` | `inputMint` | Unchanged |
| `outputMint` | `outputMint` | Unchanged |
| `amount` | `amount` | Unchanged |
| `slippageBps` | `slippageBps` | Defaults to 50 in v2 |
| `swapMode` | — | **Removed**. V2 only supports `ExactIn` |
| `dexes` | `dexes` | Unchanged |
| `excludeDexes` | `excludeDexes` | Unchanged |
| `maxAccounts` | `maxAccounts` | Defaults to 64 |
| `platformFeeBps` | `platformFeeBps` | Unchanged |
| `userPublicKey` | `taker` | **Renamed** |
| — | `mode` | **New**. Set to `"fast"` for reduced latency |
| — | `feeAccount` | **New**. Required if `platformFeeBps > 0` |
## Response mapping
| Metis v1 | Swap v2 | Notes |
|----------|---------|-------|
| `computeBudgetInstructions` | `computeBudgetInstructions` | Same structure |
| `setupInstructions` | `setupInstructions` | Same structure |
| `swapInstruction` | `swapInstruction` | Now V2 format |
| `cleanupInstruction` | `cleanupInstruction` | Same |
| — | `otherInstructions` | **New field** |
| `addressLookupTableAddresses` | `addressesByLookupTableAddress` | **Changed**: Object mapping ALT addresses → account arrays (no separate RPC call needed) |
| — | `blockhashWithMetadata` | **New**: Blockhash included in response |
## V2 instruction differences
- **No fee events**: V2 instructions do not emit fee transfer events. If you parse fee events, switch to using token balance changes or the `/order` response fields.
- **Route plan format**: V1 uses `percent` (e.g., `100` for 100%). V2 uses `bps` (e.g., `10000` for 100%). Both fields appear in V2 for backwards compatibility; `bps` is canonical.
## Before (Metis)
```typescript
const API_KEY = process.env.JUPITER_API_KEY!;
// Call 1: Get quote
const quote = await fetch(
"https://api.jup.ag/swap/v1/quote?" +
new URLSearchParams({
inputMint: "So11111111111111111111111111111111111111112",
outputMint: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
amount: "100000000",
slippageBps: "50",
}),
{ headers: { "x-api-key": API_KEY } },
).then(r => r.json());
// Call 2: Get swap instructions
const instructions = await fetch(
"https://api.jup.ag/swap/v1/swap-instructions",
{
method: "POST",
headers: {
"Content-Type": "application/json",
"x-api-key": API_KEY,
},
body: JSON.stringify({
quoteResponse: quote,
userPublicKey: walletAddress,
}),
},
).then(r => r.json());
// Build transaction from instructions...
// Resolve address lookup tables via RPC...
```
## After (Swap v2)
```typescript
const API_KEY = process.env.JUPITER_API_KEY!;
// Single call: Get quote + instructions
const build = await fetch(
"https://api.jup.ag/swap/v2/build?" +
new URLSearchParams({
inputMint: "So11111111111111111111111111111111111111112",
outputMint: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
amount: "100000000",
taker: walletAddress, // was userPublicKey
slippageBps: "50",
}),
{ headers: { "x-api-key": API_KEY } },
).then(r => r.json());
// Build transaction from instructions...
// ALTs are already resolved in build.addressesByLookupTableAddress — no extra RPC call
// Blockhash is in build.blockhashWithMetadata — no extra RPC call
// For complete transaction assembly, see integrating-jupiter/examples/swap.md
```
## Benefits
- **One API call** instead of two (quote + swap-instructions)
- **ALTs pre-resolved** — `addressesByLookupTableAddress` returns account arrays directly, eliminating RPC lookups
- **Blockhash included** — `blockhashWithMetadata` eliminates another RPC call
- **Better routing** — dynamic intermediate tokens and long-tail token support
- **Built-in slippage estimation** — market-aware slippage adjustment
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |
| requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirements | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |
| using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |
| verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |