Bitcoin Core  0.18.99
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 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,
  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 ()
 

Signals

void balanceChanged (const interfaces::WalletBalances &balances)
 
void encryptionStatusChanged ()
 
void requireUnlock ()
 
void message (const QString &title, const QString &message, unsigned int style)
 
void coinsSent (WalletModel *wallet, SendCoinsRecipient recipient, QByteArray transaction)
 
void showProgress (const QString &title, int nProgress)
 
void notifyWatchonlyChanged (bool fHaveWatchonly)
 
void unload ()
 
void canGetAddressesChanged ()
 

Public Member Functions

 WalletModel (std::unique_ptr< interfaces::Wallet > wallet, interfaces::Node &node, const PlatformStyle *platformStyle, OptionsModel *optionsModel, QObject *parent=nullptr)
 
 ~WalletModel ()
 
OptionsModelgetOptionsModel ()
 
AddressTableModelgetAddressTableModel ()
 
TransactionTableModelgetTransactionTableModel ()
 
RecentRequestsTableModelgetRecentRequestsTableModel ()
 
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)
 
UnlockContext requestUnlock ()
 
void loadReceiveRequests (std::vector< std::string > &vReceiveRequests)
 
bool saveReceiveRequest (const std::string &sAddress, const int64_t nId, const std::string &sRequest)
 
bool bumpFee (uint256 hash, uint256 &new_hash)
 
bool privateKeysDisabled () const
 
bool canGetAddresses () const
 
interfaces::Nodenode () const
 
interfaces::Walletwallet () const
 
QString getWalletName () const
 
QString getDisplayName () const
 
bool isMultiwallet ()
 
AddressTableModelgetAddressTableModel () const
 

Static Public Member Functions

static bool isWalletEnabled ()
 

Private Member Functions

void subscribeToCoreSignals ()
 
void unsubscribeFromCoreSignals ()
 
void checkBalanceChanged (const interfaces::WalletBalances &new_balances)
 

Private Attributes

std::unique_ptr< interfaces::Walletm_wallet
 
std::unique_ptr< interfaces::Handlerm_handler_unload
 
std::unique_ptr< interfaces::Handlerm_handler_status_changed
 
std::unique_ptr< interfaces::Handlerm_handler_address_book_changed
 
std::unique_ptr< interfaces::Handlerm_handler_transaction_changed
 
std::unique_ptr< interfaces::Handlerm_handler_show_progress
 
std::unique_ptr< interfaces::Handlerm_handler_watch_only_changed
 
std::unique_ptr< interfaces::Handlerm_handler_can_get_addrs_changed
 
interfaces::Nodem_node
 
bool fHaveWatchOnly
 
bool fForceCheckBalanceChanged {false}
 
OptionsModeloptionsModel
 
AddressTableModeladdressTableModel
 
TransactionTableModeltransactionTableModel
 
RecentRequestsTableModelrecentRequestsTableModel
 
interfaces::WalletBalances m_cached_balances
 
EncryptionStatus cachedEncryptionStatus
 
int cachedNumBlocks
 
QTimer * pollTimer
 

Detailed Description

Interface to Bitcoin wallet from Qt view code.

Definition at line 125 of file walletmodel.h.

Member Enumeration Documentation

◆ EncryptionStatus

Enumerator
Unencrypted 
Locked 
Unlocked 

Definition at line 147 of file walletmodel.h.

◆ StatusCode

Enumerator
OK 
InvalidAmount 
InvalidAddress 
AmountExceedsBalance 
AmountWithFeeExceedsBalance 
DuplicateAddress 
TransactionCreationFailed 
TransactionCommitFailed 
AbsurdFee 
PaymentRequestExpired 

Definition at line 133 of file walletmodel.h.

Constructor & Destructor Documentation

◆ WalletModel()

WalletModel::WalletModel ( std::unique_ptr< interfaces::Wallet wallet,
interfaces::Node node,
const PlatformStyle platformStyle,
OptionsModel optionsModel,
QObject *  parent = nullptr 
)
explicit

Definition at line 35 of file walletmodel.cpp.

Here is the call graph for this function:

◆ ~WalletModel()

WalletModel::~WalletModel ( )

Definition at line 55 of file walletmodel.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ balanceChanged

void WalletModel::balanceChanged ( const interfaces::WalletBalances balances)
signal
Here is the caller graph for this function:

◆ bumpFee()

bool WalletModel::bumpFee ( uint256  hash,
uint256 new_hash 
)

Definition at line 511 of file walletmodel.cpp.

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

◆ canGetAddresses()

bool WalletModel::canGetAddresses ( ) const

Definition at line 581 of file walletmodel.cpp.

Here is the caller graph for this function:

◆ canGetAddressesChanged

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

◆ changePassphrase()

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

Definition at line 369 of file walletmodel.cpp.

◆ checkBalanceChanged()

void WalletModel::checkBalanceChanged ( const interfaces::WalletBalances new_balances)
private

Definition at line 94 of file walletmodel.cpp.

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

◆ coinsSent

void WalletModel::coinsSent ( WalletModel wallet,
SendCoinsRecipient  recipient,
QByteArray  transaction 
)
signal
Here is the caller graph for this function:

◆ encryptionStatusChanged

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

◆ getAddressTableModel() [1/2]

AddressTableModel * WalletModel::getAddressTableModel ( )

Definition at line 310 of file walletmodel.cpp.

Here is the caller graph for this function:

◆ getAddressTableModel() [2/2]

AddressTableModel* WalletModel::getAddressTableModel ( ) const
inline

Definition at line 230 of file walletmodel.h.

◆ getDisplayName()

QString WalletModel::getDisplayName ( ) const

Definition at line 591 of file walletmodel.cpp.

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

◆ getEncryptionStatus()

WalletModel::EncryptionStatus WalletModel::getEncryptionStatus ( ) const

Definition at line 325 of file walletmodel.cpp.

Here is the caller graph for this function:

◆ getOptionsModel()

OptionsModel * WalletModel::getOptionsModel ( )

Definition at line 305 of file walletmodel.cpp.

Here is the caller graph for this function:

◆ getRecentRequestsTableModel()

RecentRequestsTableModel * WalletModel::getRecentRequestsTableModel ( )

Definition at line 320 of file walletmodel.cpp.

Here is the caller graph for this function:

◆ getTransactionTableModel()

TransactionTableModel * WalletModel::getTransactionTableModel ( )

Definition at line 315 of file walletmodel.cpp.

Here is the caller graph for this function:

◆ getWalletName()

QString WalletModel::getWalletName ( ) const

Definition at line 586 of file walletmodel.cpp.

Here is the caller graph for this function:

◆ isMultiwallet()

bool WalletModel::isMultiwallet ( )

Definition at line 597 of file walletmodel.cpp.

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

◆ isWalletEnabled()

bool WalletModel::isWalletEnabled ( )
static

Definition at line 571 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 492 of file walletmodel.cpp.

Here is the caller 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:

◆ node()

interfaces::Node& WalletModel::node ( ) const
inline

Definition at line 222 of file walletmodel.h.

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 69 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 
)

Definition at line 126 of file walletmodel.cpp.

Here is the call graph for this function:

◆ privateKeysDisabled()

bool WalletModel::privateKeysDisabled ( ) const

Definition at line 576 of file walletmodel.cpp.

Here is the caller graph for this function:

◆ requestUnlock()

WalletModel::UnlockContext WalletModel::requestUnlock ( )

Definition at line 456 of file walletmodel.cpp.

Here is the call graph for this function:

◆ requireUnlock

void WalletModel::requireUnlock ( )
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 497 of file walletmodel.cpp.

Here is the call graph for this function:

◆ sendCoins()

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

Definition at line 234 of file walletmodel.cpp.

Here is the call graph for this function:

◆ setWalletEncrypted()

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

Definition at line 341 of file walletmodel.cpp.

◆ setWalletLocked()

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

Definition at line 355 of file walletmodel.cpp.

Here is the caller graph for this function:

◆ showProgress

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

◆ subscribeToCoreSignals()

void WalletModel::subscribeToCoreSignals ( )
private

Definition at line 431 of file walletmodel.cpp.

◆ unload

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

◆ unsubscribeFromCoreSignals()

void WalletModel::unsubscribeFromCoreSignals ( )
private

Definition at line 443 of file walletmodel.cpp.

Here is the caller graph for this function:

◆ updateAddressBook

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

Definition at line 108 of file walletmodel.cpp.

Here is the call graph for this function:

◆ updateStatus

void WalletModel::updateStatus ( )
slot

Definition at line 60 of file walletmodel.cpp.

Here is the call graph for this function:

◆ updateTransaction

void WalletModel::updateTransaction ( )
slot

Definition at line 102 of file walletmodel.cpp.

◆ updateWatchOnlyFlag

void WalletModel::updateWatchOnlyFlag ( bool  fHaveWatchonly)
slot

Definition at line 115 of file walletmodel.cpp.

◆ validateAddress()

bool WalletModel::validateAddress ( const QString &  address)

Definition at line 121 of file walletmodel.cpp.

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

◆ wallet()

interfaces::Wallet& WalletModel::wallet ( ) const
inline

Definition at line 223 of file walletmodel.h.

Here is the caller graph for this function:

Member Data Documentation

◆ addressTableModel

AddressTableModel* WalletModel::addressTableModel
private

Definition at line 249 of file walletmodel.h.

◆ cachedEncryptionStatus

EncryptionStatus WalletModel::cachedEncryptionStatus
private

Definition at line 255 of file walletmodel.h.

◆ cachedNumBlocks

int WalletModel::cachedNumBlocks
private

Definition at line 256 of file walletmodel.h.

◆ fForceCheckBalanceChanged

bool WalletModel::fForceCheckBalanceChanged {false}
private

Definition at line 243 of file walletmodel.h.

◆ fHaveWatchOnly

bool WalletModel::fHaveWatchOnly
private

Definition at line 242 of file walletmodel.h.

◆ m_cached_balances

interfaces::WalletBalances WalletModel::m_cached_balances
private

Definition at line 254 of file walletmodel.h.

◆ m_handler_address_book_changed

std::unique_ptr<interfaces::Handler> WalletModel::m_handler_address_book_changed
private

Definition at line 235 of file walletmodel.h.

◆ m_handler_can_get_addrs_changed

std::unique_ptr<interfaces::Handler> WalletModel::m_handler_can_get_addrs_changed
private

Definition at line 239 of file walletmodel.h.

◆ m_handler_show_progress

std::unique_ptr<interfaces::Handler> WalletModel::m_handler_show_progress
private

Definition at line 237 of file walletmodel.h.

◆ m_handler_status_changed

std::unique_ptr<interfaces::Handler> WalletModel::m_handler_status_changed
private

Definition at line 234 of file walletmodel.h.

◆ m_handler_transaction_changed

std::unique_ptr<interfaces::Handler> WalletModel::m_handler_transaction_changed
private

Definition at line 236 of file walletmodel.h.

◆ m_handler_unload

std::unique_ptr<interfaces::Handler> WalletModel::m_handler_unload
private

Definition at line 233 of file walletmodel.h.

◆ m_handler_watch_only_changed

std::unique_ptr<interfaces::Handler> WalletModel::m_handler_watch_only_changed
private

Definition at line 238 of file walletmodel.h.

◆ m_node

interfaces::Node& WalletModel::m_node
private

Definition at line 240 of file walletmodel.h.

◆ m_wallet

std::unique_ptr<interfaces::Wallet> WalletModel::m_wallet
private

Definition at line 232 of file walletmodel.h.

◆ optionsModel

OptionsModel* WalletModel::optionsModel
private

Definition at line 247 of file walletmodel.h.

◆ pollTimer

QTimer* WalletModel::pollTimer
private

Definition at line 258 of file walletmodel.h.

◆ recentRequestsTableModel

RecentRequestsTableModel* WalletModel::recentRequestsTableModel
private

Definition at line 251 of file walletmodel.h.

◆ transactionTableModel

TransactionTableModel* WalletModel::transactionTableModel
private

Definition at line 250 of file walletmodel.h.


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