Token Allowances
Which approvals and permits a quote needs, and how the SDK sizes them.
Before an ERC-20 source can fund an intent, the spender named in the quote needs permission to move it. Native-token sources need no allowance; the wallet sends them directly.
The quote lists what is needed in
After the user approves the quote, the SDK handles each missing allowance:
If an approval fails, the error carries
Contract calls on the destination chain use a separate approval. Set
quote.allowances. Each entry has the chainId, tokenAddress, spender, currentRaw, requiredRaw, and deficitRaw. The SDK only acts on entries with a positive deficitRaw.
How the SDK grants allowances
- Permit tokens. The wallet signs an EIP-712 message (
source_approval_signaturestep). No transaction and no gas. - Other tokens. The wallet sends an ERC-20
approvefor exactlyrequiredRaw(erc20_approvalstep). The SDK never grants unlimited approvals.
quote.plan.steps, so show them in your review UI.
Warning
An
approve transaction needs native gas on the source chain. Without it, the quote fails with BACKEND_INSUFFICIENT_APPROVAL_GAS, even for a rate preview. Fund the source chain or choose another source.Failed approvals
error.details.approvals with each broadcast approval's state: confirmed, reverted, or unconfirmed. An unconfirmed approval may still confirm, so request a fresh quote before trying again.
Destination approvals
execute.tokenApproval in swapAndExecute(), or tokenApproval in execute(), and the SDK approves the contract when the current allowance is too low. See swap and execute.
How is this guide?