Skip to main content

security_token_client/generated/instructions/
claim_distribution.rs

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