Salehsei_nft_main_dob
    Updated 2024-04-15
    with lst_sei_price as (
    select
    TO_TIMESTAMP(value[0]::string) as avg_date
    ,value[1] as avg_price
    from (
    select livequery.live.udf_api(
    'https://api.coingecko.com/api/v3/coins/sei-network/market_chart?vs_currency=usd&days=0&interval=daily&precision=3') as resp
    )
    ,lateral flatten (input => resp:data:prices)
    )
    ,lst_buyer as (
    select
    tx_id
    ,ATTRIBUTE_VALUE as buyer
    ,msg_index
    from sei.core.fact_msg_attributes
    where MSG_TYPE = 'wasm'
    and block_timestamp::date>='2024-01-09'
    and ATTRIBUTE_KEY = 'recipient'
    and tx_succeeded = true
    )
    ,lst_amount_seller as (
    select
    tx_id
    ,split(ATTRIBUTE_VALUE,'usei')[0]/1e6 as amount_sell
    ,msg_index
    from sei.core.fact_msg_attributes
    where block_timestamp::date>='2024-01-09'
    and MSG_TYPE = 'wasm-buy_now'
    and ATTRIBUTE_KEY = 'sale_price'
    and tx_succeeded = true
    )
    ,lst_contract_address as (
    select
    QueryRunArchived: QueryRun has been archived