diff --git a/libraries/app/api.cpp b/libraries/app/api.cpp index 9533588b..dfc43420 100644 --- a/libraries/app/api.cpp +++ b/libraries/app/api.cpp @@ -141,11 +141,11 @@ namespace graphene { namespace app { { } - fc::variant network_node_api::get_info() const + fc::variant_object network_node_api::get_info() const { - fc::mutable_variant_object result = _app.p2p_node()->network_get_info(); - result["connection_count"] = _app.p2p_node()->get_connection_count(); - return result; + fc::mutable_variant_object result = _app.p2p_node()->network_get_info(); + result["connection_count"] = _app.p2p_node()->get_connection_count(); + return result; } void network_node_api::add_node(const fc::ip::endpoint& ep) @@ -155,7 +155,22 @@ namespace graphene { namespace app { std::vector network_node_api::get_connected_peers() const { - return _app.p2p_node()->get_connected_peers(); + return _app.p2p_node()->get_connected_peers(); + } + + std::vector network_node_api::get_potential_peers() const + { + return _app.p2p_node()->get_potential_peers(); + } + + fc::variant_object network_node_api::get_advanced_node_parameters() const + { + return _app.p2p_node()->get_advanced_node_parameters(); + } + + void network_node_api::set_advanced_node_parameters(const fc::variant_object& params) + { + return _app.p2p_node()->set_advanced_node_parameters(params); } fc::api login_api::network_broadcast()const diff --git a/libraries/app/include/graphene/app/api.hpp b/libraries/app/include/graphene/app/api.hpp index 46c6d457..30d0d048 100644 --- a/libraries/app/include/graphene/app/api.hpp +++ b/libraries/app/include/graphene/app/api.hpp @@ -139,7 +139,7 @@ namespace graphene { namespace app { /** * @brief Return general network information, such as p2p port */ - fc::variant get_info() const; + fc::variant_object get_info() const; /** * @brief add_node Connect to a new peer @@ -149,9 +149,27 @@ namespace graphene { namespace app { /** * @brief Get status of all current connections to peers - */ + */ std::vector get_connected_peers() const; + /** + * @brief Get advanced node parameters, such as desired and max + * number of connections + */ + fc::variant_object get_advanced_node_parameters() const; + + /** + * @brief Set advanced node parameters, such as desired and max + * number of connections + * @param params a JSON object containing the name/value pairs for the parameters to set + */ + void set_advanced_node_parameters(const fc::variant_object& params); + + /** + * @brief Return list of potential peers + */ + std::vector get_potential_peers() const; + private: application& _app; }; @@ -217,6 +235,9 @@ FC_API(graphene::app::network_node_api, (get_info) (add_node) (get_connected_peers) + (get_potential_peers) + (get_advanced_node_parameters) + (set_advanced_node_parameters) ) FC_API(graphene::app::login_api, (login) diff --git a/libraries/wallet/include/graphene/wallet/wallet.hpp b/libraries/wallet/include/graphene/wallet/wallet.hpp index 4d2c2d82..19247aef 100644 --- a/libraries/wallet/include/graphene/wallet/wallet.hpp +++ b/libraries/wallet/include/graphene/wallet/wallet.hpp @@ -274,6 +274,10 @@ class wallet_api fc::ecc::private_key derive_private_key(const std::string& prefix_string, int sequence_number) const; variant info(); + /** Returns info such as client version, git version of graphene/fc, version of boost, openssl. + * @returns compile time info and client and dependencies versions + */ + variant_object about() const; optional get_block( uint32_t num ); /** Returns the number of accounts registered on the blockchain * @returns the number of registered accounts @@ -1470,6 +1474,7 @@ FC_API( graphene::wallet::wallet_api, (help) (gethelp) (info) + (about) (begin_builder_transaction) (add_operation_to_builder_transaction) (replace_operation_in_builder_transaction) diff --git a/libraries/wallet/wallet.cpp b/libraries/wallet/wallet.cpp index 96c8263b..0cb8dceb 100644 --- a/libraries/wallet/wallet.cpp +++ b/libraries/wallet/wallet.cpp @@ -27,6 +27,10 @@ #include #include +#include +#include +#include + #include #include #include @@ -41,6 +45,7 @@ #include #include +#include #include #include #include @@ -55,6 +60,7 @@ #include #include #include +#include #include #include #include @@ -506,6 +512,41 @@ public: result["active_committee_members"] = global_props.active_committee_members; return result; } + + variant_object about() const + { + string client_version( graphene::utilities::git_revision_description ); + const size_t pos = client_version.find( '/' ); + if( pos != string::npos && client_version.size() > pos ) + client_version = client_version.substr( pos + 1 ); + + fc::mutable_variant_object result; + //result["blockchain_name"] = BLOCKCHAIN_NAME; + //result["blockchain_description"] = BTS_BLOCKCHAIN_DESCRIPTION; + result["client_version"] = client_version; + result["graphene_revision"] = graphene::utilities::git_revision_sha; + result["graphene_revision_age"] = fc::get_approximate_relative_time_string( fc::time_point_sec( graphene::utilities::git_revision_unix_timestamp ) ); + result["fc_revision"] = fc::git_revision_sha; + result["fc_revision_age"] = fc::get_approximate_relative_time_string( fc::time_point_sec( fc::git_revision_unix_timestamp ) ); + result["compile_date"] = "compiled on " __DATE__ " at " __TIME__; + result["boost_version"] = boost::replace_all_copy(std::string(BOOST_LIB_VERSION), "_", "."); + result["openssl_version"] = OPENSSL_VERSION_TEXT; + + std::string bitness = boost::lexical_cast(8 * sizeof(int*)) + "-bit"; +#if defined(__APPLE__) + std::string os = "osx"; +#elif defined(__linux__) + std::string os = "linux"; +#elif defined(_MSC_VER) + std::string os = "win32"; +#else + std::string os = "other"; +#endif + result["build"] = os + " " + bitness; + + return result; + } + chain_property_object get_chain_properties() const { return _remote_db->get_chain_properties(); @@ -2866,6 +2907,11 @@ variant wallet_api::info() return my->info(); } +variant_object wallet_api::about() const +{ + return my->about(); +} + fc::ecc::private_key wallet_api::derive_private_key(const std::string& prefix_string, int sequence_number) const { return detail::derive_private_key( prefix_string, sequence_number );