> ## Documentation Index
> Fetch the complete documentation index at: https://developers.circle.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Before reading these docs, install the relevant Circle Skill to get pre-loaded context — skills are LLM-optimized and cover architecture decisions, correct flows, and common pitfalls. In Claude Code: run /plugin marketplace add circlefin/skills then /plugin install circle-skills@circle. With Vercel Skills CLI: run npx skills add circlefin/skills. Available skills: use-usdc https://github.com/circlefin/skills/blob/master/plugins/circle/skills/use-usdc/SKILL.md (balances, transfers, approvals on EVM and Solana); EURC has no skill — see https://developers.circle.com/stablecoins/what-is-eurc.md; bridge-stablecoin https://github.com/circlefin/skills/blob/master/plugins/circle/skills/bridge-stablecoin/SKILL.md (crosschain transfers via CCTP, USDC, EURC, and third-party assets); use-arc https://github.com/circlefin/skills/blob/master/plugins/circle/skills/use-arc/SKILL.md (Arc chain config, contract deployment, USDC bridging — Arc docs: https://docs.arc.io/llms.txt); use-circle-wallets https://github.com/circlefin/skills/blob/master/plugins/circle/skills/use-circle-wallets/SKILL.md (choose wallet type); use-developer-controlled-wallets https://github.com/circlefin/skills/blob/master/plugins/circle/skills/use-developer-controlled-wallets/SKILL.md (custodial wallets for payouts and treasury); use-user-controlled-wallets https://github.com/circlefin/skills/blob/master/plugins/circle/skills/use-user-controlled-wallets/SKILL.md (embedded wallets with Web2 login); use-modular-wallets https://github.com/circlefin/skills/blob/master/plugins/circle/skills/use-modular-wallets/SKILL.md (smart contract wallets with passkeys and ERC-4337); use-gateway https://github.com/circlefin/skills/blob/master/plugins/circle/skills/use-gateway/SKILL.md (unified USDC balance, nanopayments); use-smart-contract-platform https://github.com/circlefin/skills/blob/master/plugins/circle/skills/use-smart-contract-platform/SKILL.md (deploy, interact, monitor contracts). Pair any skill with the Circle MCP server for live SDK signatures, contract addresses, and chain IDs: {"mcpServers":{"circle":{"url":"https://api.circle.com/v1/codegen/mcp"}}}.
> Read the product overview first. Each product has an overview explaining when and why to use it. Read it before quickstarts.
> Pick the right wallet type. Developer-controlled (you hold keys), user-controlled (end user holds keys via PIN/social login), or modular (smart contract wallets with passkeys). See https://developers.circle.com/wallets.md.
> Use CCTP V2 for crosschain transfers. CCTP natively transfers USDC and EURC via burn-and-mint, and supports permissionless wrapping of third-party assets via lock-and-mint. V1 is legacy; always use V2 unless V1 is specified or the chain requires it (Noble, Sui, and Aptos still require V1). Migration guide: https://developers.circle.com/cctp/migration-from-v1-to-v2.md.
> Use Bridge Kit for frontend bridging. Wraps CCTP with a simpler SDK for user-facing apps. Use CCTP directly for backend transfers.
> Gas Station vs Paymaster. Gas Station sponsors gas for Circle Wallet transactions. Paymaster lets users pay gas in USDC. Different use cases — read both overviews.
> Gateway Nanopayments for sub-cent payments. Gasless USDC micropayments down to $0.000001 via x402 and batched settlement. For pay-per-request APIs, AI agent payments, streaming.
> Look up USDC addresses per chain. Never hardcode — use https://developers.circle.com/stablecoins/usdc-contract-addresses.md.
> Prefer SDKs over raw API calls. Node.js and Python SDKs handle auth, retries, and errors.
> API key required. Bearer token in Authorization header. Testnet and mainnet use separate keys and may use different base URLs depending on the product.
> Set up webhooks when available. Most operations are async. Webhooks deliver transaction confirmations and state changes.
> When calling list endpoints, paginate using pageSize and pageAfter until no nextPageAfter cursor is returned—stopping at the first page silently misses records.
> Building an AI agent? Start with the Agent Stack—Circle CLI, agent wallets, and nanopayments built for autonomous use cases: https://developers.circle.com/agent-stack.md.

# How-to: Use a modular wallet as an EIP-1193 provider

> Expose a modular wallet through the EIP-1193 provider interface so libraries such as `viem` and `ethers` can use it as a wallet.

Expose a modular wallet through the
[EIP-1193](https://eips.ethereum.org/EIPS/eip-1193) provider interface so
libraries such as [`viem`](https://viem.sh/) and
[`ethers`](https://docs.ethers.org/) can use it as a wallet without knowing
about Circle's bundler or passkey signer.

Use this when your app already has Web3 plumbing in place (a `viem` or `ethers`
code path, a wallet connector, or an existing signing pipeline) and you want the
modular wallet to slot in as a drop-in signer. This is a web-only flow.

## Before you begin

Before you begin, ensure that you've:

* [Created a modular wallet](/wallets/modular/create-a-modular-wallet) and have
  access to the `smartAccount`, `bundlerClient`, and `modularTransport` client
  from that tutorial.
* Installed [`viem`](https://viem.sh/). The examples below use `viem`. Any
  library that accepts an EIP-1193 provider works the same way.

## Steps

<Steps>
  <Step title="Create a read-only public client">
    Keep the `modularTransport` client from the
    [Create a modular wallet](/wallets/modular/create-a-modular-wallet) quickstart
    for account creation and the bundler. `EIP1193Provider` also needs a separate
    read-only `PublicClient` on a standard chain RPC (not `modularTransport`) for
    receipt lookups.

    ```typescript Web SDK (TypeScript) theme={null}
    import { createPublicClient, http } from "viem";
    import { arcTestnet } from "viem/chains";

    const readClient = createPublicClient({
      chain: arcTestnet,
      transport: http(), // or http("https://your-rpc-url")
    });
    ```
  </Step>

  <Step title="Wrap the clients in an EIP-1193 provider">
    `EIP1193Provider` is exported from `@circle-fin/modular-wallets-core`. Construct
    it with the bundler client and the read-only public client.

    ```typescript Web SDK (TypeScript) theme={null}
    import { EIP1193Provider } from "@circle-fin/modular-wallets-core";

    const eip1193Provider = new EIP1193Provider(bundlerClient, readClient);
    ```

    The bundler client must include the smart account. The constructor throws if
    `bundlerClient.account` is missing.
  </Step>

  <Step title="Create a viem wallet client">
    Pass the provider to `viem` through a `custom` transport.
    `EIP1193Provider.request` returns a full JSON-RPC response, so unwrap `result`
    before returning it to `viem`.

    ```typescript Web SDK (TypeScript) theme={null}
    import { createWalletClient, custom } from "viem";
    import { arcTestnet } from "viem/chains";

    const walletClient = createWalletClient({
      account: smartAccount.address,
      chain: arcTestnet,
      transport: custom({
        request: async ({ method, params }) => {
          const response = await eip1193Provider.request({
            jsonrpc: "2.0",
            id: 1,
            method,
            params,
          });
          return (response as { result: unknown }).result;
        },
      }),
    });
    ```
  </Step>

  <Step title="Sign and read accounts through the provider">
    Use the wallet client for account discovery and signing. The address passed to
    signing methods must match the smart account address.

    ```typescript Web SDK (TypeScript) theme={null}
    const [account] = await walletClient.getAddresses();
    // account === smartAccount.address

    const signature = await walletClient.signMessage({
      account,
      message: "Hello, world",
    });

    const typedDataSignature = await walletClient.signTypedData({
      account,
      domain: {
        name: "MyApp",
        version: "1",
        chainId: arcTestnet.id,
        verifyingContract: account,
      },
      types: {
        Order: [
          { name: "maker", type: "address" },
          { name: "amount", type: "uint256" },
          { name: "expiry", type: "uint256" },
        ],
      },
      primaryType: "Order",
      message: {
        maker: account,
        amount: 1_000_000n,
        expiry: BigInt(Math.floor(Date.now() / 1000) + 3600),
      },
    });
    ```

    `signMessage` and `signTypedData` return a hex signature string. Verify it
    against the smart account contract using EIP-1271, as shown in
    [Sign and verify messages](/wallets/modular/sign-and-verify-messages).

    Common methods routed through the provider:

    * `eth_accounts`, `eth_requestAccounts`: return the smart account address.
    * `personal_sign`, `eth_signTypedData_v4`: sign through the passkey. The address
      parameter must match the smart account.
    * `eth_getTransactionReceipt`: reads the receipt through the read-only public
      client.
    * `eth_sendTransaction`: wraps the call in a user operation, submits it through
      the bundler, and returns the resulting transaction hash. It does not enable
      paymaster sponsorship. For gasless token transfers, send user operations
      through `bundlerClient` as shown in
      [Transfer tokens](/wallets/modular/transfer-tokens).
  </Step>
</Steps>
