Skip to content

Commit

Permalink
Cli
Browse files Browse the repository at this point in the history
  • Loading branch information
ebatsell committed Nov 1, 2024
1 parent 9d8598f commit 1963557
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
2 changes: 2 additions & 0 deletions cli/src/vault.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ pub enum ConfigActions {
/// The new admin's pubkey
new_admin: Pubkey,
},
/// Set the config program fee wallet
SetProgramFeeWallet,
}

/// Vault commands
Expand Down
35 changes: 34 additions & 1 deletion cli/src/vault_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ use jito_vault_client::{
CooldownDelegationBuilder, CrankVaultUpdateStateTrackerBuilder, CreateTokenMetadataBuilder,
EnqueueWithdrawalBuilder, InitializeConfigBuilder, InitializeVaultBuilder,
InitializeVaultOperatorDelegationBuilder, InitializeVaultUpdateStateTrackerBuilder,
MintToBuilder, SetConfigAdminBuilder, SetDepositCapacityBuilder,
MintToBuilder, SetConfigAdminBuilder, SetConfigProgramFeeWalletBuilder,
SetDepositCapacityBuilder,
},
types::WithdrawalAllocationMethod,
};
Expand Down Expand Up @@ -81,6 +82,9 @@ impl VaultCliHandler {
VaultCommands::Config {
action: ConfigActions::SetAdmin { new_admin },
} => self.set_config_admin(new_admin).await,
VaultCommands::Config {
action: ConfigActions::SetProgramFeeWallet,
} => self.set_config_program_fee_wallet().await,
VaultCommands::Vault {
action:
VaultActions::Initialize {
Expand Down Expand Up @@ -1117,4 +1121,33 @@ impl VaultCliHandler {
info!("Transaction confirmed: {:?}", tx.get_signature());
Ok(())
}

async fn set_config_program_fee_wallet(&self) -> Result<()> {
let keypair = self
.cli_config
.keypair
.as_ref()
.ok_or_else(|| anyhow!("Keypair not provided"))?;
let rpc_client = self.get_rpc_client();

let config_address = Config::find_program_address(&self.vault_program_id).0;
let mut ix_builder = SetConfigProgramFeeWalletBuilder::new();
ix_builder.config(config_address);

let blockhash = rpc_client.get_latest_blockhash().await?;
let tx = Transaction::new_signed_with_payer(
&[ix_builder.instruction()],
Some(&keypair.pubkey()),
&[keypair],
blockhash,
);

info!(
"Setting config program fee wallet transaction: {:?}",
tx.get_signature()
);
rpc_client.send_and_confirm_transaction(&tx).await?;
info!("Transaction confirmed: {:?}", tx.get_signature());
Ok(())
}
}

0 comments on commit 1963557

Please sign in to comment.