CatapultServer  v0.5.0.1 (Elephant)
TransferBuilder.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include "TransactionBuilder.h"
24 #include <vector>
25 
26 namespace catapult { namespace builders {
27 
30  public:
31  using Transaction = model::TransferTransaction;
32  using EmbeddedTransaction = model::EmbeddedTransferTransaction;
33 
34  public:
37  TransferBuilder(model::NetworkIdentifier networkIdentifier, const Key& signer);
38 
39  public:
41  void setRecipient(const UnresolvedAddress& recipient);
42 
44  void setMessage(const RawBuffer& message);
45 
47  void addMosaic(const model::UnresolvedMosaic& mosaic);
48 
49  public:
52  size_t size() const;
53 
55  std::unique_ptr<Transaction> build() const;
56 
58  std::unique_ptr<EmbeddedTransaction> buildEmbedded() const;
59 
60  private:
61  template<typename TTransaction>
62  size_t sizeImpl() const;
63 
64  template<typename TTransaction>
65  std::unique_ptr<TTransaction> buildImpl() const;
66 
67  private:
69  std::vector<uint8_t> m_message;
70  std::vector<model::UnresolvedMosaic> m_mosaics;
71  };
72 }}
TransferBuilder.h
catapult::validators::DEFINE_STATEFUL_VALIDATOR
DEFINE_STATEFUL_VALIDATOR(EligibleHarvester, [](const auto &notification, const auto &context) { cache::ImportanceView view(context.Cache.template sub< cache::AccountStateCache >());return view.canHarvest(notification.Signer, context.Height) ? ValidationResult::Success :Failure_Core_Block_Harvester_Ineligible;})
catapult::builders::TransactionBuilder::signer
const Key & signer() const
Returns signer.
Definition: TransactionBuilder.h:41
catapult::model::MosaicT< UnresolvedMosaicId >
AccountRestrictionCache.h
catapult::builders::TransferBuilder::size
size_t size() const
Definition: TransferBuilder.cpp:53
catapult::builders::TransferBuilder::sizeImpl
size_t sizeImpl() const
Definition: TransferBuilder.cpp:66
catapult::builders::TransferBuilder::addMosaic
void addMosaic(const model::UnresolvedMosaic &mosaic)
Adds mosaic to attached mosaics.
Definition: TransferBuilder.cpp:47
catapult::model::AccountRestrictionType::TransactionType
Account restriction type is a transaction type.
ValidatorContext.h
catapult::validators::Notification
model::AccountAddressNotification Notification
Definition: AddressValidator.cpp:27
catapult::builders::TransferBuilder::Transaction
model::TransferTransaction Transaction
Definition: TransferBuilder.h:31
catapult::builders::TransferBuilder::build
std::unique_ptr< Transaction > build() const
Builds a new transfer transaction.
Definition: TransferBuilder.cpp:57
catapult::model::UnresolvedMosaic
MosaicT< UnresolvedMosaicId > UnresolvedMosaic
Definition: Mosaic.h:39
AccountRestrictionView.h
catapult::builders::TransferBuilder::TransferBuilder
TransferBuilder(model::NetworkIdentifier networkIdentifier, const Key &signer)
Definition: TransferBuilder.cpp:25
catapult::builders::TransferBuilder::buildEmbedded
std::unique_ptr< EmbeddedTransaction > buildEmbedded() const
Builds a new embedded transfer transaction.
Definition: TransferBuilder.cpp:61
TransferTransaction.h
catapult::builders::TransferBuilder::m_message
std::vector< uint8_t > m_message
Definition: TransferBuilder.h:69
catapult::builders::TransferBuilder::setRecipient
void setRecipient(const UnresolvedAddress &recipient)
Sets the transaction recipient to recipient.
Definition: TransferBuilder.cpp:32
catapult::builders::TransferBuilder::m_recipient
UnresolvedAddress m_recipient
Definition: TransferBuilder.h:68
Address.h
TransactionBuilder.h
catapult::builders::TransferBuilder
Builder for a transfer transaction.
Definition: TransferBuilder.h:29
catapult::model::PublicKeyToAddress
Address PublicKeyToAddress(const Key &publicKey, NetworkIdentifier networkIdentifier)
Creates an address from a public key (publicKey) for the network identified by networkIdentifier.
Definition: Address.cpp:50
Validators.h
catapult::model::NetworkIdentifier
NetworkIdentifier
Possible network identifiers.
Definition: NetworkInfo.h:45
catapult::builders::TransactionBuilder
Base transaction builder.
Definition: TransactionBuilder.h:31
catapult::builders::TransferBuilder::setMessage
void setMessage(const RawBuffer &message)
Sets the transaction message to message.
Definition: TransferBuilder.cpp:36
CATAPULT_THROW_RUNTIME_ERROR
#define CATAPULT_THROW_RUNTIME_ERROR(MESSAGE)
Macro used to throw a catapult runtime error.
Definition: exceptions.h:167
catapult::validators::ValidationResult::Success
Validation succeeded.
catapult::builders::TransferBuilder::m_mosaics
std::vector< model::UnresolvedMosaic > m_mosaics
Definition: TransferBuilder.h:70
catapult::model::MosaicT::MosaicId
TMosaicId MosaicId
Mosaic id.
Definition: Mosaic.h:32
catapult::builders::TransferBuilder::EmbeddedTransaction
model::EmbeddedTransferTransaction EmbeddedTransaction
Definition: TransferBuilder.h:32
CATAPULT_THROW_INVALID_ARGUMENT
#define CATAPULT_THROW_INVALID_ARGUMENT(MESSAGE)
Macro used to throw a catapult invalid argument.
Definition: exceptions.h:179
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::utils::ByteArray< Key_Size, Key_tag >
catapult::builders::TransferBuilder::buildImpl
std::unique_ptr< TTransaction > buildImpl() const
catapult::builders::TransactionType
model::AggregateTransaction TransactionType
Definition: AggregateTransactionBuilder.cpp:28
catapult::utils::RawBuffer
BasicRawBuffer< const uint8_t > RawBuffer
A const binary buffer.
Definition: RawBuffer.h:62
catapult::builders::TransactionBuilder::InsertSorted
static void InsertSorted(std::vector< T > &vector, const T &element, Predicate orderPredicate)
Definition: TransactionBuilder.h:83