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