Skip to main content

How do I simulate a delegate call or smart-account transaction?

Set operationType to 1 on the Quoter transaction to simulate a DelegateCall. The default, 0, is a standard Call. This is useful for smart-account and ERC-4337 flows.

J
Written by Javier Diaz

Set operationType to 1 on the Enso Quoter transaction to simulate a DelegateCall. The default, 0, is a standard Call. The Quoter docs describe this as useful for smart-account and ERC-4337 scenarios.

Definition

A DelegateCall runs the target code in the caller’s context. If the transaction you intend to submit uses that semantics, the simulation must use it too, or the preview will not match how the live call executes.

How it works

  • Build the transaction as usual (to, data, value, from, chainId).

  • Set transaction.operationType to 1 for DelegateCall, or omit it (or use 0) for a standard Call.

  • Pass tokenIn, tokenOut, and amountIn so outputs are tracked.

  • Review result.status, amountOut, and gas, then validate the unsigned transaction before signing.

  • Sign only when valid is true. Quoter does not change the transaction you submit.

How Enso does this

The Quoter FAQ and How It Works document operationType: 1 for DelegateCall, including smart-account operations. Send the field on POST https://quoter.api.enso.build/api/v1/simulate. For Enso-built Route or Bundle transactions that must run in a smart wallet’s context, use the delegate routing strategy on those APIs; Quoter is only for calldata you already have.

FAQ

Is operationType required?

No. It defaults to a standard Call (0). Set 1 only when the live execution is a DelegateCall.

Does validate also take operationType?

The documented validate fields are simulationId plus transaction.data, to, from, value, and chainId. Simulate with the correct operationType, then validate those unsigned fields.

Related articles

  • How do I use Enso with a smart wallet?

  • Router vs delegate routing strategies

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

  • What optional fields can I send in a Quoter transaction?

  • How do I validate that a transaction has not been tampered with?

Sources

Did this answer your question?