Salehaptos_24h_new_users_actions
    Updated 2024-12-14
    with lst_all as (
    select
    block_timestamp::date as date
    ,tx_hash
    ,sender as wallet
    ,event_address
    ,iff( INITCAP(LABEL_TYPE)='Token','Defi',INITCAP(LABEL_TYPE)) as Type
    ,LABEL
    ,ADDRESS_NAME
    ,LABEL_SUBTYPE
    from aptos.core.fact_events
    join aptos.core.dim_labels on address = event_address
    join aptos.core.fact_transactions using(tx_hash)
    where SUCCESS=true
    and tx_type='user_transaction'
    )
    ,lst_new as (
    select
    sender
    ,min(block_timestamp)::date as min_date
    from aptos.core.fact_transactions
    group by 1
    )
    ,lst_group as (
    select
    Type
    -- ,LABEL
    ,count(DISTINCT wallet) as Wallets
    ,count(DISTINCT tx_hash) as TXs
    from lst_all
    join lst_new on wallet=sender
    where min_date >= DATEADD(HOUR, -24, CURRENT_TIMESTAMP())
    group by 1
    order by 1
    )
    select
    QueryRunArchived: QueryRun has been archived