Merge pull request #5750
884df82
wallet: provide original address for outgoing transfers (xiphon)
This commit is contained in:
commit
1bd3f1a1fb
|
@ -83,6 +83,21 @@ namespace cryptonote
|
||||||
tx_destination_entry(uint64_t a, const account_public_address &ad, bool is_subaddress) : amount(a), addr(ad), is_subaddress(is_subaddress), is_integrated(false) { }
|
tx_destination_entry(uint64_t a, const account_public_address &ad, bool is_subaddress) : amount(a), addr(ad), is_subaddress(is_subaddress), is_integrated(false) { }
|
||||||
tx_destination_entry(const std::string &o, uint64_t a, const account_public_address &ad, bool is_subaddress) : original(o), amount(a), addr(ad), is_subaddress(is_subaddress), is_integrated(false) { }
|
tx_destination_entry(const std::string &o, uint64_t a, const account_public_address &ad, bool is_subaddress) : original(o), amount(a), addr(ad), is_subaddress(is_subaddress), is_integrated(false) { }
|
||||||
|
|
||||||
|
std::string address(network_type nettype, const crypto::hash &payment_id) const
|
||||||
|
{
|
||||||
|
if (!original.empty())
|
||||||
|
{
|
||||||
|
return original;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_integrated)
|
||||||
|
{
|
||||||
|
return get_account_integrated_address_as_str(nettype, addr, reinterpret_cast<const crypto::hash8 &>(payment_id));
|
||||||
|
}
|
||||||
|
|
||||||
|
return get_account_address_as_str(nettype, is_subaddress, addr);
|
||||||
|
}
|
||||||
|
|
||||||
BEGIN_SERIALIZE_OBJECT()
|
BEGIN_SERIALIZE_OBJECT()
|
||||||
FIELD(original)
|
FIELD(original)
|
||||||
VARINT_FIELD(amount)
|
VARINT_FIELD(amount)
|
||||||
|
|
|
@ -7820,7 +7820,7 @@ bool simple_wallet::get_transfers(std::vector<std::string>& local_args, std::vec
|
||||||
uint64_t fee = pd.m_amount_in - pd.m_amount_out;
|
uint64_t fee = pd.m_amount_in - pd.m_amount_out;
|
||||||
std::vector<std::pair<std::string, uint64_t>> destinations;
|
std::vector<std::pair<std::string, uint64_t>> destinations;
|
||||||
for (const auto &d: pd.m_dests) {
|
for (const auto &d: pd.m_dests) {
|
||||||
destinations.push_back({get_account_address_as_str(m_wallet->nettype(), d.is_subaddress, d.addr), d.amount});
|
destinations.push_back({d.address(m_wallet->nettype(), pd.m_payment_id), d.amount});
|
||||||
}
|
}
|
||||||
std::string payment_id = string_tools::pod_to_hex(i->second.m_payment_id);
|
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)
|
if (payment_id.substr(16).find_first_not_of('0') == std::string::npos)
|
||||||
|
@ -7896,7 +7896,7 @@ bool simple_wallet::get_transfers(std::vector<std::string>& local_args, std::vec
|
||||||
uint64_t fee = amount - pd.m_amount_out;
|
uint64_t fee = amount - pd.m_amount_out;
|
||||||
std::vector<std::pair<std::string, uint64_t>> destinations;
|
std::vector<std::pair<std::string, uint64_t>> destinations;
|
||||||
for (const auto &d: pd.m_dests) {
|
for (const auto &d: pd.m_dests) {
|
||||||
destinations.push_back({get_account_address_as_str(m_wallet->nettype(), d.is_subaddress, d.addr), d.amount});
|
destinations.push_back({d.address(m_wallet->nettype(), pd.m_payment_id), d.amount});
|
||||||
}
|
}
|
||||||
std::string payment_id = string_tools::pod_to_hex(i->second.m_payment_id);
|
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)
|
if (payment_id.substr(16).find_first_not_of('0') == std::string::npos)
|
||||||
|
@ -9371,7 +9371,7 @@ bool simple_wallet::show_transfer(const std::vector<std::string> &args)
|
||||||
for (const auto &d: pd.m_dests) {
|
for (const auto &d: pd.m_dests) {
|
||||||
if (!dests.empty())
|
if (!dests.empty())
|
||||||
dests += ", ";
|
dests += ", ";
|
||||||
dests += get_account_address_as_str(m_wallet->nettype(), d.is_subaddress, d.addr) + ": " + print_money(d.amount);
|
dests += d.address(m_wallet->nettype(), pd.m_payment_id) + ": " + print_money(d.amount);
|
||||||
}
|
}
|
||||||
std::string payment_id = string_tools::pod_to_hex(i->second.m_payment_id);
|
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)
|
if (payment_id.substr(16).find_first_not_of('0') == std::string::npos)
|
||||||
|
|
|
@ -181,7 +181,7 @@ void TransactionHistoryImpl::refresh()
|
||||||
|
|
||||||
// single output transaction might contain multiple transfers
|
// single output transaction might contain multiple transfers
|
||||||
for (const auto &d: pd.m_dests) {
|
for (const auto &d: pd.m_dests) {
|
||||||
ti->m_transfers.push_back({d.amount, get_account_address_as_str(m_wallet->m_wallet->nettype(), d.is_subaddress, d.addr)});
|
ti->m_transfers.push_back({d.amount, d.address(m_wallet->m_wallet->nettype(), pd.m_payment_id)});
|
||||||
}
|
}
|
||||||
m_history.push_back(ti);
|
m_history.push_back(ti);
|
||||||
}
|
}
|
||||||
|
|
|
@ -352,7 +352,7 @@ namespace tools
|
||||||
entry.destinations.push_back(wallet_rpc::transfer_destination());
|
entry.destinations.push_back(wallet_rpc::transfer_destination());
|
||||||
wallet_rpc::transfer_destination &td = entry.destinations.back();
|
wallet_rpc::transfer_destination &td = entry.destinations.back();
|
||||||
td.amount = d.amount;
|
td.amount = d.amount;
|
||||||
td.address = d.original.empty() ? get_account_address_as_str(m_wallet->nettype(), d.is_subaddress, d.addr) : d.original;
|
td.address = d.address(m_wallet->nettype(), pd.m_payment_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
entry.type = "out";
|
entry.type = "out";
|
||||||
|
@ -382,7 +382,7 @@ namespace tools
|
||||||
entry.destinations.push_back(wallet_rpc::transfer_destination());
|
entry.destinations.push_back(wallet_rpc::transfer_destination());
|
||||||
wallet_rpc::transfer_destination &td = entry.destinations.back();
|
wallet_rpc::transfer_destination &td = entry.destinations.back();
|
||||||
td.amount = d.amount;
|
td.amount = d.amount;
|
||||||
td.address = d.original.empty() ? get_account_address_as_str(m_wallet->nettype(), d.is_subaddress, d.addr) : d.original;
|
td.address = d.address(m_wallet->nettype(), pd.m_payment_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
entry.type = is_failed ? "failed" : "pending";
|
entry.type = is_failed ? "failed" : "pending";
|
||||||
|
|
Loading…
Reference in New Issue