watcher-ts/packages/erc20-watcher/test/tasks/block-latest.ts
Ashwin Phatak cf0713eda7
Tasks in erc20-watcher to deploy and transfer tokens. (#233)
Co-authored-by: nabarun <nabarun@deepstacksoft.com>
2021-08-27 17:47:23 +05:30

19 lines
431 B
TypeScript

//
// Copyright 2021 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);
}
);