ocp.CouponMinter.canMintCouponsNow (also importable as canMintCouponsNow from @open-captable-protocol/canton) evaluates the rate-limit inequality using maxTps and lastMint on your payload.
Example
const result = ocp.CouponMinter.canMintCouponsNow(COUPON_MINTER_PAYLOAD);
if (result.canMint) {
// submit MintCoupons
} else {
await sleep(result.waitMs);
}
Parameters
payload(required) —CouponMinterPayload.now(optional) —Datefor deterministic tests; defaults tonew Date().
Returns
{ canMint: true }when allowed.{ canMint: false, waitMs: number }when the next mint must wait (waitMsis whole milliseconds, ceiling of remaining microseconds).
Errors
OcpValidationError—payload.maxTpswhen not a positive number string (INVALID_FORMAT).OcpValidationError—payload.lastMint.timewhen the timestamp is not parseable ISO (INVALID_FORMAT).