Skip to main content

What is a preTransaction?

preTransactions are transactions, often token approvals, that must be submitted in order before the main route or bundle transaction.

J
Written by Javier Diaz

preTransactions are transactions that must be submitted in order before the main route or bundle transaction. They are often token approvals.

Definition

A routing response can include setup transactions the user has to confirm first, so the main shortcut has the permissions or account state it needs.

How it works

  • Inspect preTransactions in the order returned and submit each one before the main tx.

  • Many entries are approvals. EnsoWallet V2 responses, for example, can list a missing approval as type: "requiredApproval".

  • Approve the spender or target returned in the response. Do not hardcode an approval target.

  • After the required setup transactions confirm, submit the route or bundle transaction unchanged.

How Enso does this

Bundle API guidance for new integrations is to inspect preTransactions and treat a legacy approvals list as deprecated there. For a typical EOA router flow, GET https://api.enso.build/api/v1/wallet/approve can also return an approval transaction when allowance is insufficient. See Routing Strategies and Core Concepts.

FAQ

Do I always have to send a preTransaction?

No. Submit one only when the response includes it — usually because allowance is insufficient or another setup step is required.

Is a preTransaction the same as a Quoter preSimulationTransaction?

No. preTransactions are real on-chain setup transactions to send first. preSimulationTransactions are optional setup calls used only inside a Quoter simulation.

Related articles

  • How do I handle token approvals in a routing flow?

  • How do I skip approval when allowance is already enough?

  • What is an ERC-20 approval in a routing flow?

  • What are preSimulationTransactions?

  • What is a routing strategy?

Sources

Did this answer your question?