Fabcoin Core  0.16.2
P2P Digital Currency
Classes | Public Types | Public Slots | Signals | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
WalletModel Class Reference

Interface to Fabcoin 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,
  AbsurdFee, PaymentRequestExpired
}
 
enum  EncryptionStatus { Unencrypted, Locked, 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 ()
 
void updateContractBook (const QString &address, const QString &label, const QString &abi, int status)
 

Signals

void balanceChanged (const CAmount &balance, const CAmount &unconfirmedBalance, const CAmount &immatureBalance, const CAmount &stake, const CAmount &watchOnlyBalance, const CAmount &watchUnconfBalance, const CAmount &watchImmatureBalance, const CAmount &watchOnlyStake)
 
void encryptionStatusChanged (int status)
 
void requireUnlock ()
 
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 ()
 
ContractTableModelgetContractTableModel ()
 
TransactionTableModelgetTransactionTableModel ()
 
RecentRequestsTableModelgetRecentRequestsTableModel ()
 
TokenItemModelgetTokenItemModel ()
 
TokenTransactionTableModelgetTokenTransactionTableModel ()
 
CAmount getBalance (const CCoinControl *coinControl=nullptr) const
 
CAmount getUnconfirmedBalance () const
 
CAmount getImmatureBalance () const
 
CAmount getStake () const
 
bool haveWatchOnly () const
 
CAmount getWatchBalance () const
 
CAmount getWatchUnconfirmedBalance () const
 
CAmount getWatchImmatureBalance () const
 
CAmount getWatchStake () 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 changePassphrase (const SecureString &oldPass, const SecureString &newPass)
 
bool backupWallet (const QString &filename)
 
bool hasWalletBackup ()
 
bool restoreWallet (const QString &filename, const QString &param)
 
UnlockContext requestUnlock ()
 
bool getPubKey (const CKeyID &address, CPubKey &vchPubKeyOut) const
 
bool IsSpendable (const CTxDestination &dest) 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
 
bool isUnspentAddress (const std::string &address) 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 transactionCanBeBumped (uint256 hash) const
 
bool bumpFee (uint256 hash)
 
bool hdEnabled () const
 
int getDefaultConfirmTarget () const
 
bool getDefaultWalletRbf () const
 
bool addTokenEntry (const CTokenInfo &token)
 
bool addTokenTxEntry (const CTokenTx &tokenTx, bool fFlushOnClose=true)
 
bool existTokenEntry (const CTokenInfo &token)
 
bool removeTokenEntry (const std::string &sHash)
 
QString getRestorePath ()
 
QString getRestoreParam ()
 
std::vector< CTokenInfogetInvalidTokens ()
 
bool isMineAddress (const std::string &strAddress)
 

Static Public Member Functions

static bool isWalletEnabled ()
 

Private Member Functions

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

Private Attributes

CWalletwallet
 
bool fHaveWatchOnly
 
bool fForceCheckBalanceChanged
 
OptionsModeloptionsModel
 
AddressTableModeladdressTableModel
 
ContractTableModelcontractTableModel
 
TransactionTableModeltransactionTableModel
 
RecentRequestsTableModelrecentRequestsTableModel
 
TokenItemModeltokenItemModel
 
TokenTransactionTableModeltokenTransactionTableModel
 
CAmount cachedBalance
 
CAmount cachedUnconfirmedBalance
 
CAmount cachedImmatureBalance
 
CAmount cachedStake
 
CAmount cachedWatchOnlyBalance
 
CAmount cachedWatchUnconfBalance
 
CAmount cachedWatchImmatureBalance
 
CAmount cachedWatchOnlyStake
 
EncryptionStatus cachedEncryptionStatus
 
int cachedNumBlocks
 
QTimer * pollTimer
 
QString restorePath
 
QString restoreParam
 

Detailed Description

Interface to Fabcoin wallet from Qt view code.

Definition at line 103 of file walletmodel.h.

Member Enumeration Documentation

Enumerator
Unencrypted 
Locked 
Unlocked 

Definition at line 125 of file walletmodel.h.

Enumerator
OK 
InvalidAmount 
InvalidAddress 
AmountExceedsBalance 
AmountWithFeeExceedsBalance 
DuplicateAddress 
TransactionCreationFailed 
TransactionCommitFailed 
AbsurdFee 
PaymentRequestExpired 

Definition at line 111 of file walletmodel.h.

Constructor & Destructor Documentation

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

Definition at line 45 of file walletmodel.cpp.

Here is the call graph for this function:

WalletModel::~WalletModel ( )

Definition at line 81 of file walletmodel.cpp.

Here is the call graph for this function:

Member Function Documentation

bool WalletModel::abandonTransaction ( uint256  hash) const

Definition at line 815 of file walletmodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool WalletModel::addTokenEntry ( const CTokenInfo token)

Definition at line 921 of file walletmodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool WalletModel::addTokenTxEntry ( const CTokenTx tokenTx,
bool  fFlushOnClose = true 
)

Definition at line 926 of file walletmodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool WalletModel::backupWallet ( const QString &  filename)

Definition at line 525 of file walletmodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 245 of file moc_walletmodel.cpp.

Here is the caller graph for this function:

bool WalletModel::bumpFee ( uint256  hash)

Definition at line 828 of file walletmodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 514 of file walletmodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void WalletModel::checkBalanceChanged ( )
private

Definition at line 185 of file walletmodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void WalletModel::checkTokenBalanceChanged ( )
private

Definition at line 219 of file walletmodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 272 of file moc_walletmodel.cpp.

Here is the caller graph for this function:

void WalletModel::encryptionStatusChanged ( int  status)
signal

Definition at line 252 of file moc_walletmodel.cpp.

Here is the caller graph for this function:

bool WalletModel::existTokenEntry ( const CTokenInfo token)

Definition at line 931 of file walletmodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

AddressTableModel * WalletModel::getAddressTableModel ( )

Definition at line 439 of file walletmodel.cpp.

Here is the caller graph for this function:

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

Definition at line 86 of file walletmodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

ContractTableModel * WalletModel::getContractTableModel ( )

Definition at line 444 of file walletmodel.cpp.

Here is the caller graph for this function:

int WalletModel::getDefaultConfirmTarget ( ) const

Definition at line 911 of file walletmodel.cpp.

Here is the caller graph for this function:

bool WalletModel::getDefaultWalletRbf ( ) const

Definition at line 916 of file walletmodel.cpp.

Here is the caller graph for this function:

WalletModel::EncryptionStatus WalletModel::getEncryptionStatus ( ) const

Definition at line 470 of file walletmodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

CAmount WalletModel::getImmatureBalance ( ) const

Definition at line 112 of file walletmodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

std::vector< CTokenInfo > WalletModel::getInvalidTokens ( )

Definition at line 956 of file walletmodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

OptionsModel * WalletModel::getOptionsModel ( )

Definition at line 434 of file walletmodel.cpp.

Here is the caller graph for this function:

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

Definition at line 716 of file walletmodel.cpp.

Here is the caller graph for this function:

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

Definition at line 710 of file walletmodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 700 of file walletmodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

RecentRequestsTableModel * WalletModel::getRecentRequestsTableModel ( )

Definition at line 454 of file walletmodel.cpp.

Here is the caller graph for this function:

QString WalletModel::getRestoreParam ( )

Definition at line 951 of file walletmodel.cpp.

QString WalletModel::getRestorePath ( )

Definition at line 946 of file walletmodel.cpp.

CAmount WalletModel::getStake ( ) const

Definition at line 95 of file walletmodel.cpp.

Here is the caller graph for this function:

TokenItemModel * WalletModel::getTokenItemModel ( )

Definition at line 459 of file walletmodel.cpp.

Here is the caller graph for this function:

TokenTransactionTableModel * WalletModel::getTokenTransactionTableModel ( )

Definition at line 464 of file walletmodel.cpp.

Here is the caller graph for this function:

TransactionTableModel * WalletModel::getTransactionTableModel ( )

Definition at line 449 of file walletmodel.cpp.

Here is the caller graph for this function:

CAmount WalletModel::getUnconfirmedBalance ( ) const

Definition at line 107 of file walletmodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

CAmount WalletModel::getWatchBalance ( ) const

Definition at line 122 of file walletmodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

CAmount WalletModel::getWatchImmatureBalance ( ) const

Definition at line 132 of file walletmodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

CAmount WalletModel::getWatchStake ( ) const

Definition at line 101 of file walletmodel.cpp.

Here is the caller graph for this function:

CAmount WalletModel::getWatchUnconfirmedBalance ( ) const

Definition at line 127 of file walletmodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool WalletModel::hasWalletBackup ( )

Definition at line 537 of file walletmodel.cpp.

Here is the caller graph for this function:

bool WalletModel::haveWatchOnly ( ) const

Definition at line 117 of file walletmodel.cpp.

Here is the caller graph for this function:

bool WalletModel::hdEnabled ( ) const

Definition at line 906 of file walletmodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 766 of file walletmodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool WalletModel::isMineAddress ( const std::string &  strAddress)

Definition at line 974 of file walletmodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool WalletModel::IsSpendable ( const CTxDestination dest) const

Definition at line 705 of file walletmodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool WalletModel::isSpent ( const COutPoint outpoint) const

Definition at line 729 of file walletmodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool WalletModel::isUnspentAddress ( const std::string &  address) const

Definition at line 735 of file walletmodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool WalletModel::isWalletEnabled ( )
static

Definition at line 901 of file walletmodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 756 of file walletmodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 784 of file walletmodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 790 of file walletmodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void WalletModel::lockCoin ( COutPoint output)

Definition at line 772 of file walletmodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 265 of file moc_walletmodel.cpp.

Here is the caller graph for this function:

void WalletModel::notifyWatchonlyChanged ( bool  fHaveWatchonly)
signal

Definition at line 286 of file moc_walletmodel.cpp.

Here is the caller graph for this function:

void WalletModel::pollBalanceChanged ( )
slot

Definition at line 145 of file walletmodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 252 of file walletmodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool WalletModel::removeTokenEntry ( const std::string &  sHash)

Definition at line 941 of file walletmodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

WalletModel::UnlockContext WalletModel::requestUnlock ( )

Definition at line 645 of file walletmodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void WalletModel::requireUnlock ( )
signal

Definition at line 259 of file moc_walletmodel.cpp.

Here is the caller graph for this function:

bool WalletModel::restoreWallet ( const QString &  filename,
const QString &  param 
)

Definition at line 543 of file walletmodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 795 of file walletmodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 364 of file walletmodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 486 of file walletmodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 500 of file walletmodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 279 of file moc_walletmodel.cpp.

void WalletModel::subscribeToCoreSignals ( )
private

Definition at line 622 of file walletmodel.cpp.

Here is the caller graph for this function:

bool WalletModel::transactionCanBeAbandoned ( uint256  hash) const

Definition at line 810 of file walletmodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool WalletModel::transactionCanBeBumped ( uint256  hash) const

Definition at line 821 of file walletmodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void WalletModel::unlockCoin ( COutPoint output)

Definition at line 778 of file walletmodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void WalletModel::unsubscribeFromCoreSignals ( )
private

Definition at line 633 of file walletmodel.cpp.

Here is the caller graph for this function:

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

Definition at line 233 of file walletmodel.cpp.

Here is the call graph for this function:

void WalletModel::updateContractBook ( const QString &  address,
const QString &  label,
const QString &  abi,
int  status 
)
slot

Definition at line 179 of file walletmodel.cpp.

Here is the call graph for this function:

void WalletModel::updateStatus ( )
slot

Definition at line 137 of file walletmodel.cpp.

Here is the call graph for this function:

void WalletModel::updateTransaction ( )
slot

Definition at line 227 of file walletmodel.cpp.

void WalletModel::updateWatchOnlyFlag ( bool  fHaveWatchonly)
slot

Definition at line 240 of file walletmodel.cpp.

bool WalletModel::validateAddress ( const QString &  address)

Definition at line 246 of file walletmodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

AddressTableModel* WalletModel::addressTableModel
private

Definition at line 261 of file walletmodel.h.

CAmount WalletModel::cachedBalance
private

Definition at line 269 of file walletmodel.h.

EncryptionStatus WalletModel::cachedEncryptionStatus
private

Definition at line 277 of file walletmodel.h.

CAmount WalletModel::cachedImmatureBalance
private

Definition at line 271 of file walletmodel.h.

int WalletModel::cachedNumBlocks
private

Definition at line 278 of file walletmodel.h.

CAmount WalletModel::cachedStake
private

Definition at line 272 of file walletmodel.h.

CAmount WalletModel::cachedUnconfirmedBalance
private

Definition at line 270 of file walletmodel.h.

CAmount WalletModel::cachedWatchImmatureBalance
private

Definition at line 275 of file walletmodel.h.

CAmount WalletModel::cachedWatchOnlyBalance
private

Definition at line 273 of file walletmodel.h.

CAmount WalletModel::cachedWatchOnlyStake
private

Definition at line 276 of file walletmodel.h.

CAmount WalletModel::cachedWatchUnconfBalance
private

Definition at line 274 of file walletmodel.h.

ContractTableModel* WalletModel::contractTableModel
private

Definition at line 262 of file walletmodel.h.

bool WalletModel::fForceCheckBalanceChanged
private

Definition at line 255 of file walletmodel.h.

bool WalletModel::fHaveWatchOnly
private

Definition at line 254 of file walletmodel.h.

OptionsModel* WalletModel::optionsModel
private

Definition at line 259 of file walletmodel.h.

QTimer* WalletModel::pollTimer
private

Definition at line 280 of file walletmodel.h.

RecentRequestsTableModel* WalletModel::recentRequestsTableModel
private

Definition at line 264 of file walletmodel.h.

QString WalletModel::restoreParam
private

Definition at line 283 of file walletmodel.h.

QString WalletModel::restorePath
private

Definition at line 282 of file walletmodel.h.

TokenItemModel* WalletModel::tokenItemModel
private

Definition at line 265 of file walletmodel.h.

TokenTransactionTableModel* WalletModel::tokenTransactionTableModel
private

Definition at line 266 of file walletmodel.h.

TransactionTableModel* WalletModel::transactionTableModel
private

Definition at line 263 of file walletmodel.h.

CWallet* WalletModel::wallet
private

Definition at line 253 of file walletmodel.h.


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