1use crate::generated::types::MetadataArgs;
9use borsh::BorshDeserialize;
10use borsh::BorshSerialize;
11
12pub struct UnverifyCollection {
14 pub tree_config: solana_program::pubkey::Pubkey,
15
16 pub leaf_owner: solana_program::pubkey::Pubkey,
17
18 pub leaf_delegate: solana_program::pubkey::Pubkey,
19
20 pub merkle_tree: solana_program::pubkey::Pubkey,
21
22 pub payer: solana_program::pubkey::Pubkey,
23 pub tree_creator_or_delegate: solana_program::pubkey::Pubkey,
27
28 pub collection_authority: solana_program::pubkey::Pubkey,
29 pub collection_authority_record_pda: Option<solana_program::pubkey::Pubkey>,
32
33 pub collection_mint: solana_program::pubkey::Pubkey,
34
35 pub collection_metadata: solana_program::pubkey::Pubkey,
36
37 pub collection_edition: solana_program::pubkey::Pubkey,
38
39 pub bubblegum_signer: solana_program::pubkey::Pubkey,
40
41 pub log_wrapper: solana_program::pubkey::Pubkey,
42
43 pub compression_program: solana_program::pubkey::Pubkey,
44
45 pub token_metadata_program: solana_program::pubkey::Pubkey,
46
47 pub system_program: solana_program::pubkey::Pubkey,
48}
49
50impl UnverifyCollection {
51 pub fn instruction(
52 &self,
53 args: UnverifyCollectionInstructionArgs,
54 ) -> solana_program::instruction::Instruction {
55 self.instruction_with_remaining_accounts(args, &[])
56 }
57 #[allow(clippy::vec_init_then_push)]
58 pub fn instruction_with_remaining_accounts(
59 &self,
60 args: UnverifyCollectionInstructionArgs,
61 remaining_accounts: &[solana_program::instruction::AccountMeta],
62 ) -> solana_program::instruction::Instruction {
63 let mut accounts = Vec::with_capacity(16 + remaining_accounts.len());
64 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
65 self.tree_config,
66 false,
67 ));
68 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
69 self.leaf_owner,
70 false,
71 ));
72 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
73 self.leaf_delegate,
74 false,
75 ));
76 accounts.push(solana_program::instruction::AccountMeta::new(
77 self.merkle_tree,
78 false,
79 ));
80 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
81 self.payer, true,
82 ));
83 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
84 self.tree_creator_or_delegate,
85 false,
86 ));
87 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
88 self.collection_authority,
89 true,
90 ));
91 if let Some(collection_authority_record_pda) = self.collection_authority_record_pda {
92 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
93 collection_authority_record_pda,
94 false,
95 ));
96 } else {
97 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
98 crate::MPL_BUBBLEGUM_ID,
99 false,
100 ));
101 }
102 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
103 self.collection_mint,
104 false,
105 ));
106 accounts.push(solana_program::instruction::AccountMeta::new(
107 self.collection_metadata,
108 false,
109 ));
110 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
111 self.collection_edition,
112 false,
113 ));
114 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
115 self.bubblegum_signer,
116 false,
117 ));
118 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
119 self.log_wrapper,
120 false,
121 ));
122 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
123 self.compression_program,
124 false,
125 ));
126 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
127 self.token_metadata_program,
128 false,
129 ));
130 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
131 self.system_program,
132 false,
133 ));
134 accounts.extend_from_slice(remaining_accounts);
135 let mut data = UnverifyCollectionInstructionData::new()
136 .try_to_vec()
137 .unwrap();
138 let mut args = args.try_to_vec().unwrap();
139 data.append(&mut args);
140
141 solana_program::instruction::Instruction {
142 program_id: crate::MPL_BUBBLEGUM_ID,
143 accounts,
144 data,
145 }
146 }
147}
148
149#[derive(BorshDeserialize, BorshSerialize)]
150struct UnverifyCollectionInstructionData {
151 discriminator: [u8; 8],
152}
153
154impl UnverifyCollectionInstructionData {
155 fn new() -> Self {
156 Self {
157 discriminator: [250, 251, 42, 106, 41, 137, 186, 168],
158 }
159 }
160}
161
162#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)]
163#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
164pub struct UnverifyCollectionInstructionArgs {
165 pub root: [u8; 32],
166 pub data_hash: [u8; 32],
167 pub creator_hash: [u8; 32],
168 pub nonce: u64,
169 pub index: u32,
170 pub metadata: MetadataArgs,
171}
172
173#[derive(Default)]
175pub struct UnverifyCollectionBuilder {
176 tree_config: Option<solana_program::pubkey::Pubkey>,
177 leaf_owner: Option<solana_program::pubkey::Pubkey>,
178 leaf_delegate: Option<solana_program::pubkey::Pubkey>,
179 merkle_tree: Option<solana_program::pubkey::Pubkey>,
180 payer: Option<solana_program::pubkey::Pubkey>,
181 tree_creator_or_delegate: Option<solana_program::pubkey::Pubkey>,
182 collection_authority: Option<solana_program::pubkey::Pubkey>,
183 collection_authority_record_pda: Option<solana_program::pubkey::Pubkey>,
184 collection_mint: Option<solana_program::pubkey::Pubkey>,
185 collection_metadata: Option<solana_program::pubkey::Pubkey>,
186 collection_edition: Option<solana_program::pubkey::Pubkey>,
187 bubblegum_signer: Option<solana_program::pubkey::Pubkey>,
188 log_wrapper: Option<solana_program::pubkey::Pubkey>,
189 compression_program: Option<solana_program::pubkey::Pubkey>,
190 token_metadata_program: Option<solana_program::pubkey::Pubkey>,
191 system_program: Option<solana_program::pubkey::Pubkey>,
192 root: Option<[u8; 32]>,
193 data_hash: Option<[u8; 32]>,
194 creator_hash: Option<[u8; 32]>,
195 nonce: Option<u64>,
196 index: Option<u32>,
197 metadata: Option<MetadataArgs>,
198 __remaining_accounts: Vec<solana_program::instruction::AccountMeta>,
199}
200
201impl UnverifyCollectionBuilder {
202 pub fn new() -> Self {
203 Self::default()
204 }
205 #[inline(always)]
206 pub fn tree_config(&mut self, tree_config: solana_program::pubkey::Pubkey) -> &mut Self {
207 self.tree_config = Some(tree_config);
208 self
209 }
210 #[inline(always)]
211 pub fn leaf_owner(&mut self, leaf_owner: solana_program::pubkey::Pubkey) -> &mut Self {
212 self.leaf_owner = Some(leaf_owner);
213 self
214 }
215 #[inline(always)]
216 pub fn leaf_delegate(&mut self, leaf_delegate: solana_program::pubkey::Pubkey) -> &mut Self {
217 self.leaf_delegate = Some(leaf_delegate);
218 self
219 }
220 #[inline(always)]
221 pub fn merkle_tree(&mut self, merkle_tree: solana_program::pubkey::Pubkey) -> &mut Self {
222 self.merkle_tree = Some(merkle_tree);
223 self
224 }
225 #[inline(always)]
226 pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self {
227 self.payer = Some(payer);
228 self
229 }
230 #[inline(always)]
234 pub fn tree_creator_or_delegate(
235 &mut self,
236 tree_creator_or_delegate: solana_program::pubkey::Pubkey,
237 ) -> &mut Self {
238 self.tree_creator_or_delegate = Some(tree_creator_or_delegate);
239 self
240 }
241 #[inline(always)]
242 pub fn collection_authority(
243 &mut self,
244 collection_authority: solana_program::pubkey::Pubkey,
245 ) -> &mut Self {
246 self.collection_authority = Some(collection_authority);
247 self
248 }
249 #[inline(always)]
253 pub fn collection_authority_record_pda(
254 &mut self,
255 collection_authority_record_pda: Option<solana_program::pubkey::Pubkey>,
256 ) -> &mut Self {
257 self.collection_authority_record_pda = collection_authority_record_pda;
258 self
259 }
260 #[inline(always)]
261 pub fn collection_mint(
262 &mut self,
263 collection_mint: solana_program::pubkey::Pubkey,
264 ) -> &mut Self {
265 self.collection_mint = Some(collection_mint);
266 self
267 }
268 #[inline(always)]
269 pub fn collection_metadata(
270 &mut self,
271 collection_metadata: solana_program::pubkey::Pubkey,
272 ) -> &mut Self {
273 self.collection_metadata = Some(collection_metadata);
274 self
275 }
276 #[inline(always)]
277 pub fn collection_edition(
278 &mut self,
279 collection_edition: solana_program::pubkey::Pubkey,
280 ) -> &mut Self {
281 self.collection_edition = Some(collection_edition);
282 self
283 }
284 #[inline(always)]
286 pub fn bubblegum_signer(
287 &mut self,
288 bubblegum_signer: solana_program::pubkey::Pubkey,
289 ) -> &mut Self {
290 self.bubblegum_signer = Some(bubblegum_signer);
291 self
292 }
293 #[inline(always)]
295 pub fn log_wrapper(&mut self, log_wrapper: solana_program::pubkey::Pubkey) -> &mut Self {
296 self.log_wrapper = Some(log_wrapper);
297 self
298 }
299 #[inline(always)]
301 pub fn compression_program(
302 &mut self,
303 compression_program: solana_program::pubkey::Pubkey,
304 ) -> &mut Self {
305 self.compression_program = Some(compression_program);
306 self
307 }
308 #[inline(always)]
310 pub fn token_metadata_program(
311 &mut self,
312 token_metadata_program: solana_program::pubkey::Pubkey,
313 ) -> &mut Self {
314 self.token_metadata_program = Some(token_metadata_program);
315 self
316 }
317 #[inline(always)]
319 pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self {
320 self.system_program = Some(system_program);
321 self
322 }
323 #[inline(always)]
324 pub fn root(&mut self, root: [u8; 32]) -> &mut Self {
325 self.root = Some(root);
326 self
327 }
328 #[inline(always)]
329 pub fn data_hash(&mut self, data_hash: [u8; 32]) -> &mut Self {
330 self.data_hash = Some(data_hash);
331 self
332 }
333 #[inline(always)]
334 pub fn creator_hash(&mut self, creator_hash: [u8; 32]) -> &mut Self {
335 self.creator_hash = Some(creator_hash);
336 self
337 }
338 #[inline(always)]
339 pub fn nonce(&mut self, nonce: u64) -> &mut Self {
340 self.nonce = Some(nonce);
341 self
342 }
343 #[inline(always)]
344 pub fn index(&mut self, index: u32) -> &mut Self {
345 self.index = Some(index);
346 self
347 }
348 #[inline(always)]
349 pub fn metadata(&mut self, metadata: MetadataArgs) -> &mut Self {
350 self.metadata = Some(metadata);
351 self
352 }
353 #[inline(always)]
355 pub fn add_remaining_account(
356 &mut self,
357 account: solana_program::instruction::AccountMeta,
358 ) -> &mut Self {
359 self.__remaining_accounts.push(account);
360 self
361 }
362 #[inline(always)]
364 pub fn add_remaining_accounts(
365 &mut self,
366 accounts: &[solana_program::instruction::AccountMeta],
367 ) -> &mut Self {
368 self.__remaining_accounts.extend_from_slice(accounts);
369 self
370 }
371 #[allow(clippy::clone_on_copy)]
372 pub fn instruction(&self) -> solana_program::instruction::Instruction {
373 let accounts =
374 UnverifyCollection {
375 tree_config: self.tree_config.expect("tree_config is not set"),
376 leaf_owner: self.leaf_owner.expect("leaf_owner is not set"),
377 leaf_delegate: self.leaf_delegate.expect("leaf_delegate is not set"),
378 merkle_tree: self.merkle_tree.expect("merkle_tree is not set"),
379 payer: self.payer.expect("payer is not set"),
380 tree_creator_or_delegate: self
381 .tree_creator_or_delegate
382 .expect("tree_creator_or_delegate is not set"),
383 collection_authority: self
384 .collection_authority
385 .expect("collection_authority is not set"),
386 collection_authority_record_pda: self.collection_authority_record_pda,
387 collection_mint: self.collection_mint.expect("collection_mint is not set"),
388 collection_metadata: self
389 .collection_metadata
390 .expect("collection_metadata is not set"),
391 collection_edition: self
392 .collection_edition
393 .expect("collection_edition is not set"),
394 bubblegum_signer: self.bubblegum_signer.unwrap_or(solana_program::pubkey!(
395 "BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY"
396 )),
397 log_wrapper: self.log_wrapper.unwrap_or(solana_program::pubkey!(
398 "noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV"
399 )),
400 compression_program: self.compression_program.unwrap_or(solana_program::pubkey!(
401 "cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK"
402 )),
403 token_metadata_program: self.token_metadata_program.unwrap_or(
404 solana_program::pubkey!("BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY"),
405 ),
406 system_program: self
407 .system_program
408 .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")),
409 };
410 let args = UnverifyCollectionInstructionArgs {
411 root: self.root.clone().expect("root is not set"),
412 data_hash: self.data_hash.clone().expect("data_hash is not set"),
413 creator_hash: self.creator_hash.clone().expect("creator_hash is not set"),
414 nonce: self.nonce.clone().expect("nonce is not set"),
415 index: self.index.clone().expect("index is not set"),
416 metadata: self.metadata.clone().expect("metadata is not set"),
417 };
418
419 accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts)
420 }
421}
422
423pub struct UnverifyCollectionCpiAccounts<'a, 'b> {
425 pub tree_config: &'b solana_program::account_info::AccountInfo<'a>,
426
427 pub leaf_owner: &'b solana_program::account_info::AccountInfo<'a>,
428
429 pub leaf_delegate: &'b solana_program::account_info::AccountInfo<'a>,
430
431 pub merkle_tree: &'b solana_program::account_info::AccountInfo<'a>,
432
433 pub payer: &'b solana_program::account_info::AccountInfo<'a>,
434 pub tree_creator_or_delegate: &'b solana_program::account_info::AccountInfo<'a>,
438
439 pub collection_authority: &'b solana_program::account_info::AccountInfo<'a>,
440 pub collection_authority_record_pda: Option<&'b solana_program::account_info::AccountInfo<'a>>,
443
444 pub collection_mint: &'b solana_program::account_info::AccountInfo<'a>,
445
446 pub collection_metadata: &'b solana_program::account_info::AccountInfo<'a>,
447
448 pub collection_edition: &'b solana_program::account_info::AccountInfo<'a>,
449
450 pub bubblegum_signer: &'b solana_program::account_info::AccountInfo<'a>,
451
452 pub log_wrapper: &'b solana_program::account_info::AccountInfo<'a>,
453
454 pub compression_program: &'b solana_program::account_info::AccountInfo<'a>,
455
456 pub token_metadata_program: &'b solana_program::account_info::AccountInfo<'a>,
457
458 pub system_program: &'b solana_program::account_info::AccountInfo<'a>,
459}
460
461pub struct UnverifyCollectionCpi<'a, 'b> {
463 pub __program: &'b solana_program::account_info::AccountInfo<'a>,
465
466 pub tree_config: &'b solana_program::account_info::AccountInfo<'a>,
467
468 pub leaf_owner: &'b solana_program::account_info::AccountInfo<'a>,
469
470 pub leaf_delegate: &'b solana_program::account_info::AccountInfo<'a>,
471
472 pub merkle_tree: &'b solana_program::account_info::AccountInfo<'a>,
473
474 pub payer: &'b solana_program::account_info::AccountInfo<'a>,
475 pub tree_creator_or_delegate: &'b solana_program::account_info::AccountInfo<'a>,
479
480 pub collection_authority: &'b solana_program::account_info::AccountInfo<'a>,
481 pub collection_authority_record_pda: Option<&'b solana_program::account_info::AccountInfo<'a>>,
484
485 pub collection_mint: &'b solana_program::account_info::AccountInfo<'a>,
486
487 pub collection_metadata: &'b solana_program::account_info::AccountInfo<'a>,
488
489 pub collection_edition: &'b solana_program::account_info::AccountInfo<'a>,
490
491 pub bubblegum_signer: &'b solana_program::account_info::AccountInfo<'a>,
492
493 pub log_wrapper: &'b solana_program::account_info::AccountInfo<'a>,
494
495 pub compression_program: &'b solana_program::account_info::AccountInfo<'a>,
496
497 pub token_metadata_program: &'b solana_program::account_info::AccountInfo<'a>,
498
499 pub system_program: &'b solana_program::account_info::AccountInfo<'a>,
500 pub __args: UnverifyCollectionInstructionArgs,
502}
503
504impl<'a, 'b> UnverifyCollectionCpi<'a, 'b> {
505 pub fn new(
506 program: &'b solana_program::account_info::AccountInfo<'a>,
507 accounts: UnverifyCollectionCpiAccounts<'a, 'b>,
508 args: UnverifyCollectionInstructionArgs,
509 ) -> Self {
510 Self {
511 __program: program,
512 tree_config: accounts.tree_config,
513 leaf_owner: accounts.leaf_owner,
514 leaf_delegate: accounts.leaf_delegate,
515 merkle_tree: accounts.merkle_tree,
516 payer: accounts.payer,
517 tree_creator_or_delegate: accounts.tree_creator_or_delegate,
518 collection_authority: accounts.collection_authority,
519 collection_authority_record_pda: accounts.collection_authority_record_pda,
520 collection_mint: accounts.collection_mint,
521 collection_metadata: accounts.collection_metadata,
522 collection_edition: accounts.collection_edition,
523 bubblegum_signer: accounts.bubblegum_signer,
524 log_wrapper: accounts.log_wrapper,
525 compression_program: accounts.compression_program,
526 token_metadata_program: accounts.token_metadata_program,
527 system_program: accounts.system_program,
528 __args: args,
529 }
530 }
531 #[inline(always)]
532 pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult {
533 self.invoke_signed_with_remaining_accounts(&[], &[])
534 }
535 #[inline(always)]
536 pub fn invoke_with_remaining_accounts(
537 &self,
538 remaining_accounts: &[(
539 &'b solana_program::account_info::AccountInfo<'a>,
540 bool,
541 bool,
542 )],
543 ) -> solana_program::entrypoint::ProgramResult {
544 self.invoke_signed_with_remaining_accounts(&[], remaining_accounts)
545 }
546 #[inline(always)]
547 pub fn invoke_signed(
548 &self,
549 signers_seeds: &[&[&[u8]]],
550 ) -> solana_program::entrypoint::ProgramResult {
551 self.invoke_signed_with_remaining_accounts(signers_seeds, &[])
552 }
553 #[allow(clippy::clone_on_copy)]
554 #[allow(clippy::vec_init_then_push)]
555 pub fn invoke_signed_with_remaining_accounts(
556 &self,
557 signers_seeds: &[&[&[u8]]],
558 remaining_accounts: &[(
559 &'b solana_program::account_info::AccountInfo<'a>,
560 bool,
561 bool,
562 )],
563 ) -> solana_program::entrypoint::ProgramResult {
564 let mut accounts = Vec::with_capacity(16 + remaining_accounts.len());
565 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
566 *self.tree_config.key,
567 false,
568 ));
569 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
570 *self.leaf_owner.key,
571 false,
572 ));
573 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
574 *self.leaf_delegate.key,
575 false,
576 ));
577 accounts.push(solana_program::instruction::AccountMeta::new(
578 *self.merkle_tree.key,
579 false,
580 ));
581 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
582 *self.payer.key,
583 true,
584 ));
585 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
586 *self.tree_creator_or_delegate.key,
587 false,
588 ));
589 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
590 *self.collection_authority.key,
591 true,
592 ));
593 if let Some(collection_authority_record_pda) = self.collection_authority_record_pda {
594 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
595 *collection_authority_record_pda.key,
596 false,
597 ));
598 } else {
599 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
600 crate::MPL_BUBBLEGUM_ID,
601 false,
602 ));
603 }
604 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
605 *self.collection_mint.key,
606 false,
607 ));
608 accounts.push(solana_program::instruction::AccountMeta::new(
609 *self.collection_metadata.key,
610 false,
611 ));
612 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
613 *self.collection_edition.key,
614 false,
615 ));
616 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
617 *self.bubblegum_signer.key,
618 false,
619 ));
620 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
621 *self.log_wrapper.key,
622 false,
623 ));
624 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
625 *self.compression_program.key,
626 false,
627 ));
628 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
629 *self.token_metadata_program.key,
630 false,
631 ));
632 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
633 *self.system_program.key,
634 false,
635 ));
636 remaining_accounts.iter().for_each(|remaining_account| {
637 accounts.push(solana_program::instruction::AccountMeta {
638 pubkey: *remaining_account.0.key,
639 is_signer: remaining_account.1,
640 is_writable: remaining_account.2,
641 })
642 });
643 let mut data = UnverifyCollectionInstructionData::new()
644 .try_to_vec()
645 .unwrap();
646 let mut args = self.__args.try_to_vec().unwrap();
647 data.append(&mut args);
648
649 let instruction = solana_program::instruction::Instruction {
650 program_id: crate::MPL_BUBBLEGUM_ID,
651 accounts,
652 data,
653 };
654 let mut account_infos = Vec::with_capacity(16 + 1 + remaining_accounts.len());
655 account_infos.push(self.__program.clone());
656 account_infos.push(self.tree_config.clone());
657 account_infos.push(self.leaf_owner.clone());
658 account_infos.push(self.leaf_delegate.clone());
659 account_infos.push(self.merkle_tree.clone());
660 account_infos.push(self.payer.clone());
661 account_infos.push(self.tree_creator_or_delegate.clone());
662 account_infos.push(self.collection_authority.clone());
663 if let Some(collection_authority_record_pda) = self.collection_authority_record_pda {
664 account_infos.push(collection_authority_record_pda.clone());
665 }
666 account_infos.push(self.collection_mint.clone());
667 account_infos.push(self.collection_metadata.clone());
668 account_infos.push(self.collection_edition.clone());
669 account_infos.push(self.bubblegum_signer.clone());
670 account_infos.push(self.log_wrapper.clone());
671 account_infos.push(self.compression_program.clone());
672 account_infos.push(self.token_metadata_program.clone());
673 account_infos.push(self.system_program.clone());
674 remaining_accounts
675 .iter()
676 .for_each(|remaining_account| account_infos.push(remaining_account.0.clone()));
677
678 if signers_seeds.is_empty() {
679 solana_program::program::invoke(&instruction, &account_infos)
680 } else {
681 solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds)
682 }
683 }
684}
685
686pub struct UnverifyCollectionCpiBuilder<'a, 'b> {
688 instruction: Box<UnverifyCollectionCpiBuilderInstruction<'a, 'b>>,
689}
690
691impl<'a, 'b> UnverifyCollectionCpiBuilder<'a, 'b> {
692 pub fn new(program: &'b solana_program::account_info::AccountInfo<'a>) -> Self {
693 let instruction = Box::new(UnverifyCollectionCpiBuilderInstruction {
694 __program: program,
695 tree_config: None,
696 leaf_owner: None,
697 leaf_delegate: None,
698 merkle_tree: None,
699 payer: None,
700 tree_creator_or_delegate: None,
701 collection_authority: None,
702 collection_authority_record_pda: None,
703 collection_mint: None,
704 collection_metadata: None,
705 collection_edition: None,
706 bubblegum_signer: None,
707 log_wrapper: None,
708 compression_program: None,
709 token_metadata_program: None,
710 system_program: None,
711 root: None,
712 data_hash: None,
713 creator_hash: None,
714 nonce: None,
715 index: None,
716 metadata: None,
717 __remaining_accounts: Vec::new(),
718 });
719 Self { instruction }
720 }
721 #[inline(always)]
722 pub fn tree_config(
723 &mut self,
724 tree_config: &'b solana_program::account_info::AccountInfo<'a>,
725 ) -> &mut Self {
726 self.instruction.tree_config = Some(tree_config);
727 self
728 }
729 #[inline(always)]
730 pub fn leaf_owner(
731 &mut self,
732 leaf_owner: &'b solana_program::account_info::AccountInfo<'a>,
733 ) -> &mut Self {
734 self.instruction.leaf_owner = Some(leaf_owner);
735 self
736 }
737 #[inline(always)]
738 pub fn leaf_delegate(
739 &mut self,
740 leaf_delegate: &'b solana_program::account_info::AccountInfo<'a>,
741 ) -> &mut Self {
742 self.instruction.leaf_delegate = Some(leaf_delegate);
743 self
744 }
745 #[inline(always)]
746 pub fn merkle_tree(
747 &mut self,
748 merkle_tree: &'b solana_program::account_info::AccountInfo<'a>,
749 ) -> &mut Self {
750 self.instruction.merkle_tree = Some(merkle_tree);
751 self
752 }
753 #[inline(always)]
754 pub fn payer(&mut self, payer: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self {
755 self.instruction.payer = Some(payer);
756 self
757 }
758 #[inline(always)]
762 pub fn tree_creator_or_delegate(
763 &mut self,
764 tree_creator_or_delegate: &'b solana_program::account_info::AccountInfo<'a>,
765 ) -> &mut Self {
766 self.instruction.tree_creator_or_delegate = Some(tree_creator_or_delegate);
767 self
768 }
769 #[inline(always)]
770 pub fn collection_authority(
771 &mut self,
772 collection_authority: &'b solana_program::account_info::AccountInfo<'a>,
773 ) -> &mut Self {
774 self.instruction.collection_authority = Some(collection_authority);
775 self
776 }
777 #[inline(always)]
781 pub fn collection_authority_record_pda(
782 &mut self,
783 collection_authority_record_pda: Option<&'b solana_program::account_info::AccountInfo<'a>>,
784 ) -> &mut Self {
785 self.instruction.collection_authority_record_pda = collection_authority_record_pda;
786 self
787 }
788 #[inline(always)]
789 pub fn collection_mint(
790 &mut self,
791 collection_mint: &'b solana_program::account_info::AccountInfo<'a>,
792 ) -> &mut Self {
793 self.instruction.collection_mint = Some(collection_mint);
794 self
795 }
796 #[inline(always)]
797 pub fn collection_metadata(
798 &mut self,
799 collection_metadata: &'b solana_program::account_info::AccountInfo<'a>,
800 ) -> &mut Self {
801 self.instruction.collection_metadata = Some(collection_metadata);
802 self
803 }
804 #[inline(always)]
805 pub fn collection_edition(
806 &mut self,
807 collection_edition: &'b solana_program::account_info::AccountInfo<'a>,
808 ) -> &mut Self {
809 self.instruction.collection_edition = Some(collection_edition);
810 self
811 }
812 #[inline(always)]
813 pub fn bubblegum_signer(
814 &mut self,
815 bubblegum_signer: &'b solana_program::account_info::AccountInfo<'a>,
816 ) -> &mut Self {
817 self.instruction.bubblegum_signer = Some(bubblegum_signer);
818 self
819 }
820 #[inline(always)]
821 pub fn log_wrapper(
822 &mut self,
823 log_wrapper: &'b solana_program::account_info::AccountInfo<'a>,
824 ) -> &mut Self {
825 self.instruction.log_wrapper = Some(log_wrapper);
826 self
827 }
828 #[inline(always)]
829 pub fn compression_program(
830 &mut self,
831 compression_program: &'b solana_program::account_info::AccountInfo<'a>,
832 ) -> &mut Self {
833 self.instruction.compression_program = Some(compression_program);
834 self
835 }
836 #[inline(always)]
837 pub fn token_metadata_program(
838 &mut self,
839 token_metadata_program: &'b solana_program::account_info::AccountInfo<'a>,
840 ) -> &mut Self {
841 self.instruction.token_metadata_program = Some(token_metadata_program);
842 self
843 }
844 #[inline(always)]
845 pub fn system_program(
846 &mut self,
847 system_program: &'b solana_program::account_info::AccountInfo<'a>,
848 ) -> &mut Self {
849 self.instruction.system_program = Some(system_program);
850 self
851 }
852 #[inline(always)]
853 pub fn root(&mut self, root: [u8; 32]) -> &mut Self {
854 self.instruction.root = Some(root);
855 self
856 }
857 #[inline(always)]
858 pub fn data_hash(&mut self, data_hash: [u8; 32]) -> &mut Self {
859 self.instruction.data_hash = Some(data_hash);
860 self
861 }
862 #[inline(always)]
863 pub fn creator_hash(&mut self, creator_hash: [u8; 32]) -> &mut Self {
864 self.instruction.creator_hash = Some(creator_hash);
865 self
866 }
867 #[inline(always)]
868 pub fn nonce(&mut self, nonce: u64) -> &mut Self {
869 self.instruction.nonce = Some(nonce);
870 self
871 }
872 #[inline(always)]
873 pub fn index(&mut self, index: u32) -> &mut Self {
874 self.instruction.index = Some(index);
875 self
876 }
877 #[inline(always)]
878 pub fn metadata(&mut self, metadata: MetadataArgs) -> &mut Self {
879 self.instruction.metadata = Some(metadata);
880 self
881 }
882 #[inline(always)]
884 pub fn add_remaining_account(
885 &mut self,
886 account: &'b solana_program::account_info::AccountInfo<'a>,
887 is_writable: bool,
888 is_signer: bool,
889 ) -> &mut Self {
890 self.instruction
891 .__remaining_accounts
892 .push((account, is_writable, is_signer));
893 self
894 }
895 #[inline(always)]
900 pub fn add_remaining_accounts(
901 &mut self,
902 accounts: &[(
903 &'b solana_program::account_info::AccountInfo<'a>,
904 bool,
905 bool,
906 )],
907 ) -> &mut Self {
908 self.instruction
909 .__remaining_accounts
910 .extend_from_slice(accounts);
911 self
912 }
913 #[inline(always)]
914 pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult {
915 self.invoke_signed(&[])
916 }
917 #[allow(clippy::clone_on_copy)]
918 #[allow(clippy::vec_init_then_push)]
919 pub fn invoke_signed(
920 &self,
921 signers_seeds: &[&[&[u8]]],
922 ) -> solana_program::entrypoint::ProgramResult {
923 let args = UnverifyCollectionInstructionArgs {
924 root: self.instruction.root.clone().expect("root is not set"),
925 data_hash: self
926 .instruction
927 .data_hash
928 .clone()
929 .expect("data_hash is not set"),
930 creator_hash: self
931 .instruction
932 .creator_hash
933 .clone()
934 .expect("creator_hash is not set"),
935 nonce: self.instruction.nonce.clone().expect("nonce is not set"),
936 index: self.instruction.index.clone().expect("index is not set"),
937 metadata: self
938 .instruction
939 .metadata
940 .clone()
941 .expect("metadata is not set"),
942 };
943 let instruction = UnverifyCollectionCpi {
944 __program: self.instruction.__program,
945
946 tree_config: self
947 .instruction
948 .tree_config
949 .expect("tree_config is not set"),
950
951 leaf_owner: self.instruction.leaf_owner.expect("leaf_owner is not set"),
952
953 leaf_delegate: self
954 .instruction
955 .leaf_delegate
956 .expect("leaf_delegate is not set"),
957
958 merkle_tree: self
959 .instruction
960 .merkle_tree
961 .expect("merkle_tree is not set"),
962
963 payer: self.instruction.payer.expect("payer is not set"),
964
965 tree_creator_or_delegate: self
966 .instruction
967 .tree_creator_or_delegate
968 .expect("tree_creator_or_delegate is not set"),
969
970 collection_authority: self
971 .instruction
972 .collection_authority
973 .expect("collection_authority is not set"),
974
975 collection_authority_record_pda: self.instruction.collection_authority_record_pda,
976
977 collection_mint: self
978 .instruction
979 .collection_mint
980 .expect("collection_mint is not set"),
981
982 collection_metadata: self
983 .instruction
984 .collection_metadata
985 .expect("collection_metadata is not set"),
986
987 collection_edition: self
988 .instruction
989 .collection_edition
990 .expect("collection_edition is not set"),
991
992 bubblegum_signer: self
993 .instruction
994 .bubblegum_signer
995 .expect("bubblegum_signer is not set"),
996
997 log_wrapper: self
998 .instruction
999 .log_wrapper
1000 .expect("log_wrapper is not set"),
1001
1002 compression_program: self
1003 .instruction
1004 .compression_program
1005 .expect("compression_program is not set"),
1006
1007 token_metadata_program: self
1008 .instruction
1009 .token_metadata_program
1010 .expect("token_metadata_program is not set"),
1011
1012 system_program: self
1013 .instruction
1014 .system_program
1015 .expect("system_program is not set"),
1016 __args: args,
1017 };
1018 instruction.invoke_signed_with_remaining_accounts(
1019 signers_seeds,
1020 &self.instruction.__remaining_accounts,
1021 )
1022 }
1023}
1024
1025struct UnverifyCollectionCpiBuilderInstruction<'a, 'b> {
1026 __program: &'b solana_program::account_info::AccountInfo<'a>,
1027 tree_config: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1028 leaf_owner: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1029 leaf_delegate: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1030 merkle_tree: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1031 payer: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1032 tree_creator_or_delegate: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1033 collection_authority: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1034 collection_authority_record_pda: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1035 collection_mint: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1036 collection_metadata: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1037 collection_edition: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1038 bubblegum_signer: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1039 log_wrapper: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1040 compression_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1041 token_metadata_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1042 system_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1043 root: Option<[u8; 32]>,
1044 data_hash: Option<[u8; 32]>,
1045 creator_hash: Option<[u8; 32]>,
1046 nonce: Option<u64>,
1047 index: Option<u32>,
1048 metadata: Option<MetadataArgs>,
1049 __remaining_accounts: Vec<(
1051 &'b solana_program::account_info::AccountInfo<'a>,
1052 bool,
1053 bool,
1054 )>,
1055}