mirror of https://github.com/oxen-io/oxen-core.git
Actually add make update signature to simplewallet interface
This commit is contained in:
parent
68782a76df
commit
d7507a65b5
|
@ -3114,6 +3114,11 @@ Pending or Failed: "failed"|"pending", "out", Time, Amount*, Transaction Hash,
|
|||
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."));
|
||||
|
||||
m_cmd_binder.set_handler("lns_make_update_mapping_signature",
|
||||
boost::bind(&simple_wallet::lns_make_update_mapping_signature, this, _1),
|
||||
tr(USAGE_LNS_MAKE_UPDATE_MAPPING_SIGNATURE),
|
||||
tr(tools::wallet_rpc::COMMAND_RPC_LNS_MAKE_UPDATE_SIGNATURE::description));
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
bool simple_wallet::set_variable(const std::vector<std::string> &args)
|
||||
|
@ -6545,12 +6550,12 @@ bool simple_wallet::lns_update_mapping(const std::vector<std::string>& args)
|
|||
return true;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
bool simple_wallet::lns_make_updating_mapping_signature(const std::vector<std::string> &args)
|
||||
bool simple_wallet::lns_make_update_mapping_signature(const std::vector<std::string> &args)
|
||||
{
|
||||
if (!try_connect_to_daemon())
|
||||
return true;
|
||||
|
||||
if (args.size() < 3)
|
||||
if (args.size() < 2)
|
||||
{
|
||||
PRINT_USAGE(USAGE_LNS_MAKE_UPDATE_MAPPING_SIGNATURE);
|
||||
return true;
|
||||
|
|
|
@ -176,7 +176,7 @@ namespace cryptonote
|
|||
bool query_locked_stakes(bool print_result);
|
||||
bool lns_buy_mapping(const std::vector<std::string> &args);
|
||||
bool lns_update_mapping(const std::vector<std::string> &args);
|
||||
bool lns_make_updating_mapping_signature(const std::vector<std::string> &args);
|
||||
bool lns_make_update_mapping_signature(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);
|
||||
|
||||
|
|
|
@ -8700,8 +8700,8 @@ bool wallet2::lns_make_update_mapping_signature(lns::mapping_type type, std::str
|
|||
if (!lns::validate_lns_name(type, name, reason))
|
||||
return false;
|
||||
|
||||
lns::lns_value value_blob;
|
||||
if (!lns::validate_lns_value(nettype(), type, value, &value_blob, reason))
|
||||
lns::mapping_value value_blob;
|
||||
if (!lns::validate_mapping_value(nettype(), type, value, &value_blob, reason))
|
||||
return false;
|
||||
|
||||
boost::optional<std::string> failed;
|
||||
|
@ -8720,13 +8720,13 @@ bool wallet2::lns_make_update_mapping_signature(lns::mapping_type type, std::str
|
|||
|
||||
cryptonote::COMMAND_RPC_LNS_NAMES_TO_OWNERS::response_entry const &record = response[0];
|
||||
crypto::hash prev_txid;
|
||||
if (epee::string_tools::hex_to_pod(response[0].prev_txid, prev_txid))
|
||||
if (!epee::string_tools::hex_to_pod(response[0].prev_txid, prev_txid))
|
||||
{
|
||||
if (reason) *reason = "Failed to convert=" + response[0].prev_txid + std::string(" to a transaction ID.");
|
||||
return false;
|
||||
}
|
||||
|
||||
crypto::hash hash = lns::tx_extra_signature_hash(epee::span<const uint8_t>(value_blob.buffer.data(), value_blob.len), prev_txid);
|
||||
crypto::hash hash = lns::tx_extra_signature_hash(value_blob.to_span(), prev_txid);
|
||||
crypto::generate_signature(hash, get_account().get_keys().m_account_address.m_spend_public_key, get_account().get_keys().m_spend_secret_key, signature.monero);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -3037,39 +3037,5 @@ transaction, the open wallet is assumed the owner and it's spend key will automa
|
|||
};
|
||||
typedef epee::misc_utils::struct_init<response_t> response;
|
||||
};
|
||||
|
||||
LOKI_RPC_DOC_INTROSPECT
|
||||
// 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 COMMAND_RPC_LNS_MAKE_UPDATE_SIGNATURE
|
||||
{
|
||||
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; // The new value that the name will be updated to via Loki Name Service.
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(type);
|
||||
KV_SERIALIZE(name);
|
||||
KV_SERIALIZE(value);
|
||||
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;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue