Skip to content

internet-court/internet-court-skill / vendored/jupiter/jupiter-swap-migration

jupiter-swap-migration

Verified

Migration 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.

FileKindSize
LICENSEother1.0 KB
README.mdmarkdown1.1 KB
SKILL.mdskill md4.8 KB
examples/metis-to-build.mdmarkdown4.2 KB
examples/metis-to-order.mdmarkdown2.4 KB
examples/ultra-to-order.mdmarkdown2.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`
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 implementationStars: 323kUpdated Claude CodeCodexVerifiedInstall
requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirementsStars: 323kUpdated Claude CodeCodexVerifiedInstall
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 fallbackStars: 323kUpdated Claude CodeCodexVerifiedInstall
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 alwaysStars: 323kUpdated Claude CodeCodexVerifiedInstall