hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
transaction_sequence_builder.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_TRANSACTION_SEQUENCE_BUILDER_HPP
7 #define IROHA_TRANSACTION_SEQUENCE_BUILDER_HPP
8 
12 #include "module/irohad/common/validators_config.hpp"
13 
14 namespace shared_model {
15  namespace proto {
16 
21  template <typename SV>
22  class [[deprecated]] TransportBuilder<interface::TransactionSequence, SV> {
24  SV stateless_validator,
25  std::shared_ptr<validation::ValidatorsConfig> config)
26  : stateless_validator_(std::move(stateless_validator)),
27  validators_config_(std::move(config)) {}
28 
29  public:
30  // we do such default initialization only because it is deprecated and
31  // used only in tests
33  std::shared_ptr<validation::ValidatorsConfig> config)
35  SV(iroha::test::kTestsValidatorsConfig), std::move(config)) {}
36 
43  template <class T>
44  iroha::expected::Result<interface::TransactionSequence, std::string>
45  build(const T &transport) {
46  const auto &txs = transport.transactions();
47  std::vector<std::shared_ptr<interface::Transaction>> shm_txs;
48  std::transform(txs.begin(),
49  txs.end(),
50  std::back_inserter(shm_txs),
51  [](const iroha::protocol::Transaction &tx) {
52  return std::make_shared<Transaction>(tx);
53  });
55  shm_txs,
56  stateless_validator_,
57  validation::FieldValidator(validators_config_));
58  }
59 
60  private:
61  SV stateless_validator_;
62  std::shared_ptr<validation::ValidatorsConfig> validators_config_;
63  };
64  } // namespace proto
65 } // namespace shared_model
66 #endif // IROHA_TRANSACTION_SEQUENCE_BUILDER_HPP
Definition: transport_builder.hpp:22
iroha::expected::Result< interface::TransactionSequence, std::string > build(const T &transport)
Definition: transaction_sequence_builder.hpp:45
Definition: field_validator.hpp:33
static iroha::expected::Result< TransactionSequence, std::string > createTransactionSequence(const types::SharedTxsCollectionType &transactions, const validation::TransactionsCollectionValidator< TransactionValidator > &validator, const FieldValidator &field_validator)
Definition: transaction_sequence_factory.cpp:34
Definition: command_executor.hpp:12