Query editor
withmnde_accounts as (SELECTvote.stake_account_raw, vote.vote_account_raw, auth.authority, case when auth.authority = '9eG63CdHjsfhHmobHgLtESGC8GabbmRcaSpHAZrtmhco' then 'liquid' else 'native' end as typeFROM dune.dune.result_solana_stake_accounts_vote_delegates as voteLEFT JOIN dune.dune.result_solana_stake_accounts_authorities as auth ON vote.stake_account_raw = auth.stake_account_rawWHERE 1=1and vote.latest = 1and auth.latest = 1and auth.authority IN ('9eG63CdHjsfhHmobHgLtESGC8GabbmRcaSpHAZrtmhco','stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq','ex9CfkBZZd6Nv9XdnoDmmB45ymbu4arXVk7g5pWnt3N','noMa7dN4cHQLV4ZonXrC29HTKFpxrpFbDLK5Gub8W8t','exGQS9BR9Y1zLf36iM4pqHCDGoj2HChcjzu6kQTV2Ju')UNION ALLSELECT'Du3Ysj1wKbxPKkuPPnvzQLQh8oMSVifs3jGZjJWXFmHN', null, null, 'liquid' as type), base as (SELECTget_href(get_chain_explorer('solana') || '/account/' || stake_account_raw , stake_account_raw ) as stake_account, stake_account_raw, get_href(get_chain_explorer('solana') || '/account/' || vote_account_raw , vote_account_raw ) as vote_account, vote_account_raw, bal.sol_balance, r_stake.rewards as stake_rewards, typeFROM mnde_accountsJOIN solana_utils.latest_balances as bal ON bal.address = stake_account_rawLEFT JOIN solana_utils.total_rewards r_stake ON r_stake.recipient = stake_account_raw AND r_stake.reward_type = 'Staking'WHERE 1=1and sol_balance > 0)SELECTsum(case when type = 'liquid' then sol_balance else null end) as lst_tvl, sum(case when type = 'native' then sol_balance else null end) as native_tvl, sum(sol_balance) as total_tvl, count(distinct vote_account_raw) as active_validators, sum(stake_rewards) as stake_rewardsFROM base