Browse Source

added eth_lll

cl-refactor
Marek Kotewicz 10 years ago
parent
commit
c6dbe66ec8
  1. 3
      libjsqrc/main.js
  2. 5
      libweb3jsonrpc/WebThreeStubServer.cpp
  3. 1
      libweb3jsonrpc/WebThreeStubServer.h
  4. 7
      libweb3jsonrpc/abstractwebthreestubserver.h
  5. 1
      libweb3jsonrpc/spec.json
  6. 13
      test/webthreestubclient.h

3
libjsqrc/main.js

@ -87,7 +87,8 @@
{ name: 'block', call: blockCall }, { name: 'block', call: blockCall },
{ name: 'transaction', call: transactionCall }, { name: 'transaction', call: transactionCall },
{ name: 'uncle', call: uncleCall }, { name: 'uncle', call: uncleCall },
{ name: 'compile', call: 'eth_compile' } { name: 'compile', call: 'eth_compile' },
{ name: 'lll', call: 'eth_lll' }
]; ];
return methods; return methods;
}; };

5
libweb3jsonrpc/WebThreeStubServer.cpp

@ -521,6 +521,11 @@ std::string WebThreeStubServer::eth_compile(string const& _s)
return toJS(dev::eth::compileLLL(_s)); return toJS(dev::eth::compileLLL(_s));
} }
std::string WebThreeStubServer::eth_lll(string const& _s)
{
return toJS(dev::eth::compileLLL(_s));
}
int WebThreeStubServer::eth_number() int WebThreeStubServer::eth_number()
{ {
return client() ? client()->number() + 1 : 0; return client() ? client()->number() + 1 : 0;

1
libweb3jsonrpc/WebThreeStubServer.h

@ -86,6 +86,7 @@ public:
virtual bool eth_setCoinbase(std::string const& _address); virtual bool eth_setCoinbase(std::string const& _address);
virtual bool eth_setDefaultBlock(int const& _block); virtual bool eth_setDefaultBlock(int const& _block);
virtual bool eth_setListening(bool const& _listening); virtual bool eth_setListening(bool const& _listening);
virtual std::string eth_lll(std::string const& _s);
virtual bool eth_setMining(bool const& _mining); virtual bool eth_setMining(bool const& _mining);
virtual std::string eth_stateAt(std::string const& _address, std::string const& _storage); virtual std::string eth_stateAt(std::string const& _address, std::string const& _storage);
virtual std::string eth_transact(Json::Value const& _json); virtual std::string eth_transact(Json::Value const& _json);

7
libweb3jsonrpc/abstractwebthreestubserver.h

@ -31,6 +31,7 @@ class AbstractWebThreeStubServer : public jsonrpc::AbstractServer<AbstractWebThr
this->bindAndAddMethod(new jsonrpc::Procedure("eth_gasPrice", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_gasPriceI); this->bindAndAddMethod(new jsonrpc::Procedure("eth_gasPrice", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_gasPriceI);
this->bindAndAddMethod(new jsonrpc::Procedure("eth_getMessages", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_ARRAY, "param1",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::eth_getMessagesI); this->bindAndAddMethod(new jsonrpc::Procedure("eth_getMessages", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_ARRAY, "param1",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::eth_getMessagesI);
this->bindAndAddMethod(new jsonrpc::Procedure("eth_listening", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, NULL), &AbstractWebThreeStubServer::eth_listeningI); this->bindAndAddMethod(new jsonrpc::Procedure("eth_listening", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, NULL), &AbstractWebThreeStubServer::eth_listeningI);
this->bindAndAddMethod(new jsonrpc::Procedure("eth_lll", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_lllI);
this->bindAndAddMethod(new jsonrpc::Procedure("eth_mining", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, NULL), &AbstractWebThreeStubServer::eth_miningI); this->bindAndAddMethod(new jsonrpc::Procedure("eth_mining", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, NULL), &AbstractWebThreeStubServer::eth_miningI);
this->bindAndAddMethod(new jsonrpc::Procedure("eth_newFilter", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_INTEGER, "param1",jsonrpc::JSON_OBJECT, NULL), &AbstractWebThreeStubServer::eth_newFilterI); this->bindAndAddMethod(new jsonrpc::Procedure("eth_newFilter", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_INTEGER, "param1",jsonrpc::JSON_OBJECT, NULL), &AbstractWebThreeStubServer::eth_newFilterI);
this->bindAndAddMethod(new jsonrpc::Procedure("eth_newFilterString", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_INTEGER, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_newFilterStringI); this->bindAndAddMethod(new jsonrpc::Procedure("eth_newFilterString", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_INTEGER, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_newFilterStringI);
@ -148,6 +149,11 @@ class AbstractWebThreeStubServer : public jsonrpc::AbstractServer<AbstractWebThr
response = this->eth_listening(); response = this->eth_listening();
} }
inline virtual void eth_lllI(const Json::Value& request, Json::Value& response)
{
response = this->eth_lll(request[0u].asString());
}
inline virtual void eth_miningI(const Json::Value& request, Json::Value& response) inline virtual void eth_miningI(const Json::Value& request, Json::Value& response)
{ {
response = this->eth_mining(); response = this->eth_mining();
@ -287,6 +293,7 @@ class AbstractWebThreeStubServer : public jsonrpc::AbstractServer<AbstractWebThr
virtual std::string eth_gasPrice() = 0; virtual std::string eth_gasPrice() = 0;
virtual Json::Value eth_getMessages(const int& param1) = 0; virtual Json::Value eth_getMessages(const int& param1) = 0;
virtual bool eth_listening() = 0; virtual bool eth_listening() = 0;
virtual std::string eth_lll(const std::string& param1) = 0;
virtual bool eth_mining() = 0; virtual bool eth_mining() = 0;
virtual int eth_newFilter(const Json::Value& param1) = 0; virtual int eth_newFilter(const Json::Value& param1) = 0;
virtual int eth_newFilterString(const std::string& param1) = 0; virtual int eth_newFilterString(const std::string& param1) = 0;

1
libweb3jsonrpc/spec.json

@ -27,6 +27,7 @@
{ "method": "eth_uncleByHash", "params": ["", 0], "order": [], "returns": {}}, { "method": "eth_uncleByHash", "params": ["", 0], "order": [], "returns": {}},
{ "method": "eth_uncleByNumber", "params": [0, 0], "order": [], "returns": {}}, { "method": "eth_uncleByNumber", "params": [0, 0], "order": [], "returns": {}},
{ "method": "eth_lll", "params": [""], "order": [], "returns": ""},
{ "method": "eth_compile", "params": [""], "order": [], "returns": ""}, { "method": "eth_compile", "params": [""], "order": [], "returns": ""},
{ "method": "eth_newFilter", "params": [{}], "order": [], "returns": 0}, { "method": "eth_newFilter", "params": [{}], "order": [], "returns": 0},

13
test/webthreestubclient.h

@ -254,6 +254,19 @@ p.append(param3);
} }
std::string eth_lll(const std::string& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
Json::Value result = this->client->CallMethod("eth_lll",p);
if (result.isString())
return result.asString();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
bool eth_mining() throw (jsonrpc::JsonRpcException) bool eth_mining() throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;

Loading…
Cancel
Save