Browse Source

getData -> getCode.

cl-refactor
Gav Wood 10 years ago
parent
commit
a8d84b0d86
  1. 6
      libjsqrc/CMakeLists.txt
  2. 2
      libjsqrc/ethereumjs/lib/web3/eth.js
  3. 2
      libweb3jsonrpc/WebThreeStubServerBase.cpp
  4. 2
      libweb3jsonrpc/WebThreeStubServerBase.h
  5. 6
      libweb3jsonrpc/abstractwebthreestubserver.h
  6. 4
      test/webthreestubclient.h

6
libjsqrc/CMakeLists.txt

@ -23,3 +23,9 @@ if (USENPM)
endif()
install( TARGETS jsqrc RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib )
file(GLOB_RECURSE SOLFILES "ethereumjs/lib/solidity/*.js")
file(GLOB_RECURSE UTILSFILES "ethereumjs/lib/utils/*.js")
file(GLOB_RECURSE WEB3FILES "ethereumjs/lib/web3/*.js")
add_custom_target(aux_js SOURCES ${SOLFILES} ${UTILSFILES} ${WEB3FILES})

2
libjsqrc/ethereumjs/lib/web3/eth.js

@ -77,7 +77,7 @@ var methods = [
{ name: 'getStorage', call: 'eth_getStorage', addDefaultblock: 2},
{ name: 'getStorageAt', call: 'eth_getStorageAt', addDefaultblock: 3,
inputFormatter: utils.toHex},
{ name: 'getData', call: 'eth_getData', addDefaultblock: 2},
{ name: 'getCode', call: 'eth_getCode', addDefaultblock: 2},
{ name: 'getBlock', call: blockCall,
outputFormatter: formatters.outputBlockFormatter,
inputFormatter: [utils.toHex, function(param){ return (!param) ? false : true; }]},

2
libweb3jsonrpc/WebThreeStubServerBase.cpp

@ -435,7 +435,7 @@ string WebThreeStubServerBase::eth_getUncleCountByBlockNumber(string const& _blo
return toJS(client()->uncleCount(client()->hashFromNumber(number)));
}
string WebThreeStubServerBase::eth_getData(string const& _address, string const& _blockNumber)
string WebThreeStubServerBase::eth_getCode(string const& _address, string const& _blockNumber)
{
Address address;
int number;

2
libweb3jsonrpc/WebThreeStubServerBase.h

@ -87,7 +87,7 @@ public:
virtual std::string eth_getBlockTransactionCountByNumber(std::string const& _blockNumber);
virtual std::string eth_getUncleCountByBlockHash(std::string const& _blockHash);
virtual std::string eth_getUncleCountByBlockNumber(std::string const& _blockNumber);
virtual std::string eth_getData(std::string const& _address, std::string const& _blockNumber);
virtual std::string eth_getCode(std::string const& _address, std::string const& _blockNumber);
virtual std::string eth_sendTransaction(Json::Value const& _json);
virtual std::string eth_call(Json::Value const& _json, std::string const& _blockNumber);
virtual bool eth_flush();

6
libweb3jsonrpc/abstractwebthreestubserver.h

@ -30,7 +30,7 @@ class AbstractWebThreeStubServer : public jsonrpc::AbstractServer<AbstractWebThr
this->bindAndAddMethod(jsonrpc::Procedure("eth_getBlockTransactionCountByNumber", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_getBlockTransactionCountByNumberI);
this->bindAndAddMethod(jsonrpc::Procedure("eth_getUncleCountByBlockHash", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_getUncleCountByBlockHashI);
this->bindAndAddMethod(jsonrpc::Procedure("eth_getUncleCountByBlockNumber", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_getUncleCountByBlockNumberI);
this->bindAndAddMethod(jsonrpc::Procedure("eth_getData", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_getDataI);
this->bindAndAddMethod(jsonrpc::Procedure("eth_getCode", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_getDataI);
this->bindAndAddMethod(jsonrpc::Procedure("eth_sendTransaction", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_OBJECT, NULL), &AbstractWebThreeStubServer::eth_sendTransactionI);
this->bindAndAddMethod(jsonrpc::Procedure("eth_call", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_OBJECT,"param2",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_callI);
this->bindAndAddMethod(jsonrpc::Procedure("eth_flush", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, NULL), &AbstractWebThreeStubServer::eth_flushI);
@ -152,7 +152,7 @@ class AbstractWebThreeStubServer : public jsonrpc::AbstractServer<AbstractWebThr
}
inline virtual void eth_getDataI(const Json::Value &request, Json::Value &response)
{
response = this->eth_getData(request[0u].asString(), request[1u].asString());
response = this->eth_getCode(request[0u].asString(), request[1u].asString());
}
inline virtual void eth_sendTransactionI(const Json::Value &request, Json::Value &response)
{
@ -320,7 +320,7 @@ class AbstractWebThreeStubServer : public jsonrpc::AbstractServer<AbstractWebThr
virtual std::string eth_getBlockTransactionCountByNumber(const std::string& param1) = 0;
virtual std::string eth_getUncleCountByBlockHash(const std::string& param1) = 0;
virtual std::string eth_getUncleCountByBlockNumber(const std::string& param1) = 0;
virtual std::string eth_getData(const std::string& param1, const std::string& param2) = 0;
virtual std::string eth_getCode(const std::string& param1, const std::string& param2) = 0;
virtual std::string eth_sendTransaction(const Json::Value& param1) = 0;
virtual std::string eth_call(const Json::Value& param1, const std::string& param2) = 0;
virtual bool eth_flush() = 0;

4
test/webthreestubclient.h

@ -197,12 +197,12 @@ class WebThreeStubClient : public jsonrpc::Client
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
std::string eth_getData(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
std::string eth_getCode(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
p.append(param2);
Json::Value result = this->CallMethod("eth_getData",p);
Json::Value result = this->CallMethod("eth_getCode",p);
if (result.isString())
return result.asString();
else

Loading…
Cancel
Save