Skip to content

Commit fca7cbc

Browse files
committed
chore: cargo fmt
1 parent c777d91 commit fca7cbc

File tree

5 files changed

+45
-21
lines changed

5 files changed

+45
-21
lines changed

src/indexer/mod.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,12 @@ impl Indexer {
134134
}
135135

136136
pub async fn update_pox_info(&mut self) {
137-
let res: Result<PoxInfo, _> = reqwest::get(format!("{}/v2/pox", self.config.stacks_node_rpc_url)).await
138-
.expect("Unable to retrieve pox info")
139-
.json().await;
137+
let res: Result<PoxInfo, _> =
138+
reqwest::get(format!("{}/v2/pox", self.config.stacks_node_rpc_url))
139+
.await
140+
.expect("Unable to retrieve pox info")
141+
.json()
142+
.await;
140143
if let Ok(ref pox_info) = res {
141144
self.stacks_context.pox_info = pox_info.clone();
142145
}

src/integrate/events_observer.rs

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ use crate::indexer::{chains, BitcoinChainEvent, Indexer, IndexerConfig, StacksCh
33
use crate::integrate::{MempoolAdmissionData, ServiceStatusData, Status};
44
use crate::poke::load_session;
55
use crate::publish::{publish_contract, Network};
6-
use crate::types::{self, DevnetConfig, BlockIdentifier};
6+
use crate::types::{self, BlockIdentifier, DevnetConfig};
77
use crate::utils;
8-
use crate::utils::stacks::{transactions, StacksRpc, PoxInfo};
8+
use crate::utils::stacks::{transactions, PoxInfo, StacksRpc};
99
use base58::FromBase58;
1010
use clarity_repl::clarity::representations::ClarityName;
1111
use clarity_repl::clarity::types::{BuffData, SequenceData, TupleData, Value as ClarityValue};
@@ -225,12 +225,15 @@ pub async fn start_events_observer(
225225
init_status.deployer_nonce = 0;
226226
}
227227
}
228-
Ok(EventsObserverCommand::UpdatePoxInfo) => {
229-
230-
}
228+
Ok(EventsObserverCommand::UpdatePoxInfo) => {}
231229
Ok(EventsObserverCommand::PublishInitialContracts) => {
232230
if let Ok(mut init_status_writer) = init_status_rw_lock.write() {
233-
let res = publish_initial_contracts(&config.devnet_config, &config.accounts, config.deployment_fee_rate, &mut init_status_writer);
231+
let res = publish_initial_contracts(
232+
&config.devnet_config,
233+
&config.accounts,
234+
config.deployment_fee_rate,
235+
&mut init_status_writer,
236+
);
234237
if let Some(tx_count) = res {
235238
let _ = devnet_event_tx.send(DevnetEvent::success(format!(
236239
"Will publish {} contracts",
@@ -241,7 +244,13 @@ pub async fn start_events_observer(
241244
}
242245
Ok(EventsObserverCommand::PublishPoxStackingOrders(block_identifier)) => {
243246
let bitcoin_block_height = block_identifier.index;
244-
let res = publish_stacking_orders(&config.devnet_config, &config.accounts, config.deployment_fee_rate, bitcoin_block_height as u32).await;
247+
let res = publish_stacking_orders(
248+
&config.devnet_config,
249+
&config.accounts,
250+
config.deployment_fee_rate,
251+
bitcoin_block_height as u32,
252+
)
253+
.await;
245254
if let Some(tx_count) = res {
246255
let _ = devnet_event_tx.send(DevnetEvent::success(format!(
247256
"Will broadcast {} stacking orders",
@@ -354,7 +363,7 @@ pub fn handle_new_block(
354363
}
355364
};
356365

357-
// Partially update the UI. With current approach a full update
366+
// Partially update the UI. With current approach a full update
358367
// would requires either cloning the block, or passing ownership.
359368
let devnet_events_tx = devnet_events_tx.inner();
360369
if let Ok(tx) = devnet_events_tx.lock() {
@@ -394,7 +403,9 @@ pub fn handle_new_block(
394403
let should_submit_pox_orders = block.metadata.pox_cycle_position == (pox_cycle_length - 2);
395404
if should_submit_pox_orders {
396405
if let Ok(background_job_tx) = background_job_tx_mutex.lock() {
397-
let _ = background_job_tx.send(EventsObserverCommand::PublishPoxStackingOrders(block.metadata.bitcoin_anchor_block_identifier.clone()));
406+
let _ = background_job_tx.send(EventsObserverCommand::PublishPoxStackingOrders(
407+
block.metadata.bitcoin_anchor_block_identifier.clone(),
408+
));
398409
}
399410
}
400411

@@ -491,7 +502,6 @@ pub fn handle_ping() -> Json<JsonValue> {
491502
}))
492503
}
493504

494-
495505
pub fn publish_initial_contracts(
496506
devnet_config: &DevnetConfig,
497507
accounts: &Vec<Account>,
@@ -569,7 +579,7 @@ pub async fn publish_stacking_orders(
569579
}
570580

571581
let stacks_node_rpc_url = format!("http://localhost:{}", devnet_config.stacks_node_rpc_port);
572-
582+
573583
let mut transactions = 0;
574584
let pox_info: PoxInfo = reqwest::get(format!("{}/v2/pox", stacks_node_rpc_url))
575585
.await

src/integrate/mod.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,12 @@ pub async fn do_run_devnet(
8181
let (events_observer_commands_tx, events_observer_commands_rx) = channel();
8282
let moved_events_observer_commands_tx = events_observer_commands_tx.clone();
8383
let events_observer_handle = std::thread::spawn(move || {
84-
let future = start_events_observer(config, events_observer_tx, events_observer_commands_rx, moved_events_observer_commands_tx);
84+
let future = start_events_observer(
85+
config,
86+
events_observer_tx,
87+
events_observer_commands_rx,
88+
moved_events_observer_commands_tx,
89+
);
8590
let rt = utils::create_basic_runtime();
8691
let _ = rt.block_on(future);
8792
});

src/integrate/ui/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ mod ui;
55
#[allow(dead_code)]
66
mod util;
77

8-
use super::{DevnetEvent, events_observer::EventsObserverCommand};
8+
use super::{events_observer::EventsObserverCommand, DevnetEvent};
99
use app::App;
1010
use crossterm::{
1111
event::{self, Event, KeyCode, KeyModifiers},

src/utils/stacks/rpc_client.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ struct Balance {
5050

5151
impl StacksRpc {
5252
pub fn new(url: &str) -> Self {
53-
Self {
53+
Self {
5454
url: url.into(),
5555
client: Client::builder().build().unwrap(),
5656
}
@@ -62,7 +62,8 @@ impl StacksRpc {
6262
) -> Result<PostTransactionResult, RpcError> {
6363
let tx = transaction.serialize_to_vec();
6464
let path = format!("{}/v2/transactions", self.url);
65-
let res = self.client
65+
let res = self
66+
.client
6667
.post(&path)
6768
.header("Content-Type", "application/octet-stream")
6869
.body(tx)
@@ -82,7 +83,9 @@ impl StacksRpc {
8283
pub fn get_nonce(&self, address: &str) -> Result<u64, RpcError> {
8384
let request_url = format!("{}/v2/accounts/{addr}", self.url, addr = address,);
8485

85-
let res: Balance = self.client.get(&request_url)
86+
let res: Balance = self
87+
.client
88+
.get(&request_url)
8689
.send()
8790
.expect("Unable to retrieve account")
8891
.json()
@@ -94,7 +97,9 @@ impl StacksRpc {
9497
pub fn get_pox_info(&self) -> Result<PoxInfo, RpcError> {
9598
let request_url = format!("{}/v2/pox", self.url);
9699

97-
let res: PoxInfo = self.client.get(&request_url)
100+
let res: PoxInfo = self
101+
.client
102+
.get(&request_url)
98103
.send()
99104
.expect("Unable to retrieve account")
100105
.json()
@@ -119,7 +124,8 @@ impl StacksRpc {
119124
.iter()
120125
.map(|a| bytes_to_hex(&a.serialize_to_vec()))
121126
.collect::<Vec<_>>();
122-
let res = self.client
127+
let res = self
128+
.client
123129
.post(&path)
124130
.json(&json!({
125131
"sender": sender,

0 commit comments

Comments
 (0)