Skip to content

fix(cli): accept base58-encoded transaction_message in vault_transaction_create (closes #159)#184

Open
cryptomotifs wants to merge 1 commit into
Squads-Protocol:mainfrom
cryptomotifs:fix/159-cli-transaction-message-base58
Open

fix(cli): accept base58-encoded transaction_message in vault_transaction_create (closes #159)#184
cryptomotifs wants to merge 1 commit into
Squads-Protocol:mainfrom
cryptomotifs:fix/159-cli-transaction-message-base58

Conversation

@cryptomotifs
Copy link
Copy Markdown

Summary

Closes #159.

--transaction-message on squads-multisig-cli vault-transaction-create is typed as Vec<u8>, which clap parses as one byte per --transaction-message invocation. A real VaultTransactionMessage is many bytes long, so as-written there is no way to actually pass one through this argument — the CLI accepts the flag but cannot accept a real message (which is what #159 reports).

Fix

Take the message as a single base58-encoded string and decode it inside a clap::value_parser. The decoded Vec<u8> flows through the rest of the function unchanged — the on-chain instruction continues to receive the same bytes.

fn parse_base58_transaction_message(s: &str) -> Result<Vec<u8>, String> {
    solana_sdk::bs58::decode(s)
        .into_vec()
        .map_err(|e| format!(\"invalid base58 in --transaction-message: {e}\"))
}

#[arg(long, value_parser = parse_base58_transaction_message)]
transaction_message: Vec<u8>,

Base58 matches the rest of the Squads CLI (multisig_pubkey is already base58 parsed via Pubkey::from_str) and bs58 is already available via solana_sdk so no new dependency is added.

Usage after fix

squads-multisig-cli vault-transaction-create \
  --keypair ./keypair.json \
  --multisig-pubkey 6Mz4...Asdf \
  --vault-index 0 \
  --transaction-message <base58-encoded-VaultTransactionMessage>

Test plan

  • Diff compiles with the existing solana-sdk dependency (no new crate added).
  • CI: please run the cli build/test suite — happy to follow up if maintainers want a small unit test for the parser fn.

🤖 Generated with Claude Code

…ion_create

Closes Squads-Protocol#159.

The `--transaction-message` flag was typed as `Vec<u8>`, which clap
parses as one `u8` per `--transaction-message` invocation. Real
`VaultTransactionMessage` payloads are many bytes long, so there is no
way to actually pass one through this argument as written; the CLI
appears to accept the flag but cannot accept a real message.

Take the transaction message as a single base58-encoded string and
decode it inside a `clap::value_parser`. The decoded `Vec<u8>` flows
through the rest of the function unchanged.

Base58 matches the rest of the Squads CLI (e.g. `multisig_pubkey` is
already a base58 string parsed via `Pubkey::from_str`) and uses the
`bs58` re-export already available via `solana_sdk`.
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 25, 2026

@cryptomotifs is attempting to deploy a commit to the squads Team on Vercel.

A member of the Team first needs to authorize it.

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.

Incorrect setup for clap in transaction_create

1 participant