Retrieves events associated with a smart contract address

get_events_by_contract_address(
  address,
  event_name = NULL,
  block_number = NULL,
  only_confirmed = NULL,
  only_unconfirmed = NULL,
  min_timestamp = 0,
  max_timestamp,
  direction = "desc",
  max_attempts = 3L
)

Arguments

address

(character): address of the account of interest, either in base58check or hex format.

event_name

(character): name of the event of interest (e.g., Transfer). Defaults to NULL.

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.

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.

min_timestamp

(numeric or character): a Unix timestamp (including milliseconds), which defines the beginning of the period of interest (inclusive). Defaults to 0.

max_timestamp

(numeric or character): a Unix timestamp (including milliseconds), which defines the end of the period of interest (inclusive).

direction

(character): specifies the direction of ordering the results - descending (desc) or ascending (asc).

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

address <- "TKttnV3FSY1iEoAwB4N52WK2DxdV94KpSd" min_timestamp <- "1576317786000" max_timestamp <- "1576317996000" get_events_by_contract_address( address = address, min_timestamp = min_timestamp, max_timestamp = max_timestamp )
#> # A tibble: 17 x 6 #> tx_id block_number timestamp contract_address event_name event_data #> <chr> <chr> <dttm> <chr> <chr> <list> #> 1 d52e… 15354570 2019-12-14 10:06:30 TKttnV3FSY1iEoA… Transfer <named li… #> 2 3e14… 15354566 2019-12-14 10:06:18 TKttnV3FSY1iEoA… Transfer <named li… #> 3 3e14… 15354566 2019-12-14 10:06:18 TKttnV3FSY1iEoA… Approval <named li… #> 4 a654… 15354562 2019-12-14 10:06:06 TKttnV3FSY1iEoA… Transfer <named li… #> 5 1714… 15354554 2019-12-14 10:05:42 TKttnV3FSY1iEoA… Transfer <named li… #> 6 1714… 15354554 2019-12-14 10:05:42 TKttnV3FSY1iEoA… Approval <named li… #> 7 99a8… 15354550 2019-12-14 10:05:30 TKttnV3FSY1iEoA… Transfer <named li… #> 8 904a… 15354539 2019-12-14 10:04:57 TKttnV3FSY1iEoA… Transfer <named li… #> 9 904a… 15354539 2019-12-14 10:04:57 TKttnV3FSY1iEoA… Approval <named li… #> 10 c535… 15354538 2019-12-14 10:04:54 TKttnV3FSY1iEoA… Transfer <named li… #> 11 c535… 15354538 2019-12-14 10:04:54 TKttnV3FSY1iEoA… Approval <named li… #> 12 72c9… 15354538 2019-12-14 10:04:54 TKttnV3FSY1iEoA… Transfer <named li… #> 13 ef37… 15354537 2019-12-14 10:04:51 TKttnV3FSY1iEoA… Transfer <named li… #> 14 f4a0… 15354519 2019-12-14 10:03:57 TKttnV3FSY1iEoA… Transfer <named li… #> 15 f4a0… 15354519 2019-12-14 10:03:57 TKttnV3FSY1iEoA… Approval <named li… #> 16 855b… 15354517 2019-12-14 10:03:51 TKttnV3FSY1iEoA… Transfer <named li… #> 17 33a9… 15354508 2019-12-14 10:03:24 TKttnV3FSY1iEoA… Transfer <named li
get_events_by_contract_address( address = address, min_timestamp = min_timestamp, max_timestamp = max_timestamp, event_name = "Transfer", direction = "asc" )
#> # A tibble: 12 x 6 #> tx_id block_number timestamp contract_address event_name event_data #> <chr> <chr> <dttm> <chr> <chr> <list> #> 1 33a9… 15354508 2019-12-14 10:03:24 TKttnV3FSY1iEoA… Transfer <named li… #> 2 855b… 15354517 2019-12-14 10:03:51 TKttnV3FSY1iEoA… Transfer <named li… #> 3 f4a0… 15354519 2019-12-14 10:03:57 TKttnV3FSY1iEoA… Transfer <named li… #> 4 ef37… 15354537 2019-12-14 10:04:51 TKttnV3FSY1iEoA… Transfer <named li… #> 5 72c9… 15354538 2019-12-14 10:04:54 TKttnV3FSY1iEoA… Transfer <named li… #> 6 c535… 15354538 2019-12-14 10:04:54 TKttnV3FSY1iEoA… Transfer <named li… #> 7 904a… 15354539 2019-12-14 10:04:57 TKttnV3FSY1iEoA… Transfer <named li… #> 8 99a8… 15354550 2019-12-14 10:05:30 TKttnV3FSY1iEoA… Transfer <named li… #> 9 1714… 15354554 2019-12-14 10:05:42 TKttnV3FSY1iEoA… Transfer <named li… #> 10 a654… 15354562 2019-12-14 10:06:06 TKttnV3FSY1iEoA… Transfer <named li… #> 11 3e14… 15354566 2019-12-14 10:06:18 TKttnV3FSY1iEoA… Transfer <named li… #> 12 d52e… 15354570 2019-12-14 10:06:30 TKttnV3FSY1iEoA… Transfer <named li