Skip to content

Conversation

dylankyc
Copy link
Contributor

Add support for multisig accounts to the CreateAccount command by including the multisig_signer_arg() argument.

Add support for multisig accounts to the CreateAccount command by including
the multisig_signer_arg() argument.
@dylankyc
Copy link
Contributor Author

This PR will fix the panic when creating account:

 ./target/debug/spl-token create-token
Creating token JDtj9Gg7ZtXcdYBTBsgYqRBBQ1Dig37VpQz3vxgWNSTo under program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA

Address:  JDtj9Gg7ZtXcdYBTBsgYqRBBQ1Dig37VpQz3vxgWNSTo
Decimals:  9

 ./target/debug/spl-token create-account JDtj9Gg7ZtXcdYBTBsgYqRBBQ1Dig37VpQz3vxgWNSTo
thread 'main' panicked at clients/cli/src/config.rs:51:35:
`multisig_signer` is not an id of an argument or a group.
Make sure you're using the name of the argument itself and not the name of short or long flags.
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

joncinque added a commit to joncinque/token-2022 that referenced this pull request Jan 14, 2025
#### Problem

As pointed out in solana-program#58, the CLI currently fails when just running
`create-account <MINT_ADDRESS>`, because a multisig argument is expected
during all commands. Clap v3's version of `values_of` gives an error if
the arg is not configured in the command.

This was probably missed during the port over to clap v3.

#### Summary of changes

Do the same thing as elsewhere, and change `values_of` to
`try_get_many(...).ok().flatten()`.

This is the last place using `values_of` in the CLI that could fail.
@joncinque
Copy link
Contributor

Thanks for your contribution! This was caused during the upgrade to clap v3, and could end up breaking more commands, so we'll take a different approach to fixing it with #72 (or whatever the reviewer prefers).

Either way, thanks for pointing out the problem and providing such clear reproduction steps!

joncinque added a commit that referenced this pull request Jan 14, 2025
* cli: Fix multisig parsing

#### Problem

As pointed out in #58, the CLI currently fails when just running
`create-account <MINT_ADDRESS>`, because a multisig argument is expected
during all commands. Clap v3's version of `values_of` gives an error if
the arg is not configured in the command.

This was probably missed during the port over to clap v3.

#### Summary of changes

Do the same thing as elsewhere, and change `values_of` to
`try_get_many(...).ok().flatten()`.

This is the last place using `values_of` in the CLI that could fail.

* Integrate review feedback
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.

2 participants