pull/2052/head
Ayrat Badykov 6 years ago
parent 1a97e35b2a
commit 2398d8eb7d
No known key found for this signature in database
GPG Key ID: B44668E265E9396F
  1. 3
      apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/contract.ex
  2. 3
      apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/encoder.ex

@ -53,13 +53,14 @@ defmodule EthereumJSONRPC.Contract do
|> Enum.into(%{}, &{&1.id, &1})
Enum.map(requests_with_index, fn {%{function_name: function_name}, index} ->
selectors = Enum.filter(parsed_abi, fn p_abi -> p_abi.function == function_name end)
indexed_responses[index]
|> case do
nil ->
{:error, "No result"}
response ->
selectors = Enum.filter(parsed_abi, fn p_abi -> p_abi.function == function_name end)
{^index, result} = Encoder.decode_result(response, selectors)
result
end

@ -42,7 +42,8 @@ defmodule EthereumJSONRPC.Encoder do
end
def decode_result(result, selectors) when is_list(selectors) do
Enum.map(selectors, fn selector ->
selectors
|> Enum.map(fn selector ->
try do
decode_result(result, selector)
rescue

Loading…
Cancel
Save