Popex404#11 AllDomains TLDs by user
    Updated 2023-08-16
    -- Query From panda-gXSkiX
    -- https://flipsidecrypto.xyz/panda-gXSkiX/q/4VgubkSf4Gik/alldomain-query-tld-daily-values
    -- Changes made at the final select, to change the data view perspective


    WITH tab1 AS
    (
    SELECT
    block_timestamp,
    tx_id,
    inner_instruction,
    signers[0] as user_address,
    CASE WHEN ((inner_instruction:instructions[2]:programId = 'ALTNSZ46uaAUU7XUV6awvdorLGqAsPwa9shm7h4uP2FK' AND inner_instruction:instructions[0]:parsed:info:destination = 'DaJVVD52pfVRZe7ArD7Y8GSQaUssSxgdtuTKgimtWzCx') OR (inner_instruction:instructions[0]:parsed:info:destination = 'GCe8Jj9vQPjxPA4nWXXW8y3iE2ynHfCHJEnRZPBV43aD')) then '.poor'
    WHEN (inner_instruction:instructions[0]:parsed:info:mint = 'DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263' AND inner_instruction:instructions[0]:parsed:type = 'burn') then '.bonk'
    WHEN (inner_instruction:instructions[3]:programId = 'ALTNSZ46uaAUU7XUV6awvdorLGqAsPwa9shm7h4uP2FK' AND inner_instruction:instructions[1]:parsed:info:destination = '5AZYZb7sfB5K7P2GCWnB6v2G7urQ3LjoKtKRop8A79DA') then '.moon'
    WHEN ((inner_instruction:instructions[0]:parsed:info:destination = 'DaJVVD52pfVRZe7ArD7Y8GSQaUssSxgdtuTKgimtWzCx' AND inner_instruction:instructions[1]:programId = 'ALTNSZ46uaAUU7XUV6awvdorLGqAsPwa9shm7h4uP2FK') OR inner_instruction:instructions[0]:programId = 'ALTNSZ46uaAUU7XUV6awvdorLGqAsPwa9shm7h4uP2FK') then '.abc'
    WHEN (inner_instruction:instructions[0]:parsed:type = 'burn' AND inner_instruction:instructions[0]:parsed:info:mint = '72DPHZErwJLYkHBjr8bj6RAK2UhpFUJ1sLbnHMJaykv2') then '.abc NFT'
    WHEN (inner_instruction:instructions[0]:parsed:type = 'createAccount' AND inner_instruction:instructions[0]:parsed:info:owner = 'TLDHkysf5pCnKsVA4gXpNvmy7psXLPEu4LAdDJthT9S') then 'TLD Creation'
    WHEN (inner_instruction:instructions[0]:parsed:info:destination = '2rWVMwtTQGDrG875uHmZWKot7zEUcqEjyyafh9kuVoFc' AND inner_instruction:instructions[1]:parsed:info:destination = 'DaJVVD52pfVRZe7ArD7Y8GSQaUssSxgdtuTKgimtWzCx') then '.all'
    ELSE 'Other TLDs' END AS TLD
    FROM
    solana.core.fact_events
    WHERE
    block_timestamp >= '2022-10-21'
    AND
    program_id = 'TLDHkysf5pCnKsVA4gXpNvmy7psXLPEu4LAdDJthT9S'
    AND
    SUCCEEDED = 'true'
    AND
    (inner_instruction:instructions[0]:programId = 'ALTNSZ46uaAUU7XUV6awvdorLGqAsPwa9shm7h4uP2FK' OR
    inner_instruction:instructions[1]:programId = 'ALTNSZ46uaAUU7XUV6awvdorLGqAsPwa9shm7h4uP2FK' OR
    inner_instruction:instructions[2]:programId = 'ALTNSZ46uaAUU7XUV6awvdorLGqAsPwa9shm7h4uP2FK' OR
    inner_instruction:instructions[3]:programId = 'ALTNSZ46uaAUU7XUV6awvdorLGqAsPwa9shm7h4uP2FK' OR
    inner_instruction:instructions[4]:programId = 'ALTNSZ46uaAUU7XUV6awvdorLGqAsPwa9shm7h4uP2FK' OR
    inner_instruction:instructions[5]:programId = 'ALTNSZ46uaAUU7XUV6awvdorLGqAsPwa9shm7h4uP2FK')
    AND
    Run a query to Download Data