with wallets as (
SELECT top 10
SIGNERS[0] as wallet,
SUM(fee) as sum_fee
FROM
solana.core.fact_transactions
WHERE
SUCCEEDED = 'FALSE'
AND BLOCK_TIMESTAMP >= '2022-01-01'
AND BLOCK_TIMESTAMP < '2022-07-01'
GROUP BY SIGNERS
ORDER BY sum_fee DESC),
programs as (
SELECT top 10
split(LOG_MESSAGES[0] ,' ')[1] as program,
SUM(fee) as sum_fee
FROM
solana.core.fact_transactions
WHERE
SUCCEEDED = 'FALSE'
AND BLOCK_TIMESTAMP >= '2022-01-01'
AND BLOCK_TIMESTAMP < '2022-07-01'
GROUP BY program
ORDER BY sum_fee DESC)
SELECT
wallet,
sum_fee