Bitcoin Core  0.19.99
P2P Digital Currency
Public Types | Public Member Functions | List of all members
interfaces::Wallet Class Referenceabstract

Interface for accessing a wallet. More...

#include <wallet.h>

Public Types

using CoinsList = std::map< CTxDestination, std::vector< std::tuple< COutPoint, WalletTxOut > >>
 Return AvailableCoins + LockedCoins grouped by wallet address. More...
 
using UnloadFn = std::function< void()>
 Register handler for unload message. More...
 
using ShowProgressFn = std::function< void(const std::string &title, int progress)>
 Register handler for show progress messages. More...
 
using StatusChangedFn = std::function< void()>
 Register handler for status changed messages. More...
 
using AddressBookChangedFn = std::function< void(const CTxDestination &address, const std::string &label, bool is_mine, const std::string &purpose, ChangeType status)>
 Register handler for address book changed messages. More...
 
using TransactionChangedFn = std::function< void(const uint256 &txid, ChangeType status)>
 Register handler for transaction changed messages. More...
 
using WatchOnlyChangedFn = std::function< void(bool have_watch_only)>
 Register handler for watchonly changed messages. More...
 
using CanGetAddressesChangedFn = std::function< void()>
 Register handler for keypool changed messages. More...
 

Public Member Functions

virtual ~Wallet ()
 
virtual bool encryptWallet (const SecureString &wallet_passphrase)=0
 Encrypt wallet. More...
 
virtual bool isCrypted ()=0
 Return whether wallet is encrypted. More...
 
virtual bool lock ()=0
 Lock wallet. More...
 
virtual bool unlock (const SecureString &wallet_passphrase)=0
 Unlock wallet. More...
 
virtual bool isLocked ()=0
 Return whether wallet is locked. More...
 
virtual bool changeWalletPassphrase (const SecureString &old_wallet_passphrase, const SecureString &new_wallet_passphrase)=0
 Change wallet passphrase. More...
 
virtual void abortRescan ()=0
 Abort a rescan. More...
 
virtual bool backupWallet (const std::string &filename)=0
 Back up wallet. More...
 
virtual std::string getWalletName ()=0
 Get wallet name. More...
 
virtual bool getNewDestination (const OutputType type, const std::string label, CTxDestination &dest)=0
 
virtual bool getPubKey (const CScript &script, const CKeyID &address, CPubKey &pub_key)=0
 Get public key. More...
 
virtual bool getPrivKey (const CScript &script, const CKeyID &address, CKey &key)=0
 Get private key. More...
 
virtual bool isSpendable (const CTxDestination &dest)=0
 Return whether wallet has private key. More...
 
virtual bool haveWatchOnly ()=0
 Return whether wallet has watch only keys. More...
 
virtual bool setAddressBook (const CTxDestination &dest, const std::string &name, const std::string &purpose)=0
 Add or update address. More...
 
virtual bool delAddressBook (const CTxDestination &dest)=0
 
virtual bool getAddress (const CTxDestination &dest, std::string *name, isminetype *is_mine, std::string *purpose)=0
 Look up address in wallet, return whether exists. More...
 
virtual std::vector< WalletAddressgetAddresses ()=0
 Get wallet address list. More...
 
virtual bool addDestData (const CTxDestination &dest, const std::string &key, const std::string &value)=0
 Add dest data. More...
 
virtual bool eraseDestData (const CTxDestination &dest, const std::string &key)=0
 Erase dest data. More...
 
virtual std::vector< std::string > getDestValues (const std::string &prefix)=0
 Get dest values with prefix. More...
 
virtual void lockCoin (const COutPoint &output)=0
 Lock coin. More...
 
virtual void unlockCoin (const COutPoint &output)=0
 Unlock coin. More...
 
virtual bool isLockedCoin (const COutPoint &output)=0
 Return whether coin is locked. More...
 
virtual void listLockedCoins (std::vector< COutPoint > &outputs)=0
 List locked coins. More...
 
virtual CTransactionRef createTransaction (const std::vector< CRecipient > &recipients, const CCoinControl &coin_control, bool sign, int &change_pos, CAmount &fee, std::string &fail_reason)=0
 Create transaction. More...
 
virtual void commitTransaction (CTransactionRef tx, WalletValueMap value_map, WalletOrderForm order_form)=0
 Commit transaction. More...
 
virtual bool transactionCanBeAbandoned (const uint256 &txid)=0
 Return whether transaction can be abandoned. More...
 
virtual bool abandonTransaction (const uint256 &txid)=0
 Abandon transaction. More...
 
virtual bool transactionCanBeBumped (const uint256 &txid)=0
 Return whether transaction can be bumped. More...
 
virtual bool createBumpTransaction (const uint256 &txid, const CCoinControl &coin_control, CAmount total_fee, std::vector< std::string > &errors, CAmount &old_fee, CAmount &new_fee, CMutableTransaction &mtx)=0
 Create bump transaction. More...
 
virtual bool signBumpTransaction (CMutableTransaction &mtx)=0
 Sign bump transaction. More...
 
virtual bool commitBumpTransaction (const uint256 &txid, CMutableTransaction &&mtx, std::vector< std::string > &errors, uint256 &bumped_txid)=0
 Commit bump transaction. More...
 
virtual CTransactionRef getTx (const uint256 &txid)=0
 Get a transaction. More...
 
virtual WalletTx getWalletTx (const uint256 &txid)=0
 Get transaction information. More...
 
virtual std::vector< WalletTxgetWalletTxs ()=0
 Get list of all wallet transactions. More...
 
virtual bool tryGetTxStatus (const uint256 &txid, WalletTxStatus &tx_status, int &num_blocks, int64_t &block_time)=0
 Try to get updated status for a particular transaction, if possible without blocking. More...
 
virtual WalletTx getWalletTxDetails (const uint256 &txid, WalletTxStatus &tx_status, WalletOrderForm &order_form, bool &in_mempool, int &num_blocks)=0
 Get transaction details. More...
 
virtual TransactionError fillPSBT (PartiallySignedTransaction &psbtx, bool &complete, int sighash_type=1, bool sign=true, bool bip32derivs=false)=0
 Fill PSBT. More...
 
virtual WalletBalances getBalances ()=0
 Get balances. More...
 
virtual bool tryGetBalances (WalletBalances &balances, int &num_blocks)=0
 Get balances if possible without blocking. More...
 
virtual CAmount getBalance ()=0
 Get balance. More...
 
virtual CAmount getAvailableBalance (const CCoinControl &coin_control)=0
 Get available balance. More...
 
virtual isminetype txinIsMine (const CTxIn &txin)=0
 Return whether transaction input belongs to wallet. More...
 
virtual isminetype txoutIsMine (const CTxOut &txout)=0
 Return whether transaction output belongs to wallet. More...
 
virtual CAmount getDebit (const CTxIn &txin, isminefilter filter)=0
 Return debit amount if transaction input belongs to wallet. More...
 
virtual CAmount getCredit (const CTxOut &txout, isminefilter filter)=0
 Return credit amount if transaction input belongs to wallet. More...
 
virtual CoinsList listCoins ()=0
 
virtual std::vector< WalletTxOutgetCoins (const std::vector< COutPoint > &outputs)=0
 Return wallet transaction output information. More...
 
virtual CAmount getRequiredFee (unsigned int tx_bytes)=0
 Get required fee. More...
 
virtual CAmount getMinimumFee (unsigned int tx_bytes, const CCoinControl &coin_control, int *returned_target, FeeReason *reason)=0
 Get minimum fee. More...
 
virtual unsigned int getConfirmTarget ()=0
 Get tx confirm target. More...
 
virtual bool hdEnabled ()=0
 
virtual bool canGetAddresses ()=0
 
virtual bool IsWalletFlagSet (uint64_t flag)=0
 
virtual OutputType getDefaultAddressType ()=0
 
virtual OutputType getDefaultChangeType ()=0
 
virtual CAmount getDefaultMaxTxFee ()=0
 Get max tx fee. More...
 
virtual void remove ()=0
 
virtual std::unique_ptr< HandlerhandleUnload (UnloadFn fn)=0
 
virtual std::unique_ptr< HandlerhandleShowProgress (ShowProgressFn fn)=0
 
virtual std::unique_ptr< HandlerhandleStatusChanged (StatusChangedFn fn)=0
 
virtual std::unique_ptr< HandlerhandleAddressBookChanged (AddressBookChangedFn fn)=0
 
virtual std::unique_ptr< HandlerhandleTransactionChanged (TransactionChangedFn fn)=0
 
virtual std::unique_ptr< HandlerhandleWatchOnlyChanged (WatchOnlyChangedFn fn)=0
 
virtual std::unique_ptr< HandlerhandleCanGetAddressesChanged (CanGetAddressesChangedFn fn)=0
 

Detailed Description

Interface for accessing a wallet.

Definition at line 48 of file wallet.h.

Member Typedef Documentation

◆ AddressBookChangedFn

using interfaces::Wallet::AddressBookChangedFn = std::function<void(const CTxDestination& address, const std::string& label, bool is_mine, const std::string& purpose, ChangeType status)>

Register handler for address book changed messages.

Definition at line 283 of file wallet.h.

◆ CanGetAddressesChangedFn

using interfaces::Wallet::CanGetAddressesChangedFn = std::function<void()>

Register handler for keypool changed messages.

Definition at line 295 of file wallet.h.

◆ CoinsList

using interfaces::Wallet::CoinsList = std::map<CTxDestination, std::vector<std::tuple<COutPoint, WalletTxOut> >>

Return AvailableCoins + LockedCoins grouped by wallet address.

(put change in one group with wallet address)

Definition at line 227 of file wallet.h.

◆ ShowProgressFn

using interfaces::Wallet::ShowProgressFn = std::function<void(const std::string& title, int progress)>

Register handler for show progress messages.

Definition at line 271 of file wallet.h.

◆ StatusChangedFn

using interfaces::Wallet::StatusChangedFn = std::function<void()>

Register handler for status changed messages.

Definition at line 275 of file wallet.h.

◆ TransactionChangedFn

using interfaces::Wallet::TransactionChangedFn = std::function<void(const uint256& txid, ChangeType status)>

Register handler for transaction changed messages.

Definition at line 287 of file wallet.h.

◆ UnloadFn

using interfaces::Wallet::UnloadFn = std::function<void()>

Register handler for unload message.

Definition at line 267 of file wallet.h.

◆ WatchOnlyChangedFn

using interfaces::Wallet::WatchOnlyChangedFn = std::function<void(bool have_watch_only)>

Register handler for watchonly changed messages.

Definition at line 291 of file wallet.h.

Constructor & Destructor Documentation

◆ ~Wallet()

virtual interfaces::Wallet::~Wallet ( )
inlinevirtual

Definition at line 51 of file wallet.h.

Here is the call graph for this function:

Member Function Documentation

◆ abandonTransaction()

virtual bool interfaces::Wallet::abandonTransaction ( const uint256 txid)
pure virtual

Abandon transaction.

Here is the caller graph for this function:

◆ abortRescan()

virtual void interfaces::Wallet::abortRescan ( )
pure virtual

Abort a rescan.

Here is the caller graph for this function:

◆ addDestData()

virtual bool interfaces::Wallet::addDestData ( const CTxDestination dest,
const std::string &  key,
const std::string &  value 
)
pure virtual

Add dest data.

Here is the caller graph for this function:

◆ backupWallet()

virtual bool interfaces::Wallet::backupWallet ( const std::string &  filename)
pure virtual

Back up wallet.

Here is the caller graph for this function:

◆ canGetAddresses()

virtual bool interfaces::Wallet::canGetAddresses ( )
pure virtual

◆ changeWalletPassphrase()

virtual bool interfaces::Wallet::changeWalletPassphrase ( const SecureString old_wallet_passphrase,
const SecureString new_wallet_passphrase 
)
pure virtual

Change wallet passphrase.

Here is the caller graph for this function:

◆ commitBumpTransaction()

virtual bool interfaces::Wallet::commitBumpTransaction ( const uint256 txid,
CMutableTransaction &&  mtx,
std::vector< std::string > &  errors,
uint256 bumped_txid 
)
pure virtual

Commit bump transaction.

Here is the caller graph for this function:

◆ commitTransaction()

virtual void interfaces::Wallet::commitTransaction ( CTransactionRef  tx,
WalletValueMap  value_map,
WalletOrderForm  order_form 
)
pure virtual

Commit transaction.

Here is the caller graph for this function:

◆ createBumpTransaction()

virtual bool interfaces::Wallet::createBumpTransaction ( const uint256 txid,
const CCoinControl coin_control,
CAmount  total_fee,
std::vector< std::string > &  errors,
CAmount old_fee,
CAmount new_fee,
CMutableTransaction mtx 
)
pure virtual

Create bump transaction.

Here is the caller graph for this function:

◆ createTransaction()

virtual CTransactionRef interfaces::Wallet::createTransaction ( const std::vector< CRecipient > &  recipients,
const CCoinControl coin_control,
bool  sign,
int &  change_pos,
CAmount fee,
std::string &  fail_reason 
)
pure virtual

Create transaction.

Here is the caller graph for this function:

◆ delAddressBook()

virtual bool interfaces::Wallet::delAddressBook ( const CTxDestination dest)
pure virtual
Here is the caller graph for this function:

◆ encryptWallet()

virtual bool interfaces::Wallet::encryptWallet ( const SecureString wallet_passphrase)
pure virtual

Encrypt wallet.

Here is the caller graph for this function:

◆ eraseDestData()

virtual bool interfaces::Wallet::eraseDestData ( const CTxDestination dest,
const std::string &  key 
)
pure virtual

Erase dest data.

Here is the caller graph for this function:

◆ fillPSBT()

virtual TransactionError interfaces::Wallet::fillPSBT ( PartiallySignedTransaction psbtx,
bool &  complete,
int  sighash_type = 1,
bool  sign = true,
bool  bip32derivs = false 
)
pure virtual

Fill PSBT.

Here is the caller graph for this function:

◆ getAddress()

virtual bool interfaces::Wallet::getAddress ( const CTxDestination dest,
std::string *  name,
isminetype is_mine,
std::string *  purpose 
)
pure virtual

Look up address in wallet, return whether exists.

Here is the caller graph for this function:

◆ getAddresses()

virtual std::vector<WalletAddress> interfaces::Wallet::getAddresses ( )
pure virtual

Get wallet address list.

Here is the caller graph for this function:

◆ getAvailableBalance()

virtual CAmount interfaces::Wallet::getAvailableBalance ( const CCoinControl coin_control)
pure virtual

Get available balance.

Here is the caller graph for this function:

◆ getBalance()

virtual CAmount interfaces::Wallet::getBalance ( )
pure virtual

Get balance.

Here is the caller graph for this function:

◆ getBalances()

virtual WalletBalances interfaces::Wallet::getBalances ( )
pure virtual

Get balances.

Here is the caller graph for this function:

◆ getCoins()

virtual std::vector<WalletTxOut> interfaces::Wallet::getCoins ( const std::vector< COutPoint > &  outputs)
pure virtual

Return wallet transaction output information.

Here is the caller graph for this function:

◆ getConfirmTarget()

virtual unsigned int interfaces::Wallet::getConfirmTarget ( )
pure virtual

Get tx confirm target.

Here is the caller graph for this function:

◆ getCredit()

virtual CAmount interfaces::Wallet::getCredit ( const CTxOut txout,
isminefilter  filter 
)
pure virtual

Return credit amount if transaction input belongs to wallet.

Here is the caller graph for this function:

◆ getDebit()

virtual CAmount interfaces::Wallet::getDebit ( const CTxIn txin,
isminefilter  filter 
)
pure virtual

Return debit amount if transaction input belongs to wallet.

Here is the caller graph for this function:

◆ getDefaultAddressType()

virtual OutputType interfaces::Wallet::getDefaultAddressType ( )
pure virtual
Here is the caller graph for this function:

◆ getDefaultChangeType()

virtual OutputType interfaces::Wallet::getDefaultChangeType ( )
pure virtual

◆ getDefaultMaxTxFee()

virtual CAmount interfaces::Wallet::getDefaultMaxTxFee ( )
pure virtual

Get max tx fee.

Here is the caller graph for this function:

◆ getDestValues()

virtual std::vector<std::string> interfaces::Wallet::getDestValues ( const std::string &  prefix)
pure virtual

Get dest values with prefix.

Here is the caller graph for this function:

◆ getMinimumFee()

virtual CAmount interfaces::Wallet::getMinimumFee ( unsigned int  tx_bytes,
const CCoinControl coin_control,
int *  returned_target,
FeeReason reason 
)
pure virtual

Get minimum fee.

Here is the caller graph for this function:

◆ getNewDestination()

virtual bool interfaces::Wallet::getNewDestination ( const OutputType  type,
const std::string  label,
CTxDestination dest 
)
pure virtual
Here is the caller graph for this function:

◆ getPrivKey()

virtual bool interfaces::Wallet::getPrivKey ( const CScript script,
const CKeyID address,
CKey key 
)
pure virtual

Get private key.

Here is the caller graph for this function:

◆ getPubKey()

virtual bool interfaces::Wallet::getPubKey ( const CScript script,
const CKeyID address,
CPubKey pub_key 
)
pure virtual

Get public key.

Here is the caller graph for this function:

◆ getRequiredFee()

virtual CAmount interfaces::Wallet::getRequiredFee ( unsigned int  tx_bytes)
pure virtual

Get required fee.

Here is the caller graph for this function:

◆ getTx()

virtual CTransactionRef interfaces::Wallet::getTx ( const uint256 txid)
pure virtual

Get a transaction.

Here is the caller graph for this function:

◆ getWalletName()

virtual std::string interfaces::Wallet::getWalletName ( )
pure virtual

Get wallet name.

Here is the caller graph for this function:

◆ getWalletTx()

virtual WalletTx interfaces::Wallet::getWalletTx ( const uint256 txid)
pure virtual

Get transaction information.

Here is the caller graph for this function:

◆ getWalletTxDetails()

virtual WalletTx interfaces::Wallet::getWalletTxDetails ( const uint256 txid,
WalletTxStatus tx_status,
WalletOrderForm order_form,
bool &  in_mempool,
int &  num_blocks 
)
pure virtual

Get transaction details.

Here is the caller graph for this function:

◆ getWalletTxs()

virtual std::vector<WalletTx> interfaces::Wallet::getWalletTxs ( )
pure virtual

Get list of all wallet transactions.

Here is the caller graph for this function:

◆ handleAddressBookChanged()

virtual std::unique_ptr<Handler> interfaces::Wallet::handleAddressBookChanged ( AddressBookChangedFn  fn)
pure virtual

◆ handleCanGetAddressesChanged()

virtual std::unique_ptr<Handler> interfaces::Wallet::handleCanGetAddressesChanged ( CanGetAddressesChangedFn  fn)
pure virtual

◆ handleShowProgress()

virtual std::unique_ptr<Handler> interfaces::Wallet::handleShowProgress ( ShowProgressFn  fn)
pure virtual
Here is the caller graph for this function:

◆ handleStatusChanged()

virtual std::unique_ptr<Handler> interfaces::Wallet::handleStatusChanged ( StatusChangedFn  fn)
pure virtual

◆ handleTransactionChanged()

virtual std::unique_ptr<Handler> interfaces::Wallet::handleTransactionChanged ( TransactionChangedFn  fn)
pure virtual
Here is the caller graph for this function:

◆ handleUnload()

virtual std::unique_ptr<Handler> interfaces::Wallet::handleUnload ( UnloadFn  fn)
pure virtual

◆ handleWatchOnlyChanged()

virtual std::unique_ptr<Handler> interfaces::Wallet::handleWatchOnlyChanged ( WatchOnlyChangedFn  fn)
pure virtual

◆ haveWatchOnly()

virtual bool interfaces::Wallet::haveWatchOnly ( )
pure virtual

Return whether wallet has watch only keys.

Here is the caller graph for this function:

◆ hdEnabled()

virtual bool interfaces::Wallet::hdEnabled ( )
pure virtual
Here is the caller graph for this function:

◆ isCrypted()

virtual bool interfaces::Wallet::isCrypted ( )
pure virtual

Return whether wallet is encrypted.

Here is the caller graph for this function:

◆ isLocked()

virtual bool interfaces::Wallet::isLocked ( )
pure virtual

Return whether wallet is locked.

Here is the caller graph for this function:

◆ isLockedCoin()

virtual bool interfaces::Wallet::isLockedCoin ( const COutPoint output)
pure virtual

Return whether coin is locked.

Here is the caller graph for this function:

◆ isSpendable()

virtual bool interfaces::Wallet::isSpendable ( const CTxDestination dest)
pure virtual

Return whether wallet has private key.

Here is the caller graph for this function:

◆ IsWalletFlagSet()

virtual bool interfaces::Wallet::IsWalletFlagSet ( uint64_t  flag)
pure virtual

◆ listCoins()

virtual CoinsList interfaces::Wallet::listCoins ( )
pure virtual
Here is the caller graph for this function:

◆ listLockedCoins()

virtual void interfaces::Wallet::listLockedCoins ( std::vector< COutPoint > &  outputs)
pure virtual

List locked coins.

Here is the caller graph for this function:

◆ lock()

virtual bool interfaces::Wallet::lock ( )
pure virtual

Lock wallet.

Here is the caller graph for this function:

◆ lockCoin()

virtual void interfaces::Wallet::lockCoin ( const COutPoint output)
pure virtual

Lock coin.

Here is the caller graph for this function:

◆ remove()

virtual void interfaces::Wallet::remove ( )
pure virtual
Here is the caller graph for this function:

◆ setAddressBook()

virtual bool interfaces::Wallet::setAddressBook ( const CTxDestination dest,
const std::string &  name,
const std::string &  purpose 
)
pure virtual

Add or update address.

Here is the caller graph for this function:

◆ signBumpTransaction()

virtual bool interfaces::Wallet::signBumpTransaction ( CMutableTransaction mtx)
pure virtual

Sign bump transaction.

Here is the caller graph for this function:

◆ transactionCanBeAbandoned()

virtual bool interfaces::Wallet::transactionCanBeAbandoned ( const uint256 txid)
pure virtual

Return whether transaction can be abandoned.

Here is the caller graph for this function:

◆ transactionCanBeBumped()

virtual bool interfaces::Wallet::transactionCanBeBumped ( const uint256 txid)
pure virtual

Return whether transaction can be bumped.

Here is the caller graph for this function:

◆ tryGetBalances()

virtual bool interfaces::Wallet::tryGetBalances ( WalletBalances balances,
int &  num_blocks 
)
pure virtual

Get balances if possible without blocking.

Here is the caller graph for this function:

◆ tryGetTxStatus()

virtual bool interfaces::Wallet::tryGetTxStatus ( const uint256 txid,
WalletTxStatus tx_status,
int &  num_blocks,
int64_t &  block_time 
)
pure virtual

Try to get updated status for a particular transaction, if possible without blocking.

Here is the caller graph for this function:

◆ txinIsMine()

virtual isminetype interfaces::Wallet::txinIsMine ( const CTxIn txin)
pure virtual

Return whether transaction input belongs to wallet.

Here is the caller graph for this function:

◆ txoutIsMine()

virtual isminetype interfaces::Wallet::txoutIsMine ( const CTxOut txout)
pure virtual

Return whether transaction output belongs to wallet.

Here is the caller graph for this function:

◆ unlock()

virtual bool interfaces::Wallet::unlock ( const SecureString wallet_passphrase)
pure virtual

Unlock wallet.

Here is the caller graph for this function:

◆ unlockCoin()

virtual void interfaces::Wallet::unlockCoin ( const COutPoint output)
pure virtual

Unlock coin.

Here is the caller graph for this function:

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