diff options
Diffstat (limited to 'src/wallet/wallet2_api.h')
-rw-r--r-- | src/wallet/wallet2_api.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/wallet/wallet2_api.h b/src/wallet/wallet2_api.h index 60907b436..86a24fa59 100644 --- a/src/wallet/wallet2_api.h +++ b/src/wallet/wallet2_api.h @@ -34,6 +34,7 @@ #include <string> #include <vector> #include <ctime> +#include <iostream> // Public interface for libwallet library namespace Bitmonero { @@ -130,6 +131,50 @@ struct TransactionHistory virtual void refresh() = 0; }; +/** + * @brief AddressBookRow - provides functions to manage address book + */ +struct AddressBookRow { +public: + AddressBookRow(int _rowId, const std::string &_address, const std::string &_paymentId, const std::string &_description): + m_rowId(_rowId), + m_address(_address), + m_paymentId(_paymentId), + m_description(_description) {} + +private: + int m_rowId; + std::string m_address; + std::string m_paymentId; + std::string m_description; +public: + std::string extra; + std::string getAddress() const {return m_address;} + std::string getDescription() const {return m_description;} + std::string getPaymentId() const {return m_paymentId;} + int getRowId() const {return m_rowId;} +}; + +/** + * @brief The AddressBook - interface for +Book + */ +struct AddressBook +{ + enum ErrorCode { + Status_Ok, + General_Error, + Invalid_Address, + Invalid_Payment_Id + }; + virtual ~AddressBook() = 0; + virtual std::vector<AddressBookRow*> getAll() const = 0; + virtual bool addRow(const std::string &dst_addr , const std::string &payment_id, const std::string &description) = 0; + virtual bool deleteRow(int rowId) = 0; + virtual void refresh() = 0; + virtual std::string errorString() const = 0; + virtual int errorCode() const = 0; +}; struct WalletListener { @@ -370,6 +415,7 @@ struct Wallet */ virtual void disposeTransaction(PendingTransaction * t) = 0; virtual TransactionHistory * history() const = 0; + virtual AddressBook * addressBook() const = 0; virtual void setListener(WalletListener *) = 0; /*! * \brief defaultMixin - returns number of mixins used in transactions |