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