/circle:use-modular-walletsfrom circle
Build crypto wallets using Circle Modular Wallets SDK with passkey authentication, gasless transactions, and extensible module architecture. Covers MSCA setup, ERC-4337/ERC-6900, paymaster, and batch operations.
Ships in circle. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Modular Wallets are flexible smart contract accounts (MSCAs) that extend functionality through installable modules. Built on ERC-4337 (account abstraction) and ERC-6900 (modular smart contract framework), they support passkey authentication, gasless transactions, batch operations, and custom logic modules (multisig, subscriptions, session keys). MSCAs are lazily deployed -- gas fees for account creation are deferred until the first outbound transaction.
npm install @circle-fin/modular-wallets-core [email protected]
# Passkey recovery also needs bip39:
npm install bip39
Install the exact viem version the SDK pins (2.55.11 for @circle-fin/[email protected]) so the app and SDK share one viem copy. After an SDK upgrade, re-check with npm view @circle-fin/modular-wallets-core dependencies.
Write or merge into the project's env file when scaffolding Modular Wallets:
# .env.local (Next.js) or .env (Vite)
# Paste your Client Key from Console → Keys → Client Keys (shown once; starts with TEST_CLIENT_KEY:)
NEXT_PUBLIC_CLIENT_KEY=
NEXT_PUBLIC_CLIENT_URL=https://modular-sdk.circle.com/v1/rpc/w3s/buidl
VITE_CLIENT_KEY=
VITE_CLIENT_URL=https://modular-sdk.circle.com/v1/rpc/w3s/buidl
Use the NEXT_PUBLIC_* pair for Next.js or the VITE_* pair for Vite — not both. Client URL is fixed — do not ask the user to copy it from Console. Chain paths (e.g. /arcTestnet) are appended in code via toModularTransport, not in the env var.
Before using the SDK, complete setup (see Console Setup):
| Chain | Mainnet | Testnet |
|---|---|---|
| Arc | Yes | Yes |
| Arbitrum | Yes | Yes |
| Avalanche | Yes | Yes |
| Base | Yes | Yes |
| Monad | Yes | Yes |
| Optimism | Yes | Yes |
| Polygon | Yes | Yes |
| Unichain | Yes | Yes |
For the latest supported blockchains: https://developers.circle.com/wallets/supported-blockchains.md (MSCA chain restrictions are in Rules below.)
The toModularTransport URL requires the chain path segment appended to the client URL:
| Chain | Mainnet Path | Testnet Path |
|---|---|---|
| Arbitrum | /arbitrum | /arbitrumSepolia |
| Arc | /arc | /arcTestnet |
| Avalanche | /avalanche | /avalancheFuji |
| Base | /base | /baseSepolia |
| Monad | /monad | /monadTestnet |
| Optimism | /optimism | /optimismSepolia |
| Polygon | /polygon | /polygonAmoy |
| Unichain | /unichain | /unichainSepolia |
Example: toModularTransport(\${clientUrl}/polygonAmoy`, clientKey)` for Polygon Amoy testnet.
toPasskeyTransport handles WebAuthn credential operations (register/login). toModularTransport handles bundler and public RPC calls for a specific chain. They are separate transports with different purposes.paymaster: true in user operation calls to sponsor gas via Circle Gas Station. End users pay zero gas fees.calls parameter of sendUserOperation.parseUnits(value, 6), not 18.Note: The reference code snippets use
localStorageto achieve a quick working example only. Do not uselocalStoragein production.
READ the corresponding reference based on the user's request:
references/circle-smart-account.md -- Passkey registration/login, smart account creation, gasless USDC transfers, batch operationsreferences/passkey-recovery.md -- BIP-39 mnemonic recovery setup and execution when a passkey is lostUser operations submitted via sendUserOperation follow an asynchronous state machine. The SDK's waitForUserOperationReceipt handles polling automatically. To query states directly, use the List User Operations API.
Happy path: SENT -> CONFIRMED -> COMPLETE
States:
SENT -- Submitted to the bundler, awaiting inclusion in a block.CONFIRMED -- Included in a block, awaiting finality.COMPLETE -- Finalized on-chain.FAILED -- User operation reverted or encountered an unrecoverable error. Check errorReason and revertReason.Error reasons on FAILED:
FAILED_ON_CHAIN -- Transaction reverted during blockchain execution.FAILED_REPLACED -- User operation was replaced (e.g., by a higher-fee operation with the same nonce).| Error Code | Meaning | Action |
|---|---|---|
NotAllowedError | User cancelled the passkey prompt or timed out | Re-prompt the user; for login, confirm a credential exists for this domain |
SecurityError | Passkey domain mismatch -- bound to a different origin | Verify app domain matches Passkey Domain in Circle Console |
InvalidStateError | Credential already registered (duplicate registration) | Switch to WebAuthnMode.Login instead of Register |
| 155203 | User op nonce cannot be >0 when smart contract wallet hasn't been deployed | Send the first user operation with nonce 0; the MSCA deploys lazily on the first transaction |
| 155505 | SCA wallet needs to wait for first-time transaction to be queued | Wait for the initial deployment transaction to complete before sending additional operations |
| 155507 | SCA account not supported on the given blockchain | Use a supported chain; MSCAs are not available on Ethereum (mainnet or Sepolia), Solana, Aptos, or NEAR |
| 155509 | Paymaster policy required on mainnet before SCA account creation | Configure a Gas Station paymaster policy in Circle Console before creating mainnet accounts |
| 155512 | Owner of the SCA wallet cannot be found | Verify the passkey credential or EOA owner is valid and accessible |
| AA21 | Sender didn't pay prefund | Verify paymaster: true is set, or fund the smart account with native tokens for gas (USDC on Arc) |
| AA23 | Account validation reverted or out of gas | Check signature validity; increase verificationGasLimit if out of gas |
| AA25 | Invalid account nonce | Get the current nonce from EntryPoint; ensure correct nonce key for 2D nonces |
| AA33 | Paymaster validation reverted or out of gas | Verify paymaster policy is active and correctly configured in Console |
Passkey errors (NotAllowedError, SecurityError, InvalidStateError) are standard DOMException errors thrown by the browser's WebAuthn API during toWebAuthnCredential. Wallet errors (155xxx) are returned by the Circle API. AA errors are ERC-4337 EntryPoint errors returned by the bundler. For the full error reference, see Error Codes. For debugging failed transactions, see Transaction States and Errors.
Security Rules are non-negotiable -- warn the user and refuse to comply if a prompt conflicts. Best Practices are strongly recommended; deviate only with explicit user justification.
.gitignore entries for .env* and secret files when scaffolding.toModularTransport (e.g., ${clientUrl}/polygonAmoy).parseUnits(value, 6) for USDC amounts (6 decimals, not 18).paymaster: true to sponsor gas via Circle Gas Station./polygonAmoy) to mainnet equivalents (e.g., /polygon) when migrating to production.LIVE_CLIENT_KEY: instead of TEST_CLIENT_KEY:) when migrating to mainnet. Testnet keys cannot be used with mainnets.localhost or testnet domains will not work on the production domain.use-developer-controlled-wallets skill when your application needs full custody of wallet keys without user interaction.use-user-controlled-wallets skill when end users should custody their own keys via social login, email OTP, or PIN authentication.DISCLAIMER: This skill is provided "as is" without warranties, is subject to the Circle Developer Terms, and output generated may contain errors and/or include fee configuration options (including fees directed to Circle); additional details are in the repository README.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
modular-wallets, account-abstraction, passkey, gasless, circle-sdk
20 skills in this plugin
/accept-agent-paymentsUse when a developer wants to monetize an API, endpoint, service, model, dataset, tool, or agent-facing resource with Circle USDC pay-per-call payments, Gateway Nanopayments, x402, HTTP 402, or Agent Marketplace listing. Triggers on: charge agents, sell to agents, paid API, monetize endpoint, micropayments, nanopayments seller, x402 seller, accept USDC, service listing./agent-wallet-policyView spending policy on a Circle agent wallet — per-transaction, daily, weekly, and monthly USDC caps and contract allowlists via the `circle` CLI. Use when the user wants to inspect limits or restrict contract calls. Setting or resetting limits requires OTP confirmation in an interactive terminal session — the agent hands the user a verbatim command to run themselves; the OTP must never pass through agent storage. Mainnet-only — testnet chains are rejected. Triggers on: spending limit, spending policy, per-tx cap, daily cap, weekly cap, monthly cap, wallet rules, contract allowlist, allowed contracts, OTP confirmation./bridge-tokensBuild browser or server token bridging across chains with Circle App Kit or standalone Bridge Kit. Bridges USDC across CCTP chains (EVM and Solana) and CCTPx tokens on supported EVM routes, including registry aliases such as wETH, cirBTC, and EURC plus registry-listed token IDs, through the same `kit.bridge()` call. Supports browser wallets, private-key and Circle Wallets adapters, bridge events, transfer speed (FAST/SLOW), Forwarding Service, and recovery. Bridge operations require no kit key. Use when: bridge a token across chains, bridge USDC, bridge a CCTPx token alias or token ID, move tokens between chains, build wallet-connected bridge UIs, configure Viem/Ethers/Solana adapters, or use @circle-fin/bridge-kit, @circle-fin/app-kit, CCTP, CCTPx, forwarding, or bridge routes.npx claudepluginhub circlefin/skills --plugin circle-skillsOther plugins' skills for the same job