Bitcoin ABC 0.26.3
P2P Digital Currency
Loading...
Searching...
No Matches
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.
 
using UnloadFn = std::function< void()>
 Register handler for unload message.
 
using ShowProgressFn = std::function< void(const std::string &title, int progress)>
 Register handler for show progress messages.
 
using StatusChangedFn = std::function< void()>
 Register handler for status changed messages.
 
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.
 
using TransactionChangedFn = std::function< void(const TxId &txid, ChangeType status)>
 Register handler for transaction changed messages.
 
using WatchOnlyChangedFn = std::function< void(bool have_watch_only)>
 Register handler for watchonly changed messages.
 
using CanGetAddressesChangedFn = std::function< void()>
 Register handler for keypool changed messages.
 

Public Member Functions

virtual ~Wallet ()
 
virtual bool encryptWallet (const SecureString &wallet_passphrase)=0
 Encrypt wallet.
 
virtual bool isCrypted ()=0
 Return whether wallet is encrypted.
 
virtual bool lock ()=0
 Lock wallet.
 
virtual bool unlock (const SecureString &wallet_passphrase)=0
 Unlock wallet.
 
virtual bool isLocked ()=0
 Return whether wallet is locked.
 
virtual bool changeWalletPassphrase (const SecureString &old_wallet_passphrase, const SecureString &new_wallet_passphrase)=0
 Change wallet passphrase.
 
virtual void abortRescan ()=0
 Abort a rescan.
 
virtual bool backupWallet (const std::string &filename)=0
 Back up wallet.
 
virtual std::string getWalletName ()=0
 Get wallet name.
 
virtual const CChainParamsgetChainParams ()=0
 Get chainparams.
 
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.
 
virtual SigningResult signMessage (const std::string &message, const PKHash &pkhash, std::string &str_sig)=0
 Sign message.
 
virtual bool isSpendable (const CTxDestination &dest)=0
 Return whether wallet has private key.
 
virtual bool haveWatchOnly ()=0
 Return whether wallet has watch only keys.
 
virtual bool setAddressBook (const CTxDestination &dest, const std::string &name, const std::string &purpose)=0
 Add or update address.
 
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.
 
virtual std::vector< WalletAddressgetAddresses ()=0
 Get wallet address list.
 
virtual bool addDestData (const CTxDestination &dest, const std::string &key, const std::string &value)=0
 Add dest data.
 
virtual bool eraseDestData (const CTxDestination &dest, const std::string &key)=0
 Erase dest data.
 
virtual std::vector< std::string > getDestValues (const std::string &prefix)=0
 Get dest values with prefix.
 
virtual void lockCoin (const COutPoint &output)=0
 Lock coin.
 
virtual void unlockCoin (const COutPoint &output)=0
 Unlock coin.
 
virtual bool isLockedCoin (const COutPoint &output)=0
 Return whether coin is locked.
 
virtual void listLockedCoins (std::vector< COutPoint > &outputs)=0
 List locked coins.
 
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.
 
virtual void commitTransaction (CTransactionRef tx, WalletValueMap value_map, WalletOrderForm order_form)=0
 Commit transaction.
 
virtual bool transactionCanBeAbandoned (const TxId &txid)=0
 Return whether transaction can be abandoned.
 
virtual bool abandonTransaction (const TxId &txid)=0
 Abandon transaction.
 
virtual CTransactionRef getTx (const TxId &txid)=0
 Get a transaction.
 
virtual WalletTx getWalletTx (const TxId &txid)=0
 Get transaction information.
 
virtual std::vector< WalletTxgetWalletTxs ()=0
 Get list of all wallet transactions.
 
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.
 
virtual WalletTx getWalletTxDetails (const TxId &txid, WalletTxStatus &tx_status, WalletOrderForm &order_form, bool &in_mempool, int &num_blocks)=0
 Get transaction details.
 
virtual TransactionError fillPSBT (SigHashType sighash_type, bool sign, bool bip32derivs, PartiallySignedTransaction &psbtx, bool &complete) const =0
 Fill PSBT.
 
virtual WalletBalances getBalances ()=0
 Get balances.
 
virtual bool tryGetBalances (WalletBalances &balances, BlockHash &block_hash)=0
 Get balances if possible without blocking.
 
virtual Amount getBalance ()=0
 Get balance.
 
virtual Amount getAvailableBalance (const CCoinControl &coin_control)=0
 Get available balance.
 
virtual isminetype txinIsMine (const CTxIn &txin)=0
 Return whether transaction input belongs to wallet.
 
virtual isminetype txoutIsMine (const CTxOut &txout)=0
 Return whether transaction output belongs to wallet.
 
virtual Amount getDebit (const CTxIn &txin, isminefilter filter)=0
 Return debit amount if transaction input belongs to wallet.
 
virtual Amount getCredit (const CTxOut &txout, isminefilter filter)=0
 Return credit amount if transaction input belongs to wallet.
 
virtual CoinsList listCoins ()=0
 
virtual std::vector< WalletTxOutgetCoins (const std::vector< COutPoint > &outputs)=0
 Return wallet transaction output information.
 
virtual Amount getRequiredFee (unsigned int tx_bytes)=0
 Get required fee.
 
virtual Amount getMinimumFee (unsigned int tx_bytes, const CCoinControl &coin_control)=0
 Get minimum fee.
 
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.
 
virtual void remove ()=0
 
virtual bool isLegacy ()=0
 Return whether is a legacy wallet.
 
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.
 

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

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

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

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

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