with tx_ids as ( select tx_id
from solana.transactions
where block_timestamp::date >= '2022-01-01'
and succeeded =true
and (pre_mint = 'AFbX8oGjGpmVFywbVouvhQSRmiW2aR1mohfahi4Y2AdB' or post_mint = 'AFbX8oGjGpmVFywbVouvhQSRmiW2aR1mohfahi4Y2AdB' )
and transfer_tx_flag=true
group by 1
)
select block_timestamp::date as date, sum(ZEROIFNULL(instruction:parsed:info:amount/1e9)) as GST_amount ,
count (DISTINCT instruction:parsed:info:authority) as number_of_unique_wallets
from solana.events join tx_ids
on tx_ids.tx_id =solana.events.tx_id
where block_timestamp::date >= '2022-01-01'
and instruction:parsed:info:authority is not NULL
group by 1