mirror of
https://github.com/wownero/wownero-cpp.git
synced 2026-10-17 23:31:32 +02:00
defined tx/WalletToPropertyTree() to re-serialize given tx request
This commit is contained in:
@@ -145,3 +145,36 @@ boost::property_tree::ptree MoneroUtils::toPropertyTree(const MoneroSubaddress&
|
||||
if (subaddress.numBlocksToUnlock != nullptr) subaddressNode.put("numBlocksToUnlock", *subaddress.numBlocksToUnlock);
|
||||
return subaddressNode;
|
||||
}
|
||||
|
||||
// blockToPropertyTree
|
||||
|
||||
boost::property_tree::ptree MoneroUtils::txToPropertyTree(const MoneroTx& tx) {
|
||||
cout << "txToPropertyTree(tx)" << endl;
|
||||
boost::property_tree::ptree txNode;
|
||||
if (tx.id != nullptr) txNode.put("id", *tx.id);
|
||||
// if (subaddress.accountIndex != nullptr) subaddressNode.put("accountIndex", *subaddress.accountIndex);
|
||||
// if (subaddress.index != nullptr) subaddressNode.put("index", *subaddress.index);
|
||||
// if (subaddress.address != nullptr) subaddressNode.put("address", *subaddress.address);
|
||||
// if (subaddress.label != nullptr) subaddressNode.put("label", *subaddress.label);
|
||||
// if (subaddress.balance != nullptr) subaddressNode.put("balance", *subaddress.balance);
|
||||
// if (subaddress.unlockedBalance != nullptr) subaddressNode.put("unlockedBalance", *subaddress.unlockedBalance);
|
||||
// if (subaddress.numUnspentOutputs != nullptr) subaddressNode.put("numUnspentOutputs", *subaddress.numUnspentOutputs);
|
||||
// if (subaddress.isUsed != nullptr) subaddressNode.put("isUsed", *subaddress.isUsed);
|
||||
// if (subaddress.numBlocksToUnlock != nullptr) subaddressNode.put("numBlocksToUnlock", *subaddress.numBlocksToUnlock);
|
||||
return txNode;
|
||||
}
|
||||
|
||||
boost::property_tree::ptree MoneroUtils::txWalletToPropertyTree(const MoneroTxWallet& tx) {
|
||||
cout << "txWalletToPropertyTree(tx)" << endl;
|
||||
boost::property_tree::ptree txNode = txToPropertyTree(tx);
|
||||
// if (subaddress.accountIndex != nullptr) subaddressNode.put("accountIndex", *subaddress.accountIndex);
|
||||
// if (subaddress.index != nullptr) subaddressNode.put("index", *subaddress.index);
|
||||
// if (subaddress.address != nullptr) subaddressNode.put("address", *subaddress.address);
|
||||
// if (subaddress.label != nullptr) subaddressNode.put("label", *subaddress.label);
|
||||
// if (subaddress.balance != nullptr) subaddressNode.put("balance", *subaddress.balance);
|
||||
// if (subaddress.unlockedBalance != nullptr) subaddressNode.put("unlockedBalance", *subaddress.unlockedBalance);
|
||||
// if (subaddress.numUnspentOutputs != nullptr) subaddressNode.put("numUnspentOutputs", *subaddress.numUnspentOutputs);
|
||||
// if (subaddress.isUsed != nullptr) subaddressNode.put("isUsed", *subaddress.isUsed);
|
||||
// if (subaddress.numBlocksToUnlock != nullptr) subaddressNode.put("numBlocksToUnlock", *subaddress.numBlocksToUnlock);
|
||||
return txNode;
|
||||
}
|
||||
|
||||
@@ -66,6 +66,10 @@ namespace MoneroUtils
|
||||
|
||||
boost::property_tree::ptree toPropertyTree(const MoneroSubaddress& subaddress);
|
||||
|
||||
boost::property_tree::ptree txToPropertyTree(const MoneroTx& tx);
|
||||
|
||||
boost::property_tree::ptree txWalletToPropertyTree(const MoneroTxWallet& tx);
|
||||
|
||||
// // TODO: template implementation here, could move to MoneroUtils.hpp per https://stackoverflow.com/questions/3040480/c-template-function-compiles-in-header-but-not-implementation
|
||||
template <class T> boost::property_tree::ptree toPropertyTree(const vector<T> types) {
|
||||
cout << "toPropertyTree(types)" << endl;
|
||||
|
||||
Reference in New Issue
Block a user