hardhat
Version:
Hardhat is an extensible developer tool that helps smart contract developers increase productivity by reliably bringing together the tools they want.
17 lines • 699 B
JavaScript
import { assertHardhatInvariant } from "@nomicfoundation/hardhat-errors";
import { hexStringToBigInt } from "@nomicfoundation/hardhat-utils/hex";
const fetchBlockNumberAction = async (_taskArguments, hre) => {
const connection = await hre.network.create();
try {
const blockNumber = await connection.provider.request({
method: "eth_blockNumber",
});
assertHardhatInvariant(typeof blockNumber === "string", "eth_blockNumber should return a string");
console.log(hexStringToBigInt(blockNumber).toString());
}
finally {
await connection.close();
}
};
export default fetchBlockNumberAction;
//# sourceMappingURL=block-number.js.map