Kagome
Polkadot Runtime Engine in C++17
payment_api_impl.cpp
Go to the documentation of this file.
1 
7 
10 #include "scale/types.hpp"
11 
12 namespace kagome::api {
13 
15  std::shared_ptr<runtime::TransactionPaymentApi> api,
16  std::shared_ptr<const blockchain::BlockTree> block_tree)
17  : api_(std::move(api)), block_tree_{std::move(block_tree)} {
18  BOOST_ASSERT(api_);
19  BOOST_ASSERT(block_tree_);
20  }
21 
22  outcome::result<primitives::RuntimeDispatchInfo> PaymentApiImpl::queryInfo(
23  const primitives::Extrinsic &extrinsic,
24  uint32_t len,
25  OptionalHashRef at) const {
26  if (at.has_value()) {
27  return api_->query_info(at.value(), extrinsic, len);
28  }
29  return api_->query_info(block_tree_->deepestLeaf().hash, extrinsic, len);
30  }
31 
32 } // namespace kagome::api
STL namespace.
std::shared_ptr< const blockchain::BlockTree > block_tree_
std::optional< std::reference_wrapper< const common::Hash256 >> OptionalHashRef
Definition: payment_api.hpp:21
std::shared_ptr< runtime::TransactionPaymentApi > api_
Extrinsic class represents extrinsic.
Definition: extrinsic.hpp:24
PaymentApiImpl(std::shared_ptr< runtime::TransactionPaymentApi > api, std::shared_ptr< const blockchain::BlockTree > block_tree)
outcome::result< primitives::RuntimeDispatchInfo > queryInfo(const primitives::Extrinsic &extrinsic, uint32_t len, OptionalHashRef at) const override