Docs/API/CurbStore

CurbStore

interfaceStorage

The state interface to implement for production (Redis / Postgres) so spend + approvals are shared and durable.

signature
interface CurbStore { … }

Implement these eight methods against your datastore. Spend is committed + holds; approvals are single-use.

Methods

isAllowed(agent, account): Promise<boolean>

Counterparty allowlist check.

getDailySpend(agent): Promise<number>

Committed spend in the rolling window.

incrDailySpend(agent, amount): Promise<void>

Add committed spend.

tryReserveSpend(agent, key, amount, cap): Promise<boolean>

Atomic hold (idempotent per key).

commitSpend(agent, key, amount): Promise<void>

Hold → committed.

getApproval(requestId): Promise<ApprovalStatus | null>

Read approval status.

setApproval(requestId, status, meta?): Promise<void>

Write approval status.

consumeApproval(requestId): Promise<void>

Consume (single-use).

VERIFIABLE SPEND-CONTROL   ·   ENFORCED ON-CHAIN   ·   AGENTS CAN PAY — NOW THEY CAN’T OVERSPEND   ·   CURB × HEDERA   ·   VERIFIABLE SPEND-CONTROL   ·   ENFORCED ON-CHAIN   ·   AGENTS CAN PAY — NOW THEY CAN’T OVERSPEND   ·   CURB × HEDERA   ·