Bitcoin Core  22.99.0
P2P Digital Currency
wallet.h
Go to the documentation of this file.
1 // Copyright (c) 2018-2021 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 <consensus/amount.h>
9 #include <fs.h>
10 #include <interfaces/chain.h> // For ChainClient
11 #include <pubkey.h> // For CKeyID and CScriptID (definitions needed in CTxDestination instantiation)
12 #include <script/standard.h> // For CTxDestination
13 #include <support/allocators/secure.h> // For SecureString
14 #include <util/message.h>
15 #include <util/ui_change_type.h>
16 
17 #include <cstdint>
18 #include <functional>
19 #include <map>
20 #include <memory>
21 #include <string>
22 #include <tuple>
23 #include <type_traits>
24 #include <utility>
25 #include <vector>
26 
27 class CFeeRate;
28 class CKey;
29 enum class FeeReason;
30 enum class OutputType;
31 enum class TransactionError;
33 struct bilingual_str;
34 namespace wallet {
35 class CCoinControl;
36 class CWallet;
37 enum isminetype : unsigned int;
38 struct CRecipient;
39 struct WalletContext;
40 using isminefilter = std::underlying_type<isminetype>::type;
41 } // namespace wallet
42 
43 namespace interfaces {
44 
45 class Handler;
46 struct WalletAddress;
47 struct WalletBalances;
48 struct WalletTx;
49 struct WalletTxOut;
50 struct WalletTxStatus;
51 
52 using WalletOrderForm = std::vector<std::pair<std::string, std::string>>;
53 using WalletValueMap = std::map<std::string, std::string>;
54 
56 class Wallet
57 {
58 public:
59  virtual ~Wallet() {}
60 
62  virtual bool encryptWallet(const SecureString& wallet_passphrase) = 0;
63 
65  virtual bool isCrypted() = 0;
66 
68  virtual bool lock() = 0;
69 
71  virtual bool unlock(const SecureString& wallet_passphrase) = 0;
72 
74  virtual bool isLocked() = 0;
75 
77  virtual bool changeWalletPassphrase(const SecureString& old_wallet_passphrase,
78  const SecureString& new_wallet_passphrase) = 0;
79 
81  virtual void abortRescan() = 0;
82 
84  virtual bool backupWallet(const std::string& filename) = 0;
85 
87  virtual std::string getWalletName() = 0;
88 
89  // Get a new address.
90  virtual bool getNewDestination(const OutputType type, const std::string label, CTxDestination& dest) = 0;
91 
93  virtual bool getPubKey(const CScript& script, const CKeyID& address, CPubKey& pub_key) = 0;
94 
96  virtual SigningResult signMessage(const std::string& message, const PKHash& pkhash, std::string& str_sig) = 0;
97 
99  virtual bool isSpendable(const CTxDestination& dest) = 0;
100 
102  virtual bool haveWatchOnly() = 0;
103 
105  virtual bool setAddressBook(const CTxDestination& dest, const std::string& name, const std::string& purpose) = 0;
106 
107  // Remove address.
108  virtual bool delAddressBook(const CTxDestination& dest) = 0;
109 
111  virtual bool getAddress(const CTxDestination& dest,
112  std::string* name,
113  wallet::isminetype* is_mine,
114  std::string* purpose) = 0;
115 
117  virtual std::vector<WalletAddress> getAddresses() = 0;
118 
120  virtual std::vector<std::string> getAddressReceiveRequests() = 0;
121 
123  virtual bool setAddressReceiveRequest(const CTxDestination& dest, const std::string& id, const std::string& value) = 0;
124 
126  virtual bool displayAddress(const CTxDestination& dest) = 0;
127 
129  virtual bool lockCoin(const COutPoint& output, const bool write_to_db) = 0;
130 
132  virtual bool unlockCoin(const COutPoint& output) = 0;
133 
135  virtual bool isLockedCoin(const COutPoint& output) = 0;
136 
138  virtual void listLockedCoins(std::vector<COutPoint>& outputs) = 0;
139 
141  virtual CTransactionRef createTransaction(const std::vector<wallet::CRecipient>& recipients,
142  const wallet::CCoinControl& coin_control,
143  bool sign,
144  int& change_pos,
145  CAmount& fee,
146  bilingual_str& fail_reason) = 0;
147 
149  virtual void commitTransaction(CTransactionRef tx,
150  WalletValueMap value_map,
151  WalletOrderForm order_form) = 0;
152 
154  virtual bool transactionCanBeAbandoned(const uint256& txid) = 0;
155 
157  virtual bool abandonTransaction(const uint256& txid) = 0;
158 
160  virtual bool transactionCanBeBumped(const uint256& txid) = 0;
161 
163  virtual bool createBumpTransaction(const uint256& txid,
164  const wallet::CCoinControl& coin_control,
165  std::vector<bilingual_str>& errors,
166  CAmount& old_fee,
167  CAmount& new_fee,
168  CMutableTransaction& mtx) = 0;
169 
171  virtual bool signBumpTransaction(CMutableTransaction& mtx) = 0;
172 
174  virtual bool commitBumpTransaction(const uint256& txid,
175  CMutableTransaction&& mtx,
176  std::vector<bilingual_str>& errors,
177  uint256& bumped_txid) = 0;
178 
180  virtual CTransactionRef getTx(const uint256& txid) = 0;
181 
183  virtual WalletTx getWalletTx(const uint256& txid) = 0;
184 
186  virtual std::vector<WalletTx> getWalletTxs() = 0;
187 
189  virtual bool tryGetTxStatus(const uint256& txid,
190  WalletTxStatus& tx_status,
191  int& num_blocks,
192  int64_t& block_time) = 0;
193 
195  virtual WalletTx getWalletTxDetails(const uint256& txid,
196  WalletTxStatus& tx_status,
197  WalletOrderForm& order_form,
198  bool& in_mempool,
199  int& num_blocks) = 0;
200 
202  virtual TransactionError fillPSBT(int sighash_type,
203  bool sign,
204  bool bip32derivs,
205  size_t* n_signed,
207  bool& complete) = 0;
208 
210  virtual WalletBalances getBalances() = 0;
211 
213  virtual bool tryGetBalances(WalletBalances& balances, uint256& block_hash) = 0;
214 
216  virtual CAmount getBalance() = 0;
217 
219  virtual CAmount getAvailableBalance(const wallet::CCoinControl& coin_control) = 0;
220 
222  virtual wallet::isminetype txinIsMine(const CTxIn& txin) = 0;
223 
225  virtual wallet::isminetype txoutIsMine(const CTxOut& txout) = 0;
226 
228  virtual CAmount getDebit(const CTxIn& txin, wallet::isminefilter filter) = 0;
229 
231  virtual CAmount getCredit(const CTxOut& txout, wallet::isminefilter filter) = 0;
232 
235  using CoinsList = std::map<CTxDestination, std::vector<std::tuple<COutPoint, WalletTxOut>>>;
236  virtual CoinsList listCoins() = 0;
237 
239  virtual std::vector<WalletTxOut> getCoins(const std::vector<COutPoint>& outputs) = 0;
240 
242  virtual CAmount getRequiredFee(unsigned int tx_bytes) = 0;
243 
245  virtual CAmount getMinimumFee(unsigned int tx_bytes,
246  const wallet::CCoinControl& coin_control,
247  int* returned_target,
248  FeeReason* reason) = 0;
249 
251  virtual unsigned int getConfirmTarget() = 0;
252 
253  // Return whether HD enabled.
254  virtual bool hdEnabled() = 0;
255 
256  // Return whether the wallet is blank.
257  virtual bool canGetAddresses() = 0;
258 
259  // Return whether private keys enabled.
260  virtual bool privateKeysDisabled() = 0;
261 
262  // Return whether the wallet contains a Taproot scriptPubKeyMan
263  virtual bool taprootEnabled() = 0;
264 
265  // Return whether wallet uses an external signer.
266  virtual bool hasExternalSigner() = 0;
267 
268  // Get default address type.
269  virtual OutputType getDefaultAddressType() = 0;
270 
272  virtual CAmount getDefaultMaxTxFee() = 0;
273 
274  // Remove wallet.
275  virtual void remove() = 0;
276 
278  virtual bool isLegacy() = 0;
279 
281  using UnloadFn = std::function<void()>;
282  virtual std::unique_ptr<Handler> handleUnload(UnloadFn fn) = 0;
283 
285  using ShowProgressFn = std::function<void(const std::string& title, int progress)>;
286  virtual std::unique_ptr<Handler> handleShowProgress(ShowProgressFn fn) = 0;
287 
289  using StatusChangedFn = std::function<void()>;
290  virtual std::unique_ptr<Handler> handleStatusChanged(StatusChangedFn fn) = 0;
291 
293  using AddressBookChangedFn = std::function<void(const CTxDestination& address,
294  const std::string& label,
295  bool is_mine,
296  const std::string& purpose,
297  ChangeType status)>;
298  virtual std::unique_ptr<Handler> handleAddressBookChanged(AddressBookChangedFn fn) = 0;
299 
301  using TransactionChangedFn = std::function<void(const uint256& txid, ChangeType status)>;
302  virtual std::unique_ptr<Handler> handleTransactionChanged(TransactionChangedFn fn) = 0;
303 
305  using WatchOnlyChangedFn = std::function<void(bool have_watch_only)>;
306  virtual std::unique_ptr<Handler> handleWatchOnlyChanged(WatchOnlyChangedFn fn) = 0;
307 
309  using CanGetAddressesChangedFn = std::function<void()>;
310  virtual std::unique_ptr<Handler> handleCanGetAddressesChanged(CanGetAddressesChangedFn fn) = 0;
311 
313  virtual wallet::CWallet* wallet() { return nullptr; }
314 };
315 
319 class WalletLoader : public ChainClient
320 {
321 public:
323  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;
324 
326  virtual std::unique_ptr<Wallet> loadWallet(const std::string& name, bilingual_str& error, std::vector<bilingual_str>& warnings) = 0;
327 
329  virtual std::string getWalletDir() = 0;
330 
332  virtual std::unique_ptr<Wallet> restoreWallet(const fs::path& backup_file, const std::string& wallet_name, bilingual_str& error, std::vector<bilingual_str>& warnings) = 0;
333 
335  virtual std::vector<std::string> listWalletDir() = 0;
336 
338  virtual std::vector<std::unique_ptr<Wallet>> getWallets() = 0;
339 
343  using LoadWalletFn = std::function<void(std::unique_ptr<Wallet> wallet)>;
344  virtual std::unique_ptr<Handler> handleLoadWallet(LoadWalletFn fn) = 0;
345 
347  virtual wallet::WalletContext* context() { return nullptr; }
348 };
349 
352 {
355  std::string name;
356  std::string purpose;
357 
359  : dest(std::move(dest)), is_mine(is_mine), name(std::move(name)), purpose(std::move(purpose))
360  {
361  }
362 };
363 
366 {
370  bool have_watch_only = false;
374 
375  bool balanceChanged(const WalletBalances& prev) const
376  {
377  return balance != prev.balance || unconfirmed_balance != prev.unconfirmed_balance ||
381  }
382 };
383 
384 // Wallet transaction information.
385 struct WalletTx
386 {
388  std::vector<wallet::isminetype> txin_is_mine;
389  std::vector<wallet::isminetype> txout_is_mine;
390  std::vector<CTxDestination> txout_address;
391  std::vector<wallet::isminetype> txout_address_is_mine;
395  int64_t time;
396  std::map<std::string, std::string> value_map;
398 };
399 
402 {
406  unsigned int time_received;
407  uint32_t lock_time;
408  bool is_final;
413 };
414 
417 {
419  int64_t time;
421  bool is_spent = false;
422 };
423 
426 std::unique_ptr<Wallet> MakeWallet(wallet::WalletContext& context, const std::shared_ptr<wallet::CWallet>& wallet);
427 
430 std::unique_ptr<WalletLoader> MakeWalletLoader(Chain& chain, ArgsManager& args);
431 
432 } // namespace interfaces
433 
434 #endif // BITCOIN_INTERFACES_WALLET_H
interfaces::Wallet::isLocked
virtual bool isLocked()=0
Return whether wallet is locked.
CTxIn
An input of a transaction.
Definition: transaction.h:65
interfaces
Definition: dummywallet.cpp:10
FeeReason
FeeReason
Definition: fees.h:43
interfaces::WalletLoader::context
virtual wallet::WalletContext * context()
Return pointer to internal context, useful for testing.
Definition: wallet.h:347
interfaces::Wallet::getWalletTx
virtual WalletTx getWalletTx(const uint256 &txid)=0
Get transaction information.
OutputType
OutputType
Definition: outputtype.h:18
wallet::isminetype
isminetype
IsMine() return codes, which depend on ScriptPubKeyMan implementation.
Definition: ismine.h:41
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:285
wallet::isminefilter
std::underlying_type< isminetype >::type isminefilter
used for bitflags of isminetype
Definition: wallet.h:40
interfaces::Wallet::UnloadFn
std::function< void()> UnloadFn
Register handler for unload message.
Definition: wallet.h:281
interfaces::Wallet::hasExternalSigner
virtual bool hasExternalSigner()=0
interfaces::Wallet::~Wallet
virtual ~Wallet()
Definition: wallet.h:59
interfaces::WalletTxStatus::depth_in_main_chain
int depth_in_main_chain
Definition: wallet.h:405
fs.h
interfaces::Wallet::getConfirmTarget
virtual unsigned int getConfirmTarget()=0
Get tx confirm target.
interfaces::Wallet::wallet
virtual wallet::CWallet * wallet()
Return pointer to internal wallet class, useful for testing.
Definition: wallet.h:313
interfaces::WalletTxOut::depth_in_main_chain
int depth_in_main_chain
Definition: wallet.h:420
interfaces::Wallet::getDebit
virtual CAmount getDebit(const CTxIn &txin, wallet::isminefilter filter)=0
Return debit amount if transaction input belongs to wallet.
interfaces::Wallet::taprootEnabled
virtual bool taprootEnabled()=0
interfaces::WalletTxStatus::is_final
bool is_final
Definition: wallet.h:408
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:397
interfaces::WalletTxStatus::block_height
int block_height
Definition: wallet.h:403
interfaces::Wallet::setAddressReceiveRequest
virtual bool setAddressReceiveRequest(const CTxDestination &dest, const std::string &id, const std::string &value)=0
Save or remove receive request.
interfaces::Wallet::displayAddress
virtual bool displayAddress(const CTxDestination &dest)=0
Display address on external signer.
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:289
interfaces::WalletBalances::unconfirmed_balance
CAmount unconfirmed_balance
Definition: wallet.h:368
interfaces::WalletBalances::balanceChanged
bool balanceChanged(const WalletBalances &prev) const
Definition: wallet.h:375
interfaces::Wallet::unlockCoin
virtual bool unlockCoin(const COutPoint &output)=0
Unlock coin.
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.
wallet
Definition: node.h:38
interfaces::WalletBalances::have_watch_only
bool have_watch_only
Definition: wallet.h:370
interfaces::WalletTxOut
Wallet transaction output.
Definition: wallet.h:416
CKeyID
A reference to a CKey: the Hash160 of its serialized public key.
Definition: pubkey.h:23
interfaces::WalletBalances::immature_watch_only_balance
CAmount immature_watch_only_balance
Definition: wallet.h:373
pubkey.h
chain.h
interfaces::Wallet::getMinimumFee
virtual CAmount getMinimumFee(unsigned int tx_bytes, const wallet::CCoinControl &coin_control, int *returned_target, FeeReason *reason)=0
Get minimum fee.
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:395
interfaces::WalletBalances::balance
CAmount balance
Definition: wallet.h:367
CFeeRate
Fee rate in satoshis per kilobyte: CAmount / kB.
Definition: feerate.h:29
interfaces::Wallet::createTransaction
virtual CTransactionRef createTransaction(const std::vector< wallet::CRecipient > &recipients, const wallet::CCoinControl &coin_control, bool sign, int &change_pos, CAmount &fee, bilingual_str &fail_reason)=0
Create transaction.
interfaces::Wallet::getAddressReceiveRequests
virtual std::vector< std::string > getAddressReceiveRequests()=0
Get receive requests.
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::WalletTx::txout_is_mine
std::vector< wallet::isminetype > txout_is_mine
Definition: wallet.h:389
interfaces::WalletTxStatus::is_coinbase
bool is_coinbase
Definition: wallet.h:411
interfaces::Wallet::lockCoin
virtual bool lockCoin(const COutPoint &output, const bool write_to_db)=0
Lock coin.
interfaces::Wallet::commitBumpTransaction
virtual bool commitBumpTransaction(const uint256 &txid, CMutableTransaction &&mtx, std::vector< bilingual_str > &errors, uint256 &bumped_txid)=0
Commit bump transaction.
interfaces::WalletBalances::watch_only_balance
CAmount watch_only_balance
Definition: wallet.h:371
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:396
interfaces::Chain
Interface giving clients (wallet processes, maybe other analysis tools in the future) ability to acce...
Definition: chain.h:94
SecureString
std::basic_string< char, std::char_traits< char >, secure_allocator< char > > SecureString
Definition: secure.h:59
ChangeType
ChangeType
General change type (added, updated, removed).
Definition: ui_change_type.h:9
interfaces::WalletBalances
Collection of wallet balances.
Definition: wallet.h:365
CTxDestination
std::variant< CNoDestination, PKHash, ScriptHash, WitnessV0ScriptHash, WitnessV0KeyHash, WitnessV1Taproot, WitnessUnknown > CTxDestination
A txout script template with a specific destination.
Definition: standard.h:157
interfaces::Wallet::createBumpTransaction
virtual bool createBumpTransaction(const uint256 &txid, const wallet::CCoinControl &coin_control, std::vector< bilingual_str > &errors, CAmount &old_fee, CAmount &new_fee, CMutableTransaction &mtx)=0
Create bump transaction.
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::WalletLoader::handleLoadWallet
virtual std::unique_ptr< Handler > handleLoadWallet(LoadWalletFn fn)=0
interfaces::WalletTx::change
CAmount change
Definition: wallet.h:394
wallet::CWallet
A CWallet maintains a set of transactions and balances, and provides the ability to create new transa...
Definition: wallet.h:232
fs::path
Path class wrapper to prepare application code for transition from boost::filesystem library to std::...
Definition: fs.h:33
message.h
interfaces::Wallet::getCredit
virtual CAmount getCredit(const CTxOut &txout, wallet::isminefilter filter)=0
Return credit amount if transaction input belongs to wallet.
interfaces::WalletTx::debit
CAmount debit
Definition: wallet.h:393
interfaces::Wallet::getAddress
virtual bool getAddress(const CTxDestination &dest, std::string *name, wallet::isminetype *is_mine, std::string *purpose)=0
Look up address in wallet, return whether exists.
interfaces::WalletLoader::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::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::WalletLoader::restoreWallet
virtual std::unique_ptr< Wallet > restoreWallet(const fs::path &backup_file, const std::string &wallet_name, bilingual_str &error, std::vector< bilingual_str > &warnings)=0
Restore backup wallet.
interfaces::WalletTx
Definition: wallet.h:385
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:309
interfaces::WalletLoader
Wallet chain client that in addition to having chain client methods for starting up,...
Definition: wallet.h:319
interfaces::Wallet::TransactionChangedFn
std::function< void(const uint256 &txid, ChangeType status)> TransactionChangedFn
Register handler for transaction changed messages.
Definition: wallet.h:301
CAmount
int64_t CAmount
Amount in satoshis (Can be negative)
Definition: amount.h:12
interfaces::WalletAddress::purpose
std::string purpose
Definition: wallet.h:356
interfaces::WalletLoader::getWalletDir
virtual std::string getWalletDir()=0
Return default wallet directory.
standard.h
context
WalletContext context
Definition: notifications.cpp:37
interfaces::Wallet::handleShowProgress
virtual std::unique_ptr< Handler > handleShowProgress(ShowProgressFn fn)=0
interfaces::WalletAddress::name
std::string name
Definition: wallet.h:355
interfaces::Wallet::canGetAddresses
virtual bool canGetAddresses()=0
interfaces::Wallet::backupWallet
virtual bool backupWallet(const std::string &filename)=0
Back up wallet.
interfaces::WalletTx::txin_is_mine
std::vector< wallet::isminetype > txin_is_mine
Definition: wallet.h:388
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.
uint256
256-bit opaque blob.
Definition: uint256.h:124
interfaces::WalletLoader::listWalletDir
virtual std::vector< std::string > listWalletDir()=0
Return available wallets in wallet directory.
interfaces::Wallet::getBalances
virtual WalletBalances getBalances()=0
Get balances.
interfaces::WalletTxStatus
Updated transaction status.
Definition: wallet.h:401
interfaces::Wallet::delAddressBook
virtual bool delAddressBook(const CTxDestination &dest)=0
interfaces::Wallet
Interface for accessing a wallet.
Definition: wallet.h:56
interfaces::WalletTxStatus::is_in_main_chain
bool is_in_main_chain
Definition: wallet.h:412
interfaces::WalletTxOut::txout
CTxOut txout
Definition: wallet.h:418
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:405
interfaces::WalletTxStatus::blocks_to_maturity
int blocks_to_maturity
Definition: wallet.h:404
interfaces::WalletOrderForm
std::vector< std::pair< std::string, std::string > > WalletOrderForm
Definition: wallet.h:52
interfaces::WalletAddress::WalletAddress
WalletAddress(CTxDestination dest, wallet::isminetype is_mine, std::string name, std::string purpose)
Definition: wallet.h:358
interfaces::Wallet::getDefaultMaxTxFee
virtual CAmount getDefaultMaxTxFee()=0
Get max tx fee.
interfaces::Wallet::WatchOnlyChangedFn
std::function< void(bool have_watch_only)> WatchOnlyChangedFn
Register handler for watchonly changed messages.
Definition: wallet.h:305
secure.h
name
const char * name
Definition: rest.cpp:52
interfaces::WalletBalances::immature_balance
CAmount immature_balance
Definition: wallet.h:369
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:79
interfaces::Wallet::CoinsList
std::map< CTxDestination, std::vector< std::tuple< COutPoint, WalletTxOut > >> CoinsList
Return AvailableCoins + LockedCoins grouped by wallet address.
Definition: wallet.h:235
interfaces::WalletTxStatus::is_trusted
bool is_trusted
Definition: wallet.h:409
interfaces::Wallet::getDefaultAddressType
virtual OutputType getDefaultAddressType()=0
CPubKey
An encapsulated public key.
Definition: pubkey.h:33
interfaces::ChainClient
Interface to let node manage chain clients (wallets, or maybe tools for monitoring and analysis in th...
Definition: chain.h:293
interfaces::WalletLoader::LoadWalletFn
std::function< void(std::unique_ptr< Wallet > wallet)> LoadWalletFn
Register handler for load wallet messages.
Definition: wallet.h:343
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.
CKey
An encapsulated private key.
Definition: key.h:26
ArgsManager
Definition: system.h:158
interfaces::WalletTxOut::is_spent
bool is_spent
Definition: wallet.h:421
interfaces::Wallet::hdEnabled
virtual bool hdEnabled()=0
PartiallySignedTransaction
A version of CTransaction with the PSBT format.
Definition: psbt.h:668
interfaces::WalletTxStatus::lock_time
uint32_t lock_time
Definition: wallet.h:407
interfaces::WalletValueMap
std::map< std::string, std::string > WalletValueMap
Definition: wallet.h:53
interfaces::Wallet::abortRescan
virtual void abortRescan()=0
Abort a rescan.
interfaces::WalletTx::credit
CAmount credit
Definition: wallet.h:392
std
Definition: setup_common.h:33
interfaces::WalletAddress::dest
CTxDestination dest
Definition: wallet.h:353
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:410
interfaces::Wallet::signBumpTransaction
virtual bool signBumpTransaction(CMutableTransaction &mtx)=0
Sign bump transaction.
interfaces::WalletTx::txout_address
std::vector< CTxDestination > txout_address
Definition: wallet.h:390
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.
interfaces::WalletLoader::loadWallet
virtual std::unique_ptr< Wallet > loadWallet(const std::string &name, bilingual_str &error, std::vector< bilingual_str > &warnings)=0
Load existing wallet.
interfaces::WalletBalances::unconfirmed_watch_only_balance
CAmount unconfirmed_watch_only_balance
Definition: wallet.h:372
interfaces::Wallet::txoutIsMine
virtual wallet::isminetype txoutIsMine(const CTxOut &txout)=0
Return whether transaction output belongs to wallet.
interfaces::WalletTx::txout_address_is_mine
std::vector< wallet::isminetype > txout_address_is_mine
Definition: wallet.h:391
interfaces::Wallet::txinIsMine
virtual wallet::isminetype txinIsMine(const CTxIn &txin)=0
Return whether transaction input belongs to wallet.
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::WalletAddress::is_mine
wallet::isminetype is_mine
Definition: wallet.h:354
interfaces::MakeWallet
std::unique_ptr< Wallet > MakeWallet(wallet::WalletContext &context, const std::shared_ptr< wallet::CWallet > &wallet)
Return implementation of Wallet interface.
Definition: interfaces.cpp:601
interfaces::WalletTxStatus::time_received
unsigned int time_received
Definition: wallet.h:406
interfaces::Wallet::getTx
virtual CTransactionRef getTx(const uint256 &txid)=0
Get a transaction.
wallet::WalletContext
WalletContext struct containing references to state shared between CWallet instances,...
Definition: context.h:35
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:49
interfaces::Wallet::abandonTransaction
virtual bool abandonTransaction(const uint256 &txid)=0
Abandon transaction.
CMutableTransaction
A mutable version of CTransaction.
Definition: transaction.h:344
interfaces::MakeWalletLoader
std::unique_ptr< WalletLoader > MakeWalletLoader(Chain &chain, ArgsManager &args)
Return implementation of ChainClient interface for a wallet loader.
Definition: dummywallet.cpp:61
interfaces::Wallet::isCrypted
virtual bool isCrypted()=0
Return whether wallet is encrypted.
amount.h
interfaces::Wallet::fillPSBT
virtual TransactionError fillPSBT(int sighash_type, bool sign, bool bip32derivs, size_t *n_signed, PartiallySignedTransaction &psbtx, bool &complete)=0
Fill PSBT.
interfaces::WalletTx::tx
CTransactionRef tx
Definition: wallet.h:387
interfaces::Wallet::privateKeysDisabled
virtual bool privateKeysDisabled()=0
wallet::CCoinControl
Coin Control Features.
Definition: coincontrol.h:29
interfaces::Wallet::handleCanGetAddressesChanged
virtual std::unique_ptr< Handler > handleCanGetAddressesChanged(CanGetAddressesChangedFn fn)=0
interfaces::WalletTxOut::time
int64_t time
Definition: wallet.h:419
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:351
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:297
interfaces::Wallet::getAvailableBalance
virtual CAmount getAvailableBalance(const wallet::CCoinControl &coin_control)=0
Get available balance.
args
ArgsManager args
Definition: notifications.cpp:36
interfaces::WalletLoader::getWallets
virtual std::vector< std::unique_ptr< Wallet > > getWallets()=0
Return interfaces for accessing wallets (if any).