Skip to main content

Install and set up

This page provides instructions to install and set up the MetaMask Delegation Toolkit.

Prerequisites

Steps

1. Get the authentication token

The MetaMask Delegation Toolkit is currently published to a private package registry. You can request access by contacting the MetaMask Delegation team, who will provide you with an authentication token.

2. Configure your package manager

Create a .yarnrc.yml or .npmrc file in the root of your project with the following content, and replace <auth-token> with the authentication token:

.yarnrc.yml
npmRegistries:
"https://nexus.eu-west-3.codefi.network/repository/npm-hosted/":
npmAuthToken: <auth-token>

npmScopes:
codefi:
npmRegistryServer: "https://nexus.eu-west-3.codefi.network/repository/npm-hosted/"
note

If you're using an alternative package manager (such as pnpm or Bun), refer to its documentation.

3. Install the toolkit

Install the MetaMask Delegation Toolkit dependencies:

yarn add @codefi/delegator-core-viem

4. (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

Add @metamask/delegation-framework/=lib/metamask/delegation-framework/ in your remappings.txt file.

5. Get started

You're now ready to start using the MetaMask Delegation Toolkit. Check out the Hello Gator quickstart to walk through a simple example.