Trait sc_rpc::chain::ChainApiServer
source · pub trait ChainApiServer<Number, Hash, Header, Block>: Sized + Send + Sync + 'staticwhere
Block: Encode,{
// Required methods
fn header(&self, hash: Option<Hash>) -> Result<Option<Header>, Error>;
fn block(
&self,
hash: Option<Hash>,
) -> Result<Option<SignedBlock<Block>>, Error>;
fn block_hash(
&self,
hash: Option<ListOrValue<NumberOrHex>>,
) -> Result<ListOrValue<Option<Hash>>, Error>;
fn finalized_head(&self) -> Result<Hash, Error>;
fn subscribe_all_heads(
&self,
subscription_sink: SubscriptionSink,
) -> Result<(), SubscriptionEmptyError>;
fn subscribe_new_heads(
&self,
subscription_sink: SubscriptionSink,
) -> Result<(), SubscriptionEmptyError>;
fn subscribe_finalized_heads(
&self,
subscription_sink: SubscriptionSink,
) -> Result<(), SubscriptionEmptyError>;
// Provided methods
fn block_bin(&self, hash: Option<Hash>) -> Result<Option<String>, Error> { ... }
fn into_rpc(self) -> RpcModule<Self>
where Number: Send + Sync + 'static,
Hash: Send + Sync + 'static + DeserializeOwned + Serialize,
Header: Send + Sync + 'static + Serialize,
Block: Send + Sync + 'static + Serialize { ... }
}
Expand description
Server trait implementation for the ChainApi
RPC API.
Required Methods§
sourcefn block(&self, hash: Option<Hash>) -> Result<Option<SignedBlock<Block>>, Error>
fn block(&self, hash: Option<Hash>) -> Result<Option<SignedBlock<Block>>, Error>
Get header and body of a block.
sourcefn block_hash(
&self,
hash: Option<ListOrValue<NumberOrHex>>,
) -> Result<ListOrValue<Option<Hash>>, Error>
fn block_hash( &self, hash: Option<ListOrValue<NumberOrHex>>, ) -> Result<ListOrValue<Option<Hash>>, Error>
Get hash of the n-th block in the canon chain.
By default returns latest block hash.
sourcefn finalized_head(&self) -> Result<Hash, Error>
fn finalized_head(&self) -> Result<Hash, Error>
Get hash of the last finalized block in the canon chain.
sourcefn subscribe_all_heads(
&self,
subscription_sink: SubscriptionSink,
) -> Result<(), SubscriptionEmptyError>
fn subscribe_all_heads( &self, subscription_sink: SubscriptionSink, ) -> Result<(), SubscriptionEmptyError>
All head subscription.
sourcefn subscribe_new_heads(
&self,
subscription_sink: SubscriptionSink,
) -> Result<(), SubscriptionEmptyError>
fn subscribe_new_heads( &self, subscription_sink: SubscriptionSink, ) -> Result<(), SubscriptionEmptyError>
New head subscription.
sourcefn subscribe_finalized_heads(
&self,
subscription_sink: SubscriptionSink,
) -> Result<(), SubscriptionEmptyError>
fn subscribe_finalized_heads( &self, subscription_sink: SubscriptionSink, ) -> Result<(), SubscriptionEmptyError>
Finalized head subscription.
Provided Methods§
sourcefn block_bin(&self, hash: Option<Hash>) -> Result<Option<String>, Error>
fn block_bin(&self, hash: Option<Hash>) -> Result<Option<String>, Error>
Get a hex-encoded block.
Object Safety§
This trait is not object safe.