Retrieves events that belong to a given block

get_events_by_block_number(
  block_number,
  only_confirmed = NULL,
  max_attempts = 3L
)

Arguments

block_number

(character): number of the block of interest.

only_confirmed

(boolean or NULL): if NULL (default) or FALSE, results are returned for both confirmed and unconfirmed transactions. If TRUE, only results for confirmed transactions are returned.

max_attempts

(integer, positive): specifies the maximum number of additional attempts to call a URL if the first attempt fails (i.e. its call status is different from 200). Additional attempts are implemented with an exponential backoff. Defaults to 3.

Value

A nested tibble where each row corresponds to an event associated with the block of interest. This tibble contains the following columns:

  • tx_id (character): transaction ID;

  • block_number (character): same as the argument block_number;

  • block_timestamp (POSIXct, UTC timezone);

  • contract_address (character): adress of the smart contract that triggered the event;

  • event_name (character): possible values of this column are contract- and event-specific;

  • event_data (list): each element of this list contains a named list with additional attributes of the event.

If no events are found for the specified combination of query parameters, nothing (NULL) is returned, with a console message "No data found".

Details

The exact content of event_data in the tibble returned by this function will be contract- and event-specific. Thus, these data are returned in the form of a named R list as-is, i.e. without any processing. Users are advised to develop their own, task-specific, logic to process event attributes.

Examples

r <- get_events_by_block_number(block_number = "15354550") print(r)
#> # A tibble: 23 x 6 #> tx_id block_number timestamp contract_address event_name event_data #> <chr> <chr> <dttm> <chr> <chr> <list> #> 1 ba39… 15354550 2019-12-14 10:05:30 TFRLPB1kiCyKRSM… RingCreate <named li… #> 2 0f81… 15354550 2019-12-14 10:05:30 TUezhPtdMYByMLt… Transfer <named li… #> 3 dd7a… 15354550 2019-12-14 10:05:30 TFRLPB1kiCyKRSM… RingCreate <named li… #> 4 24e0… 15354550 2019-12-14 10:05:30 TWmhXhXjgXTj87t… DiceResult <named li… #> 5 5d7e… 15354550 2019-12-14 10:05:30 TUCwcEhuAzPUrde… Transfer <named li… #> 6 7834… 15354550 2019-12-14 10:05:30 TWmhXhXjgXTj87t… DiceCreate <named li… #> 7 8f0d… 15354550 2019-12-14 10:05:30 TCt3U4qRxJy4nCW… DiceResul… <named li… #> 8 6dce… 15354550 2019-12-14 10:05:30 THeo5hYWegUqbNS… PayedEvent <named li… #> 9 2970… 15354550 2019-12-14 10:05:30 TVRqMwBZU13c4wx… GetToken <named li… #> 10 0f82… 15354550 2019-12-14 10:05:30 TFRLPB1kiCyKRSM… RingCreate <named li… #> # … with 13 more rows