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§
Sourcefn get_best_block_hash(&self) -> Result<BlockHash, Error>
fn get_best_block_hash(&self) -> Result<BlockHash, Error>
Returns the hash of the best (tip) block in the most-work fully-validated chain.
Sourcefn get_blockchain_info(&self) -> Result<GetBlockchainInfo, Error>
fn get_blockchain_info(&self) -> Result<GetBlockchainInfo, Error>
Returns an object containing various state info regarding blockchain processing.
Sourcefn get_block_count(&self) -> Result<u32, Error>
fn get_block_count(&self) -> Result<u32, Error>
Returns the height of the most-work fully-validated chain.
Sourcefn get_block_hash(&self, height: u32) -> Result<BlockHash, Error>
fn get_block_hash(&self, height: u32) -> Result<BlockHash, Error>
Returns hash of block in best-block-chain at height provided.
Sourcefn get_block(
&self,
blockhash: BlockHash,
verbosity: Option<u8>,
) -> Result<Value, Error>
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.
Provided Methods§
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.