Simplified Smart Wallet Session Key API

Joaquim Verges

You can now easily create session keys for your smart wallets, granting scoped access to other wallets.

This is useful in a handful of setups where you need to give restricted or temporary smart wallet access to a backend or another user.

Restrictions include:

  • Which contracts can be called
  • How much ETH can be spent
  • start and expiration time

Here's what it looks like in Typescript:

const smartWallet = new SmartWallet(config);
// create and add a session key with permissions
await smartWallet.createSessionKey(
"0x...", // the session key address
approvedCallTargets: ["0x..."], // the addresses of contracts that the session key can call
nativeTokenLimitPerTransaction: 0.1, // the maximum amount of native token (in ETH) that the session key can spend per transaction
startDate: new Date(), // the date when the session key becomes active
expirationDate = new Date( + 24 * 60 * 60 * 1000); // the date when the session key expires

And in React:

const {
mutate: createSessionKey,
} = useCreateSessionKey();

Read more on our portal:

Permissions & Session Keys | thirdweb developer portal
All of the account contracts [Simple, Dynamic and Managed] share the same permission model. In this section, we’ll describe this permission model in detail.