Query editor
-- Params you can set in the UI:-- {{wallet}} e.g. 0xB44c382d160FC0e07C83F7CfEA08dE4feb38EfdDWITH params AS (SELECTFROM_HEX(REPLACE('{{wallet}}','0x','')) AS wallet,LOWER('0x46ac8540d698167fcbb9e846511beb8cf8af9bd8') AS contract_hex,FROM_HEX('46ac8540d698167fcbb9e846511beb8cf8af9bd8') AS contract_addr),-- Movements on the target contract where THIS wallet is sender or receivermovements AS (SELECTCAST(FLOOR(TRY_CAST(q.tokenId AS DOUBLE) / 10000) AS INTEGER) AS dropid,CAST(q.tokenId AS BIGINT) AS tokenId,CASEWHEN q."to" = p.wallet THEN 1WHEN q."from" = p.wallet THEN -1ELSE 0END AS deltaFROM erc721_ethereum.evt_Transfer qJOIN params pON q.contract_address = p.contract_addrWHERE q."to" = p.wallet OR q."from" = p.wallet),-- Net per token for the walletbalances_per_token AS (SELECTdropid,tokenId,SUM(delta) AS netFROM movementsGROUP BY dropid, tokenId),-- Tokens currently owned per dropowned_tokens AS (SELECTdropid,tokenIdFROM balances_per_tokenWHERE net > 0),-- Count per dropowned_by_drop AS (SELECTdropid,COUNT(*) AS tokens_ownedFROM owned_tokensGROUP BY dropid),-- Clickable OS links for each token, aggregated per droptokenlinks_by_drop AS (SELECTot.dropid,ARRAY_JOIN(ARRAY_SORT(