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