@@ -54,13 +54,17 @@ pub struct DepositStakeWhitelisted {
5454}
5555
5656impl DepositStakeWhitelisted {
57- pub fn instruction ( & self ) -> solana_instruction:: Instruction {
58- self . instruction_with_remaining_accounts ( & [ ] )
57+ pub fn instruction (
58+ & self ,
59+ args : DepositStakeWhitelistedInstructionArgs ,
60+ ) -> solana_instruction:: Instruction {
61+ self . instruction_with_remaining_accounts ( args, & [ ] )
5962 }
6063 #[ allow( clippy:: arithmetic_side_effects) ]
6164 #[ allow( clippy:: vec_init_then_push) ]
6265 pub fn instruction_with_remaining_accounts (
6366 & self ,
67+ args : DepositStakeWhitelistedInstructionArgs ,
6468 remaining_accounts : & [ solana_instruction:: AccountMeta ] ,
6569 ) -> solana_instruction:: Instruction {
6670 let mut accounts = Vec :: with_capacity ( 19 + remaining_accounts. len ( ) ) ;
@@ -134,9 +138,11 @@ impl DepositStakeWhitelisted {
134138 false ,
135139 ) ) ;
136140 accounts. extend_from_slice ( remaining_accounts) ;
137- let data = DepositStakeWhitelistedInstructionData :: new ( )
141+ let mut data = DepositStakeWhitelistedInstructionData :: new ( )
138142 . try_to_vec ( )
139143 . unwrap ( ) ;
144+ let mut args = args. try_to_vec ( ) . unwrap ( ) ;
145+ data. append ( & mut args) ;
140146
141147 solana_instruction:: Instruction {
142148 program_id : crate :: STAKE_DEPOSIT_INTERCEPTOR_ID ,
@@ -168,6 +174,18 @@ impl Default for DepositStakeWhitelistedInstructionData {
168174 }
169175}
170176
177+ #[ derive( BorshSerialize , BorshDeserialize , Clone , Debug , Eq , PartialEq ) ]
178+ #[ cfg_attr( feature = "serde" , derive( serde:: Serialize , serde:: Deserialize ) ) ]
179+ pub struct DepositStakeWhitelistedInstructionArgs {
180+ pub minimum_pool_tokens_out : Option < u64 > ,
181+ }
182+
183+ impl DepositStakeWhitelistedInstructionArgs {
184+ pub ( crate ) fn try_to_vec ( & self ) -> Result < Vec < u8 > , std:: io:: Error > {
185+ borsh:: to_vec ( self )
186+ }
187+ }
188+
171189/// Instruction builder for `DepositStakeWhitelisted`.
172190///
173191/// ### Accounts:
@@ -212,6 +230,7 @@ pub struct DepositStakeWhitelistedBuilder {
212230 stake_program : Option < solana_pubkey:: Pubkey > ,
213231 spl_stake_pool_program : Option < solana_pubkey:: Pubkey > ,
214232 system_program : Option < solana_pubkey:: Pubkey > ,
233+ minimum_pool_tokens_out : Option < u64 > ,
215234 __remaining_accounts : Vec < solana_instruction:: AccountMeta > ,
216235}
217236
@@ -344,6 +363,12 @@ impl DepositStakeWhitelistedBuilder {
344363 self . system_program = Some ( system_program) ;
345364 self
346365 }
366+ /// `[optional argument]`
367+ #[ inline( always) ]
368+ pub fn minimum_pool_tokens_out ( & mut self , minimum_pool_tokens_out : u64 ) -> & mut Self {
369+ self . minimum_pool_tokens_out = Some ( minimum_pool_tokens_out) ;
370+ self
371+ }
347372 /// Add an additional account to the instruction.
348373 #[ inline( always) ]
349374 pub fn add_remaining_account ( & mut self , account : solana_instruction:: AccountMeta ) -> & mut Self {
@@ -398,8 +423,11 @@ impl DepositStakeWhitelistedBuilder {
398423 . system_program
399424 . unwrap_or ( solana_pubkey:: pubkey!( "11111111111111111111111111111111" ) ) ,
400425 } ;
426+ let args = DepositStakeWhitelistedInstructionArgs {
427+ minimum_pool_tokens_out : self . minimum_pool_tokens_out . clone ( ) ,
428+ } ;
401429
402- accounts. instruction_with_remaining_accounts ( & self . __remaining_accounts )
430+ accounts. instruction_with_remaining_accounts ( args , & self . __remaining_accounts )
403431 }
404432}
405433
@@ -487,12 +515,15 @@ pub struct DepositStakeWhitelistedCpi<'a, 'b> {
487515 pub spl_stake_pool_program : & ' b solana_account_info:: AccountInfo < ' a > ,
488516 /// System program
489517 pub system_program : & ' b solana_account_info:: AccountInfo < ' a > ,
518+ /// The arguments for the instruction.
519+ pub __args : DepositStakeWhitelistedInstructionArgs ,
490520}
491521
492522impl < ' a , ' b > DepositStakeWhitelistedCpi < ' a , ' b > {
493523 pub fn new (
494524 program : & ' b solana_account_info:: AccountInfo < ' a > ,
495525 accounts : DepositStakeWhitelistedCpiAccounts < ' a , ' b > ,
526+ args : DepositStakeWhitelistedInstructionArgs ,
496527 ) -> Self {
497528 Self {
498529 __program : program,
@@ -515,6 +546,7 @@ impl<'a, 'b> DepositStakeWhitelistedCpi<'a, 'b> {
515546 stake_program : accounts. stake_program ,
516547 spl_stake_pool_program : accounts. spl_stake_pool_program ,
517548 system_program : accounts. system_program ,
549+ __args : args,
518550 }
519551 }
520552 #[ inline( always) ]
@@ -624,9 +656,11 @@ impl<'a, 'b> DepositStakeWhitelistedCpi<'a, 'b> {
624656 is_writable : remaining_account. 2 ,
625657 } )
626658 } ) ;
627- let data = DepositStakeWhitelistedInstructionData :: new ( )
659+ let mut data = DepositStakeWhitelistedInstructionData :: new ( )
628660 . try_to_vec ( )
629661 . unwrap ( ) ;
662+ let mut args = self . __args . try_to_vec ( ) . unwrap ( ) ;
663+ data. append ( & mut args) ;
630664
631665 let instruction = solana_instruction:: Instruction {
632666 program_id : crate :: STAKE_DEPOSIT_INTERCEPTOR_ID ,
@@ -717,6 +751,7 @@ impl<'a, 'b> DepositStakeWhitelistedCpiBuilder<'a, 'b> {
717751 stake_program : None ,
718752 spl_stake_pool_program : None ,
719753 system_program : None ,
754+ minimum_pool_tokens_out : None ,
720755 __remaining_accounts : Vec :: new ( ) ,
721756 } ) ;
722757 Self { instruction }
@@ -883,6 +918,12 @@ impl<'a, 'b> DepositStakeWhitelistedCpiBuilder<'a, 'b> {
883918 self . instruction . system_program = Some ( system_program) ;
884919 self
885920 }
921+ /// `[optional argument]`
922+ #[ inline( always) ]
923+ pub fn minimum_pool_tokens_out ( & mut self , minimum_pool_tokens_out : u64 ) -> & mut Self {
924+ self . instruction . minimum_pool_tokens_out = Some ( minimum_pool_tokens_out) ;
925+ self
926+ }
886927 /// Add an additional account to the instruction.
887928 #[ inline( always) ]
888929 pub fn add_remaining_account (
@@ -917,6 +958,9 @@ impl<'a, 'b> DepositStakeWhitelistedCpiBuilder<'a, 'b> {
917958 #[ allow( clippy:: clone_on_copy) ]
918959 #[ allow( clippy:: vec_init_then_push) ]
919960 pub fn invoke_signed ( & self , signers_seeds : & [ & [ & [ u8 ] ] ] ) -> solana_program_error:: ProgramResult {
961+ let args = DepositStakeWhitelistedInstructionArgs {
962+ minimum_pool_tokens_out : self . instruction . minimum_pool_tokens_out . clone ( ) ,
963+ } ;
920964 let instruction = DepositStakeWhitelistedCpi {
921965 __program : self . instruction . __program ,
922966
@@ -1002,6 +1046,7 @@ impl<'a, 'b> DepositStakeWhitelistedCpiBuilder<'a, 'b> {
10021046 . instruction
10031047 . system_program
10041048 . expect ( "system_program is not set" ) ,
1049+ __args : args,
10051050 } ;
10061051 instruction. invoke_signed_with_remaining_accounts (
10071052 signers_seeds,
@@ -1032,6 +1077,7 @@ struct DepositStakeWhitelistedCpiBuilderInstruction<'a, 'b> {
10321077 stake_program : Option < & ' b solana_account_info:: AccountInfo < ' a > > ,
10331078 spl_stake_pool_program : Option < & ' b solana_account_info:: AccountInfo < ' a > > ,
10341079 system_program : Option < & ' b solana_account_info:: AccountInfo < ' a > > ,
1080+ minimum_pool_tokens_out : Option < u64 > ,
10351081 /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`.
10361082 __remaining_accounts : Vec < ( & ' b solana_account_info:: AccountInfo < ' a > , bool , bool ) > ,
10371083}
0 commit comments