1use jsonrpsee::core::{RpcResult, SubscriptionResult};
4use jsonrpsee::proc_macros::rpc;
5use massa_api_exports::page::PagedVecV2;
6use massa_api_exports::ApiRequest;
7use massa_models::address::Address;
8use massa_models::block_id::BlockId;
9use massa_models::version::Version;
10
11#[rpc(server)]
13pub trait MassaApi {
14 #[method(name = "get_largest_stakers")]
16 async fn get_largest_stakers(
17 &self,
18 page_request: Option<ApiRequest>,
19 ) -> RpcResult<PagedVecV2<(Address, u64)>>;
20
21 #[method(name = "get_next_block_best_parents")]
23 async fn get_next_block_best_parents(&self) -> RpcResult<Vec<(BlockId, u64)>>;
24
25 #[method(name = "get_version")]
27 async fn get_version(&self) -> RpcResult<Version>;
28
29 #[subscription(
31 name = "subscribe_new_blocks" => "new_blocks",
32 unsubscribe = "unsubscribe_new_blocks",
33 item = Block
34 )]
35 async fn subscribe_new_blocks(&self) -> SubscriptionResult;
36
37 #[subscription(
39 name = "subscribe_new_blocks_headers" => "new_blocks_headers",
40 unsubscribe = "unsubscribe_new_blocks_headers",
41 item = SecureShare<BlockHeader, BlockId>
42 )]
43 async fn subscribe_new_blocks_headers(&self) -> SubscriptionResult;
44
45 #[subscription(
47 name = "subscribe_new_filled_blocks" => "new_filled_blocks",
48 unsubscribe = "unsubscribe_new_filled_blocks",
49 item = FilledBlock
50 )]
51 async fn subscribe_new_filled_blocks(&self) -> SubscriptionResult;
52
53 #[subscription(
55 name = "subscribe_new_operations" => "new_operations",
56 unsubscribe = "unsubscribe_new_operations",
57 item = Operation
58 )]
59 async fn subscribe_new_operations(&self) -> SubscriptionResult;
60}