Update getLeaderSchedule options (#16749)

This commit is contained in:
Tyera Eulberg
2021-04-22 13:27:30 -06:00
committed by GitHub
parent 556997666c
commit 636b5987af
2 changed files with 25 additions and 4 deletions

View File

@ -49,6 +49,22 @@ pub struct RpcLeaderScheduleConfig {
pub commitment: Option<CommitmentConfig>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(untagged)]
pub enum RpcLeaderScheduleConfigWrapper {
SlotOnly(Option<Slot>),
ConfigOnly(Option<RpcLeaderScheduleConfig>),
}
impl RpcLeaderScheduleConfigWrapper {
pub fn unzip(&self) -> (Option<Slot>, Option<RpcLeaderScheduleConfig>) {
match &self {
RpcLeaderScheduleConfigWrapper::SlotOnly(slot) => (*slot, None),
RpcLeaderScheduleConfigWrapper::ConfigOnly(config) => (None, config.clone()),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum RpcLargestAccountsFilter {