mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-18 13:17:55 +02:00
GUI: TransactionRecord: Add asset field
This commit is contained in:
parent
060ad2f566
commit
ef2f717e67
2 changed files with 11 additions and 4 deletions
|
|
@ -56,17 +56,20 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const interface
|
||||||
// Received by Bitcoin Address
|
// Received by Bitcoin Address
|
||||||
sub.type = TransactionRecord::RecvWithAddress;
|
sub.type = TransactionRecord::RecvWithAddress;
|
||||||
sub.address = EncodeDestination(wtx.txout_address[i]);
|
sub.address = EncodeDestination(wtx.txout_address[i]);
|
||||||
|
sub.asset = wtx.txout_assets[i];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Received by IP connection (deprecated features), or a multisignature or other non-simple transaction
|
// Received by IP connection (deprecated features), or a multisignature or other non-simple transaction
|
||||||
sub.type = TransactionRecord::RecvFromOther;
|
sub.type = TransactionRecord::RecvFromOther;
|
||||||
sub.address = mapValue["from"];
|
sub.address = mapValue["from"];
|
||||||
|
sub.asset = wtx.txout_assets[i];
|
||||||
}
|
}
|
||||||
if (wtx.is_coinbase)
|
if (wtx.is_coinbase)
|
||||||
{
|
{
|
||||||
// Generated
|
// Generated
|
||||||
sub.type = TransactionRecord::Generated;
|
sub.type = TransactionRecord::Generated;
|
||||||
|
sub.asset = wtx.txout_assets[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
parts.append(sub);
|
parts.append(sub);
|
||||||
|
|
@ -101,7 +104,7 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const interface
|
||||||
CAmount nChange = valueFor(wtx.change, ::policyAsset);
|
CAmount nChange = valueFor(wtx.change, ::policyAsset);
|
||||||
|
|
||||||
parts.append(TransactionRecord(hash, nTime, TransactionRecord::SendToSelf, "",
|
parts.append(TransactionRecord(hash, nTime, TransactionRecord::SendToSelf, "",
|
||||||
-(nDebit - nChange) + (nCredit - nChange)));
|
-(nDebit - nChange) + (nCredit - nChange), ::policyAsset));
|
||||||
parts.last().involvesWatchAddress = involvesWatchAddress; // maybe pass to TransactionRecord as constructor argument
|
parts.last().involvesWatchAddress = involvesWatchAddress; // maybe pass to TransactionRecord as constructor argument
|
||||||
}
|
}
|
||||||
else if (fAllFromMe)
|
else if (fAllFromMe)
|
||||||
|
|
@ -125,6 +128,7 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const interface
|
||||||
sub.idx = nOut;
|
sub.idx = nOut;
|
||||||
sub.involvesWatchAddress = involvesWatchAddress;
|
sub.involvesWatchAddress = involvesWatchAddress;
|
||||||
sub.amount = -wtx.txout_amounts[nOut];
|
sub.amount = -wtx.txout_amounts[nOut];
|
||||||
|
sub.asset = wtx.txout_assets[nOut];
|
||||||
|
|
||||||
if (!boost::get<CNoDestination>(&wtx.txout_address[nOut]))
|
if (!boost::get<CNoDestination>(&wtx.txout_address[nOut]))
|
||||||
{
|
{
|
||||||
|
|
@ -146,6 +150,7 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const interface
|
||||||
TransactionRecord sub(hash, nTime);
|
TransactionRecord sub(hash, nTime);
|
||||||
sub.type = TransactionRecord::Fee;
|
sub.type = TransactionRecord::Fee;
|
||||||
sub.amount = -nTxFee;
|
sub.amount = -nTxFee;
|
||||||
|
sub.asset = ::policyAsset;
|
||||||
parts.append(sub);
|
parts.append(sub);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -154,7 +159,7 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const interface
|
||||||
//
|
//
|
||||||
// Mixed debit transaction, can't break down payees
|
// Mixed debit transaction, can't break down payees
|
||||||
//
|
//
|
||||||
parts.append(TransactionRecord(hash, nTime, TransactionRecord::Other, "", nNet));
|
parts.append(TransactionRecord(hash, nTime, TransactionRecord::Other, "", nNet, CAsset()));
|
||||||
parts.last().involvesWatchAddress = involvesWatchAddress;
|
parts.last().involvesWatchAddress = involvesWatchAddress;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
#define BITCOIN_QT_TRANSACTIONRECORD_H
|
#define BITCOIN_QT_TRANSACTIONRECORD_H
|
||||||
|
|
||||||
#include <amount.h>
|
#include <amount.h>
|
||||||
|
#include <asset.h>
|
||||||
#include <uint256.h>
|
#include <uint256.h>
|
||||||
|
|
||||||
#include <QList>
|
#include <QList>
|
||||||
|
|
@ -101,9 +102,9 @@ public:
|
||||||
|
|
||||||
TransactionRecord(uint256 _hash, qint64 _time,
|
TransactionRecord(uint256 _hash, qint64 _time,
|
||||||
Type _type, const std::string &_address,
|
Type _type, const std::string &_address,
|
||||||
const CAmount& _amount):
|
const CAmount& _amount, const CAsset& _asset):
|
||||||
hash(_hash), time(_time), type(_type), address(_address),
|
hash(_hash), time(_time), type(_type), address(_address),
|
||||||
amount(_amount),
|
amount(_amount), asset(_asset),
|
||||||
idx(0)
|
idx(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
@ -120,6 +121,7 @@ public:
|
||||||
Type type;
|
Type type;
|
||||||
std::string address;
|
std::string address;
|
||||||
CAmount amount;
|
CAmount amount;
|
||||||
|
CAsset asset;
|
||||||
/**@}*/
|
/**@}*/
|
||||||
|
|
||||||
/** Subtransaction index, for sort key */
|
/** Subtransaction index, for sort key */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue