View Source Xander.Util (Xander v0.2.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: <<0, 3>>, payload: "abc", protocol_id: <<1, 2>>}}
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: <<97, 98, 99>>, protocol_id: <<1, 2>>, size: <<0, 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>>