Skip to content
Docs
Hooks
useProvider

useProvider

Hook for accessing Client's ethers Provider.

import { useProvider } from 'wagmi'

Usage

import { useProvider } from 'wagmi'

function App() {
  const provider = useProvider()
}

Return Value

Provider

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,
  })
}