Bitcoin Core  0.21.1
P2P Digital Currency
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules
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, AbsurdFee,
  PaymentRequestExpired
}
 
enum  EncryptionStatus { Unencrypted, Locked, Unlocked }
 

Public Slots

void startPollBalance ()
 
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, ClientModel &client_model, const PlatformStyle *platformStyle, 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)
 
interfaces::Nodenode () const
 
interfaces::Walletwallet () const
 
ClientModelclientModel () const
 
void setClientModel (ClientModel *client_model)
 
QString getWalletName () const
 
QString getDisplayName () const
 
bool isMultiwallet ()
 
AddressTableModelgetAddressTableModel () const
 
void refresh (bool pk_hash_only=false)
 
uint256 getLastBlockProcessed () 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::Wallet
m_wallet
 
std::unique_ptr
< interfaces::Handler
m_handler_unload
 
std::unique_ptr
< interfaces::Handler
m_handler_status_changed
 
std::unique_ptr
< interfaces::Handler
m_handler_address_book_changed
 
std::unique_ptr
< interfaces::Handler
m_handler_transaction_changed
 
std::unique_ptr
< interfaces::Handler
m_handler_show_progress
 
std::unique_ptr
< interfaces::Handler
m_handler_watch_only_changed
 
std::unique_ptr
< interfaces::Handler
m_handler_can_get_addrs_changed
 
ClientModelm_client_model
 
interfaces::Nodem_node
 
bool fHaveWatchOnly
 
bool fForceCheckBalanceChanged {false}
 
OptionsModeloptionsModel
 
AddressTableModeladdressTableModel
 
TransactionTableModeltransactionTableModel
 
RecentRequestsTableModelrecentRequestsTableModel
 
interfaces::WalletBalances m_cached_balances
 
EncryptionStatus cachedEncryptionStatus
 
QTimer * timer
 
uint256 m_cached_last_update_tip {}
 

Detailed Description

Interface to Bitcoin wallet from Qt view code.

Definition at line 51 of file walletmodel.h.

Member Enumeration Documentation

Enumerator
Unencrypted 
Locked 
Unlocked 

Definition at line 72 of file walletmodel.h.

Enumerator
OK 
InvalidAmount 
InvalidAddress 
AmountExceedsBalance 
AmountWithFeeExceedsBalance 
DuplicateAddress 
TransactionCreationFailed 
AbsurdFee 
PaymentRequestExpired 

Definition at line 59 of file walletmodel.h.

Constructor & Destructor Documentation

WalletModel::WalletModel ( std::unique_ptr< interfaces::Wallet wallet,
ClientModel client_model,
const PlatformStyle platformStyle,
QObject *  parent = nullptr 
)
explicit

Definition at line 39 of file walletmodel.cpp.

Here is the call graph for this function:

WalletModel::~WalletModel ( )

Definition at line 59 of file walletmodel.cpp.

Here is the call graph for this function:

Member Function Documentation

void WalletModel::balanceChanged ( const interfaces::WalletBalances balances)
signal

Here is the caller graph for this function:

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

Definition at line 487 of file walletmodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void WalletModel::canGetAddressesChanged ( )
signal

Here is the caller graph for this function:

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

Definition at line 338 of file walletmodel.cpp.

Here is the caller graph for this function:

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

Definition at line 114 of file walletmodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

ClientModel& WalletModel::clientModel ( ) const
inline

Definition at line 147 of file walletmodel.h.

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

Here is the caller graph for this function:

void WalletModel::encryptionStatusChanged ( )
signal

Here is the caller graph for this function:

AddressTableModel * WalletModel::getAddressTableModel ( )

Definition at line 285 of file walletmodel.cpp.

Here is the caller graph for this function:

AddressTableModel* WalletModel::getAddressTableModel ( ) const
inline

Definition at line 155 of file walletmodel.h.

QString WalletModel::getDisplayName ( ) const

Definition at line 576 of file walletmodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

WalletModel::EncryptionStatus WalletModel::getEncryptionStatus ( ) const

Definition at line 300 of file walletmodel.cpp.

Here is the caller graph for this function:

uint256 WalletModel::getLastBlockProcessed ( ) const

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

Here is the caller graph for this function:

RecentRequestsTableModel * WalletModel::getRecentRequestsTableModel ( )

Definition at line 295 of file walletmodel.cpp.

Here is the caller graph for this function:

TransactionTableModel * WalletModel::getTransactionTableModel ( )

Definition at line 290 of file walletmodel.cpp.

Here is the caller graph for this function:

QString WalletModel::getWalletName ( ) const

Definition at line 571 of file walletmodel.cpp.

Here is the caller graph for this function:

bool WalletModel::isMultiwallet ( )

Definition at line 582 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 566 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 468 of file walletmodel.cpp.

Here is the caller graph for this function:

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

Here is the caller graph for this function:

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

Definition at line 145 of file walletmodel.h.

Here is the caller graph for this function:

void WalletModel::notifyWatchonlyChanged ( bool  fHaveWatchonly)
signal

Here is the caller graph for this function:

void WalletModel::pollBalanceChanged ( )
slot

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

Here is the call graph for this function:

Here is the caller graph for this function:

void WalletModel::refresh ( bool  pk_hash_only = false)

Definition at line 587 of file walletmodel.cpp.

Here is the caller graph for this function:

WalletModel::UnlockContext WalletModel::requestUnlock ( )

Definition at line 432 of file walletmodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void WalletModel::requireUnlock ( )
signal

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 473 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 230 of file walletmodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void WalletModel::setClientModel ( ClientModel client_model)

Definition at line 71 of file walletmodel.cpp.

Here is the caller graph for this function:

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

Definition at line 316 of file walletmodel.cpp.

Here is the caller graph for this function:

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

Definition at line 324 of file walletmodel.cpp.

Here is the caller graph for this function:

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

Here is the caller graph for this function:

void WalletModel::startPollBalance ( )
slot

Definition at line 64 of file walletmodel.cpp.

Here is the call graph for this function:

void WalletModel::subscribeToCoreSignals ( )
private

Definition at line 407 of file walletmodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void WalletModel::unload ( )
signal

Here is the caller graph for this function:

void WalletModel::unsubscribeFromCoreSignals ( )
private

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

Here is the call graph for this function:

void WalletModel::updateStatus ( )
slot

Definition at line 77 of file walletmodel.cpp.

Here is the call graph for this function:

void WalletModel::updateTransaction ( )
slot

Definition at line 122 of file walletmodel.cpp.

void WalletModel::updateWatchOnlyFlag ( bool  fHaveWatchonly)
slot

Definition at line 135 of file walletmodel.cpp.

bool WalletModel::validateAddress ( const QString &  address)

Definition at line 141 of file walletmodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 146 of file walletmodel.h.

Here is the caller graph for this function:

Member Data Documentation

AddressTableModel* WalletModel::addressTableModel
private

Definition at line 180 of file walletmodel.h.

EncryptionStatus WalletModel::cachedEncryptionStatus
private

Definition at line 186 of file walletmodel.h.

bool WalletModel::fForceCheckBalanceChanged {false}
private

Definition at line 174 of file walletmodel.h.

bool WalletModel::fHaveWatchOnly
private

Definition at line 173 of file walletmodel.h.

interfaces::WalletBalances WalletModel::m_cached_balances
private

Definition at line 185 of file walletmodel.h.

uint256 WalletModel::m_cached_last_update_tip {}
private

Definition at line 190 of file walletmodel.h.

ClientModel* WalletModel::m_client_model
private

Definition at line 170 of file walletmodel.h.

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

Definition at line 165 of file walletmodel.h.

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

Definition at line 169 of file walletmodel.h.

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

Definition at line 167 of file walletmodel.h.

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

Definition at line 164 of file walletmodel.h.

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

Definition at line 166 of file walletmodel.h.

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

Definition at line 163 of file walletmodel.h.

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

Definition at line 168 of file walletmodel.h.

interfaces::Node& WalletModel::m_node
private

Definition at line 171 of file walletmodel.h.

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

Definition at line 162 of file walletmodel.h.

OptionsModel* WalletModel::optionsModel
private

Definition at line 178 of file walletmodel.h.

RecentRequestsTableModel* WalletModel::recentRequestsTableModel
private

Definition at line 182 of file walletmodel.h.

QTimer* WalletModel::timer
private

Definition at line 187 of file walletmodel.h.

TransactionTableModel* WalletModel::transactionTableModel
private

Definition at line 181 of file walletmodel.h.


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