re-order get/set tx notes;

re-order getOutputsHex() with other getOutputs() methods
grouped getMnemonic(), getLanguage(), getLanguages() and updated model
This commit is contained in:
woodser
2019-07-06 17:51:12 -04:00
parent c7af9074d2
commit 062e32d848
2 changed files with 60 additions and 58 deletions
+23 -23
View File
@@ -1473,6 +1473,22 @@ namespace monero {
return vouts;
}
string MoneroWallet::getOutputsHex() const {
return epee::string_tools::buff_to_hex_nodelimer(wallet2->export_outputs_to_str(true));
}
int MoneroWallet::importOutputsHex(const string& outputsHex) {
// validate and parse hex data
cryptonote::blobdata blob;
if (!epee::string_tools::parse_hexstr_to_binbuff(outputsHex, blob)) {
throw runtime_error("Failed to parse hex.");
}
// import hex and return result
return wallet2->import_outputs_from_str(blob);
}
vector<shared_ptr<MoneroKeyImage>> MoneroWallet::getKeyImages() const {
cout << "MoneroWallet::getKeyImages()" << endl;
@@ -1867,6 +1883,13 @@ namespace monero {
return wallet2->get_tx_note(txHash);
}
vector<string> MoneroWallet::getTxNotes(const vector<string>& txIds) const {
cout << "MoneroWallet::getTxNotes()" << endl;
vector<string> txNotes;
for (const auto& txId : txIds) txNotes.push_back(getTxNote(txId));
return txNotes;
}
void MoneroWallet::setTxNote(const string& txId, const string& note) {
cout << "MoneroWallet::setTxNote" << endl;
cryptonote::blobdata txBlob;
@@ -1877,13 +1900,6 @@ namespace monero {
wallet2->set_tx_note(txHash, note);
}
vector<string> MoneroWallet::getTxNotes(const vector<string>& txIds) const {
cout << "MoneroWallet::getTxNotes()" << endl;
vector<string> txNotes;
for (const auto& txId : txIds) txNotes.push_back(getTxNote(txId));
return txNotes;
}
void MoneroWallet::setTxNotes(const vector<string>& txIds, const vector<string>& txNotes) {
cout << "MoneroWallet::setTxNotes()" << endl;
if (txIds.size() != txNotes.size()) throw runtime_error("Different amount of txids and notes");
@@ -2153,22 +2169,6 @@ namespace monero {
return sendRequest;
}
string MoneroWallet::getOutputsHex() const {
return epee::string_tools::buff_to_hex_nodelimer(wallet2->export_outputs_to_str(true));
}
int MoneroWallet::importOutputsHex(const string& outputsHex) {
// validate and parse hex data
cryptonote::blobdata blob;
if (!epee::string_tools::parse_hexstr_to_binbuff(outputsHex, blob)) {
throw runtime_error("Failed to parse hex.");
}
// import hex and return result
return wallet2->import_outputs_from_str(blob);
}
void MoneroWallet::setAttribute(const string& key, const string& val) {
wallet2->set_attribute(key, val);
}
+37 -35
View File
@@ -251,6 +251,20 @@ namespace monero {
*/
string getMnemonic() const;
/**
* Get the language of the wallet's mnemonic phrase.
*
* @return the language of the wallet's mnemonic phrase
*/
string getLanguage() const;
/**
* Get a list of available languages for the wallet's mnemonic phrase.
*
* @return the available languages for the wallet's mnemonic phrase
*/
vector<string> getLanguages() const;
/**
* Get the wallet's public view key.
*
@@ -279,18 +293,6 @@ namespace monero {
*/
string getPrivateSpendKey() const;
/**
* TODO
*/
string getLanguage() const;
/**
* Get a list of available languages for the wallet's seed.
*
* @return the available languages for the wallet's seed
*/
vector<string> getLanguages() const;
/**
* Get the wallet's primary address.
*
@@ -648,6 +650,21 @@ namespace monero {
*/
vector<shared_ptr<MoneroOutputWallet>> getOutputs(const MoneroOutputRequest& request) const;
/**
* Export all outputs in hex format.
*
* @return all outputs in hex format, empty string if no outputs
*/
string getOutputsHex() const;
/**
* Import outputs in hex format.
*
* @param outputsHex are outputs in hex format
* @return the number of outputs imported
*/
int importOutputsHex(const string& outputsHex);
/**
* Get all signed key images.
*
@@ -838,14 +855,6 @@ namespace monero {
*/
string getTxNote(const string& txId) const;
/**
* Set a note for a specific transaction.
*
* @param txId specifies the transaction
* @param note specifies the note
*/
void setTxNote(const string& txId, const string& note);
/**
* Get notes for multiple transactions.
*
@@ -854,6 +863,14 @@ namespace monero {
*/
vector<string> getTxNotes(const vector<string>& txIds) const;
/**
* Set a note for a specific transaction.
*
* @param txId specifies the transaction
* @param note specifies the note
*/
void setTxNote(const string& txId, const string& note);
/**
* Set notes for multiple transactions.
*
@@ -1070,21 +1087,6 @@ namespace monero {
*/
shared_ptr<MoneroSendRequest> parsePaymentUri(const string& uri) const;
/**
* Export all outputs in hex format.
*
* @return all outputs in hex format, empty string if no outputs
*/
string getOutputsHex() const;
/**
* Import outputs in hex format.
*
* @param outputsHex are outputs in hex format
* @return the number of outputs imported
*/
int importOutputsHex(const string& outputsHex);
/**
* Set an arbitrary attribute.
*