diff --git a/CHANGELOG.md b/CHANGELOG.md index 37850a7b..737d6bf1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Added +- added Delegate Resignation Builder and Tests ([#207]) + ## [1.0.0] - 2020-02-13 ### Changed @@ -129,3 +134,5 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. [#190]: https://github.com/ArkEcosystem/cpp-crypto/pull/190 [#198]: https://github.com/ArkEcosystem/cpp-crypto/pull/198 [1.0.0]: https://github.com/ArkEcosystem/cpp-crypto/compare/0.7.0...1.0.0 +[#207]: https://github.com/ArkEcosystem/cpp-crypto/pull/207 +[unreleased]: https://github.com/ArkEcosystem/cpp-crypto/compare/1.0.0...develop diff --git a/src/include/cpp-crypto/transactions/builders/builder.hpp b/src/include/cpp-crypto/transactions/builders/builder.hpp index 6226868a..79082f1c 100644 --- a/src/include/cpp-crypto/transactions/builders/builder.hpp +++ b/src/include/cpp-crypto/transactions/builders/builder.hpp @@ -17,6 +17,7 @@ // #include "transactions/builders/multi_signature.hpp" #include "transactions/builders/ipfs.hpp" #include "transactions/builders/multi_payment.hpp" +#include "transactions/builders/delegate_resignation.hpp" #include "transactions/builders/htlc_lock.hpp" #include "transactions/builders/htlc_claim.hpp" #include "transactions/builders/htlc_refund.hpp" diff --git a/src/include/cpp-crypto/transactions/builders/delegate_resignation.hpp b/src/include/cpp-crypto/transactions/builders/delegate_resignation.hpp new file mode 100644 index 00000000..ad74249c --- /dev/null +++ b/src/include/cpp-crypto/transactions/builders/delegate_resignation.hpp @@ -0,0 +1,37 @@ +/** + * This file is part of Ark Cpp Crypto. + * + * (c) Ark Ecosystem + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + **/ + +#ifndef ARK_TRANSACTIONS_BUILDERS_DELEGATE_RESIGNATION_HPP +#define ARK_TRANSACTIONS_BUILDERS_DELEGATE_RESIGNATION_HPP + +#include "transactions/builders/common.hpp" + +namespace Ark { +namespace Crypto { +namespace transactions { +namespace builder { + +//////////////////////////////////////////////////////////////////////////////// +// Forward Declaration +class DelegateResignation; + +//////////////////////////////////////////////////////////////////////////////// +class DelegateResignation : public Common { + public: + DelegateResignation() { + this->transaction.data.type = DELEGATE_RESIGNATION_TYPE; + } +}; + +} // namespace builder +} // namespace transactions +} // namespace Crypto +} // namespace Ark + +#endif diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index c8d41d8e..d2456a4a 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -99,6 +99,7 @@ set(TRANSACTIONS_BUILDERS_TEST_SOURCE ${PROJECT_SOURCE_DIR}/transactions/builders/vote.cpp ${PROJECT_SOURCE_DIR}/transactions/builders/ipfs.cpp ${PROJECT_SOURCE_DIR}/transactions/builders/multi_payment.cpp + ${PROJECT_SOURCE_DIR}/transactions/builders/delegate_resignation.cpp ${PROJECT_SOURCE_DIR}/transactions/builders/htlc_lock.cpp ${PROJECT_SOURCE_DIR}/transactions/builders/htlc_claim.cpp ${PROJECT_SOURCE_DIR}/transactions/builders/htlc_refund.cpp diff --git a/test/transactions/builders/delegate_resignation.cpp b/test/transactions/builders/delegate_resignation.cpp new file mode 100644 index 00000000..3abc8429 --- /dev/null +++ b/test/transactions/builders/delegate_resignation.cpp @@ -0,0 +1,34 @@ +/** + * This file is part of Ark Cpp Crypto. + * + * (c) Ark Ecosystem + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + **/ + +#include "gtest/gtest.h" + +#include "transactions/builders/delegate_resignation.hpp" + +#include "interfaces/constants.h" + +#include "fixtures/identity.hpp" +#include "transactions/types/fixtures/delegate_registration.hpp" + +#include "test_helpers.h" + +using namespace Ark::Crypto; +using namespace Ark::Crypto::transactions; + +//////////////////////////////////////////////////////////////////////////////// +TEST(transactions_builders, delegate_resignation) { + auto transaction = builder::DelegateResignation() + .nonce(COMMON_NONCE) + .senderPublicKey(fixtures::PublicKeyBytes.data()) + .fee(TYPE_2_FEE) + .sign(fixtures::Passphrase) + .build(); + + ASSERT_TRUE(transaction.verify()); +}