Kagome
Polkadot Runtime Engine in C++17
author_api.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_CORE_API_EXTRINSIC_EXTRINSIC_API_HPP
7 #define KAGOME_CORE_API_EXTRINSIC_EXTRINSIC_API_HPP
8 
9 #include "common/blob.hpp"
10 #include "common/buffer.hpp"
14 
15 namespace kagome::api {
16  class ApiService;
17 }
18 
19 namespace kagome::primitives {
20  struct Extrinsic;
21 }
22 
23 namespace kagome::api {
24  class AuthorApi {
25  protected:
33 
34  public:
35  virtual ~AuthorApi() = default;
36 
37  virtual void setApiService(
38  std::shared_ptr<api::ApiService> const &api_service) = 0;
39 
48  virtual outcome::result<common::Hash256> submitExtrinsic(
49  TransactionSource source, const Extrinsic &extrinsic) = 0;
50 
57  virtual outcome::result<void> insertKey(
58  crypto::KeyTypeId key_type,
59  const gsl::span<const uint8_t> &seed,
60  const gsl::span<const uint8_t> &public_key) = 0;
61 
67  virtual outcome::result<common::Buffer> rotateKeys() = 0;
68 
76  virtual outcome::result<bool> hasSessionKeys(
77  const gsl::span<const uint8_t> &keys) = 0;
78 
85  virtual outcome::result<bool> hasKey(
86  const gsl::span<const uint8_t> &public_key,
87  crypto::KeyTypeId key_type) = 0;
88 
92  virtual outcome::result<std::vector<Extrinsic>> pendingExtrinsics() = 0;
93 
98  virtual outcome::result<std::vector<Extrinsic>> removeExtrinsic(
99  const std::vector<ExtrinsicKey> &keys) = 0;
100 
104  virtual outcome::result<SubscriptionId> submitAndWatchExtrinsic(
105  Extrinsic extrinsic) = 0;
106 
113  virtual outcome::result<bool> unwatchExtrinsic(SubscriptionId sub_id) = 0;
114  };
115 } // namespace kagome::api
116 
117 #endif // KAGOME_CORE_API_EXTRINSIC_EXTRINSIC_API_HPP
Class represents arbitrary (including empty) byte buffer.
Definition: buffer.hpp:29
Blob< 32 > Hash256
Definition: blob.hpp:230
primitives::ExtrinsicKey ExtrinsicKey
Definition: author_api.hpp:31
uint32_t KeyTypeId
Key type identifier.
Definition: key_type.hpp:21
std::optional< std::shared_ptr< Session >> Metadata
Metadata primitive.
SLBuffer< std::numeric_limits< size_t >::max()> Buffer
Definition: buffer.hpp:244
primitives::SubscriptionId SubscriptionId
Definition: author_api.hpp:30
std::vector< uint8_t > ExtrinsicKey
ExtrinsicKey is used as a key to search extrinsic.
Extrinsic class represents extrinsic.
Definition: extrinsic.hpp:24
primitives::Metadata Metadata
Definition: author_api.hpp:29
uint64_t SubscriptionId
SubscriptionId primitive.