# createWagmiConfig

Creates an immutable Core configuration using the public client and active wallet connection from
Wagmi. The adapter lives in an optional entrypoint so viem-only applications do not install Wagmi.

## Import

```ts
import { createWagmiConfig } from "@ensforge/core/wagmi";
```

## Usage

:::code-group
```ts [ensforge.ts]
import { createWagmiConfig } from "@ensforge/core/wagmi";
import { wagmiConfig } from "./wagmi";

export const config = createWagmiConfig({
  network: "mainnet",
  wagmiConfig,
});
```

```ts [wagmi.ts]
// [!include ~/snippets/wagmi/config.ts]
```
:::

Reads use the selected network's Wagmi public client. Each write resolves the active wallet client
when it executes, so account and connector changes do not require recreating the config.

## Parameters

```ts
import type { CreateWagmiConfigParameters } from "@ensforge/core/wagmi";
```

### network

`"mainnet" | "sepolia" | CustomEnsNetwork`

Also accepts a [custom deployment profile](/core/api/create-config#custom-deployments).

Network whose Wagmi public client and ENS deployment should be selected.

### wagmiConfig

`Config`

Existing Wagmi config. It must contain the selected network.

### reads

`ReadOptions | undefined`

Default read concurrency and Multicall sizing.

### writes

`WriteOptions | undefined`

Default simulation, confirmation, and status retry policies.

### gateways

`GatewayOptions | undefined`

Outbound gateway policy applied to CCIP Read and supported resource resolution.

## Return Type

`EnsforgeConfig`

The same immutable configuration returned by root `createConfig`.

## Error

Throws `ConfigError` when the network is unsupported, Wagmi does not expose its public client, or a
configuration policy is invalid. A write fails with `WALLET_CLIENT_UNAVAILABLE` when no wallet is
connected at execution time.

## Related

* [`createConfig`](/core/api/create-config)
* [`createEnsforge`](/sdk/api/create-ensforge)
