Changeset View
Changeset View
Standalone View
Standalone View
src/interfaces/wallet.h
Show All 33 Lines | |||||
enum class OutputType; | enum class OutputType; | ||||
struct CRecipient; | struct CRecipient; | ||||
struct TxId; | struct TxId; | ||||
namespace interfaces { | namespace interfaces { | ||||
class Handler; | class Handler; | ||||
class PendingWalletTx; | |||||
struct WalletAddress; | struct WalletAddress; | ||||
struct WalletBalances; | struct WalletBalances; | ||||
struct WalletTx; | struct WalletTx; | ||||
struct WalletTxOut; | struct WalletTxOut; | ||||
struct WalletTxStatus; | struct WalletTxStatus; | ||||
using WalletOrderForm = std::vector<std::pair<std::string, std::string>>; | using WalletOrderForm = std::vector<std::pair<std::string, std::string>>; | ||||
using WalletValueMap = std::map<std::string, std::string>; | using WalletValueMap = std::map<std::string, std::string>; | ||||
▲ Show 20 Lines • Show All 95 Lines • ▼ Show 20 Lines | public: | ||||
//! Return whether coin is locked. | //! Return whether coin is locked. | ||||
virtual bool isLockedCoin(const COutPoint &output) = 0; | virtual bool isLockedCoin(const COutPoint &output) = 0; | ||||
//! List locked coins. | //! List locked coins. | ||||
virtual void listLockedCoins(std::vector<COutPoint> &outputs) = 0; | virtual void listLockedCoins(std::vector<COutPoint> &outputs) = 0; | ||||
//! Create transaction. | //! Create transaction. | ||||
virtual std::unique_ptr<PendingWalletTx> | virtual CTransactionRef | ||||
createTransaction(const std::vector<CRecipient> &recipients, | createTransaction(const std::vector<CRecipient> &recipients, | ||||
const CCoinControl &coin_control, bool sign, | const CCoinControl &coin_control, bool sign, | ||||
int &change_pos, Amount &fee, | int &change_pos, Amount &fee, | ||||
std::string &fail_reason) = 0; | std::string &fail_reason) = 0; | ||||
//! Commit transaction. | |||||
virtual bool commitTransaction(CTransactionRef tx, WalletValueMap value_map, | |||||
WalletOrderForm order_form, | |||||
std::string &reject_reason) = 0; | |||||
//! Return whether transaction can be abandoned. | //! Return whether transaction can be abandoned. | ||||
virtual bool transactionCanBeAbandoned(const TxId &txid) = 0; | virtual bool transactionCanBeAbandoned(const TxId &txid) = 0; | ||||
//! Abandon transaction. | //! Abandon transaction. | ||||
virtual bool abandonTransaction(const TxId &txid) = 0; | virtual bool abandonTransaction(const TxId &txid) = 0; | ||||
//! Get a transaction. | //! Get a transaction. | ||||
virtual CTransactionRef getTx(const TxId &txid) = 0; | virtual CTransactionRef getTx(const TxId &txid) = 0; | ||||
▲ Show 20 Lines • Show All 110 Lines • ▼ Show 20 Lines | public: | ||||
handleWatchOnlyChanged(WatchOnlyChangedFn fn) = 0; | handleWatchOnlyChanged(WatchOnlyChangedFn fn) = 0; | ||||
//! Register handler for keypool changed messages. | //! Register handler for keypool changed messages. | ||||
using CanGetAddressesChangedFn = std::function<void()>; | using CanGetAddressesChangedFn = std::function<void()>; | ||||
virtual std::unique_ptr<Handler> | virtual std::unique_ptr<Handler> | ||||
handleCanGetAddressesChanged(CanGetAddressesChangedFn fn) = 0; | handleCanGetAddressesChanged(CanGetAddressesChangedFn fn) = 0; | ||||
}; | }; | ||||
//! Tracking object returned by CreateTransaction and passed to | |||||
//! CommitTransaction. | |||||
class PendingWalletTx { | |||||
public: | |||||
virtual ~PendingWalletTx() {} | |||||
//! Get transaction data. | |||||
virtual const CTransaction &get() = 0; | |||||
//! Send pending transaction and commit to wallet. | |||||
virtual bool commit(WalletValueMap value_map, WalletOrderForm order_form, | |||||
std::string &reject_reason) = 0; | |||||
}; | |||||
//! Information about one wallet address. | //! Information about one wallet address. | ||||
struct WalletAddress { | struct WalletAddress { | ||||
CTxDestination dest; | CTxDestination dest; | ||||
isminetype is_mine; | isminetype is_mine; | ||||
std::string name; | std::string name; | ||||
std::string purpose; | std::string purpose; | ||||
WalletAddress(CTxDestination destIn, isminetype isMineIn, | WalletAddress(CTxDestination destIn, isminetype isMineIn, | ||||
▲ Show 20 Lines • Show All 70 Lines • Show Last 20 Lines |