mirror of
https://github.com/wownero/wownero-cpp.git
synced 2026-10-17 23:31:32 +02:00
implemented get/set tx notes
This commit is contained in:
@@ -1287,6 +1287,41 @@ namespace monero {
|
||||
return txIds;
|
||||
}
|
||||
|
||||
string MoneroWallet::getTxNote(const string& txId) const {
|
||||
cout << "MoneroWallet::getTxNote" << endl;
|
||||
cryptonote::blobdata txBlob;
|
||||
if (!epee::string_tools::parse_hexstr_to_binbuff(txId, txBlob) || txBlob.size() != sizeof(crypto::hash)) {
|
||||
throw runtime_error("TX ID has invalid format");
|
||||
}
|
||||
crypto::hash txHash = *reinterpret_cast<const crypto::hash*>(txBlob.data());
|
||||
return wallet2->get_tx_note(txHash);
|
||||
}
|
||||
|
||||
void MoneroWallet::setTxNote(const string& txId, const string& note) {
|
||||
cout << "MoneroWallet::setTxNote" << endl;
|
||||
cryptonote::blobdata txBlob;
|
||||
if (!epee::string_tools::parse_hexstr_to_binbuff(txId, txBlob) || txBlob.size() != sizeof(crypto::hash)) {
|
||||
throw runtime_error("TX ID has invalid format");
|
||||
}
|
||||
crypto::hash txHash = *reinterpret_cast<const crypto::hash*>(txBlob.data());
|
||||
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");
|
||||
for (int i = 0; i < txIds.size(); i++) {
|
||||
setTxNote(txIds[i], txNotes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
string MoneroWallet::createPaymentUri(const MoneroSendRequest& request) const {
|
||||
cout << "createPaymentUri()" << endl;
|
||||
|
||||
|
||||
+32
-32
@@ -759,38 +759,38 @@ namespace monero {
|
||||
*/
|
||||
vector<string> relayTxs(const vector<string>& txMetadatas);
|
||||
|
||||
// /**
|
||||
// * Get a transaction note.
|
||||
// *
|
||||
// * @param txId specifies the transaction to get the note of
|
||||
// * @return the tx note
|
||||
// */
|
||||
// public string getTxNote(string txId);
|
||||
//
|
||||
// /**
|
||||
// * Set a note for a specific transaction.
|
||||
// *
|
||||
// * @param txId specifies the transaction
|
||||
// * @param note specifies the note
|
||||
// */
|
||||
// public void setTxNote(string txId, string note);
|
||||
//
|
||||
// /**
|
||||
// * Get notes for multiple transactions.
|
||||
// *
|
||||
// * @param txIds identify the transactions to get notes for
|
||||
// * @preturns notes for the transactions
|
||||
// */
|
||||
// public List<string> getTxNotes(Collection<string> txIds);
|
||||
//
|
||||
// /**
|
||||
// * Set notes for multiple transactions.
|
||||
// *
|
||||
// * @param txIds specify the transactions to set notes for
|
||||
// * @param notes are the notes to set for the transactions
|
||||
// */
|
||||
// public void setTxNotes(Collection<string> txIds, Collection<string> notes);
|
||||
//
|
||||
/**
|
||||
* Get a transaction note.
|
||||
*
|
||||
* @param txId specifies the transaction to get the note of
|
||||
* @return the tx note
|
||||
*/
|
||||
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.
|
||||
*
|
||||
* @param txIds identify the transactions to get notes for
|
||||
* @preturns notes for the transactions
|
||||
*/
|
||||
vector<string> getTxNotes(const vector<string>& txIds) const;
|
||||
|
||||
/**
|
||||
* Set notes for multiple transactions.
|
||||
*
|
||||
* @param txIds specify the transactions to set notes for
|
||||
* @param notes are the notes to set for the transactions
|
||||
*/
|
||||
void setTxNotes(const vector<string>& txIds, const vector<string>& notes);
|
||||
|
||||
// /**
|
||||
// * Sign a message.
|
||||
// *
|
||||
|
||||
Reference in New Issue
Block a user