PIVX Core  5.6.99
P2P Digital Currency
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
TransactionRecord Class Reference

UI model for a transaction. More...

#include <transactionrecord.h>

Collaboration diagram for TransactionRecord:
[legend]

Public Types

enum  Type : uint16_t {
  Other = 0 , Generated , StakeMint , StakeZPIV ,
  SendToAddress , SendToOther , RecvWithAddress , MNReward ,
  BudgetPayment , RecvFromOther , SendToSelf , ZerocoinMint ,
  ZerocoinSpend , RecvFromZerocoinSpend , ZerocoinSpend_Change_zPiv , ZerocoinSpend_FromMe ,
  StakeDelegated , StakeHot , P2CSDelegation , P2CSDelegationSent ,
  P2CSDelegationSentOwner , P2CSUnlockOwner , P2CSUnlockStaker , SendToShielded ,
  RecvWithShieldedAddress , RecvWithShieldedAddressMemo , SendToSelfShieldedAddress , SendToSelfShieldToTransparent ,
  SendToSelfShieldToShieldChangeAddress , SendToNobody
}
 

Public Member Functions

 TransactionRecord (unsigned int size)
 
 TransactionRecord (uint256 hash, qint64 time, unsigned int size)
 
 TransactionRecord (uint256 hash, qint64 time, unsigned int size, Type type, const std::string &address, const CAmount &debit, const CAmount &credit)
 
int getOutputIndex () const
 Return the output index of the subtransaction
More...
 
void updateStatus (const CWalletTx &wtx, int chainHeight)
 Update status from core wallet tx. More...
 
bool statusUpdateNeeded (int blockHeight) const
 Return whether a status update is needed. More...
 
std::string statusToString ()
 Return transaction status. More...
 
bool isCoinStake () const
 Return true if the tx is a coinstake. More...
 
bool isMNReward () const
 Return true if the tx is a MN reward. More...
 
bool isAnyColdStakingType () const
 Return true if the tx is a any cold staking type tx. More...
 
bool isNull () const
 Return true if the tx hash is null and/or if the size is 0. More...
 

Static Public Member Functions

static QList< TransactionRecorddecomposeTransaction (const CWallet *wallet, const CWalletTx &wtx)
 Decompose CWallet transaction to model transaction records. More...
 
static bool decomposeCoinStake (const CWallet *wallet, const CWalletTx &wtx, const CAmount &nCredit, const CAmount &nDebit, QList< TransactionRecord > &parts)
 Helpers. More...
 
static bool decomposeZcSpendTx (const CWallet *wallet, const CWalletTx &wtx, const CAmount &nCredit, const CAmount &nDebit, QList< TransactionRecord > &parts)
 
static bool decomposeP2CS (const CWallet *wallet, const CWalletTx &wtx, const CAmount &nCredit, const CAmount &nDebit, QList< TransactionRecord > &parts)
 
static bool decomposeCreditTransaction (const CWallet *wallet, const CWalletTx &wtx, QList< TransactionRecord > &parts)
 Decompose a credit transaction into a record for each received output. More...
 
static bool decomposeSendToSelfTransaction (const CWalletTx &wtx, const CAmount &nCredit, const CAmount &nDebit, bool involvesWatchAddress, QList< TransactionRecord > &parts, const CWallet *wallet)
 
static bool decomposeDebitTransaction (const CWallet *wallet, const CWalletTx &wtx, const CAmount &nDebit, bool involvesWatchAddress, QList< TransactionRecord > &parts)
 Decompose wtx outputs in records. More...
 
static bool decomposeShieldedDebitTransaction (const CWallet *wallet, const CWalletTx &wtx, CAmount nTxFee, bool involvesWatchAddress, QList< TransactionRecord > &parts)
 
static std::string getValueOrReturnEmpty (const std::map< std::string, std::string > &mapValue, const std::string &key)
 
static void loadHotOrColdStakeOrContract (const CWallet *wallet, const CWalletTx &wtx, TransactionRecord &record, bool isContract=false)
 
static void loadUnlockColdStake (const CWallet *wallet, const CWalletTx &wtx, TransactionRecord &record)
 

Public Attributes

int idx
 Subtransaction index, for sort key. More...
 
TransactionStatus status
 Status: can change with block chain update. More...
 
bool involvesWatchAddress {false}
 Whether the transaction was sent/received with a watch-only address. More...
 
Immutable transaction attributes
uint256 hash
 
qint64 time
 
Type type
 
std::string address
 
CAmount debit
 
CAmount credit
 
unsigned int size
 
Optional< CAmountshieldedCredit {nullopt}
 
Optional< std::string > memo {nullopt}
 

Static Public Attributes

static const int RecommendedNumConfirmations = 6
 Number of confirmation recommended for accepting a transaction. More...
 

Detailed Description

UI model for a transaction.

A core transaction can be represented by multiple UI transactions if it has multiple outputs.

Definition at line 72 of file transactionrecord.h.

Member Enumeration Documentation

◆ Type

enum TransactionRecord::Type : uint16_t
Enumerator
Other 
Generated 
StakeMint 
StakeZPIV 
SendToAddress 
SendToOther 
RecvWithAddress 
MNReward 
BudgetPayment 
RecvFromOther 
SendToSelf 
ZerocoinMint 
ZerocoinSpend 
RecvFromZerocoinSpend 
ZerocoinSpend_Change_zPiv 
ZerocoinSpend_FromMe 
StakeDelegated 
StakeHot 
P2CSDelegation 
P2CSDelegationSent 
P2CSDelegationSentOwner 
P2CSUnlockOwner 
P2CSUnlockStaker 
SendToShielded 
RecvWithShieldedAddress 
RecvWithShieldedAddressMemo 
SendToSelfShieldedAddress 
SendToSelfShieldToTransparent 
SendToSelfShieldToShieldChangeAddress 
SendToNobody 

Definition at line 75 of file transactionrecord.h.

Constructor & Destructor Documentation

◆ TransactionRecord() [1/3]

TransactionRecord::TransactionRecord ( unsigned int  size)
inlineexplicit

Definition at line 111 of file transactionrecord.h.

◆ TransactionRecord() [2/3]

TransactionRecord::TransactionRecord ( uint256  hash,
qint64  time,
unsigned int  size 
)
inline

Definition at line 115 of file transactionrecord.h.

◆ TransactionRecord() [3/3]

TransactionRecord::TransactionRecord ( uint256  hash,
qint64  time,
unsigned int  size,
Type  type,
const std::string &  address,
const CAmount debit,
const CAmount credit 
)
inline

Definition at line 120 of file transactionrecord.h.

Member Function Documentation

◆ decomposeCoinStake()

bool TransactionRecord::decomposeCoinStake ( const CWallet wallet,
const CWalletTx wtx,
const CAmount nCredit,
const CAmount nDebit,
QList< TransactionRecord > &  parts 
)
static

Helpers.

Definition at line 23 of file transactionrecord.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ decomposeCreditTransaction()

bool TransactionRecord::decomposeCreditTransaction ( const CWallet wallet,
const CWalletTx wtx,
QList< TransactionRecord > &  parts 
)
static

Decompose a credit transaction into a record for each received output.

Definition at line 139 of file transactionrecord.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ decomposeDebitTransaction()

bool TransactionRecord::decomposeDebitTransaction ( const CWallet wallet,
const CWalletTx wtx,
const CAmount nDebit,
bool  involvesWatchAddress,
QList< TransactionRecord > &  parts 
)
static

Decompose wtx outputs in records.

Definition at line 293 of file transactionrecord.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ decomposeP2CS()

bool TransactionRecord::decomposeP2CS ( const CWallet wallet,
const CWalletTx wtx,
const CAmount nCredit,
const CAmount nDebit,
QList< TransactionRecord > &  parts 
)
static

Definition at line 114 of file transactionrecord.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ decomposeSendToSelfTransaction()

bool TransactionRecord::decomposeSendToSelfTransaction ( const CWalletTx wtx,
const CAmount nCredit,
const CAmount nDebit,
bool  involvesWatchAddress,
QList< TransactionRecord > &  parts,
const CWallet wallet 
)
static

Definition at line 195 of file transactionrecord.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ decomposeShieldedDebitTransaction()

bool TransactionRecord::decomposeShieldedDebitTransaction ( const CWallet wallet,
const CWalletTx wtx,
CAmount  nTxFee,
bool  involvesWatchAddress,
QList< TransactionRecord > &  parts 
)
static

Definition at line 256 of file transactionrecord.cpp.

Here is the call graph for this function:

◆ decomposeTransaction()

QList< TransactionRecord > TransactionRecord::decomposeTransaction ( const CWallet wallet,
const CWalletTx wtx 
)
static

Decompose CWallet transaction to model transaction records.

Definition at line 404 of file transactionrecord.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ decomposeZcSpendTx()

bool TransactionRecord::decomposeZcSpendTx ( const CWallet wallet,
const CWalletTx wtx,
const CAmount nCredit,
const CAmount nDebit,
QList< TransactionRecord > &  parts 
)
static

Definition at line 71 of file transactionrecord.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getOutputIndex()

int TransactionRecord::getOutputIndex ( ) const

Return the output index of the subtransaction

Definition at line 657 of file transactionrecord.cpp.

◆ getValueOrReturnEmpty()

std::string TransactionRecord::getValueOrReturnEmpty ( const std::map< std::string, std::string > &  mapValue,
const std::string &  key 
)
static

Definition at line 17 of file transactionrecord.cpp.

Here is the caller graph for this function:

◆ isAnyColdStakingType()

bool TransactionRecord::isAnyColdStakingType ( ) const

Return true if the tx is a any cold staking type tx.

Definition at line 672 of file transactionrecord.cpp.

Here is the caller graph for this function:

◆ isCoinStake()

bool TransactionRecord::isCoinStake ( ) const

Return true if the tx is a coinstake.

Definition at line 662 of file transactionrecord.cpp.

Here is the caller graph for this function:

◆ isMNReward()

bool TransactionRecord::isMNReward ( ) const

Return true if the tx is a MN reward.

Definition at line 667 of file transactionrecord.cpp.

Here is the caller graph for this function:

◆ isNull()

bool TransactionRecord::isNull ( ) const

Return true if the tx hash is null and/or if the size is 0.

Definition at line 680 of file transactionrecord.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadHotOrColdStakeOrContract()

void TransactionRecord::loadHotOrColdStakeOrContract ( const CWallet wallet,
const CWalletTx wtx,
TransactionRecord record,
bool  isContract = false 
)
static

Definition at line 537 of file transactionrecord.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadUnlockColdStake()

void TransactionRecord::loadUnlockColdStake ( const CWallet wallet,
const CWalletTx wtx,
TransactionRecord record 
)
static

Definition at line 502 of file transactionrecord.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ statusToString()

std::string TransactionRecord::statusToString ( )

Return transaction status.

Definition at line 685 of file transactionrecord.cpp.

Here is the caller graph for this function:

◆ statusUpdateNeeded()

bool TransactionRecord::statusUpdateNeeded ( int  blockHeight) const

Return whether a status update is needed.

Definition at line 652 of file transactionrecord.cpp.

Here is the caller graph for this function:

◆ updateStatus()

void TransactionRecord::updateStatus ( const CWalletTx wtx,
int  chainHeight 
)

Update status from core wallet tx.

Definition at line 585 of file transactionrecord.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ address

std::string TransactionRecord::address

Definition at line 166 of file transactionrecord.h.

◆ credit

CAmount TransactionRecord::credit

Definition at line 168 of file transactionrecord.h.

◆ debit

CAmount TransactionRecord::debit

Definition at line 167 of file transactionrecord.h.

◆ hash

uint256 TransactionRecord::hash

Definition at line 163 of file transactionrecord.h.

◆ idx

int TransactionRecord::idx

Subtransaction index, for sort key.

Definition at line 175 of file transactionrecord.h.

◆ involvesWatchAddress

bool TransactionRecord::involvesWatchAddress {false}

Whether the transaction was sent/received with a watch-only address.

Definition at line 181 of file transactionrecord.h.

◆ memo

Optional<std::string> TransactionRecord::memo {nullopt}

Definition at line 171 of file transactionrecord.h.

◆ RecommendedNumConfirmations

const int TransactionRecord::RecommendedNumConfirmations = 6
static

Number of confirmation recommended for accepting a transaction.

Definition at line 109 of file transactionrecord.h.

◆ shieldedCredit

Optional<CAmount> TransactionRecord::shieldedCredit {nullopt}

Definition at line 170 of file transactionrecord.h.

◆ size

unsigned int TransactionRecord::size

Definition at line 169 of file transactionrecord.h.

◆ status

TransactionStatus TransactionRecord::status

Status: can change with block chain update.

Definition at line 178 of file transactionrecord.h.

◆ time

qint64 TransactionRecord::time

Definition at line 164 of file transactionrecord.h.

◆ type

Type TransactionRecord::type

Definition at line 165 of file transactionrecord.h.


The documentation for this class was generated from the following files: