diff --git a/src/Transaction.cpp b/src/Transaction.cpp index 4a60814ffb..fb37f53d5a 100644 --- a/src/Transaction.cpp +++ b/src/Transaction.cpp @@ -180,14 +180,13 @@ Transaction::pointer Transaction::setClaim( Transaction::pointer Transaction::sharedClaim( const NewcoinAddress& naPublicKey, const NewcoinAddress& naPrivateKey, - const NewcoinAddress& naSourceAccount, uint32 uSourceTag, const std::vector& vucGenerator, const std::vector& vucPubKey, const std::vector& vucSignature) { pointer tResult = boost::make_shared(ttCLAIM, - naPublicKey, naSourceAccount, + naPublicKey, naPublicKey, 0, // Sequence of 0. 0, // Free. uSourceTag); @@ -262,6 +261,71 @@ Transaction::pointer Transaction::sharedCreditSet( return tResult->setCreditSet(naPrivateKey, naDstAccountID, saLimitAmount, uAcceptRate); } +// +// PasswordFund +// + +Transaction::pointer Transaction::setPasswordFund( + const NewcoinAddress& naPrivateKey, + const NewcoinAddress& naDstAccountID) +{ + sign(naPrivateKey); + + mTransaction->setITFieldAccount(sfDestination, naDstAccountID); + + return shared_from_this(); +} + +Transaction::pointer Transaction::sharedPasswordFund( + const NewcoinAddress& naPublicKey, const NewcoinAddress& naPrivateKey, + const NewcoinAddress& naSourceAccount, + uint32 uSeq, + const STAmount& saFee, + uint32 uSourceTag, + const NewcoinAddress& naDstAccountID) +{ + pointer tResult = boost::make_shared(ttPASSWORD_FUND, naPublicKey, naSourceAccount, uSeq, saFee, uSourceTag); + + return tResult->setPasswordFund(naPrivateKey, naDstAccountID); +} + +// +// PasswordSet +// + +Transaction::pointer Transaction::setPasswordSet( + const NewcoinAddress& naPrivateKey, + const NewcoinAddress& naAuthKeyID, + const std::vector& vucGenerator, + const std::vector& vucPubKey, + const std::vector& vucSignature) +{ + mTransaction->setITFieldAccount(sfDestination, naAuthKeyID); + mTransaction->setITFieldVL(sfGenerator, vucGenerator); + mTransaction->setITFieldVL(sfPubKey, vucPubKey); + mTransaction->setITFieldVL(sfSignature, vucSignature); + + sign(naPrivateKey); + + return shared_from_this(); +} + +Transaction::pointer Transaction::sharedPasswordSet( + const NewcoinAddress& naPublicKey, const NewcoinAddress& naPrivateKey, + uint32 uSourceTag, + const NewcoinAddress& naAuthKeyID, + const std::vector& vucGenerator, + const std::vector& vucPubKey, + const std::vector& vucSignature) +{ + pointer tResult = boost::make_shared(ttPASSWORD_SET, + naPublicKey, naPublicKey, + 0, // Sequence of 0. + 0, // Free. + uSourceTag); + + return tResult->setPasswordSet(naPrivateKey, naAuthKeyID, vucGenerator, vucPubKey, vucSignature); +} // // Payment // diff --git a/src/Transaction.h b/src/Transaction.h index 9f40951ee4..e2dfa915ce 100644 --- a/src/Transaction.h +++ b/src/Transaction.h @@ -71,6 +71,17 @@ private: const STAmount& saLimitAmount, uint32 uAcceptRate); + Transaction::pointer setPasswordFund( + const NewcoinAddress& naPrivateKey, + const NewcoinAddress& naDstAccountID); + + Transaction::pointer setPasswordSet( + const NewcoinAddress& naPrivateKey, + const NewcoinAddress& naAuthKeyID, + const std::vector& vucGenerator, + const std::vector& vucPubKey, + const std::vector& vucSignature); + Transaction::pointer setPayment( const NewcoinAddress& naPrivateKey, const NewcoinAddress& naDstAccountID, @@ -120,7 +131,6 @@ public: // Claim a wallet. static Transaction::pointer sharedClaim( const NewcoinAddress& naPublicKey, const NewcoinAddress& naPrivateKey, - const NewcoinAddress& naSourceAccount, uint32 uSourceTag, const std::vector& vucGenerator, const std::vector& vucPubKey, @@ -147,6 +157,24 @@ public: const STAmount& saLimitAmount, uint32 uAcceptRate); + // Pre-fund password change. + static Transaction::pointer sharedPasswordFund( + const NewcoinAddress& naPublicKey, const NewcoinAddress& naPrivateKey, + const NewcoinAddress& naSourceAccount, + uint32 uSeq, + const STAmount& saFee, + uint32 uSourceTag, + const NewcoinAddress& naDstAccountID); + + // Change a password. + static Transaction::pointer sharedPasswordSet( + const NewcoinAddress& naPublicKey, const NewcoinAddress& naPrivateKey, + uint32 uSourceTag, + const NewcoinAddress& naAuthKeyID, // ID of regular public to auth. + const std::vector& vucGenerator, + const std::vector& vucPubKey, + const std::vector& vucSignature); + // Make a payment. static Transaction::pointer sharedPayment( const NewcoinAddress& naPublicKey, const NewcoinAddress& naPrivateKey,