eth_event v0.1.1 EthEvent.Api.Block View Source
Defines the Block
event.
In order to request a Block
, you have to specify the desired block_number
by setting it in the event struct itself (if no block_number
is set, then
defaults to "latest"
) e.g:
> alias EthEvent.Api.Block
> {:ok, %Block{} = block} = Block.query(%Block{block_number: 0})
> block
%Block{
block_number: 0,
block_hash: "0xb7381ade07e036e0f9195446f54b6c5e6228a10d3ff750dedb8a5c2372db2b3c",
type: "mined",
...
timestamp: #DateTime<...>
}
Link to this section Summary
Link to this section Functions
Link to this function
build_query(event, options)
View Source
build_query(EthEvent.Schema.t(), Keyword.t()) :: {:ok, term()} | {:error, term()}
Builds the query to get the basic information of a block. It receives the
Block
event
and some options
as Keyword
list.
Link to this function
build_result(event, result)
View Source
build_result(EthEvent.Schema.t(), term()) :: {:ok, EthEvent.Schema.t()} | {:error, term()}
Decodes the result
from the Block
event
query and places it in the
Block
struct.