feat: get epoch schedule rpc, update cli (#6500)
This commit is contained in:
@@ -9,6 +9,7 @@ use serde_json::{json, Value};
|
||||
use solana_sdk::{
|
||||
account::Account,
|
||||
clock::{Slot, DEFAULT_TICKS_PER_SECOND, DEFAULT_TICKS_PER_SLOT},
|
||||
epoch_schedule::EpochSchedule,
|
||||
fee_calculator::FeeCalculator,
|
||||
hash::Hash,
|
||||
inflation::Inflation,
|
||||
@@ -138,6 +139,25 @@ impl RpcClient {
|
||||
})
|
||||
}
|
||||
|
||||
pub fn get_epoch_schedule(&self) -> io::Result<EpochSchedule> {
|
||||
let response = self
|
||||
.client
|
||||
.send(&RpcRequest::GetEpochSchedule, None, 0)
|
||||
.map_err(|err| {
|
||||
io::Error::new(
|
||||
io::ErrorKind::Other,
|
||||
format!("GetEpochSchedule request failure: {:?}", err),
|
||||
)
|
||||
})?;
|
||||
|
||||
serde_json::from_value(response).map_err(|err| {
|
||||
io::Error::new(
|
||||
io::ErrorKind::Other,
|
||||
format!("GetEpochSchedule parse failure: {}", err),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
pub fn get_inflation(&self) -> io::Result<Inflation> {
|
||||
let response = self
|
||||
.client
|
||||
|
@@ -58,6 +58,7 @@ pub enum RpcRequest {
|
||||
GetBalance,
|
||||
GetClusterNodes,
|
||||
GetEpochInfo,
|
||||
GetEpochSchedule,
|
||||
GetGenesisBlockhash,
|
||||
GetInflation,
|
||||
GetNumBlocksSinceSignatureConfirmation,
|
||||
@@ -91,6 +92,7 @@ impl RpcRequest {
|
||||
RpcRequest::GetBalance => "getBalance",
|
||||
RpcRequest::GetClusterNodes => "getClusterNodes",
|
||||
RpcRequest::GetEpochInfo => "getEpochInfo",
|
||||
RpcRequest::GetEpochSchedule => "getEpochSchedule",
|
||||
RpcRequest::GetGenesisBlockhash => "getGenesisBlockhash",
|
||||
RpcRequest::GetInflation => "getInflation",
|
||||
RpcRequest::GetNumBlocksSinceSignatureConfirmation => {
|
||||
|
Reference in New Issue
Block a user