Browse Source

ethrpc -> web3jsonrpc, other issues fixed

cl-refactor
Marek Kotewicz 10 years ago
parent
commit
d76a44f226
  1. 6
      CMakeLists.txt
  2. 2
      alethzero/CMakeLists.txt
  3. 2
      alethzero/MainWin.cpp
  4. 4
      eth/CMakeLists.txt
  5. 22
      eth/main.cpp
  6. 2
      libweb3jsonrpc/CMakeLists.txt
  7. 0
      libweb3jsonrpc/CorsHttpServer.cpp
  8. 0
      libweb3jsonrpc/CorsHttpServer.h
  9. 0
      libweb3jsonrpc/WebThreeStubServer.cpp
  10. 0
      libweb3jsonrpc/WebThreeStubServer.h
  11. 0
      libweb3jsonrpc/abstractwebthreestubserver.h
  12. 0
      libweb3jsonrpc/spec.json
  13. 4
      neth/CMakeLists.txt
  14. 24
      neth/main.cpp
  15. 4
      test/CMakeLists.txt
  16. 4
      test/jsonrpc.cpp
  17. 3
      third/CMakeLists.txt
  18. 2
      third/MainWin.cpp

6
CMakeLists.txt

@ -119,7 +119,9 @@ endif()
add_subdirectory(lllc)
add_subdirectory(solc)
add_subdirectory(sc)
add_subdirectory(libethrpc)
if (JSONRPC_LS OR (NOT HEADLESS))
add_subdirectory(libweb3jsonrpc)
endif()
if (NOT LANGUAGES)
add_subdirectory(secp256k1)
add_subdirectory(libp2p)
@ -148,7 +150,7 @@ if (NOT LANGUAGES)
if ("${TARGET_PLATFORM}" STREQUAL "w64")
cmake_policy(SET CMP0020 NEW)
endif ()
add_subdirectory(libqethereum)
add_subdirectory(alethzero)
add_subdirectory(third)

2
alethzero/CMakeLists.txt

@ -53,7 +53,7 @@ else ()
endif ()
qt5_use_modules(${EXECUTEABLE} Core)# Gui Widgets Network WebKit WebKitWidgets)
target_link_libraries(${EXECUTEABLE} webthree qethereum ethereum evm ethcore devcrypto secp256k1 gmp ${CRYPTOPP_LS} serpent lll evmface devcore ethrpc)
target_link_libraries(${EXECUTEABLE} webthree qethereum ethereum evm ethcore devcrypto secp256k1 gmp ${CRYPTOPP_LS} serpent lll evmface devcore web3jsonrpc)
if (APPLE)
# First have qt5 install plugins and frameworks

2
alethzero/MainWin.cpp

@ -41,7 +41,7 @@
#include <libethereum/Client.h>
#include <libethereum/EthereumHost.h>
#include <libethereum/DownloadMan.h>
#include <libethrpc/WebThreeStubServer.h>
#include <libweb3jsonrpc/WebThreeStubServer.h>
#include "DownloadView.h"
#include "MiningView.h"
#include "BuildInfo.h"

4
eth/CMakeLists.txt

@ -19,7 +19,9 @@ if(MINIUPNPC_LS)
endif()
target_link_libraries(${EXECUTABLE} ${LEVELDB_LS})
target_link_libraries(${EXECUTABLE} ${CRYPTOPP_LS})
target_link_libraries(${EXECUTABLE} ethrpc)
if(JSONRPC_LS)
target_link_libraries(${EXECUTABLE} web3jsonrpc)
endif()
if(READLINE_LS)
target_link_libraries(${EXECUTABLE} ${READLINE_LS})
endif()

22
eth/main.cpp

@ -27,9 +27,10 @@
#include <signal.h>
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/trim_all.hpp>
#include <jsonrpc/rpc.h>
#include <libethrpc/CorsHttpServer.h>
#include <libethrpc/WebThreeStubServer.h>
#if ETH_JSONRPC
#include <jsonrpc/connectors/httpserver.h>
#include <libweb3jsonrpc/CorsHttpServer.h>
#endif
#include <libdevcrypto/FileSystem.h>
#include <libevmface/Instruction.h>
#include <libevm/VM.h>
@ -39,6 +40,9 @@
#include <readline/readline.h>
#include <readline/history.h>
#endif
#if ETH_JSONRPC
#include <libweb3jsonrpc/WebThreeStubServer.h>
#endif
#include "BuildInfo.h"
using namespace std;
using namespace dev;
@ -104,8 +108,10 @@ void help()
<< " -f,--force-mining Mine even when there are no transaction to mine (Default: off)" << endl
<< " -h,--help Show this help message and exit." << endl
<< " -i,--interactive Enter interactive mode (default: non-interactive)." << endl
#if ETH_JSONRPC
<< " -j,--json-rpc Enable JSON-RPC server (default: off)." << endl
<< " --json-rpc-port Specify JSON-RPC server port (implies '-j', default: 8080)." << endl
#endif
<< " -l,--listen <port> Listen on the given port for incoming connected (default: 30303)." << endl
<< " -m,--mining <on/off/number> Enable mining, optionally for a specified number of blocks (Default: off)" << endl
<< " -n,--upnp <on/off> Use upnp for NAT (default: on)." << endl
@ -179,7 +185,9 @@ int main(int argc, char** argv)
NodeMode mode = NodeMode::Full;
unsigned peers = 5;
bool interactive = false;
#if ETH_JSONRPC
int jsonrpc = -1;
#endif
string publicIP;
bool bootstrap = false;
bool upnp = true;
@ -264,10 +272,12 @@ int main(int argc, char** argv)
forceMining = true;
else if (arg == "-i" || arg == "--interactive")
interactive = true;
#if ETH_JSONRPC
else if ((arg == "-j" || arg == "--json-rpc"))
jsonrpc = jsonrpc == -1 ? 8080 : jsonrpc;
else if (arg == "--json-rpc-port" && i + 1 < argc)
jsonrpc = atoi(argv[++i]);
#endif
else if ((arg == "-v" || arg == "--verbosity") && i + 1 < argc)
g_logVerbosity = atoi(argv[++i]);
else if ((arg == "-x" || arg == "--peers") && i + 1 < argc)
@ -326,12 +336,14 @@ int main(int argc, char** argv)
if (remoteHost.size())
web3.connect(remoteHost, remotePort);
#if ETH_JSONRPC
auto_ptr<WebThreeStubServer> jsonrpcServer;
if (jsonrpc > -1)
{
jsonrpcServer = auto_ptr<WebThreeStubServer>(new WebThreeStubServer(new jsonrpc::CorsHttpServer(jsonrpc), web3, {us}));
jsonrpcServer->StartListening();
}
#endif
signal(SIGABRT, &sighandler);
signal(SIGTERM, &sighandler);
@ -404,6 +416,7 @@ int main(int argc, char** argv)
iss >> g_logVerbosity;
cout << "Verbosity: " << g_logVerbosity << endl;
}
#if ETH_JSONRPC
else if (cmd == "jsonport")
{
if (iss.peek() != -1)
@ -423,6 +436,7 @@ int main(int argc, char** argv)
jsonrpcServer->StopListening();
jsonrpcServer.reset();
}
#endif
else if (cmd == "address")
{
cout << "Current address:" << endl;
@ -755,8 +769,10 @@ int main(int argc, char** argv)
else
cout << "Unrecognised command. Type 'help' for help in interactive mode." << endl;
}
#if ETH_JSONRPC
if (jsonrpcServer.get())
jsonrpcServer->StopListening();
#endif
}
else if (c)
{

2
libethrpc/CMakeLists.txt → libweb3jsonrpc/CMakeLists.txt

@ -6,7 +6,7 @@ include_directories(..)
link_directories(../libethcore)
link_directories(../libwebthree)
set(EXECUTABLE ethrpc)
set(EXECUTABLE web3jsonrpc)
file(GLOB HEADERS "*.h")
if(ETH_STATIC)

0
libethrpc/CorsHttpServer.cpp → libweb3jsonrpc/CorsHttpServer.cpp

0
libethrpc/CorsHttpServer.h → libweb3jsonrpc/CorsHttpServer.h

0
libethrpc/WebThreeStubServer.cpp → libweb3jsonrpc/WebThreeStubServer.cpp

0
libethrpc/WebThreeStubServer.h → libweb3jsonrpc/WebThreeStubServer.h

0
libethrpc/abstractwebthreestubserver.h → libweb3jsonrpc/abstractwebthreestubserver.h

0
libethrpc/spec.json → libweb3jsonrpc/spec.json

4
neth/CMakeLists.txt

@ -20,7 +20,9 @@ target_link_libraries(${EXECUTABLE} ${MINIUPNPC_LS})
endif()
target_link_libraries(${EXECUTABLE} ${LEVELDB_LS})
target_link_libraries(${EXECUTABLE} ${CRYPTOPP_LS})
target_link_libraries(${EXECUTABLE} ethrpc)
if(JSONRPC_LS)
target_link_libraries(${EXECUTABLE} web3jsonrpc)
endif()
if ("${TARGET_PLATFORM}" STREQUAL "w64")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++")

24
neth/main.cpp

@ -26,13 +26,17 @@
#include <iostream>
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/trim_all.hpp>
#if ETH_JSONRPC
#include <jsonrpc/connectors/httpserver.h>
#include <libethrpc/WebThreeStubServer.h>
#include <libethrpc/abstractwebthreestubserver.h>
#include <libdevcore/CommonJS.h>
#endif
#include <libdevcrypto/FileSystem.h>
#include <libevmface/Instruction.h>
#include <libethereum/All.h>
#if ETH_JSONRPC
#include <libweb3jsonrpc/WebThreeStubServer.h>
#include <libweb3jsonrpc/abstractwebthreestubserver.h>
#include <libdevcore/CommonJS.h>
#endif
#include <libwebthree/WebThree.h>
#include "BuildInfo.h"
@ -69,8 +73,10 @@ void help()
<< " -d,--db-path <path> Load database from path (default: ~/.ethereum " << endl
<< " <APPDATA>/Etherum or Library/Application Support/Ethereum)." << endl
<< " -h,--help Show this help message and exit." << endl
#if ETH_JSONRPC
<< " -j,--json-rpc Enable JSON-RPC server (default: off)." << endl
<< " --json-rpc-port Specify JSON-RPC server port (implies '-j', default: 8080)." << endl
#endif
<< " -l,--listen <port> Listen on the given port for incoming connected (default: 30303)." << endl
<< " -m,--mining <on/off> Enable mining (default: off)" << endl
<< " -n,--upnp <on/off> Use upnp for NAT (default: on)." << endl
@ -91,8 +97,10 @@ void interactiveHelp()
<< "Commands:" << endl
<< " netstart <port> Starts the network sybsystem on a specific port." << endl
<< " netstop Stops the network subsystem." << endl
#if ETH_JSONRPC
<< " jsonstart <port> Starts the JSON-RPC server." << endl
<< " jsonstop Stops the JSON-RPC server." << endl
#endif
<< " connect <addr> <port> Connects to a specific peer." << endl
<< " minestart Starts mining." << endl
<< " minestop Stops mining." << endl
@ -296,7 +304,9 @@ int main(int argc, char** argv)
string dbPath;
bool mining = false;
unsigned peers = 5;
#if ETH_JSONRPC
int jsonrpc = 8080;
#endif
string publicIP;
bool upnp = true;
string clientName;
@ -367,10 +377,12 @@ int main(int argc, char** argv)
cerr << "Unknown mining option: " << m << endl;
}
}
#if ETH_JSONRPC
else if ((arg == "-j" || arg == "--json-rpc"))
jsonrpc = jsonrpc ? jsonrpc : 8080;
else if (arg == "--json-rpc-port" && i + 1 < argc)
jsonrpc = atoi(argv[++i]);
#endif
else if ((arg == "-v" || arg == "--verbosity") && i + 1 < argc)
g_logVerbosity = atoi(argv[++i]);
else if ((arg == "-x" || arg == "--peers") && i + 1 < argc)
@ -462,12 +474,14 @@ int main(int argc, char** argv)
if (mining)
c.startMining();
#if ETH_JSONRPC
auto_ptr<WebThreeStubServer> jsonrpcServer;
if (jsonrpc > -1)
{
jsonrpcServer = auto_ptr<WebThreeStubServer>(new WebThreeStubServer(new jsonrpc::HttpServer(jsonrpc), web3, {us}));
jsonrpcServer->StartListening();
}
#endif
while (true)
{
@ -526,6 +540,7 @@ int main(int argc, char** argv)
{
c.stopMining();
}
#if ETH_JSONRPC
else if (cmd == "jsonport")
{
if (iss.peek() != -1)
@ -545,6 +560,7 @@ int main(int argc, char** argv)
jsonrpcServer->StopListening();
jsonrpcServer.reset();
}
#endif
else if (cmd == "address")
{
ccout << "Current address:" << endl;
@ -986,8 +1002,10 @@ int main(int argc, char** argv)
endwin();
refresh();
#if ETH_JSONRPC
if (jsonrpcServer.get())
jsonrpcServer->StopListening();
#endif
return 0;
}

4
test/CMakeLists.txt

@ -18,7 +18,9 @@ target_link_libraries(testeth gmp)
target_link_libraries(testeth solidity)
target_link_libraries(testeth ${CRYPTOPP_LS})
target_link_libraries(testeth webthree)
target_link_libraries(testeth ethrpc)
if(JSONRPC_LS)
target_link_libraries(testeth web3jsonrpc)
endif()
target_link_libraries(createRandomTest ethereum)
target_link_libraries(createRandomTest ethcore)

4
test/jsonrpc.cpp

@ -27,8 +27,8 @@
#include <libdevcore/CommonIO.h>
#include <libdevcore/CommonJS.h>
#include <libwebthree/WebThree.h>
#include <libethrpc/WebThreeStubServer.h>
#include <libethrpc/CorsHttpServer.h>
#include <libweb3jsonrpc/WebThreeStubServer.h>
#include <libweb3jsonrpc/CorsHttpServer.h>
#include <jsonrpc/connectors/httpserver.h>
#include <jsonrpc/connectors/httpclient.h>
#include <set>

3
third/CMakeLists.txt

@ -53,8 +53,7 @@ else ()
endif ()
qt5_use_modules(${EXECUTEABLE} Core)# Gui Widgets Network WebKit WebKitWidgets)
target_link_libraries(${EXECUTEABLE} webthree qethereum ethereum evm ethcore secp256k1 gmp ${CRYPTOPP_LS} serpent lll evmface devcore)
target_link_libraries(${EXECUTEABLE} ethrpc)
target_link_libraries(${EXECUTEABLE} webthree qethereum ethereum evm ethcore secp256k1 gmp ${CRYPTOPP_LS} serpent lll evmface devcore web3jsonrpc)
if (APPLE)
# First have qt5 install plugins and frameworks

2
third/MainWin.cpp

@ -39,7 +39,7 @@
#include <libethereum/Client.h>
#include <libethereum/EthereumHost.h>
#include <libwebthree/WebThree.h>
#include <libethrpc/WebThreeStubServer.h>
#include <libweb3jsonrpc/WebThreeStubServer.h>
#include "BuildInfo.h"
#include "MainWin.h"
#include "ui_Main.h"

Loading…
Cancel
Save