Bläddra i källkod

darkfid/drk: fmt

skoupidi 2 år sedan
förälder
incheckning
0c5bf14eee
2 ändrade filer med 257 tillägg och 54 borttagningar
  1. 2 2
      bin/darkfid/src/main.rs
  2. 255 52
      bin/drk/src/main.rs

+ 2 - 2
bin/darkfid/src/main.rs

@@ -298,7 +298,7 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
     } else {
     } else {
         None
         None
     };
     };
-    
+
     // Grab blockchain network configured transactions batch size for garbage collection
     // Grab blockchain network configured transactions batch size for garbage collection
     let txs_batch_size = match blockchain_config.txs_batch_size {
     let txs_batch_size = match blockchain_config.txs_batch_size {
         Some(b) => {
         Some(b) => {
@@ -307,7 +307,7 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
             } else {
             } else {
                 50
                 50
             }
             }
-        },
+        }
         None => 50,
         None => 50,
     };
     };
 
 

+ 255 - 52
bin/drk/src/main.rs

@@ -37,7 +37,7 @@ use darkfi::{
         path::{expand_path, get_config_path},
         path::{expand_path, get_config_path},
     },
     },
     zk::halo2::Field,
     zk::halo2::Field,
-    Result, Error,
+    Error, Result,
 };
 };
 use darkfi_dao_contract::{blockwindow, model::DaoProposalBulla, DaoFunction};
 use darkfi_dao_contract::{blockwindow, model::DaoProposalBulla, DaoFunction};
 use darkfi_money_contract::model::{Coin, CoinAttributes, TokenId};
 use darkfi_money_contract::model::{Coin, CoinAttributes, TokenId};
@@ -588,7 +588,13 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
         }
         }
 
 
         Subcmd::Ping => {
         Subcmd::Ping => {
-            let drk = Drk::new(blockchain_config.wallet_path, blockchain_config.wallet_pass, Some(blockchain_config.endpoint), ex).await?;
+            let drk = Drk::new(
+                blockchain_config.wallet_path,
+                blockchain_config.wallet_pass,
+                Some(blockchain_config.endpoint),
+                ex,
+            )
+            .await?;
             drk.ping().await?;
             drk.ping().await?;
             drk.stop_rpc_client().await
             drk.stop_rpc_client().await
         }
         }
@@ -623,7 +629,9 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
                 exit(2);
                 exit(2);
             }
             }
 
 
-            let drk = Drk::new(blockchain_config.wallet_path, blockchain_config.wallet_pass, None, ex).await?;
+            let drk =
+                Drk::new(blockchain_config.wallet_path, blockchain_config.wallet_pass, None, ex)
+                    .await?;
 
 
             if initialize {
             if initialize {
                 drk.initialize_wallet()?;
                 drk.initialize_wallet()?;
@@ -844,7 +852,9 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
         Subcmd::Spend => {
         Subcmd::Spend => {
             let tx = parse_tx_from_stdin().await?;
             let tx = parse_tx_from_stdin().await?;
 
 
-            let drk = Drk::new(blockchain_config.wallet_path, blockchain_config.wallet_pass, None, ex).await?;
+            let drk =
+                Drk::new(blockchain_config.wallet_path, blockchain_config.wallet_pass, None, ex)
+                    .await?;
 
 
             if let Err(e) = drk.mark_tx_spend(&tx).await {
             if let Err(e) = drk.mark_tx_spend(&tx).await {
                 eprintln!("Failed to mark transaction coins as spent: {e:?}");
                 eprintln!("Failed to mark transaction coins as spent: {e:?}");
@@ -872,7 +882,9 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
             };
             };
 
 
             let coin = Coin::from(elem);
             let coin = Coin::from(elem);
-            let drk = Drk::new(blockchain_config.wallet_path, blockchain_config.wallet_pass, None, ex).await?;
+            let drk =
+                Drk::new(blockchain_config.wallet_path, blockchain_config.wallet_pass, None, ex)
+                    .await?;
             if let Err(e) = drk.unspend_coin(&coin).await {
             if let Err(e) = drk.unspend_coin(&coin).await {
                 eprintln!("Failed to mark coin as unspent: {e:?}");
                 eprintln!("Failed to mark coin as unspent: {e:?}");
                 exit(2);
                 exit(2);
@@ -882,7 +894,13 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
         }
         }
 
 
         Subcmd::Transfer { amount, token, recipient, spend_hook, user_data, half_split } => {
         Subcmd::Transfer { amount, token, recipient, spend_hook, user_data, half_split } => {
-            let drk = Drk::new(blockchain_config.wallet_path, blockchain_config.wallet_pass, Some(blockchain_config.endpoint), ex).await?;
+            let drk = Drk::new(
+                blockchain_config.wallet_path,
+                blockchain_config.wallet_pass,
+                Some(blockchain_config.endpoint),
+                ex,
+            )
+            .await?;
 
 
             if let Err(e) = f64::from_str(&amount) {
             if let Err(e) = f64::from_str(&amount) {
                 eprintln!("Invalid amount: {e:?}");
                 eprintln!("Invalid amount: {e:?}");
@@ -955,8 +973,13 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
 
 
         Subcmd::Otc { command } => match command {
         Subcmd::Otc { command } => match command {
             OtcSubcmd::Init { value_pair, token_pair } => {
             OtcSubcmd::Init { value_pair, token_pair } => {
-                let drk =
-                    Drk::new(blockchain_config.wallet_path, blockchain_config.wallet_pass, Some(blockchain_config.endpoint), ex).await?;
+                let drk = Drk::new(
+                    blockchain_config.wallet_path,
+                    blockchain_config.wallet_pass,
+                    Some(blockchain_config.endpoint),
+                    ex,
+                )
+                .await?;
                 let value_pair = parse_value_pair(&value_pair)?;
                 let value_pair = parse_value_pair(&value_pair)?;
                 let token_pair = parse_token_pair(&drk, &token_pair).await?;
                 let token_pair = parse_token_pair(&drk, &token_pair).await?;
 
 
@@ -982,8 +1005,13 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
 
 
                 let partial: PartialSwapData = deserialize_async(&bytes).await?;
                 let partial: PartialSwapData = deserialize_async(&bytes).await?;
 
 
-                let drk =
-                    Drk::new(blockchain_config.wallet_path, blockchain_config.wallet_pass, Some(blockchain_config.endpoint), ex).await?;
+                let drk = Drk::new(
+                    blockchain_config.wallet_path,
+                    blockchain_config.wallet_pass,
+                    Some(blockchain_config.endpoint),
+                    ex,
+                )
+                .await?;
                 let tx = match drk.join_swap(partial, None, None, None).await {
                 let tx = match drk.join_swap(partial, None, None, None).await {
                     Ok(tx) => tx,
                     Ok(tx) => tx,
                     Err(e) => {
                     Err(e) => {
@@ -1004,7 +1032,13 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
                     exit(2);
                     exit(2);
                 };
                 };
 
 
-                let drk = Drk::new(blockchain_config.wallet_path, blockchain_config.wallet_pass, None, ex).await?;
+                let drk = Drk::new(
+                    blockchain_config.wallet_path,
+                    blockchain_config.wallet_pass,
+                    None,
+                    ex,
+                )
+                .await?;
                 if let Err(e) = drk.inspect_swap(bytes).await {
                 if let Err(e) = drk.inspect_swap(bytes).await {
                     eprintln!("Failed to inspect swap: {e:?}");
                     eprintln!("Failed to inspect swap: {e:?}");
                     exit(2);
                     exit(2);
@@ -1016,7 +1050,13 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
             OtcSubcmd::Sign => {
             OtcSubcmd::Sign => {
                 let mut tx = parse_tx_from_stdin().await?;
                 let mut tx = parse_tx_from_stdin().await?;
 
 
-                let drk = Drk::new(blockchain_config.wallet_path, blockchain_config.wallet_pass, None, ex).await?;
+                let drk = Drk::new(
+                    blockchain_config.wallet_path,
+                    blockchain_config.wallet_pass,
+                    None,
+                    ex,
+                )
+                .await?;
                 if let Err(e) = drk.sign_swap(&mut tx).await {
                 if let Err(e) = drk.sign_swap(&mut tx).await {
                     eprintln!("Failed to sign joined swap transaction: {e:?}");
                     eprintln!("Failed to sign joined swap transaction: {e:?}");
                     exit(2);
                     exit(2);
@@ -1049,7 +1089,13 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
                 let approval_ratio_base = 100_u64;
                 let approval_ratio_base = 100_u64;
                 let approval_ratio_quot = (approval_ratio * approval_ratio_base as f64) as u64;
                 let approval_ratio_quot = (approval_ratio * approval_ratio_base as f64) as u64;
 
 
-                let drk = Drk::new(blockchain_config.wallet_path, blockchain_config.wallet_pass, None, ex).await?;
+                let drk = Drk::new(
+                    blockchain_config.wallet_path,
+                    blockchain_config.wallet_pass,
+                    None,
+                    ex,
+                )
+                .await?;
                 let gov_token_id = match drk.get_token(gov_token_id).await {
                 let gov_token_id = match drk.get_token(gov_token_id).await {
                     Ok(g) => g,
                     Ok(g) => g,
                     Err(e) => {
                     Err(e) => {
@@ -1093,7 +1139,13 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
                 let bytes = bs58::decode(&buf.trim()).into_vec()?;
                 let bytes = bs58::decode(&buf.trim()).into_vec()?;
                 let params: DaoParams = deserialize_async(&bytes).await?;
                 let params: DaoParams = deserialize_async(&bytes).await?;
 
 
-                let drk = Drk::new(blockchain_config.wallet_path, blockchain_config.wallet_pass, None, ex).await?;
+                let drk = Drk::new(
+                    blockchain_config.wallet_path,
+                    blockchain_config.wallet_pass,
+                    None,
+                    ex,
+                )
+                .await?;
                 if let Err(e) = drk.import_dao(&name, params).await {
                 if let Err(e) = drk.import_dao(&name, params).await {
                     eprintln!("Failed to import DAO: {e:?}");
                     eprintln!("Failed to import DAO: {e:?}");
                     exit(2);
                     exit(2);
@@ -1103,7 +1155,13 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
             }
             }
 
 
             DaoSubcmd::List { name } => {
             DaoSubcmd::List { name } => {
-                let drk = Drk::new(blockchain_config.wallet_path, blockchain_config.wallet_pass, None, ex).await?;
+                let drk = Drk::new(
+                    blockchain_config.wallet_path,
+                    blockchain_config.wallet_pass,
+                    None,
+                    ex,
+                )
+                .await?;
                 if let Err(e) = drk.dao_list(&name).await {
                 if let Err(e) = drk.dao_list(&name).await {
                     eprintln!("Failed to list DAO: {e:?}");
                     eprintln!("Failed to list DAO: {e:?}");
                     exit(2);
                     exit(2);
@@ -1113,7 +1171,13 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
             }
             }
 
 
             DaoSubcmd::Balance { name } => {
             DaoSubcmd::Balance { name } => {
-                let drk = Drk::new(blockchain_config.wallet_path, blockchain_config.wallet_pass, None, ex).await?;
+                let drk = Drk::new(
+                    blockchain_config.wallet_path,
+                    blockchain_config.wallet_pass,
+                    None,
+                    ex,
+                )
+                .await?;
                 let balmap = match drk.dao_balance(&name).await {
                 let balmap = match drk.dao_balance(&name).await {
                     Ok(b) => b,
                     Ok(b) => b,
                     Err(e) => {
                     Err(e) => {
@@ -1157,8 +1221,13 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
             }
             }
 
 
             DaoSubcmd::Mint { name } => {
             DaoSubcmd::Mint { name } => {
-                let drk =
-                    Drk::new(blockchain_config.wallet_path, blockchain_config.wallet_pass, Some(blockchain_config.endpoint), ex).await?;
+                let drk = Drk::new(
+                    blockchain_config.wallet_path,
+                    blockchain_config.wallet_pass,
+                    Some(blockchain_config.endpoint),
+                    ex,
+                )
+                .await?;
                 let tx = match drk.dao_mint(&name).await {
                 let tx = match drk.dao_mint(&name).await {
                     Ok(tx) => tx,
                     Ok(tx) => tx,
                     Err(e) => {
                     Err(e) => {
@@ -1180,8 +1249,13 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
                 spend_hook,
                 spend_hook,
                 user_data,
                 user_data,
             } => {
             } => {
-                let drk =
-                    Drk::new(blockchain_config.wallet_path, blockchain_config.wallet_pass, Some(blockchain_config.endpoint), ex).await?;
+                let drk = Drk::new(
+                    blockchain_config.wallet_path,
+                    blockchain_config.wallet_pass,
+                    Some(blockchain_config.endpoint),
+                    ex,
+                )
+                .await?;
 
 
                 if let Err(e) = f64::from_str(&amount) {
                 if let Err(e) = f64::from_str(&amount) {
                     eprintln!("Invalid amount: {e:?}");
                     eprintln!("Invalid amount: {e:?}");
@@ -1255,7 +1329,13 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
             }
             }
 
 
             DaoSubcmd::Proposals { name } => {
             DaoSubcmd::Proposals { name } => {
-                let drk = Drk::new(blockchain_config.wallet_path, blockchain_config.wallet_pass, None, ex).await?;
+                let drk = Drk::new(
+                    blockchain_config.wallet_path,
+                    blockchain_config.wallet_pass,
+                    None,
+                    ex,
+                )
+                .await?;
                 let proposals = drk.get_dao_proposals(&name).await?;
                 let proposals = drk.get_dao_proposals(&name).await?;
 
 
                 for (i, proposal) in proposals.iter().enumerate() {
                 for (i, proposal) in proposals.iter().enumerate() {
@@ -1274,8 +1354,13 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
                     }
                     }
                 };
                 };
 
 
-                let drk =
-                    Drk::new(blockchain_config.wallet_path, blockchain_config.wallet_pass, Some(blockchain_config.endpoint), ex).await?;
+                let drk = Drk::new(
+                    blockchain_config.wallet_path,
+                    blockchain_config.wallet_pass,
+                    Some(blockchain_config.endpoint),
+                    ex,
+                )
+                .await?;
                 let proposal = drk.get_dao_proposal_by_bulla(&bulla).await?;
                 let proposal = drk.get_dao_proposal_by_bulla(&bulla).await?;
 
 
                 if export {
                 if export {
@@ -1459,7 +1544,13 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
                 };
                 };
                 let encrypted_proposal: AeadEncryptedNote = deserialize_async(&bytes).await?;
                 let encrypted_proposal: AeadEncryptedNote = deserialize_async(&bytes).await?;
 
 
-                let drk = Drk::new(blockchain_config.wallet_path, blockchain_config.wallet_pass, None, ex).await?;
+                let drk = Drk::new(
+                    blockchain_config.wallet_path,
+                    blockchain_config.wallet_pass,
+                    None,
+                    ex,
+                )
+                .await?;
 
 
                 // Retrieve all DAOs to try to decrypt the proposal
                 // Retrieve all DAOs to try to decrypt the proposal
                 let daos = drk.get_daos().await?;
                 let daos = drk.get_daos().await?;
@@ -1511,8 +1602,13 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
                     None => None,
                     None => None,
                 };
                 };
 
 
-                let drk =
-                    Drk::new(blockchain_config.wallet_path, blockchain_config.wallet_pass, Some(blockchain_config.endpoint), ex).await?;
+                let drk = Drk::new(
+                    blockchain_config.wallet_path,
+                    blockchain_config.wallet_pass,
+                    Some(blockchain_config.endpoint),
+                    ex,
+                )
+                .await?;
                 let tx = match drk.dao_vote(&bulla, vote, weight).await {
                 let tx = match drk.dao_vote(&bulla, vote, weight).await {
                     Ok(tx) => tx,
                     Ok(tx) => tx,
                     Err(e) => {
                     Err(e) => {
@@ -1534,8 +1630,13 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
                     }
                     }
                 };
                 };
 
 
-                let drk =
-                    Drk::new(blockchain_config.wallet_path, blockchain_config.wallet_pass, Some(blockchain_config.endpoint), ex).await?;
+                let drk = Drk::new(
+                    blockchain_config.wallet_path,
+                    blockchain_config.wallet_pass,
+                    Some(blockchain_config.endpoint),
+                    ex,
+                )
+                .await?;
                 let proposal = drk.get_dao_proposal_by_bulla(&bulla).await?;
                 let proposal = drk.get_dao_proposal_by_bulla(&bulla).await?;
 
 
                 for call in &proposal.proposal.auth_calls {
                 for call in &proposal.proposal.auth_calls {
@@ -1571,7 +1672,13 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
         Subcmd::AttachFee => {
         Subcmd::AttachFee => {
             let mut tx = parse_tx_from_stdin().await?;
             let mut tx = parse_tx_from_stdin().await?;
 
 
-            let drk = Drk::new(blockchain_config.wallet_path, blockchain_config.wallet_pass, Some(blockchain_config.endpoint), ex).await?;
+            let drk = Drk::new(
+                blockchain_config.wallet_path,
+                blockchain_config.wallet_pass,
+                Some(blockchain_config.endpoint),
+                ex,
+            )
+            .await?;
             if let Err(e) = drk.attach_fee(&mut tx).await {
             if let Err(e) = drk.attach_fee(&mut tx).await {
                 eprintln!("Failed to attach the fee call to the transaction: {e:?}");
                 eprintln!("Failed to attach the fee call to the transaction: {e:?}");
                 exit(2);
                 exit(2);
@@ -1593,7 +1700,13 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
         Subcmd::Broadcast => {
         Subcmd::Broadcast => {
             let tx = parse_tx_from_stdin().await?;
             let tx = parse_tx_from_stdin().await?;
 
 
-            let drk = Drk::new(blockchain_config.wallet_path, blockchain_config.wallet_pass, Some(blockchain_config.endpoint), ex).await?;
+            let drk = Drk::new(
+                blockchain_config.wallet_path,
+                blockchain_config.wallet_pass,
+                Some(blockchain_config.endpoint),
+                ex,
+            )
+            .await?;
 
 
             if let Err(e) = drk.simulate_tx(&tx).await {
             if let Err(e) = drk.simulate_tx(&tx).await {
                 eprintln!("Failed to simulate tx: {e:?}");
                 eprintln!("Failed to simulate tx: {e:?}");
@@ -1636,7 +1749,13 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
         }
         }
 
 
         Subcmd::Scan { reset } => {
         Subcmd::Scan { reset } => {
-            let drk = Drk::new(blockchain_config.wallet_path, blockchain_config.wallet_pass, Some(blockchain_config.endpoint), ex).await?;
+            let drk = Drk::new(
+                blockchain_config.wallet_path,
+                blockchain_config.wallet_pass,
+                Some(blockchain_config.endpoint),
+                ex,
+            )
+            .await?;
 
 
             if reset {
             if reset {
                 println!("Reset requested.");
                 println!("Reset requested.");
@@ -1662,8 +1781,13 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
             ExplorerSubcmd::FetchTx { tx_hash, full, encode } => {
             ExplorerSubcmd::FetchTx { tx_hash, full, encode } => {
                 let tx_hash = TransactionHash(*blake3::Hash::from_hex(&tx_hash)?.as_bytes());
                 let tx_hash = TransactionHash(*blake3::Hash::from_hex(&tx_hash)?.as_bytes());
 
 
-                let drk =
-                    Drk::new(blockchain_config.wallet_path, blockchain_config.wallet_pass, Some(blockchain_config.endpoint), ex).await?;
+                let drk = Drk::new(
+                    blockchain_config.wallet_path,
+                    blockchain_config.wallet_pass,
+                    Some(blockchain_config.endpoint),
+                    ex,
+                )
+                .await?;
 
 
                 let tx = match drk.get_tx(&tx_hash).await {
                 let tx = match drk.get_tx(&tx_hash).await {
                     Ok(tx) => tx,
                     Ok(tx) => tx,
@@ -1697,8 +1821,13 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
             ExplorerSubcmd::SimulateTx => {
             ExplorerSubcmd::SimulateTx => {
                 let tx = parse_tx_from_stdin().await?;
                 let tx = parse_tx_from_stdin().await?;
 
 
-                let drk =
-                    Drk::new(blockchain_config.wallet_path, blockchain_config.wallet_pass, Some(blockchain_config.endpoint), ex).await?;
+                let drk = Drk::new(
+                    blockchain_config.wallet_path,
+                    blockchain_config.wallet_pass,
+                    Some(blockchain_config.endpoint),
+                    ex,
+                )
+                .await?;
 
 
                 let is_valid = match drk.simulate_tx(&tx).await {
                 let is_valid = match drk.simulate_tx(&tx).await {
                     Ok(b) => b,
                     Ok(b) => b,
@@ -1715,7 +1844,13 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
             }
             }
 
 
             ExplorerSubcmd::TxsHistory { tx_hash, encode } => {
             ExplorerSubcmd::TxsHistory { tx_hash, encode } => {
-                let drk = Drk::new(blockchain_config.wallet_path, blockchain_config.wallet_pass, None, ex).await?;
+                let drk = Drk::new(
+                    blockchain_config.wallet_path,
+                    blockchain_config.wallet_pass,
+                    None,
+                    ex,
+                )
+                .await?;
 
 
                 if let Some(c) = tx_hash {
                 if let Some(c) = tx_hash {
                     let (tx_hash, status, tx) = drk.get_tx_history_record(&c).await?;
                     let (tx_hash, status, tx) = drk.get_tx_history_record(&c).await?;
@@ -1773,7 +1908,13 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
                     }
                     }
                 };
                 };
 
 
-                let drk = Drk::new(blockchain_config.wallet_path, blockchain_config.wallet_pass, None, ex).await?;
+                let drk = Drk::new(
+                    blockchain_config.wallet_path,
+                    blockchain_config.wallet_pass,
+                    None,
+                    ex,
+                )
+                .await?;
                 if let Err(e) = drk.add_alias(alias, token_id).await {
                 if let Err(e) = drk.add_alias(alias, token_id).await {
                     eprintln!("Failed to add alias: {e:?}");
                     eprintln!("Failed to add alias: {e:?}");
                     exit(2);
                     exit(2);
@@ -1794,7 +1935,13 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
                     None => None,
                     None => None,
                 };
                 };
 
 
-                let drk = Drk::new(blockchain_config.wallet_path, blockchain_config.wallet_pass, None, ex).await?;
+                let drk = Drk::new(
+                    blockchain_config.wallet_path,
+                    blockchain_config.wallet_pass,
+                    None,
+                    ex,
+                )
+                .await?;
                 let map = drk.get_aliases(alias, token_id).await?;
                 let map = drk.get_aliases(alias, token_id).await?;
 
 
                 // Create a prettytable with the new data:
                 // Create a prettytable with the new data:
@@ -1815,7 +1962,13 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
             }
             }
 
 
             AliasSubcmd::Remove { alias } => {
             AliasSubcmd::Remove { alias } => {
-                let drk = Drk::new(blockchain_config.wallet_path, blockchain_config.wallet_pass, None, ex).await?;
+                let drk = Drk::new(
+                    blockchain_config.wallet_path,
+                    blockchain_config.wallet_pass,
+                    None,
+                    ex,
+                )
+                .await?;
                 if let Err(e) = drk.remove_alias(alias).await {
                 if let Err(e) = drk.remove_alias(alias).await {
                     eprintln!("Failed to remove alias: {e:?}");
                     eprintln!("Failed to remove alias: {e:?}");
                     exit(2);
                     exit(2);
@@ -1843,7 +1996,13 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
                     }
                     }
                 };
                 };
 
 
-                let drk = Drk::new(blockchain_config.wallet_path, blockchain_config.wallet_pass, None, ex).await?;
+                let drk = Drk::new(
+                    blockchain_config.wallet_path,
+                    blockchain_config.wallet_pass,
+                    None,
+                    ex,
+                )
+                .await?;
                 let token_id = drk.import_mint_authority(mint_authority, token_blind).await?;
                 let token_id = drk.import_mint_authority(mint_authority, token_blind).await?;
                 println!("Successfully imported mint authority for token ID: {token_id}");
                 println!("Successfully imported mint authority for token ID: {token_id}");
 
 
@@ -1851,7 +2010,13 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
             }
             }
 
 
             TokenSubcmd::GenerateMint => {
             TokenSubcmd::GenerateMint => {
-                let drk = Drk::new(blockchain_config.wallet_path, blockchain_config.wallet_pass, None, ex).await?;
+                let drk = Drk::new(
+                    blockchain_config.wallet_path,
+                    blockchain_config.wallet_pass,
+                    None,
+                    ex,
+                )
+                .await?;
                 let mint_authority = SecretKey::random(&mut OsRng);
                 let mint_authority = SecretKey::random(&mut OsRng);
                 let token_blind = BaseBlind::random(&mut OsRng);
                 let token_blind = BaseBlind::random(&mut OsRng);
                 let token_id = drk.import_mint_authority(mint_authority, token_blind).await?;
                 let token_id = drk.import_mint_authority(mint_authority, token_blind).await?;
@@ -1861,7 +2026,13 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
             }
             }
 
 
             TokenSubcmd::List => {
             TokenSubcmd::List => {
-                let drk = Drk::new(blockchain_config.wallet_path, blockchain_config.wallet_pass, None, ex).await?;
+                let drk = Drk::new(
+                    blockchain_config.wallet_path,
+                    blockchain_config.wallet_pass,
+                    None,
+                    ex,
+                )
+                .await?;
                 let tokens = drk.get_mint_authorities().await?;
                 let tokens = drk.get_mint_authorities().await?;
                 let aliases_map = match drk.get_aliases_mapped_by_token().await {
                 let aliases_map = match drk.get_aliases_mapped_by_token().await {
                     Ok(map) => map,
                     Ok(map) => map,
@@ -1900,8 +2071,13 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
             }
             }
 
 
             TokenSubcmd::Mint { token, amount, recipient, spend_hook, user_data } => {
             TokenSubcmd::Mint { token, amount, recipient, spend_hook, user_data } => {
-                let drk =
-                    Drk::new(blockchain_config.wallet_path, blockchain_config.wallet_pass, Some(blockchain_config.endpoint), ex).await?;
+                let drk = Drk::new(
+                    blockchain_config.wallet_path,
+                    blockchain_config.wallet_pass,
+                    Some(blockchain_config.endpoint),
+                    ex,
+                )
+                .await?;
 
 
                 if let Err(e) = f64::from_str(&amount) {
                 if let Err(e) = f64::from_str(&amount) {
                     eprintln!("Invalid amount: {e:?}");
                     eprintln!("Invalid amount: {e:?}");
@@ -1971,8 +2147,13 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
             }
             }
 
 
             TokenSubcmd::Freeze { token } => {
             TokenSubcmd::Freeze { token } => {
-                let drk =
-                    Drk::new(blockchain_config.wallet_path, blockchain_config.wallet_pass, Some(blockchain_config.endpoint), ex).await?;
+                let drk = Drk::new(
+                    blockchain_config.wallet_path,
+                    blockchain_config.wallet_pass,
+                    Some(blockchain_config.endpoint),
+                    ex,
+                )
+                .await?;
                 let token_id = match drk.get_token(token).await {
                 let token_id = match drk.get_token(token).await {
                     Ok(t) => t,
                     Ok(t) => t,
                     Err(e) => {
                     Err(e) => {
@@ -1997,7 +2178,13 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
 
 
         Subcmd::Contract { command } => match command {
         Subcmd::Contract { command } => match command {
             ContractSubcmd::GenerateDeploy => {
             ContractSubcmd::GenerateDeploy => {
-                let drk = Drk::new(blockchain_config.wallet_path, blockchain_config.wallet_pass, None, ex).await?;
+                let drk = Drk::new(
+                    blockchain_config.wallet_path,
+                    blockchain_config.wallet_pass,
+                    None,
+                    ex,
+                )
+                .await?;
 
 
                 if let Err(e) = drk.deploy_auth_keygen().await {
                 if let Err(e) = drk.deploy_auth_keygen().await {
                     eprintln!("Error creating deploy auth keypair: {:?}", e);
                     eprintln!("Error creating deploy auth keypair: {:?}", e);
@@ -2008,7 +2195,13 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
             }
             }
 
 
             ContractSubcmd::List => {
             ContractSubcmd::List => {
-                let drk = Drk::new(blockchain_config.wallet_path, blockchain_config.wallet_pass, None, ex).await?;
+                let drk = Drk::new(
+                    blockchain_config.wallet_path,
+                    blockchain_config.wallet_pass,
+                    None,
+                    ex,
+                )
+                .await?;
                 let auths = drk.list_deploy_auth().await?;
                 let auths = drk.list_deploy_auth().await?;
 
 
                 let mut table = Table::new();
                 let mut table = Table::new();
@@ -2033,8 +2226,13 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
                 let wasm_bin = smol::fs::read(expand_path(&wasm_path)?).await?;
                 let wasm_bin = smol::fs::read(expand_path(&wasm_path)?).await?;
                 let deploy_ix = smol::fs::read(expand_path(&deploy_ix)?).await?;
                 let deploy_ix = smol::fs::read(expand_path(&deploy_ix)?).await?;
 
 
-                let drk =
-                    Drk::new(blockchain_config.wallet_path, blockchain_config.wallet_pass, Some(blockchain_config.endpoint), ex).await?;
+                let drk = Drk::new(
+                    blockchain_config.wallet_path,
+                    blockchain_config.wallet_pass,
+                    Some(blockchain_config.endpoint),
+                    ex,
+                )
+                .await?;
 
 
                 let mut tx = match drk.deploy_contract(deploy_auth, wasm_bin, deploy_ix).await {
                 let mut tx = match drk.deploy_contract(deploy_auth, wasm_bin, deploy_ix).await {
                     Ok(v) => v,
                     Ok(v) => v,
@@ -2055,8 +2253,13 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
             }
             }
 
 
             ContractSubcmd::Lock { deploy_auth } => {
             ContractSubcmd::Lock { deploy_auth } => {
-                let drk =
-                    Drk::new(blockchain_config.wallet_path, blockchain_config.wallet_pass, Some(blockchain_config.endpoint), ex).await?;
+                let drk = Drk::new(
+                    blockchain_config.wallet_path,
+                    blockchain_config.wallet_pass,
+                    Some(blockchain_config.endpoint),
+                    ex,
+                )
+                .await?;
 
 
                 let mut tx = match drk.lock_contract(deploy_auth).await {
                 let mut tx = match drk.lock_contract(deploy_auth).await {
                     Ok(v) => v,
                     Ok(v) => v,