winnie-fs[Parent Query] NEP245 Parsed Events - 20241206 copy
    Updated 2024-12-09
    -- forked from forgash / [Parent Query] NEP245 Parsed Events - 20241206 @ https://flipsidecrypto.xyz/forgash/q/Lgpk5B4lyOBL/parent-query-nep245-parsed-events---20241206
    -- forked from [Parent Query] NEP245 Parsed Events - 20241205 @ https://flipsidecrypto.xyz/studio/queries/9016ac39-e42b-4591-bea9-dabef61822f7
    -- forked from [Parent Query] NEP245 Parsed Mints and Burns Events @ https://flipsidecrypto.xyz/studio/queries/1ca044ae-9e66-4f51-bc61-0cc181cfc50e
    with nep245_logs as (
    select
    block_timestamp,
    block_id,
    tx_hash,
    receipt_object_id AS receipt_id,
    receiver_id,
    predecessor_id,
    try_parse_json(clean_log) :event :: STRING as log_event,
    try_parse_json(clean_log) :data :: ARRAY as log_data,
    array_size(log_data) as log_data_len
    from
    near.core.fact_logs
    where
    receiver_id = 'intents.near' -- not including defuse-alpha.near at recommendation of NF
    and block_timestamp >= '2024-11-01'
    and try_parse_json(clean_log) :standard :: STRING = 'nep245'
    ),
    flatten_logs AS (
    SELECT
    block_timestamp,
    block_id,
    tx_hash,
    receipt_id,
    receiver_id,
    predecessor_id,
    log_event,
    THIS AS log_event_this,
    INDEX AS log_event_index,
    VALUE :amounts :: ARRAY as amounts,
    VALUE :token_ids :: ARRAY as token_ids,
    VALUE :owner_id :: STRING as owner_id,
    VALUE :old_owner_id :: STRING as old_owner_id,
    QueryRunArchived: QueryRun has been archived