mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-23 11:23:26 +01:00
Merge pull request #816
7baed9b
wallet: allow attaching notes to txids (moneromooo-monero)ce6f8a6
wallet: add GMT timestamps to transfers/payments (moneromooo-monero)
This commit is contained in:
commit
b6f19a485c
@ -576,6 +576,8 @@ simple_wallet::simple_wallet()
|
||||
m_cmd_binder.set_handler("check_tx_key", boost::bind(&simple_wallet::check_tx_key, this, _1), tr("Check amount going to <address> in <txid>"));
|
||||
m_cmd_binder.set_handler("show_transfers", boost::bind(&simple_wallet::show_transfers, this, _1), tr("show_transfers [in|out] [<min_height> [<max_height>]] - Show incoming/outgoing transfers within an optional height range"));
|
||||
m_cmd_binder.set_handler("rescan_bc", boost::bind(&simple_wallet::rescan_blockchain, this, _1), tr("Rescan blockchain from scratch"));
|
||||
m_cmd_binder.set_handler("set_tx_note", boost::bind(&simple_wallet::set_tx_note, this, _1), tr("Set an arbitrary string note for a txid"));
|
||||
m_cmd_binder.set_handler("get_tx_note", boost::bind(&simple_wallet::get_tx_note, this, _1), tr("Get a string note for a txid"));
|
||||
m_cmd_binder.set_handler("help", boost::bind(&simple_wallet::help, this, _1), tr("Show this help"));
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@ -2935,6 +2937,23 @@ bool simple_wallet::check_tx_key(const std::vector<std::string> &args_)
|
||||
return true;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
static std::string get_human_readable_timestamp(uint64_t ts)
|
||||
{
|
||||
char buffer[64];
|
||||
if (ts < 1234567890)
|
||||
return "<unknown>";
|
||||
time_t tt = ts;
|
||||
struct tm tm;
|
||||
gmtime_r(&tt, &tm);
|
||||
uint64_t now = time(NULL);
|
||||
uint64_t diff = ts > now ? ts - now : now - ts;
|
||||
if (diff > 24*3600)
|
||||
strftime(buffer, sizeof(buffer), "%F", &tm);
|
||||
else
|
||||
strftime(buffer, sizeof(buffer), "%r", &tm);
|
||||
return std::string(buffer);
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
bool simple_wallet::show_transfers(const std::vector<std::string> &args_)
|
||||
{
|
||||
std::vector<std::string> local_args = args_;
|
||||
@ -3009,7 +3028,8 @@ bool simple_wallet::show_transfers(const std::vector<std::string> &args_)
|
||||
std::string payment_id = string_tools::pod_to_hex(i->first);
|
||||
if (payment_id.substr(16).find_first_not_of('0') == std::string::npos)
|
||||
payment_id = payment_id.substr(0,16);
|
||||
output.insert(std::make_pair(pd.m_block_height, std::make_pair(true, (boost::format("%20.20s %s %s %s") % print_money(pd.m_amount) % string_tools::pod_to_hex(pd.m_tx_hash) % payment_id % "-").str())));
|
||||
std::string note = m_wallet->get_tx_note(pd.m_tx_hash);
|
||||
output.insert(std::make_pair(pd.m_block_height, std::make_pair(true, (boost::format("%16.16s %20.20s %s %s %s %s") % get_human_readable_timestamp(pd.m_timestamp) % print_money(pd.m_amount) % string_tools::pod_to_hex(pd.m_tx_hash) % payment_id % "-" % note).str())));
|
||||
}
|
||||
}
|
||||
|
||||
@ -3029,7 +3049,8 @@ bool simple_wallet::show_transfers(const std::vector<std::string> &args_)
|
||||
std::string payment_id = string_tools::pod_to_hex(i->second.m_payment_id);
|
||||
if (payment_id.substr(16).find_first_not_of('0') == std::string::npos)
|
||||
payment_id = payment_id.substr(0,16);
|
||||
output.insert(std::make_pair(pd.m_block_height, std::make_pair(false, (boost::format("%20.20s %s %s %14.14s %s") % print_money(pd.m_amount_in - change - fee) % string_tools::pod_to_hex(i->first) % payment_id % print_money(fee) % dests).str())));
|
||||
std::string note = m_wallet->get_tx_note(i->first);
|
||||
output.insert(std::make_pair(pd.m_block_height, std::make_pair(false, (boost::format("%16.16s %20.20s %s %s %14.14s %s %s") % get_human_readable_timestamp(pd.m_timestamp) % print_money(pd.m_amount_in - change - fee) % string_tools::pod_to_hex(i->first) % payment_id % print_money(fee) % dests % note).str())));
|
||||
}
|
||||
}
|
||||
|
||||
@ -3052,9 +3073,10 @@ bool simple_wallet::show_transfers(const std::vector<std::string> &args_)
|
||||
std::string payment_id = string_tools::pod_to_hex(i->second.m_payment_id);
|
||||
if (payment_id.substr(16).find_first_not_of('0') == std::string::npos)
|
||||
payment_id = payment_id.substr(0,16);
|
||||
std::string note = m_wallet->get_tx_note(i->first);
|
||||
bool is_failed = pd.m_state == tools::wallet2::unconfirmed_transfer_details::failed;
|
||||
if ((failed && is_failed) || (!is_failed && pending)) {
|
||||
message_writer() << (boost::format("%8.8s %6.6s %20.20s %s %s %14.14s") % (is_failed ? tr("failed") : tr("pending")) % tr("out") % print_money(amount - pd.m_change) % string_tools::pod_to_hex(i->first) % payment_id % print_money(fee)).str();
|
||||
message_writer() << (boost::format("%8.8s %6.6s %16.16s %20.20s %s %s %14.14s %s") % (is_failed ? tr("failed") : tr("pending")) % tr("out") % get_human_readable_timestamp(pd.m_timestamp) % print_money(amount - pd.m_change) % string_tools::pod_to_hex(i->first) % payment_id % print_money(fee) % note).str();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3162,6 +3184,59 @@ bool simple_wallet::print_integrated_address(const std::vector<std::string> &arg
|
||||
return true;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
bool simple_wallet::set_tx_note(const std::vector<std::string> &args)
|
||||
{
|
||||
if (args.size() == 0)
|
||||
{
|
||||
fail_msg_writer() << tr("usage: set_tx_note [txid] free text note");
|
||||
return true;
|
||||
}
|
||||
|
||||
cryptonote::blobdata txid_data;
|
||||
if(!epee::string_tools::parse_hexstr_to_binbuff(args.front(), txid_data))
|
||||
{
|
||||
fail_msg_writer() << tr("failed to parse txid");
|
||||
return false;
|
||||
}
|
||||
crypto::hash txid = *reinterpret_cast<const crypto::hash*>(txid_data.data());
|
||||
|
||||
std::string note = "";
|
||||
for (size_t n = 1; n < args.size(); ++n)
|
||||
{
|
||||
if (n > 1)
|
||||
note += " ";
|
||||
note += args[n];
|
||||
}
|
||||
m_wallet->set_tx_note(txid, note);
|
||||
|
||||
return true;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
bool simple_wallet::get_tx_note(const std::vector<std::string> &args)
|
||||
{
|
||||
if (args.size() != 1)
|
||||
{
|
||||
fail_msg_writer() << tr("usage: get_tx_note [txid]");
|
||||
return true;
|
||||
}
|
||||
|
||||
cryptonote::blobdata txid_data;
|
||||
if(!epee::string_tools::parse_hexstr_to_binbuff(args.front(), txid_data))
|
||||
{
|
||||
fail_msg_writer() << tr("failed to parse txid");
|
||||
return false;
|
||||
}
|
||||
crypto::hash txid = *reinterpret_cast<const crypto::hash*>(txid_data.data());
|
||||
|
||||
std::string note = m_wallet->get_tx_note(txid);
|
||||
if (note.empty())
|
||||
success_msg_writer() << "no note found";
|
||||
else
|
||||
success_msg_writer() << "note found: " << note;
|
||||
|
||||
return true;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
bool simple_wallet::process_command(const std::vector<std::string> &args)
|
||||
{
|
||||
return m_cmd_binder.process_command_vec(args);
|
||||
|
@ -139,6 +139,8 @@ namespace cryptonote
|
||||
bool show_transfers(const std::vector<std::string> &args);
|
||||
bool rescan_blockchain(const std::vector<std::string> &args);
|
||||
bool refresh_main(uint64_t start_height, bool reset = false);
|
||||
bool set_tx_note(const std::vector<std::string> &args);
|
||||
bool get_tx_note(const std::vector<std::string> &args);
|
||||
|
||||
uint64_t get_daemon_blockchain_height(std::string& err);
|
||||
bool try_connect_to_daemon();
|
||||
|
@ -184,7 +184,7 @@ void wallet2::check_acc_out(const account_keys &acc, const tx_out &o, const cryp
|
||||
error = false;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
void wallet2::process_new_transaction(const cryptonote::transaction& tx, uint64_t height, bool miner_tx)
|
||||
void wallet2::process_new_transaction(const cryptonote::transaction& tx, uint64_t height, uint64_t ts, bool miner_tx)
|
||||
{
|
||||
if (!miner_tx)
|
||||
process_unconfirmed(tx, height);
|
||||
@ -409,7 +409,7 @@ void wallet2::process_new_transaction(const cryptonote::transaction& tx, uint64_
|
||||
|
||||
if (tx_money_spent_in_ins > 0)
|
||||
{
|
||||
process_outgoing(tx, height, tx_money_spent_in_ins, tx_money_got_in_outs);
|
||||
process_outgoing(tx, height, ts, tx_money_spent_in_ins, tx_money_got_in_outs);
|
||||
}
|
||||
|
||||
uint64_t received = (tx_money_spent_in_ins < tx_money_got_in_outs) ? tx_money_got_in_outs - tx_money_spent_in_ins : 0;
|
||||
@ -459,6 +459,7 @@ void wallet2::process_new_transaction(const cryptonote::transaction& tx, uint64_
|
||||
payment.m_amount = received;
|
||||
payment.m_block_height = height;
|
||||
payment.m_unlock_time = tx.unlock_time;
|
||||
payment.m_timestamp = ts;
|
||||
m_payments.emplace(payment_id, payment);
|
||||
LOG_PRINT_L2("Payment found: " << payment_id << " / " << payment.m_tx_hash << " / " << payment.m_amount);
|
||||
}
|
||||
@ -482,7 +483,7 @@ void wallet2::process_unconfirmed(const cryptonote::transaction& tx, uint64_t he
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
void wallet2::process_outgoing(const cryptonote::transaction &tx, uint64_t height, uint64_t spent, uint64_t received)
|
||||
void wallet2::process_outgoing(const cryptonote::transaction &tx, uint64_t height, uint64_t ts, uint64_t spent, uint64_t received)
|
||||
{
|
||||
crypto::hash txid = get_transaction_hash(tx);
|
||||
confirmed_transfer_details &ctd = m_confirmed_txs[txid];
|
||||
@ -492,6 +493,7 @@ void wallet2::process_outgoing(const cryptonote::transaction &tx, uint64_t heigh
|
||||
ctd.m_amount_out = get_outs_money_amount(tx);
|
||||
ctd.m_change = received;
|
||||
ctd.m_block_height = height;
|
||||
ctd.m_timestamp = ts;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
void wallet2::process_new_blockchain_entry(const cryptonote::block& b, const cryptonote::block_complete_entry& bche, const crypto::hash& bl_id, uint64_t height)
|
||||
@ -502,7 +504,7 @@ void wallet2::process_new_blockchain_entry(const cryptonote::block& b, const cry
|
||||
if(b.timestamp + 60*60*24 > m_account.get_createtime() && height >= m_refresh_from_block_height)
|
||||
{
|
||||
TIME_MEASURE_START(miner_tx_handle_time);
|
||||
process_new_transaction(b.miner_tx, height, true);
|
||||
process_new_transaction(b.miner_tx, height, b.timestamp, true);
|
||||
TIME_MEASURE_FINISH(miner_tx_handle_time);
|
||||
|
||||
TIME_MEASURE_START(txs_handle_time);
|
||||
@ -511,7 +513,7 @@ void wallet2::process_new_blockchain_entry(const cryptonote::block& b, const cry
|
||||
cryptonote::transaction tx;
|
||||
bool r = parse_and_validate_tx_from_blob(txblob, tx);
|
||||
THROW_WALLET_EXCEPTION_IF(!r, error::tx_parse_error, txblob);
|
||||
process_new_transaction(tx, height, false);
|
||||
process_new_transaction(tx, height, b.timestamp, false);
|
||||
}
|
||||
TIME_MEASURE_FINISH(txs_handle_time);
|
||||
LOG_PRINT_L2("Processed block: " << bl_id << ", height " << height << ", " << miner_tx_handle_time + txs_handle_time << "(" << miner_tx_handle_time << "/" << txs_handle_time <<")ms");
|
||||
@ -1861,6 +1863,7 @@ void wallet2::add_unconfirmed_tx(const cryptonote::transaction& tx, const std::v
|
||||
utd.m_dests = dests;
|
||||
utd.m_payment_id = payment_id;
|
||||
utd.m_state = wallet2::unconfirmed_transfer_details::pending;
|
||||
utd.m_timestamp = time(NULL);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@ -3068,6 +3071,19 @@ std::string wallet2::get_keys_file() const
|
||||
return m_keys_file;
|
||||
}
|
||||
|
||||
void wallet2::set_tx_note(const crypto::hash &txid, const std::string ¬e)
|
||||
{
|
||||
m_tx_notes[txid] = note;
|
||||
}
|
||||
|
||||
std::string wallet2::get_tx_note(const crypto::hash &txid) const
|
||||
{
|
||||
std::unordered_map<crypto::hash, std::string>::const_iterator i = m_tx_notes.find(txid);
|
||||
if (i == m_tx_notes.end())
|
||||
return std::string();
|
||||
return i->second;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
void wallet2::generate_genesis(cryptonote::block& b) {
|
||||
if (m_testnet)
|
||||
|
@ -110,6 +110,7 @@ namespace tools
|
||||
uint64_t m_amount;
|
||||
uint64_t m_block_height;
|
||||
uint64_t m_unlock_time;
|
||||
uint64_t m_timestamp;
|
||||
};
|
||||
|
||||
struct unconfirmed_transfer_details
|
||||
@ -120,6 +121,7 @@ namespace tools
|
||||
std::vector<cryptonote::tx_destination_entry> m_dests;
|
||||
crypto::hash m_payment_id;
|
||||
enum { pending, pending_not_in_pool, failed } m_state;
|
||||
uint64_t m_timestamp;
|
||||
};
|
||||
|
||||
struct confirmed_transfer_details
|
||||
@ -130,10 +132,11 @@ namespace tools
|
||||
uint64_t m_block_height;
|
||||
std::vector<cryptonote::tx_destination_entry> m_dests;
|
||||
crypto::hash m_payment_id;
|
||||
uint64_t m_timestamp;
|
||||
|
||||
confirmed_transfer_details(): m_amount_in(0), m_amount_out(0), m_change((uint64_t)-1), m_block_height(0), m_payment_id(cryptonote::null_hash) {}
|
||||
confirmed_transfer_details(const unconfirmed_transfer_details &utd, uint64_t height):
|
||||
m_amount_out(get_outs_money_amount(utd.m_tx)), m_change(utd.m_change), m_block_height(height), m_dests(utd.m_dests), m_payment_id(utd.m_payment_id) { get_inputs_money_amount(utd.m_tx, m_amount_in); }
|
||||
m_amount_out(get_outs_money_amount(utd.m_tx)), m_change(utd.m_change), m_block_height(height), m_dests(utd.m_dests), m_payment_id(utd.m_payment_id), m_timestamp(utd.m_timestamp) { get_inputs_money_amount(utd.m_tx, m_amount_in); }
|
||||
};
|
||||
|
||||
typedef std::vector<transfer_details> transfer_container;
|
||||
@ -326,6 +329,9 @@ namespace tools
|
||||
if(ver < 11)
|
||||
return;
|
||||
a & m_refresh_from_block_height;
|
||||
if(ver < 12)
|
||||
return;
|
||||
a & m_tx_notes;
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -372,6 +378,9 @@ namespace tools
|
||||
std::vector<size_t> select_available_unmixable_outputs(bool trusted_daemon);
|
||||
std::vector<size_t> select_available_mixable_outputs(bool trusted_daemon);
|
||||
|
||||
void set_tx_note(const crypto::hash &txid, const std::string ¬e);
|
||||
std::string get_tx_note(const crypto::hash &txid) const;
|
||||
|
||||
private:
|
||||
/*!
|
||||
* \brief Stores wallet information to wallet file.
|
||||
@ -387,7 +396,7 @@ namespace tools
|
||||
* \param password Password of wallet file
|
||||
*/
|
||||
bool load_keys(const std::string& keys_file_name, const std::string& password);
|
||||
void process_new_transaction(const cryptonote::transaction& tx, uint64_t height, bool miner_tx);
|
||||
void process_new_transaction(const cryptonote::transaction& tx, uint64_t height, uint64_t ts, bool miner_tx);
|
||||
void process_new_blockchain_entry(const cryptonote::block& b, const cryptonote::block_complete_entry& bche, const crypto::hash& bl_id, uint64_t height);
|
||||
void detach_blockchain(uint64_t height);
|
||||
void get_short_chain_history(std::list<crypto::hash>& ids) const;
|
||||
@ -402,7 +411,7 @@ namespace tools
|
||||
uint64_t select_transfers(uint64_t needed_money, std::vector<size_t> unused_transfers_indices, std::list<transfer_container::iterator>& selected_transfers, bool trusted_daemon);
|
||||
bool prepare_file_names(const std::string& file_path);
|
||||
void process_unconfirmed(const cryptonote::transaction& tx, uint64_t height);
|
||||
void process_outgoing(const cryptonote::transaction& tx, uint64_t height, uint64_t spent, uint64_t received);
|
||||
void process_outgoing(const cryptonote::transaction& tx, uint64_t height, uint64_t ts, uint64_t spent, uint64_t received);
|
||||
void add_unconfirmed_tx(const cryptonote::transaction& tx, const std::vector<cryptonote::tx_destination_entry> &dests, const crypto::hash &payment_id, uint64_t change_amount);
|
||||
void generate_genesis(cryptonote::block& b);
|
||||
void check_genesis(const crypto::hash& genesis_hash) const; //throws
|
||||
@ -429,6 +438,7 @@ namespace tools
|
||||
payment_container m_payments;
|
||||
std::unordered_map<crypto::key_image, size_t> m_key_images;
|
||||
cryptonote::account_public_address m_account_public_address;
|
||||
std::unordered_map<crypto::hash, std::string> m_tx_notes;
|
||||
uint64_t m_upper_transaction_size_limit; //TODO: auto-calc this value or request from daemon, now use some fixed value
|
||||
|
||||
std::atomic<bool> m_run;
|
||||
@ -449,10 +459,10 @@ namespace tools
|
||||
uint64_t m_refresh_from_block_height;
|
||||
};
|
||||
}
|
||||
BOOST_CLASS_VERSION(tools::wallet2, 11)
|
||||
BOOST_CLASS_VERSION(tools::wallet2::payment_details, 0)
|
||||
BOOST_CLASS_VERSION(tools::wallet2::unconfirmed_transfer_details, 2)
|
||||
BOOST_CLASS_VERSION(tools::wallet2::confirmed_transfer_details, 1)
|
||||
BOOST_CLASS_VERSION(tools::wallet2, 12)
|
||||
BOOST_CLASS_VERSION(tools::wallet2::payment_details, 1)
|
||||
BOOST_CLASS_VERSION(tools::wallet2::unconfirmed_transfer_details, 3)
|
||||
BOOST_CLASS_VERSION(tools::wallet2::confirmed_transfer_details, 2)
|
||||
|
||||
namespace boost
|
||||
{
|
||||
@ -482,6 +492,9 @@ namespace boost
|
||||
if (ver < 2)
|
||||
return;
|
||||
a & x.m_state;
|
||||
if (ver < 3)
|
||||
return;
|
||||
a & x.m_timestamp;
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
@ -495,6 +508,9 @@ namespace boost
|
||||
return;
|
||||
a & x.m_dests;
|
||||
a & x.m_payment_id;
|
||||
if (ver < 2)
|
||||
return;
|
||||
a & x.m_timestamp;
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
@ -504,6 +520,9 @@ namespace boost
|
||||
a & x.m_amount;
|
||||
a & x.m_block_height;
|
||||
a & x.m_unlock_time;
|
||||
if (ver < 1)
|
||||
return;
|
||||
a & x.m_timestamp;
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
|
@ -770,5 +770,68 @@ namespace tools
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
bool wallet_rpc_server::on_set_tx_notes(const wallet_rpc::COMMAND_RPC_SET_TX_NOTES::request& req, wallet_rpc::COMMAND_RPC_SET_TX_NOTES::response& res, epee::json_rpc::error& er)
|
||||
{
|
||||
if (req.txids.size() != req.notes.size())
|
||||
{
|
||||
er.code = WALLET_RPC_ERROR_CODE_UNKNOWN_ERROR;
|
||||
er.message = "Different amount of txids and notes";
|
||||
return false;
|
||||
}
|
||||
|
||||
std::list<crypto::hash> txids;
|
||||
std::list<std::string>::const_iterator i = req.txids.begin();
|
||||
while (i != req.txids.end())
|
||||
{
|
||||
cryptonote::blobdata txid_blob;
|
||||
if(!epee::string_tools::parse_hexstr_to_binbuff(*i++, txid_blob))
|
||||
{
|
||||
er.code = WALLET_RPC_ERROR_CODE_WRONG_TXID;
|
||||
er.message = "TX ID has invalid format";
|
||||
return false;
|
||||
}
|
||||
|
||||
crypto::hash txid = *reinterpret_cast<const crypto::hash*>(txid_blob.data());
|
||||
txids.push_back(txid);
|
||||
}
|
||||
|
||||
std::list<crypto::hash>::const_iterator il = txids.begin();
|
||||
std::list<std::string>::const_iterator in = req.notes.begin();
|
||||
while (il != txids.end())
|
||||
{
|
||||
m_wallet.set_tx_note(*il++, *in++);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
bool wallet_rpc_server::on_get_tx_notes(const wallet_rpc::COMMAND_RPC_GET_TX_NOTES::request& req, wallet_rpc::COMMAND_RPC_GET_TX_NOTES::response& res, epee::json_rpc::error& er)
|
||||
{
|
||||
res.notes.clear();
|
||||
|
||||
std::list<crypto::hash> txids;
|
||||
std::list<std::string>::const_iterator i = req.txids.begin();
|
||||
while (i != req.txids.end())
|
||||
{
|
||||
cryptonote::blobdata txid_blob;
|
||||
if(!epee::string_tools::parse_hexstr_to_binbuff(*i++, txid_blob))
|
||||
{
|
||||
er.code = WALLET_RPC_ERROR_CODE_WRONG_TXID;
|
||||
er.message = "TX ID has invalid format";
|
||||
return false;
|
||||
}
|
||||
|
||||
crypto::hash txid = *reinterpret_cast<const crypto::hash*>(txid_blob.data());
|
||||
txids.push_back(txid);
|
||||
}
|
||||
|
||||
std::list<crypto::hash>::const_iterator il = txids.begin();
|
||||
while (il != txids.end())
|
||||
{
|
||||
res.notes.push_back(m_wallet.get_tx_note(*il++));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
|
@ -77,6 +77,8 @@ namespace tools
|
||||
MAP_JON_RPC_WE("split_integrated_address", on_split_integrated_address, wallet_rpc::COMMAND_RPC_SPLIT_INTEGRATED_ADDRESS)
|
||||
MAP_JON_RPC_WE("stop_wallet", on_stop_wallet, wallet_rpc::COMMAND_RPC_STOP_WALLET)
|
||||
MAP_JON_RPC_WE("rescan_blockchain", on_rescan_blockchain, wallet_rpc::COMMAND_RPC_RESCAN_BLOCKCHAIN)
|
||||
MAP_JON_RPC_WE("set_tx_notes", on_set_tx_notes, wallet_rpc::COMMAND_RPC_SET_TX_NOTES)
|
||||
MAP_JON_RPC_WE("get_tx_notes", on_get_tx_notes, wallet_rpc::COMMAND_RPC_GET_TX_NOTES)
|
||||
END_JSON_RPC_MAP()
|
||||
END_URI_MAP2()
|
||||
|
||||
@ -97,6 +99,8 @@ namespace tools
|
||||
bool on_incoming_transfers(const wallet_rpc::COMMAND_RPC_INCOMING_TRANSFERS::request& req, wallet_rpc::COMMAND_RPC_INCOMING_TRANSFERS::response& res, epee::json_rpc::error& er);
|
||||
bool on_stop_wallet(const wallet_rpc::COMMAND_RPC_STOP_WALLET::request& req, wallet_rpc::COMMAND_RPC_STOP_WALLET::response& res, epee::json_rpc::error& er);
|
||||
bool on_rescan_blockchain(const wallet_rpc::COMMAND_RPC_RESCAN_BLOCKCHAIN::request& req, wallet_rpc::COMMAND_RPC_RESCAN_BLOCKCHAIN::response& res, epee::json_rpc::error& er);
|
||||
bool on_set_tx_notes(const wallet_rpc::COMMAND_RPC_SET_TX_NOTES::request& req, wallet_rpc::COMMAND_RPC_SET_TX_NOTES::response& res, epee::json_rpc::error& er);
|
||||
bool on_get_tx_notes(const wallet_rpc::COMMAND_RPC_GET_TX_NOTES::request& req, wallet_rpc::COMMAND_RPC_GET_TX_NOTES::response& res, epee::json_rpc::error& er);
|
||||
|
||||
bool handle_command_line(const boost::program_options::variables_map& vm);
|
||||
|
||||
|
@ -447,6 +447,47 @@ namespace wallet_rpc
|
||||
};
|
||||
};
|
||||
|
||||
struct COMMAND_RPC_SET_TX_NOTES
|
||||
{
|
||||
struct request
|
||||
{
|
||||
std::list<std::string> txids;
|
||||
std::list<std::string> notes;
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(txids)
|
||||
KV_SERIALIZE(notes)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
|
||||
struct response
|
||||
{
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
};
|
||||
|
||||
struct COMMAND_RPC_GET_TX_NOTES
|
||||
{
|
||||
struct request
|
||||
{
|
||||
std::list<std::string> txids;
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(txids)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
|
||||
struct response
|
||||
{
|
||||
std::list<std::string> notes;
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(notes)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,3 +38,4 @@
|
||||
#define WALLET_RPC_ERROR_CODE_WRONG_PAYMENT_ID -5
|
||||
#define WALLET_RPC_ERROR_CODE_TRANSFER_TYPE -6
|
||||
#define WALLET_RPC_ERROR_CODE_DENIED -7
|
||||
#define WALLET_RPC_ERROR_CODE_WRONG_TXID -8
|
||||
|
Loading…
Reference in New Issue
Block a user