tpu-client: Move send_messages_with_spinner from program (#20960)

We have too many ways of sending transactions, and too many
reimplementations of the same logic all over the place.

The program deploy logic and stake-o-matic currently make the
most use of the TPU client, so this merges their implementations into
one place to be reused by both.  Yay for consolidation!
This commit is contained in:
Jon Cinque
2021-10-26 22:54:26 +02:00
committed by GitHub
parent 4d6190a1ba
commit 5f7b60576f
6 changed files with 192 additions and 173 deletions

View File

@@ -21,9 +21,9 @@ use {
rpc_request::{RpcError, RpcRequest, RpcResponseErrorData, TokenAccountsFilter},
rpc_response::*,
rpc_sender::*,
spinner,
},
bincode::serialize,
indicatif::{ProgressBar, ProgressStyle},
log::*,
serde_json::{json, Value},
solana_account_decoder::{
@@ -1062,7 +1062,7 @@ impl RpcClient {
};
let mut confirmations = 0;
let progress_bar = new_spinner_progress_bar();
let progress_bar = spinner::new_progress_bar();
progress_bar.set_message(format!(
"[{}/{}] Finalizing transaction {}",
@@ -4876,14 +4876,6 @@ pub struct GetConfirmedSignaturesForAddress2Config {
pub commitment: Option<CommitmentConfig>,
}
fn new_spinner_progress_bar() -> ProgressBar {
let progress_bar = ProgressBar::new(42);
progress_bar
.set_style(ProgressStyle::default_spinner().template("{spinner:.green} {wide_msg}"));
progress_bar.enable_steady_tick(100);
progress_bar
}
fn get_rpc_request_str(rpc_addr: SocketAddr, tls: bool) -> String {
if tls {
format!("https://{}", rpc_addr)