flyingfishgetTx RPC copy
    Updated 2024-10-08
    /*
    Failed transaction:
    tx_id = '3d2ZhYpKm2dKaEM5YZa95h5hH7cDnsMgPKrdHFm8XVoWrsqn8U4Uof7tFmqTHAmTa5uZ6MMZHv2PhTXpmnn4n87Q'
    block_id = 294223718


    Sucessful transaction:
    and block_id = 294292155
    and tx_id = '63yRsjyaTcMA2UT1bucEGycoQHNVQrNQQdZYCHas84n2Ks911THPQ5ombV9GfDf3Mih71YP6LUUxDeTx8C7mJWt5'
    */

    with tx_from_rpc as (
    select
    resp:data:result:slot as block_id
    , resp:data:result:meta:computeUnitsConsumed as rpc_units_consumed
    , '63yRsjyaTcMA2UT1bucEGycoQHNVQrNQQdZYCHas84n2Ks911THPQ5ombV9GfDf3Mih71YP6LUUxDeTx8C7mJWt5' as tx_id
    from (
    select
    live.udf_api(
    'POST',
    'https://api.mainnet-beta.solana.com',
    { },
    utils.udf_json_rpc_call(
    'getTransaction'
    , ['63yRsjyaTcMA2UT1bucEGycoQHNVQrNQQdZYCHas84n2Ks911THPQ5ombV9GfDf3Mih71YP6LUUxDeTx8C7mJWt5'
    , {'encoding': 'json', 'maxSupportedTransactionVersion': 0}
    ]
    )
    ) as resp
    )

    union all

    select
    resp:data:result:slot as block_id
    QueryRunArchived: QueryRun has been archived