with first_tx as (
select
min(block_timestamp) as timestamp,
tx_receiver
from near.core.fact_transfers
group by tx_receiver
),
weekly as (
select
date_trunc('week', timestamp) as week,
count(distinct tx_receiver) as new_wallets
from first_tx
where timestamp >= '2022-07-01' -- July
and timestamp < '2022-10-01' -- September
group by week
)
select
min(new_wallets) as min,
avg(new_wallets) as avg,
max(new_wallets) as max
from weekly