Skip to main content

Order sizing

Peer Cash has no fixed-fill mode, so there is nothing to migrate. No published @zkp2p/cash release has fillMode or minChunkSize, and the sizing below applies to every payout platform.

Default range​

Each buyer intent takes part of an order. Unless you pass intentAmountRange, cashout() and prepare() let each buyer take:

BoundDefault
Minimum1 USDC, or the whole order when it is smaller
MaximumThe whole order

A cash-out must be at least 0.01 USDC (capabilities().amount.min), or it throws AMOUNT_BELOW_MINIMUM. Below 1 USDC (capabilities().amount.recommendedMin), the minimum is the whole order, so a single buyer must take all of it.

Every buyer intent must fall within the range, so a remaining balance below the minimum can't be filled.

Set a custom range​

Pass intentAmountRange in USDC base units to cashout() or prepare(). With this range, each buyer takes exactly 300 USDC, so the order fills in three payments:

import { usdc } from "@zkp2p/cash";

await cash.cashout(
{
amount: usdc(900),
intentAmountRange: { min: usdc(300), max: usdc(300) },
receive: {
platform: "chime",
currency: "USD",
payee: { offchainId: "$your-chime-sign" },
},
},
{ signer },
);
  • min must be greater than zero, and max must be between min and amount. Otherwise the call throws INVALID_INTENT_AMOUNT_RANGE before sending any transaction.
  • The range applies to every payout leg in the order.
  • estimate() takes no range; it prices the full amount.