jgvfCompressed NFTs - [collections] minted collections copy
    -- forked from marqu / Compressed NFTs - [collections] minted collections @ https://flipsidecrypto.xyz/marqu/q/wzCMFJx2HWca/compressed-nfts-collections]-minted-collections

    with

    bgum_mints as (

    select

    block_timestamp,
    tx_id,
    instruction :accounts[1] ::string as leaf_owner,
    instruction :accounts[8] ::string as collection_mint

    from solana.core.fact_events
    inner join solana.core.fact_transactions txs
    using(tx_id, block_timestamp, succeeded)
    where succeeded
    and program_id = 'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'
    and array_contains('Program log: Instruction: MintToCollectionV1' ::variant, log_messages)
    and block_timestamp > '2023-04-07'

    union all

    select
    block_timestamp,
    tx_id,
    f.value :accounts[1] ::string as leaf_owner,
    f.value :accounts[8] ::string as collection_mint
    from solana.core.fact_events
    inner join lateral flatten (input => inner_instruction :instructions) f
    where succeeded
    and program_id = '1atrmQs3eq1N2FEYWu6tyTXbCjP4uQwExpjtnhXtS8h' -- lazy_transactions
    and f.value :programId = 'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY' -- bubblegum
    and block_timestamp > '2023-04-07'
    Run a query to Download Data