Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CLI for SetConfigAdmin instructions #165

Merged
merged 2 commits into from
Oct 31, 2024
Merged
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
3 changes: 1 addition & 2 deletions cli/src/vault_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@ use std::str::FromStr;

use anyhow::{anyhow, Result};
use jito_bytemuck::{AccountDeserialize, Discriminator};
use jito_restaking_client::instructions::SetConfigAdminBuilder;
use jito_restaking_core::operator_vault_ticket::OperatorVaultTicket;
use jito_vault_client::{
instructions::{
AddDelegationBuilder, BurnWithdrawalTicketBuilder, CloseVaultUpdateStateTrackerBuilder,
CooldownDelegationBuilder, CrankVaultUpdateStateTrackerBuilder, CreateTokenMetadataBuilder,
EnqueueWithdrawalBuilder, InitializeConfigBuilder, InitializeVaultBuilder,
InitializeVaultOperatorDelegationBuilder, InitializeVaultUpdateStateTrackerBuilder,
MintToBuilder, SetDepositCapacityBuilder,
MintToBuilder, SetConfigAdminBuilder, SetDepositCapacityBuilder,
},
types::WithdrawalAllocationMethod,
};
Expand Down
6 changes: 3 additions & 3 deletions clients/js/restaking_client/instructions/setConfigAdmin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
type IInstruction,
type IInstructionWithAccounts,
type IInstructionWithData,
type ReadonlyAccount,
type ReadonlySignerAccount,
type TransactionSigner,
type WritableAccount,
Expand Down Expand Up @@ -53,8 +54,7 @@ export type SetConfigAdminInstruction<
IAccountSignerMeta<TAccountOldAdmin>
: TAccountOldAdmin,
TAccountNewAdmin extends string
? ReadonlySignerAccount<TAccountNewAdmin> &
IAccountSignerMeta<TAccountNewAdmin>
? ReadonlyAccount<TAccountNewAdmin>
: TAccountNewAdmin,
...TRemainingAccounts,
]
Expand Down Expand Up @@ -92,7 +92,7 @@ export type SetConfigAdminInput<
> = {
config: Address<TAccountConfig>;
oldAdmin: TransactionSigner<TAccountOldAdmin>;
newAdmin: TransactionSigner<TAccountNewAdmin>;
newAdmin: Address<TAccountNewAdmin>;
};

export function getSetConfigAdminInstruction<
Expand Down
6 changes: 3 additions & 3 deletions clients/js/vault_client/instructions/setConfigAdmin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
type IInstruction,
type IInstructionWithAccounts,
type IInstructionWithData,
type ReadonlyAccount,
type ReadonlySignerAccount,
type TransactionSigner,
type WritableAccount,
Expand Down Expand Up @@ -53,8 +54,7 @@ export type SetConfigAdminInstruction<
IAccountSignerMeta<TAccountOldAdmin>
: TAccountOldAdmin,
TAccountNewAdmin extends string
? ReadonlySignerAccount<TAccountNewAdmin> &
IAccountSignerMeta<TAccountNewAdmin>
? ReadonlyAccount<TAccountNewAdmin>
: TAccountNewAdmin,
...TRemainingAccounts,
]
Expand Down Expand Up @@ -92,7 +92,7 @@ export type SetConfigAdminInput<
> = {
config: Address<TAccountConfig>;
oldAdmin: TransactionSigner<TAccountOldAdmin>;
newAdmin: TransactionSigner<TAccountNewAdmin>;
newAdmin: Address<TAccountNewAdmin>;
};

export function getSetConfigAdminInstruction<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl SetConfigAdmin {
));
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
self.new_admin,
true,
false,
));
accounts.extend_from_slice(remaining_accounts);
let data = SetConfigAdminInstructionData::new().try_to_vec().unwrap();
Expand Down Expand Up @@ -71,7 +71,7 @@ impl Default for SetConfigAdminInstructionData {
///
/// 0. `[writable]` config
/// 1. `[signer]` old_admin
/// 2. `[signer]` new_admin
/// 2. `[]` new_admin
#[derive(Clone, Debug, Default)]
pub struct SetConfigAdminBuilder {
config: Option<solana_program::pubkey::Pubkey>,
Expand Down Expand Up @@ -206,7 +206,7 @@ impl<'a, 'b> SetConfigAdminCpi<'a, 'b> {
));
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
*self.new_admin.key,
true,
false,
));
remaining_accounts.iter().for_each(|remaining_account| {
accounts.push(solana_program::instruction::AccountMeta {
Expand Down Expand Up @@ -245,7 +245,7 @@ impl<'a, 'b> SetConfigAdminCpi<'a, 'b> {
///
/// 0. `[writable]` config
/// 1. `[signer]` old_admin
/// 2. `[signer]` new_admin
/// 2. `[]` new_admin
#[derive(Clone, Debug)]
pub struct SetConfigAdminCpiBuilder<'a, 'b> {
instruction: Box<SetConfigAdminCpiBuilderInstruction<'a, 'b>>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl SetConfigAdmin {
));
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
self.new_admin,
true,
false,
));
accounts.extend_from_slice(remaining_accounts);
let data = SetConfigAdminInstructionData::new().try_to_vec().unwrap();
Expand Down Expand Up @@ -71,7 +71,7 @@ impl Default for SetConfigAdminInstructionData {
///
/// 0. `[writable]` config
/// 1. `[signer]` old_admin
/// 2. `[signer]` new_admin
/// 2. `[]` new_admin
#[derive(Clone, Debug, Default)]
pub struct SetConfigAdminBuilder {
config: Option<solana_program::pubkey::Pubkey>,
Expand Down Expand Up @@ -206,7 +206,7 @@ impl<'a, 'b> SetConfigAdminCpi<'a, 'b> {
));
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
*self.new_admin.key,
true,
false,
));
remaining_accounts.iter().for_each(|remaining_account| {
accounts.push(solana_program::instruction::AccountMeta {
Expand Down Expand Up @@ -245,7 +245,7 @@ impl<'a, 'b> SetConfigAdminCpi<'a, 'b> {
///
/// 0. `[writable]` config
/// 1. `[signer]` old_admin
/// 2. `[signer]` new_admin
/// 2. `[]` new_admin
#[derive(Clone, Debug)]
pub struct SetConfigAdminCpiBuilder<'a, 'b> {
instruction: Box<SetConfigAdminCpiBuilderInstruction<'a, 'b>>,
Expand Down
2 changes: 1 addition & 1 deletion idl/jito_restaking.json
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,7 @@
{
"name": "newAdmin",
"isMut": false,
"isSigner": true
"isSigner": false
}
],
"args": [],
Expand Down
2 changes: 1 addition & 1 deletion idl/jito_vault.json
Original file line number Diff line number Diff line change
Expand Up @@ -1354,7 +1354,7 @@
{
"name": "newAdmin",
"isMut": false,
"isSigner": true
"isSigner": false
}
],
"args": [],
Expand Down
2 changes: 1 addition & 1 deletion restaking_sdk/src/instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ pub enum RestakingInstruction {
/// Changes the admin for the config
#[account(0, writable, name = "config")]
#[account(1, signer, name = "old_admin")]
#[account(2, signer, name = "new_admin")]
#[account(2, name = "new_admin")]
SetConfigAdmin,
}

Expand Down
2 changes: 1 addition & 1 deletion vault_sdk/src/instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ pub enum VaultInstruction {
/// Changes the admin for the config
#[account(0, writable, name = "config")]
#[account(1, signer, name = "old_admin")]
#[account(2, signer, name = "new_admin")]
#[account(2, name = "new_admin")]
SetConfigAdmin,

}
Expand Down
Loading