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