jsonrpc api changes in progress3

This commit is contained in:
Marek Kotewicz 2015-03-05 01:34:02 +01:00
parent 13d14289d8
commit d3e65ba8a4

View File

@ -114,44 +114,46 @@ class WebThreeStubClient : public jsonrpc::Client
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 eth_stateAt(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException) std::string eth_getStorageAt(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); p.append(param2);
Json::Value result = this->CallMethod("eth_stateAt",p); p.append(param3);
Json::Value result = this->CallMethod("eth_getStorageAt",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 eth_countAt(const std::string& param1) throw (jsonrpc::JsonRpcException) std::string eth_getTransactionCount(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p.append(param1); p.append(param1);
Json::Value result = this->CallMethod("eth_countAt",p); p.append(param2);
if (result.isDouble()) Json::Value result = this->CallMethod("eth_getTransactionCount",p);
return result.asDouble(); if (result.isString())
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 eth_transactionCountByHash(const std::string& param1) throw (jsonrpc::JsonRpcException) std::string eth_getBlockTransactionCountByHash(const std::string& param1) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p.append(param1); p.append(param1);
Json::Value result = this->CallMethod("eth_transactionCountByHash",p); Json::Value result = this->CallMethod("eth_getBlockTransactionCountByHash",p);
if (result.isDouble()) if (result.isString())
return result.asDouble(); 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 eth_transactionCountByNumber(int param1) throw (jsonrpc::JsonRpcException) std::string eth_getBlockTransactionCountByNumber(const std::string& param1) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p.append(param1); p.append(param1);
Json::Value result = this->CallMethod("eth_transactionCountByNumber",p); Json::Value result = this->CallMethod("eth_getBlockTransactionCountByNumber",p);
if (result.isDouble()) if (result.isString())
return result.asDouble(); 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());
} }