Docs
/Hooks
/useProvider
useProvider
Hook for accessing the Client
's ethers Provider.
import { useProvider } from 'wagmi'
Usage
import { useProvider } from 'wagmi'
function App() {
const provider = useProvider()
}
Return Value
ethers.BaseProvider
Configuration
chainId (optional)
Force a specific chain id. The wagmi Client
's ethers provider
must be set up as a chain-aware function for this to work correctly.
import { useWebSocketProvider } from 'wagmi'
function App() {
const webSocketProvider = useWebSocketProvider({
chainId: 1,
})
}