Kagome
Polkadot Runtime Engine in C++17
get_block.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_CHAIN_GET_BLOCK_HPP
7 #define KAGOME_CHAIN_GET_BLOCK_HPP
8 
10 
12 
13  struct GetBlock final : details::RequestType<primitives::BlockData,
14  std::optional<std::string>> {
15  explicit GetBlock(std::shared_ptr<ChainApi> &api) : api_(api) {}
16 
17  outcome::result<primitives::BlockData> execute() override {
18  if (const auto &param_0 = getParam<0>()) {
19  return api_->getBlock(*param_0);
20  }
21  return api_->getBlock();
22  }
23 
24  private:
25  std::shared_ptr<ChainApi> api_;
26  };
27 
28 } // namespace kagome::api::chain::request
29 
30 #endif // KAGOME_CHAIN_GET_BLOCK_HPP
std::shared_ptr< ChainApi > api_
Definition: get_block.hpp:25
GetBlock(std::shared_ptr< ChainApi > &api)
Definition: get_block.hpp:15
outcome::result< primitives::BlockData > execute() override
Definition: get_block.hpp:17