SajjadiiiNumber of NFTs held by candidates and names of collections
    Updated 2023-08-24
    -- pinehearst its really awesome <3 thanks
    -- https://flipsidecrypto.xyz/pinehearst/q/eiofoIs2nKx0/near-balances-1-final
    with candidates_tab AS (
    SELECT
    max(block_timestamp) AS last_date
    , try_parse_json (args):nominee AS candidates
    , try_parse_json (args):house_type AS Houses
    , row_number()over (partition BY candidates ORDER BY last_date DESC ) AS rn
    FROM near.core.fact_actions_events_function_call
    WHERE method_name = 'on_nominate_verified'
    AND receiver_id = 'nominations.ndc-gwg.near'
    AND candidates <> 'ruBYcop.near' -- self_revoke ApD2WD34qU5VA2Q6ouU8vimuqxfRdUR7KreuCyqkoYwh
    AND candidates <> 'jlw.near' -- self_revoke F4g51XXxJeJfWFk36B2A8RxkKQPvwA9PVm2yn6i9QWfm
    AND candidates <> 'atrox1382.near' -- self_revoke Erqnn7Zzz6Vu9KnPfQiuwcAYa5nQ4qKVUfmCYeZ1eBTp
    --tx_hash = 'Hcz28rqQFVKydSpT621LNdcUTenyXJqAabjW97V77qce'
    GROUP BY 3,2
    qualify rn = 1

    ),


    resolve_purchases AS (
    SELECT
    block_timestamp,
    tx_hash,
    receiver_id as platform,
    try_parse_json(value) as parse_logs,
    parse_logs:type as type,
    parse_logs:params:buyer_id::string as buyer_id,
    parse_logs:params:owner_id::string as owner_id,
    parse_logs:params:is_offer as is_offer,
    parse_logs:params:is_auction as is_auction,
    replace(parse_logs:params:nft_contract_id::string, '.near') as nft_contract_id,
    parse_logs:params:token_id::string as token_id,
    parse_logs:params:ft_token_id as ft_token_id,
    parse_logs:params:price/pow(10,24) as near,
    Run a query to Download Data