I tried to use ethers' keccak256 function like this:
import { keccak256 } from "@ethersproject/keccak256";
const signature = keccak256("balanceOf(address)");
But the script failed with this error:
Error: invalid arrayify value (argument="value", value="balanceOf(address)", code=INVALID_ARGUMENT, version=bytes/5.5.0)
How can I make it work?
@ethersproject/keccak256package is better when you only need to use thekeccak256function. You avoid installing all the packages that come with the umbrellaetherspackage. – Paul Razvan Berg Apr 11 '22 at 06:30