Add GetMinimumDelegation stake program instruction (#24020)
This commit is contained in:
@ -222,6 +222,15 @@ pub enum StakeInstruction {
|
||||
/// 1. `[SIGNER]` Lockup authority or withdraw authority
|
||||
/// 2. Optional: `[SIGNER]` New lockup authority
|
||||
SetLockupChecked(LockupCheckedArgs),
|
||||
|
||||
/// Get the minimum stake delegation, in lamports
|
||||
///
|
||||
/// # Account references
|
||||
/// None
|
||||
///
|
||||
/// The minimum delegation will be returned via the transaction context's returndata.
|
||||
/// Use `get_return_data()` to retrieve the result.
|
||||
GetMinimumDelegation,
|
||||
}
|
||||
|
||||
#[derive(Default, Debug, Serialize, Deserialize, PartialEq, Clone, Copy)]
|
||||
@ -678,6 +687,14 @@ pub fn set_lockup_checked(
|
||||
)
|
||||
}
|
||||
|
||||
pub fn get_minimum_delegation() -> Instruction {
|
||||
Instruction::new_with_bincode(
|
||||
id(),
|
||||
&StakeInstruction::GetMinimumDelegation,
|
||||
Vec::default(),
|
||||
)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use {super::*, crate::instruction::InstructionError};
|
||||
|
@ -6,7 +6,8 @@ pub mod program {
|
||||
crate::declare_id!("Stake11111111111111111111111111111111111111");
|
||||
}
|
||||
|
||||
/// The minimum stake amount that can be delegated, in lamports.
|
||||
/// NOTE: This is also used to calculate the minimum balance of a stake account, which is the
|
||||
/// rent exempt reserve _plus_ the minimum stake delegation.
|
||||
#[deprecated(
|
||||
since = "1.10.6",
|
||||
note = "This constant may be outdated, please use `solana_stake_program::get_minimum_delegation` instead"
|
||||
)]
|
||||
pub const MINIMUM_STAKE_DELEGATION: u64 = 1;
|
||||
|
@ -339,6 +339,10 @@ pub mod stake_split_uses_rent_sysvar {
|
||||
solana_sdk::declare_id!("FQnc7U4koHqWgRvFaBJjZnV8VPg6L6wWK33yJeDp4yvV");
|
||||
}
|
||||
|
||||
pub mod add_get_minimum_delegation_instruction_to_stake_program {
|
||||
solana_sdk::declare_id!("St8k9dVXP97xT6faW24YmRSYConLbhsMJA4TJTBLmMT");
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
/// Map of feature identifiers to user-visible description
|
||||
pub static ref FEATURE_NAMES: HashMap<Pubkey, &'static str> = [
|
||||
@ -418,6 +422,7 @@ lazy_static! {
|
||||
(disable_deprecated_loader::id(), "disable the deprecated BPF loader"),
|
||||
(check_slice_translation_size::id(), "check size when translating slices"),
|
||||
(stake_split_uses_rent_sysvar::id(), "stake split instruction uses rent sysvar"),
|
||||
(add_get_minimum_delegation_instruction_to_stake_program::id(), "add GetMinimumDelegation instruction to stake program"),
|
||||
/*************** ADD NEW FEATURES HERE ***************/
|
||||
]
|
||||
.iter()
|
||||
|
Reference in New Issue
Block a user