CyberaResearchList of all transactions on JUP program with event name
    Updated 2024-11-14
    SELECT
    fe.block_timestamp,
    fe.tx_id,
    fe.succeeded,
    ed.event_type,
    fe.program_id,
    fe.instruction,
    fe.inner_instruction,
    TRY_TO_NUMBER(instruction.value:parsed.info.amount::STRING) / 1000000 AS inner_amount, -- Extract and scale the amount from inner_instruction
    fe.signers[0]::STRING AS signer_wallet_address,
    SUM(TRY_TO_NUMBER(instruction.value:parsed.info.amount::STRING) / 1000000) OVER () AS total_withdrawn_amount -- Calculate the total sum of inner_amount across all records
    FROM
    solana.core.fact_events fe
    JOIN
    solana.core.ez_events_decoded ed
    ON fe.tx_id = ed.tx_id
    AND fe.program_id = ed.program_id
    -- Flatten the instructions array within inner_instruction
    CROSS JOIN
    LATERAL FLATTEN(input => PARSE_JSON(fe.inner_instruction):instructions) AS instruction
    WHERE
    fe.program_id = 'voTpe3tHQ7AjQHMapgSue2HJFAh2cGsdokqN3XqmVSj'
    AND signer_wallet_address = 'BDcMyPsVTjh5fd4pcBQFBTtnGTiaYnSghMjyBGi5uLVT'
    -- AND fe.succeeded = 'true'
    -- AND ed.event_type = 'toggleMaxLock' -- Swap for: withdraw, increaseLockedAmount, newEscrow, toggleMaxLock, THESE DON'T WORK: withdrawPartialUnstaking or openPartialUnstaking
    -- AND fe.block_timestamp < '2024-11-01'
    -- AND fe.tx_id = '42pLSH4KpCo297sv6Wp7YjpP6GMZBv2zsEwAKWz2PGMREGuUEaGq2zhnF1EpRvHJF6ERG4DXBieFSSuGcjm2i9kt'

    ORDER BY
    fe.block_timestamp DESC
    LIMIT 10000
    QueryRunArchived: QueryRun has been archived