ZSaed0.1 find mistake
    Updated 2023-04-14
    -- forked from 9ff71f55-a273-4557-8636-277f11ddec91
    with users as (
    select
    TX_HASH, actions:predecessor_id as TX_SIGNER , BLOCK_TIMESTAMP
    from
    near.core.fact_receipts
    where
    BLOCK_TIMESTAMP::date > '2022-12-18'
    and RECEIVER_ID = 'nethmap.near'
    and ACTIONS:receipt:Action:actions[0]:FunctionCall:method_name::string = 'set'
    )
    , receipts as (
    select a.*, a.actions:predecessor_id as TX_SIGNER
    from near.core.fact_receipts a JOIN users b on (a.actions:predecessor_id = b.TX_SIGNER or a.RECEIVER_ID= b.TX_SIGNER)
    where
    a.BLOCK_TIMESTAMP::date> '2022-12-18'
    )
    ,fail as (
    select * from near.core.fact_receipts
    where tx_hash in (select tx_hash from receipts )
    and STATUS_VALUE:Failure is not null
    )
    , success_receipts as
    (select * from receipts where tx_hash not in (select tx_hash from fail ))

    , fact_transactions as (
    select a.* from near.core.fact_transactions a
    JOIN users b on (a.TX_RECEIVER = b.TX_SIGNER or a.TX_SIGNER= b.TX_SIGNER)
    where TX_STATUS ='Success'
    )
    select 'success_receipts', count(tx_hash ) , count(DISTINCT tx_hash) from success_receipts
    UNION
    select 'fact_transactions', count(tx_hash) , count(DISTINCT tx_hash ) from fact_transactions

    -- select * from near.core.fact_receipts
    -- where BLOCK_TIMESTAMP::date> '2022-12-18'
    Run a query to Download Data