lifi
v4 - Use LI.FI API for cross-chain and same-chain swaps, bridges, and contract calls. Use when quoting routes, validating chains/tokens, building transaction requests, and tracking status.
- License 许可
- MIT
- 最近更新
- 2026-08-23
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- lifi
- homepage
- https://docs.li.fi/
- metadata
- { "openclaw": { "emoji": "?", "requires": { "env": [ "LIFI_API_KEY" ] }, "primaryEnv": "LIFI_API_KEY" } }
- description
- v4 - Use LI.FI API for cross-chain and same-chain swaps, bridges, and contract calls. Use when quoting routes, validating chains/tokens, building transaction requests, and tracking status.
02 资源文件 1
- 参考文档_meta.json813 B
03 SKILL.md 正文
LI.FI Agent Skill
CRITICAL RULES (read first)
- ONLY use
curlto call the LI.FI API. NEVER useweb_search,web_fetch, or any other tool. - ONLY use the endpoints documented below. Do NOT guess or invent URLs.
- Base URL is
https://li.quest/v1/. No other base URL. - ALWAYS include auth header:
"x-lifi-api-key: $LIFI_API_KEY"(double quotes, dollar sign — shell expands it). - ALWAYS tell the user the quote is provided by LI.FI.
- Default slippage: 10% (0.10). If the user has a custom slippage in their strategy (via
defi_get_strategy), use that instead. The agent can also adjust dynamically per-transaction if the user requests it. - Default deadline: 10 minutes.
- ALWAYS add
&skipSimulation=trueto all/v1/quoterequests. Our EIP-7702 delegated wallets have on-chain code that breaks LI.FI's simulation. - NEVER construct ERC-20 approve calldata (hex) yourself. ALWAYS use the
defi_approveordefi_approve_and_sendtools. - ALL swaps, bridges, and DeFi token operations MUST go through LI.FI. No exceptions. No manual DEX interactions.
Transaction Links
After every transaction broadcast, always provide a clickable block explorer link:
- EVM:
[View tx](https://basescan.org/tx/0xHASH)— use the correct explorer (etherscan.io, basescan.org, arbiscan.io, polygonscan.com, optimistic.etherscan.io) - Sui:
[View tx](https://suiscan.xyz/txblock/{txDigest})
Sui
- Sui chain ID:
9270000000000000. Use this forfromChainandtoChainin LI.FI quote requests when the user wants Sui (e.g.fromChain=9270000000000000&toChain=9270000000000000for same-chain Sui swap). - LI.FI supports Sui for same-chain swaps and bridging to/from EVM and Solana.
- For Sui quotes, use the user's suiAddress from
defi_get_walletasfromAddress. - Execute Sui quotes with
defi_send_sui_transaction— pass the transaction bytes (hex) from the LI.FI quote. Do not usedefi_send_transactionordefi_approve_and_sendfor Sui. - Sui does not use ERC-20 approvals; there is no approval step for Sui swaps.
Endpoints
GET /v1/chains — List supported chains
curl -s --request GET \
--url https://li.quest/v1/chains \
--header "x-lifi-api-key: $LIFI_API_KEY"
Use for: listing chains, testing connectivity. If user asks for a test, use this.
GET /v1/tokens — List tokens on chains
curl -s --request GET \
--url 'https://li.quest/v1/tokens?chains=8453' \
--header "x-lifi-api-key: $LIFI_API_KEY"
Params: chains (comma-separated chain IDs).
GET /v1/quote — Get swap/bridge quote with tx data
curl -s --request GET \
--url 'https://li.quest/v1/quote?fromChain=8453&toChain=8453&fromToken=ETH&toToken=USDC&fromAddress=0xYOUR_ADDRESS&fromAmount=100000000000000&slippage=0.10&skipSimulation=true' \
--header "x-lifi-api-key: $LIFI_API_KEY"
Params: fromChain, toChain, fromToken, toToken, fromAddress, toAddress (optional), fromAmount (in wei), slippage (decimal, e.g. 0.10 = 10%), skipSimulation=true (ALWAYS include).
Returns: estimate (with toAmount, toAmountMin, approvalAddress) and transactionRequest (ready for wallet submission).
After presenting a quote to the user, always include the estimated output amount, fees, and slippage. Get the user's wallet address with defi_get_wallet and use it as fromAddress in the quote.
Executing the quote
Check if ERC-20 approval is needed: If the quote's transactionRequest.value is "0x0" AND estimate.approvalAddress exists, the swap/bridge is using an ERC-20 token that needs approval first.
-
If approval IS needed: Use
defi_approve_and_sendwith:token: theaction.fromToken.addressfrom the quotespender: theestimate.approvalAddressfrom the quoteapproveAmount: theaction.fromAmountfrom the quote (or omit for unlimited)to,value,data,gasLimit: from the quote'stransactionRequest
-
If approval is NOT needed (native ETH swap, value > 0x0): Use
defi_send_transactionwith the quote'stransactionRequestfields: to, value, data, chainId, and gasLimit (ALWAYS passgasLimitfrom the quote).
NEVER construct approve calldata hex yourself. The defi_approve and defi_approve_and_send tools handle ABI encoding correctly.
Sui: For quotes where fromChain or toChain is Sui, use defi_send_sui_transaction with the quote's transaction bytes. No approval step.
POST /v1/advanced/routes — Get multiple route options
curl -s --request POST \
--url https://li.quest/v1/advanced/routes \
--header 'Content-Type: application/json' \
--header "x-lifi-api-key: $LIFI_API_KEY" \
--data '{
"fromChainId": 8453,
"fromAmount": "100000000000000",
"fromTokenAddress": "0x0000000000000000000000000000000000000000",
"toChainId": 8453,
"toTokenAddress": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"options": {
"slippage": 0.10,
"order": "RECOMMENDED"
}
}'
POST /v1/quote/contractCalls — Multi-step contract calls (BETA)
curl -s --request POST \
--url https://li.quest/v1/quote/contractCalls \
--header 'Content-Type: application/json' \
--header "x-lifi-api-key: $LIFI_API_KEY" \
--data '{
"fromChain": 10,
"fromToken": "0x4200000000000000000000000000000000000042",
"fromAddress": "0xYOUR_ADDRESS",
"toChain": 1,
"toToken": "ETH",
"toAmount": "100000000000001",
"contractCalls": []
}'
GET /v1/status — Check transfer status
curl -s --request GET \
--url 'https://li.quest/v1/status?txHash=0xYOUR_TX_HASH&fromChain=8453' \
--header "x-lifi-api-key: $LIFI_API_KEY"
Pass fromChain to speed up the lookup.
GET /v1/tools — List available bridges and exchanges
curl -s --request GET \
--url 'https://li.quest/v1/tools?chains=8453' \
--header "x-lifi-api-key: $LIFI_API_KEY"
Docs
04 同仓库更多 Skills
crowd-prompting
A marketplace where AI agents improve prompts, system instructions, tool descriptions, and other text-based content with domain expertise from real-world operations — and earn tokens for valuable contributions.
dilemm-ai
Compete in DilemmAI, the prisoner's dilemma AI arena at dilemm.ai. Use when an OpenClaw agent wants to create an account, design and submit strategy prompts for their bot, enter matchmaking, analyze historical matches and leaderboards, and iterate on bot strategy. Requires headless browser automation (no API available yet).
arxiv-paper-reviews
Interact with arXiv Crawler API to fetch papers, read reviews, and submit comments. Use when working with arXiv papers, fetching paper lists by date/category/interest, viewing paper details with comments, or submitting paper reviews via API at http://150.158.152.82:8000.
arxiv-paper-reviews
Interact with arXiv Crawler API to fetch papers, read reviews, and submit comments. Use when working with arXiv papers, fetching paper lists by date/category/interest, viewing paper details with comments, or submitting paper reviews via API at http://150.158.152.82:8000.
git-summary
Get a quick summary of the current Git repository including status, recent commits, branches, and contributors.
agent-constitution
Interact with AgentConstitution governance contracts on Base Sepolia. Check compliance, read rules, log actions, query governance state.