Query editor
-- SHOW FUNCTIONSWITH _accounts AS (-- NOTE: This can be anything you've setup as a map-- https://dune.com/queries/2660028SELECT _account_map FROM query_2660028), variables AS (SELECT-- NOTE: You can change these for the desired lookback'30' AS interval,'day' AS period,(INTERVAL '30' DAY) AS lookback), filtered_transactions_group AS (-- NOTE: If you don't group by / aggregate here it's too big for Dune.SELECTDATE_TRUNC('day', block_time) AS day,CASEWHEN (ARRAYS_OVERLAP(account_keys, (SELECT MAP_KEYS(_account_map) FROM _accounts))) THEN ELEMENT_AT((SELECT _account_map FROM _accounts), ARRAY_INTERSECT(account_keys, (SELECT MAP_KEYS(_account_map) FROM _accounts))[1])ELSE NULLEND AS category,-- TODO: Add in a way to fetch all accounts which touch these accounts, we're looking to calcute beyond this with total "active" accounts.account_keys[1] AS account_active,COUNT(*) AS account_interaction_countFROM solana.transactions-- NOTE: This is the limit based on program accounts we care about / addressesWHERE ARRAYS_OVERLAP(account_keys, (SELECT MAP_KEYS(_account_map) FROM _accounts))-- NOTE: LookbackAND block_time >= DATE_TRUNC((SELECT period FROM variables), NOW() - (SELECT lookback FROM variables))AND block_time < DATE_TRUNC((SELECT period FROM variables), NOW())GROUP BY 1, 2, account_keys[1])SELECT day, category, account_active, account_interaction_count FROM filtered_transactions_group