smart-accounts-kit
Web3 development using MetaMask Smart Accounts Kit. Use when the user wants to build dApps with ERC-4337 smart accounts, send user operations, batch transactions, configure signers (EOA, passkey, multisig), implement gas abstraction with paymasters, create delegations, or request advanced permissions (ERC-7715). Supports Viem integration, multiple signer types (Dynamic, Web3Auth, Wagmi), gasless transactions, and the Delegation Framework.
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/ayushbherwani1998/smart-accounts-kitQuick Reference
This skill file provides quick access to the MetaMask Smart Accounts Kit v0.3.0. For detailed information, refer to the specific reference files.
📚 Detailed References:
- Smart Accounts Reference - Account creation, implementations, signers
- Delegations Reference - Delegation lifecycle, scopes, caveats
- Advanced Permissions Reference - ERC-7715 permissions via MetaMask
Package Installation
npm install @metamask/[email protected]
For custom caveat enforcers:
forge install metamask/[email protected]
Core Concepts Summary
1. Smart Accounts (ERC-4337)
Three implementation types:
| Implementation | Best For | Key Feature |
|---|---|---|
Hybrid (Implementation.Hybrid) | Standard dApp users | EOA + passkey signers, most flexible |
MultiSig (Implementation.MultiSig) | Treasury/DAO operations | Threshold-based security, Safe-compatible |
Stateless7702 (Implementation.Stateless7702) | Power users with existing EOA | Keep same address, add smart account features via EIP-7702 |
Decision Guide:
- Building for general users? → Hybrid
- Managing treasuries or multi-party control? → MultiSig
- Upgrading existing EOAs without address change? → Stateless7702
2. Delegation Framework (ERC-7710)
Grant permissions from delegator to delegate:
- Scopes - Initial authority (spending limits, function calls)
- Caveats - Restrictions enforced by smart contracts
- Types - Root, open root, redelegation, open redelegation
- Lifecycle - Create → Sign → Store → Redeem
3. Advanced Permissions (ERC-7715)
Request permissions via MetaMask extension:
- Human-readable UI confirmations
- ERC-20 and native token permissions
- Requires MetaMask Flask 13.5.0+
- User must have smart account
Quick Code Examples
Create Smart Account
import { Implementation, toMetaMaskSmartAccount } from '@metamask/smart-accounts-kit'
import { privateKeyToAccount } from 'viem/accounts'
const account = privateKeyToAccount('0x...')
const smartAccount = await toMetaMaskSmartAccount({
client: publicClient,
implementation: Implementation.Hybrid,
deployParams: [account.address, [], [], []],
deploySalt: '0x',
signer: { account },
})
Create Delegation
import { createDelegation } from '@metamask/smart-accounts-kit'
import { parseUnits } from 'viem'
const delegation = createDelegation({
to: delegateAddress,
from: delegatorSmartAccount.address,
environment: delegatorSmartAccount.environment,
scope: {
type: 'erc20TransferAmount',
tokenAddress: '0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238',
maxAmount: parseUnits('10', 6),
},
caveats: [
{ type: 'timestamp', afterThreshold: now, beforeThreshold: expiry },
{ type: 'limitedCalls', limit: 5 },
],
})
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-ayushbherwani1998-smart-accounts-kit": {
"enabled": true,
"auto_update": true
}
}
}Related Skills
gator-cli
Use when you need to operate the @metamask/gator-cli to initialize profiles, upgrade EOA to EIP-7702, grant, redeem, and revoke ERC-7710 delegations, or inspect balances and delegations. Covers commands, required flags, grant scopes, redeem action types, configuration locations, and common usage flows.
smart-accounts-kit
Web3 development using MetaMask Smart Accounts Kit. Use when the user wants to build dApps with ERC-4337 smart accounts, send user operations, batch transactions, configure signers (EOA, passkey, multisig), implement gas abstraction with paymasters, create delegations, or request advanced permissions (ERC-7715). Supports Viem integration, multiple signer types (Dynamic, Web3Auth, Wagmi), gasless transactions, and the Delegation Framework.