watcher-ts/packages/erc721-watcher/test/tasks/block-latest.ts

19 lines
431 B
TypeScript
Raw Normal View History

2022-06-08 10:38:09 +00:00
//
// Copyright 2022 Vulcanize, Inc.
//
import { task } from 'hardhat/config';
import '@nomiclabs/hardhat-ethers';
task(
'block-latest',
'Prints the current block info',
async (_, { ethers }) => {
const blockNumber = await ethers.provider.getBlockNumber();
const block = await ethers.provider.getBlock(blockNumber);
console.log('Block Number:', blockNumber);
console.log('Block Hash:', block.hash);
}
);