Skip to main content

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