Skip to content

Commit

Permalink
Deprecate RpcClient methods, RpcRequest variants (#16516)
Browse files Browse the repository at this point in the history
* Deprecate RpcClient methods, RpcRequest variants

* Update cli to getSupply
  • Loading branch information
CriesofCarrots authored Apr 13, 2021
1 parent 17aa45f commit ccb11a9
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cli/src/cluster_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
12 changes: 12 additions & 0 deletions client/src/rpc_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -458,10 +458,17 @@ impl RpcClient {
)
}

#[deprecated(since = "1.5.19", note = "Please use RpcClient::supply() instead")]
#[allow(deprecated)]
pub fn total_supply(&self) -> ClientResult<u64> {
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,
Expand Down Expand Up @@ -611,6 +618,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,
Expand Down
10 changes: 10 additions & 0 deletions client/src/rpc_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ pub enum RpcRequest {
GetConfirmedBlock,
GetConfirmedBlocks,
GetConfirmedBlocksWithLimit,

#[deprecated(
since = "1.5.19",
note = "Please use RpcRequest::GetConfirmedSignaturesForAddress2 instead"
)]
GetConfirmedSignaturesForAddress,

GetConfirmedSignaturesForAddress2,
GetConfirmedTransaction,
GetEpochInfo,
Expand Down Expand Up @@ -55,7 +61,10 @@ pub enum RpcRequest {
GetTokenAccountsByDelegate,
GetTokenAccountsByOwner,
GetTokenSupply,

#[deprecated(since = "1.5.19", note = "Please use RpcRequest::GetSupply instead")]
GetTotalSupply,

GetTransactionCount,
GetVersion,
GetVoteAccounts,
Expand All @@ -67,6 +76,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 {
Expand Down

0 comments on commit ccb11a9

Please sign in to comment.