jito_vault_client/generated/instructions/
set_config_admin.rs1use borsh::{BorshDeserialize, BorshSerialize};
8
9pub struct SetConfigAdmin {
11 pub config: solana_program::pubkey::Pubkey,
12
13 pub old_admin: solana_program::pubkey::Pubkey,
14
15 pub new_admin: solana_program::pubkey::Pubkey,
16}
17
18impl SetConfigAdmin {
19 pub fn instruction(&self) -> solana_program::instruction::Instruction {
20 self.instruction_with_remaining_accounts(&[])
21 }
22 #[allow(clippy::vec_init_then_push)]
23 pub fn instruction_with_remaining_accounts(
24 &self,
25 remaining_accounts: &[solana_program::instruction::AccountMeta],
26 ) -> solana_program::instruction::Instruction {
27 let mut accounts = Vec::with_capacity(3 + remaining_accounts.len());
28 accounts.push(solana_program::instruction::AccountMeta::new(
29 self.config,
30 false,
31 ));
32 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
33 self.old_admin,
34 true,
35 ));
36 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
37 self.new_admin,
38 false,
39 ));
40 accounts.extend_from_slice(remaining_accounts);
41 let data = SetConfigAdminInstructionData::new().try_to_vec().unwrap();
42
43 solana_program::instruction::Instruction {
44 program_id: crate::JITO_VAULT_ID,
45 accounts,
46 data,
47 }
48 }
49}
50
51#[derive(BorshDeserialize, BorshSerialize)]
52pub struct SetConfigAdminInstructionData {
53 discriminator: u8,
54}
55
56impl SetConfigAdminInstructionData {
57 pub fn new() -> Self {
58 Self { discriminator: 31 }
59 }
60}
61
62impl Default for SetConfigAdminInstructionData {
63 fn default() -> Self {
64 Self::new()
65 }
66}
67
68#[derive(Clone, Debug, Default)]
76pub struct SetConfigAdminBuilder {
77 config: Option<solana_program::pubkey::Pubkey>,
78 old_admin: Option<solana_program::pubkey::Pubkey>,
79 new_admin: Option<solana_program::pubkey::Pubkey>,
80 __remaining_accounts: Vec<solana_program::instruction::AccountMeta>,
81}
82
83impl SetConfigAdminBuilder {
84 pub fn new() -> Self {
85 Self::default()
86 }
87 #[inline(always)]
88 pub fn config(&mut self, config: solana_program::pubkey::Pubkey) -> &mut Self {
89 self.config = Some(config);
90 self
91 }
92 #[inline(always)]
93 pub fn old_admin(&mut self, old_admin: solana_program::pubkey::Pubkey) -> &mut Self {
94 self.old_admin = Some(old_admin);
95 self
96 }
97 #[inline(always)]
98 pub fn new_admin(&mut self, new_admin: solana_program::pubkey::Pubkey) -> &mut Self {
99 self.new_admin = Some(new_admin);
100 self
101 }
102 #[inline(always)]
104 pub fn add_remaining_account(
105 &mut self,
106 account: solana_program::instruction::AccountMeta,
107 ) -> &mut Self {
108 self.__remaining_accounts.push(account);
109 self
110 }
111 #[inline(always)]
113 pub fn add_remaining_accounts(
114 &mut self,
115 accounts: &[solana_program::instruction::AccountMeta],
116 ) -> &mut Self {
117 self.__remaining_accounts.extend_from_slice(accounts);
118 self
119 }
120 #[allow(clippy::clone_on_copy)]
121 pub fn instruction(&self) -> solana_program::instruction::Instruction {
122 let accounts = SetConfigAdmin {
123 config: self.config.expect("config is not set"),
124 old_admin: self.old_admin.expect("old_admin is not set"),
125 new_admin: self.new_admin.expect("new_admin is not set"),
126 };
127
128 accounts.instruction_with_remaining_accounts(&self.__remaining_accounts)
129 }
130}
131
132pub struct SetConfigAdminCpiAccounts<'a, 'b> {
134 pub config: &'b solana_program::account_info::AccountInfo<'a>,
135
136 pub old_admin: &'b solana_program::account_info::AccountInfo<'a>,
137
138 pub new_admin: &'b solana_program::account_info::AccountInfo<'a>,
139}
140
141pub struct SetConfigAdminCpi<'a, 'b> {
143 pub __program: &'b solana_program::account_info::AccountInfo<'a>,
145
146 pub config: &'b solana_program::account_info::AccountInfo<'a>,
147
148 pub old_admin: &'b solana_program::account_info::AccountInfo<'a>,
149
150 pub new_admin: &'b solana_program::account_info::AccountInfo<'a>,
151}
152
153impl<'a, 'b> SetConfigAdminCpi<'a, 'b> {
154 pub fn new(
155 program: &'b solana_program::account_info::AccountInfo<'a>,
156 accounts: SetConfigAdminCpiAccounts<'a, 'b>,
157 ) -> Self {
158 Self {
159 __program: program,
160 config: accounts.config,
161 old_admin: accounts.old_admin,
162 new_admin: accounts.new_admin,
163 }
164 }
165 #[inline(always)]
166 pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult {
167 self.invoke_signed_with_remaining_accounts(&[], &[])
168 }
169 #[inline(always)]
170 pub fn invoke_with_remaining_accounts(
171 &self,
172 remaining_accounts: &[(
173 &'b solana_program::account_info::AccountInfo<'a>,
174 bool,
175 bool,
176 )],
177 ) -> solana_program::entrypoint::ProgramResult {
178 self.invoke_signed_with_remaining_accounts(&[], remaining_accounts)
179 }
180 #[inline(always)]
181 pub fn invoke_signed(
182 &self,
183 signers_seeds: &[&[&[u8]]],
184 ) -> solana_program::entrypoint::ProgramResult {
185 self.invoke_signed_with_remaining_accounts(signers_seeds, &[])
186 }
187 #[allow(clippy::clone_on_copy)]
188 #[allow(clippy::vec_init_then_push)]
189 pub fn invoke_signed_with_remaining_accounts(
190 &self,
191 signers_seeds: &[&[&[u8]]],
192 remaining_accounts: &[(
193 &'b solana_program::account_info::AccountInfo<'a>,
194 bool,
195 bool,
196 )],
197 ) -> solana_program::entrypoint::ProgramResult {
198 let mut accounts = Vec::with_capacity(3 + remaining_accounts.len());
199 accounts.push(solana_program::instruction::AccountMeta::new(
200 *self.config.key,
201 false,
202 ));
203 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
204 *self.old_admin.key,
205 true,
206 ));
207 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
208 *self.new_admin.key,
209 false,
210 ));
211 remaining_accounts.iter().for_each(|remaining_account| {
212 accounts.push(solana_program::instruction::AccountMeta {
213 pubkey: *remaining_account.0.key,
214 is_signer: remaining_account.1,
215 is_writable: remaining_account.2,
216 })
217 });
218 let data = SetConfigAdminInstructionData::new().try_to_vec().unwrap();
219
220 let instruction = solana_program::instruction::Instruction {
221 program_id: crate::JITO_VAULT_ID,
222 accounts,
223 data,
224 };
225 let mut account_infos = Vec::with_capacity(3 + 1 + remaining_accounts.len());
226 account_infos.push(self.__program.clone());
227 account_infos.push(self.config.clone());
228 account_infos.push(self.old_admin.clone());
229 account_infos.push(self.new_admin.clone());
230 remaining_accounts
231 .iter()
232 .for_each(|remaining_account| account_infos.push(remaining_account.0.clone()));
233
234 if signers_seeds.is_empty() {
235 solana_program::program::invoke(&instruction, &account_infos)
236 } else {
237 solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds)
238 }
239 }
240}
241
242#[derive(Clone, Debug)]
250pub struct SetConfigAdminCpiBuilder<'a, 'b> {
251 instruction: Box<SetConfigAdminCpiBuilderInstruction<'a, 'b>>,
252}
253
254impl<'a, 'b> SetConfigAdminCpiBuilder<'a, 'b> {
255 pub fn new(program: &'b solana_program::account_info::AccountInfo<'a>) -> Self {
256 let instruction = Box::new(SetConfigAdminCpiBuilderInstruction {
257 __program: program,
258 config: None,
259 old_admin: None,
260 new_admin: None,
261 __remaining_accounts: Vec::new(),
262 });
263 Self { instruction }
264 }
265 #[inline(always)]
266 pub fn config(
267 &mut self,
268 config: &'b solana_program::account_info::AccountInfo<'a>,
269 ) -> &mut Self {
270 self.instruction.config = Some(config);
271 self
272 }
273 #[inline(always)]
274 pub fn old_admin(
275 &mut self,
276 old_admin: &'b solana_program::account_info::AccountInfo<'a>,
277 ) -> &mut Self {
278 self.instruction.old_admin = Some(old_admin);
279 self
280 }
281 #[inline(always)]
282 pub fn new_admin(
283 &mut self,
284 new_admin: &'b solana_program::account_info::AccountInfo<'a>,
285 ) -> &mut Self {
286 self.instruction.new_admin = Some(new_admin);
287 self
288 }
289 #[inline(always)]
291 pub fn add_remaining_account(
292 &mut self,
293 account: &'b solana_program::account_info::AccountInfo<'a>,
294 is_writable: bool,
295 is_signer: bool,
296 ) -> &mut Self {
297 self.instruction
298 .__remaining_accounts
299 .push((account, is_writable, is_signer));
300 self
301 }
302 #[inline(always)]
307 pub fn add_remaining_accounts(
308 &mut self,
309 accounts: &[(
310 &'b solana_program::account_info::AccountInfo<'a>,
311 bool,
312 bool,
313 )],
314 ) -> &mut Self {
315 self.instruction
316 .__remaining_accounts
317 .extend_from_slice(accounts);
318 self
319 }
320 #[inline(always)]
321 pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult {
322 self.invoke_signed(&[])
323 }
324 #[allow(clippy::clone_on_copy)]
325 #[allow(clippy::vec_init_then_push)]
326 pub fn invoke_signed(
327 &self,
328 signers_seeds: &[&[&[u8]]],
329 ) -> solana_program::entrypoint::ProgramResult {
330 let instruction = SetConfigAdminCpi {
331 __program: self.instruction.__program,
332
333 config: self.instruction.config.expect("config is not set"),
334
335 old_admin: self.instruction.old_admin.expect("old_admin is not set"),
336
337 new_admin: self.instruction.new_admin.expect("new_admin is not set"),
338 };
339 instruction.invoke_signed_with_remaining_accounts(
340 signers_seeds,
341 &self.instruction.__remaining_accounts,
342 )
343 }
344}
345
346#[derive(Clone, Debug)]
347struct SetConfigAdminCpiBuilderInstruction<'a, 'b> {
348 __program: &'b solana_program::account_info::AccountInfo<'a>,
349 config: Option<&'b solana_program::account_info::AccountInfo<'a>>,
350 old_admin: Option<&'b solana_program::account_info::AccountInfo<'a>>,
351 new_admin: Option<&'b solana_program::account_info::AccountInfo<'a>>,
352 __remaining_accounts: Vec<(
354 &'b solana_program::account_info::AccountInfo<'a>,
355 bool,
356 bool,
357 )>,
358}