Bitcoin ABC 0.30.7
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 TxId &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 const CChainParamsgetChainParams ()=0
 Get chainparams. 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 SigningResult signMessage (const std::string &message, const PKHash &pkhash, std::string &str_sig)=0
 Sign message. 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, Amount &fee, bilingual_str &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 TxId &txid)=0
 Return whether transaction can be abandoned. More...
 
virtual bool abandonTransaction (const TxId &txid)=0
 Abandon transaction. More...
 
virtual CTransactionRef getTx (const TxId &txid)=0
 Get a transaction. More...
 
virtual WalletTx getWalletTx (const TxId &txid)=0
 Get transaction information. More...
 
virtual std::vector< WalletTxgetWalletTxs ()=0
 Get list of all wallet transactions. More...
 
virtual bool tryGetTxStatus (const TxId &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 TxId &txid, WalletTxStatus &tx_status, WalletOrderForm &order_form, bool &in_mempool, int &num_blocks)=0
 Get transaction details. More...
 
virtual TransactionError fillPSBT (SigHashType sighash_type, bool sign, bool bip32derivs, PartiallySignedTransaction &psbtx, bool &complete) const =0
 Fill PSBT. More...
 
virtual WalletBalances getBalances ()=0
 Get balances. More...
 
virtual bool tryGetBalances (WalletBalances &balances, BlockHash &block_hash)=0
 Get balances if possible without blocking. More...
 
virtual Amount getBalance ()=0
 Get balance. More...
 
virtual Amount 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 Amount getDebit (const CTxIn &txin, isminefilter filter)=0
 Return debit amount if transaction input belongs to wallet. More...
 
virtual Amount 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 Amount getRequiredFee (unsigned int tx_bytes)=0
 Get required fee. More...
 
virtual Amount getMinimumFee (unsigned int tx_bytes, const CCoinControl &coin_control)=0
 Get minimum fee. More...
 
virtual bool hdEnabled ()=0
 
virtual bool canGetAddresses () const =0
 
virtual bool privateKeysDisabled ()=0
 
virtual OutputType getDefaultAddressType ()=0
 
virtual Amount getDefaultMaxTxFee ()=0
 Get max tx fee. More...
 
virtual void remove ()=0
 
virtual bool isLegacy ()=0
 Return whether is a legacy wallet. More...
 
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
 
virtual CWalletwallet ()
 Return pointer to internal wallet class, useful for testing. More...
 

Detailed Description

Interface for accessing a wallet.

Definition at line 59 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 275 of file wallet.h.

◆ CanGetAddressesChangedFn

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

Register handler for keypool changed messages.

Definition at line 293 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 224 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 265 of file wallet.h.

◆ StatusChangedFn

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

Register handler for status changed messages.

Definition at line 270 of file wallet.h.

◆ TransactionChangedFn

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

Register handler for transaction changed messages.

Definition at line 282 of file wallet.h.

◆ UnloadFn

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

Register handler for unload message.

Definition at line 261 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 288 of file wallet.h.

Constructor & Destructor Documentation

◆ ~Wallet()

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

Definition at line 61 of file wallet.h.

Member Function Documentation

◆ abandonTransaction()

virtual bool interfaces::Wallet::abandonTransaction ( const TxId 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.

◆ 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 ( ) const
pure virtual
Here is the caller graph for this function:

◆ changeWalletPassphrase()

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

Change wallet passphrase.

◆ 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:

◆ createTransaction()

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

Create transaction.

◆ 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.

◆ eraseDestData()

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

Erase dest data.

◆ fillPSBT()

virtual TransactionError interfaces::Wallet::fillPSBT ( SigHashType  sighash_type,
bool  sign,
bool  bip32derivs,
PartiallySignedTransaction psbtx,
bool &  complete 
) const
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.

◆ getAvailableBalance()

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

Get available balance.

Here is the caller graph for this function:

◆ getBalance()

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

Get balance.

◆ getBalances()

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

Get balances.

Here is the caller graph for this function:

◆ getChainParams()

virtual const CChainParams & interfaces::Wallet::getChainParams ( )
pure virtual

Get chainparams.

◆ 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:

◆ getCredit()

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

Return credit amount if transaction input belongs to wallet.

◆ getDebit()

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

Return debit amount if transaction input belongs to wallet.

◆ getDefaultAddressType()

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

◆ getDefaultMaxTxFee()

virtual Amount 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.

◆ getMinimumFee()

virtual Amount interfaces::Wallet::getMinimumFee ( unsigned int  tx_bytes,
const CCoinControl coin_control 
)
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:

◆ 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 Amount 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 TxId txid)
pure virtual

Get a transaction.

◆ getWalletName()

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

Get wallet name.

◆ getWalletTx()

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

Get transaction information.

◆ getWalletTxDetails()

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

Get transaction details.

◆ getWalletTxs()

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

Get list of all wallet transactions.

◆ 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

◆ isCrypted()

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

Return whether wallet is encrypted.

◆ isLegacy()

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

Return whether is a legacy wallet.

Here is the caller graph for this function:

◆ isLocked()

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

Return whether wallet is locked.

◆ 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:

◆ 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.

◆ lockCoin()

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

Lock coin.

Here is the caller graph for this function:

◆ privateKeysDisabled()

virtual bool interfaces::Wallet::privateKeysDisabled ( )
pure virtual
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:

◆ signMessage()

virtual SigningResult interfaces::Wallet::signMessage ( const std::string &  message,
const PKHash pkhash,
std::string &  str_sig 
)
pure virtual

Sign message.

Here is the caller graph for this function:

◆ transactionCanBeAbandoned()

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

Return whether transaction can be abandoned.

Here is the caller graph for this function:

◆ tryGetBalances()

virtual bool interfaces::Wallet::tryGetBalances ( WalletBalances balances,
BlockHash block_hash 
)
pure virtual

Get balances if possible without blocking.

◆ tryGetTxStatus()

virtual bool interfaces::Wallet::tryGetTxStatus ( const TxId 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.

◆ txinIsMine()

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

Return whether transaction input belongs to wallet.

◆ txoutIsMine()

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

Return whether transaction output belongs to wallet.

◆ unlock()

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

Unlock wallet.

◆ unlockCoin()

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

Unlock coin.

Here is the caller graph for this function:

◆ wallet()

virtual CWallet * interfaces::Wallet::wallet ( )
inlinevirtual

Return pointer to internal wallet class, useful for testing.

Definition at line 298 of file wallet.h.


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