encodeBytes32String
encodeBytes32String(
text):string
Defined in: utils/bytes32-string.ts:18
Encode a string as a bytes32 hex value. The string must be 31 bytes or shorter, as one byte is used for the null terminator in Solidity.
Similar to “encodeBytes32String” in ethers.js v6
Parameters
Section titled “Parameters”string
the string to encode (max 31 bytes UTF-8)
Returns
Section titled “Returns”string
a 66-character hex string (bytes32)
Example
Section titled “Example”encodeBytes32String('essential-eth')// '0x657373656e7469616c2d657468000000000000000000000000000000000000'