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
1,845 changes: 1,154 additions & 691 deletions Cargo.lock

Large diffs are not rendered by default.

35 changes: 25 additions & 10 deletions cli/Cargo.lock

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

1 change: 1 addition & 0 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ description = "Command line interface to interact with the Squads v4 program."

[dependencies]
tokio = { version = "1.35.1", features = ["rt", "rt-multi-thread", "macros"] }
base64 = "0.22.1"
clap = { version = "4.4.13", features = ["derive"] }
eyre = "0.6.11"
dialoguer = "0.11.0"
Expand Down
2 changes: 1 addition & 1 deletion cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ vault-transaction-create --rpc-url <RPC_URL> --program-id <PROGRAM_ID> --keypair
### Example Usage

```bash
vault-transaction-create --keypair /path/to/keypair.json --multisig-pubkey <MULTISIG_PUBLIC_KEY> --vault-index 1 --transaction-message [1, 2, 3, 5, 5, 6, 7, 8]
vault-transaction-create --keypair /path/to/keypair.json --multisig-pubkey <MULTISIG_PUBLIC_KEY> --vault-index 1 --transaction-message AAAABBBBBBB==
```

In this example, a new transaction with the specified message is proposed in the multisig vault at vault index 1.
Expand Down
18 changes: 14 additions & 4 deletions cli/src/command/multisig_create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ pub struct MultisigCreate {

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

/// Skip confirmation prompt
#[arg(long)]
no_confirm: bool,
}

impl MultisigCreate {
Expand All @@ -68,6 +72,7 @@ impl MultisigCreate {
threshold,
rent_collector,
priority_fee_lamports,
no_confirm,
} = self;

let program_id =
Expand Down Expand Up @@ -114,10 +119,15 @@ impl MultisigCreate {

let config_authority = config_authority.map(|s| Pubkey::from_str(&s)).transpose()?;

let proceed = Confirm::new()
.with_prompt("Do you want to proceed?")
.default(false)
.interact()?;
let proceed = if no_confirm {
true
} else {
Confirm::new()
.with_prompt("Do you want to proceed?")
.default(false)
.interact()?
};

if !proceed {
println!("OK, aborting.");
return Ok(());
Expand Down
24 changes: 19 additions & 5 deletions cli/src/command/proposal_vote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ pub struct ProposalVote {

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

/// Skip confirmation prompt
#[arg(long)]
no_confirm: bool,

#[arg(long, default_value = "finalized")]
commitment: solana_sdk::commitment_config::CommitmentConfig,
}

impl ProposalVote {
Expand All @@ -69,6 +76,8 @@ impl ProposalVote {
action,
memo,
priority_fee_lamports,
no_confirm,
commitment,
} = self;

let program_id =
Expand Down Expand Up @@ -102,17 +111,22 @@ impl ProposalVote {
println!("Vote Type: {}", action);
println!();

let proceed = Confirm::new()
.with_prompt("Do you want to proceed?")
.default(false)
.interact()?;
let proceed = if no_confirm {
true
} else {
Confirm::new()
.with_prompt("Do you want to proceed?")
.default(false)
.interact()?
};

if !proceed {
println!("OK, aborting.");
return Ok(());
}
println!();

let rpc_client = RpcClient::new(rpc_url);
let rpc_client = RpcClient::new_with_commitment(rpc_url, commitment);

let progress = ProgressBar::new_spinner().with_message("Sending transaction...");
progress.enable_steady_tick(Duration::from_millis(100));
Expand Down
35 changes: 29 additions & 6 deletions cli/src/command/vault_transaction_create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,23 @@ pub struct VaultTransactionCreate {
#[arg(long)]
vault_index: u8,

/// Transaction message in base64
#[arg(long)]
transaction_message: Vec<u8>,
transaction_message: String,

/// Memo to be included in the transaction
#[arg(long)]
memo: Option<String>,

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

/// Skip confirmation prompt
#[arg(long)]
no_confirm: bool,

#[arg(long, default_value = "finalized")]
commitment: solana_sdk::commitment_config::CommitmentConfig,
}

impl VaultTransactionCreate {
Expand All @@ -69,8 +77,18 @@ impl VaultTransactionCreate {
transaction_message,
vault_index,
priority_fee_lamports,
no_confirm,
commitment,
} = self;

let transaction_message: Vec<u8> = {
use base64::prelude::Engine as _;
use base64::prelude::BASE64_STANDARD;
BASE64_STANDARD
.decode(transaction_message)
.expect("Invalid base64 string for transaction_message")
};

let program_id =
program_id.unwrap_or_else(|| "SQDS4ep65T869zMMBKyuUq6aD6EgTu8psMjkvj52pCf".to_string());

Expand All @@ -82,7 +100,7 @@ impl VaultTransactionCreate {

let rpc_url = rpc_url.unwrap_or_else(|| "https://api.mainnet-beta.solana.com".to_string());
let rpc_url_clone = rpc_url.clone();
let rpc_client = &RpcClient::new(rpc_url);
let rpc_client = &RpcClient::new_with_commitment(rpc_url, commitment);

let multisig = Pubkey::from_str(&multisig_pubkey).expect("Invalid multisig address");

Expand All @@ -108,10 +126,15 @@ impl VaultTransactionCreate {
println!("Vault Index: {}", vault_index);
println!();

let proceed = Confirm::new()
.with_prompt("Do you want to proceed?")
.default(false)
.interact()?;
let proceed = if no_confirm {
true
} else {
Confirm::new()
.with_prompt("Do you want to proceed?")
.default(false)
.interact()?
};

if !proceed {
println!("OK, aborting.");
return Ok(());
Expand Down
34 changes: 25 additions & 9 deletions cli/src/command/vault_transaction_execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,14 @@ pub struct VaultTransactionExecute {
compute_unit_limit: Option<u32>,

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

/// Skip confirmation prompt
#[arg(long)]
no_confirm: bool,

#[arg(long, default_value = "finalized")]
commitment: solana_sdk::commitment_config::CommitmentConfig,
}

impl VaultTransactionExecute {
Expand All @@ -68,6 +75,8 @@ impl VaultTransactionExecute {
priority_fee_lamports,
compute_unit_limit,
extra_keypair,
no_confirm,
commitment,
} = self;

let program_id =
Expand All @@ -87,8 +96,10 @@ impl VaultTransactionExecute {

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

let transaction_extra_signer_keypair =
extra_keypair.map(|path| create_signer_from_path(path).unwrap());
let transaction_extra_signer_keypair = extra_keypair
.into_iter()
.map(|path| create_signer_from_path(path).unwrap())
.collect::<Vec<_>>();

println!();
println!(
Expand All @@ -105,17 +116,22 @@ impl VaultTransactionExecute {
println!("Transaction Index: {}", transaction_index);
println!();

let proceed = Confirm::new()
.with_prompt("Do you want to proceed?")
.default(false)
.interact()?;
let proceed = if no_confirm {
true
} else {
Confirm::new()
.with_prompt("Do you want to proceed?")
.default(false)
.interact()?
};

if !proceed {
println!("OK, aborting.");
return Ok(());
}
println!();

let rpc_client = RpcClient::new(rpc_url);
let rpc_client = RpcClient::new_with_commitment(rpc_url, commitment);

let transaction_account_data = rpc_client
.get_account(&transaction_pda.0)
Expand Down Expand Up @@ -182,7 +198,7 @@ impl VaultTransactionExecute {
.unwrap();

let mut signers = vec![&*transaction_creator_keypair];
if let Some(ref extra_signer) = transaction_extra_signer_keypair {
for extra_signer in &transaction_extra_signer_keypair {
signers.push(&**extra_signer);
}

Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.75.0
1.87.0