mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Work on Create and Payment transactions.
This commit is contained in:
@@ -57,8 +57,9 @@ Transaction::Transaction(
|
||||
const NewcoinAddress& naSourceAccount,
|
||||
uint32 uSeq,
|
||||
uint64 uFee,
|
||||
uint32 uSourceTag) :
|
||||
mInLedger(0), mStatus(NEW)
|
||||
uint32 uSourceTag,
|
||||
uint32 uLedger) :
|
||||
mStatus(NEW)
|
||||
{
|
||||
mAccountFrom = naSourceAccount;
|
||||
mFromPubKey = naPublicKey;
|
||||
@@ -78,6 +79,12 @@ Transaction::Transaction(
|
||||
mTransaction->makeITFieldPresent(sfSourceTag);
|
||||
mTransaction->setITFieldU32(sfSourceTag, uSourceTag);
|
||||
}
|
||||
|
||||
if (uLedger)
|
||||
{
|
||||
mTransaction->makeITFieldPresent(sfTargetLedger);
|
||||
mTransaction->setITFieldU32(sfTargetLedger, uLedger);
|
||||
}
|
||||
}
|
||||
|
||||
bool Transaction::sign(const NewcoinAddress& naAccountPrivate)
|
||||
@@ -148,6 +155,41 @@ Transaction::pointer Transaction::sharedClaim(
|
||||
return tResult->setClaim(naPrivateKey, vucGenerator, vucPubKey, vucSignature);
|
||||
}
|
||||
|
||||
//
|
||||
// Create
|
||||
//
|
||||
|
||||
Transaction::pointer Transaction::setCreate(
|
||||
const NewcoinAddress& naPrivateKey,
|
||||
const NewcoinAddress& naCreateAccountID,
|
||||
uint64 uFund)
|
||||
{
|
||||
mTransaction->setITFieldU32(sfFlags, tfCreateAccount);
|
||||
mTransaction->setITFieldAccount(sfDestination, naCreateAccountID);
|
||||
mTransaction->setITFieldU64(sfAmount, uFund);
|
||||
|
||||
sign(naPrivateKey);
|
||||
|
||||
return shared_from_this();
|
||||
}
|
||||
|
||||
Transaction::pointer Transaction::sharedCreate(
|
||||
const NewcoinAddress& naPublicKey, const NewcoinAddress& naPrivateKey,
|
||||
const NewcoinAddress& naSourceAccount,
|
||||
uint32 uSeq,
|
||||
uint64 uFee,
|
||||
uint32 uSourceTag,
|
||||
uint32 uLedger,
|
||||
const NewcoinAddress& naCreateAccountID,
|
||||
uint64 uFund)
|
||||
{
|
||||
pointer tResult = boost::make_shared<Transaction>(ttPAYMENT,
|
||||
naPublicKey, naSourceAccount,
|
||||
uSeq, uFee, uSourceTag, uLedger);
|
||||
|
||||
return tResult->setCreate(naPrivateKey, naCreateAccountID, uFund);
|
||||
}
|
||||
|
||||
//
|
||||
// Payment
|
||||
//
|
||||
@@ -155,18 +197,11 @@ Transaction::pointer Transaction::sharedClaim(
|
||||
Transaction::pointer Transaction::setPayment(
|
||||
const NewcoinAddress& naPrivateKey,
|
||||
const NewcoinAddress& toAccount,
|
||||
uint64 uAmount,
|
||||
uint32 ledger)
|
||||
uint64 uAmount)
|
||||
{
|
||||
mTransaction->setITFieldAccount(sfDestination, toAccount);
|
||||
mTransaction->setITFieldU64(sfAmount, uAmount);
|
||||
|
||||
if (ledger != 0)
|
||||
{
|
||||
mTransaction->makeITFieldPresent(sfTargetLedger);
|
||||
mTransaction->setITFieldU32(sfTargetLedger, ledger);
|
||||
}
|
||||
|
||||
sign(naPrivateKey);
|
||||
|
||||
return shared_from_this();
|
||||
@@ -178,15 +213,15 @@ Transaction::pointer Transaction::sharedPayment(
|
||||
uint32 uSeq,
|
||||
uint64 uFee,
|
||||
uint32 uSourceTag,
|
||||
uint32 uLedger,
|
||||
const NewcoinAddress& toAccount,
|
||||
uint64 uAmount,
|
||||
uint32 ledger)
|
||||
uint64 uAmount)
|
||||
{
|
||||
pointer tResult = boost::make_shared<Transaction>(ttMAKE_PAYMENT,
|
||||
pointer tResult = boost::make_shared<Transaction>(ttPAYMENT,
|
||||
naPublicKey, naSourceAccount,
|
||||
uSeq, uFee, uSourceTag);
|
||||
uSeq, uFee, uSourceTag, uLedger);
|
||||
|
||||
return tResult->setPayment(naPrivateKey, toAccount, uAmount, ledger);
|
||||
return tResult->setPayment(naPrivateKey, toAccount, uAmount);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user