Uniswap Swap Quote
Get a live Uniswap swap quote across V2/V3/V4 pools for a token pair and size, without executing or moving funds. Routes through the same hosted Uniswap Trading API as `uniswap-swap`, so a plan-time quote and the runtime swap can never disagree on whether a route exists. Use it to check whether a buy/swap is feasible before building it.
Catalog action EVM Onchain
Get a live Uniswap swap quote across V2/V3/V4 pools for a token pair and size, without executing or moving funds. Routes through the same hosted Uniswap Trading API as uniswap-swap, so a plan-time quote and the runtime swap can never disagree on whether a route exists. Use it to check whether a buy/swap is feasible before building it.
At a Glance
| Field | Value |
|---|---|
| Action ID | uniswap-swap-quote |
| Category | EVM Onchain |
| Connector | Not required |
| Requires gas | No |
| Funds movement | None declared |
| Tags | blockchain, evm, dex, swap, defi, quote, read, uniswap |
Payload Schema
| Field | Type | Required | Description |
|---|---|---|---|
tokenIn | string | Yes | Input token address to price. Use 0x0000000000000000000000000000000000000000 for native ETH. |
tokenOut | string | Yes | Output token address to price. 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. Uniswap Trading API routing is single-chain only. |
Result Schema
| Field | Type | Required | Description |
|---|---|---|---|
amountOut | string | Yes | Quoted output amount for the exact input, in the output token's smallest unit (wei). "0" when noRoute is true. |
route | array | Yes | Route steps the Trading API's best quote used — passed through as-is from the API response, since its shape varies by routing engine and pool version (v2/v3/v4). Empty when noRoute is true. |
routing | string | Yes | Routing engine the Trading API used for the best quote (e.g. "CLASSIC"). "NONE" when noRoute is true. |
noRoute | boolean | Yes | True when the Trading API found no route for this pair/size on any pool version. Read this instead of treating a caught error as the block signal — matches how the caddie feasibility gate consumes this action. |
tokenOutSymbol | string | null | No | Display symbol of tokenOut — lets a consumer render the quoted amount without a second lookup. Null when the metadata lookup fails, or when noRoute is true. |
tokenOutDecimals | number | null | No | Decimals of tokenOut, pairs with tokenOutSymbol. Null when the metadata lookup fails, or when noRoute is true. |
priceImpactBps | number | null | No | Fill-vs-spot price impact in basis points (positive = worse/loss), from the Trading API's percent priceImpact × 100. Null when noRoute is true, or when the quote omitted a numeric price impact. The caddie swap-feasibility gate reads this to classify the swap. |
Examples
json{ "type": "uniswap-swap-quote", "payload": { "tokenIn": "0x0000000000000000000000000000000000000000", "tokenOut": "0x6330D8C3178a418788dF01a47479c0ce7CCF450b", "amountIn": "300000000000000", "chainId": 4663 }, "children": []}
bashcurl -X POST "https://api.b3os.org/v1/actions/uniswap-swap-quote/test" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "inputs": { "tokenIn": "0x0000000000000000000000000000000000000000", "tokenOut": "0x6330D8C3178a418788dF01a47479c0ce7CCF450b", "amountIn": "300000000000000", "chainId": 4663 }}'
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.
