Before any swap/bridge/zap that spends ERC20s, the DZap router must be approved. The SDK supports four modes — pickDocumentation Index
Fetch the complete documentation index at: https://docs.dzap.io/llms.txt
Use this file to discover all available pages before exploring further.
AutoPermit unless you have a reason not to.
The four modes
| Mode | How | Gas | Spender |
|---|---|---|---|
Default | Standard ERC20 approve() | Yes (one-time) | DZap router |
Permit2 | One-time approve to Permit2; sign per-trade | Initial yes, then signature only | Permit2 contract |
EIP2612Permit | Sign permit message; no approval tx | None (signature only) | DZap router |
AutoPermit | EIP2612 if supported, fallback to Permit2 | Best-of-both | Auto |
AutoPermit covers the long tail.
Check allowance
type tells you whether the token will use a direct DZap approval, a Permit2 approval, or an EIP-2612 permit.
Approve
Sign (gasless permits)
For EIP-2612 / Permit2 paths:Recommended flow
Common pitfalls
- Multi-token swaps —
getAllowanceandapproveboth accept arrays. Don’t loop one-by-one; you’ll trigger N wallet popups. - Service must match —
service: 'swap'checks the swap router;service: 'zap'checks the zap router. They differ on some chains. - Permit deadlines — gasless permits include a deadline (default ~1 hour). Sign close to execution.