From 813847949d1e900caf39397f5cdf896400c7d91e Mon Sep 17 00:00:00 2001 From: woodser Date: Thu, 2 Dec 2021 09:28:27 -0500 Subject: [PATCH] update docs --- docs/monero__utils_8h_source.html | 191 +++++++++++++++--------------- docs/namespacemonero__utils.html | 3 + 2 files changed, 98 insertions(+), 96 deletions(-) diff --git a/docs/monero__utils_8h_source.html b/docs/monero__utils_8h_source.html index 711a81d7..10ff4bfd 100644 --- a/docs/monero__utils_8h_source.html +++ b/docs/monero__utils_8h_source.html @@ -84,115 +84,114 @@
67 {
68  using namespace cryptonote;
69 
-
70  // ------------------------ CONSTANTS ---------------------------
+
70  // ------------------------------ CONSTANTS ---------------------------------
71 
72  static const int RING_SIZE = 12; // network-enforced ring size
73 
-
74  // -------------------------- VALIDATION UTILS ------------------------------
+
74  // -------------------------------- UTILS -----------------------------------
75 
-
76  bool is_valid_address(const std::string& address, monero_network_type network_type);
-
77  bool is_valid_private_view_key(const std::string& private_view_key);
-
78  bool is_valid_private_spend_key(const std::string& private_spend_key);
-
79  void validate_address(const std::string& address, monero_network_type network_type);
-
80  void validate_private_view_key(const std::string& private_view_key);
-
81  void validate_private_spend_key(const std::string& private_spend_key);
-
82 
-
83  // ------------------------ BINARY SERIALIZATION ----------------------------
-
84 
-
85  void json_to_binary(const std::string &json, std::string &bin);
-
86  void binary_to_json(const std::string &bin, std::string &json);
-
87  void binary_blocks_to_json(const std::string &bin, std::string &json);
+
76  monero_integrated_address get_integrated_address(monero_network_type network_type, const std::string& standard_address, const std::string& payment_id);
+
77  bool is_valid_address(const std::string& address, monero_network_type network_type);
+
78  bool is_valid_private_view_key(const std::string& private_view_key);
+
79  bool is_valid_private_spend_key(const std::string& private_spend_key);
+
80  void validate_address(const std::string& address, monero_network_type network_type);
+
81  void validate_private_view_key(const std::string& private_view_key);
+
82  void validate_private_spend_key(const std::string& private_spend_key);
+
83  void json_to_binary(const std::string &json, std::string &bin);
+
84  void binary_to_json(const std::string &bin, std::string &json);
+
85  void binary_blocks_to_json(const std::string &bin, std::string &json);
+
86 
+
87  // ------------------------------ RAPIDJSON ---------------------------------
88 
-
89  // ------------------------------ RAPIDJSON ---------------------------------
+
89  std::string serialize(const rapidjson::Document& doc);
90 
-
91  std::string serialize(const rapidjson::Document& doc);
-
92 
-
98  template <class T>
-
99  void add_json_member(std::string key, T val, rapidjson::Document::AllocatorType& allocator, rapidjson::Value& root, rapidjson::Value& field) {
-
100  rapidjson::Value field_key(key.c_str(), key.size(), allocator);
-
101  field.SetInt64((uint64_t) val);
-
102  root.AddMember(field_key, field, allocator);
-
103  }
-
104  void add_json_member(std::string key, std::string val, rapidjson::Document::AllocatorType& allocator, rapidjson::Value& root, rapidjson::Value& field);
-
105  void add_json_member(std::string key, bool val, rapidjson::Document::AllocatorType& allocator, rapidjson::Value& root);
-
106 
-
107  // TODO: template implementation here, could move to monero_utils.hpp per https://stackoverflow.com/questions/3040480/c-template-function-compiles-in-header-but-not-implementation
-
108  template <class T> rapidjson::Value to_rapidjson_val(rapidjson::Document::AllocatorType& allocator, const std::vector<std::shared_ptr<T>>& vals) {
-
109  rapidjson::Value value_arr(rapidjson::kArrayType);
-
110  for (const auto& val : vals) {
-
111  value_arr.PushBack(val->to_rapidjson_val(allocator), allocator);
-
112  }
-
113  return value_arr;
-
114  }
-
115 
-
116  // TODO: template implementation here, could move to monero_utils.hpp per https://stackoverflow.com/questions/3040480/c-template-function-compiles-in-header-but-not-implementation
-
117  template <class T> rapidjson::Value to_rapidjson_val(rapidjson::Document::AllocatorType& allocator, const std::vector<T>& vals) {
-
118  rapidjson::Value value_arr(rapidjson::kArrayType);
-
119  for (const auto& val : vals) {
-
120  value_arr.PushBack(val.to_rapidjson_val(allocator), allocator);
-
121  }
-
122  return value_arr;
-
123  }
-
124 
-
125  rapidjson::Value to_rapidjson_val(rapidjson::Document::AllocatorType& allocator, const std::vector<std::string>& strs);
-
126  rapidjson::Value to_rapidjson_val(rapidjson::Document::AllocatorType& allocator, const std::vector<uint8_t>& nums);
-
127  rapidjson::Value to_rapidjson_val(rapidjson::Document::AllocatorType& allocator, const std::vector<uint32_t>& nums);
-
128  rapidjson::Value to_rapidjson_val(rapidjson::Document::AllocatorType& allocator, const std::vector<uint64_t>& nums);
+
96  template <class T>
+
97  void add_json_member(std::string key, T val, rapidjson::Document::AllocatorType& allocator, rapidjson::Value& root, rapidjson::Value& field) {
+
98  rapidjson::Value field_key(key.c_str(), key.size(), allocator);
+
99  field.SetInt64((uint64_t) val);
+
100  root.AddMember(field_key, field, allocator);
+
101  }
+
102  void add_json_member(std::string key, std::string val, rapidjson::Document::AllocatorType& allocator, rapidjson::Value& root, rapidjson::Value& field);
+
103  void add_json_member(std::string key, bool val, rapidjson::Document::AllocatorType& allocator, rapidjson::Value& root);
+
104 
+
105  // TODO: template implementation here, could move to monero_utils.hpp per https://stackoverflow.com/questions/3040480/c-template-function-compiles-in-header-but-not-implementation
+
106  template <class T> rapidjson::Value to_rapidjson_val(rapidjson::Document::AllocatorType& allocator, const std::vector<std::shared_ptr<T>>& vals) {
+
107  rapidjson::Value value_arr(rapidjson::kArrayType);
+
108  for (const auto& val : vals) {
+
109  value_arr.PushBack(val->to_rapidjson_val(allocator), allocator);
+
110  }
+
111  return value_arr;
+
112  }
+
113 
+
114  // TODO: template implementation here, could move to monero_utils.hpp per https://stackoverflow.com/questions/3040480/c-template-function-compiles-in-header-but-not-implementation
+
115  template <class T> rapidjson::Value to_rapidjson_val(rapidjson::Document::AllocatorType& allocator, const std::vector<T>& vals) {
+
116  rapidjson::Value value_arr(rapidjson::kArrayType);
+
117  for (const auto& val : vals) {
+
118  value_arr.PushBack(val.to_rapidjson_val(allocator), allocator);
+
119  }
+
120  return value_arr;
+
121  }
+
122 
+
123  rapidjson::Value to_rapidjson_val(rapidjson::Document::AllocatorType& allocator, const std::vector<std::string>& strs);
+
124  rapidjson::Value to_rapidjson_val(rapidjson::Document::AllocatorType& allocator, const std::vector<uint8_t>& nums);
+
125  rapidjson::Value to_rapidjson_val(rapidjson::Document::AllocatorType& allocator, const std::vector<uint32_t>& nums);
+
126  rapidjson::Value to_rapidjson_val(rapidjson::Document::AllocatorType& allocator, const std::vector<uint64_t>& nums);
+
127 
+
128  // ------------------------ PROPERTY TREES ---------------------------
129 
-
130  // ------------------------ PROPERTY TREES ---------------------------
+
130  // TODO: fully switch from property trees to rapidjson
131 
-
132  // TODO: fully switch from property trees to rapidjson
-
133 
-
134  std::string serialize(const boost::property_tree::ptree& node);
-
135  void deserialize(const std::string& json, boost::property_tree::ptree& root);
+
132  std::string serialize(const boost::property_tree::ptree& node);
+
133  void deserialize(const std::string& json, boost::property_tree::ptree& root);
+
134 
+
135  // --------------------------------------------------------------------------
136 
-
137  // --------------------------------------------------------------------------
-
138 
-
145  bool is_valid_language(const std::string& language);
-
146 
-
153  std::shared_ptr<monero_block> cn_block_to_block(const cryptonote::block& cn_block);
-
154 
-
162  std::shared_ptr<monero_tx> cn_tx_to_tx(const cryptonote::transaction& cn_tx, bool init_as_tx_wallet = false);
-
163 
-
169  static std::string get_pruned_tx_json(cryptonote::transaction &tx)
-
170  {
-
171  std::stringstream ss;
-
172  json_archive<true> ar(ss);
-
173  bool r = tx.serialize_base(ar);
-
174  CHECK_AND_ASSERT_MES(r, std::string(), "Failed to serialize rct signatures base");
-
175  return ss.str();
-
176  }
-
177 
-
183  static void free(std::shared_ptr<monero_block> block) {
-
184  for (std::shared_ptr<monero_tx>& tx : block->m_txs) {
-
185  tx->m_block.reset();
-
186  monero_tx_wallet* tx_wallet = dynamic_cast<monero_tx_wallet*>(tx.get());
-
187  if (tx_wallet != nullptr) {
-
188  if (tx_wallet->m_outgoing_transfer != boost::none) tx_wallet->m_outgoing_transfer.get()->m_tx.reset();
-
189  for (std::shared_ptr<monero_transfer> transfer : tx_wallet->m_incoming_transfers) transfer->m_tx.reset();
-
190  for (std::shared_ptr<monero_output> output : tx_wallet->m_outputs) output->m_tx.reset();
-
191  for (std::shared_ptr<monero_output> input : tx_wallet->m_inputs) {
-
192  input->m_key_image.reset();
-
193  input->m_tx.reset();
-
194  }
-
195  }
-
196  }
-
197  block.reset();
-
198  }
-
199 
-
205  static void free(std::vector<std::shared_ptr<monero_block>> blocks) {
-
206  for (std::shared_ptr<monero_block>& block : blocks) monero_utils::free(block);
-
207  }
-
208 }
-
209 #endif /* monero_utils_h */
+
143  bool is_valid_language(const std::string& language);
+
144 
+
151  std::shared_ptr<monero_block> cn_block_to_block(const cryptonote::block& cn_block);
+
152 
+
160  std::shared_ptr<monero_tx> cn_tx_to_tx(const cryptonote::transaction& cn_tx, bool init_as_tx_wallet = false);
+
161 
+
167  static std::string get_pruned_tx_json(cryptonote::transaction &tx)
+
168  {
+
169  std::stringstream ss;
+
170  json_archive<true> ar(ss);
+
171  bool r = tx.serialize_base(ar);
+
172  CHECK_AND_ASSERT_MES(r, std::string(), "Failed to serialize rct signatures base");
+
173  return ss.str();
+
174  }
+
175 
+
181  static void free(std::shared_ptr<monero_block> block) {
+
182  for (std::shared_ptr<monero_tx>& tx : block->m_txs) {
+
183  tx->m_block.reset();
+
184  monero_tx_wallet* tx_wallet = dynamic_cast<monero_tx_wallet*>(tx.get());
+
185  if (tx_wallet != nullptr) {
+
186  if (tx_wallet->m_outgoing_transfer != boost::none) tx_wallet->m_outgoing_transfer.get()->m_tx.reset();
+
187  for (std::shared_ptr<monero_transfer> transfer : tx_wallet->m_incoming_transfers) transfer->m_tx.reset();
+
188  for (std::shared_ptr<monero_output> output : tx_wallet->m_outputs) output->m_tx.reset();
+
189  for (std::shared_ptr<monero_output> input : tx_wallet->m_inputs) {
+
190  input->m_key_image.reset();
+
191  input->m_tx.reset();
+
192  }
+
193  }
+
194  }
+
195  block.reset();
+
196  }
+
197 
+
203  static void free(std::vector<std::shared_ptr<monero_block>> blocks) {
+
204  for (std::shared_ptr<monero_block>& block : blocks) monero_utils::free(block);
+
205  }
+
206 }
+
207 #endif /* monero_utils_h */
-
bool is_valid_language(const std::string &language)
Definition: monero_utils.cpp:267
-
std::shared_ptr< monero_tx > cn_tx_to_tx(const cryptonote::transaction &cn_tx, bool init_as_tx_wallet=false)
Definition: monero_utils.cpp:296
+
bool is_valid_language(const std::string &language)
Definition: monero_utils.cpp:292
+
std::shared_ptr< monero_tx > cn_tx_to_tx(const cryptonote::transaction &cn_tx, bool init_as_tx_wallet=false)
Definition: monero_utils.cpp:321
Definition: monero_wallet_model.h:244
monero_network_type
Definition: monero_daemon_model.h:90
+
Definition: monero_wallet_model.h:323
Definition: monero_utils.h:67
-
void add_json_member(std::string key, T val, rapidjson::Document::AllocatorType &allocator, rapidjson::Value &root, rapidjson::Value &field)
Definition: monero_utils.h:99
-
std::shared_ptr< monero_block > cn_block_to_block(const cryptonote::block &cn_block)
Definition: monero_utils.cpp:280
+
void add_json_member(std::string key, T val, rapidjson::Document::AllocatorType &allocator, rapidjson::Value &root, rapidjson::Value &field)
Definition: monero_utils.h:97
+
std::shared_ptr< monero_block > cn_block_to_block(const cryptonote::block &cn_block)
Definition: monero_utils.cpp:305