DZapClient is a singleton — one instance per app. All SDK calls flow through it.
Get an instance
import { DZapClient } from '@dzapio/sdk';
const dzap = DZapClient.getInstance();
// Or with API key + custom RPCs:
const dzap = DZapClient.getInstance('dzap_...', {
42161: ['https://arbitrum.llamarpc.com'],
});
getInstance() returns the same singleton across calls. The first call wins for apiKey and rpcUrlsByChainId — subsequent calls reuse those.
Public methods
| Group | Methods |
|---|
| Trade | getTradeQuotes, buildTradeTxn, trade, tradeGasless, getTradeTxnStatus |
| Zap (Fuse) | getZapQuote, buildZapTxn, zap, getZapTxnStatus, getZapBundleQuote, buildZapBundleTx |
| Tokens | getAllTokens, getTokenDetails, getTokenPrices, getBalances |
| Approvals | getAllowance, approve, sign |
| Chain | getAllSupportedChains, getDZapContractAddress, getChainConfig |
| Utility | decodeTxnData, calculatePoints, sendBatchCalls, waitForBatchTransactionReceipt |
Each is documented in the dedicated pages: Trade, Zap, Approvals, Intents, Tokens & Balances, Utilities.
Errors
All SDK methods reject with a normalized error:
try {
await dzap.getTradeQuotes({ ... });
} catch (e: any) {
console.log(e.code); // e.g. "NO_ROUTE_FOUND"
console.log(e.message);
console.log(e.details);
}
See Error Codes for the full catalog.
Logging
The SDK doesn’t log to stdout by default. To attach a logger:
const dzap = DZapClient.getInstance();
// SDK accepts standard console-like loggers via initialize hooks
// For production, wrap calls in your own observability layer
Last modified on May 4, 2026