Infura
The infuraProvider
configures the chains with Infura RPC URLs.
import { infuraProvider } from 'wagmi/providers/infura'
Usage
import { configureChains } from 'wagmi'
import { mainnet, polygon } from 'wagmi/chains'
import { infuraProvider } from 'wagmi/providers/infura'
const { chains, publicClient } = configureChains(
[mainnet, polygon],
[infuraProvider({ apiKey: 'yourInfuraApiKey' })],
)
Note: The above example is using chains from the wagmi/chains
entrypoint.
Return Value
{
chains: Chain[],
publicClient: PublicClient,
webSocketPublicClient: PublicClient
}
Configuration
apiKey
Your Infura API key from the Infura Dashboard.
import { configureChains } from 'wagmi'
import { mainnet, polygon } from 'wagmi/chains'
import { infuraProvider } from 'wagmi/providers/infura'
const { chains, publicClient } = configureChains(
[mainnet, polygon],
[infuraProvider({ apiKey: 'yourInfuraApiKey' })],
)