Skip to main content

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

The platform fee is converted from NGN to the source token at market rate and deducted from the swap.

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

Timing expectations

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 an optimized routing engine to find the best swap route:
  • Same-chain: Routes through the best available DEX
  • Cross-chain: Finds the best bridge + DEX combination
The route.providers field in the quote tells you which protocols will be used.

Best practices

  1. Show the route details — display estimated time and providers to set user expectations
  2. Default to 0.3% slippage — increase only if swaps are frequently failing
  3. Use same-chain swaps when possible — they’re faster, cheaper, and more reliable
  4. Handle partial fills — in rare cases, the received amount may differ slightly from the quote
  5. Retry on NO_ROUTE_FOUND — liquidity changes; a route may become available with a different amount