Loading...
Loading...
Cross-chain asset transfers via the LayerZero Value Transfer API. Quote, execute, and track bridging of 850 tokens across 170 chains (EVM, Solana, Aptos, TON) using OFT, Stargate, CCTP, and Aori routes. Quote-then-execute workflow with status polling.
npx skill4agent add starchild-ai-agent/official-skills layerzero-value-transferhttps://transfer.layerzero-api.com/v1LAYERZERO_API_KEYtransfer.layerzero-api.comcore.http_clientx-api-keyfrom core.http_client import proxied_post, proxied_get
r = proxied_post(
"https://transfer.layerzero-api.com/v1/quotes",
json=body,
headers={"x-api-key": "proxy", "SC-CALLER-ID": f"chat:{thread_id}"},
timeout=40,
)/chains/tokens/metadatacurlcurl{"error": "Unauthorized"}proxied_*| Route | Protocol |
|---|---|
| Standard omnichain token transfer |
| Instant Stargate transfer |
| Batched (cheaper, slower) Stargate transfer |
| Circle native USDC |
| Intent-based swap (uses EIP-712 signatures) |
1. GET /chains, /tokens → discover routes (optional)
2. POST /quotes → get quote.id, feeUsd, userSteps
3. Execute userSteps → sign & send each tx (or EIP-712 signature)
4. GET /status/{quoteId} → poll every ~4s until terminalcurl -s https://transfer.layerzero-api.com/v1/chains
# → { "chains": [{ "name": "Base", "chainKey": "base", "chainType": "EVM",
# "chainId": 8453, "nativeCurrency": { "symbol": "ETH", "decimals": 18,
# "address": "0xEeee...EEeE" } }, ...] }
# Note: results are under the "chains" key (not a bare array). chainType is
# uppercase: EVM, SOLANA, APTOS, SUI, TON, TRON, STARKNET, IOTAMOVE.
# Tokens receivable from a given source token:
curl -s "https://transfer.layerzero-api.com/v1/tokens?transferrableFromChainKey=base&transferrableFromTokenAddress=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"
# → { "tokens": [{ chainKey, address, decimals, symbol, name, price.usd }, ...],
# "pagination": { "nextToken"? } } (results under the "tokens" key)0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeEpagination[nextToken]nextTokenGET /metadatafrom core.http_client import proxied_post
r = proxied_post(
"https://transfer.layerzero-api.com/v1/quotes",
json={
"srcChainKey": "base",
"dstChainKey": "optimism",
"srcTokenAddress": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
"dstTokenAddress": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
"srcWalletAddress": "0xYOUR_WALLET",
"dstWalletAddress": "0xYOUR_WALLET",
"amount": "1000000000000000",
"options": {
"amountType": "EXACT_SRC_AMOUNT",
"feeTolerance": {"type": "PERCENT", "amount": 2},
},
},
headers={"x-api-key": "proxy", "SC-CALLER-ID": f"chat:{thread_id}"},
timeout=40,
)
quote = r.json()["quotes"][0] # id, feeUsd, dstAmount, userSteps{"error": null, "quotes": [{ "id", "routeSteps", "fees", "feeUsd", "feePercent", "srcAmount", "dstAmount", "dstAmountMin", "userSteps" }]}quotesquotes[0]feeUsdamountquote.idquote.feeUsdquote.userStepsfeeUsduserStepsapprover = proxied_post(
"https://transfer.layerzero-api.com/v1/build-user-steps",
json={"quoteId": "QUOTE_ID"},
headers={"x-api-key": "proxy", "SC-CALLER-ID": f"chat:{thread_id}"},
)userStep.signature.typedDatar = proxied_post(
"https://transfer.layerzero-api.com/v1/submit-signature",
json={"quoteId": "QUOTE_ID", "signatures": ["0xSIGNATURE"]},
headers={"x-api-key": "proxy", "SC-CALLER-ID": f"chat:{thread_id}"},
)from core.http_client import proxied_get
r = proxied_get(
"https://transfer.layerzero-api.com/v1/status/QUOTE_ID",
params={"txHash": "0xSRC_TX_HASH"},
headers={"x-api-key": "proxy", "SC-CALLER-ID": f"chat:{thread_id}"},
)
# → { "status": "PROCESSING", "explorerUrl": "..." }SUCCEEDEDFAILEDUNKNOWNPENDINGPROCESSINGexplorerUrlfeeUsdFAILEDUNKNOWNexplorerUrl