Browse Source

jsonrpc api changes in progress5

cl-refactor
Marek Kotewicz 10 years ago
parent
commit
a3dc16dabd
  1. 236
      libweb3jsonrpc/WebThreeStubServerBase.cpp
  2. 21
      libweb3jsonrpc/WebThreeStubServerBase.h
  3. 70
      libweb3jsonrpc/abstractwebthreestubserver.h
  4. 19
      libweb3jsonrpc/spec.json
  5. 42
      test/webthreestubclient.h

236
libweb3jsonrpc/WebThreeStubServerBase.cpp

@ -575,6 +575,161 @@ Json::Value WebThreeStubServerBase::eth_getBlockByNumber(string const& _blockNum
return toJson(client()->blockInfo(client()->hashFromNumber(number)));
}
Json::Value WebThreeStubServerBase::eth_getTransactionByHash(string const& _transactionHash)
{
h256 hash;
try
{
hash = jsToFixed<32>(_transactionHash);
}
catch (...)
{
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_RPC_INVALID_PARAMS);
}
// return toJson(client()->transaction(hash, index));
// TODO:
return "";
}
Json::Value WebThreeStubServerBase::eth_getTransactionByBlockHashAndIndex(string const& _blockHash, string const& _transactionIndex)
{
h256 hash;
unsigned index;
try
{
hash = jsToFixed<32>(_blockHash);
index = jsToInt(_transactionIndex);
}
catch (...)
{
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_RPC_INVALID_PARAMS);
}
return toJson(client()->transaction(hash, index));
}
Json::Value WebThreeStubServerBase::eth_getTransactionByBlockNumberAndIndex(string const& _blockNumber, string const& _transactionIndex)
{
int number;
unsigned index;
try
{
number = jsToInt(_blockNumber);
index = jsToInt(_transactionIndex);
}
catch (...)
{
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_RPC_INVALID_PARAMS);
}
return toJson(client()->transaction(client()->hashFromNumber(number), index));
}
Json::Value WebThreeStubServerBase::eth_getUncleByBlockHashAndIndex(string const& _blockHash, string const& _uncleIndex)
{
h256 hash;
unsigned index;
try
{
hash = jsToFixed<32>(_blockHash);
index = jsToInt(_uncleIndex);
}
catch (...)
{
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_RPC_INVALID_PARAMS);
}
return toJson(client()->uncle(hash, index));
}
Json::Value WebThreeStubServerBase::eth_getUncleByBlockNumberAndIndex(string const& _blockNumber, string const& _uncleIndex)
{
int number;
unsigned index;
try
{
number = jsToInt(_blockNumber);
index = jsToInt(_uncleIndex);
}
catch (...)
{
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_RPC_INVALID_PARAMS);
}
return toJson(client()->uncle(client()->hashFromNumber(number), index));
}
Json::Value WebThreeStubServerBase::eth_getCompilers()
{
Json::Value ret(Json::arrayValue);
ret.append("lll");
ret.append("solidity");
#ifndef _MSC_VER
ret.append("serpent");
#endif
return ret;
}
std::string WebThreeStubServerBase::eth_compileLLL(std::string const& _code)
{
// TODO throw here jsonrpc errors
string res;
vector<string> errors;
res = toJS(dev::eth::compileLLL(_code, true, &errors));
cwarn << "LLL compilation errors: " << errors;
return res;
}
std::string WebThreeStubServerBase::eth_compileSerpent(std::string const& _code)
{
// TODO throw here jsonrpc errors
string res;
#ifndef _MSC_VER
try
{
res = toJS(dev::asBytes(::compile(_code)));
}
catch (string err)
{
cwarn << "Solidity compilation error: " << err;
}
catch (...)
{
cwarn << "Uncought serpent compilation exception";
}
#endif
return res;
}
std::string WebThreeStubServerBase::eth_compileSolidity(std::string const& _code)
{
// TOOD throw here jsonrpc errors
string res;
dev::solidity::CompilerStack compiler;
try
{
res = toJS(compiler.compile(_code, true));
}
catch (dev::Exception const& exception)
{
ostringstream error;
solidity::SourceReferenceFormatter::printExceptionInformation(error, exception, "Error", compiler);
cwarn << "Solidity compilation error: " << error.str();
}
catch (...)
{
cwarn << "Uncought solidity compilation exception";
}
return res;
}
std::string WebThreeStubServerBase::shh_addToGroup(std::string const& _group, std::string const& _who)
{
(void)_group;
@ -681,67 +836,6 @@ std::string WebThreeStubServerBase::shh_newIdentity()
return toJS(kp.pub());
}
Json::Value WebThreeStubServerBase::eth_compilers()
{
Json::Value ret(Json::arrayValue);
ret.append("lll");
ret.append("solidity");
#ifndef _MSC_VER
ret.append("serpent");
#endif
return ret;
}
std::string WebThreeStubServerBase::eth_lll(std::string const& _code)
{
string res;
vector<string> errors;
res = toJS(dev::eth::compileLLL(_code, true, &errors));
cwarn << "LLL compilation errors: " << errors;
return res;
}
std::string WebThreeStubServerBase::eth_serpent(std::string const& _code)
{
string res;
#ifndef _MSC_VER
try
{
res = toJS(dev::asBytes(::compile(_code)));
}
catch (string err)
{
cwarn << "Solidity compilation error: " << err;
}
catch (...)
{
cwarn << "Uncought serpent compilation exception";
}
#endif
return res;
}
std::string WebThreeStubServerBase::eth_solidity(std::string const& _code)
{
string res;
dev::solidity::CompilerStack compiler;
try
{
res = toJS(compiler.compile(_code, true));
}
catch (dev::Exception const& exception)
{
ostringstream error;
solidity::SourceReferenceFormatter::printExceptionInformation(error, exception, "Error", compiler);
cwarn << "Solidity compilation error: " << error.str();
}
catch (...)
{
cwarn << "Uncought solidity compilation exception";
}
return res;
}
bool WebThreeStubServerBase::shh_post(Json::Value const& _json)
{
shh::Message m = toMessage(_json);
@ -842,26 +936,6 @@ void WebThreeStubServerBase::authenticate(TransactionSkeleton const& _t, bool _t
client()->transact(m_accounts->secretKey(_t.from), _t.value, _t.data, _t.gas, _t.gasPrice);
}
Json::Value WebThreeStubServerBase::eth_transactionByHash(std::string const& _hash, int _i)
{
return toJson(client()->transaction(jsToFixed<32>(_hash), _i));
}
Json::Value WebThreeStubServerBase::eth_transactionByNumber(int _number, int _i)
{
return toJson(client()->transaction(client()->hashFromNumber(_number), _i));
}
Json::Value WebThreeStubServerBase::eth_uncleByHash(std::string const& _hash, int _i)
{
return toJson(client()->uncle(jsToFixed<32>(_hash), _i));
}
Json::Value WebThreeStubServerBase::eth_uncleByNumber(int _number, int _i)
{
return toJson(client()->uncle(client()->hashFromNumber(_number), _i));
}
bool WebThreeStubServerBase::eth_uninstallFilter(int _id)
{
client()->uninstallWatch(_id);

21
libweb3jsonrpc/WebThreeStubServerBase.h

@ -91,25 +91,26 @@ public:
virtual bool eth_flush();
virtual Json::Value eth_getBlockByHash(std::string const& _blockHash);
virtual Json::Value eth_getBlockByNumber(std::string const& _blockNumber);
virtual Json::Value eth_getTransactionByHash(std::string const& _transactionHash);
virtual Json::Value eth_getTransactionByBlockHashAndIndex(std::string const& _blockHash, std::string const& _transactionIndex);
virtual Json::Value eth_getTransactionByBlockNumberAndIndex(std::string const& _blockNumber, std::string const& _transactionIndex);
virtual Json::Value eth_getUncleByBlockHashAndIndex(std::string const& _blockHash, std::string const& _uncleIndex);
virtual Json::Value eth_getUncleByBlockNumberAndIndex(std::string const& _blockNumber, std::string const& _uncleIndex);
virtual Json::Value eth_getCompilers();
virtual std::string eth_compileLLL(std::string const& _s);
virtual std::string eth_compileSerpent(std::string const& _s);
virtual std::string eth_compileSolidity(std::string const& _code);
virtual Json::Value eth_changed(int _id);
virtual Json::Value eth_compilers();
virtual Json::Value eth_filterLogs(int _id);
virtual Json::Value eth_logs(Json::Value const& _json);
virtual int eth_newFilter(Json::Value const& _json);
virtual int eth_newFilterString(std::string const& _filter);
virtual std::string eth_lll(std::string const& _s);
virtual std::string eth_serpent(std::string const& _s);
virtual std::string eth_solidity(std::string const& _code);
virtual Json::Value eth_transactionByHash(std::string const& _hash, int _i);
virtual Json::Value eth_transactionByNumber(int _number, int _i);
virtual Json::Value eth_uncleByHash(std::string const& _hash, int _i);
virtual Json::Value eth_uncleByNumber(int _number, int _i);
virtual bool eth_uninstallFilter(int _id);
virtual Json::Value eth_getWork();

70
libweb3jsonrpc/abstractwebthreestubserver.h

@ -34,14 +34,15 @@ class AbstractWebThreeStubServer : public jsonrpc::AbstractServer<AbstractWebThr
this->bindAndAddMethod(jsonrpc::Procedure("eth_flush", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, NULL), &AbstractWebThreeStubServer::eth_flushI);
this->bindAndAddMethod(jsonrpc::Procedure("eth_getBlockByHash", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_getBlockByHashI);
this->bindAndAddMethod(jsonrpc::Procedure("eth_getBlockByNumber", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_getBlockByNumberI);
this->bindAndAddMethod(jsonrpc::Procedure("eth_transactionByHash", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::eth_transactionByHashI);
this->bindAndAddMethod(jsonrpc::Procedure("eth_transactionByNumber", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_INTEGER,"param2",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::eth_transactionByNumberI);
this->bindAndAddMethod(jsonrpc::Procedure("eth_uncleByHash", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::eth_uncleByHashI);
this->bindAndAddMethod(jsonrpc::Procedure("eth_uncleByNumber", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_INTEGER,"param2",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::eth_uncleByNumberI);
this->bindAndAddMethod(jsonrpc::Procedure("eth_compilers", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_ARRAY, NULL), &AbstractWebThreeStubServer::eth_compilersI);
this->bindAndAddMethod(jsonrpc::Procedure("eth_lll", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_lllI);
this->bindAndAddMethod(jsonrpc::Procedure("eth_solidity", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_solidityI);
this->bindAndAddMethod(jsonrpc::Procedure("eth_serpent", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_serpentI);
this->bindAndAddMethod(jsonrpc::Procedure("eth_getTransactionByHash", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_getTransactionByHashI);
this->bindAndAddMethod(jsonrpc::Procedure("eth_getTransactionByBlockHashAndIndex", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_getTransactionByBlockHashAndIndexI);
this->bindAndAddMethod(jsonrpc::Procedure("eth_getTransactionByBlockNumberAndIndex", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_getTransactionByBlockNumberAndIndexI);
this->bindAndAddMethod(jsonrpc::Procedure("eth_getUncleByBlockHashAndIndex", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_getUncleByBlockHashAndIndexI);
this->bindAndAddMethod(jsonrpc::Procedure("eth_getUncleByBlockNumberAndIndex", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_getUncleByBlockNumberAndIndexI);
this->bindAndAddMethod(jsonrpc::Procedure("eth_getCompilers", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_ARRAY, NULL), &AbstractWebThreeStubServer::eth_getCompilersI);
this->bindAndAddMethod(jsonrpc::Procedure("eth_compileLLL", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_compileLLLI);
this->bindAndAddMethod(jsonrpc::Procedure("eth_compileSerpent", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_compileSerpentI);
this->bindAndAddMethod(jsonrpc::Procedure("eth_compileSolidity", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_compileSolidityI);
this->bindAndAddMethod(jsonrpc::Procedure("eth_newFilter", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_INTEGER, "param1",jsonrpc::JSON_OBJECT, NULL), &AbstractWebThreeStubServer::eth_newFilterI);
this->bindAndAddMethod(jsonrpc::Procedure("eth_newFilterString", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_INTEGER, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_newFilterStringI);
this->bindAndAddMethod(jsonrpc::Procedure("eth_uninstallFilter", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::eth_uninstallFilterI);
@ -164,38 +165,42 @@ class AbstractWebThreeStubServer : public jsonrpc::AbstractServer<AbstractWebThr
{
response = this->eth_getBlockByNumber(request[0u].asString());
}
inline virtual void eth_transactionByHashI(const Json::Value &request, Json::Value &response)
inline virtual void eth_getTransactionByHashI(const Json::Value &request, Json::Value &response)
{
response = this->eth_transactionByHash(request[0u].asString(), request[1u].asInt());
response = this->eth_getTransactionByHash(request[0u].asString());
}
inline virtual void eth_transactionByNumberI(const Json::Value &request, Json::Value &response)
inline virtual void eth_getTransactionByBlockHashAndIndexI(const Json::Value &request, Json::Value &response)
{
response = this->eth_transactionByNumber(request[0u].asInt(), request[1u].asInt());
response = this->eth_getTransactionByBlockHashAndIndex(request[0u].asString(), request[1u].asString());
}
inline virtual void eth_uncleByHashI(const Json::Value &request, Json::Value &response)
inline virtual void eth_getTransactionByBlockNumberAndIndexI(const Json::Value &request, Json::Value &response)
{
response = this->eth_uncleByHash(request[0u].asString(), request[1u].asInt());
response = this->eth_getTransactionByBlockNumberAndIndex(request[0u].asString(), request[1u].asString());
}
inline virtual void eth_uncleByNumberI(const Json::Value &request, Json::Value &response)
inline virtual void eth_getUncleByBlockHashAndIndexI(const Json::Value &request, Json::Value &response)
{
response = this->eth_uncleByNumber(request[0u].asInt(), request[1u].asInt());
response = this->eth_getUncleByBlockHashAndIndex(request[0u].asString(), request[1u].asString());
}
inline virtual void eth_compilersI(const Json::Value &request, Json::Value &response)
inline virtual void eth_getUncleByBlockNumberAndIndexI(const Json::Value &request, Json::Value &response)
{
response = this->eth_getUncleByBlockNumberAndIndex(request[0u].asString(), request[1u].asString());
}
inline virtual void eth_getCompilersI(const Json::Value &request, Json::Value &response)
{
(void)request;
response = this->eth_compilers();
response = this->eth_getCompilers();
}
inline virtual void eth_lllI(const Json::Value &request, Json::Value &response)
inline virtual void eth_compileLLLI(const Json::Value &request, Json::Value &response)
{
response = this->eth_lll(request[0u].asString());
response = this->eth_compileLLL(request[0u].asString());
}
inline virtual void eth_solidityI(const Json::Value &request, Json::Value &response)
inline virtual void eth_compileSerpentI(const Json::Value &request, Json::Value &response)
{
response = this->eth_solidity(request[0u].asString());
response = this->eth_compileSerpent(request[0u].asString());
}
inline virtual void eth_serpentI(const Json::Value &request, Json::Value &response)
inline virtual void eth_compileSolidityI(const Json::Value &request, Json::Value &response)
{
response = this->eth_serpent(request[0u].asString());
response = this->eth_compileSolidity(request[0u].asString());
}
inline virtual void eth_newFilterI(const Json::Value &request, Json::Value &response)
{
@ -317,14 +322,15 @@ class AbstractWebThreeStubServer : public jsonrpc::AbstractServer<AbstractWebThr
virtual bool eth_flush() = 0;
virtual Json::Value eth_getBlockByHash(const std::string& param1) = 0;
virtual Json::Value eth_getBlockByNumber(const std::string& param1) = 0;
virtual Json::Value eth_transactionByHash(const std::string& param1, int param2) = 0;
virtual Json::Value eth_transactionByNumber(int param1, int param2) = 0;
virtual Json::Value eth_uncleByHash(const std::string& param1, int param2) = 0;
virtual Json::Value eth_uncleByNumber(int param1, int param2) = 0;
virtual Json::Value eth_compilers() = 0;
virtual std::string eth_lll(const std::string& param1) = 0;
virtual std::string eth_solidity(const std::string& param1) = 0;
virtual std::string eth_serpent(const std::string& param1) = 0;
virtual Json::Value eth_getTransactionByHash(const std::string& param1) = 0;
virtual Json::Value eth_getTransactionByBlockHashAndIndex(const std::string& param1, const std::string& param2) = 0;
virtual Json::Value eth_getTransactionByBlockNumberAndIndex(const std::string& param1, const std::string& param2) = 0;
virtual Json::Value eth_getUncleByBlockHashAndIndex(const std::string& param1, const std::string& param2) = 0;
virtual Json::Value eth_getUncleByBlockNumberAndIndex(const std::string& param1, const std::string& param2) = 0;
virtual Json::Value eth_getCompilers() = 0;
virtual std::string eth_compileLLL(const std::string& param1) = 0;
virtual std::string eth_compileSerpent(const std::string& param1) = 0;
virtual std::string eth_compileSolidity(const std::string& param1) = 0;
virtual int eth_newFilter(const Json::Value& param1) = 0;
virtual int eth_newFilterString(const std::string& param1) = 0;
virtual bool eth_uninstallFilter(int param1) = 0;

19
libweb3jsonrpc/spec.json

@ -23,18 +23,17 @@
{ "name": "eth_flush", "params": [], "order": [], "returns" : true},
{ "name": "eth_getBlockByHash", "params": [""],"order": [], "returns": {}},
{ "name": "eth_getBlockByNumber", "params": [""],"order": [], "returns": {}},
{ "name": "eth_getTransactionByHash", "params": [""], "order": [], "returns": {}},
{ "name": "eth_getTransactionByBlockHashAndIndex", "params": ["", ""], "order": [], "returns": {}},
{ "name": "eth_getTransactionByBlockNumberAndIndex", "params": ["", ""], "order": [], "returns": {}},
{ "name": "eth_getUncleByBlockHashAndIndex", "params": ["", ""], "order": [], "returns": {}},
{ "name": "eth_getUncleByBlockNumberAndIndex", "params": ["", ""], "order": [], "returns": {}},
{ "name": "eth_getCompilers", "params": [], "order": [], "returns": []},
{ "name": "eth_compileLLL", "params": [""], "order": [], "returns": ""},
{ "name": "eth_compileSerpent", "params": [""], "order": [], "returns": ""},
{ "name": "eth_compileSolidity", "params": [""], "order": [], "returns": ""},
{ "name": "eth_transactionByHash", "params": ["", 0], "order": [], "returns": {}},
{ "name": "eth_transactionByNumber", "params": [0, 0], "order": [], "returns": {}},
{ "name": "eth_uncleByHash", "params": ["", 0], "order": [], "returns": {}},
{ "name": "eth_uncleByNumber", "params": [0, 0], "order": [], "returns": {}},
{ "name": "eth_compilers", "params": [], "order": [], "returns": []},
{ "name": "eth_lll", "params": [""], "order": [], "returns": ""},
{ "name": "eth_solidity", "params": [""], "order": [], "returns": ""},
{ "name": "eth_serpent", "params": [""], "order": [], "returns": ""},
{ "name": "eth_newFilter", "params": [{}], "order": [], "returns": 0},
{ "name": "eth_newFilterString", "params": [""], "order": [], "returns": 0},
{ "name": "eth_uninstallFilter", "params": [0], "order": [], "returns": true},

42
test/webthreestubclient.h

@ -238,85 +238,95 @@ class WebThreeStubClient : public jsonrpc::Client
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
Json::Value eth_transactionByHash(const std::string& param1, int param2) throw (jsonrpc::JsonRpcException)
Json::Value eth_getTransactionByHash(const std::string& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
Json::Value result = this->CallMethod("eth_getTransactionByHash",p);
if (result.isObject())
return result;
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
Json::Value eth_getTransactionByBlockHashAndIndex(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_transactionByHash",p);
Json::Value result = this->CallMethod("eth_getTransactionByBlockHashAndIndex",p);
if (result.isObject())
return result;
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
Json::Value eth_transactionByNumber(int param1, int param2) throw (jsonrpc::JsonRpcException)
Json::Value eth_getTransactionByBlockNumberAndIndex(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_transactionByNumber",p);
Json::Value result = this->CallMethod("eth_getTransactionByBlockNumberAndIndex",p);
if (result.isObject())
return result;
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
Json::Value eth_uncleByHash(const std::string& param1, int param2) throw (jsonrpc::JsonRpcException)
Json::Value eth_getUncleByBlockHashAndIndex(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_uncleByHash",p);
Json::Value result = this->CallMethod("eth_getUncleByBlockHashAndIndex",p);
if (result.isObject())
return result;
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
Json::Value eth_uncleByNumber(int param1, int param2) throw (jsonrpc::JsonRpcException)
Json::Value eth_getUncleByBlockNumberAndIndex(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_uncleByNumber",p);
Json::Value result = this->CallMethod("eth_getUncleByBlockNumberAndIndex",p);
if (result.isObject())
return result;
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
Json::Value eth_compilers() throw (jsonrpc::JsonRpcException)
Json::Value eth_getCompilers() throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p = Json::nullValue;
Json::Value result = this->CallMethod("eth_compilers",p);
Json::Value result = this->CallMethod("eth_getCompilers",p);
if (result.isArray())
return result;
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
std::string eth_lll(const std::string& param1) throw (jsonrpc::JsonRpcException)
std::string eth_compileLLL(const std::string& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
Json::Value result = this->CallMethod("eth_lll",p);
Json::Value result = this->CallMethod("eth_compileLLL",p);
if (result.isString())
return result.asString();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
std::string eth_solidity(const std::string& param1) throw (jsonrpc::JsonRpcException)
std::string eth_compileSerpent(const std::string& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
Json::Value result = this->CallMethod("eth_solidity",p);
Json::Value result = this->CallMethod("eth_compileSerpent",p);
if (result.isString())
return result.asString();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
std::string eth_serpent(const std::string& param1) throw (jsonrpc::JsonRpcException)
std::string eth_compileSolidity(const std::string& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
Json::Value result = this->CallMethod("eth_serpent",p);
Json::Value result = this->CallMethod("eth_compileSolidity",p);
if (result.isString())
return result.asString();
else

Loading…
Cancel
Save