Constructors
Constructor
Parameters
options?
SpendTrackerOptions = {}
Optional configuration for the tracker.
Returns
SpendTracker
Methods
record()
Parameters
input
RecordSpendInput
The spend record to add.
Returns
Promise<SpendLedgerEntry>
The recorded ledger entry.
total()
since.
Parameters
query
TotalSpendQuery
Query parameters specifying asset and optional time window.
Returns
Promise<bigint>
The total atomic amount spent.
prune()
now - windowMs.
Parameters
now
number
Current timestamp in milliseconds.
windowMs?
number
Optional rolling window size in milliseconds.
Returns
Promise<void>
removeEntry()
Parameters
entry
SpendLedgerEntry
The ledger entry to remove.
Returns
Promise<void>
entries()
Returns
Promise<readonly SpendLedgerEntry[]>
All current entries.