diff options
author | Ilya Kitaev <mbg033@gmail.com> | 2016-04-19 12:25:03 +0300 |
---|---|---|
committer | Ilya Kitaev <mbg033@gmail.com> | 2016-06-23 15:50:17 +0300 |
commit | 60508e6baecf8c64b4bbd90516ac03f65308a267 (patch) | |
tree | 2bef8af5e3fc314d0be9e57cd8eb777850dd445e /src/wallet/wallet2_api.h | |
parent | Wallet::createTransaction API introduced (diff) | |
download | monero-60508e6baecf8c64b4bbd90516ac03f65308a267.tar.xz |
TransactionInfo / TransactionHistory APIs design
Diffstat (limited to 'src/wallet/wallet2_api.h')
-rw-r--r-- | src/wallet/wallet2_api.h | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/src/wallet/wallet2_api.h b/src/wallet/wallet2_api.h index 56a91bfbb..a675d8b31 100644 --- a/src/wallet/wallet2_api.h +++ b/src/wallet/wallet2_api.h @@ -32,12 +32,13 @@ #include <string> +#include <vector> // Public interface for libwallet library namespace Bitmonero { /** - * @brief Transaction interface + * @brief Transaction-like interface for sending money */ struct PendingTransaction { @@ -54,6 +55,35 @@ struct PendingTransaction virtual uint64_t fee() const = 0; }; +struct TransactionInfo; +struct TransactionHistory +{ + virtual int count() const; + virtual TransactionInfo * transaction(int index) const = 0; + virtual TransactionInfo * transaction(const std::string &id) const = 0; + virtual std::vector<TransactionInfo*> getAll() const = 0; +}; + + +/** + * @brief The TransactionInfo - interface for displaying transaction information + */ +struct TransactionInfo +{ + enum Direction { + Direction_In, + Direction_Out + }; + + virtual bool isHold() const = 0; + virtual bool isFailed() const = 0; + virtual uint64_t amount() const = 0; + virtual uint64_t fee() const = 0; + virtual std::string address() const = 0; + virtual int direction() const = 0; + // TODO +}; + /** * @brief Interface for wallet operations. * TODO: check if /include/IWallet.h is still actual @@ -66,12 +96,11 @@ struct Wallet Status_Error }; - virtual ~Wallet() = 0; virtual std::string seed() const = 0; virtual std::string getSeedLanguage() const = 0; virtual void setSeedLanguage(const std::string &arg) = 0; - virtual void setListener(Listener * listener) = 0; + // virtual void setListener(Listener * listener) = 0; //! returns wallet status (Status_Ok | Status_Error) virtual int status() const = 0; //! in case error status, returns error string @@ -89,10 +118,7 @@ struct Wallet virtual bool refresh() = 0; virtual PendingTransaction * createTransaction(const std::string &dst_addr, uint64_t amount) = 0; virtual void disposeTransaction(PendingTransaction * t) = 0; - // TODO - virtual void getPayments() const; - - + virtual TransactionHistory * history() const = 0; }; /** |