Bitcoin
|
Interface for accessing a wallet. More...
#include <wallet.h>
Public Types | |
using | CoinsList = std::map< CTxDestination, std::vector< std::tuple< COutPoint, WalletTxOut > >> |
using | UnloadFn = std::function< void()> |
Register handler for unload message. More... | |
using | ShowProgressFn = std::function< void(const std::string &title, int progress)> |
Register handler for show progress messages. More... | |
using | StatusChangedFn = std::function< void()> |
Register handler for status changed messages. More... | |
using | AddressBookChangedFn = std::function< void(const CTxDestination &address, const std::string &label, bool is_mine, const std::string &purpose, ChangeType status)> |
Register handler for address book changed messages. More... | |
using | TransactionChangedFn = std::function< void(const uint256 &txid, ChangeType status)> |
Register handler for transaction changed messages. More... | |
using | WatchOnlyChangedFn = std::function< void(bool have_watch_only)> |
Register handler for watchonly changed messages. More... | |
using | CanGetAddressesChangedFn = std::function< void()> |
Register handler for keypool changed messages. More... | |
Public Member Functions | |
virtual | ~Wallet () |
virtual bool | encryptWallet (const SecureString &wallet_passphrase)=0 |
Encrypt wallet. More... | |
virtual bool | isCrypted ()=0 |
Return whether wallet is encrypted. More... | |
virtual bool | lock ()=0 |
Lock wallet. More... | |
virtual bool | unlock (const SecureString &wallet_passphrase)=0 |
Unlock wallet. More... | |
virtual bool | isLocked ()=0 |
Return whether wallet is locked. More... | |
virtual bool | changeWalletPassphrase (const SecureString &old_wallet_passphrase, const SecureString &new_wallet_passphrase)=0 |
Change wallet passphrase. More... | |
virtual void | abortRescan ()=0 |
Abort a rescan. More... | |
virtual bool | backupWallet (const std::string &filename)=0 |
Back up wallet. More... | |
virtual std::string | getWalletName ()=0 |
Get wallet name. More... | |
virtual bool | getNewDestination (const OutputType type, const std::string label, CTxDestination &dest)=0 |
virtual bool | getPubKey (const CKeyID &address, CPubKey &pub_key)=0 |
Get public key. More... | |
virtual bool | getPrivKey (const CKeyID &address, CKey &key)=0 |
Get private key. More... | |
virtual bool | isSpendable (const CTxDestination &dest)=0 |
Return whether wallet has private key. More... | |
virtual bool | haveWatchOnly ()=0 |
Return whether wallet has watch only keys. More... | |
virtual bool | setAddressBook (const CTxDestination &dest, const std::string &name, const std::string &purpose)=0 |
Add or update address. More... | |
virtual bool | delAddressBook (const CTxDestination &dest)=0 |
virtual bool | getAddress (const CTxDestination &dest, std::string *name, isminetype *is_mine, std::string *purpose)=0 |
Look up address in wallet, return whether exists. More... | |
virtual std::vector< WalletAddress > | getAddresses ()=0 |
Get wallet address list. More... | |
virtual void | learnRelatedScripts (const CPubKey &key, OutputType type)=0 |
virtual bool | addDestData (const CTxDestination &dest, const std::string &key, const std::string &value)=0 |
Add dest data. More... | |
virtual bool | eraseDestData (const CTxDestination &dest, const std::string &key)=0 |
Erase dest data. More... | |
virtual std::vector< std::string > | getDestValues (const std::string &prefix)=0 |
Get dest values with prefix. More... | |
virtual void | lockCoin (const COutPoint &output)=0 |
Lock coin. More... | |
virtual void | unlockCoin (const COutPoint &output)=0 |
Unlock coin. More... | |
virtual bool | isLockedCoin (const COutPoint &output)=0 |
Return whether coin is locked. More... | |
virtual void | listLockedCoins (std::vector< COutPoint > &outputs)=0 |
List locked coins. More... | |
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. More... | |
virtual bool | transactionCanBeAbandoned (const uint256 &txid)=0 |
Return whether transaction can be abandoned. More... | |
virtual bool | abandonTransaction (const uint256 &txid)=0 |
Abandon transaction. More... | |
virtual bool | transactionCanBeBumped (const uint256 &txid)=0 |
Return whether transaction can be bumped. More... | |
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. More... | |
virtual bool | signBumpTransaction (CMutableTransaction &mtx)=0 |
Sign bump transaction. More... | |
virtual bool | commitBumpTransaction (const uint256 &txid, CMutableTransaction &&mtx, std::vector< std::string > &errors, uint256 &bumped_txid)=0 |
Commit bump transaction. More... | |
virtual CTransactionRef | getTx (const uint256 &txid)=0 |
Get a transaction. More... | |
virtual WalletTx | getWalletTx (const uint256 &txid)=0 |
Get transaction information. More... | |
virtual std::vector< WalletTx > | getWalletTxs ()=0 |
Get list of all wallet transactions. More... | |
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. More... | |
virtual WalletTx | getWalletTxDetails (const uint256 &txid, WalletTxStatus &tx_status, WalletOrderForm &order_form, bool &in_mempool, int &num_blocks)=0 |
Get transaction details. More... | |
virtual WalletBalances | getBalances ()=0 |
Get balances. More... | |
virtual bool | tryGetBalances (WalletBalances &balances, int &num_blocks)=0 |
Get balances if possible without blocking. More... | |
virtual CAmount | getBalance ()=0 |
Get balance. More... | |
virtual CAmount | getAvailableBalance (const CCoinControl &coin_control)=0 |
Get available balance. More... | |
virtual isminetype | txinIsMine (const CTxIn &txin)=0 |
Return whether transaction input belongs to wallet. More... | |
virtual isminetype | txoutIsMine (const CTxOut &txout)=0 |
Return whether transaction output belongs to wallet. More... | |
virtual CAmount | getDebit (const CTxIn &txin, isminefilter filter)=0 |
Return debit amount if transaction input belongs to wallet. More... | |
virtual CAmount | getCredit (const CTxOut &txout, isminefilter filter)=0 |
Return credit amount if transaction input belongs to wallet. More... | |
virtual CoinsList | listCoins ()=0 |
virtual std::vector< WalletTxOut > | getCoins (const std::vector< COutPoint > &outputs)=0 |
Return wallet transaction output information. More... | |
virtual CAmount | getRequiredFee (unsigned int tx_bytes)=0 |
Get required fee. More... | |
virtual CAmount | getMinimumFee (unsigned int tx_bytes, const CCoinControl &coin_control, int *returned_target, FeeReason *reason)=0 |
Get minimum fee. More... | |
virtual unsigned int | getConfirmTarget ()=0 |
Get tx confirm target. More... | |
virtual bool | hdEnabled ()=0 |
virtual bool | canGetAddresses ()=0 |
virtual bool | IsWalletFlagSet (uint64_t flag)=0 |
virtual OutputType | getDefaultAddressType ()=0 |
virtual OutputType | getDefaultChangeType ()=0 |
virtual CAmount | getDefaultMaxTxFee ()=0 |
Get max tx fee. More... | |
virtual void | remove ()=0 |
virtual std::unique_ptr< Handler > | handleUnload (UnloadFn fn)=0 |
virtual std::unique_ptr< Handler > | handleShowProgress (ShowProgressFn fn)=0 |
virtual std::unique_ptr< Handler > | handleStatusChanged (StatusChangedFn fn)=0 |
virtual std::unique_ptr< Handler > | handleAddressBookChanged (AddressBookChangedFn fn)=0 |
virtual std::unique_ptr< Handler > | handleTransactionChanged (TransactionChangedFn fn)=0 |
virtual std::unique_ptr< Handler > | handleWatchOnlyChanged (WatchOnlyChangedFn fn)=0 |
virtual std::unique_ptr< Handler > | handleCanGetAddressesChanged (CanGetAddressesChangedFn fn)=0 |
Interface for accessing a wallet.
using interfaces::Wallet::AddressBookChangedFn = std::function<void(const CTxDestination& address, const std::string& label, bool is_mine, const std::string& purpose, ChangeType status)> |
Register handler for address book changed messages.
using interfaces::Wallet::CanGetAddressesChangedFn = std::function<void()> |
Register handler for keypool changed messages.
using interfaces::Wallet::CoinsList = std::map<CTxDestination, std::vector<std::tuple<COutPoint, WalletTxOut> >> |
Return AvailableCoins + LockedCoins grouped by wallet address. (put change in one group with wallet address)
using interfaces::Wallet::ShowProgressFn = std::function<void(const std::string& title, int progress)> |
Register handler for show progress messages.
using interfaces::Wallet::StatusChangedFn = std::function<void()> |
Register handler for status changed messages.
using interfaces::Wallet::TransactionChangedFn = std::function<void(const uint256& txid, ChangeType status)> |
Register handler for transaction changed messages.
using interfaces::Wallet::UnloadFn = std::function<void()> |
Register handler for unload message.
using interfaces::Wallet::WatchOnlyChangedFn = std::function<void(bool have_watch_only)> |
Register handler for watchonly changed messages.
|
inlinevirtual |
|
pure virtual |
Abandon transaction.
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Abort a rescan.
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Add dest data.
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Back up wallet.
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Change wallet passphrase.
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Commit bump transaction.
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Create bump transaction.
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Create transaction.
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Encrypt wallet.
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Erase dest data.
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Look up address in wallet, return whether exists.
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Get wallet address list.
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Get available balance.
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Get balance.
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Get balances.
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Return wallet transaction output information.
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Get tx confirm target.
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Return credit amount if transaction input belongs to wallet.
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Return debit amount if transaction input belongs to wallet.
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Get max tx fee.
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Get dest values with prefix.
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Get minimum fee.
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
Get private key.
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Get public key.
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Get required fee.
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Get a transaction.
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Get wallet name.
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
Get transaction information.
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Get transaction details.
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Get list of all wallet transactions.
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Return whether wallet has watch only keys.
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Return whether wallet is encrypted.
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Return whether wallet is locked.
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Return whether coin is locked.
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Return whether wallet has private key.
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Add scripts to key store so old so software versions opening the wallet database can detect payments to newer address types.
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
List locked coins.
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Lock wallet.
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Lock coin.
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Add or update address.
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Sign bump transaction.
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Return whether transaction can be abandoned.
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Return whether transaction can be bumped.
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Get balances if possible without blocking.
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Try to get updated status for a particular transaction, if possible without blocking.
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Return whether transaction input belongs to wallet.
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Return whether transaction output belongs to wallet.
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Unlock wallet.
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.
|
pure virtual |
Unlock coin.
Implemented in interfaces::anonymous_namespace{wallet.cpp}::WalletImpl.