jackguyNear SBT 2
    Updated 2023-07-25
    with tab1 as (
    SELECT
    signer_id as a,
    min(date_trunc('week', block_timestamp)) as week1
    FROM
    near.core.fact_actions_events
    WHERE receiver_id = 'registry.i-am-human.near'
    AND action_data:method_name = 'sbt_mint'
    GROUP BY 1
    ORDER BY 2 DESC
    ), tab2 as (
    SELECT
    TX_SIGNER as b,
    min(date_trunc('week', block_timestamp)) as week2
    FROM
    near.core.fact_transactions
    WHERE TX_SIGNER in (SELECT a from tab1)
    GROUP BY 1
    ORDER BY 2 DESC
    )


    SELECT
    wallet_age_weeks,
    count(*) as users


    FROM (
    SELECT
    datediff('week', week2, week1) as wallet_age_weeks,
    *
    FROM tab1
    LEFT outer JOIN tab2
    on a = b
    Run a query to Download Data