Skip to content

OutputType

OutputType = object

Defined in: packages/synapse-core/src/pay/resolve-account-state.ts:7

availableFunds: bigint

Defined in: packages/synapse-core/src/pay/resolve-account-state.ts:14

Funds available for withdrawal or new rail commitments at currentEpoch. Equal to funds - lockupCurrent once lockup is simulated forward to currentEpoch. The “unreserved” portion of funds described on runwayInEpochs.


grossCoverageInEpochs: bigint

Defined in: packages/synapse-core/src/pay/resolve-account-state.ts:58

Total spend the account’s funds would cover at lockupRate, calculated as funds / lockupRate. Treat as “how much coverage has the user prepaid in total?”.

Always >= runwayInEpochs, typically by roughly the size of the reserve held in lockupCurrent. runwayInEpochs accounts for the reserve as a floor that halts settlement; grossCoverageInEpochs treats funds as a single bucket without modeling whether the reserve is actually flowing as ongoing payment.

Useful as a complement to runwayInEpochs in user-facing displays, e.g. “your deposit covers ~X days of storage in total; you have ~Y days of runway before your account enters deficit”.

  • maxUint256 when lockupRate is 0n (nothing is being spent; takes precedence over funds === 0n).
  • 0n when funds is 0n and lockupRate is positive.

runwayInEpochs: bigint

Defined in: packages/synapse-core/src/pay/resolve-account-state.ts:38

Epochs from currentEpoch until this account enters deficit and the standard payment flow to providers halts. Treat as “when must the user act?”.

The account holds a reserve in lockupCurrent that each rail has set aside under its terms. The funds are locked at the contract level: the user can’t withdraw them while the rail is active. Active payments draw from the unreserved portion of funds (funds - lockupCurrent). Once the unreserved portion is exhausted, the account is in deficit: standard settlement of active rails halts even though funds is still positive. A provider can then terminate the rail to claim against the reserve for a final payment window of up to one lockupPeriod. Termination is one-way: once a rail has an endEpoch it’s heading to finalization and topping up the account won’t revive it. Top up before deficit to keep existing rails open.

  • maxUint256 when lockupRate is 0n (nothing is being spent).
  • 0n when the account is already past this point (in deficit).

To get the absolute epoch form, add currentEpoch (skip when this is maxUint256).