Kagome
Polkadot Runtime Engine in C++17
kagome::api::ChainApi Class Referenceabstract

#include <chain_api.hpp>

Inheritance diagram for kagome::api::ChainApi:
Collaboration diagram for kagome::api::ChainApi:

Public Types

using BlockNumber = primitives::BlockNumber
 
using BlockHash = kagome::primitives::BlockHash
 
using ValueType = boost::variant< BlockNumber, std::string >
 

Public Member Functions

virtual ~ChainApi ()=default
 
virtual void setApiService (const std::shared_ptr< api::ApiService > &api_service)=0
 
virtual outcome::result< BlockHashgetBlockHash () const =0
 
virtual outcome::result< BlockHashgetBlockHash (BlockNumber block_number) const =0
 
virtual outcome::result< BlockHashgetBlockHash (std::string_view hex_number) const =0
 
virtual outcome::result< std::vector< BlockHash > > getBlockHash (gsl::span< const ValueType > values) const =0
 
virtual outcome::result< primitives::BlockHeadergetHeader (std::string_view hash)=0
 
virtual outcome::result< primitives::BlockHeadergetHeader ()=0
 
virtual outcome::result< primitives::BlockDatagetBlock (std::string_view hash)=0
 
virtual outcome::result< primitives::BlockDatagetBlock ()=0
 
virtual outcome::result< primitives::BlockHashgetFinalizedHead () const =0
 
virtual outcome::result< uint32_t > subscribeFinalizedHeads ()=0
 
virtual outcome::result< void > unsubscribeFinalizedHeads (uint32_t subscription_id)=0
 
virtual outcome::result< uint32_t > subscribeNewHeads ()=0
 
virtual outcome::result< void > unsubscribeNewHeads (uint32_t subscription_id)=0
 

Detailed Description

for blockchain api

Definition at line 23 of file chain_api.hpp.

Member Typedef Documentation

using kagome::api::ChainApi::ValueType = boost::variant<BlockNumber, std::string>

Definition at line 28 of file chain_api.hpp.

Constructor & Destructor Documentation

virtual kagome::api::ChainApi::~ChainApi ( )
virtualdefault

Member Function Documentation

virtual outcome::result<primitives::BlockData> kagome::api::ChainApi::getBlock ( std::string_view  hash)
pure virtual
Parameters
hashhex-string of a block to retrieve

Implemented in kagome::api::ChainApiImpl.

virtual outcome::result<primitives::BlockData> kagome::api::ChainApi::getBlock ( )
pure virtual

Returns header of a last finalized block.

Implemented in kagome::api::ChainApiImpl.

virtual outcome::result<BlockHash> kagome::api::ChainApi::getBlockHash ( ) const
pure virtual
Returns
last finalized block hash

Implemented in kagome::api::ChainApiImpl.

virtual outcome::result<BlockHash> kagome::api::ChainApi::getBlockHash ( BlockNumber  block_number) const
pure virtual
Parameters
block_numberblock number
Returns
block hash by number

Implemented in kagome::api::ChainApiImpl.

virtual outcome::result<BlockHash> kagome::api::ChainApi::getBlockHash ( std::string_view  hex_number) const
pure virtual
Parameters
hex_numberhex-encoded block number
Returns
block hash by number

Implemented in kagome::api::ChainApiImpl.

virtual outcome::result<std::vector<BlockHash> > kagome::api::ChainApi::getBlockHash ( gsl::span< const ValueType values) const
pure virtual
Parameters
valuesmixed values array either of block number of hex-encoded block number as string
Returns
array of block hashes for numbers

Implemented in kagome::api::ChainApiImpl.

virtual outcome::result<primitives::BlockHash> kagome::api::ChainApi::getFinalizedHead ( ) const
pure virtual

Get hash of the last finalized block in the canon chain.

Returns
The hash of the last finalized block

Implemented in kagome::api::ChainApiImpl.

virtual outcome::result<primitives::BlockHeader> kagome::api::ChainApi::getHeader ( std::string_view  hash)
pure virtual
Parameters
hashhex-string of a block to retrieve

Implemented in kagome::api::ChainApiImpl.

virtual outcome::result<primitives::BlockHeader> kagome::api::ChainApi::getHeader ( )
pure virtual

Returns header of a last finalized block.

Implemented in kagome::api::ChainApiImpl.

virtual void kagome::api::ChainApi::setApiService ( const std::shared_ptr< api::ApiService > &  api_service)
pure virtual

Implemented in kagome::api::ChainApiImpl.

virtual outcome::result<uint32_t> kagome::api::ChainApi::subscribeFinalizedHeads ( )
pure virtual

Subscribes to events of Finalized Heads type.

Returns
id of the subscription

Implemented in kagome::api::ChainApiImpl.

virtual outcome::result<uint32_t> kagome::api::ChainApi::subscribeNewHeads ( )
pure virtual

Subscribes to events of New Heads type

Returns
id of the subscription

Implemented in kagome::api::ChainApiImpl.

virtual outcome::result<void> kagome::api::ChainApi::unsubscribeFinalizedHeads ( uint32_t  subscription_id)
pure virtual

Unsubscribes from events of Finalized Heads type.

Implemented in kagome::api::ChainApiImpl.

virtual outcome::result<void> kagome::api::ChainApi::unsubscribeNewHeads ( uint32_t  subscription_id)
pure virtual

Unsubscribes from events of New Heads type.

Implemented in kagome::api::ChainApiImpl.


The documentation for this class was generated from the following file: