Skip to main content

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