Featurize spinner in rpc-client and tpu-client (#27381)
* Add spinner features to rpc-client and tpu-client, and disable where unneeded * Add doc comment
This commit is contained in:
parent
3d692ba046
commit
7bd08ad3ae
|
@ -24,7 +24,7 @@ solana-poh = { path = "../poh", version = "=1.12.0" }
|
||||||
solana-runtime = { path = "../runtime", version = "=1.12.0" }
|
solana-runtime = { path = "../runtime", version = "=1.12.0" }
|
||||||
solana-sdk = { path = "../sdk", version = "=1.12.0" }
|
solana-sdk = { path = "../sdk", version = "=1.12.0" }
|
||||||
solana-streamer = { path = "../streamer", version = "=1.12.0" }
|
solana-streamer = { path = "../streamer", version = "=1.12.0" }
|
||||||
solana-tpu-client = { path = "../tpu-client", version = "=1.12.0" }
|
solana-tpu-client = { path = "../tpu-client", version = "=1.12.0", default-features = false }
|
||||||
solana-version = { path = "../version", version = "=1.12.0" }
|
solana-version = { path = "../version", version = "=1.12.0" }
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
|
|
|
@ -18,7 +18,7 @@ solana-client = { path = "../client", version = "=1.12.0" }
|
||||||
solana-runtime = { path = "../runtime", version = "=1.12.0" }
|
solana-runtime = { path = "../runtime", version = "=1.12.0" }
|
||||||
solana-sdk = { path = "../sdk", version = "=1.12.0" }
|
solana-sdk = { path = "../sdk", version = "=1.12.0" }
|
||||||
solana-send-transaction-service = { path = "../send-transaction-service", version = "=1.12.0" }
|
solana-send-transaction-service = { path = "../send-transaction-service", version = "=1.12.0" }
|
||||||
solana-tpu-client = { path = "../tpu-client", version = "=1.12.0" }
|
solana-tpu-client = { path = "../tpu-client", version = "=1.12.0", default-features = false }
|
||||||
tarpc = { version = "0.29.0", features = ["full"] }
|
tarpc = { version = "0.29.0", features = ["full"] }
|
||||||
tokio = { version = "1", features = ["full"] }
|
tokio = { version = "1", features = ["full"] }
|
||||||
tokio-serde = { version = "0.8", features = ["bincode"] }
|
tokio-serde = { version = "0.8", features = ["bincode"] }
|
||||||
|
|
|
@ -28,14 +28,14 @@ solana-measure = { path = "../measure", version = "=1.12.0" }
|
||||||
solana-metrics = { path = "../metrics", version = "=1.12.0" }
|
solana-metrics = { path = "../metrics", version = "=1.12.0" }
|
||||||
solana-net-utils = { path = "../net-utils", version = "=1.12.0" }
|
solana-net-utils = { path = "../net-utils", version = "=1.12.0" }
|
||||||
solana-rpc = { path = "../rpc", version = "=1.12.0" }
|
solana-rpc = { path = "../rpc", version = "=1.12.0" }
|
||||||
solana-rpc-client = { path = "../rpc-client", version = "=1.12.0" }
|
solana-rpc-client = { path = "../rpc-client", version = "=1.12.0", default-features = false }
|
||||||
solana-rpc-client-api = { path = "../rpc-client-api", version = "=1.12.0" }
|
solana-rpc-client-api = { path = "../rpc-client-api", version = "=1.12.0" }
|
||||||
solana-rpc-client-nonce-utils = { path = "../rpc-client-nonce-utils", version = "=1.12.0" }
|
solana-rpc-client-nonce-utils = { path = "../rpc-client-nonce-utils", version = "=1.12.0" }
|
||||||
solana-runtime = { path = "../runtime", version = "=1.12.0" }
|
solana-runtime = { path = "../runtime", version = "=1.12.0" }
|
||||||
solana-sdk = { path = "../sdk", version = "=1.12.0" }
|
solana-sdk = { path = "../sdk", version = "=1.12.0" }
|
||||||
solana-streamer = { path = "../streamer", version = "=1.12.0" }
|
solana-streamer = { path = "../streamer", version = "=1.12.0" }
|
||||||
solana-thin-client = { path = "../thin-client", version = "=1.12.0" }
|
solana-thin-client = { path = "../thin-client", version = "=1.12.0" }
|
||||||
solana-tpu-client = { path = "../tpu-client", version = "=1.12.0" }
|
solana-tpu-client = { path = "../tpu-client", version = "=1.12.0", default-features = false }
|
||||||
solana-version = { path = "../version", version = "=1.12.0" }
|
solana-version = { path = "../version", version = "=1.12.0" }
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ solana-perf = { path = "../perf", version = "=1.12.0" }
|
||||||
solana-pubsub-client = { path = "../pubsub-client", version = "=1.12.0" }
|
solana-pubsub-client = { path = "../pubsub-client", version = "=1.12.0" }
|
||||||
solana-rayon-threadlimit = { path = "../rayon-threadlimit", version = "=1.12.0" }
|
solana-rayon-threadlimit = { path = "../rayon-threadlimit", version = "=1.12.0" }
|
||||||
solana-rpc = { path = "../rpc", version = "=1.12.0" }
|
solana-rpc = { path = "../rpc", version = "=1.12.0" }
|
||||||
solana-rpc-client = { path = "../rpc-client", version = "=1.12.0" }
|
solana-rpc-client = { path = "../rpc-client", version = "=1.12.0", default-features = false }
|
||||||
solana-rpc-client-api = { path = "../rpc-client-api", version = "=1.12.0" }
|
solana-rpc-client-api = { path = "../rpc-client-api", version = "=1.12.0" }
|
||||||
solana-runtime = { path = "../runtime", version = "=1.12.0" }
|
solana-runtime = { path = "../runtime", version = "=1.12.0" }
|
||||||
solana-sdk = { path = "../sdk", version = "=1.12.0" }
|
solana-sdk = { path = "../sdk", version = "=1.12.0" }
|
||||||
|
|
|
@ -56,7 +56,7 @@ solana-runtime = { path = "../runtime", version = "=1.12.0" }
|
||||||
solana-sdk = { path = "../sdk", version = "=1.12.0" }
|
solana-sdk = { path = "../sdk", version = "=1.12.0" }
|
||||||
solana-send-transaction-service = { path = "../send-transaction-service", version = "=1.12.0" }
|
solana-send-transaction-service = { path = "../send-transaction-service", version = "=1.12.0" }
|
||||||
solana-streamer = { path = "../streamer", version = "=1.12.0" }
|
solana-streamer = { path = "../streamer", version = "=1.12.0" }
|
||||||
solana-tpu-client = { path = "../tpu-client", version = "=1.12.0" }
|
solana-tpu-client = { path = "../tpu-client", version = "=1.12.0", default-features = false }
|
||||||
solana-transaction-status = { path = "../transaction-status", version = "=1.12.0" }
|
solana-transaction-status = { path = "../transaction-status", version = "=1.12.0" }
|
||||||
solana-version = { path = "../version", version = "=1.12.0" }
|
solana-version = { path = "../version", version = "=1.12.0" }
|
||||||
solana-vote-program = { path = "../programs/vote", version = "=1.12.0" }
|
solana-vote-program = { path = "../programs/vote", version = "=1.12.0" }
|
||||||
|
|
|
@ -26,10 +26,10 @@ solana-measure = { path = "../measure", version = "=1.12.0" }
|
||||||
solana-net-utils = { path = "../net-utils", version = "=1.12.0" }
|
solana-net-utils = { path = "../net-utils", version = "=1.12.0" }
|
||||||
solana-perf = { path = "../perf", version = "=1.12.0" }
|
solana-perf = { path = "../perf", version = "=1.12.0" }
|
||||||
solana-rpc = { path = "../rpc", version = "=1.12.0" }
|
solana-rpc = { path = "../rpc", version = "=1.12.0" }
|
||||||
solana-rpc-client = { path = "../rpc-client", version = "=1.12.0" }
|
solana-rpc-client = { path = "../rpc-client", version = "=1.12.0", default-features = false }
|
||||||
solana-sdk = { path = "../sdk", version = "=1.12.0" }
|
solana-sdk = { path = "../sdk", version = "=1.12.0" }
|
||||||
solana-streamer = { path = "../streamer", version = "=1.12.0" }
|
solana-streamer = { path = "../streamer", version = "=1.12.0" }
|
||||||
solana-tpu-client = { path = "../tpu-client", version = "=1.12.0" }
|
solana-tpu-client = { path = "../tpu-client", version = "=1.12.0", default-features = false }
|
||||||
solana-version = { path = "../version", version = "=1.12.0" }
|
solana-version = { path = "../version", version = "=1.12.0" }
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
|
|
|
@ -43,7 +43,7 @@ solana-runtime = { path = "../runtime", version = "=1.12.0" }
|
||||||
solana-sdk = { path = "../sdk", version = "=1.12.0" }
|
solana-sdk = { path = "../sdk", version = "=1.12.0" }
|
||||||
solana-streamer = { path = "../streamer", version = "=1.12.0" }
|
solana-streamer = { path = "../streamer", version = "=1.12.0" }
|
||||||
solana-thin-client = { path = "../thin-client", version = "=1.12.0" }
|
solana-thin-client = { path = "../thin-client", version = "=1.12.0" }
|
||||||
solana-tpu-client = { path = "../tpu-client", version = "=1.12.0" }
|
solana-tpu-client = { path = "../tpu-client", version = "=1.12.0", default-features = false }
|
||||||
solana-version = { path = "../version", version = "=1.12.0" }
|
solana-version = { path = "../version", version = "=1.12.0" }
|
||||||
solana-vote-program = { path = "../programs/vote", version = "=1.12.0" }
|
solana-vote-program = { path = "../programs/vote", version = "=1.12.0" }
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
|
|
|
@ -29,7 +29,7 @@ serde_yaml = "0.8.26"
|
||||||
solana-clap-utils = { path = "../clap-utils", version = "=1.12.0" }
|
solana-clap-utils = { path = "../clap-utils", version = "=1.12.0" }
|
||||||
solana-config-program = { path = "../programs/config", version = "=1.12.0" }
|
solana-config-program = { path = "../programs/config", version = "=1.12.0" }
|
||||||
solana-logger = { path = "../logger", version = "=1.12.0" }
|
solana-logger = { path = "../logger", version = "=1.12.0" }
|
||||||
solana-rpc-client = { path = "../rpc-client", version = "=1.12.0" }
|
solana-rpc-client = { path = "../rpc-client", version = "=1.12.0", default-features = false }
|
||||||
solana-sdk = { path = "../sdk", version = "=1.12.0" }
|
solana-sdk = { path = "../sdk", version = "=1.12.0" }
|
||||||
solana-version = { path = "../version", version = "=1.12.0" }
|
solana-version = { path = "../version", version = "=1.12.0" }
|
||||||
tar = "0.4.38"
|
tar = "0.4.38"
|
||||||
|
|
|
@ -22,14 +22,14 @@ solana-entry = { path = "../entry", version = "=1.12.0" }
|
||||||
solana-gossip = { path = "../gossip", version = "=1.12.0" }
|
solana-gossip = { path = "../gossip", version = "=1.12.0" }
|
||||||
solana-ledger = { path = "../ledger", version = "=1.12.0" }
|
solana-ledger = { path = "../ledger", version = "=1.12.0" }
|
||||||
solana-pubsub-client = { path = "../pubsub-client", version = "=1.12.0" }
|
solana-pubsub-client = { path = "../pubsub-client", version = "=1.12.0" }
|
||||||
solana-rpc-client = { path = "../rpc-client", version = "=1.12.0" }
|
solana-rpc-client = { path = "../rpc-client", version = "=1.12.0", default-features = false }
|
||||||
solana-rpc-client-api = { path = "../rpc-client-api", version = "=1.12.0" }
|
solana-rpc-client-api = { path = "../rpc-client-api", version = "=1.12.0" }
|
||||||
solana-runtime = { path = "../runtime", version = "=1.12.0" }
|
solana-runtime = { path = "../runtime", version = "=1.12.0" }
|
||||||
solana-sdk = { path = "../sdk", version = "=1.12.0" }
|
solana-sdk = { path = "../sdk", version = "=1.12.0" }
|
||||||
solana-stake-program = { path = "../programs/stake", version = "=1.12.0" }
|
solana-stake-program = { path = "../programs/stake", version = "=1.12.0" }
|
||||||
solana-streamer = { path = "../streamer", version = "=1.12.0" }
|
solana-streamer = { path = "../streamer", version = "=1.12.0" }
|
||||||
solana-thin-client = { path = "../thin-client", version = "=1.12.0" }
|
solana-thin-client = { path = "../thin-client", version = "=1.12.0" }
|
||||||
solana-tpu-client = { path = "../tpu-client", version = "=1.12.0" }
|
solana-tpu-client = { path = "../tpu-client", version = "=1.12.0", default-features = false }
|
||||||
solana-vote-program = { path = "../programs/vote", version = "=1.12.0" }
|
solana-vote-program = { path = "../programs/vote", version = "=1.12.0" }
|
||||||
tempfile = "3.3.0"
|
tempfile = "3.3.0"
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ edition = "2021"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = "2.33.0"
|
clap = "2.33.0"
|
||||||
solana-clap-utils = { path = "../clap-utils", version = "=1.12.0" }
|
solana-clap-utils = { path = "../clap-utils", version = "=1.12.0" }
|
||||||
solana-rpc-client = { path = "../rpc-client", version = "=1.12.0" }
|
solana-rpc-client = { path = "../rpc-client", version = "=1.12.0", default-features = false }
|
||||||
solana-sdk = { path = "../sdk", version = "=1.12.0" }
|
solana-sdk = { path = "../sdk", version = "=1.12.0" }
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ async-trait = "0.1.57"
|
||||||
base64 = "0.13.0"
|
base64 = "0.13.0"
|
||||||
bincode = "1.3.3"
|
bincode = "1.3.3"
|
||||||
bs58 = "0.4.0"
|
bs58 = "0.4.0"
|
||||||
indicatif = "0.17.0"
|
indicatif = { version = "0.17.0", optional = true }
|
||||||
log = "0.4.17"
|
log = "0.4.17"
|
||||||
reqwest = { version = "0.11.11", default-features = false, features = ["blocking", "brotli", "deflate", "gzip", "rustls-tls", "json"] }
|
reqwest = { version = "0.11.11", default-features = false, features = ["blocking", "brotli", "deflate", "gzip", "rustls-tls", "json"] }
|
||||||
semver = "1.0.13"
|
semver = "1.0.13"
|
||||||
|
@ -36,5 +36,11 @@ futures = "0.3"
|
||||||
jsonrpc-core = "18.0.0"
|
jsonrpc-core = "18.0.0"
|
||||||
jsonrpc-http-server = "18.0.0"
|
jsonrpc-http-server = "18.0.0"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
default = ["spinner"]
|
||||||
|
# Support rpc-client methods that feature a spinner progress bar for
|
||||||
|
# command-line interfaces
|
||||||
|
spinner = ["dep:indicatif"]
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
targets = ["x86_64-unknown-linux-gnu"]
|
targets = ["x86_64-unknown-linux-gnu"]
|
||||||
|
|
|
@ -12,13 +12,14 @@ use solana_rpc_client_api::deprecated_config::{
|
||||||
RpcConfirmedBlockConfig, RpcConfirmedTransactionConfig,
|
RpcConfirmedBlockConfig, RpcConfirmedTransactionConfig,
|
||||||
RpcGetConfirmedSignaturesForAddress2Config,
|
RpcGetConfirmedSignaturesForAddress2Config,
|
||||||
};
|
};
|
||||||
|
#[cfg(feature = "spinner")]
|
||||||
|
use {crate::spinner, solana_sdk::clock::MAX_HASH_AGE_IN_SECONDS, std::cmp::min};
|
||||||
use {
|
use {
|
||||||
crate::{
|
crate::{
|
||||||
http_sender::HttpSender,
|
http_sender::HttpSender,
|
||||||
mock_sender::MockSender,
|
mock_sender::MockSender,
|
||||||
rpc_client::{GetConfirmedSignaturesForAddress2Config, RpcClientConfig},
|
rpc_client::{GetConfirmedSignaturesForAddress2Config, RpcClientConfig},
|
||||||
rpc_sender::*,
|
rpc_sender::*,
|
||||||
spinner,
|
|
||||||
},
|
},
|
||||||
bincode::serialize,
|
bincode::serialize,
|
||||||
log::*,
|
log::*,
|
||||||
|
@ -38,7 +39,7 @@ use {
|
||||||
},
|
},
|
||||||
solana_sdk::{
|
solana_sdk::{
|
||||||
account::Account,
|
account::Account,
|
||||||
clock::{Epoch, Slot, UnixTimestamp, DEFAULT_MS_PER_SLOT, MAX_HASH_AGE_IN_SECONDS},
|
clock::{Epoch, Slot, UnixTimestamp, DEFAULT_MS_PER_SLOT},
|
||||||
commitment_config::{CommitmentConfig, CommitmentLevel},
|
commitment_config::{CommitmentConfig, CommitmentLevel},
|
||||||
epoch_info::EpochInfo,
|
epoch_info::EpochInfo,
|
||||||
epoch_schedule::EpochSchedule,
|
epoch_schedule::EpochSchedule,
|
||||||
|
@ -55,7 +56,6 @@ use {
|
||||||
},
|
},
|
||||||
solana_vote_program::vote_state::MAX_LOCKOUT_HISTORY,
|
solana_vote_program::vote_state::MAX_LOCKOUT_HISTORY,
|
||||||
std::{
|
std::{
|
||||||
cmp::min,
|
|
||||||
net::SocketAddr,
|
net::SocketAddr,
|
||||||
str::FromStr,
|
str::FromStr,
|
||||||
time::{Duration, Instant},
|
time::{Duration, Instant},
|
||||||
|
@ -278,10 +278,10 @@ impl RpcClient {
|
||||||
/// The URL is an HTTP URL, usually for port 8899, as in
|
/// The URL is an HTTP URL, usually for port 8899, as in
|
||||||
/// "http://localhost:8899".
|
/// "http://localhost:8899".
|
||||||
///
|
///
|
||||||
/// The `confirm_transaction_initial_timeout` argument specifies, when
|
/// The `confirm_transaction_initial_timeout` argument specifies the amount of
|
||||||
|
/// time to allow for the server to initially process a transaction, when
|
||||||
/// confirming a transaction via one of the `_with_spinner` methods, like
|
/// confirming a transaction via one of the `_with_spinner` methods, like
|
||||||
/// [`RpcClient::send_and_confirm_transaction_with_spinner`], the amount of
|
/// [`RpcClient::send_and_confirm_transaction_with_spinner`]. In
|
||||||
/// time to allow for the server to initially process a transaction. In
|
|
||||||
/// other words, setting `confirm_transaction_initial_timeout` to > 0 allows
|
/// other words, setting `confirm_transaction_initial_timeout` to > 0 allows
|
||||||
/// `RpcClient` to wait for confirmation of a transaction that the server
|
/// `RpcClient` to wait for confirmation of a transaction that the server
|
||||||
/// has not "seen" yet.
|
/// has not "seen" yet.
|
||||||
|
@ -708,6 +708,7 @@ impl RpcClient {
|
||||||
.into())
|
.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "spinner")]
|
||||||
pub async fn send_and_confirm_transaction_with_spinner(
|
pub async fn send_and_confirm_transaction_with_spinner(
|
||||||
&self,
|
&self,
|
||||||
transaction: &Transaction,
|
transaction: &Transaction,
|
||||||
|
@ -719,6 +720,7 @@ impl RpcClient {
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "spinner")]
|
||||||
pub async fn send_and_confirm_transaction_with_spinner_and_commitment(
|
pub async fn send_and_confirm_transaction_with_spinner_and_commitment(
|
||||||
&self,
|
&self,
|
||||||
transaction: &Transaction,
|
transaction: &Transaction,
|
||||||
|
@ -735,6 +737,7 @@ impl RpcClient {
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "spinner")]
|
||||||
pub async fn send_and_confirm_transaction_with_spinner_and_config(
|
pub async fn send_and_confirm_transaction_with_spinner_and_config(
|
||||||
&self,
|
&self,
|
||||||
transaction: &Transaction,
|
transaction: &Transaction,
|
||||||
|
@ -1124,6 +1127,7 @@ impl RpcClient {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "spinner")]
|
||||||
pub async fn confirm_transaction_with_spinner(
|
pub async fn confirm_transaction_with_spinner(
|
||||||
&self,
|
&self,
|
||||||
signature: &Signature,
|
signature: &Signature,
|
||||||
|
|
|
@ -308,10 +308,10 @@ impl RpcClient {
|
||||||
/// The URL is an HTTP URL, usually for port 8899, as in
|
/// The URL is an HTTP URL, usually for port 8899, as in
|
||||||
/// "http://localhost:8899".
|
/// "http://localhost:8899".
|
||||||
///
|
///
|
||||||
/// The `confirm_transaction_initial_timeout` argument specifies, when
|
/// The `confirm_transaction_initial_timeout` argument specifies the amount of
|
||||||
|
/// time to allow for the server to initially process a transaction, when
|
||||||
/// confirming a transaction via one of the `_with_spinner` methods, like
|
/// confirming a transaction via one of the `_with_spinner` methods, like
|
||||||
/// [`RpcClient::send_and_confirm_transaction_with_spinner`], the amount of
|
/// [`RpcClient::send_and_confirm_transaction_with_spinner`]. In
|
||||||
/// time to allow for the server to initially process a transaction. In
|
|
||||||
/// other words, setting `confirm_transaction_initial_timeout` to > 0 allows
|
/// other words, setting `confirm_transaction_initial_timeout` to > 0 allows
|
||||||
/// `RpcClient` to wait for confirmation of a transaction that the server
|
/// `RpcClient` to wait for confirmation of a transaction that the server
|
||||||
/// has not "seen" yet.
|
/// has not "seen" yet.
|
||||||
|
@ -631,6 +631,7 @@ impl RpcClient {
|
||||||
self.invoke((self.rpc_client.as_ref()).send_and_confirm_transaction(transaction))
|
self.invoke((self.rpc_client.as_ref()).send_and_confirm_transaction(transaction))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "spinner")]
|
||||||
pub fn send_and_confirm_transaction_with_spinner(
|
pub fn send_and_confirm_transaction_with_spinner(
|
||||||
&self,
|
&self,
|
||||||
transaction: &Transaction,
|
transaction: &Transaction,
|
||||||
|
@ -640,6 +641,7 @@ impl RpcClient {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "spinner")]
|
||||||
pub fn send_and_confirm_transaction_with_spinner_and_commitment(
|
pub fn send_and_confirm_transaction_with_spinner_and_commitment(
|
||||||
&self,
|
&self,
|
||||||
transaction: &Transaction,
|
transaction: &Transaction,
|
||||||
|
@ -651,6 +653,7 @@ impl RpcClient {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "spinner")]
|
||||||
pub fn send_and_confirm_transaction_with_spinner_and_config(
|
pub fn send_and_confirm_transaction_with_spinner_and_config(
|
||||||
&self,
|
&self,
|
||||||
transaction: &Transaction,
|
transaction: &Transaction,
|
||||||
|
@ -949,6 +952,7 @@ impl RpcClient {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "spinner")]
|
||||||
pub fn confirm_transaction_with_spinner(
|
pub fn confirm_transaction_with_spinner(
|
||||||
&self,
|
&self,
|
||||||
signature: &Signature,
|
signature: &Signature,
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
//! Spinner creator
|
#![cfg(feature = "spinner")]
|
||||||
|
//! Spinner creator.
|
||||||
|
//! This module is wrapped by the `spinner` feature, which is on by default.
|
||||||
|
//! It can be disabled and the dependency on `indicatif` avoided by running
|
||||||
|
//! with `default-features = false`
|
||||||
|
|
||||||
use {
|
use {
|
||||||
indicatif::{ProgressBar, ProgressStyle},
|
indicatif::{ProgressBar, ProgressStyle},
|
||||||
|
|
|
@ -22,12 +22,12 @@ serde_json = "1.0.83"
|
||||||
solana-account-decoder = { path = "../account-decoder", version = "=1.12.0" }
|
solana-account-decoder = { path = "../account-decoder", version = "=1.12.0" }
|
||||||
solana-pubsub-client = { path = "../pubsub-client", version = "=1.12.0" }
|
solana-pubsub-client = { path = "../pubsub-client", version = "=1.12.0" }
|
||||||
solana-rpc = { path = "../rpc", version = "=1.12.0" }
|
solana-rpc = { path = "../rpc", version = "=1.12.0" }
|
||||||
solana-rpc-client = { path = "../rpc-client", version = "=1.12.0" }
|
solana-rpc-client = { path = "../rpc-client", version = "=1.12.0", default-features = false }
|
||||||
solana-rpc-client-api = { path = "../rpc-client-api", version = "=1.12.0" }
|
solana-rpc-client-api = { path = "../rpc-client-api", version = "=1.12.0" }
|
||||||
solana-sdk = { path = "../sdk", version = "=1.12.0" }
|
solana-sdk = { path = "../sdk", version = "=1.12.0" }
|
||||||
solana-streamer = { path = "../streamer", version = "=1.12.0" }
|
solana-streamer = { path = "../streamer", version = "=1.12.0" }
|
||||||
solana-test-validator = { path = "../test-validator", version = "=1.12.0" }
|
solana-test-validator = { path = "../test-validator", version = "=1.12.0" }
|
||||||
solana-tpu-client = { path = "../tpu-client", version = "=1.12.0" }
|
solana-tpu-client = { path = "../tpu-client", version = "=1.12.0", default-features = false }
|
||||||
solana-transaction-status = { path = "../transaction-status", version = "=1.12.0" }
|
solana-transaction-status = { path = "../transaction-status", version = "=1.12.0" }
|
||||||
tokio = { version = "~1.14.1", features = ["full"] }
|
tokio = { version = "~1.14.1", features = ["full"] }
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ solana-send-transaction-service = { path = "../send-transaction-service", versio
|
||||||
solana-stake-program = { path = "../programs/stake", version = "=1.12.0" }
|
solana-stake-program = { path = "../programs/stake", version = "=1.12.0" }
|
||||||
solana-storage-bigtable = { path = "../storage-bigtable", version = "=1.12.0" }
|
solana-storage-bigtable = { path = "../storage-bigtable", version = "=1.12.0" }
|
||||||
solana-streamer = { path = "../streamer", version = "=1.12.0" }
|
solana-streamer = { path = "../streamer", version = "=1.12.0" }
|
||||||
solana-tpu-client = { path = "../tpu-client", version = "=1.12.0" }
|
solana-tpu-client = { path = "../tpu-client", version = "=1.12.0", default-features = false }
|
||||||
solana-transaction-status = { path = "../transaction-status", version = "=1.12.0" }
|
solana-transaction-status = { path = "../transaction-status", version = "=1.12.0" }
|
||||||
solana-version = { path = "../version", version = "=1.12.0" }
|
solana-version = { path = "../version", version = "=1.12.0" }
|
||||||
solana-vote-program = { path = "../programs/vote", version = "=1.12.0" }
|
solana-vote-program = { path = "../programs/vote", version = "=1.12.0" }
|
||||||
|
|
|
@ -16,7 +16,7 @@ solana-measure = { path = "../measure", version = "=1.12.0" }
|
||||||
solana-metrics = { path = "../metrics", version = "=1.12.0" }
|
solana-metrics = { path = "../metrics", version = "=1.12.0" }
|
||||||
solana-runtime = { path = "../runtime", version = "=1.12.0" }
|
solana-runtime = { path = "../runtime", version = "=1.12.0" }
|
||||||
solana-sdk = { path = "../sdk", version = "=1.12.0" }
|
solana-sdk = { path = "../sdk", version = "=1.12.0" }
|
||||||
solana-tpu-client = { path = "../tpu-client", version = "=1.12.0" }
|
solana-tpu-client = { path = "../tpu-client", version = "=1.12.0", default-features = false }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
solana-logger = { path = "../logger", version = "=1.12.0" }
|
solana-logger = { path = "../logger", version = "=1.12.0" }
|
||||||
|
|
|
@ -25,11 +25,11 @@ solana-net-utils = { path = "../net-utils", version = "=1.12.0" }
|
||||||
solana-program-runtime = { path = "../program-runtime", version = "=1.12.0" }
|
solana-program-runtime = { path = "../program-runtime", version = "=1.12.0" }
|
||||||
solana-program-test = { path = "../program-test", version = "=1.12.0" }
|
solana-program-test = { path = "../program-test", version = "=1.12.0" }
|
||||||
solana-rpc = { path = "../rpc", version = "=1.12.0" }
|
solana-rpc = { path = "../rpc", version = "=1.12.0" }
|
||||||
solana-rpc-client = { path = "../rpc-client", version = "=1.12.0" }
|
solana-rpc-client = { path = "../rpc-client", version = "=1.12.0", default-features = false }
|
||||||
solana-runtime = { path = "../runtime", version = "=1.12.0" }
|
solana-runtime = { path = "../runtime", version = "=1.12.0" }
|
||||||
solana-sdk = { path = "../sdk", version = "=1.12.0" }
|
solana-sdk = { path = "../sdk", version = "=1.12.0" }
|
||||||
solana-streamer = { path = "../streamer", version = "=1.12.0" }
|
solana-streamer = { path = "../streamer", version = "=1.12.0" }
|
||||||
solana-tpu-client = { path = "../tpu-client", version = "=1.12.0" }
|
solana-tpu-client = { path = "../tpu-client", version = "=1.12.0", default-features = false }
|
||||||
tokio = { version = "1", features = ["full"] }
|
tokio = { version = "1", features = ["full"] }
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
|
|
|
@ -12,10 +12,10 @@ edition = "2021"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bincode = "1.3.3"
|
bincode = "1.3.3"
|
||||||
log = "0.4.17"
|
log = "0.4.17"
|
||||||
solana-rpc-client = { path = "../rpc-client", version = "=1.12.0" }
|
solana-rpc-client = { path = "../rpc-client", version = "=1.12.0", default-features = false }
|
||||||
solana-rpc-client-api = { path = "../rpc-client-api", version = "=1.12.0" }
|
solana-rpc-client-api = { path = "../rpc-client-api", version = "=1.12.0" }
|
||||||
solana-sdk = { path = "../sdk", version = "=1.12.0" }
|
solana-sdk = { path = "../sdk", version = "=1.12.0" }
|
||||||
solana-tpu-client = { path = "../tpu-client", version = "=1.12.0" }
|
solana-tpu-client = { path = "../tpu-client", version = "=1.12.0", default-features = false }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
rayon = "1.5.3"
|
rayon = "1.5.3"
|
||||||
|
|
|
@ -17,7 +17,7 @@ enum_dispatch = "0.3.8"
|
||||||
futures = "0.3"
|
futures = "0.3"
|
||||||
futures-util = "0.3.21"
|
futures-util = "0.3.21"
|
||||||
indexmap = "1.9.1"
|
indexmap = "1.9.1"
|
||||||
indicatif = "0.17.0"
|
indicatif = { version = "0.17.0", optional = true }
|
||||||
itertools = "0.10.2"
|
itertools = "0.10.2"
|
||||||
lazy_static = "1.4.0"
|
lazy_static = "1.4.0"
|
||||||
log = "0.4.17"
|
log = "0.4.17"
|
||||||
|
@ -31,7 +31,7 @@ solana-measure = { path = "../measure", version = "=1.12.0" }
|
||||||
solana-metrics = { path = "../metrics", version = "=1.12.0" }
|
solana-metrics = { path = "../metrics", version = "=1.12.0" }
|
||||||
solana-net-utils = { path = "../net-utils", version = "=1.12.0" }
|
solana-net-utils = { path = "../net-utils", version = "=1.12.0" }
|
||||||
solana-pubsub-client = { path = "../pubsub-client", version = "=1.12.0" }
|
solana-pubsub-client = { path = "../pubsub-client", version = "=1.12.0" }
|
||||||
solana-rpc-client = { path = "../rpc-client", version = "=1.12.0" }
|
solana-rpc-client = { path = "../rpc-client", version = "=1.12.0", default-features = false }
|
||||||
solana-rpc-client-api = { path = "../rpc-client-api", version = "=1.12.0" }
|
solana-rpc-client-api = { path = "../rpc-client-api", version = "=1.12.0" }
|
||||||
solana-sdk = { path = "../sdk", version = "=1.12.0" }
|
solana-sdk = { path = "../sdk", version = "=1.12.0" }
|
||||||
solana-streamer = { path = "../streamer", version = "=1.12.0" }
|
solana-streamer = { path = "../streamer", version = "=1.12.0" }
|
||||||
|
@ -44,5 +44,11 @@ rand_chacha = "0.2.2"
|
||||||
solana-logger = { path = "../logger", version = "=1.12.0" }
|
solana-logger = { path = "../logger", version = "=1.12.0" }
|
||||||
solana-perf = { path = "../perf", version = "=1.12.0" }
|
solana-perf = { path = "../perf", version = "=1.12.0" }
|
||||||
|
|
||||||
|
[features]
|
||||||
|
default = ["spinner"]
|
||||||
|
# Support tpu-client methods that feature a spinner progress bar for
|
||||||
|
# command-line interfaces
|
||||||
|
spinner = ["dep:indicatif", "solana-rpc-client/spinner"]
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
targets = ["x86_64-unknown-linux-gnu"]
|
targets = ["x86_64-unknown-linux-gnu"]
|
||||||
|
|
|
@ -1,32 +1,33 @@
|
||||||
|
#[cfg(feature = "spinner")]
|
||||||
|
use {
|
||||||
|
crate::tpu_client::{SEND_TRANSACTION_INTERVAL, TRANSACTION_RESEND_INTERVAL},
|
||||||
|
indicatif::ProgressBar,
|
||||||
|
solana_rpc_client::spinner,
|
||||||
|
solana_rpc_client_api::request::MAX_GET_SIGNATURE_STATUSES_QUERY_ITEMS,
|
||||||
|
solana_sdk::{message::Message, signers::Signers, transaction::TransactionError},
|
||||||
|
};
|
||||||
use {
|
use {
|
||||||
crate::{
|
crate::{
|
||||||
connection_cache::ConnectionCache,
|
connection_cache::ConnectionCache,
|
||||||
nonblocking::tpu_connection::TpuConnection,
|
nonblocking::tpu_connection::TpuConnection,
|
||||||
tpu_client::{
|
tpu_client::{RecentLeaderSlots, TpuClientConfig, MAX_FANOUT_SLOTS},
|
||||||
RecentLeaderSlots, TpuClientConfig, MAX_FANOUT_SLOTS, SEND_TRANSACTION_INTERVAL,
|
|
||||||
TRANSACTION_RESEND_INTERVAL,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
bincode::serialize,
|
bincode::serialize,
|
||||||
futures_util::{future::join_all, stream::StreamExt},
|
futures_util::{future::join_all, stream::StreamExt},
|
||||||
indicatif::ProgressBar,
|
|
||||||
log::*,
|
log::*,
|
||||||
solana_pubsub_client::nonblocking::pubsub_client::{PubsubClient, PubsubClientError},
|
solana_pubsub_client::nonblocking::pubsub_client::{PubsubClient, PubsubClientError},
|
||||||
solana_rpc_client::{nonblocking::rpc_client::RpcClient, spinner},
|
solana_rpc_client::nonblocking::rpc_client::RpcClient,
|
||||||
solana_rpc_client_api::{
|
solana_rpc_client_api::{
|
||||||
client_error::{Error as ClientError, Result as ClientResult},
|
client_error::{Error as ClientError, Result as ClientResult},
|
||||||
request::MAX_GET_SIGNATURE_STATUSES_QUERY_ITEMS,
|
|
||||||
response::{RpcContactInfo, SlotUpdate},
|
response::{RpcContactInfo, SlotUpdate},
|
||||||
},
|
},
|
||||||
solana_sdk::{
|
solana_sdk::{
|
||||||
clock::Slot,
|
clock::Slot,
|
||||||
commitment_config::CommitmentConfig,
|
commitment_config::CommitmentConfig,
|
||||||
epoch_info::EpochInfo,
|
epoch_info::EpochInfo,
|
||||||
message::Message,
|
|
||||||
pubkey::Pubkey,
|
pubkey::Pubkey,
|
||||||
signature::SignerError,
|
signature::SignerError,
|
||||||
signers::Signers,
|
transaction::Transaction,
|
||||||
transaction::{Transaction, TransactionError},
|
|
||||||
transport::{Result as TransportResult, TransportError},
|
transport::{Result as TransportResult, TransportError},
|
||||||
},
|
},
|
||||||
std::{
|
std::{
|
||||||
|
@ -326,6 +327,7 @@ impl TpuClient {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "spinner")]
|
||||||
pub async fn send_and_confirm_messages_with_spinner<T: Signers>(
|
pub async fn send_and_confirm_messages_with_spinner<T: Signers>(
|
||||||
&self,
|
&self,
|
||||||
messages: &[Message],
|
messages: &[Message],
|
||||||
|
@ -667,6 +669,7 @@ async fn maybe_fetch_cache_info(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "spinner")]
|
||||||
fn set_message_for_confirmed_transactions(
|
fn set_message_for_confirmed_transactions(
|
||||||
progress_bar: &ProgressBar,
|
progress_bar: &ProgressBar,
|
||||||
confirmed_transactions: u32,
|
confirmed_transactions: u32,
|
||||||
|
|
|
@ -5,18 +5,16 @@ use {
|
||||||
nonblocking::tpu_client::TpuClient as NonblockingTpuClient,
|
nonblocking::tpu_client::TpuClient as NonblockingTpuClient,
|
||||||
},
|
},
|
||||||
solana_rpc_client::rpc_client::RpcClient,
|
solana_rpc_client::rpc_client::RpcClient,
|
||||||
solana_sdk::{
|
solana_sdk::{clock::Slot, transaction::Transaction, transport::Result as TransportResult},
|
||||||
clock::Slot,
|
|
||||||
message::Message,
|
|
||||||
signers::Signers,
|
|
||||||
transaction::{Transaction, TransactionError},
|
|
||||||
transport::Result as TransportResult,
|
|
||||||
},
|
|
||||||
std::{
|
std::{
|
||||||
collections::VecDeque,
|
collections::VecDeque,
|
||||||
net::UdpSocket,
|
net::UdpSocket,
|
||||||
sync::{Arc, RwLock},
|
sync::{Arc, RwLock},
|
||||||
},
|
},
|
||||||
|
};
|
||||||
|
#[cfg(feature = "spinner")]
|
||||||
|
use {
|
||||||
|
solana_sdk::{message::Message, signers::Signers, transaction::TransactionError},
|
||||||
tokio::time::Duration,
|
tokio::time::Duration,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -29,8 +27,10 @@ pub const DEFAULT_FANOUT_SLOTS: u64 = 12;
|
||||||
pub const MAX_FANOUT_SLOTS: u64 = 100;
|
pub const MAX_FANOUT_SLOTS: u64 = 100;
|
||||||
|
|
||||||
/// Send at ~100 TPS
|
/// Send at ~100 TPS
|
||||||
|
#[cfg(feature = "spinner")]
|
||||||
pub(crate) const SEND_TRANSACTION_INTERVAL: Duration = Duration::from_millis(10);
|
pub(crate) const SEND_TRANSACTION_INTERVAL: Duration = Duration::from_millis(10);
|
||||||
/// Retry batch send after 4 seconds
|
/// Retry batch send after 4 seconds
|
||||||
|
#[cfg(feature = "spinner")]
|
||||||
pub(crate) const TRANSACTION_RESEND_INTERVAL: Duration = Duration::from_secs(4);
|
pub(crate) const TRANSACTION_RESEND_INTERVAL: Duration = Duration::from_secs(4);
|
||||||
|
|
||||||
/// Config params for `TpuClient`
|
/// Config params for `TpuClient`
|
||||||
|
@ -124,6 +124,7 @@ impl TpuClient {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "spinner")]
|
||||||
pub fn send_and_confirm_messages_with_spinner<T: Signers>(
|
pub fn send_and_confirm_messages_with_spinner<T: Signers>(
|
||||||
&self,
|
&self,
|
||||||
messages: &[Message],
|
messages: &[Message],
|
||||||
|
|
|
@ -23,7 +23,7 @@ solana-gossip = { path = "../gossip", version = "=1.12.0" }
|
||||||
solana-logger = { path = "../logger", version = "=1.12.0" }
|
solana-logger = { path = "../logger", version = "=1.12.0" }
|
||||||
solana-measure = { path = "../measure", version = "=1.12.0" }
|
solana-measure = { path = "../measure", version = "=1.12.0" }
|
||||||
solana-net-utils = { path = "../net-utils", version = "=1.12.0" }
|
solana-net-utils = { path = "../net-utils", version = "=1.12.0" }
|
||||||
solana-rpc-client = { path = "../rpc-client", version = "=1.12.0" }
|
solana-rpc-client = { path = "../rpc-client", version = "=1.12.0", default-features = false }
|
||||||
solana-runtime = { path = "../runtime", version = "=1.12.0" }
|
solana-runtime = { path = "../runtime", version = "=1.12.0" }
|
||||||
solana-sdk = { path = "../sdk", version = "=1.12.0" }
|
solana-sdk = { path = "../sdk", version = "=1.12.0" }
|
||||||
solana-streamer = { path = "../streamer", version = "=1.12.0" }
|
solana-streamer = { path = "../streamer", version = "=1.12.0" }
|
||||||
|
|
|
@ -45,7 +45,7 @@ solana-net-utils = { path = "../net-utils", version = "=1.12.0" }
|
||||||
solana-perf = { path = "../perf", version = "=1.12.0" }
|
solana-perf = { path = "../perf", version = "=1.12.0" }
|
||||||
solana-poh = { path = "../poh", version = "=1.12.0" }
|
solana-poh = { path = "../poh", version = "=1.12.0" }
|
||||||
solana-rpc = { path = "../rpc", version = "=1.12.0" }
|
solana-rpc = { path = "../rpc", version = "=1.12.0" }
|
||||||
solana-rpc-client = { path = "../rpc-client", version = "=1.12.0" }
|
solana-rpc-client = { path = "../rpc-client", version = "=1.12.0", default-features = false }
|
||||||
solana-rpc-client-api = { path = "../rpc-client-api", version = "=1.12.0" }
|
solana-rpc-client-api = { path = "../rpc-client-api", version = "=1.12.0" }
|
||||||
solana-runtime = { path = "../runtime", version = "=1.12.0" }
|
solana-runtime = { path = "../runtime", version = "=1.12.0" }
|
||||||
solana-sdk = { path = "../sdk", version = "=1.12.0" }
|
solana-sdk = { path = "../sdk", version = "=1.12.0" }
|
||||||
|
@ -53,7 +53,7 @@ solana-send-transaction-service = { path = "../send-transaction-service", versio
|
||||||
solana-storage-bigtable = { path = "../storage-bigtable", version = "=1.12.0" }
|
solana-storage-bigtable = { path = "../storage-bigtable", version = "=1.12.0" }
|
||||||
solana-streamer = { path = "../streamer", version = "=1.12.0" }
|
solana-streamer = { path = "../streamer", version = "=1.12.0" }
|
||||||
solana-test-validator = { path = "../test-validator", version = "=1.12.0" }
|
solana-test-validator = { path = "../test-validator", version = "=1.12.0" }
|
||||||
solana-tpu-client = { path = "../tpu-client", version = "=1.12.0" }
|
solana-tpu-client = { path = "../tpu-client", version = "=1.12.0", default-features = false }
|
||||||
solana-version = { path = "../version", version = "=1.12.0" }
|
solana-version = { path = "../version", version = "=1.12.0" }
|
||||||
solana-vote-program = { path = "../programs/vote", version = "=1.12.0" }
|
solana-vote-program = { path = "../programs/vote", version = "=1.12.0" }
|
||||||
symlink = "0.1.0"
|
symlink = "0.1.0"
|
||||||
|
|
|
@ -19,7 +19,7 @@ solana-cli-output = { path = "../cli-output", version = "=1.12.0" }
|
||||||
solana-logger = { path = "../logger", version = "=1.12.0" }
|
solana-logger = { path = "../logger", version = "=1.12.0" }
|
||||||
solana-metrics = { path = "../metrics", version = "=1.12.0" }
|
solana-metrics = { path = "../metrics", version = "=1.12.0" }
|
||||||
solana-notifier = { path = "../notifier", version = "=1.12.0" }
|
solana-notifier = { path = "../notifier", version = "=1.12.0" }
|
||||||
solana-rpc-client = { path = "../rpc-client", version = "=1.12.0" }
|
solana-rpc-client = { path = "../rpc-client", version = "=1.12.0", default-features = false }
|
||||||
solana-rpc-client-api = { path = "../rpc-client-api", version = "=1.12.0" }
|
solana-rpc-client-api = { path = "../rpc-client-api", version = "=1.12.0" }
|
||||||
solana-sdk = { path = "../sdk", version = "=1.12.0" }
|
solana-sdk = { path = "../sdk", version = "=1.12.0" }
|
||||||
solana-version = { path = "../version", version = "=1.12.0" }
|
solana-version = { path = "../version", version = "=1.12.0" }
|
||||||
|
|
Loading…
Reference in New Issue