1use borsh::BorshDeserialize;
9use borsh::BorshSerialize;
10
11pub struct RevokeMigrationV1 {
13 pub delegate_record: Option<solana_program::pubkey::Pubkey>,
15 pub delegate: solana_program::pubkey::Pubkey,
17 pub metadata: solana_program::pubkey::Pubkey,
19 pub master_edition: Option<solana_program::pubkey::Pubkey>,
21 pub token_record: Option<solana_program::pubkey::Pubkey>,
23 pub mint: solana_program::pubkey::Pubkey,
25 pub token: solana_program::pubkey::Pubkey,
27 pub authority: solana_program::pubkey::Pubkey,
29 pub payer: solana_program::pubkey::Pubkey,
31 pub system_program: solana_program::pubkey::Pubkey,
33 pub sysvar_instructions: solana_program::pubkey::Pubkey,
35 pub spl_token_program: Option<solana_program::pubkey::Pubkey>,
37 pub authorization_rules_program: Option<solana_program::pubkey::Pubkey>,
39 pub authorization_rules: Option<solana_program::pubkey::Pubkey>,
41}
42
43impl RevokeMigrationV1 {
44 pub fn instruction(&self) -> solana_program::instruction::Instruction {
45 self.instruction_with_remaining_accounts(&[])
46 }
47 #[allow(clippy::vec_init_then_push)]
48 pub fn instruction_with_remaining_accounts(
49 &self,
50 remaining_accounts: &[solana_program::instruction::AccountMeta],
51 ) -> solana_program::instruction::Instruction {
52 let mut accounts = Vec::with_capacity(14 + remaining_accounts.len());
53 if let Some(delegate_record) = self.delegate_record {
54 accounts.push(solana_program::instruction::AccountMeta::new(
55 delegate_record,
56 false,
57 ));
58 } else {
59 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
60 crate::MPL_TOKEN_METADATA_ID,
61 false,
62 ));
63 }
64 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
65 self.delegate,
66 false,
67 ));
68 accounts.push(solana_program::instruction::AccountMeta::new(
69 self.metadata,
70 false,
71 ));
72 if let Some(master_edition) = self.master_edition {
73 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
74 master_edition,
75 false,
76 ));
77 } else {
78 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
79 crate::MPL_TOKEN_METADATA_ID,
80 false,
81 ));
82 }
83 if let Some(token_record) = self.token_record {
84 accounts.push(solana_program::instruction::AccountMeta::new(
85 token_record,
86 false,
87 ));
88 } else {
89 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
90 crate::MPL_TOKEN_METADATA_ID,
91 false,
92 ));
93 }
94 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
95 self.mint, false,
96 ));
97 accounts.push(solana_program::instruction::AccountMeta::new(
98 self.token, false,
99 ));
100 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
101 self.authority,
102 true,
103 ));
104 accounts.push(solana_program::instruction::AccountMeta::new(
105 self.payer, true,
106 ));
107 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
108 self.system_program,
109 false,
110 ));
111 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
112 self.sysvar_instructions,
113 false,
114 ));
115 if let Some(spl_token_program) = self.spl_token_program {
116 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
117 spl_token_program,
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(authorization_rules_program) = self.authorization_rules_program {
127 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
128 authorization_rules_program,
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(authorization_rules) = self.authorization_rules {
138 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
139 authorization_rules,
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.extend_from_slice(remaining_accounts);
149 let data = RevokeMigrationV1InstructionData::new()
150 .try_to_vec()
151 .unwrap();
152
153 solana_program::instruction::Instruction {
154 program_id: crate::MPL_TOKEN_METADATA_ID,
155 accounts,
156 data,
157 }
158 }
159}
160
161#[derive(BorshDeserialize, BorshSerialize)]
162struct RevokeMigrationV1InstructionData {
163 discriminator: u8,
164 revoke_migration_v1_discriminator: u8,
165}
166
167impl RevokeMigrationV1InstructionData {
168 fn new() -> Self {
169 Self {
170 discriminator: 45,
171 revoke_migration_v1_discriminator: 9,
172 }
173 }
174}
175
176#[derive(Default)]
195pub struct RevokeMigrationV1Builder {
196 delegate_record: Option<solana_program::pubkey::Pubkey>,
197 delegate: Option<solana_program::pubkey::Pubkey>,
198 metadata: Option<solana_program::pubkey::Pubkey>,
199 master_edition: Option<solana_program::pubkey::Pubkey>,
200 token_record: Option<solana_program::pubkey::Pubkey>,
201 mint: Option<solana_program::pubkey::Pubkey>,
202 token: Option<solana_program::pubkey::Pubkey>,
203 authority: Option<solana_program::pubkey::Pubkey>,
204 payer: Option<solana_program::pubkey::Pubkey>,
205 system_program: Option<solana_program::pubkey::Pubkey>,
206 sysvar_instructions: Option<solana_program::pubkey::Pubkey>,
207 spl_token_program: Option<solana_program::pubkey::Pubkey>,
208 authorization_rules_program: Option<solana_program::pubkey::Pubkey>,
209 authorization_rules: Option<solana_program::pubkey::Pubkey>,
210 __remaining_accounts: Vec<solana_program::instruction::AccountMeta>,
211}
212
213impl RevokeMigrationV1Builder {
214 pub fn new() -> Self {
215 Self::default()
216 }
217 #[inline(always)]
220 pub fn delegate_record(
221 &mut self,
222 delegate_record: Option<solana_program::pubkey::Pubkey>,
223 ) -> &mut Self {
224 self.delegate_record = delegate_record;
225 self
226 }
227 #[inline(always)]
229 pub fn delegate(&mut self, delegate: solana_program::pubkey::Pubkey) -> &mut Self {
230 self.delegate = Some(delegate);
231 self
232 }
233 #[inline(always)]
235 pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self {
236 self.metadata = Some(metadata);
237 self
238 }
239 #[inline(always)]
242 pub fn master_edition(
243 &mut self,
244 master_edition: Option<solana_program::pubkey::Pubkey>,
245 ) -> &mut Self {
246 self.master_edition = master_edition;
247 self
248 }
249 #[inline(always)]
252 pub fn token_record(
253 &mut self,
254 token_record: Option<solana_program::pubkey::Pubkey>,
255 ) -> &mut Self {
256 self.token_record = token_record;
257 self
258 }
259 #[inline(always)]
261 pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self {
262 self.mint = Some(mint);
263 self
264 }
265 #[inline(always)]
267 pub fn token(&mut self, token: solana_program::pubkey::Pubkey) -> &mut Self {
268 self.token = Some(token);
269 self
270 }
271 #[inline(always)]
273 pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self {
274 self.authority = Some(authority);
275 self
276 }
277 #[inline(always)]
279 pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self {
280 self.payer = Some(payer);
281 self
282 }
283 #[inline(always)]
286 pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self {
287 self.system_program = Some(system_program);
288 self
289 }
290 #[inline(always)]
293 pub fn sysvar_instructions(
294 &mut self,
295 sysvar_instructions: solana_program::pubkey::Pubkey,
296 ) -> &mut Self {
297 self.sysvar_instructions = Some(sysvar_instructions);
298 self
299 }
300 #[inline(always)]
303 pub fn spl_token_program(
304 &mut self,
305 spl_token_program: Option<solana_program::pubkey::Pubkey>,
306 ) -> &mut Self {
307 self.spl_token_program = spl_token_program;
308 self
309 }
310 #[inline(always)]
313 pub fn authorization_rules_program(
314 &mut self,
315 authorization_rules_program: Option<solana_program::pubkey::Pubkey>,
316 ) -> &mut Self {
317 self.authorization_rules_program = authorization_rules_program;
318 self
319 }
320 #[inline(always)]
323 pub fn authorization_rules(
324 &mut self,
325 authorization_rules: Option<solana_program::pubkey::Pubkey>,
326 ) -> &mut Self {
327 self.authorization_rules = authorization_rules;
328 self
329 }
330 #[inline(always)]
332 pub fn add_remaining_account(
333 &mut self,
334 account: solana_program::instruction::AccountMeta,
335 ) -> &mut Self {
336 self.__remaining_accounts.push(account);
337 self
338 }
339 #[inline(always)]
341 pub fn add_remaining_accounts(
342 &mut self,
343 accounts: &[solana_program::instruction::AccountMeta],
344 ) -> &mut Self {
345 self.__remaining_accounts.extend_from_slice(accounts);
346 self
347 }
348 #[allow(clippy::clone_on_copy)]
349 pub fn instruction(&self) -> solana_program::instruction::Instruction {
350 let accounts = RevokeMigrationV1 {
351 delegate_record: self.delegate_record,
352 delegate: self.delegate.expect("delegate is not set"),
353 metadata: self.metadata.expect("metadata is not set"),
354 master_edition: self.master_edition,
355 token_record: self.token_record,
356 mint: self.mint.expect("mint is not set"),
357 token: self.token.expect("token is not set"),
358 authority: self.authority.expect("authority is not set"),
359 payer: self.payer.expect("payer is not set"),
360 system_program: self
361 .system_program
362 .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")),
363 sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!(
364 "Sysvar1nstructions1111111111111111111111111"
365 )),
366 spl_token_program: self.spl_token_program,
367 authorization_rules_program: self.authorization_rules_program,
368 authorization_rules: self.authorization_rules,
369 };
370
371 accounts.instruction_with_remaining_accounts(&self.__remaining_accounts)
372 }
373}
374
375pub struct RevokeMigrationV1CpiAccounts<'a, 'b> {
377 pub delegate_record: Option<&'b solana_program::account_info::AccountInfo<'a>>,
379 pub delegate: &'b solana_program::account_info::AccountInfo<'a>,
381 pub metadata: &'b solana_program::account_info::AccountInfo<'a>,
383 pub master_edition: Option<&'b solana_program::account_info::AccountInfo<'a>>,
385 pub token_record: Option<&'b solana_program::account_info::AccountInfo<'a>>,
387 pub mint: &'b solana_program::account_info::AccountInfo<'a>,
389 pub token: &'b solana_program::account_info::AccountInfo<'a>,
391 pub authority: &'b solana_program::account_info::AccountInfo<'a>,
393 pub payer: &'b solana_program::account_info::AccountInfo<'a>,
395 pub system_program: &'b solana_program::account_info::AccountInfo<'a>,
397 pub sysvar_instructions: &'b solana_program::account_info::AccountInfo<'a>,
399 pub spl_token_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
401 pub authorization_rules_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
403 pub authorization_rules: Option<&'b solana_program::account_info::AccountInfo<'a>>,
405}
406
407pub struct RevokeMigrationV1Cpi<'a, 'b> {
409 pub __program: &'b solana_program::account_info::AccountInfo<'a>,
411 pub delegate_record: Option<&'b solana_program::account_info::AccountInfo<'a>>,
413 pub delegate: &'b solana_program::account_info::AccountInfo<'a>,
415 pub metadata: &'b solana_program::account_info::AccountInfo<'a>,
417 pub master_edition: Option<&'b solana_program::account_info::AccountInfo<'a>>,
419 pub token_record: Option<&'b solana_program::account_info::AccountInfo<'a>>,
421 pub mint: &'b solana_program::account_info::AccountInfo<'a>,
423 pub token: &'b solana_program::account_info::AccountInfo<'a>,
425 pub authority: &'b solana_program::account_info::AccountInfo<'a>,
427 pub payer: &'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: Option<&'b solana_program::account_info::AccountInfo<'a>>,
435 pub authorization_rules_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
437 pub authorization_rules: Option<&'b solana_program::account_info::AccountInfo<'a>>,
439}
440
441impl<'a, 'b> RevokeMigrationV1Cpi<'a, 'b> {
442 pub fn new(
443 program: &'b solana_program::account_info::AccountInfo<'a>,
444 accounts: RevokeMigrationV1CpiAccounts<'a, 'b>,
445 ) -> Self {
446 Self {
447 __program: program,
448 delegate_record: accounts.delegate_record,
449 delegate: accounts.delegate,
450 metadata: accounts.metadata,
451 master_edition: accounts.master_edition,
452 token_record: accounts.token_record,
453 mint: accounts.mint,
454 token: accounts.token,
455 authority: accounts.authority,
456 payer: accounts.payer,
457 system_program: accounts.system_program,
458 sysvar_instructions: accounts.sysvar_instructions,
459 spl_token_program: accounts.spl_token_program,
460 authorization_rules_program: accounts.authorization_rules_program,
461 authorization_rules: accounts.authorization_rules,
462 }
463 }
464 #[inline(always)]
465 pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult {
466 self.invoke_signed_with_remaining_accounts(&[], &[])
467 }
468 #[inline(always)]
469 pub fn invoke_with_remaining_accounts(
470 &self,
471 remaining_accounts: &[(
472 &'b solana_program::account_info::AccountInfo<'a>,
473 bool,
474 bool,
475 )],
476 ) -> solana_program::entrypoint::ProgramResult {
477 self.invoke_signed_with_remaining_accounts(&[], remaining_accounts)
478 }
479 #[inline(always)]
480 pub fn invoke_signed(
481 &self,
482 signers_seeds: &[&[&[u8]]],
483 ) -> solana_program::entrypoint::ProgramResult {
484 self.invoke_signed_with_remaining_accounts(signers_seeds, &[])
485 }
486 #[allow(clippy::clone_on_copy)]
487 #[allow(clippy::vec_init_then_push)]
488 pub fn invoke_signed_with_remaining_accounts(
489 &self,
490 signers_seeds: &[&[&[u8]]],
491 remaining_accounts: &[(
492 &'b solana_program::account_info::AccountInfo<'a>,
493 bool,
494 bool,
495 )],
496 ) -> solana_program::entrypoint::ProgramResult {
497 let mut accounts = Vec::with_capacity(14 + remaining_accounts.len());
498 if let Some(delegate_record) = self.delegate_record {
499 accounts.push(solana_program::instruction::AccountMeta::new(
500 *delegate_record.key,
501 false,
502 ));
503 } else {
504 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
505 crate::MPL_TOKEN_METADATA_ID,
506 false,
507 ));
508 }
509 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
510 *self.delegate.key,
511 false,
512 ));
513 accounts.push(solana_program::instruction::AccountMeta::new(
514 *self.metadata.key,
515 false,
516 ));
517 if let Some(master_edition) = self.master_edition {
518 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
519 *master_edition.key,
520 false,
521 ));
522 } else {
523 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
524 crate::MPL_TOKEN_METADATA_ID,
525 false,
526 ));
527 }
528 if let Some(token_record) = self.token_record {
529 accounts.push(solana_program::instruction::AccountMeta::new(
530 *token_record.key,
531 false,
532 ));
533 } else {
534 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
535 crate::MPL_TOKEN_METADATA_ID,
536 false,
537 ));
538 }
539 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
540 *self.mint.key,
541 false,
542 ));
543 accounts.push(solana_program::instruction::AccountMeta::new(
544 *self.token.key,
545 false,
546 ));
547 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
548 *self.authority.key,
549 true,
550 ));
551 accounts.push(solana_program::instruction::AccountMeta::new(
552 *self.payer.key,
553 true,
554 ));
555 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
556 *self.system_program.key,
557 false,
558 ));
559 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
560 *self.sysvar_instructions.key,
561 false,
562 ));
563 if let Some(spl_token_program) = self.spl_token_program {
564 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
565 *spl_token_program.key,
566 false,
567 ));
568 } else {
569 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
570 crate::MPL_TOKEN_METADATA_ID,
571 false,
572 ));
573 }
574 if let Some(authorization_rules_program) = self.authorization_rules_program {
575 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
576 *authorization_rules_program.key,
577 false,
578 ));
579 } else {
580 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
581 crate::MPL_TOKEN_METADATA_ID,
582 false,
583 ));
584 }
585 if let Some(authorization_rules) = self.authorization_rules {
586 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
587 *authorization_rules.key,
588 false,
589 ));
590 } else {
591 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
592 crate::MPL_TOKEN_METADATA_ID,
593 false,
594 ));
595 }
596 remaining_accounts.iter().for_each(|remaining_account| {
597 accounts.push(solana_program::instruction::AccountMeta {
598 pubkey: *remaining_account.0.key,
599 is_signer: remaining_account.1,
600 is_writable: remaining_account.2,
601 })
602 });
603 let data = RevokeMigrationV1InstructionData::new()
604 .try_to_vec()
605 .unwrap();
606
607 let instruction = solana_program::instruction::Instruction {
608 program_id: crate::MPL_TOKEN_METADATA_ID,
609 accounts,
610 data,
611 };
612 let mut account_infos = Vec::with_capacity(14 + 1 + remaining_accounts.len());
613 account_infos.push(self.__program.clone());
614 if let Some(delegate_record) = self.delegate_record {
615 account_infos.push(delegate_record.clone());
616 }
617 account_infos.push(self.delegate.clone());
618 account_infos.push(self.metadata.clone());
619 if let Some(master_edition) = self.master_edition {
620 account_infos.push(master_edition.clone());
621 }
622 if let Some(token_record) = self.token_record {
623 account_infos.push(token_record.clone());
624 }
625 account_infos.push(self.mint.clone());
626 account_infos.push(self.token.clone());
627 account_infos.push(self.authority.clone());
628 account_infos.push(self.payer.clone());
629 account_infos.push(self.system_program.clone());
630 account_infos.push(self.sysvar_instructions.clone());
631 if let Some(spl_token_program) = self.spl_token_program {
632 account_infos.push(spl_token_program.clone());
633 }
634 if let Some(authorization_rules_program) = self.authorization_rules_program {
635 account_infos.push(authorization_rules_program.clone());
636 }
637 if let Some(authorization_rules) = self.authorization_rules {
638 account_infos.push(authorization_rules.clone());
639 }
640 remaining_accounts
641 .iter()
642 .for_each(|remaining_account| account_infos.push(remaining_account.0.clone()));
643
644 if signers_seeds.is_empty() {
645 solana_program::program::invoke(&instruction, &account_infos)
646 } else {
647 solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds)
648 }
649 }
650}
651
652pub struct RevokeMigrationV1CpiBuilder<'a, 'b> {
671 instruction: Box<RevokeMigrationV1CpiBuilderInstruction<'a, 'b>>,
672}
673
674impl<'a, 'b> RevokeMigrationV1CpiBuilder<'a, 'b> {
675 pub fn new(program: &'b solana_program::account_info::AccountInfo<'a>) -> Self {
676 let instruction = Box::new(RevokeMigrationV1CpiBuilderInstruction {
677 __program: program,
678 delegate_record: None,
679 delegate: None,
680 metadata: None,
681 master_edition: None,
682 token_record: None,
683 mint: None,
684 token: None,
685 authority: None,
686 payer: None,
687 system_program: None,
688 sysvar_instructions: None,
689 spl_token_program: None,
690 authorization_rules_program: None,
691 authorization_rules: None,
692 __remaining_accounts: Vec::new(),
693 });
694 Self { instruction }
695 }
696 #[inline(always)]
699 pub fn delegate_record(
700 &mut self,
701 delegate_record: Option<&'b solana_program::account_info::AccountInfo<'a>>,
702 ) -> &mut Self {
703 self.instruction.delegate_record = delegate_record;
704 self
705 }
706 #[inline(always)]
708 pub fn delegate(
709 &mut self,
710 delegate: &'b solana_program::account_info::AccountInfo<'a>,
711 ) -> &mut Self {
712 self.instruction.delegate = Some(delegate);
713 self
714 }
715 #[inline(always)]
717 pub fn metadata(
718 &mut self,
719 metadata: &'b solana_program::account_info::AccountInfo<'a>,
720 ) -> &mut Self {
721 self.instruction.metadata = Some(metadata);
722 self
723 }
724 #[inline(always)]
727 pub fn master_edition(
728 &mut self,
729 master_edition: Option<&'b solana_program::account_info::AccountInfo<'a>>,
730 ) -> &mut Self {
731 self.instruction.master_edition = master_edition;
732 self
733 }
734 #[inline(always)]
737 pub fn token_record(
738 &mut self,
739 token_record: Option<&'b solana_program::account_info::AccountInfo<'a>>,
740 ) -> &mut Self {
741 self.instruction.token_record = token_record;
742 self
743 }
744 #[inline(always)]
746 pub fn mint(&mut self, mint: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self {
747 self.instruction.mint = Some(mint);
748 self
749 }
750 #[inline(always)]
752 pub fn token(&mut self, token: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self {
753 self.instruction.token = Some(token);
754 self
755 }
756 #[inline(always)]
758 pub fn authority(
759 &mut self,
760 authority: &'b solana_program::account_info::AccountInfo<'a>,
761 ) -> &mut Self {
762 self.instruction.authority = Some(authority);
763 self
764 }
765 #[inline(always)]
767 pub fn payer(&mut self, payer: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self {
768 self.instruction.payer = Some(payer);
769 self
770 }
771 #[inline(always)]
773 pub fn system_program(
774 &mut self,
775 system_program: &'b solana_program::account_info::AccountInfo<'a>,
776 ) -> &mut Self {
777 self.instruction.system_program = Some(system_program);
778 self
779 }
780 #[inline(always)]
782 pub fn sysvar_instructions(
783 &mut self,
784 sysvar_instructions: &'b solana_program::account_info::AccountInfo<'a>,
785 ) -> &mut Self {
786 self.instruction.sysvar_instructions = Some(sysvar_instructions);
787 self
788 }
789 #[inline(always)]
792 pub fn spl_token_program(
793 &mut self,
794 spl_token_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
795 ) -> &mut Self {
796 self.instruction.spl_token_program = spl_token_program;
797 self
798 }
799 #[inline(always)]
802 pub fn authorization_rules_program(
803 &mut self,
804 authorization_rules_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
805 ) -> &mut Self {
806 self.instruction.authorization_rules_program = authorization_rules_program;
807 self
808 }
809 #[inline(always)]
812 pub fn authorization_rules(
813 &mut self,
814 authorization_rules: Option<&'b solana_program::account_info::AccountInfo<'a>>,
815 ) -> &mut Self {
816 self.instruction.authorization_rules = authorization_rules;
817 self
818 }
819 #[inline(always)]
821 pub fn add_remaining_account(
822 &mut self,
823 account: &'b solana_program::account_info::AccountInfo<'a>,
824 is_writable: bool,
825 is_signer: bool,
826 ) -> &mut Self {
827 self.instruction
828 .__remaining_accounts
829 .push((account, is_writable, is_signer));
830 self
831 }
832 #[inline(always)]
837 pub fn add_remaining_accounts(
838 &mut self,
839 accounts: &[(
840 &'b solana_program::account_info::AccountInfo<'a>,
841 bool,
842 bool,
843 )],
844 ) -> &mut Self {
845 self.instruction
846 .__remaining_accounts
847 .extend_from_slice(accounts);
848 self
849 }
850 #[inline(always)]
851 pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult {
852 self.invoke_signed(&[])
853 }
854 #[allow(clippy::clone_on_copy)]
855 #[allow(clippy::vec_init_then_push)]
856 pub fn invoke_signed(
857 &self,
858 signers_seeds: &[&[&[u8]]],
859 ) -> solana_program::entrypoint::ProgramResult {
860 let instruction = RevokeMigrationV1Cpi {
861 __program: self.instruction.__program,
862
863 delegate_record: self.instruction.delegate_record,
864
865 delegate: self.instruction.delegate.expect("delegate is not set"),
866
867 metadata: self.instruction.metadata.expect("metadata is not set"),
868
869 master_edition: self.instruction.master_edition,
870
871 token_record: self.instruction.token_record,
872
873 mint: self.instruction.mint.expect("mint is not set"),
874
875 token: self.instruction.token.expect("token is not set"),
876
877 authority: self.instruction.authority.expect("authority is not set"),
878
879 payer: self.instruction.payer.expect("payer is not set"),
880
881 system_program: self
882 .instruction
883 .system_program
884 .expect("system_program is not set"),
885
886 sysvar_instructions: self
887 .instruction
888 .sysvar_instructions
889 .expect("sysvar_instructions is not set"),
890
891 spl_token_program: self.instruction.spl_token_program,
892
893 authorization_rules_program: self.instruction.authorization_rules_program,
894
895 authorization_rules: self.instruction.authorization_rules,
896 };
897 instruction.invoke_signed_with_remaining_accounts(
898 signers_seeds,
899 &self.instruction.__remaining_accounts,
900 )
901 }
902}
903
904struct RevokeMigrationV1CpiBuilderInstruction<'a, 'b> {
905 __program: &'b solana_program::account_info::AccountInfo<'a>,
906 delegate_record: Option<&'b solana_program::account_info::AccountInfo<'a>>,
907 delegate: Option<&'b solana_program::account_info::AccountInfo<'a>>,
908 metadata: Option<&'b solana_program::account_info::AccountInfo<'a>>,
909 master_edition: Option<&'b solana_program::account_info::AccountInfo<'a>>,
910 token_record: Option<&'b solana_program::account_info::AccountInfo<'a>>,
911 mint: Option<&'b solana_program::account_info::AccountInfo<'a>>,
912 token: Option<&'b solana_program::account_info::AccountInfo<'a>>,
913 authority: Option<&'b solana_program::account_info::AccountInfo<'a>>,
914 payer: Option<&'b solana_program::account_info::AccountInfo<'a>>,
915 system_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
916 sysvar_instructions: Option<&'b solana_program::account_info::AccountInfo<'a>>,
917 spl_token_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
918 authorization_rules_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
919 authorization_rules: Option<&'b solana_program::account_info::AccountInfo<'a>>,
920 __remaining_accounts: Vec<(
922 &'b solana_program::account_info::AccountInfo<'a>,
923 bool,
924 bool,
925 )>,
926}