Overview
useChipiSession provides a unified API for managing session keys, enabling gasless transactions without requiring the owner’s signature for each operation.
This hook combines all session-related operations:
- Session creation (local keypair generation)
- Session registration (on-chain)
- Transaction execution (using session key)
- Session revocation (on-chain)
- Status checking (remaining calls, expiration)
Session keys only work with CHIPI wallets. READY wallets do not support session keys.
Prerequisites
Before using useChipiSession, you need:
- A CHIPI wallet (check
wallet.walletType === "CHIPI" or wallet.supportsSessionKeys)
- The user’s encryption key (PIN)
- An authentication token (from Clerk, Firebase, etc.)
Session Lifecycle
Quick Start
Configuration Options
Return Values
Session Data
Actions
Loading States
Persisting Sessions
Sessions should be persisted between page loads. Here’s an example using local state:
Executing Transactions
The executeWithSession method accepts an array of Starknet calls:
Custom Session Configuration
Custom Duration
Custom Max Calls
Error Handling