tensor_marketplace/generated/instructions/
take_bid_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 TakeBidLegacy {
14    pub fee_vault: solana_program::pubkey::Pubkey,
15
16    pub seller: solana_program::pubkey::Pubkey,
17
18    pub bid_state: solana_program::pubkey::Pubkey,
19
20    pub owner: solana_program::pubkey::Pubkey,
21
22    pub taker_broker: Option<solana_program::pubkey::Pubkey>,
23
24    pub maker_broker: Option<solana_program::pubkey::Pubkey>,
25
26    pub shared_escrow: solana_program::pubkey::Pubkey,
27
28    pub whitelist: Option<solana_program::pubkey::Pubkey>,
29
30    pub seller_ta: solana_program::pubkey::Pubkey,
31
32    pub mint: solana_program::pubkey::Pubkey,
33
34    pub metadata: solana_program::pubkey::Pubkey,
35
36    pub owner_ta: solana_program::pubkey::Pubkey,
37
38    pub edition: solana_program::pubkey::Pubkey,
39
40    pub seller_token_record: Option<solana_program::pubkey::Pubkey>,
41
42    pub owner_token_record: Option<solana_program::pubkey::Pubkey>,
43
44    pub token_metadata_program: Option<solana_program::pubkey::Pubkey>,
45
46    pub sysvar_instructions: Option<solana_program::pubkey::Pubkey>,
47
48    pub authorization_rules_program: Option<solana_program::pubkey::Pubkey>,
49    /// Implicitly checked via transfer. Will fail if wrong account
50    pub bid_ta: solana_program::pubkey::Pubkey,
51
52    pub bid_token_record: Option<solana_program::pubkey::Pubkey>,
53
54    pub authorization_rules: Option<solana_program::pubkey::Pubkey>,
55
56    pub token_program: solana_program::pubkey::Pubkey,
57
58    pub associated_token_program: solana_program::pubkey::Pubkey,
59
60    pub system_program: solana_program::pubkey::Pubkey,
61
62    pub marketplace_program: solana_program::pubkey::Pubkey,
63
64    pub escrow_program: solana_program::pubkey::Pubkey,
65
66    pub cosigner: Option<solana_program::pubkey::Pubkey>,
67    /// intentionally not deserializing, it would be dummy in the case of VOC/FVC based verification
68    pub mint_proof: Option<solana_program::pubkey::Pubkey>,
69
70    pub rent_destination: solana_program::pubkey::Pubkey,
71}
72
73impl TakeBidLegacy {
74    pub fn instruction(
75        &self,
76        args: TakeBidLegacyInstructionArgs,
77    ) -> solana_program::instruction::Instruction {
78        self.instruction_with_remaining_accounts(args, &[])
79    }
80    #[allow(clippy::vec_init_then_push)]
81    pub fn instruction_with_remaining_accounts(
82        &self,
83        args: TakeBidLegacyInstructionArgs,
84        remaining_accounts: &[solana_program::instruction::AccountMeta],
85    ) -> solana_program::instruction::Instruction {
86        let mut accounts = Vec::with_capacity(29 + remaining_accounts.len());
87        accounts.push(solana_program::instruction::AccountMeta::new(
88            self.fee_vault,
89            false,
90        ));
91        accounts.push(solana_program::instruction::AccountMeta::new(
92            self.seller,
93            true,
94        ));
95        accounts.push(solana_program::instruction::AccountMeta::new(
96            self.bid_state,
97            false,
98        ));
99        accounts.push(solana_program::instruction::AccountMeta::new(
100            self.owner, false,
101        ));
102        if let Some(taker_broker) = self.taker_broker {
103            accounts.push(solana_program::instruction::AccountMeta::new(
104                taker_broker,
105                false,
106            ));
107        } else {
108            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
109                crate::TENSOR_MARKETPLACE_ID,
110                false,
111            ));
112        }
113        if let Some(maker_broker) = self.maker_broker {
114            accounts.push(solana_program::instruction::AccountMeta::new(
115                maker_broker,
116                false,
117            ));
118        } else {
119            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
120                crate::TENSOR_MARKETPLACE_ID,
121                false,
122            ));
123        }
124        accounts.push(solana_program::instruction::AccountMeta::new(
125            self.shared_escrow,
126            false,
127        ));
128        if let Some(whitelist) = self.whitelist {
129            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
130                whitelist, false,
131            ));
132        } else {
133            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
134                crate::TENSOR_MARKETPLACE_ID,
135                false,
136            ));
137        }
138        accounts.push(solana_program::instruction::AccountMeta::new(
139            self.seller_ta,
140            false,
141        ));
142        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
143            self.mint, false,
144        ));
145        accounts.push(solana_program::instruction::AccountMeta::new(
146            self.metadata,
147            false,
148        ));
149        accounts.push(solana_program::instruction::AccountMeta::new(
150            self.owner_ta,
151            false,
152        ));
153        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
154            self.edition,
155            false,
156        ));
157        if let Some(seller_token_record) = self.seller_token_record {
158            accounts.push(solana_program::instruction::AccountMeta::new(
159                seller_token_record,
160                false,
161            ));
162        } else {
163            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
164                crate::TENSOR_MARKETPLACE_ID,
165                false,
166            ));
167        }
168        if let Some(owner_token_record) = self.owner_token_record {
169            accounts.push(solana_program::instruction::AccountMeta::new(
170                owner_token_record,
171                false,
172            ));
173        } else {
174            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
175                crate::TENSOR_MARKETPLACE_ID,
176                false,
177            ));
178        }
179        if let Some(token_metadata_program) = self.token_metadata_program {
180            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
181                token_metadata_program,
182                false,
183            ));
184        } else {
185            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
186                crate::TENSOR_MARKETPLACE_ID,
187                false,
188            ));
189        }
190        if let Some(sysvar_instructions) = self.sysvar_instructions {
191            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
192                sysvar_instructions,
193                false,
194            ));
195        } else {
196            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
197                crate::TENSOR_MARKETPLACE_ID,
198                false,
199            ));
200        }
201        if let Some(authorization_rules_program) = self.authorization_rules_program {
202            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
203                authorization_rules_program,
204                false,
205            ));
206        } else {
207            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
208                crate::TENSOR_MARKETPLACE_ID,
209                false,
210            ));
211        }
212        accounts.push(solana_program::instruction::AccountMeta::new(
213            self.bid_ta,
214            false,
215        ));
216        if let Some(bid_token_record) = self.bid_token_record {
217            accounts.push(solana_program::instruction::AccountMeta::new(
218                bid_token_record,
219                false,
220            ));
221        } else {
222            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
223                crate::TENSOR_MARKETPLACE_ID,
224                false,
225            ));
226        }
227        if let Some(authorization_rules) = self.authorization_rules {
228            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
229                authorization_rules,
230                false,
231            ));
232        } else {
233            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
234                crate::TENSOR_MARKETPLACE_ID,
235                false,
236            ));
237        }
238        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
239            self.token_program,
240            false,
241        ));
242        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
243            self.associated_token_program,
244            false,
245        ));
246        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
247            self.system_program,
248            false,
249        ));
250        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
251            self.marketplace_program,
252            false,
253        ));
254        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
255            self.escrow_program,
256            false,
257        ));
258        if let Some(cosigner) = self.cosigner {
259            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
260                cosigner, true,
261            ));
262        } else {
263            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
264                crate::TENSOR_MARKETPLACE_ID,
265                false,
266            ));
267        }
268        if let Some(mint_proof) = self.mint_proof {
269            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
270                mint_proof, false,
271            ));
272        } else {
273            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
274                crate::TENSOR_MARKETPLACE_ID,
275                false,
276            ));
277        }
278        accounts.push(solana_program::instruction::AccountMeta::new(
279            self.rent_destination,
280            false,
281        ));
282        accounts.extend_from_slice(remaining_accounts);
283        let mut data = TakeBidLegacyInstructionData::new().try_to_vec().unwrap();
284        let mut args = args.try_to_vec().unwrap();
285        data.append(&mut args);
286
287        solana_program::instruction::Instruction {
288            program_id: crate::TENSOR_MARKETPLACE_ID,
289            accounts,
290            data,
291        }
292    }
293}
294
295#[derive(BorshDeserialize, BorshSerialize)]
296pub struct TakeBidLegacyInstructionData {
297    discriminator: [u8; 8],
298}
299
300impl TakeBidLegacyInstructionData {
301    pub fn new() -> Self {
302        Self {
303            discriminator: [188, 35, 116, 108, 0, 233, 237, 201],
304        }
305    }
306}
307
308impl Default for TakeBidLegacyInstructionData {
309    fn default() -> Self {
310        Self::new()
311    }
312}
313
314#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)]
315#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
316pub struct TakeBidLegacyInstructionArgs {
317    pub min_amount: u64,
318    pub optional_royalty_pct: Option<u16>,
319    pub rules_acc_present: bool,
320    pub authorization_data: Option<AuthorizationDataLocal>,
321}
322
323/// Instruction builder for `TakeBidLegacy`.
324///
325/// ### Accounts:
326///
327///   0. `[writable]` fee_vault
328///   1. `[writable, signer]` seller
329///   2. `[writable]` bid_state
330///   3. `[writable]` owner
331///   4. `[writable, optional]` taker_broker
332///   5. `[writable, optional]` maker_broker
333///   6. `[writable]` shared_escrow
334///   7. `[optional]` whitelist (default to `TCMPhJdwDryooaGtiocG1u3xcYbRpiJzb283XfCZsDp`)
335///   8. `[writable]` seller_ta
336///   9. `[]` mint
337///   10. `[writable]` metadata
338///   11. `[writable]` owner_ta
339///   12. `[]` edition
340///   13. `[writable, optional]` seller_token_record
341///   14. `[writable, optional]` owner_token_record
342///   15. `[optional]` token_metadata_program
343///   16. `[optional]` sysvar_instructions
344///   17. `[optional]` authorization_rules_program
345///   18. `[writable]` bid_ta
346///   19. `[writable, optional]` bid_token_record
347///   20. `[optional]` authorization_rules
348///   21. `[optional]` token_program (default to `TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA`)
349///   22. `[optional]` associated_token_program (default to `ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL`)
350///   23. `[optional]` system_program (default to `11111111111111111111111111111111`)
351///   24. `[optional]` marketplace_program (default to `TCMPhJdwDryooaGtiocG1u3xcYbRpiJzb283XfCZsDp`)
352///   25. `[optional]` escrow_program (default to `TSWAPaqyCSx2KABk68Shruf4rp7CxcNi8hAsbdwmHbN`)
353///   26. `[signer, optional]` cosigner
354///   27. `[optional]` mint_proof
355///   28. `[writable]` rent_destination
356#[derive(Clone, Debug, Default)]
357pub struct TakeBidLegacyBuilder {
358    fee_vault: Option<solana_program::pubkey::Pubkey>,
359    seller: Option<solana_program::pubkey::Pubkey>,
360    bid_state: Option<solana_program::pubkey::Pubkey>,
361    owner: Option<solana_program::pubkey::Pubkey>,
362    taker_broker: Option<solana_program::pubkey::Pubkey>,
363    maker_broker: Option<solana_program::pubkey::Pubkey>,
364    shared_escrow: Option<solana_program::pubkey::Pubkey>,
365    whitelist: Option<solana_program::pubkey::Pubkey>,
366    seller_ta: Option<solana_program::pubkey::Pubkey>,
367    mint: Option<solana_program::pubkey::Pubkey>,
368    metadata: Option<solana_program::pubkey::Pubkey>,
369    owner_ta: Option<solana_program::pubkey::Pubkey>,
370    edition: Option<solana_program::pubkey::Pubkey>,
371    seller_token_record: Option<solana_program::pubkey::Pubkey>,
372    owner_token_record: Option<solana_program::pubkey::Pubkey>,
373    token_metadata_program: Option<solana_program::pubkey::Pubkey>,
374    sysvar_instructions: Option<solana_program::pubkey::Pubkey>,
375    authorization_rules_program: Option<solana_program::pubkey::Pubkey>,
376    bid_ta: Option<solana_program::pubkey::Pubkey>,
377    bid_token_record: Option<solana_program::pubkey::Pubkey>,
378    authorization_rules: Option<solana_program::pubkey::Pubkey>,
379    token_program: Option<solana_program::pubkey::Pubkey>,
380    associated_token_program: Option<solana_program::pubkey::Pubkey>,
381    system_program: Option<solana_program::pubkey::Pubkey>,
382    marketplace_program: Option<solana_program::pubkey::Pubkey>,
383    escrow_program: Option<solana_program::pubkey::Pubkey>,
384    cosigner: Option<solana_program::pubkey::Pubkey>,
385    mint_proof: Option<solana_program::pubkey::Pubkey>,
386    rent_destination: Option<solana_program::pubkey::Pubkey>,
387    min_amount: Option<u64>,
388    optional_royalty_pct: Option<u16>,
389    rules_acc_present: Option<bool>,
390    authorization_data: Option<AuthorizationDataLocal>,
391    __remaining_accounts: Vec<solana_program::instruction::AccountMeta>,
392}
393
394impl TakeBidLegacyBuilder {
395    pub fn new() -> Self {
396        Self::default()
397    }
398    #[inline(always)]
399    pub fn fee_vault(&mut self, fee_vault: solana_program::pubkey::Pubkey) -> &mut Self {
400        self.fee_vault = Some(fee_vault);
401        self
402    }
403    #[inline(always)]
404    pub fn seller(&mut self, seller: solana_program::pubkey::Pubkey) -> &mut Self {
405        self.seller = Some(seller);
406        self
407    }
408    #[inline(always)]
409    pub fn bid_state(&mut self, bid_state: solana_program::pubkey::Pubkey) -> &mut Self {
410        self.bid_state = Some(bid_state);
411        self
412    }
413    #[inline(always)]
414    pub fn owner(&mut self, owner: solana_program::pubkey::Pubkey) -> &mut Self {
415        self.owner = Some(owner);
416        self
417    }
418    /// `[optional account]`
419    #[inline(always)]
420    pub fn taker_broker(
421        &mut self,
422        taker_broker: Option<solana_program::pubkey::Pubkey>,
423    ) -> &mut Self {
424        self.taker_broker = taker_broker;
425        self
426    }
427    /// `[optional account]`
428    #[inline(always)]
429    pub fn maker_broker(
430        &mut self,
431        maker_broker: Option<solana_program::pubkey::Pubkey>,
432    ) -> &mut Self {
433        self.maker_broker = maker_broker;
434        self
435    }
436    #[inline(always)]
437    pub fn shared_escrow(&mut self, shared_escrow: solana_program::pubkey::Pubkey) -> &mut Self {
438        self.shared_escrow = Some(shared_escrow);
439        self
440    }
441    /// `[optional account]`
442    #[inline(always)]
443    pub fn whitelist(&mut self, whitelist: Option<solana_program::pubkey::Pubkey>) -> &mut Self {
444        self.whitelist = whitelist;
445        self
446    }
447    #[inline(always)]
448    pub fn seller_ta(&mut self, seller_ta: solana_program::pubkey::Pubkey) -> &mut Self {
449        self.seller_ta = Some(seller_ta);
450        self
451    }
452    #[inline(always)]
453    pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self {
454        self.mint = Some(mint);
455        self
456    }
457    #[inline(always)]
458    pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self {
459        self.metadata = Some(metadata);
460        self
461    }
462    #[inline(always)]
463    pub fn owner_ta(&mut self, owner_ta: solana_program::pubkey::Pubkey) -> &mut Self {
464        self.owner_ta = Some(owner_ta);
465        self
466    }
467    #[inline(always)]
468    pub fn edition(&mut self, edition: solana_program::pubkey::Pubkey) -> &mut Self {
469        self.edition = Some(edition);
470        self
471    }
472    /// `[optional account]`
473    #[inline(always)]
474    pub fn seller_token_record(
475        &mut self,
476        seller_token_record: Option<solana_program::pubkey::Pubkey>,
477    ) -> &mut Self {
478        self.seller_token_record = seller_token_record;
479        self
480    }
481    /// `[optional account]`
482    #[inline(always)]
483    pub fn owner_token_record(
484        &mut self,
485        owner_token_record: Option<solana_program::pubkey::Pubkey>,
486    ) -> &mut Self {
487        self.owner_token_record = owner_token_record;
488        self
489    }
490    /// `[optional account]`
491    #[inline(always)]
492    pub fn token_metadata_program(
493        &mut self,
494        token_metadata_program: Option<solana_program::pubkey::Pubkey>,
495    ) -> &mut Self {
496        self.token_metadata_program = token_metadata_program;
497        self
498    }
499    /// `[optional account]`
500    #[inline(always)]
501    pub fn sysvar_instructions(
502        &mut self,
503        sysvar_instructions: Option<solana_program::pubkey::Pubkey>,
504    ) -> &mut Self {
505        self.sysvar_instructions = sysvar_instructions;
506        self
507    }
508    /// `[optional account]`
509    #[inline(always)]
510    pub fn authorization_rules_program(
511        &mut self,
512        authorization_rules_program: Option<solana_program::pubkey::Pubkey>,
513    ) -> &mut Self {
514        self.authorization_rules_program = authorization_rules_program;
515        self
516    }
517    /// Implicitly checked via transfer. Will fail if wrong account
518    #[inline(always)]
519    pub fn bid_ta(&mut self, bid_ta: solana_program::pubkey::Pubkey) -> &mut Self {
520        self.bid_ta = Some(bid_ta);
521        self
522    }
523    /// `[optional account]`
524    #[inline(always)]
525    pub fn bid_token_record(
526        &mut self,
527        bid_token_record: Option<solana_program::pubkey::Pubkey>,
528    ) -> &mut Self {
529        self.bid_token_record = bid_token_record;
530        self
531    }
532    /// `[optional account]`
533    #[inline(always)]
534    pub fn authorization_rules(
535        &mut self,
536        authorization_rules: Option<solana_program::pubkey::Pubkey>,
537    ) -> &mut Self {
538        self.authorization_rules = authorization_rules;
539        self
540    }
541    /// `[optional account, default to 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA']`
542    #[inline(always)]
543    pub fn token_program(&mut self, token_program: solana_program::pubkey::Pubkey) -> &mut Self {
544        self.token_program = Some(token_program);
545        self
546    }
547    /// `[optional account, default to 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL']`
548    #[inline(always)]
549    pub fn associated_token_program(
550        &mut self,
551        associated_token_program: solana_program::pubkey::Pubkey,
552    ) -> &mut Self {
553        self.associated_token_program = Some(associated_token_program);
554        self
555    }
556    /// `[optional account, default to '11111111111111111111111111111111']`
557    #[inline(always)]
558    pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self {
559        self.system_program = Some(system_program);
560        self
561    }
562    /// `[optional account, default to 'TCMPhJdwDryooaGtiocG1u3xcYbRpiJzb283XfCZsDp']`
563    #[inline(always)]
564    pub fn marketplace_program(
565        &mut self,
566        marketplace_program: solana_program::pubkey::Pubkey,
567    ) -> &mut Self {
568        self.marketplace_program = Some(marketplace_program);
569        self
570    }
571    /// `[optional account, default to 'TSWAPaqyCSx2KABk68Shruf4rp7CxcNi8hAsbdwmHbN']`
572    #[inline(always)]
573    pub fn escrow_program(&mut self, escrow_program: solana_program::pubkey::Pubkey) -> &mut Self {
574        self.escrow_program = Some(escrow_program);
575        self
576    }
577    /// `[optional account]`
578    #[inline(always)]
579    pub fn cosigner(&mut self, cosigner: Option<solana_program::pubkey::Pubkey>) -> &mut Self {
580        self.cosigner = cosigner;
581        self
582    }
583    /// `[optional account]`
584    /// intentionally not deserializing, it would be dummy in the case of VOC/FVC based verification
585    #[inline(always)]
586    pub fn mint_proof(&mut self, mint_proof: Option<solana_program::pubkey::Pubkey>) -> &mut Self {
587        self.mint_proof = mint_proof;
588        self
589    }
590    #[inline(always)]
591    pub fn rent_destination(
592        &mut self,
593        rent_destination: solana_program::pubkey::Pubkey,
594    ) -> &mut Self {
595        self.rent_destination = Some(rent_destination);
596        self
597    }
598    #[inline(always)]
599    pub fn min_amount(&mut self, min_amount: u64) -> &mut Self {
600        self.min_amount = Some(min_amount);
601        self
602    }
603    /// `[optional argument]`
604    #[inline(always)]
605    pub fn optional_royalty_pct(&mut self, optional_royalty_pct: u16) -> &mut Self {
606        self.optional_royalty_pct = Some(optional_royalty_pct);
607        self
608    }
609    /// `[optional argument, defaults to 'false']`
610    #[inline(always)]
611    pub fn rules_acc_present(&mut self, rules_acc_present: bool) -> &mut Self {
612        self.rules_acc_present = Some(rules_acc_present);
613        self
614    }
615    /// `[optional argument]`
616    #[inline(always)]
617    pub fn authorization_data(&mut self, authorization_data: AuthorizationDataLocal) -> &mut Self {
618        self.authorization_data = Some(authorization_data);
619        self
620    }
621    /// Add an aditional account to the instruction.
622    #[inline(always)]
623    pub fn add_remaining_account(
624        &mut self,
625        account: solana_program::instruction::AccountMeta,
626    ) -> &mut Self {
627        self.__remaining_accounts.push(account);
628        self
629    }
630    /// Add additional accounts to the instruction.
631    #[inline(always)]
632    pub fn add_remaining_accounts(
633        &mut self,
634        accounts: &[solana_program::instruction::AccountMeta],
635    ) -> &mut Self {
636        self.__remaining_accounts.extend_from_slice(accounts);
637        self
638    }
639    #[allow(clippy::clone_on_copy)]
640    pub fn instruction(&self) -> solana_program::instruction::Instruction {
641        let accounts = TakeBidLegacy {
642            fee_vault: self.fee_vault.expect("fee_vault is not set"),
643            seller: self.seller.expect("seller is not set"),
644            bid_state: self.bid_state.expect("bid_state is not set"),
645            owner: self.owner.expect("owner is not set"),
646            taker_broker: self.taker_broker,
647            maker_broker: self.maker_broker,
648            shared_escrow: self.shared_escrow.expect("shared_escrow is not set"),
649            whitelist: self.whitelist,
650            seller_ta: self.seller_ta.expect("seller_ta is not set"),
651            mint: self.mint.expect("mint is not set"),
652            metadata: self.metadata.expect("metadata is not set"),
653            owner_ta: self.owner_ta.expect("owner_ta is not set"),
654            edition: self.edition.expect("edition is not set"),
655            seller_token_record: self.seller_token_record,
656            owner_token_record: self.owner_token_record,
657            token_metadata_program: self.token_metadata_program,
658            sysvar_instructions: self.sysvar_instructions,
659            authorization_rules_program: self.authorization_rules_program,
660            bid_ta: self.bid_ta.expect("bid_ta is not set"),
661            bid_token_record: self.bid_token_record,
662            authorization_rules: self.authorization_rules,
663            token_program: self.token_program.unwrap_or(solana_program::pubkey!(
664                "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
665            )),
666            associated_token_program: self.associated_token_program.unwrap_or(
667                solana_program::pubkey!("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"),
668            ),
669            system_program: self
670                .system_program
671                .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")),
672            marketplace_program: self.marketplace_program.unwrap_or(solana_program::pubkey!(
673                "TCMPhJdwDryooaGtiocG1u3xcYbRpiJzb283XfCZsDp"
674            )),
675            escrow_program: self.escrow_program.unwrap_or(solana_program::pubkey!(
676                "TSWAPaqyCSx2KABk68Shruf4rp7CxcNi8hAsbdwmHbN"
677            )),
678            cosigner: self.cosigner,
679            mint_proof: self.mint_proof,
680            rent_destination: self.rent_destination.expect("rent_destination is not set"),
681        };
682        let args = TakeBidLegacyInstructionArgs {
683            min_amount: self.min_amount.clone().expect("min_amount is not set"),
684            optional_royalty_pct: self.optional_royalty_pct.clone(),
685            rules_acc_present: self.rules_acc_present.clone().unwrap_or(false),
686            authorization_data: self.authorization_data.clone(),
687        };
688
689        accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts)
690    }
691}
692
693/// `take_bid_legacy` CPI accounts.
694pub struct TakeBidLegacyCpiAccounts<'a, 'b> {
695    pub fee_vault: &'b solana_program::account_info::AccountInfo<'a>,
696
697    pub seller: &'b solana_program::account_info::AccountInfo<'a>,
698
699    pub bid_state: &'b solana_program::account_info::AccountInfo<'a>,
700
701    pub owner: &'b solana_program::account_info::AccountInfo<'a>,
702
703    pub taker_broker: Option<&'b solana_program::account_info::AccountInfo<'a>>,
704
705    pub maker_broker: Option<&'b solana_program::account_info::AccountInfo<'a>>,
706
707    pub shared_escrow: &'b solana_program::account_info::AccountInfo<'a>,
708
709    pub whitelist: Option<&'b solana_program::account_info::AccountInfo<'a>>,
710
711    pub seller_ta: &'b solana_program::account_info::AccountInfo<'a>,
712
713    pub mint: &'b solana_program::account_info::AccountInfo<'a>,
714
715    pub metadata: &'b solana_program::account_info::AccountInfo<'a>,
716
717    pub owner_ta: &'b solana_program::account_info::AccountInfo<'a>,
718
719    pub edition: &'b solana_program::account_info::AccountInfo<'a>,
720
721    pub seller_token_record: Option<&'b solana_program::account_info::AccountInfo<'a>>,
722
723    pub owner_token_record: Option<&'b solana_program::account_info::AccountInfo<'a>>,
724
725    pub token_metadata_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
726
727    pub sysvar_instructions: Option<&'b solana_program::account_info::AccountInfo<'a>>,
728
729    pub authorization_rules_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
730    /// Implicitly checked via transfer. Will fail if wrong account
731    pub bid_ta: &'b solana_program::account_info::AccountInfo<'a>,
732
733    pub bid_token_record: Option<&'b solana_program::account_info::AccountInfo<'a>>,
734
735    pub authorization_rules: Option<&'b solana_program::account_info::AccountInfo<'a>>,
736
737    pub token_program: &'b solana_program::account_info::AccountInfo<'a>,
738
739    pub associated_token_program: &'b solana_program::account_info::AccountInfo<'a>,
740
741    pub system_program: &'b solana_program::account_info::AccountInfo<'a>,
742
743    pub marketplace_program: &'b solana_program::account_info::AccountInfo<'a>,
744
745    pub escrow_program: &'b solana_program::account_info::AccountInfo<'a>,
746
747    pub cosigner: Option<&'b solana_program::account_info::AccountInfo<'a>>,
748    /// intentionally not deserializing, it would be dummy in the case of VOC/FVC based verification
749    pub mint_proof: Option<&'b solana_program::account_info::AccountInfo<'a>>,
750
751    pub rent_destination: &'b solana_program::account_info::AccountInfo<'a>,
752}
753
754/// `take_bid_legacy` CPI instruction.
755pub struct TakeBidLegacyCpi<'a, 'b> {
756    /// The program to invoke.
757    pub __program: &'b solana_program::account_info::AccountInfo<'a>,
758
759    pub fee_vault: &'b solana_program::account_info::AccountInfo<'a>,
760
761    pub seller: &'b solana_program::account_info::AccountInfo<'a>,
762
763    pub bid_state: &'b solana_program::account_info::AccountInfo<'a>,
764
765    pub owner: &'b solana_program::account_info::AccountInfo<'a>,
766
767    pub taker_broker: Option<&'b solana_program::account_info::AccountInfo<'a>>,
768
769    pub maker_broker: Option<&'b solana_program::account_info::AccountInfo<'a>>,
770
771    pub shared_escrow: &'b solana_program::account_info::AccountInfo<'a>,
772
773    pub whitelist: Option<&'b solana_program::account_info::AccountInfo<'a>>,
774
775    pub seller_ta: &'b solana_program::account_info::AccountInfo<'a>,
776
777    pub mint: &'b solana_program::account_info::AccountInfo<'a>,
778
779    pub metadata: &'b solana_program::account_info::AccountInfo<'a>,
780
781    pub owner_ta: &'b solana_program::account_info::AccountInfo<'a>,
782
783    pub edition: &'b solana_program::account_info::AccountInfo<'a>,
784
785    pub seller_token_record: Option<&'b solana_program::account_info::AccountInfo<'a>>,
786
787    pub owner_token_record: Option<&'b solana_program::account_info::AccountInfo<'a>>,
788
789    pub token_metadata_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
790
791    pub sysvar_instructions: Option<&'b solana_program::account_info::AccountInfo<'a>>,
792
793    pub authorization_rules_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
794    /// Implicitly checked via transfer. Will fail if wrong account
795    pub bid_ta: &'b solana_program::account_info::AccountInfo<'a>,
796
797    pub bid_token_record: Option<&'b solana_program::account_info::AccountInfo<'a>>,
798
799    pub authorization_rules: Option<&'b solana_program::account_info::AccountInfo<'a>>,
800
801    pub token_program: &'b solana_program::account_info::AccountInfo<'a>,
802
803    pub associated_token_program: &'b solana_program::account_info::AccountInfo<'a>,
804
805    pub system_program: &'b solana_program::account_info::AccountInfo<'a>,
806
807    pub marketplace_program: &'b solana_program::account_info::AccountInfo<'a>,
808
809    pub escrow_program: &'b solana_program::account_info::AccountInfo<'a>,
810
811    pub cosigner: Option<&'b solana_program::account_info::AccountInfo<'a>>,
812    /// intentionally not deserializing, it would be dummy in the case of VOC/FVC based verification
813    pub mint_proof: Option<&'b solana_program::account_info::AccountInfo<'a>>,
814
815    pub rent_destination: &'b solana_program::account_info::AccountInfo<'a>,
816    /// The arguments for the instruction.
817    pub __args: TakeBidLegacyInstructionArgs,
818}
819
820impl<'a, 'b> TakeBidLegacyCpi<'a, 'b> {
821    pub fn new(
822        program: &'b solana_program::account_info::AccountInfo<'a>,
823        accounts: TakeBidLegacyCpiAccounts<'a, 'b>,
824        args: TakeBidLegacyInstructionArgs,
825    ) -> Self {
826        Self {
827            __program: program,
828            fee_vault: accounts.fee_vault,
829            seller: accounts.seller,
830            bid_state: accounts.bid_state,
831            owner: accounts.owner,
832            taker_broker: accounts.taker_broker,
833            maker_broker: accounts.maker_broker,
834            shared_escrow: accounts.shared_escrow,
835            whitelist: accounts.whitelist,
836            seller_ta: accounts.seller_ta,
837            mint: accounts.mint,
838            metadata: accounts.metadata,
839            owner_ta: accounts.owner_ta,
840            edition: accounts.edition,
841            seller_token_record: accounts.seller_token_record,
842            owner_token_record: accounts.owner_token_record,
843            token_metadata_program: accounts.token_metadata_program,
844            sysvar_instructions: accounts.sysvar_instructions,
845            authorization_rules_program: accounts.authorization_rules_program,
846            bid_ta: accounts.bid_ta,
847            bid_token_record: accounts.bid_token_record,
848            authorization_rules: accounts.authorization_rules,
849            token_program: accounts.token_program,
850            associated_token_program: accounts.associated_token_program,
851            system_program: accounts.system_program,
852            marketplace_program: accounts.marketplace_program,
853            escrow_program: accounts.escrow_program,
854            cosigner: accounts.cosigner,
855            mint_proof: accounts.mint_proof,
856            rent_destination: accounts.rent_destination,
857            __args: args,
858        }
859    }
860    #[inline(always)]
861    pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult {
862        self.invoke_signed_with_remaining_accounts(&[], &[])
863    }
864    #[inline(always)]
865    pub fn invoke_with_remaining_accounts(
866        &self,
867        remaining_accounts: &[(
868            &'b solana_program::account_info::AccountInfo<'a>,
869            bool,
870            bool,
871        )],
872    ) -> solana_program::entrypoint::ProgramResult {
873        self.invoke_signed_with_remaining_accounts(&[], remaining_accounts)
874    }
875    #[inline(always)]
876    pub fn invoke_signed(
877        &self,
878        signers_seeds: &[&[&[u8]]],
879    ) -> solana_program::entrypoint::ProgramResult {
880        self.invoke_signed_with_remaining_accounts(signers_seeds, &[])
881    }
882    #[allow(clippy::clone_on_copy)]
883    #[allow(clippy::vec_init_then_push)]
884    pub fn invoke_signed_with_remaining_accounts(
885        &self,
886        signers_seeds: &[&[&[u8]]],
887        remaining_accounts: &[(
888            &'b solana_program::account_info::AccountInfo<'a>,
889            bool,
890            bool,
891        )],
892    ) -> solana_program::entrypoint::ProgramResult {
893        let mut accounts = Vec::with_capacity(29 + remaining_accounts.len());
894        accounts.push(solana_program::instruction::AccountMeta::new(
895            *self.fee_vault.key,
896            false,
897        ));
898        accounts.push(solana_program::instruction::AccountMeta::new(
899            *self.seller.key,
900            true,
901        ));
902        accounts.push(solana_program::instruction::AccountMeta::new(
903            *self.bid_state.key,
904            false,
905        ));
906        accounts.push(solana_program::instruction::AccountMeta::new(
907            *self.owner.key,
908            false,
909        ));
910        if let Some(taker_broker) = self.taker_broker {
911            accounts.push(solana_program::instruction::AccountMeta::new(
912                *taker_broker.key,
913                false,
914            ));
915        } else {
916            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
917                crate::TENSOR_MARKETPLACE_ID,
918                false,
919            ));
920        }
921        if let Some(maker_broker) = self.maker_broker {
922            accounts.push(solana_program::instruction::AccountMeta::new(
923                *maker_broker.key,
924                false,
925            ));
926        } else {
927            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
928                crate::TENSOR_MARKETPLACE_ID,
929                false,
930            ));
931        }
932        accounts.push(solana_program::instruction::AccountMeta::new(
933            *self.shared_escrow.key,
934            false,
935        ));
936        if let Some(whitelist) = self.whitelist {
937            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
938                *whitelist.key,
939                false,
940            ));
941        } else {
942            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
943                crate::TENSOR_MARKETPLACE_ID,
944                false,
945            ));
946        }
947        accounts.push(solana_program::instruction::AccountMeta::new(
948            *self.seller_ta.key,
949            false,
950        ));
951        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
952            *self.mint.key,
953            false,
954        ));
955        accounts.push(solana_program::instruction::AccountMeta::new(
956            *self.metadata.key,
957            false,
958        ));
959        accounts.push(solana_program::instruction::AccountMeta::new(
960            *self.owner_ta.key,
961            false,
962        ));
963        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
964            *self.edition.key,
965            false,
966        ));
967        if let Some(seller_token_record) = self.seller_token_record {
968            accounts.push(solana_program::instruction::AccountMeta::new(
969                *seller_token_record.key,
970                false,
971            ));
972        } else {
973            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
974                crate::TENSOR_MARKETPLACE_ID,
975                false,
976            ));
977        }
978        if let Some(owner_token_record) = self.owner_token_record {
979            accounts.push(solana_program::instruction::AccountMeta::new(
980                *owner_token_record.key,
981                false,
982            ));
983        } else {
984            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
985                crate::TENSOR_MARKETPLACE_ID,
986                false,
987            ));
988        }
989        if let Some(token_metadata_program) = self.token_metadata_program {
990            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
991                *token_metadata_program.key,
992                false,
993            ));
994        } else {
995            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
996                crate::TENSOR_MARKETPLACE_ID,
997                false,
998            ));
999        }
1000        if let Some(sysvar_instructions) = self.sysvar_instructions {
1001            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
1002                *sysvar_instructions.key,
1003                false,
1004            ));
1005        } else {
1006            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
1007                crate::TENSOR_MARKETPLACE_ID,
1008                false,
1009            ));
1010        }
1011        if let Some(authorization_rules_program) = self.authorization_rules_program {
1012            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
1013                *authorization_rules_program.key,
1014                false,
1015            ));
1016        } else {
1017            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
1018                crate::TENSOR_MARKETPLACE_ID,
1019                false,
1020            ));
1021        }
1022        accounts.push(solana_program::instruction::AccountMeta::new(
1023            *self.bid_ta.key,
1024            false,
1025        ));
1026        if let Some(bid_token_record) = self.bid_token_record {
1027            accounts.push(solana_program::instruction::AccountMeta::new(
1028                *bid_token_record.key,
1029                false,
1030            ));
1031        } else {
1032            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
1033                crate::TENSOR_MARKETPLACE_ID,
1034                false,
1035            ));
1036        }
1037        if let Some(authorization_rules) = self.authorization_rules {
1038            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
1039                *authorization_rules.key,
1040                false,
1041            ));
1042        } else {
1043            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
1044                crate::TENSOR_MARKETPLACE_ID,
1045                false,
1046            ));
1047        }
1048        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
1049            *self.token_program.key,
1050            false,
1051        ));
1052        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
1053            *self.associated_token_program.key,
1054            false,
1055        ));
1056        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
1057            *self.system_program.key,
1058            false,
1059        ));
1060        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
1061            *self.marketplace_program.key,
1062            false,
1063        ));
1064        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
1065            *self.escrow_program.key,
1066            false,
1067        ));
1068        if let Some(cosigner) = self.cosigner {
1069            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
1070                *cosigner.key,
1071                true,
1072            ));
1073        } else {
1074            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
1075                crate::TENSOR_MARKETPLACE_ID,
1076                false,
1077            ));
1078        }
1079        if let Some(mint_proof) = self.mint_proof {
1080            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
1081                *mint_proof.key,
1082                false,
1083            ));
1084        } else {
1085            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
1086                crate::TENSOR_MARKETPLACE_ID,
1087                false,
1088            ));
1089        }
1090        accounts.push(solana_program::instruction::AccountMeta::new(
1091            *self.rent_destination.key,
1092            false,
1093        ));
1094        remaining_accounts.iter().for_each(|remaining_account| {
1095            accounts.push(solana_program::instruction::AccountMeta {
1096                pubkey: *remaining_account.0.key,
1097                is_signer: remaining_account.1,
1098                is_writable: remaining_account.2,
1099            })
1100        });
1101        let mut data = TakeBidLegacyInstructionData::new().try_to_vec().unwrap();
1102        let mut args = self.__args.try_to_vec().unwrap();
1103        data.append(&mut args);
1104
1105        let instruction = solana_program::instruction::Instruction {
1106            program_id: crate::TENSOR_MARKETPLACE_ID,
1107            accounts,
1108            data,
1109        };
1110        let mut account_infos = Vec::with_capacity(29 + 1 + remaining_accounts.len());
1111        account_infos.push(self.__program.clone());
1112        account_infos.push(self.fee_vault.clone());
1113        account_infos.push(self.seller.clone());
1114        account_infos.push(self.bid_state.clone());
1115        account_infos.push(self.owner.clone());
1116        if let Some(taker_broker) = self.taker_broker {
1117            account_infos.push(taker_broker.clone());
1118        }
1119        if let Some(maker_broker) = self.maker_broker {
1120            account_infos.push(maker_broker.clone());
1121        }
1122        account_infos.push(self.shared_escrow.clone());
1123        if let Some(whitelist) = self.whitelist {
1124            account_infos.push(whitelist.clone());
1125        }
1126        account_infos.push(self.seller_ta.clone());
1127        account_infos.push(self.mint.clone());
1128        account_infos.push(self.metadata.clone());
1129        account_infos.push(self.owner_ta.clone());
1130        account_infos.push(self.edition.clone());
1131        if let Some(seller_token_record) = self.seller_token_record {
1132            account_infos.push(seller_token_record.clone());
1133        }
1134        if let Some(owner_token_record) = self.owner_token_record {
1135            account_infos.push(owner_token_record.clone());
1136        }
1137        if let Some(token_metadata_program) = self.token_metadata_program {
1138            account_infos.push(token_metadata_program.clone());
1139        }
1140        if let Some(sysvar_instructions) = self.sysvar_instructions {
1141            account_infos.push(sysvar_instructions.clone());
1142        }
1143        if let Some(authorization_rules_program) = self.authorization_rules_program {
1144            account_infos.push(authorization_rules_program.clone());
1145        }
1146        account_infos.push(self.bid_ta.clone());
1147        if let Some(bid_token_record) = self.bid_token_record {
1148            account_infos.push(bid_token_record.clone());
1149        }
1150        if let Some(authorization_rules) = self.authorization_rules {
1151            account_infos.push(authorization_rules.clone());
1152        }
1153        account_infos.push(self.token_program.clone());
1154        account_infos.push(self.associated_token_program.clone());
1155        account_infos.push(self.system_program.clone());
1156        account_infos.push(self.marketplace_program.clone());
1157        account_infos.push(self.escrow_program.clone());
1158        if let Some(cosigner) = self.cosigner {
1159            account_infos.push(cosigner.clone());
1160        }
1161        if let Some(mint_proof) = self.mint_proof {
1162            account_infos.push(mint_proof.clone());
1163        }
1164        account_infos.push(self.rent_destination.clone());
1165        remaining_accounts
1166            .iter()
1167            .for_each(|remaining_account| account_infos.push(remaining_account.0.clone()));
1168
1169        if signers_seeds.is_empty() {
1170            solana_program::program::invoke(&instruction, &account_infos)
1171        } else {
1172            solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds)
1173        }
1174    }
1175}
1176
1177/// Instruction builder for `TakeBidLegacy` via CPI.
1178///
1179/// ### Accounts:
1180///
1181///   0. `[writable]` fee_vault
1182///   1. `[writable, signer]` seller
1183///   2. `[writable]` bid_state
1184///   3. `[writable]` owner
1185///   4. `[writable, optional]` taker_broker
1186///   5. `[writable, optional]` maker_broker
1187///   6. `[writable]` shared_escrow
1188///   7. `[optional]` whitelist
1189///   8. `[writable]` seller_ta
1190///   9. `[]` mint
1191///   10. `[writable]` metadata
1192///   11. `[writable]` owner_ta
1193///   12. `[]` edition
1194///   13. `[writable, optional]` seller_token_record
1195///   14. `[writable, optional]` owner_token_record
1196///   15. `[optional]` token_metadata_program
1197///   16. `[optional]` sysvar_instructions
1198///   17. `[optional]` authorization_rules_program
1199///   18. `[writable]` bid_ta
1200///   19. `[writable, optional]` bid_token_record
1201///   20. `[optional]` authorization_rules
1202///   21. `[]` token_program
1203///   22. `[]` associated_token_program
1204///   23. `[]` system_program
1205///   24. `[]` marketplace_program
1206///   25. `[]` escrow_program
1207///   26. `[signer, optional]` cosigner
1208///   27. `[optional]` mint_proof
1209///   28. `[writable]` rent_destination
1210#[derive(Clone, Debug)]
1211pub struct TakeBidLegacyCpiBuilder<'a, 'b> {
1212    instruction: Box<TakeBidLegacyCpiBuilderInstruction<'a, 'b>>,
1213}
1214
1215impl<'a, 'b> TakeBidLegacyCpiBuilder<'a, 'b> {
1216    pub fn new(program: &'b solana_program::account_info::AccountInfo<'a>) -> Self {
1217        let instruction = Box::new(TakeBidLegacyCpiBuilderInstruction {
1218            __program: program,
1219            fee_vault: None,
1220            seller: None,
1221            bid_state: None,
1222            owner: None,
1223            taker_broker: None,
1224            maker_broker: None,
1225            shared_escrow: None,
1226            whitelist: None,
1227            seller_ta: None,
1228            mint: None,
1229            metadata: None,
1230            owner_ta: None,
1231            edition: None,
1232            seller_token_record: None,
1233            owner_token_record: None,
1234            token_metadata_program: None,
1235            sysvar_instructions: None,
1236            authorization_rules_program: None,
1237            bid_ta: None,
1238            bid_token_record: None,
1239            authorization_rules: None,
1240            token_program: None,
1241            associated_token_program: None,
1242            system_program: None,
1243            marketplace_program: None,
1244            escrow_program: None,
1245            cosigner: None,
1246            mint_proof: None,
1247            rent_destination: None,
1248            min_amount: None,
1249            optional_royalty_pct: None,
1250            rules_acc_present: None,
1251            authorization_data: None,
1252            __remaining_accounts: Vec::new(),
1253        });
1254        Self { instruction }
1255    }
1256    #[inline(always)]
1257    pub fn fee_vault(
1258        &mut self,
1259        fee_vault: &'b solana_program::account_info::AccountInfo<'a>,
1260    ) -> &mut Self {
1261        self.instruction.fee_vault = Some(fee_vault);
1262        self
1263    }
1264    #[inline(always)]
1265    pub fn seller(
1266        &mut self,
1267        seller: &'b solana_program::account_info::AccountInfo<'a>,
1268    ) -> &mut Self {
1269        self.instruction.seller = Some(seller);
1270        self
1271    }
1272    #[inline(always)]
1273    pub fn bid_state(
1274        &mut self,
1275        bid_state: &'b solana_program::account_info::AccountInfo<'a>,
1276    ) -> &mut Self {
1277        self.instruction.bid_state = Some(bid_state);
1278        self
1279    }
1280    #[inline(always)]
1281    pub fn owner(&mut self, owner: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self {
1282        self.instruction.owner = Some(owner);
1283        self
1284    }
1285    /// `[optional account]`
1286    #[inline(always)]
1287    pub fn taker_broker(
1288        &mut self,
1289        taker_broker: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1290    ) -> &mut Self {
1291        self.instruction.taker_broker = taker_broker;
1292        self
1293    }
1294    /// `[optional account]`
1295    #[inline(always)]
1296    pub fn maker_broker(
1297        &mut self,
1298        maker_broker: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1299    ) -> &mut Self {
1300        self.instruction.maker_broker = maker_broker;
1301        self
1302    }
1303    #[inline(always)]
1304    pub fn shared_escrow(
1305        &mut self,
1306        shared_escrow: &'b solana_program::account_info::AccountInfo<'a>,
1307    ) -> &mut Self {
1308        self.instruction.shared_escrow = Some(shared_escrow);
1309        self
1310    }
1311    /// `[optional account]`
1312    #[inline(always)]
1313    pub fn whitelist(
1314        &mut self,
1315        whitelist: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1316    ) -> &mut Self {
1317        self.instruction.whitelist = whitelist;
1318        self
1319    }
1320    #[inline(always)]
1321    pub fn seller_ta(
1322        &mut self,
1323        seller_ta: &'b solana_program::account_info::AccountInfo<'a>,
1324    ) -> &mut Self {
1325        self.instruction.seller_ta = Some(seller_ta);
1326        self
1327    }
1328    #[inline(always)]
1329    pub fn mint(&mut self, mint: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self {
1330        self.instruction.mint = Some(mint);
1331        self
1332    }
1333    #[inline(always)]
1334    pub fn metadata(
1335        &mut self,
1336        metadata: &'b solana_program::account_info::AccountInfo<'a>,
1337    ) -> &mut Self {
1338        self.instruction.metadata = Some(metadata);
1339        self
1340    }
1341    #[inline(always)]
1342    pub fn owner_ta(
1343        &mut self,
1344        owner_ta: &'b solana_program::account_info::AccountInfo<'a>,
1345    ) -> &mut Self {
1346        self.instruction.owner_ta = Some(owner_ta);
1347        self
1348    }
1349    #[inline(always)]
1350    pub fn edition(
1351        &mut self,
1352        edition: &'b solana_program::account_info::AccountInfo<'a>,
1353    ) -> &mut Self {
1354        self.instruction.edition = Some(edition);
1355        self
1356    }
1357    /// `[optional account]`
1358    #[inline(always)]
1359    pub fn seller_token_record(
1360        &mut self,
1361        seller_token_record: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1362    ) -> &mut Self {
1363        self.instruction.seller_token_record = seller_token_record;
1364        self
1365    }
1366    /// `[optional account]`
1367    #[inline(always)]
1368    pub fn owner_token_record(
1369        &mut self,
1370        owner_token_record: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1371    ) -> &mut Self {
1372        self.instruction.owner_token_record = owner_token_record;
1373        self
1374    }
1375    /// `[optional account]`
1376    #[inline(always)]
1377    pub fn token_metadata_program(
1378        &mut self,
1379        token_metadata_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1380    ) -> &mut Self {
1381        self.instruction.token_metadata_program = token_metadata_program;
1382        self
1383    }
1384    /// `[optional account]`
1385    #[inline(always)]
1386    pub fn sysvar_instructions(
1387        &mut self,
1388        sysvar_instructions: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1389    ) -> &mut Self {
1390        self.instruction.sysvar_instructions = sysvar_instructions;
1391        self
1392    }
1393    /// `[optional account]`
1394    #[inline(always)]
1395    pub fn authorization_rules_program(
1396        &mut self,
1397        authorization_rules_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1398    ) -> &mut Self {
1399        self.instruction.authorization_rules_program = authorization_rules_program;
1400        self
1401    }
1402    /// Implicitly checked via transfer. Will fail if wrong account
1403    #[inline(always)]
1404    pub fn bid_ta(
1405        &mut self,
1406        bid_ta: &'b solana_program::account_info::AccountInfo<'a>,
1407    ) -> &mut Self {
1408        self.instruction.bid_ta = Some(bid_ta);
1409        self
1410    }
1411    /// `[optional account]`
1412    #[inline(always)]
1413    pub fn bid_token_record(
1414        &mut self,
1415        bid_token_record: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1416    ) -> &mut Self {
1417        self.instruction.bid_token_record = bid_token_record;
1418        self
1419    }
1420    /// `[optional account]`
1421    #[inline(always)]
1422    pub fn authorization_rules(
1423        &mut self,
1424        authorization_rules: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1425    ) -> &mut Self {
1426        self.instruction.authorization_rules = authorization_rules;
1427        self
1428    }
1429    #[inline(always)]
1430    pub fn token_program(
1431        &mut self,
1432        token_program: &'b solana_program::account_info::AccountInfo<'a>,
1433    ) -> &mut Self {
1434        self.instruction.token_program = Some(token_program);
1435        self
1436    }
1437    #[inline(always)]
1438    pub fn associated_token_program(
1439        &mut self,
1440        associated_token_program: &'b solana_program::account_info::AccountInfo<'a>,
1441    ) -> &mut Self {
1442        self.instruction.associated_token_program = Some(associated_token_program);
1443        self
1444    }
1445    #[inline(always)]
1446    pub fn system_program(
1447        &mut self,
1448        system_program: &'b solana_program::account_info::AccountInfo<'a>,
1449    ) -> &mut Self {
1450        self.instruction.system_program = Some(system_program);
1451        self
1452    }
1453    #[inline(always)]
1454    pub fn marketplace_program(
1455        &mut self,
1456        marketplace_program: &'b solana_program::account_info::AccountInfo<'a>,
1457    ) -> &mut Self {
1458        self.instruction.marketplace_program = Some(marketplace_program);
1459        self
1460    }
1461    #[inline(always)]
1462    pub fn escrow_program(
1463        &mut self,
1464        escrow_program: &'b solana_program::account_info::AccountInfo<'a>,
1465    ) -> &mut Self {
1466        self.instruction.escrow_program = Some(escrow_program);
1467        self
1468    }
1469    /// `[optional account]`
1470    #[inline(always)]
1471    pub fn cosigner(
1472        &mut self,
1473        cosigner: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1474    ) -> &mut Self {
1475        self.instruction.cosigner = cosigner;
1476        self
1477    }
1478    /// `[optional account]`
1479    /// intentionally not deserializing, it would be dummy in the case of VOC/FVC based verification
1480    #[inline(always)]
1481    pub fn mint_proof(
1482        &mut self,
1483        mint_proof: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1484    ) -> &mut Self {
1485        self.instruction.mint_proof = mint_proof;
1486        self
1487    }
1488    #[inline(always)]
1489    pub fn rent_destination(
1490        &mut self,
1491        rent_destination: &'b solana_program::account_info::AccountInfo<'a>,
1492    ) -> &mut Self {
1493        self.instruction.rent_destination = Some(rent_destination);
1494        self
1495    }
1496    #[inline(always)]
1497    pub fn min_amount(&mut self, min_amount: u64) -> &mut Self {
1498        self.instruction.min_amount = Some(min_amount);
1499        self
1500    }
1501    /// `[optional argument]`
1502    #[inline(always)]
1503    pub fn optional_royalty_pct(&mut self, optional_royalty_pct: u16) -> &mut Self {
1504        self.instruction.optional_royalty_pct = Some(optional_royalty_pct);
1505        self
1506    }
1507    /// `[optional argument, defaults to 'false']`
1508    #[inline(always)]
1509    pub fn rules_acc_present(&mut self, rules_acc_present: bool) -> &mut Self {
1510        self.instruction.rules_acc_present = Some(rules_acc_present);
1511        self
1512    }
1513    /// `[optional argument]`
1514    #[inline(always)]
1515    pub fn authorization_data(&mut self, authorization_data: AuthorizationDataLocal) -> &mut Self {
1516        self.instruction.authorization_data = Some(authorization_data);
1517        self
1518    }
1519    /// Add an additional account to the instruction.
1520    #[inline(always)]
1521    pub fn add_remaining_account(
1522        &mut self,
1523        account: &'b solana_program::account_info::AccountInfo<'a>,
1524        is_writable: bool,
1525        is_signer: bool,
1526    ) -> &mut Self {
1527        self.instruction
1528            .__remaining_accounts
1529            .push((account, is_writable, is_signer));
1530        self
1531    }
1532    /// Add additional accounts to the instruction.
1533    ///
1534    /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not,
1535    /// and a `bool` indicating whether the account is a signer or not.
1536    #[inline(always)]
1537    pub fn add_remaining_accounts(
1538        &mut self,
1539        accounts: &[(
1540            &'b solana_program::account_info::AccountInfo<'a>,
1541            bool,
1542            bool,
1543        )],
1544    ) -> &mut Self {
1545        self.instruction
1546            .__remaining_accounts
1547            .extend_from_slice(accounts);
1548        self
1549    }
1550    #[inline(always)]
1551    pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult {
1552        self.invoke_signed(&[])
1553    }
1554    #[allow(clippy::clone_on_copy)]
1555    #[allow(clippy::vec_init_then_push)]
1556    pub fn invoke_signed(
1557        &self,
1558        signers_seeds: &[&[&[u8]]],
1559    ) -> solana_program::entrypoint::ProgramResult {
1560        let args = TakeBidLegacyInstructionArgs {
1561            min_amount: self
1562                .instruction
1563                .min_amount
1564                .clone()
1565                .expect("min_amount is not set"),
1566            optional_royalty_pct: self.instruction.optional_royalty_pct.clone(),
1567            rules_acc_present: self.instruction.rules_acc_present.clone().unwrap_or(false),
1568            authorization_data: self.instruction.authorization_data.clone(),
1569        };
1570        let instruction = TakeBidLegacyCpi {
1571            __program: self.instruction.__program,
1572
1573            fee_vault: self.instruction.fee_vault.expect("fee_vault is not set"),
1574
1575            seller: self.instruction.seller.expect("seller is not set"),
1576
1577            bid_state: self.instruction.bid_state.expect("bid_state is not set"),
1578
1579            owner: self.instruction.owner.expect("owner is not set"),
1580
1581            taker_broker: self.instruction.taker_broker,
1582
1583            maker_broker: self.instruction.maker_broker,
1584
1585            shared_escrow: self
1586                .instruction
1587                .shared_escrow
1588                .expect("shared_escrow is not set"),
1589
1590            whitelist: self.instruction.whitelist,
1591
1592            seller_ta: self.instruction.seller_ta.expect("seller_ta is not set"),
1593
1594            mint: self.instruction.mint.expect("mint is not set"),
1595
1596            metadata: self.instruction.metadata.expect("metadata is not set"),
1597
1598            owner_ta: self.instruction.owner_ta.expect("owner_ta is not set"),
1599
1600            edition: self.instruction.edition.expect("edition is not set"),
1601
1602            seller_token_record: self.instruction.seller_token_record,
1603
1604            owner_token_record: self.instruction.owner_token_record,
1605
1606            token_metadata_program: self.instruction.token_metadata_program,
1607
1608            sysvar_instructions: self.instruction.sysvar_instructions,
1609
1610            authorization_rules_program: self.instruction.authorization_rules_program,
1611
1612            bid_ta: self.instruction.bid_ta.expect("bid_ta is not set"),
1613
1614            bid_token_record: self.instruction.bid_token_record,
1615
1616            authorization_rules: self.instruction.authorization_rules,
1617
1618            token_program: self
1619                .instruction
1620                .token_program
1621                .expect("token_program is not set"),
1622
1623            associated_token_program: self
1624                .instruction
1625                .associated_token_program
1626                .expect("associated_token_program is not set"),
1627
1628            system_program: self
1629                .instruction
1630                .system_program
1631                .expect("system_program is not set"),
1632
1633            marketplace_program: self
1634                .instruction
1635                .marketplace_program
1636                .expect("marketplace_program is not set"),
1637
1638            escrow_program: self
1639                .instruction
1640                .escrow_program
1641                .expect("escrow_program is not set"),
1642
1643            cosigner: self.instruction.cosigner,
1644
1645            mint_proof: self.instruction.mint_proof,
1646
1647            rent_destination: self
1648                .instruction
1649                .rent_destination
1650                .expect("rent_destination is not set"),
1651            __args: args,
1652        };
1653        instruction.invoke_signed_with_remaining_accounts(
1654            signers_seeds,
1655            &self.instruction.__remaining_accounts,
1656        )
1657    }
1658}
1659
1660#[derive(Clone, Debug)]
1661struct TakeBidLegacyCpiBuilderInstruction<'a, 'b> {
1662    __program: &'b solana_program::account_info::AccountInfo<'a>,
1663    fee_vault: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1664    seller: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1665    bid_state: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1666    owner: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1667    taker_broker: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1668    maker_broker: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1669    shared_escrow: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1670    whitelist: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1671    seller_ta: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1672    mint: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1673    metadata: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1674    owner_ta: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1675    edition: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1676    seller_token_record: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1677    owner_token_record: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1678    token_metadata_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1679    sysvar_instructions: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1680    authorization_rules_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1681    bid_ta: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1682    bid_token_record: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1683    authorization_rules: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1684    token_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1685    associated_token_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1686    system_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1687    marketplace_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1688    escrow_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1689    cosigner: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1690    mint_proof: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1691    rent_destination: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1692    min_amount: Option<u64>,
1693    optional_royalty_pct: Option<u16>,
1694    rules_acc_present: Option<bool>,
1695    authorization_data: Option<AuthorizationDataLocal>,
1696    /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`.
1697    __remaining_accounts: Vec<(
1698        &'b solana_program::account_info::AccountInfo<'a>,
1699        bool,
1700        bool,
1701    )>,
1702}