Skip to content

Networks

Importing a network

To add / remove / edit a network supported by the dApp you can do it directly in the networks.config.ts file.

Import network

Import the supported network of your choice, say Base.

networks.config.ts
- import { mainnet, optimismSepolia, sepolia } from 'viem/chains'
+ import { base, mainnet, optimismSepolia, sepolia } from 'viem/chains'
 
...
 
- export const chains = [mainnet, optimismSepolia, sepolia] as const
+ export const chains = [base, mainnet, optimismSepolia, sepolia] as const

Include it in the transports

Use the default RPC provided by wagmi / Viem to include it in the transports.

networks.config.ts
export const transports: RestrictedTransports = {
    ...
+   [base.id]: http(env.PUBLIC_RPC_BASE),
}

Specifying the RPC

If you want to use an RPC different from the one provided by wagmi

Define the env variable

.env.local
+ PUBLIC_RPC_BASE=https://base.llamarpc.com

Import

Import the RPC in the src/env.ts file

env.ts
export const env = createEnv({
  client: {
    ...
+   PUBLIC_RPC_BASE: z.string().optional(),
  },
})
Released under the MIT License.
© 2025 - BootNode