diff --git a/client/src/rpc_client.rs b/client/src/rpc_client.rs index fdcdecb624..c45727323d 100644 --- a/client/src/rpc_client.rs +++ b/client/src/rpc_client.rs @@ -7,7 +7,7 @@ use crate::{ RpcConfirmedBlockConfig, RpcConfirmedTransactionConfig, RpcGetConfirmedSignaturesForAddress2Config, RpcLargestAccountsConfig, RpcProgramAccountsConfig, RpcSendTransactionConfig, RpcSimulateTransactionConfig, - RpcTokenAccountsFilter, + RpcStakeConfig, RpcTokenAccountsFilter, }, rpc_request::{RpcError, RpcRequest, RpcResponseErrorData, TokenAccountsFilter}, rpc_response::*, @@ -23,7 +23,7 @@ use solana_account_decoder::{ }; use solana_sdk::{ account::Account, - clock::{Slot, UnixTimestamp, DEFAULT_MS_PER_SLOT, MAX_HASH_AGE_IN_SECONDS}, + clock::{Epoch, Slot, UnixTimestamp, DEFAULT_MS_PER_SLOT, MAX_HASH_AGE_IN_SECONDS}, commitment_config::{CommitmentConfig, CommitmentLevel}, epoch_info::EpochInfo, epoch_schedule::EpochSchedule, @@ -425,6 +425,23 @@ impl RpcClient { }) } + pub fn get_stake_activation( + &self, + stake_account: Pubkey, + epoch: Option, + ) -> ClientResult { + self.send( + RpcRequest::GetStakeActivation, + json!([ + stake_account.to_string(), + RpcStakeConfig { + epoch, + commitment: Some(self.commitment_config), + } + ]), + ) + } + pub fn supply(&self) -> RpcResult { self.supply_with_commitment(self.commitment_config) } diff --git a/client/src/rpc_request.rs b/client/src/rpc_request.rs index 4b6f0717be..25f518edfe 100644 --- a/client/src/rpc_request.rs +++ b/client/src/rpc_request.rs @@ -43,6 +43,7 @@ pub enum RpcRequest { GetStorageTurn, GetStorageTurnRate, GetSlotsPerSegment, + GetStakeActivation, GetStoragePubkeysForSlot, GetSupply, GetTokenAccountBalance, @@ -98,6 +99,7 @@ impl fmt::Display for RpcRequest { RpcRequest::GetSlot => "getSlot", RpcRequest::GetSlotLeader => "getSlotLeader", RpcRequest::GetSlotLeaders => "getSlotLeaders", + RpcRequest::GetStakeActivation => "getStakeActivation", RpcRequest::GetStorageTurn => "getStorageTurn", RpcRequest::GetStorageTurnRate => "getStorageTurnRate", RpcRequest::GetSlotsPerSegment => "getSlotsPerSegment",