5 #ifndef BITCOIN_INTERFACES_WALLET_H 6 #define BITCOIN_INTERFACES_WALLET_H 37 class PendingWalletTx;
39 struct WalletBalances;
42 struct WalletTxStatus;
60 virtual bool lock() = 0;
106 std::string* purpose) = 0;
137 virtual std::unique_ptr<PendingWalletTx>
createTransaction(
const std::vector<CRecipient>& recipients,
142 std::string& fail_reason) = 0;
157 std::vector<std::string>& errors,
168 std::vector<std::string>& errors,
191 int& num_blocks) = 0;
219 using CoinsList = std::map<CTxDestination, std::vector<std::tuple<COutPoint, WalletTxOut>>>;
223 virtual std::vector<WalletTxOut>
getCoins(
const std::vector<COutPoint>& outputs) = 0;
231 int* returned_target,
256 virtual void remove() = 0;
263 using ShowProgressFn = std::function<void(
const std::string& title,
int progress)>;
272 const std::string& label,
274 const std::string& purpose,
303 std::string& reject_reason) = 0;
382 std::unique_ptr<Wallet>
MakeWallet(
const std::shared_ptr<CWallet>& wallet);
386 #endif // BITCOIN_INTERFACES_WALLET_H std::shared_ptr< const CTransaction > CTransactionRef
Definition: transaction.h:408
int blocks_to_maturity
Definition: wallet.h:360
virtual bool isLocked()=0
Return whether wallet is locked.
virtual bool canGetAddresses()=0
CAmount watch_only_balance
Definition: wallet.h:327
Definition: transaction.h:366
virtual bool getAddress(const CTxDestination &dest, std::string *name, isminetype *is_mine, std::string *purpose)=0
Look up address in wallet, return whether exists.
std::function< void(bool have_watch_only)> WatchOnlyChangedFn
Register handler for watchonly changed messages.
Definition: wallet.h:283
std::vector< CTxDestination > txout_address
Definition: wallet.h:346
virtual bool changeWalletPassphrase(const SecureString &old_wallet_passphrase, const SecureString &new_wallet_passphrase)=0
Change wallet passphrase.
virtual WalletTx getWalletTxDetails(const uint256 &txid, WalletTxStatus &tx_status, WalletOrderForm &order_form, bool &in_mempool, int &num_blocks)=0
Get transaction details.
Definition: transaction.h:63
virtual void lockCoin(const COutPoint &output)=0
Lock coin.
filename
Definition: custom_dsstore.py:46
virtual bool isCrypted()=0
Return whether wallet is encrypted.
virtual bool hdEnabled()=0
std::vector< isminetype > txout_is_mine
Definition: wallet.h:345
virtual const CTransaction & get()=0
Get transaction data.
virtual CAmount getCredit(const CTxOut &txout, isminefilter filter)=0
Return credit amount if transaction input belongs to wallet.
std::string purpose
Definition: wallet.h:312
virtual std::vector< WalletTx > getWalletTxs()=0
Get list of all wallet transactions.
const char * prefix
Definition: rest.cpp:626
virtual CAmount getDefaultMaxTxFee()=0
Get max tx fee.
bool is_trusted
Definition: wallet.h:365
bool is_abandoned
Definition: wallet.h:366
std::basic_string< char, std::char_traits< char >, secure_allocator< char > > SecureString
Definition: secure.h:60
virtual isminetype txinIsMine(const CTxIn &txin)=0
Return whether transaction input belongs to wallet.
Collection of wallet balances.
Definition: wallet.h:321
virtual bool backupWallet(const std::string &filename)=0
Back up wallet.
virtual bool tryGetBalances(WalletBalances &balances, int &num_blocks)=0
Get balances if possible without blocking.
virtual std::string getWalletName()=0
Get wallet name.
std::map< std::string, std::string > WalletValueMap
Definition: wallet.h:45
int depth_in_main_chain
Definition: wallet.h:361
unsigned int time_received
Definition: wallet.h:362
unsigned char uint8_t
Definition: stdint.h:19
virtual bool delAddressBook(const CTxDestination &dest)=0
virtual bool eraseDestData(const CTxDestination &dest, const std::string &key)=0
Erase dest data.
std::vector< isminetype > txout_address_is_mine
Definition: wallet.h:347
virtual bool addDestData(const CTxDestination &dest, const std::string &key, const std::string &value)=0
Add dest data.
virtual CAmount getAvailableBalance(const CCoinControl &coin_control)=0
Get available balance.
OutputType
Definition: outputtype.h:16
std::vector< isminetype > txin_is_mine
Definition: wallet.h:344
uint32_t lock_time
Definition: wallet.h:363
Definition: coincontrol.h:16
CAmount debit
Definition: wallet.h:349
std::function< void()> StatusChangedFn
Register handler for status changed messages.
Definition: wallet.h:267
virtual std::unique_ptr< Handler > handleTransactionChanged(TransactionChangedFn fn)=0
virtual bool lock()=0
Lock wallet.
CTransactionRef tx
Definition: wallet.h:343
bool is_coinbase
Definition: wallet.h:353
int64_t CAmount
Definition: amount.h:12
std::function< void(const std::string &title, int progress)> ShowProgressFn
Register handler for show progress messages.
Definition: wallet.h:263
virtual ~Wallet()
Definition: wallet.h:51
virtual std::unique_ptr< Handler > handleShowProgress(ShowProgressFn fn)=0
virtual bool isLockedCoin(const COutPoint &output)=0
Return whether coin is locked.
CAmount immature_watch_only_balance
Definition: wallet.h:329
std::function< void(const uint256 &txid, ChangeType status)> TransactionChangedFn
Register handler for transaction changed messages.
Definition: wallet.h:279
virtual bool transactionCanBeBumped(const uint256 &txid)=0
Return whether transaction can be bumped.
virtual OutputType getDefaultAddressType()=0
std::map< CTxDestination, std::vector< std::tuple< COutPoint, WalletTxOut > >> CoinsList
Definition: wallet.h:219
ChangeType
Definition: ui_interface.h:26
Definition: dummywallet.cpp:11
Definition: transaction.h:270
std::function< void()> UnloadFn
Register handler for unload message.
Definition: wallet.h:259
Definition: transaction.h:18
unsigned int uint32_t
Definition: stdint.h:21
virtual bool isSpendable(const CTxDestination &dest)=0
Return whether wallet has private key.
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:275
const char * name
Definition: rest.cpp:39
virtual bool signBumpTransaction(CMutableTransaction &mtx)=0
Sign bump transaction.
CTxOut txout
Definition: wallet.h:374
CAmount immature_balance
Definition: wallet.h:325
virtual CAmount getBalance()=0
Get balance.
unsigned long long uint64_t
Definition: stdint.h:22
virtual WalletTx getWalletTx(const uint256 &txid)=0
Get transaction information.
bool have_watch_only
Definition: wallet.h:326
virtual ~PendingWalletTx()
Definition: wallet.h:295
uint8_t isminefilter
Definition: wallet.h:28
virtual OutputType getDefaultChangeType()=0
CAmount change
Definition: wallet.h:350
virtual bool getNewDestination(const OutputType type, const std::string label, CTxDestination &dest)=0
virtual std::unique_ptr< Handler > handleStatusChanged(StatusChangedFn fn)=0
virtual bool transactionCanBeAbandoned(const uint256 &txid)=0
Return whether transaction can be abandoned.
isminetype
Definition: ismine.h:18
Updated transaction status.
Definition: wallet.h:357
FeeReason
Definition: fees.h:36
bool is_coinbase
Definition: wallet.h:367
virtual bool unlock(const SecureString &wallet_passphrase)=0
Unlock wallet.
virtual std::unique_ptr< PendingWalletTx > createTransaction(const std::vector< CRecipient > &recipients, const CCoinControl &coin_control, bool sign, int &change_pos, CAmount &fee, std::string &fail_reason)=0
Create transaction.
int64_t time
Definition: wallet.h:375
virtual std::unique_ptr< Handler > handleWatchOnlyChanged(WatchOnlyChangedFn fn)=0
std::unique_ptr< Wallet > MakeWallet(const std::shared_ptr< CWallet > &wallet)
Definition: dummywallet.cpp:81
virtual CAmount getRequiredFee(unsigned int tx_bytes)=0
Get required fee.
virtual bool setAddressBook(const CTxDestination &dest, const std::string &name, const std::string &purpose)=0
Add or update address.
int depth_in_main_chain
Definition: wallet.h:376
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.
std::string name
Definition: wallet.h:311
virtual CAmount getMinimumFee(unsigned int tx_bytes, const CCoinControl &coin_control, int *returned_target, FeeReason *reason)=0
Get minimum fee.
virtual bool commit(WalletValueMap value_map, WalletOrderForm order_form, std::string &reject_reason)=0
Send pending transaction and commit to wallet.
CTxDestination dest
Definition: wallet.h:309
Definition: uint256.h:121
isminetype is_mine
Definition: wallet.h:310
std::function< void()> CanGetAddressesChangedFn
Register handler for keypool changed messages.
Definition: wallet.h:287
virtual bool haveWatchOnly()=0
Return whether wallet has watch only keys.
CAmount unconfirmed_watch_only_balance
Definition: wallet.h:328
virtual bool encryptWallet(const SecureString &wallet_passphrase)=0
Encrypt wallet.
CAmount balance
Definition: wallet.h:323
bool is_in_main_chain
Definition: wallet.h:368
bool is_final
Definition: wallet.h:364
virtual std::unique_ptr< Handler > handleAddressBookChanged(AddressBookChangedFn fn)=0
virtual isminetype txoutIsMine(const CTxOut &txout)=0
Return whether transaction output belongs to wallet.
bool is_spent
Definition: wallet.h:377
virtual std::vector< WalletAddress > getAddresses()=0
Get wallet address list.
virtual CAmount getDebit(const CTxIn &txin, isminefilter filter)=0
Return debit amount if transaction input belongs to wallet.
std::map< std::string, std::string > value_map
Definition: wallet.h:352
Tracking object returned by CreateTransaction and passed to CommitTransaction.
Definition: wallet.h:292
virtual bool IsWalletFlagSet(uint64_t flag)=0
virtual unsigned int getConfirmTarget()=0
Get tx confirm target.
virtual void unlockCoin(const COutPoint &output)=0
Unlock coin.
CAmount unconfirmed_balance
Definition: wallet.h:324
std::vector< std::pair< std::string, std::string > > WalletOrderForm
Definition: wallet.h:44
bool balanceChanged(const WalletBalances &prev) const
Definition: wallet.h:331
virtual void learnRelatedScripts(const CPubKey &key, OutputType type)=0
signed long long int64_t
Definition: stdint.h:18
virtual CoinsList listCoins()=0
virtual bool getPubKey(const CKeyID &address, CPubKey &pub_key)=0
Get public key.
virtual std::vector< std::string > getDestValues(const std::string &prefix)=0
Get dest values with prefix.
virtual bool getPrivKey(const CKeyID &address, CKey &key)=0
Get private key.
virtual std::vector< WalletTxOut > getCoins(const std::vector< COutPoint > &outputs)=0
Return wallet transaction output information.
Information about one wallet address.
Definition: wallet.h:307
CAmount credit
Definition: wallet.h:348
boost::variant< CNoDestination, PKHash, ScriptHash, WitnessV0ScriptHash, WitnessV0KeyHash, WitnessUnknown > CTxDestination
Definition: standard.h:139
virtual CTransactionRef getTx(const uint256 &txid)=0
Get a transaction.
virtual WalletBalances getBalances()=0
Get balances.
int block_height
Definition: wallet.h:359
virtual std::unique_ptr< Handler > handleCanGetAddressesChanged(CanGetAddressesChangedFn fn)=0
virtual void abortRescan()=0
Abort a rescan.
int64_t time
Definition: wallet.h:351
virtual std::unique_ptr< Handler > handleUnload(UnloadFn fn)=0
WalletAddress(CTxDestination dest, isminetype is_mine, std::string name, std::string purpose)
Definition: wallet.h:314
virtual bool createBumpTransaction(const uint256 &txid, const CCoinControl &coin_control, CAmount total_fee, std::vector< std::string > &errors, CAmount &old_fee, CAmount &new_fee, CMutableTransaction &mtx)=0
Create bump transaction.
Interface for accessing a wallet.
Definition: wallet.h:48
Wallet transaction output.
Definition: wallet.h:372
virtual bool commitBumpTransaction(const uint256 &txid, CMutableTransaction &&mtx, std::vector< std::string > &errors, uint256 &bumped_txid)=0
Commit bump transaction.
virtual bool abandonTransaction(const uint256 &txid)=0
Abandon transaction.
virtual void listLockedCoins(std::vector< COutPoint > &outputs)=0
List locked coins.
def sign()
Definition: gitian-build.py:91
Definition: transaction.h:133