5 #ifndef BITCOIN_INTERFACES_WALLET_H 6 #define BITCOIN_INTERFACES_WALLET_H 35 class PendingWalletTx;
37 struct WalletBalances;
40 struct WalletTxStatus;
58 virtual bool lock() = 0;
74 virtual bool backupWallet(
const std::string& filename) = 0;
104 std::string* purpose) = 0;
135 virtual std::unique_ptr<PendingWalletTx>
createTransaction(
const std::vector<CRecipient>& recipients,
140 std::string& fail_reason) = 0;
155 std::vector<std::string>& errors,
166 std::vector<std::string>& errors,
182 int64_t& adjusted_time) = 0;
190 int64_t& adjusted_time) = 0;
218 using CoinsList = std::map<CTxDestination, std::vector<std::tuple<COutPoint, WalletTxOut>>>;
222 virtual std::vector<WalletTxOut>
getCoins(
const std::vector<COutPoint>& outputs) = 0;
230 int* returned_target,
253 using ShowProgressFn = std::function<void(const std::string& title, int progress)>;
262 const std::string& label,
264 const std::string& purpose,
292 std::string& reject_reason) = 0;
371 std::unique_ptr<Wallet>
MakeWallet(
const std::shared_ptr<CWallet>& wallet);
375 #endif // BITCOIN_INTERFACES_WALLET_H virtual bool isCrypted()=0
Return whether wallet is encrypted.
virtual bool getAddress(const CTxDestination &dest, std::string *name, isminetype *is_mine, std::string *purpose)=0
Look up address in wallet, return whether exists.
virtual bool tryGetTxStatus(const uint256 &txid, WalletTxStatus &tx_status, int &num_blocks, int64_t &adjusted_time)=0
Try to get updated status for a particular transaction, if possible without blocking.
virtual CoinsList listCoins()=0
WalletAddress(CTxDestination dest, isminetype is_mine, std::string name, std::string purpose)
std::vector< CTxDestination > txout_address
virtual bool commitBumpTransaction(const uint256 &txid, CMutableTransaction &&mtx, std::vector< std::string > &errors, uint256 &bumped_txid)=0
Commit bump transaction.
virtual bool isLocked()=0
Return whether wallet is locked.
virtual OutputType getDefaultAddressType()=0
unsigned int time_received
virtual isminetype txoutIsMine(const CTxOut &txout)=0
Return whether transaction output belongs to wallet.
std::function< void(bool have_watch_only)> WatchOnlyChangedFn
Register handler for watchonly changed messages.
std::vector< isminetype > txin_is_mine
virtual std::unique_ptr< Handler > handleAddressBookChanged(AddressBookChangedFn fn)=0
std::vector< isminetype > txout_is_mine
virtual CTransactionRef getTx(const uint256 &txid)=0
Get a transaction.
std::function< void()> UnloadFn
Register handler for unload message.
std::basic_string< char, std::char_traits< char >, secure_allocator< char > > SecureString
virtual std::unique_ptr< Handler > handleWatchOnlyChanged(WatchOnlyChangedFn fn)=0
virtual bool backupWallet(const std::string &filename)=0
Back up wallet.
uint8_t isminefilter
used for bitflags of isminetype
virtual void lockCoin(const COutPoint &output)=0
Lock coin.
virtual bool commit(WalletValueMap value_map, WalletOrderForm order_form, std::string &reject_reason)=0
Send pending transaction and commit to wallet.
std::map< std::string, std::string > WalletValueMap
virtual bool eraseDestData(const CTxDestination &dest, const std::string &key)=0
Erase dest data.
std::shared_ptr< const CTransaction > CTransactionRef
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 OutputType getDefaultChangeType()=0
std::function< void()> StatusChangedFn
Register handler for status changed messages.
virtual WalletTx getWalletTx(const uint256 &txid)=0
Get transaction information.
virtual isminetype txinIsMine(const CTxIn &txin)=0
Return whether transaction input belongs to wallet.
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.
virtual bool IsWalletFlagSet(uint64_t flag)=0
int64_t CAmount
Amount in satoshis (Can be negative)
std::map< CTxDestination, std::vector< std::tuple< COutPoint, WalletTxOut > >> CoinsList
Return AvailableCoins + LockedCoins grouped by wallet address.
virtual std::unique_ptr< Handler > handleUnload(UnloadFn fn)=0
virtual bool getKeyFromPool(bool internal, CPubKey &pub_key)=0
CAmount watch_only_balance
virtual std::unique_ptr< Handler > handleTransactionChanged(TransactionChangedFn fn)=0
virtual bool hdEnabled()=0
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.
virtual CAmount getCredit(const CTxOut &txout, isminefilter filter)=0
Return credit amount if transaction input belongs to wallet.
virtual std::unique_ptr< Handler > handleShowProgress(ShowProgressFn fn)=0
virtual std::unique_ptr< Handler > handleStatusChanged(StatusChangedFn fn)=0
virtual void unlockCoin(const COutPoint &output)=0
Unlock coin.
ChangeType
General change type (added, updated, removed).
virtual ~PendingWalletTx()
Collection of wallet balances.
isminetype
IsMine() return codes.
An input of a transaction.
boost::variant< CNoDestination, CKeyID, CScriptID, WitnessV0ScriptHash, WitnessV0KeyHash, WitnessUnknown > CTxDestination
A txout script template with a specific destination.
An encapsulated public key.
virtual bool transactionCanBeAbandoned(const uint256 &txid)=0
Return whether transaction can be abandoned.
Interface for accessing a wallet.
virtual bool encryptWallet(const SecureString &wallet_passphrase)=0
Encrypt wallet.
virtual CAmount getMinimumFee(unsigned int tx_bytes, const CCoinControl &coin_control, int *returned_target, FeeReason *reason)=0
Get minimum fee.
An output of a transaction.
CAmount immature_watch_only_balance
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.
virtual int64_t getVirtualSize()=0
Get virtual transaction size.
std::unique_ptr< Wallet > MakeWallet(const std::shared_ptr< CWallet > &wallet)
Return implementation of Wallet interface.
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.
std::function< void(const uint256 &txid, ChangeType status)> TransactionChangedFn
Register handler for transaction changed messages.
virtual std::vector< WalletTxOut > getCoins(const std::vector< COutPoint > &outputs)=0
Return wallet transaction output information.
virtual bool addDestData(const CTxDestination &dest, const std::string &key, const std::string &value)=0
Add dest data.
virtual CAmount getDebit(const CTxIn &txin, isminefilter filter)=0
Return debit amount if transaction input belongs to wallet.
CAmount unconfirmed_balance
virtual void learnRelatedScripts(const CPubKey &key, OutputType type)=0
Add scripts to key store so old so software versions opening the wallet database can detect payments ...
virtual bool signBumpTransaction(CMutableTransaction &mtx)=0
Sign bump transaction.
std::vector< isminetype > txout_address_is_mine
virtual std::vector< WalletTx > getWalletTxs()=0
Get list of all wallet transactions.
virtual bool delAddressBook(const CTxDestination &dest)=0
CAmount unconfirmed_watch_only_balance
virtual void listLockedCoins(std::vector< COutPoint > &outputs)=0
List locked coins.
virtual WalletTx getWalletTxDetails(const uint256 &txid, WalletTxStatus &tx_status, WalletOrderForm &order_form, bool &in_mempool, int &num_blocks, int64_t &adjusted_time)=0
Get transaction details.
virtual bool setAddressBook(const CTxDestination &dest, const std::string &name, const std::string &purpose)=0
Add or update address.
A reference to a CKey: the Hash360 of its serialized public key.
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.
A CWallet is an extension of a keystore, which also maintains a set of transactions and balances...
Fee rate in satoshis per kilobyte: CAmount / kB.
virtual bool getPubKey(const CKeyID &address, CPubKey &pub_key)=0
Get public key.
virtual bool isLockedCoin(const COutPoint &output)=0
Return whether coin is locked.
std::vector< std::pair< std::string, std::string > > WalletOrderForm
Information about one wallet address.
virtual bool lock()=0
Lock wallet.
A mutable version of CTransaction.
virtual unsigned int getConfirmTarget()=0
Get tx confirm target.
virtual CAmount getBalance()=0
Get balance.
std::map< std::string, std::string > value_map
An encapsulated private key.
virtual void abortRescan()=0
Abort a rescan.
The basic transaction that is broadcasted on the network and contained in blocks. ...
virtual CAmount getAvailableBalance(const CCoinControl &coin_control)=0
Get available balance.
virtual WalletBalances getBalances()=0
Get balances.
Wallet transaction output.
virtual CAmount getRequiredFee(unsigned int tx_bytes)=0
Get required fee.
bool balanceChanged(const WalletBalances &prev) const
virtual std::string getWalletName()=0
Get wallet name.
Updated transaction status.
virtual bool getPrivKey(const CKeyID &address, CKey &key)=0
Get private key.
Tracking object returned by CreateTransaction and passed to CommitTransaction.
virtual bool abandonTransaction(const uint256 &txid)=0
Abandon transaction.
virtual std::vector< std::string > getDestValues(const std::string &prefix)=0
Get dest values with prefix.
virtual bool unlock(const SecureString &wallet_passphrase)=0
Unlock wallet.
virtual bool tryGetBalances(WalletBalances &balances, int &num_blocks)=0
Get balances if possible without blocking.
virtual std::vector< WalletAddress > getAddresses()=0
Get wallet address list.