Install
The SDK is published as @dzapio/sdk. Latest stable: 2.0.x. Targets Node 18+ and modern browsers (with appropriate polyfills for crypto APIs).
Wallet adapters
The SDK accepts both viem and ethers.js signers.
import { createWalletClient, http } from 'viem';
import { arbitrum } from 'viem/chains';
const walletClient = createWalletClient({
account: '0xYourAddress',
chain: arbitrum,
transport: http(),
});
Pass either as the signer field to dzap.trade(), dzap.zap(), etc.
Never put private keys in client code or commit them. Use a wallet provider (RainbowKit, ConnectKit, etc.) on the frontend; use a secrets manager on the backend.
Custom RPC URLs
The SDK ships with sensible defaults but you’ll want your own RPCs for production.
import { DZapClient } from '@dzapio/sdk';
const dzap = DZapClient.getInstance(undefined, {
1: ['https://eth.llamarpc.com'],
42161: ['https://arbitrum.llamarpc.com'],
8453: ['https://base.llamarpc.com'],
});
The first URL in each array is primary; subsequent URLs are fallbacks for read-quorum.
API key (optional)
const dzap = DZapClient.getInstance('dzap_xxxxxxxxxxxxxx');
API keys raise rate limits and unlock per-route configuration. See Authentication.