Index of every page on this site: llms.txt
All skills
circlefin avatar

/use-modular-wallets

@a045767
Run it yourself

Build crypto wallets using Circle Modular Wallets SDK with passkey authentication, gasless transactions, and extensible module architecture. Use when: creating crypto wallets with passkey-based (WebAuthn) registration and login, sending gasless transactions using Circle Gas Station paymaster, batching multiple transactions into a single user operation, implementing passkey recovery using BIP-39 mnemonic phrases, building advanced onchain wallets with custom modules (multisig, subscriptions, session keys). Triggers on: MSCA, passkey authentication, WebAuthn, paymaster, Gas Station, ERC-4337, ERC-6900, toCircleSmartAccount, toModularTransport, sendUserOperation, 2D nonce, passkey recovery, EIP-1193 provider.

Use this Skill: https://skilld.dev/gh/circlefin/skills/use-modular-wallets

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencescircle-smart-account.md

≈958 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Circle Smart Account with Passkey Authentication

Reference implementation for creating a Circle Smart Account using passkeys and sending gasless USDC transfers via user operations.

Source: circle-smart-account example (React, TypeScript)

Environment Variables

Scaffolding (Next.js vs Vite pairs and fixed Client URL) lives in SKILL.md. This example uses Vite:

VITE_CLIENT_KEY=
VITE_CLIENT_URL=https://modular-sdk.circle.com/v1/rpc/w3s/buidl

Setup

import { createPublicClient, parseUnits, type Hex } from 'viem'
import { arcTestnet } from 'viem/chains'
import {
  type P256Credential,
  type SmartAccount,
  type WebAuthnAccount,
  createBundlerClient,
  toWebAuthnAccount,
} from 'viem/account-abstraction'
import {
  WebAuthnMode,
  toCircleSmartAccount,
  toModularTransport,
  toPasskeyTransport,
  toWebAuthnCredential,
  encodeTransfer,
  ContractAddress,
} from '@circle-fin/modular-wallets-core'

const clientKey = import.meta.env.VITE_CLIENT_KEY as string
const clientUrl = import.meta.env.VITE_CLIENT_URL as string
const USDC_DECIMALS = 6

const passkeyTransport = toPasskeyTransport(clientUrl, clientKey)
const modularTransport = toModularTransport(`${clientUrl}/arcTestnet`, clientKey)

const client = createPublicClient({
  chain: arcTestnet,
  transport: modularTransport,
})

const bundlerClient = createBundlerClient({
  chain: arcTestnet,
  transport: modularTransport,
})

Arc mainnet: import arc instead of arcTestnet from viem/chains, use the `${clientUrl}/arc` transport path, and pass ContractAddress.Arc_USDC to encodeTransfer (the Arc USDC address is the same on Arc mainnet and testnet).

Register a Passkey

const credential = await toWebAuthnCredential({
  transport: passkeyTransport,
  mode: WebAuthnMode.Register,
  username: 'alice',
})

// Persist credential so the user stays logged in across reloads
localStorage.setItem('credential', JSON.stringify(credential))

Login with Existing Passkey

const credential = await toWebAuthnCredential({
  transport: passkeyTransport,
  mode: WebAuthnMode.Login,
})

localStorage.setItem('credential', JSON.stringify(credential))

Create Smart Account from Credential

const account = await toCircleSmartAccount({
  client,
  owner: toWebAuthnAccount({ credential }) as WebAuthnAccount,
  name: 'alice', // optional human-readable name
})

console.log('Smart account address:', account.address)

Send Gasless USDC Transfer

const to = '0xRecipientAddress' as Hex
const amount = parseUnits('10', USDC_DECIMALS)

// Encode an ERC-20 transfer call for USDC on Arc Testnet
const callData = encodeTransfer(to, ContractAddress.ArcTestnet_USDC, amount)

// paymaster: true means gas is sponsored by the developer via Circle Gas Station
const userOpHash = await bundlerClient.sendUserOperation({
  account,
  calls: [callData],
  paymaster: true,
})

// Wait for the user operation to be included on-chain
const { receipt } = await bundlerClient.waitForUserOperationReceipt({ hash: userOpHash })
console.log('Transaction hash:', receipt.transactionHash)

Batch Multiple Calls

Pass an array of encoded calls to execute them atomically in a single user operation:

const calls = [
  encodeTransfer(recipient1, ContractAddress.ArcTestnet_USDC, parseUnits('5', USDC_DECIMALS)),
  encodeTransfer(recipient2, ContractAddress.ArcTestnet_USDC, parseUnits('10', USDC_DECIMALS)),
]

const hash = await bundlerClient.sendUserOperation({
  account,
  calls,
  paymaster: true,
})

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

2 warnings15d5 checks · Risk SAFE
  • Gen Agent Trust Hub15d

    The skill provides a secure implementation guide for building modular crypto wallets using the Circle SDK. It incorporates strong security practices, including mandatory environment variable usage for secrets, warnings against insecure credential storage, and explicit user confirmation steps for sensitive blockchain operations.

  • Socket15d

    No alerts

  • Snyk15d

    Risk: MEDIUM · 1 issue

  • Runlayer8mo

    3/3 files flagged

  • ZeroLeaks7mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at a045767. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 6 days ago.

Activeupdated 3 weeks ago
requirements
{
  "runtimes": [],
  "connectors": []
}

README badge

README badge for circlefin/skills/use-modular-wallets