Quote and swap

Simulate a built transaction before signing

eth_calls the built calldata from the user's address and estimates gas, so a revert is caught before the wallet opens. Known selectors are decoded (NotRouter, a paused Kuru market, allowance and balance errors). An allowance revert is advisory: approve first, then swap.

post/swap/simulate

Request

  • Base URL: https://api.getchord.xyz/v1
  • URL: https://api.getchord.xyz/v1/swap/simulate
  • Auth: none declared

Request body

chain5042 | 4663 | 143 | 43114 | 8453 | 56 | 42161 | 1
fromstring required

EVM address, hex, case-insensitive.

tostring required

EVM address, hex, case-insensitive.

datastring required

Calldata from /swap.

valuestring required

Amount in the token's smallest unit, as a decimal string. Never a float.

Response

ok: true with the simulated output and gas, or ok: false with the decoded revert.

okboolean
amountOutstring nullable

Simulated output, smallest unit.

gasinteger nullable

Estimated gas units.

revertstring

Decoded reason (when ok is false).

selectorstring nullable

4-byte error selector.

Changes

No recorded changes to this operation across all 1 revision of this API.