SessionWalletProvider
is a higher-order component that wraps around your app components to provide the sessionWallet
context throughout the application.
Here’s an example of how to use the SessionWalletProvider
:
- Create a new file named
components/SessionProvider.tsx
- In your
_app.tsx
file, wrap the SessionProvider around the entire app to ensure it’s accessible within every component:
- With the SessionWalletProvider set up, you can now use the
useSessionWallet
hook in your components:
Using useSessionWallet
in components
useSessionWallet
is a custom hook that provides access to the session wallet context value. Use this hook in any component wrapped by the SessionWalletProvider.
To properly understand what the useSessionWallet
hook provides, we need to examine the SessionWalletInterface
. This is what useSessionKeyManager
returns, providing the methods needed to utilize session keys as well as transaction signing and sending capabilities.