> ## 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.

# Utilities

> decodeTxnData, points, batch calls.

A handful of helpers that don't fit the trade/zap categories.

## decodeTxnData

Decodes a DZap transaction's input data into a readable structure — useful for indexing or debugging.

```ts theme={null}
const decoded = dzap.decodeTxnData({
  chainId: 42161,
  data: '0x...',
});
// => { method, args: { ... } }
```

## calculatePoints

Estimates DZap loyalty points for a given action — used by partners surfacing rewards in their UI.

```ts theme={null}
const points = await dzap.calculatePoints({
  chainId: 1,
  account: '0xUser',
  amount: '1000000000',                  // wei
  service: 'swap',
});
```

## sendBatchCalls

Bundles multiple write calls into one transaction (where the chain supports it — EIP-5792 / multicall fallback).

```ts theme={null}
const result = await dzap.sendBatchCalls({
  chainId: 1,
  signer: walletClient,
  calls: [
    { to: '0xToken', data: encodeApprove(...) },
    { to: '0xToken', data: encodeApprove(...) },
  ],
});
```

## waitForBatchTransactionReceipt

Companion to `sendBatchCalls`. Waits until all sub-calls have confirmed.

```ts theme={null}
await dzap.waitForBatchTransactionReceipt({
  chainId: 1,
  batchId: result.batchId,
});
```

## Chain helpers

```ts theme={null}
const chains = await dzap.getAllSupportedChains();           // map of chainId → config
const config = await dzap.getChainConfig(8453);              // single chain
const router = dzap.getDZapContractAddress(8453);            // string
```

Use these instead of hard-coding addresses or chain IDs — both shift over time.
