I am trying to build a clap cli tool using the latest utils from solana_clap_v3_utils
1.18.2 and there are currently no good examples in the solana-program-library that use v3 in the builder context that don't also use deprecated functions.
I am specifically talking about the functions in solana_clap_v3_utils::input_validators
like is_valid_pubkey
. The suggested fix is:
use of deprecated function `solana_clap_v3_utils::input_validators::is_valid_pubkey`:
please use `SignerSourceParserBuilder::default().allow_pubkey().allow_file_path().build()`
I am trying to use the parser instead like:
.arg(Arg::with_name("token")
.value_parser(SignerSourceParserBuilder::default().allow_pubkey().allow_file_path().build())
.value_name("TOKEN_MINT_ADDRESS")
.takes_value(true)
.index(1)
.required(true)
.help("Token to airdrop"),)
I assume this change was done to better match with regular clap functions so I could get the value with:
let token = arg_matches.get_one::<Pubkey>("token");
However I get this error.
Mismatch between definition and access of `token`. Could not downcast to solana_program::pubkey::Pubkey, need to downcast to solana_clap_v3_utils::keypair::SignerSource
Am I using this in the correct way? Or should I just stick to the validators?