Skip to main content

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