CatapultServer  v0.5.0.1 (Elephant)
SecretLockBuilder.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include "TransactionBuilder.h"
24 
25 namespace catapult { namespace builders {
26 
29  public:
30  using Transaction = model::SecretLockTransaction;
31  using EmbeddedTransaction = model::EmbeddedSecretLockTransaction;
32 
33  public:
36  SecretLockBuilder(model::NetworkIdentifier networkIdentifier, const Key& signer);
37 
38  public:
40  void setMosaic(const model::UnresolvedMosaic& mosaic);
41 
43  void setDuration(BlockDuration duration);
44 
46  void setHashAlgorithm(model::LockHashAlgorithm hashAlgorithm);
47 
49  void setSecret(const Hash256& secret);
50 
52  void setRecipient(const UnresolvedAddress& recipient);
53 
54  public:
57  size_t size() const;
58 
60  std::unique_ptr<Transaction> build() const;
61 
63  std::unique_ptr<EmbeddedTransaction> buildEmbedded() const;
64 
65  private:
66  template<typename TTransaction>
67  size_t sizeImpl() const;
68 
69  template<typename TTransaction>
70  std::unique_ptr<TTransaction> buildImpl() const;
71 
72  private:
78  };
79 }}
catapult::builders::SecretLockBuilder::setMosaic
void setMosaic(const model::UnresolvedMosaic &mosaic)
Sets the lock mosaic to mosaic.
Definition: SecretLockBuilder.cpp:34
catapult::builders::SecretLockBuilder::m_secret
Hash256 m_secret
Definition: SecretLockBuilder.h:76
catapult::builders::TransactionBuilder::signer
const Key & signer() const
Returns signer.
Definition: TransactionBuilder.h:41
catapult::model::MosaicT< UnresolvedMosaicId >
catapult::builders::SecretLockBuilder::sizeImpl
size_t sizeImpl() const
Definition: SecretLockBuilder.cpp:67
catapult::builders::SecretLockBuilder::SecretLockBuilder
SecretLockBuilder(model::NetworkIdentifier networkIdentifier, const Key &signer)
Definition: SecretLockBuilder.cpp:25
catapult::builders::SecretLockBuilder::setHashAlgorithm
void setHashAlgorithm(model::LockHashAlgorithm hashAlgorithm)
Sets the hash alghoritm to hashAlgorithm.
Definition: SecretLockBuilder.cpp:42
catapult::builders::SecretLockBuilder::setSecret
void setSecret(const Hash256 &secret)
Sets the secret to secret.
Definition: SecretLockBuilder.cpp:46
SecretLockTransaction.h
catapult::builders::SecretLockBuilder::m_mosaic
model::UnresolvedMosaic m_mosaic
Definition: SecretLockBuilder.h:73
catapult::builders::SecretLockBuilder::m_hashAlgorithm
model::LockHashAlgorithm m_hashAlgorithm
Definition: SecretLockBuilder.h:75
catapult::utils::BaseValue< uint64_t, BlockDuration_tag >
catapult::builders::SecretLockBuilder::m_duration
BlockDuration m_duration
Definition: SecretLockBuilder.h:74
catapult::builders::SecretLockBuilder::size
size_t size() const
Definition: SecretLockBuilder.cpp:54
catapult::builders::SecretLockBuilder
Builder for a secret lock transaction.
Definition: SecretLockBuilder.h:28
catapult::builders::SecretLockBuilder::buildEmbedded
std::unique_ptr< EmbeddedTransaction > buildEmbedded() const
Builds a new embedded secret lock transaction.
Definition: SecretLockBuilder.cpp:62
catapult::builders::SecretLockBuilder::m_recipient
UnresolvedAddress m_recipient
Definition: SecretLockBuilder.h:77
TransactionBuilder.h
catapult::builders::SecretLockBuilder::EmbeddedTransaction
model::EmbeddedSecretLockTransaction EmbeddedTransaction
Definition: SecretLockBuilder.h:31
catapult::model::NetworkIdentifier
NetworkIdentifier
Possible network identifiers.
Definition: NetworkInfo.h:45
catapult::builders::TransactionBuilder
Base transaction builder.
Definition: TransactionBuilder.h:31
catapult::builders::SecretLockBuilder::setRecipient
void setRecipient(const UnresolvedAddress &recipient)
Sets the recipient of the locked mosaic to recipient.
Definition: SecretLockBuilder.cpp:50
SecretLockBuilder.h
catapult::builders::SecretLockBuilder::build
std::unique_ptr< Transaction > build() const
Builds a new secret lock transaction.
Definition: SecretLockBuilder.cpp:58
catapult::builders::SecretLockBuilder::setDuration
void setDuration(BlockDuration duration)
Sets the number of blocks for which a lock should be valid to duration.
Definition: SecretLockBuilder.cpp:38
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::utils::ByteArray< Key_Size, Key_tag >
catapult::builders::SecretLockBuilder::Transaction
model::SecretLockTransaction Transaction
Definition: SecretLockBuilder.h:30
catapult::builders::SecretLockBuilder::buildImpl
std::unique_ptr< TTransaction > buildImpl() const
catapult::model::LockHashAlgorithm
LockHashAlgorithm
Lock secret hash algorithm.
Definition: LockHashAlgorithm.h:27
catapult::builders::TransactionType
model::AggregateTransaction TransactionType
Definition: AggregateTransactionBuilder.cpp:28