payment_id added to details of unsigned raw tx

master
moneroexamples 8 years ago
parent 82494c229d
commit c193e8adeb

@ -1342,10 +1342,24 @@ namespace xmreg {
const tx_destination_entry& tx_change = tx_cd.change_dts;
crypto::hash payment_id = null_hash;
crypto::hash8 payment_id8 = null_hash8;
get_payment_id(tx_cd.extra, payment_id, payment_id8);
// payments id. both normal and encrypted (payment_id8)
string pid_str = REMOVE_HASH_BRAKETS(fmt::format("{:s}", payment_id));
string pid8_str = REMOVE_HASH_BRAKETS(fmt::format("{:s}", payment_id8));
mstch::map tx_cd_data {
{"no_of_sources" , no_of_sources},
{"use_rct" , tx_cd.use_rct},
{"change_amount" , fmt::format("{:0.12f}", XMR_AMOUNT(tx_change.amount))},
{"has_payment_id" , (payment_id != null_hash)},
{"has_payment_id8" , (payment_id8 != null_hash8)},
{"payment_id" , pid_str},
{"payment_id8" , pid8_str},
{"dest_sources" , mstch::array{}},
{"dest_infos" , mstch::array{}},
};

@ -27,11 +27,19 @@
{{#txs}}
<div class="center" style="width: 100%; margin-top:10px">
<h4>Destination information</h4>
<h4>Basic information</h4>
<div class="center" style="width: 100%;">
{{#dest_infos}}
Send {{dest_amount}} to {{dest_address}}<br/>
{{/dest_infos}}
{{#has_payment_id}}
Payment id: {{payment_id}}<br/>
{{/has_payment_id}}
{{#has_payment_id8}}
Payment id (encrypted): {{payment_id8}}<br/>
{{/has_payment_id8}}
</div>
<h3>

@ -472,18 +472,18 @@ namespace xmreg
return key_images;
}
bool
get_payment_id(const transaction& tx,
get_payment_id(const vector<uint8_t>& extra,
crypto::hash& payment_id,
crypto::hash8& payment_id8)
{
payment_id = null_hash;
payment_id8 = null_hash8;
std::vector<tx_extra_field> tx_extra_fields;
if(!parse_tx_extra(tx.extra, tx_extra_fields))
if(!parse_tx_extra(extra, tx_extra_fields))
{
return false;
}
@ -492,7 +492,7 @@ namespace xmreg
if (find_tx_extra_field_by_type(tx_extra_fields, extra_nonce))
{
// first check for encripted id and then for normal one
// first check for encrypted id and then for normal one
if(get_encrypted_payment_id_from_tx_extra_nonce(extra_nonce.nonce, payment_id8))
{
return true;
@ -507,6 +507,15 @@ namespace xmreg
}
bool
get_payment_id(const transaction& tx,
crypto::hash& payment_id,
crypto::hash8& payment_id8)
{
return get_payment_id(tx.extra, payment_id, payment_id8);
}
/**
* Rough estimate of block height from the time provided
*

@ -163,6 +163,11 @@ namespace xmreg
get_key_images(const transaction& tx);
bool
get_payment_id(const vector<uint8_t>& extra,
crypto::hash& payment_id,
crypto::hash8& payment_id8);
bool
get_payment_id(const transaction& tx,
crypto::hash& payment_id,

Loading…
Cancel
Save