Add cluster-version subcommand to return entrypoint versions (#5464)

This commit is contained in:
Tyera Eulberg
2019-08-08 11:13:06 -06:00
committed by GitHub
parent 8c15214923
commit 4ae48b56f3
6 changed files with 65 additions and 13 deletions

View File

@ -94,6 +94,25 @@ impl RpcClient {
})
}
pub fn get_version(&self) -> io::Result<String> {
let response = self
.client
.send(&RpcRequest::GetVersion, None, 0)
.map_err(|err| {
io::Error::new(
io::ErrorKind::Other,
format!("GetVersion request failure: {:?}", err),
)
})?;
serde_json::to_string(&response).map_err(|err| {
io::Error::new(
io::ErrorKind::Other,
format!("GetVersion parse failure: {}", err),
)
})
}
pub fn send_and_confirm_transaction<T: KeypairUtil>(
&self,
transaction: &mut Transaction,

View File

@ -9,18 +9,19 @@ pub enum RpcRequest {
GetAccountInfo,
GetBalance,
GetClusterNodes,
GetEpochVoteAccounts,
GetNumBlocksSinceSignatureConfirmation,
GetProgramAccounts,
GetRecentBlockhash,
GetSignatureStatus,
GetSlot,
GetSlotLeader,
GetEpochVoteAccounts,
GetStorageTurn,
GetStorageTurnRate,
GetSlotsPerSegment,
GetStoragePubkeysForSlot,
GetTransactionCount,
GetVersion,
RegisterNode,
RequestAirdrop,
SendTransaction,
@ -37,6 +38,7 @@ impl RpcRequest {
RpcRequest::GetAccountInfo => "getAccountInfo",
RpcRequest::GetBalance => "getBalance",
RpcRequest::GetClusterNodes => "getClusterNodes",
RpcRequest::GetEpochVoteAccounts => "getEpochVoteAccounts",
RpcRequest::GetNumBlocksSinceSignatureConfirmation => {
"getNumBlocksSinceSignatureConfirmation"
}
@ -45,12 +47,12 @@ impl RpcRequest {
RpcRequest::GetSignatureStatus => "getSignatureStatus",
RpcRequest::GetSlot => "getSlot",
RpcRequest::GetSlotLeader => "getSlotLeader",
RpcRequest::GetEpochVoteAccounts => "getEpochVoteAccounts",
RpcRequest::GetStorageTurn => "getStorageTurn",
RpcRequest::GetStorageTurnRate => "getStorageTurnRate",
RpcRequest::GetSlotsPerSegment => "getSlotsPerSegment",
RpcRequest::GetStoragePubkeysForSlot => "getStoragePubkeysForSlot",
RpcRequest::GetTransactionCount => "getTransactionCount",
RpcRequest::GetVersion => "getVersion",
RpcRequest::RegisterNode => "registerNode",
RpcRequest::RequestAirdrop => "requestAirdrop",
RpcRequest::SendTransaction => "sendTransaction",