add discrepent columns between gold and livequery

This commit is contained in:
Jensen Yap 2024-10-17 11:23:40 +09:00 committed by Julius Remigio
parent 1fc41519ef
commit 6d1407bdff
2 changed files with 21 additions and 27 deletions

View File

@ -396,7 +396,7 @@
- [block_height, INTEGER, The start block height to get the logs from]
- [to_latest, BOOLEAN, Whether to continue fetching logs until the latest block or not]
return_type:
- "TABLE(block_number INTEGER, block_timestamp TIMESTAMP_NTZ, tx_hash STRING, event_index INTEGER, contract_address STRING, contract_name STRING, event_name STRING, decoded_log OBJECT, full_decoded_log VARIANT, origin_function_signature STRING, origin_from_address STRING, origin_to_address STRING, topics VARIANT, data STRING, event_removed STRING, tx_status STRING, _log_id STRING, fact_event_logs_id STRING, inserted_timestamp TIMESTAMP_NTZ, modified_timestamp TIMESTAMP_NTZ)"
- "TABLE(block_number INTEGER, block_timestamp TIMESTAMP_NTZ, tx_hash STRING, event_index INTEGER, contract_address STRING, contract_name STRING, event_name STRING, decoded_log OBJECT, full_decoded_log VARIANT, fact_decoded_event_logs_id STRING, inserted_timestamp TIMESTAMP_NTZ, modified_timestamp TIMESTAMP_NTZ)"
options: |
NOT NULL
RETURNS NULL ON NULL INPUT
@ -408,7 +408,7 @@
signature:
- [block_height, INTEGER, The start block height to get the transfers from]
- [to_latest, BOOLEAN, Whether to continue fetching transfers until the latest block or not]
return_type:
return_type:
- "TABLE(tx_hash STRING, block_number NUMBER, block_timestamp TIMESTAMP_NTZ(9), from_address STRING, to_address STRING, value FLOAT, value_precise_raw STRING, value_precise STRING, gas NUMBER, gas_used NUMBER, input STRING, output STRING, TYPE STRING, identifier STRING, DATA OBJECT, tx_status STRING, sub_traces NUMBER, trace_status STRING, error_reason STRING, trace_index NUMBER, fact_traces_id STRING, inserted_timestamp TIMESTAMP_NTZ(9), modified_timestamp TIMESTAMP_NTZ(9))"
options: |
NOT NULL
@ -422,7 +422,7 @@
signature:
- [block_height, INTEGER, The start block height to get the transfers from]
- [to_latest, BOOLEAN, Whether to continue fetching transfers until the latest block or not]
return_type:
return_type:
- "TABLE(block_number NUMBER, block_timestamp TIMESTAMP_NTZ, block_hash STRING, tx_hash STRING, nonce NUMBER, POSITION NUMBER, origin_function_signature STRING, from_address STRING, to_address STRING, VALUE FLOAT, value_precise_raw STRING, value_precise STRING, tx_fee FLOAT, tx_fee_precise STRING, gas_price FLOAT, gas_limit NUMBER, gas_used NUMBER, cumulative_gas_used NUMBER, input_data STRING, status STRING, effective_gas_price FLOAT, max_fee_per_gas FLOAT, max_priority_fee_per_gas FLOAT, r STRING, s STRING, v STRING, tx_type NUMBER, chain_id NUMBER, blob_versioned_hashes ARRAY, max_fee_per_blob_gas NUMBER, blob_gas_used NUMBER, blob_gas_price NUMBER, fact_transactions_id STRING, inserted_timestamp TIMESTAMP_NTZ, modified_timestamp TIMESTAMP_NTZ)"
options: |
NOT NULL
@ -452,7 +452,7 @@
- [to_latest, BOOLEAN, Whether to continue fetching transfers until the latest block or not]
- [ez_token_transfers_id, STRING, The topic of the token transfers to get]
return_type:
- "TABLE(block_number INTEGER, block_timestamp TIMESTAMP_NTZ, tx_hash STRING, event_index INTEGER, origin_funcion_signature STRING, origin_from_address STRING, origin_to_address STRING, contract_address STRING, from_address STRING, to_address STRING, raw_amount_precise STRING, raw_amount FLOAT, amount_precise FLOAT, amount FLOAT, amount_usd FLOAT, decimals INTEGER, symbol STRING, token_price FLOAT, has_decimal STRING, has_price STRING, ez_token_transfers_id STRING, inserted_timestamp TIMESTAMP_NTZ, modified_timestamp TIMESTAMP_NTZ)"
- "TABLE(block_number INTEGER, block_timestamp TIMESTAMP_NTZ, tx_hash STRING, event_index INTEGER, origin_function_signature STRING, origin_from_address STRING, origin_to_address STRING, contract_address STRING, from_address STRING, to_address STRING, raw_amount_precise STRING, raw_amount FLOAT, amount_precise FLOAT, amount FLOAT, amount_usd FLOAT, decimals INTEGER, symbol STRING, token_price FLOAT, has_decimal STRING, has_price STRING, _log_id STRING, ez_token_transfers_id STRING, _inserted_timestamp TIMESTAMP_NTZ, inserted_timestamp TIMESTAMP_NTZ, modified_timestamp TIMESTAMP_NTZ)"
options: |
NOT NULL
RETURNS NULL ON NULL INPUT

View File

@ -40,7 +40,7 @@
SELECT
block_number,
{{ schema }}.udf_rpc(
'eth_getBlockByNumber',
'eth_getBlockByNumber',
[utils.udf_int_to_hex(block_number), true]) AS DATA
FROM
{{ table_name }}
@ -51,7 +51,7 @@ SELECT
latest_block_height,
block_number,
{{ schema }}.udf_rpc(
'eth_getBlockReceipts',
'eth_getBlockReceipts',
[utils.udf_int_to_hex(block_number)]) AS result,
v.value AS DATA
FROM
@ -460,15 +460,8 @@ SELECT
B.event_name,
B.decoded_flat AS decoded_log,
B.decoded_data AS full_decoded_log,
C.origin_function_signature,
C.origin_from_address,
C.origin_to_address,
C.topics,
C.DATA,
C.event_removed :: STRING AS event_removed,
C.tx_status,
_log_id,
md5(_log_id) AS fact_event_logs_id,
md5(_log_id) AS fact_decoded_event_logs_id,
SYSDATE() AS _inserted_timestamp,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
FROM _flatten_logs AS B
@ -508,7 +501,7 @@ WITH heights AS (
latest_block_height
from
table(generator(ROWCOUNT => 1000)),
heights
heights
qualify block_number between min_height and max_height
),
raw_receipts as (
@ -516,7 +509,7 @@ WITH heights AS (
latest_block_height,
block_number,
{{ schema }}.udf_rpc(
'eth_getBlockReceipts',
'eth_getBlockReceipts',
[utils.udf_int_to_hex(block_number)]) AS result,
v.value as DATA
from
@ -527,7 +520,7 @@ WITH heights AS (
SELECT
block_number,
{{ schema }}.udf_rpc(
'eth_getBlockByNumber',
'eth_getBlockByNumber',
[utils.udf_int_to_hex(block_number), true]) AS DATA
from
spine
@ -662,7 +655,7 @@ WITH heights AS (
raw_txs A
left join blocks b on b.block_number = A.block_number
left join receipts as r on r.tx_hash = A.data :hash::STRING
)
)
SELECT
block_number,
block_timestamp,
@ -741,7 +734,7 @@ WITH heights AS (
latest_block_height
from
table(generator(ROWCOUNT => 1000)),
heights
heights
qualify block_number between min_height and max_height
),
raw_receipts as (
@ -749,7 +742,7 @@ WITH heights AS (
latest_block_height,
block_number,
{{ schema }}.udf_rpc(
'eth_getBlockReceipts',
'eth_getBlockReceipts',
[utils.udf_int_to_hex(block_number)]) AS result,
v.value as DATA
from
@ -760,7 +753,7 @@ WITH heights AS (
SELECT
block_number,
{{ schema }}.udf_rpc(
'eth_getBlockByNumber',
'eth_getBlockByNumber',
[utils.udf_int_to_hex(block_number), true]) AS DATA
from
spine
@ -905,7 +898,7 @@ WITH heights AS (
FROM spine s,
LATERAL FLATTEN(input => PARSE_JSON(
{{ schema }}.udf_rpc(
'debug_traceBlockByNumber',
'debug_traceBlockByNumber',
[utils.udf_int_to_hex(s.block_number), {'tracer': 'callTracer'}])
)) v
),
@ -1249,6 +1242,7 @@ SELECT
WHEN price IS NULL THEN 'false'
ELSE 'true'
END AS has_price,
_log_id,
md5(
cast(
coalesce(
@ -1305,7 +1299,7 @@ WITH heights AS (
latest_block_height
from
table(generator(ROWCOUNT => 1000)),
heights
heights
qualify block_number between min_height and max_height
),
raw_receipts as (
@ -1313,7 +1307,7 @@ WITH heights AS (
latest_block_height,
block_number,
{{ schema }}.udf_rpc(
'eth_getBlockReceipts',
'eth_getBlockReceipts',
[utils.udf_int_to_hex(block_number)]) AS result,
v.value as DATA
from
@ -1324,7 +1318,7 @@ WITH heights AS (
SELECT
block_number,
{{ schema }}.udf_rpc(
'eth_getBlockByNumber',
'eth_getBlockByNumber',
[utils.udf_int_to_hex(block_number), true]) AS DATA
from
spine
@ -1469,7 +1463,7 @@ WITH heights AS (
FROM spine s,
LATERAL FLATTEN(input => PARSE_JSON(
{{ schema }}.udf_rpc(
'debug_traceBlockByNumber',
'debug_traceBlockByNumber',
[utils.udf_int_to_hex(s.block_number), {'tracer': 'callTracer'}])
)) v
),