Kagome
Polkadot Runtime Engine in C++17
misc_extension.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_MISC_EXTENSION_HPP
7 #define KAGOME_MISC_EXTENSION_HPP
8 
9 #include <cstdint>
10 #include <functional>
11 #include <memory>
12 
13 #include "log/logger.hpp"
14 #include "outcome/outcome.hpp"
15 #include "runtime/ptr_size.hpp"
16 #include "runtime/types.hpp"
17 
18 namespace kagome::runtime {
19  class CoreApiFactory;
20  class MemoryProvider;
21 } // namespace kagome::runtime
22 
23 namespace kagome::crypto {
24  class Hasher;
25 }
26 
27 namespace kagome::host_api {
28 
32  class MiscExtension final {
33  public:
35  uint64_t chain_id,
36  std::shared_ptr<const crypto::Hasher> hasher,
37  std::shared_ptr<const runtime::MemoryProvider> memory_provider,
38  std::shared_ptr<const runtime::CoreApiFactory> core_provider);
39 
40  ~MiscExtension() = default;
41 
42  runtime::WasmSpan ext_misc_runtime_version_version_1(
43  runtime::WasmSpan data) const;
44 
45  void ext_misc_print_hex_version_1(runtime::WasmSpan data) const;
46 
47  void ext_misc_print_num_version_1(uint64_t value) const;
48 
49  void ext_misc_print_utf8_version_1(runtime::WasmSpan data) const;
50 
51  private:
52  std::shared_ptr<const crypto::Hasher> hasher_;
53  std::shared_ptr<const runtime::MemoryProvider> memory_provider_;
54  std::shared_ptr<const runtime::CoreApiFactory> core_factory_;
56  };
57 
58 } // namespace kagome::host_api
59 
60 #endif // KAGOME_MISC_EXTENSION_HPP
std::shared_ptr< const runtime::CoreApiFactory > core_factory_
std::shared_ptr< const crypto::Hasher > hasher_
std::shared_ptr< soralog::Logger > Logger
Definition: logger.hpp:23
uint64_t WasmSpan
combination of pointer and size, where less significant part represents wasm pointer, and most significant represents size
Definition: types.hpp:31
std::shared_ptr< const runtime::MemoryProvider > memory_provider_