mirror of
https://github.com/vacp2p/linea-monorepo.git
synced 2026-01-09 04:08:01 -05:00
* fix * added more errors to smart-contract-errors.toml * cross-check against bytecode * remove redundant comment
12 lines
510 B
TypeScript
12 lines
510 B
TypeScript
import { ethers } from "ethers";
|
|
import { encodeData } from "./encoding";
|
|
|
|
export const generateKeccak256 = (types: string[], values: unknown[], opts: { encodePacked?: boolean }) =>
|
|
ethers.keccak256(encodeData(types, values, opts.encodePacked));
|
|
|
|
export const generateKeccak256ForString = (value: string) =>
|
|
generateKeccak256(["string"], [value], { encodePacked: true });
|
|
|
|
export const generateFunctionSelector = (functionSignature: string) =>
|
|
generateKeccak256ForString(functionSignature).slice(2, 10);
|