DappSpendPolicy

data class DappSpendPolicy(val maxPerTransaction: BigDecimal? = null, val dailyCap: BigDecimal? = null, val allowedInstruments: Set<String>? = null, val allowedReceivers: Set<String>? = null, val minRequestInterval: Duration = Duration.ZERO, val autoApproveBelow: BigDecimal? = null)

Per-peer limits a wallet enforces on a dApp's transactions, checked before anything reaches the approver.

Every field is off by default, so a session with no policy behaves exactly as before: each transaction asks the human. The caps are hard: a request outside them is refused without asking the approver, which is what makes a policy a pre-commitment ("this dApp can never move more than X") and what stops an agent from farming approvals until reflex taps one through. The wallet's owner can always widen the policy in the app.

Amount limits are per instrument: dailyCap = 25 means at most 25 of each allowed instrument in any rolling 24h window, tracked from the SpendLedger's receipts. Only transactions the wallet can parse as a single token-standard transfer (DappCommandSummary.transferOf) count against the caps or qualify for auto-approval; anything unrecognised is never refused by amount and never auto-approved. It goes to the human, flagged, and the human is the gate.

autoApproveBelow is the one field that skips the approver: a parsed transfer at or under it (and inside every other limit) is approved without asking, and the receipt records that it was. Off by default; a wallet UI should treat enabling it as an explicit, per-peer opt-in.

Constructors

Link copied to clipboard
constructor(maxPerTransaction: BigDecimal? = null, dailyCap: BigDecimal? = null, allowedInstruments: Set<String>? = null, allowedReceivers: Set<String>? = null, minRequestInterval: Duration = Duration.ZERO, autoApproveBelow: BigDecimal? = null)

Properties

Link copied to clipboard

Instruments this peer may move. Null = any.

Link copied to clipboard

Receiving parties this peer may pay. Null = any.

Link copied to clipboard

Auto-approve parsed transfers at or below this amount, without asking the approver. Null = off: every transaction goes to the approver. Always bounded by the caps above.

Link copied to clipboard

Largest total per instrument in any rolling 24h window. Null = no cap.

Link copied to clipboard

Largest single transfer, per request. Null = no cap.

Link copied to clipboard

Minimum gap between transaction requests. ZERO = no rate limit.

Functions

Link copied to clipboard
fun decide(summary: DappTransferSummary?, spentLast24h: BigDecimal): SpendDecision

What the policy says about one submission.