Etherspot
Search
⌃K

Shared Sessions

Introduction

Shared session allow a user to provide a signature just once on one chain, and use the same session when accessing other chains with the same acconnt. This helps streamline the user experience without them needing constantly provide a signature.

Implementation

When using 1 BUIDLER component

This is handled automatically for you, there's nothing you need to do to enable this feature.

When using more than 1 BUIDLER component in your dApp

You need to import the SessionStorage export from the etherspot package, and pass this to your <Etherspot /> component using the prop: etherspotSessionStorage.
See the example below:
import {
SessionStorage,
} from 'etherspot';
import {
Etherspot,
TRANSACTION_BLOCK_TYPE,
} from "@etherspot/react-transaction-buidler";
// ...
return (
<Etherspot
etherspotSessionStorage={SessionStorage}
defaultTransactionBlocks={[{ type: TRANSACTION_BLOCK_TYPE.SEND_ASSET }]}
/>
);