Bitcoin Core  26.1.0
P2P Digital Currency
wallet.h
Go to the documentation of this file.
1 // Copyright (c) 2018-2022 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 <addresstype.h>
9 #include <consensus/amount.h>
10 #include <interfaces/chain.h>
11 #include <pubkey.h>
12 #include <script/script.h>
14 #include <util/fs.h>
15 #include <util/message.h>
16 #include <util/result.h>
17 #include <util/ui_change_type.h>
18 
19 #include <cstdint>
20 #include <functional>
21 #include <map>
22 #include <memory>
23 #include <string>
24 #include <tuple>
25 #include <type_traits>
26 #include <utility>
27 #include <vector>
28 
29 class CFeeRate;
30 class CKey;
31 enum class FeeReason;
32 enum class OutputType;
33 enum class TransactionError;
35 struct bilingual_str;
36 namespace wallet {
37 class CCoinControl;
38 class CWallet;
39 enum class AddressPurpose;
40 enum isminetype : unsigned int;
41 struct CRecipient;
42 struct WalletContext;
43 using isminefilter = std::underlying_type<isminetype>::type;
44 } // namespace wallet
45 
46 namespace interfaces {
47 
48 class Handler;
49 struct WalletAddress;
50 struct WalletBalances;
51 struct WalletTx;
52 struct WalletTxOut;
53 struct WalletTxStatus;
54 struct WalletMigrationResult;
55 
56 using WalletOrderForm = std::vector<std::pair<std::string, std::string>>;
57 using WalletValueMap = std::map<std::string, std::string>;
58 
60 class Wallet
61 {
62 public:
63  virtual ~Wallet() {}
64 
66  virtual bool encryptWallet(const SecureString& wallet_passphrase) = 0;
67 
69  virtual bool isCrypted() = 0;
70 
72  virtual bool lock() = 0;
73 
75  virtual bool unlock(const SecureString& wallet_passphrase) = 0;
76 
78  virtual bool isLocked() = 0;
79 
81  virtual bool changeWalletPassphrase(const SecureString& old_wallet_passphrase,
82  const SecureString& new_wallet_passphrase) = 0;
83 
85  virtual void abortRescan() = 0;
86 
88  virtual bool backupWallet(const std::string& filename) = 0;
89 
91  virtual std::string getWalletName() = 0;
92 
93  // Get a new address.
94  virtual util::Result<CTxDestination> getNewDestination(const OutputType type, const std::string& label) = 0;
95 
97  virtual bool getPubKey(const CScript& script, const CKeyID& address, CPubKey& pub_key) = 0;
98 
100  virtual SigningResult signMessage(const std::string& message, const PKHash& pkhash, std::string& str_sig) = 0;
101 
103  virtual bool isSpendable(const CTxDestination& dest) = 0;
104 
106  virtual bool haveWatchOnly() = 0;
107 
109  virtual bool setAddressBook(const CTxDestination& dest, const std::string& name, const std::optional<wallet::AddressPurpose>& purpose) = 0;
110 
111  // Remove address.
112  virtual bool delAddressBook(const CTxDestination& dest) = 0;
113 
115  virtual bool getAddress(const CTxDestination& dest,
116  std::string* name,
117  wallet::isminetype* is_mine,
118  wallet::AddressPurpose* purpose) = 0;
119 
121  virtual std::vector<WalletAddress> getAddresses() const = 0;
122 
124  virtual std::vector<std::string> getAddressReceiveRequests() = 0;
125 
127  virtual bool setAddressReceiveRequest(const CTxDestination& dest, const std::string& id, const std::string& value) = 0;
128 
130  virtual bool displayAddress(const CTxDestination& dest) = 0;
131 
133  virtual bool lockCoin(const COutPoint& output, const bool write_to_db) = 0;
134 
136  virtual bool unlockCoin(const COutPoint& output) = 0;
137 
139  virtual bool isLockedCoin(const COutPoint& output) = 0;
140 
142  virtual void listLockedCoins(std::vector<COutPoint>& outputs) = 0;
143 
145  virtual util::Result<CTransactionRef> createTransaction(const std::vector<wallet::CRecipient>& recipients,
146  const wallet::CCoinControl& coin_control,
147  bool sign,
148  int& change_pos,
149  CAmount& fee) = 0;
150 
152  virtual void commitTransaction(CTransactionRef tx,
153  WalletValueMap value_map,
154  WalletOrderForm order_form) = 0;
155 
157  virtual bool transactionCanBeAbandoned(const uint256& txid) = 0;
158 
160  virtual bool abandonTransaction(const uint256& txid) = 0;
161 
163  virtual bool transactionCanBeBumped(const uint256& txid) = 0;
164 
166  virtual bool createBumpTransaction(const uint256& txid,
167  const wallet::CCoinControl& coin_control,
168  std::vector<bilingual_str>& errors,
169  CAmount& old_fee,
170  CAmount& new_fee,
171  CMutableTransaction& mtx) = 0;
172 
174  virtual bool signBumpTransaction(CMutableTransaction& mtx) = 0;
175 
177  virtual bool commitBumpTransaction(const uint256& txid,
178  CMutableTransaction&& mtx,
179  std::vector<bilingual_str>& errors,
180  uint256& bumped_txid) = 0;
181 
183  virtual CTransactionRef getTx(const uint256& txid) = 0;
184 
186  virtual WalletTx getWalletTx(const uint256& txid) = 0;
187 
189  virtual std::set<WalletTx> getWalletTxs() = 0;
190 
192  virtual bool tryGetTxStatus(const uint256& txid,
193  WalletTxStatus& tx_status,
194  int& num_blocks,
195  int64_t& block_time) = 0;
196 
198  virtual WalletTx getWalletTxDetails(const uint256& txid,
199  WalletTxStatus& tx_status,
200  WalletOrderForm& order_form,
201  bool& in_mempool,
202  int& num_blocks) = 0;
203 
205  virtual TransactionError fillPSBT(int sighash_type,
206  bool sign,
207  bool bip32derivs,
208  size_t* n_signed,
210  bool& complete) = 0;
211 
213  virtual WalletBalances getBalances() = 0;
214 
216  virtual bool tryGetBalances(WalletBalances& balances, uint256& block_hash) = 0;
217 
219  virtual CAmount getBalance() = 0;
220 
222  virtual CAmount getAvailableBalance(const wallet::CCoinControl& coin_control) = 0;
223 
225  virtual wallet::isminetype txinIsMine(const CTxIn& txin) = 0;
226 
228  virtual wallet::isminetype txoutIsMine(const CTxOut& txout) = 0;
229 
231  virtual CAmount getDebit(const CTxIn& txin, wallet::isminefilter filter) = 0;
232 
234  virtual CAmount getCredit(const CTxOut& txout, wallet::isminefilter filter) = 0;
235 
238  using CoinsList = std::map<CTxDestination, std::vector<std::tuple<COutPoint, WalletTxOut>>>;
239  virtual CoinsList listCoins() = 0;
240 
242  virtual std::vector<WalletTxOut> getCoins(const std::vector<COutPoint>& outputs) = 0;
243 
245  virtual CAmount getRequiredFee(unsigned int tx_bytes) = 0;
246 
248  virtual CAmount getMinimumFee(unsigned int tx_bytes,
249  const wallet::CCoinControl& coin_control,
250  int* returned_target,
251  FeeReason* reason) = 0;
252 
254  virtual unsigned int getConfirmTarget() = 0;
255 
256  // Return whether HD enabled.
257  virtual bool hdEnabled() = 0;
258 
259  // Return whether the wallet is blank.
260  virtual bool canGetAddresses() = 0;
261 
262  // Return whether private keys enabled.
263  virtual bool privateKeysDisabled() = 0;
264 
265  // Return whether the wallet contains a Taproot scriptPubKeyMan
266  virtual bool taprootEnabled() = 0;
267 
268  // Return whether wallet uses an external signer.
269  virtual bool hasExternalSigner() = 0;
270 
271  // Get default address type.
272  virtual OutputType getDefaultAddressType() = 0;
273 
275  virtual CAmount getDefaultMaxTxFee() = 0;
276 
277  // Remove wallet.
278  virtual void remove() = 0;
279 
281  virtual bool isLegacy() = 0;
282 
284  using UnloadFn = std::function<void()>;
285  virtual std::unique_ptr<Handler> handleUnload(UnloadFn fn) = 0;
286 
288  using ShowProgressFn = std::function<void(const std::string& title, int progress)>;
289  virtual std::unique_ptr<Handler> handleShowProgress(ShowProgressFn fn) = 0;
290 
292  using StatusChangedFn = std::function<void()>;
293  virtual std::unique_ptr<Handler> handleStatusChanged(StatusChangedFn fn) = 0;
294 
296  using AddressBookChangedFn = std::function<void(const CTxDestination& address,
297  const std::string& label,
298  bool is_mine,
299  wallet::AddressPurpose purpose,
300  ChangeType status)>;
301  virtual std::unique_ptr<Handler> handleAddressBookChanged(AddressBookChangedFn fn) = 0;
302 
304  using TransactionChangedFn = std::function<void(const uint256& txid, ChangeType status)>;
305  virtual std::unique_ptr<Handler> handleTransactionChanged(TransactionChangedFn fn) = 0;
306 
308  using WatchOnlyChangedFn = std::function<void(bool have_watch_only)>;
309  virtual std::unique_ptr<Handler> handleWatchOnlyChanged(WatchOnlyChangedFn fn) = 0;
310 
312  using CanGetAddressesChangedFn = std::function<void()>;
313  virtual std::unique_ptr<Handler> handleCanGetAddressesChanged(CanGetAddressesChangedFn fn) = 0;
314 
316  virtual wallet::CWallet* wallet() { return nullptr; }
317 };
318 
322 class WalletLoader : public ChainClient
323 {
324 public:
326  virtual util::Result<std::unique_ptr<Wallet>> createWallet(const std::string& name, const SecureString& passphrase, uint64_t wallet_creation_flags, std::vector<bilingual_str>& warnings) = 0;
327 
329  virtual util::Result<std::unique_ptr<Wallet>> loadWallet(const std::string& name, std::vector<bilingual_str>& warnings) = 0;
330 
332  virtual std::string getWalletDir() = 0;
333 
335  virtual util::Result<std::unique_ptr<Wallet>> restoreWallet(const fs::path& backup_file, const std::string& wallet_name, std::vector<bilingual_str>& warnings) = 0;
336 
338  virtual util::Result<WalletMigrationResult> migrateWallet(const std::string& name, const SecureString& passphrase) = 0;
339 
341  virtual std::vector<std::string> listWalletDir() = 0;
342 
344  virtual std::vector<std::unique_ptr<Wallet>> getWallets() = 0;
345 
349  using LoadWalletFn = std::function<void(std::unique_ptr<Wallet> wallet)>;
350  virtual std::unique_ptr<Handler> handleLoadWallet(LoadWalletFn fn) = 0;
351 
353  virtual wallet::WalletContext* context() { return nullptr; }
354 };
355 
358 {
362  std::string name;
363 
365  : dest(std::move(dest)), is_mine(is_mine), purpose(std::move(purpose)), name(std::move(name))
366  {
367  }
368 };
369 
372 {
376  bool have_watch_only = false;
380 
381  bool balanceChanged(const WalletBalances& prev) const
382  {
383  return balance != prev.balance || unconfirmed_balance != prev.unconfirmed_balance ||
387  }
388 };
389 
390 // Wallet transaction information.
391 struct WalletTx
392 {
394  std::vector<wallet::isminetype> txin_is_mine;
395  std::vector<wallet::isminetype> txout_is_mine;
396  std::vector<bool> txout_is_change;
397  std::vector<CTxDestination> txout_address;
398  std::vector<wallet::isminetype> txout_address_is_mine;
402  int64_t time;
403  std::map<std::string, std::string> value_map;
405 
406  bool operator<(const WalletTx& a) const { return tx->GetHash() < a.tx->GetHash(); }
407 };
408 
411 {
415  unsigned int time_received;
416  uint32_t lock_time;
421 };
422 
425 {
427  int64_t time;
429  bool is_spent = false;
430 };
431 
434 {
435  std::unique_ptr<Wallet> wallet;
436  std::optional<std::string> watchonly_wallet_name;
437  std::optional<std::string> solvables_wallet_name;
439 };
440 
443 std::unique_ptr<Wallet> MakeWallet(wallet::WalletContext& context, const std::shared_ptr<wallet::CWallet>& wallet);
444 
447 std::unique_ptr<WalletLoader> MakeWalletLoader(Chain& chain, ArgsManager& args);
448 
449 } // namespace interfaces
450 
451 #endif // BITCOIN_INTERFACES_WALLET_H
std::shared_ptr< const CTransaction > CTransactionRef
Definition: transaction.h:421
virtual bool isCrypted()=0
Return whether wallet is encrypted.
virtual bool privateKeysDisabled()=0
virtual CoinsList listCoins()=0
std::function< void(const CTxDestination &address, const std::string &label, bool is_mine, wallet::AddressPurpose purpose, ChangeType status)> AddressBookChangedFn
Register handler for address book changed messages.
Definition: wallet.h:300
virtual bool canGetAddresses()=0
std::vector< CTxDestination > txout_address
Definition: wallet.h:397
virtual bool displayAddress(const CTxDestination &dest)=0
Display address on external signer.
virtual WalletTx getWalletTxDetails(const uint256 &txid, WalletTxStatus &tx_status, WalletOrderForm &order_form, bool &in_mempool, int &num_blocks)=0
Get transaction details.
virtual bool isLocked()=0
Return whether wallet is locked.
std::vector< wallet::isminetype > txin_is_mine
Definition: wallet.h:394
virtual OutputType getDefaultAddressType()=0
unsigned int time_received
Definition: wallet.h:415
Bilingual messages:
Definition: translation.h:18
std::function< void(bool have_watch_only)> WatchOnlyChangedFn
Register handler for watchonly changed messages.
Definition: wallet.h:308
virtual util::Result< std::unique_ptr< Wallet > > loadWallet(const std::string &name, std::vector< bilingual_str > &warnings)=0
Load existing wallet.
wallet::isminetype is_mine
Definition: wallet.h:360
SigningResult
Definition: message.h:43
virtual std::unique_ptr< Handler > handleAddressBookChanged(AddressBookChangedFn fn)=0
virtual CTransactionRef getTx(const uint256 &txid)=0
Get a transaction.
virtual bool getPubKey(const CScript &script, const CKeyID &address, CPubKey &pub_key)=0
Get public key.
virtual CAmount getDefaultMaxTxFee()=0
Get max tx fee.
std::function< void()> UnloadFn
Register handler for unload message.
Definition: wallet.h:284
std::basic_string< char, std::char_traits< char >, secure_allocator< char > > SecureString
Definition: secure.h:58
virtual std::unique_ptr< Handler > handleWatchOnlyChanged(WatchOnlyChangedFn fn)=0
virtual bool backupWallet(const std::string &filename)=0
Back up wallet.
std::function< void()> CanGetAddressesChangedFn
Register handler for keypool changed messages.
Definition: wallet.h:312
std::unique_ptr< Wallet > MakeWallet(wallet::WalletContext &context, const std::shared_ptr< wallet::CWallet > &wallet)
Return implementation of Wallet interface.
Definition: interfaces.cpp:682
CTransactionRef tx
Definition: wallet.h:393
A version of CTransaction with the PSBT format.
Definition: psbt.h:946
virtual bool lockCoin(const COutPoint &output, const bool write_to_db)=0
Lock coin.
wallet::AddressPurpose purpose
Definition: wallet.h:361
virtual CAmount getDebit(const CTxIn &txin, wallet::isminefilter filter)=0
Return debit amount if transaction input belongs to wallet.
std::map< std::string, std::string > WalletValueMap
Definition: wallet.h:57
virtual bool isLegacy()=0
Return whether is a legacy wallet.
virtual SigningResult signMessage(const std::string &message, const PKHash &pkhash, std::string &str_sig)=0
Sign message.
virtual std::vector< std::string > listWalletDir()=0
Return available wallets in wallet directory.
virtual bool changeWalletPassphrase(const SecureString &old_wallet_passphrase, const SecureString &new_wallet_passphrase)=0
Change wallet passphrase.
virtual bool isSpendable(const CTxDestination &dest)=0
Return whether wallet has private key.
virtual CAmount getCredit(const CTxOut &txout, wallet::isminefilter filter)=0
Return credit amount if transaction input belongs to wallet.
OutputType
Definition: outputtype.h:17
std::function< void()> StatusChangedFn
Register handler for status changed messages.
Definition: wallet.h:292
virtual WalletTx getWalletTx(const uint256 &txid)=0
Get transaction information.
virtual bool hasExternalSigner()=0
virtual std::vector< WalletAddress > getAddresses() const =0
Get wallet address list.
int64_t CAmount
Amount in satoshis (Can be negative)
Definition: amount.h:12
std::map< CTxDestination, std::vector< std::tuple< COutPoint, WalletTxOut > >> CoinsList
Return AvailableCoins + LockedCoins grouped by wallet address.
Definition: wallet.h:238
std::vector< bool > txout_is_change
Definition: wallet.h:396
virtual wallet::isminetype txoutIsMine(const CTxOut &txout)=0
Return whether transaction output belongs to wallet.
virtual std::unique_ptr< Handler > handleUnload(UnloadFn fn)=0
std::optional< std::string > watchonly_wallet_name
Definition: wallet.h:436
CTxDestination dest
Definition: wallet.h:359
virtual wallet::WalletContext * context()
Return pointer to internal context, useful for testing.
Definition: wallet.h:353
std::vector< wallet::isminetype > txout_is_mine
Definition: wallet.h:395
AddressPurpose
Address purpose field that has been been stored with wallet sending and receiving addresses since BIP...
Definition: types.h:60
std::unique_ptr< WalletLoader > MakeWalletLoader(Chain &chain, ArgsManager &args)
Return implementation of ChainClient interface for a wallet loader.
Definition: dummywallet.cpp:63
virtual util::Result< std::unique_ptr< Wallet > > createWallet(const std::string &name, const SecureString &passphrase, uint64_t wallet_creation_flags, std::vector< bilingual_str > &warnings)=0
Create new wallet.
std::underlying_type< isminetype >::type isminefilter
used for bitflags of isminetype
Definition: wallet.h:43
virtual std::unique_ptr< Handler > handleTransactionChanged(TransactionChangedFn fn)=0
virtual bool hdEnabled()=0
std::optional< std::string > solvables_wallet_name
Definition: wallet.h:437
virtual std::unique_ptr< Handler > handleShowProgress(ShowProgressFn fn)=0
ArgsManager & args
Definition: bitcoind.cpp:269
virtual std::unique_ptr< Handler > handleCanGetAddressesChanged(CanGetAddressesChangedFn fn)=0
virtual std::unique_ptr< Handler > handleStatusChanged(StatusChangedFn fn)=0
virtual util::Result< CTxDestination > getNewDestination(const OutputType type, const std::string &label)=0
Collection of wallet balances.
Definition: wallet.h:371
virtual bool commitBumpTransaction(const uint256 &txid, CMutableTransaction &&mtx, std::vector< bilingual_str > &errors, uint256 &bumped_txid)=0
Commit bump transaction.
virtual bool unlockCoin(const COutPoint &output)=0
Unlock coin.
An input of a transaction.
Definition: transaction.h:74
virtual bool setAddressReceiveRequest(const CTxDestination &dest, const std::string &id, const std::string &value)=0
Save or remove receive request.
const char * name
Definition: rest.cpp:45
An encapsulated public key.
Definition: pubkey.h:33
isminetype
IsMine() return codes, which depend on ScriptPubKeyMan implementation.
Definition: types.h:40
virtual util::Result< std::unique_ptr< Wallet > > restoreWallet(const fs::path &backup_file, const std::string &wallet_name, std::vector< bilingual_str > &warnings)=0
Restore backup wallet.
virtual bool transactionCanBeAbandoned(const uint256 &txid)=0
Return whether transaction can be abandoned.
Interface for accessing a wallet.
Definition: wallet.h:60
virtual bool encryptWallet(const SecureString &wallet_passphrase)=0
Encrypt wallet.
std::unique_ptr< Wallet > wallet
Definition: wallet.h:435
WalletContext context
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.
A CWallet maintains a set of transactions and balances, and provides the ability to create new transa...
Definition: wallet.h:300
An output of a transaction.
Definition: transaction.h:157
std::vector< wallet::isminetype > txout_address_is_mine
Definition: wallet.h:398
CAmount immature_watch_only_balance
Definition: wallet.h:379
FeeReason
Definition: fees.h:58
virtual bool transactionCanBeBumped(const uint256 &txid)=0
Return whether transaction can be bumped.
An outpoint - a combination of a transaction hash and an index n into its vout.
Definition: transaction.h:35
Wallet chain client that in addition to having chain client methods for starting up, shutting down, and registering RPCs, also has additional methods (called by the GUI) to load and create wallets.
Definition: wallet.h:322
virtual wallet::CWallet * wallet()
Return pointer to internal wallet class, useful for testing.
Definition: wallet.h:316
virtual std::vector< std::unique_ptr< Wallet > > getWallets()=0
Return interfaces for accessing wallets (if any).
std::function< void(const uint256 &txid, ChangeType status)> TransactionChangedFn
Register handler for transaction changed messages.
Definition: wallet.h:304
virtual std::vector< WalletTxOut > getCoins(const std::vector< COutPoint > &outputs)=0
Return wallet transaction output information.
virtual CAmount getAvailableBalance(const wallet::CCoinControl &coin_control)=0
Get available balance.
std::variant< CNoDestination, PubKeyDestination, PKHash, ScriptHash, WitnessV0ScriptHash, WitnessV0KeyHash, WitnessV1Taproot, WitnessUnknown > CTxDestination
A txout script categorized into standard templates.
Definition: addresstype.h:129
virtual ~Wallet()
Definition: wallet.h:63
virtual std::set< WalletTx > getWalletTxs()=0
Get list of all wallet transactions.
256-bit opaque blob.
Definition: uint256.h:106
virtual bool taprootEnabled()=0
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.
virtual bool signBumpTransaction(CMutableTransaction &mtx)=0
Sign bump transaction.
virtual bool delAddressBook(const CTxDestination &dest)=0
CAmount unconfirmed_watch_only_balance
Definition: wallet.h:378
Migrated wallet info.
Definition: wallet.h:433
Interface to let node manage chain clients (wallets, or maybe tools for monitoring and analysis in th...
Definition: chain.h:373
Interface giving clients (wallet processes, maybe other analysis tools in the future) ability to acce...
Definition: chain.h:122
virtual void listLockedCoins(std::vector< COutPoint > &outputs)=0
List locked coins.
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:412
virtual bool tryGetBalances(WalletBalances &balances, uint256 &block_hash)=0
Get balances if possible without blocking.
A reference to a CKey: the Hash160 of its serialized public key.
Definition: pubkey.h:23
virtual std::string getWalletDir()=0
Return default wallet directory.
virtual bool haveWatchOnly()=0
Return whether wallet has watch only keys.
std::function< void(const std::string &title, int progress)> ShowProgressFn
Register handler for show progress messages.
Definition: wallet.h:288
virtual std::unique_ptr< Handler > handleLoadWallet(LoadWalletFn fn)=0
virtual wallet::isminetype txinIsMine(const CTxIn &txin)=0
Return whether transaction input belongs to wallet.
WalletContext struct containing references to state shared between CWallet instances, like the reference to the chain interface, and the list of opened wallets.
Definition: context.h:35
TransactionError
Definition: error.h:22
Fee rate in satoshis per kilovirtualbyte: CAmount / kvB.
Definition: feerate.h:32
virtual bool isLockedCoin(const COutPoint &output)=0
Return whether coin is locked.
virtual util::Result< CTransactionRef > createTransaction(const std::vector< wallet::CRecipient > &recipients, const wallet::CCoinControl &coin_control, bool sign, int &change_pos, CAmount &fee)=0
Create transaction.
std::vector< std::pair< std::string, std::string > > WalletOrderForm
Definition: wallet.h:56
Information about one wallet address.
Definition: wallet.h:357
virtual bool lock()=0
Lock wallet.
A mutable version of CTransaction.
Definition: transaction.h:379
virtual TransactionError fillPSBT(int sighash_type, bool sign, bool bip32derivs, size_t *n_signed, PartiallySignedTransaction &psbtx, bool &complete)=0
Fill PSBT.
virtual bool setAddressBook(const CTxDestination &dest, const std::string &name, const std::optional< wallet::AddressPurpose > &purpose)=0
Add or update address.
virtual unsigned int getConfirmTarget()=0
Get tx confirm target.
virtual CAmount getBalance()=0
Get balance.
virtual std::vector< std::string > getAddressReceiveRequests()=0
Get receive requests.
std::map< std::string, std::string > value_map
Definition: wallet.h:403
bool operator<(const WalletTx &a) const
Definition: wallet.h:406
An encapsulated private key.
Definition: key.h:32
virtual void abortRescan()=0
Abort a rescan.
std::shared_ptr< CWallet > wallet
WalletAddress(CTxDestination dest, wallet::isminetype is_mine, wallet::AddressPurpose purpose, std::string name)
Definition: wallet.h:364
virtual void commitTransaction(CTransactionRef tx, WalletValueMap value_map, WalletOrderForm order_form)=0
Commit transaction.
virtual WalletBalances getBalances()=0
Get balances.
ChangeType
General change type (added, updated, removed).
Definition: ui_change_type.h:9
Wallet transaction output.
Definition: wallet.h:424
virtual CAmount getRequiredFee(unsigned int tx_bytes)=0
Get required fee.
bool balanceChanged(const WalletBalances &prev) const
Definition: wallet.h:381
Path class wrapper to block calls to the fs::path(std::string) implicit constructor and the fs::path:...
Definition: fs.h:30
virtual std::string getWalletName()=0
Get wallet name.
Updated transaction status.
Definition: wallet.h:410
virtual CAmount getMinimumFee(unsigned int tx_bytes, const wallet::CCoinControl &coin_control, int *returned_target, FeeReason *reason)=0
Get minimum fee.
Coin Control Features.
Definition: coincontrol.h:28
virtual bool getAddress(const CTxDestination &dest, std::string *name, wallet::isminetype *is_mine, wallet::AddressPurpose *purpose)=0
Look up address in wallet, return whether exists.
std::function< void(std::unique_ptr< Wallet > wallet)> LoadWalletFn
Register handler for load wallet messages.
Definition: wallet.h:349
virtual bool abandonTransaction(const uint256 &txid)=0
Abandon transaction.
virtual bool unlock(const SecureString &wallet_passphrase)=0
Unlock wallet.
virtual util::Result< WalletMigrationResult > migrateWallet(const std::string &name, const SecureString &passphrase)=0
Migrate a wallet.