[transfer-hook-cli] Replace pubkey_of_signer
with pubkey_from_source
#6625
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
The
pubkey_of_signer
function fromsolana-clap-v3-utils
expects arguments to be parsed asString
. However, if when using the more up-to-date way of declaring arguments usingSignerSourceParserBuilder
, clap expects arguments to be parsed directly asSignerSource
rather thanString
and hence returns a downcast error whenpubkey_of_signer
is invoked.Summary of changes
Replace
pubkey_of_signer
withpubkey_from_source
.Unfortunately, this way of parsing is a bit more verbose than the original code, but it should do the job. Perhaps an analogous function to
pubkey_of_signer
, which parses arguments directly asSignerSource
can be added tosolana-clap-v3-utils
later on to make the code less verbose.Closes #6623.