|
|
@ -1458,9 +1458,9 @@ namespace xmreg
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// parse string representing given monero address
|
|
|
|
// parse string representing given monero address
|
|
|
|
cryptonote::account_public_address address;
|
|
|
|
cryptonote::address_parse_info address_info;
|
|
|
|
|
|
|
|
|
|
|
|
if (!xmreg::parse_str_address(xmr_address_str, address, testnet))
|
|
|
|
if (!xmreg::parse_str_address(xmr_address_str, address_info, testnet))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
cerr << "Cant parse string address: " << xmr_address_str << endl;
|
|
|
|
cerr << "Cant parse string address: " << xmr_address_str << endl;
|
|
|
|
return string("Cant parse xmr address: " + xmr_address_str);
|
|
|
|
return string("Cant parse xmr address: " + xmr_address_str);
|
|
|
@ -1649,7 +1649,7 @@ namespace xmreg
|
|
|
|
// to create, so called, derived key.
|
|
|
|
// to create, so called, derived key.
|
|
|
|
key_derivation derivation;
|
|
|
|
key_derivation derivation;
|
|
|
|
|
|
|
|
|
|
|
|
public_key pub_key = tx_prove ? address.m_view_public_key : txd.pk;
|
|
|
|
public_key pub_key = tx_prove ? address_info.address.m_view_public_key : txd.pk;
|
|
|
|
|
|
|
|
|
|
|
|
//cout << "txd.pk: " << pod_to_hex(txd.pk) << endl;
|
|
|
|
//cout << "txd.pk: " << pod_to_hex(txd.pk) << endl;
|
|
|
|
|
|
|
|
|
|
|
@ -1693,7 +1693,7 @@ namespace xmreg
|
|
|
|
|
|
|
|
|
|
|
|
derive_public_key(derivation,
|
|
|
|
derive_public_key(derivation,
|
|
|
|
output_idx,
|
|
|
|
output_idx,
|
|
|
|
address.m_spend_public_key,
|
|
|
|
address_info.address.m_spend_public_key,
|
|
|
|
tx_pubkey);
|
|
|
|
tx_pubkey);
|
|
|
|
|
|
|
|
|
|
|
|
//cout << pod_to_hex(outp.first.key) << endl;
|
|
|
|
//cout << pod_to_hex(outp.first.key) << endl;
|
|
|
@ -1948,7 +1948,7 @@ namespace xmreg
|
|
|
|
|
|
|
|
|
|
|
|
derive_public_key(derivation,
|
|
|
|
derive_public_key(derivation,
|
|
|
|
output_idx_in_tx,
|
|
|
|
output_idx_in_tx,
|
|
|
|
address.m_spend_public_key,
|
|
|
|
address_info.address.m_spend_public_key,
|
|
|
|
tx_pubkey_generated);
|
|
|
|
tx_pubkey_generated);
|
|
|
|
|
|
|
|
|
|
|
|
// check if generated public key matches the current output's key
|
|
|
|
// check if generated public key matches the current output's key
|
|
|
@ -2239,7 +2239,8 @@ namespace xmreg
|
|
|
|
for (const tx_destination_entry& a_dest: tx_cd.splitted_dsts)
|
|
|
|
for (const tx_destination_entry& a_dest: tx_cd.splitted_dsts)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
mstch::map dest_info {
|
|
|
|
mstch::map dest_info {
|
|
|
|
{"dest_address" , get_account_address_as_str(testnet, a_dest.addr)},
|
|
|
|
{"dest_address" , get_account_address_as_str(
|
|
|
|
|
|
|
|
testnet, a_dest.is_subaddress, a_dest.addr)},
|
|
|
|
{"dest_amount" , xmreg::xmr_amount_to_str(a_dest.amount)}
|
|
|
|
{"dest_amount" , xmreg::xmr_amount_to_str(a_dest.amount)}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -2579,7 +2580,8 @@ namespace xmreg
|
|
|
|
|
|
|
|
|
|
|
|
destination_addresses.push_back(
|
|
|
|
destination_addresses.push_back(
|
|
|
|
mstch::map {
|
|
|
|
mstch::map {
|
|
|
|
{"dest_address" , get_account_address_as_str(testnet, a_dest.addr)},
|
|
|
|
{"dest_address" , get_account_address_as_str(
|
|
|
|
|
|
|
|
testnet, a_dest.is_subaddress, a_dest.addr)},
|
|
|
|
{"dest_amount" , xmreg::xmr_amount_to_str(a_dest.amount)},
|
|
|
|
{"dest_amount" , xmreg::xmr_amount_to_str(a_dest.amount)},
|
|
|
|
{"is_this_change" , false}
|
|
|
|
{"is_this_change" , false}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -2595,8 +2597,10 @@ namespace xmreg
|
|
|
|
{
|
|
|
|
{
|
|
|
|
destination_addresses.push_back(
|
|
|
|
destination_addresses.push_back(
|
|
|
|
mstch::map {
|
|
|
|
mstch::map {
|
|
|
|
{"dest_address" , get_account_address_as_str(testnet, ptx.construction_data.change_dts.addr)},
|
|
|
|
{"dest_address" , get_account_address_as_str(
|
|
|
|
{"dest_amount" , xmreg::xmr_amount_to_str(ptx.construction_data.change_dts.amount)},
|
|
|
|
testnet, ptx.construction_data.change_dts.is_subaddress, ptx.construction_data.change_dts.addr)},
|
|
|
|
|
|
|
|
{"dest_amount" ,
|
|
|
|
|
|
|
|
xmreg::xmr_amount_to_str(ptx.construction_data.change_dts.amount)},
|
|
|
|
{"is_this_change" , true}
|
|
|
|
{"is_this_change" , true}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
);
|
|
|
@ -3101,8 +3105,13 @@ namespace xmreg
|
|
|
|
reinterpret_cast<const account_public_address*>(
|
|
|
|
reinterpret_cast<const account_public_address*>(
|
|
|
|
decoded_raw_data.data());
|
|
|
|
decoded_raw_data.data());
|
|
|
|
|
|
|
|
|
|
|
|
context.insert({"address" , REMOVE_HASH_BRAKETS(xmreg::print_address(*xmr_address, testnet))});
|
|
|
|
address_parse_info address_info {*xmr_address, false};
|
|
|
|
context.insert({"viewkey" , REMOVE_HASH_BRAKETS(fmt::format("{:s}", prv_view_key))});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context.insert({"address" , REMOVE_HASH_BRAKETS(
|
|
|
|
|
|
|
|
xmreg::print_address(address_info, testnet))});
|
|
|
|
|
|
|
|
context.insert({"viewkey" , REMOVE_HASH_BRAKETS(
|
|
|
|
|
|
|
|
fmt::format("{:s}", prv_view_key))});
|
|
|
|
context.insert({"has_total_xmr" , false});
|
|
|
|
context.insert({"has_total_xmr" , false});
|
|
|
|
context.insert({"total_xmr" , string{}});
|
|
|
|
context.insert({"total_xmr" , string{}});
|
|
|
|
context.insert({"key_imgs" , mstch::array{}});
|
|
|
|
context.insert({"key_imgs" , mstch::array{}});
|
|
|
@ -3128,7 +3137,8 @@ namespace xmreg
|
|
|
|
{"key_no" , fmt::format("{:03d}", n)},
|
|
|
|
{"key_no" , fmt::format("{:03d}", n)},
|
|
|
|
{"key_image" , pod_to_hex(key_image)},
|
|
|
|
{"key_image" , pod_to_hex(key_image)},
|
|
|
|
{"signature" , fmt::format("{:s}", signature)},
|
|
|
|
{"signature" , fmt::format("{:s}", signature)},
|
|
|
|
{"address" , xmreg::print_address(*xmr_address, testnet)},
|
|
|
|
{"address" , xmreg::print_address(
|
|
|
|
|
|
|
|
address_info, testnet)},
|
|
|
|
{"is_spent" , core_storage->have_tx_keyimg_as_spent(key_image)},
|
|
|
|
{"is_spent" , core_storage->have_tx_keyimg_as_spent(key_image)},
|
|
|
|
{"tx_hash" , string{}}
|
|
|
|
{"tx_hash" , string{}}
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -3229,8 +3239,12 @@ namespace xmreg
|
|
|
|
reinterpret_cast<const account_public_address*>(
|
|
|
|
reinterpret_cast<const account_public_address*>(
|
|
|
|
decoded_raw_data.data());
|
|
|
|
decoded_raw_data.data());
|
|
|
|
|
|
|
|
|
|
|
|
context.insert({"address" , REMOVE_HASH_BRAKETS(xmreg::print_address(*xmr_address, testnet))});
|
|
|
|
address_parse_info address_info {*xmr_address, false};
|
|
|
|
context.insert({"viewkey" , REMOVE_HASH_BRAKETS(fmt::format("{:s}", prv_view_key))});
|
|
|
|
|
|
|
|
|
|
|
|
context.insert({"address" , REMOVE_HASH_BRAKETS(
|
|
|
|
|
|
|
|
xmreg::print_address(address_info, testnet))});
|
|
|
|
|
|
|
|
context.insert({"viewkey" , REMOVE_HASH_BRAKETS(
|
|
|
|
|
|
|
|
fmt::format("{:s}", prv_view_key))});
|
|
|
|
context.insert({"has_total_xmr" , false});
|
|
|
|
context.insert({"has_total_xmr" , false});
|
|
|
|
context.insert({"total_xmr" , string{}});
|
|
|
|
context.insert({"total_xmr" , string{}});
|
|
|
|
context.insert({"output_keys" , mstch::array{}});
|
|
|
|
context.insert({"output_keys" , mstch::array{}});
|
|
|
@ -3436,47 +3450,48 @@ namespace xmreg
|
|
|
|
if (search_str_length == 95)
|
|
|
|
if (search_str_length == 95)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// parse string representing given monero address
|
|
|
|
// parse string representing given monero address
|
|
|
|
cryptonote::account_public_address address;
|
|
|
|
address_parse_info address_info;
|
|
|
|
|
|
|
|
|
|
|
|
bool testnet_addr {false};
|
|
|
|
bool testnet_addr {false};
|
|
|
|
|
|
|
|
|
|
|
|
if (search_text[0] == '9' || search_text[0] == 'A')
|
|
|
|
if (search_text[0] == '9' || search_text[0] == 'A')
|
|
|
|
testnet_addr = true;
|
|
|
|
testnet_addr = true;
|
|
|
|
|
|
|
|
|
|
|
|
if (!xmreg::parse_str_address(search_text, address, testnet_addr))
|
|
|
|
if (!xmreg::parse_str_address(search_text, address_info, testnet_addr))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
cerr << "Cant parse string address: " << search_text << endl;
|
|
|
|
cerr << "Cant parse string address: " << search_text << endl;
|
|
|
|
return string("Cant parse address (probably incorrect format): ")
|
|
|
|
return string("Cant parse address (probably incorrect format): ")
|
|
|
|
+ search_text;
|
|
|
|
+ search_text;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return show_address_details(address, testnet_addr);
|
|
|
|
return show_address_details(address_info, testnet_addr);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// check if integrated monero address is given based on its length
|
|
|
|
|
|
|
|
// if yes, then show its public components search tx based on encrypted id
|
|
|
|
|
|
|
|
if (search_str_length == 106)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cryptonote::account_public_address address;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool has_payment_id;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
crypto::hash8 encrypted_payment_id;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!get_account_integrated_address_from_str(address,
|
|
|
|
|
|
|
|
has_payment_id,
|
|
|
|
|
|
|
|
encrypted_payment_id,
|
|
|
|
|
|
|
|
testnet,
|
|
|
|
|
|
|
|
search_text))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
cerr << "Cant parse string integerated address: " << search_text << endl;
|
|
|
|
|
|
|
|
return string("Cant parse address (probably incorrect format): ")
|
|
|
|
|
|
|
|
+ search_text;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return show_integrated_address_details(address, encrypted_payment_id, testnet);
|
|
|
|
// // check if integrated monero address is given based on its length
|
|
|
|
}
|
|
|
|
// // if yes, then show its public components search tx based on encrypted id
|
|
|
|
|
|
|
|
// @todo does not work with integrated address for now
|
|
|
|
|
|
|
|
// if (search_str_length == 106)
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// cryptonote::account_public_address address;
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// bool has_payment_id;
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// crypto::hash8 encrypted_payment_id;
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// if (!get_account_integrated_address_from_str(address_info.address,
|
|
|
|
|
|
|
|
// has_payment_id,
|
|
|
|
|
|
|
|
// encrypted_payment_id,
|
|
|
|
|
|
|
|
// testnet,
|
|
|
|
|
|
|
|
// search_text))
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// cerr << "Cant parse string integerated address: " << search_text << endl;
|
|
|
|
|
|
|
|
// return string("Cant parse address (probably incorrect format): ")
|
|
|
|
|
|
|
|
// + search_text;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// return show_integrated_address_details(address_info.address, encrypted_payment_id, testnet);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// all_possible_tx_hashes was field using custom lmdb database
|
|
|
|
// all_possible_tx_hashes was field using custom lmdb database
|
|
|
|
// it was dropped, so all_possible_tx_hashes will be alwasy empty
|
|
|
|
// it was dropped, so all_possible_tx_hashes will be alwasy empty
|
|
|
@ -3489,12 +3504,12 @@ namespace xmreg
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
string
|
|
|
|
string
|
|
|
|
show_address_details(const account_public_address& address, bool testnet = false)
|
|
|
|
show_address_details(const address_parse_info& address_info, bool testnet = false)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
string address_str = xmreg::print_address(address, testnet);
|
|
|
|
string address_str = xmreg::print_address(address_info, testnet);
|
|
|
|
string pub_viewkey_str = fmt::format("{:s}", address.m_view_public_key);
|
|
|
|
string pub_viewkey_str = fmt::format("{:s}", address_info.address.m_view_public_key);
|
|
|
|
string pub_spendkey_str = fmt::format("{:s}", address.m_spend_public_key);
|
|
|
|
string pub_spendkey_str = fmt::format("{:s}", address_info.address.m_spend_public_key);
|
|
|
|
|
|
|
|
|
|
|
|
mstch::map context {
|
|
|
|
mstch::map context {
|
|
|
|
{"xmr_address" , REMOVE_HASH_BRAKETS(address_str)},
|
|
|
|
{"xmr_address" , REMOVE_HASH_BRAKETS(address_str)},
|
|
|
@ -3512,14 +3527,14 @@ namespace xmreg
|
|
|
|
|
|
|
|
|
|
|
|
// ;
|
|
|
|
// ;
|
|
|
|
string
|
|
|
|
string
|
|
|
|
show_integrated_address_details(const account_public_address& address,
|
|
|
|
show_integrated_address_details(const address_parse_info& address_info,
|
|
|
|
const crypto::hash8& encrypted_payment_id,
|
|
|
|
const crypto::hash8& encrypted_payment_id,
|
|
|
|
bool testnet = false)
|
|
|
|
bool testnet = false)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
string address_str = xmreg::print_address(address, testnet);
|
|
|
|
string address_str = xmreg::print_address(address_info, testnet);
|
|
|
|
string pub_viewkey_str = fmt::format("{:s}", address.m_view_public_key);
|
|
|
|
string pub_viewkey_str = fmt::format("{:s}", address_info.address.m_view_public_key);
|
|
|
|
string pub_spendkey_str = fmt::format("{:s}", address.m_spend_public_key);
|
|
|
|
string pub_spendkey_str = fmt::format("{:s}", address_info.address.m_spend_public_key);
|
|
|
|
string enc_payment_id_str = fmt::format("{:s}", encrypted_payment_id);
|
|
|
|
string enc_payment_id_str = fmt::format("{:s}", encrypted_payment_id);
|
|
|
|
|
|
|
|
|
|
|
|
mstch::map context {
|
|
|
|
mstch::map context {
|
|
|
@ -4572,9 +4587,9 @@ namespace xmreg
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// parse string representing given monero address
|
|
|
|
// parse string representing given monero address
|
|
|
|
cryptonote::account_public_address address;
|
|
|
|
address_parse_info address_info;
|
|
|
|
|
|
|
|
|
|
|
|
if (!xmreg::parse_str_address(address_str, address, testnet))
|
|
|
|
if (!xmreg::parse_str_address(address_str, address_info, testnet))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
j_response["status"] = "error";
|
|
|
|
j_response["status"] = "error";
|
|
|
|
j_response["message"] = "Cant parse monero address: " + address_str;
|
|
|
|
j_response["message"] = "Cant parse monero address: " + address_str;
|
|
|
@ -4618,7 +4633,7 @@ namespace xmreg
|
|
|
|
// to create, so called, derived key.
|
|
|
|
// to create, so called, derived key.
|
|
|
|
key_derivation derivation;
|
|
|
|
key_derivation derivation;
|
|
|
|
|
|
|
|
|
|
|
|
public_key pub_key = tx_prove ? address.m_view_public_key : txd.pk;
|
|
|
|
public_key pub_key = tx_prove ? address_info.address.m_view_public_key : txd.pk;
|
|
|
|
|
|
|
|
|
|
|
|
//cout << "txd.pk: " << pod_to_hex(txd.pk) << endl;
|
|
|
|
//cout << "txd.pk: " << pod_to_hex(txd.pk) << endl;
|
|
|
|
|
|
|
|
|
|
|
@ -4646,7 +4661,7 @@ namespace xmreg
|
|
|
|
|
|
|
|
|
|
|
|
derive_public_key(derivation,
|
|
|
|
derive_public_key(derivation,
|
|
|
|
output_idx,
|
|
|
|
output_idx,
|
|
|
|
address.m_spend_public_key,
|
|
|
|
address_info.address.m_spend_public_key,
|
|
|
|
tx_pubkey);
|
|
|
|
tx_pubkey);
|
|
|
|
|
|
|
|
|
|
|
|
// check if generated public key matches the current output's key
|
|
|
|
// check if generated public key matches the current output's key
|
|
|
@ -4699,7 +4714,7 @@ namespace xmreg
|
|
|
|
// check if submited data in the request
|
|
|
|
// check if submited data in the request
|
|
|
|
// matches to what was used to produce response.
|
|
|
|
// matches to what was used to produce response.
|
|
|
|
j_data["tx_hash"] = pod_to_hex(txd.hash);
|
|
|
|
j_data["tx_hash"] = pod_to_hex(txd.hash);
|
|
|
|
j_data["address"] = pod_to_hex(address);
|
|
|
|
j_data["address"] = pod_to_hex(address_info.address);
|
|
|
|
j_data["viewkey"] = pod_to_hex(prv_view_key);
|
|
|
|
j_data["viewkey"] = pod_to_hex(prv_view_key);
|
|
|
|
j_data["tx_prove"] = tx_prove;
|
|
|
|
j_data["tx_prove"] = tx_prove;
|
|
|
|
|
|
|
|
|
|
|
@ -4758,9 +4773,9 @@ namespace xmreg
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// parse string representing given monero address
|
|
|
|
// parse string representing given monero address
|
|
|
|
cryptonote::account_public_address address;
|
|
|
|
address_parse_info address_info;
|
|
|
|
|
|
|
|
|
|
|
|
if (!xmreg::parse_str_address(address_str, address, testnet))
|
|
|
|
if (!xmreg::parse_str_address(address_str, address_info, testnet))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
j_response["status"] = "error";
|
|
|
|
j_response["status"] = "error";
|
|
|
|
j_response["message"] = "Cant parse monero address: " + address_str;
|
|
|
|
j_response["message"] = "Cant parse monero address: " + address_str;
|
|
|
@ -4806,7 +4821,7 @@ namespace xmreg
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!find_our_outputs(
|
|
|
|
if (!find_our_outputs(
|
|
|
|
address, prv_view_key,
|
|
|
|
address_info.address, prv_view_key,
|
|
|
|
0 /* block_no */, true /*is mempool*/,
|
|
|
|
0 /* block_no */, true /*is mempool*/,
|
|
|
|
tmp_vector.cbegin(), tmp_vector.cend(),
|
|
|
|
tmp_vector.cbegin(), tmp_vector.cend(),
|
|
|
|
j_outptus /* found outputs are pushed to this*/,
|
|
|
|
j_outptus /* found outputs are pushed to this*/,
|
|
|
@ -4863,7 +4878,7 @@ namespace xmreg
|
|
|
|
(void) missed_txs;
|
|
|
|
(void) missed_txs;
|
|
|
|
|
|
|
|
|
|
|
|
if (!find_our_outputs(
|
|
|
|
if (!find_our_outputs(
|
|
|
|
address, prv_view_key,
|
|
|
|
address_info.address, prv_view_key,
|
|
|
|
block_no, false /*is mempool*/,
|
|
|
|
block_no, false /*is mempool*/,
|
|
|
|
blk_txs.cbegin(), blk_txs.cend(),
|
|
|
|
blk_txs.cbegin(), blk_txs.cend(),
|
|
|
|
j_outptus /* found outputs are pushed to this*/,
|
|
|
|
j_outptus /* found outputs are pushed to this*/,
|
|
|
@ -4881,7 +4896,7 @@ namespace xmreg
|
|
|
|
// return parsed values. can be use to double
|
|
|
|
// return parsed values. can be use to double
|
|
|
|
// check if submited data in the request
|
|
|
|
// check if submited data in the request
|
|
|
|
// matches to what was used to produce response.
|
|
|
|
// matches to what was used to produce response.
|
|
|
|
j_data["address"] = pod_to_hex(address);
|
|
|
|
j_data["address"] = pod_to_hex(address_info.address);
|
|
|
|
j_data["viewkey"] = pod_to_hex(prv_view_key);
|
|
|
|
j_data["viewkey"] = pod_to_hex(prv_view_key);
|
|
|
|
j_data["limit"] = _limit;
|
|
|
|
j_data["limit"] = _limit;
|
|
|
|
j_data["height"] = height;
|
|
|
|
j_data["height"] = height;
|
|
|
|