Skip to content

Commit

Permalink
some other fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
telezhnaya committed Jan 16, 2024
1 parent 58a2c0b commit e395fe2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion examples/query_tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
})
.await
{
Ok(block_details) => println!("{:#?}", block_details),
Ok(tx_details) => println!("{:#?}", tx_details),
Err(err) => match err.handler_error() {
Some(err) => {
println!("(i) An error occurred `{:#?}`", err);
Expand Down
8 changes: 5 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
//! ```no_run
//! use near_jsonrpc_client::{methods, JsonRpcClient};
//! use near_jsonrpc_primitives::types::transactions::TransactionInfo;
//! use near_primitives::views::TxExecutionStatus;
//!
//! # #[tokio::main]
//! # async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
Expand All @@ -48,6 +49,7 @@
//! tx_hash: "9FtHUFBQsZ2MG77K3x3MJ9wjX3UT8zE1TczCrhZEcG8U".parse()?,
//! sender_account_id: "miraclx.near".parse()?,
//! },
//! wait_until: TxExecutionStatus::Executed,
//! };
//!
//! let tx_status = client.call(tx_status_request).await?;
Expand Down Expand Up @@ -439,9 +441,9 @@ mod tests {
assert!(
matches!(
tx_status,
Ok(methods::tx::RpcTransactionStatusResponse { ref transaction, .. })
if transaction.signer_id == "miraclx.near"
&& transaction.hash == "9FtHUFBQsZ2MG77K3x3MJ9wjX3UT8zE1TczCrhZEcG8U".parse()?
Ok(methods::tx::RpcTransactionResponse { ref final_execution_outcome, .. })
if final_execution_outcome.unwrap().into_outcome().transaction.signer_id == "miraclx.near"
&& final_execution_outcome.unwrap().into_outcome().transaction.hash == "9FtHUFBQsZ2MG77K3x3MJ9wjX3UT8zE1TczCrhZEcG8U".parse()?
),
"expected an Ok(RpcTransactionStatusResponse) with matching signer_id + hash, found [{:?}]",
tx_status
Expand Down
7 changes: 3 additions & 4 deletions src/methods/experimental/tx_status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,26 @@
//!
//! ```
//! use near_jsonrpc_client::{methods, JsonRpcClient};
//! use near_primitives::views;
//! use near_primitives::views::TxExecutionStatus;
//!
//! # #[tokio::main]
//! # async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
//! use near_primitives::views::TxExecutionStatus;
//! let client = JsonRpcClient::connect("https://archival-rpc.mainnet.near.org");
//! let tx_hash = "B9aypWiMuiWR5kqzewL9eC96uZWA3qCMhLe67eBMWacq".parse()?;
//!
//! let request = methods::EXPERIMENTAL_tx_status::RpcTransactionStatusRequest {
//! transaction_info: methods::EXPERIMENTAL_tx_status::TransactionInfo::TransactionId {
//! tx_hash,
//! sender_account_id: "itranscend.near".parse()?,
//! },
//! },
//! wait_until: TxExecutionStatus::Executed,
//! };
//!
//! let response = client.call(request).await?;
//!
//! assert!(matches!(
//! response,
//! views::FinalExecutionOutcomeWithReceiptView { .. }
//! near_jsonrpc_primitives::types::transactions::RpcTransactionResponse { .. }
//! ));
//! # Ok(())
//! # }
Expand Down

0 comments on commit e395fe2

Please sign in to comment.