1use borsh::BorshDeserialize;
9use borsh::BorshSerialize;
10
11pub struct PrintV1 {
13 pub edition_metadata: solana_program::pubkey::Pubkey,
15 pub edition: solana_program::pubkey::Pubkey,
17 pub edition_mint: (solana_program::pubkey::Pubkey, bool),
19 pub edition_token_account_owner: solana_program::pubkey::Pubkey,
21 pub edition_token_account: solana_program::pubkey::Pubkey,
23 pub edition_mint_authority: solana_program::pubkey::Pubkey,
25 pub edition_token_record: Option<solana_program::pubkey::Pubkey>,
27 pub master_edition: solana_program::pubkey::Pubkey,
29 pub edition_marker_pda: solana_program::pubkey::Pubkey,
31 pub payer: solana_program::pubkey::Pubkey,
33 pub master_token_account_owner: solana_program::pubkey::Pubkey,
35 pub master_token_account: solana_program::pubkey::Pubkey,
37 pub master_metadata: solana_program::pubkey::Pubkey,
39 pub update_authority: solana_program::pubkey::Pubkey,
41 pub spl_token_program: solana_program::pubkey::Pubkey,
43 pub spl_ata_program: solana_program::pubkey::Pubkey,
45 pub sysvar_instructions: solana_program::pubkey::Pubkey,
47 pub system_program: solana_program::pubkey::Pubkey,
49}
50
51impl PrintV1 {
52 pub fn instruction(
53 &self,
54 args: PrintV1InstructionArgs,
55 ) -> solana_program::instruction::Instruction {
56 self.instruction_with_remaining_accounts(args, &[])
57 }
58 #[allow(clippy::vec_init_then_push)]
59 pub fn instruction_with_remaining_accounts(
60 &self,
61 args: PrintV1InstructionArgs,
62 remaining_accounts: &[solana_program::instruction::AccountMeta],
63 ) -> solana_program::instruction::Instruction {
64 let mut accounts = Vec::with_capacity(18 + remaining_accounts.len());
65 accounts.push(solana_program::instruction::AccountMeta::new(
66 self.edition_metadata,
67 false,
68 ));
69 accounts.push(solana_program::instruction::AccountMeta::new(
70 self.edition,
71 false,
72 ));
73 accounts.push(solana_program::instruction::AccountMeta::new(
74 self.edition_mint.0,
75 self.edition_mint.1,
76 ));
77 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
78 self.edition_token_account_owner,
79 false,
80 ));
81 accounts.push(solana_program::instruction::AccountMeta::new(
82 self.edition_token_account,
83 false,
84 ));
85 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
86 self.edition_mint_authority,
87 true,
88 ));
89 if let Some(edition_token_record) = self.edition_token_record {
90 accounts.push(solana_program::instruction::AccountMeta::new(
91 edition_token_record,
92 false,
93 ));
94 } else {
95 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
96 crate::MPL_TOKEN_METADATA_ID,
97 false,
98 ));
99 }
100 accounts.push(solana_program::instruction::AccountMeta::new(
101 self.master_edition,
102 false,
103 ));
104 accounts.push(solana_program::instruction::AccountMeta::new(
105 self.edition_marker_pda,
106 false,
107 ));
108 accounts.push(solana_program::instruction::AccountMeta::new(
109 self.payer, true,
110 ));
111 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
112 self.master_token_account_owner,
113 true,
114 ));
115 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
116 self.master_token_account,
117 false,
118 ));
119 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
120 self.master_metadata,
121 false,
122 ));
123 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
124 self.update_authority,
125 false,
126 ));
127 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
128 self.spl_token_program,
129 false,
130 ));
131 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
132 self.spl_ata_program,
133 false,
134 ));
135 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
136 self.sysvar_instructions,
137 false,
138 ));
139 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
140 self.system_program,
141 false,
142 ));
143 accounts.extend_from_slice(remaining_accounts);
144 let mut data = PrintV1InstructionData::new().try_to_vec().unwrap();
145 let mut args = args.try_to_vec().unwrap();
146 data.append(&mut args);
147
148 solana_program::instruction::Instruction {
149 program_id: crate::MPL_TOKEN_METADATA_ID,
150 accounts,
151 data,
152 }
153 }
154}
155
156#[derive(BorshDeserialize, BorshSerialize)]
157struct PrintV1InstructionData {
158 discriminator: u8,
159 print_v1_discriminator: u8,
160}
161
162impl PrintV1InstructionData {
163 fn new() -> Self {
164 Self {
165 discriminator: 55,
166 print_v1_discriminator: 0,
167 }
168 }
169}
170
171#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)]
172#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
173pub struct PrintV1InstructionArgs {
174 pub edition_number: u64,
175}
176
177#[derive(Default)]
200pub struct PrintV1Builder {
201 edition_metadata: Option<solana_program::pubkey::Pubkey>,
202 edition: Option<solana_program::pubkey::Pubkey>,
203 edition_mint: Option<(solana_program::pubkey::Pubkey, bool)>,
204 edition_token_account_owner: Option<solana_program::pubkey::Pubkey>,
205 edition_token_account: Option<solana_program::pubkey::Pubkey>,
206 edition_mint_authority: Option<solana_program::pubkey::Pubkey>,
207 edition_token_record: Option<solana_program::pubkey::Pubkey>,
208 master_edition: Option<solana_program::pubkey::Pubkey>,
209 edition_marker_pda: Option<solana_program::pubkey::Pubkey>,
210 payer: Option<solana_program::pubkey::Pubkey>,
211 master_token_account_owner: Option<solana_program::pubkey::Pubkey>,
212 master_token_account: Option<solana_program::pubkey::Pubkey>,
213 master_metadata: Option<solana_program::pubkey::Pubkey>,
214 update_authority: Option<solana_program::pubkey::Pubkey>,
215 spl_token_program: Option<solana_program::pubkey::Pubkey>,
216 spl_ata_program: Option<solana_program::pubkey::Pubkey>,
217 sysvar_instructions: Option<solana_program::pubkey::Pubkey>,
218 system_program: Option<solana_program::pubkey::Pubkey>,
219 edition_number: Option<u64>,
220 __remaining_accounts: Vec<solana_program::instruction::AccountMeta>,
221}
222
223impl PrintV1Builder {
224 pub fn new() -> Self {
225 Self::default()
226 }
227 #[inline(always)]
229 pub fn edition_metadata(
230 &mut self,
231 edition_metadata: solana_program::pubkey::Pubkey,
232 ) -> &mut Self {
233 self.edition_metadata = Some(edition_metadata);
234 self
235 }
236 #[inline(always)]
238 pub fn edition(&mut self, edition: solana_program::pubkey::Pubkey) -> &mut Self {
239 self.edition = Some(edition);
240 self
241 }
242 #[inline(always)]
244 pub fn edition_mint(
245 &mut self,
246 edition_mint: solana_program::pubkey::Pubkey,
247 as_signer: bool,
248 ) -> &mut Self {
249 self.edition_mint = Some((edition_mint, as_signer));
250 self
251 }
252 #[inline(always)]
254 pub fn edition_token_account_owner(
255 &mut self,
256 edition_token_account_owner: solana_program::pubkey::Pubkey,
257 ) -> &mut Self {
258 self.edition_token_account_owner = Some(edition_token_account_owner);
259 self
260 }
261 #[inline(always)]
263 pub fn edition_token_account(
264 &mut self,
265 edition_token_account: solana_program::pubkey::Pubkey,
266 ) -> &mut Self {
267 self.edition_token_account = Some(edition_token_account);
268 self
269 }
270 #[inline(always)]
272 pub fn edition_mint_authority(
273 &mut self,
274 edition_mint_authority: solana_program::pubkey::Pubkey,
275 ) -> &mut Self {
276 self.edition_mint_authority = Some(edition_mint_authority);
277 self
278 }
279 #[inline(always)]
282 pub fn edition_token_record(
283 &mut self,
284 edition_token_record: Option<solana_program::pubkey::Pubkey>,
285 ) -> &mut Self {
286 self.edition_token_record = edition_token_record;
287 self
288 }
289 #[inline(always)]
291 pub fn master_edition(&mut self, master_edition: solana_program::pubkey::Pubkey) -> &mut Self {
292 self.master_edition = Some(master_edition);
293 self
294 }
295 #[inline(always)]
297 pub fn edition_marker_pda(
298 &mut self,
299 edition_marker_pda: solana_program::pubkey::Pubkey,
300 ) -> &mut Self {
301 self.edition_marker_pda = Some(edition_marker_pda);
302 self
303 }
304 #[inline(always)]
306 pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self {
307 self.payer = Some(payer);
308 self
309 }
310 #[inline(always)]
312 pub fn master_token_account_owner(
313 &mut self,
314 master_token_account_owner: solana_program::pubkey::Pubkey,
315 ) -> &mut Self {
316 self.master_token_account_owner = Some(master_token_account_owner);
317 self
318 }
319 #[inline(always)]
321 pub fn master_token_account(
322 &mut self,
323 master_token_account: solana_program::pubkey::Pubkey,
324 ) -> &mut Self {
325 self.master_token_account = Some(master_token_account);
326 self
327 }
328 #[inline(always)]
330 pub fn master_metadata(
331 &mut self,
332 master_metadata: solana_program::pubkey::Pubkey,
333 ) -> &mut Self {
334 self.master_metadata = Some(master_metadata);
335 self
336 }
337 #[inline(always)]
339 pub fn update_authority(
340 &mut self,
341 update_authority: solana_program::pubkey::Pubkey,
342 ) -> &mut Self {
343 self.update_authority = Some(update_authority);
344 self
345 }
346 #[inline(always)]
349 pub fn spl_token_program(
350 &mut self,
351 spl_token_program: solana_program::pubkey::Pubkey,
352 ) -> &mut Self {
353 self.spl_token_program = Some(spl_token_program);
354 self
355 }
356 #[inline(always)]
359 pub fn spl_ata_program(
360 &mut self,
361 spl_ata_program: solana_program::pubkey::Pubkey,
362 ) -> &mut Self {
363 self.spl_ata_program = Some(spl_ata_program);
364 self
365 }
366 #[inline(always)]
369 pub fn sysvar_instructions(
370 &mut self,
371 sysvar_instructions: solana_program::pubkey::Pubkey,
372 ) -> &mut Self {
373 self.sysvar_instructions = Some(sysvar_instructions);
374 self
375 }
376 #[inline(always)]
379 pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self {
380 self.system_program = Some(system_program);
381 self
382 }
383 #[inline(always)]
384 pub fn edition_number(&mut self, edition_number: u64) -> &mut Self {
385 self.edition_number = Some(edition_number);
386 self
387 }
388 #[inline(always)]
390 pub fn add_remaining_account(
391 &mut self,
392 account: solana_program::instruction::AccountMeta,
393 ) -> &mut Self {
394 self.__remaining_accounts.push(account);
395 self
396 }
397 #[inline(always)]
399 pub fn add_remaining_accounts(
400 &mut self,
401 accounts: &[solana_program::instruction::AccountMeta],
402 ) -> &mut Self {
403 self.__remaining_accounts.extend_from_slice(accounts);
404 self
405 }
406 #[allow(clippy::clone_on_copy)]
407 pub fn instruction(&self) -> solana_program::instruction::Instruction {
408 let accounts = PrintV1 {
409 edition_metadata: self.edition_metadata.expect("edition_metadata is not set"),
410 edition: self.edition.expect("edition is not set"),
411 edition_mint: self.edition_mint.expect("edition_mint is not set"),
412 edition_token_account_owner: self
413 .edition_token_account_owner
414 .expect("edition_token_account_owner is not set"),
415 edition_token_account: self
416 .edition_token_account
417 .expect("edition_token_account is not set"),
418 edition_mint_authority: self
419 .edition_mint_authority
420 .expect("edition_mint_authority is not set"),
421 edition_token_record: self.edition_token_record,
422 master_edition: self.master_edition.expect("master_edition is not set"),
423 edition_marker_pda: self
424 .edition_marker_pda
425 .expect("edition_marker_pda is not set"),
426 payer: self.payer.expect("payer is not set"),
427 master_token_account_owner: self
428 .master_token_account_owner
429 .expect("master_token_account_owner is not set"),
430 master_token_account: self
431 .master_token_account
432 .expect("master_token_account is not set"),
433 master_metadata: self.master_metadata.expect("master_metadata is not set"),
434 update_authority: self.update_authority.expect("update_authority is not set"),
435 spl_token_program: self.spl_token_program.unwrap_or(solana_program::pubkey!(
436 "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
437 )),
438 spl_ata_program: self.spl_ata_program.unwrap_or(solana_program::pubkey!(
439 "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
440 )),
441 sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!(
442 "Sysvar1nstructions1111111111111111111111111"
443 )),
444 system_program: self
445 .system_program
446 .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")),
447 };
448 let args = PrintV1InstructionArgs {
449 edition_number: self
450 .edition_number
451 .clone()
452 .expect("edition_number is not set"),
453 };
454
455 accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts)
456 }
457}
458
459pub struct PrintV1CpiAccounts<'a, 'b> {
461 pub edition_metadata: &'b solana_program::account_info::AccountInfo<'a>,
463 pub edition: &'b solana_program::account_info::AccountInfo<'a>,
465 pub edition_mint: (&'b solana_program::account_info::AccountInfo<'a>, bool),
467 pub edition_token_account_owner: &'b solana_program::account_info::AccountInfo<'a>,
469 pub edition_token_account: &'b solana_program::account_info::AccountInfo<'a>,
471 pub edition_mint_authority: &'b solana_program::account_info::AccountInfo<'a>,
473 pub edition_token_record: Option<&'b solana_program::account_info::AccountInfo<'a>>,
475 pub master_edition: &'b solana_program::account_info::AccountInfo<'a>,
477 pub edition_marker_pda: &'b solana_program::account_info::AccountInfo<'a>,
479 pub payer: &'b solana_program::account_info::AccountInfo<'a>,
481 pub master_token_account_owner: &'b solana_program::account_info::AccountInfo<'a>,
483 pub master_token_account: &'b solana_program::account_info::AccountInfo<'a>,
485 pub master_metadata: &'b solana_program::account_info::AccountInfo<'a>,
487 pub update_authority: &'b solana_program::account_info::AccountInfo<'a>,
489 pub spl_token_program: &'b solana_program::account_info::AccountInfo<'a>,
491 pub spl_ata_program: &'b solana_program::account_info::AccountInfo<'a>,
493 pub sysvar_instructions: &'b solana_program::account_info::AccountInfo<'a>,
495 pub system_program: &'b solana_program::account_info::AccountInfo<'a>,
497}
498
499pub struct PrintV1Cpi<'a, 'b> {
501 pub __program: &'b solana_program::account_info::AccountInfo<'a>,
503 pub edition_metadata: &'b solana_program::account_info::AccountInfo<'a>,
505 pub edition: &'b solana_program::account_info::AccountInfo<'a>,
507 pub edition_mint: (&'b solana_program::account_info::AccountInfo<'a>, bool),
509 pub edition_token_account_owner: &'b solana_program::account_info::AccountInfo<'a>,
511 pub edition_token_account: &'b solana_program::account_info::AccountInfo<'a>,
513 pub edition_mint_authority: &'b solana_program::account_info::AccountInfo<'a>,
515 pub edition_token_record: Option<&'b solana_program::account_info::AccountInfo<'a>>,
517 pub master_edition: &'b solana_program::account_info::AccountInfo<'a>,
519 pub edition_marker_pda: &'b solana_program::account_info::AccountInfo<'a>,
521 pub payer: &'b solana_program::account_info::AccountInfo<'a>,
523 pub master_token_account_owner: &'b solana_program::account_info::AccountInfo<'a>,
525 pub master_token_account: &'b solana_program::account_info::AccountInfo<'a>,
527 pub master_metadata: &'b solana_program::account_info::AccountInfo<'a>,
529 pub update_authority: &'b solana_program::account_info::AccountInfo<'a>,
531 pub spl_token_program: &'b solana_program::account_info::AccountInfo<'a>,
533 pub spl_ata_program: &'b solana_program::account_info::AccountInfo<'a>,
535 pub sysvar_instructions: &'b solana_program::account_info::AccountInfo<'a>,
537 pub system_program: &'b solana_program::account_info::AccountInfo<'a>,
539 pub __args: PrintV1InstructionArgs,
541}
542
543impl<'a, 'b> PrintV1Cpi<'a, 'b> {
544 pub fn new(
545 program: &'b solana_program::account_info::AccountInfo<'a>,
546 accounts: PrintV1CpiAccounts<'a, 'b>,
547 args: PrintV1InstructionArgs,
548 ) -> Self {
549 Self {
550 __program: program,
551 edition_metadata: accounts.edition_metadata,
552 edition: accounts.edition,
553 edition_mint: accounts.edition_mint,
554 edition_token_account_owner: accounts.edition_token_account_owner,
555 edition_token_account: accounts.edition_token_account,
556 edition_mint_authority: accounts.edition_mint_authority,
557 edition_token_record: accounts.edition_token_record,
558 master_edition: accounts.master_edition,
559 edition_marker_pda: accounts.edition_marker_pda,
560 payer: accounts.payer,
561 master_token_account_owner: accounts.master_token_account_owner,
562 master_token_account: accounts.master_token_account,
563 master_metadata: accounts.master_metadata,
564 update_authority: accounts.update_authority,
565 spl_token_program: accounts.spl_token_program,
566 spl_ata_program: accounts.spl_ata_program,
567 sysvar_instructions: accounts.sysvar_instructions,
568 system_program: accounts.system_program,
569 __args: args,
570 }
571 }
572 #[inline(always)]
573 pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult {
574 self.invoke_signed_with_remaining_accounts(&[], &[])
575 }
576 #[inline(always)]
577 pub fn invoke_with_remaining_accounts(
578 &self,
579 remaining_accounts: &[(
580 &'b solana_program::account_info::AccountInfo<'a>,
581 bool,
582 bool,
583 )],
584 ) -> solana_program::entrypoint::ProgramResult {
585 self.invoke_signed_with_remaining_accounts(&[], remaining_accounts)
586 }
587 #[inline(always)]
588 pub fn invoke_signed(
589 &self,
590 signers_seeds: &[&[&[u8]]],
591 ) -> solana_program::entrypoint::ProgramResult {
592 self.invoke_signed_with_remaining_accounts(signers_seeds, &[])
593 }
594 #[allow(clippy::clone_on_copy)]
595 #[allow(clippy::vec_init_then_push)]
596 pub fn invoke_signed_with_remaining_accounts(
597 &self,
598 signers_seeds: &[&[&[u8]]],
599 remaining_accounts: &[(
600 &'b solana_program::account_info::AccountInfo<'a>,
601 bool,
602 bool,
603 )],
604 ) -> solana_program::entrypoint::ProgramResult {
605 let mut accounts = Vec::with_capacity(18 + remaining_accounts.len());
606 accounts.push(solana_program::instruction::AccountMeta::new(
607 *self.edition_metadata.key,
608 false,
609 ));
610 accounts.push(solana_program::instruction::AccountMeta::new(
611 *self.edition.key,
612 false,
613 ));
614 accounts.push(solana_program::instruction::AccountMeta::new(
615 *self.edition_mint.0.key,
616 self.edition_mint.1,
617 ));
618 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
619 *self.edition_token_account_owner.key,
620 false,
621 ));
622 accounts.push(solana_program::instruction::AccountMeta::new(
623 *self.edition_token_account.key,
624 false,
625 ));
626 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
627 *self.edition_mint_authority.key,
628 true,
629 ));
630 if let Some(edition_token_record) = self.edition_token_record {
631 accounts.push(solana_program::instruction::AccountMeta::new(
632 *edition_token_record.key,
633 false,
634 ));
635 } else {
636 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
637 crate::MPL_TOKEN_METADATA_ID,
638 false,
639 ));
640 }
641 accounts.push(solana_program::instruction::AccountMeta::new(
642 *self.master_edition.key,
643 false,
644 ));
645 accounts.push(solana_program::instruction::AccountMeta::new(
646 *self.edition_marker_pda.key,
647 false,
648 ));
649 accounts.push(solana_program::instruction::AccountMeta::new(
650 *self.payer.key,
651 true,
652 ));
653 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
654 *self.master_token_account_owner.key,
655 true,
656 ));
657 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
658 *self.master_token_account.key,
659 false,
660 ));
661 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
662 *self.master_metadata.key,
663 false,
664 ));
665 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
666 *self.update_authority.key,
667 false,
668 ));
669 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
670 *self.spl_token_program.key,
671 false,
672 ));
673 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
674 *self.spl_ata_program.key,
675 false,
676 ));
677 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
678 *self.sysvar_instructions.key,
679 false,
680 ));
681 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
682 *self.system_program.key,
683 false,
684 ));
685 remaining_accounts.iter().for_each(|remaining_account| {
686 accounts.push(solana_program::instruction::AccountMeta {
687 pubkey: *remaining_account.0.key,
688 is_signer: remaining_account.1,
689 is_writable: remaining_account.2,
690 })
691 });
692 let mut data = PrintV1InstructionData::new().try_to_vec().unwrap();
693 let mut args = self.__args.try_to_vec().unwrap();
694 data.append(&mut args);
695
696 let instruction = solana_program::instruction::Instruction {
697 program_id: crate::MPL_TOKEN_METADATA_ID,
698 accounts,
699 data,
700 };
701 let mut account_infos = Vec::with_capacity(18 + 1 + remaining_accounts.len());
702 account_infos.push(self.__program.clone());
703 account_infos.push(self.edition_metadata.clone());
704 account_infos.push(self.edition.clone());
705 account_infos.push(self.edition_mint.0.clone());
706 account_infos.push(self.edition_token_account_owner.clone());
707 account_infos.push(self.edition_token_account.clone());
708 account_infos.push(self.edition_mint_authority.clone());
709 if let Some(edition_token_record) = self.edition_token_record {
710 account_infos.push(edition_token_record.clone());
711 }
712 account_infos.push(self.master_edition.clone());
713 account_infos.push(self.edition_marker_pda.clone());
714 account_infos.push(self.payer.clone());
715 account_infos.push(self.master_token_account_owner.clone());
716 account_infos.push(self.master_token_account.clone());
717 account_infos.push(self.master_metadata.clone());
718 account_infos.push(self.update_authority.clone());
719 account_infos.push(self.spl_token_program.clone());
720 account_infos.push(self.spl_ata_program.clone());
721 account_infos.push(self.sysvar_instructions.clone());
722 account_infos.push(self.system_program.clone());
723 remaining_accounts
724 .iter()
725 .for_each(|remaining_account| account_infos.push(remaining_account.0.clone()));
726
727 if signers_seeds.is_empty() {
728 solana_program::program::invoke(&instruction, &account_infos)
729 } else {
730 solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds)
731 }
732 }
733}
734
735pub struct PrintV1CpiBuilder<'a, 'b> {
758 instruction: Box<PrintV1CpiBuilderInstruction<'a, 'b>>,
759}
760
761impl<'a, 'b> PrintV1CpiBuilder<'a, 'b> {
762 pub fn new(program: &'b solana_program::account_info::AccountInfo<'a>) -> Self {
763 let instruction = Box::new(PrintV1CpiBuilderInstruction {
764 __program: program,
765 edition_metadata: None,
766 edition: None,
767 edition_mint: None,
768 edition_token_account_owner: None,
769 edition_token_account: None,
770 edition_mint_authority: None,
771 edition_token_record: None,
772 master_edition: None,
773 edition_marker_pda: None,
774 payer: None,
775 master_token_account_owner: None,
776 master_token_account: None,
777 master_metadata: None,
778 update_authority: None,
779 spl_token_program: None,
780 spl_ata_program: None,
781 sysvar_instructions: None,
782 system_program: None,
783 edition_number: None,
784 __remaining_accounts: Vec::new(),
785 });
786 Self { instruction }
787 }
788 #[inline(always)]
790 pub fn edition_metadata(
791 &mut self,
792 edition_metadata: &'b solana_program::account_info::AccountInfo<'a>,
793 ) -> &mut Self {
794 self.instruction.edition_metadata = Some(edition_metadata);
795 self
796 }
797 #[inline(always)]
799 pub fn edition(
800 &mut self,
801 edition: &'b solana_program::account_info::AccountInfo<'a>,
802 ) -> &mut Self {
803 self.instruction.edition = Some(edition);
804 self
805 }
806 #[inline(always)]
808 pub fn edition_mint(
809 &mut self,
810 edition_mint: &'b solana_program::account_info::AccountInfo<'a>,
811 as_signer: bool,
812 ) -> &mut Self {
813 self.instruction.edition_mint = Some((edition_mint, as_signer));
814 self
815 }
816 #[inline(always)]
818 pub fn edition_token_account_owner(
819 &mut self,
820 edition_token_account_owner: &'b solana_program::account_info::AccountInfo<'a>,
821 ) -> &mut Self {
822 self.instruction.edition_token_account_owner = Some(edition_token_account_owner);
823 self
824 }
825 #[inline(always)]
827 pub fn edition_token_account(
828 &mut self,
829 edition_token_account: &'b solana_program::account_info::AccountInfo<'a>,
830 ) -> &mut Self {
831 self.instruction.edition_token_account = Some(edition_token_account);
832 self
833 }
834 #[inline(always)]
836 pub fn edition_mint_authority(
837 &mut self,
838 edition_mint_authority: &'b solana_program::account_info::AccountInfo<'a>,
839 ) -> &mut Self {
840 self.instruction.edition_mint_authority = Some(edition_mint_authority);
841 self
842 }
843 #[inline(always)]
846 pub fn edition_token_record(
847 &mut self,
848 edition_token_record: Option<&'b solana_program::account_info::AccountInfo<'a>>,
849 ) -> &mut Self {
850 self.instruction.edition_token_record = edition_token_record;
851 self
852 }
853 #[inline(always)]
855 pub fn master_edition(
856 &mut self,
857 master_edition: &'b solana_program::account_info::AccountInfo<'a>,
858 ) -> &mut Self {
859 self.instruction.master_edition = Some(master_edition);
860 self
861 }
862 #[inline(always)]
864 pub fn edition_marker_pda(
865 &mut self,
866 edition_marker_pda: &'b solana_program::account_info::AccountInfo<'a>,
867 ) -> &mut Self {
868 self.instruction.edition_marker_pda = Some(edition_marker_pda);
869 self
870 }
871 #[inline(always)]
873 pub fn payer(&mut self, payer: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self {
874 self.instruction.payer = Some(payer);
875 self
876 }
877 #[inline(always)]
879 pub fn master_token_account_owner(
880 &mut self,
881 master_token_account_owner: &'b solana_program::account_info::AccountInfo<'a>,
882 ) -> &mut Self {
883 self.instruction.master_token_account_owner = Some(master_token_account_owner);
884 self
885 }
886 #[inline(always)]
888 pub fn master_token_account(
889 &mut self,
890 master_token_account: &'b solana_program::account_info::AccountInfo<'a>,
891 ) -> &mut Self {
892 self.instruction.master_token_account = Some(master_token_account);
893 self
894 }
895 #[inline(always)]
897 pub fn master_metadata(
898 &mut self,
899 master_metadata: &'b solana_program::account_info::AccountInfo<'a>,
900 ) -> &mut Self {
901 self.instruction.master_metadata = Some(master_metadata);
902 self
903 }
904 #[inline(always)]
906 pub fn update_authority(
907 &mut self,
908 update_authority: &'b solana_program::account_info::AccountInfo<'a>,
909 ) -> &mut Self {
910 self.instruction.update_authority = Some(update_authority);
911 self
912 }
913 #[inline(always)]
915 pub fn spl_token_program(
916 &mut self,
917 spl_token_program: &'b solana_program::account_info::AccountInfo<'a>,
918 ) -> &mut Self {
919 self.instruction.spl_token_program = Some(spl_token_program);
920 self
921 }
922 #[inline(always)]
924 pub fn spl_ata_program(
925 &mut self,
926 spl_ata_program: &'b solana_program::account_info::AccountInfo<'a>,
927 ) -> &mut Self {
928 self.instruction.spl_ata_program = Some(spl_ata_program);
929 self
930 }
931 #[inline(always)]
933 pub fn sysvar_instructions(
934 &mut self,
935 sysvar_instructions: &'b solana_program::account_info::AccountInfo<'a>,
936 ) -> &mut Self {
937 self.instruction.sysvar_instructions = Some(sysvar_instructions);
938 self
939 }
940 #[inline(always)]
942 pub fn system_program(
943 &mut self,
944 system_program: &'b solana_program::account_info::AccountInfo<'a>,
945 ) -> &mut Self {
946 self.instruction.system_program = Some(system_program);
947 self
948 }
949 #[inline(always)]
950 pub fn edition_number(&mut self, edition_number: u64) -> &mut Self {
951 self.instruction.edition_number = Some(edition_number);
952 self
953 }
954 #[inline(always)]
956 pub fn add_remaining_account(
957 &mut self,
958 account: &'b solana_program::account_info::AccountInfo<'a>,
959 is_writable: bool,
960 is_signer: bool,
961 ) -> &mut Self {
962 self.instruction
963 .__remaining_accounts
964 .push((account, is_writable, is_signer));
965 self
966 }
967 #[inline(always)]
972 pub fn add_remaining_accounts(
973 &mut self,
974 accounts: &[(
975 &'b solana_program::account_info::AccountInfo<'a>,
976 bool,
977 bool,
978 )],
979 ) -> &mut Self {
980 self.instruction
981 .__remaining_accounts
982 .extend_from_slice(accounts);
983 self
984 }
985 #[inline(always)]
986 pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult {
987 self.invoke_signed(&[])
988 }
989 #[allow(clippy::clone_on_copy)]
990 #[allow(clippy::vec_init_then_push)]
991 pub fn invoke_signed(
992 &self,
993 signers_seeds: &[&[&[u8]]],
994 ) -> solana_program::entrypoint::ProgramResult {
995 let args = PrintV1InstructionArgs {
996 edition_number: self
997 .instruction
998 .edition_number
999 .clone()
1000 .expect("edition_number is not set"),
1001 };
1002 let instruction = PrintV1Cpi {
1003 __program: self.instruction.__program,
1004
1005 edition_metadata: self
1006 .instruction
1007 .edition_metadata
1008 .expect("edition_metadata is not set"),
1009
1010 edition: self.instruction.edition.expect("edition is not set"),
1011
1012 edition_mint: self
1013 .instruction
1014 .edition_mint
1015 .expect("edition_mint is not set"),
1016
1017 edition_token_account_owner: self
1018 .instruction
1019 .edition_token_account_owner
1020 .expect("edition_token_account_owner is not set"),
1021
1022 edition_token_account: self
1023 .instruction
1024 .edition_token_account
1025 .expect("edition_token_account is not set"),
1026
1027 edition_mint_authority: self
1028 .instruction
1029 .edition_mint_authority
1030 .expect("edition_mint_authority is not set"),
1031
1032 edition_token_record: self.instruction.edition_token_record,
1033
1034 master_edition: self
1035 .instruction
1036 .master_edition
1037 .expect("master_edition is not set"),
1038
1039 edition_marker_pda: self
1040 .instruction
1041 .edition_marker_pda
1042 .expect("edition_marker_pda is not set"),
1043
1044 payer: self.instruction.payer.expect("payer is not set"),
1045
1046 master_token_account_owner: self
1047 .instruction
1048 .master_token_account_owner
1049 .expect("master_token_account_owner is not set"),
1050
1051 master_token_account: self
1052 .instruction
1053 .master_token_account
1054 .expect("master_token_account is not set"),
1055
1056 master_metadata: self
1057 .instruction
1058 .master_metadata
1059 .expect("master_metadata is not set"),
1060
1061 update_authority: self
1062 .instruction
1063 .update_authority
1064 .expect("update_authority is not set"),
1065
1066 spl_token_program: self
1067 .instruction
1068 .spl_token_program
1069 .expect("spl_token_program is not set"),
1070
1071 spl_ata_program: self
1072 .instruction
1073 .spl_ata_program
1074 .expect("spl_ata_program is not set"),
1075
1076 sysvar_instructions: self
1077 .instruction
1078 .sysvar_instructions
1079 .expect("sysvar_instructions is not set"),
1080
1081 system_program: self
1082 .instruction
1083 .system_program
1084 .expect("system_program is not set"),
1085 __args: args,
1086 };
1087 instruction.invoke_signed_with_remaining_accounts(
1088 signers_seeds,
1089 &self.instruction.__remaining_accounts,
1090 )
1091 }
1092}
1093
1094struct PrintV1CpiBuilderInstruction<'a, 'b> {
1095 __program: &'b solana_program::account_info::AccountInfo<'a>,
1096 edition_metadata: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1097 edition: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1098 edition_mint: Option<(&'b solana_program::account_info::AccountInfo<'a>, bool)>,
1099 edition_token_account_owner: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1100 edition_token_account: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1101 edition_mint_authority: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1102 edition_token_record: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1103 master_edition: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1104 edition_marker_pda: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1105 payer: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1106 master_token_account_owner: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1107 master_token_account: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1108 master_metadata: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1109 update_authority: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1110 spl_token_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1111 spl_ata_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1112 sysvar_instructions: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1113 system_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1114 edition_number: Option<u64>,
1115 __remaining_accounts: Vec<(
1117 &'b solana_program::account_info::AccountInfo<'a>,
1118 bool,
1119 bool,
1120 )>,
1121}