Skip to main content

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