MCPcopy Create free account
hub / github.com/ccxt/ccxt / encodeBytes32String

Function encodeBytes32String

js/src/static_dependencies/ethers/bytes32.js:10–19  ·  view source on GitHub ↗
(text)

Source from the content-addressed store, hash-verified

8 * Encodes %%text%% as a Bytes32 string.
9 */
10export 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 */

Callers

nothing calls this directly

Calls 2

toUtf8BytesFunction · 0.90
zeroPadBytesFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…