Retrieves events associated with the most recent block

get_events_of_latest_block(only_confirmed = FALSE, max_attempts = 3L)

Arguments

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 account of interest. This tibble contains the following columns:

  • tx_id (character): transaction ID;

  • block_number (character);

  • timestamp (POSIXct, UTC timezone);

  • contract_address (character): adress of the smart contract that implemented 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_of_latest_block() print(r)
#> # A tibble: 5 x 6 #> tx_id block_number timestamp contract_address event_name event_data #> <chr> <chr> <dttm> <chr> <chr> <list> #> 1 91395… 31884290 2021-07-12 22:03:54 TR7NHqjeKQxGTCi… Transfer <named li… #> 2 e9382… 31884290 2021-07-12 22:03:54 TR7NHqjeKQxGTCi… Transfer <named li… #> 3 d86ef… 31884290 2021-07-12 22:03:54 TR7NHqjeKQxGTCi… Transfer <named li… #> 4 e80ff… 31884290 2021-07-12 22:03:54 TUXDfjhAuwvgPeG… Transfer <named li… #> 5 a419c… 31884290 2021-07-12 22:03:54 TQFAp3aYqtYcG7o… Deposit <named li