|
|
@ -61,20 +61,6 @@ defmodule EthereumJSONRPC do |
|
|
|
""" |
|
|
|
""" |
|
|
|
@type timestamp :: String.t() |
|
|
|
@type timestamp :: String.t() |
|
|
|
|
|
|
|
|
|
|
|
@doc """ |
|
|
|
|
|
|
|
Lists changes for a given filter subscription. |
|
|
|
|
|
|
|
""" |
|
|
|
|
|
|
|
def check_for_updates(filter_id) do |
|
|
|
|
|
|
|
request = %{ |
|
|
|
|
|
|
|
"id" => filter_id, |
|
|
|
|
|
|
|
"jsonrpc" => "2.0", |
|
|
|
|
|
|
|
"method" => "eth_getFilterChanges", |
|
|
|
|
|
|
|
"params" => [filter_id] |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
json_rpc(request, config(:url)) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@doc """ |
|
|
|
@doc """ |
|
|
|
Fetches configuration for this module under `key` |
|
|
|
Fetches configuration for this module under `key` |
|
|
|
|
|
|
|
|
|
|
@ -190,22 +176,6 @@ defmodule EthereumJSONRPC do |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
@doc """ |
|
|
|
|
|
|
|
Creates a filter subscription that can be polled for retreiving new blocks. |
|
|
|
|
|
|
|
""" |
|
|
|
|
|
|
|
def listen_for_new_blocks do |
|
|
|
|
|
|
|
id = DateTime.utc_now() |> DateTime.to_unix() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
request = %{ |
|
|
|
|
|
|
|
"id" => id, |
|
|
|
|
|
|
|
"jsonrpc" => "2.0", |
|
|
|
|
|
|
|
"method" => "eth_newBlockFilter", |
|
|
|
|
|
|
|
"params" => [] |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
json_rpc(request, config(:url)) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@doc """ |
|
|
|
@doc """ |
|
|
|
Converts `t:nonce/0` to `t:non_neg_integer/0` |
|
|
|
Converts `t:nonce/0` to `t:non_neg_integer/0` |
|
|
|
""" |
|
|
|
""" |
|
|
|