Skip to content

isFwssMaxApproved

isFwssMaxApproved(client, options): Promise<boolean>

Defined in: packages/synapse-core/src/pay/is-fwss-max-approved.ts:48

Check whether FWSS is approved with unlimited rate/lockup allowances and a maxLockupPeriod covering the chain’s default lockup period.

A bounded approval returns false, even one large enough for the next upload. With a bounded approval, getUploadCosts reports needsFwssMaxApproval: true and ready: false, and fund sends a transaction that includes an unlimited approval. Request an unlimited approval (e.g. setOperatorApproval with its default allowances) to pass it.

rateAllowance is checked for exact maxUint256 since the contract never decrements it — it only tracks usage separately via rateUsage.

lockupAllowance uses a >= maxUint256 / 2 threshold instead of exact equality because the contract permanently decrements lockupAllowance on one-time payments (e.g. when settleFilBeamPaymentRails processes CDN egress charges). After initially approving with maxUint256, each CDN settlement reduces lockupAllowance by the one-time payment amount, causing an exact === check to fail and unnecessarily prompt the user for a new approval transaction. Half of maxUint256 is still astronomically large — no realistic usage would ever cross this threshold.

Parameter Type Description
client Client<Transport, Chain> The client to use to check FWSS max approval.
options OptionsType isFwssMaxApproved.OptionsType

Promise<boolean>

true if FWSS is fully approved with sufficient allowances