Bitcoin Core 31.0.0
P2P Digital Currency
Loading...
Searching...
No Matches
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 ,
  DuplicateAddress , TransactionCreationFailed , AbsurdFee
}
enum  EncryptionStatus { NoKeys , Unencrypted , Locked , Unlocked }

Public Slots

void startPollBalance ()
void updateStatus ()
void updateTransaction ()
void updateAddressBook (const QString &address, const QString &label, bool isMine, wallet::AddressPurpose purpose, int status)
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 unload ()
void canGetAddressesChanged ()
void timerTimeout ()

Public Member Functions

 WalletModel (std::unique_ptr< interfaces::Wallet > wallet, ClientModel &client_model, const PlatformStyle *platformStyle, QObject *parent=nullptr)
 ~WalletModel ()
OptionsModelgetOptionsModel () const
AddressTableModelgetAddressTableModel () const
TransactionTableModelgetTransactionTableModel () const
RecentRequestsTableModelgetRecentRequestsTableModel () const
EncryptionStatus getEncryptionStatus () const
bool validateAddress (const QString &address) const
SendCoinsReturn prepareTransaction (WalletModelTransaction &transaction, const wallet::CCoinControl &coinControl)
void sendCoins (WalletModelTransaction &transaction)
bool setWalletEncrypted (const SecureString &passphrase)
bool setWalletLocked (bool locked, const SecureString &passPhrase=SecureString())
bool changePassphrase (const SecureString &oldPass, const SecureString &newPass)
UnlockContext requestUnlock ()
bool bumpFee (Txid hash, Txid &new_hash)
void displayAddress (std::string sAddress) const
interfaces::Nodenode () const
interfaces::Walletwallet () const
ClientModelclientModel () const
void setClientModel (ClientModel *client_model)
QString getWalletName () const
QString getDisplayName () const
bool isMultiwallet () const
void refresh (bool pk_hash_only=false)
uint256 getLastBlockProcessed () const
interfaces::WalletBalances getCachedBalance () const
CAmount getAvailableBalance (const wallet::CCoinControl *control)

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_can_get_addrs_changed
ClientModelm_client_model
interfaces::Nodem_node
bool fForceCheckBalanceChanged {false}
OptionsModeloptionsModel
AddressTableModeladdressTableModel {nullptr}
TransactionTableModeltransactionTableModel {nullptr}
RecentRequestsTableModelrecentRequestsTableModel {nullptr}
interfaces::WalletBalances m_cached_balances
EncryptionStatus cachedEncryptionStatus {Unencrypted}
QTimer * timer
uint256 m_cached_last_update_tip {}

Detailed Description

Interface to Bitcoin wallet from Qt view code.

Definition at line 48 of file walletmodel.h.

Member Enumeration Documentation

◆ EncryptionStatus

Enumerator
NoKeys 
Unencrypted 
Locked 
Unlocked 

Definition at line 67 of file walletmodel.h.

◆ StatusCode

Enumerator
OK 
InvalidAmount 
InvalidAddress 
AmountExceedsBalance 
DuplicateAddress 
TransactionCreationFailed 
AbsurdFee 

Definition at line 56 of file walletmodel.h.

Constructor & Destructor Documentation

◆ WalletModel()

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

Definition at line 43 of file walletmodel.cpp.

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

◆ ~WalletModel()

WalletModel::~WalletModel ( )

Definition at line 58 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 ( Txid hash,
Txid & new_hash )

Definition at line 464 of file walletmodel.cpp.

Here is the call 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 344 of file walletmodel.cpp.

◆ checkBalanceChanged()

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

Definition at line 120 of file walletmodel.cpp.

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

◆ clientModel()

ClientModel & WalletModel::clientModel ( ) const
inline

Definition at line 139 of file walletmodel.h.

◆ coinsSent

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

◆ displayAddress()

void WalletModel::displayAddress ( std::string sAddress) const

Definition at line 554 of file walletmodel.cpp.

Here is the call graph for this function:

◆ encryptionStatusChanged

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

◆ getAddressTableModel()

AddressTableModel * WalletModel::getAddressTableModel ( ) const

Definition at line 289 of file walletmodel.cpp.

Here is the caller graph for this function:

◆ getAvailableBalance()

CAmount WalletModel::getAvailableBalance ( const wallet::CCoinControl * control)

Definition at line 597 of file walletmodel.cpp.

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

◆ getCachedBalance()

interfaces::WalletBalances WalletModel::getCachedBalance ( ) const

Definition at line 128 of file walletmodel.cpp.

Here is the caller graph for this function:

◆ getDisplayName()

QString WalletModel::getDisplayName ( ) const

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

Here is the caller graph for this function:

◆ getLastBlockProcessed()

uint256 WalletModel::getLastBlockProcessed ( ) const

Definition at line 592 of file walletmodel.cpp.

Here is the caller graph for this function:

◆ getOptionsModel()

OptionsModel * WalletModel::getOptionsModel ( ) const

Definition at line 284 of file walletmodel.cpp.

Here is the caller graph for this function:

◆ getRecentRequestsTableModel()

RecentRequestsTableModel * WalletModel::getRecentRequestsTableModel ( ) const

Definition at line 299 of file walletmodel.cpp.

Here is the caller graph for this function:

◆ getTransactionTableModel()

TransactionTableModel * WalletModel::getTransactionTableModel ( ) const

Definition at line 294 of file walletmodel.cpp.

Here is the caller graph for this function:

◆ getWalletName()

QString WalletModel::getWalletName ( ) const

Definition at line 572 of file walletmodel.cpp.

Here is the caller graph for this function:

◆ isMultiwallet()

bool WalletModel::isMultiwallet ( ) const

Definition at line 582 of file walletmodel.cpp.

◆ isWalletEnabled()

bool WalletModel::isWalletEnabled ( )
static

Definition at line 567 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 call graph for this function:
Here is the caller graph for this function:

◆ node()

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

Definition at line 137 of file walletmodel.h.

◆ pollBalanceChanged

void WalletModel::pollBalanceChanged ( )
slot

Definition at line 92 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 wallet::CCoinControl & coinControl )

Definition at line 151 of file walletmodel.cpp.

Here is the call graph for this function:

◆ refresh()

void WalletModel::refresh ( bool pk_hash_only = false)

Definition at line 587 of file walletmodel.cpp.

◆ requestUnlock()

WalletModel::UnlockContext WalletModel::requestUnlock ( )

Definition at line 428 of file walletmodel.cpp.

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

◆ requireUnlock

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

◆ sendCoins()

void WalletModel::sendCoins ( WalletModelTransaction & transaction)

Definition at line 236 of file walletmodel.cpp.

Here is the call graph for this function:

◆ setClientModel()

void WalletModel::setClientModel ( ClientModel * client_model)

Definition at line 77 of file walletmodel.cpp.

◆ setWalletEncrypted()

bool WalletModel::setWalletEncrypted ( const SecureString & passphrase)

Definition at line 325 of file walletmodel.cpp.

◆ setWalletLocked()

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

Definition at line 330 of file walletmodel.cpp.

◆ showProgress

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

◆ startPollBalance

void WalletModel::startPollBalance ( )
slot

Definition at line 63 of file walletmodel.cpp.

Here is the call graph for this function:

◆ subscribeToCoreSignals()

void WalletModel::subscribeToCoreSignals ( )
private

Definition at line 405 of file walletmodel.cpp.

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

◆ timerTimeout

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

◆ unload

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

◆ unsubscribeFromCoreSignals()

void WalletModel::unsubscribeFromCoreSignals ( )
private

Definition at line 416 of file walletmodel.cpp.

Here is the caller graph for this function:

◆ updateAddressBook

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

Definition at line 139 of file walletmodel.cpp.

◆ updateStatus

void WalletModel::updateStatus ( )
slot

Definition at line 83 of file walletmodel.cpp.

Here is the call graph for this function:

◆ updateTransaction

void WalletModel::updateTransaction ( )
slot

Definition at line 133 of file walletmodel.cpp.

◆ validateAddress()

bool WalletModel::validateAddress ( const QString & address) const

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

Here is the caller graph for this function:

Member Data Documentation

◆ addressTableModel

AddressTableModel* WalletModel::addressTableModel {nullptr}
private

Definition at line 175 of file walletmodel.h.

◆ cachedEncryptionStatus

EncryptionStatus WalletModel::cachedEncryptionStatus {Unencrypted}
private

Definition at line 181 of file walletmodel.h.

◆ fForceCheckBalanceChanged

bool WalletModel::fForceCheckBalanceChanged {false}
private

Definition at line 169 of file walletmodel.h.

◆ m_cached_balances

interfaces::WalletBalances WalletModel::m_cached_balances
private

Definition at line 180 of file walletmodel.h.

◆ m_cached_last_update_tip

uint256 WalletModel::m_cached_last_update_tip {}
private

Definition at line 185 of file walletmodel.h.

◆ m_client_model

ClientModel* WalletModel::m_client_model
private

Definition at line 166 of file walletmodel.h.

◆ m_handler_address_book_changed

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

Definition at line 162 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 165 of file walletmodel.h.

◆ m_handler_show_progress

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

Definition at line 164 of file walletmodel.h.

◆ m_handler_status_changed

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

Definition at line 161 of file walletmodel.h.

◆ m_handler_transaction_changed

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

Definition at line 163 of file walletmodel.h.

◆ m_handler_unload

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

Definition at line 160 of file walletmodel.h.

◆ m_node

interfaces::Node& WalletModel::m_node
private

Definition at line 167 of file walletmodel.h.

◆ m_wallet

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

Definition at line 159 of file walletmodel.h.

◆ optionsModel

OptionsModel* WalletModel::optionsModel
private

Definition at line 173 of file walletmodel.h.

◆ recentRequestsTableModel

RecentRequestsTableModel* WalletModel::recentRequestsTableModel {nullptr}
private

Definition at line 177 of file walletmodel.h.

◆ timer

QTimer* WalletModel::timer
private

Definition at line 182 of file walletmodel.h.

◆ transactionTableModel

TransactionTableModel* WalletModel::transactionTableModel {nullptr}
private

Definition at line 176 of file walletmodel.h.


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