0xHaM-dTransactions by services copy
    Updated 2025-01-22
    -- forked from Transactions by services @ https://flipsidecrypto.xyz/studio/queries/927b0b34-beea-4233-b4e2-1ed73551f3d5

    -- forked from MLDZMN / activity by services @ https://flipsidecrypto.xyz/MLDZMN/q/fQrxp0_08eub/activity-by-services

    with t1 as (
    select
    BLOCK_TIMESTAMP,
    tx_hash,
    SERVICE_ID,
    NAME,
    case
    when NAME ilike '%market_maker%' then 'Creator'
    when NAME ilike '%Trader%' then 'Trader'
    when NAME ilike '%Mech%' then 'Mech'
    else null
    end as service_type,
    AGENT_IDS[0] as agent_Id
    from crosschain.olas.ez_service_registrations
    ),

    base as (
    select
    events.BLOCKCHAIN,
    events.BLOCK_TIMESTAMP,
    events.tx_hash,
    events.service_id,
    agent_Id,
    NAME,
    service_type
    from crosschain.olas.fact_service_events events
    left join t1 on events.service_id=t1.SERVICE_ID
    )
    select
    service_type,
    count(distinct tx_hash) as no_transaction,
    from base
    QueryRunArchived: QueryRun has been archived