Skip to main content

satrush_client/generated/instructions/
update_min_deploy_usd_amount.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 UPDATE_MIN_DEPLOY_USD_AMOUNT_DISCRIMINATOR: [u8; 8] = [187, 108, 89, 178, 249, 101, 187, 33];
12
13/// Accounts.
14#[derive(Debug)]
15pub struct UpdateMinDeployUsdAmount {
16      
17              
18          pub authority: solana_address::Address,
19          
20              
21          pub satrush_config: solana_address::Address,
22      }
23
24impl UpdateMinDeployUsdAmount {
25  pub fn instruction(&self, args: UpdateMinDeployUsdAmountInstructionArgs) -> solana_instruction::Instruction {
26    self.instruction_with_remaining_accounts(args, &[])
27  }
28  #[allow(clippy::arithmetic_side_effects)]
29  #[allow(clippy::vec_init_then_push)]
30  pub fn instruction_with_remaining_accounts(&self, args: UpdateMinDeployUsdAmountInstructionArgs, remaining_accounts: &[solana_instruction::AccountMeta]) -> solana_instruction::Instruction {
31    let mut accounts = Vec::with_capacity(2+ remaining_accounts.len());
32                            accounts.push(solana_instruction::AccountMeta::new_readonly(
33            self.authority,
34            true
35          ));
36                                          accounts.push(solana_instruction::AccountMeta::new(
37            self.satrush_config,
38            false
39          ));
40                      accounts.extend_from_slice(remaining_accounts);
41    let mut data = UpdateMinDeployUsdAmountInstructionData::new().try_to_vec().unwrap();
42          let mut args = args.try_to_vec().unwrap();
43      data.append(&mut args);
44    
45    solana_instruction::Instruction {
46      program_id: crate::SATRUSH_ID,
47      accounts,
48      data,
49    }
50  }
51}
52
53#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)]
54 pub struct UpdateMinDeployUsdAmountInstructionData {
55            discriminator: [u8; 8],
56            }
57
58impl UpdateMinDeployUsdAmountInstructionData {
59  pub fn new() -> Self {
60    Self {
61                        discriminator: [187, 108, 89, 178, 249, 101, 187, 33],
62                                }
63  }
64
65    pub(crate) fn try_to_vec(&self) -> Result<Vec<u8>, std::io::Error> {
66    borsh::to_vec(self)
67  }
68  }
69
70impl Default for UpdateMinDeployUsdAmountInstructionData {
71  fn default() -> Self {
72    Self::new()
73  }
74}
75
76#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)]
77 pub struct UpdateMinDeployUsdAmountInstructionArgs {
78                  pub new_min_deploy_usd_amount: u64,
79      }
80
81impl UpdateMinDeployUsdAmountInstructionArgs {
82  pub(crate) fn try_to_vec(&self) -> Result<Vec<u8>, std::io::Error> {
83    borsh::to_vec(self)
84  }
85}
86
87
88/// Instruction builder for `UpdateMinDeployUsdAmount`.
89///
90/// ### Accounts:
91///
92                ///   0. `[signer]` authority
93                ///   1. `[writable]` satrush_config
94#[derive(Clone, Debug, Default)]
95pub struct UpdateMinDeployUsdAmountBuilder {
96            authority: Option<solana_address::Address>,
97                satrush_config: Option<solana_address::Address>,
98                        new_min_deploy_usd_amount: Option<u64>,
99        __remaining_accounts: Vec<solana_instruction::AccountMeta>,
100}
101
102impl UpdateMinDeployUsdAmountBuilder {
103  pub fn new() -> Self {
104    Self::default()
105  }
106            #[inline(always)]
107    pub fn authority(&mut self, authority: solana_address::Address) -> &mut Self {
108                        self.authority = Some(authority);
109                    self
110    }
111            #[inline(always)]
112    pub fn satrush_config(&mut self, satrush_config: solana_address::Address) -> &mut Self {
113                        self.satrush_config = Some(satrush_config);
114                    self
115    }
116                    #[inline(always)]
117      pub fn new_min_deploy_usd_amount(&mut self, new_min_deploy_usd_amount: u64) -> &mut Self {
118        self.new_min_deploy_usd_amount = Some(new_min_deploy_usd_amount);
119        self
120      }
121        /// Add an additional account to the instruction.
122  #[inline(always)]
123  pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self {
124    self.__remaining_accounts.push(account);
125    self
126  }
127  /// Add additional accounts to the instruction.
128  #[inline(always)]
129  pub fn add_remaining_accounts(&mut self, accounts: &[solana_instruction::AccountMeta]) -> &mut Self {
130    self.__remaining_accounts.extend_from_slice(accounts);
131    self
132  }
133  #[allow(clippy::clone_on_copy)]
134  pub fn instruction(&self) -> solana_instruction::Instruction {
135    let accounts = UpdateMinDeployUsdAmount {
136                              authority: self.authority.expect("authority is not set"),
137                                        satrush_config: self.satrush_config.expect("satrush_config is not set"),
138                      };
139          let args = UpdateMinDeployUsdAmountInstructionArgs {
140                                                              new_min_deploy_usd_amount: self.new_min_deploy_usd_amount.clone().expect("new_min_deploy_usd_amount is not set"),
141                                    };
142    
143    accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts)
144  }
145}
146
147  /// `update_min_deploy_usd_amount` CPI accounts.
148  pub struct UpdateMinDeployUsdAmountCpiAccounts<'a, 'b> {
149          
150                    
151              pub authority: &'b solana_account_info::AccountInfo<'a>,
152                
153                    
154              pub satrush_config: &'b solana_account_info::AccountInfo<'a>,
155            }
156
157/// `update_min_deploy_usd_amount` CPI instruction.
158pub struct UpdateMinDeployUsdAmountCpi<'a, 'b> {
159  /// The program to invoke.
160  pub __program: &'b solana_account_info::AccountInfo<'a>,
161      
162              
163          pub authority: &'b solana_account_info::AccountInfo<'a>,
164          
165              
166          pub satrush_config: &'b solana_account_info::AccountInfo<'a>,
167            /// The arguments for the instruction.
168    pub __args: UpdateMinDeployUsdAmountInstructionArgs,
169  }
170
171impl<'a, 'b> UpdateMinDeployUsdAmountCpi<'a, 'b> {
172  pub fn new(
173    program: &'b solana_account_info::AccountInfo<'a>,
174          accounts: UpdateMinDeployUsdAmountCpiAccounts<'a, 'b>,
175              args: UpdateMinDeployUsdAmountInstructionArgs,
176      ) -> Self {
177    Self {
178      __program: program,
179              authority: accounts.authority,
180              satrush_config: accounts.satrush_config,
181                    __args: args,
182          }
183  }
184  #[inline(always)]
185  pub fn invoke(&self) -> solana_program_error::ProgramResult {
186    self.invoke_signed_with_remaining_accounts(&[], &[])
187  }
188  #[inline(always)]
189  pub fn invoke_with_remaining_accounts(&self, remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)]) -> solana_program_error::ProgramResult {
190    self.invoke_signed_with_remaining_accounts(&[], remaining_accounts)
191  }
192  #[inline(always)]
193  pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult {
194    self.invoke_signed_with_remaining_accounts(signers_seeds, &[])
195  }
196  #[allow(clippy::arithmetic_side_effects)]
197  #[allow(clippy::clone_on_copy)]
198  #[allow(clippy::vec_init_then_push)]
199  pub fn invoke_signed_with_remaining_accounts(
200    &self,
201    signers_seeds: &[&[&[u8]]],
202    remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)]
203  ) -> solana_program_error::ProgramResult {
204    let mut accounts = Vec::with_capacity(2+ remaining_accounts.len());
205                            accounts.push(solana_instruction::AccountMeta::new_readonly(
206            *self.authority.key,
207            true
208          ));
209                                          accounts.push(solana_instruction::AccountMeta::new(
210            *self.satrush_config.key,
211            false
212          ));
213                      remaining_accounts.iter().for_each(|remaining_account| {
214      accounts.push(solana_instruction::AccountMeta {
215          pubkey: *remaining_account.0.key,
216          is_signer: remaining_account.1,
217          is_writable: remaining_account.2,
218      })
219    });
220    let mut data = UpdateMinDeployUsdAmountInstructionData::new().try_to_vec().unwrap();
221          let mut args = self.__args.try_to_vec().unwrap();
222      data.append(&mut args);
223    
224    let instruction = solana_instruction::Instruction {
225      program_id: crate::SATRUSH_ID,
226      accounts,
227      data,
228    };
229    let mut account_infos = Vec::with_capacity(3 + remaining_accounts.len());
230    account_infos.push(self.__program.clone());
231                  account_infos.push(self.authority.clone());
232                        account_infos.push(self.satrush_config.clone());
233              remaining_accounts.iter().for_each(|remaining_account| account_infos.push(remaining_account.0.clone()));
234
235    if signers_seeds.is_empty() {
236      solana_cpi::invoke(&instruction, &account_infos)
237    } else {
238      solana_cpi::invoke_signed(&instruction, &account_infos, signers_seeds)
239    }
240  }
241}
242
243/// Instruction builder for `UpdateMinDeployUsdAmount` via CPI.
244///
245/// ### Accounts:
246///
247                ///   0. `[signer]` authority
248                ///   1. `[writable]` satrush_config
249#[derive(Clone, Debug)]
250pub struct UpdateMinDeployUsdAmountCpiBuilder<'a, 'b> {
251  instruction: Box<UpdateMinDeployUsdAmountCpiBuilderInstruction<'a, 'b>>,
252}
253
254impl<'a, 'b> UpdateMinDeployUsdAmountCpiBuilder<'a, 'b> {
255  pub fn new(program: &'b solana_account_info::AccountInfo<'a>) -> Self {
256    let instruction = Box::new(UpdateMinDeployUsdAmountCpiBuilderInstruction {
257      __program: program,
258              authority: None,
259              satrush_config: None,
260                                            new_min_deploy_usd_amount: None,
261                    __remaining_accounts: Vec::new(),
262    });
263    Self { instruction }
264  }
265      #[inline(always)]
266    pub fn authority(&mut self, authority: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
267                        self.instruction.authority = Some(authority);
268                    self
269    }
270      #[inline(always)]
271    pub fn satrush_config(&mut self, satrush_config: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
272                        self.instruction.satrush_config = Some(satrush_config);
273                    self
274    }
275                    #[inline(always)]
276      pub fn new_min_deploy_usd_amount(&mut self, new_min_deploy_usd_amount: u64) -> &mut Self {
277        self.instruction.new_min_deploy_usd_amount = Some(new_min_deploy_usd_amount);
278        self
279      }
280        /// Add an additional account to the instruction.
281  #[inline(always)]
282  pub fn add_remaining_account(&mut self, account: &'b solana_account_info::AccountInfo<'a>, is_writable: bool, is_signer: bool) -> &mut Self {
283    self.instruction.__remaining_accounts.push((account, is_writable, is_signer));
284    self
285  }
286  /// Add additional accounts to the instruction.
287  ///
288  /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not,
289  /// and a `bool` indicating whether the account is a signer or not.
290  #[inline(always)]
291  pub fn add_remaining_accounts(&mut self, accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)]) -> &mut Self {
292    self.instruction.__remaining_accounts.extend_from_slice(accounts);
293    self
294  }
295  #[inline(always)]
296  pub fn invoke(&self) -> solana_program_error::ProgramResult {
297    self.invoke_signed(&[])
298  }
299  #[allow(clippy::clone_on_copy)]
300  #[allow(clippy::vec_init_then_push)]
301  pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult {
302          let args = UpdateMinDeployUsdAmountInstructionArgs {
303                                                              new_min_deploy_usd_amount: self.instruction.new_min_deploy_usd_amount.clone().expect("new_min_deploy_usd_amount is not set"),
304                                    };
305        let instruction = UpdateMinDeployUsdAmountCpi {
306        __program: self.instruction.__program,
307                  
308          authority: self.instruction.authority.expect("authority is not set"),
309                  
310          satrush_config: self.instruction.satrush_config.expect("satrush_config is not set"),
311                          __args: args,
312            };
313    instruction.invoke_signed_with_remaining_accounts(signers_seeds, &self.instruction.__remaining_accounts)
314  }
315}
316
317#[derive(Clone, Debug)]
318struct UpdateMinDeployUsdAmountCpiBuilderInstruction<'a, 'b> {
319  __program: &'b solana_account_info::AccountInfo<'a>,
320            authority: Option<&'b solana_account_info::AccountInfo<'a>>,
321                satrush_config: Option<&'b solana_account_info::AccountInfo<'a>>,
322                        new_min_deploy_usd_amount: Option<u64>,
323        /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`.
324  __remaining_accounts: Vec<(&'b solana_account_info::AccountInfo<'a>, bool, bool)>,
325}
326