Current section

40 Versions

Jump to

Compare versions

4 files changed
+23 additions
-4 deletions
  @@ -10,7 +10,7 @@ by adding `abi` to your list of dependencies in `mix.exs`:
10 10 ```elixir
11 11 def deps do
12 12 [
13 - {:abi, "~> 1.0.0-alpha2"}
13 + {:abi, "~> 1.0.0-alpha3"}
14 14 ]
15 15 end
16 16 ```
  @@ -1,6 +1,6 @@
1 1 {<<"links">>,[{<<"GitHub">>,<<"https://github.com/exthereum/abi">>}]}.
2 2 {<<"name">>,<<"abi">>}.
3 - {<<"version">>,<<"1.0.0-alpha2">>}.
3 + {<<"version">>,<<"1.0.0-alpha3">>}.
4 4 {<<"description">>,<<"Ethereum's ABI Interface">>}.
5 5 {<<"elixir">>,<<"~> 1.14">>}.
6 6 {<<"app">>,<<"abi">>}.
  @@ -19,7 +19,7 @@ defmodule ABI.FunctionSelector do
19 19 @type argument_type ::
20 20 %{:type => type, optional(:name) => String.t(), optional(:indexed) => boolean()}
21 21
22 - @type function_type :: :function | :constructor | :fallback | :receive
22 + @type function_type :: :function | :constructor | :fallback | :receive | :error | :event
23 23
24 24 @type state_mutability :: :nonpayable | :pure | :view | :payable
25 25
  @@ -262,6 +262,23 @@ defmodule ABI.FunctionSelector do
262 262 ],
263 263 returns: [%{name: "", type: {:array, :bytes}}]
264 264 }
265 +
266 + iex> ABI.FunctionSelector.parse_specification_item(%{"anonymous" => false, "inputs" => [%{"indexed" => true, "internalType" => "address", "name" => "z0", "type" => "address"}, %{"indexed" => true, "internalType" => "address", "name" => "z1", "type" => "address"}, %{"indexed" => false, "internalType" => "address", "name" => "z2", "type" => "address"}, %{"indexed" => false, "internalType" => "bytes32", "name" => "z3", "type" => "bytes32"}], "name" => "z4", "type" => "event"})
267 + %ABI.FunctionSelector{
268 + function: "z4",
269 + function_type: :event,
270 + state_mutability: nil,
271 + types: [
272 + %{name: "z0", type: :address},
273 + %{name: "z1", type: :address},
274 + %{name: "z2", type: :address},
275 + %{name: "z3", type: {:bytes, 32}}
276 + ],
277 + returns: nil
278 + }
279 +
280 + iex> ABI.FunctionSelector.parse_specification_item(%{"inputs" => [], "name" => "Abc", "type" => "error"})
281 + %ABI.FunctionSelector{function: "Abc", function_type: :error, state_mutability: nil, types: [], returns: nil}
265 282 """
266 283 def parse_specification_item(%{"type" => function_type} = item) do
267 284 input_types = Enum.map(Map.get(item, "inputs", []), &parse_specification_type/1)
  @@ -400,6 +417,8 @@ defmodule ABI.FunctionSelector do
400 417 def get_function_type("constructor"), do: :constructor
401 418 def get_function_type("receive"), do: :receive
402 419 def get_function_type("fallback"), do: :fallback
420 + def get_function_type("error"), do: :error
421 + def get_function_type("event"), do: :event
403 422
404 423 @doc false
405 424 @spec get_state_mutability(String.t()) :: state_mutability()
  @@ -4,7 +4,7 @@ defmodule ABI.Mixfile do
4 4 def project do
5 5 [
6 6 app: :abi,
7 - version: "1.0.0-alpha2",
7 + version: "1.0.0-alpha3",
8 8 elixir: "~> 1.14",
9 9 description: "Ethereum's ABI Interface",
10 10 package: [