Skip to content

Commit

Permalink
apply changes to ethers facade
Browse files Browse the repository at this point in the history
  • Loading branch information
joaop21 committed Nov 18, 2024
1 parent 64cb7f6 commit acf5644
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions lib/ethers.ex
Original file line number Diff line number Diff line change
Expand Up @@ -564,19 +564,11 @@ defmodule Ethers do

@doc false
@spec rpc_client() :: atom()
def rpc_client, do: Application.get_env(:ethers, :rpc_client, Ethereumex.HttpClient)
defdelegate rpc_client(), to: Ethers.RpcClient

@doc false
@spec get_rpc_client(Keyword.t()) :: {atom(), Keyword.t()}
def get_rpc_client(opts) do
module =
case Keyword.fetch(opts, :rpc_client) do
{:ok, module} when is_atom(module) -> module
:error -> Ethers.rpc_client()
end

{module, Keyword.get(opts, :rpc_opts, [])}
end
defdelegate get_rpc_client(opts), to: Ethers.RpcClient

defp pre_process(tx_data, overrides, :call = _action, _opts) do
{block, overrides} = Keyword.pop(overrides, :block, "latest")
Expand Down Expand Up @@ -657,8 +649,8 @@ defmodule Ethers do
log_params =
event_filter
|> EventFilter.to_map(overrides)
|> ensure_hex_value(:fromBlock)
|> ensure_hex_value(:toBlock)
|> ensure_hex_value(:from_block)
|> ensure_hex_value(:to_block)

{:ok, log_params}
end
Expand Down

0 comments on commit acf5644

Please sign in to comment.