Install and set up the Delegation Toolkit
This page provides instructions to install and set up the MetaMask Delegation Toolkit, enabling you to integrate MetaMask Smart Accounts into your dapp.
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 toolkit
Install the MetaMask Delegation Toolkit dependencies:
- npm
- Yarn
- pnpm
- Bun
npm install @metamask/delegation-toolkit
yarn add @metamask/delegation-toolkit
pnpm add @metamask/delegation-toolkit
bun add @metamask/delegation-toolkit
2. (Optional) Install the contracts
If you plan to extend the Delegation Framework 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 MetaMask Smart Accounts. Check out the quickstart to walk through a simple example.