Skip to main content

satrush_client/generated/instructions/
withdraw_grubstake.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 WITHDRAW_GRUBSTAKE_DISCRIMINATOR: [u8; 8] = [94, 141, 168, 137, 52, 222, 159, 174];
12
13/// Accounts.
14#[derive(Debug)]
15pub struct WithdrawGrubstake {
16      
17              
18          pub authority: solana_address::Address,
19          
20              
21          pub satrush_config: solana_address::Address,
22                /// The treasury: owns the grubstake pool and signs the withdrawal transfer.
23
24    
25              
26          pub treasury: solana_address::Address,
27          
28              
29          pub usd_mint: solana_address::Address,
30                /// Treasury's USD pool — the withdrawal source.
31
32    
33              
34          pub treasury_usd_ata: solana_address::Address,
35                /// as the authority of the destination ATA.
36
37    
38              
39          pub fee_recipient: solana_address::Address,
40                /// Fee recipient's USD account — the withdrawal destination. Created by the
41/// crank if missing.
42
43    
44              
45          pub fee_recipient_usd_ata: solana_address::Address,
46          
47              
48          pub token_program: solana_address::Address,
49          
50              
51          pub associated_token_program: solana_address::Address,
52          
53              
54          pub system_program: solana_address::Address,
55      }
56
57impl WithdrawGrubstake {
58  pub fn instruction(&self, args: WithdrawGrubstakeInstructionArgs) -> solana_instruction::Instruction {
59    self.instruction_with_remaining_accounts(args, &[])
60  }
61  #[allow(clippy::arithmetic_side_effects)]
62  #[allow(clippy::vec_init_then_push)]
63  pub fn instruction_with_remaining_accounts(&self, args: WithdrawGrubstakeInstructionArgs, remaining_accounts: &[solana_instruction::AccountMeta]) -> solana_instruction::Instruction {
64    let mut accounts = Vec::with_capacity(10+ remaining_accounts.len());
65                            accounts.push(solana_instruction::AccountMeta::new(
66            self.authority,
67            true
68          ));
69                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
70            self.satrush_config,
71            false
72          ));
73                                          accounts.push(solana_instruction::AccountMeta::new(
74            self.treasury,
75            false
76          ));
77                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
78            self.usd_mint,
79            false
80          ));
81                                          accounts.push(solana_instruction::AccountMeta::new(
82            self.treasury_usd_ata,
83            false
84          ));
85                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
86            self.fee_recipient,
87            false
88          ));
89                                          accounts.push(solana_instruction::AccountMeta::new(
90            self.fee_recipient_usd_ata,
91            false
92          ));
93                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
94            self.token_program,
95            false
96          ));
97                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
98            self.associated_token_program,
99            false
100          ));
101                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
102            self.system_program,
103            false
104          ));
105                      accounts.extend_from_slice(remaining_accounts);
106    let mut data = WithdrawGrubstakeInstructionData::new().try_to_vec().unwrap();
107          let mut args = args.try_to_vec().unwrap();
108      data.append(&mut args);
109    
110    solana_instruction::Instruction {
111      program_id: crate::SATRUSH_ID,
112      accounts,
113      data,
114    }
115  }
116}
117
118#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)]
119 pub struct WithdrawGrubstakeInstructionData {
120            discriminator: [u8; 8],
121            }
122
123impl WithdrawGrubstakeInstructionData {
124  pub fn new() -> Self {
125    Self {
126                        discriminator: [94, 141, 168, 137, 52, 222, 159, 174],
127                                }
128  }
129
130    pub(crate) fn try_to_vec(&self) -> Result<Vec<u8>, std::io::Error> {
131    borsh::to_vec(self)
132  }
133  }
134
135impl Default for WithdrawGrubstakeInstructionData {
136  fn default() -> Self {
137    Self::new()
138  }
139}
140
141#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)]
142 pub struct WithdrawGrubstakeInstructionArgs {
143                  pub usd_amount: u64,
144      }
145
146impl WithdrawGrubstakeInstructionArgs {
147  pub(crate) fn try_to_vec(&self) -> Result<Vec<u8>, std::io::Error> {
148    borsh::to_vec(self)
149  }
150}
151
152
153/// Instruction builder for `WithdrawGrubstake`.
154///
155/// ### Accounts:
156///
157                      ///   0. `[writable, signer]` authority
158          ///   1. `[]` satrush_config
159                ///   2. `[writable]` treasury
160          ///   3. `[]` usd_mint
161                ///   4. `[writable]` treasury_usd_ata
162          ///   5. `[]` fee_recipient
163                ///   6. `[writable]` fee_recipient_usd_ata
164                ///   7. `[optional]` token_program (default to `TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA`)
165                ///   8. `[optional]` associated_token_program (default to `ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL`)
166                ///   9. `[optional]` system_program (default to `11111111111111111111111111111111`)
167#[derive(Clone, Debug, Default)]
168pub struct WithdrawGrubstakeBuilder {
169            authority: Option<solana_address::Address>,
170                satrush_config: Option<solana_address::Address>,
171                treasury: Option<solana_address::Address>,
172                usd_mint: Option<solana_address::Address>,
173                treasury_usd_ata: Option<solana_address::Address>,
174                fee_recipient: Option<solana_address::Address>,
175                fee_recipient_usd_ata: Option<solana_address::Address>,
176                token_program: Option<solana_address::Address>,
177                associated_token_program: Option<solana_address::Address>,
178                system_program: Option<solana_address::Address>,
179                        usd_amount: Option<u64>,
180        __remaining_accounts: Vec<solana_instruction::AccountMeta>,
181}
182
183impl WithdrawGrubstakeBuilder {
184  pub fn new() -> Self {
185    Self::default()
186  }
187            #[inline(always)]
188    pub fn authority(&mut self, authority: solana_address::Address) -> &mut Self {
189                        self.authority = Some(authority);
190                    self
191    }
192            #[inline(always)]
193    pub fn satrush_config(&mut self, satrush_config: solana_address::Address) -> &mut Self {
194                        self.satrush_config = Some(satrush_config);
195                    self
196    }
197            /// The treasury: owns the grubstake pool and signs the withdrawal transfer.
198#[inline(always)]
199    pub fn treasury(&mut self, treasury: solana_address::Address) -> &mut Self {
200                        self.treasury = Some(treasury);
201                    self
202    }
203            #[inline(always)]
204    pub fn usd_mint(&mut self, usd_mint: solana_address::Address) -> &mut Self {
205                        self.usd_mint = Some(usd_mint);
206                    self
207    }
208            /// Treasury's USD pool — the withdrawal source.
209#[inline(always)]
210    pub fn treasury_usd_ata(&mut self, treasury_usd_ata: solana_address::Address) -> &mut Self {
211                        self.treasury_usd_ata = Some(treasury_usd_ata);
212                    self
213    }
214            /// as the authority of the destination ATA.
215#[inline(always)]
216    pub fn fee_recipient(&mut self, fee_recipient: solana_address::Address) -> &mut Self {
217                        self.fee_recipient = Some(fee_recipient);
218                    self
219    }
220            /// Fee recipient's USD account — the withdrawal destination. Created by the
221/// crank if missing.
222#[inline(always)]
223    pub fn fee_recipient_usd_ata(&mut self, fee_recipient_usd_ata: solana_address::Address) -> &mut Self {
224                        self.fee_recipient_usd_ata = Some(fee_recipient_usd_ata);
225                    self
226    }
227            /// `[optional account, default to 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA']`
228#[inline(always)]
229    pub fn token_program(&mut self, token_program: solana_address::Address) -> &mut Self {
230                        self.token_program = Some(token_program);
231                    self
232    }
233            /// `[optional account, default to 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL']`
234#[inline(always)]
235    pub fn associated_token_program(&mut self, associated_token_program: solana_address::Address) -> &mut Self {
236                        self.associated_token_program = Some(associated_token_program);
237                    self
238    }
239            /// `[optional account, default to '11111111111111111111111111111111']`
240#[inline(always)]
241    pub fn system_program(&mut self, system_program: solana_address::Address) -> &mut Self {
242                        self.system_program = Some(system_program);
243                    self
244    }
245                    #[inline(always)]
246      pub fn usd_amount(&mut self, usd_amount: u64) -> &mut Self {
247        self.usd_amount = Some(usd_amount);
248        self
249      }
250        /// Add an additional account to the instruction.
251  #[inline(always)]
252  pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self {
253    self.__remaining_accounts.push(account);
254    self
255  }
256  /// Add additional accounts to the instruction.
257  #[inline(always)]
258  pub fn add_remaining_accounts(&mut self, accounts: &[solana_instruction::AccountMeta]) -> &mut Self {
259    self.__remaining_accounts.extend_from_slice(accounts);
260    self
261  }
262  #[allow(clippy::clone_on_copy)]
263  pub fn instruction(&self) -> solana_instruction::Instruction {
264    let accounts = WithdrawGrubstake {
265                              authority: self.authority.expect("authority is not set"),
266                                        satrush_config: self.satrush_config.expect("satrush_config is not set"),
267                                        treasury: self.treasury.expect("treasury is not set"),
268                                        usd_mint: self.usd_mint.expect("usd_mint is not set"),
269                                        treasury_usd_ata: self.treasury_usd_ata.expect("treasury_usd_ata is not set"),
270                                        fee_recipient: self.fee_recipient.expect("fee_recipient is not set"),
271                                        fee_recipient_usd_ata: self.fee_recipient_usd_ata.expect("fee_recipient_usd_ata is not set"),
272                                        token_program: self.token_program.unwrap_or(solana_address::address!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA")),
273                                        associated_token_program: self.associated_token_program.unwrap_or(solana_address::address!("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL")),
274                                        system_program: self.system_program.unwrap_or(solana_address::address!("11111111111111111111111111111111")),
275                      };
276          let args = WithdrawGrubstakeInstructionArgs {
277                                                              usd_amount: self.usd_amount.clone().expect("usd_amount is not set"),
278                                    };
279    
280    accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts)
281  }
282}
283
284  /// `withdraw_grubstake` CPI accounts.
285  pub struct WithdrawGrubstakeCpiAccounts<'a, 'b> {
286          
287                    
288              pub authority: &'b solana_account_info::AccountInfo<'a>,
289                
290                    
291              pub satrush_config: &'b solana_account_info::AccountInfo<'a>,
292                        /// The treasury: owns the grubstake pool and signs the withdrawal transfer.
293
294      
295                    
296              pub treasury: &'b solana_account_info::AccountInfo<'a>,
297                
298                    
299              pub usd_mint: &'b solana_account_info::AccountInfo<'a>,
300                        /// Treasury's USD pool — the withdrawal source.
301
302      
303                    
304              pub treasury_usd_ata: &'b solana_account_info::AccountInfo<'a>,
305                        /// as the authority of the destination ATA.
306
307      
308                    
309              pub fee_recipient: &'b solana_account_info::AccountInfo<'a>,
310                        /// Fee recipient's USD account — the withdrawal destination. Created by the
311/// crank if missing.
312
313      
314                    
315              pub fee_recipient_usd_ata: &'b solana_account_info::AccountInfo<'a>,
316                
317                    
318              pub token_program: &'b solana_account_info::AccountInfo<'a>,
319                
320                    
321              pub associated_token_program: &'b solana_account_info::AccountInfo<'a>,
322                
323                    
324              pub system_program: &'b solana_account_info::AccountInfo<'a>,
325            }
326
327/// `withdraw_grubstake` CPI instruction.
328pub struct WithdrawGrubstakeCpi<'a, 'b> {
329  /// The program to invoke.
330  pub __program: &'b solana_account_info::AccountInfo<'a>,
331      
332              
333          pub authority: &'b solana_account_info::AccountInfo<'a>,
334          
335              
336          pub satrush_config: &'b solana_account_info::AccountInfo<'a>,
337                /// The treasury: owns the grubstake pool and signs the withdrawal transfer.
338
339    
340              
341          pub treasury: &'b solana_account_info::AccountInfo<'a>,
342          
343              
344          pub usd_mint: &'b solana_account_info::AccountInfo<'a>,
345                /// Treasury's USD pool — the withdrawal source.
346
347    
348              
349          pub treasury_usd_ata: &'b solana_account_info::AccountInfo<'a>,
350                /// as the authority of the destination ATA.
351
352    
353              
354          pub fee_recipient: &'b solana_account_info::AccountInfo<'a>,
355                /// Fee recipient's USD account — the withdrawal destination. Created by the
356/// crank if missing.
357
358    
359              
360          pub fee_recipient_usd_ata: &'b solana_account_info::AccountInfo<'a>,
361          
362              
363          pub token_program: &'b solana_account_info::AccountInfo<'a>,
364          
365              
366          pub associated_token_program: &'b solana_account_info::AccountInfo<'a>,
367          
368              
369          pub system_program: &'b solana_account_info::AccountInfo<'a>,
370            /// The arguments for the instruction.
371    pub __args: WithdrawGrubstakeInstructionArgs,
372  }
373
374impl<'a, 'b> WithdrawGrubstakeCpi<'a, 'b> {
375  pub fn new(
376    program: &'b solana_account_info::AccountInfo<'a>,
377          accounts: WithdrawGrubstakeCpiAccounts<'a, 'b>,
378              args: WithdrawGrubstakeInstructionArgs,
379      ) -> Self {
380    Self {
381      __program: program,
382              authority: accounts.authority,
383              satrush_config: accounts.satrush_config,
384              treasury: accounts.treasury,
385              usd_mint: accounts.usd_mint,
386              treasury_usd_ata: accounts.treasury_usd_ata,
387              fee_recipient: accounts.fee_recipient,
388              fee_recipient_usd_ata: accounts.fee_recipient_usd_ata,
389              token_program: accounts.token_program,
390              associated_token_program: accounts.associated_token_program,
391              system_program: accounts.system_program,
392                    __args: args,
393          }
394  }
395  #[inline(always)]
396  pub fn invoke(&self) -> solana_program_error::ProgramResult {
397    self.invoke_signed_with_remaining_accounts(&[], &[])
398  }
399  #[inline(always)]
400  pub fn invoke_with_remaining_accounts(&self, remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)]) -> solana_program_error::ProgramResult {
401    self.invoke_signed_with_remaining_accounts(&[], remaining_accounts)
402  }
403  #[inline(always)]
404  pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult {
405    self.invoke_signed_with_remaining_accounts(signers_seeds, &[])
406  }
407  #[allow(clippy::arithmetic_side_effects)]
408  #[allow(clippy::clone_on_copy)]
409  #[allow(clippy::vec_init_then_push)]
410  pub fn invoke_signed_with_remaining_accounts(
411    &self,
412    signers_seeds: &[&[&[u8]]],
413    remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)]
414  ) -> solana_program_error::ProgramResult {
415    let mut accounts = Vec::with_capacity(10+ remaining_accounts.len());
416                            accounts.push(solana_instruction::AccountMeta::new(
417            *self.authority.key,
418            true
419          ));
420                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
421            *self.satrush_config.key,
422            false
423          ));
424                                          accounts.push(solana_instruction::AccountMeta::new(
425            *self.treasury.key,
426            false
427          ));
428                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
429            *self.usd_mint.key,
430            false
431          ));
432                                          accounts.push(solana_instruction::AccountMeta::new(
433            *self.treasury_usd_ata.key,
434            false
435          ));
436                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
437            *self.fee_recipient.key,
438            false
439          ));
440                                          accounts.push(solana_instruction::AccountMeta::new(
441            *self.fee_recipient_usd_ata.key,
442            false
443          ));
444                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
445            *self.token_program.key,
446            false
447          ));
448                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
449            *self.associated_token_program.key,
450            false
451          ));
452                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
453            *self.system_program.key,
454            false
455          ));
456                      remaining_accounts.iter().for_each(|remaining_account| {
457      accounts.push(solana_instruction::AccountMeta {
458          pubkey: *remaining_account.0.key,
459          is_signer: remaining_account.1,
460          is_writable: remaining_account.2,
461      })
462    });
463    let mut data = WithdrawGrubstakeInstructionData::new().try_to_vec().unwrap();
464          let mut args = self.__args.try_to_vec().unwrap();
465      data.append(&mut args);
466    
467    let instruction = solana_instruction::Instruction {
468      program_id: crate::SATRUSH_ID,
469      accounts,
470      data,
471    };
472    let mut account_infos = Vec::with_capacity(11 + remaining_accounts.len());
473    account_infos.push(self.__program.clone());
474                  account_infos.push(self.authority.clone());
475                        account_infos.push(self.satrush_config.clone());
476                        account_infos.push(self.treasury.clone());
477                        account_infos.push(self.usd_mint.clone());
478                        account_infos.push(self.treasury_usd_ata.clone());
479                        account_infos.push(self.fee_recipient.clone());
480                        account_infos.push(self.fee_recipient_usd_ata.clone());
481                        account_infos.push(self.token_program.clone());
482                        account_infos.push(self.associated_token_program.clone());
483                        account_infos.push(self.system_program.clone());
484              remaining_accounts.iter().for_each(|remaining_account| account_infos.push(remaining_account.0.clone()));
485
486    if signers_seeds.is_empty() {
487      solana_cpi::invoke(&instruction, &account_infos)
488    } else {
489      solana_cpi::invoke_signed(&instruction, &account_infos, signers_seeds)
490    }
491  }
492}
493
494/// Instruction builder for `WithdrawGrubstake` via CPI.
495///
496/// ### Accounts:
497///
498                      ///   0. `[writable, signer]` authority
499          ///   1. `[]` satrush_config
500                ///   2. `[writable]` treasury
501          ///   3. `[]` usd_mint
502                ///   4. `[writable]` treasury_usd_ata
503          ///   5. `[]` fee_recipient
504                ///   6. `[writable]` fee_recipient_usd_ata
505          ///   7. `[]` token_program
506          ///   8. `[]` associated_token_program
507          ///   9. `[]` system_program
508#[derive(Clone, Debug)]
509pub struct WithdrawGrubstakeCpiBuilder<'a, 'b> {
510  instruction: Box<WithdrawGrubstakeCpiBuilderInstruction<'a, 'b>>,
511}
512
513impl<'a, 'b> WithdrawGrubstakeCpiBuilder<'a, 'b> {
514  pub fn new(program: &'b solana_account_info::AccountInfo<'a>) -> Self {
515    let instruction = Box::new(WithdrawGrubstakeCpiBuilderInstruction {
516      __program: program,
517              authority: None,
518              satrush_config: None,
519              treasury: None,
520              usd_mint: None,
521              treasury_usd_ata: None,
522              fee_recipient: None,
523              fee_recipient_usd_ata: None,
524              token_program: None,
525              associated_token_program: None,
526              system_program: None,
527                                            usd_amount: None,
528                    __remaining_accounts: Vec::new(),
529    });
530    Self { instruction }
531  }
532      #[inline(always)]
533    pub fn authority(&mut self, authority: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
534                        self.instruction.authority = Some(authority);
535                    self
536    }
537      #[inline(always)]
538    pub fn satrush_config(&mut self, satrush_config: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
539                        self.instruction.satrush_config = Some(satrush_config);
540                    self
541    }
542      /// The treasury: owns the grubstake pool and signs the withdrawal transfer.
543#[inline(always)]
544    pub fn treasury(&mut self, treasury: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
545                        self.instruction.treasury = Some(treasury);
546                    self
547    }
548      #[inline(always)]
549    pub fn usd_mint(&mut self, usd_mint: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
550                        self.instruction.usd_mint = Some(usd_mint);
551                    self
552    }
553      /// Treasury's USD pool — the withdrawal source.
554#[inline(always)]
555    pub fn treasury_usd_ata(&mut self, treasury_usd_ata: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
556                        self.instruction.treasury_usd_ata = Some(treasury_usd_ata);
557                    self
558    }
559      /// as the authority of the destination ATA.
560#[inline(always)]
561    pub fn fee_recipient(&mut self, fee_recipient: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
562                        self.instruction.fee_recipient = Some(fee_recipient);
563                    self
564    }
565      /// Fee recipient's USD account — the withdrawal destination. Created by the
566/// crank if missing.
567#[inline(always)]
568    pub fn fee_recipient_usd_ata(&mut self, fee_recipient_usd_ata: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
569                        self.instruction.fee_recipient_usd_ata = Some(fee_recipient_usd_ata);
570                    self
571    }
572      #[inline(always)]
573    pub fn token_program(&mut self, token_program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
574                        self.instruction.token_program = Some(token_program);
575                    self
576    }
577      #[inline(always)]
578    pub fn associated_token_program(&mut self, associated_token_program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
579                        self.instruction.associated_token_program = Some(associated_token_program);
580                    self
581    }
582      #[inline(always)]
583    pub fn system_program(&mut self, system_program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
584                        self.instruction.system_program = Some(system_program);
585                    self
586    }
587                    #[inline(always)]
588      pub fn usd_amount(&mut self, usd_amount: u64) -> &mut Self {
589        self.instruction.usd_amount = Some(usd_amount);
590        self
591      }
592        /// Add an additional account to the instruction.
593  #[inline(always)]
594  pub fn add_remaining_account(&mut self, account: &'b solana_account_info::AccountInfo<'a>, is_writable: bool, is_signer: bool) -> &mut Self {
595    self.instruction.__remaining_accounts.push((account, is_writable, is_signer));
596    self
597  }
598  /// Add additional accounts to the instruction.
599  ///
600  /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not,
601  /// and a `bool` indicating whether the account is a signer or not.
602  #[inline(always)]
603  pub fn add_remaining_accounts(&mut self, accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)]) -> &mut Self {
604    self.instruction.__remaining_accounts.extend_from_slice(accounts);
605    self
606  }
607  #[inline(always)]
608  pub fn invoke(&self) -> solana_program_error::ProgramResult {
609    self.invoke_signed(&[])
610  }
611  #[allow(clippy::clone_on_copy)]
612  #[allow(clippy::vec_init_then_push)]
613  pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult {
614          let args = WithdrawGrubstakeInstructionArgs {
615                                                              usd_amount: self.instruction.usd_amount.clone().expect("usd_amount is not set"),
616                                    };
617        let instruction = WithdrawGrubstakeCpi {
618        __program: self.instruction.__program,
619                  
620          authority: self.instruction.authority.expect("authority is not set"),
621                  
622          satrush_config: self.instruction.satrush_config.expect("satrush_config is not set"),
623                  
624          treasury: self.instruction.treasury.expect("treasury is not set"),
625                  
626          usd_mint: self.instruction.usd_mint.expect("usd_mint is not set"),
627                  
628          treasury_usd_ata: self.instruction.treasury_usd_ata.expect("treasury_usd_ata is not set"),
629                  
630          fee_recipient: self.instruction.fee_recipient.expect("fee_recipient is not set"),
631                  
632          fee_recipient_usd_ata: self.instruction.fee_recipient_usd_ata.expect("fee_recipient_usd_ata is not set"),
633                  
634          token_program: self.instruction.token_program.expect("token_program is not set"),
635                  
636          associated_token_program: self.instruction.associated_token_program.expect("associated_token_program is not set"),
637                  
638          system_program: self.instruction.system_program.expect("system_program is not set"),
639                          __args: args,
640            };
641    instruction.invoke_signed_with_remaining_accounts(signers_seeds, &self.instruction.__remaining_accounts)
642  }
643}
644
645#[derive(Clone, Debug)]
646struct WithdrawGrubstakeCpiBuilderInstruction<'a, 'b> {
647  __program: &'b solana_account_info::AccountInfo<'a>,
648            authority: Option<&'b solana_account_info::AccountInfo<'a>>,
649                satrush_config: Option<&'b solana_account_info::AccountInfo<'a>>,
650                treasury: Option<&'b solana_account_info::AccountInfo<'a>>,
651                usd_mint: Option<&'b solana_account_info::AccountInfo<'a>>,
652                treasury_usd_ata: Option<&'b solana_account_info::AccountInfo<'a>>,
653                fee_recipient: Option<&'b solana_account_info::AccountInfo<'a>>,
654                fee_recipient_usd_ata: Option<&'b solana_account_info::AccountInfo<'a>>,
655                token_program: Option<&'b solana_account_info::AccountInfo<'a>>,
656                associated_token_program: Option<&'b solana_account_info::AccountInfo<'a>>,
657                system_program: Option<&'b solana_account_info::AccountInfo<'a>>,
658                        usd_amount: Option<u64>,
659        /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`.
660  __remaining_accounts: Vec<(&'b solana_account_info::AccountInfo<'a>, bool, bool)>,
661}
662