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