lifi
Skill này làm gì
Skill này bao quát LI.FI API, công cụ xử lý hoán đổi token và chuyển tài sản qua cầu nối trên hơn 75 blockchain. Skill cũng bao quát gửi tiền DeFi, dữ liệu lợi suất và các lệnh theo ý định, dành cho lập trình viên thêm tính năng hoán đổi đa blockchain hoặc lợi suất vào ứng dụng.
Khi nào nên dùng
- ✓Khi người dùng muốn hoán đổi token giữa hai blockchain khác nhau.
- ✓Khi người dùng muốn chuyển token sang một blockchain khác.
- ✓Khi bạn muốn tìm vault có lợi suất hoặc gửi tiền vào một giao thức DeFi.
Liên kết skill
https://github.com/internet-court/internet-court-skill/blob/main/vendored/lifi/lifi/SKILL.mdSao 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
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Tôi muốn người dùng của mình hoán đổi USDC trên Ethereum sang ETH trên Arbitrum ngay trong ứng dụng của tôi.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent gọi LI.FI API để lấy báo giá và tuyến đường, rồi dùng dữ liệu thực thi và kiểm tra trạng thái cho tới khi việc chuyển hoàn tất. Khóa API là tùy chọn, giúp tăng giới hạn yêu cầu và được gửi trong một header của yêu cầu.
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.
LI.FI API Integration
LI.FI aggregates bridges, DEXs, intent solvers, and DeFi protocols behind one API. This skill covers the full product surface:
| Product | Base URL | What it does |
|---|---|---|
| Core API (swaps & bridges) | https://li.quest/v1 |
Quotes, routes, execution data, status tracking across 75+ chains |
| Composer (DeFi execution) | https://li.quest/v1 (same /quote endpoint) |
One-click swap/bridge + deposit/withdraw into vaults, lending, staking |
| Earn (yield data) | https://earn.li.fi/v1 |
Vault discovery, APY/TVL analytics, portfolio positions |
| Intents (solver marketplace) | https://order.li.fi |
Intent-based orders filled by a competitive solver network |
For AI agents, LI.FI also offers an MCP server (https://mcp.li.quest/mcp) and a CLI (@lifi/cli). LI.FI recommends agents and backends use the REST API directly rather than the SDK.
Authentication & Rate Limits
API key is optional — it only raises rate limits. Header: x-lifi-api-key (get one at the LI.FI Partner Portal).
curl "https://li.quest/v1/chains" -H "x-lifi-api-key: YOUR_API_KEY"
| Tier | /quote, /advanced/routes |
/advanced/stepTransaction |
Other endpoints |
|---|---|---|---|
| Without API key | 75 req / 2 hours | 50 req / 2 hours | 100 req / minute |
| With API key (default) | 100 RPM (2-hour rolling window: 12,000 / 2h) | same | 100 RPM |
Responses include ratelimit-limit, ratelimit-remaining, ratelimit-reset (seconds) headers. 429 responses carry error code 1005. Never expose your API key in client-side code.
Quick Start — The Five-Call Recipe
The canonical flow for any swap/bridge:
1. GET /chains → discover chains (id, key, chainType, nativeToken)
2. GET /tokens → find tokens & decimals (?chains=1,42161)
3. GET /quote → get quote with ready-to-sign transactionRequest
4. [Execute] → if ERC-20: check allowance vs estimate.approvalAddress, approve if needed;
then sign & send transactionRequest
5. GET /status → poll until DONE or FAILED
# 3. Quote (fromToken/toToken accept addresses OR symbols)
curl "https://li.quest/v1/quote?\
fromChain=42161&toChain=10&\
fromToken=0xaf88d065e77c8cC2239327C5EDb3A432268e5831&\
toToken=0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1&\
fromAmount=10000000&fromAddress=0xYourAddress&slippage=0.005"
# 5. Status (pass fromChain to speed it up; bridge = quote's `tool`)
curl "https://li.quest/v1/status?txHash=0xYourTxHash&fromChain=42161&toChain=10&bridge=across"
From the quote response, extract: transactionRequest (sign & send), estimate.approvalAddress (ERC-20 spender), estimate.toAmount/toAmountMin, estimate.executionDuration (basis for polling), and tool (pass as bridge to /status). Quotes go stale in ~60 seconds — re-fetch before signing if older (and always after a separate approval tx).
Core Endpoints
GET /quote
Single best route with transaction data ready for execution.
| Parameter | Type | Required | Description |
|---|---|---|---|
fromChain / toChain |
string | Yes | Chain ID or key (same value = same-chain swap) |
fromToken / toToken |
string | Yes | Token address or symbol |
fromAmount |
string | Yes | Amount in smallest unit |
fromAddress |
string | Yes | Sender wallet address |
toAddress |
string | No | Recipient (defaults to fromAddress) |
slippage |
number | No | 0.005 = 0.5% (default) |
order |
string | No | FASTEST or CHEAPEST |
integrator |
string | No | Your app ID (analytics + fee collection) |
fee |
number | No | Integrator fee (0.02 = 2%) |
preset |
string | No | Routing preset, e.g. stablecoin (see below) |
allowBridges / denyBridges / preferBridges |
string[] | No | Tool keys from /tools, or all/none/default |
allowExchanges / denyExchanges / preferExchanges |
string[] | No | Same |
allowDestinationCall |
boolean | No | Default true |
maxPriceImpact |
number | No | Default 0.10 (10%) |
fromAmountForGas |
string | No | Amount converted to gas on destination |
skipSimulation |
boolean | No | Faster response, less accurate gas limit |
svmPriorityFeeLevel |
string | No | Solana priority fee: NORMAL/FAST/ULTRA |
swapStepTimingStrategies / routeTimingStrategies |
string[] | No | e.g |
Câu hỏi thường gặp
Tôi có cần khóa API không?
Không bắt buộc. Khóa chỉ giúp tăng giới hạn yêu cầu của bạn.
Agent AI có thể dùng cái này qua công cụ khác không?
Có. LI.FI có MCP server và CLI, nhưng skill khuyên gọi trực tiếp REST API.
Earn bao gồm những gì?
Earn cung cấp khám phá vault, dữ liệu APY và TVL, cùng các vị thế trong danh mục.
Chi tiết
Mô tả gốc của tác giả
LI.FI REST API for cross-chain and same-chain token swaps, bridging, DeFi deposits (Composer), yield discovery (Earn), and intent-based execution (Intents). USE THIS SKILL WHEN USER WANTS TO: - Swap tokens between different blockchains (e.g., "swap USDC on Ethereum to ETH on Arbitrum") - Bridge tokens to another chain (e.g., "move my ETH from mainnet to Optimism") - Swap tokens on the same chain with best rates (e.g., "swap ETH to USDC on Polygon") - Find the best route or quote for a token swap across chains - Deposit into DeFi vaults/lending/staking in one click, including cross-chain (Compo
Độ phổ biến
- Sao GitHub
- 7.0k
- Vị trí xếp hạng
- #13640
- Giấy phép
- —
- Cập nhật
- 26/10/2026
Bình luận
- …
Thêm skill từ kho mã này
internet-court
7.0kGiúp agent của bạn thanh toán, thuê hoặc giao dịch an toàn với một agent AI khác hoặc dịch vụ trả phí, và chỉ đến hướng dẫn chuyên sâu phù hợp.
genlayer-erc7710-connector
7.0kGiúp agent của bạn kết nối kết quả đánh giá AI với hệ thống quyền hạn, để một đánh giá xấu có thể hạn chế hoặc hủy quyền của agent.
genlayer-intelligent-contracts
7.0kGiúp agent của bạn xác định quy tắc, bằng chứng và đầu ra của một AI judge kiểm tra xem agent khác có làm đúng nhiệm vụ được ủy quyền hay không.
x402-erc7710
7.0kGiúp agent của bạn trả tiền cho dịch vụ web theo từng yêu cầu, và thiết lập chi tiêu định kỳ nằm trong ngân sách quyền hạn.
Skill tương tự
api-connector-builder
280kGiúp agent của bạn xây dựng kết nối API mới theo đúng mẫu đã có, dùng khi bạn cần thêm một tích hợp mà không tạo cách làm mới.
api-design
280kGiúp agent của bạn thiết kế REST API theo các thực hành tốt nhất, hữu ích để định nghĩa cách API giao tiếp, hiển thị lỗi và tổ chức dữ liệu.
backend-patterns
280kGiúp agent của bạn với các mẫu kiến trúc phía máy chủ và tối ưu cơ sở dữ liệu, hữu ích khi xây dựng hoặc rà soát code chạy trên máy chủ.