|
|
|
@ -103,6 +103,8 @@ main(int ac, const char* av[])
|
|
|
|
|
uint32_t log_level = 0;
|
|
|
|
|
mlog_configure("", true);
|
|
|
|
|
|
|
|
|
|
(void) log_level;
|
|
|
|
|
|
|
|
|
|
//cast port number in string to uint
|
|
|
|
|
uint16_t app_port = boost::lexical_cast<uint16_t>(*port_opt);
|
|
|
|
|
|
|
|
|
@ -288,7 +290,7 @@ main(int ac, const char* av[])
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
CROW_ROUTE(app, "/")
|
|
|
|
|
([&](const crow::request& req) {
|
|
|
|
|
([&]() {
|
|
|
|
|
return crow::response(xmrblocks.index2());
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -298,30 +300,35 @@ main(int ac, const char* av[])
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
CROW_ROUTE(app, "/block/<uint>")
|
|
|
|
|
([&](const crow::request& req, size_t block_height) {
|
|
|
|
|
([&](size_t block_height) {
|
|
|
|
|
return crow::response(xmrblocks.show_block(block_height));
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
CROW_ROUTE(app, "/block/<string>")
|
|
|
|
|
([&](const crow::request& req, string block_hash) {
|
|
|
|
|
([&](string block_hash) {
|
|
|
|
|
return crow::response(xmrblocks.show_block(remove_bad_chars(block_hash)));
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
CROW_ROUTE(app, "/tx/<string>")
|
|
|
|
|
([&](const crow::request& req, string tx_hash) {
|
|
|
|
|
([&](string tx_hash) {
|
|
|
|
|
return crow::response(xmrblocks.show_tx(remove_bad_chars(tx_hash)));
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (enable_as_hex)
|
|
|
|
|
{
|
|
|
|
|
CROW_ROUTE(app, "/txhex/<string>")
|
|
|
|
|
([&](const crow::request& req, string tx_hash) {
|
|
|
|
|
([&](string tx_hash) {
|
|
|
|
|
return crow::response(xmrblocks.show_tx_hex(remove_bad_chars(tx_hash)));
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
CROW_ROUTE(app, "/blockhex/<uint>")
|
|
|
|
|
([&](const crow::request& req, size_t block_height) {
|
|
|
|
|
return crow::response(xmrblocks.show_block_hex(block_height));
|
|
|
|
|
([&](size_t block_height) {
|
|
|
|
|
return crow::response(xmrblocks.show_block_hex(block_height, false));
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
CROW_ROUTE(app, "/blockhexcomplete/<uint>")
|
|
|
|
|
([&](size_t block_height) {
|
|
|
|
|
return crow::response(xmrblocks.show_block_hex(block_height, true));
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -422,7 +429,7 @@ main(int ac, const char* av[])
|
|
|
|
|
if (enable_pusher)
|
|
|
|
|
{
|
|
|
|
|
CROW_ROUTE(app, "/rawtx")
|
|
|
|
|
([&](const crow::request& req) {
|
|
|
|
|
([&]() {
|
|
|
|
|
return xmrblocks.show_rawtx();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -452,7 +459,7 @@ main(int ac, const char* av[])
|
|
|
|
|
if (enable_key_image_checker)
|
|
|
|
|
{
|
|
|
|
|
CROW_ROUTE(app, "/rawkeyimgs")
|
|
|
|
|
([&](const crow::request& req) {
|
|
|
|
|
([&]() {
|
|
|
|
|
return xmrblocks.show_rawkeyimgs();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -483,7 +490,7 @@ main(int ac, const char* av[])
|
|
|
|
|
if (enable_output_key_checker)
|
|
|
|
|
{
|
|
|
|
|
CROW_ROUTE(app, "/rawoutputkeys")
|
|
|
|
|
([&](const crow::request& req) {
|
|
|
|
|
([&]() {
|
|
|
|
|
return xmrblocks.show_rawoutputkeys();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -518,13 +525,13 @@ main(int ac, const char* av[])
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
CROW_ROUTE(app, "/mempool")
|
|
|
|
|
([&](const crow::request& req) {
|
|
|
|
|
([&]() {
|
|
|
|
|
return xmrblocks.mempool(true);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// alias to "/mempool"
|
|
|
|
|
CROW_ROUTE(app, "/txpool")
|
|
|
|
|
([&](const crow::request& req) {
|
|
|
|
|
([&]() {
|
|
|
|
|
return xmrblocks.mempool(true);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -545,52 +552,52 @@ main(int ac, const char* av[])
|
|
|
|
|
cout << "Enable JavaScript checking of outputs and proving txs\n";
|
|
|
|
|
|
|
|
|
|
CROW_ROUTE(app, "/js/jquery.min.js")
|
|
|
|
|
([&](const crow::request& req) {
|
|
|
|
|
([&]() {
|
|
|
|
|
return xmrblocks.get_js_file("jquery.min.js");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
CROW_ROUTE(app, "/js/crc32.js")
|
|
|
|
|
([&](const crow::request& req) {
|
|
|
|
|
([&]() {
|
|
|
|
|
return xmrblocks.get_js_file("crc32.js");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
CROW_ROUTE(app, "/js/biginteger.js")
|
|
|
|
|
([&](const crow::request& req) {
|
|
|
|
|
([&]() {
|
|
|
|
|
return xmrblocks.get_js_file("biginteger.js");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
CROW_ROUTE(app, "/js/crypto.js")
|
|
|
|
|
([&](const crow::request& req) {
|
|
|
|
|
([&]() {
|
|
|
|
|
return xmrblocks.get_js_file("crypto.js");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
CROW_ROUTE(app, "/js/config.js")
|
|
|
|
|
([&](const crow::request& req) {
|
|
|
|
|
([&]() {
|
|
|
|
|
return xmrblocks.get_js_file("config.js");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
CROW_ROUTE(app, "/js/nacl-fast-cn.js")
|
|
|
|
|
([&](const crow::request& req) {
|
|
|
|
|
([&]() {
|
|
|
|
|
return xmrblocks.get_js_file("nacl-fast-cn.js");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
CROW_ROUTE(app, "/js/base58.js")
|
|
|
|
|
([&](const crow::request& req) {
|
|
|
|
|
([&]() {
|
|
|
|
|
return xmrblocks.get_js_file("base58.js");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
CROW_ROUTE(app, "/js/cn_util.js")
|
|
|
|
|
([&](const crow::request& req) {
|
|
|
|
|
([&]() {
|
|
|
|
|
return xmrblocks.get_js_file("cn_util.js");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
CROW_ROUTE(app, "/js/sha3.js")
|
|
|
|
|
([&](const crow::request& req) {
|
|
|
|
|
([&]() {
|
|
|
|
|
return xmrblocks.get_js_file("sha3.js");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
CROW_ROUTE(app, "/js/all_in_one.js")
|
|
|
|
|
([&](const crow::request& req) {
|
|
|
|
|
([&]() {
|
|
|
|
|
// /js/all_in_one.js file does not exist. it is generated on the fly
|
|
|
|
|
// from the above real files.
|
|
|
|
|
return xmrblocks.get_js_file("all_in_one.js");
|
|
|
|
@ -604,7 +611,7 @@ main(int ac, const char* av[])
|
|
|
|
|
cout << "Enable JSON API\n";
|
|
|
|
|
|
|
|
|
|
CROW_ROUTE(app, "/api/transaction/<string>")
|
|
|
|
|
([&](const crow::request &req, string tx_hash) {
|
|
|
|
|
([&](string tx_hash) {
|
|
|
|
|
|
|
|
|
|
myxmr::jsonresponse r{xmrblocks.json_transaction(remove_bad_chars(tx_hash))};
|
|
|
|
|
|
|
|
|
@ -612,7 +619,7 @@ main(int ac, const char* av[])
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
CROW_ROUTE(app, "/api/rawtransaction/<string>")
|
|
|
|
|
([&](const crow::request &req, string tx_hash) {
|
|
|
|
|
([&](string tx_hash) {
|
|
|
|
|
|
|
|
|
|
myxmr::jsonresponse r{xmrblocks.json_rawtransaction(remove_bad_chars(tx_hash))};
|
|
|
|
|
|
|
|
|
@ -620,7 +627,7 @@ main(int ac, const char* av[])
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
CROW_ROUTE(app, "/api/detailedtransaction/<string>")
|
|
|
|
|
([&](const crow::request &req, string tx_hash) {
|
|
|
|
|
([&](string tx_hash) {
|
|
|
|
|
|
|
|
|
|
myxmr::jsonresponse r{xmrblocks.json_detailedtransaction(remove_bad_chars(tx_hash))};
|
|
|
|
|
|
|
|
|
@ -628,7 +635,7 @@ main(int ac, const char* av[])
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
CROW_ROUTE(app, "/api/block/<string>")
|
|
|
|
|
([&](const crow::request &req, string block_no_or_hash) {
|
|
|
|
|
([&](string block_no_or_hash) {
|
|
|
|
|
|
|
|
|
|
myxmr::jsonresponse r{xmrblocks.json_block(remove_bad_chars(block_no_or_hash))};
|
|
|
|
|
|
|
|
|
@ -636,7 +643,7 @@ main(int ac, const char* av[])
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
CROW_ROUTE(app, "/api/rawblock/<string>")
|
|
|
|
|
([&](const crow::request &req, string block_no_or_hash) {
|
|
|
|
|
([&](string block_no_or_hash) {
|
|
|
|
|
|
|
|
|
|
myxmr::jsonresponse r{xmrblocks.json_rawblock(remove_bad_chars(block_no_or_hash))};
|
|
|
|
|
|
|
|
|
@ -677,7 +684,7 @@ main(int ac, const char* av[])
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
CROW_ROUTE(app, "/api/search/<string>")
|
|
|
|
|
([&](const crow::request &req, string search_value) {
|
|
|
|
|
([&](string search_value) {
|
|
|
|
|
|
|
|
|
|
myxmr::jsonresponse r{xmrblocks.json_search(remove_bad_chars(search_value))};
|
|
|
|
|
|
|
|
|
@ -685,7 +692,7 @@ main(int ac, const char* av[])
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
CROW_ROUTE(app, "/api/networkinfo")
|
|
|
|
|
([&](const crow::request &req) {
|
|
|
|
|
([&]() {
|
|
|
|
|
|
|
|
|
|
myxmr::jsonresponse r{xmrblocks.json_networkinfo()};
|
|
|
|
|
|
|
|
|
@ -693,7 +700,7 @@ main(int ac, const char* av[])
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
CROW_ROUTE(app, "/api/emission")
|
|
|
|
|
([&](const crow::request &req) {
|
|
|
|
|
([&]() {
|
|
|
|
|
|
|
|
|
|
myxmr::jsonresponse r{xmrblocks.json_emission()};
|
|
|
|
|
|
|
|
|
@ -769,7 +776,7 @@ main(int ac, const char* av[])
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
CROW_ROUTE(app, "/api/version")
|
|
|
|
|
([&](const crow::request &req) {
|
|
|
|
|
([&]() {
|
|
|
|
|
|
|
|
|
|
myxmr::jsonresponse r{xmrblocks.json_version()};
|
|
|
|
|
|
|
|
|
|