Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

Interface to Bitcoin wallet from Qt view code. More...

#include <walletmodel.h>

+ Inheritance diagram for WalletModel:
+ Collaboration 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 updateNumISLocks ()
 
void updateChainLockHeight (int chainLockHeight)
 
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 (CWallet *wallet, OptionsModel *optionsModel, QObject *parent=0)
 
 ~WalletModel ()
 
OptionsModelgetOptionsModel ()
 
AddressTableModelgetAddressTableModel ()
 
TransactionTableModelgetTransactionTableModel ()
 
RecentRequestsTableModelgetRecentRequestsTableModel ()
 
CAmount getBalance (const CCoinControl *coinControl=nullptr) const
 
CAmount getUnconfirmedBalance () const
 
CAmount getImmatureBalance () const
 
CAmount getAnonymizableBalance (bool fSkipDenominated, bool fSkipUnconfirmed) const
 
CAmount getAnonymizedBalance (const CCoinControl *coinControl=nullptr) const
 
CAmount getDenominatedBalance (bool unconfirmed) const
 
CAmount getNormalizedAnonymizedBalance () const
 
CAmount getAverageAnonymizedRounds () 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)
 
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)
 
bool autoBackupWallet (QString &strBackupWarningRet, QString &strBackupErrorRet)
 
int64_t getKeysLeftSinceAutoBackup () const
 
UnlockContext requestUnlock (bool fForMixingOnly=false)
 
bool getPubKey (const CKeyID &address, CPubKey &vchPubKeyOut) const
 
bool IsSpendable (const CTxDestination &dest) const
 
bool IsSpendable (const CScript &script) const
 
bool getPrivKey (const CKeyID &address, CKey &vchPrivKeyOut) 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 listProTxCoins (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
 
int getDefaultConfirmTarget () const
 
int getNumISLocks () const
 
int getRealOutpointPrivateSendRounds (const COutPoint &outpoint) const
 
bool isFullyMixed (const COutPoint &outpoint) const
 

Static Public Member Functions

static bool isWalletEnabled ()
 

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 cachedNumISLocks
 
int cachedPrivateSendRounds
 
QTimer * pollTimer
 

Detailed Description

Interface to Bitcoin wallet from Qt view code.

Definition at line 100 of file walletmodel.h.

Member Enumeration Documentation

◆ EncryptionStatus

Enumerator
Unencrypted 
Locked 
UnlockedForMixingOnly 
Unlocked 

Definition at line 122 of file walletmodel.h.

◆ StatusCode

Enumerator
OK 
InvalidAmount 
InvalidAddress 
AmountExceedsBalance 
AmountWithFeeExceedsBalance 
DuplicateAddress 
TransactionCreationFailed 
TransactionCommitFailed 
AbsurdFee 
PaymentRequestExpired 

Definition at line 108 of file walletmodel.h.

Constructor & Destructor Documentation

◆ WalletModel()

◆ ~WalletModel()

WalletModel::~WalletModel ( )

Definition at line 71 of file walletmodel.cpp.

References unsubscribeFromCoreSignals().

Member Function Documentation

◆ abandonTransaction()

bool WalletModel::abandonTransaction ( uint256  hash) const

◆ autoBackupWallet()

bool WalletModel::autoBackupWallet ( QString &  strBackupWarningRet,
QString &  strBackupErrorRet 
)

Definition at line 543 of file walletmodel.cpp.

References CWallet::AutoBackupWallet(), and wallet.

Referenced by OverviewPage::privateSendStatus().

◆ backupWallet()

bool WalletModel::backupWallet ( const QString &  filename)

Definition at line 538 of file walletmodel.cpp.

References CWallet::BackupWallet(), and wallet.

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

Referenced by checkBalanceChanged().

◆ changePassphrase()

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

◆ checkBalanceChanged()

◆ coinsSent

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

Referenced by sendCoins().

◆ encryptionStatusChanged

void WalletModel::encryptionStatusChanged ( int  status)
signal

Referenced by updateStatus().

◆ getAddressTableModel()

◆ getAnonymizableBalance()

CAmount WalletModel::getAnonymizableBalance ( bool  fSkipDenominated,
bool  fSkipUnconfirmed 
) const

Definition at line 87 of file walletmodel.cpp.

References CWallet::GetAnonymizableBalance(), and wallet.

Referenced by OverviewPage::updatePrivateSendProgress().

◆ getAnonymizedBalance()

CAmount WalletModel::getAnonymizedBalance ( const CCoinControl coinControl = nullptr) const

◆ getAverageAnonymizedRounds()

CAmount WalletModel::getAverageAnonymizedRounds ( ) const

◆ getBalance()

◆ getDefaultConfirmTarget()

int WalletModel::getDefaultConfirmTarget ( ) const

Definition at line 817 of file walletmodel.cpp.

References nTxConfirmTarget.

Referenced by SendCoinsDialog::setModel().

◆ getDenominatedBalance()

CAmount WalletModel::getDenominatedBalance ( bool  unconfirmed) const

Definition at line 97 of file walletmodel.cpp.

References CWallet::GetDenominatedBalance(), and wallet.

Referenced by OverviewPage::updatePrivateSendProgress().

◆ getEncryptionStatus()

◆ getImmatureBalance()

CAmount WalletModel::getImmatureBalance ( ) const

◆ getKeysLeftSinceAutoBackup()

int64_t WalletModel::getKeysLeftSinceAutoBackup ( ) const

Definition at line 553 of file walletmodel.cpp.

References CWallet::nKeysLeftSinceAutoBackup, and wallet.

Referenced by OverviewPage::privateSendStatus().

◆ getNormalizedAnonymizedBalance()

CAmount WalletModel::getNormalizedAnonymizedBalance ( ) const

◆ getNumISLocks()

int WalletModel::getNumISLocks ( ) const

Definition at line 227 of file walletmodel.cpp.

References cachedNumISLocks.

Referenced by OverviewPage::setBalance().

◆ getOptionsModel()

◆ getOutputs()

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

Definition at line 715 of file walletmodel.cpp.

References cs_main, CWallet::cs_wallet, LOCK2, CWallet::mapWallet, and wallet.

Referenced by CoinControlDialog::updateLabels().

◆ getPrivKey()

bool WalletModel::getPrivKey ( const CKeyID address,
CKey vchPrivKeyOut 
) const

Definition at line 709 of file walletmodel.cpp.

References CWallet::GetKey(), and wallet.

Referenced by SignVerifyMessageDialog::on_signMessageButton_SM_clicked().

◆ getPubKey()

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

Definition at line 694 of file walletmodel.cpp.

References CWallet::GetPubKey(), and wallet.

Referenced by CoinControlDialog::updateLabels().

◆ getRealOutpointPrivateSendRounds()

int WalletModel::getRealOutpointPrivateSendRounds ( const COutPoint outpoint) const

Definition at line 232 of file walletmodel.cpp.

References CWallet::GetRealOutpointPrivateSendRounds(), and wallet.

Referenced by CoinControlDialog::updateView().

◆ getRecentRequestsTableModel()

◆ getTransactionTableModel()

◆ getUnconfirmedBalance()

CAmount WalletModel::getUnconfirmedBalance ( ) const

◆ getWatchBalance()

◆ getWatchImmatureBalance()

CAmount WalletModel::getWatchImmatureBalance ( ) const

◆ getWatchUnconfirmedBalance()

CAmount WalletModel::getWatchUnconfirmedBalance ( ) const

◆ haveWatchOnly()

bool WalletModel::haveWatchOnly ( ) const

◆ hdEnabled()

bool WalletModel::hdEnabled ( ) const

Definition at line 812 of file walletmodel.cpp.

References CWallet::IsHDEnabled(), and wallet.

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

◆ isFullyMixed()

bool WalletModel::isFullyMixed ( const COutPoint outpoint) const

◆ isLockedCoin()

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

◆ IsSpendable() [1/2]

bool WalletModel::IsSpendable ( const CTxDestination dest) const

◆ IsSpendable() [2/2]

bool WalletModel::IsSpendable ( const CScript script) const

Definition at line 704 of file walletmodel.cpp.

References IsMine(), ISMINE_SPENDABLE, and wallet.

◆ isSpent()

bool WalletModel::isSpent ( const COutPoint outpoint) const

◆ isWalletEnabled()

bool WalletModel::isWalletEnabled ( )
static

Definition at line 807 of file walletmodel.cpp.

References DEFAULT_DISABLE_WALLET, gArgs, and ArgsManager::GetBoolArg().

Referenced by BitcoinGUI::BitcoinGUI().

◆ listCoins()

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

Definition at line 736 of file walletmodel.cpp.

References EncodeDestination(), CWallet::ListCoins(), and wallet.

Referenced by CoinControlDialog::updateView().

◆ listLockedCoins()

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

◆ listProTxCoins()

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

◆ loadReceiveRequests()

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

◆ lockCoin()

void WalletModel::lockCoin ( COutPoint output)

◆ message

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

Referenced by prepareTransaction().

◆ notifyWatchonlyChanged

void WalletModel::notifyWatchonlyChanged ( bool  fHaveWatchonly)
signal

Referenced by updateWatchOnlyFlag().

◆ pollBalanceChanged

◆ prepareTransaction()

◆ requestUnlock()

◆ requireUnlock

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

Referenced by requestUnlock().

◆ saveReceiveRequest()

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

◆ sendCoins()

◆ setWalletEncrypted()

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

Definition at line 499 of file walletmodel.cpp.

References CWallet::EncryptWallet(), and wallet.

Referenced by AskPassphraseDialog::accept().

◆ setWalletLocked()

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

◆ showProgress

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

◆ subscribeToCoreSignals()

◆ transactionCanBeAbandoned()

bool WalletModel::transactionCanBeAbandoned ( uint256  hash) const

Definition at line 796 of file walletmodel.cpp.

References CWallet::TransactionCanBeAbandoned(), and wallet.

Referenced by TransactionView::contextualMenu().

◆ unlockCoin()

void WalletModel::unlockCoin ( COutPoint output)

◆ unsubscribeFromCoreSignals()

◆ updateAddressBook

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

Definition at line 242 of file walletmodel.cpp.

References addressTableModel, and AddressTableModel::updateEntry().

◆ updateChainLockHeight

void WalletModel::updateChainLockHeight ( int  chainLockHeight)
slot

◆ updateNumISLocks

void WalletModel::updateNumISLocks ( )
slot

Definition at line 214 of file walletmodel.cpp.

References cachedNumISLocks.

◆ updateStatus

void WalletModel::updateStatus ( )
slot

◆ updateTransaction

void WalletModel::updateTransaction ( )
slot

Definition at line 208 of file walletmodel.cpp.

References fForceCheckBalanceChanged.

◆ updateWatchOnlyFlag

void WalletModel::updateWatchOnlyFlag ( bool  fHaveWatchonly)
slot

Definition at line 249 of file walletmodel.cpp.

References fHaveWatchOnly, and notifyWatchonlyChanged().

◆ validateAddress()

bool WalletModel::validateAddress ( const QString &  address)

Member Data Documentation

◆ addressTableModel

AddressTableModel* WalletModel::addressTableModel
private

Definition at line 244 of file walletmodel.h.

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

◆ cachedAnonymizedBalance

CAmount WalletModel::cachedAnonymizedBalance
private

Definition at line 252 of file walletmodel.h.

Referenced by checkBalanceChanged().

◆ cachedBalance

CAmount WalletModel::cachedBalance
private

Definition at line 249 of file walletmodel.h.

Referenced by checkBalanceChanged().

◆ cachedEncryptionStatus

EncryptionStatus WalletModel::cachedEncryptionStatus
private

Definition at line 256 of file walletmodel.h.

Referenced by updateStatus().

◆ cachedImmatureBalance

CAmount WalletModel::cachedImmatureBalance
private

Definition at line 251 of file walletmodel.h.

Referenced by checkBalanceChanged().

◆ cachedNumBlocks

int WalletModel::cachedNumBlocks
private

Definition at line 257 of file walletmodel.h.

Referenced by pollBalanceChanged().

◆ cachedNumISLocks

int WalletModel::cachedNumISLocks
private

Definition at line 258 of file walletmodel.h.

Referenced by getNumISLocks(), and updateNumISLocks().

◆ cachedPrivateSendRounds

int WalletModel::cachedPrivateSendRounds
private

Definition at line 259 of file walletmodel.h.

Referenced by pollBalanceChanged().

◆ cachedUnconfirmedBalance

CAmount WalletModel::cachedUnconfirmedBalance
private

Definition at line 250 of file walletmodel.h.

Referenced by checkBalanceChanged().

◆ cachedWatchImmatureBalance

CAmount WalletModel::cachedWatchImmatureBalance
private

Definition at line 255 of file walletmodel.h.

Referenced by checkBalanceChanged().

◆ cachedWatchOnlyBalance

CAmount WalletModel::cachedWatchOnlyBalance
private

Definition at line 253 of file walletmodel.h.

Referenced by checkBalanceChanged().

◆ cachedWatchUnconfBalance

CAmount WalletModel::cachedWatchUnconfBalance
private

Definition at line 254 of file walletmodel.h.

Referenced by checkBalanceChanged().

◆ fForceCheckBalanceChanged

bool WalletModel::fForceCheckBalanceChanged
private

◆ fHaveWatchOnly

bool WalletModel::fHaveWatchOnly
private

Definition at line 237 of file walletmodel.h.

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

◆ optionsModel

OptionsModel* WalletModel::optionsModel
private

Definition at line 242 of file walletmodel.h.

Referenced by getOptionsModel().

◆ pollTimer

QTimer* WalletModel::pollTimer
private

Definition at line 261 of file walletmodel.h.

Referenced by WalletModel().

◆ recentRequestsTableModel

RecentRequestsTableModel* WalletModel::recentRequestsTableModel
private

Definition at line 246 of file walletmodel.h.

Referenced by getRecentRequestsTableModel(), and WalletModel().

◆ transactionTableModel

TransactionTableModel* WalletModel::transactionTableModel
private

◆ wallet


The documentation for this class was generated from the following files:
Released under the MIT license