Docs
/Providers
/Public
Public
The publicProvider
configures the chains with a public RPC URL and also provides an ethers.js getpublicProvider
.
import { publicProvider } from 'wagmi/providers/public'
Usage
import { chain, configureChains } from 'wagmi'
import { publicProvider } from 'wagmi/providers/public'
const { chains, provider } = configureChains(
[chain.mainnet, chain.polygon],
[publicProvider()],
)
⚠️
Only having publicProvider
in your providers will make the chain use the
public RPC URL which could lead to rate-limiting. It is recommended to also
include another provider in your list (such as: alchemyProvider
,
infuraProvider
or staticJsonRpcProvider
).
Return Value
{
chains: Chain[],
provider: BaseProvider,
webSocketProvider: WebSocketProvider
}