Skip to main content
Spending policies enforce per-token limits on ERC-20 operations executed by session keys. The CHIPI wallet contract enforces these automatically during transaction execution.
Requires CHIPI v33 wallets. See the Spending Policies guide for concepts and use cases.

SHHH wallets supported (14.10.0): setSpendingPolicy / removeSpendingPolicy now accept walletType: "SHHH" (V8.4) in addition to CHIPI — both embed the same SNIP-163 session-key + spending-policy component. undefined still defaults to CHIPI; READY remains unsupported (no sessions component). Proven on mainnet: in-cap approve succeeds, over-cap reverts with 'Spending: exceeds per-call'.

sessions.setSpendingPolicy()

Set a spending policy for a session key + token pair. Requires owner signature.

Usage

Parameters

Return Value

Promise<string> — Transaction hash of the on-chain set_spending_policy call.

sessions.getSpendingPolicy()

Query a spending policy from the contract. Read-only, no signature or gas required.

Usage

Parameters

Return Value

SpendingPolicyData: Returns all zeros if no policy is set (meaning no enforcement).

sessions.removeSpendingPolicy()

Remove a spending policy. After removal, the session has no limits for this token. Requires owner signature.

Usage

Parameters

Return Value

Promise<string> — Transaction hash of the on-chain remove_spending_policy call.