1use crate::generated::types::BurnArgs;
9use borsh::BorshDeserialize;
10use borsh::BorshSerialize;
11
12pub struct Burn {
14 pub authority: solana_program::pubkey::Pubkey,
16 pub collection_metadata: Option<solana_program::pubkey::Pubkey>,
18 pub metadata: solana_program::pubkey::Pubkey,
20 pub edition: Option<solana_program::pubkey::Pubkey>,
22 pub mint: solana_program::pubkey::Pubkey,
24 pub token: solana_program::pubkey::Pubkey,
26 pub master_edition: Option<solana_program::pubkey::Pubkey>,
28 pub master_edition_mint: Option<solana_program::pubkey::Pubkey>,
30 pub master_edition_token: Option<solana_program::pubkey::Pubkey>,
32 pub edition_marker: Option<solana_program::pubkey::Pubkey>,
34 pub token_record: Option<solana_program::pubkey::Pubkey>,
36 pub system_program: solana_program::pubkey::Pubkey,
38 pub sysvar_instructions: solana_program::pubkey::Pubkey,
40 pub spl_token_program: solana_program::pubkey::Pubkey,
42}
43
44impl Burn {
45 pub fn instruction(
46 &self,
47 args: BurnInstructionArgs,
48 ) -> solana_program::instruction::Instruction {
49 self.instruction_with_remaining_accounts(args, &[])
50 }
51 #[allow(clippy::vec_init_then_push)]
52 pub fn instruction_with_remaining_accounts(
53 &self,
54 args: BurnInstructionArgs,
55 remaining_accounts: &[solana_program::instruction::AccountMeta],
56 ) -> solana_program::instruction::Instruction {
57 let mut accounts = Vec::with_capacity(14 + remaining_accounts.len());
58 accounts.push(solana_program::instruction::AccountMeta::new(
59 self.authority,
60 true,
61 ));
62 if let Some(collection_metadata) = self.collection_metadata {
63 accounts.push(solana_program::instruction::AccountMeta::new(
64 collection_metadata,
65 false,
66 ));
67 } else {
68 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
69 crate::MPL_TOKEN_METADATA_ID,
70 false,
71 ));
72 }
73 accounts.push(solana_program::instruction::AccountMeta::new(
74 self.metadata,
75 false,
76 ));
77 if let Some(edition) = self.edition {
78 accounts.push(solana_program::instruction::AccountMeta::new(
79 edition, false,
80 ));
81 } else {
82 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
83 crate::MPL_TOKEN_METADATA_ID,
84 false,
85 ));
86 }
87 accounts.push(solana_program::instruction::AccountMeta::new(
88 self.mint, false,
89 ));
90 accounts.push(solana_program::instruction::AccountMeta::new(
91 self.token, false,
92 ));
93 if let Some(master_edition) = self.master_edition {
94 accounts.push(solana_program::instruction::AccountMeta::new(
95 master_edition,
96 false,
97 ));
98 } else {
99 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
100 crate::MPL_TOKEN_METADATA_ID,
101 false,
102 ));
103 }
104 if let Some(master_edition_mint) = self.master_edition_mint {
105 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
106 master_edition_mint,
107 false,
108 ));
109 } else {
110 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
111 crate::MPL_TOKEN_METADATA_ID,
112 false,
113 ));
114 }
115 if let Some(master_edition_token) = self.master_edition_token {
116 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
117 master_edition_token,
118 false,
119 ));
120 } else {
121 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
122 crate::MPL_TOKEN_METADATA_ID,
123 false,
124 ));
125 }
126 if let Some(edition_marker) = self.edition_marker {
127 accounts.push(solana_program::instruction::AccountMeta::new(
128 edition_marker,
129 false,
130 ));
131 } else {
132 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
133 crate::MPL_TOKEN_METADATA_ID,
134 false,
135 ));
136 }
137 if let Some(token_record) = self.token_record {
138 accounts.push(solana_program::instruction::AccountMeta::new(
139 token_record,
140 false,
141 ));
142 } else {
143 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
144 crate::MPL_TOKEN_METADATA_ID,
145 false,
146 ));
147 }
148 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
149 self.system_program,
150 false,
151 ));
152 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
153 self.sysvar_instructions,
154 false,
155 ));
156 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
157 self.spl_token_program,
158 false,
159 ));
160 accounts.extend_from_slice(remaining_accounts);
161 let mut data = BurnInstructionData::new().try_to_vec().unwrap();
162 let mut args = args.try_to_vec().unwrap();
163 data.append(&mut args);
164
165 solana_program::instruction::Instruction {
166 program_id: crate::MPL_TOKEN_METADATA_ID,
167 accounts,
168 data,
169 }
170 }
171}
172
173#[derive(BorshDeserialize, BorshSerialize)]
174struct BurnInstructionData {
175 discriminator: u8,
176}
177
178impl BurnInstructionData {
179 fn new() -> Self {
180 Self { discriminator: 41 }
181 }
182}
183
184#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)]
185#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
186pub struct BurnInstructionArgs {
187 pub burn_args: BurnArgs,
188}
189
190#[derive(Default)]
209pub struct BurnBuilder {
210 authority: Option<solana_program::pubkey::Pubkey>,
211 collection_metadata: Option<solana_program::pubkey::Pubkey>,
212 metadata: Option<solana_program::pubkey::Pubkey>,
213 edition: Option<solana_program::pubkey::Pubkey>,
214 mint: Option<solana_program::pubkey::Pubkey>,
215 token: Option<solana_program::pubkey::Pubkey>,
216 master_edition: Option<solana_program::pubkey::Pubkey>,
217 master_edition_mint: Option<solana_program::pubkey::Pubkey>,
218 master_edition_token: Option<solana_program::pubkey::Pubkey>,
219 edition_marker: Option<solana_program::pubkey::Pubkey>,
220 token_record: Option<solana_program::pubkey::Pubkey>,
221 system_program: Option<solana_program::pubkey::Pubkey>,
222 sysvar_instructions: Option<solana_program::pubkey::Pubkey>,
223 spl_token_program: Option<solana_program::pubkey::Pubkey>,
224 burn_args: Option<BurnArgs>,
225 __remaining_accounts: Vec<solana_program::instruction::AccountMeta>,
226}
227
228impl BurnBuilder {
229 pub fn new() -> Self {
230 Self::default()
231 }
232 #[inline(always)]
234 pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self {
235 self.authority = Some(authority);
236 self
237 }
238 #[inline(always)]
241 pub fn collection_metadata(
242 &mut self,
243 collection_metadata: Option<solana_program::pubkey::Pubkey>,
244 ) -> &mut Self {
245 self.collection_metadata = collection_metadata;
246 self
247 }
248 #[inline(always)]
250 pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self {
251 self.metadata = Some(metadata);
252 self
253 }
254 #[inline(always)]
257 pub fn edition(&mut self, edition: Option<solana_program::pubkey::Pubkey>) -> &mut Self {
258 self.edition = edition;
259 self
260 }
261 #[inline(always)]
263 pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self {
264 self.mint = Some(mint);
265 self
266 }
267 #[inline(always)]
269 pub fn token(&mut self, token: solana_program::pubkey::Pubkey) -> &mut Self {
270 self.token = Some(token);
271 self
272 }
273 #[inline(always)]
276 pub fn master_edition(
277 &mut self,
278 master_edition: Option<solana_program::pubkey::Pubkey>,
279 ) -> &mut Self {
280 self.master_edition = master_edition;
281 self
282 }
283 #[inline(always)]
286 pub fn master_edition_mint(
287 &mut self,
288 master_edition_mint: Option<solana_program::pubkey::Pubkey>,
289 ) -> &mut Self {
290 self.master_edition_mint = master_edition_mint;
291 self
292 }
293 #[inline(always)]
296 pub fn master_edition_token(
297 &mut self,
298 master_edition_token: Option<solana_program::pubkey::Pubkey>,
299 ) -> &mut Self {
300 self.master_edition_token = master_edition_token;
301 self
302 }
303 #[inline(always)]
306 pub fn edition_marker(
307 &mut self,
308 edition_marker: Option<solana_program::pubkey::Pubkey>,
309 ) -> &mut Self {
310 self.edition_marker = edition_marker;
311 self
312 }
313 #[inline(always)]
316 pub fn token_record(
317 &mut self,
318 token_record: Option<solana_program::pubkey::Pubkey>,
319 ) -> &mut Self {
320 self.token_record = token_record;
321 self
322 }
323 #[inline(always)]
326 pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self {
327 self.system_program = Some(system_program);
328 self
329 }
330 #[inline(always)]
333 pub fn sysvar_instructions(
334 &mut self,
335 sysvar_instructions: solana_program::pubkey::Pubkey,
336 ) -> &mut Self {
337 self.sysvar_instructions = Some(sysvar_instructions);
338 self
339 }
340 #[inline(always)]
343 pub fn spl_token_program(
344 &mut self,
345 spl_token_program: solana_program::pubkey::Pubkey,
346 ) -> &mut Self {
347 self.spl_token_program = Some(spl_token_program);
348 self
349 }
350 #[inline(always)]
351 pub fn burn_args(&mut self, burn_args: BurnArgs) -> &mut Self {
352 self.burn_args = Some(burn_args);
353 self
354 }
355 #[inline(always)]
357 pub fn add_remaining_account(
358 &mut self,
359 account: solana_program::instruction::AccountMeta,
360 ) -> &mut Self {
361 self.__remaining_accounts.push(account);
362 self
363 }
364 #[inline(always)]
366 pub fn add_remaining_accounts(
367 &mut self,
368 accounts: &[solana_program::instruction::AccountMeta],
369 ) -> &mut Self {
370 self.__remaining_accounts.extend_from_slice(accounts);
371 self
372 }
373 #[allow(clippy::clone_on_copy)]
374 pub fn instruction(&self) -> solana_program::instruction::Instruction {
375 let accounts = Burn {
376 authority: self.authority.expect("authority is not set"),
377 collection_metadata: self.collection_metadata,
378 metadata: self.metadata.expect("metadata is not set"),
379 edition: self.edition,
380 mint: self.mint.expect("mint is not set"),
381 token: self.token.expect("token is not set"),
382 master_edition: self.master_edition,
383 master_edition_mint: self.master_edition_mint,
384 master_edition_token: self.master_edition_token,
385 edition_marker: self.edition_marker,
386 token_record: self.token_record,
387 system_program: self
388 .system_program
389 .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")),
390 sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!(
391 "Sysvar1nstructions1111111111111111111111111"
392 )),
393 spl_token_program: self.spl_token_program.unwrap_or(solana_program::pubkey!(
394 "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
395 )),
396 };
397 let args = BurnInstructionArgs {
398 burn_args: self.burn_args.clone().expect("burn_args is not set"),
399 };
400
401 accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts)
402 }
403}
404
405pub struct BurnCpiAccounts<'a, 'b> {
407 pub authority: &'b solana_program::account_info::AccountInfo<'a>,
409 pub collection_metadata: Option<&'b solana_program::account_info::AccountInfo<'a>>,
411 pub metadata: &'b solana_program::account_info::AccountInfo<'a>,
413 pub edition: Option<&'b solana_program::account_info::AccountInfo<'a>>,
415 pub mint: &'b solana_program::account_info::AccountInfo<'a>,
417 pub token: &'b solana_program::account_info::AccountInfo<'a>,
419 pub master_edition: Option<&'b solana_program::account_info::AccountInfo<'a>>,
421 pub master_edition_mint: Option<&'b solana_program::account_info::AccountInfo<'a>>,
423 pub master_edition_token: Option<&'b solana_program::account_info::AccountInfo<'a>>,
425 pub edition_marker: Option<&'b solana_program::account_info::AccountInfo<'a>>,
427 pub token_record: Option<&'b solana_program::account_info::AccountInfo<'a>>,
429 pub system_program: &'b solana_program::account_info::AccountInfo<'a>,
431 pub sysvar_instructions: &'b solana_program::account_info::AccountInfo<'a>,
433 pub spl_token_program: &'b solana_program::account_info::AccountInfo<'a>,
435}
436
437pub struct BurnCpi<'a, 'b> {
439 pub __program: &'b solana_program::account_info::AccountInfo<'a>,
441 pub authority: &'b solana_program::account_info::AccountInfo<'a>,
443 pub collection_metadata: Option<&'b solana_program::account_info::AccountInfo<'a>>,
445 pub metadata: &'b solana_program::account_info::AccountInfo<'a>,
447 pub edition: Option<&'b solana_program::account_info::AccountInfo<'a>>,
449 pub mint: &'b solana_program::account_info::AccountInfo<'a>,
451 pub token: &'b solana_program::account_info::AccountInfo<'a>,
453 pub master_edition: Option<&'b solana_program::account_info::AccountInfo<'a>>,
455 pub master_edition_mint: Option<&'b solana_program::account_info::AccountInfo<'a>>,
457 pub master_edition_token: Option<&'b solana_program::account_info::AccountInfo<'a>>,
459 pub edition_marker: Option<&'b solana_program::account_info::AccountInfo<'a>>,
461 pub token_record: Option<&'b solana_program::account_info::AccountInfo<'a>>,
463 pub system_program: &'b solana_program::account_info::AccountInfo<'a>,
465 pub sysvar_instructions: &'b solana_program::account_info::AccountInfo<'a>,
467 pub spl_token_program: &'b solana_program::account_info::AccountInfo<'a>,
469 pub __args: BurnInstructionArgs,
471}
472
473impl<'a, 'b> BurnCpi<'a, 'b> {
474 pub fn new(
475 program: &'b solana_program::account_info::AccountInfo<'a>,
476 accounts: BurnCpiAccounts<'a, 'b>,
477 args: BurnInstructionArgs,
478 ) -> Self {
479 Self {
480 __program: program,
481 authority: accounts.authority,
482 collection_metadata: accounts.collection_metadata,
483 metadata: accounts.metadata,
484 edition: accounts.edition,
485 mint: accounts.mint,
486 token: accounts.token,
487 master_edition: accounts.master_edition,
488 master_edition_mint: accounts.master_edition_mint,
489 master_edition_token: accounts.master_edition_token,
490 edition_marker: accounts.edition_marker,
491 token_record: accounts.token_record,
492 system_program: accounts.system_program,
493 sysvar_instructions: accounts.sysvar_instructions,
494 spl_token_program: accounts.spl_token_program,
495 __args: args,
496 }
497 }
498 #[inline(always)]
499 pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult {
500 self.invoke_signed_with_remaining_accounts(&[], &[])
501 }
502 #[inline(always)]
503 pub fn invoke_with_remaining_accounts(
504 &self,
505 remaining_accounts: &[(
506 &'b solana_program::account_info::AccountInfo<'a>,
507 bool,
508 bool,
509 )],
510 ) -> solana_program::entrypoint::ProgramResult {
511 self.invoke_signed_with_remaining_accounts(&[], remaining_accounts)
512 }
513 #[inline(always)]
514 pub fn invoke_signed(
515 &self,
516 signers_seeds: &[&[&[u8]]],
517 ) -> solana_program::entrypoint::ProgramResult {
518 self.invoke_signed_with_remaining_accounts(signers_seeds, &[])
519 }
520 #[allow(clippy::clone_on_copy)]
521 #[allow(clippy::vec_init_then_push)]
522 pub fn invoke_signed_with_remaining_accounts(
523 &self,
524 signers_seeds: &[&[&[u8]]],
525 remaining_accounts: &[(
526 &'b solana_program::account_info::AccountInfo<'a>,
527 bool,
528 bool,
529 )],
530 ) -> solana_program::entrypoint::ProgramResult {
531 let mut accounts = Vec::with_capacity(14 + remaining_accounts.len());
532 accounts.push(solana_program::instruction::AccountMeta::new(
533 *self.authority.key,
534 true,
535 ));
536 if let Some(collection_metadata) = self.collection_metadata {
537 accounts.push(solana_program::instruction::AccountMeta::new(
538 *collection_metadata.key,
539 false,
540 ));
541 } else {
542 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
543 crate::MPL_TOKEN_METADATA_ID,
544 false,
545 ));
546 }
547 accounts.push(solana_program::instruction::AccountMeta::new(
548 *self.metadata.key,
549 false,
550 ));
551 if let Some(edition) = self.edition {
552 accounts.push(solana_program::instruction::AccountMeta::new(
553 *edition.key,
554 false,
555 ));
556 } else {
557 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
558 crate::MPL_TOKEN_METADATA_ID,
559 false,
560 ));
561 }
562 accounts.push(solana_program::instruction::AccountMeta::new(
563 *self.mint.key,
564 false,
565 ));
566 accounts.push(solana_program::instruction::AccountMeta::new(
567 *self.token.key,
568 false,
569 ));
570 if let Some(master_edition) = self.master_edition {
571 accounts.push(solana_program::instruction::AccountMeta::new(
572 *master_edition.key,
573 false,
574 ));
575 } else {
576 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
577 crate::MPL_TOKEN_METADATA_ID,
578 false,
579 ));
580 }
581 if let Some(master_edition_mint) = self.master_edition_mint {
582 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
583 *master_edition_mint.key,
584 false,
585 ));
586 } else {
587 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
588 crate::MPL_TOKEN_METADATA_ID,
589 false,
590 ));
591 }
592 if let Some(master_edition_token) = self.master_edition_token {
593 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
594 *master_edition_token.key,
595 false,
596 ));
597 } else {
598 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
599 crate::MPL_TOKEN_METADATA_ID,
600 false,
601 ));
602 }
603 if let Some(edition_marker) = self.edition_marker {
604 accounts.push(solana_program::instruction::AccountMeta::new(
605 *edition_marker.key,
606 false,
607 ));
608 } else {
609 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
610 crate::MPL_TOKEN_METADATA_ID,
611 false,
612 ));
613 }
614 if let Some(token_record) = self.token_record {
615 accounts.push(solana_program::instruction::AccountMeta::new(
616 *token_record.key,
617 false,
618 ));
619 } else {
620 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
621 crate::MPL_TOKEN_METADATA_ID,
622 false,
623 ));
624 }
625 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
626 *self.system_program.key,
627 false,
628 ));
629 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
630 *self.sysvar_instructions.key,
631 false,
632 ));
633 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
634 *self.spl_token_program.key,
635 false,
636 ));
637 remaining_accounts.iter().for_each(|remaining_account| {
638 accounts.push(solana_program::instruction::AccountMeta {
639 pubkey: *remaining_account.0.key,
640 is_signer: remaining_account.1,
641 is_writable: remaining_account.2,
642 })
643 });
644 let mut data = BurnInstructionData::new().try_to_vec().unwrap();
645 let mut args = self.__args.try_to_vec().unwrap();
646 data.append(&mut args);
647
648 let instruction = solana_program::instruction::Instruction {
649 program_id: crate::MPL_TOKEN_METADATA_ID,
650 accounts,
651 data,
652 };
653 let mut account_infos = Vec::with_capacity(14 + 1 + remaining_accounts.len());
654 account_infos.push(self.__program.clone());
655 account_infos.push(self.authority.clone());
656 if let Some(collection_metadata) = self.collection_metadata {
657 account_infos.push(collection_metadata.clone());
658 }
659 account_infos.push(self.metadata.clone());
660 if let Some(edition) = self.edition {
661 account_infos.push(edition.clone());
662 }
663 account_infos.push(self.mint.clone());
664 account_infos.push(self.token.clone());
665 if let Some(master_edition) = self.master_edition {
666 account_infos.push(master_edition.clone());
667 }
668 if let Some(master_edition_mint) = self.master_edition_mint {
669 account_infos.push(master_edition_mint.clone());
670 }
671 if let Some(master_edition_token) = self.master_edition_token {
672 account_infos.push(master_edition_token.clone());
673 }
674 if let Some(edition_marker) = self.edition_marker {
675 account_infos.push(edition_marker.clone());
676 }
677 if let Some(token_record) = self.token_record {
678 account_infos.push(token_record.clone());
679 }
680 account_infos.push(self.system_program.clone());
681 account_infos.push(self.sysvar_instructions.clone());
682 account_infos.push(self.spl_token_program.clone());
683 remaining_accounts
684 .iter()
685 .for_each(|remaining_account| account_infos.push(remaining_account.0.clone()));
686
687 if signers_seeds.is_empty() {
688 solana_program::program::invoke(&instruction, &account_infos)
689 } else {
690 solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds)
691 }
692 }
693}
694
695pub struct BurnCpiBuilder<'a, 'b> {
714 instruction: Box<BurnCpiBuilderInstruction<'a, 'b>>,
715}
716
717impl<'a, 'b> BurnCpiBuilder<'a, 'b> {
718 pub fn new(program: &'b solana_program::account_info::AccountInfo<'a>) -> Self {
719 let instruction = Box::new(BurnCpiBuilderInstruction {
720 __program: program,
721 authority: None,
722 collection_metadata: None,
723 metadata: None,
724 edition: None,
725 mint: None,
726 token: None,
727 master_edition: None,
728 master_edition_mint: None,
729 master_edition_token: None,
730 edition_marker: None,
731 token_record: None,
732 system_program: None,
733 sysvar_instructions: None,
734 spl_token_program: None,
735 burn_args: None,
736 __remaining_accounts: Vec::new(),
737 });
738 Self { instruction }
739 }
740 #[inline(always)]
742 pub fn authority(
743 &mut self,
744 authority: &'b solana_program::account_info::AccountInfo<'a>,
745 ) -> &mut Self {
746 self.instruction.authority = Some(authority);
747 self
748 }
749 #[inline(always)]
752 pub fn collection_metadata(
753 &mut self,
754 collection_metadata: Option<&'b solana_program::account_info::AccountInfo<'a>>,
755 ) -> &mut Self {
756 self.instruction.collection_metadata = collection_metadata;
757 self
758 }
759 #[inline(always)]
761 pub fn metadata(
762 &mut self,
763 metadata: &'b solana_program::account_info::AccountInfo<'a>,
764 ) -> &mut Self {
765 self.instruction.metadata = Some(metadata);
766 self
767 }
768 #[inline(always)]
771 pub fn edition(
772 &mut self,
773 edition: Option<&'b solana_program::account_info::AccountInfo<'a>>,
774 ) -> &mut Self {
775 self.instruction.edition = edition;
776 self
777 }
778 #[inline(always)]
780 pub fn mint(&mut self, mint: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self {
781 self.instruction.mint = Some(mint);
782 self
783 }
784 #[inline(always)]
786 pub fn token(&mut self, token: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self {
787 self.instruction.token = Some(token);
788 self
789 }
790 #[inline(always)]
793 pub fn master_edition(
794 &mut self,
795 master_edition: Option<&'b solana_program::account_info::AccountInfo<'a>>,
796 ) -> &mut Self {
797 self.instruction.master_edition = master_edition;
798 self
799 }
800 #[inline(always)]
803 pub fn master_edition_mint(
804 &mut self,
805 master_edition_mint: Option<&'b solana_program::account_info::AccountInfo<'a>>,
806 ) -> &mut Self {
807 self.instruction.master_edition_mint = master_edition_mint;
808 self
809 }
810 #[inline(always)]
813 pub fn master_edition_token(
814 &mut self,
815 master_edition_token: Option<&'b solana_program::account_info::AccountInfo<'a>>,
816 ) -> &mut Self {
817 self.instruction.master_edition_token = master_edition_token;
818 self
819 }
820 #[inline(always)]
823 pub fn edition_marker(
824 &mut self,
825 edition_marker: Option<&'b solana_program::account_info::AccountInfo<'a>>,
826 ) -> &mut Self {
827 self.instruction.edition_marker = edition_marker;
828 self
829 }
830 #[inline(always)]
833 pub fn token_record(
834 &mut self,
835 token_record: Option<&'b solana_program::account_info::AccountInfo<'a>>,
836 ) -> &mut Self {
837 self.instruction.token_record = token_record;
838 self
839 }
840 #[inline(always)]
842 pub fn system_program(
843 &mut self,
844 system_program: &'b solana_program::account_info::AccountInfo<'a>,
845 ) -> &mut Self {
846 self.instruction.system_program = Some(system_program);
847 self
848 }
849 #[inline(always)]
851 pub fn sysvar_instructions(
852 &mut self,
853 sysvar_instructions: &'b solana_program::account_info::AccountInfo<'a>,
854 ) -> &mut Self {
855 self.instruction.sysvar_instructions = Some(sysvar_instructions);
856 self
857 }
858 #[inline(always)]
860 pub fn spl_token_program(
861 &mut self,
862 spl_token_program: &'b solana_program::account_info::AccountInfo<'a>,
863 ) -> &mut Self {
864 self.instruction.spl_token_program = Some(spl_token_program);
865 self
866 }
867 #[inline(always)]
868 pub fn burn_args(&mut self, burn_args: BurnArgs) -> &mut Self {
869 self.instruction.burn_args = Some(burn_args);
870 self
871 }
872 #[inline(always)]
874 pub fn add_remaining_account(
875 &mut self,
876 account: &'b solana_program::account_info::AccountInfo<'a>,
877 is_writable: bool,
878 is_signer: bool,
879 ) -> &mut Self {
880 self.instruction
881 .__remaining_accounts
882 .push((account, is_writable, is_signer));
883 self
884 }
885 #[inline(always)]
890 pub fn add_remaining_accounts(
891 &mut self,
892 accounts: &[(
893 &'b solana_program::account_info::AccountInfo<'a>,
894 bool,
895 bool,
896 )],
897 ) -> &mut Self {
898 self.instruction
899 .__remaining_accounts
900 .extend_from_slice(accounts);
901 self
902 }
903 #[inline(always)]
904 pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult {
905 self.invoke_signed(&[])
906 }
907 #[allow(clippy::clone_on_copy)]
908 #[allow(clippy::vec_init_then_push)]
909 pub fn invoke_signed(
910 &self,
911 signers_seeds: &[&[&[u8]]],
912 ) -> solana_program::entrypoint::ProgramResult {
913 let args = BurnInstructionArgs {
914 burn_args: self
915 .instruction
916 .burn_args
917 .clone()
918 .expect("burn_args is not set"),
919 };
920 let instruction = BurnCpi {
921 __program: self.instruction.__program,
922
923 authority: self.instruction.authority.expect("authority is not set"),
924
925 collection_metadata: self.instruction.collection_metadata,
926
927 metadata: self.instruction.metadata.expect("metadata is not set"),
928
929 edition: self.instruction.edition,
930
931 mint: self.instruction.mint.expect("mint is not set"),
932
933 token: self.instruction.token.expect("token is not set"),
934
935 master_edition: self.instruction.master_edition,
936
937 master_edition_mint: self.instruction.master_edition_mint,
938
939 master_edition_token: self.instruction.master_edition_token,
940
941 edition_marker: self.instruction.edition_marker,
942
943 token_record: self.instruction.token_record,
944
945 system_program: self
946 .instruction
947 .system_program
948 .expect("system_program is not set"),
949
950 sysvar_instructions: self
951 .instruction
952 .sysvar_instructions
953 .expect("sysvar_instructions is not set"),
954
955 spl_token_program: self
956 .instruction
957 .spl_token_program
958 .expect("spl_token_program is not set"),
959 __args: args,
960 };
961 instruction.invoke_signed_with_remaining_accounts(
962 signers_seeds,
963 &self.instruction.__remaining_accounts,
964 )
965 }
966}
967
968struct BurnCpiBuilderInstruction<'a, 'b> {
969 __program: &'b solana_program::account_info::AccountInfo<'a>,
970 authority: Option<&'b solana_program::account_info::AccountInfo<'a>>,
971 collection_metadata: Option<&'b solana_program::account_info::AccountInfo<'a>>,
972 metadata: Option<&'b solana_program::account_info::AccountInfo<'a>>,
973 edition: Option<&'b solana_program::account_info::AccountInfo<'a>>,
974 mint: Option<&'b solana_program::account_info::AccountInfo<'a>>,
975 token: Option<&'b solana_program::account_info::AccountInfo<'a>>,
976 master_edition: Option<&'b solana_program::account_info::AccountInfo<'a>>,
977 master_edition_mint: Option<&'b solana_program::account_info::AccountInfo<'a>>,
978 master_edition_token: Option<&'b solana_program::account_info::AccountInfo<'a>>,
979 edition_marker: Option<&'b solana_program::account_info::AccountInfo<'a>>,
980 token_record: Option<&'b solana_program::account_info::AccountInfo<'a>>,
981 system_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
982 sysvar_instructions: Option<&'b solana_program::account_info::AccountInfo<'a>>,
983 spl_token_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
984 burn_args: Option<BurnArgs>,
985 __remaining_accounts: Vec<(
987 &'b solana_program::account_info::AccountInfo<'a>,
988 bool,
989 bool,
990 )>,
991}