# `Cartouche.OpenChain`
[🔗](https://github.com/zenhive/cartouche/blob/main/lib/cartouche/open_chain.ex#L1)

API Client for [OpenChain.xyz](https://openchain.xyz] API.

# `lookup`

```elixir
@spec lookup(binary(), :function | :event, Keyword.t()) ::
  {:ok, String.t()} | {:error, String.t()}
```

Tries to lookup given signature of given type.

## Examples

    iex> Cartouche.OpenChain.lookup(<<8, 195, 121, 160>>, :function)
    {:ok, "Error(string)"}

# `lookup_error`

```elixir
@spec lookup_error(binary(), Keyword.t()) :: {:ok, [term()]} | {:error, String.t()}
```

Looks up and tries to decode a given error message from its ABI-encoded form.

## Examples

    iex> Cartouche.OpenChain.lookup_error(~h[0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001b43616c6c6572206e6f74206174746573746572206d616e616765720000000000])
    {:ok, ["Caller not attester manager"]}

# `lookup_error_and_values`

```elixir
@spec lookup_error_and_values(binary(), Keyword.t()) ::
  {:ok, String.t(), [term()]} | {:error, String.t()}
```

  Looks up an error and decodes its values, returning both.

    ## Examples

        iex> Cartouche.OpenChain.lookup_error_and_values(~h[0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001b43616c6c6572206e6f74206174746573746572206d616e616765720000000000])
        {:ok, "Error(string)", ["Caller not attester manager"]}

---

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