diff --git a/src/daemon/MoneroDaemonModel.cpp b/src/daemon/MoneroDaemonModel.cpp index 205361b..13e3c37 100644 --- a/src/daemon/MoneroDaemonModel.cpp +++ b/src/daemon/MoneroDaemonModel.cpp @@ -280,13 +280,31 @@ namespace monero { } } + // --------------------------- MONERO KEY IMAGE ----------------------------- + + boost::property_tree::ptree MoneroKeyImage::toPropertyTree() const { + //cout << "MoneroKeyImage::toPropertyTree(tx)" << endl; + boost::property_tree::ptree node; + if (hex != boost::none) node.put("hex", *hex); + if (signature != boost::none) node.put("signature", *signature); + return node; + } + + void MoneroKeyImage::merge(const shared_ptr& self, const shared_ptr& other) { + cout << "MoneroKeyImage::merge()" << endl; + throw runtime_error("Not implemented"); + } + // ------------------------------ MONERO OUTPUT ----------------------------- boost::property_tree::ptree MoneroOutput::toPropertyTree() const { - //cout << "MoneroOutput::txToPropertyTree(tx)" << endl; + //cout << "MoneroOutput::toPropertyTree(tx)" << endl; boost::property_tree::ptree node; - //if (id != boost::none) node.put("id", *id); TODO - throw runtime_error("MoneroOutput toPropertyTree() not implemented"); + if (keyImage != boost::none) node.add_child("keyImage", (*keyImage)->toPropertyTree()); + if (amount != boost::none) node.put("amount", *amount); + if (index != boost::none) node.put("index", *index); + if (!ringOutputIndices.empty()) throw runtime_error("MoneroOutput::toPropertyTree() ringOutputIndices not implemented"); + if (stealthPublicKey != boost::none) node.put("stealthPublicKey", *stealthPublicKey); return node; } @@ -294,11 +312,4 @@ namespace monero { cout << "MoneroOutput::merge()" << endl; throw runtime_error("Not implemented"); } - - // --------------------------- MONERO KEY IMAGE ----------------------------- - - void MoneroKeyImage::merge(const shared_ptr& self, const shared_ptr& other) { - cout << "MoneroKeyImage::merge()" << endl; - throw runtime_error("Not implemented"); - } } diff --git a/src/daemon/MoneroDaemonModel.h b/src/daemon/MoneroDaemonModel.h index f6c5162..45ef3cd 100644 --- a/src/daemon/MoneroDaemonModel.h +++ b/src/daemon/MoneroDaemonModel.h @@ -150,10 +150,11 @@ namespace monero { /** * Models a Monero key image. */ - struct MoneroKeyImage { + struct MoneroKeyImage : public SerializableStruct { boost::optional hex; boost::optional signature; + boost::property_tree::ptree toPropertyTree() const; void merge(const shared_ptr& self, const shared_ptr& other); };