CatapultServer  v0.5.0.1 (Elephant)
AccountLinkBuilder.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::AccountLinkTransaction;
31  using EmbeddedTransaction = model::EmbeddedAccountLinkTransaction;
32 
33  public:
36  AccountLinkBuilder(model::NetworkIdentifier networkIdentifier, const Key& signer);
37 
38  public:
40  void setRemoteAccountKey(const Key& remoteAccountKey);
41 
43  void setLinkAction(model::AccountLinkAction linkAction);
44 
45  public:
48  size_t size() const;
49 
51  std::unique_ptr<Transaction> build() const;
52 
54  std::unique_ptr<EmbeddedTransaction> buildEmbedded() const;
55 
56  private:
57  template<typename TTransaction>
58  size_t sizeImpl() const;
59 
60  template<typename TTransaction>
61  std::unique_ptr<TTransaction> buildImpl() const;
62 
63  private:
66  };
67 }}
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::builders::AccountLinkBuilder::EmbeddedTransaction
model::EmbeddedAccountLinkTransaction EmbeddedTransaction
Definition: AccountLinkBuilder.h:31
ValidatorContext.h
catapult::model::AccountLinkAction::Unlink
Unlink account.
catapult::validators::Notification
model::AccountAddressNotification Notification
Definition: AddressValidator.cpp:27
catapult::builders::AccountLinkBuilder::size
size_t size() const
Definition: AccountLinkBuilder.cpp:39
ValidatorUtils.h
catapult::state::AccountType::Unlinked
Account is not linked to another account.
catapult::validators::ValidateLessThanOrEqual
constexpr ValidationResult ValidateLessThanOrEqual(TValue value, TValue maxValue, ValidationResult failureResult)
Validates that value is less than or equal to maxValue and returns failureResult on failure.
Definition: ValidatorUtils.h:28
catapult::builders::AccountLinkBuilder::buildImpl
std::unique_ptr< TTransaction > buildImpl() const
catapult::builders::AccountLinkBuilder
Builder for an account link transaction.
Definition: AccountLinkBuilder.h:28
catapult::builders::AccountLinkBuilder::build
std::unique_ptr< Transaction > build() const
Builds a new account link transaction.
Definition: AccountLinkBuilder.cpp:43
catapult::builders::AccountLinkBuilder::m_remoteAccountKey
Key m_remoteAccountKey
Definition: AccountLinkBuilder.h:64
catapult::builders::AccountLinkBuilder::setRemoteAccountKey
void setRemoteAccountKey(const Key &remoteAccountKey)
Sets the remote account key to remoteAccountKey.
Definition: AccountLinkBuilder.cpp:31
catapult::builders::AccountLinkBuilder::Transaction
model::AccountLinkTransaction Transaction
Definition: AccountLinkBuilder.h:30
TransactionBuilder.h
catapult::builders::AccountLinkBuilder::AccountLinkBuilder
AccountLinkBuilder(model::NetworkIdentifier networkIdentifier, const Key &signer)
Definition: AccountLinkBuilder.cpp:25
catapult::model::AccountLinkAction::Link
Link account.
AccountStateCache.h
catapult::model::NetworkIdentifier
NetworkIdentifier
Possible network identifiers.
Definition: NetworkInfo.h:45
catapult::builders::TransactionBuilder
Base transaction builder.
Definition: TransactionBuilder.h:31
AccountLinkBuilder.h
catapult::validators::ValidationResult::Success
Validation succeeded.
catapult::builders::AccountLinkBuilder::m_linkAction
model::AccountLinkAction m_linkAction
Definition: AccountLinkBuilder.h:65
catapult::builders::AccountLinkBuilder::buildEmbedded
std::unique_ptr< EmbeddedTransaction > buildEmbedded() const
Builds a new embedded account link transaction.
Definition: AccountLinkBuilder.cpp:47
catapult::builders::AccountLinkBuilder::sizeImpl
size_t sizeImpl() const
Definition: AccountLinkBuilder.cpp:52
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::state::AccountType::Main
Account is a balance-holding account that is linked to a remote harvester account.
AccountLinkTransaction.h
catapult::model::AccountLinkAction
AccountLinkAction
Account link transaction action.
Definition: AccountLinkAction.h:27
catapult::validators::DEFINE_STATELESS_VALIDATOR
DEFINE_STATELESS_VALIDATOR(TransactionFee, [](const auto &notification) { if(notification.Fee > notification.MaxFee) return Failure_Core_Invalid_Transaction_Fee;constexpr auto Max_Raw_Block_Fee_Multiplier=static_cast< uint64_t >(std::numeric_limits< BlockFeeMultiplier::ValueType >::max());return notification.MaxFee.unwrap() > Max_Raw_Block_Fee_Multiplier *notification.TransactionSize ? Failure_Core_Invalid_Transaction_Fee :ValidationResult::Success;})
catapult::utils::ByteArray< Key_Size, Key_tag >
catapult::builders::AccountLinkBuilder::setLinkAction
void setLinkAction(model::AccountLinkAction linkAction)
Sets the account link action to linkAction.
Definition: AccountLinkBuilder.cpp:35
catapult::builders::TransactionType
model::AggregateTransaction TransactionType
Definition: AggregateTransactionBuilder.cpp:28