Cartouche.OpenChain (Cartouche v0.2.0)

Copy Markdown View Source

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

Summary

Functions

Tries to lookup given signature of given type.

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

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

Functions

lookup(signature, type, opts \\ [])

@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(arg1, opts \\ [])

@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(arg1, opts \\ [])

@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"]}