Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Features: Adds eth_get_logs to client. #5

Merged
merged 1 commit into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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) :: {:ok, any} | {:error, any}
@callback eth_get_logs(filter_params, opts) :: {:ok, any} | {:error, 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, :not_found}

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