diff --git a/cmake/EthDependenciesDeprecated.cmake b/cmake/EthDependenciesDeprecated.cmake index d1c51f6c4..d815bef3e 100644 --- a/cmake/EthDependenciesDeprecated.cmake +++ b/cmake/EthDependenciesDeprecated.cmake @@ -125,21 +125,47 @@ else() message(STATUS "Failed to find the miniupnpc headers!") endif () - find_path( JSONRPC_ID jsonrpc/rpc.h - /usr/include - /usr/local/include - ) + find_path( JSONRPC_ID jsonrpccpp/server.h + /usr/include + /usr/local/include + ) + if ( JSONRPC_ID ) message(STATUS "Found jsonrpc headers") - find_library( JSONRPC_LS NAMES jsonrpc + find_library( JSONRPC_LS NAMES jsonrpccpp-server PATHS /usr/lib /usr/local/lib /opt/local/lib /usr/lib/*/ ) - if ( JSONRPC_LS ) + + find_library( JSONRPC_COMMON_LS NAMES jsonrpccpp-common + PATHS + /usr/lib + /usr/local/lib + /opt/local/lib + /usr/lib/*/ + ) + + find_library( JSONCPP_LS NAMES jsoncpp + /usr/lib + /usr/local/lib + /opt/local/lib + /usr/lib/*/ + ) + + find_library( JSONRPC_CLIENT_LS NAMES jsonrpccpp-client + PATHS + /usr/lib/ + /usr/local/lib + /opt/local/lib + /usr/lib/*/ + ) + + if ( JSONRPC_LS AND JSONRPC_COMMON_LS ) message(STATUS "Found jsonrpc library: ${JSONRPC_LS}") + message(STATUS "Found jsonrpc-common library: ${JSONRPC_COMMON_LS}") add_definitions(-DETH_JSONRPC) else () message(STATUS "Failed to find the jsonrpc library!") diff --git a/eth/main.cpp b/eth/main.cpp index 759dd40d0..447729c1a 100644 --- a/eth/main.cpp +++ b/eth/main.cpp @@ -28,7 +28,7 @@ #include #include #if ETH_JSONRPC -#include +//#include #include #endif #include diff --git a/libqethereum/QEthereum.h b/libqethereum/QEthereum.h index 4f276b7e1..b4c17fdab 100644 --- a/libqethereum/QEthereum.h +++ b/libqethereum/QEthereum.h @@ -25,7 +25,8 @@ #include #include -#include +#include +//#include class QWebThree: public QObject { diff --git a/libweb3jsonrpc/CMakeLists.txt b/libweb3jsonrpc/CMakeLists.txt index b24a11196..6966cd10a 100644 --- a/libweb3jsonrpc/CMakeLists.txt +++ b/libweb3jsonrpc/CMakeLists.txt @@ -23,7 +23,9 @@ if(MINIUPNPC_LS) endif() target_link_libraries(${EXECUTABLE} ${LEVELDB_LS}) target_link_libraries(${EXECUTABLE} ${CRYPTOPP_LS}) +target_link_libraries(${EXECUTABLE} ${JSONCPP_LS}) target_link_libraries(${EXECUTABLE} ${JSONRPC_LS}) +target_link_libraries(${EXECUTABLE} ${JSONRPC_COMMON_LS}) target_link_libraries(${EXECUTABLE} ${LEVELDB_LS}) if(READLINE_LS) target_link_libraries(${EXECUTABLE} ${READLINE_LS}) diff --git a/libweb3jsonrpc/CorsHttpServer.h b/libweb3jsonrpc/CorsHttpServer.h index d3bd8a6e9..5dd3130a4 100644 --- a/libweb3jsonrpc/CorsHttpServer.h +++ b/libweb3jsonrpc/CorsHttpServer.h @@ -19,7 +19,8 @@ * @date 2014 */ -#include +#include +//#include namespace jsonrpc { diff --git a/libweb3jsonrpc/WebThreeStubServer.cpp b/libweb3jsonrpc/WebThreeStubServer.cpp index e7eb62e04..ed5907f53 100644 --- a/libweb3jsonrpc/WebThreeStubServer.cpp +++ b/libweb3jsonrpc/WebThreeStubServer.cpp @@ -217,7 +217,7 @@ static Json::Value toJson(h256 const& _h, shh::Envelope const& _e, shh::Message WebThreeStubServer::WebThreeStubServer(jsonrpc::AbstractServerConnector* _conn, WebThreeDirect& _web3, std::vector const& _accounts): - AbstractWebThreeStubServer(_conn), + AbstractWebThreeStubServer(*_conn), m_web3(_web3) { setAccounts(_accounts); diff --git a/libweb3jsonrpc/WebThreeStubServer.h b/libweb3jsonrpc/WebThreeStubServer.h index b18faf95a..193f1f6ff 100644 --- a/libweb3jsonrpc/WebThreeStubServer.h +++ b/libweb3jsonrpc/WebThreeStubServer.h @@ -29,7 +29,8 @@ #pragma warning(pop) #include -#include +//#include +#include #include #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-parameter" diff --git a/libweb3jsonrpc/abstractwebthreestubserver.h b/libweb3jsonrpc/abstractwebthreestubserver.h index ac6893933..90ee422a0 100644 --- a/libweb3jsonrpc/abstractwebthreestubserver.h +++ b/libweb3jsonrpc/abstractwebthreestubserver.h @@ -1,323 +1,287 @@ /** - * THIS FILE IS GENERATED BY jsonrpcstub, DO NOT CHANGE IT!!!!! + * This file is generated by jsonrpcstub, DO NOT CHANGE IT MANUALLY! */ -#ifndef _ABSTRACTWEBTHREESTUBSERVER_H_ -#define _ABSTRACTWEBTHREESTUBSERVER_H_ +#ifndef JSONRPC_CPP_STUB_ABSTRACTWEBTHREESTUBSERVER_H_ +#define JSONRPC_CPP_STUB_ABSTRACTWEBTHREESTUBSERVER_H_ -#include +#include class AbstractWebThreeStubServer : public jsonrpc::AbstractServer { public: - AbstractWebThreeStubServer(jsonrpc::AbstractServerConnector* conn) : - jsonrpc::AbstractServer(conn) + AbstractWebThreeStubServer(jsonrpc::AbstractServerConnector &conn) : jsonrpc::AbstractServer(conn) { - this->bindAndAddMethod(new jsonrpc::Procedure("account", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::accountI); - this->bindAndAddMethod(new jsonrpc::Procedure("accounts", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_ARRAY, NULL), &AbstractWebThreeStubServer::accountsI); - this->bindAndAddMethod(new jsonrpc::Procedure("addToGroup", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::addToGroupI); - this->bindAndAddMethod(new jsonrpc::Procedure("balanceAt", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::balanceAtI); - this->bindAndAddMethod(new jsonrpc::Procedure("blockByHash", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::blockByHashI); - this->bindAndAddMethod(new jsonrpc::Procedure("blockByNumber", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::blockByNumberI); - this->bindAndAddMethod(new jsonrpc::Procedure("call", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_OBJECT, NULL), &AbstractWebThreeStubServer::callI); - this->bindAndAddMethod(new jsonrpc::Procedure("changed", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::changedI); - this->bindAndAddMethod(new jsonrpc::Procedure("codeAt", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::codeAtI); this->bindAndAddMethod(new jsonrpc::Procedure("coinbase", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::coinbaseI); - this->bindAndAddMethod(new jsonrpc::Procedure("compile", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::compileI); - this->bindAndAddMethod(new jsonrpc::Procedure("countAt", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_REAL, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::countAtI); - this->bindAndAddMethod(new jsonrpc::Procedure("defaultBlock", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::defaultBlockI); - this->bindAndAddMethod(new jsonrpc::Procedure("gasPrice", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::gasPriceI); - this->bindAndAddMethod(new jsonrpc::Procedure("get", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::getI); - this->bindAndAddMethod(new jsonrpc::Procedure("getMessages", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_ARRAY, "param1",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::getMessagesI); - this->bindAndAddMethod(new jsonrpc::Procedure("getString", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::getStringI); - this->bindAndAddMethod(new jsonrpc::Procedure("haveIdentity", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::haveIdentityI); + this->bindAndAddMethod(new jsonrpc::Procedure("setCoinbase", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::setCoinbaseI); this->bindAndAddMethod(new jsonrpc::Procedure("listening", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, NULL), &AbstractWebThreeStubServer::listeningI); + this->bindAndAddMethod(new jsonrpc::Procedure("setListening", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_BOOLEAN, NULL), &AbstractWebThreeStubServer::setListeningI); this->bindAndAddMethod(new jsonrpc::Procedure("mining", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, NULL), &AbstractWebThreeStubServer::miningI); - this->bindAndAddMethod(new jsonrpc::Procedure("newFilter", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_INTEGER, "param1",jsonrpc::JSON_OBJECT, NULL), &AbstractWebThreeStubServer::newFilterI); - this->bindAndAddMethod(new jsonrpc::Procedure("newFilterString", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_INTEGER, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::newFilterStringI); - this->bindAndAddMethod(new jsonrpc::Procedure("newGroup", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::newGroupI); - this->bindAndAddMethod(new jsonrpc::Procedure("newIdentity", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::newIdentityI); - this->bindAndAddMethod(new jsonrpc::Procedure("number", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::numberI); + this->bindAndAddMethod(new jsonrpc::Procedure("setMining", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_BOOLEAN, NULL), &AbstractWebThreeStubServer::setMiningI); + this->bindAndAddMethod(new jsonrpc::Procedure("gasPrice", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::gasPriceI); + this->bindAndAddMethod(new jsonrpc::Procedure("account", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::accountI); + this->bindAndAddMethod(new jsonrpc::Procedure("accounts", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_ARRAY, NULL), &AbstractWebThreeStubServer::accountsI); this->bindAndAddMethod(new jsonrpc::Procedure("peerCount", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::peerCountI); - this->bindAndAddMethod(new jsonrpc::Procedure("post", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_OBJECT, NULL), &AbstractWebThreeStubServer::postI); - this->bindAndAddMethod(new jsonrpc::Procedure("put", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING,"param3",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::putI); - this->bindAndAddMethod(new jsonrpc::Procedure("putString", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING,"param3",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::putStringI); - this->bindAndAddMethod(new jsonrpc::Procedure("setCoinbase", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::setCoinbaseI); + this->bindAndAddMethod(new jsonrpc::Procedure("defaultBlock", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::defaultBlockI); this->bindAndAddMethod(new jsonrpc::Procedure("setDefaultBlock", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::setDefaultBlockI); - this->bindAndAddMethod(new jsonrpc::Procedure("setListening", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_BOOLEAN, NULL), &AbstractWebThreeStubServer::setListeningI); - this->bindAndAddMethod(new jsonrpc::Procedure("setMining", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_BOOLEAN, NULL), &AbstractWebThreeStubServer::setMiningI); - this->bindAndAddMethod(new jsonrpc::Procedure("shhChanged", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_ARRAY, "param1",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::shhChangedI); - this->bindAndAddMethod(new jsonrpc::Procedure("shhNewFilter", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_INTEGER, "param1",jsonrpc::JSON_OBJECT, NULL), &AbstractWebThreeStubServer::shhNewFilterI); - this->bindAndAddMethod(new jsonrpc::Procedure("shhUninstallFilter", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::shhUninstallFilterI); + this->bindAndAddMethod(new jsonrpc::Procedure("number", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::numberI); + this->bindAndAddMethod(new jsonrpc::Procedure("balanceAt", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::balanceAtI); this->bindAndAddMethod(new jsonrpc::Procedure("stateAt", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::stateAtI); + this->bindAndAddMethod(new jsonrpc::Procedure("countAt", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_REAL, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::countAtI); + this->bindAndAddMethod(new jsonrpc::Procedure("codeAt", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::codeAtI); this->bindAndAddMethod(new jsonrpc::Procedure("transact", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_OBJECT, NULL), &AbstractWebThreeStubServer::transactI); + this->bindAndAddMethod(new jsonrpc::Procedure("call", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_OBJECT, NULL), &AbstractWebThreeStubServer::callI); + this->bindAndAddMethod(new jsonrpc::Procedure("blockByHash", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::blockByHashI); + this->bindAndAddMethod(new jsonrpc::Procedure("blockByNumber", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::blockByNumberI); this->bindAndAddMethod(new jsonrpc::Procedure("transactionByHash", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::transactionByHashI); this->bindAndAddMethod(new jsonrpc::Procedure("transactionByNumber", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_INTEGER,"param2",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::transactionByNumberI); this->bindAndAddMethod(new jsonrpc::Procedure("uncleByHash", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::uncleByHashI); this->bindAndAddMethod(new jsonrpc::Procedure("uncleByNumber", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_INTEGER,"param2",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::uncleByNumberI); + this->bindAndAddMethod(new jsonrpc::Procedure("compile", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::compileI); + this->bindAndAddMethod(new jsonrpc::Procedure("newFilter", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_INTEGER, "param1",jsonrpc::JSON_OBJECT, NULL), &AbstractWebThreeStubServer::newFilterI); + this->bindAndAddMethod(new jsonrpc::Procedure("newFilterString", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_INTEGER, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::newFilterStringI); this->bindAndAddMethod(new jsonrpc::Procedure("uninstallFilter", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::uninstallFilterI); - + this->bindAndAddMethod(new jsonrpc::Procedure("changed", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::changedI); + this->bindAndAddMethod(new jsonrpc::Procedure("getMessages", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_ARRAY, "param1",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::getMessagesI); + this->bindAndAddMethod(new jsonrpc::Procedure("put", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING,"param3",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::putI); + this->bindAndAddMethod(new jsonrpc::Procedure("get", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::getI); + this->bindAndAddMethod(new jsonrpc::Procedure("putString", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING,"param3",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::putStringI); + this->bindAndAddMethod(new jsonrpc::Procedure("getString", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::getStringI); + this->bindAndAddMethod(new jsonrpc::Procedure("post", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_OBJECT, NULL), &AbstractWebThreeStubServer::postI); + this->bindAndAddMethod(new jsonrpc::Procedure("newIdentity", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::newIdentityI); + this->bindAndAddMethod(new jsonrpc::Procedure("haveIdentity", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::haveIdentityI); + this->bindAndAddMethod(new jsonrpc::Procedure("newGroup", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::newGroupI); + this->bindAndAddMethod(new jsonrpc::Procedure("addToGroup", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::addToGroupI); + this->bindAndAddMethod(new jsonrpc::Procedure("shhNewFilter", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_INTEGER, "param1",jsonrpc::JSON_OBJECT, NULL), &AbstractWebThreeStubServer::shhNewFilterI); + this->bindAndAddMethod(new jsonrpc::Procedure("shhUninstallFilter", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::shhUninstallFilterI); + this->bindAndAddMethod(new jsonrpc::Procedure("shhChanged", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_ARRAY, "param1",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::shhChangedI); } - - inline virtual void accountI(const Json::Value& request, Json::Value& response) + + inline virtual void coinbaseI(const Json::Value &request, Json::Value &response) { - response = this->account(); + (void)request; + response = this->coinbase(); } - - inline virtual void accountsI(const Json::Value& request, Json::Value& response) + inline virtual void setCoinbaseI(const Json::Value &request, Json::Value &response) { - response = this->accounts(); + response = this->setCoinbase(request[0u].asString()); } - - inline virtual void addToGroupI(const Json::Value& request, Json::Value& response) + inline virtual void listeningI(const Json::Value &request, Json::Value &response) { - response = this->addToGroup(request[0u].asString(), request[1u].asString()); + (void)request; + response = this->listening(); } - - inline virtual void balanceAtI(const Json::Value& request, Json::Value& response) + inline virtual void setListeningI(const Json::Value &request, Json::Value &response) { - response = this->balanceAt(request[0u].asString()); + response = this->setListening(request[0u].asBool()); } - - inline virtual void blockByHashI(const Json::Value& request, Json::Value& response) + inline virtual void miningI(const Json::Value &request, Json::Value &response) { - response = this->blockByHash(request[0u].asString()); + (void)request; + response = this->mining(); } - - inline virtual void blockByNumberI(const Json::Value& request, Json::Value& response) + inline virtual void setMiningI(const Json::Value &request, Json::Value &response) { - response = this->blockByNumber(request[0u].asInt()); + response = this->setMining(request[0u].asBool()); } - - inline virtual void callI(const Json::Value& request, Json::Value& response) + inline virtual void gasPriceI(const Json::Value &request, Json::Value &response) { - response = this->call(request[0u]); + (void)request; + response = this->gasPrice(); } - - inline virtual void changedI(const Json::Value& request, Json::Value& response) + inline virtual void accountI(const Json::Value &request, Json::Value &response) { - response = this->changed(request[0u].asInt()); + (void)request; + response = this->account(); } - - inline virtual void codeAtI(const Json::Value& request, Json::Value& response) + inline virtual void accountsI(const Json::Value &request, Json::Value &response) { - response = this->codeAt(request[0u].asString()); + (void)request; + response = this->accounts(); } - - inline virtual void coinbaseI(const Json::Value& request, Json::Value& response) + inline virtual void peerCountI(const Json::Value &request, Json::Value &response) { - response = this->coinbase(); + (void)request; + response = this->peerCount(); } - - inline virtual void compileI(const Json::Value& request, Json::Value& response) + inline virtual void defaultBlockI(const Json::Value &request, Json::Value &response) { - response = this->compile(request[0u].asString()); + (void)request; + response = this->defaultBlock(); } - - inline virtual void countAtI(const Json::Value& request, Json::Value& response) + inline virtual void setDefaultBlockI(const Json::Value &request, Json::Value &response) { - response = this->countAt(request[0u].asString()); + response = this->setDefaultBlock(request[0u].asInt()); } - - inline virtual void defaultBlockI(const Json::Value& request, Json::Value& response) + inline virtual void numberI(const Json::Value &request, Json::Value &response) { - response = this->defaultBlock(); + (void)request; + response = this->number(); } - - inline virtual void gasPriceI(const Json::Value& request, Json::Value& response) + inline virtual void balanceAtI(const Json::Value &request, Json::Value &response) { - response = this->gasPrice(); + response = this->balanceAt(request[0u].asString()); } - - inline virtual void getI(const Json::Value& request, Json::Value& response) + inline virtual void stateAtI(const Json::Value &request, Json::Value &response) { - response = this->get(request[0u].asString(), request[1u].asString()); + response = this->stateAt(request[0u].asString(), request[1u].asString()); } - - inline virtual void getMessagesI(const Json::Value& request, Json::Value& response) + inline virtual void countAtI(const Json::Value &request, Json::Value &response) { - response = this->getMessages(request[0u].asInt()); + response = this->countAt(request[0u].asString()); } - - inline virtual void getStringI(const Json::Value& request, Json::Value& response) + inline virtual void codeAtI(const Json::Value &request, Json::Value &response) { - response = this->getString(request[0u].asString(), request[1u].asString()); + response = this->codeAt(request[0u].asString()); } - - inline virtual void haveIdentityI(const Json::Value& request, Json::Value& response) + inline virtual void transactI(const Json::Value &request, Json::Value &response) { - response = this->haveIdentity(request[0u].asString()); + response = this->transact(request[0u]); } - - inline virtual void listeningI(const Json::Value& request, Json::Value& response) + inline virtual void callI(const Json::Value &request, Json::Value &response) { - response = this->listening(); + response = this->call(request[0u]); } - - inline virtual void miningI(const Json::Value& request, Json::Value& response) + inline virtual void blockByHashI(const Json::Value &request, Json::Value &response) { - response = this->mining(); + response = this->blockByHash(request[0u].asString()); } - - inline virtual void newFilterI(const Json::Value& request, Json::Value& response) + inline virtual void blockByNumberI(const Json::Value &request, Json::Value &response) { - response = this->newFilter(request[0u]); + response = this->blockByNumber(request[0u].asInt()); } - - inline virtual void newFilterStringI(const Json::Value& request, Json::Value& response) + inline virtual void transactionByHashI(const Json::Value &request, Json::Value &response) { - response = this->newFilterString(request[0u].asString()); + response = this->transactionByHash(request[0u].asString(), request[1u].asInt()); } - - inline virtual void newGroupI(const Json::Value& request, Json::Value& response) + inline virtual void transactionByNumberI(const Json::Value &request, Json::Value &response) { - response = this->newGroup(request[0u].asString(), request[1u].asString()); + response = this->transactionByNumber(request[0u].asInt(), request[1u].asInt()); } - - inline virtual void newIdentityI(const Json::Value& request, Json::Value& response) + inline virtual void uncleByHashI(const Json::Value &request, Json::Value &response) { - response = this->newIdentity(); + response = this->uncleByHash(request[0u].asString(), request[1u].asInt()); } - - inline virtual void numberI(const Json::Value& request, Json::Value& response) + inline virtual void uncleByNumberI(const Json::Value &request, Json::Value &response) { - response = this->number(); + response = this->uncleByNumber(request[0u].asInt(), request[1u].asInt()); } - - inline virtual void peerCountI(const Json::Value& request, Json::Value& response) + inline virtual void compileI(const Json::Value &request, Json::Value &response) { - response = this->peerCount(); + response = this->compile(request[0u].asString()); } - - inline virtual void postI(const Json::Value& request, Json::Value& response) + inline virtual void newFilterI(const Json::Value &request, Json::Value &response) { - response = this->post(request[0u]); + response = this->newFilter(request[0u]); } - - inline virtual void putI(const Json::Value& request, Json::Value& response) + inline virtual void newFilterStringI(const Json::Value &request, Json::Value &response) { - response = this->put(request[0u].asString(), request[1u].asString(), request[2u].asString()); + response = this->newFilterString(request[0u].asString()); } - - inline virtual void putStringI(const Json::Value& request, Json::Value& response) + inline virtual void uninstallFilterI(const Json::Value &request, Json::Value &response) { - response = this->putString(request[0u].asString(), request[1u].asString(), request[2u].asString()); + response = this->uninstallFilter(request[0u].asInt()); } - - inline virtual void setCoinbaseI(const Json::Value& request, Json::Value& response) + inline virtual void changedI(const Json::Value &request, Json::Value &response) { - response = this->setCoinbase(request[0u].asString()); + response = this->changed(request[0u].asInt()); } - - inline virtual void setDefaultBlockI(const Json::Value& request, Json::Value& response) + inline virtual void getMessagesI(const Json::Value &request, Json::Value &response) { - response = this->setDefaultBlock(request[0u].asInt()); + response = this->getMessages(request[0u].asInt()); } - - inline virtual void setListeningI(const Json::Value& request, Json::Value& response) + inline virtual void putI(const Json::Value &request, Json::Value &response) { - response = this->setListening(request[0u].asBool()); + response = this->put(request[0u].asString(), request[1u].asString(), request[2u].asString()); } - - inline virtual void setMiningI(const Json::Value& request, Json::Value& response) + inline virtual void getI(const Json::Value &request, Json::Value &response) { - response = this->setMining(request[0u].asBool()); + response = this->get(request[0u].asString(), request[1u].asString()); } - - inline virtual void shhChangedI(const Json::Value& request, Json::Value& response) + inline virtual void putStringI(const Json::Value &request, Json::Value &response) { - response = this->shhChanged(request[0u].asInt()); + response = this->putString(request[0u].asString(), request[1u].asString(), request[2u].asString()); } - - inline virtual void shhNewFilterI(const Json::Value& request, Json::Value& response) + inline virtual void getStringI(const Json::Value &request, Json::Value &response) { - response = this->shhNewFilter(request[0u]); + response = this->getString(request[0u].asString(), request[1u].asString()); } - - inline virtual void shhUninstallFilterI(const Json::Value& request, Json::Value& response) + inline virtual void postI(const Json::Value &request, Json::Value &response) { - response = this->shhUninstallFilter(request[0u].asInt()); + response = this->post(request[0u]); } - - inline virtual void stateAtI(const Json::Value& request, Json::Value& response) + inline virtual void newIdentityI(const Json::Value &request, Json::Value &response) { - response = this->stateAt(request[0u].asString(), request[1u].asString()); + (void)request; + response = this->newIdentity(); } - - inline virtual void transactI(const Json::Value& request, Json::Value& response) + inline virtual void haveIdentityI(const Json::Value &request, Json::Value &response) { - response = this->transact(request[0u]); + response = this->haveIdentity(request[0u].asString()); } - - inline virtual void transactionByHashI(const Json::Value& request, Json::Value& response) + inline virtual void newGroupI(const Json::Value &request, Json::Value &response) { - response = this->transactionByHash(request[0u].asString(), request[1u].asInt()); + response = this->newGroup(request[0u].asString(), request[1u].asString()); } - - inline virtual void transactionByNumberI(const Json::Value& request, Json::Value& response) + inline virtual void addToGroupI(const Json::Value &request, Json::Value &response) { - response = this->transactionByNumber(request[0u].asInt(), request[1u].asInt()); + response = this->addToGroup(request[0u].asString(), request[1u].asString()); } - - inline virtual void uncleByHashI(const Json::Value& request, Json::Value& response) + inline virtual void shhNewFilterI(const Json::Value &request, Json::Value &response) { - response = this->uncleByHash(request[0u].asString(), request[1u].asInt()); + response = this->shhNewFilter(request[0u]); } - - inline virtual void uncleByNumberI(const Json::Value& request, Json::Value& response) + inline virtual void shhUninstallFilterI(const Json::Value &request, Json::Value &response) { - response = this->uncleByNumber(request[0u].asInt(), request[1u].asInt()); + response = this->shhUninstallFilter(request[0u].asInt()); } - - inline virtual void uninstallFilterI(const Json::Value& request, Json::Value& response) + inline virtual void shhChangedI(const Json::Value &request, Json::Value &response) { - response = this->uninstallFilter(request[0u].asInt()); + response = this->shhChanged(request[0u].asInt()); } - - - virtual std::string account() = 0; - virtual Json::Value accounts() = 0; - virtual std::string addToGroup(const std::string& param1, const std::string& param2) = 0; - virtual std::string balanceAt(const std::string& param1) = 0; - virtual Json::Value blockByHash(const std::string& param1) = 0; - virtual Json::Value blockByNumber(const int& param1) = 0; - virtual std::string call(const Json::Value& param1) = 0; - virtual bool changed(const int& param1) = 0; - virtual std::string codeAt(const std::string& param1) = 0; virtual std::string coinbase() = 0; - virtual std::string compile(const std::string& param1) = 0; - virtual double countAt(const std::string& param1) = 0; - virtual int defaultBlock() = 0; - virtual std::string gasPrice() = 0; - virtual std::string get(const std::string& param1, const std::string& param2) = 0; - virtual Json::Value getMessages(const int& param1) = 0; - virtual std::string getString(const std::string& param1, const std::string& param2) = 0; - virtual bool haveIdentity(const std::string& param1) = 0; + virtual bool setCoinbase(const std::string& param1) = 0; virtual bool listening() = 0; + virtual bool setListening(const bool& param1) = 0; virtual bool mining() = 0; - virtual int newFilter(const Json::Value& param1) = 0; - virtual int newFilterString(const std::string& param1) = 0; - virtual std::string newGroup(const std::string& param1, const std::string& param2) = 0; - virtual std::string newIdentity() = 0; - virtual int number() = 0; + virtual bool setMining(const bool& param1) = 0; + virtual std::string gasPrice() = 0; + virtual std::string account() = 0; + virtual Json::Value accounts() = 0; virtual int peerCount() = 0; - virtual bool post(const Json::Value& param1) = 0; - virtual bool put(const std::string& param1, const std::string& param2, const std::string& param3) = 0; - virtual bool putString(const std::string& param1, const std::string& param2, const std::string& param3) = 0; - virtual bool setCoinbase(const std::string& param1) = 0; + virtual int defaultBlock() = 0; virtual bool setDefaultBlock(const int& param1) = 0; - virtual bool setListening(const bool& param1) = 0; - virtual bool setMining(const bool& param1) = 0; - virtual Json::Value shhChanged(const int& param1) = 0; - virtual int shhNewFilter(const Json::Value& param1) = 0; - virtual bool shhUninstallFilter(const int& param1) = 0; + virtual int number() = 0; + virtual std::string balanceAt(const std::string& param1) = 0; virtual std::string stateAt(const std::string& param1, const std::string& param2) = 0; + virtual double countAt(const std::string& param1) = 0; + virtual std::string codeAt(const std::string& param1) = 0; virtual std::string transact(const Json::Value& param1) = 0; + virtual std::string call(const Json::Value& param1) = 0; + virtual Json::Value blockByHash(const std::string& param1) = 0; + virtual Json::Value blockByNumber(const int& param1) = 0; virtual Json::Value transactionByHash(const std::string& param1, const int& param2) = 0; virtual Json::Value transactionByNumber(const int& param1, const int& param2) = 0; virtual Json::Value uncleByHash(const std::string& param1, const int& param2) = 0; virtual Json::Value uncleByNumber(const int& param1, const int& param2) = 0; + virtual std::string compile(const std::string& param1) = 0; + virtual int newFilter(const Json::Value& param1) = 0; + virtual int newFilterString(const std::string& param1) = 0; virtual bool uninstallFilter(const int& param1) = 0; - + virtual bool changed(const int& param1) = 0; + virtual Json::Value getMessages(const int& param1) = 0; + virtual bool put(const std::string& param1, const std::string& param2, const std::string& param3) = 0; + virtual std::string get(const std::string& param1, const std::string& param2) = 0; + virtual bool putString(const std::string& param1, const std::string& param2, const std::string& param3) = 0; + virtual std::string getString(const std::string& param1, const std::string& param2) = 0; + virtual bool post(const Json::Value& param1) = 0; + virtual std::string newIdentity() = 0; + virtual bool haveIdentity(const std::string& param1) = 0; + virtual std::string newGroup(const std::string& param1, const std::string& param2) = 0; + virtual std::string addToGroup(const std::string& param1, const std::string& param2) = 0; + virtual int shhNewFilter(const Json::Value& param1) = 0; + virtual bool shhUninstallFilter(const int& param1) = 0; + virtual Json::Value shhChanged(const int& param1) = 0; }; -#endif //_ABSTRACTWEBTHREESTUBSERVER_H_ + +#endif //JSONRPC_CPP_ABSTRACTWEBTHREESTUBSERVER_H_ diff --git a/libweb3jsonrpc/spec.json b/libweb3jsonrpc/spec.json index 1e7065970..aea50adf9 100644 --- a/libweb3jsonrpc/spec.json +++ b/libweb3jsonrpc/spec.json @@ -1,55 +1,55 @@ [ - { "method": "coinbase", "params": [], "order": [], "returns" : "" }, - { "method": "setCoinbase", "params": [""], "order": [], "returns" : true }, - { "method": "listening", "params": [], "order": [], "returns" : false }, - { "method": "setListening", "params": [false], "order" : [], "returns" : true }, - { "method": "mining", "params": [], "order": [], "returns" : false }, - { "method": "setMining", "params": [false], "order" : [], "returns" : true }, - { "method": "gasPrice", "params": [], "order": [], "returns" : "" }, - { "method": "account", "params": [], "order": [], "returns" : "" }, - { "method": "accounts", "params": [], "order": [], "returns" : [] }, - { "method": "peerCount", "params": [], "order": [], "returns" : 0 }, - { "method": "defaultBlock", "params": [], "order": [], "returns" : 0}, - { "method": "setDefaultBlock", "params": [0], "order": [], "returns" : true}, - { "method": "number", "params": [], "order": [], "returns" : 0}, - - { "method": "balanceAt", "params": [""], "order": [], "returns" : ""}, - { "method": "stateAt", "params": ["", ""], "order": [], "returns": ""}, - { "method": "countAt", "params": [""], "order": [], "returns" : 0.0}, - { "method": "codeAt", "params": [""], "order": [], "returns": ""}, - - { "method": "transact", "params": [{}], "order": [], "returns": ""}, - { "method": "call", "params": [{}], "order": [], "returns": ""}, - - { "method": "blockByHash", "params": [""],"order": [], "returns": {}}, - { "method": "blockByNumber", "params": [0],"order": [], "returns": {}}, - { "method": "transactionByHash", "params": ["", 0], "order": [], "returns": {}}, - { "method": "transactionByNumber", "params": [0, 0], "order": [], "returns": {}}, - { "method": "uncleByHash", "params": ["", 0], "order": [], "returns": {}}, - { "method": "uncleByNumber", "params": [0, 0], "order": [], "returns": {}}, - - { "method": "compile", "params": [""], "order": [], "returns": ""}, - - { "method": "newFilter", "params": [{}], "order": [], "returns": 0}, - { "method": "newFilterString", "params": [""], "order": [], "returns": 0}, - { "method": "uninstallFilter", "params": [0], "order": [], "returns": true}, - { "method": "changed", "params": [0], "order": [], "returns": false}, - { "method": "getMessages", "params": [0], "order": [], "returns": []}, - - { "method": "put", "params": ["", "", ""], "order": [], "returns": true}, - { "method": "get", "params": ["", ""], "order": [], "returns": ""}, - { "method": "putString", "params": ["", "", ""], "order": [], "returns": true}, - { "method": "getString", "params": ["", ""], "order": [], "returns": ""}, - - { "method": "post", "params": [{}], "order": [], "returns": true}, - { "method": "newIdentity", "params": [], "order": [], "returns": ""}, - { "method": "haveIdentity", "params": [""], "order": [], "returns": false}, - { "method": "newGroup", "params": ["", ""], "order": [], "returns": ""}, - { "method": "addToGroup", "params": ["", ""], "order": [], "returns": ""}, + { "name": "coinbase", "params": [], "order": [], "returns" : "" }, + { "name": "setCoinbase", "params": [""], "order": [], "returns" : true }, + { "name": "listening", "params": [], "order": [], "returns" : false }, + { "name": "setListening", "params": [false], "order" : [], "returns" : true }, + { "name": "mining", "params": [], "order": [], "returns" : false }, + { "name": "setMining", "params": [false], "order" : [], "returns" : true }, + { "name": "gasPrice", "params": [], "order": [], "returns" : "" }, + { "name": "account", "params": [], "order": [], "returns" : "" }, + { "name": "accounts", "params": [], "order": [], "returns" : [] }, + { "name": "peerCount", "params": [], "order": [], "returns" : 0 }, + { "name": "defaultBlock", "params": [], "order": [], "returns" : 0}, + { "name": "setDefaultBlock", "params": [0], "order": [], "returns" : true}, + { "name": "number", "params": [], "order": [], "returns" : 0}, + + { "name": "balanceAt", "params": [""], "order": [], "returns" : ""}, + { "name": "stateAt", "params": ["", ""], "order": [], "returns": ""}, + { "name": "countAt", "params": [""], "order": [], "returns" : 0.0}, + { "name": "codeAt", "params": [""], "order": [], "returns": ""}, + + { "name": "transact", "params": [{}], "order": [], "returns": ""}, + { "name": "call", "params": [{}], "order": [], "returns": ""}, + + { "name": "blockByHash", "params": [""],"order": [], "returns": {}}, + { "name": "blockByNumber", "params": [0],"order": [], "returns": {}}, + { "name": "transactionByHash", "params": ["", 0], "order": [], "returns": {}}, + { "name": "transactionByNumber", "params": [0, 0], "order": [], "returns": {}}, + { "name": "uncleByHash", "params": ["", 0], "order": [], "returns": {}}, + { "name": "uncleByNumber", "params": [0, 0], "order": [], "returns": {}}, + + { "name": "compile", "params": [""], "order": [], "returns": ""}, + + { "name": "newFilter", "params": [{}], "order": [], "returns": 0}, + { "name": "newFilterString", "params": [""], "order": [], "returns": 0}, + { "name": "uninstallFilter", "params": [0], "order": [], "returns": true}, + { "name": "changed", "params": [0], "order": [], "returns": false}, + { "name": "getMessages", "params": [0], "order": [], "returns": []}, + + { "name": "put", "params": ["", "", ""], "order": [], "returns": true}, + { "name": "get", "params": ["", ""], "order": [], "returns": ""}, + { "name": "putString", "params": ["", "", ""], "order": [], "returns": true}, + { "name": "getString", "params": ["", ""], "order": [], "returns": ""}, + + { "name": "post", "params": [{}], "order": [], "returns": true}, + { "name": "newIdentity", "params": [], "order": [], "returns": ""}, + { "name": "haveIdentity", "params": [""], "order": [], "returns": false}, + { "name": "newGroup", "params": ["", ""], "order": [], "returns": ""}, + { "name": "addToGroup", "params": ["", ""], "order": [], "returns": ""}, - { "method": "shhNewFilter", "params": [{}], "order": [], "returns": 0}, - { "method": "shhUninstallFilter", "params": [0], "order": [], "returns": true}, - { "method": "shhChanged", "params": [0], "order": [], "returns": []} + { "name": "shhNewFilter", "params": [{}], "order": [], "returns": 0}, + { "name": "shhUninstallFilter", "params": [0], "order": [], "returns": true}, + { "name": "shhChanged", "params": [0], "order": [], "returns": []} ] diff --git a/neth/main.cpp b/neth/main.cpp index 4e3a0f40a..8512cf77b 100644 --- a/neth/main.cpp +++ b/neth/main.cpp @@ -27,7 +27,7 @@ #include #include #if ETH_JSONRPC -#include +#include #endif #include #include diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index a11c9fa16..63094fa23 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -18,6 +18,7 @@ target_link_libraries(testeth ${CRYPTOPP_LS}) target_link_libraries(testeth webthree) if(JSONRPC_LS) target_link_libraries(testeth web3jsonrpc) +target_link_libraries(testeth ${JSONRPC_CLIENT_LS}) endif() target_link_libraries(createRandomTest ethereum) diff --git a/test/jsonrpc.cpp b/test/jsonrpc.cpp index 033339ec2..f261a5164 100644 --- a/test/jsonrpc.cpp +++ b/test/jsonrpc.cpp @@ -29,8 +29,10 @@ #include #include #include -#include -#include +#include +#include +//#include +//#include #include #include "JsonSpiritHeaders.h" #include "TestHelper.h" @@ -54,7 +56,8 @@ dev::WebThreeDirect web3(name, dbPath, true, s, np); unique_ptr jsonrpcServer; unique_ptr jsonrpcClient; - +jsonrpc::HttpClient httpClient("http://localhost:8080"); + struct JsonrpcFixture { JsonrpcFixture() { @@ -66,7 +69,7 @@ struct JsonrpcFixture { jsonrpcServer->setIdentities({}); jsonrpcServer->StartListening(); - jsonrpcClient = unique_ptr(new WebThreeStubClient(new jsonrpc::HttpClient("http://localhost:8080"))); + jsonrpcClient = unique_ptr(new WebThreeStubClient(httpClient)); } ~JsonrpcFixture() { diff --git a/test/webthreestubclient.h b/test/webthreestubclient.h index 6beee5bb6..abe146efc 100644 --- a/test/webthreestubclient.h +++ b/test/webthreestubclient.h @@ -1,587 +1,460 @@ /** - * THIS FILE IS GENERATED BY jsonrpcstub, DO NOT CHANGE IT!!!!! + * This file is generated by jsonrpcstub, DO NOT CHANGE IT MANUALLY! */ -#ifndef _WEBTHREESTUBCLIENT_H_ -#define _WEBTHREESTUBCLIENT_H_ +#ifndef JSONRPC_CPP_STUB_WEBTHREESTUBCLIENT_H_ +#define JSONRPC_CPP_STUB_WEBTHREESTUBCLIENT_H_ -#include +#include -class WebThreeStubClient +class WebThreeStubClient : public jsonrpc::Client { public: - WebThreeStubClient(jsonrpc::AbstractClientConnector* conn) - { - this->client = new jsonrpc::Client(conn); - } - ~WebThreeStubClient() - { - delete this->client; - } + WebThreeStubClient(jsonrpc::IClientConnector &conn) : jsonrpc::Client(conn) {} - std::string account() throw (jsonrpc::JsonRpcException) + std::string coinbase() throw (jsonrpc::JsonRpcException) { Json::Value p; p = Json::nullValue; - Json::Value result = this->client->CallMethod("account",p); - if (result.isString()) - return result.asString(); - else - throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); - + Json::Value result = this->CallMethod("coinbase",p); + if (result.isString()) + return result.asString(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - - Json::Value accounts() throw (jsonrpc::JsonRpcException) + bool setCoinbase(const std::string& param1) throw (jsonrpc::JsonRpcException) { Json::Value p; - p = Json::nullValue; - Json::Value result = this->client->CallMethod("accounts",p); - if (result.isArray()) - return result; - else - throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); - + p.append(param1); + Json::Value result = this->CallMethod("setCoinbase",p); + if (result.isBool()) + return result.asBool(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - - std::string addToGroup(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException) + bool listening() throw (jsonrpc::JsonRpcException) { Json::Value p; - p.append(param1); -p.append(param2); - - Json::Value result = this->client->CallMethod("addToGroup",p); - if (result.isString()) - return result.asString(); - else - throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); - + p = Json::nullValue; + Json::Value result = this->CallMethod("listening",p); + if (result.isBool()) + return result.asBool(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - - std::string balanceAt(const std::string& param1) throw (jsonrpc::JsonRpcException) + bool setListening(const bool& param1) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); - - Json::Value result = this->client->CallMethod("balanceAt",p); - if (result.isString()) - return result.asString(); - else - throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); - + Json::Value result = this->CallMethod("setListening",p); + if (result.isBool()) + return result.asBool(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - - Json::Value blockByHash(const std::string& param1) throw (jsonrpc::JsonRpcException) + bool mining() throw (jsonrpc::JsonRpcException) { Json::Value p; - p.append(param1); - - Json::Value result = this->client->CallMethod("blockByHash",p); - if (result.isObject()) - return result; - else - throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); - + p = Json::nullValue; + Json::Value result = this->CallMethod("mining",p); + if (result.isBool()) + return result.asBool(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - - Json::Value blockByNumber(const int& param1) throw (jsonrpc::JsonRpcException) + bool setMining(const bool& param1) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); - - Json::Value result = this->client->CallMethod("blockByNumber",p); - if (result.isObject()) - return result; - else - throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); - + Json::Value result = this->CallMethod("setMining",p); + if (result.isBool()) + return result.asBool(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - - std::string call(const Json::Value& param1) throw (jsonrpc::JsonRpcException) + std::string gasPrice() throw (jsonrpc::JsonRpcException) { Json::Value p; - p.append(param1); - - Json::Value result = this->client->CallMethod("call",p); - if (result.isString()) - return result.asString(); - else - throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); - + p = Json::nullValue; + Json::Value result = this->CallMethod("gasPrice",p); + if (result.isString()) + return result.asString(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - - bool changed(const int& param1) throw (jsonrpc::JsonRpcException) + std::string account() throw (jsonrpc::JsonRpcException) { Json::Value p; - p.append(param1); - - Json::Value result = this->client->CallMethod("changed",p); - if (result.isBool()) - return result.asBool(); - else - throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); - + p = Json::nullValue; + Json::Value result = this->CallMethod("account",p); + if (result.isString()) + return result.asString(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - - std::string codeAt(const std::string& param1) throw (jsonrpc::JsonRpcException) + Json::Value accounts() throw (jsonrpc::JsonRpcException) { Json::Value p; - p.append(param1); - - Json::Value result = this->client->CallMethod("codeAt",p); - if (result.isString()) - return result.asString(); - else - throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); - + p = Json::nullValue; + Json::Value result = this->CallMethod("accounts",p); + if (result.isArray()) + return result; + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - - std::string coinbase() throw (jsonrpc::JsonRpcException) + int peerCount() throw (jsonrpc::JsonRpcException) { Json::Value p; p = Json::nullValue; - Json::Value result = this->client->CallMethod("coinbase",p); - if (result.isString()) - return result.asString(); - else - throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); - + Json::Value result = this->CallMethod("peerCount",p); + if (result.isInt()) + return result.asInt(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - - std::string compile(const std::string& param1) throw (jsonrpc::JsonRpcException) + int defaultBlock() throw (jsonrpc::JsonRpcException) { Json::Value p; - p.append(param1); - - Json::Value result = this->client->CallMethod("compile",p); - if (result.isString()) - return result.asString(); - else - throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); - + p = Json::nullValue; + Json::Value result = this->CallMethod("defaultBlock",p); + if (result.isInt()) + return result.asInt(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - - double countAt(const std::string& param1) throw (jsonrpc::JsonRpcException) + bool setDefaultBlock(const int& param1) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); - - Json::Value result = this->client->CallMethod("countAt",p); - if (result.isDouble()) - return result.asDouble(); - else - throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); - + Json::Value result = this->CallMethod("setDefaultBlock",p); + if (result.isBool()) + return result.asBool(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - - int defaultBlock() throw (jsonrpc::JsonRpcException) + int number() throw (jsonrpc::JsonRpcException) { Json::Value p; p = Json::nullValue; - Json::Value result = this->client->CallMethod("defaultBlock",p); - if (result.isInt()) - return result.asInt(); - else - throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); - + Json::Value result = this->CallMethod("number",p); + if (result.isInt()) + return result.asInt(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - - std::string gasPrice() throw (jsonrpc::JsonRpcException) + std::string balanceAt(const std::string& param1) throw (jsonrpc::JsonRpcException) { Json::Value p; - p = Json::nullValue; - Json::Value result = this->client->CallMethod("gasPrice",p); - if (result.isString()) - return result.asString(); - else - throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); - + p.append(param1); + Json::Value result = this->CallMethod("balanceAt",p); + if (result.isString()) + return result.asString(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - - std::string get(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException) + std::string stateAt(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); -p.append(param2); - - Json::Value result = this->client->CallMethod("get",p); - if (result.isString()) - return result.asString(); - else - throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); - + p.append(param2); + Json::Value result = this->CallMethod("stateAt",p); + if (result.isString()) + return result.asString(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - - Json::Value getMessages(const int& param1) throw (jsonrpc::JsonRpcException) + double countAt(const std::string& param1) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); - - Json::Value result = this->client->CallMethod("getMessages",p); - if (result.isArray()) - return result; - else - throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); - + Json::Value result = this->CallMethod("countAt",p); + if (result.isDouble()) + return result.asDouble(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - - std::string getString(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException) + std::string codeAt(const std::string& param1) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); -p.append(param2); - - Json::Value result = this->client->CallMethod("getString",p); - if (result.isString()) - return result.asString(); - else - throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); - + Json::Value result = this->CallMethod("codeAt",p); + if (result.isString()) + return result.asString(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - - bool haveIdentity(const std::string& param1) throw (jsonrpc::JsonRpcException) + std::string transact(const Json::Value& param1) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); - - Json::Value result = this->client->CallMethod("haveIdentity",p); - if (result.isBool()) - return result.asBool(); - else - throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); - + Json::Value result = this->CallMethod("transact",p); + if (result.isString()) + return result.asString(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - - bool listening() throw (jsonrpc::JsonRpcException) + std::string call(const Json::Value& param1) throw (jsonrpc::JsonRpcException) { Json::Value p; - p = Json::nullValue; - Json::Value result = this->client->CallMethod("listening",p); - if (result.isBool()) - return result.asBool(); - else - throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); - + p.append(param1); + Json::Value result = this->CallMethod("call",p); + if (result.isString()) + return result.asString(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - - bool mining() throw (jsonrpc::JsonRpcException) + Json::Value blockByHash(const std::string& param1) throw (jsonrpc::JsonRpcException) { Json::Value p; - p = Json::nullValue; - Json::Value result = this->client->CallMethod("mining",p); - if (result.isBool()) - return result.asBool(); - else - throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); - + p.append(param1); + Json::Value result = this->CallMethod("blockByHash",p); + if (result.isObject()) + return result; + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - - int newFilter(const Json::Value& param1) throw (jsonrpc::JsonRpcException) + Json::Value blockByNumber(const int& param1) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); - - Json::Value result = this->client->CallMethod("newFilter",p); - if (result.isInt()) - return result.asInt(); - else - throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); - + Json::Value result = this->CallMethod("blockByNumber",p); + if (result.isObject()) + return result; + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - - int newFilterString(const std::string& param1) throw (jsonrpc::JsonRpcException) + Json::Value transactionByHash(const std::string& param1, const int& param2) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); - - Json::Value result = this->client->CallMethod("newFilterString",p); - if (result.isInt()) - return result.asInt(); - else - throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); - + p.append(param2); + Json::Value result = this->CallMethod("transactionByHash",p); + if (result.isObject()) + return result; + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - - std::string newGroup(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException) + Json::Value transactionByNumber(const int& param1, const int& param2) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); -p.append(param2); - - Json::Value result = this->client->CallMethod("newGroup",p); - if (result.isString()) - return result.asString(); - else - throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); - + p.append(param2); + Json::Value result = this->CallMethod("transactionByNumber",p); + if (result.isObject()) + return result; + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - - std::string newIdentity() throw (jsonrpc::JsonRpcException) + Json::Value uncleByHash(const std::string& param1, const int& param2) throw (jsonrpc::JsonRpcException) { Json::Value p; - p = Json::nullValue; - Json::Value result = this->client->CallMethod("newIdentity",p); - if (result.isString()) - return result.asString(); - else - throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); - + p.append(param1); + p.append(param2); + Json::Value result = this->CallMethod("uncleByHash",p); + if (result.isObject()) + return result; + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - - int number() throw (jsonrpc::JsonRpcException) + Json::Value uncleByNumber(const int& param1, const int& param2) throw (jsonrpc::JsonRpcException) { Json::Value p; - p = Json::nullValue; - Json::Value result = this->client->CallMethod("number",p); - if (result.isInt()) - return result.asInt(); - else - throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); - + p.append(param1); + p.append(param2); + Json::Value result = this->CallMethod("uncleByNumber",p); + if (result.isObject()) + return result; + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - - int peerCount() throw (jsonrpc::JsonRpcException) + std::string compile(const std::string& param1) throw (jsonrpc::JsonRpcException) { Json::Value p; - p = Json::nullValue; - Json::Value result = this->client->CallMethod("peerCount",p); - if (result.isInt()) - return result.asInt(); - else - throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); - + p.append(param1); + Json::Value result = this->CallMethod("compile",p); + if (result.isString()) + return result.asString(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - - bool post(const Json::Value& param1) throw (jsonrpc::JsonRpcException) + int newFilter(const Json::Value& param1) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); - - Json::Value result = this->client->CallMethod("post",p); - if (result.isBool()) - return result.asBool(); - else - throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); - + Json::Value result = this->CallMethod("newFilter",p); + if (result.isInt()) + return result.asInt(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - - bool put(const std::string& param1, const std::string& param2, const std::string& param3) throw (jsonrpc::JsonRpcException) + int newFilterString(const std::string& param1) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); -p.append(param2); -p.append(param3); - - Json::Value result = this->client->CallMethod("put",p); - if (result.isBool()) - return result.asBool(); - else - throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); - + Json::Value result = this->CallMethod("newFilterString",p); + if (result.isInt()) + return result.asInt(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - - bool putString(const std::string& param1, const std::string& param2, const std::string& param3) throw (jsonrpc::JsonRpcException) + bool uninstallFilter(const int& param1) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); -p.append(param2); -p.append(param3); - - Json::Value result = this->client->CallMethod("putString",p); - if (result.isBool()) - return result.asBool(); - else - throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); - + Json::Value result = this->CallMethod("uninstallFilter",p); + if (result.isBool()) + return result.asBool(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - - bool setCoinbase(const std::string& param1) throw (jsonrpc::JsonRpcException) + bool changed(const int& param1) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); - - Json::Value result = this->client->CallMethod("setCoinbase",p); - if (result.isBool()) - return result.asBool(); - else - throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); - + Json::Value result = this->CallMethod("changed",p); + if (result.isBool()) + return result.asBool(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - - bool setDefaultBlock(const int& param1) throw (jsonrpc::JsonRpcException) + Json::Value getMessages(const int& param1) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); - - Json::Value result = this->client->CallMethod("setDefaultBlock",p); - if (result.isBool()) - return result.asBool(); - else - throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); - + Json::Value result = this->CallMethod("getMessages",p); + if (result.isArray()) + return result; + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - - bool setListening(const bool& param1) throw (jsonrpc::JsonRpcException) + bool put(const std::string& param1, const std::string& param2, const std::string& param3) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); - - Json::Value result = this->client->CallMethod("setListening",p); - if (result.isBool()) - return result.asBool(); - else - throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); - + p.append(param2); + p.append(param3); + Json::Value result = this->CallMethod("put",p); + if (result.isBool()) + return result.asBool(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - - bool setMining(const bool& param1) throw (jsonrpc::JsonRpcException) + std::string get(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); - - Json::Value result = this->client->CallMethod("setMining",p); - if (result.isBool()) - return result.asBool(); - else - throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); - + p.append(param2); + Json::Value result = this->CallMethod("get",p); + if (result.isString()) + return result.asString(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - - Json::Value shhChanged(const int& param1) throw (jsonrpc::JsonRpcException) + bool putString(const std::string& param1, const std::string& param2, const std::string& param3) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); - - Json::Value result = this->client->CallMethod("shhChanged",p); - if (result.isArray()) - return result; - else - throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); - + p.append(param2); + p.append(param3); + Json::Value result = this->CallMethod("putString",p); + if (result.isBool()) + return result.asBool(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - - int shhNewFilter(const Json::Value& param1) throw (jsonrpc::JsonRpcException) + std::string getString(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); - - Json::Value result = this->client->CallMethod("shhNewFilter",p); - if (result.isInt()) - return result.asInt(); - else - throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); - + p.append(param2); + Json::Value result = this->CallMethod("getString",p); + if (result.isString()) + return result.asString(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - - bool shhUninstallFilter(const int& param1) throw (jsonrpc::JsonRpcException) + bool post(const Json::Value& param1) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); - - Json::Value result = this->client->CallMethod("shhUninstallFilter",p); - if (result.isBool()) - return result.asBool(); - else - throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); - + Json::Value result = this->CallMethod("post",p); + if (result.isBool()) + return result.asBool(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - - std::string stateAt(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException) + std::string newIdentity() throw (jsonrpc::JsonRpcException) { Json::Value p; - p.append(param1); -p.append(param2); - - Json::Value result = this->client->CallMethod("stateAt",p); - if (result.isString()) - return result.asString(); - else - throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); - + p = Json::nullValue; + Json::Value result = this->CallMethod("newIdentity",p); + if (result.isString()) + return result.asString(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - - std::string transact(const Json::Value& param1) throw (jsonrpc::JsonRpcException) + bool haveIdentity(const std::string& param1) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); - - Json::Value result = this->client->CallMethod("transact",p); - if (result.isString()) - return result.asString(); - else - throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); - + Json::Value result = this->CallMethod("haveIdentity",p); + if (result.isBool()) + return result.asBool(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - - Json::Value transactionByHash(const std::string& param1, const int& param2) throw (jsonrpc::JsonRpcException) + std::string newGroup(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); -p.append(param2); - - Json::Value result = this->client->CallMethod("transactionByHash",p); - if (result.isObject()) - return result; - else - throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); - + p.append(param2); + Json::Value result = this->CallMethod("newGroup",p); + if (result.isString()) + return result.asString(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - - Json::Value transactionByNumber(const int& param1, const int& param2) throw (jsonrpc::JsonRpcException) + std::string addToGroup(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); -p.append(param2); - - Json::Value result = this->client->CallMethod("transactionByNumber",p); - if (result.isObject()) - return result; - else - throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); - + p.append(param2); + Json::Value result = this->CallMethod("addToGroup",p); + if (result.isString()) + return result.asString(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - - Json::Value uncleByHash(const std::string& param1, const int& param2) throw (jsonrpc::JsonRpcException) + int shhNewFilter(const Json::Value& param1) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); -p.append(param2); - - Json::Value result = this->client->CallMethod("uncleByHash",p); - if (result.isObject()) - return result; - else - throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); - + Json::Value result = this->CallMethod("shhNewFilter",p); + if (result.isInt()) + return result.asInt(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - - Json::Value uncleByNumber(const int& param1, const int& param2) throw (jsonrpc::JsonRpcException) + bool shhUninstallFilter(const int& param1) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); -p.append(param2); - - Json::Value result = this->client->CallMethod("uncleByNumber",p); - if (result.isObject()) - return result; - else - throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); - + Json::Value result = this->CallMethod("shhUninstallFilter",p); + if (result.isBool()) + return result.asBool(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - - bool uninstallFilter(const int& param1) throw (jsonrpc::JsonRpcException) + Json::Value shhChanged(const int& param1) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); - - Json::Value result = this->client->CallMethod("uninstallFilter",p); - if (result.isBool()) - return result.asBool(); - else - throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); - + Json::Value result = this->CallMethod("shhChanged",p); + if (result.isArray()) + return result; + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - - private: - jsonrpc::Client* client; }; -#endif //_WEBTHREESTUBCLIENT_H_ + +#endif //JSONRPC_CPP_WEBTHREESTUBCLIENT_H_