@ -319,6 +319,8 @@ defmodule EthereumJSONRPC.Block do
@spec elixir_to_transactions(elixir) :: Transactions.elixir()
def elixir_to_transactions(%{"transactions" => transactions}), do: transactions
def elixir_to_transactions(_), do: []
@doc """
Get `t:EthereumJSONRPC.Uncles.elixir/0` from `t:elixir/0`.
@ -56,4 +56,10 @@ defmodule EthereumJSONRPC.BlockTest do
}
end
describe "elixir_to_transactions/1" do
test "converts to empty list if there is not transaction key" do
assert Block.elixir_to_transactions(%{}) == []