Add RpcClient::get_stake_activation()
This commit is contained in:
@ -7,7 +7,7 @@ use crate::{
|
|||||||
RpcConfirmedBlockConfig, RpcConfirmedTransactionConfig,
|
RpcConfirmedBlockConfig, RpcConfirmedTransactionConfig,
|
||||||
RpcGetConfirmedSignaturesForAddress2Config, RpcLargestAccountsConfig,
|
RpcGetConfirmedSignaturesForAddress2Config, RpcLargestAccountsConfig,
|
||||||
RpcProgramAccountsConfig, RpcSendTransactionConfig, RpcSimulateTransactionConfig,
|
RpcProgramAccountsConfig, RpcSendTransactionConfig, RpcSimulateTransactionConfig,
|
||||||
RpcTokenAccountsFilter,
|
RpcStakeConfig, RpcTokenAccountsFilter,
|
||||||
},
|
},
|
||||||
rpc_request::{RpcError, RpcRequest, RpcResponseErrorData, TokenAccountsFilter},
|
rpc_request::{RpcError, RpcRequest, RpcResponseErrorData, TokenAccountsFilter},
|
||||||
rpc_response::*,
|
rpc_response::*,
|
||||||
@ -23,7 +23,7 @@ use solana_account_decoder::{
|
|||||||
};
|
};
|
||||||
use solana_sdk::{
|
use solana_sdk::{
|
||||||
account::Account,
|
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},
|
commitment_config::{CommitmentConfig, CommitmentLevel},
|
||||||
epoch_info::EpochInfo,
|
epoch_info::EpochInfo,
|
||||||
epoch_schedule::EpochSchedule,
|
epoch_schedule::EpochSchedule,
|
||||||
@ -425,6 +425,23 @@ impl RpcClient {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn get_stake_activation(
|
||||||
|
&self,
|
||||||
|
stake_account: Pubkey,
|
||||||
|
epoch: Option<Epoch>,
|
||||||
|
) -> ClientResult<RpcStakeActivation> {
|
||||||
|
self.send(
|
||||||
|
RpcRequest::GetStakeActivation,
|
||||||
|
json!([
|
||||||
|
stake_account.to_string(),
|
||||||
|
RpcStakeConfig {
|
||||||
|
epoch,
|
||||||
|
commitment: Some(self.commitment_config),
|
||||||
|
}
|
||||||
|
]),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn supply(&self) -> RpcResult<RpcSupply> {
|
pub fn supply(&self) -> RpcResult<RpcSupply> {
|
||||||
self.supply_with_commitment(self.commitment_config)
|
self.supply_with_commitment(self.commitment_config)
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,7 @@ pub enum RpcRequest {
|
|||||||
GetStorageTurn,
|
GetStorageTurn,
|
||||||
GetStorageTurnRate,
|
GetStorageTurnRate,
|
||||||
GetSlotsPerSegment,
|
GetSlotsPerSegment,
|
||||||
|
GetStakeActivation,
|
||||||
GetStoragePubkeysForSlot,
|
GetStoragePubkeysForSlot,
|
||||||
GetSupply,
|
GetSupply,
|
||||||
GetTokenAccountBalance,
|
GetTokenAccountBalance,
|
||||||
@ -98,6 +99,7 @@ impl fmt::Display for RpcRequest {
|
|||||||
RpcRequest::GetSlot => "getSlot",
|
RpcRequest::GetSlot => "getSlot",
|
||||||
RpcRequest::GetSlotLeader => "getSlotLeader",
|
RpcRequest::GetSlotLeader => "getSlotLeader",
|
||||||
RpcRequest::GetSlotLeaders => "getSlotLeaders",
|
RpcRequest::GetSlotLeaders => "getSlotLeaders",
|
||||||
|
RpcRequest::GetStakeActivation => "getStakeActivation",
|
||||||
RpcRequest::GetStorageTurn => "getStorageTurn",
|
RpcRequest::GetStorageTurn => "getStorageTurn",
|
||||||
RpcRequest::GetStorageTurnRate => "getStorageTurnRate",
|
RpcRequest::GetStorageTurnRate => "getStorageTurnRate",
|
||||||
RpcRequest::GetSlotsPerSegment => "getSlotsPerSegment",
|
RpcRequest::GetSlotsPerSegment => "getSlotsPerSegment",
|
||||||
|
Reference in New Issue
Block a user