Kagome
Polkadot Runtime Engine in C++17
has_session_keys.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_REQUESTS_HAS_SESSION_KEYS_HPP
7 #define KAGOME_REQUESTS_HAS_SESSION_KEYS_HPP
8 
9 #include <jsonrpc-lean/request.h>
10 
13 #include "outcome/outcome.hpp"
14 
16 
17  class HasSessionKeys final : public details::RequestType<bool, std::string> {
18  public:
19  explicit HasSessionKeys(std::shared_ptr<AuthorApi> api)
20  : api_(std::move(api)) {
21  BOOST_ASSERT(api_);
22  };
23 
24  outcome::result<Return> execute() override {
25  OUTCOME_TRY(keys, common::unhexWith0x(getParam<0>()));
26  return api_->hasSessionKeys(gsl::span(keys.data(), keys.size()));
27  }
28 
29  private:
30  std::shared_ptr<AuthorApi> api_;
31  };
32 
33 } // namespace kagome::api::author::request
34 
35 #endif // KAGOME_REQUESTS_HAS_SESSION_KEYS_HPP
outcome::result< std::vector< uint8_t > > unhexWith0x(std::string_view hex_with_prefix)
Unhex hex-string with 0x in the begining.
Definition: hexutil.cpp:89
STL namespace.
outcome::result< Return > execute() override
HasSessionKeys(std::shared_ptr< AuthorApi > api)