Docs
/Provider
Provider
The wagmi Provider manages configuration for all hooks using React Context (not to be confused with an ethers.js Provider of course).
import { Provider } from 'wagmi'To help avoid conflicts with other providers in your app, the Provider is also aliased as WagmiProvider.
import { WagmiProvider } from 'wagmi'Usage
import { Provider } from 'wagmi'
function App() {
return (
<Provider>
<YourRoutes />
</Provider>
)
}Configuration
client (optional)
A wagmi Client instance that consists of configuration options. Defaults to createClient().
import { providers } from 'ethers'
import { Provider, createClient } from 'wagmi'
const client = createClient({
autoConnect: true,
provider(config) {
return new providers.AlchemyProvider(config.chainId, 'Your Alchemy ID')
},
})
function App() {
return (
<Provider client={client}>
<YourRoutes />
</Provider>
)
}