Macros: Streamline Requests: Core Requests - FlipsideCrypto/fsc-evm GitHub Wiki
The following macros are intended to be used to create and maintain various models. These macros can be accessed via version >=v1.0.0
of the fsc-evm
package. Please see the fsc-evm
installation instructions in the README for more details on how to access and utilize this macro effectively.
The Core Streamline Requests macros are used to send requests for core, foundational EVM data to the nodes via EVM JSON-RPC API Methods.
streamline_core_chainhead
Usage
This macro constructs an API request to retrieve the latest block number using the eth_blockNumber
method. It returns the Chainhead response and converts the block number from hexadecimal to an integer. This macro is essential for obtaining core, foundational EVM data from the nodes.
fsc_evm.streamline_core_chainhead
Parameters
Note: Parameters with default values must be ordered after non-default parameters.
Parameter | Type | Default | Description |
---|---|---|---|
vault_secret_path |
String | - | The path to the vault secret used for authentication in API requests. The key:value pairing typically associated with this path is '{Service}/{Authentication}' . |
quantum_state |
String | - | Indicates the state of the quantum request. Acceptable values are 'streamline' or 'livequery' . If not specified, both states are enabled. Can be overridden with fsc-quantum-state header. |
api_url |
String | '{Service}/{Authentication}' |
The URL for the API service. |
streamline_core_requests
Usage
This macro constructs a SQL query to retrieve block numbers based on the specified model and type. It filters blocks based on their presence in various tables and conditions, and it constructs a JSON-RPC API request to fetch additional data related to the blocks, based on the Method passed. The results can be limited with the query_limit
parameter.
fsc_evm.streamline_core_requests
Parameters
Note: Parameters with default values must be ordered after non-default parameters.
Parameter | Type | Default | Description |
---|---|---|---|
model_type |
String | - | Specifies the type of model to use. Acceptable values are 'realtime' or 'history' , determining how block numbers are filtered. |
model |
String | - | Defines the specific model for the request. Possible values: 'confirmed_blocks' , 'blocks_transactions' , 'receipts' , 'traces' . |
quantum_state |
String | - | Indicates the state of the quantum request. Acceptable values are 'streamline' or 'livequery' . If not specified, both states are enabled. |
vault_secret_path |
String | - | The path to the vault secret for authentication. |
query_limit |
Integer | - | Limits the number of results returned by the query. If not specified, all results will be returned. |
testing_limit |
Integer | - | This will pass in a limit function to the CTE step before LiveQuery is invoked in order to limit node request volume. Intended only for use in dev when building for a new chain. |
api_url |
String | '{Service}/{Authentication}' |
The URL for the API service. |
order_by_clause |
String | 'ORDER BY partition_key ASC' |
Specifies the SQL ORDER BY clause to sort the results. |
new_build |
Boolean | false |
Will ignore logic for retry and lookbacks when set to true . Used primarily for standing up new builds |
Example:
{{ fsc_evm.streamline_core_requests(
model_type = 'realtime',
model = 'blocks_transactions',
quantum_state = 'streamline',
api_url = '{Service}/{Authentication}',
vault_secret_path = "vault/prod/ethereum/quicknode/mainnet",
order_by_clause='ORDER BY partition_key ASC'
query_limit = 300
) }}