diff --git a/shared_model/bindings/model_builder.cpp b/shared_model/bindings/model_builder.cpp index 543f9adfbf..7047ce8d93 100644 --- a/shared_model/bindings/model_builder.cpp +++ b/shared_model/bindings/model_builder.cpp @@ -19,29 +19,23 @@ namespace shared_model { namespace bindings { - SimpleBuilder::SimpleBuilder( - const proto::TemplateTransactionBuilder< - (1 << shared_model::proto::TemplateTransactionBuilder<>::total) - 1> - &o) - : builder_(o) {} - - SimpleBuilder SimpleBuilder::creatorAccountId( + ModelBuilder ModelBuilder::creatorAccountId( const interface::types::AccountIdType &account_id) { - return builder_.creatorAccountId(account_id); + return ModelBuilder(builder_.creatorAccountId(account_id)); } - SimpleBuilder SimpleBuilder::txCounter(uint64_t tx_counter) { - return builder_.txCounter(tx_counter); + ModelBuilder ModelBuilder::txCounter(uint64_t tx_counter) { + return ModelBuilder(builder_.txCounter(tx_counter)); } - SimpleBuilder SimpleBuilder::addAssetQuantity( + ModelBuilder ModelBuilder::addAssetQuantity( const interface::types::AccountIdType &account_id, const interface::types::AssetIdType &asset_id, const std::string &amount) { - return builder_.assetQuantity(account_id, asset_id, amount); + return ModelBuilder(builder_.assetQuantity(account_id, asset_id, amount)); } - proto::UnsignedWrapper SimpleBuilder::build() { + proto::UnsignedWrapper ModelBuilder::build() { return builder_.build(); } } // namespace bindings diff --git a/shared_model/bindings/model_builder.hpp b/shared_model/bindings/model_builder.hpp index f39d9f3ca4..a84a54b0ba 100644 --- a/shared_model/bindings/model_builder.hpp +++ b/shared_model/bindings/model_builder.hpp @@ -27,25 +27,21 @@ namespace shared_model { * Wrapper class for transaction builder. Designed only for SWIG bindings, * don't use in other cases. */ - class SimpleBuilder { - public: - SimpleBuilder() = default; + class ModelBuilder { + private: + template + explicit ModelBuilder(const proto::TemplateTransactionBuilder &o) + : builder_(o) {} - /** - * Creates new SimpleBuilder - * @param o - TemplateTransactionBuilder<> instance - */ - SimpleBuilder( - const proto::TemplateTransactionBuilder< - (1 << shared_model::proto::TemplateTransactionBuilder<>::total) - - 1> &o); + public: + ModelBuilder() = default; /** * Sets id of account creator * @param account_id - account id * @return builder with account_id field appended */ - SimpleBuilder creatorAccountId( + ModelBuilder creatorAccountId( const interface::types::AccountIdType &account_id); /** @@ -53,7 +49,7 @@ namespace shared_model { * @param tx_counter - transaction counter * @return builder with tx_counter field appended */ - SimpleBuilder txCounter(uint64_t tx_counter); + ModelBuilder txCounter(uint64_t tx_counter); /** * Adds given quantity of given asset to account @@ -62,7 +58,7 @@ namespace shared_model { * @param amount - amount of asset to add * @return builder with added given quantity of given asset for account */ - SimpleBuilder addAssetQuantity( + ModelBuilder addAssetQuantity( const interface::types::AccountIdType &account_id, const interface::types::AssetIdType &asset_id, const std::string &amount); diff --git a/shared_model/bindings/model_crypto.cpp b/shared_model/bindings/model_crypto.cpp index 935312a422..79b295a645 100644 --- a/shared_model/bindings/model_crypto.cpp +++ b/shared_model/bindings/model_crypto.cpp @@ -21,7 +21,7 @@ namespace shared_model { namespace bindings { - crypto::Keypair SimpleCrypto::generateKeypair() { + crypto::Keypair ModelCrypto::generateKeypair() { return crypto::CryptoProviderEd25519Sha3::generateKeypair(); } } // namespace bindings diff --git a/shared_model/bindings/model_crypto.hpp b/shared_model/bindings/model_crypto.hpp index 73d449b256..f3bb5249c6 100644 --- a/shared_model/bindings/model_crypto.hpp +++ b/shared_model/bindings/model_crypto.hpp @@ -27,7 +27,7 @@ namespace shared_model { /** * Class for crypto operations for SWIG */ - class SimpleCrypto { + class ModelCrypto { public: /** * Generates new keypair (ed25519) diff --git a/shared_model/bindings/model_transaction_proto.cpp b/shared_model/bindings/model_transaction_proto.cpp index ab27f2278e..8d7cf40489 100644 --- a/shared_model/bindings/model_transaction_proto.cpp +++ b/shared_model/bindings/model_transaction_proto.cpp @@ -21,7 +21,7 @@ namespace shared_model { namespace bindings { - crypto::Blob SimpleTransactionProto::signAndAddSignature( + crypto::Blob ModelTransactionProto::signAndAddSignature( proto::UnsignedWrapper &tx, const crypto::Keypair &keypair) { return tx.signAndAddSignature(keypair).blob(); diff --git a/shared_model/bindings/model_transaction_proto.hpp b/shared_model/bindings/model_transaction_proto.hpp index ddec506ec3..fbc3defe2f 100644 --- a/shared_model/bindings/model_transaction_proto.hpp +++ b/shared_model/bindings/model_transaction_proto.hpp @@ -27,7 +27,7 @@ namespace shared_model { /** * Class for proto operations for SWIG */ - class SimpleTransactionProto { + class ModelTransactionProto { public: /** * Signs unsigned transaction and adds signature to its internal proto diff --git a/shared_model/builders/protobuf/unsigned_proto.hpp b/shared_model/builders/protobuf/unsigned_proto.hpp index 36043bf8fd..df1f026069 100644 --- a/shared_model/builders/protobuf/unsigned_proto.hpp +++ b/shared_model/builders/protobuf/unsigned_proto.hpp @@ -36,7 +36,7 @@ namespace shared_model { * Constructs new unsigned object instance * @param o - object received from builder */ - UnsignedWrapper(const T &o) : unsigned_(o) {} + explicit UnsignedWrapper(const T &o) : unsigned_(o) {} /** * Add signature and retrieve signed result