The Five Calls
Copy
Ask AI
1. GET /chains → Discover available chains
2. GET /tokens → Find tokens on those chains
3. GET /quote → Get transfer quote with transaction data
4. [Execute] → Sign and send the transaction
5. GET /status → Poll until transfer completes
Call 1: Get Supported Chains
Discover which blockchains LI.FI supports.Request
Copy
Ask AI
curl "https://li.quest/v1/chains"
Response
Copy
Ask AI
{
"chains": [
{
"id": 1,
"key": "eth",
"chainType": "EVM",
"name": "Ethereum",
"coin": "ETH",
"mainnet": true,
"logoURI": "https://raw.githubusercontent.com/lifinance/types/main/src/assets/icons/chains/ethereum.svg",
"tokenlistUrl": "https://gateway.ipfs.io/ipns/tokens.uniswap.org",
"multicallAddress": "0xcA11bde05977b3631167028862bE2a173976CA11",
"metamask": {
"chainId": "0x1",
"blockExplorerUrls": ["https://etherscan.io/"],
"chainName": "Ethereum Mainnet",
"nativeCurrency": {
"name": "ETH",
"symbol": "ETH",
"decimals": 18
},
"rpcUrls": ["https://mainnet.infura.io/v3/"]
},
"nativeToken": {
"address": "0x0000000000000000000000000000000000000000",
"chainId": 1,
"symbol": "ETH",
"decimals": 18,
"name": "ETH",
"coinKey": "ETH",
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",
"priceUSD": "2923.27"
}
},
{
"id": 42161,
"key": "arb",
"chainType": "EVM",
"name": "Arbitrum",
"coin": "ETH",
"mainnet": true,
"logoURI": "https://raw.githubusercontent.com/lifinance/types/main/src/assets/icons/chains/arbitrum.svg",
"tokenlistUrl": "https://bridge.arbitrum.io/token-list-42161.json",
"multicallAddress": "0xcA11bde05977b3631167028862bE2a173976CA11",
"metamask": {
"chainId": "0xa4b1",
"blockExplorerUrls": ["https://arbiscan.io/"],
"chainName": "Arbitrum One",
"nativeCurrency": {
"name": "ETH",
"symbol": "ETH",
"decimals": 18
},
"rpcUrls": ["https://arb1.arbitrum.io/rpc"]
},
"nativeToken": {
"address": "0x0000000000000000000000000000000000000000",
"chainId": 42161,
"symbol": "ETH",
"decimals": 18,
"name": "ETH",
"coinKey": "ETH",
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",
"priceUSD": "2923.27"
}
}
// ... 58 chains total (EVM, SVM, UTXO, MVM)
]
}
What to Extract
| Field | Purpose |
|---|---|
chains[].id | Chain ID for use in all other API calls |
chains[].key | Short identifier (e.g., “eth”, “arb”, “pol”) |
chains[].chainType | Filter by EVM, SVM (Solana), UTXO (Bitcoin), MVM (Sui) |
chains[].mainnet | true for mainnets, false for testnets |
chains[].nativeToken | Native gas token details |
chains[].metamask | Chain config for wallet connection |
Call 2: Get Tokens for Chains
Find which tokens are available on specific chains.Request
Copy
Ask AI
curl "https://li.quest/v1/tokens?chains=1,42161"
Response
Copy
Ask AI
{
"tokens": {
"1": [
{
"address": "0x0000000000000000000000000000000000000000",
"chainId": 1,
"symbol": "ETH",
"decimals": 18,
"name": "ETH",
"coinKey": "ETH",
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",
"priceUSD": "2923.27"
},
{
"address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"chainId": 1,
"symbol": "USDC",
"decimals": 6,
"name": "USD Coin",
"coinKey": "USDC",
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",
"priceUSD": "0.999606",
"tags": ["stablecoin"]
},
{
"address": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
"chainId": 1,
"symbol": "USDT",
"decimals": 6,
"name": "Tether USD",
"coinKey": "USDT",
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png",
"priceUSD": "1.00",
"tags": ["stablecoin"]
}
// ... 500+ more tokens on Ethereum
],
"42161": [
{
"address": "0x0000000000000000000000000000000000000000",
"chainId": 42161,
"symbol": "ETH",
"decimals": 18,
"name": "ETH",
"coinKey": "ETH",
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",
"priceUSD": "2923.27"
},
{
"address": "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
"chainId": 42161,
"symbol": "USDC",
"decimals": 6,
"name": "USD Coin",
"coinKey": "USDC",
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",
"priceUSD": "0.999606",
"tags": ["stablecoin"]
},
{
"address": "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",
"chainId": 42161,
"symbol": "USDT",
"decimals": 6,
"name": "Tether USD",
"coinKey": "USDT",
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png",
"priceUSD": "1.00",
"tags": ["stablecoin"]
}
// ... 200+ more tokens on Arbitrum
]
}
}
What to Extract
| Field | Purpose |
|---|---|
tokens[chainId][].address | Token contract address (use in quote) |
tokens[chainId][].symbol | Human-readable symbol |
tokens[chainId][].decimals | For converting human amounts to smallest units |
tokens[chainId][].priceUSD | Current USD price |
tokens[chainId][].coinKey | Canonical token identifier across chains |
tokens[chainId][].tags | Token categories (e.g., “stablecoin”) |
You can use token symbols (e.g.,
USDC) instead of addresses in the quote request - the API resolves them automatically.Call 3: Get a Quote
Request a quote for the transfer. This returns transaction data ready to execute.Request
Copy
Ask AI
curl "https://li.quest/v1/quote?fromChain=1&toChain=42161&fromToken=USDC&toToken=USDC&fromAmount=10000000&fromAddress=0x552008c0f6870c2f77e5cC1d2eb9bdff03e30Ea0"
Parameters
| Parameter | Required | Description |
|---|---|---|
fromChain | Yes | Source chain ID (e.g., 1) |
toChain | Yes | Destination chain ID (e.g., 42161) |
fromToken | Yes | Source token address or symbol |
toToken | Yes | Destination token address or symbol |
fromAmount | Yes | Amount in smallest unit (e.g., 10000000 = 10 USDC) |
fromAddress | Yes | Sender wallet address |
toAddress | No | Recipient address (defaults to fromAddress) |
slippage | No | Max slippage as decimal (default: 0.005 = 0.5%) |
Response
Copy
Ask AI
{
"type": "lifi",
"id": "9f32864e-d704-46c1-874e-20f492c0ce77:0",
"tool": "across",
"toolDetails": {
"key": "across",
"name": "AcrossV4",
"logoURI": "https://raw.githubusercontent.com/lifinance/types/main/src/assets/icons/bridges/across.svg"
},
"action": {
"fromToken": {
"address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"chainId": 1,
"symbol": "USDC",
"decimals": 6,
"name": "USD Coin",
"coinKey": "USDC",
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",
"priceUSD": "0.999606",
"tags": ["stablecoin"]
},
"fromAmount": "10000000",
"toToken": {
"address": "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
"chainId": 42161,
"symbol": "USDC",
"decimals": 6,
"name": "USD Coin",
"coinKey": "USDC",
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",
"priceUSD": "0.999606",
"tags": ["stablecoin"]
},
"fromChainId": 1,
"toChainId": 42161,
"slippage": 0.001,
"fromAddress": "0x552008c0f6870c2f77e5cC1d2eb9bdff03e30Ea0",
"toAddress": "0x552008c0f6870c2f77e5cC1d2eb9bdff03e30Ea0"
},
"estimate": {
"tool": "across",
"approvalAddress": "0x1231DEB6f5749EF6cE6943a275A1D3E7486F4EaE",
"toAmountMin": "9965731",
"toAmount": "9965731",
"fromAmount": "10000000",
"feeCosts": [
{
"name": "LIFI Fixed Fee",
"description": "Fixed LIFI fee, independent of any other fee",
"token": {
"address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"chainId": 1,
"symbol": "USDC",
"decimals": 6,
"name": "USD Coin",
"coinKey": "USDC",
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",
"priceUSD": "0.999606",
"tags": ["stablecoin"]
},
"amount": "25000",
"amountUSD": "0.0250",
"percentage": "0.0025",
"included": true,
"feeSplit": {
"integratorFee": "0",
"lifiFee": "25000"
}
},
{
"name": "Relayer fee",
"description": "The fee taken by the relayer",
"token": {
"address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"chainId": 1,
"symbol": "USDC",
"decimals": 6,
"name": "USD Coin",
"coinKey": "USDC",
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",
"priceUSD": "0.999606",
"tags": ["stablecoin"]
},
"amount": "997",
"amountUSD": "0.0010",
"percentage": "0.000100",
"included": true
},
{
"name": "Relayer gas fee",
"description": "The gas fee taken by the relayer",
"token": {
"address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"chainId": 1,
"symbol": "USDC",
"decimals": 6,
"name": "USD Coin",
"coinKey": "USDC",
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",
"priceUSD": "0.999606",
"tags": ["stablecoin"]
},
"amount": "8272",
"amountUSD": "0.0083",
"percentage": "0.000829",
"included": true
}
],
"gasCosts": [
{
"type": "SEND",
"price": "65729222",
"estimate": "220266",
"limit": "286346",
"amount": "14477912813052",
"amountUSD": "0.0423",
"token": {
"address": "0x0000000000000000000000000000000000000000",
"chainId": 1,
"symbol": "ETH",
"decimals": 18,
"name": "ETH",
"coinKey": "ETH",
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",
"priceUSD": "2923.27",
"tags": ["major_asset"]
}
}
],
"executionDuration": 4,
"fromAmountUSD": "9.9961",
"toAmountUSD": "9.9618"
},
"includedSteps": [
{
"id": "e1c87be5-80be-4e2d-8c96-a6492566a739",
"type": "protocol",
"action": {
"fromChainId": 1,
"fromAmount": "10000000",
"fromToken": {
"address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"chainId": 1,
"symbol": "USDC",
"decimals": 6,
"name": "USD Coin",
"coinKey": "USDC",
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",
"priceUSD": "0.999606",
"tags": ["stablecoin"]
},
"toChainId": 1,
"toToken": {
"address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"chainId": 1,
"symbol": "USDC",
"decimals": 6,
"name": "USD Coin",
"coinKey": "USDC",
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",
"priceUSD": "0.999606",
"tags": ["stablecoin"]
},
"slippage": 0.001,
"fromAddress": "0x1231DEB6f5749EF6cE6943a275A1D3E7486F4EaE",
"toAddress": "0x1231DEB6f5749EF6cE6943a275A1D3E7486F4EaE"
},
"estimate": {
"fromAmount": "10000000",
"toAmount": "9975000",
"toAmountMin": "9975000",
"tool": "feeCollection",
"approvalAddress": "0x3Ef238c36035880EfbDfa239d218186b79Ad1d6F",
"gasCosts": [
{
"type": "SEND",
"price": "65729222",
"estimate": "130000",
"limit": "169000",
"amount": "8544798860000",
"amountUSD": "0.0250",
"token": {
"address": "0x0000000000000000000000000000000000000000",
"chainId": 1,
"symbol": "ETH",
"decimals": 18,
"name": "ETH",
"coinKey": "ETH",
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",
"priceUSD": "2923.27",
"tags": ["major_asset"]
}
}
],
"feeCosts": [
{
"name": "LIFI Fixed Fee",
"description": "Fixed LIFI fee, independent of any other fee",
"token": {
"address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"chainId": 1,
"symbol": "USDC",
"decimals": 6,
"name": "USD Coin",
"coinKey": "USDC",
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",
"priceUSD": "0.999606",
"tags": ["stablecoin"]
},
"amount": "25000",
"amountUSD": "0.0250",
"percentage": "0.0025",
"included": true,
"feeSplit": {
"integratorFee": "0",
"lifiFee": "25000"
}
}
],
"executionDuration": 0
},
"tool": "feeCollection",
"toolDetails": {
"key": "feeCollection",
"name": "Integrator Fee",
"logoURI": "https://raw.githubusercontent.com/lifinance/types/main/src/assets/icons/protocols/feeCollection.svg"
}
},
{
"id": "529839e7-a048-4abe-99ad-d650a0fe469e",
"type": "cross",
"action": {
"fromChainId": 1,
"fromAmount": "9975000",
"fromToken": {
"address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"chainId": 1,
"symbol": "USDC",
"decimals": 6,
"name": "USD Coin",
"coinKey": "USDC",
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",
"priceUSD": "0.999606",
"tags": ["stablecoin"]
},
"toChainId": 42161,
"toToken": {
"address": "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
"chainId": 42161,
"symbol": "USDC",
"decimals": 6,
"name": "USD Coin",
"coinKey": "USDC",
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",
"priceUSD": "0.999606",
"tags": ["stablecoin"]
},
"slippage": 0.001,
"fromAddress": "0x1231DEB6f5749EF6cE6943a275A1D3E7486F4EaE",
"toAddress": "0x552008c0f6870c2f77e5cC1d2eb9bdff03e30Ea0",
"destinationGasConsumption": "0"
},
"estimate": {
"fromAmount": "9975000",
"toAmount": "9965731",
"toAmountMin": "9965731",
"approvalAddress": "0x5c7BCd6E7De5423a257D81B442095A1a6ced35C5",
"executionDuration": 4,
"feeCosts": [
{
"name": "Relayer fee",
"description": "The fee taken by the relayer",
"token": {
"address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"chainId": 1,
"symbol": "USDC",
"decimals": 6,
"name": "USD Coin",
"coinKey": "USDC",
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",
"priceUSD": "0.999606",
"tags": ["stablecoin"]
},
"amount": "997",
"amountUSD": "0.0010",
"percentage": "0.000100",
"included": true
},
{
"name": "Relayer gas fee",
"description": "The gas fee taken by the relayer",
"token": {
"address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"chainId": 1,
"symbol": "USDC",
"decimals": 6,
"name": "USD Coin",
"coinKey": "USDC",
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",
"priceUSD": "0.999606",
"tags": ["stablecoin"]
},
"amount": "8272",
"amountUSD": "0.0083",
"percentage": "0.000829",
"included": true
}
],
"gasCosts": [
{
"type": "SEND",
"price": "65729222",
"estimate": "86000",
"limit": "111800",
"amount": "5652713092000",
"amountUSD": "0.0165",
"token": {
"address": "0x0000000000000000000000000000000000000000",
"chainId": 1,
"symbol": "ETH",
"decimals": 18,
"name": "ETH",
"coinKey": "ETH",
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",
"priceUSD": "2923.27",
"tags": ["major_asset"]
}
}
],
"tool": "across"
},
"tool": "across",
"toolDetails": {
"key": "across",
"name": "AcrossV4",
"logoURI": "https://raw.githubusercontent.com/lifinance/types/main/src/assets/icons/bridges/across.svg"
}
}
],
"integrator": "lifi-api",
"transactionRequest": {
"value": "0x0",
"to": "0x1231DEB6f5749EF6cE6943a275A1D3E7486F4EaE",
"data": "0x1794958f0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000004001695bded7c1634dce4a200bdec72be0ed6cc5f7153ec2dc832b271d790eb00c8000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000552008c0f6870c2f77e5cc1d2eb9bdff03e30ea000000000000000000000000000000000000000000000000000000000009834d8000000000000000000000000000000000000000000000000000000000000a4b10000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000066163726f7373000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000086c6966692d617069000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000003ef238c36035880efbdfa239d218186b79ad1d6f0000000000000000000000003ef238c36035880efbdfa239d218186b79ad1d6f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000000000000000000000000000000000000098968000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000084eedd56e1000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000061a8000000000000000000000000b9c0de368bece5e76b52545a8e377a4c118f597b00000000000000000000000000000000000000000000000000000000000000000000000000000000552008c0f6870c2f77e5cc1d2eb9bdff03e30ea0000000000000000000000000552008c0f6870c2f77e5cc1d2eb9bdff03e30ea0000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000af88d065e77c8cc2239327c5edb3a432268e583100000000000000000000000000000000000000000000000000000000009810a30000000000000000000000000000000000000000000000000ddd69940d1f65b200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000069734fab00000000000000000000000000000000000000000000000000000000697373ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000000",
"from": "0x552008c0f6870c2f77e5cC1d2eb9bdff03e30Ea0",
"chainId": 1,
"gasPrice": "0x3eaf2c6",
"gasLimit": "0x45e8a"
},
"transactionId": "0x1695bded7c1634dce4a200bdec72be0ed6cc5f7153ec2dc832b271d790eb00c8"
}
What to Extract
| Field | Purpose |
|---|---|
tool | Bridge/DEX used (needed for status check) |
estimate.toAmount | Expected output amount |
estimate.toAmountMin | Minimum guaranteed (slippage protected) |
estimate.approvalAddress | Spender address for token approval (if ERC20) |
estimate.executionDuration | Estimated time in seconds |
estimate.feeCosts | Array of protocol fees |
estimate.gasCosts | Array of gas costs |
includedSteps | Detailed breakdown of each step in the transfer |
transactionRequest | Ready-to-sign transaction object |
transactionId | Unique identifier for tracking this transfer |
Call 4: Execute the Transaction
Before executing, ensure the user has approved the token transfer if using an ERC20 token. Check if
fromToken is native (ETH) or ERC20, and verify allowance.Approval Check (if ERC20)
IffromToken.address is NOT 0x0000000000000000000000000000000000000000:
- Call
allowance(fromAddress, approvalAddress)on the token contract - If allowance < fromAmount, send an
approve(approvalAddress, amount)transaction first
Execute Transaction
Sign and send thetransactionRequest object from the quote response:
Copy
Ask AI
// The transactionRequest is ready to use
const tx = {
to: quote.transactionRequest.to,
data: quote.transactionRequest.data,
value: quote.transactionRequest.value,
gasLimit: quote.transactionRequest.gasLimit,
chainId: quote.transactionRequest.chainId
};
// Sign and send with user's wallet
const txResponse = await wallet.sendTransaction(tx);
const txHash = txResponse.hash;
What to Save
txHash- Transaction hash for status polling (required)fromChain- Source chain ID (optional, speeds up status check)toChain- Destination chain ID (optional)tool- From the quote response (optional)
Call 5: Poll Transfer Status
Check the status of the cross-chain transfer until it completes.Request
Copy
Ask AI
curl "https://li.quest/v1/status?txHash=0xabc123...&bridge=stargate&fromChain=1&toChain=42161"
Parameters
| Parameter | Required | Description |
|---|---|---|
txHash | Yes | Transaction hash from step 4 |
fromChain | No | Source chain ID (recommended for faster response) |
toChain | No | Destination chain ID |
bridge | No | The tool value from the quote |
Only
txHash is required. The other parameters are optional but providing fromChain speeds up the request.Response
Copy
Ask AI
{
"transactionId": "0x1695bded7c1634dce4a200bdec72be0ed6cc5f7153ec2dc832b271d790eb00c8",
"sending": {
"txHash": "0x1695bded7c1634dce4a200bdec72be0ed6cc5f7153ec2dc832b271d790eb00c8",
"txLink": "https://etherscan.io/tx/0x1695bded7c1634dce4a200bdec72be0ed6cc5f7153ec2dc832b271d790eb00c8",
"chainId": 1,
"amount": "10000000",
"token": {
"address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"chainId": 1,
"symbol": "USDC",
"decimals": 6,
"name": "USD Coin",
"coinKey": "USDC",
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",
"priceUSD": "0.999606"
},
"amountUSD": "9.9961",
"gasPrice": "65729222",
"gasUsed": "220266",
"gasToken": {
"address": "0x0000000000000000000000000000000000000000",
"chainId": 1,
"symbol": "ETH",
"decimals": 18,
"name": "ETH",
"coinKey": "ETH",
"priceUSD": "2923.27"
},
"gasAmount": "14477912813052",
"gasAmountUSD": "0.0423",
"timestamp": 1737625200
},
"receiving": {
"txHash": "0xdef456789abc...",
"txLink": "https://arbiscan.io/tx/0xdef456789abc...",
"chainId": 42161,
"amount": "9965731",
"token": {
"address": "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
"chainId": 42161,
"symbol": "USDC",
"decimals": 6,
"name": "USD Coin",
"coinKey": "USDC",
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",
"priceUSD": "0.999606"
},
"amountUSD": "9.9618",
"timestamp": 1737625204
},
"lifiExplorerLink": "https://explorer.li.fi/tx/0x1695bded7c1634dce4a200bdec72be0ed6cc5f7153ec2dc832b271d790eb00c8",
"fromAddress": "0x552008c0f6870c2f77e5cC1d2eb9bdff03e30Ea0",
"toAddress": "0x552008c0f6870c2f77e5cC1d2eb9bdff03e30Ea0",
"tool": "across",
"status": "DONE",
"substatus": "COMPLETED"
}
Status Values
| Status | Action |
|---|---|
NOT_FOUND | Transaction not indexed yet, keep polling |
PENDING | Transfer in progress, keep polling |
DONE | Transfer complete, check substatus |
FAILED | Transfer failed, check error |
Substatus Values (when DONE)
| Substatus | Meaning |
|---|---|
COMPLETED | Success - user received exact requested tokens |
PARTIAL | Success - user received different token (full value) |
REFUNDED | Failed - tokens returned to sender |
Polling Strategy
Copy
Ask AI
const pollStatus = async (txHash, bridge, fromChain, toChain) => {
const maxAttempts = 60;
let attempt = 0;
while (attempt < maxAttempts) {
const response = await fetch(
`https://li.quest/v1/status?txHash=${txHash}&bridge=${bridge}&fromChain=${fromChain}&toChain=${toChain}`
);
const status = await response.json();
if (status.status === 'DONE' || status.status === 'FAILED') {
return status;
}
// Wait 10 seconds before next poll
await new Promise(resolve => setTimeout(resolve, 10000));
attempt++;
}
throw new Error('Status polling timeout');
};
Complete Flow Diagram
Copy
Ask AI
┌─────────────────────────────────────────────────────────────────┐
│ AGENT WORKFLOW │
├─────────────────────────────────────────────────────────────────┤
│ │
│ 1. GET /chains ──────────────────────► List of chain IDs │
│ │
│ 2. GET /tokens?chains=X,Y ───────────► Token addresses │
│ │
│ 3. GET /quote?fromChain=X&... ───────► transactionRequest │
│ │ │
│ ▼ │
│ 4. [Check if ERC20] │
│ │ │
│ ├── Native token ──► Skip approval │
│ │ │
│ └── ERC20 ──► Check allowance │
│ │ │
│ └── If insufficient ──► Send approve() tx │
│ │
│ 5. Sign & send transactionRequest ───► txHash │
│ │
│ 6. GET /status?txHash=X&... ─────────► Poll until DONE │
│ │ │
│ ├── PENDING ──► Keep polling │
│ │ │
│ ├── DONE + COMPLETED ──► Success! │
│ │ │
│ ├── DONE + PARTIAL ──► Success (different token) │
│ │ │
│ └── FAILED ──► Handle error │
│ │
└─────────────────────────────────────────────────────────────────┘
Quick Reference
Copy
Ask AI
# 1. Get chains
curl "https://li.quest/v1/chains"
# 2. Get tokens for Ethereum and Arbitrum
curl "https://li.quest/v1/tokens?chains=1,42161"
# 3. Get quote for 10 USDC from Ethereum to Arbitrum (replace address with your own)
curl "https://li.quest/v1/quote?fromChain=1&toChain=42161&fromToken=USDC&toToken=USDC&fromAmount=10000000&fromAddress=0x552008c0f6870c2f77e5cC1d2eb9bdff03e30Ea0"
# 4. Execute transactionRequest with user's wallet
# 5. Check status
curl "https://li.quest/v1/status?txHash=TX_HASH&bridge=TOOL&fromChain=1&toChain=42161"

