Lordking✅ distribution - widget
    Updated 2024-05-14

    with

    raw as (
    SELECT livequery.live.udf_api(
    'GET',
    'https://api.flipsidecrypto.com/api/v2/queries/446f457a-755b-4004-ba8e-c020967a15aa/data/latest',
    {'accept': 'application/json'},{}) as response)

    ,builddao_user as (
    SELECT
    VALUE:Role as Role ,
    VALUE:Signer as Signer
    FROM raw,LATERAL FLATTEN (input => response:data))

    ,final_widget as
    (select
    distinct trxs.BLOCK_TIMESTAMP,
    trxs.TX_HASH,
    calls.PREDECESSOR_ID as SIGNER_ID,
    calls.DEPOSIT/pow(10,24)as DEPOSIT,
    trxs.WIDGET_NAME ,
    trxs.METADATA ,
    trxs.WIDGET_URL,
    trxs.METADATA:fork_of as fork_of,
    row_number () over (partition by trxs.WIDGET_URL order by trxs.BLOCK_TIMESTAMP asc) date_rank
    from near.core.fact_actions_events_function_call calls
    inner join near.social.fact_widget_deployments trxs
    on trxs.TX_HASH = calls.TX_HASH
    where RECEIPT_SUCCEEDED='TRUE'
    and calls.PREDECESSOR_ID in (select distinct Signer from builddao_user)


    )
    ,deposit as (
    QueryRunArchived: QueryRun has been archived