When Is Approval Needed?
Decision Logic
Step 1: Identify the Spender
The spender address comes from the quote response:Step 2: Check Current Allowance
Call theallowance function on the token contract:
Function Signature
JavaScript Example
Python Example
Step 3: Compare and Decide
Step 4: Send Approval Transaction
Function Signature
Approval Amount Strategies
JavaScript Example
Python Example
Complete Approval Flow
Common Mistakes
Using wrong spender address
Using wrong spender address
Always use
quote.estimate.approvalAddress, not a hardcoded address. Different routes may use different contracts.Not waiting for approval confirmation
Not waiting for approval confirmation
The main transaction will fail if sent before the approval is confirmed. Always wait for the approval receipt.
Approving on wrong chain
Approving on wrong chain
Ensure your wallet is connected to the source chain (
fromChain) when sending the approval.Insufficient gas for approval
Insufficient gas for approval
Approval transactions typically need 50,000-100,000 gas. Use a reasonable gas limit.
USDT special case
USDT special case
USDT requires setting allowance to 0 before setting a new non-zero value. Check current allowance and reset if needed.
Approval Checklist
Before executing a transfer, verify:-
fromToken.addressis NOT0x0000...0000(native token) - Retrieved
approvalAddressfrom quote response - Checked current
allowance(owner, spender) - Compared allowance to
fromAmount - Sent approval tx if allowance < fromAmount
- Waited for approval confirmation
- Connected to correct chain (
fromChain)
Related Pages
- Execution - How to execute the main transaction
- Five-Call Recipe - Complete workflow overview

