Browse Source

jsonrpc 0.3.0 working, needs cleanup

cl-refactor
Marek Kotewicz 10 years ago
parent
commit
3d70090fe4
  1. 38
      cmake/EthDependenciesDeprecated.cmake
  2. 2
      eth/main.cpp
  3. 3
      libqethereum/QEthereum.h
  4. 2
      libweb3jsonrpc/CMakeLists.txt
  5. 3
      libweb3jsonrpc/CorsHttpServer.h
  6. 2
      libweb3jsonrpc/WebThreeStubServer.cpp
  7. 3
      libweb3jsonrpc/WebThreeStubServer.h
  8. 368
      libweb3jsonrpc/abstractwebthreestubserver.h
  9. 100
      libweb3jsonrpc/spec.json
  10. 2
      neth/main.cpp
  11. 1
      test/CMakeLists.txt
  12. 11
      test/jsonrpc.cpp
  13. 713
      test/webthreestubclient.h

38
cmake/EthDependenciesDeprecated.cmake

@ -125,21 +125,47 @@ else()
message(STATUS "Failed to find the miniupnpc headers!") message(STATUS "Failed to find the miniupnpc headers!")
endif () endif ()
find_path( JSONRPC_ID jsonrpc/rpc.h find_path( JSONRPC_ID jsonrpccpp/server.h
/usr/include /usr/include
/usr/local/include /usr/local/include
) )
if ( JSONRPC_ID ) if ( JSONRPC_ID )
message(STATUS "Found jsonrpc headers") message(STATUS "Found jsonrpc headers")
find_library( JSONRPC_LS NAMES jsonrpc find_library( JSONRPC_LS NAMES jsonrpccpp-server
PATHS PATHS
/usr/lib /usr/lib
/usr/local/lib /usr/local/lib
/opt/local/lib /opt/local/lib
/usr/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 library: ${JSONRPC_LS}")
message(STATUS "Found jsonrpc-common library: ${JSONRPC_COMMON_LS}")
add_definitions(-DETH_JSONRPC) add_definitions(-DETH_JSONRPC)
else () else ()
message(STATUS "Failed to find the jsonrpc library!") message(STATUS "Failed to find the jsonrpc library!")

2
eth/main.cpp

@ -28,7 +28,7 @@
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/trim_all.hpp> #include <boost/algorithm/string/trim_all.hpp>
#if ETH_JSONRPC #if ETH_JSONRPC
#include <jsonrpc/connectors/httpserver.h> //#include <jsonrpc/connectors/httpserver.h>
#include <libweb3jsonrpc/CorsHttpServer.h> #include <libweb3jsonrpc/CorsHttpServer.h>
#endif #endif
#include <libdevcrypto/FileSystem.h> #include <libdevcrypto/FileSystem.h>

3
libqethereum/QEthereum.h

@ -25,7 +25,8 @@
#include <QtCore/QObject> #include <QtCore/QObject>
#include <QtCore/QString> #include <QtCore/QString>
#include <jsonrpc/rpc.h> #include <jsonrpccpp/server.h>
//#include <jsonrpc/rpc.h>
class QWebThree: public QObject class QWebThree: public QObject
{ {

2
libweb3jsonrpc/CMakeLists.txt

@ -23,7 +23,9 @@ if(MINIUPNPC_LS)
endif() endif()
target_link_libraries(${EXECUTABLE} ${LEVELDB_LS}) target_link_libraries(${EXECUTABLE} ${LEVELDB_LS})
target_link_libraries(${EXECUTABLE} ${CRYPTOPP_LS}) target_link_libraries(${EXECUTABLE} ${CRYPTOPP_LS})
target_link_libraries(${EXECUTABLE} ${JSONCPP_LS})
target_link_libraries(${EXECUTABLE} ${JSONRPC_LS}) target_link_libraries(${EXECUTABLE} ${JSONRPC_LS})
target_link_libraries(${EXECUTABLE} ${JSONRPC_COMMON_LS})
target_link_libraries(${EXECUTABLE} ${LEVELDB_LS}) target_link_libraries(${EXECUTABLE} ${LEVELDB_LS})
if(READLINE_LS) if(READLINE_LS)
target_link_libraries(${EXECUTABLE} ${READLINE_LS}) target_link_libraries(${EXECUTABLE} ${READLINE_LS})

3
libweb3jsonrpc/CorsHttpServer.h

@ -19,7 +19,8 @@
* @date 2014 * @date 2014
*/ */
#include <jsonrpc/connectors/httpserver.h> #include <jsonrpccpp/server/connectors/httpserver.h>
//#include <jsonrpc/connectors/httpserver.h>
namespace jsonrpc namespace jsonrpc
{ {

2
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<dev::KeyPair> const& _accounts): WebThreeStubServer::WebThreeStubServer(jsonrpc::AbstractServerConnector* _conn, WebThreeDirect& _web3, std::vector<dev::KeyPair> const& _accounts):
AbstractWebThreeStubServer(_conn), AbstractWebThreeStubServer(*_conn),
m_web3(_web3) m_web3(_web3)
{ {
setAccounts(_accounts); setAccounts(_accounts);

3
libweb3jsonrpc/WebThreeStubServer.h

@ -29,7 +29,8 @@
#pragma warning(pop) #pragma warning(pop)
#include <iostream> #include <iostream>
#include <jsonrpc/rpc.h> //#include <jsonrpc/rpc.h>
#include <jsonrpccpp/server.h>
#include <libdevcrypto/Common.h> #include <libdevcrypto/Common.h>
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-parameter"

368
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_ #ifndef JSONRPC_CPP_STUB_ABSTRACTWEBTHREESTUBSERVER_H_
#define _ABSTRACTWEBTHREESTUBSERVER_H_ #define JSONRPC_CPP_STUB_ABSTRACTWEBTHREESTUBSERVER_H_
#include <jsonrpc/rpc.h> #include <jsonrpccpp/server.h>
class AbstractWebThreeStubServer : public jsonrpc::AbstractServer<AbstractWebThreeStubServer> class AbstractWebThreeStubServer : public jsonrpc::AbstractServer<AbstractWebThreeStubServer>
{ {
public: public:
AbstractWebThreeStubServer(jsonrpc::AbstractServerConnector* conn) : AbstractWebThreeStubServer(jsonrpc::AbstractServerConnector &conn) : jsonrpc::AbstractServer<AbstractWebThreeStubServer>(conn)
jsonrpc::AbstractServer<AbstractWebThreeStubServer>(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("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("setCoinbase", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::setCoinbaseI);
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("listening", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, NULL), &AbstractWebThreeStubServer::listeningI); 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("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("setMining", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_BOOLEAN, NULL), &AbstractWebThreeStubServer::setMiningI);
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("gasPrice", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::gasPriceI);
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("account", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::accountI);
this->bindAndAddMethod(new jsonrpc::Procedure("newIdentity", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::newIdentityI); this->bindAndAddMethod(new jsonrpc::Procedure("accounts", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_ARRAY, NULL), &AbstractWebThreeStubServer::accountsI);
this->bindAndAddMethod(new jsonrpc::Procedure("number", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::numberI);
this->bindAndAddMethod(new jsonrpc::Procedure("peerCount", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::peerCountI); 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("defaultBlock", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::defaultBlockI);
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("setDefaultBlock", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::setDefaultBlockI); 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("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("balanceAt", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::balanceAtI);
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("stateAt", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::stateAtI); 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("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("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("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("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("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("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 setCoinbaseI(const Json::Value &request, Json::Value &response)
inline virtual void accountsI(const Json::Value& request, Json::Value& response)
{ {
response = this->accounts(); response = this->setCoinbase(request[0u].asString());
} }
inline virtual void listeningI(const Json::Value &request, Json::Value &response)
inline virtual void addToGroupI(const Json::Value& request, Json::Value& response)
{ {
response = this->addToGroup(request[0u].asString(), request[1u].asString()); (void)request;
response = this->listening();
} }
inline virtual void setListeningI(const Json::Value &request, Json::Value &response)
inline virtual void balanceAtI(const Json::Value& request, Json::Value& response)
{ {
response = this->balanceAt(request[0u].asString()); response = this->setListening(request[0u].asBool());
} }
inline virtual void miningI(const Json::Value &request, Json::Value &response)
inline virtual void blockByHashI(const Json::Value& request, Json::Value& response)
{ {
response = this->blockByHash(request[0u].asString()); (void)request;
response = this->mining();
} }
inline virtual void setMiningI(const Json::Value &request, Json::Value &response)
inline virtual void blockByNumberI(const Json::Value& request, Json::Value& response)
{ {
response = this->blockByNumber(request[0u].asInt()); response = this->setMining(request[0u].asBool());
} }
inline virtual void gasPriceI(const Json::Value &request, Json::Value &response)
inline virtual void callI(const Json::Value& request, Json::Value& response)
{ {
response = this->call(request[0u]); (void)request;
response = this->gasPrice();
} }
inline virtual void accountI(const Json::Value &request, Json::Value &response)
inline virtual void changedI(const Json::Value& request, Json::Value& response)
{ {
response = this->changed(request[0u].asInt()); (void)request;
response = this->account();
} }
inline virtual void accountsI(const Json::Value &request, Json::Value &response)
inline virtual void codeAtI(const Json::Value& request, Json::Value& response)
{ {
response = this->codeAt(request[0u].asString()); (void)request;
response = this->accounts();
} }
inline virtual void peerCountI(const Json::Value &request, Json::Value &response)
inline virtual void coinbaseI(const Json::Value& request, Json::Value& response)
{ {
response = this->coinbase(); (void)request;
response = this->peerCount();
} }
inline virtual void defaultBlockI(const Json::Value &request, Json::Value &response)
inline virtual void compileI(const Json::Value& request, Json::Value& response)
{ {
response = this->compile(request[0u].asString()); (void)request;
response = this->defaultBlock();
} }
inline virtual void setDefaultBlockI(const Json::Value &request, Json::Value &response)
inline virtual void countAtI(const Json::Value& request, Json::Value& response)
{ {
response = this->countAt(request[0u].asString()); response = this->setDefaultBlock(request[0u].asInt());
} }
inline virtual void numberI(const Json::Value &request, Json::Value &response)
inline virtual void defaultBlockI(const Json::Value& request, Json::Value& response)
{ {
response = this->defaultBlock(); (void)request;
response = this->number();
} }
inline virtual void balanceAtI(const Json::Value &request, Json::Value &response)
inline virtual void gasPriceI(const Json::Value& request, Json::Value& response)
{ {
response = this->gasPrice(); response = this->balanceAt(request[0u].asString());
} }
inline virtual void stateAtI(const Json::Value &request, Json::Value &response)
inline virtual void getI(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 countAtI(const Json::Value &request, Json::Value &response)
inline virtual void getMessagesI(const Json::Value& request, Json::Value& response)
{ {
response = this->getMessages(request[0u].asInt()); response = this->countAt(request[0u].asString());
} }
inline virtual void codeAtI(const Json::Value &request, Json::Value &response)
inline virtual void getStringI(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 transactI(const Json::Value &request, Json::Value &response)
inline virtual void haveIdentityI(const Json::Value& request, Json::Value& response)
{ {
response = this->haveIdentity(request[0u].asString()); response = this->transact(request[0u]);
} }
inline virtual void callI(const Json::Value &request, Json::Value &response)
inline virtual void listeningI(const Json::Value& request, Json::Value& response)
{ {
response = this->listening(); response = this->call(request[0u]);
} }
inline virtual void blockByHashI(const Json::Value &request, Json::Value &response)
inline virtual void miningI(const Json::Value& request, Json::Value& response)
{ {
response = this->mining(); response = this->blockByHash(request[0u].asString());
} }
inline virtual void blockByNumberI(const Json::Value &request, Json::Value &response)
inline virtual void newFilterI(const Json::Value& request, Json::Value& response)
{ {
response = this->newFilter(request[0u]); response = this->blockByNumber(request[0u].asInt());
} }
inline virtual void transactionByHashI(const Json::Value &request, Json::Value &response)
inline virtual void newFilterStringI(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 transactionByNumberI(const Json::Value &request, Json::Value &response)
inline virtual void newGroupI(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 uncleByHashI(const Json::Value &request, Json::Value &response)
inline virtual void newIdentityI(const Json::Value& request, Json::Value& response)
{ {
response = this->newIdentity(); response = this->uncleByHash(request[0u].asString(), request[1u].asInt());
} }
inline virtual void uncleByNumberI(const Json::Value &request, Json::Value &response)
inline virtual void numberI(const Json::Value& request, Json::Value& response)
{ {
response = this->number(); response = this->uncleByNumber(request[0u].asInt(), request[1u].asInt());
} }
inline virtual void compileI(const Json::Value &request, Json::Value &response)
inline virtual void peerCountI(const Json::Value& request, Json::Value& response)
{ {
response = this->peerCount(); response = this->compile(request[0u].asString());
} }
inline virtual void newFilterI(const Json::Value &request, Json::Value &response)
inline virtual void postI(const Json::Value& request, Json::Value& response)
{ {
response = this->post(request[0u]); response = this->newFilter(request[0u]);
} }
inline virtual void newFilterStringI(const Json::Value &request, Json::Value &response)
inline virtual void putI(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 uninstallFilterI(const Json::Value &request, Json::Value &response)
inline virtual void putStringI(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 changedI(const Json::Value &request, Json::Value &response)
inline virtual void setCoinbaseI(const Json::Value& request, Json::Value& response)
{ {
response = this->setCoinbase(request[0u].asString()); response = this->changed(request[0u].asInt());
} }
inline virtual void getMessagesI(const Json::Value &request, Json::Value &response)
inline virtual void setDefaultBlockI(const Json::Value& request, Json::Value& response)
{ {
response = this->setDefaultBlock(request[0u].asInt()); response = this->getMessages(request[0u].asInt());
} }
inline virtual void putI(const Json::Value &request, Json::Value &response)
inline virtual void setListeningI(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 getI(const Json::Value &request, Json::Value &response)
inline virtual void setMiningI(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 putStringI(const Json::Value &request, Json::Value &response)
inline virtual void shhChangedI(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 getStringI(const Json::Value &request, Json::Value &response)
inline virtual void shhNewFilterI(const Json::Value& request, Json::Value& response)
{ {
response = this->shhNewFilter(request[0u]); response = this->getString(request[0u].asString(), request[1u].asString());
} }
inline virtual void postI(const Json::Value &request, Json::Value &response)
inline virtual void shhUninstallFilterI(const Json::Value& request, Json::Value& response)
{ {
response = this->shhUninstallFilter(request[0u].asInt()); response = this->post(request[0u]);
} }
inline virtual void newIdentityI(const Json::Value &request, Json::Value &response)
inline virtual void stateAtI(const Json::Value& request, Json::Value& response)
{ {
response = this->stateAt(request[0u].asString(), request[1u].asString()); (void)request;
response = this->newIdentity();
} }
inline virtual void haveIdentityI(const Json::Value &request, Json::Value &response)
inline virtual void transactI(const Json::Value& request, Json::Value& response)
{ {
response = this->transact(request[0u]); response = this->haveIdentity(request[0u].asString());
} }
inline virtual void newGroupI(const Json::Value &request, Json::Value &response)
inline virtual void transactionByHashI(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 addToGroupI(const Json::Value &request, Json::Value &response)
inline virtual void transactionByNumberI(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 shhNewFilterI(const Json::Value &request, Json::Value &response)
inline virtual void uncleByHashI(const Json::Value& request, Json::Value& response)
{ {
response = this->uncleByHash(request[0u].asString(), request[1u].asInt()); response = this->shhNewFilter(request[0u]);
} }
inline virtual void shhUninstallFilterI(const Json::Value &request, Json::Value &response)
inline virtual void uncleByNumberI(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 shhChangedI(const Json::Value &request, Json::Value &response)
inline virtual void uninstallFilterI(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 coinbase() = 0;
virtual std::string compile(const std::string& param1) = 0; virtual bool setCoinbase(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 listening() = 0; virtual bool listening() = 0;
virtual bool setListening(const bool& param1) = 0;
virtual bool mining() = 0; virtual bool mining() = 0;
virtual int newFilter(const Json::Value& param1) = 0; virtual bool setMining(const bool& param1) = 0;
virtual int newFilterString(const std::string& param1) = 0; virtual std::string gasPrice() = 0;
virtual std::string newGroup(const std::string& param1, const std::string& param2) = 0; virtual std::string account() = 0;
virtual std::string newIdentity() = 0; virtual Json::Value accounts() = 0;
virtual int number() = 0;
virtual int peerCount() = 0; virtual int peerCount() = 0;
virtual bool post(const Json::Value& param1) = 0; virtual int defaultBlock() = 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 bool setDefaultBlock(const int& param1) = 0; virtual bool setDefaultBlock(const int& param1) = 0;
virtual bool setListening(const bool& param1) = 0; virtual int number() = 0;
virtual bool setMining(const bool& param1) = 0; virtual std::string balanceAt(const std::string& 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 std::string stateAt(const std::string& param1, const std::string& param2) = 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 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 transactionByHash(const std::string& param1, const int& param2) = 0;
virtual Json::Value transactionByNumber(const int& 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 uncleByHash(const std::string& param1, const int& param2) = 0;
virtual Json::Value uncleByNumber(const int& 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 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_

100
libweb3jsonrpc/spec.json

@ -1,55 +1,55 @@
[ [
{ "method": "coinbase", "params": [], "order": [], "returns" : "" }, { "name": "coinbase", "params": [], "order": [], "returns" : "" },
{ "method": "setCoinbase", "params": [""], "order": [], "returns" : true }, { "name": "setCoinbase", "params": [""], "order": [], "returns" : true },
{ "method": "listening", "params": [], "order": [], "returns" : false }, { "name": "listening", "params": [], "order": [], "returns" : false },
{ "method": "setListening", "params": [false], "order" : [], "returns" : true }, { "name": "setListening", "params": [false], "order" : [], "returns" : true },
{ "method": "mining", "params": [], "order": [], "returns" : false }, { "name": "mining", "params": [], "order": [], "returns" : false },
{ "method": "setMining", "params": [false], "order" : [], "returns" : true }, { "name": "setMining", "params": [false], "order" : [], "returns" : true },
{ "method": "gasPrice", "params": [], "order": [], "returns" : "" }, { "name": "gasPrice", "params": [], "order": [], "returns" : "" },
{ "method": "account", "params": [], "order": [], "returns" : "" }, { "name": "account", "params": [], "order": [], "returns" : "" },
{ "method": "accounts", "params": [], "order": [], "returns" : [] }, { "name": "accounts", "params": [], "order": [], "returns" : [] },
{ "method": "peerCount", "params": [], "order": [], "returns" : 0 }, { "name": "peerCount", "params": [], "order": [], "returns" : 0 },
{ "method": "defaultBlock", "params": [], "order": [], "returns" : 0}, { "name": "defaultBlock", "params": [], "order": [], "returns" : 0},
{ "method": "setDefaultBlock", "params": [0], "order": [], "returns" : true}, { "name": "setDefaultBlock", "params": [0], "order": [], "returns" : true},
{ "method": "number", "params": [], "order": [], "returns" : 0}, { "name": "number", "params": [], "order": [], "returns" : 0},
{ "method": "balanceAt", "params": [""], "order": [], "returns" : ""}, { "name": "balanceAt", "params": [""], "order": [], "returns" : ""},
{ "method": "stateAt", "params": ["", ""], "order": [], "returns": ""}, { "name": "stateAt", "params": ["", ""], "order": [], "returns": ""},
{ "method": "countAt", "params": [""], "order": [], "returns" : 0.0}, { "name": "countAt", "params": [""], "order": [], "returns" : 0.0},
{ "method": "codeAt", "params": [""], "order": [], "returns": ""}, { "name": "codeAt", "params": [""], "order": [], "returns": ""},
{ "method": "transact", "params": [{}], "order": [], "returns": ""}, { "name": "transact", "params": [{}], "order": [], "returns": ""},
{ "method": "call", "params": [{}], "order": [], "returns": ""}, { "name": "call", "params": [{}], "order": [], "returns": ""},
{ "method": "blockByHash", "params": [""],"order": [], "returns": {}}, { "name": "blockByHash", "params": [""],"order": [], "returns": {}},
{ "method": "blockByNumber", "params": [0],"order": [], "returns": {}}, { "name": "blockByNumber", "params": [0],"order": [], "returns": {}},
{ "method": "transactionByHash", "params": ["", 0], "order": [], "returns": {}}, { "name": "transactionByHash", "params": ["", 0], "order": [], "returns": {}},
{ "method": "transactionByNumber", "params": [0, 0], "order": [], "returns": {}}, { "name": "transactionByNumber", "params": [0, 0], "order": [], "returns": {}},
{ "method": "uncleByHash", "params": ["", 0], "order": [], "returns": {}}, { "name": "uncleByHash", "params": ["", 0], "order": [], "returns": {}},
{ "method": "uncleByNumber", "params": [0, 0], "order": [], "returns": {}}, { "name": "uncleByNumber", "params": [0, 0], "order": [], "returns": {}},
{ "method": "compile", "params": [""], "order": [], "returns": ""}, { "name": "compile", "params": [""], "order": [], "returns": ""},
{ "method": "newFilter", "params": [{}], "order": [], "returns": 0}, { "name": "newFilter", "params": [{}], "order": [], "returns": 0},
{ "method": "newFilterString", "params": [""], "order": [], "returns": 0}, { "name": "newFilterString", "params": [""], "order": [], "returns": 0},
{ "method": "uninstallFilter", "params": [0], "order": [], "returns": true}, { "name": "uninstallFilter", "params": [0], "order": [], "returns": true},
{ "method": "changed", "params": [0], "order": [], "returns": false}, { "name": "changed", "params": [0], "order": [], "returns": false},
{ "method": "getMessages", "params": [0], "order": [], "returns": []}, { "name": "getMessages", "params": [0], "order": [], "returns": []},
{ "method": "put", "params": ["", "", ""], "order": [], "returns": true}, { "name": "put", "params": ["", "", ""], "order": [], "returns": true},
{ "method": "get", "params": ["", ""], "order": [], "returns": ""}, { "name": "get", "params": ["", ""], "order": [], "returns": ""},
{ "method": "putString", "params": ["", "", ""], "order": [], "returns": true}, { "name": "putString", "params": ["", "", ""], "order": [], "returns": true},
{ "method": "getString", "params": ["", ""], "order": [], "returns": ""}, { "name": "getString", "params": ["", ""], "order": [], "returns": ""},
{ "method": "post", "params": [{}], "order": [], "returns": true}, { "name": "post", "params": [{}], "order": [], "returns": true},
{ "method": "newIdentity", "params": [], "order": [], "returns": ""}, { "name": "newIdentity", "params": [], "order": [], "returns": ""},
{ "method": "haveIdentity", "params": [""], "order": [], "returns": false}, { "name": "haveIdentity", "params": [""], "order": [], "returns": false},
{ "method": "newGroup", "params": ["", ""], "order": [], "returns": ""}, { "name": "newGroup", "params": ["", ""], "order": [], "returns": ""},
{ "method": "addToGroup", "params": ["", ""], "order": [], "returns": ""}, { "name": "addToGroup", "params": ["", ""], "order": [], "returns": ""},
{ "method": "shhNewFilter", "params": [{}], "order": [], "returns": 0}, { "name": "shhNewFilter", "params": [{}], "order": [], "returns": 0},
{ "method": "shhUninstallFilter", "params": [0], "order": [], "returns": true}, { "name": "shhUninstallFilter", "params": [0], "order": [], "returns": true},
{ "method": "shhChanged", "params": [0], "order": [], "returns": []} { "name": "shhChanged", "params": [0], "order": [], "returns": []}
] ]

2
neth/main.cpp

@ -27,7 +27,7 @@
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/trim_all.hpp> #include <boost/algorithm/string/trim_all.hpp>
#if ETH_JSONRPC #if ETH_JSONRPC
#include <jsonrpc/connectors/httpserver.h> #include <jsonrpccpp/server/connectors/httpserver.h>
#endif #endif
#include <libdevcrypto/FileSystem.h> #include <libdevcrypto/FileSystem.h>
#include <libevmface/Instruction.h> #include <libevmface/Instruction.h>

1
test/CMakeLists.txt

@ -18,6 +18,7 @@ target_link_libraries(testeth ${CRYPTOPP_LS})
target_link_libraries(testeth webthree) target_link_libraries(testeth webthree)
if(JSONRPC_LS) if(JSONRPC_LS)
target_link_libraries(testeth web3jsonrpc) target_link_libraries(testeth web3jsonrpc)
target_link_libraries(testeth ${JSONRPC_CLIENT_LS})
endif() endif()
target_link_libraries(createRandomTest ethereum) target_link_libraries(createRandomTest ethereum)

11
test/jsonrpc.cpp

@ -29,8 +29,10 @@
#include <libwebthree/WebThree.h> #include <libwebthree/WebThree.h>
#include <libweb3jsonrpc/WebThreeStubServer.h> #include <libweb3jsonrpc/WebThreeStubServer.h>
#include <libweb3jsonrpc/CorsHttpServer.h> #include <libweb3jsonrpc/CorsHttpServer.h>
#include <jsonrpc/connectors/httpserver.h> #include <jsonrpccpp/server/connectors/httpserver.h>
#include <jsonrpc/connectors/httpclient.h> #include <jsonrpccpp/client/connectors/httpclient.h>
//#include <jsonrpc/connectors/httpserver.h>
//#include <jsonrpc/connectors/httpclient.h>
#include <set> #include <set>
#include "JsonSpiritHeaders.h" #include "JsonSpiritHeaders.h"
#include "TestHelper.h" #include "TestHelper.h"
@ -54,7 +56,8 @@ dev::WebThreeDirect web3(name, dbPath, true, s, np);
unique_ptr<WebThreeStubServer> jsonrpcServer; unique_ptr<WebThreeStubServer> jsonrpcServer;
unique_ptr<WebThreeStubClient> jsonrpcClient; unique_ptr<WebThreeStubClient> jsonrpcClient;
jsonrpc::HttpClient httpClient("http://localhost:8080");
struct JsonrpcFixture { struct JsonrpcFixture {
JsonrpcFixture() JsonrpcFixture()
{ {
@ -66,7 +69,7 @@ struct JsonrpcFixture {
jsonrpcServer->setIdentities({}); jsonrpcServer->setIdentities({});
jsonrpcServer->StartListening(); jsonrpcServer->StartListening();
jsonrpcClient = unique_ptr<WebThreeStubClient>(new WebThreeStubClient(new jsonrpc::HttpClient("http://localhost:8080"))); jsonrpcClient = unique_ptr<WebThreeStubClient>(new WebThreeStubClient(httpClient));
} }
~JsonrpcFixture() ~JsonrpcFixture()
{ {

713
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_ #ifndef JSONRPC_CPP_STUB_WEBTHREESTUBCLIENT_H_
#define _WEBTHREESTUBCLIENT_H_ #define JSONRPC_CPP_STUB_WEBTHREESTUBCLIENT_H_
#include <jsonrpc/rpc.h> #include <jsonrpccpp/client.h>
class WebThreeStubClient class WebThreeStubClient : public jsonrpc::Client
{ {
public: public:
WebThreeStubClient(jsonrpc::AbstractClientConnector* conn) WebThreeStubClient(jsonrpc::IClientConnector &conn) : jsonrpc::Client(conn) {}
{
this->client = new jsonrpc::Client(conn);
}
~WebThreeStubClient()
{
delete this->client;
}
std::string account() throw (jsonrpc::JsonRpcException) std::string coinbase() throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p = Json::nullValue; p = Json::nullValue;
Json::Value result = this->client->CallMethod("account",p); Json::Value result = this->CallMethod("coinbase",p);
if (result.isString()) if (result.isString())
return result.asString(); return result.asString();
else else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
bool setCoinbase(const std::string& param1) throw (jsonrpc::JsonRpcException)
Json::Value accounts() throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p = Json::nullValue; p.append(param1);
Json::Value result = this->client->CallMethod("accounts",p); Json::Value result = this->CallMethod("setCoinbase",p);
if (result.isArray()) if (result.isBool())
return result; return result.asBool();
else else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
bool listening() throw (jsonrpc::JsonRpcException)
std::string addToGroup(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p.append(param1); p = Json::nullValue;
p.append(param2); Json::Value result = this->CallMethod("listening",p);
if (result.isBool())
Json::Value result = this->client->CallMethod("addToGroup",p); return result.asBool();
if (result.isString()) else
return result.asString(); throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
bool setListening(const bool& param1) throw (jsonrpc::JsonRpcException)
std::string balanceAt(const std::string& param1) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p.append(param1); p.append(param1);
Json::Value result = this->CallMethod("setListening",p);
Json::Value result = this->client->CallMethod("balanceAt",p); if (result.isBool())
if (result.isString()) return result.asBool();
return result.asString(); else
else throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
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; Json::Value p;
p.append(param1); p = Json::nullValue;
Json::Value result = this->CallMethod("mining",p);
Json::Value result = this->client->CallMethod("blockByHash",p); if (result.isBool())
if (result.isObject()) return result.asBool();
return result; else
else throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
bool setMining(const bool& param1) throw (jsonrpc::JsonRpcException)
Json::Value blockByNumber(const int& param1) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p.append(param1); p.append(param1);
Json::Value result = this->CallMethod("setMining",p);
Json::Value result = this->client->CallMethod("blockByNumber",p); if (result.isBool())
if (result.isObject()) return result.asBool();
return result; else
else throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
std::string gasPrice() throw (jsonrpc::JsonRpcException)
std::string call(const Json::Value& param1) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p.append(param1); p = Json::nullValue;
Json::Value result = this->CallMethod("gasPrice",p);
Json::Value result = this->client->CallMethod("call",p); if (result.isString())
if (result.isString()) return result.asString();
return result.asString(); else
else throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
std::string account() throw (jsonrpc::JsonRpcException)
bool changed(const int& param1) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p.append(param1); p = Json::nullValue;
Json::Value result = this->CallMethod("account",p);
Json::Value result = this->client->CallMethod("changed",p); if (result.isString())
if (result.isBool()) return result.asString();
return result.asBool(); else
else throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
Json::Value accounts() throw (jsonrpc::JsonRpcException)
std::string codeAt(const std::string& param1) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p.append(param1); p = Json::nullValue;
Json::Value result = this->CallMethod("accounts",p);
Json::Value result = this->client->CallMethod("codeAt",p); if (result.isArray())
if (result.isString()) return result;
return result.asString(); else
else throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
int peerCount() throw (jsonrpc::JsonRpcException)
std::string coinbase() throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p = Json::nullValue; p = Json::nullValue;
Json::Value result = this->client->CallMethod("coinbase",p); Json::Value result = this->CallMethod("peerCount",p);
if (result.isString()) if (result.isInt())
return result.asString(); return result.asInt();
else else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
int defaultBlock() throw (jsonrpc::JsonRpcException)
std::string compile(const std::string& param1) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p.append(param1); p = Json::nullValue;
Json::Value result = this->CallMethod("defaultBlock",p);
Json::Value result = this->client->CallMethod("compile",p); if (result.isInt())
if (result.isString()) return result.asInt();
return result.asString(); else
else throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
bool setDefaultBlock(const int& param1) throw (jsonrpc::JsonRpcException)
double countAt(const std::string& param1) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p.append(param1); p.append(param1);
Json::Value result = this->CallMethod("setDefaultBlock",p);
Json::Value result = this->client->CallMethod("countAt",p); if (result.isBool())
if (result.isDouble()) return result.asBool();
return result.asDouble(); else
else throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
int number() throw (jsonrpc::JsonRpcException)
int defaultBlock() throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p = Json::nullValue; p = Json::nullValue;
Json::Value result = this->client->CallMethod("defaultBlock",p); Json::Value result = this->CallMethod("number",p);
if (result.isInt()) if (result.isInt())
return result.asInt(); return result.asInt();
else else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
std::string balanceAt(const std::string& param1) throw (jsonrpc::JsonRpcException)
std::string gasPrice() throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p = Json::nullValue; p.append(param1);
Json::Value result = this->client->CallMethod("gasPrice",p); Json::Value result = this->CallMethod("balanceAt",p);
if (result.isString()) if (result.isString())
return result.asString(); return result.asString();
else else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); 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 get(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p.append(param1); p.append(param1);
p.append(param2); p.append(param2);
Json::Value result = this->CallMethod("stateAt",p);
Json::Value result = this->client->CallMethod("get",p); if (result.isString())
if (result.isString()) return result.asString();
return result.asString(); else
else throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
double countAt(const std::string& param1) throw (jsonrpc::JsonRpcException)
Json::Value getMessages(const int& param1) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p.append(param1); p.append(param1);
Json::Value result = this->CallMethod("countAt",p);
Json::Value result = this->client->CallMethod("getMessages",p); if (result.isDouble())
if (result.isArray()) return result.asDouble();
return result; else
else throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
std::string codeAt(const std::string& param1) throw (jsonrpc::JsonRpcException)
std::string getString(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p.append(param1); p.append(param1);
p.append(param2); Json::Value result = this->CallMethod("codeAt",p);
if (result.isString())
Json::Value result = this->client->CallMethod("getString",p); return result.asString();
if (result.isString()) else
return result.asString(); throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
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; Json::Value p;
p.append(param1); p.append(param1);
Json::Value result = this->CallMethod("transact",p);
Json::Value result = this->client->CallMethod("haveIdentity",p); if (result.isString())
if (result.isBool()) return result.asString();
return result.asBool(); else
else throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
std::string call(const Json::Value& param1) throw (jsonrpc::JsonRpcException)
bool listening() throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p = Json::nullValue; p.append(param1);
Json::Value result = this->client->CallMethod("listening",p); Json::Value result = this->CallMethod("call",p);
if (result.isBool()) if (result.isString())
return result.asBool(); return result.asString();
else else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); 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; Json::Value p;
p = Json::nullValue; p.append(param1);
Json::Value result = this->client->CallMethod("mining",p); Json::Value result = this->CallMethod("blockByHash",p);
if (result.isBool()) if (result.isObject())
return result.asBool(); return result;
else else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
Json::Value blockByNumber(const int& param1) throw (jsonrpc::JsonRpcException)
int newFilter(const Json::Value& param1) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p.append(param1); p.append(param1);
Json::Value result = this->CallMethod("blockByNumber",p);
Json::Value result = this->client->CallMethod("newFilter",p); if (result.isObject())
if (result.isInt()) return result;
return result.asInt(); else
else throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
Json::Value transactionByHash(const std::string& param1, const int& param2) throw (jsonrpc::JsonRpcException)
int newFilterString(const std::string& param1) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p.append(param1); p.append(param1);
p.append(param2);
Json::Value result = this->client->CallMethod("newFilterString",p); Json::Value result = this->CallMethod("transactionByHash",p);
if (result.isInt()) if (result.isObject())
return result.asInt(); return result;
else else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); 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 newGroup(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p.append(param1); p.append(param1);
p.append(param2); p.append(param2);
Json::Value result = this->CallMethod("transactionByNumber",p);
Json::Value result = this->client->CallMethod("newGroup",p); if (result.isObject())
if (result.isString()) return result;
return result.asString(); else
else throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
Json::Value uncleByHash(const std::string& param1, const int& param2) throw (jsonrpc::JsonRpcException)
std::string newIdentity() throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p = Json::nullValue; p.append(param1);
Json::Value result = this->client->CallMethod("newIdentity",p); p.append(param2);
if (result.isString()) Json::Value result = this->CallMethod("uncleByHash",p);
return result.asString(); if (result.isObject())
else return result;
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
Json::Value uncleByNumber(const int& param1, const int& param2) throw (jsonrpc::JsonRpcException)
int number() throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p = Json::nullValue; p.append(param1);
Json::Value result = this->client->CallMethod("number",p); p.append(param2);
if (result.isInt()) Json::Value result = this->CallMethod("uncleByNumber",p);
return result.asInt(); if (result.isObject())
else return result;
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
std::string compile(const std::string& param1) throw (jsonrpc::JsonRpcException)
int peerCount() throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p = Json::nullValue; p.append(param1);
Json::Value result = this->client->CallMethod("peerCount",p); Json::Value result = this->CallMethod("compile",p);
if (result.isInt()) if (result.isString())
return result.asInt(); return result.asString();
else else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
int newFilter(const Json::Value& param1) throw (jsonrpc::JsonRpcException)
bool post(const Json::Value& param1) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p.append(param1); p.append(param1);
Json::Value result = this->CallMethod("newFilter",p);
Json::Value result = this->client->CallMethod("post",p); if (result.isInt())
if (result.isBool()) return result.asInt();
return result.asBool(); else
else throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
int newFilterString(const std::string& param1) throw (jsonrpc::JsonRpcException)
bool put(const std::string& param1, const std::string& param2, const std::string& param3) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p.append(param1); p.append(param1);
p.append(param2); Json::Value result = this->CallMethod("newFilterString",p);
p.append(param3); if (result.isInt())
return result.asInt();
Json::Value result = this->client->CallMethod("put",p); else
if (result.isBool()) throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
return result.asBool();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
bool uninstallFilter(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; Json::Value p;
p.append(param1); p.append(param1);
p.append(param2); Json::Value result = this->CallMethod("uninstallFilter",p);
p.append(param3); if (result.isBool())
return result.asBool();
Json::Value result = this->client->CallMethod("putString",p); else
if (result.isBool()) throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
return result.asBool();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
bool changed(const int& param1) throw (jsonrpc::JsonRpcException)
bool setCoinbase(const std::string& param1) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p.append(param1); p.append(param1);
Json::Value result = this->CallMethod("changed",p);
Json::Value result = this->client->CallMethod("setCoinbase",p); if (result.isBool())
if (result.isBool()) return result.asBool();
return result.asBool(); else
else throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
Json::Value getMessages(const int& param1) throw (jsonrpc::JsonRpcException)
bool setDefaultBlock(const int& param1) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p.append(param1); p.append(param1);
Json::Value result = this->CallMethod("getMessages",p);
Json::Value result = this->client->CallMethod("setDefaultBlock",p); if (result.isArray())
if (result.isBool()) return result;
return result.asBool(); else
else throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
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)
bool setListening(const bool& param1) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p.append(param1); p.append(param1);
p.append(param2);
Json::Value result = this->client->CallMethod("setListening",p); p.append(param3);
if (result.isBool()) Json::Value result = this->CallMethod("put",p);
return result.asBool(); if (result.isBool())
else return result.asBool();
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); 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)
bool setMining(const bool& param1) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p.append(param1); p.append(param1);
p.append(param2);
Json::Value result = this->client->CallMethod("setMining",p); Json::Value result = this->CallMethod("get",p);
if (result.isBool()) if (result.isString())
return result.asBool(); return result.asString();
else else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); 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)
Json::Value shhChanged(const int& param1) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p.append(param1); p.append(param1);
p.append(param2);
Json::Value result = this->client->CallMethod("shhChanged",p); p.append(param3);
if (result.isArray()) Json::Value result = this->CallMethod("putString",p);
return result; if (result.isBool())
else return result.asBool();
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); 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)
int shhNewFilter(const Json::Value& param1) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p.append(param1); p.append(param1);
p.append(param2);
Json::Value result = this->client->CallMethod("shhNewFilter",p); Json::Value result = this->CallMethod("getString",p);
if (result.isInt()) if (result.isString())
return result.asInt(); return result.asString();
else else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
bool post(const Json::Value& param1) throw (jsonrpc::JsonRpcException)
bool shhUninstallFilter(const int& param1) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p.append(param1); p.append(param1);
Json::Value result = this->CallMethod("post",p);
Json::Value result = this->client->CallMethod("shhUninstallFilter",p); if (result.isBool())
if (result.isBool()) return result.asBool();
return result.asBool(); else
else throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
std::string newIdentity() throw (jsonrpc::JsonRpcException)
std::string stateAt(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p.append(param1); p = Json::nullValue;
p.append(param2); Json::Value result = this->CallMethod("newIdentity",p);
if (result.isString())
Json::Value result = this->client->CallMethod("stateAt",p); return result.asString();
if (result.isString()) else
return result.asString(); throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
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; Json::Value p;
p.append(param1); p.append(param1);
Json::Value result = this->CallMethod("haveIdentity",p);
Json::Value result = this->client->CallMethod("transact",p); if (result.isBool())
if (result.isString()) return result.asBool();
return result.asString(); else
else throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
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 transactionByHash(const std::string& param1, const int& param2) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p.append(param1); p.append(param1);
p.append(param2); p.append(param2);
Json::Value result = this->CallMethod("newGroup",p);
Json::Value result = this->client->CallMethod("transactionByHash",p); if (result.isString())
if (result.isObject()) return result.asString();
return result; else
else throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
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)
Json::Value transactionByNumber(const int& param1, const int& param2) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p.append(param1); p.append(param1);
p.append(param2); p.append(param2);
Json::Value result = this->CallMethod("addToGroup",p);
Json::Value result = this->client->CallMethod("transactionByNumber",p); if (result.isString())
if (result.isObject()) return result.asString();
return result; else
else throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
int shhNewFilter(const Json::Value& param1) throw (jsonrpc::JsonRpcException)
Json::Value uncleByHash(const std::string& param1, const int& param2) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p.append(param1); p.append(param1);
p.append(param2); Json::Value result = this->CallMethod("shhNewFilter",p);
if (result.isInt())
Json::Value result = this->client->CallMethod("uncleByHash",p); return result.asInt();
if (result.isObject()) else
return result; throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
bool shhUninstallFilter(const int& param1) throw (jsonrpc::JsonRpcException)
Json::Value uncleByNumber(const int& param1, const int& param2) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p.append(param1); p.append(param1);
p.append(param2); Json::Value result = this->CallMethod("shhUninstallFilter",p);
if (result.isBool())
Json::Value result = this->client->CallMethod("uncleByNumber",p); return result.asBool();
if (result.isObject()) else
return result; throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
Json::Value shhChanged(const int& param1) throw (jsonrpc::JsonRpcException)
bool uninstallFilter(const int& param1) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p.append(param1); p.append(param1);
Json::Value result = this->CallMethod("shhChanged",p);
Json::Value result = this->client->CallMethod("uninstallFilter",p); if (result.isArray())
if (result.isBool()) return result;
return result.asBool(); else
else throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
private:
jsonrpc::Client* client;
}; };
#endif //_WEBTHREESTUBCLIENT_H_
#endif //JSONRPC_CPP_WEBTHREESTUBCLIENT_H_

Loading…
Cancel
Save