Prefix LNS commands with lns, instead of <verb> lns <action>

This commit is contained in:
Doyle 2020-02-27 15:26:58 +11:00
parent 91036eb2ad
commit 5dd5723332
12 changed files with 151 additions and 122 deletions

View File

@ -3374,16 +3374,16 @@ namespace cryptonote
return true;
}
//------------------------------------------------------------------------------------------------------------------------------
bool core_rpc_server::on_get_lns_names_to_owners(const COMMAND_RPC_GET_LNS_NAMES_TO_OWNERS::request &req, COMMAND_RPC_GET_LNS_NAMES_TO_OWNERS::response &res, epee::json_rpc::error &error_resp, const connection_context *ctx)
bool core_rpc_server::on_lns_names_to_owners(const COMMAND_RPC_LNS_NAMES_TO_OWNERS::request &req, COMMAND_RPC_LNS_NAMES_TO_OWNERS::response &res, epee::json_rpc::error &error_resp, const connection_context *ctx)
{
if (exceeds_quantity_limit(ctx, error_resp, m_restricted, req.entries.size(), COMMAND_RPC_GET_LNS_NAMES_TO_OWNERS::MAX_REQUEST_ENTRIES))
if (exceeds_quantity_limit(ctx, error_resp, m_restricted, req.entries.size(), COMMAND_RPC_LNS_NAMES_TO_OWNERS::MAX_REQUEST_ENTRIES))
return false;
lns::name_system_db const &db = m_core.get_blockchain_storage().name_system_db();
for (size_t request_index = 0; request_index < req.entries.size(); request_index++)
{
COMMAND_RPC_GET_LNS_NAMES_TO_OWNERS::request_entry const &request = req.entries[request_index];
if (exceeds_quantity_limit(ctx, error_resp, m_restricted, request.types.size(), COMMAND_RPC_GET_LNS_NAMES_TO_OWNERS::MAX_TYPE_REQUEST_ENTRIES, "types"))
COMMAND_RPC_LNS_NAMES_TO_OWNERS::request_entry const &request = req.entries[request_index];
if (exceeds_quantity_limit(ctx, error_resp, m_restricted, request.types.size(), COMMAND_RPC_LNS_NAMES_TO_OWNERS::MAX_TYPE_REQUEST_ENTRIES, "types"))
return false;
std::string name_hash = lns::name_to_base64_hash(request.name);
@ -3392,15 +3392,15 @@ namespace cryptonote
for (auto const &record : records)
{
res.entries.emplace_back();
COMMAND_RPC_GET_LNS_NAMES_TO_OWNERS::response_entry &entry = res.entries.back();
entry.entry_index = request_index;
entry.type = static_cast<uint16_t>(record.type);
entry.owner = epee::string_tools::pod_to_hex(record.owner);
entry.backup_owner = epee::string_tools::pod_to_hex(record.backup_owner);
entry.encrypted_value = epee::to_hex::string(record.encrypted_value.to_span());
entry.register_height = record.register_height;
entry.txid = epee::string_tools::pod_to_hex(record.txid);
entry.prev_txid = epee::string_tools::pod_to_hex(record.prev_txid);
COMMAND_RPC_LNS_NAMES_TO_OWNERS::response_entry &entry = res.entries.back();
entry.entry_index = request_index;
entry.type = static_cast<uint16_t>(record.type);
entry.owner = epee::string_tools::pod_to_hex(record.owner);
entry.backup_owner = epee::string_tools::pod_to_hex(record.backup_owner);
entry.encrypted_value = epee::to_hex::string(record.encrypted_value.to_span());
entry.register_height = record.register_height;
entry.txid = epee::string_tools::pod_to_hex(record.txid);
entry.prev_txid = epee::string_tools::pod_to_hex(record.prev_txid);
}
}
@ -3408,9 +3408,9 @@ namespace cryptonote
return true;
}
//------------------------------------------------------------------------------------------------------------------------------
bool core_rpc_server::on_get_lns_owners_to_names(const COMMAND_RPC_GET_LNS_OWNERS_TO_NAMES::request &req, COMMAND_RPC_GET_LNS_OWNERS_TO_NAMES::response &res, epee::json_rpc::error &error_resp, const connection_context *ctx)
bool core_rpc_server::on_lns_owners_to_names(const COMMAND_RPC_LNS_OWNERS_TO_NAMES::request &req, COMMAND_RPC_LNS_OWNERS_TO_NAMES::response &res, epee::json_rpc::error &error_resp, const connection_context *ctx)
{
if (exceeds_quantity_limit(ctx, error_resp, m_restricted, req.entries.size(), COMMAND_RPC_GET_LNS_OWNERS_TO_NAMES::MAX_REQUEST_ENTRIES))
if (exceeds_quantity_limit(ctx, error_resp, m_restricted, req.entries.size(), COMMAND_RPC_LNS_OWNERS_TO_NAMES::MAX_REQUEST_ENTRIES))
return false;
std::map<crypto::generic_public_key, size_t> key_to_request_index;
@ -3437,7 +3437,7 @@ namespace cryptonote
for (auto &record : records)
{
res.entries.emplace_back();
COMMAND_RPC_GET_LNS_OWNERS_TO_NAMES::response_entry &entry = res.entries.back();
COMMAND_RPC_LNS_OWNERS_TO_NAMES::response_entry &entry = res.entries.back();
auto it = key_to_request_index.find(record.owner);
if (it == key_to_request_index.end())

View File

@ -195,8 +195,8 @@ namespace cryptonote
MAP_JON_RPC_WE("get_service_nodes_state_changes", on_get_service_nodes_state_changes, COMMAND_RPC_GET_SN_STATE_CHANGES)
MAP_JON_RPC_WE_IF("report_peer_storage_server_status", on_report_peer_storage_server_status, COMMAND_RPC_REPORT_PEER_SS_STATUS, !m_restricted)
MAP_JON_RPC_WE_IF("test_trigger_p2p_resync", on_test_trigger_p2p_resync, COMMAND_RPC_TEST_TRIGGER_P2P_RESYNC, !m_restricted)
MAP_JON_RPC_WE("get_lns_names_to_owners", on_get_lns_names_to_owners, COMMAND_RPC_GET_LNS_NAMES_TO_OWNERS)
MAP_JON_RPC_WE("get_lns_owners_to_names", on_get_lns_owners_to_names, COMMAND_RPC_GET_LNS_OWNERS_TO_NAMES)
MAP_JON_RPC_WE("lns_names_to_owners", on_lns_names_to_owners, COMMAND_RPC_LNS_NAMES_TO_OWNERS)
MAP_JON_RPC_WE("lns_owners_to_names", on_lns_owners_to_names, COMMAND_RPC_LNS_OWNERS_TO_NAMES)
END_JSON_RPC_MAP()
END_URI_MAP2()
@ -290,8 +290,8 @@ namespace cryptonote
bool on_get_service_nodes_state_changes(const COMMAND_RPC_GET_SN_STATE_CHANGES::request& req, COMMAND_RPC_GET_SN_STATE_CHANGES::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx = NULL);
bool on_report_peer_storage_server_status(const COMMAND_RPC_REPORT_PEER_SS_STATUS::request& req, COMMAND_RPC_REPORT_PEER_SS_STATUS::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx = NULL);
bool on_test_trigger_p2p_resync(const COMMAND_RPC_TEST_TRIGGER_P2P_RESYNC::request& req, COMMAND_RPC_TEST_TRIGGER_P2P_RESYNC::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx = NULL);
bool on_get_lns_names_to_owners(const COMMAND_RPC_GET_LNS_NAMES_TO_OWNERS::request &req, COMMAND_RPC_GET_LNS_NAMES_TO_OWNERS::response &res, epee::json_rpc::error &error_resp, const connection_context *ctx = NULL);
bool on_get_lns_owners_to_names(const COMMAND_RPC_GET_LNS_OWNERS_TO_NAMES::request &req, COMMAND_RPC_GET_LNS_OWNERS_TO_NAMES::response &res, epee::json_rpc::error &error_resp, const connection_context *ctx = NULL);
bool on_lns_names_to_owners(const COMMAND_RPC_LNS_NAMES_TO_OWNERS::request &req, COMMAND_RPC_LNS_NAMES_TO_OWNERS::response &res, epee::json_rpc::error &error_resp, const connection_context *ctx = NULL);
bool on_lns_owners_to_names(const COMMAND_RPC_LNS_OWNERS_TO_NAMES::request &req, COMMAND_RPC_LNS_OWNERS_TO_NAMES::response &res, epee::json_rpc::error &error_resp, const connection_context *ctx = NULL);
//-----------------------
#if defined(LOKI_ENABLE_INTEGRATION_TEST_HOOKS)

View File

@ -3455,7 +3455,7 @@ constexpr char const CORE_RPC_STATUS_TX_LONG_POLL_MAX_CONNECTIONS[] = "Daemon ma
LOKI_RPC_DOC_INTROSPECT
// Get the name mapping for a Loki Name Service entry. Loki currently supports mappings
// for Session.
struct COMMAND_RPC_GET_LNS_NAMES_TO_OWNERS
struct COMMAND_RPC_LNS_NAMES_TO_OWNERS
{
static size_t const MAX_REQUEST_ENTRIES = 256;
static size_t const MAX_TYPE_REQUEST_ENTRIES = 16;
@ -3513,7 +3513,7 @@ constexpr char const CORE_RPC_STATUS_TX_LONG_POLL_MAX_CONNECTIONS[] = "Daemon ma
LOKI_RPC_DOC_INTROSPECT
// Get all the name mappings for the queried owner. The owner can be either a ed25519 public key or Monero style
// public key; by default purchases are owned by the spend public key of the purchasing wallet.
struct COMMAND_RPC_GET_LNS_OWNERS_TO_NAMES
struct COMMAND_RPC_LNS_OWNERS_TO_NAMES
{
static size_t const MAX_REQUEST_ENTRIES = 256;
struct request

View File

@ -79,6 +79,7 @@
#include <stdexcept>
#include "int-util.h"
#include "wallet/message_store.h"
#include "wallet/wallet_rpc_server_commands_defs.h"
#ifdef WIN32
#include <boost/locale.hpp>
@ -269,10 +270,11 @@ namespace
const char* USAGE_STAKE("stake [index=<N1>[,<N2>,...]] [<priority>] <service node pubkey> <amount|percent%>");
const char* USAGE_REQUEST_STAKE_UNLOCK("request_stake_unlock <service_node_pubkey>");
const char* USAGE_PRINT_LOCKED_STAKES("print_locked_stakes");
const char* USAGE_BUY_LNS_MAPPING("buy_lns_mapping [index=<N1>[,<N2>,...]] [<priority>] [owner=] [backup_owner=] \"<name>\" <value>");
const char* USAGE_UPDATE_LNS_MAPPING("update_lns_mapping [index=<N1>[,<N2>,...]] [<priority>] \"<name>\" <value> [<signature>]");
const char* USAGE_PRINT_LNS_OWNERS_TO_NAME_HASHES("print_lns_owners_to_name_hashes [<64 hex character ed25519 public key>]");
const char* USAGE_PRINT_LNS_NAME_TO_OWNERS("print_lns_name_to_owners [type=<N1|all>[,<N2>...]] \"name\"");
const char* USAGE_LNS_BUY_MAPPING("lns_buy_mapping [index=<N1>[,<N2>,...]] [<priority>] [owner=] [backup_owner=] \"<name>\" <value>");
const char* USAGE_LNS_UPDATE_MAPPING("lns_update_mapping [index=<N1>[,<N2>,...]] [<priority>] \"<name>\" <value> [<signature>]");
const char* USAGE_LNS_PRINT_OWNERS_TO_NAMES("lns_print_owners_to_names [<64 hex character ed25519 public key>]");
const char* USAGE_LNS_PRINT_NAME_TO_OWNERS("lns_print_name_to_owners [type=<N1|all>[,<N2>...]] \"name\"");
#if defined (LOKI_ENABLE_INTEGRATION_TEST_HOOKS)
std::string input_line(const std::string &prompt, bool yesno = false)
@ -3090,37 +3092,24 @@ Pending or Failed: "failed"|"pending", "out", Time, Amount*, Transaction Hash,
tr(USAGE_PRINT_LOCKED_STAKES),
tr("Print stakes currently locked on the Service Node network"));
char const OWNER_KEY_EXPLANATION[] = "By default this is the public key of an ed25519 keypair derived using the wallet's secret spend key as the seed value. ";
char const AVAILABLE_LNS_RECORDS[] = "You are currenly only able to purchase Session mappings. ";
std::stringstream stream;
stream << "Buy a Loki Name Service mapping. Specifying `owner` is optional and defaults to the purchasing wallet if empty or not specified. The `owner` should be a ed25519 public key. "
<< OWNER_KEY_EXPLANATION
<< AVAILABLE_LNS_RECORDS << "\n\n";
stream << "Session: (max: " << lns::SESSION_DISPLAY_NAME_MAX << " bytes) map a human readable name to a Session public key.\n";
m_cmd_binder.set_handler("lns_buy_mapping",
boost::bind(&simple_wallet::lns_buy_mapping, this, _1),
tr(USAGE_LNS_BUY_MAPPING),
tr(tools::wallet_rpc::COMMAND_RPC_LNS_BUY_MAPPING::description));
m_cmd_binder.set_handler("buy_lns_mapping",
boost::bind(&simple_wallet::buy_lns_mapping, this, _1),
tr(USAGE_BUY_LNS_MAPPING),
tr(stream.str().c_str()));
m_cmd_binder.set_handler("lns_update_mapping",
boost::bind(&simple_wallet::lns_update_mapping, this, _1),
tr(USAGE_LNS_UPDATE_MAPPING),
tr(tools::wallet_rpc::COMMAND_RPC_LNS_UPDATE_MAPPING::description));
stream.clear();
stream << "Update a Loki Name Service mapping's value field in the name->value mapping, you must be the owner of the the mapping by providing a signature that can be verified by the owner's public key."
<< OWNER_KEY_EXPLANATION
<< AVAILABLE_LNS_RECORDS
<< "The signature is derived using libsodium generichash on the {current txid blob, new value blob} of the mapping to update. Signature is an optional field and is signed using the wallet's spend key as an ed25519 keypair if it is not specified.";
m_cmd_binder.set_handler("update_lns_mapping",
boost::bind(&simple_wallet::update_lns_mapping, this, _1),
tr(USAGE_UPDATE_LNS_MAPPING),
tr(stream.str().c_str()));
m_cmd_binder.set_handler("lns_print_owners_to_names",
boost::bind(&simple_wallet::lns_print_owners_to_names, this, _1),
tr(USAGE_LNS_PRINT_OWNERS_TO_NAMES),
tr("Query the Loki Name Service names that the keys have purchased. If no keys are specified, it defaults to the current wallet."));
m_cmd_binder.set_handler("print_lns_owners_to_name_hashes",
boost::bind(&simple_wallet::print_lns_owners_to_name_hashes, this, _1),
tr(USAGE_PRINT_LNS_OWNERS_TO_NAME_HASHES),
tr("Query the Loki Name Service names that the owners have purchased. If no keys are specified, it defaults to the current wallet."));
m_cmd_binder.set_handler("print_lns_name_to_owners",
boost::bind(&simple_wallet::print_lns_name_to_owners, this, _1),
tr(USAGE_PRINT_LNS_NAME_TO_OWNERS),
m_cmd_binder.set_handler("lns_print_name_to_owners",
boost::bind(&simple_wallet::lns_print_name_to_owners, this, _1),
tr(USAGE_LNS_PRINT_NAME_TO_OWNERS),
tr("Query the ed25519 public keys that own the Loki Name System names."));
}
//----------------------------------------------------------------------------------------------------
@ -6375,7 +6364,7 @@ static bool parse_lns_name_string(std::vector<std::string> const &args, size_t f
return true;
}
//----------------------------------------------------------------------------------------------------
bool simple_wallet::buy_lns_mapping(const std::vector<std::string>& args)
bool simple_wallet::lns_buy_mapping(const std::vector<std::string>& args)
{
std::vector<std::string> local_args = args;
uint32_t priority = 0;
@ -6384,7 +6373,7 @@ bool simple_wallet::buy_lns_mapping(const std::vector<std::string>& args)
if (local_args.size() < 2)
{
PRINT_USAGE(USAGE_BUY_LNS_MAPPING);
PRINT_USAGE(USAGE_LNS_BUY_MAPPING);
return true;
}
@ -6420,7 +6409,7 @@ bool simple_wallet::buy_lns_mapping(const std::vector<std::string>& args)
size_t last_word_index = local_args.size() - 2;
if (!parse_lns_name_string(local_args, first_word_index, last_word_index, name))
{
PRINT_USAGE(USAGE_BUY_LNS_MAPPING);
PRINT_USAGE(USAGE_LNS_BUY_MAPPING);
fail_msg_writer() << "lns name didn't start or end with quotation marks (\"), first word in name is=\"" << local_args[first_word_index] << "\"";
return false;
}
@ -6430,7 +6419,7 @@ bool simple_wallet::buy_lns_mapping(const std::vector<std::string>& args)
std::vector<tools::wallet2::pending_tx> ptx_vector;
try
{
ptx_vector = m_wallet->create_buy_lns_mapping_tx(lns::mapping_type::session,
ptx_vector = m_wallet->lns_create_buy_mapping_tx(lns::mapping_type::session,
owner,
backup_owner,
name,
@ -6468,7 +6457,7 @@ bool simple_wallet::buy_lns_mapping(const std::vector<std::string>& args)
return true;
}
//----------------------------------------------------------------------------------------------------
bool simple_wallet::update_lns_mapping(const std::vector<std::string>& args)
bool simple_wallet::lns_update_mapping(const std::vector<std::string>& args)
{
std::vector<std::string> local_args = args;
uint32_t priority = 0;
@ -6477,7 +6466,7 @@ bool simple_wallet::update_lns_mapping(const std::vector<std::string>& args)
if (local_args.size() < 2)
{
PRINT_USAGE(USAGE_UPDATE_LNS_MAPPING);
PRINT_USAGE(USAGE_LNS_UPDATE_MAPPING);
return true;
}
@ -6488,7 +6477,7 @@ bool simple_wallet::update_lns_mapping(const std::vector<std::string>& args)
{
if (local_args.size() == 2)
{
PRINT_USAGE(USAGE_UPDATE_LNS_MAPPING);
PRINT_USAGE(USAGE_LNS_UPDATE_MAPPING);
fail_msg_writer() << "Detected signature=" << last_word << ", but only 2 arguments given- missing either <value> or \"<name>\".";
return true;
}
@ -6506,7 +6495,7 @@ bool simple_wallet::update_lns_mapping(const std::vector<std::string>& args)
size_t last_word_index = local_args.size() - 2;
if (!parse_lns_name_string(local_args, first_word_index, last_word_index, name))
{
PRINT_USAGE(USAGE_UPDATE_LNS_MAPPING);
PRINT_USAGE(USAGE_LNS_UPDATE_MAPPING);
fail_msg_writer() << "lns name didn't start or end with quotation marks (')";
return false;
}
@ -6516,7 +6505,7 @@ bool simple_wallet::update_lns_mapping(const std::vector<std::string>& args)
std::vector<tools::wallet2::pending_tx> ptx_vector;
try
{
ptx_vector = m_wallet->create_update_lns_mapping_tx(lns::mapping_type::session,
ptx_vector = m_wallet->lns_create_update_mapping_tx(lns::mapping_type::session,
name,
*value,
signature,
@ -6554,14 +6543,14 @@ bool simple_wallet::update_lns_mapping(const std::vector<std::string>& args)
}
//----------------------------------------------------------------------------------------------------
static char constexpr NULL_KEY_STR[] = "0000000000000000000000000000000000000000000000000000000000000000";
bool simple_wallet::print_lns_name_to_owners(const std::vector<std::string>& args)
bool simple_wallet::lns_print_name_to_owners(const std::vector<std::string>& args)
{
if (!try_connect_to_daemon())
return false;
if (args.size() < 1)
{
PRINT_USAGE(USAGE_PRINT_LNS_NAME_TO_OWNERS);
PRINT_USAGE(USAGE_LNS_PRINT_NAME_TO_OWNERS);
return true;
}
@ -6601,15 +6590,15 @@ bool simple_wallet::print_lns_name_to_owners(const std::vector<std::string>& arg
std::string lns_name;
if (!parse_lns_name_string(args, start_of_name, end_of_name, lns_name))
{
PRINT_USAGE(USAGE_PRINT_LNS_NAME_TO_OWNERS);
PRINT_USAGE(USAGE_LNS_PRINT_NAME_TO_OWNERS);
fail_msg_writer() << "lns name didn't start or end with quotation marks (\")";
return false;
}
cryptonote::COMMAND_RPC_GET_LNS_NAMES_TO_OWNERS::request request = {};
cryptonote::COMMAND_RPC_LNS_NAMES_TO_OWNERS::request request = {};
request.entries.push_back({lns_name, std::move(requested_types)});
cryptonote::COMMAND_RPC_GET_LNS_NAMES_TO_OWNERS::request_entry &entry = request.entries.back();
cryptonote::COMMAND_RPC_LNS_NAMES_TO_OWNERS::request_entry &entry = request.entries.back();
if (entry.types.empty())
{
entry.types.push_back(static_cast<uint16_t>(lns::mapping_type::session));
@ -6621,7 +6610,7 @@ bool simple_wallet::print_lns_name_to_owners(const std::vector<std::string>& arg
}
boost::optional<std::string> failed;
std::vector<cryptonote::COMMAND_RPC_GET_LNS_NAMES_TO_OWNERS::response_entry> response = m_wallet->get_lns_names_to_owners(request, failed);
std::vector<cryptonote::COMMAND_RPC_LNS_NAMES_TO_OWNERS::response_entry> response = m_wallet->lns_names_to_owners(request, failed);
if (failed)
{
fail_msg_writer() << *failed;
@ -6641,7 +6630,7 @@ bool simple_wallet::print_lns_name_to_owners(const std::vector<std::string>& arg
return true;
}
//----------------------------------------------------------------------------------------------------
bool simple_wallet::print_lns_owners_to_name_hashes(const std::vector<std::string>& args)
bool simple_wallet::lns_print_owners_to_names(const std::vector<std::string>& args)
{
if (!try_connect_to_daemon())
return false;
@ -6649,7 +6638,7 @@ bool simple_wallet::print_lns_owners_to_name_hashes(const std::vector<std::strin
boost::optional<std::string> failed;
std::string my_key;
cryptonote::COMMAND_RPC_GET_LNS_OWNERS_TO_NAMES::request request = {};
cryptonote::COMMAND_RPC_LNS_OWNERS_TO_NAMES::request request = {};
if (args.size() == 0)
{
my_key = epee::string_tools::pod_to_hex(m_wallet->get_account().get_keys().m_account_address.m_spend_public_key);
@ -6673,14 +6662,14 @@ bool simple_wallet::print_lns_owners_to_name_hashes(const std::vector<std::strin
}
}
std::vector<cryptonote::COMMAND_RPC_GET_LNS_OWNERS_TO_NAMES::response_entry> entries = m_wallet->get_lns_owners_to_names(request, failed);
std::vector<cryptonote::COMMAND_RPC_LNS_OWNERS_TO_NAMES::response_entry> entries = m_wallet->lns_owners_to_names(request, failed);
if (failed)
{
fail_msg_writer() << *failed;
return false;
}
for (cryptonote::COMMAND_RPC_GET_LNS_OWNERS_TO_NAMES::response_entry const &entry : entries)
for (cryptonote::COMMAND_RPC_LNS_OWNERS_TO_NAMES::response_entry const &entry : entries)
{
std::string const *owner = &my_key;
if (args.size()) // If specified owner to look up, retrieve it

View File

@ -174,10 +174,10 @@ namespace cryptonote
bool request_stake_unlock(const std::vector<std::string> &args_);
bool print_locked_stakes(const std::vector<std::string>& /*args*/);
bool query_locked_stakes(bool print_result);
bool buy_lns_mapping(const std::vector<std::string> &args);
bool update_lns_mapping(const std::vector<std::string> &args);
bool print_lns_owners_to_name_hashes(const std::vector<std::string> &args);
bool print_lns_name_to_owners(const std::vector<std::string> &args);
bool lns_buy_mapping(const std::vector<std::string> &args);
bool lns_update_mapping(const std::vector<std::string> &args);
bool lns_print_owners_to_names(const std::vector<std::string> &args);
bool lns_print_name_to_owners(const std::vector<std::string> &args);
enum class sweep_type_t { stake, register_stake, all_or_below, single };
bool sweep_main_internal(sweep_type_t sweep_type, std::vector<tools::wallet2::pending_tx> &ptx_vector, cryptonote::address_parse_info const &dest, bool blink);

View File

@ -406,7 +406,7 @@ std::vector<cryptonote::COMMAND_RPC_GET_SERVICE_NODE_BLACKLISTED_KEY_IMAGES::ent
return result;
}
std::vector<cryptonote::COMMAND_RPC_GET_LNS_OWNERS_TO_NAMES::response_entry> NodeRPCProxy::get_lns_owners_to_names(cryptonote::COMMAND_RPC_GET_LNS_OWNERS_TO_NAMES::request const &request, boost::optional<std::string> &failed) const
std::vector<cryptonote::COMMAND_RPC_LNS_OWNERS_TO_NAMES::response_entry> NodeRPCProxy::lns_owners_to_names(cryptonote::COMMAND_RPC_LNS_OWNERS_TO_NAMES::request const &request, boost::optional<std::string> &failed) const
{
if (m_offline)
{
@ -414,10 +414,10 @@ std::vector<cryptonote::COMMAND_RPC_GET_LNS_OWNERS_TO_NAMES::response_entry> Nod
return {};
}
cryptonote::COMMAND_RPC_GET_LNS_OWNERS_TO_NAMES::response res = {};
cryptonote::COMMAND_RPC_LNS_OWNERS_TO_NAMES::response res = {};
{
std::lock_guard<std::recursive_mutex> lock(m_daemon_rpc_mutex);
bool r = epee::net_utils::invoke_http_json_rpc("/json_rpc", "get_lns_owners_to_names", request, res, m_http_client, rpc_timeout);
bool r = epee::net_utils::invoke_http_json_rpc("/json_rpc", "lns_owners_to_names", request, res, m_http_client, rpc_timeout);
if (!check_invoke(r, res, failed))
return {};
}
@ -425,7 +425,7 @@ std::vector<cryptonote::COMMAND_RPC_GET_LNS_OWNERS_TO_NAMES::response_entry> Nod
return res.entries;
}
std::vector<cryptonote::COMMAND_RPC_GET_LNS_NAMES_TO_OWNERS::response_entry> NodeRPCProxy::get_lns_names_to_owners(cryptonote::COMMAND_RPC_GET_LNS_NAMES_TO_OWNERS::request const &request, boost::optional<std::string> &failed) const
std::vector<cryptonote::COMMAND_RPC_LNS_NAMES_TO_OWNERS::response_entry> NodeRPCProxy::lns_names_to_owners(cryptonote::COMMAND_RPC_LNS_NAMES_TO_OWNERS::request const &request, boost::optional<std::string> &failed) const
{
if (m_offline)
{
@ -433,10 +433,10 @@ std::vector<cryptonote::COMMAND_RPC_GET_LNS_NAMES_TO_OWNERS::response_entry> Nod
return {};
}
cryptonote::COMMAND_RPC_GET_LNS_NAMES_TO_OWNERS::response res = {};
cryptonote::COMMAND_RPC_LNS_NAMES_TO_OWNERS::response res = {};
{
std::lock_guard<std::recursive_mutex> lock(m_daemon_rpc_mutex);
bool r = epee::net_utils::invoke_http_json_rpc("/json_rpc", "get_lns_names_to_owners", request, res, m_http_client, rpc_timeout);
bool r = epee::net_utils::invoke_http_json_rpc("/json_rpc", "lns_names_to_owners", request, res, m_http_client, rpc_timeout);
if (!check_invoke(r, res, failed))
return {};
}

View File

@ -60,8 +60,8 @@ public:
std::vector<cryptonote::COMMAND_RPC_GET_SERVICE_NODES::response::entry> get_all_service_nodes(boost::optional<std::string> &failed) const;
std::vector<cryptonote::COMMAND_RPC_GET_SERVICE_NODES::response::entry> get_contributed_service_nodes(const std::string &contributor, boost::optional<std::string> &failed) const;
std::vector<cryptonote::COMMAND_RPC_GET_SERVICE_NODE_BLACKLISTED_KEY_IMAGES::entry> get_service_node_blacklisted_key_images(boost::optional<std::string> &failed) const;
std::vector<cryptonote::COMMAND_RPC_GET_LNS_OWNERS_TO_NAMES::response_entry> get_lns_owners_to_names(cryptonote::COMMAND_RPC_GET_LNS_OWNERS_TO_NAMES::request const &request, boost::optional<std::string> &failed) const;
std::vector<cryptonote::COMMAND_RPC_GET_LNS_NAMES_TO_OWNERS::response_entry> get_lns_names_to_owners(cryptonote::COMMAND_RPC_GET_LNS_NAMES_TO_OWNERS::request const &request, boost::optional<std::string> &failed) const;
std::vector<cryptonote::COMMAND_RPC_LNS_OWNERS_TO_NAMES::response_entry> lns_owners_to_names(cryptonote::COMMAND_RPC_LNS_OWNERS_TO_NAMES::request const &request, boost::optional<std::string> &failed) const;
std::vector<cryptonote::COMMAND_RPC_LNS_NAMES_TO_OWNERS::response_entry> lns_names_to_owners(cryptonote::COMMAND_RPC_LNS_NAMES_TO_OWNERS::request const &request, boost::optional<std::string> &failed) const;
private:
boost::optional<std::string> get_info() const;

View File

@ -8478,7 +8478,7 @@ static bool prepare_tx_extra_loki_name_system_values(cryptonote::network_type ne
prev_txid = crypto::null_hash;
{
cryptonote::COMMAND_RPC_GET_LNS_NAMES_TO_OWNERS::request request = {};
cryptonote::COMMAND_RPC_LNS_NAMES_TO_OWNERS::request request = {};
{
request.entries.emplace_back();
auto &request_entry = request.entries.back();
@ -8487,7 +8487,7 @@ static bool prepare_tx_extra_loki_name_system_values(cryptonote::network_type ne
}
boost::optional<std::string> failed;
std::vector<cryptonote::COMMAND_RPC_GET_LNS_NAMES_TO_OWNERS::response_entry> response = wallet.get_lns_names_to_owners(request, failed);
std::vector<cryptonote::COMMAND_RPC_LNS_NAMES_TO_OWNERS::response_entry> response = wallet.lns_names_to_owners(request, failed);
if (failed)
{
if (reason) *reason = "Failed to query previous owner for LNS entry, reason=" + *failed;
@ -8512,7 +8512,7 @@ static bool prepare_tx_extra_loki_name_system_values(cryptonote::network_type ne
return true;
}
std::vector<wallet2::pending_tx> wallet2::create_buy_lns_mapping_tx(lns::mapping_type type,
std::vector<wallet2::pending_tx> wallet2::lns_create_buy_mapping_tx(lns::mapping_type type,
std::string const &owner,
std::string const &backup_owner,
std::string const &name,
@ -8582,7 +8582,7 @@ std::vector<wallet2::pending_tx> wallet2::create_buy_lns_mapping_tx(lns::mapping
return result;
}
std::vector<wallet2::pending_tx> wallet2::create_buy_lns_mapping_tx(std::string const &type,
std::vector<wallet2::pending_tx> wallet2::lns_create_buy_mapping_tx(std::string const &type,
std::string const &owner,
std::string const &backup_owner,
std::string const &name,
@ -8596,11 +8596,11 @@ std::vector<wallet2::pending_tx> wallet2::create_buy_lns_mapping_tx(std::string
if (!lns::validate_mapping_type(type, &mapping_type, reason))
return {};
std::vector<wallet2::pending_tx> result = create_buy_lns_mapping_tx(mapping_type, owner, backup_owner, name, value, reason, priority, account_index, subaddr_indices);
std::vector<wallet2::pending_tx> result = lns_create_buy_mapping_tx(mapping_type, owner, backup_owner, name, value, reason, priority, account_index, subaddr_indices);
return result;
}
std::vector<wallet2::pending_tx> wallet2::create_update_lns_mapping_tx(lns::mapping_type type,
std::vector<wallet2::pending_tx> wallet2::lns_create_update_mapping_tx(lns::mapping_type type,
std::string const &name,
std::string const &value,
std::string const *signature,
@ -8653,7 +8653,7 @@ std::vector<wallet2::pending_tx> wallet2::create_update_lns_mapping_tx(lns::mapp
return result;
}
std::vector<wallet2::pending_tx> wallet2::create_update_lns_mapping_tx(std::string const &type,
std::vector<wallet2::pending_tx> wallet2::lns_create_update_mapping_tx(std::string const &type,
std::string const &name,
std::string const &value,
std::string const *signature,
@ -8666,7 +8666,7 @@ std::vector<wallet2::pending_tx> wallet2::create_update_lns_mapping_tx(std::stri
if (!lns::validate_mapping_type(type, &mapping_type, reason))
return {};
std::vector<wallet2::pending_tx> result = create_update_lns_mapping_tx(mapping_type, name, value, signature, reason, priority, account_index, subaddr_indices);
std::vector<wallet2::pending_tx> result = lns_create_update_mapping_tx(mapping_type, name, value, signature, reason, priority, account_index, subaddr_indices);
return result;
}

View File

@ -1023,8 +1023,8 @@ private:
std::vector<cryptonote::COMMAND_RPC_GET_SERVICE_NODES::response::entry> get_all_service_nodes(boost::optional<std::string> &failed) const { return m_node_rpc_proxy.get_all_service_nodes(failed); }
std::vector<cryptonote::COMMAND_RPC_GET_SERVICE_NODES::response::entry> get_service_nodes (std::vector<std::string> const &pubkeys, boost::optional<std::string> &failed) const { return m_node_rpc_proxy.get_service_nodes(pubkeys, failed); }
std::vector<cryptonote::COMMAND_RPC_GET_SERVICE_NODE_BLACKLISTED_KEY_IMAGES::entry> get_service_node_blacklisted_key_images(boost::optional<std::string> &failed) const { return m_node_rpc_proxy.get_service_node_blacklisted_key_images(failed); }
std::vector<cryptonote::COMMAND_RPC_GET_LNS_OWNERS_TO_NAMES::response_entry> get_lns_owners_to_names(cryptonote::COMMAND_RPC_GET_LNS_OWNERS_TO_NAMES::request const &request, boost::optional<std::string> &failed) const { return m_node_rpc_proxy.get_lns_owners_to_names(request, failed); }
std::vector<cryptonote::COMMAND_RPC_GET_LNS_NAMES_TO_OWNERS::response_entry> get_lns_names_to_owners(cryptonote::COMMAND_RPC_GET_LNS_NAMES_TO_OWNERS::request const &request, boost::optional<std::string> &failed) const { return m_node_rpc_proxy.get_lns_names_to_owners(request, failed); }
std::vector<cryptonote::COMMAND_RPC_LNS_OWNERS_TO_NAMES::response_entry> lns_owners_to_names(cryptonote::COMMAND_RPC_LNS_OWNERS_TO_NAMES::request const &request, boost::optional<std::string> &failed) const { return m_node_rpc_proxy.lns_owners_to_names(request, failed); }
std::vector<cryptonote::COMMAND_RPC_LNS_NAMES_TO_OWNERS::response_entry> lns_names_to_owners(cryptonote::COMMAND_RPC_LNS_NAMES_TO_OWNERS::request const &request, boost::optional<std::string> &failed) const { return m_node_rpc_proxy.lns_names_to_owners(request, failed); }
uint64_t get_blockchain_current_height() const { return m_light_wallet_blockchain_height ? m_light_wallet_blockchain_height : m_blockchain.size(); }
void rescan_spent();
@ -1538,13 +1538,13 @@ private:
pending_tx ptx;
};
request_stake_unlock_result can_request_stake_unlock(const crypto::public_key &sn_key);
std::vector<wallet2::pending_tx> create_buy_lns_mapping_tx(lns::mapping_type type, std::string const &owner, std::string const &backup_owner, std::string const &name, std::string const &value, std::string *reason, uint32_t priority = 0, uint32_t account_index = 0, std::set<uint32_t> subaddr_indices = {});
std::vector<wallet2::pending_tx> create_buy_lns_mapping_tx(std::string const &type, std::string const &owner, std::string const &backup_owner, std::string const &name, std::string const &value, std::string *reason, uint32_t priority = 0, uint32_t account_index = 0, std::set<uint32_t> subaddr_indices = {});
std::vector<wallet2::pending_tx> lns_create_buy_mapping_tx(lns::mapping_type type, std::string const &owner, std::string const &backup_owner, std::string const &name, std::string const &value, std::string *reason, uint32_t priority = 0, uint32_t account_index = 0, std::set<uint32_t> subaddr_indices = {});
std::vector<wallet2::pending_tx> lns_create_buy_mapping_tx(std::string const &type, std::string const &owner, std::string const &backup_owner, std::string const &name, std::string const &value, std::string *reason, uint32_t priority = 0, uint32_t account_index = 0, std::set<uint32_t> subaddr_indices = {});
// signature: (Optional) If set, use the signature given, otherwise by default derive the signature from the wallet spend key as an ed25519 key.
// The signature is derived from the hash of the previous txid blob and previous value blob of the mapping. By default this is signed using the wallet's spend key as an ed25519 keypair.
std::vector<wallet2::pending_tx> create_update_lns_mapping_tx(lns::mapping_type type, std::string const &name, std::string const &value, std::string const *signature, std::string *reason, uint32_t priority = 0, uint32_t account_index = 0, std::set<uint32_t> subaddr_indices = {});
std::vector<wallet2::pending_tx> create_update_lns_mapping_tx(std::string const &type, std::string const &name, std::string const &value, std::string const *signature, std::string *reason, uint32_t priority = 0, uint32_t account_index = 0, std::set<uint32_t> subaddr_indices = {});
std::vector<wallet2::pending_tx> lns_create_update_mapping_tx(lns::mapping_type type, std::string const &name, std::string const &value, std::string const *signature, std::string *reason, uint32_t priority = 0, uint32_t account_index = 0, std::set<uint32_t> subaddr_indices = {});
std::vector<wallet2::pending_tx> lns_create_update_mapping_tx(std::string const &type, std::string const &name, std::string const &value, std::string const *signature, std::string *reason, uint32_t priority = 0, uint32_t account_index = 0, std::set<uint32_t> subaddr_indices = {});
void freeze(size_t idx);
void thaw(size_t idx);

View File

@ -46,7 +46,6 @@ using namespace epee;
#include "cryptonote_basic/cryptonote_format_utils.h"
#include "cryptonote_basic/account.h"
#include "multisig/multisig.h"
#include "wallet_rpc_server_commands_defs.h"
#include "misc_language.h"
#include "string_coding.h"
#include "string_tools.h"
@ -4280,7 +4279,7 @@ namespace tools
return res.unlocked;
}
bool wallet_rpc_server::on_buy_lns_mapping(const wallet_rpc::COMMAND_RPC_BUY_LNS_MAPPING::request& req, wallet_rpc::COMMAND_RPC_BUY_LNS_MAPPING::response& res, epee::json_rpc::error& er, const connection_context *ctx)
bool wallet_rpc_server::on_lns_buy_mapping(const wallet_rpc::COMMAND_RPC_LNS_BUY_MAPPING::request& req, wallet_rpc::COMMAND_RPC_LNS_BUY_MAPPING::response& res, epee::json_rpc::error& er, const connection_context *ctx)
{
if (!m_wallet) return not_open(er);
if (m_restricted)
@ -4291,7 +4290,7 @@ namespace tools
}
std::string reason;
std::vector<wallet2::pending_tx> ptx_vector = m_wallet->create_buy_lns_mapping_tx(req.type,
std::vector<wallet2::pending_tx> ptx_vector = m_wallet->lns_create_buy_mapping_tx(req.type,
req.owner,
req.backup_owner,
req.name,
@ -4324,7 +4323,7 @@ namespace tools
er);
}
bool wallet_rpc_server::on_update_lns_mapping(const wallet_rpc::COMMAND_RPC_UPDATE_LNS_MAPPING::request &req, wallet_rpc::COMMAND_RPC_UPDATE_LNS_MAPPING::response &res, epee::json_rpc::error &er, const connection_context *ctx)
bool wallet_rpc_server::on_lns_update_mapping(const wallet_rpc::COMMAND_RPC_LNS_UPDATE_MAPPING::request &req, wallet_rpc::COMMAND_RPC_LNS_UPDATE_MAPPING::response &res, epee::json_rpc::error &er, const connection_context *ctx)
{
if (!m_wallet) return not_open(er);
if (m_restricted)
@ -4336,7 +4335,7 @@ namespace tools
std::string reason;
std::vector<wallet2::pending_tx> ptx_vector =
m_wallet->create_update_lns_mapping_tx(req.type,
m_wallet->lns_create_update_mapping_tx(req.type,
req.name,
req.value,
req.signature.empty() ? nullptr : &req.signature,

View File

@ -164,8 +164,8 @@ namespace tools
MAP_JON_RPC_WE("register_service_node", on_register_service_node, wallet_rpc::COMMAND_RPC_REGISTER_SERVICE_NODE)
MAP_JON_RPC_WE("can_request_stake_unlock", on_can_request_stake_unlock, wallet_rpc::COMMAND_RPC_CAN_REQUEST_STAKE_UNLOCK)
MAP_JON_RPC_WE("request_stake_unlock", on_request_stake_unlock, wallet_rpc::COMMAND_RPC_REQUEST_STAKE_UNLOCK)
MAP_JON_RPC_WE("buy_lns_mapping", on_buy_lns_mapping, wallet_rpc::COMMAND_RPC_BUY_LNS_MAPPING)
MAP_JON_RPC_WE("update_lns_mapping", on_update_lns_mapping, wallet_rpc::COMMAND_RPC_UPDATE_LNS_MAPPING)
MAP_JON_RPC_WE("lns_buy_mapping", on_lns_buy_mapping, wallet_rpc::COMMAND_RPC_LNS_BUY_MAPPING)
MAP_JON_RPC_WE("lns_update_mapping", on_lns_update_mapping, wallet_rpc::COMMAND_RPC_LNS_UPDATE_MAPPING)
END_JSON_RPC_MAP()
END_URI_MAP2()
@ -256,8 +256,8 @@ namespace tools
bool on_register_service_node(const wallet_rpc::COMMAND_RPC_REGISTER_SERVICE_NODE::request& req, wallet_rpc::COMMAND_RPC_REGISTER_SERVICE_NODE::response& res, epee::json_rpc::error& er, const connection_context *ctx = NULL);
bool on_can_request_stake_unlock(const wallet_rpc::COMMAND_RPC_CAN_REQUEST_STAKE_UNLOCK::request& req, wallet_rpc::COMMAND_RPC_CAN_REQUEST_STAKE_UNLOCK::response& res, epee::json_rpc::error& er, const connection_context *ctx = NULL);
bool on_request_stake_unlock(const wallet_rpc::COMMAND_RPC_REQUEST_STAKE_UNLOCK::request& req, wallet_rpc::COMMAND_RPC_REQUEST_STAKE_UNLOCK::response& res, epee::json_rpc::error& er, const connection_context *ctx = NULL);
bool on_buy_lns_mapping(const wallet_rpc::COMMAND_RPC_BUY_LNS_MAPPING::request& req, wallet_rpc::COMMAND_RPC_BUY_LNS_MAPPING::response& res, epee::json_rpc::error& er, const connection_context *ctx = NULL);
bool on_update_lns_mapping(const wallet_rpc::COMMAND_RPC_UPDATE_LNS_MAPPING::request& req, wallet_rpc::COMMAND_RPC_UPDATE_LNS_MAPPING::response& res, epee::json_rpc::error& er, const connection_context *ctx = NULL);
bool on_lns_buy_mapping(const wallet_rpc::COMMAND_RPC_LNS_BUY_MAPPING::request& req, wallet_rpc::COMMAND_RPC_LNS_BUY_MAPPING::response& res, epee::json_rpc::error& er, const connection_context *ctx = NULL);
bool on_lns_update_mapping(const wallet_rpc::COMMAND_RPC_LNS_UPDATE_MAPPING::request& req, wallet_rpc::COMMAND_RPC_LNS_UPDATE_MAPPING::response& res, epee::json_rpc::error& er, const connection_context *ctx = NULL);
//json rpc v2
bool on_query_key(const wallet_rpc::COMMAND_RPC_QUERY_KEY::request& req, wallet_rpc::COMMAND_RPC_QUERY_KEY::response& res, epee::json_rpc::error& er, const connection_context *ctx = NULL);

View File

@ -2854,19 +2854,17 @@ namespace wallet_rpc
};
LOKI_RPC_DOC_INTROSPECT
struct COMMAND_RPC_BUY_LNS_MAPPING
struct COMMAND_RPC_LNS_BUY_MAPPING
{
static constexpr char const description[] =
static constexpr const char *description =
R"(Buy a Loki Name System mapping. Loki Name System allows multiple owners that are authorised to update the underlying mapping. By default if no owner is specified, the purchasing wallet's public spend key is set as the owner.
- For Session, the recommended owner is the ed25519 public key of the user's Session ID set to ed_owner
- For Session, the recommended owner is the ed25519 public key of the user's Session ID set to owner
In future, support for mappings on Blockchain wallets and Lokinet addresses will be available. Tentatively,
- for Wallets, the recommended owner is the monero ed25519 public key of the user's wallet spend key set to loki_owner
- for Lokinet, the recommended default owner is the ed25519 public key of the user's Lokinet key set to ed_owner
In future, support for mappings on Blockchain wallets and Lokinet addresses will be available. The recommended owner is the monero ed25519 public key of the user's wallet spend key set to owner.
When specifying owners, either a Monero twist or standard ed25519 public key is supported per mapping. Updating the value that a name maps to requires one of the owner keys to sign the update transaction.
For information on updating & signing, refer to COMMAND_RPC_UPDATE_LNS_MAPPING)";
For information on updating & signing, refer to COMMAND_RPC_LNS_UPDATE_MAPPING)";
struct request_t
{
@ -2886,8 +2884,8 @@ For information on updating & signing, refer to COMMAND_RPC_UPDATE_LNS_MAPPING)"
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE (type);
KV_SERIALIZE_OPT(owner, std::string(""));
KV_SERIALIZE_OPT(backup_owner, std::string(""));
KV_SERIALIZE (owner);
KV_SERIALIZE (backup_owner);
KV_SERIALIZE (name);
KV_SERIALIZE (value);
KV_SERIALIZE_OPT(account_index, (uint32_t)0);
@ -2928,9 +2926,9 @@ For information on updating & signing, refer to COMMAND_RPC_UPDATE_LNS_MAPPING)"
LOKI_RPC_DOC_INTROSPECT
// Update the underlying value in the name->value mapping via Loki Name Service.
struct COMMAND_RPC_UPDATE_LNS_MAPPING
struct COMMAND_RPC_LNS_UPDATE_MAPPING
{
static constexpr char const description[] =
static constexpr const char *description =
R"(Update a Loki Name System mapping's underlying value. The owner (public key) of the mapping must be able to validate.
The signature is generated from signing a hash generated by using Libsodium's generichash on the {prev_txid field (in the current mapping to update), value (new value to update to)} in binary.
@ -2944,8 +2942,10 @@ Providing the signature is an optional field and if not provided, will default t
{
std::string type; // The mapping type, currently we only support "session". In future "lokinet" and "blockchain" mappings will be available.
std::string name; // The name to update via Loki Name Service
std::string value; // The new value that the name maps to via Loki Name Service, (i.e. For Session: [display name->session public key]. In future, for wallets: [name->wallet address], for Lokinet: [name->domain name]).
std::string signature; // (Optional): Signature derived using libsodium generichash on {current txid blob, new value blob} of the mapping to update. By default the hash is signed using the wallet's spend key if signature is not specified.
std::string value; // (Optional): The new value that the name maps to via Loki Name Service. If not specified or given the empty string "", then the mapping's value remains unchanged.
std::string owner; // (Optional): The new owner of the mapping. If not specified or given the empty string "", then the mapping's owner remains unchanged.
std::string backup_owner; // (Optional): The new backup owner of the mapping. If not specified or given the empty string "", then the mapping's backup owner remains unchanged.
std::string signature; // (Optional): Signature derived using libsodium generichash on {current txid blob, new value blob} of the mapping to update. By default the hash is signed using the wallet's spend key as an ed25519 keypair, if signature is specified.
uint32_t account_index; // (Optional) Transfer from this account index. (Defaults to 0)
std::set<uint32_t> subaddr_indices; // (Optional) Transfer from this set of subaddresses. (Defaults to 0)
@ -2959,7 +2959,9 @@ Providing the signature is an optional field and if not provided, will default t
KV_SERIALIZE (type);
KV_SERIALIZE (name);
KV_SERIALIZE (value);
KV_SERIALIZE_OPT(signature, std::string(""));
KV_SERIALIZE (owner);
KV_SERIALIZE (backup_owner);
KV_SERIALIZE (signature);
KV_SERIALIZE_OPT(account_index, (uint32_t)0);
KV_SERIALIZE_OPT(subaddr_indices, {});
@ -2997,5 +2999,44 @@ Providing the signature is an optional field and if not provided, will default t
typedef epee::misc_utils::struct_init<response_t> response;
};
LOKI_RPC_DOC_INTROSPECT
struct COMMAND_RPC_LNS_MAKE_UPDATE_SIGNATURE
{
static constexpr const char *description =
R"(Generate the signature necessary for updating the requested record using the wallet's spend key. The signature is
only valid if the queried wallet is one of the owners of the LNS record.
This command is only required if the open wallet is one of the owners of a LNS record but want the update
transaction to occur via another non-owning wallet. By default, if no signature is specified to the update
transaction, the open wallet is assumed the owner and it's spend key will automatically be used.)";
struct request_t
{
std::string type; // The mapping type, currently we only support "session". In future "lokinet" and "blockchain" mappings will be available.
std::string name; // The desired name to update via Loki Name Service
std::string value; // (Optional): The new value that the name maps to via Loki Name Service. If not specified or given the empty string "", then the mapping's value remains unchanged.
std::string owner; // (Optional): The new owner of the mapping. If not specified or given the empty string "", then the mapping's owner remains unchanged.
std::string backup_owner; // (Optional): The new backup owner of the mapping. If not specified or given the empty string "", then the mapping's backup owner remains unchanged.
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(type);
KV_SERIALIZE(name);
KV_SERIALIZE(value);
KV_SERIALIZE(owner);
KV_SERIALIZE(backup_owner);
END_KV_SERIALIZE_MAP()
};
typedef epee::misc_utils::struct_init<request_t> request;
struct response_t
{
std::string signature; // A signature valid for using in LNS to update an underlying mapping.
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(signature)
END_KV_SERIALIZE_MAP()
};
typedef epee::misc_utils::struct_init<response_t> response;
};
}
}