orca_wavebreak/generated/instructions/
lp_harvest.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::BorshDeserialize;
9use borsh::BorshSerialize;
10
11pub const LP_HARVEST_DISCRIMINATOR: u8 = 56;
12
13/// Accounts.
14#[derive(Debug)]
15pub struct LpHarvest {
16    /// The authority of the lp escrow account
17    pub lp_authority: solana_pubkey::Pubkey,
18    /// The LP escrow account
19    pub lp_escrow: solana_pubkey::Pubkey,
20    /// The whirlpool account
21    pub whirlpool: solana_pubkey::Pubkey,
22    /// The position account
23    pub position: solana_pubkey::Pubkey,
24    /// The position token account
25    pub position_token_account: solana_pubkey::Pubkey,
26    /// The lower tick array account
27    pub lower_tick_array: solana_pubkey::Pubkey,
28    /// The upper tick array account
29    pub upper_tick_array: solana_pubkey::Pubkey,
30    /// The token mint a account
31    pub token_a_mint: solana_pubkey::Pubkey,
32    /// The token mint b account
33    pub token_b_mint: solana_pubkey::Pubkey,
34    /// The token owner a account
35    pub token_a_ata: solana_pubkey::Pubkey,
36    /// The token owner b account
37    pub token_b_ata: solana_pubkey::Pubkey,
38    /// The token vault a account
39    pub token_a_vault: solana_pubkey::Pubkey,
40    /// The token vault b account
41    pub token_b_vault: solana_pubkey::Pubkey,
42    /// The reward mint 1 account
43    pub reward1_mint: solana_pubkey::Pubkey,
44    /// The reward mint 2 account
45    pub reward2_mint: solana_pubkey::Pubkey,
46    /// The reward mint 3 account
47    pub reward3_mint: solana_pubkey::Pubkey,
48    /// The reward owner 1 account
49    pub reward1_ata: solana_pubkey::Pubkey,
50    /// The reward owner 2 account
51    pub reward2_ata: solana_pubkey::Pubkey,
52    /// The reward owner 3 account
53    pub reward3_ata: solana_pubkey::Pubkey,
54    /// The reward vault 1 account
55    pub reward1_vault: solana_pubkey::Pubkey,
56    /// The reward vault 2 account
57    pub reward2_vault: solana_pubkey::Pubkey,
58    /// The reward vault 3 account
59    pub reward3_vault: solana_pubkey::Pubkey,
60    /// The system program
61    pub system_program: solana_pubkey::Pubkey,
62    /// The token a program
63    pub token_a_program: solana_pubkey::Pubkey,
64    /// The token b program
65    pub token_b_program: solana_pubkey::Pubkey,
66    /// The token reward 1 program
67    pub reward1_token_program: solana_pubkey::Pubkey,
68    /// The token reward 2 program
69    pub reward2_token_program: solana_pubkey::Pubkey,
70    /// The token reward 3 program
71    pub reward3_token_program: solana_pubkey::Pubkey,
72    /// The ata program
73    pub ata_program: solana_pubkey::Pubkey,
74    /// The memo program
75    pub memo_program: solana_pubkey::Pubkey,
76    /// The whirlpool program
77    pub whirlpool_program: solana_pubkey::Pubkey,
78}
79
80impl LpHarvest {
81    pub fn instruction(&self) -> solana_instruction::Instruction {
82        self.instruction_with_remaining_accounts(&[])
83    }
84    #[allow(clippy::arithmetic_side_effects)]
85    #[allow(clippy::vec_init_then_push)]
86    pub fn instruction_with_remaining_accounts(
87        &self,
88        remaining_accounts: &[solana_instruction::AccountMeta],
89    ) -> solana_instruction::Instruction {
90        let mut accounts = Vec::with_capacity(31 + remaining_accounts.len());
91        accounts.push(solana_instruction::AccountMeta::new(
92            self.lp_authority,
93            true,
94        ));
95        accounts.push(solana_instruction::AccountMeta::new_readonly(
96            self.lp_escrow,
97            false,
98        ));
99        accounts.push(solana_instruction::AccountMeta::new(self.whirlpool, false));
100        accounts.push(solana_instruction::AccountMeta::new(self.position, false));
101        accounts.push(solana_instruction::AccountMeta::new_readonly(
102            self.position_token_account,
103            false,
104        ));
105        accounts.push(solana_instruction::AccountMeta::new_readonly(
106            self.lower_tick_array,
107            false,
108        ));
109        accounts.push(solana_instruction::AccountMeta::new_readonly(
110            self.upper_tick_array,
111            false,
112        ));
113        accounts.push(solana_instruction::AccountMeta::new(
114            self.token_a_mint,
115            false,
116        ));
117        accounts.push(solana_instruction::AccountMeta::new(
118            self.token_b_mint,
119            false,
120        ));
121        accounts.push(solana_instruction::AccountMeta::new(
122            self.token_a_ata,
123            false,
124        ));
125        accounts.push(solana_instruction::AccountMeta::new(
126            self.token_b_ata,
127            false,
128        ));
129        accounts.push(solana_instruction::AccountMeta::new(
130            self.token_a_vault,
131            false,
132        ));
133        accounts.push(solana_instruction::AccountMeta::new(
134            self.token_b_vault,
135            false,
136        ));
137        accounts.push(solana_instruction::AccountMeta::new_readonly(
138            self.reward1_mint,
139            false,
140        ));
141        accounts.push(solana_instruction::AccountMeta::new_readonly(
142            self.reward2_mint,
143            false,
144        ));
145        accounts.push(solana_instruction::AccountMeta::new_readonly(
146            self.reward3_mint,
147            false,
148        ));
149        accounts.push(solana_instruction::AccountMeta::new(
150            self.reward1_ata,
151            false,
152        ));
153        accounts.push(solana_instruction::AccountMeta::new(
154            self.reward2_ata,
155            false,
156        ));
157        accounts.push(solana_instruction::AccountMeta::new(
158            self.reward3_ata,
159            false,
160        ));
161        accounts.push(solana_instruction::AccountMeta::new(
162            self.reward1_vault,
163            false,
164        ));
165        accounts.push(solana_instruction::AccountMeta::new(
166            self.reward2_vault,
167            false,
168        ));
169        accounts.push(solana_instruction::AccountMeta::new(
170            self.reward3_vault,
171            false,
172        ));
173        accounts.push(solana_instruction::AccountMeta::new_readonly(
174            self.system_program,
175            false,
176        ));
177        accounts.push(solana_instruction::AccountMeta::new_readonly(
178            self.token_a_program,
179            false,
180        ));
181        accounts.push(solana_instruction::AccountMeta::new_readonly(
182            self.token_b_program,
183            false,
184        ));
185        accounts.push(solana_instruction::AccountMeta::new_readonly(
186            self.reward1_token_program,
187            false,
188        ));
189        accounts.push(solana_instruction::AccountMeta::new_readonly(
190            self.reward2_token_program,
191            false,
192        ));
193        accounts.push(solana_instruction::AccountMeta::new_readonly(
194            self.reward3_token_program,
195            false,
196        ));
197        accounts.push(solana_instruction::AccountMeta::new_readonly(
198            self.ata_program,
199            false,
200        ));
201        accounts.push(solana_instruction::AccountMeta::new_readonly(
202            self.memo_program,
203            false,
204        ));
205        accounts.push(solana_instruction::AccountMeta::new_readonly(
206            self.whirlpool_program,
207            false,
208        ));
209        accounts.extend_from_slice(remaining_accounts);
210        let data = borsh::to_vec(&LpHarvestInstructionData::new()).unwrap();
211
212        solana_instruction::Instruction {
213            program_id: crate::WAVEBREAK_ID,
214            accounts,
215            data,
216        }
217    }
218}
219
220#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)]
221#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
222pub struct LpHarvestInstructionData {
223    discriminator: u8,
224}
225
226impl LpHarvestInstructionData {
227    pub fn new() -> Self {
228        Self { discriminator: 56 }
229    }
230}
231
232impl Default for LpHarvestInstructionData {
233    fn default() -> Self {
234        Self::new()
235    }
236}
237
238/// Instruction builder for `LpHarvest`.
239///
240/// ### Accounts:
241///
242///   0. `[writable, signer]` lp_authority
243///   1. `[]` lp_escrow
244///   2. `[writable]` whirlpool
245///   3. `[writable]` position
246///   4. `[]` position_token_account
247///   5. `[]` lower_tick_array
248///   6. `[]` upper_tick_array
249///   7. `[writable]` token_a_mint
250///   8. `[writable]` token_b_mint
251///   9. `[writable]` token_a_ata
252///   10. `[writable]` token_b_ata
253///   11. `[writable]` token_a_vault
254///   12. `[writable]` token_b_vault
255///   13. `[]` reward1_mint
256///   14. `[]` reward2_mint
257///   15. `[]` reward3_mint
258///   16. `[writable]` reward1_ata
259///   17. `[writable]` reward2_ata
260///   18. `[writable]` reward3_ata
261///   19. `[writable]` reward1_vault
262///   20. `[writable]` reward2_vault
263///   21. `[writable]` reward3_vault
264///   22. `[optional]` system_program (default to `11111111111111111111111111111111`)
265///   23. `[]` token_a_program
266///   24. `[]` token_b_program
267///   25. `[]` reward1_token_program
268///   26. `[]` reward2_token_program
269///   27. `[]` reward3_token_program
270///   28. `[optional]` ata_program (default to `ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL`)
271///   29. `[]` memo_program
272///   30. `[]` whirlpool_program
273#[derive(Clone, Debug, Default)]
274pub struct LpHarvestBuilder {
275    lp_authority: Option<solana_pubkey::Pubkey>,
276    lp_escrow: Option<solana_pubkey::Pubkey>,
277    whirlpool: Option<solana_pubkey::Pubkey>,
278    position: Option<solana_pubkey::Pubkey>,
279    position_token_account: Option<solana_pubkey::Pubkey>,
280    lower_tick_array: Option<solana_pubkey::Pubkey>,
281    upper_tick_array: Option<solana_pubkey::Pubkey>,
282    token_a_mint: Option<solana_pubkey::Pubkey>,
283    token_b_mint: Option<solana_pubkey::Pubkey>,
284    token_a_ata: Option<solana_pubkey::Pubkey>,
285    token_b_ata: Option<solana_pubkey::Pubkey>,
286    token_a_vault: Option<solana_pubkey::Pubkey>,
287    token_b_vault: Option<solana_pubkey::Pubkey>,
288    reward1_mint: Option<solana_pubkey::Pubkey>,
289    reward2_mint: Option<solana_pubkey::Pubkey>,
290    reward3_mint: Option<solana_pubkey::Pubkey>,
291    reward1_ata: Option<solana_pubkey::Pubkey>,
292    reward2_ata: Option<solana_pubkey::Pubkey>,
293    reward3_ata: Option<solana_pubkey::Pubkey>,
294    reward1_vault: Option<solana_pubkey::Pubkey>,
295    reward2_vault: Option<solana_pubkey::Pubkey>,
296    reward3_vault: Option<solana_pubkey::Pubkey>,
297    system_program: Option<solana_pubkey::Pubkey>,
298    token_a_program: Option<solana_pubkey::Pubkey>,
299    token_b_program: Option<solana_pubkey::Pubkey>,
300    reward1_token_program: Option<solana_pubkey::Pubkey>,
301    reward2_token_program: Option<solana_pubkey::Pubkey>,
302    reward3_token_program: Option<solana_pubkey::Pubkey>,
303    ata_program: Option<solana_pubkey::Pubkey>,
304    memo_program: Option<solana_pubkey::Pubkey>,
305    whirlpool_program: Option<solana_pubkey::Pubkey>,
306    __remaining_accounts: Vec<solana_instruction::AccountMeta>,
307}
308
309impl LpHarvestBuilder {
310    pub fn new() -> Self {
311        Self::default()
312    }
313    /// The authority of the lp escrow account
314    #[inline(always)]
315    pub fn lp_authority(&mut self, lp_authority: solana_pubkey::Pubkey) -> &mut Self {
316        self.lp_authority = Some(lp_authority);
317        self
318    }
319    /// The LP escrow account
320    #[inline(always)]
321    pub fn lp_escrow(&mut self, lp_escrow: solana_pubkey::Pubkey) -> &mut Self {
322        self.lp_escrow = Some(lp_escrow);
323        self
324    }
325    /// The whirlpool account
326    #[inline(always)]
327    pub fn whirlpool(&mut self, whirlpool: solana_pubkey::Pubkey) -> &mut Self {
328        self.whirlpool = Some(whirlpool);
329        self
330    }
331    /// The position account
332    #[inline(always)]
333    pub fn position(&mut self, position: solana_pubkey::Pubkey) -> &mut Self {
334        self.position = Some(position);
335        self
336    }
337    /// The position token account
338    #[inline(always)]
339    pub fn position_token_account(
340        &mut self,
341        position_token_account: solana_pubkey::Pubkey,
342    ) -> &mut Self {
343        self.position_token_account = Some(position_token_account);
344        self
345    }
346    /// The lower tick array account
347    #[inline(always)]
348    pub fn lower_tick_array(&mut self, lower_tick_array: solana_pubkey::Pubkey) -> &mut Self {
349        self.lower_tick_array = Some(lower_tick_array);
350        self
351    }
352    /// The upper tick array account
353    #[inline(always)]
354    pub fn upper_tick_array(&mut self, upper_tick_array: solana_pubkey::Pubkey) -> &mut Self {
355        self.upper_tick_array = Some(upper_tick_array);
356        self
357    }
358    /// The token mint a account
359    #[inline(always)]
360    pub fn token_a_mint(&mut self, token_a_mint: solana_pubkey::Pubkey) -> &mut Self {
361        self.token_a_mint = Some(token_a_mint);
362        self
363    }
364    /// The token mint b account
365    #[inline(always)]
366    pub fn token_b_mint(&mut self, token_b_mint: solana_pubkey::Pubkey) -> &mut Self {
367        self.token_b_mint = Some(token_b_mint);
368        self
369    }
370    /// The token owner a account
371    #[inline(always)]
372    pub fn token_a_ata(&mut self, token_a_ata: solana_pubkey::Pubkey) -> &mut Self {
373        self.token_a_ata = Some(token_a_ata);
374        self
375    }
376    /// The token owner b account
377    #[inline(always)]
378    pub fn token_b_ata(&mut self, token_b_ata: solana_pubkey::Pubkey) -> &mut Self {
379        self.token_b_ata = Some(token_b_ata);
380        self
381    }
382    /// The token vault a account
383    #[inline(always)]
384    pub fn token_a_vault(&mut self, token_a_vault: solana_pubkey::Pubkey) -> &mut Self {
385        self.token_a_vault = Some(token_a_vault);
386        self
387    }
388    /// The token vault b account
389    #[inline(always)]
390    pub fn token_b_vault(&mut self, token_b_vault: solana_pubkey::Pubkey) -> &mut Self {
391        self.token_b_vault = Some(token_b_vault);
392        self
393    }
394    /// The reward mint 1 account
395    #[inline(always)]
396    pub fn reward1_mint(&mut self, reward1_mint: solana_pubkey::Pubkey) -> &mut Self {
397        self.reward1_mint = Some(reward1_mint);
398        self
399    }
400    /// The reward mint 2 account
401    #[inline(always)]
402    pub fn reward2_mint(&mut self, reward2_mint: solana_pubkey::Pubkey) -> &mut Self {
403        self.reward2_mint = Some(reward2_mint);
404        self
405    }
406    /// The reward mint 3 account
407    #[inline(always)]
408    pub fn reward3_mint(&mut self, reward3_mint: solana_pubkey::Pubkey) -> &mut Self {
409        self.reward3_mint = Some(reward3_mint);
410        self
411    }
412    /// The reward owner 1 account
413    #[inline(always)]
414    pub fn reward1_ata(&mut self, reward1_ata: solana_pubkey::Pubkey) -> &mut Self {
415        self.reward1_ata = Some(reward1_ata);
416        self
417    }
418    /// The reward owner 2 account
419    #[inline(always)]
420    pub fn reward2_ata(&mut self, reward2_ata: solana_pubkey::Pubkey) -> &mut Self {
421        self.reward2_ata = Some(reward2_ata);
422        self
423    }
424    /// The reward owner 3 account
425    #[inline(always)]
426    pub fn reward3_ata(&mut self, reward3_ata: solana_pubkey::Pubkey) -> &mut Self {
427        self.reward3_ata = Some(reward3_ata);
428        self
429    }
430    /// The reward vault 1 account
431    #[inline(always)]
432    pub fn reward1_vault(&mut self, reward1_vault: solana_pubkey::Pubkey) -> &mut Self {
433        self.reward1_vault = Some(reward1_vault);
434        self
435    }
436    /// The reward vault 2 account
437    #[inline(always)]
438    pub fn reward2_vault(&mut self, reward2_vault: solana_pubkey::Pubkey) -> &mut Self {
439        self.reward2_vault = Some(reward2_vault);
440        self
441    }
442    /// The reward vault 3 account
443    #[inline(always)]
444    pub fn reward3_vault(&mut self, reward3_vault: solana_pubkey::Pubkey) -> &mut Self {
445        self.reward3_vault = Some(reward3_vault);
446        self
447    }
448    /// `[optional account, default to '11111111111111111111111111111111']`
449    /// The system program
450    #[inline(always)]
451    pub fn system_program(&mut self, system_program: solana_pubkey::Pubkey) -> &mut Self {
452        self.system_program = Some(system_program);
453        self
454    }
455    /// The token a program
456    #[inline(always)]
457    pub fn token_a_program(&mut self, token_a_program: solana_pubkey::Pubkey) -> &mut Self {
458        self.token_a_program = Some(token_a_program);
459        self
460    }
461    /// The token b program
462    #[inline(always)]
463    pub fn token_b_program(&mut self, token_b_program: solana_pubkey::Pubkey) -> &mut Self {
464        self.token_b_program = Some(token_b_program);
465        self
466    }
467    /// The token reward 1 program
468    #[inline(always)]
469    pub fn reward1_token_program(
470        &mut self,
471        reward1_token_program: solana_pubkey::Pubkey,
472    ) -> &mut Self {
473        self.reward1_token_program = Some(reward1_token_program);
474        self
475    }
476    /// The token reward 2 program
477    #[inline(always)]
478    pub fn reward2_token_program(
479        &mut self,
480        reward2_token_program: solana_pubkey::Pubkey,
481    ) -> &mut Self {
482        self.reward2_token_program = Some(reward2_token_program);
483        self
484    }
485    /// The token reward 3 program
486    #[inline(always)]
487    pub fn reward3_token_program(
488        &mut self,
489        reward3_token_program: solana_pubkey::Pubkey,
490    ) -> &mut Self {
491        self.reward3_token_program = Some(reward3_token_program);
492        self
493    }
494    /// `[optional account, default to 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL']`
495    /// The ata program
496    #[inline(always)]
497    pub fn ata_program(&mut self, ata_program: solana_pubkey::Pubkey) -> &mut Self {
498        self.ata_program = Some(ata_program);
499        self
500    }
501    /// The memo program
502    #[inline(always)]
503    pub fn memo_program(&mut self, memo_program: solana_pubkey::Pubkey) -> &mut Self {
504        self.memo_program = Some(memo_program);
505        self
506    }
507    /// The whirlpool program
508    #[inline(always)]
509    pub fn whirlpool_program(&mut self, whirlpool_program: solana_pubkey::Pubkey) -> &mut Self {
510        self.whirlpool_program = Some(whirlpool_program);
511        self
512    }
513    /// Add an additional account to the instruction.
514    #[inline(always)]
515    pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self {
516        self.__remaining_accounts.push(account);
517        self
518    }
519    /// Add additional accounts to the instruction.
520    #[inline(always)]
521    pub fn add_remaining_accounts(
522        &mut self,
523        accounts: &[solana_instruction::AccountMeta],
524    ) -> &mut Self {
525        self.__remaining_accounts.extend_from_slice(accounts);
526        self
527    }
528    #[allow(clippy::clone_on_copy)]
529    pub fn instruction(&self) -> solana_instruction::Instruction {
530        let accounts = LpHarvest {
531            lp_authority: self.lp_authority.expect("lp_authority is not set"),
532            lp_escrow: self.lp_escrow.expect("lp_escrow is not set"),
533            whirlpool: self.whirlpool.expect("whirlpool is not set"),
534            position: self.position.expect("position is not set"),
535            position_token_account: self
536                .position_token_account
537                .expect("position_token_account is not set"),
538            lower_tick_array: self.lower_tick_array.expect("lower_tick_array is not set"),
539            upper_tick_array: self.upper_tick_array.expect("upper_tick_array is not set"),
540            token_a_mint: self.token_a_mint.expect("token_a_mint is not set"),
541            token_b_mint: self.token_b_mint.expect("token_b_mint is not set"),
542            token_a_ata: self.token_a_ata.expect("token_a_ata is not set"),
543            token_b_ata: self.token_b_ata.expect("token_b_ata is not set"),
544            token_a_vault: self.token_a_vault.expect("token_a_vault is not set"),
545            token_b_vault: self.token_b_vault.expect("token_b_vault is not set"),
546            reward1_mint: self.reward1_mint.expect("reward1_mint is not set"),
547            reward2_mint: self.reward2_mint.expect("reward2_mint is not set"),
548            reward3_mint: self.reward3_mint.expect("reward3_mint is not set"),
549            reward1_ata: self.reward1_ata.expect("reward1_ata is not set"),
550            reward2_ata: self.reward2_ata.expect("reward2_ata is not set"),
551            reward3_ata: self.reward3_ata.expect("reward3_ata is not set"),
552            reward1_vault: self.reward1_vault.expect("reward1_vault is not set"),
553            reward2_vault: self.reward2_vault.expect("reward2_vault is not set"),
554            reward3_vault: self.reward3_vault.expect("reward3_vault is not set"),
555            system_program: self
556                .system_program
557                .unwrap_or(solana_pubkey::pubkey!("11111111111111111111111111111111")),
558            token_a_program: self.token_a_program.expect("token_a_program is not set"),
559            token_b_program: self.token_b_program.expect("token_b_program is not set"),
560            reward1_token_program: self
561                .reward1_token_program
562                .expect("reward1_token_program is not set"),
563            reward2_token_program: self
564                .reward2_token_program
565                .expect("reward2_token_program is not set"),
566            reward3_token_program: self
567                .reward3_token_program
568                .expect("reward3_token_program is not set"),
569            ata_program: self.ata_program.unwrap_or(solana_pubkey::pubkey!(
570                "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
571            )),
572            memo_program: self.memo_program.expect("memo_program is not set"),
573            whirlpool_program: self
574                .whirlpool_program
575                .expect("whirlpool_program is not set"),
576        };
577
578        accounts.instruction_with_remaining_accounts(&self.__remaining_accounts)
579    }
580}
581
582/// `lp_harvest` CPI accounts.
583pub struct LpHarvestCpiAccounts<'a, 'b> {
584    /// The authority of the lp escrow account
585    pub lp_authority: &'b solana_account_info::AccountInfo<'a>,
586    /// The LP escrow account
587    pub lp_escrow: &'b solana_account_info::AccountInfo<'a>,
588    /// The whirlpool account
589    pub whirlpool: &'b solana_account_info::AccountInfo<'a>,
590    /// The position account
591    pub position: &'b solana_account_info::AccountInfo<'a>,
592    /// The position token account
593    pub position_token_account: &'b solana_account_info::AccountInfo<'a>,
594    /// The lower tick array account
595    pub lower_tick_array: &'b solana_account_info::AccountInfo<'a>,
596    /// The upper tick array account
597    pub upper_tick_array: &'b solana_account_info::AccountInfo<'a>,
598    /// The token mint a account
599    pub token_a_mint: &'b solana_account_info::AccountInfo<'a>,
600    /// The token mint b account
601    pub token_b_mint: &'b solana_account_info::AccountInfo<'a>,
602    /// The token owner a account
603    pub token_a_ata: &'b solana_account_info::AccountInfo<'a>,
604    /// The token owner b account
605    pub token_b_ata: &'b solana_account_info::AccountInfo<'a>,
606    /// The token vault a account
607    pub token_a_vault: &'b solana_account_info::AccountInfo<'a>,
608    /// The token vault b account
609    pub token_b_vault: &'b solana_account_info::AccountInfo<'a>,
610    /// The reward mint 1 account
611    pub reward1_mint: &'b solana_account_info::AccountInfo<'a>,
612    /// The reward mint 2 account
613    pub reward2_mint: &'b solana_account_info::AccountInfo<'a>,
614    /// The reward mint 3 account
615    pub reward3_mint: &'b solana_account_info::AccountInfo<'a>,
616    /// The reward owner 1 account
617    pub reward1_ata: &'b solana_account_info::AccountInfo<'a>,
618    /// The reward owner 2 account
619    pub reward2_ata: &'b solana_account_info::AccountInfo<'a>,
620    /// The reward owner 3 account
621    pub reward3_ata: &'b solana_account_info::AccountInfo<'a>,
622    /// The reward vault 1 account
623    pub reward1_vault: &'b solana_account_info::AccountInfo<'a>,
624    /// The reward vault 2 account
625    pub reward2_vault: &'b solana_account_info::AccountInfo<'a>,
626    /// The reward vault 3 account
627    pub reward3_vault: &'b solana_account_info::AccountInfo<'a>,
628    /// The system program
629    pub system_program: &'b solana_account_info::AccountInfo<'a>,
630    /// The token a program
631    pub token_a_program: &'b solana_account_info::AccountInfo<'a>,
632    /// The token b program
633    pub token_b_program: &'b solana_account_info::AccountInfo<'a>,
634    /// The token reward 1 program
635    pub reward1_token_program: &'b solana_account_info::AccountInfo<'a>,
636    /// The token reward 2 program
637    pub reward2_token_program: &'b solana_account_info::AccountInfo<'a>,
638    /// The token reward 3 program
639    pub reward3_token_program: &'b solana_account_info::AccountInfo<'a>,
640    /// The ata program
641    pub ata_program: &'b solana_account_info::AccountInfo<'a>,
642    /// The memo program
643    pub memo_program: &'b solana_account_info::AccountInfo<'a>,
644    /// The whirlpool program
645    pub whirlpool_program: &'b solana_account_info::AccountInfo<'a>,
646}
647
648/// `lp_harvest` CPI instruction.
649pub struct LpHarvestCpi<'a, 'b> {
650    /// The program to invoke.
651    pub __program: &'b solana_account_info::AccountInfo<'a>,
652    /// The authority of the lp escrow account
653    pub lp_authority: &'b solana_account_info::AccountInfo<'a>,
654    /// The LP escrow account
655    pub lp_escrow: &'b solana_account_info::AccountInfo<'a>,
656    /// The whirlpool account
657    pub whirlpool: &'b solana_account_info::AccountInfo<'a>,
658    /// The position account
659    pub position: &'b solana_account_info::AccountInfo<'a>,
660    /// The position token account
661    pub position_token_account: &'b solana_account_info::AccountInfo<'a>,
662    /// The lower tick array account
663    pub lower_tick_array: &'b solana_account_info::AccountInfo<'a>,
664    /// The upper tick array account
665    pub upper_tick_array: &'b solana_account_info::AccountInfo<'a>,
666    /// The token mint a account
667    pub token_a_mint: &'b solana_account_info::AccountInfo<'a>,
668    /// The token mint b account
669    pub token_b_mint: &'b solana_account_info::AccountInfo<'a>,
670    /// The token owner a account
671    pub token_a_ata: &'b solana_account_info::AccountInfo<'a>,
672    /// The token owner b account
673    pub token_b_ata: &'b solana_account_info::AccountInfo<'a>,
674    /// The token vault a account
675    pub token_a_vault: &'b solana_account_info::AccountInfo<'a>,
676    /// The token vault b account
677    pub token_b_vault: &'b solana_account_info::AccountInfo<'a>,
678    /// The reward mint 1 account
679    pub reward1_mint: &'b solana_account_info::AccountInfo<'a>,
680    /// The reward mint 2 account
681    pub reward2_mint: &'b solana_account_info::AccountInfo<'a>,
682    /// The reward mint 3 account
683    pub reward3_mint: &'b solana_account_info::AccountInfo<'a>,
684    /// The reward owner 1 account
685    pub reward1_ata: &'b solana_account_info::AccountInfo<'a>,
686    /// The reward owner 2 account
687    pub reward2_ata: &'b solana_account_info::AccountInfo<'a>,
688    /// The reward owner 3 account
689    pub reward3_ata: &'b solana_account_info::AccountInfo<'a>,
690    /// The reward vault 1 account
691    pub reward1_vault: &'b solana_account_info::AccountInfo<'a>,
692    /// The reward vault 2 account
693    pub reward2_vault: &'b solana_account_info::AccountInfo<'a>,
694    /// The reward vault 3 account
695    pub reward3_vault: &'b solana_account_info::AccountInfo<'a>,
696    /// The system program
697    pub system_program: &'b solana_account_info::AccountInfo<'a>,
698    /// The token a program
699    pub token_a_program: &'b solana_account_info::AccountInfo<'a>,
700    /// The token b program
701    pub token_b_program: &'b solana_account_info::AccountInfo<'a>,
702    /// The token reward 1 program
703    pub reward1_token_program: &'b solana_account_info::AccountInfo<'a>,
704    /// The token reward 2 program
705    pub reward2_token_program: &'b solana_account_info::AccountInfo<'a>,
706    /// The token reward 3 program
707    pub reward3_token_program: &'b solana_account_info::AccountInfo<'a>,
708    /// The ata program
709    pub ata_program: &'b solana_account_info::AccountInfo<'a>,
710    /// The memo program
711    pub memo_program: &'b solana_account_info::AccountInfo<'a>,
712    /// The whirlpool program
713    pub whirlpool_program: &'b solana_account_info::AccountInfo<'a>,
714}
715
716impl<'a, 'b> LpHarvestCpi<'a, 'b> {
717    pub fn new(
718        program: &'b solana_account_info::AccountInfo<'a>,
719        accounts: LpHarvestCpiAccounts<'a, 'b>,
720    ) -> Self {
721        Self {
722            __program: program,
723            lp_authority: accounts.lp_authority,
724            lp_escrow: accounts.lp_escrow,
725            whirlpool: accounts.whirlpool,
726            position: accounts.position,
727            position_token_account: accounts.position_token_account,
728            lower_tick_array: accounts.lower_tick_array,
729            upper_tick_array: accounts.upper_tick_array,
730            token_a_mint: accounts.token_a_mint,
731            token_b_mint: accounts.token_b_mint,
732            token_a_ata: accounts.token_a_ata,
733            token_b_ata: accounts.token_b_ata,
734            token_a_vault: accounts.token_a_vault,
735            token_b_vault: accounts.token_b_vault,
736            reward1_mint: accounts.reward1_mint,
737            reward2_mint: accounts.reward2_mint,
738            reward3_mint: accounts.reward3_mint,
739            reward1_ata: accounts.reward1_ata,
740            reward2_ata: accounts.reward2_ata,
741            reward3_ata: accounts.reward3_ata,
742            reward1_vault: accounts.reward1_vault,
743            reward2_vault: accounts.reward2_vault,
744            reward3_vault: accounts.reward3_vault,
745            system_program: accounts.system_program,
746            token_a_program: accounts.token_a_program,
747            token_b_program: accounts.token_b_program,
748            reward1_token_program: accounts.reward1_token_program,
749            reward2_token_program: accounts.reward2_token_program,
750            reward3_token_program: accounts.reward3_token_program,
751            ata_program: accounts.ata_program,
752            memo_program: accounts.memo_program,
753            whirlpool_program: accounts.whirlpool_program,
754        }
755    }
756    #[inline(always)]
757    pub fn invoke(&self) -> solana_program_error::ProgramResult {
758        self.invoke_signed_with_remaining_accounts(&[], &[])
759    }
760    #[inline(always)]
761    pub fn invoke_with_remaining_accounts(
762        &self,
763        remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)],
764    ) -> solana_program_error::ProgramResult {
765        self.invoke_signed_with_remaining_accounts(&[], remaining_accounts)
766    }
767    #[inline(always)]
768    pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult {
769        self.invoke_signed_with_remaining_accounts(signers_seeds, &[])
770    }
771    #[allow(clippy::arithmetic_side_effects)]
772    #[allow(clippy::clone_on_copy)]
773    #[allow(clippy::vec_init_then_push)]
774    pub fn invoke_signed_with_remaining_accounts(
775        &self,
776        signers_seeds: &[&[&[u8]]],
777        remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)],
778    ) -> solana_program_error::ProgramResult {
779        let mut accounts = Vec::with_capacity(31 + remaining_accounts.len());
780        accounts.push(solana_instruction::AccountMeta::new(
781            *self.lp_authority.key,
782            true,
783        ));
784        accounts.push(solana_instruction::AccountMeta::new_readonly(
785            *self.lp_escrow.key,
786            false,
787        ));
788        accounts.push(solana_instruction::AccountMeta::new(
789            *self.whirlpool.key,
790            false,
791        ));
792        accounts.push(solana_instruction::AccountMeta::new(
793            *self.position.key,
794            false,
795        ));
796        accounts.push(solana_instruction::AccountMeta::new_readonly(
797            *self.position_token_account.key,
798            false,
799        ));
800        accounts.push(solana_instruction::AccountMeta::new_readonly(
801            *self.lower_tick_array.key,
802            false,
803        ));
804        accounts.push(solana_instruction::AccountMeta::new_readonly(
805            *self.upper_tick_array.key,
806            false,
807        ));
808        accounts.push(solana_instruction::AccountMeta::new(
809            *self.token_a_mint.key,
810            false,
811        ));
812        accounts.push(solana_instruction::AccountMeta::new(
813            *self.token_b_mint.key,
814            false,
815        ));
816        accounts.push(solana_instruction::AccountMeta::new(
817            *self.token_a_ata.key,
818            false,
819        ));
820        accounts.push(solana_instruction::AccountMeta::new(
821            *self.token_b_ata.key,
822            false,
823        ));
824        accounts.push(solana_instruction::AccountMeta::new(
825            *self.token_a_vault.key,
826            false,
827        ));
828        accounts.push(solana_instruction::AccountMeta::new(
829            *self.token_b_vault.key,
830            false,
831        ));
832        accounts.push(solana_instruction::AccountMeta::new_readonly(
833            *self.reward1_mint.key,
834            false,
835        ));
836        accounts.push(solana_instruction::AccountMeta::new_readonly(
837            *self.reward2_mint.key,
838            false,
839        ));
840        accounts.push(solana_instruction::AccountMeta::new_readonly(
841            *self.reward3_mint.key,
842            false,
843        ));
844        accounts.push(solana_instruction::AccountMeta::new(
845            *self.reward1_ata.key,
846            false,
847        ));
848        accounts.push(solana_instruction::AccountMeta::new(
849            *self.reward2_ata.key,
850            false,
851        ));
852        accounts.push(solana_instruction::AccountMeta::new(
853            *self.reward3_ata.key,
854            false,
855        ));
856        accounts.push(solana_instruction::AccountMeta::new(
857            *self.reward1_vault.key,
858            false,
859        ));
860        accounts.push(solana_instruction::AccountMeta::new(
861            *self.reward2_vault.key,
862            false,
863        ));
864        accounts.push(solana_instruction::AccountMeta::new(
865            *self.reward3_vault.key,
866            false,
867        ));
868        accounts.push(solana_instruction::AccountMeta::new_readonly(
869            *self.system_program.key,
870            false,
871        ));
872        accounts.push(solana_instruction::AccountMeta::new_readonly(
873            *self.token_a_program.key,
874            false,
875        ));
876        accounts.push(solana_instruction::AccountMeta::new_readonly(
877            *self.token_b_program.key,
878            false,
879        ));
880        accounts.push(solana_instruction::AccountMeta::new_readonly(
881            *self.reward1_token_program.key,
882            false,
883        ));
884        accounts.push(solana_instruction::AccountMeta::new_readonly(
885            *self.reward2_token_program.key,
886            false,
887        ));
888        accounts.push(solana_instruction::AccountMeta::new_readonly(
889            *self.reward3_token_program.key,
890            false,
891        ));
892        accounts.push(solana_instruction::AccountMeta::new_readonly(
893            *self.ata_program.key,
894            false,
895        ));
896        accounts.push(solana_instruction::AccountMeta::new_readonly(
897            *self.memo_program.key,
898            false,
899        ));
900        accounts.push(solana_instruction::AccountMeta::new_readonly(
901            *self.whirlpool_program.key,
902            false,
903        ));
904        remaining_accounts.iter().for_each(|remaining_account| {
905            accounts.push(solana_instruction::AccountMeta {
906                pubkey: *remaining_account.0.key,
907                is_signer: remaining_account.1,
908                is_writable: remaining_account.2,
909            })
910        });
911        let data = borsh::to_vec(&LpHarvestInstructionData::new()).unwrap();
912
913        let instruction = solana_instruction::Instruction {
914            program_id: crate::WAVEBREAK_ID,
915            accounts,
916            data,
917        };
918        let mut account_infos = Vec::with_capacity(32 + remaining_accounts.len());
919        account_infos.push(self.__program.clone());
920        account_infos.push(self.lp_authority.clone());
921        account_infos.push(self.lp_escrow.clone());
922        account_infos.push(self.whirlpool.clone());
923        account_infos.push(self.position.clone());
924        account_infos.push(self.position_token_account.clone());
925        account_infos.push(self.lower_tick_array.clone());
926        account_infos.push(self.upper_tick_array.clone());
927        account_infos.push(self.token_a_mint.clone());
928        account_infos.push(self.token_b_mint.clone());
929        account_infos.push(self.token_a_ata.clone());
930        account_infos.push(self.token_b_ata.clone());
931        account_infos.push(self.token_a_vault.clone());
932        account_infos.push(self.token_b_vault.clone());
933        account_infos.push(self.reward1_mint.clone());
934        account_infos.push(self.reward2_mint.clone());
935        account_infos.push(self.reward3_mint.clone());
936        account_infos.push(self.reward1_ata.clone());
937        account_infos.push(self.reward2_ata.clone());
938        account_infos.push(self.reward3_ata.clone());
939        account_infos.push(self.reward1_vault.clone());
940        account_infos.push(self.reward2_vault.clone());
941        account_infos.push(self.reward3_vault.clone());
942        account_infos.push(self.system_program.clone());
943        account_infos.push(self.token_a_program.clone());
944        account_infos.push(self.token_b_program.clone());
945        account_infos.push(self.reward1_token_program.clone());
946        account_infos.push(self.reward2_token_program.clone());
947        account_infos.push(self.reward3_token_program.clone());
948        account_infos.push(self.ata_program.clone());
949        account_infos.push(self.memo_program.clone());
950        account_infos.push(self.whirlpool_program.clone());
951        remaining_accounts
952            .iter()
953            .for_each(|remaining_account| account_infos.push(remaining_account.0.clone()));
954
955        if signers_seeds.is_empty() {
956            solana_cpi::invoke(&instruction, &account_infos)
957        } else {
958            solana_cpi::invoke_signed(&instruction, &account_infos, signers_seeds)
959        }
960    }
961}
962
963/// Instruction builder for `LpHarvest` via CPI.
964///
965/// ### Accounts:
966///
967///   0. `[writable, signer]` lp_authority
968///   1. `[]` lp_escrow
969///   2. `[writable]` whirlpool
970///   3. `[writable]` position
971///   4. `[]` position_token_account
972///   5. `[]` lower_tick_array
973///   6. `[]` upper_tick_array
974///   7. `[writable]` token_a_mint
975///   8. `[writable]` token_b_mint
976///   9. `[writable]` token_a_ata
977///   10. `[writable]` token_b_ata
978///   11. `[writable]` token_a_vault
979///   12. `[writable]` token_b_vault
980///   13. `[]` reward1_mint
981///   14. `[]` reward2_mint
982///   15. `[]` reward3_mint
983///   16. `[writable]` reward1_ata
984///   17. `[writable]` reward2_ata
985///   18. `[writable]` reward3_ata
986///   19. `[writable]` reward1_vault
987///   20. `[writable]` reward2_vault
988///   21. `[writable]` reward3_vault
989///   22. `[]` system_program
990///   23. `[]` token_a_program
991///   24. `[]` token_b_program
992///   25. `[]` reward1_token_program
993///   26. `[]` reward2_token_program
994///   27. `[]` reward3_token_program
995///   28. `[]` ata_program
996///   29. `[]` memo_program
997///   30. `[]` whirlpool_program
998#[derive(Clone, Debug)]
999pub struct LpHarvestCpiBuilder<'a, 'b> {
1000    instruction: Box<LpHarvestCpiBuilderInstruction<'a, 'b>>,
1001}
1002
1003impl<'a, 'b> LpHarvestCpiBuilder<'a, 'b> {
1004    pub fn new(program: &'b solana_account_info::AccountInfo<'a>) -> Self {
1005        let instruction = Box::new(LpHarvestCpiBuilderInstruction {
1006            __program: program,
1007            lp_authority: None,
1008            lp_escrow: None,
1009            whirlpool: None,
1010            position: None,
1011            position_token_account: None,
1012            lower_tick_array: None,
1013            upper_tick_array: None,
1014            token_a_mint: None,
1015            token_b_mint: None,
1016            token_a_ata: None,
1017            token_b_ata: None,
1018            token_a_vault: None,
1019            token_b_vault: None,
1020            reward1_mint: None,
1021            reward2_mint: None,
1022            reward3_mint: None,
1023            reward1_ata: None,
1024            reward2_ata: None,
1025            reward3_ata: None,
1026            reward1_vault: None,
1027            reward2_vault: None,
1028            reward3_vault: None,
1029            system_program: None,
1030            token_a_program: None,
1031            token_b_program: None,
1032            reward1_token_program: None,
1033            reward2_token_program: None,
1034            reward3_token_program: None,
1035            ata_program: None,
1036            memo_program: None,
1037            whirlpool_program: None,
1038            __remaining_accounts: Vec::new(),
1039        });
1040        Self { instruction }
1041    }
1042    /// The authority of the lp escrow account
1043    #[inline(always)]
1044    pub fn lp_authority(
1045        &mut self,
1046        lp_authority: &'b solana_account_info::AccountInfo<'a>,
1047    ) -> &mut Self {
1048        self.instruction.lp_authority = Some(lp_authority);
1049        self
1050    }
1051    /// The LP escrow account
1052    #[inline(always)]
1053    pub fn lp_escrow(&mut self, lp_escrow: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
1054        self.instruction.lp_escrow = Some(lp_escrow);
1055        self
1056    }
1057    /// The whirlpool account
1058    #[inline(always)]
1059    pub fn whirlpool(&mut self, whirlpool: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
1060        self.instruction.whirlpool = Some(whirlpool);
1061        self
1062    }
1063    /// The position account
1064    #[inline(always)]
1065    pub fn position(&mut self, position: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
1066        self.instruction.position = Some(position);
1067        self
1068    }
1069    /// The position token account
1070    #[inline(always)]
1071    pub fn position_token_account(
1072        &mut self,
1073        position_token_account: &'b solana_account_info::AccountInfo<'a>,
1074    ) -> &mut Self {
1075        self.instruction.position_token_account = Some(position_token_account);
1076        self
1077    }
1078    /// The lower tick array account
1079    #[inline(always)]
1080    pub fn lower_tick_array(
1081        &mut self,
1082        lower_tick_array: &'b solana_account_info::AccountInfo<'a>,
1083    ) -> &mut Self {
1084        self.instruction.lower_tick_array = Some(lower_tick_array);
1085        self
1086    }
1087    /// The upper tick array account
1088    #[inline(always)]
1089    pub fn upper_tick_array(
1090        &mut self,
1091        upper_tick_array: &'b solana_account_info::AccountInfo<'a>,
1092    ) -> &mut Self {
1093        self.instruction.upper_tick_array = Some(upper_tick_array);
1094        self
1095    }
1096    /// The token mint a account
1097    #[inline(always)]
1098    pub fn token_a_mint(
1099        &mut self,
1100        token_a_mint: &'b solana_account_info::AccountInfo<'a>,
1101    ) -> &mut Self {
1102        self.instruction.token_a_mint = Some(token_a_mint);
1103        self
1104    }
1105    /// The token mint b account
1106    #[inline(always)]
1107    pub fn token_b_mint(
1108        &mut self,
1109        token_b_mint: &'b solana_account_info::AccountInfo<'a>,
1110    ) -> &mut Self {
1111        self.instruction.token_b_mint = Some(token_b_mint);
1112        self
1113    }
1114    /// The token owner a account
1115    #[inline(always)]
1116    pub fn token_a_ata(
1117        &mut self,
1118        token_a_ata: &'b solana_account_info::AccountInfo<'a>,
1119    ) -> &mut Self {
1120        self.instruction.token_a_ata = Some(token_a_ata);
1121        self
1122    }
1123    /// The token owner b account
1124    #[inline(always)]
1125    pub fn token_b_ata(
1126        &mut self,
1127        token_b_ata: &'b solana_account_info::AccountInfo<'a>,
1128    ) -> &mut Self {
1129        self.instruction.token_b_ata = Some(token_b_ata);
1130        self
1131    }
1132    /// The token vault a account
1133    #[inline(always)]
1134    pub fn token_a_vault(
1135        &mut self,
1136        token_a_vault: &'b solana_account_info::AccountInfo<'a>,
1137    ) -> &mut Self {
1138        self.instruction.token_a_vault = Some(token_a_vault);
1139        self
1140    }
1141    /// The token vault b account
1142    #[inline(always)]
1143    pub fn token_b_vault(
1144        &mut self,
1145        token_b_vault: &'b solana_account_info::AccountInfo<'a>,
1146    ) -> &mut Self {
1147        self.instruction.token_b_vault = Some(token_b_vault);
1148        self
1149    }
1150    /// The reward mint 1 account
1151    #[inline(always)]
1152    pub fn reward1_mint(
1153        &mut self,
1154        reward1_mint: &'b solana_account_info::AccountInfo<'a>,
1155    ) -> &mut Self {
1156        self.instruction.reward1_mint = Some(reward1_mint);
1157        self
1158    }
1159    /// The reward mint 2 account
1160    #[inline(always)]
1161    pub fn reward2_mint(
1162        &mut self,
1163        reward2_mint: &'b solana_account_info::AccountInfo<'a>,
1164    ) -> &mut Self {
1165        self.instruction.reward2_mint = Some(reward2_mint);
1166        self
1167    }
1168    /// The reward mint 3 account
1169    #[inline(always)]
1170    pub fn reward3_mint(
1171        &mut self,
1172        reward3_mint: &'b solana_account_info::AccountInfo<'a>,
1173    ) -> &mut Self {
1174        self.instruction.reward3_mint = Some(reward3_mint);
1175        self
1176    }
1177    /// The reward owner 1 account
1178    #[inline(always)]
1179    pub fn reward1_ata(
1180        &mut self,
1181        reward1_ata: &'b solana_account_info::AccountInfo<'a>,
1182    ) -> &mut Self {
1183        self.instruction.reward1_ata = Some(reward1_ata);
1184        self
1185    }
1186    /// The reward owner 2 account
1187    #[inline(always)]
1188    pub fn reward2_ata(
1189        &mut self,
1190        reward2_ata: &'b solana_account_info::AccountInfo<'a>,
1191    ) -> &mut Self {
1192        self.instruction.reward2_ata = Some(reward2_ata);
1193        self
1194    }
1195    /// The reward owner 3 account
1196    #[inline(always)]
1197    pub fn reward3_ata(
1198        &mut self,
1199        reward3_ata: &'b solana_account_info::AccountInfo<'a>,
1200    ) -> &mut Self {
1201        self.instruction.reward3_ata = Some(reward3_ata);
1202        self
1203    }
1204    /// The reward vault 1 account
1205    #[inline(always)]
1206    pub fn reward1_vault(
1207        &mut self,
1208        reward1_vault: &'b solana_account_info::AccountInfo<'a>,
1209    ) -> &mut Self {
1210        self.instruction.reward1_vault = Some(reward1_vault);
1211        self
1212    }
1213    /// The reward vault 2 account
1214    #[inline(always)]
1215    pub fn reward2_vault(
1216        &mut self,
1217        reward2_vault: &'b solana_account_info::AccountInfo<'a>,
1218    ) -> &mut Self {
1219        self.instruction.reward2_vault = Some(reward2_vault);
1220        self
1221    }
1222    /// The reward vault 3 account
1223    #[inline(always)]
1224    pub fn reward3_vault(
1225        &mut self,
1226        reward3_vault: &'b solana_account_info::AccountInfo<'a>,
1227    ) -> &mut Self {
1228        self.instruction.reward3_vault = Some(reward3_vault);
1229        self
1230    }
1231    /// The system program
1232    #[inline(always)]
1233    pub fn system_program(
1234        &mut self,
1235        system_program: &'b solana_account_info::AccountInfo<'a>,
1236    ) -> &mut Self {
1237        self.instruction.system_program = Some(system_program);
1238        self
1239    }
1240    /// The token a program
1241    #[inline(always)]
1242    pub fn token_a_program(
1243        &mut self,
1244        token_a_program: &'b solana_account_info::AccountInfo<'a>,
1245    ) -> &mut Self {
1246        self.instruction.token_a_program = Some(token_a_program);
1247        self
1248    }
1249    /// The token b program
1250    #[inline(always)]
1251    pub fn token_b_program(
1252        &mut self,
1253        token_b_program: &'b solana_account_info::AccountInfo<'a>,
1254    ) -> &mut Self {
1255        self.instruction.token_b_program = Some(token_b_program);
1256        self
1257    }
1258    /// The token reward 1 program
1259    #[inline(always)]
1260    pub fn reward1_token_program(
1261        &mut self,
1262        reward1_token_program: &'b solana_account_info::AccountInfo<'a>,
1263    ) -> &mut Self {
1264        self.instruction.reward1_token_program = Some(reward1_token_program);
1265        self
1266    }
1267    /// The token reward 2 program
1268    #[inline(always)]
1269    pub fn reward2_token_program(
1270        &mut self,
1271        reward2_token_program: &'b solana_account_info::AccountInfo<'a>,
1272    ) -> &mut Self {
1273        self.instruction.reward2_token_program = Some(reward2_token_program);
1274        self
1275    }
1276    /// The token reward 3 program
1277    #[inline(always)]
1278    pub fn reward3_token_program(
1279        &mut self,
1280        reward3_token_program: &'b solana_account_info::AccountInfo<'a>,
1281    ) -> &mut Self {
1282        self.instruction.reward3_token_program = Some(reward3_token_program);
1283        self
1284    }
1285    /// The ata program
1286    #[inline(always)]
1287    pub fn ata_program(
1288        &mut self,
1289        ata_program: &'b solana_account_info::AccountInfo<'a>,
1290    ) -> &mut Self {
1291        self.instruction.ata_program = Some(ata_program);
1292        self
1293    }
1294    /// The memo program
1295    #[inline(always)]
1296    pub fn memo_program(
1297        &mut self,
1298        memo_program: &'b solana_account_info::AccountInfo<'a>,
1299    ) -> &mut Self {
1300        self.instruction.memo_program = Some(memo_program);
1301        self
1302    }
1303    /// The whirlpool program
1304    #[inline(always)]
1305    pub fn whirlpool_program(
1306        &mut self,
1307        whirlpool_program: &'b solana_account_info::AccountInfo<'a>,
1308    ) -> &mut Self {
1309        self.instruction.whirlpool_program = Some(whirlpool_program);
1310        self
1311    }
1312    /// Add an additional account to the instruction.
1313    #[inline(always)]
1314    pub fn add_remaining_account(
1315        &mut self,
1316        account: &'b solana_account_info::AccountInfo<'a>,
1317        is_writable: bool,
1318        is_signer: bool,
1319    ) -> &mut Self {
1320        self.instruction
1321            .__remaining_accounts
1322            .push((account, is_writable, is_signer));
1323        self
1324    }
1325    /// Add additional accounts to the instruction.
1326    ///
1327    /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not,
1328    /// and a `bool` indicating whether the account is a signer or not.
1329    #[inline(always)]
1330    pub fn add_remaining_accounts(
1331        &mut self,
1332        accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)],
1333    ) -> &mut Self {
1334        self.instruction
1335            .__remaining_accounts
1336            .extend_from_slice(accounts);
1337        self
1338    }
1339    #[inline(always)]
1340    pub fn invoke(&self) -> solana_program_error::ProgramResult {
1341        self.invoke_signed(&[])
1342    }
1343    #[allow(clippy::clone_on_copy)]
1344    #[allow(clippy::vec_init_then_push)]
1345    pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult {
1346        let instruction = LpHarvestCpi {
1347            __program: self.instruction.__program,
1348
1349            lp_authority: self
1350                .instruction
1351                .lp_authority
1352                .expect("lp_authority is not set"),
1353
1354            lp_escrow: self.instruction.lp_escrow.expect("lp_escrow is not set"),
1355
1356            whirlpool: self.instruction.whirlpool.expect("whirlpool is not set"),
1357
1358            position: self.instruction.position.expect("position is not set"),
1359
1360            position_token_account: self
1361                .instruction
1362                .position_token_account
1363                .expect("position_token_account is not set"),
1364
1365            lower_tick_array: self
1366                .instruction
1367                .lower_tick_array
1368                .expect("lower_tick_array is not set"),
1369
1370            upper_tick_array: self
1371                .instruction
1372                .upper_tick_array
1373                .expect("upper_tick_array is not set"),
1374
1375            token_a_mint: self
1376                .instruction
1377                .token_a_mint
1378                .expect("token_a_mint is not set"),
1379
1380            token_b_mint: self
1381                .instruction
1382                .token_b_mint
1383                .expect("token_b_mint is not set"),
1384
1385            token_a_ata: self
1386                .instruction
1387                .token_a_ata
1388                .expect("token_a_ata is not set"),
1389
1390            token_b_ata: self
1391                .instruction
1392                .token_b_ata
1393                .expect("token_b_ata is not set"),
1394
1395            token_a_vault: self
1396                .instruction
1397                .token_a_vault
1398                .expect("token_a_vault is not set"),
1399
1400            token_b_vault: self
1401                .instruction
1402                .token_b_vault
1403                .expect("token_b_vault is not set"),
1404
1405            reward1_mint: self
1406                .instruction
1407                .reward1_mint
1408                .expect("reward1_mint is not set"),
1409
1410            reward2_mint: self
1411                .instruction
1412                .reward2_mint
1413                .expect("reward2_mint is not set"),
1414
1415            reward3_mint: self
1416                .instruction
1417                .reward3_mint
1418                .expect("reward3_mint is not set"),
1419
1420            reward1_ata: self
1421                .instruction
1422                .reward1_ata
1423                .expect("reward1_ata is not set"),
1424
1425            reward2_ata: self
1426                .instruction
1427                .reward2_ata
1428                .expect("reward2_ata is not set"),
1429
1430            reward3_ata: self
1431                .instruction
1432                .reward3_ata
1433                .expect("reward3_ata is not set"),
1434
1435            reward1_vault: self
1436                .instruction
1437                .reward1_vault
1438                .expect("reward1_vault is not set"),
1439
1440            reward2_vault: self
1441                .instruction
1442                .reward2_vault
1443                .expect("reward2_vault is not set"),
1444
1445            reward3_vault: self
1446                .instruction
1447                .reward3_vault
1448                .expect("reward3_vault is not set"),
1449
1450            system_program: self
1451                .instruction
1452                .system_program
1453                .expect("system_program is not set"),
1454
1455            token_a_program: self
1456                .instruction
1457                .token_a_program
1458                .expect("token_a_program is not set"),
1459
1460            token_b_program: self
1461                .instruction
1462                .token_b_program
1463                .expect("token_b_program is not set"),
1464
1465            reward1_token_program: self
1466                .instruction
1467                .reward1_token_program
1468                .expect("reward1_token_program is not set"),
1469
1470            reward2_token_program: self
1471                .instruction
1472                .reward2_token_program
1473                .expect("reward2_token_program is not set"),
1474
1475            reward3_token_program: self
1476                .instruction
1477                .reward3_token_program
1478                .expect("reward3_token_program is not set"),
1479
1480            ata_program: self
1481                .instruction
1482                .ata_program
1483                .expect("ata_program is not set"),
1484
1485            memo_program: self
1486                .instruction
1487                .memo_program
1488                .expect("memo_program is not set"),
1489
1490            whirlpool_program: self
1491                .instruction
1492                .whirlpool_program
1493                .expect("whirlpool_program is not set"),
1494        };
1495        instruction.invoke_signed_with_remaining_accounts(
1496            signers_seeds,
1497            &self.instruction.__remaining_accounts,
1498        )
1499    }
1500}
1501
1502#[derive(Clone, Debug)]
1503struct LpHarvestCpiBuilderInstruction<'a, 'b> {
1504    __program: &'b solana_account_info::AccountInfo<'a>,
1505    lp_authority: Option<&'b solana_account_info::AccountInfo<'a>>,
1506    lp_escrow: Option<&'b solana_account_info::AccountInfo<'a>>,
1507    whirlpool: Option<&'b solana_account_info::AccountInfo<'a>>,
1508    position: Option<&'b solana_account_info::AccountInfo<'a>>,
1509    position_token_account: Option<&'b solana_account_info::AccountInfo<'a>>,
1510    lower_tick_array: Option<&'b solana_account_info::AccountInfo<'a>>,
1511    upper_tick_array: Option<&'b solana_account_info::AccountInfo<'a>>,
1512    token_a_mint: Option<&'b solana_account_info::AccountInfo<'a>>,
1513    token_b_mint: Option<&'b solana_account_info::AccountInfo<'a>>,
1514    token_a_ata: Option<&'b solana_account_info::AccountInfo<'a>>,
1515    token_b_ata: Option<&'b solana_account_info::AccountInfo<'a>>,
1516    token_a_vault: Option<&'b solana_account_info::AccountInfo<'a>>,
1517    token_b_vault: Option<&'b solana_account_info::AccountInfo<'a>>,
1518    reward1_mint: Option<&'b solana_account_info::AccountInfo<'a>>,
1519    reward2_mint: Option<&'b solana_account_info::AccountInfo<'a>>,
1520    reward3_mint: Option<&'b solana_account_info::AccountInfo<'a>>,
1521    reward1_ata: Option<&'b solana_account_info::AccountInfo<'a>>,
1522    reward2_ata: Option<&'b solana_account_info::AccountInfo<'a>>,
1523    reward3_ata: Option<&'b solana_account_info::AccountInfo<'a>>,
1524    reward1_vault: Option<&'b solana_account_info::AccountInfo<'a>>,
1525    reward2_vault: Option<&'b solana_account_info::AccountInfo<'a>>,
1526    reward3_vault: Option<&'b solana_account_info::AccountInfo<'a>>,
1527    system_program: Option<&'b solana_account_info::AccountInfo<'a>>,
1528    token_a_program: Option<&'b solana_account_info::AccountInfo<'a>>,
1529    token_b_program: Option<&'b solana_account_info::AccountInfo<'a>>,
1530    reward1_token_program: Option<&'b solana_account_info::AccountInfo<'a>>,
1531    reward2_token_program: Option<&'b solana_account_info::AccountInfo<'a>>,
1532    reward3_token_program: Option<&'b solana_account_info::AccountInfo<'a>>,
1533    ata_program: Option<&'b solana_account_info::AccountInfo<'a>>,
1534    memo_program: Option<&'b solana_account_info::AccountInfo<'a>>,
1535    whirlpool_program: Option<&'b solana_account_info::AccountInfo<'a>>,
1536    /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`.
1537    __remaining_accounts: Vec<(&'b solana_account_info::AccountInfo<'a>, bool, bool)>,
1538}