Skip to content

resolveAccountState

resolveAccountState(params): OutputType

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

Project account state forward to currentEpoch by simulating settlement locally.

Pure function — no RPC call. Takes raw account fields from accounts() + currentEpoch and computes:

  • fundedUntilEpoch — the absolute epoch at which lockupCurrent + lockupRate × elapsed === funds. Past this point, settlement stops advancing and the payer must deposit more funds (or have rails terminated) to keep services running.
  • availableFunds — funds minus all lockup (fixed + rate) at currentEpoch.
  • runwayInEpochsfundedUntilEpoch - currentEpoch, clamped to 0n when insolvent and maxUint256 when lockupRate is 0n.

Note: funds already includes fixed lockup from rails (it’s reflected in lockupCurrent), so runway accounts for both fixed lockup and rate-based lockup automatically.

ParameterTypeDescription
paramsAccountStateRaw account fields + current epoch

OutputType

The projected account state resolveAccountState.OutputType