Skip to main content
Move tokens from one chain to another. It works like a swap with toChain set to a different chain: DZap finds a route and builds the transaction on the source chain, and you sign it, send it, and track it until the tokens arrive. Pick EVM, Solana, or Bitcoin in any tab, and the rest of the page switches with it.

Setup

This example bridges 100 USDC from Arbitrum to your own address on Base, signing with walletClient, a viem wallet client built from the private key in PRIVATE_KEY. Amounts are strings in the token’s smallest unit, and no API key is needed.

Steps

1

Quote

getTradeQuotes asks the bridge providers DZap supports for a price; a toChain different from fromChain makes it a bridge. pair.quoteRates lists every route, recommendedSource names DZap’s pick, and each route’s duration is its estimated time in seconds. slippage: 1 accepts up to 1% less than quoted.
2

Approve

The DZap router on Arbitrum needs permission to move your USDC. getAllowance reads the current allowance, and if it’s too low, approve() approves exactly the bridge amount. Nothing needs approving on Base.
Other approval flows (Permit2, EIP-2612, gasless permits) are in Check allowance and Approval mechanisms.
3

Build & send

trade() builds the transaction for the recommended route, simulates it, then signs and sends it on Arbitrum. If the simulation fails, nothing is sent and result says why. recipient receives the USDC on Base, and refundee gets it back on Arbitrum if the bridge refunds.
4

Status

The USDC reaches Base only after the bridge finishes, so poll getTradeTxnStatus with the Arbitrum transaction hash until the status leaves PENDING; COMPLETED means it arrived. DZap answers 404 until it sees the transaction, and 429 once the keyless limit of 5 requests a minute is used up, so the catch skips only those two and rethrows anything else. The loop gives up after 30 minutes, and the check after it throws unless the status is COMPLETED.

End-to-end

API usage

The same flow over REST. Non-EVM chains build a chain-specific transaction you sign locally, then submit via Broadcast.
Approve the DZap router for the USDC first, then sign and send the transaction from the build response with your own wallet. Full reference: Quote, Build Tx, Status.

What can go wrong

  • No route: pair.quoteRates is empty; pair.unavailableRoutes says why each provider declined.
  • The build fails: trade() returns an error and buildTradeTxn throws. The error’s action says what to fix; TRY_ANOTHER_ROUTE means building with another route from pair.quoteRates.
  • expired from broadcastTradeTx on Solana: build and sign again right away.
  • Not completed: no status: DZap never returned a status, usually because the transaction failed on-chain. Check the hash in a block explorer.
  • HTTP 429: without an API key, the trade API allows 5 requests a minute in total, shared by every endpoint, and retryAfter says how many seconds to wait. The status loop skips 429s and polls again.
See Error codes for the full catalog.

When to use Fuse instead

If your goal is “bridge, then do something on the destination”, use a Fuse bundle, one signature for the whole journey.
Last modified on October 1, 2026