Skip to main content

defituna_staking/generated/instructions/
swap_reward_two_hop_orca.rs

1//! This code was AUTOGENERATED using the codama library.
2//! Please DO NOT EDIT THIS FILE, instead use visitors
3//! to add features, then rerun codama to update it.
4//!
5//! <https://github.com/codama-idl/codama>
6//!
7
8use borsh::BorshSerialize;
9use borsh::BorshDeserialize;
10
11/// Accounts.
12#[derive(Debug)]
13pub struct SwapRewardTwoHopOrca {
14      
15              
16          pub authority: solana_pubkey::Pubkey,
17          
18              
19          pub treasury: solana_pubkey::Pubkey,
20          
21              
22          pub input_token_mint: solana_pubkey::Pubkey,
23          
24              
25          pub intermediate_token_mint: solana_pubkey::Pubkey,
26          
27              
28          pub reward_token_mint: solana_pubkey::Pubkey,
29          
30              
31          pub input_token_program: solana_pubkey::Pubkey,
32          
33              
34          pub intermediate_token_program: solana_pubkey::Pubkey,
35          
36              
37          pub reward_token_program: solana_pubkey::Pubkey,
38          
39              
40          pub input_token_account: solana_pubkey::Pubkey,
41          
42              
43          pub reward_token_account: solana_pubkey::Pubkey,
44          
45              
46          pub whirlpool_program: solana_pubkey::Pubkey,
47          
48              
49          pub whirlpool_one: solana_pubkey::Pubkey,
50          
51              
52          pub whirlpool_two: solana_pubkey::Pubkey,
53          
54              
55          pub memo_program: solana_pubkey::Pubkey,
56      }
57
58impl SwapRewardTwoHopOrca {
59  pub fn instruction(&self) -> solana_instruction::Instruction {
60    self.instruction_with_remaining_accounts(&[])
61  }
62  #[allow(clippy::arithmetic_side_effects)]
63  #[allow(clippy::vec_init_then_push)]
64  pub fn instruction_with_remaining_accounts(&self, remaining_accounts: &[solana_instruction::AccountMeta]) -> solana_instruction::Instruction {
65    let mut accounts = Vec::with_capacity(14+ remaining_accounts.len());
66                            accounts.push(solana_instruction::AccountMeta::new(
67            self.authority,
68            true
69          ));
70                                          accounts.push(solana_instruction::AccountMeta::new(
71            self.treasury,
72            false
73          ));
74                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
75            self.input_token_mint,
76            false
77          ));
78                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
79            self.intermediate_token_mint,
80            false
81          ));
82                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
83            self.reward_token_mint,
84            false
85          ));
86                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
87            self.input_token_program,
88            false
89          ));
90                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
91            self.intermediate_token_program,
92            false
93          ));
94                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
95            self.reward_token_program,
96            false
97          ));
98                                          accounts.push(solana_instruction::AccountMeta::new(
99            self.input_token_account,
100            false
101          ));
102                                          accounts.push(solana_instruction::AccountMeta::new(
103            self.reward_token_account,
104            false
105          ));
106                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
107            self.whirlpool_program,
108            false
109          ));
110                                          accounts.push(solana_instruction::AccountMeta::new(
111            self.whirlpool_one,
112            false
113          ));
114                                          accounts.push(solana_instruction::AccountMeta::new(
115            self.whirlpool_two,
116            false
117          ));
118                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
119            self.memo_program,
120            false
121          ));
122                      accounts.extend_from_slice(remaining_accounts);
123    let data = borsh::to_vec(&SwapRewardTwoHopOrcaInstructionData::new()).unwrap();
124    
125    solana_instruction::Instruction {
126      program_id: crate::TUNA_STAKING_ID,
127      accounts,
128      data,
129    }
130  }
131}
132
133#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)]
134#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
135 pub struct SwapRewardTwoHopOrcaInstructionData {
136            discriminator: [u8; 8],
137      }
138
139impl SwapRewardTwoHopOrcaInstructionData {
140  pub fn new() -> Self {
141    Self {
142                        discriminator: [64, 141, 251, 215, 20, 61, 93, 12],
143                  }
144  }
145}
146
147impl Default for SwapRewardTwoHopOrcaInstructionData {
148  fn default() -> Self {
149    Self::new()
150  }
151}
152
153
154
155/// Instruction builder for `SwapRewardTwoHopOrca`.
156///
157/// ### Accounts:
158///
159                      ///   0. `[writable, signer]` authority
160                ///   1. `[writable]` treasury
161          ///   2. `[]` input_token_mint
162          ///   3. `[]` intermediate_token_mint
163          ///   4. `[]` reward_token_mint
164          ///   5. `[]` input_token_program
165          ///   6. `[]` intermediate_token_program
166          ///   7. `[]` reward_token_program
167                ///   8. `[writable]` input_token_account
168                ///   9. `[writable]` reward_token_account
169          ///   10. `[]` whirlpool_program
170                ///   11. `[writable]` whirlpool_one
171                ///   12. `[writable]` whirlpool_two
172          ///   13. `[]` memo_program
173#[derive(Clone, Debug, Default)]
174pub struct SwapRewardTwoHopOrcaBuilder {
175            authority: Option<solana_pubkey::Pubkey>,
176                treasury: Option<solana_pubkey::Pubkey>,
177                input_token_mint: Option<solana_pubkey::Pubkey>,
178                intermediate_token_mint: Option<solana_pubkey::Pubkey>,
179                reward_token_mint: Option<solana_pubkey::Pubkey>,
180                input_token_program: Option<solana_pubkey::Pubkey>,
181                intermediate_token_program: Option<solana_pubkey::Pubkey>,
182                reward_token_program: Option<solana_pubkey::Pubkey>,
183                input_token_account: Option<solana_pubkey::Pubkey>,
184                reward_token_account: Option<solana_pubkey::Pubkey>,
185                whirlpool_program: Option<solana_pubkey::Pubkey>,
186                whirlpool_one: Option<solana_pubkey::Pubkey>,
187                whirlpool_two: Option<solana_pubkey::Pubkey>,
188                memo_program: Option<solana_pubkey::Pubkey>,
189                __remaining_accounts: Vec<solana_instruction::AccountMeta>,
190}
191
192impl SwapRewardTwoHopOrcaBuilder {
193  pub fn new() -> Self {
194    Self::default()
195  }
196            #[inline(always)]
197    pub fn authority(&mut self, authority: solana_pubkey::Pubkey) -> &mut Self {
198                        self.authority = Some(authority);
199                    self
200    }
201            #[inline(always)]
202    pub fn treasury(&mut self, treasury: solana_pubkey::Pubkey) -> &mut Self {
203                        self.treasury = Some(treasury);
204                    self
205    }
206            #[inline(always)]
207    pub fn input_token_mint(&mut self, input_token_mint: solana_pubkey::Pubkey) -> &mut Self {
208                        self.input_token_mint = Some(input_token_mint);
209                    self
210    }
211            #[inline(always)]
212    pub fn intermediate_token_mint(&mut self, intermediate_token_mint: solana_pubkey::Pubkey) -> &mut Self {
213                        self.intermediate_token_mint = Some(intermediate_token_mint);
214                    self
215    }
216            #[inline(always)]
217    pub fn reward_token_mint(&mut self, reward_token_mint: solana_pubkey::Pubkey) -> &mut Self {
218                        self.reward_token_mint = Some(reward_token_mint);
219                    self
220    }
221            #[inline(always)]
222    pub fn input_token_program(&mut self, input_token_program: solana_pubkey::Pubkey) -> &mut Self {
223                        self.input_token_program = Some(input_token_program);
224                    self
225    }
226            #[inline(always)]
227    pub fn intermediate_token_program(&mut self, intermediate_token_program: solana_pubkey::Pubkey) -> &mut Self {
228                        self.intermediate_token_program = Some(intermediate_token_program);
229                    self
230    }
231            #[inline(always)]
232    pub fn reward_token_program(&mut self, reward_token_program: solana_pubkey::Pubkey) -> &mut Self {
233                        self.reward_token_program = Some(reward_token_program);
234                    self
235    }
236            #[inline(always)]
237    pub fn input_token_account(&mut self, input_token_account: solana_pubkey::Pubkey) -> &mut Self {
238                        self.input_token_account = Some(input_token_account);
239                    self
240    }
241            #[inline(always)]
242    pub fn reward_token_account(&mut self, reward_token_account: solana_pubkey::Pubkey) -> &mut Self {
243                        self.reward_token_account = Some(reward_token_account);
244                    self
245    }
246            #[inline(always)]
247    pub fn whirlpool_program(&mut self, whirlpool_program: solana_pubkey::Pubkey) -> &mut Self {
248                        self.whirlpool_program = Some(whirlpool_program);
249                    self
250    }
251            #[inline(always)]
252    pub fn whirlpool_one(&mut self, whirlpool_one: solana_pubkey::Pubkey) -> &mut Self {
253                        self.whirlpool_one = Some(whirlpool_one);
254                    self
255    }
256            #[inline(always)]
257    pub fn whirlpool_two(&mut self, whirlpool_two: solana_pubkey::Pubkey) -> &mut Self {
258                        self.whirlpool_two = Some(whirlpool_two);
259                    self
260    }
261            #[inline(always)]
262    pub fn memo_program(&mut self, memo_program: solana_pubkey::Pubkey) -> &mut Self {
263                        self.memo_program = Some(memo_program);
264                    self
265    }
266            /// Add an additional account to the instruction.
267  #[inline(always)]
268  pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self {
269    self.__remaining_accounts.push(account);
270    self
271  }
272  /// Add additional accounts to the instruction.
273  #[inline(always)]
274  pub fn add_remaining_accounts(&mut self, accounts: &[solana_instruction::AccountMeta]) -> &mut Self {
275    self.__remaining_accounts.extend_from_slice(accounts);
276    self
277  }
278  #[allow(clippy::clone_on_copy)]
279  pub fn instruction(&self) -> solana_instruction::Instruction {
280    let accounts = SwapRewardTwoHopOrca {
281                              authority: self.authority.expect("authority is not set"),
282                                        treasury: self.treasury.expect("treasury is not set"),
283                                        input_token_mint: self.input_token_mint.expect("input_token_mint is not set"),
284                                        intermediate_token_mint: self.intermediate_token_mint.expect("intermediate_token_mint is not set"),
285                                        reward_token_mint: self.reward_token_mint.expect("reward_token_mint is not set"),
286                                        input_token_program: self.input_token_program.expect("input_token_program is not set"),
287                                        intermediate_token_program: self.intermediate_token_program.expect("intermediate_token_program is not set"),
288                                        reward_token_program: self.reward_token_program.expect("reward_token_program is not set"),
289                                        input_token_account: self.input_token_account.expect("input_token_account is not set"),
290                                        reward_token_account: self.reward_token_account.expect("reward_token_account is not set"),
291                                        whirlpool_program: self.whirlpool_program.expect("whirlpool_program is not set"),
292                                        whirlpool_one: self.whirlpool_one.expect("whirlpool_one is not set"),
293                                        whirlpool_two: self.whirlpool_two.expect("whirlpool_two is not set"),
294                                        memo_program: self.memo_program.expect("memo_program is not set"),
295                      };
296    
297    accounts.instruction_with_remaining_accounts(&self.__remaining_accounts)
298  }
299}
300
301  /// `swap_reward_two_hop_orca` CPI accounts.
302  pub struct SwapRewardTwoHopOrcaCpiAccounts<'a, 'b> {
303          
304                    
305              pub authority: &'b solana_account_info::AccountInfo<'a>,
306                
307                    
308              pub treasury: &'b solana_account_info::AccountInfo<'a>,
309                
310                    
311              pub input_token_mint: &'b solana_account_info::AccountInfo<'a>,
312                
313                    
314              pub intermediate_token_mint: &'b solana_account_info::AccountInfo<'a>,
315                
316                    
317              pub reward_token_mint: &'b solana_account_info::AccountInfo<'a>,
318                
319                    
320              pub input_token_program: &'b solana_account_info::AccountInfo<'a>,
321                
322                    
323              pub intermediate_token_program: &'b solana_account_info::AccountInfo<'a>,
324                
325                    
326              pub reward_token_program: &'b solana_account_info::AccountInfo<'a>,
327                
328                    
329              pub input_token_account: &'b solana_account_info::AccountInfo<'a>,
330                
331                    
332              pub reward_token_account: &'b solana_account_info::AccountInfo<'a>,
333                
334                    
335              pub whirlpool_program: &'b solana_account_info::AccountInfo<'a>,
336                
337                    
338              pub whirlpool_one: &'b solana_account_info::AccountInfo<'a>,
339                
340                    
341              pub whirlpool_two: &'b solana_account_info::AccountInfo<'a>,
342                
343                    
344              pub memo_program: &'b solana_account_info::AccountInfo<'a>,
345            }
346
347/// `swap_reward_two_hop_orca` CPI instruction.
348pub struct SwapRewardTwoHopOrcaCpi<'a, 'b> {
349  /// The program to invoke.
350  pub __program: &'b solana_account_info::AccountInfo<'a>,
351      
352              
353          pub authority: &'b solana_account_info::AccountInfo<'a>,
354          
355              
356          pub treasury: &'b solana_account_info::AccountInfo<'a>,
357          
358              
359          pub input_token_mint: &'b solana_account_info::AccountInfo<'a>,
360          
361              
362          pub intermediate_token_mint: &'b solana_account_info::AccountInfo<'a>,
363          
364              
365          pub reward_token_mint: &'b solana_account_info::AccountInfo<'a>,
366          
367              
368          pub input_token_program: &'b solana_account_info::AccountInfo<'a>,
369          
370              
371          pub intermediate_token_program: &'b solana_account_info::AccountInfo<'a>,
372          
373              
374          pub reward_token_program: &'b solana_account_info::AccountInfo<'a>,
375          
376              
377          pub input_token_account: &'b solana_account_info::AccountInfo<'a>,
378          
379              
380          pub reward_token_account: &'b solana_account_info::AccountInfo<'a>,
381          
382              
383          pub whirlpool_program: &'b solana_account_info::AccountInfo<'a>,
384          
385              
386          pub whirlpool_one: &'b solana_account_info::AccountInfo<'a>,
387          
388              
389          pub whirlpool_two: &'b solana_account_info::AccountInfo<'a>,
390          
391              
392          pub memo_program: &'b solana_account_info::AccountInfo<'a>,
393        }
394
395impl<'a, 'b> SwapRewardTwoHopOrcaCpi<'a, 'b> {
396  pub fn new(
397    program: &'b solana_account_info::AccountInfo<'a>,
398          accounts: SwapRewardTwoHopOrcaCpiAccounts<'a, 'b>,
399          ) -> Self {
400    Self {
401      __program: program,
402              authority: accounts.authority,
403              treasury: accounts.treasury,
404              input_token_mint: accounts.input_token_mint,
405              intermediate_token_mint: accounts.intermediate_token_mint,
406              reward_token_mint: accounts.reward_token_mint,
407              input_token_program: accounts.input_token_program,
408              intermediate_token_program: accounts.intermediate_token_program,
409              reward_token_program: accounts.reward_token_program,
410              input_token_account: accounts.input_token_account,
411              reward_token_account: accounts.reward_token_account,
412              whirlpool_program: accounts.whirlpool_program,
413              whirlpool_one: accounts.whirlpool_one,
414              whirlpool_two: accounts.whirlpool_two,
415              memo_program: accounts.memo_program,
416                }
417  }
418  #[inline(always)]
419  pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult {
420    self.invoke_signed_with_remaining_accounts(&[], &[])
421  }
422  #[inline(always)]
423  pub fn invoke_with_remaining_accounts(&self, remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)]) -> solana_program_entrypoint::ProgramResult {
424    self.invoke_signed_with_remaining_accounts(&[], remaining_accounts)
425  }
426  #[inline(always)]
427  pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_entrypoint::ProgramResult {
428    self.invoke_signed_with_remaining_accounts(signers_seeds, &[])
429  }
430  #[allow(clippy::arithmetic_side_effects)]
431  #[allow(clippy::clone_on_copy)]
432  #[allow(clippy::vec_init_then_push)]
433  pub fn invoke_signed_with_remaining_accounts(
434    &self,
435    signers_seeds: &[&[&[u8]]],
436    remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)]
437  ) -> solana_program_entrypoint::ProgramResult {
438    let mut accounts = Vec::with_capacity(14+ remaining_accounts.len());
439                            accounts.push(solana_instruction::AccountMeta::new(
440            *self.authority.key,
441            true
442          ));
443                                          accounts.push(solana_instruction::AccountMeta::new(
444            *self.treasury.key,
445            false
446          ));
447                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
448            *self.input_token_mint.key,
449            false
450          ));
451                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
452            *self.intermediate_token_mint.key,
453            false
454          ));
455                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
456            *self.reward_token_mint.key,
457            false
458          ));
459                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
460            *self.input_token_program.key,
461            false
462          ));
463                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
464            *self.intermediate_token_program.key,
465            false
466          ));
467                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
468            *self.reward_token_program.key,
469            false
470          ));
471                                          accounts.push(solana_instruction::AccountMeta::new(
472            *self.input_token_account.key,
473            false
474          ));
475                                          accounts.push(solana_instruction::AccountMeta::new(
476            *self.reward_token_account.key,
477            false
478          ));
479                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
480            *self.whirlpool_program.key,
481            false
482          ));
483                                          accounts.push(solana_instruction::AccountMeta::new(
484            *self.whirlpool_one.key,
485            false
486          ));
487                                          accounts.push(solana_instruction::AccountMeta::new(
488            *self.whirlpool_two.key,
489            false
490          ));
491                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
492            *self.memo_program.key,
493            false
494          ));
495                      remaining_accounts.iter().for_each(|remaining_account| {
496      accounts.push(solana_instruction::AccountMeta {
497          pubkey: *remaining_account.0.key,
498          is_signer: remaining_account.1,
499          is_writable: remaining_account.2,
500      })
501    });
502    let data = borsh::to_vec(&SwapRewardTwoHopOrcaInstructionData::new()).unwrap();
503    
504    let instruction = solana_instruction::Instruction {
505      program_id: crate::TUNA_STAKING_ID,
506      accounts,
507      data,
508    };
509    let mut account_infos = Vec::with_capacity(15 + remaining_accounts.len());
510    account_infos.push(self.__program.clone());
511                  account_infos.push(self.authority.clone());
512                        account_infos.push(self.treasury.clone());
513                        account_infos.push(self.input_token_mint.clone());
514                        account_infos.push(self.intermediate_token_mint.clone());
515                        account_infos.push(self.reward_token_mint.clone());
516                        account_infos.push(self.input_token_program.clone());
517                        account_infos.push(self.intermediate_token_program.clone());
518                        account_infos.push(self.reward_token_program.clone());
519                        account_infos.push(self.input_token_account.clone());
520                        account_infos.push(self.reward_token_account.clone());
521                        account_infos.push(self.whirlpool_program.clone());
522                        account_infos.push(self.whirlpool_one.clone());
523                        account_infos.push(self.whirlpool_two.clone());
524                        account_infos.push(self.memo_program.clone());
525              remaining_accounts.iter().for_each(|remaining_account| account_infos.push(remaining_account.0.clone()));
526
527    if signers_seeds.is_empty() {
528      solana_cpi::invoke(&instruction, &account_infos)
529    } else {
530      solana_cpi::invoke_signed(&instruction, &account_infos, signers_seeds)
531    }
532  }
533}
534
535/// Instruction builder for `SwapRewardTwoHopOrca` via CPI.
536///
537/// ### Accounts:
538///
539                      ///   0. `[writable, signer]` authority
540                ///   1. `[writable]` treasury
541          ///   2. `[]` input_token_mint
542          ///   3. `[]` intermediate_token_mint
543          ///   4. `[]` reward_token_mint
544          ///   5. `[]` input_token_program
545          ///   6. `[]` intermediate_token_program
546          ///   7. `[]` reward_token_program
547                ///   8. `[writable]` input_token_account
548                ///   9. `[writable]` reward_token_account
549          ///   10. `[]` whirlpool_program
550                ///   11. `[writable]` whirlpool_one
551                ///   12. `[writable]` whirlpool_two
552          ///   13. `[]` memo_program
553#[derive(Clone, Debug)]
554pub struct SwapRewardTwoHopOrcaCpiBuilder<'a, 'b> {
555  instruction: Box<SwapRewardTwoHopOrcaCpiBuilderInstruction<'a, 'b>>,
556}
557
558impl<'a, 'b> SwapRewardTwoHopOrcaCpiBuilder<'a, 'b> {
559  pub fn new(program: &'b solana_account_info::AccountInfo<'a>) -> Self {
560    let instruction = Box::new(SwapRewardTwoHopOrcaCpiBuilderInstruction {
561      __program: program,
562              authority: None,
563              treasury: None,
564              input_token_mint: None,
565              intermediate_token_mint: None,
566              reward_token_mint: None,
567              input_token_program: None,
568              intermediate_token_program: None,
569              reward_token_program: None,
570              input_token_account: None,
571              reward_token_account: None,
572              whirlpool_program: None,
573              whirlpool_one: None,
574              whirlpool_two: None,
575              memo_program: None,
576                                __remaining_accounts: Vec::new(),
577    });
578    Self { instruction }
579  }
580      #[inline(always)]
581    pub fn authority(&mut self, authority: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
582                        self.instruction.authority = Some(authority);
583                    self
584    }
585      #[inline(always)]
586    pub fn treasury(&mut self, treasury: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
587                        self.instruction.treasury = Some(treasury);
588                    self
589    }
590      #[inline(always)]
591    pub fn input_token_mint(&mut self, input_token_mint: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
592                        self.instruction.input_token_mint = Some(input_token_mint);
593                    self
594    }
595      #[inline(always)]
596    pub fn intermediate_token_mint(&mut self, intermediate_token_mint: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
597                        self.instruction.intermediate_token_mint = Some(intermediate_token_mint);
598                    self
599    }
600      #[inline(always)]
601    pub fn reward_token_mint(&mut self, reward_token_mint: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
602                        self.instruction.reward_token_mint = Some(reward_token_mint);
603                    self
604    }
605      #[inline(always)]
606    pub fn input_token_program(&mut self, input_token_program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
607                        self.instruction.input_token_program = Some(input_token_program);
608                    self
609    }
610      #[inline(always)]
611    pub fn intermediate_token_program(&mut self, intermediate_token_program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
612                        self.instruction.intermediate_token_program = Some(intermediate_token_program);
613                    self
614    }
615      #[inline(always)]
616    pub fn reward_token_program(&mut self, reward_token_program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
617                        self.instruction.reward_token_program = Some(reward_token_program);
618                    self
619    }
620      #[inline(always)]
621    pub fn input_token_account(&mut self, input_token_account: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
622                        self.instruction.input_token_account = Some(input_token_account);
623                    self
624    }
625      #[inline(always)]
626    pub fn reward_token_account(&mut self, reward_token_account: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
627                        self.instruction.reward_token_account = Some(reward_token_account);
628                    self
629    }
630      #[inline(always)]
631    pub fn whirlpool_program(&mut self, whirlpool_program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
632                        self.instruction.whirlpool_program = Some(whirlpool_program);
633                    self
634    }
635      #[inline(always)]
636    pub fn whirlpool_one(&mut self, whirlpool_one: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
637                        self.instruction.whirlpool_one = Some(whirlpool_one);
638                    self
639    }
640      #[inline(always)]
641    pub fn whirlpool_two(&mut self, whirlpool_two: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
642                        self.instruction.whirlpool_two = Some(whirlpool_two);
643                    self
644    }
645      #[inline(always)]
646    pub fn memo_program(&mut self, memo_program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
647                        self.instruction.memo_program = Some(memo_program);
648                    self
649    }
650            /// Add an additional account to the instruction.
651  #[inline(always)]
652  pub fn add_remaining_account(&mut self, account: &'b solana_account_info::AccountInfo<'a>, is_writable: bool, is_signer: bool) -> &mut Self {
653    self.instruction.__remaining_accounts.push((account, is_writable, is_signer));
654    self
655  }
656  /// Add additional accounts to the instruction.
657  ///
658  /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not,
659  /// and a `bool` indicating whether the account is a signer or not.
660  #[inline(always)]
661  pub fn add_remaining_accounts(&mut self, accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)]) -> &mut Self {
662    self.instruction.__remaining_accounts.extend_from_slice(accounts);
663    self
664  }
665  #[inline(always)]
666  pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult {
667    self.invoke_signed(&[])
668  }
669  #[allow(clippy::clone_on_copy)]
670  #[allow(clippy::vec_init_then_push)]
671  pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_entrypoint::ProgramResult {
672        let instruction = SwapRewardTwoHopOrcaCpi {
673        __program: self.instruction.__program,
674                  
675          authority: self.instruction.authority.expect("authority is not set"),
676                  
677          treasury: self.instruction.treasury.expect("treasury is not set"),
678                  
679          input_token_mint: self.instruction.input_token_mint.expect("input_token_mint is not set"),
680                  
681          intermediate_token_mint: self.instruction.intermediate_token_mint.expect("intermediate_token_mint is not set"),
682                  
683          reward_token_mint: self.instruction.reward_token_mint.expect("reward_token_mint is not set"),
684                  
685          input_token_program: self.instruction.input_token_program.expect("input_token_program is not set"),
686                  
687          intermediate_token_program: self.instruction.intermediate_token_program.expect("intermediate_token_program is not set"),
688                  
689          reward_token_program: self.instruction.reward_token_program.expect("reward_token_program is not set"),
690                  
691          input_token_account: self.instruction.input_token_account.expect("input_token_account is not set"),
692                  
693          reward_token_account: self.instruction.reward_token_account.expect("reward_token_account is not set"),
694                  
695          whirlpool_program: self.instruction.whirlpool_program.expect("whirlpool_program is not set"),
696                  
697          whirlpool_one: self.instruction.whirlpool_one.expect("whirlpool_one is not set"),
698                  
699          whirlpool_two: self.instruction.whirlpool_two.expect("whirlpool_two is not set"),
700                  
701          memo_program: self.instruction.memo_program.expect("memo_program is not set"),
702                    };
703    instruction.invoke_signed_with_remaining_accounts(signers_seeds, &self.instruction.__remaining_accounts)
704  }
705}
706
707#[derive(Clone, Debug)]
708struct SwapRewardTwoHopOrcaCpiBuilderInstruction<'a, 'b> {
709  __program: &'b solana_account_info::AccountInfo<'a>,
710            authority: Option<&'b solana_account_info::AccountInfo<'a>>,
711                treasury: Option<&'b solana_account_info::AccountInfo<'a>>,
712                input_token_mint: Option<&'b solana_account_info::AccountInfo<'a>>,
713                intermediate_token_mint: Option<&'b solana_account_info::AccountInfo<'a>>,
714                reward_token_mint: Option<&'b solana_account_info::AccountInfo<'a>>,
715                input_token_program: Option<&'b solana_account_info::AccountInfo<'a>>,
716                intermediate_token_program: Option<&'b solana_account_info::AccountInfo<'a>>,
717                reward_token_program: Option<&'b solana_account_info::AccountInfo<'a>>,
718                input_token_account: Option<&'b solana_account_info::AccountInfo<'a>>,
719                reward_token_account: Option<&'b solana_account_info::AccountInfo<'a>>,
720                whirlpool_program: Option<&'b solana_account_info::AccountInfo<'a>>,
721                whirlpool_one: Option<&'b solana_account_info::AccountInfo<'a>>,
722                whirlpool_two: Option<&'b solana_account_info::AccountInfo<'a>>,
723                memo_program: Option<&'b solana_account_info::AccountInfo<'a>>,
724                /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`.
725  __remaining_accounts: Vec<(&'b solana_account_info::AccountInfo<'a>, bool, bool)>,
726}
727