Static
fromParses a CLValue from a Uint8Array given its type.
An object containing the parsed CLValue and any remaining bytes.
If an unsupported CLType is encountered.
The Uint8Array containing the serialized CLValue.
The CLType of the value to parse.
Static
fromParses a Uint8Array
to extract a CLValue
with its corresponding type.
This method takes a byte array and interprets it as a CLValue
by first extracting
the length of the value, then splitting the bytes into the value's data and its type.
An IResultWithBytes<CLValue>
containing the parsed CLValue
and its remaining bytes.
Error - If the length of the value extracted from the bytes is invalid.
const bytes = new Uint8Array([...]); // Provide valid CLValue bytes
const result = CLValueParser.fromBytesWithType(bytes);
console.log(result.result); // Parsed CLValue
The byte array to be parsed.
Static
fromJSONStatic
toStatic
toJSONConverts a CLValue to its JSON representation.
An object with 'bytes' and 'cl_type' properties representing the CLValue.
The CLValue to convert.
Generated using TypeDoc
A utility class for parsing CLValues from various formats, including JSON and byte arrays.