Trait BlockchainApiServer

Source
pub trait BlockchainApiServer:
    Sized
    + Send
    + Sync
    + 'static {
    // Required methods
    fn get_best_block_hash(&self) -> Result<BlockHash, Error>;
    fn get_blockchain_info(&self) -> Result<GetBlockchainInfo, Error>;
    fn get_block_count(&self) -> Result<u32, Error>;
    fn get_block_hash(&self, height: u32) -> Result<BlockHash, Error>;
    fn get_block(
        &self,
        blockhash: BlockHash,
        verbosity: Option<u8>,
    ) -> Result<Value, Error>;
    fn get_block_header(
        &self,
        blockhash: BlockHash,
        verbose: Option<bool>,
    ) -> Result<Value, Error>;

    // Provided method
    fn into_rpc(self) -> RpcModule<Self> { ... }
}
Expand description

Server trait implementation for the BlockchainApi RPC API.

Required Methods§

Source

fn get_best_block_hash(&self) -> Result<BlockHash, Error>

Returns the hash of the best (tip) block in the most-work fully-validated chain.

Source

fn get_blockchain_info(&self) -> Result<GetBlockchainInfo, Error>

Returns an object containing various state info regarding blockchain processing.

Source

fn get_block_count(&self) -> Result<u32, Error>

Returns the height of the most-work fully-validated chain.

Source

fn get_block_hash(&self, height: u32) -> Result<BlockHash, Error>

Returns hash of block in best-block-chain at height provided.

Source

fn get_block( &self, blockhash: BlockHash, verbosity: Option<u8>, ) -> Result<Value, Error>

Returns block data.

If verbosity is 0, returns a hex-encoded serialized block. If verbosity is 1 (default), returns a JSON object with block info and txids. If verbosity is 2, returns a JSON object with block info and full tx data.

Source

fn get_block_header( &self, blockhash: BlockHash, verbose: Option<bool>, ) -> Result<Value, Error>

Returns information about a block header.

If verbose is false (default=true), returns a hex-encoded serialized header. If verbose is true, returns a JSON object with header info.

Provided Methods§

Source

fn into_rpc(self) -> RpcModule<Self>

Collects all the methods and subscriptions defined in the trait and adds them into a single RpcModule.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<Block, Client, TransactionAdapter> BlockchainApiServer for Blockchain<Block, Client, TransactionAdapter>
where Block: BlockT + 'static, Client: HeaderBackend<Block> + BlockBackend<Block> + AuxStore + 'static, TransactionAdapter: BitcoinTransactionAdapter<Block> + Send + Sync + 'static,