Afonso_Diaz2023-10-25 06:39 PM
    Updated 2023-10-25
    with

    pal1 as

    (SELECT tx_id as tx, BLOCK_TIMESTAMP::date as date, ATTRIBUTE_VALUE as token_id
    FROM
    sei.core.fact_msg_attributes
    where
    ATTRIBUTE_KEY = 'nft_token_id'
    and MSG_TYPE = 'wasm-buy_now'),


    pal2 as (SELECT
    DISTINCT token_id, ATTRIBUTE_VALUE as nft, tx, date
    FROM
    sei.core.fact_msg_attributes
    join pal1 on tx_id=tx
    where
    ATTRIBUTE_KEY = 'nft_address'
    and MSG_TYPE = 'wasm-buy_now'),


    pal3 as (SELECT DISTINCT token_id, nft, ATTRIBUTE_VALUE as seller, tx, date
    FROM
    sei.core.fact_msg_attributes
    join pal2 on tx_id=tx
    where
    ATTRIBUTE_KEY = 'nft_seller'
    and MSG_TYPE = 'wasm-buy_now'),



    pal4 as (SELECT
    split_part(attribute_value, ', ', 2) as x, substring(x,1,len(x)-4) as x2,
    substring(x2,17,len(x2))/1e6 as price, tx_id as tx4
    FROM
    Run a query to Download Data