Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cli/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[package]
name = "squads-multisig-cli"
version = "0.1.4"
version = "0.1.6"
edition = "2021"
authors = ["Valentin Madrid", "Vova Guguiev"]
license = "MIT OR Apache-2.0"
Expand Down
28 changes: 22 additions & 6 deletions cli/src/command/proposal_vote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ pub struct ProposalVote {

#[arg(long)]
priority_fee_lamports: Option<u64>,

#[arg(long)]
fee_payer_keypair: Option<String>,
}

impl ProposalVote {
Expand All @@ -69,6 +72,7 @@ impl ProposalVote {
action,
memo,
priority_fee_lamports,
fee_payer_keypair,
} = self;

let program_id =
Expand All @@ -86,6 +90,9 @@ impl ProposalVote {

let rpc_url = rpc_url.unwrap_or_else(|| "https://api.mainnet-beta.solana.com".to_string());

let transaction_fee_payer_keypair =
fee_payer_keypair.map(|path| create_signer_from_path(path).unwrap());

println!();
println!(
"{}",
Expand Down Expand Up @@ -141,8 +148,13 @@ impl ProposalVote {
}
};

let fee_payer = transaction_fee_payer_keypair
.as_ref()
.map(|kp| kp.pubkey())
.unwrap_or(transaction_creator);

let message = Message::try_compile(
&transaction_creator,
&fee_payer,
&[
ComputeBudgetInstruction::set_compute_unit_price(
priority_fee_lamports.unwrap_or(5000),
Expand All @@ -163,11 +175,15 @@ impl ProposalVote {
)
.unwrap();

let transaction = VersionedTransaction::try_new(
VersionedMessage::V0(message),
&[&*transaction_creator_keypair],
)
.expect("Failed to create transaction");
let mut signers = vec![&*transaction_creator_keypair];
if let Some(ref fee_payer_kp) = transaction_fee_payer_keypair {
if fee_payer_kp.pubkey() != transaction_creator {
signers.push(&**fee_payer_kp);
}
}

let transaction = VersionedTransaction::try_new(VersionedMessage::V0(message), &signers)
.expect("Failed to create transaction");

let signature = send_and_confirm_transaction(&transaction, &rpc_client).await?;

Expand Down
19 changes: 18 additions & 1 deletion cli/src/command/vault_transaction_execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ pub struct VaultTransactionExecute {

#[arg(long)]
extra_keypair: Option<String>,

#[arg(long)]
fee_payer_keypair: Option<String>,
}

impl VaultTransactionExecute {
Expand All @@ -68,6 +71,7 @@ impl VaultTransactionExecute {
priority_fee_lamports,
compute_unit_limit,
extra_keypair,
fee_payer_keypair,
} = self;

let program_id =
Expand All @@ -90,6 +94,9 @@ impl VaultTransactionExecute {
let transaction_extra_signer_keypair =
extra_keypair.map(|path| create_signer_from_path(path).unwrap());

let transaction_fee_payer_keypair =
fee_payer_keypair.map(|path| create_signer_from_path(path).unwrap());
Comment on lines 95 to +98
Copy link

Copilot AI Jul 21, 2025

Choose a reason for hiding this comment

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

The use of .unwrap() for error handling is inconsistent with the pattern used elsewhere in the codebase and could cause the program to panic. Consider using proper error handling or .expect() with a descriptive message like the fee payer keypair loading below.

Suggested change
extra_keypair.map(|path| create_signer_from_path(path).unwrap());
let transaction_fee_payer_keypair =
fee_payer_keypair.map(|path| create_signer_from_path(path).unwrap());
extra_keypair.map(|path| create_signer_from_path(path).expect("Failed to load extra keypair from the provided path"));
let transaction_fee_payer_keypair =
fee_payer_keypair.map(|path| create_signer_from_path(path).expect("Failed to load fee payer keypair from the provided path"));

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Jul 21, 2025

Choose a reason for hiding this comment

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

The use of .unwrap() could cause the program to panic if the keypair file is invalid or inaccessible. Consider using .expect() with a descriptive error message like "Failed to load fee payer keypair" to provide better debugging information.

Suggested change
fee_payer_keypair.map(|path| create_signer_from_path(path).unwrap());
fee_payer_keypair.map(|path| create_signer_from_path(path).expect("Failed to load fee payer keypair"));

Copilot uses AI. Check for mistakes.

println!();
println!(
"{}",
Expand Down Expand Up @@ -161,8 +168,13 @@ impl VaultTransactionExecute {
.await
.expect("Failed to get blockhash");

let fee_payer = transaction_fee_payer_keypair
.as_ref()
.map(|kp| kp.pubkey())
.unwrap_or(transaction_creator);

let message = Message::try_compile(
&transaction_creator,
&fee_payer,
&[
ComputeBudgetInstruction::set_compute_unit_limit(
compute_unit_limit.unwrap_or(200_000),
Expand All @@ -182,6 +194,11 @@ impl VaultTransactionExecute {
.unwrap();

let mut signers = vec![&*transaction_creator_keypair];
if let Some(ref fee_payer_kp) = transaction_fee_payer_keypair {
if fee_payer_kp.pubkey() != transaction_creator {
signers.push(&**fee_payer_kp);
}
}
if let Some(ref extra_signer) = transaction_extra_signer_keypair {
signers.push(&**extra_signer);
}
Expand Down
Loading