Swap Integration Guide
This guide covers integrating the Zet Swap API for same-chain and cross-chain token swaps.Overview
Step 1: Get available tokens
Fetch the list of supported tokens, optionally filtered by chain:Step 2: Get a swap quote
Same-chain swap
Swap USDC to ETH on Base:Cross-chain swap
Swap USDC on Base to BNB on BSC:Quote response
Fee structure
| Swap Type | Platform Fee | Bridge Fee |
|---|---|---|
| Same-chain | 20 NGN (in source token) | None |
| Cross-chain | 50 NGN (in source token) | Variable (from bridge) |
Step 3: Execute the swap
Custodial (Zet-managed wallet)
Non-custodial (user-managed wallet)
For non-custodial wallets, Zet returns the raw transaction data for the user to sign:Execute response
Step 4: Monitor completion
Webhooks (recommended)
Timing expectations
| Swap Type | Estimated Time |
|---|---|
| Same-chain (e.g., USDC → ETH on Base) | 15-45 seconds |
| Cross-chain (e.g., USDC Base → BNB BSC) | 1-5 minutes |
Slippage
The default slippage tolerance is 0.3%. You can customize it per quote:- Low slippage (0.1-0.3%): Tighter price protection, may fail in volatile markets
- Medium slippage (0.5-1.0%): Good balance of protection and reliability
- High slippage (1-3%): Almost always succeeds, but may get a worse price
Routing
Zet uses LiFi to find the optimal swap route:- Same-chain: Routes through the best DEX (Uniswap, SushiSwap, Aerodrome, PancakeSwap, etc.)
- Cross-chain: Finds the best bridge + DEX combination (Stargate, Across, Hop, etc.)
route.providers field in the quote tells you which protocols will be used.
Best practices
- Show the route details — display estimated time and providers to set user expectations
- Default to 0.3% slippage — increase only if swaps are frequently failing
- Use same-chain swaps when possible — they’re faster, cheaper, and more reliable
- Handle partial fills — in rare cases, the received amount may differ slightly from the quote
- Retry on
NO_ROUTE_FOUND— liquidity changes; a route may become available with a different amount
