Skip to Content
KryptWarden Developers
Concepts

Holds

How payments above the auto-approve limit wait for the owner.

A hold is a reservation for one specific payment: this agent, this seller, this amount. It's how the contract lets an agent ask for more than its auto-approve limit without trusting it.

Lifecycle

  1. Request. The SDK sees a price above the auto-approve limit. It signs a KW_HOLD1 intent and posts it to the relayer, which calls request_hold. The contract runs the same seller, status and budget checks as a payment, then reserves the amount.
  2. Wait. The hold shows up in the dashboard's Approvals page with a countdown. The SDK polls the hold every 2 seconds by default.
  3. Decide. The owner signs approve_hold or deny_hold. If nobody answers before approval_timeout_secs, the hold expires. Silence means no.
  4. Settle. After approval, the SDK retries the payment with the hold_id in its signature. __check_auth accepts it only if seller and amount match the hold exactly. The hold becomes Consumed and can't be used again.

Rules

RuleValue
Open holds per agentAt most 8 (TooManyActiveHolds, 123)
Approval windowThe agent's approval_timeout_secs: 10 s to 24 h
Time to settle after approvalAt least 300 seconds. Approving near the deadline extends it
MatchSeller and amount must equal the hold, or it fails with HoldMismatch (121)
ReuseOne payment per hold (HoldAlreadyUsed, 119)

Bait-and-switch protection

After approval, the SDK compares the seller's new 402 challenge with the approved hold. If the seller now asks for a different amount, recipient or asset, the SDK refuses to sign and throws BAIT_AND_SWITCH_DETECTED. The contract would refuse anyway, but this fails fast and doesn't waste a transaction.

Expiry is free to enforce

Expired holds are ignored automatically wherever the contract counts reservations. expire_hold is a public call that anyone can make to mark a hold Expired and emit an event. It's only needed for tidy records.

On this page