Skip to main content

mpl_bubblegum/generated/instructions/
set_non_transferable_v2.rs

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