Cross-Chain Swap (Relay) logo

Catalog action EVM Onchain wallet Gas bridge

Swap or bridge tokens across chains using Relay Protocol. Supports same-chain swaps, cross-chain EVM transfers, and bridging to Solana. Configurable slippage.

This action can require a wallet connector, gas, token movement, or an external side effect. Test with simulation or a controlled amount before using it in a live workflow.

At a Glance

FieldValue
Action IDrelay-swap
CategoryEVM Onchain
Connectorwallet
Requires gasYes
Funds movementbridge
Tagsblockchain, evm, dex, swap, bridge, cross-chain, relay, defi

Payload Schema

FieldTypeRequiredDescription
srcChainIdnumberYesSource chain ID (e.g., 1 for Ethereum, 8453 for Base, 42161 for Arbitrum)
tokenInstringYesSource token address. Use "native", 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE, or 0x0000000000000000000000000000000000000000 for native tokens (ETH, BNB, POL, etc.). Use native address format for other chains (e.g., base58 for Solana).
amountInstringNoExact input amount to sell in smallest unit (wei for ETH). Provide either amountIn (EXACT_INPUT) or amountOut (EXACT_OUTPUT), not both.
amountOutstringNoDesired output amount to receive in smallest unit. When provided, Relay quotes the minimum amountIn needed to receive this amount (EXACT_OUTPUT mode). Provide either amountIn or amountOut, not both.
dstChainIdnumberYesDestination chain ID. Can be same as srcChainId for same-chain swaps or different for cross-chain.
tokenOutstringYesDestination token address. Use "native", 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE, or 0x0000000000000000000000000000000000000000 for native tokens (ETH, BNB, POL, etc.). Use native address format for other chains (e.g., base58 for Solana).
recipientstringNoRecipient address for the output tokens. Defaults to sender if not specified. Required for non-EVM destinations (e.g., Solana).
useMaxTokenInBalancebooleanNoWhen true and tokenIn is a native token, subtracts estimated gas cost from amountIn (based on current gas price). Useful when bridging all native ETH cross-chain, where amountIn is the full balance and gas must be reserved. Only applies to native tokens.
slippageBpsnumberNoSlippage tolerance in basis points (100 = 1%). Default is 300 (3%). Max 8000 (80%).

Result Schema

FieldTypeRequiredDescription
statusstringYesStatus of the swap operation
srcTransactionHashstringNoTransaction hash on the source chain
dstTransactionHashstringNoTransaction hash on the destination chain (for cross-chain swaps)
amountInstringNoInput amount that was swapped (actual amount sold, useful in EXACT_OUTPUT mode).
amountOutstringNoOutput amount received
srcChainIdnumberNoSource chain ID
dstChainIdnumberNoDestination chain ID

Examples

json
{ "type": "relay-swap", "payload": { "tokenIn": "ETH", "tokenOut": "ETH", "srcChainId": 8453, "dstChainId": 8453 }, "children": [], "connector": { "type": "wallet", "id": "conn_wallet" }}

Payload fields can use workflow expressions such as {{$trigger.body.amount}}, {{$nodes.fetch.result.price}}, and {{$props.asset}} when the value should come from a trigger, prior node, or reusable workflow prop.

Ask a question... ⌘I