sessions.createSessionKey()
Generate a session keypair locally. The SDK returns the data but does NOT store it.Usage
Parameters
Return Value
Returns aSessionKeyData object:
Example
sessions.addSessionKeyToContract()
Register a session key on the CHIPI wallet smart contract. Requires owner signature.Usage
Parameters
Return Value
Returns aPromise<string> with the transaction hash.
Example
This uses gasless transactions via the Chipi paymaster. Users don’t need STRK for gas.
sessions.setupSession() (14.14.0+)
Register a session and its spending policies in one owner-signed transaction. Equivalent toaddSessionKeyToContract followed by one setSpendingPolicy per token, but the owner signs once and the session never exists on-chain without its caps.
Usage
Parameters
Every call is built and validated before anything is signed: an invalid policy throws
INVALID_SPENDING_POLICY and nothing is sent. maxPerWindow: 0n means no window cap.
Call builders
The same calls are exported as pure functions, for batching with other calls or signing with your own owner path:
All are imported from
@chipi-stack/backend, together with normalizeEntrypoints and validateSpendingPolicyConfig.
executeTransactionWithSession()
Execute a transaction using a session key instead of the owner’s private key.Usage
Parameters
Return Value
Returns aPromise<string> with the transaction hash.
Example
Signature Format: Session transactions use a 4-element signature
[sessionPubKey, r, s, validUntil] instead of the owner’s 2-element [r, s]. The SDK handles this automatically.sessions.revokeSessionKey()
Remove a session key’s authorization from the CHIPI wallet contract.Usage
Parameters
Return Value
Returns aPromise<string> with the transaction hash.
Example
sessions.getSessionData()
Query the on-chain status of a session key.Usage
Parameters
Return Value
Returns aPromise<SessionDataResponse>:
Example
Error Handling
All session methods throwChipiSessionError for session-specific failures:
Error Codes
Related
- Session Keys Quickstart - Full lifecycle guide
- CHIPI Wallet Smart Contract - Cairo implementation
- Transfer - Basic token transfers
- Call Any Contract - Custom contract interactions
