near / near-jsonrpc-client-rs

Lower-level API for interfacing with the NEAR Protocol via JSONRPC.
https://docs.rs/near-jsonrpc-client
Apache License 2.0
46 stars 42 forks source link

How to get tx status with receipts #150

Open mohamedalichelbi opened 2 months ago

mohamedalichelbi commented 2 months ago

I am trying to get tx status with receipts, the RPC is returning correct JSON, but not sure if it is being deserialized correctly. Here are some snippets from my code (not runnable):

use near_jsonrpc_client::{methods::{self, EXPERIMENTAL_tx_status::{self, TransactionInfo}}, JsonRpcClient};

let request = EXPERIMENTAL_tx_status::RpcTransactionStatusRequest {
    transaction_info: TransactionInfo::TransactionId {
        tx_hash,
        sender_account_id,
    },
    wait_until: TxExecutionStatus::Final,
};

let tx_status = provider.call(&request).await?;

With tracing enabled, I see the RPC responding with JSON that contains the attribute "receipts": [....]. However, the rust attribute final_execution_outcome in my variable tx_status has type Some(FinalExecutionOutcomeViewEnum::FinalExecutionOutcome(FinalExecutionOutcomeView)). I would expect it to have Some(FinalExecutionOutcomeViewEnum::FinalExecutionOutcomeWithReceipt(FinalExecutionOutcomeWithReceiptView))

Any thoughts or help would be appreciated.

frol commented 1 month ago

Just for the reference, here is the relevant chat discussion: https://near.zulipchat.com/#narrow/stream/297873-node/topic/An.20issue.20with.20FinalExecutionOutcomeView