View Source Tezex.Micheline (tezex v1.1.0)

Decode Micheline code.

Link to this section Summary

Functions

Parse a Micheline hex string, return a tuple {result, consumed} containing a list of Micheline objects as maps, and the number of bytes that was consumed in the process.

Parse a single message from a Micheline packed message.

Link to this section Functions

@spec hex_to_micheline(binary()) :: {map() | [map()], pos_integer()}

Parse a Micheline hex string, return a tuple {result, consumed} containing a list of Micheline objects as maps, and the number of bytes that was consumed in the process.

examples

Examples

iex> Tezex.Micheline.hex_to_micheline("02000000210061010000000574657a6f730100000000010000000b63727970746f6e6f6d6963")
{[%{int: -33}, %{string: "tezos"}, %{string: ""}, %{string: "cryptonomic"}], 76}

iex> Tezex.Micheline.hex_to_micheline("00e1d22c")
{%{int: -365729}, 8}
Link to this function

micheline_hex_to_string(arg)

View Source
@spec micheline_hex_to_string(binary()) :: {binary(), pos_integer()}
@spec read_packed(binary()) :: map() | [map()]

Parse a single message from a Micheline packed message.

examples

Examples

iex> Tezex.Micheline.read_packed("02000000210061010000000574657a6f730100000000010000000b63727970746f6e6f6d6963")
%{int: 33}

iex> Tezex.Micheline.read_packed("0200e1d22c")
%{int: -365_729}