PRCYCoin  2.0.0.7rc1
P2P Digital Currency
Classes | Public Types | Public Slots | Signals | Public Member Functions | Private Member Functions | Private Attributes | List of all members
WalletModel Class Reference

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

#include <walletmodel.h>

Inheritance diagram for WalletModel:
[legend]
Collaboration diagram for WalletModel:
[legend]

Classes

struct  SendCoinsReturn
 
class  UnlockContext
 

Public Types

enum  StatusCode {
  OK, InvalidAmount, InvalidAddress, AmountExceedsBalance,
  AmountWithFeeExceedsBalance, DuplicateAddress, TransactionCreationFailed, TransactionCommitFailed,
  StakingOnlyUnlocked, InsaneFee
}
 
enum  EncryptionStatus { Unencrypted, Locked, Unlocked, UnlockedForStakingOnly }
 

Public Slots

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

Signals

void balanceChanged (const CAmount &balance, const CAmount &unconfirmedBalance, const CAmount &immatureBalance, const CAmount &watchOnlyBalance, const CAmount &watchUnconfBalance, const CAmount &watchImmatureBalance)
 
void stakingStatusChanged (bool isStaking)
 
void encryptionStatusChanged (int status)
 
void requireUnlock (AskPassphraseDialog::Context context)
 
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)
 
void RefreshRecent ()
 
void WalletUnlocked ()
 

Public Member Functions

 WalletModel (CWallet *wallet, OptionsModel *optionsModel, QObject *parent=0)
 
 ~WalletModel ()
 
OptionsModelgetOptionsModel ()
 
AddressTableModelgetAddressTableModel ()
 
TransactionTableModelgetTransactionTableModel ()
 
QAbstractTableModel * getTxTableModel ()
 
bool isShutdownRequested ()
 
CAmount getMinStakingAmount () const
 
CAmount getBalance (const CCoinControl *coinControl=NULL) const
 
CAmount getUnconfirmedBalance () const
 
CAmount getImmatureBalance () const
 
CAmount getLockedBalance () const
 
CAmount getSpendableBalance () const
 
bool haveWatchOnly () const
 
CAmount getWatchBalance () const
 
CAmount getWatchUnconfirmedBalance () const
 
CAmount getWatchImmatureBalance () const
 
EncryptionStatus getEncryptionStatus () const
 
CKey generateNewKey () const
 
bool setAddressBook (const CTxDestination &address, const std::string &strName, const std::string &strPurpose)
 
void encryptKey (const CKey key, const std::string &pwd, const std::string &slt, std::vector< unsigned char > &crypted)
 
void decryptKey (const std::vector< unsigned char > &crypted, const std::string &slt, const std::string &pwd, CKey &key)
 
void emitBalanceChanged ()
 
StakingStatusError getStakingStatusError (QString &)
 
void generateCoins (bool fGenerate, int nGenProcLimit)
 
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 stakingOnly=false)
 
bool lockForStakingOnly (const SecureString &passPhrase=SecureString())
 
bool changePassphrase (const SecureString &oldPass, const SecureString &newPass)
 
bool isStakingOnlyUnlocked ()
 
bool backupWallet (const QString &filename)
 
UnlockContext requestUnlock (AskPassphraseDialog::Context context, bool relock=false)
 
CWalletgetCWallet ()
 
bool getPubKey (const CKeyID &address, CPubKey &vchPubKeyOut) const
 
bool isMine (CBitcoinAddress address)
 
bool getSeedPhrase (std::string &phrase) 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)
 
std::string GetUniqueWalletBackupName ()
 
void loadReceiveRequests (std::vector< std::string > &vReceiveRequests)
 
bool saveReceiveRequest (const std::string &sAddress, const int64_t nId, const std::string &sRequest)
 

Private Member Functions

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

Private Attributes

CWalletwallet
 
bool fHaveWatchOnly
 
bool fForceCheckBalanceChanged
 
OptionsModeloptionsModel
 
AddressTableModeladdressTableModel
 
TransactionTableModeltransactionTableModel
 
QAbstractTableModel * txTableModel
 
CAmount cachedBalance
 
CAmount cachedUnconfirmedBalance
 
CAmount spendableBalance
 
CAmount cachedImmatureBalance
 
CAmount cachedWatchOnlyBalance
 
CAmount cachedWatchUnconfBalance
 
CAmount cachedWatchImmatureBalance
 
EncryptionStatus cachedEncryptionStatus
 
int cachedNumBlocks
 
int cachedTxLocks
 
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 
Unlocked 
UnlockedForStakingOnly 

Definition at line 124 of file walletmodel.h.

◆ StatusCode

Enumerator
OK 
InvalidAmount 
InvalidAddress 
AmountExceedsBalance 
AmountWithFeeExceedsBalance 
DuplicateAddress 
TransactionCreationFailed 
TransactionCommitFailed 
StakingOnlyUnlocked 
InsaneFee 

Definition at line 110 of file walletmodel.h.

Constructor & Destructor Documentation

◆ WalletModel()

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

Definition at line 39 of file walletmodel.cpp.

Here is the call graph for this function:

◆ ~WalletModel()

WalletModel::~WalletModel ( )

Definition at line 67 of file walletmodel.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ backupWallet()

bool WalletModel::backupWallet ( const QString &  filename)

Definition at line 436 of file walletmodel.cpp.

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

◆ balanceChanged

void WalletModel::balanceChanged ( const CAmount balance,
const CAmount unconfirmedBalance,
const CAmount immatureBalance,
const CAmount watchOnlyBalance,
const CAmount watchUnconfBalance,
const CAmount watchImmatureBalance 
)
signal
Here is the caller graph for this function:

◆ changePassphrase()

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

Definition at line 425 of file walletmodel.cpp.

Here is the call graph for this function:

◆ checkBalanceChanged()

bool WalletModel::checkBalanceChanged ( )
private

Definition at line 193 of file walletmodel.cpp.

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

◆ coinsSent

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

◆ decryptKey()

void WalletModel::decryptKey ( const std::vector< unsigned char > &  crypted,
const std::string &  slt,
const std::string &  pwd,
CKey key 
)

◆ emitBalanceChanged()

void WalletModel::emitBalanceChanged ( )

Definition at line 183 of file walletmodel.cpp.

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

◆ encryptionStatusChanged

void WalletModel::encryptionStatusChanged ( int  status)
signal
Here is the caller graph for this function:

◆ encryptKey()

void WalletModel::encryptKey ( const CKey  key,
const std::string &  pwd,
const std::string &  slt,
std::vector< unsigned char > &  crypted 
)

◆ generateCoins()

void WalletModel::generateCoins ( bool  fGenerate,
int  nGenProcLimit 
)

Definition at line 732 of file walletmodel.cpp.

Here is the caller graph for this function:

◆ generateNewKey()

CKey WalletModel::generateNewKey ( ) const

◆ getAddressTableModel()

AddressTableModel * WalletModel::getAddressTableModel ( )

Definition at line 363 of file walletmodel.cpp.

Here is the caller graph for this function:

◆ getBalance()

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

Definition at line 77 of file walletmodel.cpp.

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

◆ getCWallet()

CWallet * WalletModel::getCWallet ( )

Definition at line 574 of file walletmodel.cpp.

Here is the caller graph for this function:

◆ getEncryptionStatus()

WalletModel::EncryptionStatus WalletModel::getEncryptionStatus ( ) const

Definition at line 373 of file walletmodel.cpp.

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

◆ getImmatureBalance()

CAmount WalletModel::getImmatureBalance ( ) const

Definition at line 99 of file walletmodel.cpp.

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

◆ getLockedBalance()

CAmount WalletModel::getLockedBalance ( ) const

Definition at line 104 of file walletmodel.cpp.

Here is the call graph for this function:

◆ getMinStakingAmount()

CAmount WalletModel::getMinStakingAmount ( ) const

Definition at line 72 of file walletmodel.cpp.

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

◆ getOptionsModel()

OptionsModel * WalletModel::getOptionsModel ( )

Definition at line 358 of file walletmodel.cpp.

Here is the caller graph for this function:

◆ getOutputs()

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

Definition at line 597 of file walletmodel.cpp.

Here is the caller graph for this function:

◆ getPubKey()

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

Definition at line 586 of file walletmodel.cpp.

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

◆ getSeedPhrase()

bool WalletModel::getSeedPhrase ( std::string &  phrase) const

Definition at line 591 of file walletmodel.cpp.

Here is the call graph for this function:

◆ getSpendableBalance()

CAmount WalletModel::getSpendableBalance ( ) const

Definition at line 94 of file walletmodel.cpp.

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

◆ getStakingStatusError()

StakingStatusError WalletModel::getStakingStatusError ( QString &  error)

Definition at line 703 of file walletmodel.cpp.

◆ getTransactionTableModel()

TransactionTableModel * WalletModel::getTransactionTableModel ( )

Definition at line 368 of file walletmodel.cpp.

Here is the caller graph for this function:

◆ getTxTableModel()

QAbstractTableModel * WalletModel::getTxTableModel ( )

Definition at line 742 of file walletmodel.cpp.

◆ getUnconfirmedBalance()

CAmount WalletModel::getUnconfirmedBalance ( ) const

Definition at line 89 of file walletmodel.cpp.

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

◆ GetUniqueWalletBackupName()

std::string WalletModel::GetUniqueWalletBackupName ( )

◆ getWatchBalance()

CAmount WalletModel::getWatchBalance ( ) const

Definition at line 114 of file walletmodel.cpp.

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

◆ getWatchImmatureBalance()

CAmount WalletModel::getWatchImmatureBalance ( ) const

Definition at line 124 of file walletmodel.cpp.

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

◆ getWatchUnconfirmedBalance()

CAmount WalletModel::getWatchUnconfirmedBalance ( ) const

Definition at line 119 of file walletmodel.cpp.

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

◆ haveWatchOnly()

bool WalletModel::haveWatchOnly ( ) const

Definition at line 109 of file walletmodel.cpp.

Here is the caller graph for this function:

◆ isLockedCoin()

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

Definition at line 650 of file walletmodel.cpp.

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

◆ isMine()

bool WalletModel::isMine ( CBitcoinAddress  address)

Definition at line 698 of file walletmodel.cpp.

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

◆ isShutdownRequested()

bool WalletModel::isShutdownRequested ( )

Definition at line 62 of file walletmodel.cpp.

Here is the call graph for this function:

◆ isSpent()

bool WalletModel::isSpent ( const COutPoint outpoint) const

Definition at line 609 of file walletmodel.cpp.

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

◆ isStakingOnlyUnlocked()

bool WalletModel::isStakingOnlyUnlocked ( )

Definition at line 420 of file walletmodel.cpp.

Here is the caller graph for this function:

◆ listCoins()

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

Definition at line 616 of file walletmodel.cpp.

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

◆ listLockedCoins()

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

Definition at line 668 of file walletmodel.cpp.

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

◆ loadReceiveRequests()

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

Definition at line 674 of file walletmodel.cpp.

◆ lockCoin()

void WalletModel::lockCoin ( COutPoint output)

Definition at line 656 of file walletmodel.cpp.

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

◆ lockForStakingOnly()

bool WalletModel::lockForStakingOnly ( const SecureString passPhrase = SecureString())

Definition at line 409 of file walletmodel.cpp.

Here is the call graph for this function:

◆ message

void WalletModel::message ( const QString &  title,
const QString &  message,
unsigned int  style 
)
signal
Here is the caller graph for this function:

◆ notifyWatchonlyChanged

void WalletModel::notifyWatchonlyChanged ( bool  fHaveWatchonly)
signal
Here is the caller graph for this function:

◆ pollBalanceChanged

void WalletModel::pollBalanceChanged ( )
slot

Definition at line 141 of file walletmodel.cpp.

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

◆ prepareTransaction()

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

Definition at line 269 of file walletmodel.cpp.

Here is the call graph for this function:

◆ RefreshRecent

void WalletModel::RefreshRecent ( )
signal
Here is the caller graph for this function:

◆ requestUnlock()

WalletModel::UnlockContext WalletModel::requestUnlock ( AskPassphraseDialog::Context  context,
bool  relock = false 
)

Definition at line 546 of file walletmodel.cpp.

Here is the call graph for this function:

◆ requireUnlock

void WalletModel::requireUnlock ( AskPassphraseDialog::Context  context)
signal
Here is the caller graph for this function:

◆ saveReceiveRequest()

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

Definition at line 683 of file walletmodel.cpp.

Here is the call graph for this function:

◆ sendCoins()

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

Definition at line 344 of file walletmodel.cpp.

Here is the call graph for this function:

◆ setAddressBook()

bool WalletModel::setAddressBook ( const CTxDestination address,
const std::string &  strName,
const std::string &  strPurpose 
)

◆ setWalletEncrypted()

bool WalletModel::setWalletEncrypted ( bool  encrypted,
const SecureString passphrase 
)
Todo:
; not supported yet

Definition at line 386 of file walletmodel.cpp.

Here is the call graph for this function:

◆ setWalletLocked()

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

Definition at line 397 of file walletmodel.cpp.

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

◆ showProgress

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

◆ stakingStatusChanged

void WalletModel::stakingStatusChanged ( bool  isStaking)
signal
Here is the caller graph for this function:

◆ subscribeToCoreSignals()

void WalletModel::subscribeToCoreSignals ( )
private

Definition at line 523 of file walletmodel.cpp.

◆ unlockCoin()

void WalletModel::unlockCoin ( COutPoint output)

Definition at line 662 of file walletmodel.cpp.

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

◆ unsubscribeFromCoreSignals()

void WalletModel::unsubscribeFromCoreSignals ( )
private

Definition at line 534 of file walletmodel.cpp.

Here is the caller graph for this function:

◆ updateAddressBook [1/2]

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

Definition at line 244 of file walletmodel.cpp.

Here is the call graph for this function:

◆ updateAddressBook [2/2]

void WalletModel::updateAddressBook ( const QString &  pubCoin,
const QString &  isUsed,
int  status 
)
slot

Definition at line 249 of file walletmodel.cpp.

Here is the call graph for this function:

◆ updateStatus

void WalletModel::updateStatus ( )
slot

Definition at line 129 of file walletmodel.cpp.

Here is the call graph for this function:

◆ updateTransaction

void WalletModel::updateTransaction ( )
slot

Definition at line 238 of file walletmodel.cpp.

◆ updateWatchOnlyFlag

void WalletModel::updateWatchOnlyFlag ( bool  fHaveWatchonly)
slot

Definition at line 256 of file walletmodel.cpp.

◆ validateAddress()

bool WalletModel::validateAddress ( const QString &  address)

Definition at line 262 of file walletmodel.cpp.

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

◆ WalletUnlocked

void WalletModel::WalletUnlocked ( )
signal
Here is the caller graph for this function:

Member Data Documentation

◆ addressTableModel

AddressTableModel* WalletModel::addressTableModel
private

Definition at line 241 of file walletmodel.h.

◆ cachedBalance

CAmount WalletModel::cachedBalance
private

Definition at line 246 of file walletmodel.h.

◆ cachedEncryptionStatus

EncryptionStatus WalletModel::cachedEncryptionStatus
private

Definition at line 253 of file walletmodel.h.

◆ cachedImmatureBalance

CAmount WalletModel::cachedImmatureBalance
private

Definition at line 249 of file walletmodel.h.

◆ cachedNumBlocks

int WalletModel::cachedNumBlocks
private

Definition at line 254 of file walletmodel.h.

◆ cachedTxLocks

int WalletModel::cachedTxLocks
private

Definition at line 255 of file walletmodel.h.

◆ cachedUnconfirmedBalance

CAmount WalletModel::cachedUnconfirmedBalance
private

Definition at line 247 of file walletmodel.h.

◆ cachedWatchImmatureBalance

CAmount WalletModel::cachedWatchImmatureBalance
private

Definition at line 252 of file walletmodel.h.

◆ cachedWatchOnlyBalance

CAmount WalletModel::cachedWatchOnlyBalance
private

Definition at line 250 of file walletmodel.h.

◆ cachedWatchUnconfBalance

CAmount WalletModel::cachedWatchUnconfBalance
private

Definition at line 251 of file walletmodel.h.

◆ fForceCheckBalanceChanged

bool WalletModel::fForceCheckBalanceChanged
private

Definition at line 235 of file walletmodel.h.

◆ fHaveWatchOnly

bool WalletModel::fHaveWatchOnly
private

Definition at line 234 of file walletmodel.h.

◆ optionsModel

OptionsModel* WalletModel::optionsModel
private

Definition at line 239 of file walletmodel.h.

◆ pollTimer

QTimer* WalletModel::pollTimer
private

Definition at line 256 of file walletmodel.h.

◆ spendableBalance

CAmount WalletModel::spendableBalance
private

Definition at line 248 of file walletmodel.h.

◆ transactionTableModel

TransactionTableModel* WalletModel::transactionTableModel
private

Definition at line 242 of file walletmodel.h.

◆ txTableModel

QAbstractTableModel* WalletModel::txTableModel
private

Definition at line 243 of file walletmodel.h.

◆ wallet

CWallet* WalletModel::wallet
private

Definition at line 233 of file walletmodel.h.


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