jito_restaking_client/generated/instructions/
operator_set_fee.rs1use borsh::{BorshDeserialize, BorshSerialize};
8
9pub struct OperatorSetFee {
11 pub config: solana_program::pubkey::Pubkey,
12
13 pub operator: solana_program::pubkey::Pubkey,
14
15 pub admin: solana_program::pubkey::Pubkey,
16}
17
18impl OperatorSetFee {
19 pub fn instruction(
20 &self,
21 args: OperatorSetFeeInstructionArgs,
22 ) -> solana_program::instruction::Instruction {
23 self.instruction_with_remaining_accounts(args, &[])
24 }
25 #[allow(clippy::vec_init_then_push)]
26 pub fn instruction_with_remaining_accounts(
27 &self,
28 args: OperatorSetFeeInstructionArgs,
29 remaining_accounts: &[solana_program::instruction::AccountMeta],
30 ) -> solana_program::instruction::Instruction {
31 let mut accounts = Vec::with_capacity(3 + remaining_accounts.len());
32 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
33 self.config,
34 false,
35 ));
36 accounts.push(solana_program::instruction::AccountMeta::new(
37 self.operator,
38 false,
39 ));
40 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
41 self.admin, true,
42 ));
43 accounts.extend_from_slice(remaining_accounts);
44 let mut data = OperatorSetFeeInstructionData::new().try_to_vec().unwrap();
45 let mut args = args.try_to_vec().unwrap();
46 data.append(&mut args);
47
48 solana_program::instruction::Instruction {
49 program_id: crate::JITO_RESTAKING_ID,
50 accounts,
51 data,
52 }
53 }
54}
55
56#[derive(BorshDeserialize, BorshSerialize)]
57pub struct OperatorSetFeeInstructionData {
58 discriminator: u8,
59}
60
61impl OperatorSetFeeInstructionData {
62 pub fn new() -> Self {
63 Self { discriminator: 21 }
64 }
65}
66
67impl Default for OperatorSetFeeInstructionData {
68 fn default() -> Self {
69 Self::new()
70 }
71}
72
73#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)]
74#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
75pub struct OperatorSetFeeInstructionArgs {
76 pub new_fee_bps: u16,
77}
78
79#[derive(Clone, Debug, Default)]
87pub struct OperatorSetFeeBuilder {
88 config: Option<solana_program::pubkey::Pubkey>,
89 operator: Option<solana_program::pubkey::Pubkey>,
90 admin: Option<solana_program::pubkey::Pubkey>,
91 new_fee_bps: Option<u16>,
92 __remaining_accounts: Vec<solana_program::instruction::AccountMeta>,
93}
94
95impl OperatorSetFeeBuilder {
96 pub fn new() -> Self {
97 Self::default()
98 }
99 #[inline(always)]
100 pub fn config(&mut self, config: solana_program::pubkey::Pubkey) -> &mut Self {
101 self.config = Some(config);
102 self
103 }
104 #[inline(always)]
105 pub fn operator(&mut self, operator: solana_program::pubkey::Pubkey) -> &mut Self {
106 self.operator = Some(operator);
107 self
108 }
109 #[inline(always)]
110 pub fn admin(&mut self, admin: solana_program::pubkey::Pubkey) -> &mut Self {
111 self.admin = Some(admin);
112 self
113 }
114 #[inline(always)]
115 pub fn new_fee_bps(&mut self, new_fee_bps: u16) -> &mut Self {
116 self.new_fee_bps = Some(new_fee_bps);
117 self
118 }
119 #[inline(always)]
121 pub fn add_remaining_account(
122 &mut self,
123 account: solana_program::instruction::AccountMeta,
124 ) -> &mut Self {
125 self.__remaining_accounts.push(account);
126 self
127 }
128 #[inline(always)]
130 pub fn add_remaining_accounts(
131 &mut self,
132 accounts: &[solana_program::instruction::AccountMeta],
133 ) -> &mut Self {
134 self.__remaining_accounts.extend_from_slice(accounts);
135 self
136 }
137 #[allow(clippy::clone_on_copy)]
138 pub fn instruction(&self) -> solana_program::instruction::Instruction {
139 let accounts = OperatorSetFee {
140 config: self.config.expect("config is not set"),
141 operator: self.operator.expect("operator is not set"),
142 admin: self.admin.expect("admin is not set"),
143 };
144 let args = OperatorSetFeeInstructionArgs {
145 new_fee_bps: self.new_fee_bps.clone().expect("new_fee_bps is not set"),
146 };
147
148 accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts)
149 }
150}
151
152pub struct OperatorSetFeeCpiAccounts<'a, 'b> {
154 pub config: &'b solana_program::account_info::AccountInfo<'a>,
155
156 pub operator: &'b solana_program::account_info::AccountInfo<'a>,
157
158 pub admin: &'b solana_program::account_info::AccountInfo<'a>,
159}
160
161pub struct OperatorSetFeeCpi<'a, 'b> {
163 pub __program: &'b solana_program::account_info::AccountInfo<'a>,
165
166 pub config: &'b solana_program::account_info::AccountInfo<'a>,
167
168 pub operator: &'b solana_program::account_info::AccountInfo<'a>,
169
170 pub admin: &'b solana_program::account_info::AccountInfo<'a>,
171 pub __args: OperatorSetFeeInstructionArgs,
173}
174
175impl<'a, 'b> OperatorSetFeeCpi<'a, 'b> {
176 pub fn new(
177 program: &'b solana_program::account_info::AccountInfo<'a>,
178 accounts: OperatorSetFeeCpiAccounts<'a, 'b>,
179 args: OperatorSetFeeInstructionArgs,
180 ) -> Self {
181 Self {
182 __program: program,
183 config: accounts.config,
184 operator: accounts.operator,
185 admin: accounts.admin,
186 __args: args,
187 }
188 }
189 #[inline(always)]
190 pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult {
191 self.invoke_signed_with_remaining_accounts(&[], &[])
192 }
193 #[inline(always)]
194 pub fn invoke_with_remaining_accounts(
195 &self,
196 remaining_accounts: &[(
197 &'b solana_program::account_info::AccountInfo<'a>,
198 bool,
199 bool,
200 )],
201 ) -> solana_program::entrypoint::ProgramResult {
202 self.invoke_signed_with_remaining_accounts(&[], remaining_accounts)
203 }
204 #[inline(always)]
205 pub fn invoke_signed(
206 &self,
207 signers_seeds: &[&[&[u8]]],
208 ) -> solana_program::entrypoint::ProgramResult {
209 self.invoke_signed_with_remaining_accounts(signers_seeds, &[])
210 }
211 #[allow(clippy::clone_on_copy)]
212 #[allow(clippy::vec_init_then_push)]
213 pub fn invoke_signed_with_remaining_accounts(
214 &self,
215 signers_seeds: &[&[&[u8]]],
216 remaining_accounts: &[(
217 &'b solana_program::account_info::AccountInfo<'a>,
218 bool,
219 bool,
220 )],
221 ) -> solana_program::entrypoint::ProgramResult {
222 let mut accounts = Vec::with_capacity(3 + remaining_accounts.len());
223 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
224 *self.config.key,
225 false,
226 ));
227 accounts.push(solana_program::instruction::AccountMeta::new(
228 *self.operator.key,
229 false,
230 ));
231 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
232 *self.admin.key,
233 true,
234 ));
235 remaining_accounts.iter().for_each(|remaining_account| {
236 accounts.push(solana_program::instruction::AccountMeta {
237 pubkey: *remaining_account.0.key,
238 is_signer: remaining_account.1,
239 is_writable: remaining_account.2,
240 })
241 });
242 let mut data = OperatorSetFeeInstructionData::new().try_to_vec().unwrap();
243 let mut args = self.__args.try_to_vec().unwrap();
244 data.append(&mut args);
245
246 let instruction = solana_program::instruction::Instruction {
247 program_id: crate::JITO_RESTAKING_ID,
248 accounts,
249 data,
250 };
251 let mut account_infos = Vec::with_capacity(3 + 1 + remaining_accounts.len());
252 account_infos.push(self.__program.clone());
253 account_infos.push(self.config.clone());
254 account_infos.push(self.operator.clone());
255 account_infos.push(self.admin.clone());
256 remaining_accounts
257 .iter()
258 .for_each(|remaining_account| account_infos.push(remaining_account.0.clone()));
259
260 if signers_seeds.is_empty() {
261 solana_program::program::invoke(&instruction, &account_infos)
262 } else {
263 solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds)
264 }
265 }
266}
267
268#[derive(Clone, Debug)]
276pub struct OperatorSetFeeCpiBuilder<'a, 'b> {
277 instruction: Box<OperatorSetFeeCpiBuilderInstruction<'a, 'b>>,
278}
279
280impl<'a, 'b> OperatorSetFeeCpiBuilder<'a, 'b> {
281 pub fn new(program: &'b solana_program::account_info::AccountInfo<'a>) -> Self {
282 let instruction = Box::new(OperatorSetFeeCpiBuilderInstruction {
283 __program: program,
284 config: None,
285 operator: None,
286 admin: None,
287 new_fee_bps: None,
288 __remaining_accounts: Vec::new(),
289 });
290 Self { instruction }
291 }
292 #[inline(always)]
293 pub fn config(
294 &mut self,
295 config: &'b solana_program::account_info::AccountInfo<'a>,
296 ) -> &mut Self {
297 self.instruction.config = Some(config);
298 self
299 }
300 #[inline(always)]
301 pub fn operator(
302 &mut self,
303 operator: &'b solana_program::account_info::AccountInfo<'a>,
304 ) -> &mut Self {
305 self.instruction.operator = Some(operator);
306 self
307 }
308 #[inline(always)]
309 pub fn admin(&mut self, admin: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self {
310 self.instruction.admin = Some(admin);
311 self
312 }
313 #[inline(always)]
314 pub fn new_fee_bps(&mut self, new_fee_bps: u16) -> &mut Self {
315 self.instruction.new_fee_bps = Some(new_fee_bps);
316 self
317 }
318 #[inline(always)]
320 pub fn add_remaining_account(
321 &mut self,
322 account: &'b solana_program::account_info::AccountInfo<'a>,
323 is_writable: bool,
324 is_signer: bool,
325 ) -> &mut Self {
326 self.instruction
327 .__remaining_accounts
328 .push((account, is_writable, is_signer));
329 self
330 }
331 #[inline(always)]
336 pub fn add_remaining_accounts(
337 &mut self,
338 accounts: &[(
339 &'b solana_program::account_info::AccountInfo<'a>,
340 bool,
341 bool,
342 )],
343 ) -> &mut Self {
344 self.instruction
345 .__remaining_accounts
346 .extend_from_slice(accounts);
347 self
348 }
349 #[inline(always)]
350 pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult {
351 self.invoke_signed(&[])
352 }
353 #[allow(clippy::clone_on_copy)]
354 #[allow(clippy::vec_init_then_push)]
355 pub fn invoke_signed(
356 &self,
357 signers_seeds: &[&[&[u8]]],
358 ) -> solana_program::entrypoint::ProgramResult {
359 let args = OperatorSetFeeInstructionArgs {
360 new_fee_bps: self
361 .instruction
362 .new_fee_bps
363 .clone()
364 .expect("new_fee_bps is not set"),
365 };
366 let instruction = OperatorSetFeeCpi {
367 __program: self.instruction.__program,
368
369 config: self.instruction.config.expect("config is not set"),
370
371 operator: self.instruction.operator.expect("operator is not set"),
372
373 admin: self.instruction.admin.expect("admin is not set"),
374 __args: args,
375 };
376 instruction.invoke_signed_with_remaining_accounts(
377 signers_seeds,
378 &self.instruction.__remaining_accounts,
379 )
380 }
381}
382
383#[derive(Clone, Debug)]
384struct OperatorSetFeeCpiBuilderInstruction<'a, 'b> {
385 __program: &'b solana_program::account_info::AccountInfo<'a>,
386 config: Option<&'b solana_program::account_info::AccountInfo<'a>>,
387 operator: Option<&'b solana_program::account_info::AccountInfo<'a>>,
388 admin: Option<&'b solana_program::account_info::AccountInfo<'a>>,
389 new_fee_bps: Option<u16>,
390 __remaining_accounts: Vec<(
392 &'b solana_program::account_info::AccountInfo<'a>,
393 bool,
394 bool,
395 )>,
396}