Skip to main content

tensor_price_lock/generated/instructions/
withdraw_collateral_legacy.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::AuthorizationDataLocal;
9use borsh::BorshDeserialize;
10use borsh::BorshSerialize;
11
12/// Accounts.
13pub struct WithdrawCollateralLegacy {
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 mint: solana_program::pubkey::Pubkey,
31
32    pub metadata: solana_program::pubkey::Pubkey,
33
34    pub order_vault_ta: solana_program::pubkey::Pubkey,
35
36    pub destination_ta: solana_program::pubkey::Pubkey,
37
38    pub edition: solana_program::pubkey::Pubkey,
39
40    pub order_token_record: Option<solana_program::pubkey::Pubkey>,
41
42    pub destination_token_record: Option<solana_program::pubkey::Pubkey>,
43
44    pub token_metadata_program: solana_program::pubkey::Pubkey,
45
46    pub instructions: solana_program::pubkey::Pubkey,
47
48    pub authorization_rules_program: solana_program::pubkey::Pubkey,
49
50    pub auth_rules: Option<solana_program::pubkey::Pubkey>,
51
52    pub token_program: solana_program::pubkey::Pubkey,
53
54    pub associated_token_program: solana_program::pubkey::Pubkey,
55
56    pub system_program: solana_program::pubkey::Pubkey,
57
58    pub whitelist: solana_program::pubkey::Pubkey,
59
60    pub mint_proof: Option<solana_program::pubkey::Pubkey>,
61
62    pub order_nft_receipt: solana_program::pubkey::Pubkey,
63}
64
65impl WithdrawCollateralLegacy {
66    pub fn instruction(
67        &self,
68        args: WithdrawCollateralLegacyInstructionArgs,
69    ) -> solana_program::instruction::Instruction {
70        self.instruction_with_remaining_accounts(args, &[])
71    }
72    #[allow(clippy::vec_init_then_push)]
73    pub fn instruction_with_remaining_accounts(
74        &self,
75        args: WithdrawCollateralLegacyInstructionArgs,
76        remaining_accounts: &[solana_program::instruction::AccountMeta],
77    ) -> solana_program::instruction::Instruction {
78        let mut accounts = Vec::with_capacity(25 + remaining_accounts.len());
79        accounts.push(solana_program::instruction::AccountMeta::new(
80            self.signer,
81            true,
82        ));
83        accounts.push(solana_program::instruction::AccountMeta::new(
84            self.order_state,
85            false,
86        ));
87        accounts.push(solana_program::instruction::AccountMeta::new(
88            self.order_vault,
89            false,
90        ));
91        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
92            self.maker, false,
93        ));
94        accounts.push(solana_program::instruction::AccountMeta::new(
95            self.taker, false,
96        ));
97        accounts.push(solana_program::instruction::AccountMeta::new(
98            self.destination,
99            false,
100        ));
101        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
102            self.system,
103            false,
104        ));
105        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
106            self.tlock_program,
107            false,
108        ));
109        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
110            self.mint, false,
111        ));
112        accounts.push(solana_program::instruction::AccountMeta::new(
113            self.metadata,
114            false,
115        ));
116        accounts.push(solana_program::instruction::AccountMeta::new(
117            self.order_vault_ta,
118            false,
119        ));
120        accounts.push(solana_program::instruction::AccountMeta::new(
121            self.destination_ta,
122            false,
123        ));
124        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
125            self.edition,
126            false,
127        ));
128        if let Some(order_token_record) = self.order_token_record {
129            accounts.push(solana_program::instruction::AccountMeta::new(
130                order_token_record,
131                false,
132            ));
133        } else {
134            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
135                crate::TENSOR_PRICE_LOCK_ID,
136                false,
137            ));
138        }
139        if let Some(destination_token_record) = self.destination_token_record {
140            accounts.push(solana_program::instruction::AccountMeta::new(
141                destination_token_record,
142                false,
143            ));
144        } else {
145            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
146                crate::TENSOR_PRICE_LOCK_ID,
147                false,
148            ));
149        }
150        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
151            self.token_metadata_program,
152            false,
153        ));
154        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
155            self.instructions,
156            false,
157        ));
158        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
159            self.authorization_rules_program,
160            false,
161        ));
162        if let Some(auth_rules) = self.auth_rules {
163            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
164                auth_rules, false,
165            ));
166        } else {
167            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
168                crate::TENSOR_PRICE_LOCK_ID,
169                false,
170            ));
171        }
172        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
173            self.token_program,
174            false,
175        ));
176        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
177            self.associated_token_program,
178            false,
179        ));
180        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
181            self.system_program,
182            false,
183        ));
184        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
185            self.whitelist,
186            false,
187        ));
188        if let Some(mint_proof) = self.mint_proof {
189            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
190                mint_proof, false,
191            ));
192        } else {
193            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
194                crate::TENSOR_PRICE_LOCK_ID,
195                false,
196            ));
197        }
198        accounts.push(solana_program::instruction::AccountMeta::new(
199            self.order_nft_receipt,
200            false,
201        ));
202        accounts.extend_from_slice(remaining_accounts);
203        let mut data = WithdrawCollateralLegacyInstructionData::new()
204            .try_to_vec()
205            .unwrap();
206        let mut args = args.try_to_vec().unwrap();
207        data.append(&mut args);
208
209        solana_program::instruction::Instruction {
210            program_id: crate::TENSOR_PRICE_LOCK_ID,
211            accounts,
212            data,
213        }
214    }
215}
216
217#[derive(BorshDeserialize, BorshSerialize)]
218pub struct WithdrawCollateralLegacyInstructionData {
219    discriminator: [u8; 8],
220}
221
222impl WithdrawCollateralLegacyInstructionData {
223    pub fn new() -> Self {
224        Self {
225            discriminator: [136, 168, 219, 213, 208, 241, 192, 93],
226        }
227    }
228}
229
230impl Default for WithdrawCollateralLegacyInstructionData {
231    fn default() -> Self {
232        Self::new()
233    }
234}
235
236#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)]
237#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
238pub struct WithdrawCollateralLegacyInstructionArgs {
239    pub to_maker: bool,
240    pub authorization_data: Option<AuthorizationDataLocal>,
241}
242
243/// Instruction builder for `WithdrawCollateralLegacy`.
244///
245/// ### Accounts:
246///
247///   0. `[writable, signer]` signer
248///   1. `[writable]` order_state
249///   2. `[writable]` order_vault
250///   3. `[]` maker
251///   4. `[writable]` taker
252///   5. `[writable]` destination
253///   6. `[optional]` system (default to `11111111111111111111111111111111`)
254///   7. `[]` tlock_program
255///   8. `[]` mint
256///   9. `[writable]` metadata
257///   10. `[writable]` order_vault_ta
258///   11. `[writable]` destination_ta
259///   12. `[]` edition
260///   13. `[writable, optional]` order_token_record
261///   14. `[writable, optional]` destination_token_record
262///   15. `[]` token_metadata_program
263///   16. `[optional]` instructions (default to `Sysvar1nstructions1111111111111111111111111`)
264///   17. `[]` authorization_rules_program
265///   18. `[optional]` auth_rules
266///   19. `[optional]` token_program (default to `TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA`)
267///   20. `[optional]` associated_token_program (default to `ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL`)
268///   21. `[optional]` system_program (default to `11111111111111111111111111111111`)
269///   22. `[]` whitelist
270///   23. `[optional]` mint_proof
271///   24. `[writable]` order_nft_receipt
272#[derive(Clone, Debug, Default)]
273pub struct WithdrawCollateralLegacyBuilder {
274    signer: Option<solana_program::pubkey::Pubkey>,
275    order_state: Option<solana_program::pubkey::Pubkey>,
276    order_vault: Option<solana_program::pubkey::Pubkey>,
277    maker: Option<solana_program::pubkey::Pubkey>,
278    taker: Option<solana_program::pubkey::Pubkey>,
279    destination: Option<solana_program::pubkey::Pubkey>,
280    system: Option<solana_program::pubkey::Pubkey>,
281    tlock_program: Option<solana_program::pubkey::Pubkey>,
282    mint: Option<solana_program::pubkey::Pubkey>,
283    metadata: Option<solana_program::pubkey::Pubkey>,
284    order_vault_ta: Option<solana_program::pubkey::Pubkey>,
285    destination_ta: Option<solana_program::pubkey::Pubkey>,
286    edition: Option<solana_program::pubkey::Pubkey>,
287    order_token_record: Option<solana_program::pubkey::Pubkey>,
288    destination_token_record: Option<solana_program::pubkey::Pubkey>,
289    token_metadata_program: Option<solana_program::pubkey::Pubkey>,
290    instructions: Option<solana_program::pubkey::Pubkey>,
291    authorization_rules_program: Option<solana_program::pubkey::Pubkey>,
292    auth_rules: Option<solana_program::pubkey::Pubkey>,
293    token_program: Option<solana_program::pubkey::Pubkey>,
294    associated_token_program: Option<solana_program::pubkey::Pubkey>,
295    system_program: Option<solana_program::pubkey::Pubkey>,
296    whitelist: Option<solana_program::pubkey::Pubkey>,
297    mint_proof: Option<solana_program::pubkey::Pubkey>,
298    order_nft_receipt: Option<solana_program::pubkey::Pubkey>,
299    to_maker: Option<bool>,
300    authorization_data: Option<AuthorizationDataLocal>,
301    __remaining_accounts: Vec<solana_program::instruction::AccountMeta>,
302}
303
304impl WithdrawCollateralLegacyBuilder {
305    pub fn new() -> Self {
306        Self::default()
307    }
308    #[inline(always)]
309    pub fn signer(&mut self, signer: solana_program::pubkey::Pubkey) -> &mut Self {
310        self.signer = Some(signer);
311        self
312    }
313    #[inline(always)]
314    pub fn order_state(&mut self, order_state: solana_program::pubkey::Pubkey) -> &mut Self {
315        self.order_state = Some(order_state);
316        self
317    }
318    #[inline(always)]
319    pub fn order_vault(&mut self, order_vault: solana_program::pubkey::Pubkey) -> &mut Self {
320        self.order_vault = Some(order_vault);
321        self
322    }
323    #[inline(always)]
324    pub fn maker(&mut self, maker: solana_program::pubkey::Pubkey) -> &mut Self {
325        self.maker = Some(maker);
326        self
327    }
328    #[inline(always)]
329    pub fn taker(&mut self, taker: solana_program::pubkey::Pubkey) -> &mut Self {
330        self.taker = Some(taker);
331        self
332    }
333    #[inline(always)]
334    pub fn destination(&mut self, destination: solana_program::pubkey::Pubkey) -> &mut Self {
335        self.destination = Some(destination);
336        self
337    }
338    /// `[optional account, default to '11111111111111111111111111111111']`
339    #[inline(always)]
340    pub fn system(&mut self, system: solana_program::pubkey::Pubkey) -> &mut Self {
341        self.system = Some(system);
342        self
343    }
344    #[inline(always)]
345    pub fn tlock_program(&mut self, tlock_program: solana_program::pubkey::Pubkey) -> &mut Self {
346        self.tlock_program = Some(tlock_program);
347        self
348    }
349    #[inline(always)]
350    pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self {
351        self.mint = Some(mint);
352        self
353    }
354    #[inline(always)]
355    pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self {
356        self.metadata = Some(metadata);
357        self
358    }
359    #[inline(always)]
360    pub fn order_vault_ta(&mut self, order_vault_ta: solana_program::pubkey::Pubkey) -> &mut Self {
361        self.order_vault_ta = Some(order_vault_ta);
362        self
363    }
364    #[inline(always)]
365    pub fn destination_ta(&mut self, destination_ta: solana_program::pubkey::Pubkey) -> &mut Self {
366        self.destination_ta = Some(destination_ta);
367        self
368    }
369    #[inline(always)]
370    pub fn edition(&mut self, edition: solana_program::pubkey::Pubkey) -> &mut Self {
371        self.edition = Some(edition);
372        self
373    }
374    /// `[optional account]`
375    #[inline(always)]
376    pub fn order_token_record(
377        &mut self,
378        order_token_record: Option<solana_program::pubkey::Pubkey>,
379    ) -> &mut Self {
380        self.order_token_record = order_token_record;
381        self
382    }
383    /// `[optional account]`
384    #[inline(always)]
385    pub fn destination_token_record(
386        &mut self,
387        destination_token_record: Option<solana_program::pubkey::Pubkey>,
388    ) -> &mut Self {
389        self.destination_token_record = destination_token_record;
390        self
391    }
392    #[inline(always)]
393    pub fn token_metadata_program(
394        &mut self,
395        token_metadata_program: solana_program::pubkey::Pubkey,
396    ) -> &mut Self {
397        self.token_metadata_program = Some(token_metadata_program);
398        self
399    }
400    /// `[optional account, default to 'Sysvar1nstructions1111111111111111111111111']`
401    #[inline(always)]
402    pub fn instructions(&mut self, instructions: solana_program::pubkey::Pubkey) -> &mut Self {
403        self.instructions = Some(instructions);
404        self
405    }
406    #[inline(always)]
407    pub fn authorization_rules_program(
408        &mut self,
409        authorization_rules_program: solana_program::pubkey::Pubkey,
410    ) -> &mut Self {
411        self.authorization_rules_program = Some(authorization_rules_program);
412        self
413    }
414    /// `[optional account]`
415    #[inline(always)]
416    pub fn auth_rules(&mut self, auth_rules: Option<solana_program::pubkey::Pubkey>) -> &mut Self {
417        self.auth_rules = auth_rules;
418        self
419    }
420    /// `[optional account, default to 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA']`
421    #[inline(always)]
422    pub fn token_program(&mut self, token_program: solana_program::pubkey::Pubkey) -> &mut Self {
423        self.token_program = Some(token_program);
424        self
425    }
426    /// `[optional account, default to 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL']`
427    #[inline(always)]
428    pub fn associated_token_program(
429        &mut self,
430        associated_token_program: solana_program::pubkey::Pubkey,
431    ) -> &mut Self {
432        self.associated_token_program = Some(associated_token_program);
433        self
434    }
435    /// `[optional account, default to '11111111111111111111111111111111']`
436    #[inline(always)]
437    pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self {
438        self.system_program = Some(system_program);
439        self
440    }
441    #[inline(always)]
442    pub fn whitelist(&mut self, whitelist: solana_program::pubkey::Pubkey) -> &mut Self {
443        self.whitelist = Some(whitelist);
444        self
445    }
446    /// `[optional account]`
447    #[inline(always)]
448    pub fn mint_proof(&mut self, mint_proof: Option<solana_program::pubkey::Pubkey>) -> &mut Self {
449        self.mint_proof = mint_proof;
450        self
451    }
452    #[inline(always)]
453    pub fn order_nft_receipt(
454        &mut self,
455        order_nft_receipt: solana_program::pubkey::Pubkey,
456    ) -> &mut Self {
457        self.order_nft_receipt = Some(order_nft_receipt);
458        self
459    }
460    /// `[optional argument, defaults to 'true']`
461    #[inline(always)]
462    pub fn to_maker(&mut self, to_maker: bool) -> &mut Self {
463        self.to_maker = Some(to_maker);
464        self
465    }
466    /// `[optional argument]`
467    #[inline(always)]
468    pub fn authorization_data(&mut self, authorization_data: AuthorizationDataLocal) -> &mut Self {
469        self.authorization_data = Some(authorization_data);
470        self
471    }
472    /// Add an aditional account to the instruction.
473    #[inline(always)]
474    pub fn add_remaining_account(
475        &mut self,
476        account: solana_program::instruction::AccountMeta,
477    ) -> &mut Self {
478        self.__remaining_accounts.push(account);
479        self
480    }
481    /// Add additional accounts to the instruction.
482    #[inline(always)]
483    pub fn add_remaining_accounts(
484        &mut self,
485        accounts: &[solana_program::instruction::AccountMeta],
486    ) -> &mut Self {
487        self.__remaining_accounts.extend_from_slice(accounts);
488        self
489    }
490    #[allow(clippy::clone_on_copy)]
491    pub fn instruction(&self) -> solana_program::instruction::Instruction {
492        let accounts = WithdrawCollateralLegacy {
493            signer: self.signer.expect("signer is not set"),
494            order_state: self.order_state.expect("order_state is not set"),
495            order_vault: self.order_vault.expect("order_vault is not set"),
496            maker: self.maker.expect("maker is not set"),
497            taker: self.taker.expect("taker is not set"),
498            destination: self.destination.expect("destination is not set"),
499            system: self
500                .system
501                .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")),
502            tlock_program: self.tlock_program.expect("tlock_program is not set"),
503            mint: self.mint.expect("mint is not set"),
504            metadata: self.metadata.expect("metadata is not set"),
505            order_vault_ta: self.order_vault_ta.expect("order_vault_ta is not set"),
506            destination_ta: self.destination_ta.expect("destination_ta is not set"),
507            edition: self.edition.expect("edition is not set"),
508            order_token_record: self.order_token_record,
509            destination_token_record: self.destination_token_record,
510            token_metadata_program: self
511                .token_metadata_program
512                .expect("token_metadata_program is not set"),
513            instructions: self.instructions.unwrap_or(solana_program::pubkey!(
514                "Sysvar1nstructions1111111111111111111111111"
515            )),
516            authorization_rules_program: self
517                .authorization_rules_program
518                .expect("authorization_rules_program is not set"),
519            auth_rules: self.auth_rules,
520            token_program: self.token_program.unwrap_or(solana_program::pubkey!(
521                "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
522            )),
523            associated_token_program: self.associated_token_program.unwrap_or(
524                solana_program::pubkey!("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"),
525            ),
526            system_program: self
527                .system_program
528                .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")),
529            whitelist: self.whitelist.expect("whitelist is not set"),
530            mint_proof: self.mint_proof,
531            order_nft_receipt: self
532                .order_nft_receipt
533                .expect("order_nft_receipt is not set"),
534        };
535        let args = WithdrawCollateralLegacyInstructionArgs {
536            to_maker: self.to_maker.clone().unwrap_or(true),
537            authorization_data: self.authorization_data.clone(),
538        };
539
540        accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts)
541    }
542}
543
544/// `withdraw_collateral_legacy` CPI accounts.
545pub struct WithdrawCollateralLegacyCpiAccounts<'a, 'b> {
546    pub signer: &'b solana_program::account_info::AccountInfo<'a>,
547
548    pub order_state: &'b solana_program::account_info::AccountInfo<'a>,
549
550    pub order_vault: &'b solana_program::account_info::AccountInfo<'a>,
551
552    pub maker: &'b solana_program::account_info::AccountInfo<'a>,
553
554    pub taker: &'b solana_program::account_info::AccountInfo<'a>,
555
556    pub destination: &'b solana_program::account_info::AccountInfo<'a>,
557
558    pub system: &'b solana_program::account_info::AccountInfo<'a>,
559
560    pub tlock_program: &'b solana_program::account_info::AccountInfo<'a>,
561
562    pub mint: &'b solana_program::account_info::AccountInfo<'a>,
563
564    pub metadata: &'b solana_program::account_info::AccountInfo<'a>,
565
566    pub order_vault_ta: &'b solana_program::account_info::AccountInfo<'a>,
567
568    pub destination_ta: &'b solana_program::account_info::AccountInfo<'a>,
569
570    pub edition: &'b solana_program::account_info::AccountInfo<'a>,
571
572    pub order_token_record: Option<&'b solana_program::account_info::AccountInfo<'a>>,
573
574    pub destination_token_record: Option<&'b solana_program::account_info::AccountInfo<'a>>,
575
576    pub token_metadata_program: &'b solana_program::account_info::AccountInfo<'a>,
577
578    pub instructions: &'b solana_program::account_info::AccountInfo<'a>,
579
580    pub authorization_rules_program: &'b solana_program::account_info::AccountInfo<'a>,
581
582    pub auth_rules: Option<&'b solana_program::account_info::AccountInfo<'a>>,
583
584    pub token_program: &'b solana_program::account_info::AccountInfo<'a>,
585
586    pub associated_token_program: &'b solana_program::account_info::AccountInfo<'a>,
587
588    pub system_program: &'b solana_program::account_info::AccountInfo<'a>,
589
590    pub whitelist: &'b solana_program::account_info::AccountInfo<'a>,
591
592    pub mint_proof: Option<&'b solana_program::account_info::AccountInfo<'a>>,
593
594    pub order_nft_receipt: &'b solana_program::account_info::AccountInfo<'a>,
595}
596
597/// `withdraw_collateral_legacy` CPI instruction.
598pub struct WithdrawCollateralLegacyCpi<'a, 'b> {
599    /// The program to invoke.
600    pub __program: &'b solana_program::account_info::AccountInfo<'a>,
601
602    pub signer: &'b solana_program::account_info::AccountInfo<'a>,
603
604    pub order_state: &'b solana_program::account_info::AccountInfo<'a>,
605
606    pub order_vault: &'b solana_program::account_info::AccountInfo<'a>,
607
608    pub maker: &'b solana_program::account_info::AccountInfo<'a>,
609
610    pub taker: &'b solana_program::account_info::AccountInfo<'a>,
611
612    pub destination: &'b solana_program::account_info::AccountInfo<'a>,
613
614    pub system: &'b solana_program::account_info::AccountInfo<'a>,
615
616    pub tlock_program: &'b solana_program::account_info::AccountInfo<'a>,
617
618    pub mint: &'b solana_program::account_info::AccountInfo<'a>,
619
620    pub metadata: &'b solana_program::account_info::AccountInfo<'a>,
621
622    pub order_vault_ta: &'b solana_program::account_info::AccountInfo<'a>,
623
624    pub destination_ta: &'b solana_program::account_info::AccountInfo<'a>,
625
626    pub edition: &'b solana_program::account_info::AccountInfo<'a>,
627
628    pub order_token_record: Option<&'b solana_program::account_info::AccountInfo<'a>>,
629
630    pub destination_token_record: Option<&'b solana_program::account_info::AccountInfo<'a>>,
631
632    pub token_metadata_program: &'b solana_program::account_info::AccountInfo<'a>,
633
634    pub instructions: &'b solana_program::account_info::AccountInfo<'a>,
635
636    pub authorization_rules_program: &'b solana_program::account_info::AccountInfo<'a>,
637
638    pub auth_rules: Option<&'b solana_program::account_info::AccountInfo<'a>>,
639
640    pub token_program: &'b solana_program::account_info::AccountInfo<'a>,
641
642    pub associated_token_program: &'b solana_program::account_info::AccountInfo<'a>,
643
644    pub system_program: &'b solana_program::account_info::AccountInfo<'a>,
645
646    pub whitelist: &'b solana_program::account_info::AccountInfo<'a>,
647
648    pub mint_proof: Option<&'b solana_program::account_info::AccountInfo<'a>>,
649
650    pub order_nft_receipt: &'b solana_program::account_info::AccountInfo<'a>,
651    /// The arguments for the instruction.
652    pub __args: WithdrawCollateralLegacyInstructionArgs,
653}
654
655impl<'a, 'b> WithdrawCollateralLegacyCpi<'a, 'b> {
656    pub fn new(
657        program: &'b solana_program::account_info::AccountInfo<'a>,
658        accounts: WithdrawCollateralLegacyCpiAccounts<'a, 'b>,
659        args: WithdrawCollateralLegacyInstructionArgs,
660    ) -> Self {
661        Self {
662            __program: program,
663            signer: accounts.signer,
664            order_state: accounts.order_state,
665            order_vault: accounts.order_vault,
666            maker: accounts.maker,
667            taker: accounts.taker,
668            destination: accounts.destination,
669            system: accounts.system,
670            tlock_program: accounts.tlock_program,
671            mint: accounts.mint,
672            metadata: accounts.metadata,
673            order_vault_ta: accounts.order_vault_ta,
674            destination_ta: accounts.destination_ta,
675            edition: accounts.edition,
676            order_token_record: accounts.order_token_record,
677            destination_token_record: accounts.destination_token_record,
678            token_metadata_program: accounts.token_metadata_program,
679            instructions: accounts.instructions,
680            authorization_rules_program: accounts.authorization_rules_program,
681            auth_rules: accounts.auth_rules,
682            token_program: accounts.token_program,
683            associated_token_program: accounts.associated_token_program,
684            system_program: accounts.system_program,
685            whitelist: accounts.whitelist,
686            mint_proof: accounts.mint_proof,
687            order_nft_receipt: accounts.order_nft_receipt,
688            __args: args,
689        }
690    }
691    #[inline(always)]
692    pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult {
693        self.invoke_signed_with_remaining_accounts(&[], &[])
694    }
695    #[inline(always)]
696    pub fn invoke_with_remaining_accounts(
697        &self,
698        remaining_accounts: &[(
699            &'b solana_program::account_info::AccountInfo<'a>,
700            bool,
701            bool,
702        )],
703    ) -> solana_program::entrypoint::ProgramResult {
704        self.invoke_signed_with_remaining_accounts(&[], remaining_accounts)
705    }
706    #[inline(always)]
707    pub fn invoke_signed(
708        &self,
709        signers_seeds: &[&[&[u8]]],
710    ) -> solana_program::entrypoint::ProgramResult {
711        self.invoke_signed_with_remaining_accounts(signers_seeds, &[])
712    }
713    #[allow(clippy::clone_on_copy)]
714    #[allow(clippy::vec_init_then_push)]
715    pub fn invoke_signed_with_remaining_accounts(
716        &self,
717        signers_seeds: &[&[&[u8]]],
718        remaining_accounts: &[(
719            &'b solana_program::account_info::AccountInfo<'a>,
720            bool,
721            bool,
722        )],
723    ) -> solana_program::entrypoint::ProgramResult {
724        let mut accounts = Vec::with_capacity(25 + remaining_accounts.len());
725        accounts.push(solana_program::instruction::AccountMeta::new(
726            *self.signer.key,
727            true,
728        ));
729        accounts.push(solana_program::instruction::AccountMeta::new(
730            *self.order_state.key,
731            false,
732        ));
733        accounts.push(solana_program::instruction::AccountMeta::new(
734            *self.order_vault.key,
735            false,
736        ));
737        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
738            *self.maker.key,
739            false,
740        ));
741        accounts.push(solana_program::instruction::AccountMeta::new(
742            *self.taker.key,
743            false,
744        ));
745        accounts.push(solana_program::instruction::AccountMeta::new(
746            *self.destination.key,
747            false,
748        ));
749        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
750            *self.system.key,
751            false,
752        ));
753        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
754            *self.tlock_program.key,
755            false,
756        ));
757        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
758            *self.mint.key,
759            false,
760        ));
761        accounts.push(solana_program::instruction::AccountMeta::new(
762            *self.metadata.key,
763            false,
764        ));
765        accounts.push(solana_program::instruction::AccountMeta::new(
766            *self.order_vault_ta.key,
767            false,
768        ));
769        accounts.push(solana_program::instruction::AccountMeta::new(
770            *self.destination_ta.key,
771            false,
772        ));
773        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
774            *self.edition.key,
775            false,
776        ));
777        if let Some(order_token_record) = self.order_token_record {
778            accounts.push(solana_program::instruction::AccountMeta::new(
779                *order_token_record.key,
780                false,
781            ));
782        } else {
783            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
784                crate::TENSOR_PRICE_LOCK_ID,
785                false,
786            ));
787        }
788        if let Some(destination_token_record) = self.destination_token_record {
789            accounts.push(solana_program::instruction::AccountMeta::new(
790                *destination_token_record.key,
791                false,
792            ));
793        } else {
794            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
795                crate::TENSOR_PRICE_LOCK_ID,
796                false,
797            ));
798        }
799        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
800            *self.token_metadata_program.key,
801            false,
802        ));
803        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
804            *self.instructions.key,
805            false,
806        ));
807        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
808            *self.authorization_rules_program.key,
809            false,
810        ));
811        if let Some(auth_rules) = self.auth_rules {
812            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
813                *auth_rules.key,
814                false,
815            ));
816        } else {
817            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
818                crate::TENSOR_PRICE_LOCK_ID,
819                false,
820            ));
821        }
822        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
823            *self.token_program.key,
824            false,
825        ));
826        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
827            *self.associated_token_program.key,
828            false,
829        ));
830        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
831            *self.system_program.key,
832            false,
833        ));
834        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
835            *self.whitelist.key,
836            false,
837        ));
838        if let Some(mint_proof) = self.mint_proof {
839            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
840                *mint_proof.key,
841                false,
842            ));
843        } else {
844            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
845                crate::TENSOR_PRICE_LOCK_ID,
846                false,
847            ));
848        }
849        accounts.push(solana_program::instruction::AccountMeta::new(
850            *self.order_nft_receipt.key,
851            false,
852        ));
853        remaining_accounts.iter().for_each(|remaining_account| {
854            accounts.push(solana_program::instruction::AccountMeta {
855                pubkey: *remaining_account.0.key,
856                is_signer: remaining_account.1,
857                is_writable: remaining_account.2,
858            })
859        });
860        let mut data = WithdrawCollateralLegacyInstructionData::new()
861            .try_to_vec()
862            .unwrap();
863        let mut args = self.__args.try_to_vec().unwrap();
864        data.append(&mut args);
865
866        let instruction = solana_program::instruction::Instruction {
867            program_id: crate::TENSOR_PRICE_LOCK_ID,
868            accounts,
869            data,
870        };
871        let mut account_infos = Vec::with_capacity(25 + 1 + remaining_accounts.len());
872        account_infos.push(self.__program.clone());
873        account_infos.push(self.signer.clone());
874        account_infos.push(self.order_state.clone());
875        account_infos.push(self.order_vault.clone());
876        account_infos.push(self.maker.clone());
877        account_infos.push(self.taker.clone());
878        account_infos.push(self.destination.clone());
879        account_infos.push(self.system.clone());
880        account_infos.push(self.tlock_program.clone());
881        account_infos.push(self.mint.clone());
882        account_infos.push(self.metadata.clone());
883        account_infos.push(self.order_vault_ta.clone());
884        account_infos.push(self.destination_ta.clone());
885        account_infos.push(self.edition.clone());
886        if let Some(order_token_record) = self.order_token_record {
887            account_infos.push(order_token_record.clone());
888        }
889        if let Some(destination_token_record) = self.destination_token_record {
890            account_infos.push(destination_token_record.clone());
891        }
892        account_infos.push(self.token_metadata_program.clone());
893        account_infos.push(self.instructions.clone());
894        account_infos.push(self.authorization_rules_program.clone());
895        if let Some(auth_rules) = self.auth_rules {
896            account_infos.push(auth_rules.clone());
897        }
898        account_infos.push(self.token_program.clone());
899        account_infos.push(self.associated_token_program.clone());
900        account_infos.push(self.system_program.clone());
901        account_infos.push(self.whitelist.clone());
902        if let Some(mint_proof) = self.mint_proof {
903            account_infos.push(mint_proof.clone());
904        }
905        account_infos.push(self.order_nft_receipt.clone());
906        remaining_accounts
907            .iter()
908            .for_each(|remaining_account| account_infos.push(remaining_account.0.clone()));
909
910        if signers_seeds.is_empty() {
911            solana_program::program::invoke(&instruction, &account_infos)
912        } else {
913            solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds)
914        }
915    }
916}
917
918/// Instruction builder for `WithdrawCollateralLegacy` via CPI.
919///
920/// ### Accounts:
921///
922///   0. `[writable, signer]` signer
923///   1. `[writable]` order_state
924///   2. `[writable]` order_vault
925///   3. `[]` maker
926///   4. `[writable]` taker
927///   5. `[writable]` destination
928///   6. `[]` system
929///   7. `[]` tlock_program
930///   8. `[]` mint
931///   9. `[writable]` metadata
932///   10. `[writable]` order_vault_ta
933///   11. `[writable]` destination_ta
934///   12. `[]` edition
935///   13. `[writable, optional]` order_token_record
936///   14. `[writable, optional]` destination_token_record
937///   15. `[]` token_metadata_program
938///   16. `[]` instructions
939///   17. `[]` authorization_rules_program
940///   18. `[optional]` auth_rules
941///   19. `[]` token_program
942///   20. `[]` associated_token_program
943///   21. `[]` system_program
944///   22. `[]` whitelist
945///   23. `[optional]` mint_proof
946///   24. `[writable]` order_nft_receipt
947#[derive(Clone, Debug)]
948pub struct WithdrawCollateralLegacyCpiBuilder<'a, 'b> {
949    instruction: Box<WithdrawCollateralLegacyCpiBuilderInstruction<'a, 'b>>,
950}
951
952impl<'a, 'b> WithdrawCollateralLegacyCpiBuilder<'a, 'b> {
953    pub fn new(program: &'b solana_program::account_info::AccountInfo<'a>) -> Self {
954        let instruction = Box::new(WithdrawCollateralLegacyCpiBuilderInstruction {
955            __program: program,
956            signer: None,
957            order_state: None,
958            order_vault: None,
959            maker: None,
960            taker: None,
961            destination: None,
962            system: None,
963            tlock_program: None,
964            mint: None,
965            metadata: None,
966            order_vault_ta: None,
967            destination_ta: None,
968            edition: None,
969            order_token_record: None,
970            destination_token_record: None,
971            token_metadata_program: None,
972            instructions: None,
973            authorization_rules_program: None,
974            auth_rules: None,
975            token_program: None,
976            associated_token_program: None,
977            system_program: None,
978            whitelist: None,
979            mint_proof: None,
980            order_nft_receipt: None,
981            to_maker: None,
982            authorization_data: None,
983            __remaining_accounts: Vec::new(),
984        });
985        Self { instruction }
986    }
987    #[inline(always)]
988    pub fn signer(
989        &mut self,
990        signer: &'b solana_program::account_info::AccountInfo<'a>,
991    ) -> &mut Self {
992        self.instruction.signer = Some(signer);
993        self
994    }
995    #[inline(always)]
996    pub fn order_state(
997        &mut self,
998        order_state: &'b solana_program::account_info::AccountInfo<'a>,
999    ) -> &mut Self {
1000        self.instruction.order_state = Some(order_state);
1001        self
1002    }
1003    #[inline(always)]
1004    pub fn order_vault(
1005        &mut self,
1006        order_vault: &'b solana_program::account_info::AccountInfo<'a>,
1007    ) -> &mut Self {
1008        self.instruction.order_vault = Some(order_vault);
1009        self
1010    }
1011    #[inline(always)]
1012    pub fn maker(&mut self, maker: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self {
1013        self.instruction.maker = Some(maker);
1014        self
1015    }
1016    #[inline(always)]
1017    pub fn taker(&mut self, taker: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self {
1018        self.instruction.taker = Some(taker);
1019        self
1020    }
1021    #[inline(always)]
1022    pub fn destination(
1023        &mut self,
1024        destination: &'b solana_program::account_info::AccountInfo<'a>,
1025    ) -> &mut Self {
1026        self.instruction.destination = Some(destination);
1027        self
1028    }
1029    #[inline(always)]
1030    pub fn system(
1031        &mut self,
1032        system: &'b solana_program::account_info::AccountInfo<'a>,
1033    ) -> &mut Self {
1034        self.instruction.system = Some(system);
1035        self
1036    }
1037    #[inline(always)]
1038    pub fn tlock_program(
1039        &mut self,
1040        tlock_program: &'b solana_program::account_info::AccountInfo<'a>,
1041    ) -> &mut Self {
1042        self.instruction.tlock_program = Some(tlock_program);
1043        self
1044    }
1045    #[inline(always)]
1046    pub fn mint(&mut self, mint: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self {
1047        self.instruction.mint = Some(mint);
1048        self
1049    }
1050    #[inline(always)]
1051    pub fn metadata(
1052        &mut self,
1053        metadata: &'b solana_program::account_info::AccountInfo<'a>,
1054    ) -> &mut Self {
1055        self.instruction.metadata = Some(metadata);
1056        self
1057    }
1058    #[inline(always)]
1059    pub fn order_vault_ta(
1060        &mut self,
1061        order_vault_ta: &'b solana_program::account_info::AccountInfo<'a>,
1062    ) -> &mut Self {
1063        self.instruction.order_vault_ta = Some(order_vault_ta);
1064        self
1065    }
1066    #[inline(always)]
1067    pub fn destination_ta(
1068        &mut self,
1069        destination_ta: &'b solana_program::account_info::AccountInfo<'a>,
1070    ) -> &mut Self {
1071        self.instruction.destination_ta = Some(destination_ta);
1072        self
1073    }
1074    #[inline(always)]
1075    pub fn edition(
1076        &mut self,
1077        edition: &'b solana_program::account_info::AccountInfo<'a>,
1078    ) -> &mut Self {
1079        self.instruction.edition = Some(edition);
1080        self
1081    }
1082    /// `[optional account]`
1083    #[inline(always)]
1084    pub fn order_token_record(
1085        &mut self,
1086        order_token_record: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1087    ) -> &mut Self {
1088        self.instruction.order_token_record = order_token_record;
1089        self
1090    }
1091    /// `[optional account]`
1092    #[inline(always)]
1093    pub fn destination_token_record(
1094        &mut self,
1095        destination_token_record: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1096    ) -> &mut Self {
1097        self.instruction.destination_token_record = destination_token_record;
1098        self
1099    }
1100    #[inline(always)]
1101    pub fn token_metadata_program(
1102        &mut self,
1103        token_metadata_program: &'b solana_program::account_info::AccountInfo<'a>,
1104    ) -> &mut Self {
1105        self.instruction.token_metadata_program = Some(token_metadata_program);
1106        self
1107    }
1108    #[inline(always)]
1109    pub fn instructions(
1110        &mut self,
1111        instructions: &'b solana_program::account_info::AccountInfo<'a>,
1112    ) -> &mut Self {
1113        self.instruction.instructions = Some(instructions);
1114        self
1115    }
1116    #[inline(always)]
1117    pub fn authorization_rules_program(
1118        &mut self,
1119        authorization_rules_program: &'b solana_program::account_info::AccountInfo<'a>,
1120    ) -> &mut Self {
1121        self.instruction.authorization_rules_program = Some(authorization_rules_program);
1122        self
1123    }
1124    /// `[optional account]`
1125    #[inline(always)]
1126    pub fn auth_rules(
1127        &mut self,
1128        auth_rules: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1129    ) -> &mut Self {
1130        self.instruction.auth_rules = auth_rules;
1131        self
1132    }
1133    #[inline(always)]
1134    pub fn token_program(
1135        &mut self,
1136        token_program: &'b solana_program::account_info::AccountInfo<'a>,
1137    ) -> &mut Self {
1138        self.instruction.token_program = Some(token_program);
1139        self
1140    }
1141    #[inline(always)]
1142    pub fn associated_token_program(
1143        &mut self,
1144        associated_token_program: &'b solana_program::account_info::AccountInfo<'a>,
1145    ) -> &mut Self {
1146        self.instruction.associated_token_program = Some(associated_token_program);
1147        self
1148    }
1149    #[inline(always)]
1150    pub fn system_program(
1151        &mut self,
1152        system_program: &'b solana_program::account_info::AccountInfo<'a>,
1153    ) -> &mut Self {
1154        self.instruction.system_program = Some(system_program);
1155        self
1156    }
1157    #[inline(always)]
1158    pub fn whitelist(
1159        &mut self,
1160        whitelist: &'b solana_program::account_info::AccountInfo<'a>,
1161    ) -> &mut Self {
1162        self.instruction.whitelist = Some(whitelist);
1163        self
1164    }
1165    /// `[optional account]`
1166    #[inline(always)]
1167    pub fn mint_proof(
1168        &mut self,
1169        mint_proof: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1170    ) -> &mut Self {
1171        self.instruction.mint_proof = mint_proof;
1172        self
1173    }
1174    #[inline(always)]
1175    pub fn order_nft_receipt(
1176        &mut self,
1177        order_nft_receipt: &'b solana_program::account_info::AccountInfo<'a>,
1178    ) -> &mut Self {
1179        self.instruction.order_nft_receipt = Some(order_nft_receipt);
1180        self
1181    }
1182    /// `[optional argument, defaults to 'true']`
1183    #[inline(always)]
1184    pub fn to_maker(&mut self, to_maker: bool) -> &mut Self {
1185        self.instruction.to_maker = Some(to_maker);
1186        self
1187    }
1188    /// `[optional argument]`
1189    #[inline(always)]
1190    pub fn authorization_data(&mut self, authorization_data: AuthorizationDataLocal) -> &mut Self {
1191        self.instruction.authorization_data = Some(authorization_data);
1192        self
1193    }
1194    /// Add an additional account to the instruction.
1195    #[inline(always)]
1196    pub fn add_remaining_account(
1197        &mut self,
1198        account: &'b solana_program::account_info::AccountInfo<'a>,
1199        is_writable: bool,
1200        is_signer: bool,
1201    ) -> &mut Self {
1202        self.instruction
1203            .__remaining_accounts
1204            .push((account, is_writable, is_signer));
1205        self
1206    }
1207    /// Add additional accounts to the instruction.
1208    ///
1209    /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not,
1210    /// and a `bool` indicating whether the account is a signer or not.
1211    #[inline(always)]
1212    pub fn add_remaining_accounts(
1213        &mut self,
1214        accounts: &[(
1215            &'b solana_program::account_info::AccountInfo<'a>,
1216            bool,
1217            bool,
1218        )],
1219    ) -> &mut Self {
1220        self.instruction
1221            .__remaining_accounts
1222            .extend_from_slice(accounts);
1223        self
1224    }
1225    #[inline(always)]
1226    pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult {
1227        self.invoke_signed(&[])
1228    }
1229    #[allow(clippy::clone_on_copy)]
1230    #[allow(clippy::vec_init_then_push)]
1231    pub fn invoke_signed(
1232        &self,
1233        signers_seeds: &[&[&[u8]]],
1234    ) -> solana_program::entrypoint::ProgramResult {
1235        let args = WithdrawCollateralLegacyInstructionArgs {
1236            to_maker: self.instruction.to_maker.clone().unwrap_or(true),
1237            authorization_data: self.instruction.authorization_data.clone(),
1238        };
1239        let instruction = WithdrawCollateralLegacyCpi {
1240            __program: self.instruction.__program,
1241
1242            signer: self.instruction.signer.expect("signer is not set"),
1243
1244            order_state: self
1245                .instruction
1246                .order_state
1247                .expect("order_state is not set"),
1248
1249            order_vault: self
1250                .instruction
1251                .order_vault
1252                .expect("order_vault is not set"),
1253
1254            maker: self.instruction.maker.expect("maker is not set"),
1255
1256            taker: self.instruction.taker.expect("taker is not set"),
1257
1258            destination: self
1259                .instruction
1260                .destination
1261                .expect("destination is not set"),
1262
1263            system: self.instruction.system.expect("system is not set"),
1264
1265            tlock_program: self
1266                .instruction
1267                .tlock_program
1268                .expect("tlock_program is not set"),
1269
1270            mint: self.instruction.mint.expect("mint is not set"),
1271
1272            metadata: self.instruction.metadata.expect("metadata is not set"),
1273
1274            order_vault_ta: self
1275                .instruction
1276                .order_vault_ta
1277                .expect("order_vault_ta is not set"),
1278
1279            destination_ta: self
1280                .instruction
1281                .destination_ta
1282                .expect("destination_ta is not set"),
1283
1284            edition: self.instruction.edition.expect("edition is not set"),
1285
1286            order_token_record: self.instruction.order_token_record,
1287
1288            destination_token_record: self.instruction.destination_token_record,
1289
1290            token_metadata_program: self
1291                .instruction
1292                .token_metadata_program
1293                .expect("token_metadata_program is not set"),
1294
1295            instructions: self
1296                .instruction
1297                .instructions
1298                .expect("instructions is not set"),
1299
1300            authorization_rules_program: self
1301                .instruction
1302                .authorization_rules_program
1303                .expect("authorization_rules_program is not set"),
1304
1305            auth_rules: self.instruction.auth_rules,
1306
1307            token_program: self
1308                .instruction
1309                .token_program
1310                .expect("token_program is not set"),
1311
1312            associated_token_program: self
1313                .instruction
1314                .associated_token_program
1315                .expect("associated_token_program is not set"),
1316
1317            system_program: self
1318                .instruction
1319                .system_program
1320                .expect("system_program is not set"),
1321
1322            whitelist: self.instruction.whitelist.expect("whitelist is not set"),
1323
1324            mint_proof: self.instruction.mint_proof,
1325
1326            order_nft_receipt: self
1327                .instruction
1328                .order_nft_receipt
1329                .expect("order_nft_receipt is not set"),
1330            __args: args,
1331        };
1332        instruction.invoke_signed_with_remaining_accounts(
1333            signers_seeds,
1334            &self.instruction.__remaining_accounts,
1335        )
1336    }
1337}
1338
1339#[derive(Clone, Debug)]
1340struct WithdrawCollateralLegacyCpiBuilderInstruction<'a, 'b> {
1341    __program: &'b solana_program::account_info::AccountInfo<'a>,
1342    signer: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1343    order_state: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1344    order_vault: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1345    maker: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1346    taker: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1347    destination: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1348    system: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1349    tlock_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1350    mint: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1351    metadata: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1352    order_vault_ta: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1353    destination_ta: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1354    edition: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1355    order_token_record: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1356    destination_token_record: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1357    token_metadata_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1358    instructions: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1359    authorization_rules_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1360    auth_rules: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1361    token_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1362    associated_token_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1363    system_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1364    whitelist: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1365    mint_proof: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1366    order_nft_receipt: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1367    to_maker: Option<bool>,
1368    authorization_data: Option<AuthorizationDataLocal>,
1369    /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`.
1370    __remaining_accounts: Vec<(
1371        &'b solana_program::account_info::AccountInfo<'a>,
1372        bool,
1373        bool,
1374    )>,
1375}