use jsonrpsee::core::{RpcResult, SubscriptionResult};
use jsonrpsee::proc_macros::rpc;
use massa_api_exports::page::PagedVecV2;
use massa_api_exports::ApiRequest;
use massa_models::address::Address;
use massa_models::block_id::BlockId;
use massa_models::version::Version;
#[rpc(server)]
pub trait MassaApi {
#[method(name = "get_largest_stakers")]
async fn get_largest_stakers(
&self,
page_request: Option<ApiRequest>,
) -> RpcResult<PagedVecV2<(Address, u64)>>;
#[method(name = "get_next_block_best_parents")]
async fn get_next_block_best_parents(&self) -> RpcResult<Vec<(BlockId, u64)>>;
#[method(name = "get_version")]
async fn get_version(&self) -> RpcResult<Version>;
#[subscription(
name = "subscribe_new_blocks" => "new_blocks",
unsubscribe = "unsubscribe_new_blocks",
item = Block
)]
async fn subscribe_new_blocks(&self) -> SubscriptionResult;
#[subscription(
name = "subscribe_new_blocks_headers" => "new_blocks_headers",
unsubscribe = "unsubscribe_new_blocks_headers",
item = SecureShare<BlockHeader, BlockId>
)]
async fn subscribe_new_blocks_headers(&self) -> SubscriptionResult;
#[subscription(
name = "subscribe_new_filled_blocks" => "new_filled_blocks",
unsubscribe = "unsubscribe_new_filled_blocks",
item = FilledBlock
)]
async fn subscribe_new_filled_blocks(&self) -> SubscriptionResult;
#[subscription(
name = "subscribe_new_operations" => "new_operations",
unsubscribe = "unsubscribe_new_operations",
item = Operation
)]
async fn subscribe_new_operations(&self) -> SubscriptionResult;
}