Skip to content

Commit 0d4849c

Browse files
authored
CLI: Get StakeDepositAuthority (#30)
* fix: update * fix: update
1 parent b9916dc commit 0d4849c

File tree

2 files changed

+65
-2
lines changed

2 files changed

+65
-2
lines changed

cli/src/interceptor.rs

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
use std::num::NonZeroU32;
2-
use std::time::{SystemTime, UNIX_EPOCH};
1+
use std::{
2+
num::NonZeroU32,
3+
time::{SystemTime, UNIX_EPOCH},
4+
};
35

46
use jito_bytemuck::AccountDeserialize;
57
use solana_account_decoder::UiAccountEncoding;
@@ -491,3 +493,47 @@ pub fn command_claim_tokens(
491493
Err(e) => Err(format!("Failed to claim pool tokens: {}", e).into()),
492494
}
493495
}
496+
497+
/// Command to get [`StakePoolDepositStakeAuthority`]
498+
pub fn command_get_stake_deposit_authority(
499+
config: &Config,
500+
stake_deposit_authority_address: &Pubkey,
501+
) -> CommandResult {
502+
let stake_deposit_authority =
503+
get_stake_deposit_authority(&config.rpc_client, stake_deposit_authority_address)?;
504+
505+
println!("\nStake Pool Deposit Stake Authority");
506+
println!("=====================================");
507+
println!("Base: {}", stake_deposit_authority.base);
508+
println!(
509+
"Stake Pool: {}",
510+
stake_deposit_authority.stake_pool
511+
);
512+
println!(
513+
"Pool Mint: {}",
514+
stake_deposit_authority.pool_mint
515+
);
516+
println!(
517+
"Authority: {}",
518+
stake_deposit_authority.authority
519+
);
520+
println!("Vault: {}", stake_deposit_authority.vault);
521+
println!(
522+
"Stake Pool Program ID: {}",
523+
stake_deposit_authority.stake_pool_program_id
524+
);
525+
let cool_down_seconds: u64 = stake_deposit_authority.cool_down_seconds.into();
526+
println!("Cool Down Seconds: {cool_down_seconds}");
527+
let initial_fee_bps: u32 = stake_deposit_authority.inital_fee_bps.into();
528+
println!("Initial Fee (bps): {initial_fee_bps}",);
529+
println!(
530+
"Fee Wallet: {}",
531+
stake_deposit_authority.fee_wallet
532+
);
533+
println!(
534+
"Bump Seed: {}",
535+
stake_deposit_authority.bump_seed
536+
);
537+
538+
Ok(())
539+
}

cli/src/main.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3107,6 +3107,18 @@ fn main() {
31073107
.help("Create the destination ATA if it doesn't exist"),
31083108
)
31093109
)
3110+
.subcommand(SubCommand::with_name("get-stake-deposit-authority")
3111+
.about("Get a stake deposit authority for a specific stake pool")
3112+
.arg(
3113+
Arg::with_name("stake_deposit_authority")
3114+
.index(1)
3115+
.validator(is_pubkey)
3116+
.value_name("STAKE_DEPOSIT_AUTHORITY")
3117+
.takes_value(true)
3118+
.required(true)
3119+
.help("stake_deposit_authority of the stake pool that will be deposited to"),
3120+
)
3121+
)
31103122
)
31113123
.get_matches();
31123124

@@ -3591,6 +3603,11 @@ fn main() {
35913603
create_ata,
35923604
)
35933605
}
3606+
("get-stake-deposit-authority", Some(arg_matches)) => {
3607+
let stake_deposit_authority =
3608+
pubkey_of(arg_matches, "stake_deposit_authority").unwrap();
3609+
interceptor::command_get_stake_deposit_authority(&config, &stake_deposit_authority)
3610+
}
35943611
_ => unreachable!(),
35953612
},
35963613
_ => unreachable!(),

0 commit comments

Comments
 (0)