Chuyển đến nội dung
Skillpedia
API và máy chủ (backend)7.0k · #13633

integrating-jupiter

Skill này làm gì

Skill này là tài liệu tham khảo để xây dựng với các API của Jupiter trên Solana, bao gồm hoán đổi, cho vay, hợp đồng vĩnh viễn, giá token, danh mục và nhiều hơn nữa. Nó giúp chọn đúng endpoint, làm theo đúng các bước và xử lý lỗi, dành cho lập trình viên thêm Jupiter vào ứng dụng.

Khi nào nên dùng

  • ✓Khi bạn muốn thêm tính năng hoán đổi token vào ứng dụng bằng Jupiter.
  • ✓Khi bạn cần chọn giữa các endpoint Jupiter cho cho vay, lệnh hoặc giá.
  • ✓Khi một lần gọi API Jupiter thất bại và bạn cần giúp gỡ lỗi.

Liên kết skill

https://github.com/internet-court/internet-court-skill/blob/main/vendored/jupiter/integrating-jupiter/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/internet-court/internet-court-skill/blob/main/vendored/jupiter/integrating-jupiter/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Tôi muốn thêm tính năng hoán đổi token vào ứng dụng Solana của mình bằng API của Jupiter.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent chọn API Jupiter phù hợp với tác vụ, rồi làm theo các bước tích hợp. Các endpoint REST cần khóa API từ cổng nhà phát triển Jupiter. Skill cũng bao gồm cách làm cho ứng dụng sẵn sàng production, như xử lý lỗi tốt.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Jupiter API Integration

Single skill for all Jupiter APIs, optimized for fast routing and deterministic execution.

Base URL: https://api.jup.ag Auth: x-api-key from developers.jup.ag (required for Jupiter REST endpoints)

Use/Do Not Use

Use when:

  • The task requires choosing or calling Jupiter endpoints.
  • The task involves swap, lending, perps, orders, pricing, portfolio, send, studio, lock, or routing.
  • The user needs debugging help for Jupiter API calls.

Do not use when:

  • The task is generic Solana setup with no Jupiter API usage.
  • The task is UI-only with no API behavior decisions.
  • The agent context is not DeFi/crypto (generic triggers like buy, sell, trade assume a DeFi domain).

Triggers: swap, quote, gasless, best route, buy, sell, trade, convert, token exchange, jupiter api, jup.ag, ultra, metis, ultra swap, ultra api, ultra-api.jup.ag, lend, borrow, earn, yield, apy, deposit, liquidation, perps, leverage, long, short, position, futures, margin trading, limit order, trigger, price condition, dca, recurring, scheduled swaps, token metadata, token search, verification, shield, price, valuation, price feed, portfolio, positions, holdings, prediction markets, market odds, event market, invite transfer, send, clawback, create token, studio, claim fee, vesting, distribution lock, unlock schedule, dex integration, rfq integration, routing engine, status page, health check, service health, accumulate, auto-buy

Developer Quickstart

import { Connection, Keypair, VersionedTransaction } from '@solana/web3.js';

const API_KEY = process.env.JUPITER_API_KEY!;  // from developers.jup.ag
if (!API_KEY) throw new Error('Missing JUPITER_API_KEY');
const BASE = 'https://api.jup.ag';
const headers = { 'x-api-key': API_KEY };

async function jupiterFetch<T>(path: string, init?: RequestInit): Promise<T> {
  const res = await fetch(`${BASE}${path}`, {
    ...init,
    headers: { ...headers, ...init?.headers },
  });
  if (res.status === 429) throw { code: 'RATE_LIMITED', retryAfter: Number(res.headers.get('Retry-After')) || 10 };
  if (!res.ok) {
    const raw = await res.text();
    let body: any = { message: raw || `HTTP_${res.status}` };
    try {
      body = raw ? JSON.parse(raw) : body;
    } catch {
      // keep text fallback body
    }
    throw { status: res.status, ...body };
  }
  return res.json();
}

// Sign and send any Jupiter transaction
async function signAndSend(
  txBase64: string,
  wallet: Keypair,
  connection: Connection,
  additionalSigners: Keypair[] = []
): Promise<string> {
  const tx = VersionedTransaction.deserialize(Buffer.from(txBase64, 'base64'));
  tx.sign([wallet, ...additionalSigners]);
  const sig = await connection.sendRawTransaction(tx.serialize(), {
    maxRetries: 0,
    skipPreflight: true,
  });
  return sig;
}

Token Amounts & Decimals

Every Jupiter amount field is in the token's smallest unit (raw integer) — never a human/UI value.

  • Common decimals: SOL & wSOL = 9, USDC & USDT = 6. Canonical mints: SOL So11111111111111111111111111111111111111112, USDC EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v.
  • Convert human → raw: raw = Math.round(human * 10 ** decimals). Examples: 1 SOL → 1_000_000_000, 100 USDC → 100_000_000. slippageBps is basis points: 0.5% = 50, 1% = 100.
  • Read decimals per-mint on-chain with getMint(connection, mintPubkey) from @solana/spl-token — never hardcode (decimals vary by token), and do not call the Price API just to discover decimals.

Intent Router (first step)

User intent API family First action
Swap/quote Swap GET /swap/v2/order -> sign -> POST /swap/v2/execute
Lend/borrow/yield Lend POST /lend/v1/earn/deposit or /withdraw
Leverage/perps Perps On-chain via Anchor IDL (no REST API yet)
Limit orders Trigger JWT auth -> POST /trigger/v2/orders/price
DCA/recurring buys Recurring POST /recurring/v1/createOrder -> sign -> POST /recurring/v1/execute
Token search Tokens GET /tokens/v2/search?query={mint}
Token verification/metadata update Use jupiter-vrfd skill Defer — not handled by this skill
Price lookup Price
Câu hỏi thường gặp

Jupiter có cần khóa API không?

Có. Các endpoint REST cần header x-api-key, bạn lấy từ cổng nhà phát triển Jupiter.

Skill bao gồm những sản phẩm Jupiter nào?

Hoán đổi, cho vay, perps, lệnh kích hoạt, lệnh định kỳ, token, giá, danh mục, thị trường dự đoán, gửi, studio, lock và định tuyến.

Điều này có giúp thiết lập Solana cơ bản không?

Không. Skill dành cho dùng API của Jupiter, không dành cho thiết lập Solana nói chung.

Chi tiết

Mô tả gốc của tác giả

Comprehensive guidance for integrating Jupiter APIs (Swap, Lend, Perps, Trigger, Recurring, Tokens, Price, Portfolio, Prediction Markets, Send, Studio, Lock, Routing). Use for endpoint selection, integration flows, error handling, and production hardening.

repo: internet-court/internet-court-skill

Độ phổ biến

Sao GitHub
7.0k
Vị trí xếp hạng
#13633
Giấy phép
—
Cập nhật
26/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự