Skip to content
On this page

fetchBlockNumber

Returns the number of the most recent block seen.

Import

ts
import { fetchBlockNumber } from 'viem'

Usage

ts
import { fetchBlockNumber } from 'viem'
import { publicClient } from '.'
 
const block = await fetchBlockNumber(publicClient) 
// 69420n

Returns

bigint

The number of the block.

Example

Released under the MIT License.