Mrftialternative-aqua copy
    Updated 2024-12-25
    -- forked from alternative-aqua @ https://flipsidecrypto.xyz/studio/queries/22da03b3-7471-49df-b43b-cc27c165c0bc

    WITH datatbl AS (
    SELECT *
    FROM berachain.testnet.ez_decoded_event_logs
    where contract_address = '0x9826e5daa4d28a9b97d0f5a3377fcc7927c99a91'
    and contract_name = 'Beranames'
    and event_name = 'NameRegisteredWithRecord'
    and ORIGIN_FUNCTION_SIGNATURE = '0xeeb144da'
    and TX_SUCCEEDED = 'TRUE'
    ),
    extracted_chars AS (
    SELECT
    tx_hash,
    VALUE::STRING AS char,
    SEQ4() AS seq
    FROM
    datatbl,
    LATERAL FLATTEN(INPUT => DECODED_LOG:chars)
    ),
    beranametbl AS (
    SELECT
    tx_hash,
    LISTAGG(char, '') WITHIN GROUP (ORDER BY seq) AS "Beraname"
    FROM extracted_chars
    GROUP BY tx_hash
    )
    SELECT
    datatbl.BLOCK_TIMESTAMP AS "Timestamp",
    datatbl.tx_hash,
    datatbl.origin_from_address AS "Address",
    beranametbl."Beraname"
    FROM datatbl
    JOIN beranametbl
    ON datatbl.tx_hash = beranametbl.tx_hash
    ORDER BY 1 DESC
    Auto-refreshes every 12 hours
    QueryRunArchived: QueryRun has been archived