diff --git a/src/main.rs b/src/main.rs index 79f7c25add4ccf..e495107c4eb01b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,7 +14,7 @@ fn main() -> Result<(), Box> { let config = Config::load(&command_args.config_file)?; let json_rpc_url = command_args.url.unwrap_or(config.json_rpc_url); let client = RpcClient::new(json_rpc_url); - let thin_client = ThinClient(client); + let thin_client = ThinClient::new(client); match resolve_command(command_args.command)? { Command::DistributeTokens(args) => { diff --git a/src/thin_client.rs b/src/thin_client.rs index 8b9a28a495f02b..291801c7ca9fd0 100644 --- a/src/thin_client.rs +++ b/src/thin_client.rs @@ -115,9 +115,13 @@ impl Client for BankClient { } } -pub struct ThinClient(pub C); +pub struct ThinClient(C); impl ThinClient { + pub fn new(client: C) -> Self { + Self(client) + } + pub fn async_send_transaction(&self, transaction: Transaction) -> Result { self.0.async_send_transaction1(transaction) } diff --git a/src/tokens.rs b/src/tokens.rs index 6f29d151663cd3..e20459f1e860c7 100644 --- a/src/tokens.rs +++ b/src/tokens.rs @@ -426,11 +426,12 @@ fn finalize_transactions( let progress_bar = new_spinner_progress_bar(); while opt_confirmations.is_some() || !unconfirmed_transactions.is_empty() { - let confirmations = opt_confirmations.unwrap(); - progress_bar.set_message(&format!( - "[{}/{}] Finalizing transactions", - confirmations, 32, - )); + if let Some(confirmations) = opt_confirmations { + progress_bar.set_message(&format!( + "[{}/{}] Finalizing transactions", + confirmations, 32, + )); + } if !dry_run { for transaction in unconfirmed_transactions { @@ -589,7 +590,7 @@ pub fn process_transaction_log(args: &TransactionLogArgs) -> Result<(), Error> { use solana_sdk::{pubkey::Pubkey, signature::Keypair}; use tempfile::{tempdir, NamedTempFile}; pub fn test_process_distribute_tokens_with_client(client: C, sender_keypair: Keypair) { - let thin_client = ThinClient(client); + let thin_client = ThinClient::new(client); let fee_payer = Keypair::new(); thin_client .transfer(sol_to_lamports(1.0), &sender_keypair, &fee_payer.pubkey()) @@ -661,7 +662,7 @@ pub fn test_process_distribute_tokens_with_client(client: C, sender_k } pub fn test_process_distribute_stake_with_client(client: C, sender_keypair: Keypair) { - let thin_client = ThinClient(client); + let thin_client = ThinClient::new(client); let fee_payer = Keypair::new(); thin_client .transfer(sol_to_lamports(1.0), &sender_keypair, &fee_payer.pubkey())