add old one

This commit is contained in:
WHYTEWYLL 2024-03-20 15:04:35 -06:00
parent 11da476509
commit 0e9bf5f2a4

View 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 %}