mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Create transactions offer_create & offer_cancel.
This commit is contained in:
@@ -360,7 +360,6 @@ bool NetworkOPs::checkLastClosedLedger(const std::vector<Peer::pointer>& peerLis
|
||||
++ourVC.nodesUsing;
|
||||
ourVC.highNode = theApp->getWallet().getNodePublic();
|
||||
}
|
||||
|
||||
|
||||
for (std::vector<Peer::pointer>::const_iterator it = peerList.begin(), end = peerList.end(); it != end; ++it)
|
||||
{
|
||||
|
||||
@@ -302,6 +302,75 @@ Transaction::pointer Transaction::sharedNicknameSet(
|
||||
return tResult->setNicknameSet(naPrivateKey, uNickname, bSetOffer, saMinimumOffer, vucSignature);
|
||||
}
|
||||
|
||||
//
|
||||
// OfferCreate
|
||||
//
|
||||
|
||||
Transaction::pointer Transaction::setOfferCreate(
|
||||
const NewcoinAddress& naPrivateKey,
|
||||
bool bPassive,
|
||||
const STAmount& saTakerPays,
|
||||
const STAmount& saTakerGets,
|
||||
uint32 uExpiration)
|
||||
{
|
||||
if (bPassive)
|
||||
mTransaction->setITFieldU32(sfFlags, tfPassive);
|
||||
|
||||
mTransaction->setITFieldAmount(sfTakerPays, saTakerPays);
|
||||
mTransaction->setITFieldAmount(sfTakerGets, saTakerGets);
|
||||
mTransaction->setITFieldAccount(sfPaysIssuer, saTakerPays.getIssuer());
|
||||
mTransaction->setITFieldAccount(sfGetsIssuer, saTakerGets.getIssuer());
|
||||
mTransaction->setITFieldU32(sfExpiration, uExpiration);
|
||||
|
||||
sign(naPrivateKey);
|
||||
|
||||
return shared_from_this();
|
||||
}
|
||||
|
||||
Transaction::pointer Transaction::sharedOfferCreate(
|
||||
const NewcoinAddress& naPublicKey, const NewcoinAddress& naPrivateKey,
|
||||
const NewcoinAddress& naSourceAccount,
|
||||
uint32 uSeq,
|
||||
const STAmount& saFee,
|
||||
uint32 uSourceTag,
|
||||
bool bPassive,
|
||||
const STAmount& saTakerPays,
|
||||
const STAmount& saTakerGets,
|
||||
uint32 uExpiration)
|
||||
{
|
||||
pointer tResult = boost::make_shared<Transaction>(ttOFFER_CREATE, naPublicKey, naSourceAccount, uSeq, saFee, uSourceTag);
|
||||
|
||||
return tResult->setOfferCreate(naPrivateKey, bPassive, saTakerPays, saTakerGets, uExpiration);
|
||||
}
|
||||
|
||||
//
|
||||
// OfferCancel
|
||||
//
|
||||
|
||||
Transaction::pointer Transaction::setOfferCancel(
|
||||
const NewcoinAddress& naPrivateKey,
|
||||
uint32 uSequence)
|
||||
{
|
||||
mTransaction->setITFieldU32(sfSequence, uSequence);
|
||||
|
||||
sign(naPrivateKey);
|
||||
|
||||
return shared_from_this();
|
||||
}
|
||||
|
||||
Transaction::pointer Transaction::sharedOfferCancel(
|
||||
const NewcoinAddress& naPublicKey, const NewcoinAddress& naPrivateKey,
|
||||
const NewcoinAddress& naSourceAccount,
|
||||
uint32 uSeq,
|
||||
const STAmount& saFee,
|
||||
uint32 uSourceTag,
|
||||
uint32 uSequence)
|
||||
{
|
||||
pointer tResult = boost::make_shared<Transaction>(ttOFFER_CANCEL, naPublicKey, naSourceAccount, uSeq, saFee, uSourceTag);
|
||||
|
||||
return tResult->setOfferCancel(naPrivateKey, uSequence);
|
||||
}
|
||||
|
||||
//
|
||||
// PasswordFund
|
||||
//
|
||||
|
||||
@@ -78,6 +78,17 @@ private:
|
||||
const STAmount& saMinimumOffer,
|
||||
const std::vector<unsigned char>& vucSignature);
|
||||
|
||||
Transaction::pointer setOfferCreate(
|
||||
const NewcoinAddress& naPrivateKey,
|
||||
bool bPassive,
|
||||
const STAmount& saTakerPays,
|
||||
const STAmount& saTakerGets,
|
||||
uint32 uExpiration);
|
||||
|
||||
Transaction::pointer setOfferCancel(
|
||||
const NewcoinAddress& naPrivateKey,
|
||||
uint32 uSequence);
|
||||
|
||||
Transaction::pointer setPasswordFund(
|
||||
const NewcoinAddress& naPrivateKey,
|
||||
const NewcoinAddress& naDstAccountID);
|
||||
@@ -200,6 +211,27 @@ public:
|
||||
const STAmount& saSendMax,
|
||||
const STPathSet& saPaths);
|
||||
|
||||
// Place an offer.
|
||||
static Transaction::pointer sharedOfferCreate(
|
||||
const NewcoinAddress& naPublicKey, const NewcoinAddress& naPrivateKey,
|
||||
const NewcoinAddress& naSourceAccount,
|
||||
uint32 uSeq,
|
||||
const STAmount& saFee,
|
||||
uint32 uSourceTag,
|
||||
bool bPassive,
|
||||
const STAmount& saTakerPays,
|
||||
const STAmount& saTakerGets,
|
||||
uint32 uExpiration);
|
||||
|
||||
// Cancel an offer
|
||||
static Transaction::pointer sharedOfferCancel(
|
||||
const NewcoinAddress& naPublicKey, const NewcoinAddress& naPrivateKey,
|
||||
const NewcoinAddress& naSourceAccount,
|
||||
uint32 uSeq,
|
||||
const STAmount& saFee,
|
||||
uint32 uSourceTag,
|
||||
uint32 uSequence);
|
||||
|
||||
// Add an account to a wallet.
|
||||
static Transaction::pointer sharedWalletAdd(
|
||||
const NewcoinAddress& naPublicKey, const NewcoinAddress& naPrivateKey,
|
||||
|
||||
Reference in New Issue
Block a user