Build a WETH→token swap transaction (Universal Router)
build_swapBuild an unsigned transaction to swap a specified amount of WETH for any ERC-20 token using Uniswap's Universal Router, with support for wrapping native ETH or using Permit2 approval.
Instructions
Build an UNSIGNED tx that swaps amountInWei WETH for tokenOut (exact-in, single hop through the fee pool) via the Universal Router. With wrapWei (≥ amountInWei) the tx is payable and wraps that much native ETH first, swaps amountInWei of it, and sweeps the WETH remainder — use this when the wallet holds native ETH. Without wrapWei the wallet's WETH pays via Permit2 (needs a Permit2 approval). recipient defaults to the tx sender. Returns the tx plus unsigned rlp. Pass sender to eth_call-simulate before signing.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fee | Yes | ||
| sender | No | ||
| chainId | Yes | ||
| wrapWei | No | ||
| deadline | No | ||
| simulate | No | ||
| tokenOut | Yes | ||
| recipient | No | ||
| amountInWei | Yes | ||
| amountOutMin | Yes |