jsonrpc http watch

This commit is contained in:
Marek Kotewicz 2014-10-16 13:06:24 +02:00
parent 9cbed56278
commit fbe6e656ec

View File

@ -59,6 +59,19 @@ p["block"] = block;
} }
bool check(const int& id) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p["id"] = id;
Json::Value result = this->client->CallMethod("check",p);
if (result.isBool())
return result.asBool();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
std::string codeAt(const std::string& address, const int& block) throw (jsonrpc::JsonRpcException) std::string codeAt(const std::string& address, const int& block) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
@ -174,6 +187,19 @@ p["s"] = s;
} }
bool killWatch(const int& id) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p["id"] = id;
Json::Value result = this->client->CallMethod("killWatch",p);
if (result.isBool())
return result.asBool();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
bool listening() throw (jsonrpc::JsonRpcException) bool listening() throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
@ -408,14 +434,14 @@ p["params"] = params;
} }
std::string watch(const std::string& params) throw (jsonrpc::JsonRpcException) int watch(const std::string& params) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p["params"] = params; p["params"] = params;
Json::Value result = this->client->CallMethod("watch",p); Json::Value result = this->client->CallMethod("watch",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());