{
  "schemaVersion": "1.0",
  "item": {
    "slug": "smart-accounts-kit",
    "name": "MetaMask Smart Accounts KIt",
    "source": "tencent",
    "type": "skill",
    "category": "AI 智能",
    "sourceUrl": "https://clawhub.ai/AyushBherwani1998/smart-accounts-kit",
    "canonicalUrl": "https://clawhub.ai/AyushBherwani1998/smart-accounts-kit",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/smart-accounts-kit",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=smart-accounts-kit",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "SKILL.md",
      "references/advanced-permissions.md",
      "references/delegations.md",
      "references/smart-accounts.md"
    ],
    "primaryDoc": "SKILL.md",
    "quickSetup": [
      "Download the package from Yavira.",
      "Extract the archive and review SKILL.md first.",
      "Import or place the package into your OpenClaw setup."
    ],
    "agentAssist": {
      "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
      "steps": [
        "Download the package from Yavira.",
        "Extract it into a folder your agent can access.",
        "Paste one of the prompts below and point your agent at the extracted folder."
      ],
      "prompts": [
        {
          "label": "New install",
          "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
        },
        {
          "label": "Upgrade existing",
          "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
        }
      ]
    },
    "sourceHealth": {
      "source": "tencent",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-04-30T16:55:25.780Z",
      "expiresAt": "2026-05-07T16:55:25.780Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
        "contentDisposition": "attachment; filename=\"network-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null
      },
      "scope": "source",
      "summary": "Source download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this source.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/smart-accounts-kit"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    },
    "downloadPageUrl": "https://openagent3.xyz/downloads/smart-accounts-kit",
    "agentPageUrl": "https://openagent3.xyz/skills/smart-accounts-kit/agent",
    "manifestUrl": "https://openagent3.xyz/skills/smart-accounts-kit/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/smart-accounts-kit/agent.md"
  },
  "agentAssist": {
    "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
    "steps": [
      "Download the package from Yavira.",
      "Extract it into a folder your agent can access.",
      "Paste one of the prompts below and point your agent at the extracted folder."
    ],
    "prompts": [
      {
        "label": "New install",
        "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
      },
      {
        "label": "Upgrade existing",
        "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "Quick Reference",
        "body": "This skill file provides quick access to the MetaMask Smart Accounts Kit v0.3.0. For detailed information, refer to the specific reference files.\n\n📚 Detailed References:\n\nSmart Accounts Reference - Account creation, implementations, signers\nDelegations Reference - Delegation lifecycle, scopes, caveats\nAdvanced Permissions Reference - ERC-7715 permissions via MetaMask"
      },
      {
        "title": "Package Installation",
        "body": "npm install @metamask/smart-accounts-kit@0.3.0\n\nFor custom caveat enforcers:\n\nforge install metamask/delegation-framework@v1.3.0"
      },
      {
        "title": "1. Smart Accounts (ERC-4337)",
        "body": "Three implementation types:\n\nImplementationBest ForKey FeatureHybrid (Implementation.Hybrid)Standard dApp usersEOA + passkey signers, most flexibleMultiSig (Implementation.MultiSig)Treasury/DAO operationsThreshold-based security, Safe-compatibleStateless7702 (Implementation.Stateless7702)Power users with existing EOAKeep same address, add smart account features via EIP-7702\n\nDecision Guide:\n\nBuilding for general users? → Hybrid\nManaging treasuries or multi-party control? → MultiSig\nUpgrading existing EOAs without address change? → Stateless7702"
      },
      {
        "title": "2. Delegation Framework (ERC-7710)",
        "body": "Grant permissions from delegator to delegate:\n\nScopes - Initial authority (spending limits, function calls)\nCaveats - Restrictions enforced by smart contracts\nTypes - Root, open root, redelegation, open redelegation\nLifecycle - Create → Sign → Store → Redeem"
      },
      {
        "title": "3. Advanced Permissions (ERC-7715)",
        "body": "Request permissions via MetaMask extension:\n\nHuman-readable UI confirmations\nERC-20 and native token permissions\nRequires MetaMask Flask 13.5.0+\nUser must have smart account"
      },
      {
        "title": "Create Smart Account",
        "body": "import { Implementation, toMetaMaskSmartAccount } from '@metamask/smart-accounts-kit'\nimport { privateKeyToAccount } from 'viem/accounts'\n\nconst account = privateKeyToAccount('0x...')\n\nconst smartAccount = await toMetaMaskSmartAccount({\n  client: publicClient,\n  implementation: Implementation.Hybrid,\n  deployParams: [account.address, [], [], []],\n  deploySalt: '0x',\n  signer: { account },\n})"
      },
      {
        "title": "Create Delegation",
        "body": "import { createDelegation } from '@metamask/smart-accounts-kit'\nimport { parseUnits } from 'viem'\n\nconst delegation = createDelegation({\n  to: delegateAddress,\n  from: delegatorSmartAccount.address,\n  environment: delegatorSmartAccount.environment,\n  scope: {\n    type: 'erc20TransferAmount',\n    tokenAddress: '0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238',\n    maxAmount: parseUnits('10', 6),\n  },\n  caveats: [\n    { type: 'timestamp', afterThreshold: now, beforeThreshold: expiry },\n    { type: 'limitedCalls', limit: 5 },\n  ],\n})"
      },
      {
        "title": "Sign Delegation",
        "body": "const signature = await smartAccount.signDelegation({ delegation })\nconst signedDelegation = { ...delegation, signature }"
      },
      {
        "title": "Redeem Delegation",
        "body": "import { createExecution, ExecutionMode } from '@metamask/smart-accounts-kit'\nimport { DelegationManager } from '@metamask/smart-accounts-kit/contracts'\nimport { encodeFunctionData, erc20Abi } from 'viem'\n\nconst callData = encodeFunctionData({\n  abi: erc20Abi,\n  args: [recipient, parseUnits('1', 6)],\n  functionName: 'transfer',\n})\n\nconst execution = createExecution({ target: tokenAddress, callData })\n\nconst redeemCalldata = DelegationManager.encode.redeemDelegations({\n  delegations: [[signedDelegation]],\n  modes: [ExecutionMode.SingleDefault],\n  executions: [[execution]],\n})\n\n// Via smart account\nconst userOpHash = await bundlerClient.sendUserOperation({\n  account: delegateSmartAccount,\n  calls: [{ to: delegateSmartAccount.address, data: redeemCalldata }],\n})\n\n// Via EOA\nconst txHash = await delegateWalletClient.sendTransaction({\n  to: environment.DelegationManager,\n  data: redeemCalldata,\n})"
      },
      {
        "title": "Request Advanced Permissions",
        "body": "import { erc7715ProviderActions } from '@metamask/smart-accounts-kit/actions'\n\nconst walletClient = createWalletClient({\n  transport: custom(window.ethereum),\n}).extend(erc7715ProviderActions())\n\nconst grantedPermissions = await walletClient.requestExecutionPermissions([\n  {\n    chainId: chain.id,\n    expiry: now + 604800,\n    signer: {\n      type: 'account',\n      data: { address: sessionAccount.address },\n    },\n    permission: {\n      type: 'erc20-token-periodic',\n      data: {\n        tokenAddress,\n        periodAmount: parseUnits('10', 6),\n        periodDuration: 86400,\n        justification: 'Transfer 10 USDC daily',\n      },\n    },\n    isAdjustmentAllowed: true,\n  },\n])"
      },
      {
        "title": "Redeem Advanced Permissions",
        "body": "// Smart account\nimport { erc7710BundlerActions } from '@metamask/smart-accounts-kit/actions'\n\nconst bundlerClient = createBundlerClient({\n  client: publicClient,\n  transport: http(bundlerUrl),\n}).extend(erc7710BundlerActions())\n\nconst permissionsContext = grantedPermissions[0].context\nconst delegationManager = grantedPermissions[0].signerMeta.delegationManager\n\nconst userOpHash = await bundlerClient.sendUserOperationWithDelegation({\n  publicClient,\n  account: sessionAccount,\n  calls: [\n    {\n      to: tokenAddress,\n      data: calldata,\n      permissionsContext,\n      delegationManager,\n    },\n  ],\n})\n\n// EOA\nimport { erc7710WalletActions } from '@metamask/smart-accounts-kit/actions'\n\nconst walletClient = createWalletClient({\n  account: sessionAccount,\n  chain,\n  transport: http(),\n}).extend(erc7710WalletActions())\n\nconst txHash = await walletClient.sendTransactionWithDelegation({\n  to: tokenAddress,\n  data: calldata,\n  permissionsContext,\n  delegationManager,\n})"
      },
      {
        "title": "Smart Accounts",
        "body": "toMetaMaskSmartAccount() - Create smart account\naggregateSignature() - Combine multisig signatures\nsignDelegation() - Sign delegation\nsignUserOperation() - Sign user operation\nsignMessage() / signTypedData() - Standard signing"
      },
      {
        "title": "Delegations",
        "body": "createDelegation() - Create delegation with delegate\ncreateOpenDelegation() - Create open delegation\ncreateCaveatBuilder() - Build caveats array\ncreateExecution() - Create execution struct\nredeemDelegations() - Encode redemption calldata\nsignDelegation() - Sign with private key\ngetSmartAccountsEnvironment() - Resolve environment\ndeploySmartAccountsEnvironment() - Deploy contracts\noverrideDeployedEnvironment() - Override environment"
      },
      {
        "title": "Advanced Permissions",
        "body": "erc7715ProviderActions() - Wallet client extension for requesting\nrequestExecutionPermissions() - Request permissions\nerc7710BundlerActions() - Bundler client extension\nsendUserOperationWithDelegation() - Redeem with smart account\nerc7710WalletActions() - Wallet client extension\nsendTransactionWithDelegation() - Redeem with EOA"
      },
      {
        "title": "ERC-20 Token Permissions",
        "body": "Permission TypeDescriptionerc20-token-periodicPer-period limit that resets at each perioderc20-token-streamLinear streaming with amountPerSecond rate"
      },
      {
        "title": "Native Token Permissions",
        "body": "Permission TypeDescriptionnative-token-periodicPer-period ETH limit that resetsnative-token-streamLinear ETH streaming with amountPerSecond rate"
      },
      {
        "title": "Spending Limits",
        "body": "ScopeDescriptionerc20TransferAmountFixed ERC-20 limiterc20PeriodTransferPer-period ERC-20 limiterc20StreamingLinear streaming ERC-20nativeTokenTransferAmountFixed native token limitnativeTokenPeriodTransferPer-period native token limitnativeTokenStreamingLinear streaming nativeerc721TransferERC-721 (NFT) transfer"
      },
      {
        "title": "Function Calls",
        "body": "ScopeDescriptionfunctionCallSpecific methods/addresses allowedownershipTransferOwnership transfers only"
      },
      {
        "title": "Target & Method",
        "body": "allowedTargets - Limit callable addresses\nallowedMethods - Limit callable methods\nallowedCalldata - Validate specific calldata\nexactCalldata / exactCalldataBatch - Exact calldata match\nexactExecution / exactExecutionBatch - Exact execution match"
      },
      {
        "title": "Value & Token",
        "body": "valueLte - Limit native token value\nerc20TransferAmount - Limit ERC-20 amount\nerc20BalanceChange - Validate ERC-20 balance change\nerc721Transfer / erc721BalanceChange - ERC-721 restrictions\nerc1155BalanceChange - ERC-1155 validation"
      },
      {
        "title": "Time & Frequency",
        "body": "timestamp - Valid time range (seconds)\nblockNumber - Valid block range\nlimitedCalls - Limit redemption count\nerc20PeriodTransfer / erc20Streaming - Time-based ERC-20\nnativeTokenPeriodTransfer / nativeTokenStreaming - Time-based native"
      },
      {
        "title": "Security & State",
        "body": "redeemer - Limit redemption to specific addresses\nid - One-time delegation with ID\nnonce - Bulk revocation via nonce\ndeployed - Auto-deploy contract\nownershipTransfer - Ownership transfer only\nnativeTokenPayment - Require payment\nnativeBalanceChange - Validate native balance\nmultiTokenPeriod - Multi-token period limits"
      },
      {
        "title": "Execution Modes",
        "body": "ModeChainsProcessingOn FailureSingleDefaultOneSequentialRevertSingleTryOneSequentialContinueBatchDefaultMultipleInterleavedRevertBatchTryMultipleInterleavedContinue"
      },
      {
        "title": "Core",
        "body": "ContractAddressEntryPoint0x0000000071727De22E5E9d8BAf0edAc6f37da032SimpleFactory0x69Aa2f9fe1572F1B640E1bbc512f5c3a734fc77cDelegationManager0xdb9B1e94B5b69Df7e401DDbedE43491141047dB3MultiSigDeleGatorImpl0x56a9EdB16a0105eb5a4C54f4C062e2868844f3A7HybridDeleGatorImpl0x48dBe696A4D990079e039489bA2053B36E8FFEC4"
      },
      {
        "title": "Always Required",
        "body": "Always use caveats - Never create unrestricted delegations\nDeploy delegator first - Account must be deployed before redeeming\nCheck smart account status - ERC-7715 requires user has smart account"
      },
      {
        "title": "Behavior",
        "body": "Caveats are cumulative - In delegation chains, restrictions stack\nFunction call default - v0.3.0 defaults to NO native token (use valueLte)\nBatch mode caveat - No compatible caveat enforcers available"
      },
      {
        "title": "Requirements",
        "body": "ERC-7715 requirements - MetaMask Flask 13.5.0+, smart account\nMultisig threshold - Need at least threshold signers\n7702 upgrade - Stateless7702 requires EIP-7702 upgrade first"
      },
      {
        "title": "Parallel User Operations (Nonce Keys)",
        "body": "Smart accounts use a 256-bit nonce structure: 192-bit key + 64-bit sequence. Each unique key has its own independent sequence, enabling parallel execution. This is critical for backend services processing multiple delegations concurrently.\n\nInstallation\n\nFor proper nonce handling, install the permissionless SDK alongside the Smart Accounts Kit:\n\nnpm install permissionless\n\nHow Parallel Nonces Work\n\nERC-4337 uses a single uint256 nonce where:\n\n192 bits = key identifier (allows parallel streams)\n64 bits = sequence number (increments per key)\n\nEach key has an independent sequence, so UserOps with different keys execute in parallel without ordering constraints.\n\nGetting Nonce with Permissionless\n\nimport { getAccountNonce } from 'permissionless'\nimport { entryPoint07Address } from 'viem/account-abstraction'\n\n// Get nonce for a specific key\nconst parallelNonce = await getAccountNonce(publicClient, {\n  address: smartAccount.address,\n  entryPointAddress: entryPoint07Address,\n  key: BigInt(Date.now()), // Unique key for parallel execution\n})\n\nconst userOpHash = await bundlerClient.sendUserOperation({\n  account: smartAccount,\n  calls: [redeemCalldata],\n  nonce: parallelNonce, // Properly encoded 256-bit nonce\n})\n\nParallel Execution Pattern\n\nimport { getAccountNonce } from 'permissionless'\nimport { entryPoint07Address } from 'viem/account-abstraction'\n\n// Execute multiple redemption UserOps in parallel\nconst redeems = await Promise.all(\n  delegations.map(async (delegation, index) => {\n    // Generate unique key for this operation\n    const nonceKey = BigInt(Date.now()) + BigInt(index * 1000)\n    \n    // Get properly encoded nonce for this key\n    const nonce = await getAccountNonce(publicClient, {\n      address: backendSmartAccount.address,\n      entryPointAddress: entryPoint07Address,\n      key: nonceKey,\n    })\n    \n    const redeemCalldata = DelegationManager.encode.redeemDelegations({\n      delegations: [[delegation]],\n      modes: [ExecutionMode.SingleDefault],\n      executions: [[execution]],\n    })\n    \n    return bundlerClient.sendUserOperation({\n      account: backendSmartAccount,\n      calls: [{ to: backendSmartAccount.address, data: redeemCalldata }],\n      nonce, // Parallel execution enabled via unique key\n    })\n  })\n)\n\nWithout Permissionless (Manual Approach)\n\nThe EntryPoint contract encodes nonce as: sequence | (key << 64)\n\nIf not using permissionless, encode manually:\n\n// EntryPoint: nonceSequenceNumber[sender][key] | (uint256(key) << 64)\nconst key = BigInt(Date.now())\nconst sequence = 0n // New key starts at sequence 0\nconst nonce = sequence | (key << 64n)\n// Or equivalently: (key << 64n) | sequence\n\nHowever, getAccountNonce from permissionless is recommended as it:\n\nFetches the current sequence for the key from the EntryPoint\nProperly encodes the 256-bit value\nHandles edge cases and validation\n\nKey Points\n\nDifferent keys = parallel execution — no ordering guarantees between different keys\nSame key = sequential execution — sequence increments monotonically per key\nUse cases: Backend redemption services, DCA apps, high-frequency trading, batch operations\nNonce generation: getAccountNonce returns the full 256-bit nonce properly encoded\n\nCommon Mistakes\n\nMistakeResultReusing same nonce keySequential execution (defeats purpose)Using Date.now() without offsetPotential collision if multiple ops fire simultaneouslyNot using getAccountNonceMay miss current sequence, causing replacement instead of new opAssuming orderingRace conditions in dependent operations\n\nError Handling\n\nconst results = await Promise.allSettled(redeems)\n\nresults.forEach((result, index) => {\n  if (result.status === 'rejected') {\n    // Check for specific errors\n    if (result.reason.message?.includes('AA25')) {\n      console.error(`Nonce collision for op ${index}`)\n    }\n    // Handle or retry\n  }\n})"
      },
      {
        "title": "Backend Delegation Redemption",
        "body": "For server-side automation (DCA bots, keeper services, automated trading):\n\n// 1. Backend creates its own smart account as delegate\nconst backendAccount = await toMetaMaskSmartAccount({\n  client: publicClient,\n  implementation: Implementation.Hybrid,\n  deployParams: [backendOwner.address, [], [], []],\n  deploySalt: '0x',\n  signer: { account: backendOwner },\n})\n\n// 2. Backend redeems by sending UserOp FROM its account\nconst userOpHash = await bundlerClient.sendUserOperation({\n  account: backendAccount,\n  calls: [{\n    to: backendAccount.address,\n    data: DelegationManager.encode.redeemDelegations({\n      delegations: [[userDelegation]],\n      modes: [ExecutionMode.SingleDefault],\n      executions: [[swapExecution]],\n    })\n  }],\n})\n\nUse case: Automated dollar-cost averaging (DCA) bots that redeem swap delegations based on market signals or scheduled intervals."
      },
      {
        "title": "Counterfactual Account Deployment",
        "body": "Delegator accounts must be deployed before delegations can be redeemed. The DelegationManager reverts with 0xb9f0f171 for counterfactual accounts.\n\nSolution: Deploy automatically via first UserOp:\n\n// Build redemption calldata\nconst redeemCalldata = DelegationManager.encode.redeemDelegations({\n  delegations: [[signedDelegation]],\n  modes: [ExecutionMode.SingleDefault],\n  executions: [[execution]],\n})\n\n// First redemption deploys the account automatically via initCode\nconst userOpHash = await bundlerClient.sendUserOperation({\n  account: smartAccount, // Will deploy if counterfactual\n  calls: [{\n    to: smartAccount.address,\n    data: redeemCalldata,\n    value: 0n,\n  }],\n})"
      },
      {
        "title": "Session Accounts for AI Agents",
        "body": "For automated services, session accounts act as isolated signers that can only operate within granted delegations. The private key can be generated ephemerally, stored in environment variables, or managed via HSM/server wallets:\n\n// Session account created from various sources\nconst sessionAccount = privateKeyToAccount(\n  process.env.SESSION_KEY || generatePrivateKey() || hsmWallet.key\n)\n\n// Request delegation from user to session account\nconst delegation = createDelegation({\n  to: sessionAccount.address,\n  from: userSmartAccount.address,\n  environment,\n  scope: { type: 'erc20TransferAmount', tokenAddress, maxAmount: parseUnits('100', 6) },\n  caveats: [\n    { type: 'timestamp', afterThreshold: now, beforeThreshold: expiry },\n    { type: 'limitedCalls', limit: 10 },\n  ],\n})\n// Session account can only act within delegation constraints"
      },
      {
        "title": "Pattern 1: ERC-20 with Time Limit",
        "body": "const delegation = createDelegation({\n  to: delegate,\n  from: delegator,\n  environment,\n  scope: {\n    type: 'erc20TransferAmount',\n    tokenAddress,\n    maxAmount: parseUnits('100', 6),\n  },\n  caveats: [\n    { type: 'timestamp', afterThreshold: now, beforeThreshold: expiry },\n    { type: 'limitedCalls', limit: 10 },\n    { type: 'redeemer', redeemers: [delegate] },\n  ],\n})"
      },
      {
        "title": "Pattern 2: Function Call with Value",
        "body": "const delegation = createDelegation({\n  to: delegate,\n  from: delegator,\n  environment,\n  scope: {\n    type: 'functionCall',\n    targets: [contractAddress],\n    selectors: ['transfer(address,uint256)'],\n    valueLte: { maxValue: parseEther('0.1') },\n  },\n  caveats: [{ type: 'allowedMethods', selectors: ['transfer(address,uint256)'] }],\n})"
      },
      {
        "title": "Pattern 3: Periodic Native Token",
        "body": "const delegation = createDelegation({\n  to: delegate,\n  from: delegator,\n  environment,\n  scope: {\n    type: 'nativeTokenPeriodTransfer',\n    periodAmount: parseEther('0.01'),\n    periodDuration: 86400,\n    startDate: now,\n  },\n})"
      },
      {
        "title": "Pattern 4: Redelegation Chain",
        "body": "// Alice → Bob (100 USDC)\nconst aliceToBob = createDelegation({\n  to: bob,\n  from: alice,\n  environment,\n  scope: { type: 'erc20TransferAmount', tokenAddress, maxAmount: parseUnits('100', 6) },\n})\n\n// Bob → Carol (50 USDC, subset of authority)\nconst bobToCarol = createDelegation({\n  to: carol,\n  from: bob,\n  environment,\n  scope: { type: 'erc20TransferAmount', tokenAddress, maxAmount: parseUnits('50', 6) },\n  parentDelegation: aliceToBob,\n  caveats: [{ type: 'timestamp', afterThreshold: now, beforeThreshold: expiry }],\n})"
      },
      {
        "title": "Troubleshooting Quick Fixes",
        "body": "IssueSolutionAccount not deployedUse bundlerClient.sendUserOperation() to deployInvalid signatureVerify chain ID, delegation manager, signer permissionsCaveat enforcer revertedCheck caveat parameters match execution, verify orderRedemption failedCheck delegator balance, calldata validity, target contractsERC-7715 not workingUpgrade to Flask 13.5.0+, ensure user has smart accountPermission deniedHandle gracefully, provide manual fallbackThreshold not metAdd more signers for multisig7702 not workingConfirm EOA upgraded via EIP-7702 first"
      },
      {
        "title": "Error Code Reference",
        "body": "Error codes from the MetaMask Delegation Framework contracts (v1.3.0). Use a decoder like calldata.swiss-knife.xyz to identify error signatures."
      },
      {
        "title": "DelegationManager Errors (Verified)",
        "body": "Error CodeError NameMeaning0xb5863604InvalidDelegate()Caller is not the delegate — Most common error0xb9f0f171InvalidDelegator()Caller is not the delegator0x05baa052CannotUseADisabledDelegation()Attempting to redeem a disabled delegation0xded4370eInvalidAuthority()Delegation chain authority validation failed0x1bcaf69fBatchDataLengthMismatch()Array lengths don't match in batch0x005ecddbAlreadyDisabled()Delegation has already been disabled0xf2a5f75aAlreadyEnabled()Delegation is already enabled0xf645eedfECDSAInvalidSignature()Invalid ECDSA signature format0xfce698f7ECDSAInvalidSignatureLength(uint256)Signature length is incorrect0xd78bce0cECDSAInvalidSignatureS(bytes32)Signature S value is invalid0xac241e11EmptySignature()Signature is empty0xd93c0665EnforcedPause()Contract is paused0x3db6791cInvalidEOASignature()EOA signature verification failed0x155ff427InvalidERC1271Signature()Smart contract signature (ERC1271) failed0x118cdaa7OwnableUnauthorizedAccount(address)Unauthorized account attempted owner-only action0x1e4fbdf7OwnableInvalidOwner(address)Invalid owner address in ownership transfer0xf6b6ef5bInvalidShortString()String parameter too short0xaa0ea2d8StringTooLong(string)String parameter exceeds maximum length"
      },
      {
        "title": "DeleGatorCore Errors (Verified)",
        "body": "Error CodeError NameMeaning0xd663742aNotEntryPoint()Caller is not the EntryPoint contract0x0796d945NotEntryPointOrSelf()Caller is neither EntryPoint nor this contract0x1a4b3a04NotDelegationManager()Caller is not the DelegationManager0xb96fcfe4UnsupportedCallType(bytes1)Execution call type not supported0x1187dc06UnsupportedExecType(bytes1)Execution type not supported0x29c3b7eeNotSelf()Caller is not this contract itself"
      },
      {
        "title": "Common Caveat Enforcer Errors (Revert Strings)",
        "body": "Error StringMeaningAllowedTargetsEnforcer:target-address-not-allowedTarget contract not in allowed listAllowedTargetsEnforcer:invalid-terms-lengthTerms length not multiple of 20 bytesERC20TransferAmountEnforcer:invalid-terms-lengthTerms must be 52 bytesERC20TransferAmountEnforcer:invalid-contractTarget doesn't match allowed tokenERC20TransferAmountEnforcer:invalid-methodMethod is not transferERC20TransferAmountEnforcer:allowance-exceededTransfer exceeds delegated limitCaveatEnforcer:invalid-call-typeMust use single call typeCaveatEnforcer:invalid-execution-typeMust use default execution type"
      },
      {
        "title": "Most Common Errors in Production",
        "body": "0xb5863604 — InvalidDelegate()\n\nCause: Caller doesn't match the delegate address in delegation\nFix: Verify msg.sender equals the to address in the delegation\n\n0xb9f0f171 — InvalidDelegator()\n\nCause: Attempting to enable/disable from wrong address, or counterfactual account\nFix: Only delegator can enable/disable; for counterfactual, first UserOp auto-deploys\n\n0x05baa052 — CannotUseADisabledDelegation()\n\nCause: Delegation was disabled by delegator\nFix: Ask delegator to re-enable, or use different delegation\n\n0xded4370e — InvalidAuthority()\n\nCause: Broken delegation chain (redelegation parent mismatch)\nFix: Ensure redelegation chains are properly ordered (leaf → root)\n\n0x1bcaf69f — BatchDataLengthMismatch()\n\nCause: Array lengths don't match in redeemDelegations call\nFix: Ensure permissionContexts, modes, executionCallDatas have equal length\n\n0x3db6791c — InvalidEOASignature()\n\nCause: EOA signature invalid, wrong chain, or wrong delegation manager\nFix: Verify signature was created with correct chain ID and delegation manager"
      },
      {
        "title": "Resources",
        "body": "NPM: @metamask/smart-accounts-kit\nContracts: metamask/delegation-framework@v1.3.0\nERC Standards: ERC-4337, ERC-7710, ERC-7715, ERC-7579\nMetaMask Flask: https://metamask.io/flask"
      },
      {
        "title": "Version Info",
        "body": "Toolkit: 0.3.0\nDelegation Framework: 1.3.0\nBreaking Change: Function call scope defaults to no native token transfer\n\nFor detailed documentation, see the reference files in the /references directory."
      }
    ],
    "body": "Quick Reference\n\nThis skill file provides quick access to the MetaMask Smart Accounts Kit v0.3.0. For detailed information, refer to the specific reference files.\n\n📚 Detailed References:\n\nSmart Accounts Reference - Account creation, implementations, signers\nDelegations Reference - Delegation lifecycle, scopes, caveats\nAdvanced Permissions Reference - ERC-7715 permissions via MetaMask\nPackage Installation\nnpm install @metamask/smart-accounts-kit@0.3.0\n\n\nFor custom caveat enforcers:\n\nforge install metamask/delegation-framework@v1.3.0\n\nCore Concepts Summary\n1. Smart Accounts (ERC-4337)\n\nThree implementation types:\n\nImplementation\tBest For\tKey Feature\nHybrid (Implementation.Hybrid)\tStandard dApp users\tEOA + passkey signers, most flexible\nMultiSig (Implementation.MultiSig)\tTreasury/DAO operations\tThreshold-based security, Safe-compatible\nStateless7702 (Implementation.Stateless7702)\tPower users with existing EOA\tKeep same address, add smart account features via EIP-7702\n\nDecision Guide:\n\nBuilding for general users? → Hybrid\nManaging treasuries or multi-party control? → MultiSig\nUpgrading existing EOAs without address change? → Stateless7702\n2. Delegation Framework (ERC-7710)\n\nGrant permissions from delegator to delegate:\n\nScopes - Initial authority (spending limits, function calls)\nCaveats - Restrictions enforced by smart contracts\nTypes - Root, open root, redelegation, open redelegation\nLifecycle - Create → Sign → Store → Redeem\n3. Advanced Permissions (ERC-7715)\n\nRequest permissions via MetaMask extension:\n\nHuman-readable UI confirmations\nERC-20 and native token permissions\nRequires MetaMask Flask 13.5.0+\nUser must have smart account\nQuick Code Examples\nCreate Smart Account\nimport { Implementation, toMetaMaskSmartAccount } from '@metamask/smart-accounts-kit'\nimport { privateKeyToAccount } from 'viem/accounts'\n\nconst account = privateKeyToAccount('0x...')\n\nconst smartAccount = await toMetaMaskSmartAccount({\n  client: publicClient,\n  implementation: Implementation.Hybrid,\n  deployParams: [account.address, [], [], []],\n  deploySalt: '0x',\n  signer: { account },\n})\n\nCreate Delegation\nimport { createDelegation } from '@metamask/smart-accounts-kit'\nimport { parseUnits } from 'viem'\n\nconst delegation = createDelegation({\n  to: delegateAddress,\n  from: delegatorSmartAccount.address,\n  environment: delegatorSmartAccount.environment,\n  scope: {\n    type: 'erc20TransferAmount',\n    tokenAddress: '0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238',\n    maxAmount: parseUnits('10', 6),\n  },\n  caveats: [\n    { type: 'timestamp', afterThreshold: now, beforeThreshold: expiry },\n    { type: 'limitedCalls', limit: 5 },\n  ],\n})\n\nSign Delegation\nconst signature = await smartAccount.signDelegation({ delegation })\nconst signedDelegation = { ...delegation, signature }\n\nRedeem Delegation\nimport { createExecution, ExecutionMode } from '@metamask/smart-accounts-kit'\nimport { DelegationManager } from '@metamask/smart-accounts-kit/contracts'\nimport { encodeFunctionData, erc20Abi } from 'viem'\n\nconst callData = encodeFunctionData({\n  abi: erc20Abi,\n  args: [recipient, parseUnits('1', 6)],\n  functionName: 'transfer',\n})\n\nconst execution = createExecution({ target: tokenAddress, callData })\n\nconst redeemCalldata = DelegationManager.encode.redeemDelegations({\n  delegations: [[signedDelegation]],\n  modes: [ExecutionMode.SingleDefault],\n  executions: [[execution]],\n})\n\n// Via smart account\nconst userOpHash = await bundlerClient.sendUserOperation({\n  account: delegateSmartAccount,\n  calls: [{ to: delegateSmartAccount.address, data: redeemCalldata }],\n})\n\n// Via EOA\nconst txHash = await delegateWalletClient.sendTransaction({\n  to: environment.DelegationManager,\n  data: redeemCalldata,\n})\n\nRequest Advanced Permissions\nimport { erc7715ProviderActions } from '@metamask/smart-accounts-kit/actions'\n\nconst walletClient = createWalletClient({\n  transport: custom(window.ethereum),\n}).extend(erc7715ProviderActions())\n\nconst grantedPermissions = await walletClient.requestExecutionPermissions([\n  {\n    chainId: chain.id,\n    expiry: now + 604800,\n    signer: {\n      type: 'account',\n      data: { address: sessionAccount.address },\n    },\n    permission: {\n      type: 'erc20-token-periodic',\n      data: {\n        tokenAddress,\n        periodAmount: parseUnits('10', 6),\n        periodDuration: 86400,\n        justification: 'Transfer 10 USDC daily',\n      },\n    },\n    isAdjustmentAllowed: true,\n  },\n])\n\nRedeem Advanced Permissions\n// Smart account\nimport { erc7710BundlerActions } from '@metamask/smart-accounts-kit/actions'\n\nconst bundlerClient = createBundlerClient({\n  client: publicClient,\n  transport: http(bundlerUrl),\n}).extend(erc7710BundlerActions())\n\nconst permissionsContext = grantedPermissions[0].context\nconst delegationManager = grantedPermissions[0].signerMeta.delegationManager\n\nconst userOpHash = await bundlerClient.sendUserOperationWithDelegation({\n  publicClient,\n  account: sessionAccount,\n  calls: [\n    {\n      to: tokenAddress,\n      data: calldata,\n      permissionsContext,\n      delegationManager,\n    },\n  ],\n})\n\n// EOA\nimport { erc7710WalletActions } from '@metamask/smart-accounts-kit/actions'\n\nconst walletClient = createWalletClient({\n  account: sessionAccount,\n  chain,\n  transport: http(),\n}).extend(erc7710WalletActions())\n\nconst txHash = await walletClient.sendTransactionWithDelegation({\n  to: tokenAddress,\n  data: calldata,\n  permissionsContext,\n  delegationManager,\n})\n\nKey API Methods\nSmart Accounts\ntoMetaMaskSmartAccount() - Create smart account\naggregateSignature() - Combine multisig signatures\nsignDelegation() - Sign delegation\nsignUserOperation() - Sign user operation\nsignMessage() / signTypedData() - Standard signing\nDelegations\ncreateDelegation() - Create delegation with delegate\ncreateOpenDelegation() - Create open delegation\ncreateCaveatBuilder() - Build caveats array\ncreateExecution() - Create execution struct\nredeemDelegations() - Encode redemption calldata\nsignDelegation() - Sign with private key\ngetSmartAccountsEnvironment() - Resolve environment\ndeploySmartAccountsEnvironment() - Deploy contracts\noverrideDeployedEnvironment() - Override environment\nAdvanced Permissions\nerc7715ProviderActions() - Wallet client extension for requesting\nrequestExecutionPermissions() - Request permissions\nerc7710BundlerActions() - Bundler client extension\nsendUserOperationWithDelegation() - Redeem with smart account\nerc7710WalletActions() - Wallet client extension\nsendTransactionWithDelegation() - Redeem with EOA\nSupported ERC-7715 Permission Types\nERC-20 Token Permissions\nPermission Type\tDescription\nerc20-token-periodic\tPer-period limit that resets at each period\nerc20-token-stream\tLinear streaming with amountPerSecond rate\nNative Token Permissions\nPermission Type\tDescription\nnative-token-periodic\tPer-period ETH limit that resets\nnative-token-stream\tLinear ETH streaming with amountPerSecond rate\nCommon Delegation Scopes\nSpending Limits\nScope\tDescription\nerc20TransferAmount\tFixed ERC-20 limit\nerc20PeriodTransfer\tPer-period ERC-20 limit\nerc20Streaming\tLinear streaming ERC-20\nnativeTokenTransferAmount\tFixed native token limit\nnativeTokenPeriodTransfer\tPer-period native token limit\nnativeTokenStreaming\tLinear streaming native\nerc721Transfer\tERC-721 (NFT) transfer\nFunction Calls\nScope\tDescription\nfunctionCall\tSpecific methods/addresses allowed\nownershipTransfer\tOwnership transfers only\nCommon Caveat Enforcers\nTarget & Method\nallowedTargets - Limit callable addresses\nallowedMethods - Limit callable methods\nallowedCalldata - Validate specific calldata\nexactCalldata / exactCalldataBatch - Exact calldata match\nexactExecution / exactExecutionBatch - Exact execution match\nValue & Token\nvalueLte - Limit native token value\nerc20TransferAmount - Limit ERC-20 amount\nerc20BalanceChange - Validate ERC-20 balance change\nerc721Transfer / erc721BalanceChange - ERC-721 restrictions\nerc1155BalanceChange - ERC-1155 validation\nTime & Frequency\ntimestamp - Valid time range (seconds)\nblockNumber - Valid block range\nlimitedCalls - Limit redemption count\nerc20PeriodTransfer / erc20Streaming - Time-based ERC-20\nnativeTokenPeriodTransfer / nativeTokenStreaming - Time-based native\nSecurity & State\nredeemer - Limit redemption to specific addresses\nid - One-time delegation with ID\nnonce - Bulk revocation via nonce\ndeployed - Auto-deploy contract\nownershipTransfer - Ownership transfer only\nnativeTokenPayment - Require payment\nnativeBalanceChange - Validate native balance\nmultiTokenPeriod - Multi-token period limits\nExecution Modes\nMode\tChains\tProcessing\tOn Failure\nSingleDefault\tOne\tSequential\tRevert\nSingleTry\tOne\tSequential\tContinue\nBatchDefault\tMultiple\tInterleaved\tRevert\nBatchTry\tMultiple\tInterleaved\tContinue\nContract Addresses (v1.3.0)\nCore\nContract\tAddress\nEntryPoint\t0x0000000071727De22E5E9d8BAf0edAc6f37da032\nSimpleFactory\t0x69Aa2f9fe1572F1B640E1bbc512f5c3a734fc77c\nDelegationManager\t0xdb9B1e94B5b69Df7e401DDbedE43491141047dB3\nMultiSigDeleGatorImpl\t0x56a9EdB16a0105eb5a4C54f4C062e2868844f3A7\nHybridDeleGatorImpl\t0x48dBe696A4D990079e039489bA2053B36E8FFEC4\nCritical Rules\nAlways Required\nAlways use caveats - Never create unrestricted delegations\nDeploy delegator first - Account must be deployed before redeeming\nCheck smart account status - ERC-7715 requires user has smart account\nBehavior\nCaveats are cumulative - In delegation chains, restrictions stack\nFunction call default - v0.3.0 defaults to NO native token (use valueLte)\nBatch mode caveat - No compatible caveat enforcers available\nRequirements\nERC-7715 requirements - MetaMask Flask 13.5.0+, smart account\nMultisig threshold - Need at least threshold signers\n7702 upgrade - Stateless7702 requires EIP-7702 upgrade first\nAdvanced Patterns\nParallel User Operations (Nonce Keys)\n\nSmart accounts use a 256-bit nonce structure: 192-bit key + 64-bit sequence. Each unique key has its own independent sequence, enabling parallel execution. This is critical for backend services processing multiple delegations concurrently.\n\nInstallation\n\nFor proper nonce handling, install the permissionless SDK alongside the Smart Accounts Kit:\n\nnpm install permissionless\n\nHow Parallel Nonces Work\n\nERC-4337 uses a single uint256 nonce where:\n\n192 bits = key identifier (allows parallel streams)\n64 bits = sequence number (increments per key)\n\nEach key has an independent sequence, so UserOps with different keys execute in parallel without ordering constraints.\n\nGetting Nonce with Permissionless\nimport { getAccountNonce } from 'permissionless'\nimport { entryPoint07Address } from 'viem/account-abstraction'\n\n// Get nonce for a specific key\nconst parallelNonce = await getAccountNonce(publicClient, {\n  address: smartAccount.address,\n  entryPointAddress: entryPoint07Address,\n  key: BigInt(Date.now()), // Unique key for parallel execution\n})\n\nconst userOpHash = await bundlerClient.sendUserOperation({\n  account: smartAccount,\n  calls: [redeemCalldata],\n  nonce: parallelNonce, // Properly encoded 256-bit nonce\n})\n\nParallel Execution Pattern\nimport { getAccountNonce } from 'permissionless'\nimport { entryPoint07Address } from 'viem/account-abstraction'\n\n// Execute multiple redemption UserOps in parallel\nconst redeems = await Promise.all(\n  delegations.map(async (delegation, index) => {\n    // Generate unique key for this operation\n    const nonceKey = BigInt(Date.now()) + BigInt(index * 1000)\n    \n    // Get properly encoded nonce for this key\n    const nonce = await getAccountNonce(publicClient, {\n      address: backendSmartAccount.address,\n      entryPointAddress: entryPoint07Address,\n      key: nonceKey,\n    })\n    \n    const redeemCalldata = DelegationManager.encode.redeemDelegations({\n      delegations: [[delegation]],\n      modes: [ExecutionMode.SingleDefault],\n      executions: [[execution]],\n    })\n    \n    return bundlerClient.sendUserOperation({\n      account: backendSmartAccount,\n      calls: [{ to: backendSmartAccount.address, data: redeemCalldata }],\n      nonce, // Parallel execution enabled via unique key\n    })\n  })\n)\n\nWithout Permissionless (Manual Approach)\n\nThe EntryPoint contract encodes nonce as: sequence | (key << 64)\n\nIf not using permissionless, encode manually:\n\n// EntryPoint: nonceSequenceNumber[sender][key] | (uint256(key) << 64)\nconst key = BigInt(Date.now())\nconst sequence = 0n // New key starts at sequence 0\nconst nonce = sequence | (key << 64n)\n// Or equivalently: (key << 64n) | sequence\n\n\nHowever, getAccountNonce from permissionless is recommended as it:\n\nFetches the current sequence for the key from the EntryPoint\nProperly encodes the 256-bit value\nHandles edge cases and validation\nKey Points\nDifferent keys = parallel execution — no ordering guarantees between different keys\nSame key = sequential execution — sequence increments monotonically per key\nUse cases: Backend redemption services, DCA apps, high-frequency trading, batch operations\nNonce generation: getAccountNonce returns the full 256-bit nonce properly encoded\nCommon Mistakes\nMistake\tResult\nReusing same nonce key\tSequential execution (defeats purpose)\nUsing Date.now() without offset\tPotential collision if multiple ops fire simultaneously\nNot using getAccountNonce\tMay miss current sequence, causing replacement instead of new op\nAssuming ordering\tRace conditions in dependent operations\nError Handling\nconst results = await Promise.allSettled(redeems)\n\nresults.forEach((result, index) => {\n  if (result.status === 'rejected') {\n    // Check for specific errors\n    if (result.reason.message?.includes('AA25')) {\n      console.error(`Nonce collision for op ${index}`)\n    }\n    // Handle or retry\n  }\n})\n\nBackend Delegation Redemption\n\nFor server-side automation (DCA bots, keeper services, automated trading):\n\n// 1. Backend creates its own smart account as delegate\nconst backendAccount = await toMetaMaskSmartAccount({\n  client: publicClient,\n  implementation: Implementation.Hybrid,\n  deployParams: [backendOwner.address, [], [], []],\n  deploySalt: '0x',\n  signer: { account: backendOwner },\n})\n\n// 2. Backend redeems by sending UserOp FROM its account\nconst userOpHash = await bundlerClient.sendUserOperation({\n  account: backendAccount,\n  calls: [{\n    to: backendAccount.address,\n    data: DelegationManager.encode.redeemDelegations({\n      delegations: [[userDelegation]],\n      modes: [ExecutionMode.SingleDefault],\n      executions: [[swapExecution]],\n    })\n  }],\n})\n\n\nUse case: Automated dollar-cost averaging (DCA) bots that redeem swap delegations based on market signals or scheduled intervals.\n\nCounterfactual Account Deployment\n\nDelegator accounts must be deployed before delegations can be redeemed. The DelegationManager reverts with 0xb9f0f171 for counterfactual accounts.\n\nSolution: Deploy automatically via first UserOp:\n\n// Build redemption calldata\nconst redeemCalldata = DelegationManager.encode.redeemDelegations({\n  delegations: [[signedDelegation]],\n  modes: [ExecutionMode.SingleDefault],\n  executions: [[execution]],\n})\n\n// First redemption deploys the account automatically via initCode\nconst userOpHash = await bundlerClient.sendUserOperation({\n  account: smartAccount, // Will deploy if counterfactual\n  calls: [{\n    to: smartAccount.address,\n    data: redeemCalldata,\n    value: 0n,\n  }],\n})\n\nSession Accounts for AI Agents\n\nFor automated services, session accounts act as isolated signers that can only operate within granted delegations. The private key can be generated ephemerally, stored in environment variables, or managed via HSM/server wallets:\n\n// Session account created from various sources\nconst sessionAccount = privateKeyToAccount(\n  process.env.SESSION_KEY || generatePrivateKey() || hsmWallet.key\n)\n\n// Request delegation from user to session account\nconst delegation = createDelegation({\n  to: sessionAccount.address,\n  from: userSmartAccount.address,\n  environment,\n  scope: { type: 'erc20TransferAmount', tokenAddress, maxAmount: parseUnits('100', 6) },\n  caveats: [\n    { type: 'timestamp', afterThreshold: now, beforeThreshold: expiry },\n    { type: 'limitedCalls', limit: 10 },\n  ],\n})\n// Session account can only act within delegation constraints\n\nCommon Patterns\nPattern 1: ERC-20 with Time Limit\nconst delegation = createDelegation({\n  to: delegate,\n  from: delegator,\n  environment,\n  scope: {\n    type: 'erc20TransferAmount',\n    tokenAddress,\n    maxAmount: parseUnits('100', 6),\n  },\n  caveats: [\n    { type: 'timestamp', afterThreshold: now, beforeThreshold: expiry },\n    { type: 'limitedCalls', limit: 10 },\n    { type: 'redeemer', redeemers: [delegate] },\n  ],\n})\n\nPattern 2: Function Call with Value\nconst delegation = createDelegation({\n  to: delegate,\n  from: delegator,\n  environment,\n  scope: {\n    type: 'functionCall',\n    targets: [contractAddress],\n    selectors: ['transfer(address,uint256)'],\n    valueLte: { maxValue: parseEther('0.1') },\n  },\n  caveats: [{ type: 'allowedMethods', selectors: ['transfer(address,uint256)'] }],\n})\n\nPattern 3: Periodic Native Token\nconst delegation = createDelegation({\n  to: delegate,\n  from: delegator,\n  environment,\n  scope: {\n    type: 'nativeTokenPeriodTransfer',\n    periodAmount: parseEther('0.01'),\n    periodDuration: 86400,\n    startDate: now,\n  },\n})\n\nPattern 4: Redelegation Chain\n// Alice → Bob (100 USDC)\nconst aliceToBob = createDelegation({\n  to: bob,\n  from: alice,\n  environment,\n  scope: { type: 'erc20TransferAmount', tokenAddress, maxAmount: parseUnits('100', 6) },\n})\n\n// Bob → Carol (50 USDC, subset of authority)\nconst bobToCarol = createDelegation({\n  to: carol,\n  from: bob,\n  environment,\n  scope: { type: 'erc20TransferAmount', tokenAddress, maxAmount: parseUnits('50', 6) },\n  parentDelegation: aliceToBob,\n  caveats: [{ type: 'timestamp', afterThreshold: now, beforeThreshold: expiry }],\n})\n\nTroubleshooting Quick Fixes\nIssue\tSolution\nAccount not deployed\tUse bundlerClient.sendUserOperation() to deploy\nInvalid signature\tVerify chain ID, delegation manager, signer permissions\nCaveat enforcer reverted\tCheck caveat parameters match execution, verify order\nRedemption failed\tCheck delegator balance, calldata validity, target contracts\nERC-7715 not working\tUpgrade to Flask 13.5.0+, ensure user has smart account\nPermission denied\tHandle gracefully, provide manual fallback\nThreshold not met\tAdd more signers for multisig\n7702 not working\tConfirm EOA upgraded via EIP-7702 first\nError Code Reference\n\nError codes from the MetaMask Delegation Framework contracts (v1.3.0). Use a decoder like calldata.swiss-knife.xyz to identify error signatures.\n\nDelegationManager Errors (Verified)\nError Code\tError Name\tMeaning\n0xb5863604\tInvalidDelegate()\tCaller is not the delegate — Most common error\n0xb9f0f171\tInvalidDelegator()\tCaller is not the delegator\n0x05baa052\tCannotUseADisabledDelegation()\tAttempting to redeem a disabled delegation\n0xded4370e\tInvalidAuthority()\tDelegation chain authority validation failed\n0x1bcaf69f\tBatchDataLengthMismatch()\tArray lengths don't match in batch\n0x005ecddb\tAlreadyDisabled()\tDelegation has already been disabled\n0xf2a5f75a\tAlreadyEnabled()\tDelegation is already enabled\n0xf645eedf\tECDSAInvalidSignature()\tInvalid ECDSA signature format\n0xfce698f7\tECDSAInvalidSignatureLength(uint256)\tSignature length is incorrect\n0xd78bce0c\tECDSAInvalidSignatureS(bytes32)\tSignature S value is invalid\n0xac241e11\tEmptySignature()\tSignature is empty\n0xd93c0665\tEnforcedPause()\tContract is paused\n0x3db6791c\tInvalidEOASignature()\tEOA signature verification failed\n0x155ff427\tInvalidERC1271Signature()\tSmart contract signature (ERC1271) failed\n0x118cdaa7\tOwnableUnauthorizedAccount(address)\tUnauthorized account attempted owner-only action\n0x1e4fbdf7\tOwnableInvalidOwner(address)\tInvalid owner address in ownership transfer\n0xf6b6ef5b\tInvalidShortString()\tString parameter too short\n0xaa0ea2d8\tStringTooLong(string)\tString parameter exceeds maximum length\nDeleGatorCore Errors (Verified)\nError Code\tError Name\tMeaning\n0xd663742a\tNotEntryPoint()\tCaller is not the EntryPoint contract\n0x0796d945\tNotEntryPointOrSelf()\tCaller is neither EntryPoint nor this contract\n0x1a4b3a04\tNotDelegationManager()\tCaller is not the DelegationManager\n0xb96fcfe4\tUnsupportedCallType(bytes1)\tExecution call type not supported\n0x1187dc06\tUnsupportedExecType(bytes1)\tExecution type not supported\n0x29c3b7ee\tNotSelf()\tCaller is not this contract itself\nCommon Caveat Enforcer Errors (Revert Strings)\nError String\tMeaning\nAllowedTargetsEnforcer:target-address-not-allowed\tTarget contract not in allowed list\nAllowedTargetsEnforcer:invalid-terms-length\tTerms length not multiple of 20 bytes\nERC20TransferAmountEnforcer:invalid-terms-length\tTerms must be 52 bytes\nERC20TransferAmountEnforcer:invalid-contract\tTarget doesn't match allowed token\nERC20TransferAmountEnforcer:invalid-method\tMethod is not transfer\nERC20TransferAmountEnforcer:allowance-exceeded\tTransfer exceeds delegated limit\nCaveatEnforcer:invalid-call-type\tMust use single call type\nCaveatEnforcer:invalid-execution-type\tMust use default execution type\nMost Common Errors in Production\n\n0xb5863604 — InvalidDelegate()\n\nCause: Caller doesn't match the delegate address in delegation\nFix: Verify msg.sender equals the to address in the delegation\n\n0xb9f0f171 — InvalidDelegator()\n\nCause: Attempting to enable/disable from wrong address, or counterfactual account\nFix: Only delegator can enable/disable; for counterfactual, first UserOp auto-deploys\n\n0x05baa052 — CannotUseADisabledDelegation()\n\nCause: Delegation was disabled by delegator\nFix: Ask delegator to re-enable, or use different delegation\n\n0xded4370e — InvalidAuthority()\n\nCause: Broken delegation chain (redelegation parent mismatch)\nFix: Ensure redelegation chains are properly ordered (leaf → root)\n\n0x1bcaf69f — BatchDataLengthMismatch()\n\nCause: Array lengths don't match in redeemDelegations call\nFix: Ensure permissionContexts, modes, executionCallDatas have equal length\n\n0x3db6791c — InvalidEOASignature()\n\nCause: EOA signature invalid, wrong chain, or wrong delegation manager\nFix: Verify signature was created with correct chain ID and delegation manager\nResources\nNPM: @metamask/smart-accounts-kit\nContracts: metamask/delegation-framework@v1.3.0\nERC Standards: ERC-4337, ERC-7710, ERC-7715, ERC-7579\nMetaMask Flask: https://metamask.io/flask\nVersion Info\nToolkit: 0.3.0\nDelegation Framework: 1.3.0\nBreaking Change: Function call scope defaults to no native token transfer\n\nFor detailed documentation, see the reference files in the /references directory."
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/AyushBherwani1998/smart-accounts-kit",
    "publisherUrl": "https://clawhub.ai/AyushBherwani1998/smart-accounts-kit",
    "owner": "AyushBherwani1998",
    "version": "1.0.6",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/smart-accounts-kit",
    "downloadUrl": "https://openagent3.xyz/downloads/smart-accounts-kit",
    "agentUrl": "https://openagent3.xyz/skills/smart-accounts-kit/agent",
    "manifestUrl": "https://openagent3.xyz/skills/smart-accounts-kit/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/smart-accounts-kit/agent.md"
  }
}