Dash Core  0.12.2.1
P2P Digital Currency
WalletModel Class Reference

#include <walletmodel.h>

+ Inheritance diagram for WalletModel:

Classes

struct  SendCoinsReturn
 
class  UnlockContext
 

Public Types

enum  StatusCode {
  OK, InvalidAmount, InvalidAddress, AmountExceedsBalance,
  AmountWithFeeExceedsBalance, DuplicateAddress, TransactionCreationFailed, TransactionCommitFailed,
  AbsurdFee, PaymentRequestExpired
}
 
enum  EncryptionStatus { Unencrypted, Locked, UnlockedForMixingOnly, Unlocked }
 

Public Slots

void updateStatus ()
 
void updateTransaction ()
 
void updateAddressBook (const QString &address, const QString &label, bool isMine, const QString &purpose, int status)
 
void updateWatchOnlyFlag (bool fHaveWatchonly)
 
void pollBalanceChanged ()
 

Signals

void balanceChanged (const CAmount &balance, const CAmount &unconfirmedBalance, const CAmount &immatureBalance, const CAmount &anonymizedBalance, const CAmount &watchOnlyBalance, const CAmount &watchUnconfBalance, const CAmount &watchImmatureBalance)
 
void encryptionStatusChanged (int status)
 
void requireUnlock (bool fForMixingOnly=false)
 
void message (const QString &title, const QString &message, unsigned int style)
 
void coinsSent (CWallet *wallet, SendCoinsRecipient recipient, QByteArray transaction)
 
void showProgress (const QString &title, int nProgress)
 
void notifyWatchonlyChanged (bool fHaveWatchonly)
 

Public Member Functions

 WalletModel (const PlatformStyle *platformStyle, CWallet *wallet, OptionsModel *optionsModel, QObject *parent=0)
 
 ~WalletModel ()
 
OptionsModelgetOptionsModel ()
 
AddressTableModelgetAddressTableModel ()
 
TransactionTableModelgetTransactionTableModel ()
 
RecentRequestsTableModelgetRecentRequestsTableModel ()
 
CAmount getBalance (const CCoinControl *coinControl=NULL) const
 
CAmount getUnconfirmedBalance () const
 
CAmount getImmatureBalance () const
 
CAmount getAnonymizedBalance () const
 
bool haveWatchOnly () const
 
CAmount getWatchBalance () const
 
CAmount getWatchUnconfirmedBalance () const
 
CAmount getWatchImmatureBalance () const
 
EncryptionStatus getEncryptionStatus () const
 
bool validateAddress (const QString &address)
 
SendCoinsReturn prepareTransaction (WalletModelTransaction &transaction, const CCoinControl *coinControl=NULL)
 
SendCoinsReturn sendCoins (WalletModelTransaction &transaction)
 
bool setWalletEncrypted (bool encrypted, const SecureString &passphrase)
 
bool setWalletLocked (bool locked, const SecureString &passPhrase=SecureString(), bool fMixing=false)
 
bool changePassphrase (const SecureString &oldPass, const SecureString &newPass)
 
bool backupWallet (const QString &filename)
 
UnlockContext requestUnlock (bool fForMixingOnly=false)
 
bool getPubKey (const CKeyID &address, CPubKey &vchPubKeyOut) const
 
bool havePrivKey (const CKeyID &address) const
 
void getOutputs (const std::vector< COutPoint > &vOutpoints, std::vector< COutput > &vOutputs)
 
bool isSpent (const COutPoint &outpoint) const
 
void listCoins (std::map< QString, std::vector< COutput > > &mapCoins) const
 
bool isLockedCoin (uint256 hash, unsigned int n) const
 
void lockCoin (COutPoint &output)
 
void unlockCoin (COutPoint &output)
 
void listLockedCoins (std::vector< COutPoint > &vOutpts)
 
void loadReceiveRequests (std::vector< std::string > &vReceiveRequests)
 
bool saveReceiveRequest (const std::string &sAddress, const int64_t nId, const std::string &sRequest)
 
bool transactionCanBeAbandoned (uint256 hash) const
 
bool abandonTransaction (uint256 hash) const
 
bool hdEnabled () const
 

Private Member Functions

void subscribeToCoreSignals ()
 
void unsubscribeFromCoreSignals ()
 
void checkBalanceChanged ()
 

Private Attributes

CWalletwallet
 
bool fHaveWatchOnly
 
bool fForceCheckBalanceChanged
 
OptionsModeloptionsModel
 
AddressTableModeladdressTableModel
 
TransactionTableModeltransactionTableModel
 
RecentRequestsTableModelrecentRequestsTableModel
 
CAmount cachedBalance
 
CAmount cachedUnconfirmedBalance
 
CAmount cachedImmatureBalance
 
CAmount cachedAnonymizedBalance
 
CAmount cachedWatchOnlyBalance
 
CAmount cachedWatchUnconfBalance
 
CAmount cachedWatchImmatureBalance
 
EncryptionStatus cachedEncryptionStatus
 
int cachedNumBlocks
 
int cachedTxLocks
 
int cachedPrivateSendRounds
 
QTimer * pollTimer
 

Detailed Description

Interface to Bitcoin wallet from Qt view code.

Definition at line 102 of file walletmodel.h.

Member Enumeration Documentation

◆ EncryptionStatus

Enumerator
Unencrypted 
Locked 
UnlockedForMixingOnly 
Unlocked 

Definition at line 124 of file walletmodel.h.

◆ StatusCode

Enumerator
OK 
InvalidAmount 
InvalidAddress 
AmountExceedsBalance 
AmountWithFeeExceedsBalance 
DuplicateAddress 
TransactionCreationFailed 
TransactionCommitFailed 
AbsurdFee 
PaymentRequestExpired 

Definition at line 110 of file walletmodel.h.

Constructor & Destructor Documentation

◆ WalletModel()

WalletModel::WalletModel ( const PlatformStyle platformStyle,
CWallet wallet,
OptionsModel optionsModel,
QObject *  parent = 0 
)
explicit

Definition at line 37 of file walletmodel.cpp.

◆ ~WalletModel()

WalletModel::~WalletModel ( )

Definition at line 68 of file walletmodel.cpp.

Member Function Documentation

◆ abandonTransaction()

bool WalletModel::abandonTransaction ( uint256  hash) const

Definition at line 757 of file walletmodel.cpp.

Referenced by TransactionView::abandonTx().

◆ backupWallet()

bool WalletModel::backupWallet ( const QString &  filename)

Definition at line 506 of file walletmodel.cpp.

Referenced by WalletView::backupWallet().

◆ balanceChanged

void WalletModel::balanceChanged ( const CAmount balance,
const CAmount unconfirmedBalance,
const CAmount immatureBalance,
const CAmount anonymizedBalance,
const CAmount watchOnlyBalance,
const CAmount watchUnconfBalance,
const CAmount watchImmatureBalance 
)
signal

Definition at line 242 of file moc_walletmodel.cpp.

Referenced by checkBalanceChanged().

◆ changePassphrase()

bool WalletModel::changePassphrase ( const SecureString oldPass,
const SecureString newPass 
)

Definition at line 495 of file walletmodel.cpp.

Referenced by AskPassphraseDialog::accept().

◆ checkBalanceChanged()

void WalletModel::checkBalanceChanged ( )
private

Definition at line 160 of file walletmodel.cpp.

Referenced by pollBalanceChanged(), and sendCoins().

◆ coinsSent

void WalletModel::coinsSent ( CWallet wallet,
SendCoinsRecipient  recipient,
QByteArray  transaction 
)
signal

Definition at line 270 of file moc_walletmodel.cpp.

Referenced by sendCoins().

◆ encryptionStatusChanged

void WalletModel::encryptionStatusChanged ( int  status)
signal

Definition at line 249 of file moc_walletmodel.cpp.

Referenced by updateStatus().

◆ getAddressTableModel()

◆ getAnonymizedBalance()

CAmount WalletModel::getAnonymizedBalance ( ) const

◆ getBalance()

CAmount WalletModel::getBalance ( const CCoinControl coinControl = NULL) const

◆ getEncryptionStatus()

◆ getImmatureBalance()

CAmount WalletModel::getImmatureBalance ( ) const

◆ getOptionsModel()

◆ getOutputs()

void WalletModel::getOutputs ( const std::vector< COutPoint > &  vOutpoints,
std::vector< COutput > &  vOutputs 
)

Definition at line 643 of file walletmodel.cpp.

Referenced by CoinControlDialog::updateLabels().

◆ getPubKey()

bool WalletModel::getPubKey ( const CKeyID address,
CPubKey vchPubKeyOut 
) const

Definition at line 632 of file walletmodel.cpp.

Referenced by CoinControlDialog::updateLabels().

◆ getRecentRequestsTableModel()

◆ getTransactionTableModel()

◆ getUnconfirmedBalance()

CAmount WalletModel::getUnconfirmedBalance ( ) const

◆ getWatchBalance()

CAmount WalletModel::getWatchBalance ( ) const

◆ getWatchImmatureBalance()

CAmount WalletModel::getWatchImmatureBalance ( ) const

◆ getWatchUnconfirmedBalance()

CAmount WalletModel::getWatchUnconfirmedBalance ( ) const

◆ havePrivKey()

bool WalletModel::havePrivKey ( const CKeyID address) const

Definition at line 637 of file walletmodel.cpp.

Referenced by SendCoinsDialog::coinControlChangeEdited().

◆ haveWatchOnly()

bool WalletModel::haveWatchOnly ( ) const

◆ hdEnabled()

bool WalletModel::hdEnabled ( ) const

Definition at line 763 of file walletmodel.cpp.

Referenced by WalletView::setWalletModel().

◆ isLockedCoin()

bool WalletModel::isLockedCoin ( uint256  hash,
unsigned int  n 
) const

◆ isSpent()

bool WalletModel::isSpent ( const COutPoint outpoint) const

Definition at line 656 of file walletmodel.cpp.

Referenced by CoinControlDialog::updateLabels().

◆ listCoins()

void WalletModel::listCoins ( std::map< QString, std::vector< COutput > > &  mapCoins) const

Definition at line 663 of file walletmodel.cpp.

Referenced by CoinControlDialog::updateView().

◆ listLockedCoins()

void WalletModel::listLockedCoins ( std::vector< COutPoint > &  vOutpts)

Definition at line 718 of file walletmodel.cpp.

Referenced by CoinControlDialog::updateLabelLocked().

◆ loadReceiveRequests()

void WalletModel::loadReceiveRequests ( std::vector< std::string > &  vReceiveRequests)

Definition at line 724 of file walletmodel.cpp.

Referenced by RecentRequestsTableModel::RecentRequestsTableModel().

◆ lockCoin()

void WalletModel::lockCoin ( COutPoint output)

◆ message

void WalletModel::message ( const QString &  title,
const QString &  message,
unsigned int  style 
)
signal

Definition at line 263 of file moc_walletmodel.cpp.

Referenced by prepareTransaction().

◆ notifyWatchonlyChanged

void WalletModel::notifyWatchonlyChanged ( bool  fHaveWatchonly)
signal

Definition at line 284 of file moc_walletmodel.cpp.

Referenced by updateWatchOnlyFlag().

◆ pollBalanceChanged

void WalletModel::pollBalanceChanged ( )
slot

Definition at line 134 of file walletmodel.cpp.

Referenced by WalletModel().

◆ prepareTransaction()

WalletModel::SendCoinsReturn WalletModel::prepareTransaction ( WalletModelTransaction transaction,
const CCoinControl coinControl = NULL 
)

Definition at line 218 of file walletmodel.cpp.

Referenced by SendCoinsDialog::send().

◆ requestUnlock()

◆ requireUnlock

void WalletModel::requireUnlock ( bool  fForMixingOnly = false)
signal

Definition at line 256 of file moc_walletmodel.cpp.

Referenced by requestUnlock().

◆ saveReceiveRequest()

bool WalletModel::saveReceiveRequest ( const std::string &  sAddress,
const int64_t  nId,
const std::string &  sRequest 
)

◆ sendCoins()

WalletModel::SendCoinsReturn WalletModel::sendCoins ( WalletModelTransaction transaction)

Definition at line 353 of file walletmodel.cpp.

Referenced by SendCoinsDialog::send().

◆ setWalletEncrypted()

bool WalletModel::setWalletEncrypted ( bool  encrypted,
const SecureString passphrase 
)

Definition at line 467 of file walletmodel.cpp.

Referenced by AskPassphraseDialog::accept().

◆ setWalletLocked()

bool WalletModel::setWalletLocked ( bool  locked,
const SecureString passPhrase = SecureString(),
bool  fMixing = false 
)

Definition at line 481 of file walletmodel.cpp.

Referenced by AskPassphraseDialog::accept(), and WalletView::lockWallet().

◆ showProgress

void WalletModel::showProgress ( const QString &  title,
int  nProgress 
)
signal

Definition at line 277 of file moc_walletmodel.cpp.

◆ subscribeToCoreSignals()

void WalletModel::subscribeToCoreSignals ( )
private

Definition at line 557 of file walletmodel.cpp.

Referenced by WalletModel().

◆ transactionCanBeAbandoned()

bool WalletModel::transactionCanBeAbandoned ( uint256  hash) const

Definition at line 748 of file walletmodel.cpp.

Referenced by TransactionView::contextualMenu().

◆ unlockCoin()

void WalletModel::unlockCoin ( COutPoint output)

◆ unsubscribeFromCoreSignals()

void WalletModel::unsubscribeFromCoreSignals ( )
private

Definition at line 567 of file walletmodel.cpp.

Referenced by ~WalletModel().

◆ updateAddressBook

void WalletModel::updateAddressBook ( const QString &  address,
const QString &  label,
bool  isMine,
const QString &  purpose,
int  status 
)
slot

Definition at line 199 of file walletmodel.cpp.

◆ updateStatus

void WalletModel::updateStatus ( )
slot

Definition at line 126 of file walletmodel.cpp.

◆ updateTransaction

void WalletModel::updateTransaction ( )
slot

Definition at line 193 of file walletmodel.cpp.

◆ updateWatchOnlyFlag

void WalletModel::updateWatchOnlyFlag ( bool  fHaveWatchonly)
slot

Definition at line 206 of file walletmodel.cpp.

◆ validateAddress()

bool WalletModel::validateAddress ( const QString &  address)

Member Data Documentation

◆ addressTableModel

AddressTableModel* WalletModel::addressTableModel
private

Definition at line 224 of file walletmodel.h.

Referenced by getAddressTableModel(), updateAddressBook(), and WalletModel().

◆ cachedAnonymizedBalance

CAmount WalletModel::cachedAnonymizedBalance
private

Definition at line 232 of file walletmodel.h.

Referenced by checkBalanceChanged().

◆ cachedBalance

CAmount WalletModel::cachedBalance
private

Definition at line 229 of file walletmodel.h.

Referenced by checkBalanceChanged().

◆ cachedEncryptionStatus

EncryptionStatus WalletModel::cachedEncryptionStatus
private

Definition at line 236 of file walletmodel.h.

Referenced by updateStatus().

◆ cachedImmatureBalance

CAmount WalletModel::cachedImmatureBalance
private

Definition at line 231 of file walletmodel.h.

Referenced by checkBalanceChanged().

◆ cachedNumBlocks

int WalletModel::cachedNumBlocks
private

Definition at line 237 of file walletmodel.h.

Referenced by pollBalanceChanged().

◆ cachedPrivateSendRounds

int WalletModel::cachedPrivateSendRounds
private

Definition at line 239 of file walletmodel.h.

Referenced by pollBalanceChanged().

◆ cachedTxLocks

int WalletModel::cachedTxLocks
private

Definition at line 238 of file walletmodel.h.

Referenced by checkBalanceChanged(), and pollBalanceChanged().

◆ cachedUnconfirmedBalance

CAmount WalletModel::cachedUnconfirmedBalance
private

Definition at line 230 of file walletmodel.h.

Referenced by checkBalanceChanged().

◆ cachedWatchImmatureBalance

CAmount WalletModel::cachedWatchImmatureBalance
private

Definition at line 235 of file walletmodel.h.

Referenced by checkBalanceChanged().

◆ cachedWatchOnlyBalance

CAmount WalletModel::cachedWatchOnlyBalance
private

Definition at line 233 of file walletmodel.h.

Referenced by checkBalanceChanged().

◆ cachedWatchUnconfBalance

CAmount WalletModel::cachedWatchUnconfBalance
private

Definition at line 234 of file walletmodel.h.

Referenced by checkBalanceChanged().

◆ fForceCheckBalanceChanged

bool WalletModel::fForceCheckBalanceChanged
private

Definition at line 218 of file walletmodel.h.

Referenced by pollBalanceChanged(), updateTransaction(), and WalletModel().

◆ fHaveWatchOnly

bool WalletModel::fHaveWatchOnly
private

Definition at line 217 of file walletmodel.h.

Referenced by haveWatchOnly(), updateWatchOnlyFlag(), and WalletModel().

◆ optionsModel

OptionsModel* WalletModel::optionsModel
private

Definition at line 222 of file walletmodel.h.

Referenced by getOptionsModel().

◆ pollTimer

QTimer* WalletModel::pollTimer
private

Definition at line 241 of file walletmodel.h.

Referenced by WalletModel().

◆ recentRequestsTableModel

RecentRequestsTableModel* WalletModel::recentRequestsTableModel
private

Definition at line 226 of file walletmodel.h.

Referenced by getRecentRequestsTableModel(), and WalletModel().

◆ transactionTableModel

TransactionTableModel* WalletModel::transactionTableModel
private

Definition at line 225 of file walletmodel.h.

Referenced by getTransactionTableModel(), pollBalanceChanged(), and WalletModel().

◆ wallet

CWallet* WalletModel::wallet
private

Definition at line 216 of file walletmodel.h.


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