Kagome
Polkadot Runtime Engine in C++17
system_api_impl.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_API_SYSTEMAPIIMPL
7 #define KAGOME_API_SYSTEMAPIIMPL
8 
10 
12 
13 namespace kagome::transaction_pool {
14  class TransactionPool;
15 }
16 namespace kagome::crypto {
17  class Hasher;
18 }
19 namespace kagome::blockchain {
20  class BlockTree;
21 }
22 
23 namespace kagome::api {
24 
25  class SystemApiImpl final : public SystemApi {
26  public:
28  std::shared_ptr<application::ChainSpec> config,
29  std::shared_ptr<consensus::babe::Babe> babe,
30  std::shared_ptr<network::PeerManager> peer_manager,
31  std::shared_ptr<runtime::AccountNonceApi> account_nonce_api,
32  std::shared_ptr<transaction_pool::TransactionPool> transaction_pool,
33  std::shared_ptr<const blockchain::BlockTree> block_tree,
34  std::shared_ptr<crypto::Hasher> hasher);
35 
36  std::shared_ptr<application::ChainSpec> getConfig() const override;
37 
38  std::shared_ptr<consensus::babe::Babe> getBabe() const override;
39 
40  std::shared_ptr<network::PeerManager> getPeerManager() const override;
41 
46  outcome::result<primitives::AccountNonce> getNonceFor(
47  std::string_view account_address) const override;
48 
49  private:
50  // adjusts the provided nonce considering the pending transactions
51  primitives::AccountNonce adjustNonce(
52  const primitives::AccountId &account_id,
53  primitives::AccountNonce current_nonce) const;
54 
55  std::shared_ptr<application::ChainSpec> config_;
56  std::shared_ptr<consensus::babe::Babe> babe_;
57  std::shared_ptr<network::PeerManager> peer_manager_;
58  std::shared_ptr<runtime::AccountNonceApi> account_nonce_api_;
59  std::shared_ptr<transaction_pool::TransactionPool> transaction_pool_;
60  std::shared_ptr<const blockchain::BlockTree> block_tree_;
61  std::shared_ptr<crypto::Hasher> hasher_;
62  };
63 
64 } // namespace kagome::api
65 
66 #endif // KAGOME_API_SYSTEMAPIIMPL
std::shared_ptr< runtime::AccountNonceApi > account_nonce_api_
std::shared_ptr< transaction_pool::TransactionPool > transaction_pool_
uint32_t AccountNonce
Definition: account.hpp:15
std::shared_ptr< crypto::Hasher > hasher_
std::shared_ptr< consensus::babe::Babe > babe_
std::shared_ptr< const blockchain::BlockTree > block_tree_
crypto::Sr25519PublicKey AccountId
Definition: account.hpp:13
std::shared_ptr< network::PeerManager > peer_manager_
std::shared_ptr< application::ChainSpec > config_