Skip to content
clusters: prooflayer · edgemarket · edgefinance · synthforge · mediakit · wordmint · webprobe · locale · comppoint
$ man tx-simulate-swap

/tx-simulate-swap(1)

agentutility / edge-market / tx-simulate-swap
PRICE / CALL
$0.02
USDC · base mainnet · scheme: exact
METHOD
POST
CLUSTER
edgemarket
CATEGORY
uncategorized
STATUS
live
NAME
tx-simulate-swap tx simulate swap / pre-trade quote / dex swap simulator / 1inch + llamaswap quote / would-it-succeed check
SYNOPSIS
POST https://x402.org/v1/tx-simulate-swap
     Content-Type: application/json
     X-PAYMENT:    <signed-transferWithAuthorization>

     { ... }
↳ first call → 402 Payment Required. Sign USDCtransferWithAuthorization, retry with theX-PAYMENT header.
DESCRIPTION

Tx simulate swap / pre-trade quote / DEX swap simulator / 1inch + LlamaSwap quote / would-it-succeed check. Given (from_token, to_token, amount_in, chain), pulls a routed quote from a free DEX meta-aggregator and returns expected output, min-out at user-supplied slippage (default 1%), gas estimate, router address, and a would_succeed verdict. Quote-only depth — full Tenderly-style state simulation requires a paid API and is documented in the response's simulation_caveat.

INPUTrequest schema
propertytypedescriptionreq?
from_tokenstring0x-prefixed 20-byte ERC-20 input token.required
to_tokenstring0x-prefixed 20-byte ERC-20 output token.required
amount_instringInput amount as a decimal string in smallest units (wei-equivalent).required
chainstringEVM chain. Default 'base'.
enum: base · ethereum · polygon · arbitrum · optimism
optional
slippage_pctnumberSlippage tolerance for min_out, in percent. Range [0, 50]. Default 1.optional
OUTPUTresponse shape
fieldtypedescription
chainstringChain identifier (e.g. ethereum, base, arbitrum) the quote was routed on.
from_tokenstringSource token address or symbol being swapped from.
to_tokenstringDestination token address or symbol being swapped into.
amount_instringInput amount of from_token, echoed back in the same units the caller supplied.
expected_outstringRouted quote's expected output amount of to_token before slippage is applied.
min_outstringMinimum acceptable output amount after applying slippage_pct, used as the swap floor.
slippage_pctstringSlippage tolerance applied to derive min_out, defaulting to 1% when caller omits it.
gas_estimatestringEstimated gas units the routed swap would consume on-chain.
routerstringAddress of the DEX router contract the quote would execute against.
approval_targetstringAddress the user must grant ERC-20 allowance to before the swap can pull from_token.
would_succeedstringBoolean verdict on whether the routed quote looks executable given current liquidity and gas.
simulation_kindstringLabel for the simulation depth used (quote-only vs full state sim).
sourcestringUpstream aggregator that produced the quote, e.g. 1inch or LlamaSwap.
EXAMPLEStwo ways to call
EXAMPLE 1 · curl
curl -X POST https://x402.org/v1/tx-simulate-swap \
  -H 'Content-Type: application/json' \
  -d '{ }'
first response = 402 Payment Required with payment requirements; sign + retry with X-PAYMENT.
EXAMPLE 2 · mcp
# install once
claude mcp add x402 --command "npx x402-deployer-mcp"

# then ask Claude Code:
# "use the tx-simulate-swap tool to ..."
MCP server handles payment automatically — your coding agent just calls the tool by name.
METADATA
tags
edge-marketdex-aggregatorswap-quotepre-trade-simulationslippage-checkgas-estimate1inchswap-simulator
methods
POST
cluster
edgemarket
price
$0.02 USDC per call
ADJACENTother endpoints in edgemarket
endpointdescriptionprice
defi-llama-protocolDefiLlama protocol lookup — TVL, chain breakdown, current TVL, 24h/7d/30d changes, audits, parent protocol, categories.$0.02
gas-now-baseGas oracle / EIP-1559 fee estimator.$0.02
gas-priceGas price API / EIP-1559 fee estimator / Base + Ethereum + Optimism + Arbitrum gas tracker / pre-tx cost estimator.$0.02
token-priceCrypto token price API / CoinGecko wrapper.$0.02
tx-receipt-decodeEVM transaction receipt decoder / log decoder / event log reader / Etherscan tx debug / receipt parser / Basescan tx explainer / tenderly…$0.02
bridge-ratesCross-chain bridge rate aggregator.$0.03
dao-proposal-monitorSnapshot.org DAO proposal monitor.$0.03
ens-resolveENS resolver / Ethereum Name Service lookup.$0.03
SEE ALSO
agentutility(7) · edgemarket(7) · x402(7) · mcp(7) · llms.txt · registry.json · bazaar.x402.org