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.
数据来源:ClawHub。 在 ClawSkills 查看
选择你使用的 Agent
方法一:命令行安装(推荐)
推荐(无需提前安装 clawhub)
npx clawhub@latest --dir ~/.claude/skills install metamask-smart-accounts-kit或使用 clawhub CLI(需提前安装)
clawhub --dir ~/.claude/skills install metamask-smart-accounts-kit⚠️ 需要 Node.js 18+,没有 Node?请使用下方方法二直接下载 ZIP。 安装 Node.js →
方法二:手动下载安装(无需 Node)
下载 ZIP,解压后将文件夹放到以下路径,重启 Agent 即可:
安装路径
~/.claude/skills/metamask-smart-accounts-kit/💡解压后将文件夹放到上方路径,重启 Agent 即可生效
--- name: smart-accounts-kit description: 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. metadata: {"openclaw":{"emoji":"🦊","homepage":"https://docs.metamask.io/smart-accounts-kit"}} ---
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:
npm install @metamask/[email protected]
For custom caveat enforcers:
forge install metamask/[email protected]
Three implementation types:
Implementation.Hybrid) - EOA + passkey signersImplementation.MultiSig) - Multiple signers with thresholdImplementation.Stateless7702) - EIP-7702 upgraded EOAGrant permissions from delegator to delegate:
Request permissions via MetaMask extension:
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 },
})
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 },
],
})
const signature = await smartAccount.signDelegation({ delegation })
const signedDelegation = { ...delegation, signature }
import { createExecution, ExecutionMode } from '@metamask/smart-accounts-kit'
import { DelegationManager } from '@metamask/smart-accounts-kit/contracts'
import { encodeFunctionData, erc20Abi } from 'viem'
const callData = encodeFunctionData({
abi: erc20Abi,
args: [recipient, parseUnits('1', 6)],
functionName: 'transfer',
})
const execution = createExecution({ target: tokenAddress, callData })
const redeemCalldata = DelegationManager.encode.redeemDelegations({
delegations: [[signedDelegation]],
modes: [ExecutionMode.SingleDefault],
executions: [[execution]],
})
// Via smart account
const userOpHash = await bundlerClient.sendUserOperation({
account: delegateSmartAccount,
calls: [{ to: delegateSmartAccount.address, data: redeemCalldata }],
})
// Via EOA
const txHash = await delegateWalletClient.sendTransaction({
to: environment.DelegationManager,
data: redeemCalldata,
})
import { erc7715ProviderActions } from '@metamask/smart-accounts-kit/actions'
const walletClient = createWalletClient({
transport: custom(window.ethereum),
}).extend(erc7715ProviderActions())
const grantedPermissions = await walletClient.requestExecutionPermissions([
{
chainId: chain.id,
expiry: now + 604800,
signer: {
type: 'account',
data: { address: sessionAccount.address },
},
permission: {
type: 'erc20-token-periodic',
data: {
tokenAddress,
periodAmount: parseUnits('10', 6),
periodDuration: 86400,
justification: 'Transfer 10 USDC daily',
},
},
isAdjustmentAllowed: true,
},
])
// Smart account
import { erc7710BundlerActions } from '@metamask/smart-accounts-kit/actions'
const bundlerClient = createBundlerClient({
client: publicClient,
transport: http(bundlerUrl),
}).extend(erc7710BundlerActions())
const permissionsContext = grantedPermissions[0].context
const delegationManager = grantedPermissions[0].signerMeta.delegationManager
const userOpHash = await bundlerClient.sendUserOperationWithDelegation({
publicClient,
account: sessionAccount,
calls: [
{
to: tokenAddress,
data: calldata,
permissionsContext,
delegationManager,
},
],
})
// EOA
import { erc7710WalletActions } from '@metamask/smart-accounts-kit/actions'
const walletClient = createWalletClient({
account: sessionAccount,
chain,
transport: http(),
}).extend(erc7710WalletActions())
const txHash = await walletClient.sendTransactionWithDelegation({
to: tokenAddress,
data: calldata,
permissionsContext,
delegationManager,
})
toMetaMaskSmartAccount() - Create smart accountaggregateSignature() - Combine multisig signaturessignDelegation() - Sign delegationsignUserOperation() - Sign user operationsignMessage() / signTypedData() - Standard signingcreateDelegation() - Create delegation with delegatecreateOpenDelegation() - Create open delegationcreateCaveatBuilder() - Build caveats arraycreateExecution() - Create execution structredeemDelegations() - Encode redemption calldatasignDelegation() - Sign with private keygetSmartAccountsEnvironment() - Resolve environmentdeploySmartAccountsEnvironment() - Deploy contractsoverrideDeployedEnvironment() - Override environmenterc7715ProviderActions() - Wallet client extension for requestingrequestExecutionPermissions() - Request permissionserc7710BundlerActions() - Bundler client extensionsendUserOperationWithDelegation() - Redeem with smart accounterc7710WalletActions() - Wallet client extensionsendTransactionWithDelegation() - Redeem with EOA| Permission Type | Description | |----------------|-------------| | erc20-token-periodic | Per-period limit that resets at each period | | erc20-token-streaming | Linear streaming with amountPerSecond rate |
| Permission Type | Description | |----------------|-------------| | native-token-periodic | Per-period ETH limit that resets | | native-token-streaming | Linear ETH streaming with amountPerSecond rate |
...
安装 MetaMask Smart Accounts KIt 后,可以对 AI 说这些话来触发它
Help me get started with MetaMask Smart Accounts KIt
Explains what MetaMask Smart Accounts KIt does, walks through the setup, and runs a quick demo based on your current project
Use MetaMask Smart Accounts KIt to web3 development using MetaMask Smart Accounts Kit
Invokes MetaMask Smart Accounts KIt with the right parameters and returns the result directly in the conversation
What can I do with MetaMask Smart Accounts KIt in my developer & devops workflow?
Lists the top use cases for MetaMask Smart Accounts KIt, with example commands for each scenario
将技能文件夹放到 ~/.claude/skills/metamask-smart-accounts-kit/ 目录(个人级,所有项目可用),或 .claude/skills/metamask-smart-accounts-kit/(项目级)。重启 AI 客户端后,用 /metamask-smart-accounts-kit 主动调用,或让 AI 根据上下文自动发现并使用。
MetaMask Smart Accounts KIt 支持 Claude、Cursor、OpenClaw,可与这些 AI 平台无缝集成,扩展其能力。
MetaMask 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.
Automate my developer & devops tasks using MetaMask Smart Accounts KIt
Identifies repetitive steps in your workflow and sets up MetaMask Smart Accounts KIt to handle them automatically
MetaMask Smart Accounts KIt 属于「Developer & DevOps」分类,该分类的技能帮助 AI 智能体在此领域执行专业任务。