[toekn-cli] Replace is_valid_pubkey
validator with signer source parser
#7447
+323
−256
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
In token-cli, there are still some deprecated functions from clap-v2 that should be removed. In particular, we still use input validators, which should be replaced with input parsers.
Summary of Changes
This is a follow-up to #7448. In this PR, I removed all occurrences of the
is_valid_pubkey
validation function.Replacing
is_valid_pubkey
requires two steps.is_valid_pubkey
with eitherSignerSource::default().allow_all().build()
orSignerSource::default().allow_pubkey().build()
depending on whether we are only parsing pubkey or any signer source.SignerSource::try_get_pubkey(...)
to parse the pubkey.The main commit that applies the steps above is 8d27503. In the previous commits 76f5da8, 58e0441 (I made a mistake in this PR, which I fixed in ae6082d), dc311a7, I did some ground work to update the
Config
associated functions to use theSignerSource::try_get_pubkey(...)
.After this PR, there are still occurrences of
is_valid_signer
validation function. This will be removed in another follow-up.