import type { CommitMintResult, CommitTransferResult, ForgeLedger, PendingDelivery, StoredTx, TxRecord } from "@tat-protocol/storage"; import type { ForgeState } from "./ForgeState.js"; /** The commit/outbox half of {@link ForgeLedger}, which the blob fallback implements. */ export type TxLedger = Omit; export interface BlobTx { record: TxRecord; deliveries: { delivered: boolean; attempts: number; nextAttemptAt: number; }[]; } /** * Ledger over the forge's own state blob, for a forge configured without a * {@link ForgeLedger}. * * A commit applies the spent marks (or the supply increment) and the tx record * to in-memory state with no `await` between them, then writes the blob once. * Every snapshot of state therefore holds both or neither — including one a * concurrent save happens to take — and the single `setItem` is atomic on disk * with NodeStore's write-then-rename. If the write fails the in-memory change * is rolled back and the commit rejects, so the caller sends nothing. * * The rest of the forge's own blob writes are not serialized with this, which * is why the invariant above is per-snapshot rather than per-commit. It is * O(state) per commit, which is the reason production wants a real ledger. */ export declare class BlobLedger implements TxLedger { private readonly host; private lock; constructor(host: { state(): ForgeState; save(): Promise; }); private get txs(); private exclusive; private view; private entry; commitTransfer(_keysetId: string, record: TxRecord): Promise; commitMint(_keysetId: string, record: TxRecord, amount: number): Promise; getTx(_keysetId: string, txId: string): Promise; pendingDeliveries(_keysetId: string, opts: { now: number; createdAfter: number; limit?: number; }): Promise; markDelivered(_keysetId: string, txId: string, index: number): Promise; recordFailedAttempt(_keysetId: string, txId: string, index: number, nextAttemptAt: number): Promise; pruneTx(_keysetId: string, createdBefore: number): Promise; }