solidity/webthreestubclient.h

387 lines
12 KiB
C
Raw Normal View History

2014-10-13 09:22:28 +00:00
/**
* THIS FILE IS GENERATED BY jsonrpcstub, DO NOT CHANGE IT!!!!!
*/
#ifndef _WEBTHREESTUBCLIENT_H_
#define _WEBTHREESTUBCLIENT_H_
2014-10-13 09:22:28 +00:00
#include <jsonrpc/rpc.h>
class WebThreeStubClient
2014-10-13 09:22:28 +00:00
{
public:
WebThreeStubClient(jsonrpc::AbstractClientConnector* conn)
2014-10-13 09:22:28 +00:00
{
this->client = new jsonrpc::Client(conn);
}
~WebThreeStubClient()
2014-10-13 09:22:28 +00:00
{
delete this->client;
}
Json::Value accounts() throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p = Json::nullValue;
Json::Value result = this->client->CallMethod("accounts",p);
if (result.isArray())
return result;
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
2014-10-22 09:47:45 +00:00
std::string balanceAt(const std::string& param1) throw (jsonrpc::JsonRpcException)
2014-10-13 09:22:28 +00:00
{
Json::Value p;
2014-10-22 09:47:45 +00:00
p.append(param1);
2014-10-13 09:22:28 +00:00
Json::Value result = this->client->CallMethod("balanceAt",p);
if (result.isString())
return result.asString();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
Json::Value blockByHash(const std::string& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
Json::Value result = this->client->CallMethod("blockByHash",p);
if (result.isObject())
return result;
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
Json::Value blockByNumber(const int& param1) throw (jsonrpc::JsonRpcException)
2014-10-13 09:22:28 +00:00
{
Json::Value p;
2014-10-22 09:47:45 +00:00
p.append(param1);
2014-10-13 09:22:28 +00:00
Json::Value result = this->client->CallMethod("blockByNumber",p);
2014-10-14 11:13:30 +00:00
if (result.isObject())
2014-10-13 09:22:28 +00:00
return result;
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
2014-10-22 09:47:45 +00:00
std::string call(const Json::Value& param1) throw (jsonrpc::JsonRpcException)
2014-10-13 09:22:28 +00:00
{
Json::Value p;
2014-10-22 09:47:45 +00:00
p.append(param1);
2014-10-13 09:22:28 +00:00
Json::Value result = this->client->CallMethod("call",p);
if (result.isString())
return result.asString();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
2014-10-16 11:06:24 +00:00
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());
}
2014-10-22 09:47:45 +00:00
std::string codeAt(const std::string& param1) throw (jsonrpc::JsonRpcException)
2014-10-13 09:22:28 +00:00
{
Json::Value p;
2014-10-22 09:47:45 +00:00
p.append(param1);
2014-10-13 09:22:28 +00:00
Json::Value result = this->client->CallMethod("codeAt",p);
if (result.isString())
return result.asString();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
std::string coinbase() throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p = Json::nullValue;
Json::Value result = this->client->CallMethod("coinbase",p);
if (result.isString())
return result.asString();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
2014-10-22 09:47:45 +00:00
std::string compile(const std::string& param1) throw (jsonrpc::JsonRpcException)
2014-10-13 09:22:28 +00:00
{
Json::Value p;
2014-10-22 09:47:45 +00:00
p.append(param1);
2014-10-13 09:22:28 +00:00
2014-10-22 09:47:45 +00:00
Json::Value result = this->client->CallMethod("compile",p);
if (result.isString())
return result.asString();
2014-10-13 09:22:28 +00:00
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
2014-10-22 09:47:45 +00:00
double countAt(const std::string& param1) throw (jsonrpc::JsonRpcException)
2014-10-13 09:22:28 +00:00
{
Json::Value p;
2014-10-22 09:47:45 +00:00
p.append(param1);
2014-10-13 09:22:28 +00:00
2014-10-22 09:47:45 +00:00
Json::Value result = this->client->CallMethod("countAt",p);
if (result.isDouble())
return result.asDouble();
2014-10-13 09:22:28 +00:00
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
2014-10-22 09:47:45 +00:00
int defaultBlock() throw (jsonrpc::JsonRpcException)
2014-10-13 09:22:28 +00:00
{
Json::Value p;
2014-10-22 09:47:45 +00:00
p = Json::nullValue;
Json::Value result = this->client->CallMethod("defaultBlock",p);
if (result.isInt())
return result.asInt();
2014-10-13 09:22:28 +00:00
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
std::string gasPrice() throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p = Json::nullValue;
Json::Value result = this->client->CallMethod("gasPrice",p);
if (result.isString())
return result.asString();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
2014-10-16 11:06:24 +00:00
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());
}
2014-10-14 15:24:51 +00:00
bool listening() throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p = Json::nullValue;
Json::Value result = this->client->CallMethod("listening",p);
if (result.isBool())
return result.asBool();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
2014-10-16 01:46:47 +00:00
Json::Value messages(const Json::Value& params) throw (jsonrpc::JsonRpcException)
2014-10-13 09:22:28 +00:00
{
Json::Value p;
2014-10-16 01:46:47 +00:00
p["params"] = params;
2014-10-13 09:22:28 +00:00
Json::Value result = this->client->CallMethod("messages",p);
if (result.isArray())
return result;
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
2014-10-14 15:24:51 +00:00
}
bool mining() throw (jsonrpc::JsonRpcException)
{
Json::Value p;
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());
2014-10-13 09:22:28 +00:00
}
int number() throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p = Json::nullValue;
Json::Value result = this->client->CallMethod("number",p);
if (result.isInt())
return result.asInt();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
2014-10-16 15:21:26 +00:00
}
2014-10-13 09:22:28 +00:00
int peerCount() throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p = Json::nullValue;
Json::Value result = this->client->CallMethod("peerCount",p);
if (result.isInt())
return result.asInt();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
2014-10-22 09:47:45 +00:00
bool setCoinbase(const std::string& param1) throw (jsonrpc::JsonRpcException)
2014-10-13 09:22:28 +00:00
{
Json::Value p;
2014-10-22 09:47:45 +00:00
p.append(param1);
2014-10-14 19:53:11 +00:00
Json::Value result = this->client->CallMethod("setCoinbase",p);
if (result.isBool())
return result.asBool();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
2014-10-22 09:47:45 +00:00
bool setListening(const bool& param1) throw (jsonrpc::JsonRpcException)
2014-10-13 09:22:28 +00:00
{
Json::Value p;
2014-10-22 09:47:45 +00:00
p.append(param1);
2014-10-13 09:22:28 +00:00
Json::Value result = this->client->CallMethod("setListening",p);
2014-10-14 19:53:11 +00:00
if (result.isBool())
return result.asBool();
2014-10-13 09:22:28 +00:00
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
2014-10-22 09:47:45 +00:00
bool setMining(const bool& param1) throw (jsonrpc::JsonRpcException)
2014-10-13 09:22:28 +00:00
{
Json::Value p;
2014-10-22 09:47:45 +00:00
p.append(param1);
2014-10-13 09:22:28 +00:00
Json::Value result = this->client->CallMethod("setMining",p);
2014-10-14 19:53:11 +00:00
if (result.isBool())
return result.asBool();
2014-10-13 09:22:28 +00:00
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
2014-10-22 09:47:45 +00:00
std::string stateAt(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
2014-10-13 09:22:28 +00:00
{
Json::Value p;
2014-10-22 09:47:45 +00:00
p.append(param1);
p.append(param2);
2014-10-13 09:22:28 +00:00
Json::Value result = this->client->CallMethod("stateAt",p);
if (result.isString())
return result.asString();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
2014-10-22 09:47:45 +00:00
Json::Value transact(const Json::Value& param1) throw (jsonrpc::JsonRpcException)
2014-10-13 09:22:28 +00:00
{
Json::Value p;
2014-10-22 09:47:45 +00:00
p.append(param1);
2014-10-13 09:22:28 +00:00
Json::Value result = this->client->CallMethod("transact",p);
2014-10-22 09:47:45 +00:00
if (result.isArray())
return result;
2014-10-13 09:22:28 +00:00
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)
{
Json::Value p;
p.append(param1);
p.append(param2);
Json::Value result = this->client->CallMethod("transactionByHash",p);
if (result.isObject())
return result;
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
Json::Value 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("transactionByNumber",p);
if (result.isObject())
return result;
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)
2014-10-13 09:22:28 +00:00
{
Json::Value p;
2014-10-22 09:47:45 +00:00
p.append(param1);
p.append(param2);
2014-10-13 09:22:28 +00:00
Json::Value result = this->client->CallMethod("uncleByHash",p);
2014-10-14 11:13:30 +00:00
if (result.isObject())
2014-10-13 09:22:28 +00:00
return result;
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
Json::Value uncleByNumber(const int& param1, const int& param2) throw (jsonrpc::JsonRpcException)
2014-10-13 09:22:28 +00:00
{
Json::Value p;
2014-10-22 09:47:45 +00:00
p.append(param1);
p.append(param2);
2014-10-13 09:22:28 +00:00
Json::Value result = this->client->CallMethod("uncleByNumber",p);
2014-10-14 11:13:30 +00:00
if (result.isObject())
2014-10-13 09:22:28 +00:00
return result;
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
2014-10-16 11:06:24 +00:00
int watch(const std::string& params) throw (jsonrpc::JsonRpcException)
2014-10-13 09:22:28 +00:00
{
Json::Value p;
2014-10-16 01:46:47 +00:00
p["params"] = params;
2014-10-13 09:22:28 +00:00
Json::Value result = this->client->CallMethod("watch",p);
2014-10-16 11:06:24 +00:00
if (result.isInt())
return result.asInt();
2014-10-13 09:22:28 +00:00
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
private:
jsonrpc::Client* client;
};
#endif //_WEBTHREESTUBCLIENT_H_