@ -139,7 +139,7 @@ defmodule EthereumJSONRPC do
batched_requests
batched_requests
|> json_rpc ( config ( :url ) )
|> json_rpc ( config ( :url ) )
|> handle_get_block_by_number ( )
|> handle_get_block ( )
|> case do
|> case do
{ :ok , _next , results } -> { :ok , results }
{ :ok , _next , results } -> { :ok , results }
{ :error , reason } -> { :error , reason }
{ :error , reason } -> { :error , reason }
@ -153,7 +153,7 @@ defmodule EthereumJSONRPC do
block_start
block_start
|> build_batch_get_block_by_number ( block_end )
|> build_batch_get_block_by_number ( block_end )
|> json_rpc ( config ( :url ) )
|> json_rpc ( config ( :url ) )
|> handle_get_block_by_number ( )
|> handle_get_block ( )
end
end
@doc """
@doc """
@ -260,7 +260,7 @@ defmodule EthereumJSONRPC do
raise ( " bad jason " )
raise ( " bad jason " )
end
end
defp handle_get_block_by_number ( { :ok , results } ) do
defp handle_get_block ( { :ok , results } ) do
{ blocks , next } =
{ blocks , next } =
Enum . reduce ( results , { [ ] , :more } , fn
Enum . reduce ( results , { [ ] , :more } , fn
%{ " result " = > nil } , { blocks , _ } -> { blocks , :end_of_chain }
%{ " result " = > nil } , { blocks , _ } -> { blocks , :end_of_chain }
@ -279,7 +279,7 @@ defmodule EthereumJSONRPC do
} }
} }
end
end
defp handle_get_block_by_number ( { :error , reason } ) do
defp handle_get_block ( { :error , reason } ) do
{ :error , reason }
{ :error , reason }
end
end