Skip to main content

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