Skip to content

Commit

Permalink
Adds eth_get_logs to client.
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesduncombe committed Oct 9, 2023
1 parent 13731aa commit 1cffccc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/tt_eth/behaviours/chain_client.ex
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ defmodule TTEth.Behaviours.ChainClient do
@callback eth_get_transaction_count(account :: address, block_id) :: any
@callback eth_get_transaction_count(account :: address, block_id, opts) :: any

@callback eth_get_logs(filter_params) :: any
@callback eth_get_logs(filter_params, opts) :: any

@callback eth_new_filter(filter_params) :: any
@callback eth_new_filter(filter_params, opts) :: any

Expand Down
4 changes: 4 additions & 0 deletions lib/tt_eth/chain_client.ex
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ defmodule TTEth.ChainClient do
def eth_get_transaction_count(address, block \\ "latest", opts \\ []),
do: address |> HttpClient.eth_get_transaction_count(block, opts)

@impl ChainClient
def eth_get_logs(params, opts \\ []),
do: params |> HttpClient.eth_get_logs(opts)

@impl ChainClient
def eth_new_filter(params, opts \\ []),
do: params |> HttpClient.eth_new_filter(opts)
Expand Down
4 changes: 4 additions & 0 deletions lib/tt_eth/chain_client_mock_impl.ex
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ defmodule TTEth.ChainClientMockImpl do
def eth_get_transaction_count(_address, _block \\ "latest", _opts \\ []),
do: {:ok, "0x42"}

@impl ChainClient
def eth_get_logs(_params, _opts \\ []),
do: :error

@impl ChainClient
def eth_new_filter(_params, _opts \\ []),
do: :error
Expand Down

0 comments on commit 1cffccc

Please sign in to comment.