libruaryListingCompleted_reference
    Updated 2024-10-05
    -- Get 10 results for V1
    WITH V1_Results AS (
    SELECT
    'A.4eb8a10cb9f87357.NFTStorefront' AS contract_address, -- Manually set contract address for V1
    tx_id,
    block_timestamp,
    event_index,
    event_data:listingResourceID::STRING AS listing_id,
    event_data:nftID::STRING AS nft_id,
    NULL AS sale_price, -- No sale price for V1
    NULL AS buyer, -- No buyer for V1
    NULL AS seller, -- No seller for V1
    NULL AS commission_amount, -- No commission amount for V1
    NULL AS commission_receiver, -- No commission receiver for V1
    NULL AS payment_type, -- No payment type for V1
    event_data:purchased::STRING AS is_purchased -- Purchased status for V1
    FROM
    flow.core.fact_events
    WHERE
    event_contract = 'A.4eb8a10cb9f87357.NFTStorefront'
    AND event_type = 'ListingCompleted'
    AND event_data:purchased = 'true'
    LIMIT 10
    ),

    -- Get 10 results for V2
    V2_Results AS (
    SELECT
    'A.3cdbb3d569211ff3.NFTStorefrontV2' AS contract_address, -- Manually set contract address for V2
    tx_id,
    block_timestamp,
    event_index,
    event_data:listingResourceID::STRING AS listing_id,
    event_data:nftID::STRING AS nft_id,
    event_data:salePrice::FLOAT AS sale_price, -- Sale price
    event_data:buyer::STRING AS buyer, -- Buyer address