Changeset View
Changeset View
Standalone View
Standalone View
src/qt/transactionrecord.h
// Copyright (c) 2011-2016 The Bitcoin Core developers | // Copyright (c) 2011-2016 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#ifndef BITCOIN_QT_TRANSACTIONRECORD_H | #ifndef BITCOIN_QT_TRANSACTIONRECORD_H | ||||
#define BITCOIN_QT_TRANSACTIONRECORD_H | #define BITCOIN_QT_TRANSACTIONRECORD_H | ||||
#include "amount.h" | #include <amount.h> | ||||
#include "primitives/txid.h" | #include <primitives/txid.h> | ||||
#include <QList> | #include <QList> | ||||
#include <QString> | #include <QString> | ||||
class CWallet; | namespace interfaces { | ||||
class CWalletTx; | class Node; | ||||
class Wallet; | |||||
struct WalletTx; | |||||
struct WalletTxStatus; | |||||
} | |||||
/** | /** | ||||
* UI model for transaction status. The transaction status is the part of a | * UI model for transaction status. The transaction status is the part of a | ||||
* transaction that will change over time. | * transaction that will change over time. | ||||
*/ | */ | ||||
class TransactionStatus { | class TransactionStatus { | ||||
public: | public: | ||||
TransactionStatus() | TransactionStatus() | ||||
▲ Show 20 Lines • Show All 85 Lines • ▼ Show 20 Lines | public: | ||||
TransactionRecord(TxId _txid, qint64 _time, Type _type, | TransactionRecord(TxId _txid, qint64 _time, Type _type, | ||||
const std::string &_address, const Amount _debit, | const std::string &_address, const Amount _debit, | ||||
const Amount _credit) | const Amount _credit) | ||||
: txid(_txid), time(_time), type(_type), address(_address), | : txid(_txid), time(_time), type(_type), address(_address), | ||||
debit(_debit), credit(_credit), idx(0) {} | debit(_debit), credit(_credit), idx(0) {} | ||||
/** Decompose CWallet transaction to model transaction records. | /** Decompose CWallet transaction to model transaction records. | ||||
*/ | */ | ||||
static bool showTransaction(const CWalletTx &wtx); | static bool showTransaction(); | ||||
static QList<TransactionRecord> decomposeTransaction(const CWallet *wallet, | static QList<TransactionRecord> | ||||
const CWalletTx &wtx); | decomposeTransaction(const interfaces::WalletTx &wtx); | ||||
/** @name Immutable transaction attributes | /** @name Immutable transaction attributes | ||||
@{*/ | @{*/ | ||||
TxId txid; | TxId txid; | ||||
qint64 time; | qint64 time; | ||||
Type type; | Type type; | ||||
std::string address; | std::string address; | ||||
Amount debit; | Amount debit; | ||||
Show All 12 Lines | public: | ||||
/** Return the unique identifier for this transaction (part) */ | /** Return the unique identifier for this transaction (part) */ | ||||
QString getTxID() const; | QString getTxID() const; | ||||
/** Return the output index of the subtransaction */ | /** Return the output index of the subtransaction */ | ||||
int getOutputIndex() const; | int getOutputIndex() const; | ||||
/** Update status from core wallet tx. | /** Update status from core wallet tx. | ||||
*/ | */ | ||||
void updateStatus(const CWalletTx &wtx); | void updateStatus(const interfaces::WalletTxStatus &wtx, int numBlocks, | ||||
int64_t adjustedTime); | |||||
/** Return whether a status update is needed. | /** Return whether a status update is needed. | ||||
*/ | */ | ||||
bool statusUpdateNeeded() const; | bool statusUpdateNeeded(int numBlocks) const; | ||||
}; | }; | ||||
#endif // BITCOIN_QT_TRANSACTIONRECORD_H | #endif // BITCOIN_QT_TRANSACTIONRECORD_H |