# `Tezex.Micheline`
[🔗](https://github.com/objkt-com/tezex/blob/v4.0.0/lib/micheline.ex#L1)

Serialize/deserialize data to/from Tezos Micheline optimized binary representation.

# `pack_types`

```elixir
@type pack_types() :: nil | :address | :bytes | :int | :key_hash | :nat | :string
```

# `unpack_result`

```elixir
@type unpack_result() :: binary() | integer() | map() | [unpack_result()]
```

# `pack`

```elixir
@spec pack(binary() | integer() | map(), pack_types()) :: nonempty_binary()
```

Serialize a piece of data to its optimized binary representation.

## Examples
    iex> pack(-6407, :int)
    "0500c764"
    iex> pack(%{"prim" => "Pair", "args" => [%{"int" => "-33"}, %{"int" => "71"}]})
    "0507070061008701"

# `unpack`

```elixir
@spec unpack(binary(), pack_types()) :: unpack_result()
```

Deserialize a piece of data from its optimized binary representation.

## Examples
    iex> unpack("050a0000001601e67bac124dff100a57644de0cf26d341ebf9492600", :address)
    "KT1VbT8n6YbrzPSjdAscKfJGDDNafB5yHn1H"
    iex> unpack("0507070001000c")
    %{"prim" => "Pair", "args" => [%{"int" => "1"}, %{"int" => "12"}]}

---

*Consult [api-reference.md](api-reference.md) for complete listing*
