mirror of
https://github.com/FlipsideCrypto/terra-models.git
synced 2026-02-06 13:51:46 +00:00
chainhead to LQ
This commit is contained in:
parent
b7f148a83f
commit
cdf9c71a74
@ -3,15 +3,17 @@
|
||||
tags = ['streamline_view']
|
||||
) }}
|
||||
|
||||
|
||||
{% if execute %}
|
||||
{% set height = run_query('SELECT streamline.udf_get_chainhead()') %}
|
||||
{% set block_height = height.columns[0].values()[0] %}
|
||||
{% else %}
|
||||
{% set block_height = 0 %}
|
||||
{% endif %}
|
||||
|
||||
SELECT
|
||||
height as block_id
|
||||
_id AS block_number
|
||||
FROM
|
||||
TABLE(streamline.udtf_get_base_table({{block_height}}))
|
||||
{{ source(
|
||||
'crosschain_silver',
|
||||
'number_sequence'
|
||||
) }}
|
||||
WHERE
|
||||
_id <= (
|
||||
SELECT
|
||||
MAX(block_number)
|
||||
FROM
|
||||
{{ ref('streamline__chainhead') }}
|
||||
)
|
||||
|
||||
27
models/silver/streamline/streamline__chainhead.sql
Normal file
27
models/silver/streamline/streamline__chainhead.sql
Normal file
@ -0,0 +1,27 @@
|
||||
{{ config (
|
||||
materialized = "view",
|
||||
tags = ['streamline_view']
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
{{ target.database }}.live.udf_api(
|
||||
'POST',
|
||||
'{Service}',
|
||||
OBJECT_CONSTRUCT(
|
||||
'Content-Type',
|
||||
'application/json',
|
||||
'fsc-quantum-state',
|
||||
'livequery'
|
||||
),
|
||||
OBJECT_CONSTRUCT(
|
||||
'id',
|
||||
0,
|
||||
'jsonrpc',
|
||||
'2.0',
|
||||
'method',
|
||||
'status',
|
||||
'params',
|
||||
[]
|
||||
),
|
||||
'Vault/prod/terra/mainnet/publicnode'
|
||||
) :data :result :sync_info :latest_block_height :: INT - 500 AS block_number
|
||||
Loading…
Reference in New Issue
Block a user