Fixes for ganache JSON RPC mistakes

pull/1321/head
Konstantin Zolotarev 6 years ago
parent be37dc342e
commit 2f48f5f27c
  1. 5
      apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/receipt.ex
  2. 5
      apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/transaction.ex

@ -282,6 +282,11 @@ defmodule EthereumJSONRPC.Receipt do
end end
end end
# fixes for latest ganache JSON RPC
defp entry_to_elixir({key, quantity}) when key in ~w(r s v) do
:ignore
end
defp entry_to_elixir({key, value}) do defp entry_to_elixir({key, value}) do
{:error, {:unknown_key, %{key: key, value: value}}} {:error, {:unknown_key, %{key: key, value: value}}}
end end

@ -311,6 +311,11 @@ defmodule EthereumJSONRPC.Transaction do
{key, quantity_to_integer(quantity)} {key, quantity_to_integer(quantity)}
end end
# as always ganache has it's own vision on JSON RPC standard
defp entry_to_elixir({key, quantity}) when key in ~w(r s v) and quantity == nil do
{key, 0}
end
# quantity or nil for pending # quantity or nil for pending
defp entry_to_elixir({key, quantity_or_nil}) when key in ~w(blockNumber transactionIndex) do defp entry_to_elixir({key, quantity_or_nil}) when key in ~w(blockNumber transactionIndex) do
elixir = elixir =

Loading…
Cancel
Save