CLI BIP32 prep: KeypairUrl refactor (backport #16592) (#16605)

* clap-utils: Rename KeypairUrl to SignerSource

(cherry picked from commit 09dcc9ea04)

* clap-utils: Reduce SignerSource's visibility

(cherry picked from commit c5ab3ba6f1)

* clap-utils: Use `uriparse` crate to parse `SignerSource`

(cherry picked from commit 5d1ef5d01d)

* clap-utils: Add explicit schemes for `ask` and `file` `SignerSource`s

(cherry picked from commit 6444f0e57b)

Co-authored-by: Trent Nelson <trent@solana.com>
This commit is contained in:
mergify[bot]
2021-04-16 21:14:31 +00:00
committed by GitHub
parent ac76a75937
commit fe775a9716
6 changed files with 101 additions and 30 deletions

View File

@@ -1,4 +1,4 @@
use crate::keypair::{parse_keypair_path, KeypairUrl, ASK_KEYWORD};
use crate::keypair::{parse_signer_source, SignerSource, ASK_KEYWORD};
use chrono::DateTime;
use solana_sdk::{
clock::{Epoch, Slot},
@@ -108,8 +108,8 @@ pub fn is_valid_pubkey<T>(string: T) -> Result<(), String>
where
T: AsRef<str> + Display,
{
match parse_keypair_path(string.as_ref()) {
KeypairUrl::Filepath(path) => is_keypair(path),
match parse_signer_source(string.as_ref()) {
SignerSource::Filepath(path) => is_keypair(path),
_ => Ok(()),
}
}