Skip to main content

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