跳到正文
Skillpedia
API 与服务器(后端)7.0k · #13640

lifi

它能做什么

这项技能涵盖 LI.FI API,它可在 75 条以上的区块链之间处理代币兑换和跨链转移。内容还包括 DeFi 存款、收益数据和基于意图的订单,适合为应用添加跨链兑换或收益功能的开发者。

适用场景

  • ✓当用户想在两条不同的区块链之间兑换代币时。
  • ✓当用户想把代币转移到另一条链上时。
  • ✓当你想查找有收益的金库或向 DeFi 协议存款的时候。

技能链接

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

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/internet-court/internet-court-skill/blob/main/vendored/lifi/lifi/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“我希望我的用户能在我的应用内,把以太坊上的 USDC 兑换成 Arbitrum 上的 ETH。”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会调用 LI.FI API 获取报价和路由,然后使用执行数据,并检查状态直到转账完成。可选的 API 密钥可以提高速率限制,并通过请求头发送。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

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
常见问题

我需要 API 密钥吗?

不需要,这是可选的。密钥只用于提高你的速率限制。

AI 智能体可以通过工具使用它吗?

可以。LI.FI 提供 MCP 服务器和 CLI,但该技能建议直接调用 REST API。

Earn 涵盖哪些内容?

Earn 提供金库发现、APY 和 TVL 数据,以及投资组合仓位。

详情

作者的原始描述

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

repo: internet-court/internet-court-skill

热度

GitHub 星标
7.0k
排名
#13640
许可证
—
更新时间
2026/10/26

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能