Swap Tokens (Uniswap) logo

Catalog action EVM Onchain wallet Gas swap

Swap ERC20 tokens on Uniswap at the best available price on a single chain. Routes through the hosted Uniswap Trading API, which auto-selects across V2/V3/V4 pools, encodes the on-chain slippage floor, and uses Permit2 for approvals. Supports native ETH input and output. Returns the transaction hash and output amount. Ideal for: same-chain token swaps, native-ETH swaps, buying and selling ERC20s.

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 IDuniswap-swap
CategoryEVM Onchain
Connectorwallet
Requires gasYes
Funds movementswap
Tagsblockchain, evm, dex, swap, sell, buy, token, erc20, trade, uniswap, defi

Payload Schema

FieldTypeRequiredDescription
tokenInstringYesInput token address to sell. Use 0x0000000000000000000000000000000000000000 for native ETH.
tokenOutstringYesOutput token address to receive. Use 0x0000000000000000000000000000000000000000 for native ETH.
amountInstringYesExact input amount to sell, in the token's smallest unit (wei).
chainIdnumberYesChain to swap on. Uniswap Trading API routing is single-chain only.
recipientstringNoOutput tokens are always delivered to the swapping wallet — the Trading API has no separate destination parameter. If provided, this MUST equal the swapping wallet address; a different address is rejected. Leave empty to use the swapping wallet.
slippageBpsnumberNoSlippage tolerance in basis points (100 = 1%). Default is 300 (3%). Max 8000 (80%). The executor converts this to the API's percent form (slippageTolerance = slippageBps / 100).
maxPriceImpactBpsnumberNoAborts the swap if the quote's price impact exceeds this many basis points (1000 = 10%). Default is 1000 (10%). Higher tolerates more impact. Read from the Trading API quote's own priceImpact; a quote that omits a numeric impact proceeds unchecked.

Result Schema

FieldTypeRequiredDescription
transactionHashstringYesThe Trading API swap transaction hash.
amountOutstringYesActual output amount received, in the token's smallest unit. Parsed from the transaction receipt's ERC20 Transfer logs for ERC20 output; falls back to the quoted amount for native-ETH output or when the receipt can't be reliably decoded.
amountOutFormattedstring | nullNoFull-precision, human-readable output amount. Null when tokenOut's decimals could not be resolved.
tokenOutDecimalsnumber | nullNoDecimal places of tokenOut, used to format amountOutFormatted. Null if on-chain lookup failed.
tokenOutSymbolstring | nullNoSymbol of the output token (e.g. 'USDC'). Null if on-chain lookup failed.
chainIdnumberYesChain the swap executed on.
wrappedTxHashstring | nullNoTransaction hash of the WETH.deposit() wrap, present only when tokenIn was native and had no direct route — the action wrapped to WETH before swapping. Null on the normal (no-wrap) path.

Examples

json
{ "type": "uniswap-swap", "payload": { "tokenIn": "0x4200000000000000000000000000000000000006", "tokenOut": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "amountIn": "1000000000000000000", "chainId": 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.