1use borsh::BorshDeserialize;
9use borsh::BorshSerialize;
10
11pub struct ApproveTransfer {
13 pub payer: solana_program::pubkey::Pubkey,
14
15 pub authority: solana_program::pubkey::Pubkey,
16
17 pub mint: solana_program::pubkey::Pubkey,
18
19 pub approve_account: solana_program::pubkey::Pubkey,
20
21 pub payment_mint: solana_program::pubkey::Pubkey,
22
23 pub distribution_token_account: Option<solana_program::pubkey::Pubkey>,
24
25 pub authority_token_account: Option<solana_program::pubkey::Pubkey>,
26
27 pub distribution_account: solana_program::pubkey::Pubkey,
28
29 pub system_program: solana_program::pubkey::Pubkey,
30
31 pub distribution_program: solana_program::pubkey::Pubkey,
32
33 pub token_program: solana_program::pubkey::Pubkey,
34
35 pub payment_token_program: Option<solana_program::pubkey::Pubkey>,
36}
37
38impl ApproveTransfer {
39 pub fn instruction(
40 &self,
41 args: ApproveTransferInstructionArgs,
42 ) -> solana_program::instruction::Instruction {
43 self.instruction_with_remaining_accounts(args, &[])
44 }
45 #[allow(clippy::vec_init_then_push)]
46 pub fn instruction_with_remaining_accounts(
47 &self,
48 args: ApproveTransferInstructionArgs,
49 remaining_accounts: &[solana_program::instruction::AccountMeta],
50 ) -> solana_program::instruction::Instruction {
51 let mut accounts = Vec::with_capacity(12 + remaining_accounts.len());
52 accounts.push(solana_program::instruction::AccountMeta::new(
53 self.payer, true,
54 ));
55 accounts.push(solana_program::instruction::AccountMeta::new(
56 self.authority,
57 true,
58 ));
59 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
60 self.mint, false,
61 ));
62 accounts.push(solana_program::instruction::AccountMeta::new(
63 self.approve_account,
64 false,
65 ));
66 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
67 self.payment_mint,
68 false,
69 ));
70 if let Some(distribution_token_account) = self.distribution_token_account {
71 accounts.push(solana_program::instruction::AccountMeta::new(
72 distribution_token_account,
73 false,
74 ));
75 } else {
76 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
77 crate::WEN_NEW_STANDARD_ID,
78 false,
79 ));
80 }
81 if let Some(authority_token_account) = self.authority_token_account {
82 accounts.push(solana_program::instruction::AccountMeta::new(
83 authority_token_account,
84 false,
85 ));
86 } else {
87 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
88 crate::WEN_NEW_STANDARD_ID,
89 false,
90 ));
91 }
92 accounts.push(solana_program::instruction::AccountMeta::new(
93 self.distribution_account,
94 false,
95 ));
96 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
97 self.system_program,
98 false,
99 ));
100 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
101 self.distribution_program,
102 false,
103 ));
104 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
105 self.token_program,
106 false,
107 ));
108 if let Some(payment_token_program) = self.payment_token_program {
109 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
110 payment_token_program,
111 false,
112 ));
113 } else {
114 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
115 crate::WEN_NEW_STANDARD_ID,
116 false,
117 ));
118 }
119 accounts.extend_from_slice(remaining_accounts);
120 let mut data = ApproveTransferInstructionData::new().try_to_vec().unwrap();
121 let mut args = args.try_to_vec().unwrap();
122 data.append(&mut args);
123
124 solana_program::instruction::Instruction {
125 program_id: crate::WEN_NEW_STANDARD_ID,
126 accounts,
127 data,
128 }
129 }
130}
131
132#[derive(BorshDeserialize, BorshSerialize)]
133pub struct ApproveTransferInstructionData {
134 discriminator: [u8; 8],
135}
136
137impl ApproveTransferInstructionData {
138 pub fn new() -> Self {
139 Self {
140 discriminator: [198, 217, 247, 150, 208, 60, 169, 244],
141 }
142 }
143}
144
145impl Default for ApproveTransferInstructionData {
146 fn default() -> Self {
147 Self::new()
148 }
149}
150
151#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)]
152#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
153pub struct ApproveTransferInstructionArgs {
154 pub buy_amount: u64,
155}
156
157#[derive(Clone, Debug, Default)]
174pub struct ApproveTransferBuilder {
175 payer: Option<solana_program::pubkey::Pubkey>,
176 authority: Option<solana_program::pubkey::Pubkey>,
177 mint: Option<solana_program::pubkey::Pubkey>,
178 approve_account: Option<solana_program::pubkey::Pubkey>,
179 payment_mint: Option<solana_program::pubkey::Pubkey>,
180 distribution_token_account: Option<solana_program::pubkey::Pubkey>,
181 authority_token_account: Option<solana_program::pubkey::Pubkey>,
182 distribution_account: Option<solana_program::pubkey::Pubkey>,
183 system_program: Option<solana_program::pubkey::Pubkey>,
184 distribution_program: Option<solana_program::pubkey::Pubkey>,
185 token_program: Option<solana_program::pubkey::Pubkey>,
186 payment_token_program: Option<solana_program::pubkey::Pubkey>,
187 buy_amount: Option<u64>,
188 __remaining_accounts: Vec<solana_program::instruction::AccountMeta>,
189}
190
191impl ApproveTransferBuilder {
192 pub fn new() -> Self {
193 Self::default()
194 }
195 #[inline(always)]
196 pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self {
197 self.payer = Some(payer);
198 self
199 }
200 #[inline(always)]
201 pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self {
202 self.authority = Some(authority);
203 self
204 }
205 #[inline(always)]
206 pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self {
207 self.mint = Some(mint);
208 self
209 }
210 #[inline(always)]
211 pub fn approve_account(
212 &mut self,
213 approve_account: solana_program::pubkey::Pubkey,
214 ) -> &mut Self {
215 self.approve_account = Some(approve_account);
216 self
217 }
218 #[inline(always)]
219 pub fn payment_mint(&mut self, payment_mint: solana_program::pubkey::Pubkey) -> &mut Self {
220 self.payment_mint = Some(payment_mint);
221 self
222 }
223 #[inline(always)]
225 pub fn distribution_token_account(
226 &mut self,
227 distribution_token_account: Option<solana_program::pubkey::Pubkey>,
228 ) -> &mut Self {
229 self.distribution_token_account = distribution_token_account;
230 self
231 }
232 #[inline(always)]
234 pub fn authority_token_account(
235 &mut self,
236 authority_token_account: Option<solana_program::pubkey::Pubkey>,
237 ) -> &mut Self {
238 self.authority_token_account = authority_token_account;
239 self
240 }
241 #[inline(always)]
242 pub fn distribution_account(
243 &mut self,
244 distribution_account: solana_program::pubkey::Pubkey,
245 ) -> &mut Self {
246 self.distribution_account = Some(distribution_account);
247 self
248 }
249 #[inline(always)]
251 pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self {
252 self.system_program = Some(system_program);
253 self
254 }
255 #[inline(always)]
257 pub fn distribution_program(
258 &mut self,
259 distribution_program: solana_program::pubkey::Pubkey,
260 ) -> &mut Self {
261 self.distribution_program = Some(distribution_program);
262 self
263 }
264 #[inline(always)]
266 pub fn token_program(&mut self, token_program: solana_program::pubkey::Pubkey) -> &mut Self {
267 self.token_program = Some(token_program);
268 self
269 }
270 #[inline(always)]
272 pub fn payment_token_program(
273 &mut self,
274 payment_token_program: Option<solana_program::pubkey::Pubkey>,
275 ) -> &mut Self {
276 self.payment_token_program = payment_token_program;
277 self
278 }
279 #[inline(always)]
280 pub fn buy_amount(&mut self, buy_amount: u64) -> &mut Self {
281 self.buy_amount = Some(buy_amount);
282 self
283 }
284 #[inline(always)]
286 pub fn add_remaining_account(
287 &mut self,
288 account: solana_program::instruction::AccountMeta,
289 ) -> &mut Self {
290 self.__remaining_accounts.push(account);
291 self
292 }
293 #[inline(always)]
295 pub fn add_remaining_accounts(
296 &mut self,
297 accounts: &[solana_program::instruction::AccountMeta],
298 ) -> &mut Self {
299 self.__remaining_accounts.extend_from_slice(accounts);
300 self
301 }
302 #[allow(clippy::clone_on_copy)]
303 pub fn instruction(&self) -> solana_program::instruction::Instruction {
304 let accounts = ApproveTransfer {
305 payer: self.payer.expect("payer is not set"),
306 authority: self.authority.expect("authority is not set"),
307 mint: self.mint.expect("mint is not set"),
308 approve_account: self.approve_account.expect("approve_account is not set"),
309 payment_mint: self.payment_mint.expect("payment_mint is not set"),
310 distribution_token_account: self.distribution_token_account,
311 authority_token_account: self.authority_token_account,
312 distribution_account: self
313 .distribution_account
314 .expect("distribution_account is not set"),
315 system_program: self
316 .system_program
317 .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")),
318 distribution_program: self.distribution_program.unwrap_or(solana_program::pubkey!(
319 "diste3nXmK7ddDTs1zb6uday6j4etCa9RChD8fJ1xay"
320 )),
321 token_program: self.token_program.unwrap_or(solana_program::pubkey!(
322 "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
323 )),
324 payment_token_program: self.payment_token_program,
325 };
326 let args = ApproveTransferInstructionArgs {
327 buy_amount: self.buy_amount.clone().expect("buy_amount is not set"),
328 };
329
330 accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts)
331 }
332}
333
334pub struct ApproveTransferCpiAccounts<'a, 'b> {
336 pub payer: &'b solana_program::account_info::AccountInfo<'a>,
337
338 pub authority: &'b solana_program::account_info::AccountInfo<'a>,
339
340 pub mint: &'b solana_program::account_info::AccountInfo<'a>,
341
342 pub approve_account: &'b solana_program::account_info::AccountInfo<'a>,
343
344 pub payment_mint: &'b solana_program::account_info::AccountInfo<'a>,
345
346 pub distribution_token_account: Option<&'b solana_program::account_info::AccountInfo<'a>>,
347
348 pub authority_token_account: Option<&'b solana_program::account_info::AccountInfo<'a>>,
349
350 pub distribution_account: &'b solana_program::account_info::AccountInfo<'a>,
351
352 pub system_program: &'b solana_program::account_info::AccountInfo<'a>,
353
354 pub distribution_program: &'b solana_program::account_info::AccountInfo<'a>,
355
356 pub token_program: &'b solana_program::account_info::AccountInfo<'a>,
357
358 pub payment_token_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
359}
360
361pub struct ApproveTransferCpi<'a, 'b> {
363 pub __program: &'b solana_program::account_info::AccountInfo<'a>,
365
366 pub payer: &'b solana_program::account_info::AccountInfo<'a>,
367
368 pub authority: &'b solana_program::account_info::AccountInfo<'a>,
369
370 pub mint: &'b solana_program::account_info::AccountInfo<'a>,
371
372 pub approve_account: &'b solana_program::account_info::AccountInfo<'a>,
373
374 pub payment_mint: &'b solana_program::account_info::AccountInfo<'a>,
375
376 pub distribution_token_account: Option<&'b solana_program::account_info::AccountInfo<'a>>,
377
378 pub authority_token_account: Option<&'b solana_program::account_info::AccountInfo<'a>>,
379
380 pub distribution_account: &'b solana_program::account_info::AccountInfo<'a>,
381
382 pub system_program: &'b solana_program::account_info::AccountInfo<'a>,
383
384 pub distribution_program: &'b solana_program::account_info::AccountInfo<'a>,
385
386 pub token_program: &'b solana_program::account_info::AccountInfo<'a>,
387
388 pub payment_token_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
389 pub __args: ApproveTransferInstructionArgs,
391}
392
393impl<'a, 'b> ApproveTransferCpi<'a, 'b> {
394 pub fn new(
395 program: &'b solana_program::account_info::AccountInfo<'a>,
396 accounts: ApproveTransferCpiAccounts<'a, 'b>,
397 args: ApproveTransferInstructionArgs,
398 ) -> Self {
399 Self {
400 __program: program,
401 payer: accounts.payer,
402 authority: accounts.authority,
403 mint: accounts.mint,
404 approve_account: accounts.approve_account,
405 payment_mint: accounts.payment_mint,
406 distribution_token_account: accounts.distribution_token_account,
407 authority_token_account: accounts.authority_token_account,
408 distribution_account: accounts.distribution_account,
409 system_program: accounts.system_program,
410 distribution_program: accounts.distribution_program,
411 token_program: accounts.token_program,
412 payment_token_program: accounts.payment_token_program,
413 __args: args,
414 }
415 }
416 #[inline(always)]
417 pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult {
418 self.invoke_signed_with_remaining_accounts(&[], &[])
419 }
420 #[inline(always)]
421 pub fn invoke_with_remaining_accounts(
422 &self,
423 remaining_accounts: &[(
424 &'b solana_program::account_info::AccountInfo<'a>,
425 bool,
426 bool,
427 )],
428 ) -> solana_program::entrypoint::ProgramResult {
429 self.invoke_signed_with_remaining_accounts(&[], remaining_accounts)
430 }
431 #[inline(always)]
432 pub fn invoke_signed(
433 &self,
434 signers_seeds: &[&[&[u8]]],
435 ) -> solana_program::entrypoint::ProgramResult {
436 self.invoke_signed_with_remaining_accounts(signers_seeds, &[])
437 }
438 #[allow(clippy::clone_on_copy)]
439 #[allow(clippy::vec_init_then_push)]
440 pub fn invoke_signed_with_remaining_accounts(
441 &self,
442 signers_seeds: &[&[&[u8]]],
443 remaining_accounts: &[(
444 &'b solana_program::account_info::AccountInfo<'a>,
445 bool,
446 bool,
447 )],
448 ) -> solana_program::entrypoint::ProgramResult {
449 let mut accounts = Vec::with_capacity(12 + remaining_accounts.len());
450 accounts.push(solana_program::instruction::AccountMeta::new(
451 *self.payer.key,
452 true,
453 ));
454 accounts.push(solana_program::instruction::AccountMeta::new(
455 *self.authority.key,
456 true,
457 ));
458 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
459 *self.mint.key,
460 false,
461 ));
462 accounts.push(solana_program::instruction::AccountMeta::new(
463 *self.approve_account.key,
464 false,
465 ));
466 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
467 *self.payment_mint.key,
468 false,
469 ));
470 if let Some(distribution_token_account) = self.distribution_token_account {
471 accounts.push(solana_program::instruction::AccountMeta::new(
472 *distribution_token_account.key,
473 false,
474 ));
475 } else {
476 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
477 crate::WEN_NEW_STANDARD_ID,
478 false,
479 ));
480 }
481 if let Some(authority_token_account) = self.authority_token_account {
482 accounts.push(solana_program::instruction::AccountMeta::new(
483 *authority_token_account.key,
484 false,
485 ));
486 } else {
487 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
488 crate::WEN_NEW_STANDARD_ID,
489 false,
490 ));
491 }
492 accounts.push(solana_program::instruction::AccountMeta::new(
493 *self.distribution_account.key,
494 false,
495 ));
496 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
497 *self.system_program.key,
498 false,
499 ));
500 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
501 *self.distribution_program.key,
502 false,
503 ));
504 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
505 *self.token_program.key,
506 false,
507 ));
508 if let Some(payment_token_program) = self.payment_token_program {
509 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
510 *payment_token_program.key,
511 false,
512 ));
513 } else {
514 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
515 crate::WEN_NEW_STANDARD_ID,
516 false,
517 ));
518 }
519 remaining_accounts.iter().for_each(|remaining_account| {
520 accounts.push(solana_program::instruction::AccountMeta {
521 pubkey: *remaining_account.0.key,
522 is_signer: remaining_account.1,
523 is_writable: remaining_account.2,
524 })
525 });
526 let mut data = ApproveTransferInstructionData::new().try_to_vec().unwrap();
527 let mut args = self.__args.try_to_vec().unwrap();
528 data.append(&mut args);
529
530 let instruction = solana_program::instruction::Instruction {
531 program_id: crate::WEN_NEW_STANDARD_ID,
532 accounts,
533 data,
534 };
535 let mut account_infos = Vec::with_capacity(12 + 1 + remaining_accounts.len());
536 account_infos.push(self.__program.clone());
537 account_infos.push(self.payer.clone());
538 account_infos.push(self.authority.clone());
539 account_infos.push(self.mint.clone());
540 account_infos.push(self.approve_account.clone());
541 account_infos.push(self.payment_mint.clone());
542 if let Some(distribution_token_account) = self.distribution_token_account {
543 account_infos.push(distribution_token_account.clone());
544 }
545 if let Some(authority_token_account) = self.authority_token_account {
546 account_infos.push(authority_token_account.clone());
547 }
548 account_infos.push(self.distribution_account.clone());
549 account_infos.push(self.system_program.clone());
550 account_infos.push(self.distribution_program.clone());
551 account_infos.push(self.token_program.clone());
552 if let Some(payment_token_program) = self.payment_token_program {
553 account_infos.push(payment_token_program.clone());
554 }
555 remaining_accounts
556 .iter()
557 .for_each(|remaining_account| account_infos.push(remaining_account.0.clone()));
558
559 if signers_seeds.is_empty() {
560 solana_program::program::invoke(&instruction, &account_infos)
561 } else {
562 solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds)
563 }
564 }
565}
566
567#[derive(Clone, Debug)]
584pub struct ApproveTransferCpiBuilder<'a, 'b> {
585 instruction: Box<ApproveTransferCpiBuilderInstruction<'a, 'b>>,
586}
587
588impl<'a, 'b> ApproveTransferCpiBuilder<'a, 'b> {
589 pub fn new(program: &'b solana_program::account_info::AccountInfo<'a>) -> Self {
590 let instruction = Box::new(ApproveTransferCpiBuilderInstruction {
591 __program: program,
592 payer: None,
593 authority: None,
594 mint: None,
595 approve_account: None,
596 payment_mint: None,
597 distribution_token_account: None,
598 authority_token_account: None,
599 distribution_account: None,
600 system_program: None,
601 distribution_program: None,
602 token_program: None,
603 payment_token_program: None,
604 buy_amount: None,
605 __remaining_accounts: Vec::new(),
606 });
607 Self { instruction }
608 }
609 #[inline(always)]
610 pub fn payer(&mut self, payer: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self {
611 self.instruction.payer = Some(payer);
612 self
613 }
614 #[inline(always)]
615 pub fn authority(
616 &mut self,
617 authority: &'b solana_program::account_info::AccountInfo<'a>,
618 ) -> &mut Self {
619 self.instruction.authority = Some(authority);
620 self
621 }
622 #[inline(always)]
623 pub fn mint(&mut self, mint: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self {
624 self.instruction.mint = Some(mint);
625 self
626 }
627 #[inline(always)]
628 pub fn approve_account(
629 &mut self,
630 approve_account: &'b solana_program::account_info::AccountInfo<'a>,
631 ) -> &mut Self {
632 self.instruction.approve_account = Some(approve_account);
633 self
634 }
635 #[inline(always)]
636 pub fn payment_mint(
637 &mut self,
638 payment_mint: &'b solana_program::account_info::AccountInfo<'a>,
639 ) -> &mut Self {
640 self.instruction.payment_mint = Some(payment_mint);
641 self
642 }
643 #[inline(always)]
645 pub fn distribution_token_account(
646 &mut self,
647 distribution_token_account: Option<&'b solana_program::account_info::AccountInfo<'a>>,
648 ) -> &mut Self {
649 self.instruction.distribution_token_account = distribution_token_account;
650 self
651 }
652 #[inline(always)]
654 pub fn authority_token_account(
655 &mut self,
656 authority_token_account: Option<&'b solana_program::account_info::AccountInfo<'a>>,
657 ) -> &mut Self {
658 self.instruction.authority_token_account = authority_token_account;
659 self
660 }
661 #[inline(always)]
662 pub fn distribution_account(
663 &mut self,
664 distribution_account: &'b solana_program::account_info::AccountInfo<'a>,
665 ) -> &mut Self {
666 self.instruction.distribution_account = Some(distribution_account);
667 self
668 }
669 #[inline(always)]
670 pub fn system_program(
671 &mut self,
672 system_program: &'b solana_program::account_info::AccountInfo<'a>,
673 ) -> &mut Self {
674 self.instruction.system_program = Some(system_program);
675 self
676 }
677 #[inline(always)]
678 pub fn distribution_program(
679 &mut self,
680 distribution_program: &'b solana_program::account_info::AccountInfo<'a>,
681 ) -> &mut Self {
682 self.instruction.distribution_program = Some(distribution_program);
683 self
684 }
685 #[inline(always)]
686 pub fn token_program(
687 &mut self,
688 token_program: &'b solana_program::account_info::AccountInfo<'a>,
689 ) -> &mut Self {
690 self.instruction.token_program = Some(token_program);
691 self
692 }
693 #[inline(always)]
695 pub fn payment_token_program(
696 &mut self,
697 payment_token_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
698 ) -> &mut Self {
699 self.instruction.payment_token_program = payment_token_program;
700 self
701 }
702 #[inline(always)]
703 pub fn buy_amount(&mut self, buy_amount: u64) -> &mut Self {
704 self.instruction.buy_amount = Some(buy_amount);
705 self
706 }
707 #[inline(always)]
709 pub fn add_remaining_account(
710 &mut self,
711 account: &'b solana_program::account_info::AccountInfo<'a>,
712 is_writable: bool,
713 is_signer: bool,
714 ) -> &mut Self {
715 self.instruction
716 .__remaining_accounts
717 .push((account, is_writable, is_signer));
718 self
719 }
720 #[inline(always)]
725 pub fn add_remaining_accounts(
726 &mut self,
727 accounts: &[(
728 &'b solana_program::account_info::AccountInfo<'a>,
729 bool,
730 bool,
731 )],
732 ) -> &mut Self {
733 self.instruction
734 .__remaining_accounts
735 .extend_from_slice(accounts);
736 self
737 }
738 #[inline(always)]
739 pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult {
740 self.invoke_signed(&[])
741 }
742 #[allow(clippy::clone_on_copy)]
743 #[allow(clippy::vec_init_then_push)]
744 pub fn invoke_signed(
745 &self,
746 signers_seeds: &[&[&[u8]]],
747 ) -> solana_program::entrypoint::ProgramResult {
748 let args = ApproveTransferInstructionArgs {
749 buy_amount: self
750 .instruction
751 .buy_amount
752 .clone()
753 .expect("buy_amount is not set"),
754 };
755 let instruction = ApproveTransferCpi {
756 __program: self.instruction.__program,
757
758 payer: self.instruction.payer.expect("payer is not set"),
759
760 authority: self.instruction.authority.expect("authority is not set"),
761
762 mint: self.instruction.mint.expect("mint is not set"),
763
764 approve_account: self
765 .instruction
766 .approve_account
767 .expect("approve_account is not set"),
768
769 payment_mint: self
770 .instruction
771 .payment_mint
772 .expect("payment_mint is not set"),
773
774 distribution_token_account: self.instruction.distribution_token_account,
775
776 authority_token_account: self.instruction.authority_token_account,
777
778 distribution_account: self
779 .instruction
780 .distribution_account
781 .expect("distribution_account is not set"),
782
783 system_program: self
784 .instruction
785 .system_program
786 .expect("system_program is not set"),
787
788 distribution_program: self
789 .instruction
790 .distribution_program
791 .expect("distribution_program is not set"),
792
793 token_program: self
794 .instruction
795 .token_program
796 .expect("token_program is not set"),
797
798 payment_token_program: self.instruction.payment_token_program,
799 __args: args,
800 };
801 instruction.invoke_signed_with_remaining_accounts(
802 signers_seeds,
803 &self.instruction.__remaining_accounts,
804 )
805 }
806}
807
808#[derive(Clone, Debug)]
809struct ApproveTransferCpiBuilderInstruction<'a, 'b> {
810 __program: &'b solana_program::account_info::AccountInfo<'a>,
811 payer: Option<&'b solana_program::account_info::AccountInfo<'a>>,
812 authority: Option<&'b solana_program::account_info::AccountInfo<'a>>,
813 mint: Option<&'b solana_program::account_info::AccountInfo<'a>>,
814 approve_account: Option<&'b solana_program::account_info::AccountInfo<'a>>,
815 payment_mint: Option<&'b solana_program::account_info::AccountInfo<'a>>,
816 distribution_token_account: Option<&'b solana_program::account_info::AccountInfo<'a>>,
817 authority_token_account: Option<&'b solana_program::account_info::AccountInfo<'a>>,
818 distribution_account: Option<&'b solana_program::account_info::AccountInfo<'a>>,
819 system_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
820 distribution_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
821 token_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
822 payment_token_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
823 buy_amount: Option<u64>,
824 __remaining_accounts: Vec<(
826 &'b solana_program::account_info::AccountInfo<'a>,
827 bool,
828 bool,
829 )>,
830}