solidity/webthreestubclient.h
2014-10-16 19:03:41 +02:00

468 lines
15 KiB
C++

/**
* THIS FILE IS GENERATED BY jsonrpcstub, DO NOT CHANGE IT!!!!!
*/
#ifndef _WEBTHREESTUBCLIENT_H_
#define _WEBTHREESTUBCLIENT_H_
#include <jsonrpc/rpc.h>
class WebThreeStubClient
{
public:
WebThreeStubClient(jsonrpc::AbstractClientConnector* conn)
{
this->client = new jsonrpc::Client(conn);
}
~WebThreeStubClient()
{
delete this->client;
}
std::string balanceAt(const std::string& address, const int& block) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p["address"] = address;
p["block"] = block;
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 block(const Json::Value& params) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p["params"] = params;
Json::Value result = this->client->CallMethod("block",p);
if (result.isObject())
return result;
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
std::string call(const Json::Value& json) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p["json"] = json;
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());
}
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)
{
Json::Value p;
p["address"] = address;
p["block"] = block;
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());
}
double countAt(const std::string& address, const int& block) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p["address"] = address;
p["block"] = block;
Json::Value result = this->client->CallMethod("countAt",p);
if (result.isDouble())
return result.asDouble();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
int defaultBlock() throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p = Json::nullValue;
Json::Value result = this->client->CallMethod("defaultBlock",p);
if (result.isInt())
return result.asInt();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
std::string fromAscii(const int& padding, const std::string& s) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p["padding"] = padding;
p["s"] = s;
Json::Value result = this->client->CallMethod("fromAscii",p);
if (result.isString())
return result.asString();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
double fromFixed(const std::string& s) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p["s"] = s;
Json::Value result = this->client->CallMethod("fromFixed",p);
if (result.isDouble())
return result.asDouble();
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());
}
std::string key() throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p = Json::nullValue;
Json::Value result = this->client->CallMethod("key",p);
if (result.isString())
return result.asString();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
Json::Value keys() throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p = Json::nullValue;
Json::Value result = this->client->CallMethod("keys",p);
if (result.isArray())
return result;
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
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)
{
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());
}
std::string lll(const std::string& s) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p["s"] = s;
Json::Value result = this->client->CallMethod("lll",p);
if (result.isString())
return result.asString();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
Json::Value messages(const Json::Value& params) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p["params"] = params;
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());
}
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());
}
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());
}
std::string offset(const int& o, const std::string& s) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p["o"] = o;
p["s"] = s;
Json::Value result = this->client->CallMethod("offset",p);
if (result.isString())
return result.asString();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
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());
}
std::string secretToAddress(const std::string& s) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p["s"] = s;
Json::Value result = this->client->CallMethod("secretToAddress",p);
if (result.isString())
return result.asString();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
bool setCoinbase(const std::string& address) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p["address"] = address;
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());
}
bool setListening(const bool& listening) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p["listening"] = listening;
Json::Value result = this->client->CallMethod("setListening",p);
if (result.isBool())
return result.asBool();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
bool setMining(const bool& mining) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p["mining"] = mining;
Json::Value result = this->client->CallMethod("setMining",p);
if (result.isBool())
return result.asBool();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
std::string sha3(const std::string& s) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p["s"] = s;
Json::Value result = this->client->CallMethod("sha3",p);
if (result.isString())
return result.asString();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
std::string stateAt(const std::string& address, const int& block, const std::string& storage) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p["address"] = address;
p["block"] = block;
p["storage"] = storage;
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());
}
std::string toAscii(const std::string& s) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p["s"] = s;
Json::Value result = this->client->CallMethod("toAscii",p);
if (result.isString())
return result.asString();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
std::string toDecimal(const std::string& s) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p["s"] = s;
Json::Value result = this->client->CallMethod("toDecimal",p);
if (result.isString())
return result.asString();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
std::string toFixed(const double& s) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p["s"] = s;
Json::Value result = this->client->CallMethod("toFixed",p);
if (result.isString())
return result.asString();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
std::string transact(const Json::Value& json) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p["json"] = json;
Json::Value result = this->client->CallMethod("transact",p);
if (result.isString())
return result.asString();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
Json::Value transaction(const int& i, const Json::Value& params) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p["i"] = i;
p["params"] = params;
Json::Value result = this->client->CallMethod("transaction",p);
if (result.isObject())
return result;
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
Json::Value uncle(const int& i, const Json::Value& params) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p["i"] = i;
p["params"] = params;
Json::Value result = this->client->CallMethod("uncle",p);
if (result.isObject())
return result;
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
int watch(const std::string& params) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p["params"] = params;
Json::Value result = this->client->CallMethod("watch",p);
if (result.isInt())
return result.asInt();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
private:
jsonrpc::Client* client;
};
#endif //_WEBTHREESTUBCLIENT_H_