### Start the Development Server Source: https://docs.metamask.io/smart-accounts-kit/1.5.0/get-started/use-scaffold-eth/smart-accounts Run this command in the project's root directory to start the development server. ```bash yarn start ``` -------------------------------- ### Install Smart Accounts Kit with Bun Source: https://docs.metamask.io/smart-accounts-kit/1.5.0/get-started/install Use this command to install the Smart Accounts Kit using Bun. ```bash bun add @metamask/smart-accounts-kit ``` -------------------------------- ### Install x402 Dependencies with Bun Source: https://docs.metamask.io/smart-accounts-kit/development/guides/x402/buyer/delegations Install the necessary x402 core, fetch, and metamask packages using Bun. ```bash bun add @x402/core @x402/fetch @metamask/x402 ``` -------------------------------- ### Install Smart Accounts Kit with npm Source: https://docs.metamask.io/smart-accounts-kit/1.5.0/get-started/install Use this command to install the Smart Accounts Kit using npm. ```bash npm install @metamask/smart-accounts-kit ``` -------------------------------- ### Install @metamask/create-gator-app CLI Source: https://docs.metamask.io/smart-accounts-kit/1.5.0/get-started/use-the-cli Run this command to install the latest version of the CLI package. ```bash npx @metamask/create-gator-app@latest ``` -------------------------------- ### Install x402 Dependencies with npm Source: https://docs.metamask.io/smart-accounts-kit/development/guides/x402/buyer/delegations Install the necessary x402 core, fetch, and metamask packages using npm. ```bash npm install @x402/core @x402/fetch @metamask/x402 ``` -------------------------------- ### Install Smart Accounts Kit and Dependencies (Bun) Source: https://docs.metamask.io/smart-accounts-kit/1.5.0/guides/smart-accounts/signers/eoa-wallets Install the necessary packages for using MetaMask Smart Accounts with Bun. ```bash bun add @metamask/smart-accounts-kit wagmi @metamask/connect-evm @tanstack/react-query viem ``` -------------------------------- ### Install Smart Accounts Kit and Dependencies (Bun) Source: https://docs.metamask.io/smart-accounts-kit/development/guides/smart-accounts/signers/passkey Install the necessary packages for using MetaMask Smart Accounts and OX with Bun. ```bash bun add @metamask/smart-accounts-kit ox ``` -------------------------------- ### Install Smart Accounts Kit with Yarn Source: https://docs.metamask.io/smart-accounts-kit/1.5.0/get-started/install Use this command to install the Smart Accounts Kit using Yarn. ```bash yarn add @metamask/smart-accounts-kit ``` -------------------------------- ### Install Smart Accounts Kit with pnpm Source: https://docs.metamask.io/smart-accounts-kit/1.5.0/get-started/install Use this command to install the Smart Accounts Kit using pnpm. ```bash pnpm add @metamask/smart-accounts-kit ``` -------------------------------- ### Install Dependencies with npm Source: https://docs.metamask.io/smart-accounts-kit/1.5.0/guides/smart-accounts/signers/dynamic Install the necessary dependencies for using Dynamic with MetaMask Smart Accounts via npm. ```bash npm install @dynamic-labs/ethereum @dynamic-labs/sdk-react-core @dynamic-labs/wagmi-connector @metamask/smart-accounts-kit @tanstack/react-query wagmi viem ``` -------------------------------- ### Start Development Server Source: https://docs.metamask.io/smart-accounts-kit/get-started/use-scaffold-eth/advanced-permissions In the project's root directory, run this command to start the development server for your Scaffold-ETH 2 project. ```bash yarn start ``` -------------------------------- ### Install x402 Dependencies with pnpm Source: https://docs.metamask.io/smart-accounts-kit/development/guides/x402/buyer/delegations Install the necessary x402 core, fetch, and metamask packages using pnpm. ```bash pnpm add @x402/core @x402/fetch @metamask/x402 ``` -------------------------------- ### Install Smart Accounts Kit and Dependencies (npm) Source: https://docs.metamask.io/smart-accounts-kit/1.5.0/guides/smart-accounts/signers/eoa-wallets Install the necessary packages for using MetaMask Smart Accounts with npm. ```bash npm install @metamask/smart-accounts-kit wagmi @metamask/connect-evm @tanstack/react-query viem ``` -------------------------------- ### Install Dependencies with npm Source: https://docs.metamask.io/smart-accounts-kit/1.5.0/guides/smart-accounts/signers/privy Install the necessary dependencies for Privy and MetaMask Smart Accounts using npm. ```bash npm install @privy-io/react-auth @privy-io/wagmi @metamask/smart-accounts-kit @tanstack/react-query wagmi viem ``` -------------------------------- ### Install x402 Dependencies with Yarn Source: https://docs.metamask.io/smart-accounts-kit/development/guides/x402/buyer/delegations Install the necessary x402 core, fetch, and metamask packages using Yarn. ```bash yarn add @x402/core @x402/fetch @metamask/x402 ``` -------------------------------- ### Install Smart Accounts Kit and Dependencies (pnpm) Source: https://docs.metamask.io/smart-accounts-kit/1.5.0/guides/smart-accounts/signers/eoa-wallets Install the necessary packages for using MetaMask Smart Accounts with pnpm. ```bash pnpm add @metamask/smart-accounts-kit wagmi @metamask/connect-evm @tanstack/react-query viem ``` -------------------------------- ### Install Smart Accounts Kit and Dependencies (Yarn) Source: https://docs.metamask.io/smart-accounts-kit/1.5.0/guides/smart-accounts/signers/eoa-wallets Install the necessary packages for using MetaMask Smart Accounts with Yarn. ```bash yarn add @metamask/smart-accounts-kit wagmi @metamask/connect-evm @tanstack/react-query viem ``` -------------------------------- ### Install Smart Accounts Kit and Dependencies (npm) Source: https://docs.metamask.io/smart-accounts-kit/development/guides/smart-accounts/signers/passkey Install the necessary packages for using MetaMask Smart Accounts and OX with npm. ```bash npm install @metamask/smart-accounts-kit ox ``` -------------------------------- ### Install Smart Accounts Kit and Dependencies (Yarn) Source: https://docs.metamask.io/smart-accounts-kit/development/guides/smart-accounts/signers/passkey Install the necessary packages for using MetaMask Smart Accounts and OX with Yarn. ```bash yarn add @metamask/smart-accounts-kit ox ``` -------------------------------- ### Install Smart Accounts Kit and Dependencies (pnpm) Source: https://docs.metamask.io/smart-accounts-kit/development/guides/smart-accounts/signers/passkey Install the necessary packages for using MetaMask Smart Accounts and OX with pnpm. ```bash pnpm add @metamask/smart-accounts-kit ox ``` -------------------------------- ### Install MetaMask Smart Accounts Extension Source: https://docs.metamask.io/smart-accounts-kit/1.5.0/get-started/use-scaffold-eth/smart-accounts Use this command to install the Smart Accounts Kit extension for Scaffold-ETH 2. ```bash npx create-eth@latest -e metamask/gator-extension your-project-name ``` -------------------------------- ### Set up Environment Variables Source: https://docs.metamask.io/smart-accounts-kit/1.5.0/get-started/use-scaffold-eth/smart-accounts Navigate to the project's nextjs package and copy the example environment file. Update the NEXT_PUBLIC_PIMLICO_API_KEY with your Pimlico API Key. ```bash cd your-project-name/packages/nextjs cp .env.example .env.local ``` -------------------------------- ### Native Token Streaming Caveat Example Source: https://docs.metamask.io/smart-accounts-kit/development/reference/delegation/caveats Example of setting up a NativeTokenStreaming caveat. This caveat enforces streaming of native tokens with initial, maximum, and per-second amounts, along with a start date. ```typescript import { CaveatType } from "@metamask/smart-accounts-kit"; // Current time as start date. // Since startDate is in seconds, we need to convert milliseconds to seconds. const startDate = Math.floor(Date.now() / 1000); const caveats = [{ type: CaveatType.NativeTokenStreaming, // 0.01 ETH in wei. initialAmount: 10000000000000000, // 0.5 ETH in wei. maxAmount: 500000000000000000n // 0.00001 ETH in wei. amountPerSecond: 10000000000000n, startDate, }]; ``` -------------------------------- ### Timestamp Caveat Example Source: https://docs.metamask.io/smart-accounts-kit/1.5.0/reference/delegation/caveats Defines a timestamp range for delegation validity. Use this to set specific start and end times for a delegation. ```typescript import { CaveatType } from '@metamask/smart-accounts-kit' // We need to convert milliseconds to seconds. const currentTime = Math.floor(Date.now() / 1000) // 1 hour after current time. const afterThreshold = currentTime + 3600 // 1 day after afterThreshold const beforeThreshold = afterThreshold + 86400 const caveats = [ { type: CaveatType.Timestamp, afterThreshold, beforeThreshold, }, ] ``` -------------------------------- ### ERC20PeriodTransfer Caveat Example Source: https://docs.metamask.io/smart-accounts-kit/1.5.0/reference/delegation/caveats This caveat limits ERC-20 token transfers within a specific period. The transfer amount resets at the start of each period, and unused allowances are forfeited. ```typescript import { CaveatType } from '@metamask/smart-accounts-kit' // Current time as start date. // Since startDate is in seconds, we need to convert milliseconds to seconds. const startDate = Math.floor(Date.now() / 1000) const caveats = [ { type: CaveatType.Erc20PeriodTransfer, // Address of the ERC-20 token. tokenAddress: '0xb4aE654Aca577781Ca1c5DE8FbE60c2F423f37da', // 1 ERC-20 token - 18 decimals, in wei. periodAmount: 1000000000000000000n, // 1 day in seconds. periodDuration: 86400, startDate, }, ] ``` -------------------------------- ### Set Up Environment Variables Source: https://docs.metamask.io/smart-accounts-kit/get-started/use-scaffold-eth/advanced-permissions Navigate to the project's nextjs package and copy the example environment file to .env.local. Update the NEXT_PUBLIC_PIMLICO_API_KEY with your actual Pimlico API Key. ```bash cd your-project-name/packages/nextjs cp .env.example .env.local ``` -------------------------------- ### Get Granted Execution Permissions Response Source: https://docs.metamask.io/smart-accounts-kit/development/reference/advanced-permissions/wallet-client Example response structure for `getGrantedExecutionPermissions`. This illustrates a granted permission object, including chain ID, context, delegation manager, dependencies, sender, permission details, rules, and recipient. ```json [ { chainId: 84532, context: "0x0000...0000", delegationManager: "0xdb9B...7dB3", dependencies: [], from: "0x993f...7f31", permission: { type: "erc20-token-periodic", isAdjustmentAllowed: false, data: { ... }, }, rules: [ { type: "expiry", data: { ... } }, ], to: "0xAB57...7F1f", }, // ... ] ``` -------------------------------- ### Get Supported Execution Permissions Response Source: https://docs.metamask.io/smart-accounts-kit/development/reference/advanced-permissions/wallet-client Example response structure for `getSupportedExecutionPermissions`. This shows the types of native token streams and ERC20 token periodic permissions supported, including their associated chain IDs and rule types. ```json { "native-token-stream": { "chainIds": [1, 10], "ruleTypes": ["expiry"] }, "erc20-token-periodic": { "chainIds": [1, 137], "ruleTypes": ["expiry"] }, // ... } ``` -------------------------------- ### Configure Express server with x402 payment middleware Source: https://docs.metamask.io/smart-accounts-kit/development/guides/x402/seller Set up an Express server with x402 payment middleware and the ERC-7710 scheme for protected routes. This example configures a GET /api/hello endpoint to charge 0.01 USDC on Base Sepolia. ```typescript import express, { type Request, type Response } from 'express' import cors from 'cors' import { paymentMiddleware, x402ResourceServer } from '@x402/express' import { x402ExactEvmErc7710ServerScheme } from '@metamask/x402' import { NETWORK_ID, PORT, payToAddress, facilitatorClient } from './config.js' const app = express() app.use(cors({ exposedHeaders: ['PAYMENT-REQUIRED', 'PAYMENT-RESPONSE'] })) app.use( paymentMiddleware( { 'GET /api/hello': { accepts: [ { scheme: 'exact', price: '$0.01', network: NETWORK_ID, payTo: payToAddress, extra: { assetTransferMethod: 'erc7710', }, }, ], description: 'Access to protected resource', mimeType: 'application/json', }, }, new x402ResourceServer(facilitatorClient).register( NETWORK_ID, new x402ExactEvmErc7710ServerScheme() ) ) ) app.get('/api/hello', (_req: Request, res: Response) => { res.json({ message: 'Hello!' }) }) app.listen(PORT, () => { console.log(`[seller] Server running on http://localhost:${PORT}`) }) ``` -------------------------------- ### Configure Delegation for Multi-Token Period Enforcer Source: https://docs.metamask.io/smart-accounts-kit/1.5.0/reference/delegation/caveat-enforcer-client This example demonstrates how to set up a delegation object with multiple token configurations for the multi-token period enforcer. It includes defining token-specific amounts, durations, and start dates, as well as handling native tokens. ```typescript import { createDelegation, getSmartAccountsEnvironment, ROOT_AUTHORITY, CaveatType, } from '@metamask/smart-accounts-kit' import { createCaveatBuilder } from '@metamask/smart-accounts-kit/utils' import { sepolia as chain } from 'viem/chains' import { parseUnits, parseEther } from 'viem' const environment = getSmartAccountsEnvironment(chain.id) const caveatBuilder = createCaveatBuilder(environment) // Current time as start date. // Since startDate is in seconds, we need to convert milliseconds to seconds. const startDate = Math.floor(Date.now() / 1000) const tokenConfigs = [ { token: '0xb4aE654Aca577781Ca1c5DE8FbE60c2F423f37da', // 1 token with 6 decimals. periodAmount: parseUnits('1', 6), // 1 day in seconds. periodDuration: 86400, startDate, }, { // For native token use zeroAddress token: zeroAddress, // 0.01 ETH in wei. periodAmount: parseEther('0.01'), // 1 hour in seconds. periodDuration: 3600, startDate, }, ] const caveats = caveatBuilder.addCaveat(CaveatType.MultiTokenPeriod, tokenConfigs) export const delegation: Delegation = { delegate: 'DELEGATE_ADDRESS', delegator: 'DELEGATOR_ADDRESS', authority: ROOT_AUTHORITY, caveats: caveats.build(), salt: '0x', } ``` -------------------------------- ### Install Smart Accounts Kit and Dependencies (Bun) Source: https://docs.metamask.io/smart-accounts-kit/1.5.0/guides/smart-accounts/signers/embedded-wallets Install the necessary packages for using Smart Accounts Kit with Embedded Wallets and Wagmi using Bun. ```bash bun add @metamask/smart-accounts-kit @web3auth/modal wagmi @tanstack/react-query viem ``` -------------------------------- ### Configure Express server with x402 payment middleware Source: https://docs.metamask.io/smart-accounts-kit/1.5.0/guides/x402/seller Set up the Express server to use the x402 payment middleware and the custom ERC-7710 scheme. This example protects the GET /api/hello endpoint with a payment requirement of 0.01 USDC on Base mainnet. ```typescript import express, { type Request, type Response } from 'express' import cors from 'cors' import { paymentMiddleware } from '@x402/express' import { x402ResourceServer } from '@x402/core/server' import { Erc7710ExactEvmScheme } from './scheme.js' import { NETWORK_ID, PORT, payToAddress, facilitatorClient } from './config.js' const app = express() app.use(cors({ exposedHeaders: ['PAYMENT-REQUIRED', 'PAYMENT-RESPONSE'] })) app.use( paymentMiddleware( { 'GET /api/hello': { accepts: [ { scheme: 'exact', price: '$0.01', network: NETWORK_ID, payTo: payToAddress, }, ], description: 'Access to protected resource', mimeType: 'application/json', }, }, new x402ResourceServer(facilitatorClient).register( NETWORK_ID, new Erc7710ExactEvmScheme(facilitatorClient) ) ) ) app.get('/api/hello', (_req: Request, res: Response) => { res.json({ message: 'Hello!' }) }) app.listen(PORT, () => { console.log(`[seller] Server running on http://localhost:${PORT}`) }) ``` -------------------------------- ### Generate and Aggregate Multisig Signatures Source: https://docs.metamask.io/smart-accounts-kit/development/guides/smart-accounts/generate-multisig-signature This example demonstrates how to prepare a user operation, obtain individual signatures from multiple signers (Alice and Bob), and then aggregate these signatures into a single signature for a Multisig smart account. Ensure the Smart Accounts Kit is installed and a Multisig smart account is created prior to execution. ```typescript import { bundlerClient, aliceSmartAccount, bobSmartAccount, aliceAccount, bobAccount, } from './config.ts' import { aggregateSignature } from '@metamask/smart-accounts-kit' const userOperation = await bundlerClient.prepareUserOperation({ account: aliceSmartAccount, calls: [ { target: zeroAddress, value: 0n, data: '0x', }, ], }) const aliceSignature = await aliceSmartAccount.signUserOperation(userOperation) const bobSignature = await bobSmartAccount.signUserOperation(userOperation) const aggregatedSignature = aggregateSignature({ signatures: [ { signer: aliceAccount.address, signature: aliceSignature, type: 'ECDSA', }, { signer: bobAccount.address, signature: bobSignature, type: 'ECDSA', }, ], }) ``` -------------------------------- ### Install ERC-7715 Extension Source: https://docs.metamask.io/smart-accounts-kit/1.5.0/get-started/use-scaffold-eth/advanced-permissions Installs the Smart Accounts Kit extension for Scaffold-ETH 2. Ensure you have Node.js, Yarn, and Git installed. ```bash npx create-eth@latest -e metamask/erc-7715-extension your-project-name ``` -------------------------------- ### Set up a Bundler Client with Viem Source: https://docs.metamask.io/smart-accounts-kit/1.5.0/get-started/smart-account-quickstart Set up a Bundler Client using Viem's createBundlerClient function. This client enables the use of the bundler service for estimating gas for user operations and submitting transactions. It requires an existing public client and the bundler RPC URL. ```typescript import { createBundlerClient } from 'viem/account-abstraction' const bundlerClient = createBundlerClient({ client: publicClient, transport: http('https://your-bundler-rpc.com'), }) ``` -------------------------------- ### Install Scaffold-ETH 2 ERC-7715 Extension Source: https://docs.metamask.io/smart-accounts-kit/get-started/use-scaffold-eth/advanced-permissions Run this command to install the Smart Accounts Kit extension for Scaffold-ETH 2. Ensure you have Node.js, Yarn, and Git installed. ```bash npx create-eth@latest -e metamask/erc-7715-extension your-project-name ``` -------------------------------- ### Example Caveat Source: https://docs.metamask.io/smart-accounts-kit/1.5.0/reference/delegation/caveats A basic example demonstrating how to define an array of caveats. ```typescript import { CaveatType } from '@metamask/smart-accounts-kit' const caveats = [ { type: CaveatType.Id, id: 123456, }, ] ``` -------------------------------- ### Install Smart Accounts Kit Skill from GitHub URL Source: https://docs.metamask.io/smart-accounts-kit/1.5.0/get-started/use-with-openclaw Install the Smart Accounts Kit skill by cloning its repository from GitHub. This enables integration with advanced features like delegations and permissions. ```bash Install the skill from https://github.com/smartgator/smart-accounts-kit-skills.git ``` -------------------------------- ### LimitedCalls Caveat Example Source: https://docs.metamask.io/smart-accounts-kit/1.5.0/reference/delegation/caveats Example of a LimitedCalls caveat to restrict the number of times a delegation can be redeemed. ```typescript import { CaveatType } from '@metamask/smart-accounts-kit' const caveats = [ { type: CaveatType.LimitedCalls, limit: 1, }, ] ``` -------------------------------- ### Configuration for Smart Account Setup Source: https://docs.metamask.io/smart-accounts-kit/1.5.0/guides/delegation/create-redelegation Sets up Alice and Bob's smart accounts using the Hybrid implementation. This configuration is necessary for creating and signing delegations. ```typescript import { Implementation, toMetaMaskSmartAccount } from '@metamask/smart-accounts-kit' import { privateKeyToAccount } from 'viem/accounts' import { createPublicClient, http } from 'viem' import { sepolia as chain } from 'viem/chains' const publicClient = createPublicClient({ chain, transport: http(), }) const aliceAccount = privateKeyToAccount('0x...') const bobAccount = privateKeyToAccount('0x...') export const aliceSmartAccount = await toMetaMaskSmartAccount({ client: publicClient, implementation: Implementation.Hybrid, deployParams: [aliceAccount.address, [], [], []], deploySalt: '0x', signer: { account: aliceAccount }, }) export const bobSmartAccount = await toMetaMaskSmartAccount({ client: publicClient, implementation: Implementation.Hybrid, deployParams: [bobAccount.address, [], [], []], deploySalt: '0x', signer: { account: bobAccount }, }) ``` -------------------------------- ### Install Dependencies with pnpm Source: https://docs.metamask.io/smart-accounts-kit/1.5.0/guides/smart-accounts/signers/privy Install the necessary dependencies for Privy and MetaMask Smart Accounts using pnpm. ```bash pnpm add @privy-io/react-auth @privy-io/wagmi @metamask/smart-accounts-kit @tanstack/react-query wagmi viem ``` -------------------------------- ### Set up Public Client Source: https://docs.metamask.io/smart-accounts-kit/1.5.0/guides/advanced-permissions/execute-on-metamask-users-behalf Set up a Public Client using Viem to query account state and interact with the blockchain network. ```typescript import { createPublicClient, http } from 'viem' import { sepolia as chain } from 'viem/chains' const publicClient = createPublicClient({ chain, transport: http(), }) ``` -------------------------------- ### Install Dependencies with Yarn Source: https://docs.metamask.io/smart-accounts-kit/1.5.0/guides/smart-accounts/signers/privy Install the necessary dependencies for Privy and MetaMask Smart Accounts using Yarn. ```bash yarn add @privy-io/react-auth @privy-io/wagmi @metamask/smart-accounts-kit @tanstack/react-query wagmi viem ``` -------------------------------- ### Create Delegator Smart Account Source: https://docs.metamask.io/smart-accounts-kit/1.5.0/guides/configure-toolkit This example demonstrates the creation of a delegator smart account using viem and the Smart Accounts Kit. It requires setting up a public client, a delegator account, and specifying implementation details. ```typescript import { Implementation, toMetaMaskSmartAccount, } from "@metamask/smart-accounts-kit"; import { privateKeyToAccount } from "viem/accounts"; import { createPublicClient, http } from "viem"; import { sepolia as chain } from "viem/chains"; const publicClient = createPublicClient({ chain, transport: http(), }); const delegatorAccount = privateKeyToAccount("0x..."); const delegatorSmartAccount = await toMetaMaskSmartAccount({ client: publicClient, implementation: Implementation.Hybrid, deployParams: [delegatorAccount.address, [], [], []], deploySalt: "0x", signer: { account: delegatorAccount }, }); export delegatorSmartAccount; ``` -------------------------------- ### Install Smart Accounts Kit Skill from Git Source: https://docs.metamask.io/smart-accounts-kit/1.5.0/get-started/use-with-openclaw Install the Smart Accounts Kit skill by cloning its repository. This allows your agent to integrate capabilities like batch transactions and gas sponsorship. ```bash cd ~/.openclaw/workspace/skills git clone https://github.com/smartgator/smart-accounts-kit-skills.git ``` -------------------------------- ### Install Smart Accounts Kit and Dependencies (npm) Source: https://docs.metamask.io/smart-accounts-kit/1.5.0/guides/smart-accounts/signers/embedded-wallets Install the necessary packages for using Smart Accounts Kit with Embedded Wallets and Wagmi using npm. ```bash npm install @metamask/smart-accounts-kit @web3auth/modal wagmi @tanstack/react-query viem ``` -------------------------------- ### Install Dependencies with Yarn Source: https://docs.metamask.io/smart-accounts-kit/1.5.0/guides/smart-accounts/signers/dynamic Install the necessary dependencies for using Dynamic with MetaMask Smart Accounts via Yarn. ```bash yarn add @dynamic-labs/ethereum @dynamic-labs/sdk-react-core @dynamic-labs/wagmi-connector @metamask/smart-accounts-kit @tanstack/react-query wagmi viem ``` -------------------------------- ### Configure Viem Public Client and Environment Source: https://docs.metamask.io/smart-accounts-kit/development/guides/delegation/check-delegation-state Sets up the Viem public client and retrieves the Smart Accounts environment configuration. This is a prerequisite for initializing the CaveatEnforcerClient. ```typescript import { sepolia as chain } from 'viem/chains' import { createPublicClient, http } from 'viem' import { getSmartAccountsEnvironment } from '@metamask/smart-accounts-kit' export const environment = getSmartAccountsEnvironment(chain.id) export const publicClient = createPublicClient({ chain, transport: http(), }) ``` -------------------------------- ### Setup Wallet Client with ERC7710 Actions Source: https://docs.metamask.io/smart-accounts-kit/1.5.0/reference/erc7710/wallet-client Initializes a Viem wallet client and extends it with ERC7710 actions. This setup is required for managing smart account permissions and redelegations. ```typescript import { http, createWalletClient } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { sepolia as chain } from 'viem/chains' import { getSmartAccountsEnvironment } from '@metamask/smart-accounts-kit' import { erc7710WalletActions } from '@metamask/smart-accounts-kit/actions' // Your session account for requesting and redelegating should be the same. const privateKey = '0x...' const account = privateKeyToAccount(privateKey) export const environment = getSmartAccountsEnvironment(chain.id) const walletClient = createWalletClient({ account, transport: http(), chain, }).extend(erc7710WalletActions()) ```