wallet: add source info to describe_transfer RPC

This commit is contained in:
jeffro256
2026-01-15 12:44:54 -06:00
parent 4286fbe6cd
commit 7a2ba648f4
2 changed files with 27 additions and 4 deletions
+9 -3
View File
@@ -1529,7 +1529,7 @@ namespace tools
for (size_t n = 0; n < tx_constructions.size(); ++n)
{
const tools::wallet2::tx_construction_data &cd = tx_constructions[n];
res.desc.push_back({0, 0, std::numeric_limits<uint32_t>::max(), 0, {}, "", 0, "", 0, 0, ""});
res.desc.push_back({0, 0, std::numeric_limits<uint32_t>::max(), 0, {}, {}, "", 0, "", 0, 0, ""});
wallet_rpc::COMMAND_RPC_DESCRIBE_TRANSFER::transfer_description &desc = res.desc.back();
// Clear the recipients collection ready for this loop iteration
tx_dests.clear();
@@ -1560,8 +1560,14 @@ namespace tools
for (size_t s = 0; s < cd.sources.size(); ++s)
{
desc.amount_in += cd.sources[s].amount;
size_t ring_size = cd.sources[s].outputs.size();
const cryptonote::tx_source_entry &src_in = cd.sources[s];
wallet_rpc::COMMAND_RPC_DESCRIBE_TRANSFER::source &src_out = desc.sources.emplace_back();
src_out.amount = src_in.amount;
src_out.global_index = src_in.outputs.at(src_in.real_output_in_tx_index).first;
src_out.rct = src_in.rct;
src_out.pubkey = epee::string_tools::pod_to_hex(src_in.outputs.at(src_in.real_output_in_tx_index).second);
desc.amount_in += src_in.amount;
size_t ring_size = src_in.outputs.size();
if (ring_size < desc.ring_size)
desc.ring_size = ring_size;
}
+18 -1
View File
@@ -47,7 +47,7 @@
// advance which version they will stop working with
// Don't go over 32767 for any of these
#define WALLET_RPC_VERSION_MAJOR 1
#define WALLET_RPC_VERSION_MINOR 29
#define WALLET_RPC_VERSION_MINOR 30
#define MAKE_WALLET_RPC_VERSION(major,minor) (((major)<<16)|(minor))
#define WALLET_RPC_VERSION MAKE_WALLET_RPC_VERSION(WALLET_RPC_VERSION_MAJOR, WALLET_RPC_VERSION_MINOR)
namespace tools
@@ -698,6 +698,21 @@ namespace wallet_rpc
struct COMMAND_RPC_DESCRIBE_TRANSFER
{
struct source
{
uint64_t amount;
uint64_t global_index;
bool rct;
std::string pubkey;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(amount)
KV_SERIALIZE(global_index)
KV_SERIALIZE(rct)
KV_SERIALIZE(pubkey)
END_KV_SERIALIZE_MAP()
};
struct recipient
{
std::string address;
@@ -715,6 +730,7 @@ namespace wallet_rpc
uint64_t amount_out;
uint32_t ring_size;
uint64_t unlock_time;
std::list<source> sources;
std::list<recipient> recipients;
std::string payment_id;
uint64_t change_amount;
@@ -728,6 +744,7 @@ namespace wallet_rpc
KV_SERIALIZE(amount_out)
KV_SERIALIZE(ring_size)
KV_SERIALIZE(unlock_time)
KV_SERIALIZE(sources)
KV_SERIALIZE(recipients)
KV_SERIALIZE(payment_id)
KV_SERIALIZE(change_amount)