JSON RPC
The jsonRpcProvider configures the chains with the RPC URLs that you specify.
import { jsonRpcProvider } from '@wagmi/core/providers/jsonRpc'Usage
import { configureChains } from '@wagmi/core'
import { mainnet, polygon } from '@wagmi/core/chains'
import { jsonRpcProvider } from '@wagmi/core/providers/jsonRpc'
 
const { chains, publicClient } = configureChains(
  [mainnet, polygon],
  [
    jsonRpcProvider({
      rpc: (chain) => ({
        http: `https://${chain.id}.example.com`,
      }),
    }),
  ],
)Note: The above example is using chains from @wagmi/core/chains.
Return Value
{
  chains: Chain[],
  publicClient: PublicClient,
  webSocketPublicClient: PublicClient
}Configuration
rpc
Accepts a function which provides the chain and expects to receive a http URL and optionally a webSocket URL.
import { configureChains } from '@wagmi/core'
import { mainnet, polygon } from '@wagmi/core/chains'
import { jsonRpcProvider } from '@wagmi/core/providers/jsonRpc'
 
const { chains, publicClient } = configureChains(
  [mainnet, polygon],
  [
    jsonRpcProvider({
      rpc: (chain) => ({
        http: `https://${chain.id}.example.com`,
        webSocket: `wss://${chain.id}.example.com`,
      }),
    }),
  ],
)