Install
The SDK is published as @dzapio/sdk. Latest stable: 2.0.x. Targets Node 16+ and modern browsers (with appropriate polyfills for crypto APIs). It bundles its own viem (2.x) and ethers (v5.7) — no peer dependencies to install separately.
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(),
});
import { ethers } from 'ethers';
// The SDK bundles ethers v5 — use the v5 provider API
const provider = new ethers.providers.JsonRpcProvider('https://arbitrum.llamarpc.com');
const signer = new ethers.Wallet('0xPrivateKey', provider);
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.