DomainTreasury
The domain-scoped on-chain payment authority. Owns:
one ChainAccount per supported chain
a SpendPolicy enforced at reserve-time
an append-only TreasuryLedger for audit / billing reconciliation
Lifecycle of a single operation:
account(chainId).estimateFee(op)→ estreserve(ctx, est)→ Reservation (funds locked)plugin submits the tx → AnchorResult(fee, payerAddress)
settle(reservation, result)→ reservation closed — orcancel(reservation)on failure
Implementations must serialise reservations per ChainAccount (nonce management is the plugin's responsibility but the reservation queue prevents two writes from oversubscribing a tight balance).
Inheritors
Functions
Release the reservation in full. Used on submission errors before any fee is incurred, and by the TTL sweeper for expired reservations.
Read view over the audit ledger.
Lock estimate × safety margin against the ChainAccount for ctx.chainId. Throws org.trustweave.anchor.exceptions.TreasuryException subclasses on policy violation or insufficient funds — never on a recoverable mempool condition (that's the plugin's concern).