Returns transactions that took place within a user-specified period of time

get_tx_for_time_range(
  min_timestamp = 0,
  max_timestamp = NULL,
  add_contract_data = TRUE,
  max_attempts = 3L
)

Arguments

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).

add_contract_data

(boolean): if TRUE (default), adds column contract_data to the resultant tibble (see Value).

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 one transaction. A detailed description of the content of this tibble can be found in the help file for get_tx_info_by_id().

Details

The number of transactions that take place on the TRON blockchain is very large, and thus users are advised to choose min_timestamp and max_timestamp wisely. If the requested time range is too large, the maximum number of transactions returned by the underlying Tronscan API will be capped at 10000, and the processing time may become prohibitively long. Chunking the time range of interest into smaller periods can help to avoid gaps in data in such cases. However, users would have to implement their own logic for that.

Examples

# \donttest{ min_timestamp <- "1577836800000" max_timestamp <- "1577836803000" tx_df <- get_tx_for_time_range(min_timestamp, max_timestamp)
#>
#> - Fetching data... Elapsed time: 00:00:00
#>
#> \ Fetching data... Elapsed time: 00:00:00
#>
#> Processing data... [>---------------------------------------------------] 2%
#>
#> Processing data... [==>-------------------------------------------------] 5%
#>
#> Processing data... [===>------------------------------------------------] 7%
#>
#> Processing data... [====>-----------------------------------------------] 10%
#>
#> Processing data... [=====>----------------------------------------------] 12%
#>
#> Processing data... [=======>--------------------------------------------] 15%
#>
#> Processing data... [========>-------------------------------------------] 17%
#>
#> Processing data... [=========>------------------------------------------] 20%
#>
#> Processing data... [==========>-----------------------------------------] 22%
#>
#> Processing data... [============>---------------------------------------] 24%
#>
#> Processing data... [=============>--------------------------------------] 27%
#>
#> Processing data... [==============>-------------------------------------] 29%
#>
#> Processing data... [===============>------------------------------------] 32%
#>
#> Processing data... [=================>----------------------------------] 34%
#>
#> Processing data... [==================>---------------------------------] 37%
#>
#> Processing data... [===================>--------------------------------] 39%
#>
#> Processing data... [=====================>------------------------------] 41%
#>
#> Processing data... [======================>-----------------------------] 44%
#>
#> Processing data... [=======================>----------------------------] 46%
#>
#> Processing data... [========================>---------------------------] 49%
#>
#> Processing data... [==========================>-------------------------] 51%
#>
#> Processing data... [===========================>------------------------] 54%
#>
#> Processing data... [============================>-----------------------] 56%
#>
#> Processing data... [=============================>----------------------] 59%
#>
#> Processing data... [===============================>--------------------] 61%
#>
#> Processing data... [================================>-------------------] 63%
#>
#> Processing data... [=================================>------------------] 66%
#>
#> Processing data... [===================================>----------------] 68%
#>
#> Processing data... [====================================>---------------] 71%
#>
#> Processing data... [=====================================>--------------] 73%
#>
#> Processing data... [======================================>-------------] 76%
#>
#> Processing data... [========================================>-----------] 78%
#>
#> Processing data... [=========================================>----------] 80%
#>
#> Processing data... [==========================================>---------] 83%
#>
#> Processing data... [===========================================>--------] 85%
#>
#> Processing data... [=============================================>------] 88%
#>
#> Processing data... [==============================================>-----] 90%
#>
#> Processing data... [===============================================>----] 93%
#>
#> Processing data... [================================================>---] 95%
#>
#> Processing data... [==================================================>-] 98%
#>
#> Processing data... [====================================================] 100%
#>
#>
print(tx_df)
#> # A tibble: 41 x 20 #> request_time tx_id block_number timestamp contract_result #> <dttm> <chr> <chr> <dttm> <chr> #> 1 2021-07-12 22:04:08 5f13111… 15860581 2020-01-01 00:00:00 SUCCESS #> 2 2021-07-12 22:04:08 a186fc1… 15860581 2020-01-01 00:00:00 SUCCESS #> 3 2021-07-12 22:04:09 bf9c96d… 15860581 2020-01-01 00:00:00 SUCCESS #> 4 2021-07-12 22:04:10 f342f3e… 15860581 2020-01-01 00:00:00 SUCCESS #> 5 2021-07-12 22:04:10 90ee18d… 15860581 2020-01-01 00:00:00 SUCCESS #> 6 2021-07-12 22:04:10 0c01304… 15860581 2020-01-01 00:00:00 SUCCESS #> 7 2021-07-12 22:04:11 bcfbf1b… 15860581 2020-01-01 00:00:00 SUCCESS #> 8 2021-07-12 22:04:11 b9889be… 15860581 2020-01-01 00:00:00 SUCCESS #> 9 2021-07-12 22:04:11 44b123a… 15860581 2020-01-01 00:00:00 SUCCESS #> 10 2021-07-12 22:04:11 084d57b… 15860581 2020-01-01 00:00:00 SUCCESS #> # … with 31 more rows, and 15 more variables: confirmed <lgl>, #> # confirmations_count <int>, sr_confirm_list <list>, contract_type <chr>, #> # from_address <chr>, to_address <chr>, is_contract_from_address <lgl>, #> # is_contract_to_address <lgl>, costs <list>, trx_transfer <dbl>, #> # trc10_transfer <list>, trc20_transfer <lgl>, internal_tx <list>, #> # info <lgl>, contract_data <list>
# }