Query editor
WITH dns_bid_states AS (SELECTnft_item_address,CAST("timestamp" AS BIGINT) AS bid_ts,lt,json_extract_scalar(content_onchain,'$.domain') AS domain_name,TRY_CAST(json_extract_scalar(content_onchain,'$.auction_end_time') AS BIGINT) AS auction_end_ts,json_extract_scalar(content_onchain,'$.max_bid_address') AS winner_address,TRY_CAST(json_extract_scalar(content_onchain,'$.max_bid_amount') AS BIGINT) AS winning_bid_nanotonFROM ton.nft_eventsWHERE block_date >= DATE '2022-01-01'AND collection_address ='0:B774D95EB20543F186C06B371AB88AD704F7E256130CAF96189368A7D0CB6CCF'AND type = 'bid'AND marketplace_address ='0:B774D95EB20543F186C06B371AB88AD704F7E256130CAF96189368A7D0CB6CCF'),ordered_bid_states AS (SELECT*,LEAD(bid_ts) OVER (PARTITION BY nft_item_addressORDER BY bid_ts, lt) AS next_bid_tsFROM dns_bid_statesWHERE REGEXP_LIKE(domain_name, '^[0-9]{4}$')AND auction_end_ts IS NOT NULLAND winner_address IS NOT NULL),finalized_auction_cycles AS (