Bitcoin Core  28.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 <common/signmessage.h>
10 #include <consensus/amount.h>
11 #include <interfaces/chain.h>
12 #include <pubkey.h>
13 #include <script/script.h>
15 #include <util/fs.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;
34 struct bilingual_str;
35 namespace common {
36 enum class PSBTError;
37 } // namespace common
38 namespace node {
39 enum class TransactionError;
40 } // namespace node
41 namespace wallet {
42 class CCoinControl;
43 class CWallet;
44 enum class AddressPurpose;
45 enum isminetype : unsigned int;
46 struct CRecipient;
47 struct WalletContext;
48 using isminefilter = std::underlying_type<isminetype>::type;
49 } // namespace wallet
50 
51 namespace interfaces {
52 
53 class Handler;
54 struct WalletAddress;
55 struct WalletBalances;
56 struct WalletTx;
57 struct WalletTxOut;
58 struct WalletTxStatus;
59 struct WalletMigrationResult;
60 
61 using WalletOrderForm = std::vector<std::pair<std::string, std::string>>;
62 using WalletValueMap = std::map<std::string, std::string>;
63 
65 class Wallet
66 {
67 public:
68  virtual ~Wallet() = default;
69 
71  virtual bool encryptWallet(const SecureString& wallet_passphrase) = 0;
72 
74  virtual bool isCrypted() = 0;
75 
77  virtual bool lock() = 0;
78 
80  virtual bool unlock(const SecureString& wallet_passphrase) = 0;
81 
83  virtual bool isLocked() = 0;
84 
86  virtual bool changeWalletPassphrase(const SecureString& old_wallet_passphrase,
87  const SecureString& new_wallet_passphrase) = 0;
88 
90  virtual void abortRescan() = 0;
91 
93  virtual bool backupWallet(const std::string& filename) = 0;
94 
96  virtual std::string getWalletName() = 0;
97 
98  // Get a new address.
99  virtual util::Result<CTxDestination> getNewDestination(const OutputType type, const std::string& label) = 0;
100 
102  virtual bool getPubKey(const CScript& script, const CKeyID& address, CPubKey& pub_key) = 0;
103 
105  virtual SigningResult signMessage(const std::string& message, const PKHash& pkhash, std::string& str_sig) = 0;
106 
108  virtual bool isSpendable(const CTxDestination& dest) = 0;
109 
111  virtual bool haveWatchOnly() = 0;
112 
114  virtual bool setAddressBook(const CTxDestination& dest, const std::string& name, const std::optional<wallet::AddressPurpose>& purpose) = 0;
115 
116  // Remove address.
117  virtual bool delAddressBook(const CTxDestination& dest) = 0;
118 
120  virtual bool getAddress(const CTxDestination& dest,
121  std::string* name,
122  wallet::isminetype* is_mine,
123  wallet::AddressPurpose* purpose) = 0;
124 
126  virtual std::vector<WalletAddress> getAddresses() = 0;
127 
129  virtual std::vector<std::string> getAddressReceiveRequests() = 0;
130 
132  virtual bool setAddressReceiveRequest(const CTxDestination& dest, const std::string& id, const std::string& value) = 0;
133 
135  virtual util::Result<void> displayAddress(const CTxDestination& dest) = 0;
136 
138  virtual bool lockCoin(const COutPoint& output, const bool write_to_db) = 0;
139 
141  virtual bool unlockCoin(const COutPoint& output) = 0;
142 
144  virtual bool isLockedCoin(const COutPoint& output) = 0;
145 
147  virtual void listLockedCoins(std::vector<COutPoint>& outputs) = 0;
148 
150  virtual util::Result<CTransactionRef> createTransaction(const std::vector<wallet::CRecipient>& recipients,
151  const wallet::CCoinControl& coin_control,
152  bool sign,
153  int& change_pos,
154  CAmount& fee) = 0;
155 
157  virtual void commitTransaction(CTransactionRef tx,
158  WalletValueMap value_map,
159  WalletOrderForm order_form) = 0;
160 
162  virtual bool transactionCanBeAbandoned(const uint256& txid) = 0;
163 
165  virtual bool abandonTransaction(const uint256& txid) = 0;
166 
168  virtual bool transactionCanBeBumped(const uint256& txid) = 0;
169 
171  virtual bool createBumpTransaction(const uint256& txid,
172  const wallet::CCoinControl& coin_control,
173  std::vector<bilingual_str>& errors,
174  CAmount& old_fee,
175  CAmount& new_fee,
176  CMutableTransaction& mtx) = 0;
177 
179  virtual bool signBumpTransaction(CMutableTransaction& mtx) = 0;
180 
182  virtual bool commitBumpTransaction(const uint256& txid,
183  CMutableTransaction&& mtx,
184  std::vector<bilingual_str>& errors,
185  uint256& bumped_txid) = 0;
186 
188  virtual CTransactionRef getTx(const uint256& txid) = 0;
189 
191  virtual WalletTx getWalletTx(const uint256& txid) = 0;
192 
194  virtual std::set<WalletTx> getWalletTxs() = 0;
195 
197  virtual bool tryGetTxStatus(const uint256& txid,
198  WalletTxStatus& tx_status,
199  int& num_blocks,
200  int64_t& block_time) = 0;
201 
203  virtual WalletTx getWalletTxDetails(const uint256& txid,
204  WalletTxStatus& tx_status,
205  WalletOrderForm& order_form,
206  bool& in_mempool,
207  int& num_blocks) = 0;
208 
210  virtual std::optional<common::PSBTError> fillPSBT(int sighash_type,
211  bool sign,
212  bool bip32derivs,
213  size_t* n_signed,
215  bool& complete) = 0;
216 
218  virtual WalletBalances getBalances() = 0;
219 
221  virtual bool tryGetBalances(WalletBalances& balances, uint256& block_hash) = 0;
222 
224  virtual CAmount getBalance() = 0;
225 
227  virtual CAmount getAvailableBalance(const wallet::CCoinControl& coin_control) = 0;
228 
230  virtual wallet::isminetype txinIsMine(const CTxIn& txin) = 0;
231 
233  virtual wallet::isminetype txoutIsMine(const CTxOut& txout) = 0;
234 
236  virtual CAmount getDebit(const CTxIn& txin, wallet::isminefilter filter) = 0;
237 
239  virtual CAmount getCredit(const CTxOut& txout, wallet::isminefilter filter) = 0;
240 
243  using CoinsList = std::map<CTxDestination, std::vector<std::tuple<COutPoint, WalletTxOut>>>;
244  virtual CoinsList listCoins() = 0;
245 
247  virtual std::vector<WalletTxOut> getCoins(const std::vector<COutPoint>& outputs) = 0;
248 
250  virtual CAmount getRequiredFee(unsigned int tx_bytes) = 0;
251 
253  virtual CAmount getMinimumFee(unsigned int tx_bytes,
254  const wallet::CCoinControl& coin_control,
255  int* returned_target,
256  FeeReason* reason) = 0;
257 
259  virtual unsigned int getConfirmTarget() = 0;
260 
261  // Return whether HD enabled.
262  virtual bool hdEnabled() = 0;
263 
264  // Return whether the wallet is blank.
265  virtual bool canGetAddresses() = 0;
266 
267  // Return whether private keys enabled.
268  virtual bool privateKeysDisabled() = 0;
269 
270  // Return whether the wallet contains a Taproot scriptPubKeyMan
271  virtual bool taprootEnabled() = 0;
272 
273  // Return whether wallet uses an external signer.
274  virtual bool hasExternalSigner() = 0;
275 
276  // Get default address type.
277  virtual OutputType getDefaultAddressType() = 0;
278 
280  virtual CAmount getDefaultMaxTxFee() = 0;
281 
282  // Remove wallet.
283  virtual void remove() = 0;
284 
286  virtual bool isLegacy() = 0;
287 
289  using UnloadFn = std::function<void()>;
290  virtual std::unique_ptr<Handler> handleUnload(UnloadFn fn) = 0;
291 
293  using ShowProgressFn = std::function<void(const std::string& title, int progress)>;
294  virtual std::unique_ptr<Handler> handleShowProgress(ShowProgressFn fn) = 0;
295 
297  using StatusChangedFn = std::function<void()>;
298  virtual std::unique_ptr<Handler> handleStatusChanged(StatusChangedFn fn) = 0;
299 
301  using AddressBookChangedFn = std::function<void(const CTxDestination& address,
302  const std::string& label,
303  bool is_mine,
304  wallet::AddressPurpose purpose,
305  ChangeType status)>;
306  virtual std::unique_ptr<Handler> handleAddressBookChanged(AddressBookChangedFn fn) = 0;
307 
309  using TransactionChangedFn = std::function<void(const uint256& txid, ChangeType status)>;
310  virtual std::unique_ptr<Handler> handleTransactionChanged(TransactionChangedFn fn) = 0;
311 
313  using WatchOnlyChangedFn = std::function<void(bool have_watch_only)>;
314  virtual std::unique_ptr<Handler> handleWatchOnlyChanged(WatchOnlyChangedFn fn) = 0;
315 
317  using CanGetAddressesChangedFn = std::function<void()>;
318  virtual std::unique_ptr<Handler> handleCanGetAddressesChanged(CanGetAddressesChangedFn fn) = 0;
319 
321  virtual wallet::CWallet* wallet() { return nullptr; }
322 };
323 
327 class WalletLoader : public ChainClient
328 {
329 public:
331  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;
332 
334  virtual util::Result<std::unique_ptr<Wallet>> loadWallet(const std::string& name, std::vector<bilingual_str>& warnings) = 0;
335 
337  virtual std::string getWalletDir() = 0;
338 
340  virtual util::Result<std::unique_ptr<Wallet>> restoreWallet(const fs::path& backup_file, const std::string& wallet_name, std::vector<bilingual_str>& warnings) = 0;
341 
343  virtual util::Result<WalletMigrationResult> migrateWallet(const std::string& name, const SecureString& passphrase) = 0;
344 
346  virtual bool isEncrypted(const std::string& wallet_name) = 0;
347 
349  virtual std::vector<std::pair<std::string, std::string>> listWalletDir() = 0;
350 
352  virtual std::vector<std::unique_ptr<Wallet>> getWallets() = 0;
353 
357  using LoadWalletFn = std::function<void(std::unique_ptr<Wallet> wallet)>;
358  virtual std::unique_ptr<Handler> handleLoadWallet(LoadWalletFn fn) = 0;
359 
361  virtual wallet::WalletContext* context() { return nullptr; }
362 };
363 
366 {
370  std::string name;
371 
373  : dest(std::move(dest)), is_mine(is_mine), purpose(std::move(purpose)), name(std::move(name))
374  {
375  }
376 };
377 
380 {
384  bool have_watch_only = false;
388 
389  bool balanceChanged(const WalletBalances& prev) const
390  {
391  return balance != prev.balance || unconfirmed_balance != prev.unconfirmed_balance ||
395  }
396 };
397 
398 // Wallet transaction information.
399 struct WalletTx
400 {
402  std::vector<wallet::isminetype> txin_is_mine;
403  std::vector<wallet::isminetype> txout_is_mine;
404  std::vector<bool> txout_is_change;
405  std::vector<CTxDestination> txout_address;
406  std::vector<wallet::isminetype> txout_address_is_mine;
410  int64_t time;
411  std::map<std::string, std::string> value_map;
413 
414  bool operator<(const WalletTx& a) const { return tx->GetHash() < a.tx->GetHash(); }
415 };
416 
419 {
423  unsigned int time_received;
424  uint32_t lock_time;
429 };
430 
433 {
435  int64_t time;
437  bool is_spent = false;
438 };
439 
442 {
443  std::unique_ptr<Wallet> wallet;
444  std::optional<std::string> watchonly_wallet_name;
445  std::optional<std::string> solvables_wallet_name;
447 };
448 
451 std::unique_ptr<Wallet> MakeWallet(wallet::WalletContext& context, const std::shared_ptr<wallet::CWallet>& wallet);
452 
455 std::unique_ptr<WalletLoader> MakeWalletLoader(Chain& chain, ArgsManager& args);
456 
457 } // namespace interfaces
458 
459 #endif // BITCOIN_INTERFACES_WALLET_H
std::shared_ptr< const CTransaction > CTransactionRef
Definition: transaction.h:423
virtual bool isCrypted()=0
Return whether wallet is encrypted.
virtual bool privateKeysDisabled()=0
TransactionError
Definition: types.h:19
PSBTError
Definition: types.h:17
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:305
virtual bool canGetAddresses()=0
std::vector< CTxDestination > txout_address
Definition: wallet.h:405
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:402
virtual OutputType getDefaultAddressType()=0
unsigned int time_received
Definition: wallet.h:423
Bilingual messages:
Definition: translation.h:18
std::function< void(bool have_watch_only)> WatchOnlyChangedFn
Register handler for watchonly changed messages.
Definition: wallet.h:313
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:368
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:289
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.
virtual util::Result< void > displayAddress(const CTxDestination &dest)=0
Display address on external signer.
std::function< void()> CanGetAddressesChangedFn
Register handler for keypool changed messages.
Definition: wallet.h:317
std::unique_ptr< Wallet > MakeWallet(wallet::WalletContext &context, const std::shared_ptr< wallet::CWallet > &wallet)
Return implementation of Wallet interface.
Definition: interfaces.cpp:705
CTransactionRef tx
Definition: wallet.h:401
A version of CTransaction with the PSBT format.
Definition: psbt.h:950
virtual bool lockCoin(const COutPoint &output, const bool write_to_db)=0
Lock coin.
wallet::AddressPurpose purpose
Definition: wallet.h:369
SigningResult
Definition: signmessage.h:43
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:62
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 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:297
virtual WalletTx getWalletTx(const uint256 &txid)=0
Get transaction information.
virtual bool hasExternalSigner()=0
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:243
std::vector< bool > txout_is_change
Definition: wallet.h:404
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:444
CTxDestination dest
Definition: wallet.h:367
virtual wallet::WalletContext * context()
Return pointer to internal context, useful for testing.
Definition: wallet.h:361
std::vector< wallet::isminetype > txout_is_mine
Definition: wallet.h:403
AddressPurpose
Address purpose field that has been been stored with wallet sending and receiving addresses since BIP...
Definition: types.h:61
std::unique_ptr< WalletLoader > MakeWalletLoader(Chain &chain, ArgsManager &args)
Return implementation of ChainClient interface for a wallet loader.
Definition: dummywallet.cpp:64
virtual std::vector< std::pair< std::string, std::string > > listWalletDir()=0
Return available wallets in wallet directory.
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:48
virtual std::unique_ptr< Handler > handleTransactionChanged(TransactionChangedFn fn)=0
virtual bool hdEnabled()=0
std::optional< std::string > solvables_wallet_name
Definition: wallet.h:445
virtual std::unique_ptr< Handler > handleShowProgress(ShowProgressFn fn)=0
ArgsManager & args
Definition: bitcoind.cpp:270
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:379
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:66
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:49
An encapsulated public key.
Definition: pubkey.h:33
isminetype
IsMine() return codes, which depend on ScriptPubKeyMan implementation.
Definition: types.h:41
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:65
virtual bool encryptWallet(const SecureString &wallet_passphrase)=0
Encrypt wallet.
virtual ~Wallet()=default
std::unique_ptr< Wallet > wallet
Definition: wallet.h:443
virtual bool isEncrypted(const std::string &wallet_name)=0
Returns true if wallet stores encryption keys.
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:299
An output of a transaction.
Definition: transaction.h:149
std::vector< wallet::isminetype > txout_address_is_mine
Definition: wallet.h:406
CAmount immature_watch_only_balance
Definition: wallet.h:387
FeeReason
Definition: fees.h:60
virtual std::optional< common::PSBTError > fillPSBT(int sighash_type, bool sign, bool bip32derivs, size_t *n_signed, PartiallySignedTransaction &psbtx, bool &complete)=0
Fill PSBT.
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:28
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:327
virtual wallet::CWallet * wallet()
Return pointer to internal wallet class, useful for testing.
Definition: wallet.h:321
virtual std::vector< std::unique_ptr< Wallet > > getWallets()=0
Return interfaces for accessing wallets (if any).
Definition: messages.h:20
std::function< void(const uint256 &txid, ChangeType status)> TransactionChangedFn
Register handler for transaction changed messages.
Definition: wallet.h:309
Definition: args.cpp:843
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.
virtual std::set< WalletTx > getWalletTxs()=0
Get list of all wallet transactions.
256-bit opaque blob.
Definition: uint256.h:178
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:386
Migrated wallet info.
Definition: wallet.h:441
Interface to let node manage chain clients (wallets, or maybe tools for monitoring and analysis in th...
Definition: chain.h:389
Interface giving clients (wallet processes, maybe other analysis tools in the future) ability to acce...
Definition: chain.h:134
virtual void listLockedCoins(std::vector< COutPoint > &outputs)=0
List locked coins.
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:413
std::variant< CNoDestination, PubKeyDestination, PKHash, ScriptHash, WitnessV0ScriptHash, WitnessV0KeyHash, WitnessV1Taproot, PayToAnchor, WitnessUnknown > CTxDestination
A txout script categorized into standard templates.
Definition: addresstype.h:140
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:293
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:36
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:61
Information about one wallet address.
Definition: wallet.h:365
virtual bool lock()=0
Lock wallet.
A mutable version of CTransaction.
Definition: transaction.h:377
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:411
bool operator<(const WalletTx &a) const
Definition: wallet.h:414
An encapsulated private key.
Definition: key.h:34
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:372
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:432
virtual CAmount getRequiredFee(unsigned int tx_bytes)=0
Get required fee.
bool balanceChanged(const WalletBalances &prev) const
Definition: wallet.h:389
Path class wrapper to block calls to the fs::path(std::string) implicit constructor and the fs::path:...
Definition: fs.h:32
virtual std::string getWalletName()=0
Get wallet name.
Updated transaction status.
Definition: wallet.h:418
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:80
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:357
virtual bool abandonTransaction(const uint256 &txid)=0
Abandon transaction.
virtual bool unlock(const SecureString &wallet_passphrase)=0
Unlock wallet.
virtual std::vector< WalletAddress > getAddresses()=0
Get wallet address list.
virtual util::Result< WalletMigrationResult > migrateWallet(const std::string &name, const SecureString &passphrase)=0
Migrate a wallet.