From 754c81e48ca14c95d01ec39b52a6d8c9ce8ed501 Mon Sep 17 00:00:00 2001 From: jaswinder6991 Date: Fri, 17 May 2024 16:51:19 +0530 Subject: [PATCH] cargo fmt --- near-accounts/examples/multi-thread.rs | 24 ++++++++++++++++-------- near-accounts/src/accounts.rs | 7 +++++-- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/near-accounts/examples/multi-thread.rs b/near-accounts/examples/multi-thread.rs index c14ebc9..28d09cb 100644 --- a/near-accounts/examples/multi-thread.rs +++ b/near-accounts/examples/multi-thread.rs @@ -1,5 +1,5 @@ use near_accounts::Account; -use near_crypto::{InMemorySigner,SecretKey}; +use near_crypto::{InMemorySigner, SecretKey}; use near_primitives::{types::Gas, views::FinalExecutionOutcomeViewEnum}; use near_providers::JsonRpcProvider; use std::sync::Arc; @@ -18,14 +18,16 @@ async fn main() -> Result<(), Box> { let provider = Arc::new(JsonRpcProvider::new("https://rpc.testnet.near.org")); //let provider = JsonRpcProvider::new("https://rpc.testnet.near.org"); - let signer = Arc::new(InMemorySigner::from_secret_key(signer_account_id.clone(), signer_secret_key)); + let signer = Arc::new(InMemorySigner::from_secret_key( + signer_account_id.clone(), + signer_secret_key, + )); let account = Account::new(signer_account_id, signer.clone(), provider.clone()); let contract_id: AccountId = "contract.near-api-rs.testnet".parse::()?; // This spawns a new asynchronous task to handle account creation let handle = tokio::spawn(async move { - let method_name = "set_status".to_string(); let args_json = json!({"message": "working1"}); @@ -35,7 +37,8 @@ async fn main() -> Result<(), Box> { let result = account .function_call(&contract_id, method_name, args_json, gas, amount) - .await.expect("Reason") + .await + .expect("Reason") .transact() .await; @@ -43,10 +46,15 @@ async fn main() -> Result<(), Box> { Ok(res) => match &res.final_execution_outcome { Some(FinalExecutionOutcomeViewEnum::FinalExecutionOutcome(outcome)) => { println!("Final Execution outcome: {:#?}", outcome); - }, - Some(FinalExecutionOutcomeViewEnum::FinalExecutionOutcomeWithReceipt(outcome_receipt)) => { - println!("Final Execution outcome with receipt: {:#?}", outcome_receipt); - }, + } + Some(FinalExecutionOutcomeViewEnum::FinalExecutionOutcomeWithReceipt( + outcome_receipt, + )) => { + println!( + "Final Execution outcome with receipt: {:#?}", + outcome_receipt + ); + } None => println!("No Final execution outcome."), }, Err(err) => println!("Error: {:#?}", err), diff --git a/near-accounts/src/accounts.rs b/near-accounts/src/accounts.rs index 6d601f5..ade2d76 100644 --- a/near-accounts/src/accounts.rs +++ b/near-accounts/src/accounts.rs @@ -40,7 +40,10 @@ impl TransactionSender { /// # Returns /// /// A new `Account` instance. - pub fn new(signed_transaction: SignedTransaction, provider: Arc) -> Self { + pub fn new( + signed_transaction: SignedTransaction, + provider: Arc, + ) -> Self { Self { signed_transaction, provider, @@ -113,7 +116,7 @@ impl TransactionSender { pub struct Account { pub account_id: AccountId, //pub signer: Arc, // Use your Signer abstraction - pub signer: Arc, // Use your Signer abstraction + pub signer: Arc, // Use your Signer abstraction //pub provider: Arc, // Use your Provider abstraction provider: Arc, }