@@ -1323,6 +1323,62 @@ pub fn decrease_validator_stake_with_vote(
1323
1323
)
1324
1324
}
1325
1325
1326
+ /// Create a `IncreaseAdditionalValidatorStake` instruction given an existing
1327
+ /// stake pool, valiator list and vote account
1328
+ pub fn increase_additional_validator_stake_with_list (
1329
+ program_id : & Pubkey ,
1330
+ stake_pool : & StakePool ,
1331
+ validator_list : & ValidatorList ,
1332
+ stake_pool_address : & Pubkey ,
1333
+ vote_account_address : & Pubkey ,
1334
+ lamports : u64 ,
1335
+ ephemeral_stake_seed : u64 ,
1336
+ ) -> Result < Instruction , ProgramError > {
1337
+ let validator_info = validator_list
1338
+ . find ( vote_account_address)
1339
+ . ok_or ( ProgramError :: InvalidInstructionData ) ?;
1340
+ let transient_stake_seed = u64:: from ( validator_info. transient_seed_suffix ) ;
1341
+ let validator_stake_seed = NonZeroU32 :: new ( validator_info. validator_seed_suffix . into ( ) ) ;
1342
+ Ok ( increase_additional_validator_stake_with_vote (
1343
+ program_id,
1344
+ stake_pool,
1345
+ stake_pool_address,
1346
+ vote_account_address,
1347
+ lamports,
1348
+ validator_stake_seed,
1349
+ transient_stake_seed,
1350
+ ephemeral_stake_seed,
1351
+ ) )
1352
+ }
1353
+
1354
+ /// Create a `DecreaseAdditionalValidatorStake` instruction given an existing
1355
+ /// stake pool, valiator list and vote account
1356
+ pub fn decrease_additional_validator_stake_with_list (
1357
+ program_id : & Pubkey ,
1358
+ stake_pool : & StakePool ,
1359
+ validator_list : & ValidatorList ,
1360
+ stake_pool_address : & Pubkey ,
1361
+ vote_account_address : & Pubkey ,
1362
+ lamports : u64 ,
1363
+ ephemeral_stake_seed : u64 ,
1364
+ ) -> Result < Instruction , ProgramError > {
1365
+ let validator_info = validator_list
1366
+ . find ( vote_account_address)
1367
+ . ok_or ( ProgramError :: InvalidInstructionData ) ?;
1368
+ let transient_stake_seed = u64:: from ( validator_info. transient_seed_suffix ) ;
1369
+ let validator_stake_seed = NonZeroU32 :: new ( validator_info. validator_seed_suffix . into ( ) ) ;
1370
+ Ok ( decrease_additional_validator_stake_with_vote (
1371
+ program_id,
1372
+ stake_pool,
1373
+ stake_pool_address,
1374
+ vote_account_address,
1375
+ lamports,
1376
+ validator_stake_seed,
1377
+ transient_stake_seed,
1378
+ ephemeral_stake_seed,
1379
+ ) )
1380
+ }
1381
+
1326
1382
/// Create a `DecreaseAdditionalValidatorStake` instruction given an existing
1327
1383
/// stake pool and vote account
1328
1384
pub fn decrease_additional_validator_stake_with_vote (
0 commit comments