Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[transfer-hook-cli] Replace pubkey_of_signer with pubkey_from_source #6625

Merged
merged 1 commit into from
Apr 24, 2024

Conversation

samkim-crypto
Copy link
Contributor

@samkim-crypto samkim-crypto commented Apr 24, 2024

Problem

The pubkey_of_signer function from solana-clap-v3-utils expects arguments to be parsed as String. However, if when using the more up-to-date way of declaring arguments using SignerSourceParserBuilder, clap expects arguments to be parsed directly as SignerSource rather than String and hence returns a downcast error when pubkey_of_signer is invoked.

Summary of changes

Replace pubkey_of_signer with pubkey_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 as SignerSource can be added to solana-clap-v3-utils later on to make the code less verbose.

Closes #6623.

Copy link
Contributor

@buffalojoec buffalojoec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to work! Too bad it's so verbose now, but I agree some tuning in the Clap v3 utils crate could make this a bit more slick!

@samkim-crypto samkim-crypto merged commit 68cae53 into solana-labs:master Apr 24, 2024
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

spl-transfer-hook create-extra-metas : Result::unwrap() on an Err` value: Downcast
2 participants