Smart Sessions
Overview
💡 The support for smart-session is included in a separate package Appkit SDK. Please follow the instruction in order to install it
Smart Sessions allow developers to easily integrate session-based permission handling within their decentralized applications (dApps). Using the grantPermissions
method, can send permission requests to wallets.
For users, this means a simpler experience. Instead of approving every action individually, they can allow access for a single session, making it faster and easier to use apps without dealing with constant pop-ups or interruptions.
With Smart Sessions, approved actions are carried out by the app’s backend during the session. This allows transactions to be processed automatically, making the experience even more seamless while ensuring that everything stays within the permissions set by the user.
This guide will walk you through on how to use the grantPermissions
method, including the basic setup and an example of how to request permissions from a wallet.
Implementation
AppKit Example with Smart Session
Clone this Github repository and follow the readme to try it locally.
For a step-by-step implementation, please refer to our Smart Session guide.
Install the library
How to use the permissions
The dApp must call the following RPC calls to https://rpc.walletconnect.org/v1/wallet?projectId=<PROJECT-ID>
wallet_prepareCalls
- Accepts an EIP-5792wallet_sendCalls
request. Responds with the prepared calls (in the case of Appkit Embedded Wallet, an Entrypoint v0.7 user operation), some context, and a signature request.wallet_sendPreparedCalls
- Accepts prepared calls, a signature, and the context returned from prepareCalls if present. Returns an EIP-5792 calls ID.
Steps to follow for executing any async action by the dApp backend.
-
Dapp makes the
wallet_prepareCalls
JSON RPC call. It’s Accepts an EIP-5792wallet_sendCalls
request, and returns the prepared calls according to the account’s implementation.Parameter
Return value
-
App developers are expected to Sign the
signatureRequest.hash
returned fromwallet_prepareCalls
call using the dApp key (secp256k1 or secp256r1) -
dApps makes the
wallet_sendPreparedCalls
JSON RPC call. The RPC accepts the prepared response fromwallet_prepareCalls
request along with a signature, and returns an EIP-5792 call bundle ID.
Currently supported Permission types
ContractCallPermission
Advance Examples
- Tic Tac Toe | Demo | Video
- Dollar cost average | Demo | Explanation | Video
- Github examples repository
- Simple example implementation
Reference
- ERC-7715: Grant Permissions from Wallets | https://eip.tools/eip/7715
- EIP-5792: Wallet Call API | https://eip.tools/eip/5792
- ERC-4337 Entry Point | https://github.com/ethereum/ercs/blob/master/ERCS/erc-4337.md#entrypoint-definition
Was this page helpful?