Uniswap V4 Swap Quote
Get a live Uniswap V4 swap quote and its fill-vs-spot price impact for a token pair and size, without executing or moving funds. Use it to check whether a buy/swap is feasible before building it.
Catalog action EVM Onchain
Get a live Uniswap V4 swap quote and its fill-vs-spot price impact for a token pair and size, without executing or moving funds. Use it to check whether a buy/swap is feasible before building it.
At a Glance
| Field | Value |
|---|---|
| Action ID | v4-swap-quote |
| Category | EVM Onchain |
| Connector | Not required |
| Requires gas | No |
| Funds movement | None declared |
| Tags | blockchain, evm, dex, swap, defi, quote, read |
Payload Schema
| Field | Type | Required | Description |
|---|---|---|---|
tokenIn | string | Yes | Input token address to sell. Use 0x0000000000000000000000000000000000000000 for native ETH. |
tokenOut | string | Yes | Output token address to receive. Use 0x0000000000000000000000000000000000000000 for native ETH. |
amountIn | string | Yes | Exact input amount to price, in the token's smallest unit (wei). |
chainId | number | Yes | Chain to quote on. V4 swaps are single-chain only. |
maxHops | number | No | Maximum number of pool hops the auto-router may use. Default: 2. Capped at 2 for v1. |
Result Schema
| Field | Type | Required | Description |
|---|---|---|---|
amountOut | string | Yes | Quoted output amount for the exact input, in the output token's smallest unit (wei). NOT slippage-adjusted. |
priceImpactBps | number | Yes | Fill-vs-spot price impact of the best route, in basis points (1000 = 10%). 0 when the quote meets or beats the pool's spot price. |
route | array | Yes | The best route: 1 entry for a direct swap, 2 entries for a hub-token hop. |
Examples
json{ "type": "v4-swap-quote", "payload": { "tokenIn": "0x0000000000000000000000000000000000000000", "tokenOut": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "amountIn": "300000000000000", "chainId": 8453 }, "children": []}
bashcurl -X POST "https://api.b3os.org/v1/actions/v4-swap-quote/test" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "inputs": { "tokenIn": "0x0000000000000000000000000000000000000000", "tokenOut": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "amountIn": "300000000000000", "chainId": 8453 }}'
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.
