• Core
  • Actions
  • fetchBlockNumber

fetchBlockNumber

Action for fetching the current block number.

import { fetchBlockNumber } from '@wagmi/core'

Usage

import { fetchBlockNumber } from '@wagmi/core'
 
const blockNumber = await fetchBlockNumber()

Return Value

number

Configuration

chainId (optional)

Force a specific chain id for the request. The wagmi Client's ethers provider must be set up as a chain-aware function for this to work correctly.

import { fetchBlockNumber } from '@wagmi/core'
 
const blockNumber = fetchBlockNumber({
  chainId: 1,
})