• React
  • 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 { useProvider } from 'wagmi'
 
function App() {
  const provider = useProvider({
    chainId: 1,
  })
}