Watches the block number for a specific chain.
import { watchBlockNumber } from "thirdweb";const unwatch = watchBlockNumber({ client, chainId, onNewBlockNumber: (blockNumber) => { // do something with the block number }, onError: (err) => { // do something if getting the block number fails },}); // later stop watchingunwatch();
function watchBlockNumber(opts: WatchBlockNumberOptions): () => void;
The options for watching the block number.
let opts: { chain: Chain; client: ThirdwebClient; latestBlockNumber?: bigint; onError?: (error: Error) => void; onNewBlockNumber: (blockNumber: bigint) => void; overPollRatio?: number;};
let returnType: () => void;
The unwatch function.