From e5a76572d9ede17867204095991af7cc7a435db5 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Tue, 13 Apr 2021 21:27:46 +0000 Subject: [PATCH] Deprecate RpcClient methods, RpcRequest variants (#16516) (#16518) * Deprecate RpcClient methods, RpcRequest variants * Update cli to getSupply (cherry picked from commit ccb11a939f4551e910a148a82b515639b34eb60b) Co-authored-by: Tyera Eulberg --- cli/src/cluster_query.rs | 4 ++-- client/src/rpc_client.rs | 12 ++++++++++++ client/src/rpc_request.rs | 10 ++++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/cli/src/cluster_query.rs b/cli/src/cluster_query.rs index b1b39e3fa4..5be270bae1 100644 --- a/cli/src/cluster_query.rs +++ b/cli/src/cluster_query.rs @@ -1234,8 +1234,8 @@ pub fn process_supply( } pub fn process_total_supply(rpc_client: &RpcClient, _config: &CliConfig) -> ProcessResult { - let total_supply = rpc_client.total_supply()?; - Ok(format!("{} SOL", lamports_to_sol(total_supply))) + let supply = rpc_client.supply()?.value; + Ok(format!("{} SOL", lamports_to_sol(supply.total))) } pub fn process_get_transaction_count(rpc_client: &RpcClient, _config: &CliConfig) -> ProcessResult { diff --git a/client/src/rpc_client.rs b/client/src/rpc_client.rs index f46f6d29bf..cdbb344cd2 100644 --- a/client/src/rpc_client.rs +++ b/client/src/rpc_client.rs @@ -452,10 +452,17 @@ impl RpcClient { ) } + #[deprecated(since = "1.5.19", note = "Please use RpcClient::supply() instead")] + #[allow(deprecated)] pub fn total_supply(&self) -> ClientResult { self.total_supply_with_commitment(self.commitment_config) } + #[deprecated( + since = "1.5.19", + note = "Please use RpcClient::supply_with_commitment() instead" + )] + #[allow(deprecated)] pub fn total_supply_with_commitment( &self, commitment_config: CommitmentConfig, @@ -605,6 +612,11 @@ impl RpcClient { ) } + #[deprecated( + since = "1.5.19", + note = "Please use RpcClient::get_confirmed_signatures_for_address2() instead" + )] + #[allow(deprecated)] pub fn get_confirmed_signatures_for_address( &self, address: &Pubkey, diff --git a/client/src/rpc_request.rs b/client/src/rpc_request.rs index e16e45591b..90bcc547de 100644 --- a/client/src/rpc_request.rs +++ b/client/src/rpc_request.rs @@ -15,7 +15,13 @@ pub enum RpcRequest { GetConfirmedBlock, GetConfirmedBlocks, GetConfirmedBlocksWithLimit, + + #[deprecated( + since = "1.5.19", + note = "Please use RpcRequest::GetConfirmedSignaturesForAddress2 instead" + )] GetConfirmedSignaturesForAddress, + GetConfirmedSignaturesForAddress2, GetConfirmedTransaction, GetEpochInfo, @@ -52,7 +58,10 @@ pub enum RpcRequest { GetTokenAccountsByDelegate, GetTokenAccountsByOwner, GetTokenSupply, + + #[deprecated(since = "1.5.19", note = "Please use RpcRequest::GetSupply instead")] GetTotalSupply, + GetTransactionCount, GetVersion, GetVoteAccounts, @@ -64,6 +73,7 @@ pub enum RpcRequest { SignVote, } +#[allow(deprecated)] impl fmt::Display for RpcRequest { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let method = match self {