Skip to main content

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