From bc7e97563c11c22132336fd8765dc598ef17c4e7 Mon Sep 17 00:00:00 2001 From: woodser Date: Thu, 28 Nov 2019 12:53:19 -0500 Subject: [PATCH] add get_address_book_entries() stack w/o impl --- src/wallet/monero_wallet.cpp | 4 ++++ src/wallet/monero_wallet.h | 16 ++++++++-------- src/wallet/monero_wallet_model.cpp | 11 +++++++++++ src/wallet/monero_wallet_model.h | 12 ++++++++++++ 4 files changed, 35 insertions(+), 8 deletions(-) diff --git a/src/wallet/monero_wallet.cpp b/src/wallet/monero_wallet.cpp index 161f2b9..005025f 100644 --- a/src/wallet/monero_wallet.cpp +++ b/src/wallet/monero_wallet.cpp @@ -2790,6 +2790,10 @@ namespace monero { } } + vector monero_wallet::get_address_book_entries(const vector& indices) const { + throw runtime_error("get_address_book_entries() not implemented"); + } + string monero_wallet::create_payment_uri(const monero_send_request& request) const { MTRACE("create_payment_uri()"); diff --git a/src/wallet/monero_wallet.h b/src/wallet/monero_wallet.h index 2ac63d5..3932bdc 100644 --- a/src/wallet/monero_wallet.h +++ b/src/wallet/monero_wallet.h @@ -1167,14 +1167,14 @@ namespace monero { */ void set_tx_notes(const vector& tx_ids, const vector& notes); -// /** -// * Get all address book entries. -// * -// * @param indices are indices of the entries to get -// * @return the address book entries -// */ -// vector get_address_book_entries(const vector& indices) const; -// + /** + * Get all address book entries. + * + * @param indices are indices of the entries to get + * @return the address book entries + */ + vector get_address_book_entries(const vector& indices) const; + // /** // * Add an address book entry. // * diff --git a/src/wallet/monero_wallet_model.cpp b/src/wallet/monero_wallet_model.cpp index fce2261..e61c636 100644 --- a/src/wallet/monero_wallet_model.cpp +++ b/src/wallet/monero_wallet_model.cpp @@ -795,4 +795,15 @@ namespace monero { if (!m_tx_ids.empty()) node.add_child("txIds", monero_utils::to_property_tree(m_tx_ids)); return node; } + + // -------------------------- MONERO ADDRESS BOOK --------------------------- + + boost::property_tree::ptree monero_address_book_entry::to_property_tree() const { + boost::property_tree::ptree node; + if (m_index != boost::none) node.put("index", *m_index); + if (m_address != boost::none) node.put("address", *m_address); + if (m_description != boost::none) node.put("description", *m_description); + if (m_payment_id != boost::none) node.put("paymentId", *m_payment_id); + return node; + } } diff --git a/src/wallet/monero_wallet_model.h b/src/wallet/monero_wallet_model.h index 5169a63..b14bb79 100644 --- a/src/wallet/monero_wallet_model.h +++ b/src/wallet/monero_wallet_model.h @@ -443,4 +443,16 @@ namespace monero { boost::property_tree::ptree to_property_tree() const; }; + + /** + * Monero address book entry model. + */ + struct monero_address_book_entry : serializable_struct { + boost::optional m_index; + boost::optional m_address; + boost::optional m_description; + boost::optional m_payment_id; + + boost::property_tree::ptree to_property_tree() const; + }; }