WITH solend_events AS(
SELECT
VALUE:parsed:type AS type,
VALUE:parsed:amount AS amount,
VALUE:parsed:info:authority AS authority,
value
FROM solana.core.fact_events , table (flatten (input=> INNER_INSTRUCTION:instructions)) AS tbl
WHERE program_id = 'So1endDq2YkqhipRh3WViPa8hdiSpxWy6z3Z6tMCpAo'
)
SELECT CASE WHEN type is null THEN 'no type' ELSE type END AS type, COUNT(*) AS "unique users" FROM solend_events GROUP BY type