From 9564393f9582e37ade4c3b120883fb07381695be Mon Sep 17 00:00:00 2001 From: woodser Date: Tue, 4 Jun 2019 12:06:57 -0400 Subject: [PATCH] defined MoneroOutputWallet; MoneroUtils::deserialize() takes param to deserialize to --- src/utils/MoneroUtils.cpp | 20 ++++++++++++++------ src/utils/MoneroUtils.h | 10 +++++++--- src/wallet/MoneroWallet.h | 12 ++++++++++++ 3 files changed, 33 insertions(+), 9 deletions(-) diff --git a/src/utils/MoneroUtils.cpp b/src/utils/MoneroUtils.cpp index 1a498d5..48c4c6c 100644 --- a/src/utils/MoneroUtils.cpp +++ b/src/utils/MoneroUtils.cpp @@ -86,14 +86,22 @@ string MoneroUtils::serialize(const MoneroBlock& block) { throw runtime_error("serialize(block) not implemented"); } -MoneroTx MoneroUtils::deserializeTx(const string& txStr) { +void MoneroUtils::deserializeTx(const string& txStr, MoneroTx& tx) { + throw runtime_error("deserializeTx(txStr) not implemented"); +} + +void MoneroUtils::deserializeTxWallet(const string& txStr, MoneroTxWallet& tx) { throw runtime_error("deserializeTxWallet(txStr) not implemented"); } -MoneroTxWallet MoneroUtils::deserializeTxWallet(const string& txStr) { - throw runtime_error("deserializeTxWallet(txStr) not implemented"); -} - -MoneroTxRequest MoneroUtils::deserializeTxRequest(const string& txRequestStr) { +void MoneroUtils::deserializeTxRequest(const string& txRequestStr, MoneroTxRequest& request) { throw runtime_error("deserializeTxRequest(txRequestStr) not implemented"); } + +void MoneroUtils::deserializeOutput(const string& outputStr, MoneroOutput& output) { + throw runtime_error("deserializeOutput(outputStr) not implemented"); +} + +void MoneroUtils::deserializeOutputWallet(const string& outputStr, MoneroOutputWallet& output) { + throw runtime_error("deserializeOutputWallet(outputStr) not implemented"); +} diff --git a/src/utils/MoneroUtils.h b/src/utils/MoneroUtils.h index 5f80fdb..42faedd 100644 --- a/src/utils/MoneroUtils.h +++ b/src/utils/MoneroUtils.h @@ -33,11 +33,15 @@ namespace MoneroUtils string serialize(const MoneroBlock& block); - MoneroTx deserializeTx(const string& txStr); + void deserializeTx(const string& txStr, MoneroTx& tx); - MoneroTxWallet deserializeTxWallet(const string& txStr); + void deserializeTxWallet(const string& txStr, MoneroTxWallet& tx); - MoneroTxRequest deserializeTxRequest(const string& txRequestStr); + void deserializeTxRequest(const string& txRequestStr, MoneroTxRequest& request); + + void deserializeOutput(const string& outputStr, MoneroOutput& output); + + void deserializeOutputWallet(const string& outputStr, MoneroOutputWallet& output); /** * Modified from core_rpc_server.cpp to return a string. diff --git a/src/wallet/MoneroWallet.h b/src/wallet/MoneroWallet.h index e89f429..c120fc6 100644 --- a/src/wallet/MoneroWallet.h +++ b/src/wallet/MoneroWallet.h @@ -90,10 +90,22 @@ namespace monero { vector destinations; }; + /** + * Models a Monero output with wallet extensions. + */ + struct MoneroOutputWallet : public MoneroOutput { + shared_ptr accountIndex; + shared_ptr subaddressIndex; + shared_ptr isSpent; + shared_ptr isUnlocked; + shared_ptr isFrozen; + }; + /** * Models a Monero transaction in the context of a wallet. */ struct MoneroTxWallet : public MoneroTx { + vector vouts; // TODO: override vouts with different type? vector incomingTransfers; shared_ptr outgoingTransfer; shared_ptr numSuggestedConfirmations;