Etherscan v2.0.2 Etherscan.API.Logs
Module to wrap Etherscan event log endpoints.
Link to this section Summary
Functions
An alternative API to the native eth_getLogs
Returns a list of valid topic operators for get_logs/1
Link to this section Functions
Link to this function
get_logs(params)
get_logs(params :: map()) :: {:ok, [Etherscan.Log.t()]} | {:error, atom()}
An alternative API to the native eth_getLogs.
See operators/0
for all valid topic operators.
params[fromBlock|toBlock]
can be a block number or the string "latest"
.
Either the address
or topic(x)
params are required.
For API performance and security considerations, only the first 1000 results are returned.
Example
iex> params = %{
address: "0x33990122638b9132ca29c723bdf037f1a891a70c", # Ethereum blockchain address
fromBlock: 0, # Start block number
toBlock: "latest", # End block number
topic0: "0xf63780e752c6a54a94fc52715dbc5518a3b4c3c2833d301a204226548a2a8545", # The first topic filter
topic0_1_opr: "and", # The topic operator between topic0 and topic1
topic1: "", # The second topic filter
topic1_2_opr: "and", # The topic operator between topic1 and topic2
topic2: "", # The third topic filter
topic2_3_opr: "and", # The topic operator between topic2 and topic3
topic3: "", # The fourth topic filter
}
iex> Etherscan.get_logs(params)
{:ok, [%Etherscan.Log{}]}
Returns a list of valid topic operators for get_logs/1
.
Example
iex> Etherscan.API.Logs.operators()
["and", "or"]