wallet: add source info to describe_transfer RPC

This commit is contained in:
jeffro256
2026-03-24 08:57:12 -05:00
parent 23b420a992
commit 7a4825b062
2 changed files with 28 additions and 4 deletions
+10 -3
View File
@@ -1517,7 +1517,7 @@ namespace tools
for (size_t n = 0; n < tx_constructions.size(); ++n) for (size_t n = 0; n < tx_constructions.size(); ++n)
{ {
const tools::wallet2::tx_construction_data &cd = tx_constructions[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(); wallet_rpc::COMMAND_RPC_DESCRIBE_TRANSFER::transfer_description &desc = res.desc.back();
// Clear the recipients collection ready for this loop iteration // Clear the recipients collection ready for this loop iteration
tx_dests.clear(); tx_dests.clear();
@@ -1548,8 +1548,15 @@ namespace tools
for (size_t s = 0; s < cd.sources.size(); ++s) for (size_t s = 0; s < cd.sources.size(); ++s)
{ {
desc.amount_in += cd.sources[s].amount; const cryptonote::tx_source_entry &src_in = cd.sources[s];
size_t ring_size = cd.sources[s].outputs.size(); desc.sources.emplace_back();
wallet_rpc::COMMAND_RPC_DESCRIBE_TRANSFER::source &src_out = desc.sources.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) if (ring_size < desc.ring_size)
desc.ring_size = ring_size; desc.ring_size = ring_size;
} }
+18 -1
View File
@@ -47,7 +47,7 @@
// advance which version they will stop working with // advance which version they will stop working with
// Don't go over 32767 for any of these // Don't go over 32767 for any of these
#define WALLET_RPC_VERSION_MAJOR 1 #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 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) #define WALLET_RPC_VERSION MAKE_WALLET_RPC_VERSION(WALLET_RPC_VERSION_MAJOR, WALLET_RPC_VERSION_MINOR)
namespace tools namespace tools
@@ -698,6 +698,21 @@ namespace wallet_rpc
struct COMMAND_RPC_DESCRIBE_TRANSFER 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 struct recipient
{ {
std::string address; std::string address;
@@ -715,6 +730,7 @@ namespace wallet_rpc
uint64_t amount_out; uint64_t amount_out;
uint32_t ring_size; uint32_t ring_size;
uint64_t unlock_time; uint64_t unlock_time;
std::list<source> sources;
std::list<recipient> recipients; std::list<recipient> recipients;
std::string payment_id; std::string payment_id;
uint64_t change_amount; uint64_t change_amount;
@@ -728,6 +744,7 @@ namespace wallet_rpc
KV_SERIALIZE(amount_out) KV_SERIALIZE(amount_out)
KV_SERIALIZE(ring_size) KV_SERIALIZE(ring_size)
KV_SERIALIZE(unlock_time) KV_SERIALIZE(unlock_time)
KV_SERIALIZE(sources)
KV_SERIALIZE(recipients) KV_SERIALIZE(recipients)
KV_SERIALIZE(payment_id) KV_SERIALIZE(payment_id)
KV_SERIALIZE(change_amount) KV_SERIALIZE(change_amount)