Skip to main content

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