mirror of
https://github.com/FlipsideCrypto/near-models.git
synced 2026-02-06 11:26:52 +00:00
add old one
This commit is contained in:
parent
11da476509
commit
0e9bf5f2a4
27
macros/udfs/create_udf_get_chainhead.sql
Normal file
27
macros/udfs/create_udf_get_chainhead.sql
Normal file
@ -0,0 +1,27 @@
|
||||
{% macro create_UDF_GET_CHAINHEAD() %}
|
||||
{% set sql %}
|
||||
CREATE
|
||||
OR REPLACE FUNCTION {{ target.database }}.STREAMLINE.UDF_GET_CHAINHEAD(
|
||||
) returns INTEGER
|
||||
AS $$
|
||||
SELECT
|
||||
{{ target.database }}.live.udf_api(
|
||||
'POST',
|
||||
'https://rpc.mainnet.near.org',
|
||||
{
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
{
|
||||
'jsonrpc': '2.0',
|
||||
'id': 'dontcare',
|
||||
'method' :'status',
|
||||
'params':{
|
||||
'finality': 'final'
|
||||
}
|
||||
}
|
||||
) :data :result :sync_info :latest_block_height :: INT AS block_id
|
||||
|
||||
$$
|
||||
{% endset %}
|
||||
{% do run_query(sql) %}
|
||||
{% endmacro %}
|
||||
Loading…
Reference in New Issue
Block a user