id
id(
text):string
Defined in: utils/id.ts:24
Compute the keccak256 hash of a UTF-8 string. Commonly used to compute Solidity function selectors and event topic hashes.
Similar to “id” in ethers.js
Parameters
text
string
the UTF-8 string to hash
Returns
string
the keccak256 hash as a hex string
Examples
id('Transfer(address,address,uint256)')// '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef'// Get a function selector (first 4 bytes)id('balanceOf(address)').slice(0, 10)// '0x70a08231'