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