Skip to main content

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 instructions array.
  • 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

EnableSession

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

ActionData

Example


Use Permission

Execute instructions using granted permissions.

Parameters

Example


Policies

Sudo Policy

Grants unlimited permissions for specified functions.
Use with caution, provides highest level of access.

Universal Policy

Fine-grained parameter-level control.
Use 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 session
By default, sudo policy will be configured. Configure policies on your own by defining policies

Custom Actions

Build custom actions for your session

Custom 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.
The following methods will be extended
  • isPermissionEnabled
  • checkEnabledPermissions

isPermissionEnabled

checkEnabledPermissions


Complete Flow