Learn R Programming

shroomDK (version 0.3.0)

get_query_from_token: Get Query From Token

Description

Uses Flipside ShroomDK to access a Query Token (Run ID). This function is for pagination and multiple requests. It is best suited for debugging and testing new queries. Consider `auto_paginate_query()` for queries already known to work as expected. Note: To reduce payload it returns a list of outputs (separating column names from rows). See `clean_query()` for converting result to a data frame.

Usage

get_query_from_token(
  query_run_id,
  api_key,
  page_number = 1,
  page_size = 1000,
  result_format = "csv",
  api_url = "https://api-v2.flipsidecrypto.xyz/json-rpc"
)

Value

returns a list of jsonrpc, id, and result. Within result are: columnNames, columnTypes, rows, page, sql, format, originalQueryRun, redirectedToQueryRun use `clean_query()` to transform this into a data frame.

Arguments

query_run_id

queryRunId from `create_query_token()`, for token stored as `x`, use `x$result$queryRequest$queryRunId`

api_key

Flipside Crypto ShroomDK API Key

page_number

Results are cached, max 30MB of data per page.

page_size

Default 1000. Paginate via page_number. May return error if page_size causes data to exceed 30MB.

result_format

Default to csv. Options: csv and json.

api_url

default to https://api-v2.flipsidecrypto.xyz/json-rpc but upgradeable for user.

Examples

Run this code
if (FALSE) {
query <- create_query_token("SELECT * FROM ETHEREUM.CORE.FACT_TRANSACTIONS LIMIT 1000", api_key)
fact_transactions <- get_query_from_token(query$result$queryRequest$queryRunId, api_key, 1, 1000)
}

Run the code above in your browser using DataLab