View Source Xander.Util (Xander v0.3.0)
Summary
Functions
Unwrap the multiplexer header from a CDDL message. This can be used to extract the payload from node responses.
Unwrap the multiplexer header from a CDDL message and return just the result. Raises an error if the input is invalid.
Add multiplexer header to a CBOR payload. This is used to format outgoing messages to the Cardano node.
Functions
Unwrap the multiplexer header from a CDDL message. This can be used to extract the payload from node responses.
Examples
iex> Xander.Util.plex(<<0, 0, 0, 0, 1, 2, 0, 3, 97, 98, 99>>)
{:ok, %{size: 3, payload: "abc", protocol_id: 258}}
Unwrap the multiplexer header from a CDDL message and return just the result. Raises an error if the input is invalid.
Examples
iex> Xander.Util.plex!(<<0, 0, 0, 0, 1, 2, 0, 3, 97, 98, 99>>)
%{payload: "abc", protocol_id: 258, size: 3}
Add multiplexer header to a CBOR payload. This is used to format outgoing messages to the Cardano node.
Examples
iex> Xander.Util.plex_encode(<<97, 98, 99>>)
<<0, 0, 0, 0, 0, 2, 0, 3, 97, 98, 99>>