UNPKG

hardhat

Version:

Hardhat is an extensible developer tool that helps smart contract developers increase productivity by reliably bringing together the tools they want.

12 lines • 707 B
import { getAbiSelector, parseAbiFunctionSignature, } from "@nomicfoundation/hardhat-utils/abi"; import { getUnprefixedHexString } from "@nomicfoundation/hardhat-utils/hex"; import { parseSignatureArgument } from "./arguments.js"; import { encodeArguments } from "./encode.js"; const encodeCalldataAction = async ({ signature, values }) => { const parsed = parseSignatureArgument(parseAbiFunctionSignature, signature, "signature"); const selector = await getAbiSelector(parsed); const encoded = await encodeArguments(parsed.inputs, values, "values"); console.log(selector + getUnprefixedHexString(encoded)); }; export default encodeCalldataAction; //# sourceMappingURL=encode-calldata.js.map