1.5 KiB

title, description
title description
useBlockNumber Primitive for fetching the current block number.

useBlockNumber

Primitive for fetching the current block number.

Import

import { useBlockNumber } from '@wagmi/solid'

Usage

::: code-group

import { useBlockNumber } from '@wagmi/solid'

function App() {
  const blockNumber = useBlockNumber()
}

<<< @/snippets/solid/config.ts[config.ts] :::

Parameters

import { useBlockNumber } from '@wagmi/solid'

useBlockNumber.Parameters
useBlockNumber.SolidParameters

Parameters are passed as a getter function to maintain Solid reactivity.

useBlockNumber(() => ({
  chainId: 1,
  // other parameters...
}))

cacheTime

number | undefined

Time in milliseconds that cached block number will remain in memory.

chainId

config['chains'][number]['id'] | undefined

ID of chain to use when fetching data.

config

Config | undefined

Config to use instead of retrieving from the nearest WagmiProvider.

scopeKey

string | undefined

Scopes the cache to a given context. Primitives that have identical context will share the same cache.

Return Type

import { useBlockNumber } from '@wagmi/solid'

useBlockNumber.ReturnType

Action