Cli: Add solana supply command; hide total-supply (#9956)
* Add cli supply command; hide total-supply * Use print-accounts arg instead of verbose
This commit is contained in:
@ -179,6 +179,19 @@ impl RpcClient {
|
||||
self.send(RpcRequest::GetSlot, json!([commitment_config]), 0)
|
||||
}
|
||||
|
||||
pub fn supply_with_commitment(
|
||||
&self,
|
||||
commitment_config: CommitmentConfig,
|
||||
) -> RpcResult<RpcSupply> {
|
||||
let response = self
|
||||
.client
|
||||
.send(&RpcRequest::GetSupply, json!([commitment_config]), 0)
|
||||
.map_err(|err| err.into_with_command("GetSupply"))?;
|
||||
|
||||
serde_json::from_value::<Response<RpcSupply>>(response)
|
||||
.map_err(|err| ClientError::new_with_command(err.into(), "GetSupply"))
|
||||
}
|
||||
|
||||
pub fn total_supply(&self) -> ClientResult<u64> {
|
||||
self.total_supply_with_commitment(CommitmentConfig::default())
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ pub enum RpcRequest {
|
||||
GetStorageTurnRate,
|
||||
GetSlotsPerSegment,
|
||||
GetStoragePubkeysForSlot,
|
||||
GetSupply,
|
||||
GetTotalSupply,
|
||||
GetTransactionCount,
|
||||
GetVersion,
|
||||
@ -73,6 +74,7 @@ impl fmt::Display for RpcRequest {
|
||||
RpcRequest::GetStorageTurnRate => "getStorageTurnRate",
|
||||
RpcRequest::GetSlotsPerSegment => "getSlotsPerSegment",
|
||||
RpcRequest::GetStoragePubkeysForSlot => "getStoragePubkeysForSlot",
|
||||
RpcRequest::GetSupply => "getSupply",
|
||||
RpcRequest::GetTotalSupply => "getTotalSupply",
|
||||
RpcRequest::GetTransactionCount => "getTransactionCount",
|
||||
RpcRequest::GetVersion => "getVersion",
|
||||
|
Reference in New Issue
Block a user