(text: string)
| 14 | * Encodes %%text%% as a Bytes32 string. |
| 15 | */ |
| 16 | export function encodeBytes32String(text: string): string { |
| 17 | |
| 18 | // Get the bytes |
| 19 | const bytes = toUtf8Bytes(text); |
| 20 | |
| 21 | // Check we have room for null-termination |
| 22 | if (bytes.length > 31) { throw new Error("bytes32 string must be less than 32 bytes"); } |
| 23 | |
| 24 | // Zero-pad (implicitly null-terminates) |
| 25 | return zeroPadBytes(bytes, 32); |
| 26 | } |
| 27 | |
| 28 | /** |
| 29 | * Encodes the Bytes32-encoded %%bytes%% into a string. |
nothing calls this directly
no test coverage detected
searching dependent graphs…