iota_json_rpc_api/
governance.rs1use iota_json_rpc_types::{
6 DelegatedStake, DelegatedTimelockedStake, IotaCommittee, IotaSystemStateSummary,
7 IotaSystemStateSummaryV1, ValidatorApys,
8 iota_primitives::{Address as AddressSchema, ObjectId as ObjectIdSchema},
9};
10use iota_open_rpc_macros::open_rpc;
11use iota_sdk_types::{Address, ObjectId};
12use iota_types::iota_serde::BigInt;
13use jsonrpsee::{core::RpcResult, proc_macros::rpc};
14
15#[open_rpc(namespace = "iotax", tag = "Governance Read API")]
18#[rpc(server, client, namespace = "iotax")]
19pub trait GovernanceReadApi {
20 #[method(name = "getStakesByIds")]
23 async fn get_stakes_by_ids(
24 &self,
25 #[schemars(with = "Vec<ObjectIdSchema>")] staked_iota_ids: Vec<ObjectId>,
26 ) -> RpcResult<Vec<DelegatedStake>>;
27
28 #[method(name = "getStakes")]
30 async fn get_stakes(
31 &self,
32 #[schemars(with = "AddressSchema")] owner: Address,
33 ) -> RpcResult<Vec<DelegatedStake>>;
34
35 #[method(name = "getTimelockedStakesByIds")]
38 async fn get_timelocked_stakes_by_ids(
39 &self,
40 #[schemars(with = "Vec<ObjectIdSchema>")] timelocked_staked_iota_ids: Vec<ObjectId>,
41 ) -> RpcResult<Vec<DelegatedTimelockedStake>>;
42
43 #[method(name = "getTimelockedStakes")]
45 async fn get_timelocked_stakes(
46 &self,
47 #[schemars(with = "AddressSchema")] owner: Address,
48 ) -> RpcResult<Vec<DelegatedTimelockedStake>>;
49
50 #[method(name = "getCommitteeInfo")]
52 async fn get_committee_info(
53 &self,
54 #[schemars(with = "Option<String>")]
56 epoch: Option<BigInt<u64>>,
57 ) -> RpcResult<IotaCommittee>;
58
59 #[method(name = "getLatestIotaSystemStateV2")]
63 async fn get_latest_iota_system_state_v2(&self) -> RpcResult<IotaSystemStateSummary>;
64
65 #[method(name = "getLatestIotaSystemState")]
69 #[deprecated(since = "0.11.0", note = "Use get_latest_iota_system_state_v2 instead")]
70 async fn get_latest_iota_system_state(&self) -> RpcResult<IotaSystemStateSummaryV1>;
71
72 #[method(name = "getReferenceGasPrice")]
74 #[schemars(with = "String")]
75 async fn get_reference_gas_price(&self) -> RpcResult<BigInt<u64>>;
76
77 #[method(name = "getValidatorsApy")]
79 async fn get_validators_apy(&self) -> RpcResult<ValidatorApys>;
80}