jupiter Β· diff
v1.1.0 to v1.2.0
130 added, 116 removed. Audit A to A.
---
name: jupiter
- version: 1.1.0
+ version: 1.2.0
description: "Jupiter DEX aggregator on Solana β token swaps, limit orders, DCA. Use when user mentions Jupiter, Solana swap, SOL/USDC swap, or Solana DEX aggregator."
metadata:
starchild:
emoji: "πͺ"
skillKey: jupiter
user-invocable: true
---
# Jupiter β Solana DEX Aggregator
Jupiter routes swaps across all Solana DEXes (Raydium, Orca, Phoenixβ¦) for best price.
+ ## β½ Gas & Cost β Read This First
+
+ - **Gas is always paid from wallet SOL balance.** No gas sponsorship on Solana.
+ - `wallet_sol_transfer` does NOT work for Jupiter β it's for send-SOL only.
+ - Swaps cost ~0.0002β0.001 SOL in fees (priority fee + rent deposit for new token accounts).
+ - Limit orders cost ~0.002 SOL to create (on-chain account rent).
+ - Always call `wallet_sol_balance()` before operating to confirm SOL > 0.01.
+
## β HARD RULES
- - **ALWAYS use `ultra/v1/order`** β NOT `swap/v1/quote` + `swap/v1/swap` (deprecated two-step)
- - **NEVER pass numeric `makingAmount`/`takingAmount`** β must be strings or API returns ZodError
- - **NEVER mention DCA** β lite-api does not support it
+ - **ALWAYS use `ultra/v1/order`** β NOT `swap/v1/quote` + `swap/v1/swap` (deprecated)
+ - **Pass wallet pubkey to `jupiter_swap` only when intending to execute** β omitting it returns a quote-only result (no transaction), which is correct for price checks
+ - **NEVER pass numeric `makingAmount`/`takingAmount`** β must be strings or API returns ZodError 400
+ - **NEVER use `/ultra/v1/execute` for limit orders** β limit orders MUST go through `jupiter_broadcast_tx()` (Solana RPC)
- **NEVER omit user confirmation** before executing a swap or limit order
- - **HARD LIMIT: max 6 tool calls** per user request
- **ALWAYS call `wallet_sol_balance()`** after swap to verify balances changed
+ - **NEVER mention DCA** β lite-api does not support it
## Prerequisites β Wallet Policy
- Before any on-chain operation, load the **wallet-policy** skill and propose the standard wildcard Solana policy (deny key export + allow `*`).
+ Before any on-chain operation, load the **wallet** skill and propose the standard wildcard Solana policy (deny key export + allow `*`).
## Key Token Addresses (Solana)
- | Token | Mint Address |
- |-------|-------------|
- | SOL (wrapped) | `So11111111111111111111111111111111111111112` |
- | USDC | `EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v` |
- | USDT | `Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB` |
- | JUP | `JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN` |
- | BONK | `DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263` |
- | WIF | `EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm` |
+ | Token | Mint Address | Decimals |
+ |-------|-------------|---------|
+ | SOL | `So11111111111111111111111111111111111111112` | 9 |
+ | USDC | `EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v` | 6 |
+ | USDT | `Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB` | 6 |
+ | JUP | `JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN` | 6 |
+ | BONK | `DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263` | 5 |
+ | WIF | `EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm` | 6 |
+ | JTO | `jtojtomepa8beP8AuQc6eXt5FriJwfFMwQx2v2f9mCL` | 6 (NOT 9) |
For unlisted tokens: ask user for mint address directly β token search API is deprecated.
- ## API Overview
+ ## Available Tools (from exports.py)
- **Base URL**: `https://lite-api.jup.ag` (free, no API key)
+ | Tool | What it does |
+ |------|-------------|
+ | `jupiter_price(token)` | USD price of any token |
+ | `jupiter_swap(in, out, amount, wallet?)` | Quote only (no wallet) or quote + tx (wallet provided) |
+ | `jupiter_execute_swap(signed_tx, request_id, in_mint?, out_mint?)` | Broadcast swap via `/ultra/v1/execute` β swap only |
+ | `jupiter_broadcast_tx(signed_tx)` | Broadcast via Solana RPC β limit orders + cancel |
+ | `jupiter_limit_create(in, out, making, taking, maker)` | Create limit order |
+ | `jupiter_limit_orders(wallet, history=False)` | List open or historical orders |
+ | `jupiter_limit_cancel(order_pubkey, maker)` | Cancel an open order |
- ### Swap β Ultra API (primary, always use this)
+ ## Swap Workflow (End-to-End)
```
- GET /ultra/v1/order?inputMint=<>&outputMint=<>&amount=<lamports>
- ```
+ 1. quote = jupiter_swap("SOL", "USDC", 0.01, wallet_pubkey)
+ ββ returns: in_amount, out_amount, in_usd, out_usd, transaction, request_id
- Returns in ONE call: `inAmount`, `outAmount`, `inUsdValue`, `outUsdValue`,
- `priceImpactPct`, `transaction` (base64), `requestId`.
+ 2. Show user: amount in/out, USD values, price_impact_pct β wait for confirm
- After signing, execute via:
- ```
- POST /ultra/v1/execute
- { "signedTransaction": "<base64>", "requestId": "<id>" }
- ```
+ 3. signed = wallet_sol_sign_transaction(quote["transaction"])
- ### Limit Orders β Trigger API
+ 4. result = jupiter_execute_swap(signed["signed_transaction"], quote["request_id"])
+ ββ returns: status ("Success"), signature, in_amount, out_amount
- ```
- POST /trigger/v1/createOrder
- {
- "inputMint": "<>", "outputMint": "<>",
- "maker": "<wallet>", "payer": "<wallet>",
- "params": {
- "makingAmount": "10000000", β STRING, not number
- "takingAmount": "90000000" β STRING, not number
- },
- "computeUnitPrice": "auto"
- }
+ 5. wallet_sol_balance() β verify balances changed
```
- ```
- GET /trigger/v1/openOrders?wallet=<>
- GET /trigger/v1/orderHistory?wallet=<>
- POST /trigger/v1/cancelOrder { "order": "<pubkey>", "maker": "<>", "computeUnitPrice": "auto" }
+ **Key facts:**
+ - `jupiter_execute_swap` β POST `/ultra/v1/execute` β only for Ultra swaps
+ - `transaction` is `null` if wallet pubkey is missing/invalid β retry step 1 with a valid wallet
+ - Swap is atomic: if it fails, nothing is deducted (except gas fee)
+
+ ## Limit Order Workflow (End-to-End)
+
```
+ 1. order = jupiter_limit_create(
+ input_token="SOL", # selling
+ output_token="USDC", # buying
+ making_amount=0.06, # 0.06 SOL to sell
+ taking_amount=3.0, # want at least 3 USDC (sets target price)
+ maker=wallet_pubkey
+ )
+ ββ returns: order_pubkey, transaction, implied_price, next_step
- **Gotchas (verified live)**:
- - `makingAmount`/`takingAmount` β must be strings (int β ZodError 400)
- - `expiredAt` β omit entirely if not set (do NOT pass `null`)
- - `feeBps` β omit entirely if not set (do NOT pass `0`)
+ 2. Show user: implied price, amounts β wait for confirm
- ## Tool Routing β IF/THEN
+ 3. signed = wallet_sol_sign_transaction(order["transaction"])
+ β οΈ Sign and broadcast within ~90 seconds β blockhash expires.
- ```
- IF "SOL price" / "how much is X" β jupiter_price(token)
- IF "quote" / "how much can I get" β jupiter_quote(in, out, amount)
- IF "swap" / "exchange" / "convert" β jupiter_quote β confirm β jupiter_swap
- IF "limit order" / "buy when price hits" β jupiter_limit_create(...)
- IF "my orders" / "open orders" β jupiter_limit_orders(wallet)
- IF "cancel order" β jupiter_limit_orders β jupiter_limit_cancel
- IF token not in KNOWN_TOKENS β ask user for mint address
+ 4. result = jupiter_broadcast_tx(signed["signed_transaction"])
+ ββ returns: {"success": True, "signature": "..."} or {"success": False, "error": "..."}
+ β οΈ Use jupiter_broadcast_tx, NOT jupiter_execute_swap β different endpoints!
+
+ 5. jupiter_limit_orders(wallet_pubkey) β confirm order_pubkey appears
+ Note: if order fills instantly (implied price β€ market), check orderHistory instead
```
- ## Swap Workflow (End-to-End)
+ **Key facts:**
+ - Min order size: ~$5 USD β smaller returns `{"error": "Order size must be at least 5 USD"}`
+ - Keepers may fill the order instantly if your implied price is favorable (β€ market)
+ - `orderKey` field in API response is the order pubkey (not `publicKey`)
+ - `makingAmount` / `takingAmount` in openOrders are already human-readable (e.g. "0.06"), not raw lamports
+ - `expiredAt` and `feeBps` must be omitted entirely if not used (don't pass null or 0)
+ ## Cancel Order Workflow
+
```
- 1. jupiter_quote(input, output, amount) β ultra/v1/order
- 2. Show user: out_amount, in_usd, out_usd, price_impact_pct
- 3. Wait for confirmation
- 4. wallet_sol_sign_transaction(tx=quote["transaction"])
- 5. POST /ultra/v1/execute { signedTransaction, requestId }
- 6. wallet_sol_balance() β verify
+ 1. orders = jupiter_limit_orders(wallet_pubkey)
+ 2. Pick order_pubkey from orders["orders"][n]["order_pubkey"]
+ 3. cancel = jupiter_limit_cancel(order_pubkey, wallet_pubkey)
+ 4. signed = wallet_sol_sign_transaction(cancel["transaction"])
+ 5. jupiter_broadcast_tx(signed["signed_transaction"])
```
- ## Limit Order Workflow (End-to-End)
+ ## Tool Routing β IF/THEN
```
- 1. jupiter_limit_create(in, out, making, taking, maker)
- 2. Show user: order details, implied price
- 3. Wait for confirmation
- 4. wallet_sol_sign_transaction(tx=result["transaction"])
- 5. Broadcast signed tx
- 6. jupiter_limit_orders(wallet) β confirm order appears
+ IF "price" / "how much is X" β jupiter_price(token)
+ IF "quote" / "how much can I get" β jupiter_swap(in, out, amount) [wallet omitted = quote-only, no tx]
+ IF "swap" / "exchange" / "convert" β jupiter_swap(in, out, amount, wallet) β confirm β sign β jupiter_execute_swap(in_mint, out_mint)
+ IF "limit order" / "buy when price hits" β jupiter_limit_create β sign β jupiter_broadcast_tx
+ IF "my orders" / "open orders" β jupiter_limit_orders(wallet)
+ IF "cancel order" β jupiter_limit_orders β jupiter_limit_cancel β sign β jupiter_broadcast_tx
+ IF token not in KNOWN_TOKENS β ask user for mint address
```
+
## Few-Shot Examples
**JUP-01 β "SOL price?"**
- ```
- jupiter_price("SOL") β {"price_usd": 148.32, ...}
- Reply: "SOL is currently $148.32."
- ```
-
- **JUP-02 β "Quote: 1 SOL β USDC"**
- ```
- jupiter_quote("SOL", "USDC", 1.0)
- β in_amount=1 SOL (~$148.32), out_amount=148.07 USDC, impact=0.02%
- Reply: "1 SOL β ~148.07 USDC (impact 0.02%). Swap?"
- ```
-
- **JUP-03 β "Swap 0.5 SOL β USDC"**
- ```
- jupiter_quote("SOL","USDC",0.5) β show quote β confirm
- jupiter_swap("SOL","USDC",0.5,wallet_pubkey)
- wallet_sol_sign_transaction(tx) β execute β wallet_sol_balance()
+ ```python
+ jupiter_price("SOL")
+ # -> {"price_usd": 84.2, ...}
```
- **JUP-04 β "Buy SOL when it hits $120, spend 100 USDC"**
- ```
- # 100 USDC β X SOL at $120/SOL = 0.833 SOL
- jupiter_limit_create("USDC","SOL", making=100, taking=0.833, maker=wallet)
- β sign β broadcast β jupiter_limit_orders(wallet) to confirm
+ **JUP-01b β "How much USDC would I get for 0.5 SOL?" (quote only, no trade)**
+ ```python
+ jupiter_swap("SOL", "USDC", 0.5) # wallet_pubkey omitted
+ # -> {quote_only: True, in_amount: "0.50", out_amount: "42.10",
+ # in_usd: "42.1", transaction: None}
+ # Stop here β show user the rate, no signing needed.
```
- **JUP-05 β "My open orders"**
- ```
- jupiter_limit_orders(wallet) β display table
+ **JUP-02 β "Swap 0.01 SOL to USDC"**
+ ```python
+ quote = jupiter_swap("SOL", "USDC", 0.01, wallet_pubkey)
+ # β show: 0.01 SOL β ~0.84 USDC, impact <0.01%
+ signed = wallet_sol_sign_transaction(quote["transaction"])
+ result = jupiter_execute_swap(
+ signed["signed_transaction"],
+ quote["request_id"],
+ in_mint=quote["in_mint"],
+ out_mint=quote["out_mint"],
+ )
+ # β {"status": "Success", "signature": "yUKn...", "in_amount_fmt": "0.01", "out_amount_fmt": "0.84"}
+ wallet_sol_balance()
```
- **JUP-06 β "Cancel my latest order"**
- ```
- jupiter_limit_orders(wallet) β pick most recent pubkey
- jupiter_limit_cancel(order_pubkey, maker)
- β sign β broadcast
+ **JUP-03 β "Set limit: sell 0.06 SOL when USDC price hits $50/SOL"**
+ ```python
+ # makingAmount=0.06 SOL, takingAmount=3 USDC (= 0.06 * 50)
+ order = jupiter_limit_create("SOL", "USDC", 0.06, 3.0, wallet_pubkey)
+ # β implied_price: "1 USDC = 0.0200 SOL" (i.e. $50/SOL)
+ signed = wallet_sol_sign_transaction(order["transaction"]) # do this immediately!
+ result = jupiter_broadcast_tx(signed["signed_transaction"])
+ # β {"success": True, "signature": "53bp..."}
+ jupiter_limit_orders(wallet_pubkey) # or check history if filled instantly
```
- **JUP-07 β "Swap 10 USDC β JUP" (English)**
- ```
- jupiter_quote("USDC","JUP",10.0) β confirm β jupiter_swap(...)
+ **JUP-04 β "My open orders"**
+ ```python
+ jupiter_limit_orders(wallet_pubkey)
+ # β {"count": 1, "orders": [{"order_pubkey": "...", "making_amount": "0.06", ...}]}
```
- **JUP-08 β "WIF mint address?"**
- ```
- Reply directly: EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm
+ **JUP-05 β "Cancel my order"**
+ ```python
+ orders = jupiter_limit_orders(wallet_pubkey)
+ pubkey = orders["orders"][0]["order_pubkey"]
+ cancel = jupiter_limit_cancel(pubkey, wallet_pubkey)
+ signed = wallet_sol_sign_transaction(cancel["transaction"])
+ jupiter_broadcast_tx(signed["signed_transaction"])
```
-
- ## Amount Conversion Reference
-
- | Token | Decimals | 1 unit in lamports |
- |-------|----------|--------------------|
- | SOL | 9 | 1_000_000_000 |
- | USDC | 6 | 1_000_000 |
- | USDT | 6 | 1_000_000 |
- | JUP | 6 | 1_000_000 |
- | BONK | 5 | 100_000 |
- | WIF | 6 | 1_000_000 |