solidityKeccak256
solidityKeccak256(
types,values):string
Defined in: utils/solidity-keccak256.ts:156
Hashes data from Solidity using the Keccak256 algorithm.
Similar to “solidityKeccak256” in ethers.js
Parameters
types
readonly string[]
Each Solidity type corresponding to the values passed in. Helps the function parse and pack data properly.
values
readonly any[]
Data to be concatenated (combined) and then hashed.
Returns
string
A Keccak256 hash (hex string) based on the values provided
Examples
const types = ['string', 'bool', 'uint32'];const values = ['essential-eth is great', true, 14];solidityKeccak256(types, values);// '0xe4d4c8e809faac09d58f468f0aeab9474fe8965d554c6c0f868c433c3fd6acab'const types = ['bytes4', 'uint32[5]'];const values = [[116, 101, 115, 116], [5, 3, 4, 9, 18]];solidityKeccak256(types, values);// '0x038707a887f09355dc545412b058e7ba8f3c74047050c7c5e5e52eec608053d9'