## Documentation Index Fetch the complete documentation index at: https://docs.relay.link/llms.txt Use this file to discover all available pages before exploring further.
## Agent Instructions To quote bridges and swaps, look up chains and tokens, or track Relay transactions from an agent, use the Relay MCP server: npx -y @relayprotocol/relay-mcp. It is read-only and does not sign or broadcast transactions. Setup: https://docs.relay.link/resources/developing-with-ai.md For Relay Protocol's trust model, security architecture, and audits, see https://docs.relay.link/references/protocol/security.md. For address screening, see https://docs.relay.link/security/transaction-screening.md.Call Execution Integration Guide
How to execute cross-chain calls using Relay
[!TIP] New to Relay? Start with the Quickstart Guide and work your way through your first cross-chain transaction.
You can use Relay cross-chain execution to perform any action (tx) on any chain. This works by specifying the transaction data you wish to execute on the destination chain as part of the initial quoting process.
Before you start
[!WARNING] Origin chain gas required: The user must have a small amount of native gas token (e.g., ETH) on the origin chain to submit the deposit transaction. While Relay handles destination chain execution and deducts fees from the user's tokens, the initial onchain deposit still requires native gas — this is an EVM-level requirement. If your users have zero native tokens, see Gasless Swaps to find the right approach, or use Smart Accounts (EIP-7702 or ERC-4337) / Gasless Execution for a fully gasless flow.
While not mandatory for integration, doing the following will improve the UX for your users considerably:
- Verify user balance - Confirm user has sufficient funds for amount + fees, including native gas on the origin chain for the deposit transaction
- Check chain support - Confirm both origin and destination chains are supported
- Validate quote - Quotes are revalidated when being filled, keep your quotes as fresh as possible.
- Handle errors - Implement proper error handling for API requests and transaction failures
1. Get a Quote
Get a Quote
To execute a cross-chain transaction, you need to specify the origin chain for payment, the destination chain where the contract is deployed, and the transaction data to execute. Use the quote endpoint with specific parameters for cross-chain calling.
Cross-chain calls support both EXACT_INPUT and EXACT_OUTPUT. Use EXACT_OUTPUT when the destination call requires a precise output amount. Use EXACT_INPUT when you want to cap how much the user spends and can tolerate variable output.
Using EXACT_INPUT with proxy contracts
For EXACT_INPUT calls, integrators usually need their own proxy contract on the destination chain. Because Relay delivers a variable output amount, you cannot always precompute the final calldata at quote time.
Depositing into Aave is a good example. With EXACT_OUTPUT, the request can include two calls directly: approve the Aave pool, then call supply() with a fixed amount. With EXACT_INPUT, the destination amount is variable, so route the calls through your own Aave-specific proxy contract instead.
A simple proxy contract can:
- pull the full approved token balance from the caller that initiated execution, such as Relay's router in a Relay deposit flow
- approve the Aave pool contract
- call
supply()using its full current balance
In that flow, your Relay request should include:
- an approval to your proxy contract, usually for
MAX_UINT256 - a call to your proxy contract, such as
execute()
Your proxy contract then reads its live balance at execution time and builds the final Aave interaction from that balance.
The request below is schematic. In practice, txs[].data must contain ABI-encoded calldata.
[!WARNING] Starting October 2, 2026,POST /quote/v2will require a valid API key on every request. Pass your key in thex-api-keyheader — see API keys and Rate Limits. Requests that include areferreralready require the key today.quote/v2remains fully supported for authenticated requests.
curl -X POST "https://api.relay.link/quote/v2" \
-H "Content-Type: application/json" \
-d '{
"user": "WALLET",
"originChainId": 42161,
"destinationChainId": 137,
"originCurrency": "0x0000000000000000000000000000000000000000",
"destinationCurrency": "0x2791bca1f2de4661ed88a30c99a7a9449aa84174",
"amount": "100000000000000",
"tradeType": "EXACT_INPUT",
"txs": [
{
"to": "0x2791bca1f2de4661ed88a30c99a7a9449aa84174",
"data": "approve(PROXY_CONTRACT, MAX_UINT256)",
"value": "0"
},
{
"to": "PROXY_CONTRACT",
"data": "execute()",
"value": "0"
}
]
}'In execute(), your proxy can read its token balance, approve the Aave pool, and call supply(asset, balance, onBehalfOf, referralCode) with the live balance.
curl -X POST "https://api.relay.link/quote/v2" \
-H "Content-Type: application/json" \
-d '{
"user": "0x03508bb71268bba25ecacc8f620e01866650532c",
"originChainId": 1,
"destinationChainId": 8453,
"originCurrency": "0x0000000000000000000000000000000000000000",
"destinationCurrency": "0x0000000000000000000000000000000000000000",
"amount": "100000000000000000",
"tradeType": "EXACT_OUTPUT", // use EXACT_INPUT to cap spend and accept variable output
"txs": [
{
"to": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"value": "100000000000000000",
"data": "0xd0e30db0"
}
]
}'{
"steps": [
{
"id": "deposit",
"action": "Confirm transaction in your wallet",
"description": "Depositing funds to the depository contract",
"kind": "transaction",
"items": [
{
"status": "incomplete",
"data": {
"from": "0x03508bb71268bba25ecacc8f620e01866650532c",
"to": "0x4cd00e387622c35bddb9b4c962c136462338bc31",
"data": "0x49290c1c00000000000000000000000003508bb71268bba25ecacc8f620e01866650532c0d0f5bc9e030aa965a11905d83e54a407697e6fcdba5c300875db0fbf93e186b",
"value": "100012440985606146",
"chainId": 1,
"gas": "32713",
"maxFeePerGas": "386206132",
"maxPriorityFeePerGas": "246844318"
},
"check": {
"endpoint": "/intents/status/v3?requestId=0xa8de0141e504d2f7ed6b17cfd03455ecc2b17ab4e63120e43c38dce8015c1004",
"method": "GET"
}
}
],
"requestId": "0xa8de0141e504d2f7ed6b17cfd03455ecc2b17ab4e63120e43c38dce8015c1004",
"depositAddress": ""
}
],
"fees": {
"gas": {
"currency": {
"chainId": 1,
"address": "0x0000000000000000000000000000000000000000",
"symbol": "ETH",
"name": "Ether",
"decimals": 18,
"metadata": {
"logoURI": "https://assets.relay.link/icons/1/light.png",
"verified": true
}
},
"amount": "8496534904000",
"amountFormatted": "0.000008496534904",
"amountUsd": "0.019054",
"minimumAmount": "8496534904000"
},
"relayer": {
"currency": {
"chainId": 1,
"address": "0x0000000000000000000000000000000000000000",
"symbol": "ETH",
"name": "Ether",
"decimals": 18,
"metadata": {
"logoURI": "https://assets.relay.link/icons/1/light.png",
"verified": true
}
},
"amount": "12440985606146",
"amountFormatted": "0.000012440985606146",
"amountUsd": "0.027900",
"minimumAmount": "12440985606146"
},
"relayerGas": {
"currency": {
"chainId": 1,
"address": "0x0000000000000000000000000000000000000000",
"symbol": "ETH",
"name": "Ether",
"decimals": 18,
"metadata": {
"logoURI": "https://assets.relay.link/icons/1/light.png",
"verified": true
}
},
"amount": "1293116969649",
"amountFormatted": "0.000001293116969649",
"amountUsd": "0.002900",
"minimumAmount": "1293116969649"
},
"relayerService": {
"currency": {
"chainId": 1,
"address": "0x0000000000000000000000000000000000000000",
"symbol": "ETH",
"name": "Ether",
"decimals": 18,
"metadata": {
"logoURI": "https://assets.relay.link/icons/1/light.png",
"verified": true
}
},
"amount": "11147868636497",
"amountFormatted": "0.000011147868636497",
"amountUsd": "0.025000",
"minimumAmount": "11147868636497"
},
"app": {
"currency": {
"chainId": 1,
"address": "0x0000000000000000000000000000000000000000",
"symbol": "ETH",
"name": "Ether",
"decimals": 18,
"metadata": {
"logoURI": "https://assets.relay.link/icons/1/light.png",
"verified": true
}
},
"amount": "0",
"amountFormatted": "0.0",
"amountUsd": "0",
"minimumAmount": "0"
},
"subsidized": {
"currency": {
"chainId": 1,
"address": "0x0000000000000000000000000000000000000000",
"symbol": "ETH",
"name": "Ether",
"decimals": 18,
"metadata": {
"logoURI": "https://assets.relay.link/icons/1/light.png",
"verified": true
}
},
"amount": "0",
"amountFormatted": "0.0",
"amountUsd": "0",
"minimumAmount": "0"
}
},
"details": {
"operation": "swap",
"sender": "0x03508bb71268bba25ecacc8f620e01866650532c",
"recipient": "0x03508bb71268bba25ecacc8f620e01866650532c",
"currencyIn": {
"currency": {
"chainId": 1,
"address": "0x0000000000000000000000000000000000000000",
"symbol": "ETH",
"name": "Ether",
"decimals": 18,
"metadata": {
"logoURI": "https://assets.relay.link/icons/1/light.png",
"verified": true
}
},
"amount": "100012440985606146",
"amountFormatted": "0.100012440985606146",
"amountUsd": "224.286014",
"minimumAmount": "100012440985606146"
},
"currencyOut": {
"currency": {
"chainId": 8453,
"address": "0x0000000000000000000000000000000000000000",
"symbol": "ETH",
"name": "Ether",
"decimals": 18,
"metadata": {
"logoURI": "https://assets.relay.link/icons/1/light.png",
"verified": true
}
},
"amount": "100000000000000000",
"amountFormatted": "0.1",
"amountUsd": "224.258114",
"minimumAmount": "100000000000000000"
},
"refundCurrency": {
"currency": {
"chainId": 1,
"address": "0x0000000000000000000000000000000000000000",
"symbol": "ETH",
"name": "Ether",
"decimals": 18,
"metadata": {
"logoURI": "https://assets.relay.link/icons/1/light.png",
"verified": true
}
},
"amount": "100012440985606146",
"amountFormatted": "0.100012440985606146",
"amountUsd": "224.286014",
"minimumAmount": "100012440985606146"
},
"totalImpact": {
"usd": "-0.027900",
"percent": "-0.01"
},
"swapImpact": {
"usd": "0.000000",
"percent": "0.00"
},
"expandedPriceImpact": {
"swap": {
"usd": "0.000000"
},
"execution": {
"usd": "-0.0229"
},
"relay": {
"usd": "-0.005"
},
"app": {
"usd": "0"
}
},
"rate": "0.9998756056198255",
"slippageTolerance": {
"origin": {
"usd": "0.000000",
"value": "0",
"percent": "0.00"
},
"destination": {
"usd": "0.000000",
"value": "0",
"percent": "0.00"
}
},
"timeEstimate": 4,
"userBalance": "0",
"isFixedRate": true,
"route": {
"origin": {
"inputCurrency": {
"currency": {
"chainId": 1,
"address": "0x0000000000000000000000000000000000000000",
"symbol": "ETH",
"name": "Ether",
"decimals": 18,
"metadata": {
"logoURI": "https://assets.relay.link/icons/1/light.png",
"verified": true
}
},
"amount": "100012440985606146",
"amountFormatted": "0.100012440985606146",
"amountUsd": "224.286014",
"minimumAmount": "100012440985606146"
},
"outputCurrency": {
"currency": {
"chainId": 1,
"address": "0x0000000000000000000000000000000000000000",
"symbol": "ETH",
"name": "Ether",
"decimals": 18,
"metadata": {
"logoURI": "https://assets.relay.link/icons/1/light.png",
"verified": true
}
},
"amount": "100012440985606146",
"amountFormatted": "0.100012440985606146",
"amountUsd": "224.286014",
"minimumAmount": "100012440985606146"
},
"router": "relay"
},
"destination": {
"inputCurrency": {
"currency": {
"chainId": 8453,
"address": "0x0000000000000000000000000000000000000000",
"symbol": "ETH",
"name": "Ether",
"decimals": 18,
"metadata": {
"logoURI": "https://assets.relay.link/icons/1/light.png",
"verified": true
}
},
"amount": "100000000000000000",
"amountFormatted": "0.1",
"amountUsd": "224.258114",
"minimumAmount": "100000000000000000"
},
"outputCurrency": {
"currency": {
"chainId": 8453,
"address": "0x0000000000000000000000000000000000000000",
"symbol": "ETH",
"name": "Ether",
"decimals": 18,
"metadata": {
"logoURI": "https://assets.relay.link/icons/1/light.png",
"verified": true
}
},
"amount": "100000000000000000",
"amountFormatted": "0.1",
"amountUsd": "224.258114",
"minimumAmount": "100000000000000000"
},
"router": "relay"
}
}
},
"protocol": {
"v2": {
"orderId": "0x0d0f5bc9e030aa965a11905d83e54a407697e6fcdba5c300875db0fbf93e186b",
"orderData": {
"version": "v1",
"solverChainId": "base",
"solver": "0xf70da97812cb96acdf810712aa562db8dfa3dbef",
"salt": "0xbf53c12cc90713fc86fc9a59f4c8d1e11377ef6ae345b4de91eae3c6e99f3141",
"inputs": [
{
"payment": {
"chainId": "ethereum",
"currency": "0x0000000000000000000000000000000000000000",
"amount": "100012440985606146",
"weight": "1"
},
"refunds": [
{
"chainId": "ethereum",
"recipient": "0x03508bb71268bba25ecacc8f620e01866650532c",
"currency": "0x0000000000000000000000000000000000000000",
"minimumAmount": "0",
"deadline": 1770778474,
"extraData": "0x000000000000000000000000b92fe925dc43a0ecde6c8b1a2709c170ec4fff4f"
},
{
"chainId": "base",
"recipient": "0x03508bb71268bba25ecacc8f620e01866650532c",
"currency": "0x0000000000000000000000000000000000000000",
"minimumAmount": "0",
"deadline": 1770778474,
"extraData": "0x000000000000000000000000b92fe925dc43a0ecde6c8b1a2709c170ec4fff4f"
}
]
}
],
"output": {
"chainId": "base",
"payments": [
{
"recipient": "0xb92fe925dc43a0ecde6c8b1a2709c170ec4fff4f",
"currency": "0x0000000000000000000000000000000000000000",
"minimumAmount": "100000000000000000",
"expectedAmount": "100000000000000000"
}
],
"calls": [
"0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000016345785d8a000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000004d0e30db000000000000000000000000000000000000000000000000000000000"
],
"deadline": 1770778474,
"extraData": "0x000000000000000000000000b92fe925dc43a0ecde6c8b1a2709c170ec4fff4f"
},
"fees": []
},
"paymentDetails": {
"chainId": "ethereum",
"depository": "0x4cd00e387622c35bddb9b4c962c136462338bc31",
"currency": "0x0000000000000000000000000000000000000000",
"amount": "100012440985606146"
}
}
}
}[!TIP] Create an API key in the Relay Dashboard.
Contract Compatibility
Before integrating cross-chain calls, ensure your contract is compatible with Relay. Review our Contract Compatibility overview to make any necessary changes to your smart contracts.
Contract Interaction with Web3
When calling smart contracts, you'll need to encode the function call data. Here's how to do it with popular libraries:
[!NOTE] Important for ERC20 transactions: If your contract call involves spending ERC20 tokens, you must include an approval transaction in your txs array before the actual contract call. See the ERC20 examples below.import { ethers } from "ethers";
// Contract ABI for the function you want to call
const contractABI = [
"function mint(address to, uint256 amount) external payable",
];
// Create interface to encode function data
const iface = new ethers.Interface(contractABI);
const callData = iface.encodeFunctionData("mint", [
"0x03508bb71268bba25ecacc8f620e01866650532c", // recipient
1, // amount to mint
]);
// Use this callData in your quote request
const quoteRequest = {
user: "0x03508bb71268bba25ecacc8f620e01866650532c",
originChainId: 1,
destinationChainId: 8453,
originCurrency: "eth",
destinationCurrency: "eth",
amount: "100000000000000000",
tradeType: "EXACT_OUTPUT",
txs: [
{
to: "0xContractAddress",
value: "100000000000000000",
data: callData,
},
],
};import { encodeFunctionData, parseEther } from "viem";
// Encode the function call
const callData = encodeFunctionData({
abi: [
{
name: "mint",
type: "function",
inputs: [
{ name: "to", type: "address" },
{ name: "amount", type: "uint256" },
],
},
],
functionName: "mint",
args: ["0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", 1n],
});
const quoteRequest = {
user: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
originChainId: 1,
destinationChainId: 8453,
originCurrency: "eth",
destinationCurrency: "eth",
amount: parseEther("0.1").toString(),
tradeType: "EXACT_OUTPUT",
txs: [
{
to: "0xContractAddress",
value: parseEther("0.1").toString(),
data: callData,
},
],
};from web3 import Web3
# Initialize Web3 (you don't need a provider for encoding)
w3 = Web3()
# Contract ABI
contract_abi = [
{
'name': 'mint',
'type': 'function',
'inputs': [
{'name': 'to', 'type': 'address'},
{'name': 'amount', 'type': 'uint256'}
]
}
]
# Create contract instance for encoding
contract = w3.eth.contract(abi=contract_abi)
# Encode function call
call_data = contract.encodeABI('mint', [
'0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
1
])
quote_request = {
'user': '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
'originChainId': 1,
'destinationChainId': 8453,
'originCurrency': 'eth',
'destinationCurrency': 'eth',
'amount': '100000000000000000',
'tradeType': 'EXACT_OUTPUT',
'txs': [{
'to': '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
'value': '100000000000000000',
'data': call_data
}]
}ERC20 Contract Calls
Critical: When your contract call involves spending ERC20 tokens, you must include an approval transaction in your txs array. The approval must come before the actual contract call.
ERC20 Approval + Contract Call Pattern
import { ethers } from "ethers";
// ERC20 ABI for approval
const erc20ABI = [
"function approve(address spender, uint256 amount) external returns (bool)",
];
// Contract ABI for the function you want to call
const contractABI = [
"function purchaseWithUSDC(address to, uint256 usdcAmount) external",
];
// Encode approval transaction
const erc20Interface = new ethers.Interface(erc20ABI);
const approvalData = erc20Interface.encodeFunctionData("approve", [
"0xContractAddress", // Contract that will spend tokens
"1000000000", // Amount to approve (1000 USDC with 6 decimals)
]);
// Encode contract call transaction
const contractInterface = new ethers.Interface(contractABI);
const contractCallData = contractInterface.encodeFunctionData(
"purchaseWithUSDC",
[
"0x742d35Cc6634C0532925a3b8D9d4DB0a2D7DD5B3", // recipient
"1000000000", // 1000 USDC
]
);
const quoteRequest = {
user: "0x742d35Cc6634C0532925a3b8D9d4DB0a2D7DD5B3",
originChainId: 1,
destinationChainId: 8453,
originCurrency: "usdc",
destinationCurrency: "usdc",
amount: "1000000000", // Amount required for call (1000 USDC with 6 decimals)
tradeType: "EXACT_OUTPUT",
txs: [
{
to: "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913", // USDC contract address
value: "0",
data: approvalData,
},
{
to: "0xContractAddress",
value: "0",
data: contractCallData,
},
],
};import { encodeFunctionData, parseUnits } from "viem";
const usdcAmount = parseUnits("1000", 6); // 1000 USDC
// Encode approval transaction
const approvalData = encodeFunctionData({
abi: [
{
name: "approve",
type: "function",
inputs: [
{ name: "spender", type: "address" },
{ name: "amount", type: "uint256" },
],
},
],
functionName: "approve",
args: ["0xContractAddress", usdcAmount],
});
// Encode contract call
const contractCallData = encodeFunctionData({
abi: [
{
name: "purchaseWithUSDC",
type: "function",
inputs: [
{ name: "to", type: "address" },
{ name: "usdcAmount", type: "uint256" },
],
},
],
functionName: "purchaseWithUSDC",
args: ["0x742d35Cc6634C0532925a3b8D9d4DB0a2D7DD5B3", usdcAmount],
});
const quoteRequest = {
user: "0x742d35Cc6634C0532925a3b8D9d4DB0a2D7DD5B3",
originChainId: 1,
destinationChainId: 8453,
originCurrency: "usdc",
destinationCurrency: "usdc",
amount: "0", // No ETH value for ERC20-only calls
tradeType: "EXACT_OUTPUT",
txs: [
{
to: "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913", // USDC contract
value: "0",
data: approvalData,
},
{
to: "0xContractAddress",
value: "0",
data: contractCallData,
},
],
};from web3 import Web3
w3 = Web3()
# ERC20 ABI for approval
erc20_abi = [
{
'name': 'approve',
'type': 'function',
'inputs': [
{'name': 'spender', 'type': 'address'},
{'name': 'amount', 'type': 'uint256'}
]
}
]
# Contract ABI
contract_abi = [
{
'name': 'purchaseWithUSDC',
'type': 'function',
'inputs': [
{'name': 'to', 'type': 'address'},
{'name': 'usdcAmount', 'type': 'uint256'}
]
}
]
# Create contract instances for encoding
erc20_contract = w3.eth.contract(abi=erc20_abi)
target_contract = w3.eth.contract(abi=contract_abi)
usdc_amount = 1000 * 10**6 # 1000 USDC with 6 decimals
# Encode approval
approval_data = erc20_contract.encodeABI('approve', [
'0xContractAddress',
usdc_amount
])
# Encode contract call
contract_call_data = target_contract.encodeABI('purchaseWithUSDC', [
'0x742d35Cc6634C0532925a3b8D9d4DB0a2D7DD5B3',
usdc_amount
])
quote_request = {
'user': '0x742d35Cc6634C0532925a3b8D9d4DB0a2D7DD5B3',
'originChainId': 1,
'destinationChainId': 8453,
'originCurrency': 'usdc',
'destinationCurrency': 'usdc',
'amount': '1000000000', # Amount required for call (1000 USDC with 6 decimals)
'tradeType': 'EXACT_OUTPUT',
'txs': [
{
'to': '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913', # USDC contract
'value': '0',
'data': approval_data
},
{
'to': '0xContractAddress',
'value': '0',
'data': contract_call_data
}
]
}Sweeping ERC20 Balance
Relay's router contract has a useful function that you can call to transfer out full balance of an ERC20 token, even if you don't know the full balance. There are currently two methods for doing this:
You can use these by passing in the txs field as follows:
{
"to": "0xRouterContractAddress",
"data": "0xEncodedCalldata", // encoded calldata for cleanupErc20s or cleanupNative
"value": 0
}ERC20 Troubleshooting Guide
Problem: "ERC20: transfer amount exceeds allowance" error Solution: Ensure you include the approval transaction before your contract call
Problem: Transaction reverts with "ERC20: insufficient allowance" Solution: Check that the approval amount is sufficient for your contract call
Problem: Approval transaction succeeds but contract call fails Solution: Verify the contract address in the approval matches the contract you're calling
ERC20 Best Practices
- Always approve before spending: Include approval as the first transaction
- Use exact amounts: Approve the exact amount your contract will spend
- Check token decimals: USDC uses 6 decimals, most others use 18
- Verify contract addresses: Use the correct token contract for each chain
- Handle allowances: Some tokens require setting allowance to 0 before setting a new amount
Quote Parameters for Cross-Chain Calls
| Parameter | Type | Description | |
|---|---|---|---|
amount | string | Total value of all txs combined | |
tradeType | string | EXACT_INPUT (quote by input amount) or EXACT_OUTPUT (quote by required output) | |
txs | array | Array of transaction objects | |
txs[].to | string | Contract address to call | |
txs[].value | string | ETH value to send with call | |
txs[].data | string | Encoded function call data |
You can learn more about quote request parameters and response data here.
2. Execute the Call
Execute the Call
After receiving a call quote, execute it by processing each step in the response. The execution handles both the origin chain transaction and destination chain fulfillment.\ \ Learn more about step execution using the API here.
3. Monitor Cross-Chain Call Status
Monitor Cross-Chain Call Status
Track the progress of your cross-chain call using the status endpoint:
curl "https://api.relay.link/intents/status/v3?requestId=0xed42e2e48c56b06f8f384d66d5f3e6c450fc3a2c7cba19d92a01a649a31a0e94"
{
"status": "success",
"inTxHashes": [
"0xae0a66324f82bc54299663972b3a48c939af777ff795b13bd72e7755a6a68bb3"
],
"txHashes": [
"3exJVjCEMfqVCBN6FBCXPFp6JUmm91pBp9Mp5XWwkoBVAgcr6fM4kZyzdAhoRWtWAvVESMZPGA7G1CibTF8uxaMk"
],
"updatedAt": 1769988962883,
"originChainId": 8453,
"destinationChainId": 792703809
}Learn more about how to check the status of the fill here.
Learn more about the status lifecycle, see the status lifecycle diagram.
Preflight Checklist
 Contract compatibility - Before integrating cross-chain calls, ensure your contract is compatible with Relay. Review our Contract Compatibility overview to make any necessary changes to your smart contracts.
 ERC20 approvals - Include approval transactions before any ERC20 spending calls
 Verify transaction data - Confirm amount equals the sum of all txs[].value fields
 Check tradeType - Use "EXACT_OUTPUT" for a precise output, or "EXACT_INPUT" to cap spend
 Plan for `EXACT_INPUT` execution - Use a destination proxy contract that reads the delivered balance and builds follow-up calldata at runtime
 Validate call data - Ensure contract function calls are properly encoded
 Test contract calls - Verify contract functions work as expected on destination chain
 Gas estimation - Account for potential gas usage variations in contract calls
Common Use Cases
Below are some common use cases for cross-chain calls.
- NFT Minting with ETH: Mint NFTs on L2s while paying from L1
- NFT Minting with ERC20: Mint NFTs using USDC
- DeFi Operations: Execute swaps, provide liquidity, or claim rewards on other chains
- Gaming: Execute game actions, purchase items, or claim rewards across chains
// Mint NFT cross-chain with ETH
const mintTx = {
to: "0xNFTContract",
value: "50000000000000000", // 0.05 ETH mint price
data: encodeFunctionData({
abi: nftABI,
functionName: "mint",
args: [userAddress, tokenId],
}),
};// Mint NFT cross-chain with USDC (requires approval first)
const usdcAmount = parseUnits("50", 6); // 50 USDC
const txs = [
{
to: "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913", // USDC contract
value: "0",
data: encodeFunctionData({
abi: erc20ABI,
functionName: "approve",
args: ["0xNFTContract", usdcAmount],
}),
},
{
to: "0xNFTContract",
value: "0",
data: encodeFunctionData({
abi: nftABI,
functionName: "mintWithUSDC",
args: [userAddress, tokenId, usdcAmount],
}),
},
];// Provide liquidity cross-chain with ERC20 tokens
const tokenAmount = parseUnits("1000", 18); // 1000 tokens
const usdcAmount = parseUnits("1000", 6); // 1000 USDC
const txs = [
// Approve token A
{
to: "0xTokenAContract",
value: "0",
data: encodeFunctionData({
abi: erc20ABI,
functionName: "approve",
args: ["0xDEXContract", tokenAmount],
}),
},
// Approve token B (USDC)
{
to: "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
value: "0",
data: encodeFunctionData({
abi: erc20ABI,
functionName: "approve",
args: ["0xDEXContract", usdcAmount],
}),
},
// Add liquidity
{
to: "0xDEXContract",
value: "0",
data: encodeFunctionData({
abi: dexABI,
functionName: "addLiquidity",
args: [
"0xTokenAContract",
"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
tokenAmount,
usdcAmount,
(tokenAmount * 95n) / 100n, // 5% slippage
(usdcAmount * 95n) / 100n, // 5% slippage
Math.floor(Date.now() / 1000) + 1800, // 30 min deadline
],
}),
},
];// Purchase game item with USDC cross-chain
const itemPrice = parseUnits("10", 6); // 10 USDC
const txs = [
{
to: "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913", // USDC approval
value: "0",
data: encodeFunctionData({
abi: erc20ABI,
functionName: "approve",
args: ["0xGameContract", itemPrice],
}),
},
{
to: "0xGameContract",
value: "0",
data: encodeFunctionData({
abi: gameABI,
functionName: "purchaseItemWithUSDC",
args: [itemId, userAddress, itemPrice],
}),
},
];See Also
- **Gasless Swaps**: Find the right gasless approach for your app — permit-based, ERC-4337, or EIP-7702.
- **Smart Accounts**: Enable fully gasless transactions where users hold zero native tokens, using EIP-7702 or ERC-4337.
- **Gasless Execution**: Execute gasless transactions where the transaction signer and gas payer are different addresses.
- **App Fees**: Monetize your integration by adding a fee (in bps) to every quote.
- **Fee Sponsorship**: Sponsor fees for your users to reduce friction and improve the user experience.
- **Handling Errors**: Handle quote errors when using the Relay API.
- **Cost & Fee Structure**: Understand the fees associated with using the Relay API.
This documentation is built and hosted on Mintlify, a developer documentation platform.