preSimulationTransactions are optional setup transactions that Enso Quoter runs on the forked state before it simulates the main transaction. Use them when the call you care about depends on prior state, such as a token approval.
Definition
The main transaction is what you want to preview. Setup transactions run first, in order, only inside the simulation. They are not signed or submitted as part of the Quoter response, and Quoter still does not modify the main calldata you will send on-chain.
How it works
Include a
preSimulationTransactionsarray of transaction objects alongside the maintransaction.Quoter executes those setup calls on the fork, then executes the main call.
Typical uses are token approvals, or any other on-chain state the main transaction depends on.
You still pass
tokenIn,tokenOut, andamountInso Quoter can track the token flows of the main simulation.Review
result.status,amountOut, andgasfor the main transaction after the setup steps have run.
How Enso does this
On POST https://quoter.api.enso.build/api/v1/simulate, preSimulationTransactions is an optional array of the same transaction shape as transaction (to, data, value, from, and optional fields). See Simulating Transactions and the Quoter FAQ. When you later submit on-chain, you must still send any real approval the main transaction requires; the simulated setup does not replace it.
FAQ
Does a simulated approval spend funds or change live allowances?
No. Setup transactions run only on the forked state used for simulation.
Do I send preSimulationTransactions to the validate endpoint?
Validate checks the unsigned main transaction against the simulationId. It does not replay setup transactions.
Related articles
How do I simulate a transaction that needs a token approval first?
How do I simulate a DeFi transaction before sending it?
What is an ERC-20 approval in a routing flow?
What is a forked EVM simulation?
How do I simulate or validate a transaction I built myself?
