Merge branch 'master' into docker

pull/1401/head
Andrew Cravenho 6 years ago committed by GitHub
commit ea001f914e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/receipt.ex
  2. 7
      apps/ethereum_jsonrpc/test/ethereum_jsonrpc/receipt_test.exs

@ -258,7 +258,14 @@ defmodule EthereumJSONRPC.Receipt do
defp entry_to_elixir({key, quantity})
when key in ~w(blockNumber cumulativeGasUsed gasUsed transactionIndex) do
{:ok, {key, quantity_to_integer(quantity)}}
result =
if is_nil(quantity) do
nil
else
quantity_to_integer(quantity)
end
{:ok, {key, result}}
end
defp entry_to_elixir({"logs" = key, logs}) do

@ -30,4 +30,11 @@ defmodule EthereumJSONRPC.ReceiptTest do
assert Receipt.to_elixir(%{"status" => nil, "transactionHash" => "0x0"}) == %{"transactionHash" => "0x0"}
end
end
test "leaves nil if blockNumber is nil" do
assert Receipt.to_elixir(%{"blockNumber" => nil, "transactionHash" => "0x0"}) == %{
"transactionHash" => "0x0",
"blockNumber" => nil
}
end
end

Loading…
Cancel
Save