Skip a returned token approval only when the existing allowance already covers this spend, for this token and this spender. If the response still lists a required approval in preTransactions, submit it.
Definition
An ERC-20 approval is needed when the router or other spender is allowed to move less than this input. If allowance is already sufficient, you should not send a redundant approval.
How it works
After you receive a quote, compare the user’s current allowance for the returned spender with
amountIn.If allowance is already enough, you can skip that approval transaction.
If
preTransactionsincludes arequiredApproval(or the approve endpoint returned a transaction because allowance was insufficient), submit those transactions in order first.Never skip a required setup transaction just to save a signature if allowance is actually too low — the main
txwill fail.
How Enso does this
How do I handle token approvals in a routing flow? and Core Concepts say to request approval when the user spends an ERC-20 through the router and allowance is insufficient. Use GET https://api.enso.build/api/v1/wallet/approve only in that case, and always approve the spender returned in the current response. The same spender can differ by strategy or chain, so do not reuse an old approval assumption blindly.
FAQ
Why am I asked to approve again?
Allowance may be below this input, the spender may differ by strategy or chain, or a previous approval was for a different token. Follow the response’s approval instructions.
Can I set an infinite approval?
The API returns the approval transaction it needs. Whether your product asks the user for a limited or a larger allowance is a UX choice; still use the returned spender.
Related articles
What is a preTransaction?
Why is approval required again?
What if token allowance is too low?
How do I handle token approvals in a routing flow?
What is an ERC-20 approval in a routing flow?
