mirror of
https://github.com/cerc-io/watcher-ts
synced 2024-11-20 12:56:20 +00:00
19 lines
431 B
TypeScript
19 lines
431 B
TypeScript
|
//
|
||
|
// 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);
|
||
|
}
|
||
|
);
|