From 221245d66bcf11639bfd095bb402ed27b96c6466 Mon Sep 17 00:00:00 2001 From: Siddharth2207 Date: Fri, 29 Dec 2023 17:45:20 +0530 Subject: [PATCH] fmt --- orderbook-rs/src/errors.rs | 12 ++++++------ orderbook-rs/src/gasoracle/mod.rs | 3 +-- orderbook-rs/src/interpreter/mod.rs | 3 +-- orderbook-rs/src/orderbook/add_order/v3.rs | 2 +- orderbook-rs/src/transaction/mod.rs | 6 ++---- 5 files changed, 11 insertions(+), 15 deletions(-) diff --git a/orderbook-rs/src/errors.rs b/orderbook-rs/src/errors.rs index 7d223a0d2..3d70a7661 100644 --- a/orderbook-rs/src/errors.rs +++ b/orderbook-rs/src/errors.rs @@ -12,20 +12,20 @@ use url::ParseError; #[derive(Error, Debug)] pub enum RainOrderbookError { #[error("Invalid RPC URL")] - InvalidRPC(#[from] ParseError), + InvalidRPC(#[from] ParseError), #[error("Invalid Contract Function Call")] - InvalidContractFunctionCall(#[from] ContractError>), + InvalidContractFunctionCall(#[from] ContractError>), #[error("Invalid Address")] - InvalidAddress(#[from] FromHexError), + InvalidAddress(#[from] FromHexError), #[error("Failed to confirm transaction")] - TransactionConfirmationError(#[from] ProviderError), + TransactionConfirmationError(#[from] ProviderError), #[error("Error in Transaction")] - TransactionError(#[from] SignerMiddlewareError, Ledger>), + TransactionError(#[from] SignerMiddlewareError, Ledger>), #[error("Failed to fetch Transaction Receipt")] - TransactionReceiptError + TransactionReceiptError, } diff --git a/orderbook-rs/src/gasoracle/mod.rs b/orderbook-rs/src/gasoracle/mod.rs index ba5c68230..b2d4dd64e 100644 --- a/orderbook-rs/src/gasoracle/mod.rs +++ b/orderbook-rs/src/gasoracle/mod.rs @@ -4,8 +4,7 @@ use reqwest::{header::AUTHORIZATION, Client}; use url::Url; /// Bloacknative Base Url for fetching blockprices -static BLOCKNATIVE_BLOCKPRICES_URL: &str = - "https://api.blocknative.com/gasprices/blockprices"; +static BLOCKNATIVE_BLOCKPRICES_URL: &str = "https://api.blocknative.com/gasprices/blockprices"; /// Blocknative Gas Oracle. /// Returns max priority fee and max fee from blocknative api. diff --git a/orderbook-rs/src/interpreter/mod.rs b/orderbook-rs/src/interpreter/mod.rs index 05b223315..6677d39d1 100644 --- a/orderbook-rs/src/interpreter/mod.rs +++ b/orderbook-rs/src/interpreter/mod.rs @@ -20,10 +20,9 @@ pub async fn get_disp( deployer_npe2: Address, rpc_url: String, ) -> Result<(Address, Address, Address), RainOrderbookError> { - let provider = Provider::::try_from(rpc_url.clone())?; - let deployer_npe2_address = H160::from_str(&deployer_npe2.to_string())?; + let deployer_npe2_address = H160::from_str(&deployer_npe2.to_string())?; let deployer_npe2 = IExpressionDeployerV3::new(deployer_npe2_address, Arc::new(provider.clone())); diff --git a/orderbook-rs/src/orderbook/add_order/v3.rs b/orderbook-rs/src/orderbook/add_order/v3.rs index 04e0fd9c9..25adcd234 100644 --- a/orderbook-rs/src/orderbook/add_order/v3.rs +++ b/orderbook-rs/src/orderbook/add_order/v3.rs @@ -26,7 +26,7 @@ pub async fn add_ob_order( ) -> Result, RainOrderbookError> { let (_, _, rain_parser) = get_disp(deployer_address, rpc_url.clone()).await?; let (bytecode, constants) = - parse_rainstring(rain_parser, rainlang_order_string, rpc_url.clone()).await?; + parse_rainstring(rain_parser, rainlang_order_string, rpc_url.clone()).await?; let evaluable_config = EvaluableConfigV3 { deployer: deployer_address, diff --git a/orderbook-rs/src/transaction/mod.rs b/orderbook-rs/src/transaction/mod.rs index 953458efa..3087611fe 100644 --- a/orderbook-rs/src/transaction/mod.rs +++ b/orderbook-rs/src/transaction/mod.rs @@ -64,8 +64,8 @@ pub async fn execute_transaction( let pending_tx = client.send_transaction(tx, None).await?; info!("Transaction submitted. Awaiting block confirmations..."); - let tx_confimration = pending_tx.confirmations(1).await?; - + let tx_confimration = pending_tx.confirmations(1).await?; + let tx_receipt = match tx_confimration { Some(receipt) => receipt, None => return Err(RainOrderbookError::TransactionReceiptError), @@ -76,6 +76,4 @@ pub async fn execute_transaction( hex::encode(tx_receipt.transaction_hash.as_bytes()) ); Ok(tx_receipt) - - }