kidaParas Artists
    Updated 2022-07-27
    WITH token_series_txns AS (
    SELECT
    txn_hash,
    tx_receiver as nft_contract_id,
    REGEXP_SUBSTR(tx_receipt::string, 'token_series_id\\\\":\\\\"([^\\\\])*') as regexed,
    RIGHT(regexed, LEN(regexed) - 20) as token_series_id
    FROM flipside_prod_db.mdao_near.transactions
    WHERE token_series_id is not null AND token_series_id <> ''
    ),

    nft_data AS (
    SELECT
    created_at,
    creator_id,
    initial_price,
    number_of_copies,
    title,
    collection_regexp,
    collection,
    token_series_id,
    nft_contract_id,
    royalty_benefactor,
    royalty
    FROM (
    SELECT
    c.block_timestamp as created_at,
    c.txn_hash,
    PARSE_JSON(args):creator_id as creator_id,
    IFF(CONTAINS(args, '"price":null') OR PARSE_JSON(args):price is null, 0, PARSE_JSON(args):price::int) / 1e24 as initial_price,
    PARSE_JSON(args):token_metadata:copies as number_of_copies,
    PARSE_JSON(args):token_metadata:title as title,
    IFF(CONTAINS(title, '#'), REGEXP_SUBSTR(title, '([^#])*'), REGEXP_SUBSTR(title, '([^\\d+])*')) as collection_regexp,
    IFF(LEN(collection_regexp) = 0, title, collection_regexp) as collection,
    F.Key as royalty_benefactor,
    F.Value as royalty
    FROM flipside_prod_db.mdao_near.actions_events_function_call c,
    Run a query to Download Data