sui_json_rpc_api/
governance.rs1use jsonrpsee::core::RpcResult;
5use jsonrpsee::proc_macros::rpc;
6
7use sui_json_rpc_types::{DelegatedStake, SuiCommittee, ValidatorApys};
8use sui_open_rpc_macros::open_rpc;
9use sui_types::base_types::{ObjectID, SuiAddress};
10use sui_types::sui_serde::BigInt;
11use sui_types::sui_system_state::sui_system_state_summary::SuiSystemStateSummary;
12
13#[open_rpc(namespace = "suix", tag = "Governance Read API")]
14#[rpc(server, client, namespace = "suix")]
15pub trait GovernanceReadApi {
16 #[method(name = "getStakesByIds")]
18 async fn get_stakes_by_ids(
19 &self,
20 staked_sui_ids: Vec<ObjectID>,
21 ) -> RpcResult<Vec<DelegatedStake>>;
22
23 #[method(name = "getStakes")]
25 async fn get_stakes(&self, owner: SuiAddress) -> RpcResult<Vec<DelegatedStake>>;
26
27 #[method(name = "getCommitteeInfo")]
29 async fn get_committee_info(
30 &self,
31 epoch: Option<BigInt<u64>>,
33 ) -> RpcResult<SuiCommittee>;
34
35 #[method(name = "getLatestSuiSystemState")]
37 async fn get_latest_sui_system_state(&self) -> RpcResult<SuiSystemStateSummary>;
38
39 #[method(name = "getReferenceGasPrice")]
41 async fn get_reference_gas_price(&self) -> RpcResult<BigInt<u64>>;
42
43 #[method(name = "getValidatorsApy")]
45 async fn get_validators_apy(&self) -> RpcResult<ValidatorApys>;
46}