watchBlock

Watch for new blocks on a given network.

Example

// this will log out the new block every time a new block is finalized
const unsubscribe = watchBlock({
network: "ethereum",
onBlock: (block) => {
console.log("new block", block);
},
});
// later on you can call unsubscribe to stop listening for new blocks
unsubscribe();
function watchBlock(__namedParameters: WatchBlockParams): () => void;

Parameters

Type

let __namedParameters: WatchBlockParams;

Returns

let returnType: () => void;

An unsubscribe function that will stop listening for new blocks when called