iota_json_rpc_api/
governance.rs1use iota_json_rpc_types::{DelegatedStake, DelegatedTimelockedStake, IotaCommittee, ValidatorApys};
6use iota_open_rpc_macros::open_rpc;
7use iota_types::{
8 base_types::{IotaAddress, ObjectID},
9 iota_serde::BigInt,
10 iota_system_state::iota_system_state_summary::{
11 IotaSystemStateSummary, IotaSystemStateSummaryV1,
12 },
13};
14use jsonrpsee::{core::RpcResult, proc_macros::rpc};
15
16#[open_rpc(namespace = "iotax", tag = "Governance Read API")]
19#[rpc(server, client, namespace = "iotax")]
20pub trait GovernanceReadApi {
21 #[method(name = "getStakesByIds")]
24 async fn get_stakes_by_ids(
25 &self,
26 staked_iota_ids: Vec<ObjectID>,
27 ) -> RpcResult<Vec<DelegatedStake>>;
28
29 #[method(name = "getStakes")]
31 async fn get_stakes(&self, owner: IotaAddress) -> RpcResult<Vec<DelegatedStake>>;
32
33 #[method(name = "getTimelockedStakesByIds")]
36 async fn get_timelocked_stakes_by_ids(
37 &self,
38 timelocked_staked_iota_ids: Vec<ObjectID>,
39 ) -> RpcResult<Vec<DelegatedTimelockedStake>>;
40
41 #[method(name = "getTimelockedStakes")]
43 async fn get_timelocked_stakes(
44 &self,
45 owner: IotaAddress,
46 ) -> RpcResult<Vec<DelegatedTimelockedStake>>;
47
48 #[method(name = "getCommitteeInfo")]
50 async fn get_committee_info(
51 &self,
52 epoch: Option<BigInt<u64>>,
54 ) -> RpcResult<IotaCommittee>;
55
56 #[method(name = "getLatestIotaSystemStateV2")]
60 async fn get_latest_iota_system_state_v2(&self) -> RpcResult<IotaSystemStateSummary>;
61
62 #[method(name = "getLatestIotaSystemState")]
66 #[deprecated(since = "0.11.0", note = "Use get_latest_iota_system_state_v2 instead")]
67 async fn get_latest_iota_system_state(&self) -> RpcResult<IotaSystemStateSummaryV1>;
68
69 #[method(name = "getReferenceGasPrice")]
71 async fn get_reference_gas_price(&self) -> RpcResult<BigInt<u64>>;
72
73 #[method(name = "getValidatorsApy")]
75 async fn get_validators_apy(&self) -> RpcResult<ValidatorApys>;
76}