Overview
Cavos uses session keys for all transactions. After creating a session, users can execute unlimited transactions without any signature prompts.[!NOTE] All transactions are signed with the session key, not the user’s private key. The private key is cleared from memory after session creation.
Prerequisites
Before executing transactions, you need to be authenticated. Afterlogin(), account deployment and session registration happen automatically:
Basic Transaction
Once a session is active, transactions execute without prompts:Call Format
Each call follows the starknet.jsCall interface:
[!IMPORTANT]
The call must match a contract in your session policy’s allowedContracts. Calls to unauthorized contracts will fail.
Multiple Calls (Multicall)
Execute multiple calls atomically in a single transaction:Gas Options
execute() accepts an optional options object to control gas sponsorship:
Gasless (Default)
Gas is sponsored by the Cavos Paymaster. Users pay nothing and need no STRK balance.User Pays Gas
Pass{ gasless: false } to have the wallet pay its own gas from its STRK balance.
- The session must already be registered on-chain (at least one gasless tx must have been executed first, or
registerCurrentSession()called explicitly). - The wallet must hold enough STRK to cover the transaction fee.
[!NOTE] The SDK estimates fees using a rawstarknet_estimateFeecall (not starknet.js’s built-in estimator, which is incompatible with custom account signatures). A 5M L2-gas overhead is added on top to cover__validate__execution, which is not included inSKIP_VALIDATEestimates.
Session Policy Enforcement
Transactions are validated against your session policy:Error Handling
Transaction Status
Theexecute() function returns the transaction hash immediately. To track status:
Common Patterns
ERC20 Transfer
Approve + Action
User-Paid DeFi Action
Session Lifecycle
| State | execute() Behavior |
|---|---|
| Not authenticated | Throws “Wallet not initialized” |
| Session not registered | Gasless only — uses JWT signature (registers + executes atomically) |
| Session registered + active | Signs with session key ✅ (gasless or user-pays) |
| Expired (within grace) | Auto-renews session, then executes |
| Expired (beyond grace) | Throws “SESSION_EXPIRED” — re-login required |

