Configure the MetaMask Delegation Toolkit
The MetaMask Delegation Toolkit enables you to easily integrate MetaMask delegator accounts into your dapp, enabling a more flexible, secure, and frictionless experience for your users.
The toolkit is highly configurable, allowing you to tailor it to your project's specific needs. It includes support for custom signers, multiple signatory schemes, custom paymasters and bundlers, and more.
The MetaMask Delegation Toolkit provides custom middleware for Pimlico's gas fee resolver, paymaster, and bundler. Additional options will be made available soon.
Prerequisites
- Install and set up the MetaMask Delegation Toolkit.
- Optionally, complete the quickstart guide to familiarize yourself with the toolkit's capabilities.
Configure account creation and signing
The MetaMask Delegation Toolkit supports multiple signature schemes for verifying access to delegator accounts, including externally owned accounts (EOAs) and passkeys (P256).
In addition, it allows you to "bring your own signer" for the signing process, with the following options:
- EOAs
- Any signer that implements a
WalletClient
The following example demonstrates how to create and use a burner EOA as the owner (and signatory) of a new delegator account:
const privateKey = generatePrivateKey();
const owner = privateKeyToAccount(privateKey);
const deploySalt = "0x1";
const viemClient = createDeleGatorClient({
transport: http(),
chain,
account: {
implementation: Implementation.Hybrid,
deployParams: [owner.address, [], [], []],
deploySalt,
isAccountDeployed: false,
signatory: owner,
},
});
See how to use different signers for your delegator account.