Skip to content

Commit 9faa8a5

Browse files
feat(cli): Add possibility to use an extra signer for vault tx execution
1 parent de4a03b commit 9faa8a5

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

cli/Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cli/src/command/vault_transaction_execute.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ pub struct VaultTransactionExecute {
5252

5353
#[arg(long)]
5454
compute_unit_limit: Option<u32>,
55+
56+
#[arg(long)]
57+
extra_keypair: Option<String>,
5558
}
5659

5760
impl VaultTransactionExecute {
@@ -64,6 +67,7 @@ impl VaultTransactionExecute {
6467
transaction_index,
6568
priority_fee_lamports,
6669
compute_unit_limit,
70+
extra_keypair,
6771
} = self;
6872

6973
let program_id =
@@ -83,6 +87,8 @@ impl VaultTransactionExecute {
8387

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

90+
let transaction_extra_signer_keypair = extra_keypair.map(|path| create_signer_from_path(path).unwrap());
91+
8692
println!();
8793
println!(
8894
"{}",
@@ -174,9 +180,14 @@ impl VaultTransactionExecute {
174180
)
175181
.unwrap();
176182

183+
let mut signers = vec![&*transaction_creator_keypair];
184+
if let Some(ref extra_signer) = transaction_extra_signer_keypair {
185+
signers.push(&**extra_signer);
186+
}
187+
177188
let transaction = VersionedTransaction::try_new(
178189
VersionedMessage::V0(message),
179-
&[&*transaction_creator_keypair],
190+
&signers,
180191
)
181192
.expect("Failed to create transaction");
182193

0 commit comments

Comments
 (0)