Retrieves events associated with a transaction

get_events_by_tx_id(
  tx_id,
  only_confirmed = NULL,
  only_unconfirmed = NULL,
  max_attempts = 3L
)

Arguments

tx_id

(character): transaction ID.

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.

only_unconfirmed

(boolean or NULL): if NULL (default) or FALSE, results are returned for both confirmed and unconfirmed transactions. If TRUE, only results for unconfirmed transactions are returned. Cannot be used simultanously with the only_confirmed argument.

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

tx_id <- "270e992bf22a271008032ec09a51616ed963b74f4d808b0fd74fc82341a81391" r <- get_events_by_tx_id(tx_id) 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 270e9… 26014725 2020-12-19 16:52:15 TJRq8Sc2Dnx2PJZ… onSponsor <named li… #> 2 270e9… 26014725 2020-12-19 16:52:15 TUTik4srgKuzgXo… onTokenPu… <named li… #> 3 270e9… 26014725 2020-12-19 16:52:15 TJRq8Sc2Dnx2PJZ… onPrice <named li… #> 4 270e9… 26014725 2020-12-19 16:52:15 TJRq8Sc2Dnx2PJZ… onLeaderB… <named li… #> 5 270e9… 26014725 2020-12-19 16:52:15 TJRq8Sc2Dnx2PJZ… onTokenSe… <named li