Skip to main content

Order sizing

peer.sell() has no fixed-fill mode. The sizing below applies to every payout platform.

Default range​

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

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

A sale must be at least 0.01 USDC (capabilities().amount.min, exported as MIN_SELL_AMOUNT), or it throws AMOUNT_BELOW_MINIMUM. Below 1 USDC (capabilities().amount.recommendedMin, exported as RECOMMENDED_MIN_SELL_AMOUNT), 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 peer.sell() or peer.sell.prepare(). With this range, each buyer takes exactly 300 USDC, so the order fills in three payments:

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

await peer.sell(
{
amount: usdc(900),
intentAmountRange: { min: usdc(300), max: usdc(300) },
receive: {
platform: "chime",
currency: "USD",
payee: "$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.