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-order.md
View on GitHub# Path 3: Metis → Swap v2 `/order`
**When to choose**: You don't need transaction composability and want managed execution with better pricing.
| Element | Before (Metis v1) | After (Swap v2 `/order`) |
|---------|-------------------|--------------------------|
| Base URL | `https://api.jup.ag/swap/v1` | `https://api.jup.ag/swap/v2` |
| Flow | `GET /quote` → `POST /swap-instructions` → build tx → sign → send via RPC | `GET /order` → sign → `POST /execute` |
| Routing | Metis only | All routers (Metis, JupiterZ, Dflow, OKX) |
| Execution | Self-managed via RPC | Managed by Jupiter |
| Gasless | Not available | Automatic when eligible |
| Jupiter fee | None | Yes (variable by pair: 0-50 bps) |
## Before (Metis)
```typescript
// 1. Quote
const quote = await fetch("https://api.jup.ag/swap/v1/quote?" + new URLSearchParams({
inputMint: SOL_MINT, outputMint: USDC_MINT, amount: "100000000", slippageBps: "50",
}), { headers: { "x-api-key": API_KEY } }).then(r => r.json());
// 2. Get 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());
// 3. Build, sign, send via RPC (complex)
```
## After (Swap v2 `/order`)
```typescript
// 1. Get assembled transaction
const order = await fetch("https://api.jup.ag/swap/v2/order?" + new URLSearchParams({
inputMint: SOL_MINT, outputMint: USDC_MINT, amount: "100000000", taker: walletAddress,
}), { headers: { "x-api-key": API_KEY } }).then(r => r.json());
// 2. Sign
const tx = VersionedTransaction.deserialize(Buffer.from(order.transaction, "base64"));
tx.sign([wallet]);
const signedTransaction = Buffer.from(tx.serialize()).toString("base64");
// 3. Execute via Jupiter (no RPC management needed)
const result = await fetch("https://api.jup.ag/swap/v2/execute", {
method: "POST",
headers: { "Content-Type": "application/json", "x-api-key": API_KEY },
body: JSON.stringify({ signedTransaction, requestId: order.requestId }),
}).then(r => r.json());
// For complete transaction assembly and error handling, see integrating-jupiter/examples/swap.md
```
## Trade-offs
- **Gained**: RFQ pricing (5-20 bps better on major pairs), managed execution, gasless, simpler code
- **Lost**: Transaction composability (can't add custom instructions), no Jupiter fee on `/build`
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 |