flyingfishEclipse base and priority fees
    Updated 2024-11-25
    -- forked from Eclipse base and priority fees @ https://flipsidecrypto.xyz/studio/queries/a508fad2-dd57-4b4b-95da-2c1fe2ab1d68

    with base as (
    select
    block_timestamp
    , block_id
    , tx_id
    , index
    , fee
    , program_id
    , substr(utils.udf_base58_to_hex(instruction :data), 3, 2) as asd
    from eclipse.core.fact_transactions t
    left join eclipse.core.fact_events using(block_timestamp, block_id, tx_id)
    where 1 = 1
    and block_timestamp > current_date - {{fees_lookback_days}}
    -- and tx_id in ('4M1AF5hbR7aRdgBTuH6AvbM5uj5fDVeVSMcVbRdg2wVdHQeTyGMMDzpq1NfBMeiGSXnud4mvN1SZFq3oSZsuM6my'
    -- , '33ipHpLXXpyr3QjwBR2GbHuKMggrTaDUqzDBCKp3aQV6K1q5wveEiyErmNLBj6vYGEMKRKJPtqM8jp39F6UXeAm9'
    -- , 'c4DddPEh5Rkf16J224Jr1RB6GZ5ZFp7i4NtjYtRHANw3NFaiA1M9mof1eRgdHUfEAuBtLK3oYxoctkAUNqdMx1r')
    and program_id = 'ComputeBudget111111111111111111111111111111'
    and block_timestamp::date < current_date
    )

    , label_txs as (
    select
    block_timestamp
    , tx_id
    , count_if(asd = '03') as tx_label_
    , iff(count_if(asd = '03') = 1, 'priority', 'base') as tx_label
    , max(fee) as fee
    from base
    group by 1, 2
    )

    , vote_data as (
    select
    block_timestamp::date as date
    QueryRunArchived: QueryRun has been archived