diff options
author | Ilya Kitaev <mbg033@gmail.com> | 2016-04-19 12:25:03 +0300 |
---|---|---|
committer | Ilya Kitaev <mbg033@gmail.com> | 2016-04-19 12:25:03 +0300 |
commit | 4e1c2dc365f58817e371ac9f86de079ae096adce (patch) | |
tree | 61fc6f1bb32c23e179851e4f9f20747376a17a8b /src/wallet/wallet2_api.h | |
parent | TODOs for Transaction/Transfer interface (diff) | |
download | monero-4e1c2dc365f58817e371ac9f86de079ae096adce.tar.xz |
TransactionInfo / TransactionHistory APIs design
Diffstat (limited to '')
-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; }; /** |