jack2000Copy of Untitled Query
    Updated 2023-02-21
    SELECT
    paras_type,
    sum(txs) as total_txs,
    sum(users) as total_users,
    sum(TX_Fee) as total_fee,
    avg(txs) as avg_txs,
    avg(users) as avg_users,
    avg(TX_Fee) as avg_fee
    from
    (select
    date_trunc (week, block_timestamp) as date,
    case
    when tx_receiver = 'token.paras.near' then '$PARAS Token'
    when tx_receiver = 'staking.paras.near' then 'Staked $PARAS'
    when tx_receiver in ('nft.paras.near','marketplace.paras.near','x.paras.near') then 'PARAS NFT'
    else null end as paras_type,
    count (distinct tx_hash) as txs,
    count (distinct tx_signer) as users,
    sum (transaction_fee/ pow (10,24)) as TX_Fee,
    avg (transaction_fee/ pow (10,24)) as AVG_TX_Fee
    from near.core.fact_transactions
    where paras_type is not null
    and tx_status = 'Success'
    group by 1,2)
    group by 1
    Run a query to Download Data