diff options
author | Marek Kotewicz <marek.kotewicz@gmail.com> | 2014-11-06 21:57:13 +0800 |
---|---|---|
committer | Marek Kotewicz <marek.kotewicz@gmail.com> | 2014-11-06 21:57:13 +0800 |
commit | 7271412370fe9bd1c0d639820a8078575664fdd1 (patch) | |
tree | 431cf6bc99a63c0cf665b562e8e2de2548981447 /webthreestubclient.h | |
parent | 4b9dcd95ce5a33440de5014896bfeb99f6436c76 (diff) | |
download | dexon-solidity-7271412370fe9bd1c0d639820a8078575664fdd1.tar.gz dexon-solidity-7271412370fe9bd1c0d639820a8078575664fdd1.tar.zst dexon-solidity-7271412370fe9bd1c0d639820a8078575664fdd1.zip |
renaming calls to include a subprotocol prefix
Diffstat (limited to 'webthreestubclient.h')
-rw-r--r-- | webthreestubclient.h | 332 |
1 files changed, 160 insertions, 172 deletions
diff --git a/webthreestubclient.h b/webthreestubclient.h index 6beee5bb..516fe790 100644 --- a/webthreestubclient.h +++ b/webthreestubclient.h @@ -19,11 +19,13 @@ class WebThreeStubClient delete this->client; } - std::string account() throw (jsonrpc::JsonRpcException) + std::string db_get(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException) { Json::Value p; - p = Json::nullValue; - Json::Value result = this->client->CallMethod("account",p); + p.append(param1); +p.append(param2); + + Json::Value result = this->client->CallMethod("db_get",p); if (result.isString()) return result.asString(); else @@ -31,38 +33,68 @@ class WebThreeStubClient } - Json::Value accounts() throw (jsonrpc::JsonRpcException) + std::string db_getString(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException) { Json::Value p; - p = Json::nullValue; - Json::Value result = this->client->CallMethod("accounts",p); - if (result.isArray()) - return result; + p.append(param1); +p.append(param2); + + Json::Value result = this->client->CallMethod("db_getString",p); + if (result.isString()) + return result.asString(); else throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - std::string addToGroup(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException) + bool db_put(const std::string& param1, const std::string& param2, const std::string& param3) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); p.append(param2); +p.append(param3); - Json::Value result = this->client->CallMethod("addToGroup",p); - if (result.isString()) - return result.asString(); + Json::Value result = this->client->CallMethod("db_put",p); + if (result.isBool()) + return result.asBool(); else throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - std::string balanceAt(const std::string& param1) throw (jsonrpc::JsonRpcException) + bool db_putString(const std::string& param1, const std::string& param2, const std::string& param3) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); +p.append(param2); +p.append(param3); - Json::Value result = this->client->CallMethod("balanceAt",p); + Json::Value result = this->client->CallMethod("db_putString",p); + if (result.isBool()) + return result.asBool(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + + } + + Json::Value eth_accounts() throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p = Json::nullValue; + Json::Value result = this->client->CallMethod("eth_accounts",p); + if (result.isArray()) + return result; + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + + } + + std::string eth_balanceAt(const std::string& param1) throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p.append(param1); + + Json::Value result = this->client->CallMethod("eth_balanceAt",p); if (result.isString()) return result.asString(); else @@ -70,12 +102,12 @@ p.append(param2); } - Json::Value blockByHash(const std::string& param1) throw (jsonrpc::JsonRpcException) + Json::Value eth_blockByHash(const std::string& param1) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); - Json::Value result = this->client->CallMethod("blockByHash",p); + Json::Value result = this->client->CallMethod("eth_blockByHash",p); if (result.isObject()) return result; else @@ -83,12 +115,12 @@ p.append(param2); } - Json::Value blockByNumber(const int& param1) throw (jsonrpc::JsonRpcException) + Json::Value eth_blockByNumber(const int& param1) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); - Json::Value result = this->client->CallMethod("blockByNumber",p); + Json::Value result = this->client->CallMethod("eth_blockByNumber",p); if (result.isObject()) return result; else @@ -96,12 +128,12 @@ p.append(param2); } - std::string call(const Json::Value& param1) throw (jsonrpc::JsonRpcException) + std::string eth_call(const Json::Value& param1) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); - Json::Value result = this->client->CallMethod("call",p); + Json::Value result = this->client->CallMethod("eth_call",p); if (result.isString()) return result.asString(); else @@ -109,12 +141,12 @@ p.append(param2); } - bool changed(const int& param1) throw (jsonrpc::JsonRpcException) + bool eth_changed(const int& param1) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); - Json::Value result = this->client->CallMethod("changed",p); + Json::Value result = this->client->CallMethod("eth_changed",p); if (result.isBool()) return result.asBool(); else @@ -122,12 +154,12 @@ p.append(param2); } - std::string codeAt(const std::string& param1) throw (jsonrpc::JsonRpcException) + std::string eth_codeAt(const std::string& param1) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); - Json::Value result = this->client->CallMethod("codeAt",p); + Json::Value result = this->client->CallMethod("eth_codeAt",p); if (result.isString()) return result.asString(); else @@ -135,11 +167,11 @@ p.append(param2); } - std::string coinbase() throw (jsonrpc::JsonRpcException) + std::string eth_coinbase() throw (jsonrpc::JsonRpcException) { Json::Value p; p = Json::nullValue; - Json::Value result = this->client->CallMethod("coinbase",p); + Json::Value result = this->client->CallMethod("eth_coinbase",p); if (result.isString()) return result.asString(); else @@ -147,12 +179,12 @@ p.append(param2); } - std::string compile(const std::string& param1) throw (jsonrpc::JsonRpcException) + std::string eth_compile(const std::string& param1) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); - Json::Value result = this->client->CallMethod("compile",p); + Json::Value result = this->client->CallMethod("eth_compile",p); if (result.isString()) return result.asString(); else @@ -160,12 +192,12 @@ p.append(param2); } - double countAt(const std::string& param1) throw (jsonrpc::JsonRpcException) + double eth_countAt(const std::string& param1) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); - Json::Value result = this->client->CallMethod("countAt",p); + Json::Value result = this->client->CallMethod("eth_countAt",p); if (result.isDouble()) return result.asDouble(); else @@ -173,11 +205,11 @@ p.append(param2); } - int defaultBlock() throw (jsonrpc::JsonRpcException) + int eth_defaultBlock() throw (jsonrpc::JsonRpcException) { Json::Value p; p = Json::nullValue; - Json::Value result = this->client->CallMethod("defaultBlock",p); + Json::Value result = this->client->CallMethod("eth_defaultBlock",p); if (result.isInt()) return result.asInt(); else @@ -185,11 +217,11 @@ p.append(param2); } - std::string gasPrice() throw (jsonrpc::JsonRpcException) + std::string eth_gasPrice() throw (jsonrpc::JsonRpcException) { Json::Value p; p = Json::nullValue; - Json::Value result = this->client->CallMethod("gasPrice",p); + Json::Value result = this->client->CallMethod("eth_gasPrice",p); if (result.isString()) return result.asString(); else @@ -197,26 +229,12 @@ p.append(param2); } - std::string get(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException) + Json::Value eth_getMessages(const int& param1) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); -p.append(param2); - Json::Value result = this->client->CallMethod("get",p); - if (result.isString()) - return result.asString(); - else - throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); - - } - - Json::Value getMessages(const int& param1) throw (jsonrpc::JsonRpcException) - { - Json::Value p; - p.append(param1); - - Json::Value result = this->client->CallMethod("getMessages",p); + Json::Value result = this->client->CallMethod("eth_getMessages",p); if (result.isArray()) return result; else @@ -224,38 +242,11 @@ p.append(param2); } - std::string getString(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException) - { - Json::Value p; - p.append(param1); -p.append(param2); - - Json::Value result = this->client->CallMethod("getString",p); - if (result.isString()) - return result.asString(); - else - throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); - - } - - bool haveIdentity(const std::string& param1) throw (jsonrpc::JsonRpcException) - { - Json::Value p; - p.append(param1); - - Json::Value result = this->client->CallMethod("haveIdentity",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 eth_listening() throw (jsonrpc::JsonRpcException) { Json::Value p; p = Json::nullValue; - Json::Value result = this->client->CallMethod("listening",p); + Json::Value result = this->client->CallMethod("eth_listening",p); if (result.isBool()) return result.asBool(); else @@ -263,11 +254,11 @@ p.append(param2); } - bool mining() throw (jsonrpc::JsonRpcException) + bool eth_mining() throw (jsonrpc::JsonRpcException) { Json::Value p; p = Json::nullValue; - Json::Value result = this->client->CallMethod("mining",p); + Json::Value result = this->client->CallMethod("eth_mining",p); if (result.isBool()) return result.asBool(); else @@ -275,12 +266,12 @@ p.append(param2); } - int newFilter(const Json::Value& param1) throw (jsonrpc::JsonRpcException) + int eth_newFilter(const Json::Value& param1) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); - Json::Value result = this->client->CallMethod("newFilter",p); + Json::Value result = this->client->CallMethod("eth_newFilter",p); if (result.isInt()) return result.asInt(); else @@ -288,12 +279,12 @@ p.append(param2); } - int newFilterString(const std::string& param1) throw (jsonrpc::JsonRpcException) + int eth_newFilterString(const std::string& param1) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); - Json::Value result = this->client->CallMethod("newFilterString",p); + Json::Value result = this->client->CallMethod("eth_newFilterString",p); if (result.isInt()) return result.asInt(); else @@ -301,37 +292,23 @@ p.append(param2); } - std::string newGroup(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException) - { - Json::Value p; - p.append(param1); -p.append(param2); - - Json::Value result = this->client->CallMethod("newGroup",p); - if (result.isString()) - return result.asString(); - else - throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); - - } - - std::string newIdentity() throw (jsonrpc::JsonRpcException) + int eth_number() throw (jsonrpc::JsonRpcException) { Json::Value p; p = Json::nullValue; - Json::Value result = this->client->CallMethod("newIdentity",p); - if (result.isString()) - return result.asString(); + Json::Value result = this->client->CallMethod("eth_number",p); + if (result.isInt()) + return result.asInt(); else throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - int number() throw (jsonrpc::JsonRpcException) + int eth_peerCount() throw (jsonrpc::JsonRpcException) { Json::Value p; p = Json::nullValue; - Json::Value result = this->client->CallMethod("number",p); + Json::Value result = this->client->CallMethod("eth_peerCount",p); if (result.isInt()) return result.asInt(); else @@ -339,24 +316,25 @@ p.append(param2); } - int peerCount() throw (jsonrpc::JsonRpcException) + bool eth_setCoinbase(const std::string& param1) throw (jsonrpc::JsonRpcException) { Json::Value p; - p = Json::nullValue; - Json::Value result = this->client->CallMethod("peerCount",p); - if (result.isInt()) - return result.asInt(); + p.append(param1); + + Json::Value result = this->client->CallMethod("eth_setCoinbase",p); + if (result.isBool()) + return result.asBool(); else throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - bool post(const Json::Value& param1) throw (jsonrpc::JsonRpcException) + bool eth_setDefaultBlock(const int& param1) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); - Json::Value result = this->client->CallMethod("post",p); + Json::Value result = this->client->CallMethod("eth_setDefaultBlock",p); if (result.isBool()) return result.asBool(); else @@ -364,14 +342,12 @@ p.append(param2); } - bool put(const std::string& param1, const std::string& param2, const std::string& param3) throw (jsonrpc::JsonRpcException) + bool eth_setListening(const bool& param1) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); -p.append(param2); -p.append(param3); - Json::Value result = this->client->CallMethod("put",p); + Json::Value result = this->client->CallMethod("eth_setListening",p); if (result.isBool()) return result.asBool(); else @@ -379,14 +355,12 @@ p.append(param3); } - bool putString(const std::string& param1, const std::string& param2, const std::string& param3) throw (jsonrpc::JsonRpcException) + bool eth_setMining(const bool& param1) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); -p.append(param2); -p.append(param3); - Json::Value result = this->client->CallMethod("putString",p); + Json::Value result = this->client->CallMethod("eth_setMining",p); if (result.isBool()) return result.asBool(); else @@ -394,90 +368,95 @@ p.append(param3); } - bool setCoinbase(const std::string& param1) throw (jsonrpc::JsonRpcException) + std::string eth_stateAt(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); +p.append(param2); - Json::Value result = this->client->CallMethod("setCoinbase",p); - if (result.isBool()) - return result.asBool(); + Json::Value result = this->client->CallMethod("eth_stateAt",p); + if (result.isString()) + return result.asString(); else throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - bool setDefaultBlock(const int& param1) throw (jsonrpc::JsonRpcException) + std::string eth_transact(const Json::Value& param1) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); - Json::Value result = this->client->CallMethod("setDefaultBlock",p); - if (result.isBool()) - return result.asBool(); + Json::Value result = this->client->CallMethod("eth_transact",p); + if (result.isString()) + return result.asString(); else throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - bool setListening(const bool& param1) throw (jsonrpc::JsonRpcException) + Json::Value eth_transactionByHash(const std::string& param1, const int& param2) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); +p.append(param2); - Json::Value result = this->client->CallMethod("setListening",p); - if (result.isBool()) - return result.asBool(); + Json::Value result = this->client->CallMethod("eth_transactionByHash",p); + if (result.isObject()) + return result; else throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - bool setMining(const bool& param1) throw (jsonrpc::JsonRpcException) + Json::Value eth_transactionByNumber(const int& param1, const int& param2) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); +p.append(param2); - Json::Value result = this->client->CallMethod("setMining",p); - if (result.isBool()) - return result.asBool(); + Json::Value result = this->client->CallMethod("eth_transactionByNumber",p); + if (result.isObject()) + return result; else throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - Json::Value shhChanged(const int& param1) throw (jsonrpc::JsonRpcException) + Json::Value eth_uncleByHash(const std::string& param1, const int& param2) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); +p.append(param2); - Json::Value result = this->client->CallMethod("shhChanged",p); - if (result.isArray()) + Json::Value result = this->client->CallMethod("eth_uncleByHash",p); + if (result.isObject()) return result; else throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - int shhNewFilter(const Json::Value& param1) throw (jsonrpc::JsonRpcException) + Json::Value eth_uncleByNumber(const int& param1, const int& param2) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); +p.append(param2); - Json::Value result = this->client->CallMethod("shhNewFilter",p); - if (result.isInt()) - return result.asInt(); + Json::Value result = this->client->CallMethod("eth_uncleByNumber",p); + if (result.isObject()) + return result; else throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - bool shhUninstallFilter(const int& param1) throw (jsonrpc::JsonRpcException) + bool eth_uninstallFilter(const int& param1) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); - Json::Value result = this->client->CallMethod("shhUninstallFilter",p); + Json::Value result = this->client->CallMethod("eth_uninstallFilter",p); if (result.isBool()) return result.asBool(); else @@ -485,13 +464,13 @@ p.append(param3); } - std::string stateAt(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException) + std::string shh_addToGroup(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); p.append(param2); - Json::Value result = this->client->CallMethod("stateAt",p); + Json::Value result = this->client->CallMethod("shh_addToGroup",p); if (result.isString()) return result.asString(); else @@ -499,81 +478,90 @@ p.append(param2); } - std::string transact(const Json::Value& param1) throw (jsonrpc::JsonRpcException) + Json::Value shh_changed(const int& param1) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); - Json::Value result = this->client->CallMethod("transact",p); - if (result.isString()) - return result.asString(); + Json::Value result = this->client->CallMethod("shh_changed",p); + if (result.isArray()) + return result; else throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - Json::Value transactionByHash(const std::string& param1, const int& param2) throw (jsonrpc::JsonRpcException) + bool shh_haveIdentity(const std::string& param1) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); -p.append(param2); - Json::Value result = this->client->CallMethod("transactionByHash",p); - if (result.isObject()) - return result; + Json::Value result = this->client->CallMethod("shh_haveIdentity",p); + if (result.isBool()) + return result.asBool(); else throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - Json::Value transactionByNumber(const int& param1, const int& param2) throw (jsonrpc::JsonRpcException) + int shh_newFilter(const Json::Value& param1) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); -p.append(param2); - Json::Value result = this->client->CallMethod("transactionByNumber",p); - if (result.isObject()) - return result; + Json::Value result = this->client->CallMethod("shh_newFilter",p); + if (result.isInt()) + return result.asInt(); else throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - Json::Value uncleByHash(const std::string& param1, const int& param2) throw (jsonrpc::JsonRpcException) + std::string shh_newGroup(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); p.append(param2); - Json::Value result = this->client->CallMethod("uncleByHash",p); - if (result.isObject()) - return result; + Json::Value result = this->client->CallMethod("shh_newGroup",p); + if (result.isString()) + return result.asString(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + + } + + std::string shh_newIdentity() throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p = Json::nullValue; + Json::Value result = this->client->CallMethod("shh_newIdentity",p); + if (result.isString()) + return result.asString(); else throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - Json::Value uncleByNumber(const int& param1, const int& param2) throw (jsonrpc::JsonRpcException) + bool shh_post(const Json::Value& param1) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); -p.append(param2); - Json::Value result = this->client->CallMethod("uncleByNumber",p); - if (result.isObject()) - return result; + Json::Value result = this->client->CallMethod("shh_post",p); + if (result.isBool()) + return result.asBool(); else throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - bool uninstallFilter(const int& param1) throw (jsonrpc::JsonRpcException) + bool shh_uninstallFilter(const int& param1) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); - Json::Value result = this->client->CallMethod("uninstallFilter",p); + Json::Value result = this->client->CallMethod("shh_uninstallFilter",p); if (result.isBool()) return result.asBool(); else |