Skip to main content
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.
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.
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).
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.
await dzap.waitForBatchTransactionReceipt({
  chainId: 1,
  batchId: result.batchId,
});

Chain helpers

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.
Last modified on May 4, 2026