addSessionKey

Adds session key permissions for a specified address.

Example

import { addSessionKey } from "thirdweb/extensions/erc4337";
import { sendTransaction } from "thirdweb";
const transaction = addSessionKey({
contract,
account,
sessionKeyAddress,
permissions: {
approvedTargets: ["0x..."],
nativeTokenLimitPerTransaction: 0.1, // in ETH
permissionStartTimestamp: new Date(),
permissionEndTimestamp: new Date(
Date.now() + 1000 * 60 * 60 * 24 * 365,
), // 1 year from now
},
});
await sendTransaction({ transaction, account });

Parameters

Returns

The transaction object to be sent.