> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dzap.io/llms.txt
> Use this file to discover all available pages before exploring further.

# DZapClient

> The SDK entry point and its lifecycle.

`DZapClient` is a singleton — one instance per app. All SDK calls flow through it.

## Get an instance

```ts theme={null}
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](/sdk/trade), [Zap](/sdk/zap), [Approvals](/sdk/approvals), [Intents](/sdk/intents), [Tokens & Balances](/sdk/tokens-and-balances), [Utilities](/sdk/utilities).

## Errors

All SDK methods reject with a normalized error:

```ts theme={null}
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](/api/error-codes) for the full catalog.

## Logging

The SDK doesn't log to stdout by default. To attach a logger:

```ts theme={null}
const dzap = DZapClient.getInstance();
// SDK accepts standard console-like loggers via initialize hooks
// For production, wrap calls in your own observability layer
```
