Skip to main content

Api

pub trait Api:
    Send
    + Sync
    + 'static {
    type BlockSubscriptionStream: Stream<Item = Result<BlockSubscriptionResponse, Status>> + Send + 'static;

    // Required methods
    fn status<'life0, 'async_trait>(
        &'life0 self,
        request: Request<()>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<ValidatorStatus>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn submit_proven_transaction<'life0, 'async_trait>(
        &'life0 self,
        request: Request<ProvenTransaction>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<()>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn sign_block<'life0, 'async_trait>(
        &'life0 self,
        request: Request<ProposedBlock>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<SignBlockResponse>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn block_subscription<'life0, 'async_trait>(
        &'life0 self,
        request: Request<BlockSubscriptionRequest>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<Self::BlockSubscriptionStream>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Generated trait containing gRPC methods that should be implemented for use with ApiServer.

Required Associated Types§

Source

type BlockSubscriptionStream: Stream<Item = Result<BlockSubscriptionResponse, Status>> + Send + 'static

Server streaming response type for the BlockSubscription method.

Required Methods§

Source

fn status<'life0, 'async_trait>( &'life0 self, request: Request<()>, ) -> Pin<Box<dyn Future<Output = Result<Response<ValidatorStatus>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns the status info of the validator.

Source

fn submit_proven_transaction<'life0, 'async_trait>( &'life0 self, request: Request<ProvenTransaction>, ) -> Pin<Box<dyn Future<Output = Result<Response<()>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Submits a transaction to the validator.

Source

fn sign_block<'life0, 'async_trait>( &'life0 self, request: Request<ProposedBlock>, ) -> Pin<Box<dyn Future<Output = Result<Response<SignBlockResponse>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Validates and signs a proposed block, returning the signature and the signed block commitment.

Source

fn block_subscription<'life0, 'async_trait>( &'life0 self, request: Request<BlockSubscriptionRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<Self::BlockSubscriptionStream>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Streams signed blocks starting from the given block number (inclusive).

Replays backed-up blocks first, then streams live blocks as they are signed. Unlike the RPC block subscription, the blocks streamed here carry no proofs; they must be commissioned separately as part of recovery.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§