|
|
|
@ -346,6 +346,7 @@ YourMoneroRequests::get_address_txs(
|
|
|
|
|
last_tx_id_db = j_response["transactions"].back()["id"];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (json& j_tx: j_mempool_tx)
|
|
|
|
|
{
|
|
|
|
|
//cout << "mempool j_tx[\"total_received\"]: "
|
|
|
|
@ -353,14 +354,18 @@ YourMoneroRequests::get_address_txs(
|
|
|
|
|
|
|
|
|
|
j_tx["id"] = ++last_tx_id_db;
|
|
|
|
|
|
|
|
|
|
total_received_mempool += j_tx["total_received"].get<uint64_t>();
|
|
|
|
|
total_sent_mempool += j_tx["total_sent"].get<uint64_t>();
|
|
|
|
|
total_received_mempool += boost::lexical_cast<uint64_t>(
|
|
|
|
|
j_tx["total_received"].get<string>());
|
|
|
|
|
total_sent_mempool += boost::lexical_cast<uint64_t>(
|
|
|
|
|
j_tx["total_sent"].get<string>());
|
|
|
|
|
|
|
|
|
|
j_response["transactions"].push_back(j_tx);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
j_response["total_received"]
|
|
|
|
|
= std::to_string(j_response["total_received"].get<uint64_t>()
|
|
|
|
|
= std::to_string(
|
|
|
|
|
boost::lexical_cast<uint64_t>(
|
|
|
|
|
j_response["total_received"].get<string>())
|
|
|
|
|
+ total_received_mempool);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -409,9 +414,9 @@ YourMoneroRequests::get_address_info(
|
|
|
|
|
string viewkey_hash = make_hash(view_key);
|
|
|
|
|
|
|
|
|
|
j_response = json {
|
|
|
|
|
{"locked_funds" , 0}, // locked xmr (e.g., younger than 10 blocks)
|
|
|
|
|
{"total_received" , 0}, // calculated in this function
|
|
|
|
|
{"total_sent" , 0}, // calculated in this function
|
|
|
|
|
{"locked_funds" , "0"}, // locked xmr (e.g., younger than 10 blocks)
|
|
|
|
|
{"total_received" , "0"}, // calculated in this function
|
|
|
|
|
{"total_sent" , "0"}, // calculated in this function
|
|
|
|
|
{"scanned_height" , 0}, // not used. it is here to match mymonero
|
|
|
|
|
{"scanned_block_height" , 0}, // taken from Accounts table
|
|
|
|
|
{"scanned_block_timestamp", 0}, // taken from Accounts table
|
|
|
|
@ -595,7 +600,7 @@ YourMoneroRequests::get_unspent_outs(
|
|
|
|
|
string viewkey_hash = make_hash(view_key);
|
|
|
|
|
|
|
|
|
|
j_response = json {
|
|
|
|
|
{"amount" , 0}, // total value of the outputs
|
|
|
|
|
{"amount" , "0"}, // total value of the outputs
|
|
|
|
|
{"outputs", json::array()} // list of outputs
|
|
|
|
|
// exclude those without require
|
|
|
|
|
// no of confirmation
|
|
|
|
@ -823,7 +828,7 @@ YourMoneroRequests::get_random_outs(
|
|
|
|
|
|
|
|
|
|
for (const auto& outs: found_outputs)
|
|
|
|
|
{
|
|
|
|
|
json j_outs {{"amount", outs.amount},
|
|
|
|
|
json j_outs {{"amount", std::to_string(outs.amount)},
|
|
|
|
|
{"outputs", json::array()}};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -960,8 +965,9 @@ YourMoneroRequests::import_wallet_request(
|
|
|
|
|
json j_response;
|
|
|
|
|
|
|
|
|
|
j_response["request_fulfilled"] = false;
|
|
|
|
|
j_response["import_fee"] = current_bc_status->get_bc_setup()
|
|
|
|
|
.import_fee;
|
|
|
|
|
j_response["import_fee"] = std::to_string(
|
|
|
|
|
current_bc_status->get_bc_setup()
|
|
|
|
|
.import_fee);
|
|
|
|
|
j_response["status"] = "error";
|
|
|
|
|
j_response["error"] = "Some error occured";
|
|
|
|
|
|
|
|
|
@ -987,7 +993,7 @@ YourMoneroRequests::import_wallet_request(
|
|
|
|
|
|
|
|
|
|
auto response_headers
|
|
|
|
|
= make_headers({{ "Content-Length",
|
|
|
|
|
to_string(response_body.size())}});
|
|
|
|
|
std::to_string(response_body.size())}});
|
|
|
|
|
|
|
|
|
|
session->close( OK, response_body, response_headers);
|
|
|
|
|
|
|
|
|
@ -1004,7 +1010,7 @@ YourMoneroRequests::import_wallet_request(
|
|
|
|
|
string response_body = j_response.dump();
|
|
|
|
|
auto response_headers
|
|
|
|
|
= make_headers({{ "Content-Length",
|
|
|
|
|
to_string(response_body.size())}});
|
|
|
|
|
std::to_string(response_body.size())}});
|
|
|
|
|
|
|
|
|
|
session->close( OK, response_body, response_headers);
|
|
|
|
|
return;
|
|
|
|
@ -1045,7 +1051,7 @@ YourMoneroRequests::import_wallet_request(
|
|
|
|
|
xmr_payment.payment_id);
|
|
|
|
|
|
|
|
|
|
j_response["payment_id"] = xmr_payment.payment_id;
|
|
|
|
|
j_response["import_fee"] = xmr_payment.import_fee;
|
|
|
|
|
j_response["import_fee"] = std::to_string(xmr_payment.import_fee);
|
|
|
|
|
j_response["new_request"] = false;
|
|
|
|
|
j_response["request_fulfilled"] = request_fulfilled;
|
|
|
|
|
j_response["payment_address"] = integrated_address;
|
|
|
|
@ -1109,7 +1115,7 @@ YourMoneroRequests::import_wallet_request(
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
cerr << "Updating accounts due to made "
|
|
|
|
|
"payment mysql failed! " << endl;
|
|
|
|
|
"payment mysql failed! \n";
|
|
|
|
|
j_response["error"]
|
|
|
|
|
= "Updating accounts due to made "
|
|
|
|
|
"payment mysql failed!";
|
|
|
|
@ -1117,7 +1123,7 @@ YourMoneroRequests::import_wallet_request(
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
cerr << "Updating payment mysql failed! " << endl;
|
|
|
|
|
cerr << "Updating payment mysql failed!\n";
|
|
|
|
|
j_response["error"] = "Updating payment mysql failed!";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1167,10 +1173,11 @@ YourMoneroRequests::import_wallet_request(
|
|
|
|
|
// payment entry created
|
|
|
|
|
|
|
|
|
|
j_response["payment_id"] = payment_table_id;
|
|
|
|
|
j_response["import_fee"] = xmr_payment.import_fee;
|
|
|
|
|
j_response["import_fee"] = std::to_string(
|
|
|
|
|
xmr_payment.import_fee);
|
|
|
|
|
j_response["new_request"] = true;
|
|
|
|
|
j_response["request_fulfilled"]
|
|
|
|
|
= bool {xmr_payment.request_fulfilled};
|
|
|
|
|
= bool {xmr_payment.request_fulfilled};
|
|
|
|
|
j_response["payment_address"] = xmr_payment.payment_address;
|
|
|
|
|
j_response["status"] = "Payment not yet received";
|
|
|
|
|
j_response["error"] = "";
|
|
|
|
@ -1180,7 +1187,7 @@ YourMoneroRequests::import_wallet_request(
|
|
|
|
|
string response_body = j_response.dump();
|
|
|
|
|
|
|
|
|
|
auto response_headers = make_headers({{ "Content-Length",
|
|
|
|
|
to_string(response_body.size())}});
|
|
|
|
|
std::to_string(response_body.size())}});
|
|
|
|
|
|
|
|
|
|
session->close( OK, response_body, response_headers);
|
|
|
|
|
}
|
|
|
|
@ -1310,7 +1317,7 @@ YourMoneroRequests::import_recent_wallet_request(
|
|
|
|
|
string response_body = j_response.dump();
|
|
|
|
|
|
|
|
|
|
auto response_headers = make_headers({{ "Content-Length",
|
|
|
|
|
to_string(response_body.size())}});
|
|
|
|
|
std::to_string(response_body.size())}});
|
|
|
|
|
|
|
|
|
|
session->close( OK, response_body, response_headers);
|
|
|
|
|
}
|
|
|
|
@ -1463,8 +1470,8 @@ YourMoneroRequests::get_tx(
|
|
|
|
|
j_response["size"] = size;
|
|
|
|
|
|
|
|
|
|
// to be field later on using data from OutputInputIdentification
|
|
|
|
|
j_response["total_sent"] = 0;
|
|
|
|
|
j_response["total_received"] = 0;
|
|
|
|
|
j_response["total_sent"] = "0";
|
|
|
|
|
j_response["total_received"] = "0";
|
|
|
|
|
|
|
|
|
|
int64_t tx_height {-1};
|
|
|
|
|
|
|
|
|
@ -1639,7 +1646,7 @@ YourMoneroRequests::get_tx(
|
|
|
|
|
total_spent += out.amount;
|
|
|
|
|
|
|
|
|
|
j_spent_outputs.push_back({
|
|
|
|
|
{"amount" , in_info.amount},
|
|
|
|
|
{"amount" , std::to_string(in_info.amount)},
|
|
|
|
|
{"key_image" , in_info.key_img},
|
|
|
|
|
{"tx_pub_key" , out.tx_pub_key},
|
|
|
|
|
{"out_index" , out.out_index},
|
|
|
|
@ -1648,7 +1655,7 @@ YourMoneroRequests::get_tx(
|
|
|
|
|
|
|
|
|
|
} // for (auto& in_info: oi_identification
|
|
|
|
|
|
|
|
|
|
j_response["total_sent"] = total_spent;
|
|
|
|
|
j_response["total_sent"] = std::to_string(total_spent);
|
|
|
|
|
|
|
|
|
|
j_response["spent_outputs"] = j_spent_outputs;
|
|
|
|
|
|
|
|
|
|