Skip to content

Reference

CouponMinter — rate limit utilities

Client-side TPS checks and wait helpers attached to OcpClient.CouponMinter. Pure functions use CouponMinterPayload from your contract read model; wait/mint helpers throw WaitAbortedError or WaitTimeoutError, not OcpError.

ocp.CouponMinter hosts off-ledger helpers that mirror the DAML rate limit policy: minIntervalMicros = (lastMint.count * 1_000_000) / maxTps. When maxTps is null or there was no prior mint, minting is always allowed. These utilities help you avoid submitting MintCoupons transactions that the contract would reject for pacing.

Setup

import { OcpClient } from '@open-captable-protocol/canton';

const ocp = new OcpClient({ ledger: canton.ledger });

Topic pages

Payload shape (CouponMinterPayload)

  • operator — operator party controlling the minter.
  • maxTpsstring | null (decimal string from chain); null disables rate limiting in helpers.
  • lastMintnull or { time: string; count: number } (DAML time ISO string).

See also

  • ErrorsOcpValidationError from pure checks; compare with WaitAbortedError / WaitTimeoutError.

Source