UNPKG

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 • 735 B
import { HardhatError } from "@nomicfoundation/hardhat-errors"; import { getUnprefixedHexString, hexStringToBigInt, isHexString, } from "@nomicfoundation/hardhat-utils/hex"; const fromHexAction = async ({ value }) => { if (!isHexString(value)) { throw new HardhatError(HardhatError.ERRORS.CORE.GENERAL.INVALID_HEX_STRING, { value }); } if (getUnprefixedHexString(value).length === 0) { throw new HardhatError(HardhatError.ERRORS.CORE.ARGUMENTS.INVALID_VALUE, { value, name: "value", reason: "it must have at least one hex digit", }); } console.log(hexStringToBigInt(value).toString()); }; export default fromHexAction; //# sourceMappingURL=from-hex.js.map