Skip to content

Commit 99d582f

Browse files
committed
chore: format
1 parent f54c93a commit 99d582f

23 files changed

+164
-140
lines changed

crates/cli/src/commands/auth.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,6 @@ async fn status() -> () {
118118

119119
println!("\n💡 Note: Environment variables take precedence over stored credentials.");
120120
println!(" Use 'rrelayer auth login' to store credentials securely.");
121-
122-
123121
}
124122

125123
async fn login(profile_name: &str) -> Result<(), CliError> {

crates/cli/src/commands/balance.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,10 @@ pub async fn handle_balance(
4646
BalanceError::QueryFailed(format!("Failed to get token balance: {}", e))
4747
})?;
4848

49-
let decimals =
50-
token_contract.decimals().call().await.unwrap_or(18u8);
49+
let decimals = token_contract.decimals().call().await.unwrap_or(18u8);
5150

52-
let token_symbol = token_contract
53-
.symbol()
54-
.call()
55-
.await
56-
.unwrap_or_else(|_| "TOKEN".to_string());
51+
let token_symbol =
52+
token_contract.symbol().call().await.unwrap_or_else(|_| "TOKEN".to_string());
5753

5854
let divisor = U256::from(10).pow(U256::from(decimals));
5955
let token_value = if balance.is_zero() {

crates/cli/src/commands/config.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,7 @@ pub async fn handle_get(relayer_id: &RelayerId, client: &Client) -> Result<(), C
8080
let relayer = &result.relayer;
8181
let provider_urls = &result.provider_urls;
8282

83-
let created_at = relayer.created_at
84-
.format("%Y-%m-%d %H:%M:%S UTC");
83+
let created_at = relayer.created_at.format("%Y-%m-%d %H:%M:%S UTC");
8584

8685
let max_gas = match &relayer.max_gas_price {
8786
Some(price) => price.into_u128().to_string(),

crates/cli/src/credentials.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,19 @@ pub fn list_profiles() -> Result<Vec<String>, CredentialError> {
8383
let storage_dir = get_storage_dir()?;
8484

8585
if storage_dir.exists()
86-
&& let Ok(entries) = fs::read_dir(storage_dir) {
87-
for entry in entries.flatten() {
88-
let path = entry.path();
89-
if path.is_file() && path.extension() == Some(std::ffi::OsStr::new("json"))
90-
&& let Some(stem) = path.file_stem()
91-
&& let Some(profile_name) = stem.to_str() {
92-
profiles.push(profile_name.to_string());
93-
}
86+
&& let Ok(entries) = fs::read_dir(storage_dir)
87+
{
88+
for entry in entries.flatten() {
89+
let path = entry.path();
90+
if path.is_file()
91+
&& path.extension() == Some(std::ffi::OsStr::new("json"))
92+
&& let Some(stem) = path.file_stem()
93+
&& let Some(profile_name) = stem.to_str()
94+
{
95+
profiles.push(profile_name.to_string());
9496
}
9597
}
98+
}
9699

97100
profiles.sort();
98101
Ok(profiles)

crates/core/src/app_state.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -252,11 +252,12 @@ impl AppState {
252252
if let Some(network_permissions) = network_permission {
253253
for network_permission in network_permissions {
254254
if network_permission.relayers.contains(relayer)
255-
&& network_permission.disable_personal_sign.unwrap_or_default() {
256-
return Err(unauthorized(Some(
257-
"Relayer have disabled personal signing".to_string(),
258-
)));
259-
}
255+
&& network_permission.disable_personal_sign.unwrap_or_default()
256+
{
257+
return Err(unauthorized(Some(
258+
"Relayer have disabled personal signing".to_string(),
259+
)));
260+
}
260261
}
261262
}
262263

crates/core/src/startup.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
use std::{net::SocketAddr, sync::Arc, time::Instant};
2-
use std::path::Path;
31
use crate::app_state::RelayersInternalOnly;
42
use crate::authentication::{create_basic_auth_routes, inject_basic_auth_status};
53
use crate::background_tasks::run_background_tasks;
@@ -39,6 +37,8 @@ use axum::{
3937
Json, Router,
4038
};
4139
use dotenv::dotenv;
40+
use std::path::Path;
41+
use std::{net::SocketAddr, sync::Arc, time::Instant};
4242
use thiserror::Error;
4343
use tokio::sync::Mutex;
4444
use tower_http::cors::{AllowOrigin, Any, CorsLayer};

crates/core/src/transaction/queue_system/transactions_queue.rs

Lines changed: 56 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -419,66 +419,65 @@ impl TransactionsQueue {
419419
info!("Transaction {} failed on-chain for relayer: {}", id, self.relayer.name);
420420
}
421421

422-
let (winner_transaction, loser_transaction, loser_status) =
423-
if comp_tx.original.id == *id {
424-
let loser_status = if let Some((_, comp_type)) = &comp_tx.competitive {
425-
match comp_type {
426-
CompetitionType::Cancel => TransactionStatus::DROPPED,
427-
CompetitionType::Replace => TransactionStatus::DROPPED,
428-
}
429-
} else {
430-
TransactionStatus::DROPPED
431-
};
432-
433-
let winner = Transaction {
434-
status: transaction_status,
435-
mined_at: Some(Utc::now()),
436-
cancelled_by_transaction_id: None,
437-
..comp_tx.original
438-
};
439-
440-
(winner, comp_tx.competitive.map(|(tx, _)| tx), loser_status)
441-
} else if let Some((competitor, comp_type)) = comp_tx.competitive {
442-
let (loser_status, loser_transaction) = match comp_type {
443-
CompetitionType::Cancel => {
444-
// When cancel wins, original transaction becomes a cancelled no-op
445-
let cancelled_original = Transaction {
446-
status: TransactionStatus::CANCELLED,
447-
is_noop: true,
448-
to: self.relay_address(),
449-
value: TransactionValue::zero(),
450-
data: TransactionData::empty(),
451-
cancelled_by_transaction_id: Some(competitor.id),
452-
..comp_tx.original
453-
};
454-
(TransactionStatus::CANCELLED, cancelled_original)
455-
}
456-
CompetitionType::Replace => {
457-
let replaced_original = Transaction {
458-
status: TransactionStatus::REPLACED,
459-
..comp_tx.original
460-
};
461-
(TransactionStatus::REPLACED, replaced_original)
462-
}
463-
};
464-
465-
let winner = Transaction {
466-
status: transaction_status,
467-
mined_at: Some(Utc::now()),
468-
..competitor
469-
};
470-
471-
(winner, Some(loser_transaction), loser_status)
422+
let (winner_transaction, loser_transaction, loser_status) = if comp_tx.original.id
423+
== *id
424+
{
425+
let loser_status = if let Some((_, comp_type)) = &comp_tx.competitive {
426+
match comp_type {
427+
CompetitionType::Cancel => TransactionStatus::DROPPED,
428+
CompetitionType::Replace => TransactionStatus::DROPPED,
429+
}
472430
} else {
473-
return Err(
474-
MoveInmempoolTransactionToMinedError::TransactionIdDoesNotMatch(
475-
self.relayer.id,
476-
*id,
477-
comp_tx.original,
478-
),
479-
);
431+
TransactionStatus::DROPPED
480432
};
481433

434+
let winner = Transaction {
435+
status: transaction_status,
436+
mined_at: Some(Utc::now()),
437+
cancelled_by_transaction_id: None,
438+
..comp_tx.original
439+
};
440+
441+
(winner, comp_tx.competitive.map(|(tx, _)| tx), loser_status)
442+
} else if let Some((competitor, comp_type)) = comp_tx.competitive {
443+
let (loser_status, loser_transaction) = match comp_type {
444+
CompetitionType::Cancel => {
445+
// When cancel wins, original transaction becomes a cancelled no-op
446+
let cancelled_original = Transaction {
447+
status: TransactionStatus::CANCELLED,
448+
is_noop: true,
449+
to: self.relay_address(),
450+
value: TransactionValue::zero(),
451+
data: TransactionData::empty(),
452+
cancelled_by_transaction_id: Some(competitor.id),
453+
..comp_tx.original
454+
};
455+
(TransactionStatus::CANCELLED, cancelled_original)
456+
}
457+
CompetitionType::Replace => {
458+
let replaced_original = Transaction {
459+
status: TransactionStatus::REPLACED,
460+
..comp_tx.original
461+
};
462+
(TransactionStatus::REPLACED, replaced_original)
463+
}
464+
};
465+
466+
let winner = Transaction {
467+
status: transaction_status,
468+
mined_at: Some(Utc::now()),
469+
..competitor
470+
};
471+
472+
(winner, Some(loser_transaction), loser_status)
473+
} else {
474+
return Err(MoveInmempoolTransactionToMinedError::TransactionIdDoesNotMatch(
475+
self.relayer.id,
476+
*id,
477+
comp_tx.original,
478+
));
479+
};
480+
482481
let mut mining_transactions = self.mined_transactions.lock().await;
483482
mining_transactions.insert(winner_transaction.id, winner_transaction.clone());
484483

crates/core/src/transaction/queue_system/transactions_queues.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -646,10 +646,7 @@ impl TransactionsQueues {
646646
);
647647
Ok(CancelTransactionResult::failed())
648648
} else {
649-
info!(
650-
"cancel_transaction: transaction {} not found in any queue",
651-
transaction.id
652-
);
649+
info!("cancel_transaction: transaction {} not found in any queue", transaction.id);
653650
Ok(CancelTransactionResult::failed())
654651
}
655652
} else {

crates/core/src/transaction/types/transaction_blob.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ use alloy::primitives::FixedBytes;
22
use alloy_eips::eip4844::{Blob, BYTES_PER_BLOB};
33
use anyhow::{anyhow, Result};
44
use serde::{Deserialize, Serialize};
5-
use std::{convert::TryFrom, str::FromStr};
65
use std::fmt::Display;
6+
use std::{convert::TryFrom, str::FromStr};
77
use tokio_postgres::types::{FromSql, IsNull, ToSql, Type};
88

99
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]

crates/core/src/wallet/turnkey_wallet_manager.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,8 @@ impl WalletManagerTrait for TurnkeyWalletManager {
303303
{
304304
let accounts = self.accounts.lock().await;
305305
if let Some(account) = accounts.get(&wallet_index) {
306-
return EvmAddress::from_str(&account.address).map_err(|e| {
307-
WalletError::ApiError { message: format!("Invalid address format: {}", e) }
306+
return EvmAddress::from_str(&account.address).map_err(|e| WalletError::ApiError {
307+
message: format!("Invalid address format: {}", e),
308308
});
309309
}
310310
}

0 commit comments

Comments
 (0)