@pwngh/economy-lab
    Preparing search index...

    Interface AccrualStore

    The parked-share ledger behind the accrual split. put joins the operation's transaction; the claim methods take row locks with commit-release semantics, so a row is claimed by exactly one of a refund and a drain and whichever commits first flips the status the other respects.

    interface AccrualStore {
        claimByOrder(
            orderId: string,
            options?: CallOptions,
        ): Promise<AccrualRow[]>;
        claimPendingBySeller(
            sellerId: string,
            limit: number,
            options?: CallOptions,
        ): Promise<AccrualRow[]>;
        markDrained(
            keys: readonly AccrualRowKey[],
            settledTxnId: string,
            options?: CallOptions,
        ): Promise<void>;
        markRefunded(
            keys: readonly AccrualRowKey[],
            settledTxnId: string,
            options?: CallOptions,
        ): Promise<void>;
        netPending(sellerId: string, options?: CallOptions): Promise<bigint>;
        pendingSellers(limit: number, options?: CallOptions): Promise<string[]>;
        put(rows: readonly AccrualRow[], options?: CallOptions): Promise<void>;
        stats(
            options?: CallOptions,
        ): Promise<{ oldestPendingAgeMs: number | null; pendingMinor: bigint }>;
    }
    Index
    • Locks and returns up to limit of one seller's pending rows — positive shares first, then recovery rows, each oldest first. Positives lead so a deep recovery backlog can never crowd every share out of the claim window and stall the seller's drain.

      Parameters

      • sellerId: string
      • limit: number
      • Optionaloptions: CallOptions

      Returns Promise<AccrualRow[]>

    • Flips pending rows terminal, recording the settling posting as settledTxnId.

      Parameters

      Returns Promise<void>

    • Flips pending rows terminal, recording the settling posting as settledTxnId.

      Parameters

      Returns Promise<void>

    • The seller's pending rows summed, negatives included. Negative means refund debt the drain has not yet recovered; payout admission subtracts it from payable earned credit.

      Parameters

      Returns Promise<bigint>

    • Distinct sellers with pending rows, up to limit — the drain's work list.

      Parameters

      Returns Promise<string[]>

    • Joins the operation's transaction. A duplicate (orderId, sellerId, seq) is a fault, never an overwrite — recovery rows take fresh seqs instead.

      Parameters

      Returns Promise<void>

    • The pending backlog: the positive pending rows' total (equal to the ACCRUAL shards' summed balance at any quiescent point — the prover check) and the oldest pending row's age.

      Parameters

      Returns Promise<{ oldestPendingAgeMs: number | null; pendingMinor: bigint }>