tensor_marketplace/generated/instructions/
buy_spl_compressed.rs

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