|
|
@ -188,16 +188,11 @@ defmodule ExW3 do |
|
|
|
@spec reformat_abi([]) :: %{} |
|
|
|
@spec reformat_abi([]) :: %{} |
|
|
|
@doc "Reformats abi from list to map with event and function names as keys" |
|
|
|
@doc "Reformats abi from list to map with event and function names as keys" |
|
|
|
def reformat_abi(abi) do |
|
|
|
def reformat_abi(abi) do |
|
|
|
Map.new(Enum.map( |
|
|
|
|
|
|
|
abi, |
|
|
|
abi |
|
|
|
fn x -> |
|
|
|
|> Enum.map(&map_abi/1) |
|
|
|
case {x["name"], x["type"]} do |
|
|
|
|> Map.new |
|
|
|
{nil, "constructor"} -> {"constructor", x} |
|
|
|
|
|
|
|
{nil, "fallback"} -> {"fallback", x} |
|
|
|
|
|
|
|
{name, _} -> {x["name"], x} |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
)) |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
@spec load_abi(binary()) :: [] |
|
|
|
@spec load_abi(binary()) :: [] |
|
|
@ -304,6 +299,16 @@ defmodule ExW3 do |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ABI mapper |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
defp map_abi(x) do |
|
|
|
|
|
|
|
case {x["name"], x["type"]} do |
|
|
|
|
|
|
|
{nil, "constructor"} -> {"constructor", x} |
|
|
|
|
|
|
|
{nil, "fallback"} -> {"fallback", x} |
|
|
|
|
|
|
|
{name, _} -> {name, x} |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
defmodule Poller do |
|
|
|
defmodule Poller do |
|
|
|
use GenServer |
|
|
|
use GenServer |
|
|
|
|
|
|
|
|
|
|
|