clap-utils: Add epoch validator

This commit is contained in:
Trent Nelson 2020-12-28 11:37:47 -07:00 committed by mergify[bot]
parent addffd7694
commit a709850ee4
1 changed files with 8 additions and 1 deletions

View File

@ -1,7 +1,7 @@
use crate::keypair::{parse_keypair_path, KeypairUrl, ASK_KEYWORD};
use chrono::DateTime;
use solana_sdk::{
clock::Slot,
clock::{Epoch, Slot},
hash::Hash,
pubkey::Pubkey,
signature::{read_keypair_file, Signature},
@ -148,6 +148,13 @@ where
}
}
pub fn is_epoch<T>(epoch: T) -> Result<(), String>
where
T: AsRef<str> + Display,
{
is_parsable_generic::<Epoch, _>(epoch)
}
pub fn is_slot<T>(slot: T) -> Result<(), String>
where
T: AsRef<str> + Display,