iota_json_rpc_api/
governance.rs1use iota_json_rpc_types::{
6 DelegatedStake, DelegatedTimelockedStake, IotaCommittee, IotaSystemStateSummary,
7 IotaSystemStateSummaryV1, ValidatorApys,
8 iota_primitives::{IotaAddress as IotaAddressSchema, ObjectID as ObjectIDSchema},
9};
10use iota_open_rpc_macros::open_rpc;
11use iota_types::{
12 base_types::{IotaAddress, ObjectID},
13 iota_serde::BigInt,
14};
15use jsonrpsee::{core::RpcResult, proc_macros::rpc};
16
17#[open_rpc(namespace = "iotax", tag = "Governance Read API")]
20#[rpc(server, client, namespace = "iotax")]
21pub trait GovernanceReadApi {
22 #[method(name = "getStakesByIds")]
25 async fn get_stakes_by_ids(
26 &self,
27 #[schemars(with = "Vec<ObjectIDSchema>")] staked_iota_ids: Vec<ObjectID>,
28 ) -> RpcResult<Vec<DelegatedStake>>;
29
30 #[method(name = "getStakes")]
32 async fn get_stakes(
33 &self,
34 #[schemars(with = "IotaAddressSchema")] owner: IotaAddress,
35 ) -> RpcResult<Vec<DelegatedStake>>;
36
37 #[method(name = "getTimelockedStakesByIds")]
40 async fn get_timelocked_stakes_by_ids(
41 &self,
42 #[schemars(with = "Vec<ObjectIDSchema>")] timelocked_staked_iota_ids: Vec<ObjectID>,
43 ) -> RpcResult<Vec<DelegatedTimelockedStake>>;
44
45 #[method(name = "getTimelockedStakes")]
47 async fn get_timelocked_stakes(
48 &self,
49 #[schemars(with = "IotaAddressSchema")] owner: IotaAddress,
50 ) -> RpcResult<Vec<DelegatedTimelockedStake>>;
51
52 #[method(name = "getCommitteeInfo")]
54 async fn get_committee_info(
55 &self,
56 #[schemars(with = "Option<String>")]
58 epoch: Option<BigInt<u64>>,
59 ) -> RpcResult<IotaCommittee>;
60
61 #[method(name = "getLatestIotaSystemStateV2")]
65 async fn get_latest_iota_system_state_v2(&self) -> RpcResult<IotaSystemStateSummary>;
66
67 #[method(name = "getLatestIotaSystemState")]
71 #[deprecated(since = "0.11.0", note = "Use get_latest_iota_system_state_v2 instead")]
72 async fn get_latest_iota_system_state(&self) -> RpcResult<IotaSystemStateSummaryV1>;
73
74 #[method(name = "getReferenceGasPrice")]
76 #[schemars(with = "String")]
77 async fn get_reference_gas_price(&self) -> RpcResult<BigInt<u64>>;
78
79 #[method(name = "getValidatorsApy")]
81 async fn get_validators_apy(&self) -> RpcResult<ValidatorApys>;
82}