Documentation Index
Fetch the complete documentation index at: https://docs.biconomy.io/llms.txt
Use this file to discover all available pages before exploring further.
Smart Sessions
Smart Sessions allow accounts to delegate specific permissions to other signers with fine-grained control over what actions they can perform. Enabling and using a permission with Smart Sessions is a two-step process involving setup and actual usage:1. Enable Permission
The initial setup phase involves several key operations to prepare your account for session-based permissions:- Deploy the SCA (if it does not exist yet).
- Fund the SCA to ensure gas costs or funding for your DeFi needs.
- Bridge Funds, Unwind Positions or etc as part of initial setup by passing extra instructions via the
instructionsarray. - Install the Smart Sessions Module into the SCA, ensuring the account is capable of session management.
- Enable one or more permissions: Define specific actions and their allowed signers.
2. Use Permission
Once a permission is enabled, a valid session signer is now authorized to perform the allowed actions.- The session signer can initiate actions within the allowed scope (such as contract calls, swaps, mints, etc.).
- Calls made by the session signer are validated against the permission rules applied in the previous step.
Prepare and enable permissions
Deploy accounts, fund accounts, install Smart Sessions module, and enable permissions.Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
mode | "PREPARE" | Yes | Prepare or use a permission. |
enableSession | EnableSession | No | Options to enable a session. |
smartSessionValidatorAddress | Address | No | Address of the Smart Session validator to use. |
instructions | Instruction[] | No | Array of composable instructions to be executed. |
feeToken | FeeTokenInfo | Yes* | Token used for gas payment. |
sponsorship | boolean | No | Enable or disable gas sponsorship. |
delegate | boolean | No | Enable EIP-7702 delegate mode. |
authorization | Authorization | No | EIP-7702 authorization configuration. |
lowerBoundTimestamp | number | No | Earliest allowed execution timestamp. |
upperBoundTimestamp | number | No | Latest allowed execution timestamp. |
cleanUps | CleanUp[] | No | List of cleanup instructions. |
simulation | SimulationOptions | No | Simulation config. |
EnableSession
| Property | Type | Required | Description |
|---|---|---|---|
redeemer | Address | Yes | Address of the session signer. |
actions | SessionAction[] | Yes | Allowed actions within this session. |
batchActions | boolean | No | Whether to allow batching of actions. |
maxPaymentAmount | bigint | No | Maximum payment amount allowed for the session. |
Payment policy and fee token: When the session token (e.g. the token used in spending limits or transfer actions) is the same as
feeToken, the SDK merges those policies with the payment policy—the effective spending limit is increased by maxPaymentAmount and no duplicate payment action is added.SessionAction
| Property | Type | Required | Description |
|---|---|---|---|
actions | ActionData[] | Yes | Specific action configurations (see ActionData). |
chainId | number | Yes | Chain ID where the permission is valid. |
ActionData
| Property | Type | Required | Description |
|---|---|---|---|
actionTarget | Address | Yes | Target contract address for this action. |
actionTargetSelector | Hex | Yes | Function selector (4-byte signature) for the contract method. |
actionPolicies | Policy[] | No | List of policies defining rules and restrictions on this action. |
Example
Use Permission
Execute instructions using granted permissions.Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
mode | "USE" | Yes | Prepare or use a permission. |
sessionDetails | SessionDetails | Yes | Session information for enabled permissions |
instructions | Instruction[] | No | Array of instructions to be executed. |
feeToken | FeeTokenInfo | Yes* | Token used for gas payment. |
sponsorship | boolean | No | Enable or disable gas sponsorship. |
delegate | boolean | No | Enable EIP-7702 delegate mode. |
authorization | Authorization | No | EIP-7702 authorization configuration. |
lowerBoundTimestamp | number | No | Earliest allowed execution timestamp. |
upperBoundTimestamp | number | No | Latest allowed execution timestamp. |
simulation | SimulationOptions | No | Simulation config. |
Example
Policies
Sudo Policy
Grants unlimited permissions for specified functions.Universal Policy
Fine-grained parameter-level control.calldataArgument(n) to specify the calldata offset for the n-th (1-based) function argument—e.g. calldataArgument(2) is the second parameter. Import from @biconomy/abstractjs.
Timeframe policy
Add fine-grained expirations to the session actions.Spending limit policy
Add spending limits for the token spendings.Usage limit policy
Add usage limits to control the session usage count.Actions
Frequently Used Actions
Build approve, transfer, and transferFrom actions for your sessionBy default, sudo policy will be configured. Configure policies on your own by defining policies
Custom Actions
Build custom actions for your sessionCustom action batching
By default, all actions are submitted as a single atomic batch when enabling session permissions. If you encounter issues with block gas limits on certain chains, you can break the actions into multiple smaller batches.To enable custom batching, make sure to configure
batchActions: false in enableSession while preparing the permissions.Check Permission Status
meeSessionActions
Extend the MEE client with session-related methods.isPermissionEnabledcheckEnabledPermissions