Bitcoin Core  21.99.0
P2P Digital Currency
wallet.h
Go to the documentation of this file.
1 // Copyright (c) 2018-2020 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #ifndef BITCOIN_INTERFACES_WALLET_H
6 #define BITCOIN_INTERFACES_WALLET_H
7 
8 #include <amount.h> // For CAmount
9 #include <interfaces/chain.h> // For ChainClient
10 #include <pubkey.h> // For CKeyID and CScriptID (definitions needed in CTxDestination instantiation)
11 #include <script/standard.h> // For CTxDestination
12 #include <support/allocators/secure.h> // For SecureString
13 #include <util/message.h>
14 #include <util/ui_change_type.h>
15 
16 #include <functional>
17 #include <map>
18 #include <memory>
19 #include <stdint.h>
20 #include <string>
21 #include <tuple>
22 #include <utility>
23 #include <vector>
24 
25 class CCoinControl;
26 class CFeeRate;
27 class CKey;
28 class CWallet;
29 enum class FeeReason;
30 enum class OutputType;
31 enum class TransactionError;
32 enum isminetype : unsigned int;
33 struct CRecipient;
35 struct WalletContext;
37 typedef uint8_t isminefilter;
38 
39 namespace interfaces {
40 
41 class Handler;
42 struct WalletAddress;
43 struct WalletBalances;
44 struct WalletTx;
45 struct WalletTxOut;
46 struct WalletTxStatus;
47 
48 using WalletOrderForm = std::vector<std::pair<std::string, std::string>>;
49 using WalletValueMap = std::map<std::string, std::string>;
50 
52 class Wallet
53 {
54 public:
55  virtual ~Wallet() {}
56 
58  virtual bool encryptWallet(const SecureString& wallet_passphrase) = 0;
59 
61  virtual bool isCrypted() = 0;
62 
64  virtual bool lock() = 0;
65 
67  virtual bool unlock(const SecureString& wallet_passphrase) = 0;
68 
70  virtual bool isLocked() = 0;
71 
73  virtual bool changeWalletPassphrase(const SecureString& old_wallet_passphrase,
74  const SecureString& new_wallet_passphrase) = 0;
75 
77  virtual void abortRescan() = 0;
78 
80  virtual bool backupWallet(const std::string& filename) = 0;
81 
83  virtual std::string getWalletName() = 0;
84 
85  // Get a new address.
86  virtual bool getNewDestination(const OutputType type, const std::string label, CTxDestination& dest) = 0;
87 
89  virtual bool getPubKey(const CScript& script, const CKeyID& address, CPubKey& pub_key) = 0;
90 
92  virtual SigningResult signMessage(const std::string& message, const PKHash& pkhash, std::string& str_sig) = 0;
93 
95  virtual bool isSpendable(const CTxDestination& dest) = 0;
96 
98  virtual bool haveWatchOnly() = 0;
99 
101  virtual bool setAddressBook(const CTxDestination& dest, const std::string& name, const std::string& purpose) = 0;
102 
103  // Remove address.
104  virtual bool delAddressBook(const CTxDestination& dest) = 0;
105 
107  virtual bool getAddress(const CTxDestination& dest,
108  std::string* name,
109  isminetype* is_mine,
110  std::string* purpose) = 0;
111 
113  virtual std::vector<WalletAddress> getAddresses() = 0;
114 
116  virtual bool addDestData(const CTxDestination& dest, const std::string& key, const std::string& value) = 0;
117 
119  virtual bool eraseDestData(const CTxDestination& dest, const std::string& key) = 0;
120 
122  virtual std::vector<std::string> getDestValues(const std::string& prefix) = 0;
123 
125  virtual void lockCoin(const COutPoint& output) = 0;
126 
128  virtual void unlockCoin(const COutPoint& output) = 0;
129 
131  virtual bool isLockedCoin(const COutPoint& output) = 0;
132 
134  virtual void listLockedCoins(std::vector<COutPoint>& outputs) = 0;
135 
137  virtual CTransactionRef createTransaction(const std::vector<CRecipient>& recipients,
138  const CCoinControl& coin_control,
139  bool sign,
140  int& change_pos,
141  CAmount& fee,
142  bilingual_str& fail_reason) = 0;
143 
145  virtual void commitTransaction(CTransactionRef tx,
146  WalletValueMap value_map,
147  WalletOrderForm order_form) = 0;
148 
150  virtual bool transactionCanBeAbandoned(const uint256& txid) = 0;
151 
153  virtual bool abandonTransaction(const uint256& txid) = 0;
154 
156  virtual bool transactionCanBeBumped(const uint256& txid) = 0;
157 
159  virtual bool createBumpTransaction(const uint256& txid,
160  const CCoinControl& coin_control,
161  std::vector<bilingual_str>& errors,
162  CAmount& old_fee,
163  CAmount& new_fee,
164  CMutableTransaction& mtx) = 0;
165 
167  virtual bool signBumpTransaction(CMutableTransaction& mtx) = 0;
168 
170  virtual bool commitBumpTransaction(const uint256& txid,
171  CMutableTransaction&& mtx,
172  std::vector<bilingual_str>& errors,
173  uint256& bumped_txid) = 0;
174 
176  virtual CTransactionRef getTx(const uint256& txid) = 0;
177 
179  virtual WalletTx getWalletTx(const uint256& txid) = 0;
180 
182  virtual std::vector<WalletTx> getWalletTxs() = 0;
183 
185  virtual bool tryGetTxStatus(const uint256& txid,
186  WalletTxStatus& tx_status,
187  int& num_blocks,
188  int64_t& block_time) = 0;
189 
191  virtual WalletTx getWalletTxDetails(const uint256& txid,
192  WalletTxStatus& tx_status,
193  WalletOrderForm& order_form,
194  bool& in_mempool,
195  int& num_blocks) = 0;
196 
198  virtual TransactionError fillPSBT(int sighash_type,
199  bool sign,
200  bool bip32derivs,
202  bool& complete,
203  size_t* n_signed) = 0;
204 
206  virtual WalletBalances getBalances() = 0;
207 
209  virtual bool tryGetBalances(WalletBalances& balances, uint256& block_hash) = 0;
210 
212  virtual CAmount getBalance() = 0;
213 
215  virtual CAmount getAvailableBalance(const CCoinControl& coin_control) = 0;
216 
218  virtual isminetype txinIsMine(const CTxIn& txin) = 0;
219 
221  virtual isminetype txoutIsMine(const CTxOut& txout) = 0;
222 
224  virtual CAmount getDebit(const CTxIn& txin, isminefilter filter) = 0;
225 
227  virtual CAmount getCredit(const CTxOut& txout, isminefilter filter) = 0;
228 
231  using CoinsList = std::map<CTxDestination, std::vector<std::tuple<COutPoint, WalletTxOut>>>;
232  virtual CoinsList listCoins() = 0;
233 
235  virtual std::vector<WalletTxOut> getCoins(const std::vector<COutPoint>& outputs) = 0;
236 
238  virtual CAmount getRequiredFee(unsigned int tx_bytes) = 0;
239 
241  virtual CAmount getMinimumFee(unsigned int tx_bytes,
242  const CCoinControl& coin_control,
243  int* returned_target,
244  FeeReason* reason) = 0;
245 
247  virtual unsigned int getConfirmTarget() = 0;
248 
249  // Return whether HD enabled.
250  virtual bool hdEnabled() = 0;
251 
252  // Return whether the wallet is blank.
253  virtual bool canGetAddresses() = 0;
254 
255  // Return whether private keys enabled.
256  virtual bool privateKeysDisabled() = 0;
257 
258  // Get default address type.
259  virtual OutputType getDefaultAddressType() = 0;
260 
262  virtual CAmount getDefaultMaxTxFee() = 0;
263 
264  // Remove wallet.
265  virtual void remove() = 0;
266 
268  virtual bool isLegacy() = 0;
269 
271  using UnloadFn = std::function<void()>;
272  virtual std::unique_ptr<Handler> handleUnload(UnloadFn fn) = 0;
273 
275  using ShowProgressFn = std::function<void(const std::string& title, int progress)>;
276  virtual std::unique_ptr<Handler> handleShowProgress(ShowProgressFn fn) = 0;
277 
279  using StatusChangedFn = std::function<void()>;
280  virtual std::unique_ptr<Handler> handleStatusChanged(StatusChangedFn fn) = 0;
281 
283  using AddressBookChangedFn = std::function<void(const CTxDestination& address,
284  const std::string& label,
285  bool is_mine,
286  const std::string& purpose,
287  ChangeType status)>;
288  virtual std::unique_ptr<Handler> handleAddressBookChanged(AddressBookChangedFn fn) = 0;
289 
291  using TransactionChangedFn = std::function<void(const uint256& txid, ChangeType status)>;
292  virtual std::unique_ptr<Handler> handleTransactionChanged(TransactionChangedFn fn) = 0;
293 
295  using WatchOnlyChangedFn = std::function<void(bool have_watch_only)>;
296  virtual std::unique_ptr<Handler> handleWatchOnlyChanged(WatchOnlyChangedFn fn) = 0;
297 
299  using CanGetAddressesChangedFn = std::function<void()>;
300  virtual std::unique_ptr<Handler> handleCanGetAddressesChanged(CanGetAddressesChangedFn fn) = 0;
301 
303  virtual CWallet* wallet() { return nullptr; }
304 };
305 
309 class WalletClient : public ChainClient
310 {
311 public:
313  virtual std::unique_ptr<Wallet> createWallet(const std::string& name, const SecureString& passphrase, uint64_t wallet_creation_flags, bilingual_str& error, std::vector<bilingual_str>& warnings) = 0;
314 
316  virtual std::unique_ptr<Wallet> loadWallet(const std::string& name, bilingual_str& error, std::vector<bilingual_str>& warnings) = 0;
317 
319  virtual std::string getWalletDir() = 0;
320 
322  virtual std::vector<std::string> listWalletDir() = 0;
323 
325  virtual std::vector<std::unique_ptr<Wallet>> getWallets() = 0;
326 
330  using LoadWalletFn = std::function<void(std::unique_ptr<Wallet> wallet)>;
331  virtual std::unique_ptr<Handler> handleLoadWallet(LoadWalletFn fn) = 0;
332 };
333 
336 {
339  std::string name;
340  std::string purpose;
341 
343  : dest(std::move(dest)), is_mine(is_mine), name(std::move(name)), purpose(std::move(purpose))
344  {
345  }
346 };
347 
350 {
354  bool have_watch_only = false;
358 
359  bool balanceChanged(const WalletBalances& prev) const
360  {
361  return balance != prev.balance || unconfirmed_balance != prev.unconfirmed_balance ||
365  }
366 };
367 
368 // Wallet transaction information.
369 struct WalletTx
370 {
372  std::vector<isminetype> txin_is_mine;
373  std::vector<isminetype> txout_is_mine;
374  std::vector<CTxDestination> txout_address;
375  std::vector<isminetype> txout_address_is_mine;
379  int64_t time;
380  std::map<std::string, std::string> value_map;
382 };
383 
386 {
390  unsigned int time_received;
391  uint32_t lock_time;
392  bool is_final;
397 };
398 
401 {
403  int64_t time;
405  bool is_spent = false;
406 };
407 
410 std::unique_ptr<Wallet> MakeWallet(const std::shared_ptr<CWallet>& wallet);
411 
414 std::unique_ptr<WalletClient> MakeWalletClient(Chain& chain, ArgsManager& args);
415 
416 } // namespace interfaces
417 
418 #endif // BITCOIN_INTERFACES_WALLET_H
interfaces::Wallet::isLocked
virtual bool isLocked()=0
Return whether wallet is locked.
interfaces::Wallet::getAvailableBalance
virtual CAmount getAvailableBalance(const CCoinControl &coin_control)=0
Get available balance.
CTxIn
An input of a transaction.
Definition: transaction.h:65
interfaces
Definition: dummywallet.cpp:10
interfaces::Wallet::getMinimumFee
virtual CAmount getMinimumFee(unsigned int tx_bytes, const CCoinControl &coin_control, int *returned_target, FeeReason *reason)=0
Get minimum fee.
interfaces::Wallet::txoutIsMine
virtual isminetype txoutIsMine(const CTxOut &txout)=0
Return whether transaction output belongs to wallet.
FeeReason
FeeReason
Definition: fees.h:43
interfaces::Wallet::getWalletTx
virtual WalletTx getWalletTx(const uint256 &txid)=0
Get transaction information.
interfaces::WalletTx::txout_address_is_mine
std::vector< isminetype > txout_address_is_mine
Definition: wallet.h:375
OutputType
OutputType
Definition: outputtype.h:17
interfaces::WalletAddress::is_mine
isminetype is_mine
Definition: wallet.h:338
ui_change_type.h
interfaces::Wallet::ShowProgressFn
std::function< void(const std::string &title, int progress)> ShowProgressFn
Register handler for show progress messages.
Definition: wallet.h:275
interfaces::Wallet::UnloadFn
std::function< void()> UnloadFn
Register handler for unload message.
Definition: wallet.h:271
interfaces::MakeWallet
std::unique_ptr< Wallet > MakeWallet(const std::shared_ptr< CWallet > &wallet)
Return implementation of Wallet interface.
Definition: dummywallet.cpp:60
interfaces::Wallet::~Wallet
virtual ~Wallet()
Definition: wallet.h:55
interfaces::WalletTxStatus::depth_in_main_chain
int depth_in_main_chain
Definition: wallet.h:389
isminefilter
uint8_t isminefilter
Definition: wallet.h:36
interfaces::Wallet::getConfirmTarget
virtual unsigned int getConfirmTarget()=0
Get tx confirm target.
interfaces::WalletTxOut::depth_in_main_chain
int depth_in_main_chain
Definition: wallet.h:404
interfaces::WalletClient::createWallet
virtual std::unique_ptr< Wallet > createWallet(const std::string &name, const SecureString &passphrase, uint64_t wallet_creation_flags, bilingual_str &error, std::vector< bilingual_str > &warnings)=0
Create new wallet.
interfaces::WalletTxStatus::is_final
bool is_final
Definition: wallet.h:392
bilingual_str
Bilingual messages:
Definition: translation.h:16
interfaces::Wallet::signMessage
virtual SigningResult signMessage(const std::string &message, const PKHash &pkhash, std::string &str_sig)=0
Sign message.
interfaces::WalletTx::is_coinbase
bool is_coinbase
Definition: wallet.h:381
interfaces::WalletTxStatus::block_height
int block_height
Definition: wallet.h:387
CCoinControl
Coin Control Features.
Definition: coincontrol.h:23
interfaces::Wallet::listLockedCoins
virtual void listLockedCoins(std::vector< COutPoint > &outputs)=0
List locked coins.
interfaces::Wallet::StatusChangedFn
std::function< void()> StatusChangedFn
Register handler for status changed messages.
Definition: wallet.h:279
interfaces::WalletBalances::unconfirmed_balance
CAmount unconfirmed_balance
Definition: wallet.h:352
interfaces::WalletBalances::balanceChanged
bool balanceChanged(const WalletBalances &prev) const
Definition: wallet.h:359
interfaces::Wallet::tryGetTxStatus
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.
interfaces::WalletClient::LoadWalletFn
std::function< void(std::unique_ptr< Wallet > wallet)> LoadWalletFn
Register handler for load wallet messages.
Definition: wallet.h:330
wallet
Definition: interfaces.cpp:48
interfaces::WalletBalances::have_watch_only
bool have_watch_only
Definition: wallet.h:354
interfaces::WalletTxOut
Wallet transaction output.
Definition: wallet.h:400
CKeyID
A reference to a CKey: the Hash160 of its serialized public key.
Definition: pubkey.h:21
interfaces::WalletBalances::immature_watch_only_balance
CAmount immature_watch_only_balance
Definition: wallet.h:357
pubkey.h
chain.h
CTransactionRef
std::shared_ptr< const CTransaction > CTransactionRef
Definition: transaction.h:386
interfaces::Wallet::getWalletTxs
virtual std::vector< WalletTx > getWalletTxs()=0
Get list of all wallet transactions.
interfaces::WalletTx::time
int64_t time
Definition: wallet.h:379
interfaces::Wallet::getDestValues
virtual std::vector< std::string > getDestValues(const std::string &prefix)=0
Get dest values with prefix.
interfaces::MakeWalletClient
std::unique_ptr< WalletClient > MakeWalletClient(Chain &chain, ArgsManager &args)
Return implementation of ChainClient interface for a wallet client.
Definition: interfaces.cpp:596
interfaces::WalletBalances::balance
CAmount balance
Definition: wallet.h:351
CFeeRate
Fee rate in satoshis per kilobyte: CAmount / kB.
Definition: feerate.h:29
interfaces::WalletClient::handleLoadWallet
virtual std::unique_ptr< Handler > handleLoadWallet(LoadWalletFn fn)=0
interfaces::Wallet::unlock
virtual bool unlock(const SecureString &wallet_passphrase)=0
Unlock wallet.
SigningResult
SigningResult
Definition: message.h:42
interfaces::Wallet::handleWatchOnlyChanged
virtual std::unique_ptr< Handler > handleWatchOnlyChanged(WatchOnlyChangedFn fn)=0
interfaces::Wallet::getAddress
virtual bool getAddress(const CTxDestination &dest, std::string *name, isminetype *is_mine, std::string *purpose)=0
Look up address in wallet, return whether exists.
interfaces::WalletTxStatus::is_coinbase
bool is_coinbase
Definition: wallet.h:395
prefix
const char * prefix
Definition: rest.cpp:674
interfaces::Wallet::commitBumpTransaction
virtual bool commitBumpTransaction(const uint256 &txid, CMutableTransaction &&mtx, std::vector< bilingual_str > &errors, uint256 &bumped_txid)=0
Commit bump transaction.
interfaces::WalletClient::getWallets
virtual std::vector< std::unique_ptr< Wallet > > getWallets()=0
Return interfaces for accessing wallets (if any).
interfaces::WalletBalances::watch_only_balance
CAmount watch_only_balance
Definition: wallet.h:355
interfaces::Wallet::getBalance
virtual CAmount getBalance()=0
Get balance.
TransactionError
TransactionError
Definition: error.h:22
interfaces::Wallet::remove
virtual void remove()=0
interfaces::WalletTx::value_map
std::map< std::string, std::string > value_map
Definition: wallet.h:380
interfaces::Chain
Interface giving clients (wallet processes, maybe other analysis tools in the future) ability to acce...
Definition: chain.h:89
SecureString
std::basic_string< char, std::char_traits< char >, secure_allocator< char > > SecureString
Definition: secure.h:60
ChangeType
ChangeType
General change type (added, updated, removed).
Definition: ui_change_type.h:9
interfaces::Wallet::unlockCoin
virtual void unlockCoin(const COutPoint &output)=0
Unlock coin.
isminetype
isminetype
IsMine() return codes, which depend on ScriptPubKeyMan implementation.
Definition: ismine.h:38
interfaces::WalletBalances
Collection of wallet balances.
Definition: wallet.h:349
interfaces::Wallet::eraseDestData
virtual bool eraseDestData(const CTxDestination &dest, const std::string &key)=0
Erase dest data.
interfaces::WalletClient::loadWallet
virtual std::unique_ptr< Wallet > loadWallet(const std::string &name, bilingual_str &error, std::vector< bilingual_str > &warnings)=0
Load existing wallet.
interfaces::Wallet::commitTransaction
virtual void commitTransaction(CTransactionRef tx, WalletValueMap value_map, WalletOrderForm order_form)=0
Commit transaction.
interfaces::Wallet::getRequiredFee
virtual CAmount getRequiredFee(unsigned int tx_bytes)=0
Get required fee.
CTxOut
An output of a transaction.
Definition: transaction.h:128
interfaces::Wallet::createTransaction
virtual CTransactionRef createTransaction(const std::vector< CRecipient > &recipients, const CCoinControl &coin_control, bool sign, int &change_pos, CAmount &fee, bilingual_str &fail_reason)=0
Create transaction.
interfaces::WalletTx::change
CAmount change
Definition: wallet.h:378
interfaces::WalletClient::listWalletDir
virtual std::vector< std::string > listWalletDir()=0
Return available wallets in wallet directory.
message.h
interfaces::Wallet::txinIsMine
virtual isminetype txinIsMine(const CTxIn &txin)=0
Return whether transaction input belongs to wallet.
interfaces::WalletTx::debit
CAmount debit
Definition: wallet.h:377
interfaces::Wallet::handleAddressBookChanged
virtual std::unique_ptr< Handler > handleAddressBookChanged(AddressBookChangedFn fn)=0
interfaces::Wallet::isLockedCoin
virtual bool isLockedCoin(const COutPoint &output)=0
Return whether coin is locked.
interfaces::Wallet::transactionCanBeBumped
virtual bool transactionCanBeBumped(const uint256 &txid)=0
Return whether transaction can be bumped.
interfaces::WalletTx
Definition: wallet.h:369
interfaces::Wallet::tryGetBalances
virtual bool tryGetBalances(WalletBalances &balances, uint256 &block_hash)=0
Get balances if possible without blocking.
interfaces::Wallet::CanGetAddressesChangedFn
std::function< void()> CanGetAddressesChangedFn
Register handler for keypool changed messages.
Definition: wallet.h:299
interfaces::Wallet::TransactionChangedFn
std::function< void(const uint256 &txid, ChangeType status)> TransactionChangedFn
Register handler for transaction changed messages.
Definition: wallet.h:291
CAmount
int64_t CAmount
Amount in satoshis (Can be negative)
Definition: amount.h:12
interfaces::WalletAddress::purpose
std::string purpose
Definition: wallet.h:340
standard.h
interfaces::Wallet::handleShowProgress
virtual std::unique_ptr< Handler > handleShowProgress(ShowProgressFn fn)=0
interfaces::WalletAddress::name
std::string name
Definition: wallet.h:339
interfaces::Wallet::canGetAddresses
virtual bool canGetAddresses()=0
interfaces::Wallet::getDebit
virtual CAmount getDebit(const CTxIn &txin, isminefilter filter)=0
Return debit amount if transaction input belongs to wallet.
interfaces::Wallet::backupWallet
virtual bool backupWallet(const std::string &filename)=0
Back up wallet.
interfaces::Wallet::handleStatusChanged
virtual std::unique_ptr< Handler > handleStatusChanged(StatusChangedFn fn)=0
interfaces::Wallet::getWalletTxDetails
virtual WalletTx getWalletTxDetails(const uint256 &txid, WalletTxStatus &tx_status, WalletOrderForm &order_form, bool &in_mempool, int &num_blocks)=0
Get transaction details.
interfaces::Wallet::fillPSBT
virtual TransactionError fillPSBT(int sighash_type, bool sign, bool bip32derivs, PartiallySignedTransaction &psbtx, bool &complete, size_t *n_signed)=0
Fill PSBT.
interfaces::WalletClient
Wallet chain client that in addition to having chain client methods for starting up,...
Definition: wallet.h:309
uint256
256-bit opaque blob.
Definition: uint256.h:124
interfaces::Wallet::getCredit
virtual CAmount getCredit(const CTxOut &txout, isminefilter filter)=0
Return credit amount if transaction input belongs to wallet.
interfaces::Wallet::getBalances
virtual WalletBalances getBalances()=0
Get balances.
interfaces::WalletTxStatus
Updated transaction status.
Definition: wallet.h:385
interfaces::Wallet::delAddressBook
virtual bool delAddressBook(const CTxDestination &dest)=0
interfaces::Wallet
Interface for accessing a wallet.
Definition: wallet.h:52
interfaces::WalletTxStatus::is_in_main_chain
bool is_in_main_chain
Definition: wallet.h:396
interfaces::WalletTxOut::txout
CTxOut txout
Definition: wallet.h:402
interfaces::Wallet::getNewDestination
virtual bool getNewDestination(const OutputType type, const std::string label, CTxDestination &dest)=0
CScript
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:404
interfaces::WalletTxStatus::blocks_to_maturity
int blocks_to_maturity
Definition: wallet.h:388
interfaces::WalletOrderForm
std::vector< std::pair< std::string, std::string > > WalletOrderForm
Definition: wallet.h:48
interfaces::WalletAddress::WalletAddress
WalletAddress(CTxDestination dest, isminetype is_mine, std::string name, std::string purpose)
Definition: wallet.h:342
interfaces::Wallet::getDefaultMaxTxFee
virtual CAmount getDefaultMaxTxFee()=0
Get max tx fee.
interfaces::WalletTx::txin_is_mine
std::vector< isminetype > txin_is_mine
Definition: wallet.h:372
interfaces::Wallet::WatchOnlyChangedFn
std::function< void(bool have_watch_only)> WatchOnlyChangedFn
Register handler for watchonly changed messages.
Definition: wallet.h:295
secure.h
name
const char * name
Definition: rest.cpp:42
interfaces::WalletBalances::immature_balance
CAmount immature_balance
Definition: wallet.h:353
interfaces::Wallet::getWalletName
virtual std::string getWalletName()=0
Get wallet name.
interfaces::Wallet::encryptWallet
virtual bool encryptWallet(const SecureString &wallet_passphrase)=0
Encrypt wallet.
PKHash
Definition: standard.h:140
interfaces::Wallet::CoinsList
std::map< CTxDestination, std::vector< std::tuple< COutPoint, WalletTxOut > >> CoinsList
Return AvailableCoins + LockedCoins grouped by wallet address.
Definition: wallet.h:231
interfaces::WalletTxStatus::is_trusted
bool is_trusted
Definition: wallet.h:393
interfaces::Wallet::getDefaultAddressType
virtual OutputType getDefaultAddressType()=0
CPubKey
An encapsulated public key.
Definition: pubkey.h:31
interfaces::Wallet::wallet
virtual CWallet * wallet()
Return pointer to internal wallet class, useful for testing.
Definition: wallet.h:303
interfaces::WalletTx::txout_is_mine
std::vector< isminetype > txout_is_mine
Definition: wallet.h:373
interfaces::ChainClient
Interface to let node manage chain clients (wallets, or maybe tools for monitoring and analysis in th...
Definition: chain.h:284
interfaces::Wallet::handleUnload
virtual std::unique_ptr< Handler > handleUnload(UnloadFn fn)=0
interfaces::Wallet::listCoins
virtual CoinsList listCoins()=0
interfaces::Wallet::getAddresses
virtual std::vector< WalletAddress > getAddresses()=0
Get wallet address list.
interfaces::Wallet::haveWatchOnly
virtual bool haveWatchOnly()=0
Return whether wallet has watch only keys.
interfaces::Wallet::addDestData
virtual bool addDestData(const CTxDestination &dest, const std::string &key, const std::string &value)=0
Add dest data.
CKey
An encapsulated private key.
Definition: key.h:27
ArgsManager
Definition: system.h:166
interfaces::WalletTxOut::is_spent
bool is_spent
Definition: wallet.h:405
interfaces::Wallet::hdEnabled
virtual bool hdEnabled()=0
interfaces::Wallet::lockCoin
virtual void lockCoin(const COutPoint &output)=0
Lock coin.
PartiallySignedTransaction
A version of CTransaction with the PSBT format.
Definition: psbt.h:391
interfaces::WalletTxStatus::lock_time
uint32_t lock_time
Definition: wallet.h:391
CWallet
A CWallet maintains a set of transactions and balances, and provides the ability to create new transa...
Definition: wallet.h:638
interfaces::WalletValueMap
std::map< std::string, std::string > WalletValueMap
Definition: wallet.h:49
interfaces::Wallet::abortRescan
virtual void abortRescan()=0
Abort a rescan.
interfaces::WalletTx::credit
CAmount credit
Definition: wallet.h:376
interfaces::WalletAddress::dest
CTxDestination dest
Definition: wallet.h:337
interfaces::Wallet::getPubKey
virtual bool getPubKey(const CScript &script, const CKeyID &address, CPubKey &pub_key)=0
Get public key.
interfaces::WalletTxStatus::is_abandoned
bool is_abandoned
Definition: wallet.h:394
interfaces::Wallet::signBumpTransaction
virtual bool signBumpTransaction(CMutableTransaction &mtx)=0
Sign bump transaction.
interfaces::WalletTx::txout_address
std::vector< CTxDestination > txout_address
Definition: wallet.h:374
interfaces::Wallet::createBumpTransaction
virtual bool createBumpTransaction(const uint256 &txid, const CCoinControl &coin_control, std::vector< bilingual_str > &errors, CAmount &old_fee, CAmount &new_fee, CMutableTransaction &mtx)=0
Create bump transaction.
interfaces::Wallet::changeWalletPassphrase
virtual bool changeWalletPassphrase(const SecureString &old_wallet_passphrase, const SecureString &new_wallet_passphrase)=0
Change wallet passphrase.
interfaces::Wallet::transactionCanBeAbandoned
virtual bool transactionCanBeAbandoned(const uint256 &txid)=0
Return whether transaction can be abandoned.
CTxDestination
std::variant< CNoDestination, PKHash, ScriptHash, WitnessV0ScriptHash, WitnessV0KeyHash, WitnessUnknown > CTxDestination
A txout script template with a specific destination.
Definition: standard.h:212
interfaces::WalletBalances::unconfirmed_watch_only_balance
CAmount unconfirmed_watch_only_balance
Definition: wallet.h:356
COutPoint
An outpoint - a combination of a transaction hash and an index n into its vout.
Definition: transaction.h:26
interfaces::Wallet::setAddressBook
virtual bool setAddressBook(const CTxDestination &dest, const std::string &name, const std::string &purpose)=0
Add or update address.
interfaces::WalletTxStatus::time_received
unsigned int time_received
Definition: wallet.h:390
interfaces::Wallet::getTx
virtual CTransactionRef getTx(const uint256 &txid)=0
Get a transaction.
interfaces::Wallet::isSpendable
virtual bool isSpendable(const CTxDestination &dest)=0
Return whether wallet has private key.
error
bool error(const char *fmt, const Args &... args)
Definition: system.h:50
interfaces::Wallet::abandonTransaction
virtual bool abandonTransaction(const uint256 &txid)=0
Abandon transaction.
CMutableTransaction
A mutable version of CTransaction.
Definition: transaction.h:344
interfaces::Wallet::isCrypted
virtual bool isCrypted()=0
Return whether wallet is encrypted.
interfaces::WalletClient::getWalletDir
virtual std::string getWalletDir()=0
Return default wallet directory.
CRecipient
Definition: wallet.h:211
amount.h
interfaces::WalletTx::tx
CTransactionRef tx
Definition: wallet.h:371
interfaces::Wallet::privateKeysDisabled
virtual bool privateKeysDisabled()=0
WalletContext
WalletContext struct containing references to state shared between CWallet instances,...
Definition: context.h:23
interfaces::Wallet::handleCanGetAddressesChanged
virtual std::unique_ptr< Handler > handleCanGetAddressesChanged(CanGetAddressesChangedFn fn)=0
interfaces::WalletTxOut::time
int64_t time
Definition: wallet.h:403
interfaces::Wallet::getCoins
virtual std::vector< WalletTxOut > getCoins(const std::vector< COutPoint > &outputs)=0
Return wallet transaction output information.
interfaces::Wallet::lock
virtual bool lock()=0
Lock wallet.
interfaces::Wallet::handleTransactionChanged
virtual std::unique_ptr< Handler > handleTransactionChanged(TransactionChangedFn fn)=0
interfaces::Wallet::isLegacy
virtual bool isLegacy()=0
Return whether is a legacy wallet.
interfaces::WalletAddress
Information about one wallet address.
Definition: wallet.h:335
interfaces::Wallet::AddressBookChangedFn
std::function< void(const CTxDestination &address, const std::string &label, bool is_mine, const std::string &purpose, ChangeType status)> AddressBookChangedFn
Register handler for address book changed messages.
Definition: wallet.h:287