Anoma.CairoResource.Utils (Anoma v0.29.0)

I am a bunch of utility functions useful for the Cairo backend.

Summary

Functions

Link to this function

binary_to_hex(binary)

@spec binary_to_hex(binary()) :: String.t()
Link to this function

check_list(lst)

@spec check_list([{:ok | :error, any()}]) :: {:ok, [any()]} | {:error, any()}
Link to this function

hex_to_n_byte_binary(hex_string, n)

@spec hex_to_n_byte_binary(String.t(), non_neg_integer()) ::
  {:ok, binary()} | {:error, term()}
Link to this function

integer_or_hex_to_n_byte_binary(value, n)

@spec integer_or_hex_to_n_byte_binary(
  integer() | String.t(),
  non_neg_integer()
) :: {:ok, binary()} | {:error, term()}
Link to this function

json_object_has_empty_key(json_object, key)

@spec json_object_has_empty_key(Jason.OrderedObject.t(), String.t()) :: boolean()
Link to this function

json_object_has_key(json_object, key)

@spec json_object_has_key(Jason.OrderedObject.t(), String.t()) :: boolean()
Link to this function

json_object_has_nonempty_key(json_object, key)

@spec json_object_has_nonempty_key(Jason.OrderedObject.t(), String.t()) :: boolean()
Link to this function

parse_json_field_to_binary32(json, field)

@spec parse_json_field_to_binary32(Jason.OrderedObject.t(), String.t()) ::
  {:ok, binary()} | {:error, term()}
Link to this function

parse_json_field_to_boolean(json, field)

@spec parse_json_field_to_boolean(Jason.OrderedObject.t(), String.t()) ::
  {:ok, boolean()} | {:error, term()}
Link to this function

parse_json_optional_field_to_binary32(json, field, default)

@spec parse_json_optional_field_to_binary32(
  Jason.OrderedObject.t(),
  String.t(),
  binary()
) :: {:ok, binary()} | {:error, term()}