Install and set up the Smart Accounts Kit
This page provides instructions to install and set up the Smart Accounts KitSmart Accounts Kit Toolkit for creating, managing, and interacting with MetaMask Smart Accounts, delegations, and Advanced Permissions. in your dapp, enabling you to create and interact with MetaMask Smart AccountsMetaMask smart account A smart contract account that supports programmable behavior, delegated permissions, flexible signing options, and other advanced features..
Prerequisites
- Install Node.js v18 or later.
- Install Yarn, npm, or another package manager.
- If you plan to use any smart contracts (for example, to create a custom caveat enforcer), install Foundry.
Steps
1. Install the Smart Accounts Kit
Install the Smart Accounts Kit:
- npm
- Yarn
- pnpm
- Bun
npm install @metamask/smart-accounts-kit
yarn add @metamask/smart-accounts-kit
pnpm add @metamask/smart-accounts-kit
bun add @metamask/smart-accounts-kit
2. (Optional) Install the contracts
If you plan to extend the Delegation FrameworkDelegation Framework A set of audited smart contracts that handle smart account creation, the delegation lifecycle, and caveat enforcement. smart contracts (for example, to create a custom caveat enforcer), install the contract package using Foundry's command-line tool, Forge:
forge install metamask/delegation-framework@v1.3.0
Add @metamask/delegation-framework/=lib/metamask/delegation-framework/ in your remappings.txt file.
3. Get started
You're now ready to start using the Smart Accounts Kit. See the MetaMask Smart Accounts quickstart to walk through a simple example.