Skip to main content

How do I check if a transaction will revert?

Simulate the transaction with Enso Quoter and read result.status. Error means the call would fail on the fork; inspect result.error and do not send the transaction.

J
Written by Javier Diaz

Simulate the transaction with Enso Quoter and read result.status. "Error" means the call would fail on the fork. Inspect result.error, fix the transaction, and do not send it until a later simulation returns "Success".

Definition

A revert check is a dry-run of the calldata against current state. HTTP 200 from the simulate endpoint only means the request was processed; the on-chain outcome is in result.status.

How it works

  • Send the transaction, chainId, and token-flow fields to the simulate endpoint.

  • If result.status is "Success", the simulated call would succeed against that fork.

  • If it is "Error", read result.error. Documented failure types include CallFailed, CallReverted, DecodeError, and ProviderError.

  • Common causes of a revert include a failed require, insufficient allowance, invalid calldata, or (in CallFailed) insufficient balance or incorrect calldata.

  • After you fix the call, simulate again. Then validate before signing.

How Enso does this

POST https://quoter.api.enso.build/api/v1/simulate. See Error Handling and Simulating Transactions. A ProviderError is usually transient and can be retried. The other types require a change to the transaction or to the assumed setup (for example a simulated approval in preSimulationTransactions).

FAQ

Why did I get HTTP 200 if the transaction would revert?

A 200 means Quoter processed the simulation. Check result.status for success or error. HTTP errors such as 400 or 401 are request or auth failures, not revert previews.

Does a successful simulation guarantee the live transaction will not revert?

No. It would succeed on the fork at that time. State can change before inclusion, so keep slippage protection in the calldata and validate close to signing.

Related articles

  • Why is my Quoter simulation status Error but the HTTP status is 200?

  • What does CallReverted mean in a Quoter simulation?

  • What does CallFailed mean in a Quoter simulation?

  • How do I simulate a DeFi transaction before sending it?

  • Why did the transaction fail on-chain after I got a quote?

Sources

Did this answer your question?