diff options
author | Marek Kotewicz <marek.kotewicz@gmail.com> | 2014-10-23 18:04:26 +0800 |
---|---|---|
committer | Marek Kotewicz <marek.kotewicz@gmail.com> | 2014-10-23 18:04:26 +0800 |
commit | ea2c6a0ab42a52fef04a1e7c09a4d79ab8c7411a (patch) | |
tree | 3738d0e72e971162e207b07a4f3337a0d78cdc61 /webthreestubclient.h | |
parent | 3984f6c80ca00709bb6a9baf5bfd9c2ba7916141 (diff) | |
download | dexon-solidity-ea2c6a0ab42a52fef04a1e7c09a4d79ab8c7411a.tar.gz dexon-solidity-ea2c6a0ab42a52fef04a1e7c09a4d79ab8c7411a.tar.zst dexon-solidity-ea2c6a0ab42a52fef04a1e7c09a4d79ab8c7411a.zip |
json-rpc generic api
Diffstat (limited to 'webthreestubclient.h')
-rw-r--r-- | webthreestubclient.h | 59 |
1 files changed, 36 insertions, 23 deletions
diff --git a/webthreestubclient.h b/webthreestubclient.h index fdff10b9..4bd8afda 100644 --- a/webthreestubclient.h +++ b/webthreestubclient.h @@ -83,12 +83,12 @@ class WebThreeStubClient } - bool check(const int& id) throw (jsonrpc::JsonRpcException) + bool changed(const int& param1) throw (jsonrpc::JsonRpcException) { Json::Value p; - p["id"] = id; + p.append(param1); - Json::Value result = this->client->CallMethod("check",p); + Json::Value result = this->client->CallMethod("changed",p); if (result.isBool()) return result.asBool(); else @@ -171,14 +171,14 @@ class WebThreeStubClient } - bool killWatch(const int& id) throw (jsonrpc::JsonRpcException) + Json::Value getMessages(const int& param1) throw (jsonrpc::JsonRpcException) { Json::Value p; - p["id"] = id; + p.append(param1); - Json::Value result = this->client->CallMethod("killWatch",p); - if (result.isBool()) - return result.asBool(); + Json::Value result = this->client->CallMethod("getMessages",p); + if (result.isArray()) + return result; else throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); @@ -196,26 +196,39 @@ class WebThreeStubClient } - Json::Value messages(const Json::Value& params) throw (jsonrpc::JsonRpcException) + bool mining() throw (jsonrpc::JsonRpcException) { Json::Value p; - p["params"] = params; + p = Json::nullValue; + Json::Value result = this->client->CallMethod("mining",p); + if (result.isBool()) + return result.asBool(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); - Json::Value result = this->client->CallMethod("messages",p); - if (result.isArray()) - return result; + } + + int newFilter(const Json::Value& param1) throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p.append(param1); + + Json::Value result = this->client->CallMethod("newFilter",p); + if (result.isInt()) + return result.asInt(); else throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - bool mining() throw (jsonrpc::JsonRpcException) + int newFilterString(const std::string& param1) throw (jsonrpc::JsonRpcException) { Json::Value p; - p = Json::nullValue; - Json::Value result = this->client->CallMethod("mining",p); - if (result.isBool()) - return result.asBool(); + p.append(param1); + + Json::Value result = this->client->CallMethod("newFilterString",p); + if (result.isInt()) + return result.asInt(); else throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); @@ -367,14 +380,14 @@ p.append(param2); } - int watch(const std::string& params) throw (jsonrpc::JsonRpcException) + bool uninstallFilter(const int& param1) throw (jsonrpc::JsonRpcException) { Json::Value p; - p["params"] = params; + p.append(param1); - Json::Value result = this->client->CallMethod("watch",p); - if (result.isInt()) - return result.asInt(); + Json::Value result = this->client->CallMethod("uninstallFilter",p); + if (result.isBool()) + return result.asBool(); else throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); |