omer9329-6 Aug Mints 2
    Updated 2024-08-07
    with
    info as (
    SELECT
    tx_id,case when block_timestamp <'2024-04-20' then '2024-06-04' else block_timestamp end as block_timestamp, count(distinct CASE WHEN msg_type = 'wasm' AND attribute_key = 'token_id' THEN attribute_value END) AS nft_id,
    MAX(CASE WHEN msg_type = 'wasm' AND attribute_key = 'owner' THEN attribute_value END) AS minter,
    MAX(CASE WHEN msg_type = 'wasm' AND attribute_key = 'price' THEN attribute_value/pow(10,6) END) AS sei_price,
    MAX(CASE WHEN msg_type = 'wasm' AND attribute_key = 'group' THEN attribute_value END) AS group_type,
    MAX(CASE WHEN msg_type = 'wasm' AND attribute_key = 'minter' THEN attribute_value END) AS launchpad,
    MAX(CASE WHEN msg_type = 'wasm' AND attribute_key = 'collection' THEN attribute_value END) AS collection,
    MAX(CASE WHEN msg_type = 'wasm' AND attribute_key = 'action' THEN attribute_value END) AS action
    FROM
    sei.core.fact_msg_attributes
    where block_timestamp>'2024-07-29 17:00'
    GROUP BY
    tx_id,block_timestamp
    having collection in ('sei1ccqar77782xutkjnhx8wmufhqx076xxmma5ylfzzvl3kg2t6r6uqv39crm',
    --'sei1kgqzuxd4lgyjrrjxhk0mkp08wedfqxfgl3humwg2tgzjylvkl8rqdflnrt',
    'sei1ck9znqxdwmmuepymgwk3dckxvsy9sddt5cq3hzcdxg8d7whyrsystvd37x'
    )

    UNION

    SELECT
    tx_id, case when block_timestamp <'2024-04-20' then '2024-06-04' else block_timestamp end as block_timestamp, count(distinct CASE WHEN msg_type = 'wasm' AND attribute_key = 'token_id' THEN attribute_value END) AS nft_id,
    MAX(CASE WHEN msg_type = 'wasm' AND attribute_key = 'owner' THEN attribute_value END) AS minter,
    MAX(CASE WHEN msg_type = 'wasm' AND attribute_key = 'price' THEN attribute_value/pow(10,6) else 0 END) AS sei_price,
    MAX(CASE WHEN msg_type = 'wasm' AND attribute_key = 'group' THEN attribute_value END) AS group_type,
    MAX(CASE WHEN msg_type = 'wasm' AND attribute_key = 'minter' THEN attribute_value END) AS launchpad,
    MAX(CASE WHEN msg_type = 'wasm' AND attribute_key = '_contract_address' THEN attribute_value END) AS collection,
    MAX(CASE WHEN msg_type = 'wasm' AND attribute_key = 'action' THEN attribute_value END) AS action
    FROM
    sei.core.fact_msg_attributes
    where block_timestamp>'2024-07-29 17:00'
    GROUP BY
    QueryRunArchived: QueryRun has been archived