diff --git a/alethzero/OurWebThreeStubServer.cpp b/alethzero/OurWebThreeStubServer.cpp index ca1b77649..a40727e1e 100644 --- a/alethzero/OurWebThreeStubServer.cpp +++ b/alethzero/OurWebThreeStubServer.cpp @@ -28,7 +28,7 @@ OurWebThreeStubServer::OurWebThreeStubServer(jsonrpc::AbstractServerConnector* _ WebThreeStubServer(_conn, _web3, _accounts) {} -std::string OurWebThreeStubServer::newIdentity() +std::string OurWebThreeStubServer::shh_newIdentity() { dev::KeyPair kp = dev::KeyPair::create(); emit onNewId(QString::fromStdString(toJS(kp.sec()))); diff --git a/alethzero/OurWebThreeStubServer.h b/alethzero/OurWebThreeStubServer.h index be06da62d..b3492df5e 100644 --- a/alethzero/OurWebThreeStubServer.h +++ b/alethzero/OurWebThreeStubServer.h @@ -31,7 +31,7 @@ class OurWebThreeStubServer: public QObject, public WebThreeStubServer public: OurWebThreeStubServer(jsonrpc::AbstractServerConnector* _conn, dev::WebThreeDirect& _web3, std::vector const& _accounts); - virtual std::string newIdentity() override; + virtual std::string shh_newIdentity() override; signals: void onNewId(QString _s); diff --git a/libjsqrc/main.js b/libjsqrc/main.js index eb1dd25b9..09fe00105 100644 --- a/libjsqrc/main.js +++ b/libjsqrc/main.js @@ -66,82 +66,83 @@ var ethMethods = function () { var blockCall = function (args) { - return typeof args[0] === "string" ? "blockByHash" : "blockByNumber"; + return typeof args[0] === "string" ? "eth_blockByHash" : "eth_blockByNumber"; }; var transactionCall = function (args) { - return typeof args[0] === "string" ? 'transactionByHash' : 'transactionByNumber'; + return typeof args[0] === "string" ? 'eth_transactionByHash' : 'eth_transactionByNumber'; }; var uncleCall = function (args) { - return typeof args[0] === "string" ? 'uncleByHash' : 'uncleByNumber'; + return typeof args[0] === "string" ? 'eth_uncleByHash' : 'eth_uncleByNumber'; }; var methods = [ - { name: 'balanceAt', call: 'balanceAt' }, - { name: 'stateAt', call: 'stateAt' }, - { name: 'countAt', call: 'countAt'}, - { name: 'codeAt', call: 'codeAt' }, - { name: 'transact', call: 'transact' }, - { name: 'call', call: 'call' }, + { name: 'balanceAt', call: 'eth_balanceAt' }, + { name: 'stateAt', call: 'eth_stateAt' }, + { name: 'countAt', call: 'eth_countAt'}, + { name: 'codeAt', call: 'eth_codeAt' }, + { name: 'transact', call: 'eth_transact' }, + { name: 'call', call: 'eth_call' }, { name: 'block', call: blockCall }, { name: 'transaction', call: transactionCall }, { name: 'uncle', call: uncleCall }, - { name: 'compile', call: 'compile' } + { name: 'compile', call: 'eth_compile' }, + { name: 'lll', call: 'eth_lll' } ]; return methods; }; var ethProperties = function () { return [ - { name: 'coinbase', getter: 'coinbase', setter: 'setCoinbase' }, - { name: 'listening', getter: 'listening', setter: 'setListening' }, - { name: 'mining', getter: 'mining', setter: 'setMining' }, - { name: 'gasPrice', getter: 'gasPrice' }, - { name: 'account', getter: 'account' }, - { name: 'accounts', getter: 'accounts' }, - { name: 'peerCount', getter: 'peerCount' }, - { name: 'defaultBlock', getter: 'defaultBlock', setter: 'setDefaultBlock' }, - { name: 'number', getter: 'number'} + { name: 'coinbase', getter: 'eth_coinbase', setter: 'eth_setCoinbase' }, + { name: 'listening', getter: 'eth_listening', setter: 'eth_setListening' }, + { name: 'mining', getter: 'eth_mining', setter: 'eth_setMining' }, + { name: 'gasPrice', getter: 'eth_gasPrice' }, + { name: 'account', getter: 'eth_account' }, + { name: 'accounts', getter: 'eth_accounts' }, + { name: 'peerCount', getter: 'eth_peerCount' }, + { name: 'defaultBlock', getter: 'eth_defaultBlock', setter: 'eth_setDefaultBlock' }, + { name: 'number', getter: 'eth_number'} ]; }; var dbMethods = function () { return [ - { name: 'put', call: 'put' }, - { name: 'get', call: 'get' }, - { name: 'putString', call: 'putString' }, - { name: 'getString', call: 'getString' } + { name: 'put', call: 'db_put' }, + { name: 'get', call: 'db_get' }, + { name: 'putString', call: 'db_putString' }, + { name: 'getString', call: 'db_getString' } ]; }; var shhMethods = function () { return [ - { name: 'post', call: 'post' }, - { name: 'newIdentity', call: 'newIdentity' }, - { name: 'haveIdentity', call: 'haveIdentity' }, - { name: 'newGroup', call: 'newGroup' }, - { name: 'addToGroup', call: 'addToGroup' } + { name: 'post', call: 'shh_post' }, + { name: 'newIdentity', call: 'shh_newIdentity' }, + { name: 'haveIdentity', call: 'shh_haveIdentity' }, + { name: 'newGroup', call: 'shh_newGroup' }, + { name: 'addToGroup', call: 'shh_addToGroup' } ]; }; var ethWatchMethods = function () { var newFilter = function (args) { - return typeof args[0] === 'string' ? 'newFilterString' : 'newFilter'; + return typeof args[0] === 'string' ? 'eth_newFilterString' : 'eth_newFilter'; }; return [ { name: 'newFilter', call: newFilter }, - { name: 'uninstallFilter', call: 'uninstallFilter' }, - { name: 'getMessages', call: 'getMessages' } + { name: 'uninstallFilter', call: 'eth_uninstallFilter' }, + { name: 'getMessages', call: 'eth_getMessages' } ]; }; var shhWatchMethods = function () { return [ - { name: 'newFilter', call: 'shhNewFilter' }, - { name: 'uninstallFilter', call: 'shhUninstallFilter' }, - { name: 'getMessage', call: 'shhGetMessages' } + { name: 'newFilter', call: 'shh_newFilter' }, + { name: 'uninstallFilter', call: 'shh_uninstallFilter' }, + { name: 'getMessage', call: 'shh_getMessages' } ]; }; @@ -299,11 +300,11 @@ setupMethods(web3.shh, shhMethods()); var ethWatch = { - changed: 'changed' + changed: 'eth_changed' }; setupMethods(ethWatch, ethWatchMethods()); var shhWatch = { - changed: 'shhChanged' + changed: 'shh_changed' }; setupMethods(shhWatch, shhWatchMethods()); diff --git a/libjsqrc/setup.js b/libjsqrc/setup.js index 549222119..5142412a6 100644 --- a/libjsqrc/setup.js +++ b/libjsqrc/setup.js @@ -14,7 +14,7 @@ You should have received a copy of the GNU General Public License along with cpp-ethereum. If not, see . */ -/** @file QEthereum.cpp +/** @file setup.js * @authors: * Marek Kotewicz * @date 2014 diff --git a/libqethereum/QEthereum.cpp b/libqethereum/QEthereum.cpp index 42e00958a..5e5253829 100644 --- a/libqethereum/QEthereum.cpp +++ b/libqethereum/QEthereum.cpp @@ -59,13 +59,13 @@ void QWebThree::poll() { if (m_watches.size() > 0) { - QString batch = toJsonRpcBatch(m_watches, "changed"); - emit processData(batch, "changed"); + QString batch = toJsonRpcBatch(m_watches, "eth_changed"); + emit processData(batch, "eth_changed"); } if (m_shhWatches.size() > 0) { - QString batch = toJsonRpcBatch(m_shhWatches, "shhChanged"); - emit processData(batch, "shhChanged"); + QString batch = toJsonRpcBatch(m_shhWatches, "shh_changed"); + emit processData(batch, "shh_changed"); } } @@ -73,13 +73,13 @@ void QWebThree::clearWatches() { if (m_watches.size() > 0) { - QString batch = toJsonRpcBatch(m_watches, "uninstallFilter"); + QString batch = toJsonRpcBatch(m_watches, "eth_uninstallFilter"); m_watches.clear(); emit processData(batch, "internal"); } if (m_shhWatches.size() > 0) { - QString batch = toJsonRpcBatch(m_shhWatches, "shhUninstallFilter"); + QString batch = toJsonRpcBatch(m_shhWatches, "shh_uninstallFilter"); m_shhWatches.clear(); emit processData(batch, "internal"); } @@ -106,7 +106,12 @@ void QWebThree::postMessage(QString _json) QJsonObject f = QJsonDocument::fromJson(_json.toUtf8()).object(); QString method = f["call"].toString(); - if (!method.compare("uninstallFilter") && f["args"].isArray() && f["args"].toArray().size()) + if (!method.compare("eth_uninstallFilter") && f["args"].isArray() && f["args"].toArray().size()) + { + int idToRemove = f["args"].toArray()[0].toInt(); + m_watches.erase(std::remove(m_watches.begin(), m_watches.end(), idToRemove), m_watches.end()); + } + else if (!method.compare("eth_uninstallFilter") && f["args"].isArray() && f["args"].toArray().size()) { int idToRemove = f["args"].toArray()[0].toInt(); m_watches.erase(std::remove(m_watches.begin(), m_watches.end(), idToRemove), m_watches.end()); @@ -129,7 +134,7 @@ void QWebThree::onDataProcessed(QString _json, QString _addInfo) if (!_addInfo.compare("internal")) return; - if (!_addInfo.compare("changed")) + if (!_addInfo.compare("eth_changed")) { QJsonArray resultsArray = QJsonDocument::fromJson(_json.toUtf8()).array(); for (int i = 0; i < resultsArray.size(); i++) @@ -146,7 +151,7 @@ void QWebThree::onDataProcessed(QString _json, QString _addInfo) return; } - if (!_addInfo.compare("shhChanged")) + if (!_addInfo.compare("shh_changed")) { QJsonArray resultsArray = QJsonDocument::fromJson(_json.toUtf8()).array(); for (int i = 0; i < resultsArray.size(); i++) @@ -165,11 +170,11 @@ void QWebThree::onDataProcessed(QString _json, QString _addInfo) QJsonObject f = QJsonDocument::fromJson(_json.toUtf8()).object(); - if ((!_addInfo.compare("newFilter") || !_addInfo.compare("newFilterString")) && f.contains("result")) + if ((!_addInfo.compare("eth_newFilter") || !_addInfo.compare("eth_newFilterString")) && f.contains("result")) m_watches.push_back(f["result"].toInt()); - if (!_addInfo.compare("shhNewFilter") && f.contains("result")) + else if (!_addInfo.compare("shh_newFilter") && f.contains("result")) m_shhWatches.push_back(f["result"].toInt()); - if (!_addInfo.compare("newIdentity") && f.contains("result")) + else if (!_addInfo.compare("shh_newIdentity") && f.contains("result")) emit onNewId(f["result"].toString()); response(formatOutput(f)); diff --git a/libweb3jsonrpc/WebThreeStubServer.cpp b/libweb3jsonrpc/WebThreeStubServer.cpp index 40ec744bd..3849fb4a8 100644 --- a/libweb3jsonrpc/WebThreeStubServer.cpp +++ b/libweb3jsonrpc/WebThreeStubServer.cpp @@ -194,9 +194,11 @@ static dev::eth::MessageFilter toMessageFilter(Json::Value const& _json) if (!_json["topics"].empty()) { if (_json["topics"].isArray()) + { for (auto i: _json["topics"]) if (i.isString()) filter.topic(jsToU256(i.asString())); + } else if(_json["topics"].isString()) filter.topic(jsToU256(_json["topics"].asString())); } @@ -313,7 +315,7 @@ std::shared_ptr WebThreeStubServer::face() const return m_web3.whisper(); } -Json::Value WebThreeStubServer::accounts() +Json::Value WebThreeStubServer::eth_accounts() { Json::Value ret(Json::arrayValue); for (auto i: m_accounts) @@ -321,27 +323,27 @@ Json::Value WebThreeStubServer::accounts() return ret; } -std::string WebThreeStubServer::addToGroup(std::string const& _group, std::string const& _who) +std::string WebThreeStubServer::shh_addToGroup(std::string const& _group, std::string const& _who) { (void)_group; (void)_who; return ""; } -std::string WebThreeStubServer::balanceAt(string const& _address) +std::string WebThreeStubServer::eth_balanceAt(string const& _address) { int block = 0; return toJS(client()->balanceAt(jsToAddress(_address), block)); } -Json::Value WebThreeStubServer::blockByHash(std::string const& _hash) +Json::Value WebThreeStubServer::eth_blockByHash(std::string const& _hash) { if (!client()) return ""; return toJson(client()->blockInfo(jsToFixed<32>(_hash))); } -Json::Value WebThreeStubServer::blockByNumber(int const& _number) +Json::Value WebThreeStubServer::eth_blockByNumber(int const& _number) { if (!client()) return ""; @@ -384,7 +386,7 @@ static TransactionSkeleton toTransaction(Json::Value const& _json) return ret; } -std::string WebThreeStubServer::call(Json::Value const& _json) +std::string WebThreeStubServer::eth_call(Json::Value const& _json) { std::string ret; if (!client()) @@ -408,41 +410,41 @@ std::string WebThreeStubServer::call(Json::Value const& _json) return ret; } -bool WebThreeStubServer::changed(int const& _id) +bool WebThreeStubServer::eth_changed(int const& _id) { if (!client()) return false; return client()->checkWatch(_id); } -std::string WebThreeStubServer::codeAt(string const& _address) +std::string WebThreeStubServer::eth_codeAt(string const& _address) { int block = 0; return client() ? jsFromBinary(client()->codeAt(jsToAddress(_address), block)) : ""; } -std::string WebThreeStubServer::coinbase() +std::string WebThreeStubServer::eth_coinbase() { return client() ? toJS(client()->address()) : ""; } -double WebThreeStubServer::countAt(string const& _address) +double WebThreeStubServer::eth_countAt(string const& _address) { int block = 0; return client() ? (double)(uint64_t)client()->countAt(jsToAddress(_address), block) : 0; } -int WebThreeStubServer::defaultBlock() +int WebThreeStubServer::eth_defaultBlock() { return client() ? client()->getDefault() : 0; } -std::string WebThreeStubServer::gasPrice() +std::string WebThreeStubServer::eth_gasPrice() { return toJS(10 * dev::eth::szabo); } -std::string WebThreeStubServer::get(std::string const& _name, std::string const& _key) +std::string WebThreeStubServer::db_get(std::string const& _name, std::string const& _key) { bytes k = sha3(_name).asBytes() + sha3(_key).asBytes(); string ret; @@ -450,14 +452,14 @@ std::string WebThreeStubServer::get(std::string const& _name, std::string const& return toJS(dev::asBytes(ret)); } -Json::Value WebThreeStubServer::getMessages(int const& _id) +Json::Value WebThreeStubServer::eth_getMessages(int const& _id) { if (!client()) return Json::Value(); return toJson(client()->messages(_id)); } -std::string WebThreeStubServer::getString(std::string const& _name, std::string const& _key) +std::string WebThreeStubServer::db_getString(std::string const& _name, std::string const& _key) { bytes k = sha3(_name).asBytes() + sha3(_key).asBytes(); string ret; @@ -465,22 +467,22 @@ std::string WebThreeStubServer::getString(std::string const& _name, std::string return ret; } -bool WebThreeStubServer::haveIdentity(std::string const& _id) +bool WebThreeStubServer::shh_haveIdentity(std::string const& _id) { return m_ids.count(jsToPublic(_id)) > 0; } -bool WebThreeStubServer::listening() +bool WebThreeStubServer::eth_listening() { return m_web3.isNetworkStarted(); } -bool WebThreeStubServer::mining() +bool WebThreeStubServer::eth_mining() { return client() ? client()->isMining() : false; } -int WebThreeStubServer::newFilter(Json::Value const& _json) +int WebThreeStubServer::eth_newFilter(Json::Value const& _json) { unsigned ret = -1; if (!client()) @@ -489,7 +491,7 @@ int WebThreeStubServer::newFilter(Json::Value const& _json) return ret; } -int WebThreeStubServer::newFilterString(std::string const& _filter) +int WebThreeStubServer::eth_newFilterString(std::string const& _filter) { unsigned ret = -1; if (!client()) @@ -501,14 +503,14 @@ int WebThreeStubServer::newFilterString(std::string const& _filter) return ret; } -std::string WebThreeStubServer::newGroup(std::string const& _id, std::string const& _who) +std::string WebThreeStubServer::shh_newGroup(std::string const& _id, std::string const& _who) { (void)_id; (void)_who; return ""; } -std::string WebThreeStubServer::newIdentity() +std::string WebThreeStubServer::shh_newIdentity() { cnote << this << m_ids; KeyPair kp = KeyPair::create(); @@ -516,22 +518,27 @@ std::string WebThreeStubServer::newIdentity() return toJS(kp.pub()); } -std::string WebThreeStubServer::compile(string const& _s) +std::string WebThreeStubServer::eth_compile(string const& _s) +{ + return toJS(dev::eth::compileLLL(_s)); +} + +std::string WebThreeStubServer::eth_lll(string const& _s) { return toJS(dev::eth::compileLLL(_s)); } -int WebThreeStubServer::number() +int WebThreeStubServer::eth_number() { return client() ? client()->number() + 1 : 0; } -int WebThreeStubServer::peerCount() +int WebThreeStubServer::eth_peerCount() { return m_web3.peerCount(); } -bool WebThreeStubServer::post(Json::Value const& _json) +bool WebThreeStubServer::shh_post(Json::Value const& _json) { cnote << this << m_ids; shh::Message m = toMessage(_json); @@ -548,7 +555,7 @@ bool WebThreeStubServer::post(Json::Value const& _json) return true; } -bool WebThreeStubServer::put(std::string const& _name, std::string const& _key, std::string const& _value) +bool WebThreeStubServer::db_put(std::string const& _name, std::string const& _key, std::string const& _value) { bytes k = sha3(_name).asBytes() + sha3(_key).asBytes(); bytes v = jsToBytes(_value); @@ -556,7 +563,7 @@ bool WebThreeStubServer::put(std::string const& _name, std::string const& _key, return true; } -bool WebThreeStubServer::putString(std::string const& _name, std::string const& _key, std::string const& _value) +bool WebThreeStubServer::db_putString(std::string const& _name, std::string const& _key, std::string const& _value) { bytes k = sha3(_name).asBytes() + sha3(_key).asBytes(); string v = _value; @@ -564,7 +571,7 @@ bool WebThreeStubServer::putString(std::string const& _name, std::string const& return true; } -bool WebThreeStubServer::setCoinbase(std::string const& _address) +bool WebThreeStubServer::eth_setCoinbase(std::string const& _address) { if (!client()) return false; @@ -572,7 +579,7 @@ bool WebThreeStubServer::setCoinbase(std::string const& _address) return true; } -bool WebThreeStubServer::setDefaultBlock(int const& _block) +bool WebThreeStubServer::eth_setDefaultBlock(int const& _block) { if (!client()) return false; @@ -580,7 +587,7 @@ bool WebThreeStubServer::setDefaultBlock(int const& _block) return true; } -bool WebThreeStubServer::setListening(bool const& _listening) +bool WebThreeStubServer::eth_setListening(bool const& _listening) { if (_listening) m_web3.startNetwork(); @@ -589,7 +596,7 @@ bool WebThreeStubServer::setListening(bool const& _listening) return true; } -bool WebThreeStubServer::setMining(bool const& _mining) +bool WebThreeStubServer::eth_setMining(bool const& _mining) { if (!client()) return false; @@ -601,7 +608,7 @@ bool WebThreeStubServer::setMining(bool const& _mining) return true; } -Json::Value WebThreeStubServer::shhChanged(int const& _id) +Json::Value WebThreeStubServer::shh_changed(int const& _id) { Json::Value ret(Json::arrayValue); auto pub = m_shhWatches[_id]; @@ -625,7 +632,7 @@ Json::Value WebThreeStubServer::shhChanged(int const& _id) return ret; } -int WebThreeStubServer::shhNewFilter(Json::Value const& _json) +int WebThreeStubServer::shh_newFilter(Json::Value const& _json) { auto w = toWatch(_json); auto ret = face()->installWatch(w.first); @@ -633,19 +640,19 @@ int WebThreeStubServer::shhNewFilter(Json::Value const& _json) return ret; } -bool WebThreeStubServer::shhUninstallFilter(int const& _id) +bool WebThreeStubServer::shh_uninstallFilter(int const& _id) { face()->uninstallWatch(_id); return true; } -std::string WebThreeStubServer::stateAt(string const& _address, string const& _storage) +std::string WebThreeStubServer::eth_stateAt(string const& _address, string const& _storage) { int block = 0; return client() ? toJS(client()->stateAt(jsToAddress(_address), jsToU256(_storage), block)) : ""; } -std::string WebThreeStubServer::transact(Json::Value const& _json) +std::string WebThreeStubServer::eth_transact(Json::Value const& _json) { std::string ret; if (!client()) @@ -675,35 +682,35 @@ std::string WebThreeStubServer::transact(Json::Value const& _json) return ret; } -Json::Value WebThreeStubServer::transactionByHash(std::string const& _hash, int const& _i) +Json::Value WebThreeStubServer::eth_transactionByHash(std::string const& _hash, int const& _i) { if (!client()) return ""; return toJson(client()->transaction(jsToFixed<32>(_hash), _i)); } -Json::Value WebThreeStubServer::transactionByNumber(int const& _number, int const& _i) +Json::Value WebThreeStubServer::eth_transactionByNumber(int const& _number, int const& _i) { if (!client()) return ""; return toJson(client()->transaction(client()->hashFromNumber(_number), _i)); } -Json::Value WebThreeStubServer::uncleByHash(std::string const& _hash, int const& _i) +Json::Value WebThreeStubServer::eth_uncleByHash(std::string const& _hash, int const& _i) { if (!client()) return ""; return toJson(client()->uncle(jsToFixed<32>(_hash), _i)); } -Json::Value WebThreeStubServer::uncleByNumber(int const& _number, int const& _i) +Json::Value WebThreeStubServer::eth_uncleByNumber(int const& _number, int const& _i) { if (!client()) return ""; return toJson(client()->uncle(client()->hashFromNumber(_number), _i)); } -bool WebThreeStubServer::uninstallFilter(int const& _id) +bool WebThreeStubServer::eth_uninstallFilter(int const& _id) { if (!client()) return false; diff --git a/libweb3jsonrpc/WebThreeStubServer.h b/libweb3jsonrpc/WebThreeStubServer.h index 33163b75e..10ca2fd76 100644 --- a/libweb3jsonrpc/WebThreeStubServer.h +++ b/libweb3jsonrpc/WebThreeStubServer.h @@ -64,49 +64,52 @@ class WebThreeStubServer: public AbstractWebThreeStubServer public: WebThreeStubServer(jsonrpc::AbstractServerConnector* _conn, dev::WebThreeDirect& _web3, std::vector const& _accounts); - virtual Json::Value accounts(); - virtual std::string addToGroup(std::string const& _group, std::string const& _who); - virtual std::string balanceAt(std::string const& _address); - virtual Json::Value blockByHash(std::string const& _hash); - virtual Json::Value blockByNumber(int const& _number); - virtual std::string call(Json::Value const& _json); - virtual bool changed(int const& _id); - virtual std::string codeAt(std::string const& _address); - virtual std::string coinbase(); - virtual std::string compile(std::string const& _s); - virtual double countAt(std::string const& _address); - virtual int defaultBlock(); - virtual std::string gasPrice(); - virtual std::string get(std::string const& _name, std::string const& _key); - virtual Json::Value getMessages(int const& _id); - virtual std::string getString(std::string const& _name, std::string const& _key); - virtual bool haveIdentity(std::string const& _id); - virtual bool listening(); - virtual bool mining(); - virtual int newFilter(Json::Value const& _json); - virtual int newFilterString(std::string const& _filter); - virtual std::string newGroup(std::string const& _id, std::string const& _who); - virtual std::string newIdentity(); - virtual int number(); - virtual int peerCount(); - virtual bool post(Json::Value const& _json); - virtual bool put(std::string const& _name, std::string const& _key, std::string const& _value); - virtual bool putString(std::string const& _name, std::string const& _key, std::string const& _value); - virtual bool setCoinbase(std::string const& _address); - virtual bool setDefaultBlock(int const& _block); - virtual bool setListening(bool const& _listening); - virtual bool setMining(bool const& _mining); - virtual Json::Value shhChanged(int const& _id); - virtual int shhNewFilter(Json::Value const& _json); - virtual bool shhUninstallFilter(int const& _id); - virtual std::string stateAt(std::string const& _address, std::string const& _storage); - virtual std::string transact(Json::Value const& _json); - virtual Json::Value transactionByHash(std::string const& _hash, int const& _i); - virtual Json::Value transactionByNumber(int const& _number, int const& _i); - virtual Json::Value uncleByHash(std::string const& _hash, int const& _i); - virtual Json::Value uncleByNumber(int const& _number, int const& _i); - virtual bool uninstallFilter(int const& _id); - + virtual Json::Value eth_accounts(); + virtual std::string eth_balanceAt(std::string const& _address); + virtual Json::Value eth_blockByHash(std::string const& _hash); + virtual Json::Value eth_blockByNumber(int const& _number); + virtual std::string eth_call(Json::Value const& _json); + virtual bool eth_changed(int const& _id); + virtual std::string eth_codeAt(std::string const& _address); + virtual std::string eth_coinbase(); + virtual std::string eth_compile(std::string const& _s); + virtual double eth_countAt(std::string const& _address); + virtual int eth_defaultBlock(); + virtual std::string eth_gasPrice(); + virtual Json::Value eth_getMessages(int const& _id); + virtual bool eth_listening(); + virtual bool eth_mining(); + virtual int eth_newFilter(Json::Value const& _json); + virtual int eth_newFilterString(std::string const& _filter); + virtual int eth_number(); + virtual int eth_peerCount(); + virtual bool eth_setCoinbase(std::string const& _address); + virtual bool eth_setDefaultBlock(int const& _block); + virtual bool eth_setListening(bool const& _listening); + virtual std::string eth_lll(std::string const& _s); + virtual bool eth_setMining(bool const& _mining); + virtual std::string eth_stateAt(std::string const& _address, std::string const& _storage); + virtual std::string eth_transact(Json::Value const& _json); + virtual Json::Value eth_transactionByHash(std::string const& _hash, int const& _i); + virtual Json::Value eth_transactionByNumber(int const& _number, int const& _i); + virtual Json::Value eth_uncleByHash(std::string const& _hash, int const& _i); + virtual Json::Value eth_uncleByNumber(int const& _number, int const& _i); + virtual bool eth_uninstallFilter(int const& _id); + + virtual std::string db_get(std::string const& _name, std::string const& _key); + virtual std::string db_getString(std::string const& _name, std::string const& _key); + virtual bool db_put(std::string const& _name, std::string const& _key, std::string const& _value); + virtual bool db_putString(std::string const& _name, std::string const& _key, std::string const& _value); + + virtual std::string shh_addToGroup(std::string const& _group, std::string const& _who); + virtual Json::Value shh_changed(int const& _id); + virtual bool shh_haveIdentity(std::string const& _id); + virtual int shh_newFilter(Json::Value const& _json); + virtual std::string shh_newGroup(std::string const& _id, std::string const& _who); + virtual std::string shh_newIdentity(); + virtual bool shh_post(Json::Value const& _json); + virtual bool shh_uninstallFilter(int const& _id); + void setAccounts(std::vector const& _accounts); void setIdentities(std::vector const& _ids); std::map const& ids() const { return m_ids; } diff --git a/libweb3jsonrpc/abstractwebthreestubserver.h b/libweb3jsonrpc/abstractwebthreestubserver.h index 66b9ff77d..dc99ddcc6 100644 --- a/libweb3jsonrpc/abstractwebthreestubserver.h +++ b/libweb3jsonrpc/abstractwebthreestubserver.h @@ -13,304 +13,311 @@ class AbstractWebThreeStubServer : public jsonrpc::AbstractServer(conn) { - this->bindAndAddMethod(new jsonrpc::Procedure("accounts", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_ARRAY, NULL), &AbstractWebThreeStubServer::accountsI); - this->bindAndAddMethod(new jsonrpc::Procedure("addToGroup", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::addToGroupI); - this->bindAndAddMethod(new jsonrpc::Procedure("balanceAt", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::balanceAtI); - this->bindAndAddMethod(new jsonrpc::Procedure("blockByHash", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::blockByHashI); - this->bindAndAddMethod(new jsonrpc::Procedure("blockByNumber", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::blockByNumberI); - this->bindAndAddMethod(new jsonrpc::Procedure("call", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_OBJECT, NULL), &AbstractWebThreeStubServer::callI); - this->bindAndAddMethod(new jsonrpc::Procedure("changed", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::changedI); - this->bindAndAddMethod(new jsonrpc::Procedure("codeAt", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::codeAtI); - this->bindAndAddMethod(new jsonrpc::Procedure("coinbase", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::coinbaseI); - this->bindAndAddMethod(new jsonrpc::Procedure("compile", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::compileI); - this->bindAndAddMethod(new jsonrpc::Procedure("countAt", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_REAL, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::countAtI); - this->bindAndAddMethod(new jsonrpc::Procedure("defaultBlock", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::defaultBlockI); - this->bindAndAddMethod(new jsonrpc::Procedure("gasPrice", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::gasPriceI); - this->bindAndAddMethod(new jsonrpc::Procedure("get", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::getI); - this->bindAndAddMethod(new jsonrpc::Procedure("getMessages", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_ARRAY, "param1",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::getMessagesI); - this->bindAndAddMethod(new jsonrpc::Procedure("getString", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::getStringI); - this->bindAndAddMethod(new jsonrpc::Procedure("haveIdentity", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::haveIdentityI); - this->bindAndAddMethod(new jsonrpc::Procedure("listening", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, NULL), &AbstractWebThreeStubServer::listeningI); - this->bindAndAddMethod(new jsonrpc::Procedure("mining", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, NULL), &AbstractWebThreeStubServer::miningI); - this->bindAndAddMethod(new jsonrpc::Procedure("newFilter", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_INTEGER, "param1",jsonrpc::JSON_OBJECT, NULL), &AbstractWebThreeStubServer::newFilterI); - this->bindAndAddMethod(new jsonrpc::Procedure("newFilterString", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_INTEGER, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::newFilterStringI); - this->bindAndAddMethod(new jsonrpc::Procedure("newGroup", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::newGroupI); - this->bindAndAddMethod(new jsonrpc::Procedure("newIdentity", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::newIdentityI); - this->bindAndAddMethod(new jsonrpc::Procedure("number", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::numberI); - this->bindAndAddMethod(new jsonrpc::Procedure("peerCount", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::peerCountI); - this->bindAndAddMethod(new jsonrpc::Procedure("post", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_OBJECT, NULL), &AbstractWebThreeStubServer::postI); - this->bindAndAddMethod(new jsonrpc::Procedure("put", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING,"param3",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::putI); - this->bindAndAddMethod(new jsonrpc::Procedure("putString", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING,"param3",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::putStringI); - this->bindAndAddMethod(new jsonrpc::Procedure("setCoinbase", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::setCoinbaseI); - this->bindAndAddMethod(new jsonrpc::Procedure("setDefaultBlock", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::setDefaultBlockI); - this->bindAndAddMethod(new jsonrpc::Procedure("setListening", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_BOOLEAN, NULL), &AbstractWebThreeStubServer::setListeningI); - this->bindAndAddMethod(new jsonrpc::Procedure("setMining", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_BOOLEAN, NULL), &AbstractWebThreeStubServer::setMiningI); - this->bindAndAddMethod(new jsonrpc::Procedure("shhChanged", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_ARRAY, "param1",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::shhChangedI); - this->bindAndAddMethod(new jsonrpc::Procedure("shhNewFilter", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_INTEGER, "param1",jsonrpc::JSON_OBJECT, NULL), &AbstractWebThreeStubServer::shhNewFilterI); - this->bindAndAddMethod(new jsonrpc::Procedure("shhUninstallFilter", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::shhUninstallFilterI); - this->bindAndAddMethod(new jsonrpc::Procedure("stateAt", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::stateAtI); - this->bindAndAddMethod(new jsonrpc::Procedure("transact", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_OBJECT, NULL), &AbstractWebThreeStubServer::transactI); - this->bindAndAddMethod(new jsonrpc::Procedure("transactionByHash", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::transactionByHashI); - this->bindAndAddMethod(new jsonrpc::Procedure("transactionByNumber", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_INTEGER,"param2",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::transactionByNumberI); - this->bindAndAddMethod(new jsonrpc::Procedure("uncleByHash", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::uncleByHashI); - this->bindAndAddMethod(new jsonrpc::Procedure("uncleByNumber", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_INTEGER,"param2",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::uncleByNumberI); - this->bindAndAddMethod(new jsonrpc::Procedure("uninstallFilter", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::uninstallFilterI); + this->bindAndAddMethod(new jsonrpc::Procedure("db_get", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::db_getI); + this->bindAndAddMethod(new jsonrpc::Procedure("db_getString", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::db_getStringI); + this->bindAndAddMethod(new jsonrpc::Procedure("db_put", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING,"param3",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::db_putI); + this->bindAndAddMethod(new jsonrpc::Procedure("db_putString", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING,"param3",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::db_putStringI); + this->bindAndAddMethod(new jsonrpc::Procedure("eth_accounts", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_ARRAY, NULL), &AbstractWebThreeStubServer::eth_accountsI); + this->bindAndAddMethod(new jsonrpc::Procedure("eth_balanceAt", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_balanceAtI); + this->bindAndAddMethod(new jsonrpc::Procedure("eth_blockByHash", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_blockByHashI); + this->bindAndAddMethod(new jsonrpc::Procedure("eth_blockByNumber", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::eth_blockByNumberI); + this->bindAndAddMethod(new jsonrpc::Procedure("eth_call", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_OBJECT, NULL), &AbstractWebThreeStubServer::eth_callI); + this->bindAndAddMethod(new jsonrpc::Procedure("eth_changed", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::eth_changedI); + this->bindAndAddMethod(new jsonrpc::Procedure("eth_codeAt", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_codeAtI); + this->bindAndAddMethod(new jsonrpc::Procedure("eth_coinbase", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_coinbaseI); + this->bindAndAddMethod(new jsonrpc::Procedure("eth_compile", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_compileI); + this->bindAndAddMethod(new jsonrpc::Procedure("eth_countAt", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_REAL, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_countAtI); + this->bindAndAddMethod(new jsonrpc::Procedure("eth_defaultBlock", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::eth_defaultBlockI); + 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_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_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_number", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::eth_numberI); + this->bindAndAddMethod(new jsonrpc::Procedure("eth_peerCount", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::eth_peerCountI); + this->bindAndAddMethod(new jsonrpc::Procedure("eth_setCoinbase", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_setCoinbaseI); + this->bindAndAddMethod(new jsonrpc::Procedure("eth_setDefaultBlock", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::eth_setDefaultBlockI); + this->bindAndAddMethod(new jsonrpc::Procedure("eth_setListening", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_BOOLEAN, NULL), &AbstractWebThreeStubServer::eth_setListeningI); + this->bindAndAddMethod(new jsonrpc::Procedure("eth_setMining", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_BOOLEAN, NULL), &AbstractWebThreeStubServer::eth_setMiningI); + this->bindAndAddMethod(new jsonrpc::Procedure("eth_stateAt", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_stateAtI); + this->bindAndAddMethod(new jsonrpc::Procedure("eth_transact", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_OBJECT, NULL), &AbstractWebThreeStubServer::eth_transactI); + this->bindAndAddMethod(new jsonrpc::Procedure("eth_transactionByHash", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::eth_transactionByHashI); + this->bindAndAddMethod(new jsonrpc::Procedure("eth_transactionByNumber", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_INTEGER,"param2",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::eth_transactionByNumberI); + this->bindAndAddMethod(new jsonrpc::Procedure("eth_uncleByHash", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::eth_uncleByHashI); + this->bindAndAddMethod(new jsonrpc::Procedure("eth_uncleByNumber", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_INTEGER,"param2",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::eth_uncleByNumberI); + this->bindAndAddMethod(new jsonrpc::Procedure("eth_uninstallFilter", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::eth_uninstallFilterI); + this->bindAndAddMethod(new jsonrpc::Procedure("shh_addToGroup", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::shh_addToGroupI); + this->bindAndAddMethod(new jsonrpc::Procedure("shh_changed", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_ARRAY, "param1",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::shh_changedI); + this->bindAndAddMethod(new jsonrpc::Procedure("shh_haveIdentity", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::shh_haveIdentityI); + this->bindAndAddMethod(new jsonrpc::Procedure("shh_newFilter", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_INTEGER, "param1",jsonrpc::JSON_OBJECT, NULL), &AbstractWebThreeStubServer::shh_newFilterI); + this->bindAndAddMethod(new jsonrpc::Procedure("shh_newGroup", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::shh_newGroupI); + this->bindAndAddMethod(new jsonrpc::Procedure("shh_newIdentity", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::shh_newIdentityI); + this->bindAndAddMethod(new jsonrpc::Procedure("shh_post", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_OBJECT, NULL), &AbstractWebThreeStubServer::shh_postI); + this->bindAndAddMethod(new jsonrpc::Procedure("shh_uninstallFilter", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::shh_uninstallFilterI); } - inline virtual void accountsI(const Json::Value& request, Json::Value& response) + inline virtual void db_getI(const Json::Value& request, Json::Value& response) { - response = this->accounts(); + response = this->db_get(request[0u].asString(), request[1u].asString()); } - inline virtual void addToGroupI(const Json::Value& request, Json::Value& response) + inline virtual void db_getStringI(const Json::Value& request, Json::Value& response) { - response = this->addToGroup(request[0u].asString(), request[1u].asString()); + response = this->db_getString(request[0u].asString(), request[1u].asString()); } - inline virtual void balanceAtI(const Json::Value& request, Json::Value& response) + inline virtual void db_putI(const Json::Value& request, Json::Value& response) { - response = this->balanceAt(request[0u].asString()); + response = this->db_put(request[0u].asString(), request[1u].asString(), request[2u].asString()); } - inline virtual void blockByHashI(const Json::Value& request, Json::Value& response) + inline virtual void db_putStringI(const Json::Value& request, Json::Value& response) { - response = this->blockByHash(request[0u].asString()); + response = this->db_putString(request[0u].asString(), request[1u].asString(), request[2u].asString()); } - inline virtual void blockByNumberI(const Json::Value& request, Json::Value& response) + inline virtual void eth_accountsI(const Json::Value& request, Json::Value& response) { - response = this->blockByNumber(request[0u].asInt()); + response = this->eth_accounts(); } - inline virtual void callI(const Json::Value& request, Json::Value& response) + inline virtual void eth_balanceAtI(const Json::Value& request, Json::Value& response) { - response = this->call(request[0u]); + response = this->eth_balanceAt(request[0u].asString()); } - inline virtual void changedI(const Json::Value& request, Json::Value& response) + inline virtual void eth_blockByHashI(const Json::Value& request, Json::Value& response) { - response = this->changed(request[0u].asInt()); + response = this->eth_blockByHash(request[0u].asString()); } - inline virtual void codeAtI(const Json::Value& request, Json::Value& response) + inline virtual void eth_blockByNumberI(const Json::Value& request, Json::Value& response) { - response = this->codeAt(request[0u].asString()); + response = this->eth_blockByNumber(request[0u].asInt()); } - inline virtual void coinbaseI(const Json::Value& request, Json::Value& response) + inline virtual void eth_callI(const Json::Value& request, Json::Value& response) { - response = this->coinbase(); + response = this->eth_call(request[0u]); } - inline virtual void compileI(const Json::Value& request, Json::Value& response) + inline virtual void eth_changedI(const Json::Value& request, Json::Value& response) { - response = this->compile(request[0u].asString()); + response = this->eth_changed(request[0u].asInt()); } - inline virtual void countAtI(const Json::Value& request, Json::Value& response) + inline virtual void eth_codeAtI(const Json::Value& request, Json::Value& response) { - response = this->countAt(request[0u].asString()); + response = this->eth_codeAt(request[0u].asString()); } - inline virtual void defaultBlockI(const Json::Value& request, Json::Value& response) + inline virtual void eth_coinbaseI(const Json::Value& request, Json::Value& response) { - response = this->defaultBlock(); + response = this->eth_coinbase(); } - inline virtual void gasPriceI(const Json::Value& request, Json::Value& response) + inline virtual void eth_compileI(const Json::Value& request, Json::Value& response) { - response = this->gasPrice(); + response = this->eth_compile(request[0u].asString()); } - inline virtual void getI(const Json::Value& request, Json::Value& response) + inline virtual void eth_countAtI(const Json::Value& request, Json::Value& response) { - response = this->get(request[0u].asString(), request[1u].asString()); + response = this->eth_countAt(request[0u].asString()); } - inline virtual void getMessagesI(const Json::Value& request, Json::Value& response) + inline virtual void eth_defaultBlockI(const Json::Value& request, Json::Value& response) { - response = this->getMessages(request[0u].asInt()); + response = this->eth_defaultBlock(); } - inline virtual void getStringI(const Json::Value& request, Json::Value& response) + inline virtual void eth_gasPriceI(const Json::Value& request, Json::Value& response) { - response = this->getString(request[0u].asString(), request[1u].asString()); + response = this->eth_gasPrice(); } - inline virtual void haveIdentityI(const Json::Value& request, Json::Value& response) + inline virtual void eth_getMessagesI(const Json::Value& request, Json::Value& response) { - response = this->haveIdentity(request[0u].asString()); + response = this->eth_getMessages(request[0u].asInt()); } - inline virtual void listeningI(const Json::Value& request, Json::Value& response) + inline virtual void eth_listeningI(const Json::Value& request, Json::Value& response) { - response = this->listening(); + response = this->eth_listening(); } - inline virtual void miningI(const Json::Value& request, Json::Value& response) + inline virtual void eth_lllI(const Json::Value& request, Json::Value& response) { - response = this->mining(); + response = this->eth_lll(request[0u].asString()); } - inline virtual void newFilterI(const Json::Value& request, Json::Value& response) + inline virtual void eth_miningI(const Json::Value& request, Json::Value& response) { - response = this->newFilter(request[0u]); + response = this->eth_mining(); } - inline virtual void newFilterStringI(const Json::Value& request, Json::Value& response) + inline virtual void eth_newFilterI(const Json::Value& request, Json::Value& response) { - response = this->newFilterString(request[0u].asString()); + response = this->eth_newFilter(request[0u]); } - inline virtual void newGroupI(const Json::Value& request, Json::Value& response) + inline virtual void eth_newFilterStringI(const Json::Value& request, Json::Value& response) { - response = this->newGroup(request[0u].asString(), request[1u].asString()); + response = this->eth_newFilterString(request[0u].asString()); } - inline virtual void newIdentityI(const Json::Value& request, Json::Value& response) + inline virtual void eth_numberI(const Json::Value& request, Json::Value& response) { - response = this->newIdentity(); + response = this->eth_number(); } - inline virtual void numberI(const Json::Value& request, Json::Value& response) + inline virtual void eth_peerCountI(const Json::Value& request, Json::Value& response) { - response = this->number(); + response = this->eth_peerCount(); } - inline virtual void peerCountI(const Json::Value& request, Json::Value& response) + inline virtual void eth_setCoinbaseI(const Json::Value& request, Json::Value& response) { - response = this->peerCount(); + response = this->eth_setCoinbase(request[0u].asString()); } - inline virtual void postI(const Json::Value& request, Json::Value& response) + inline virtual void eth_setDefaultBlockI(const Json::Value& request, Json::Value& response) { - response = this->post(request[0u]); + response = this->eth_setDefaultBlock(request[0u].asInt()); } - inline virtual void putI(const Json::Value& request, Json::Value& response) + inline virtual void eth_setListeningI(const Json::Value& request, Json::Value& response) { - response = this->put(request[0u].asString(), request[1u].asString(), request[2u].asString()); + response = this->eth_setListening(request[0u].asBool()); } - inline virtual void putStringI(const Json::Value& request, Json::Value& response) + inline virtual void eth_setMiningI(const Json::Value& request, Json::Value& response) { - response = this->putString(request[0u].asString(), request[1u].asString(), request[2u].asString()); + response = this->eth_setMining(request[0u].asBool()); } - inline virtual void setCoinbaseI(const Json::Value& request, Json::Value& response) + inline virtual void eth_stateAtI(const Json::Value& request, Json::Value& response) { - response = this->setCoinbase(request[0u].asString()); + response = this->eth_stateAt(request[0u].asString(), request[1u].asString()); } - inline virtual void setDefaultBlockI(const Json::Value& request, Json::Value& response) + inline virtual void eth_transactI(const Json::Value& request, Json::Value& response) { - response = this->setDefaultBlock(request[0u].asInt()); + response = this->eth_transact(request[0u]); } - inline virtual void setListeningI(const Json::Value& request, Json::Value& response) + inline virtual void eth_transactionByHashI(const Json::Value& request, Json::Value& response) { - response = this->setListening(request[0u].asBool()); + response = this->eth_transactionByHash(request[0u].asString(), request[1u].asInt()); } - inline virtual void setMiningI(const Json::Value& request, Json::Value& response) + inline virtual void eth_transactionByNumberI(const Json::Value& request, Json::Value& response) { - response = this->setMining(request[0u].asBool()); + response = this->eth_transactionByNumber(request[0u].asInt(), request[1u].asInt()); } - inline virtual void shhChangedI(const Json::Value& request, Json::Value& response) + inline virtual void eth_uncleByHashI(const Json::Value& request, Json::Value& response) { - response = this->shhChanged(request[0u].asInt()); + response = this->eth_uncleByHash(request[0u].asString(), request[1u].asInt()); } - inline virtual void shhNewFilterI(const Json::Value& request, Json::Value& response) + inline virtual void eth_uncleByNumberI(const Json::Value& request, Json::Value& response) { - response = this->shhNewFilter(request[0u]); + response = this->eth_uncleByNumber(request[0u].asInt(), request[1u].asInt()); } - inline virtual void shhUninstallFilterI(const Json::Value& request, Json::Value& response) + inline virtual void eth_uninstallFilterI(const Json::Value& request, Json::Value& response) { - response = this->shhUninstallFilter(request[0u].asInt()); + response = this->eth_uninstallFilter(request[0u].asInt()); } - inline virtual void stateAtI(const Json::Value& request, Json::Value& response) + inline virtual void shh_addToGroupI(const Json::Value& request, Json::Value& response) { - response = this->stateAt(request[0u].asString(), request[1u].asString()); + response = this->shh_addToGroup(request[0u].asString(), request[1u].asString()); } - inline virtual void transactI(const Json::Value& request, Json::Value& response) + inline virtual void shh_changedI(const Json::Value& request, Json::Value& response) { - response = this->transact(request[0u]); + response = this->shh_changed(request[0u].asInt()); } - inline virtual void transactionByHashI(const Json::Value& request, Json::Value& response) + inline virtual void shh_haveIdentityI(const Json::Value& request, Json::Value& response) { - response = this->transactionByHash(request[0u].asString(), request[1u].asInt()); + response = this->shh_haveIdentity(request[0u].asString()); } - inline virtual void transactionByNumberI(const Json::Value& request, Json::Value& response) + inline virtual void shh_newFilterI(const Json::Value& request, Json::Value& response) { - response = this->transactionByNumber(request[0u].asInt(), request[1u].asInt()); + response = this->shh_newFilter(request[0u]); } - inline virtual void uncleByHashI(const Json::Value& request, Json::Value& response) + inline virtual void shh_newGroupI(const Json::Value& request, Json::Value& response) { - response = this->uncleByHash(request[0u].asString(), request[1u].asInt()); + response = this->shh_newGroup(request[0u].asString(), request[1u].asString()); } - inline virtual void uncleByNumberI(const Json::Value& request, Json::Value& response) + inline virtual void shh_newIdentityI(const Json::Value& request, Json::Value& response) { - response = this->uncleByNumber(request[0u].asInt(), request[1u].asInt()); + response = this->shh_newIdentity(); } - inline virtual void uninstallFilterI(const Json::Value& request, Json::Value& response) + inline virtual void shh_postI(const Json::Value& request, Json::Value& response) { - response = this->uninstallFilter(request[0u].asInt()); + response = this->shh_post(request[0u]); + } + + inline virtual void shh_uninstallFilterI(const Json::Value& request, Json::Value& response) + { + response = this->shh_uninstallFilter(request[0u].asInt()); } - virtual Json::Value accounts() = 0; - virtual std::string addToGroup(const std::string& param1, const std::string& param2) = 0; - virtual std::string balanceAt(const std::string& param1) = 0; - virtual Json::Value blockByHash(const std::string& param1) = 0; - virtual Json::Value blockByNumber(const int& param1) = 0; - virtual std::string call(const Json::Value& param1) = 0; - virtual bool changed(const int& param1) = 0; - virtual std::string codeAt(const std::string& param1) = 0; - virtual std::string coinbase() = 0; - virtual std::string compile(const std::string& param1) = 0; - virtual double countAt(const std::string& param1) = 0; - virtual int defaultBlock() = 0; - virtual std::string gasPrice() = 0; - virtual std::string get(const std::string& param1, const std::string& param2) = 0; - virtual Json::Value getMessages(const int& param1) = 0; - virtual std::string getString(const std::string& param1, const std::string& param2) = 0; - virtual bool haveIdentity(const std::string& param1) = 0; - virtual bool listening() = 0; - virtual bool mining() = 0; - virtual int newFilter(const Json::Value& param1) = 0; - virtual int newFilterString(const std::string& param1) = 0; - virtual std::string newGroup(const std::string& param1, const std::string& param2) = 0; - virtual std::string newIdentity() = 0; - virtual int number() = 0; - virtual int peerCount() = 0; - virtual bool post(const Json::Value& param1) = 0; - virtual bool put(const std::string& param1, const std::string& param2, const std::string& param3) = 0; - virtual bool putString(const std::string& param1, const std::string& param2, const std::string& param3) = 0; - virtual bool setCoinbase(const std::string& param1) = 0; - virtual bool setDefaultBlock(const int& param1) = 0; - virtual bool setListening(const bool& param1) = 0; - virtual bool setMining(const bool& param1) = 0; - virtual Json::Value shhChanged(const int& param1) = 0; - virtual int shhNewFilter(const Json::Value& param1) = 0; - virtual bool shhUninstallFilter(const int& param1) = 0; - virtual std::string stateAt(const std::string& param1, const std::string& param2) = 0; - virtual std::string transact(const Json::Value& param1) = 0; - virtual Json::Value transactionByHash(const std::string& param1, const int& param2) = 0; - virtual Json::Value transactionByNumber(const int& param1, const int& param2) = 0; - virtual Json::Value uncleByHash(const std::string& param1, const int& param2) = 0; - virtual Json::Value uncleByNumber(const int& param1, const int& param2) = 0; - virtual bool uninstallFilter(const int& param1) = 0; + virtual std::string db_get(const std::string& param1, const std::string& param2) = 0; + virtual std::string db_getString(const std::string& param1, const std::string& param2) = 0; + virtual bool db_put(const std::string& param1, const std::string& param2, const std::string& param3) = 0; + virtual bool db_putString(const std::string& param1, const std::string& param2, const std::string& param3) = 0; + virtual Json::Value eth_accounts() = 0; + virtual std::string eth_balanceAt(const std::string& param1) = 0; + virtual Json::Value eth_blockByHash(const std::string& param1) = 0; + virtual Json::Value eth_blockByNumber(const int& param1) = 0; + virtual std::string eth_call(const Json::Value& param1) = 0; + virtual bool eth_changed(const int& param1) = 0; + virtual std::string eth_codeAt(const std::string& param1) = 0; + virtual std::string eth_coinbase() = 0; + virtual std::string eth_compile(const std::string& param1) = 0; + virtual double eth_countAt(const std::string& param1) = 0; + virtual int eth_defaultBlock() = 0; + virtual std::string eth_gasPrice() = 0; + virtual Json::Value eth_getMessages(const int& param1) = 0; + virtual bool eth_listening() = 0; + virtual std::string eth_lll(const std::string& param1) = 0; + virtual bool eth_mining() = 0; + virtual int eth_newFilter(const Json::Value& param1) = 0; + virtual int eth_newFilterString(const std::string& param1) = 0; + virtual int eth_number() = 0; + virtual int eth_peerCount() = 0; + virtual bool eth_setCoinbase(const std::string& param1) = 0; + virtual bool eth_setDefaultBlock(const int& param1) = 0; + virtual bool eth_setListening(const bool& param1) = 0; + virtual bool eth_setMining(const bool& param1) = 0; + virtual std::string eth_stateAt(const std::string& param1, const std::string& param2) = 0; + virtual std::string eth_transact(const Json::Value& param1) = 0; + virtual Json::Value eth_transactionByHash(const std::string& param1, const int& param2) = 0; + virtual Json::Value eth_transactionByNumber(const int& param1, const int& param2) = 0; + virtual Json::Value eth_uncleByHash(const std::string& param1, const int& param2) = 0; + virtual Json::Value eth_uncleByNumber(const int& param1, const int& param2) = 0; + virtual bool eth_uninstallFilter(const int& param1) = 0; + virtual std::string shh_addToGroup(const std::string& param1, const std::string& param2) = 0; + virtual Json::Value shh_changed(const int& param1) = 0; + virtual bool shh_haveIdentity(const std::string& param1) = 0; + virtual int shh_newFilter(const Json::Value& param1) = 0; + virtual std::string shh_newGroup(const std::string& param1, const std::string& param2) = 0; + virtual std::string shh_newIdentity() = 0; + virtual bool shh_post(const Json::Value& param1) = 0; + virtual bool shh_uninstallFilter(const int& param1) = 0; }; #endif //_ABSTRACTWEBTHREESTUBSERVER_H_ diff --git a/libweb3jsonrpc/spec.json b/libweb3jsonrpc/spec.json index 591fbcfe7..47a8b26df 100644 --- a/libweb3jsonrpc/spec.json +++ b/libweb3jsonrpc/spec.json @@ -1,54 +1,55 @@ [ - { "method": "coinbase", "params": [], "order": [], "returns" : "" }, - { "method": "setCoinbase", "params": [""], "order": [], "returns" : true }, - { "method": "listening", "params": [], "order": [], "returns" : false }, - { "method": "setListening", "params": [false], "order" : [], "returns" : true }, - { "method": "mining", "params": [], "order": [], "returns" : false }, - { "method": "setMining", "params": [false], "order" : [], "returns" : true }, - { "method": "gasPrice", "params": [], "order": [], "returns" : "" }, - { "method": "accounts", "params": [], "order": [], "returns" : [] }, - { "method": "peerCount", "params": [], "order": [], "returns" : 0 }, - { "method": "defaultBlock", "params": [], "order": [], "returns" : 0}, - { "method": "setDefaultBlock", "params": [0], "order": [], "returns" : true}, - { "method": "number", "params": [], "order": [], "returns" : 0}, - - { "method": "balanceAt", "params": [""], "order": [], "returns" : ""}, - { "method": "stateAt", "params": ["", ""], "order": [], "returns": ""}, - { "method": "countAt", "params": [""], "order": [], "returns" : 0.0}, - { "method": "codeAt", "params": [""], "order": [], "returns": ""}, - - { "method": "transact", "params": [{}], "order": [], "returns": ""}, - { "method": "call", "params": [{}], "order": [], "returns": ""}, - - { "method": "blockByHash", "params": [""],"order": [], "returns": {}}, - { "method": "blockByNumber", "params": [0],"order": [], "returns": {}}, - { "method": "transactionByHash", "params": ["", 0], "order": [], "returns": {}}, - { "method": "transactionByNumber", "params": [0, 0], "order": [], "returns": {}}, - { "method": "uncleByHash", "params": ["", 0], "order": [], "returns": {}}, - { "method": "uncleByNumber", "params": [0, 0], "order": [], "returns": {}}, - - { "method": "compile", "params": [""], "order": [], "returns": ""}, - - { "method": "newFilter", "params": [{}], "order": [], "returns": 0}, - { "method": "newFilterString", "params": [""], "order": [], "returns": 0}, - { "method": "uninstallFilter", "params": [0], "order": [], "returns": true}, - { "method": "changed", "params": [0], "order": [], "returns": false}, - { "method": "getMessages", "params": [0], "order": [], "returns": []}, - - { "method": "put", "params": ["", "", ""], "order": [], "returns": true}, - { "method": "get", "params": ["", ""], "order": [], "returns": ""}, - { "method": "putString", "params": ["", "", ""], "order": [], "returns": true}, - { "method": "getString", "params": ["", ""], "order": [], "returns": ""}, - - { "method": "post", "params": [{}], "order": [], "returns": true}, - { "method": "newIdentity", "params": [], "order": [], "returns": ""}, - { "method": "haveIdentity", "params": [""], "order": [], "returns": false}, - { "method": "newGroup", "params": ["", ""], "order": [], "returns": ""}, - { "method": "addToGroup", "params": ["", ""], "order": [], "returns": ""}, + { "method": "eth_coinbase", "params": [], "order": [], "returns" : "" }, + { "method": "eth_setCoinbase", "params": [""], "order": [], "returns" : true }, + { "method": "eth_listening", "params": [], "order": [], "returns" : false }, + { "method": "eth_setListening", "params": [false], "order" : [], "returns" : true }, + { "method": "eth_mining", "params": [], "order": [], "returns" : false }, + { "method": "eth_setMining", "params": [false], "order" : [], "returns" : true }, + { "method": "eth_gasPrice", "params": [], "order": [], "returns" : "" }, + { "method": "eth_accounts", "params": [], "order": [], "returns" : [] }, + { "method": "eth_peerCount", "params": [], "order": [], "returns" : 0 }, + { "method": "eth_defaultBlock", "params": [], "order": [], "returns" : 0}, + { "method": "eth_setDefaultBlock", "params": [0], "order": [], "returns" : true}, + { "method": "eth_number", "params": [], "order": [], "returns" : 0}, + + { "method": "eth_balanceAt", "params": [""], "order": [], "returns" : ""}, + { "method": "eth_stateAt", "params": ["", ""], "order": [], "returns": ""}, + { "method": "eth_countAt", "params": [""], "order": [], "returns" : 0.0}, + { "method": "eth_codeAt", "params": [""], "order": [], "returns": ""}, + + { "method": "eth_transact", "params": [{}], "order": [], "returns": ""}, + { "method": "eth_call", "params": [{}], "order": [], "returns": ""}, + + { "method": "eth_blockByHash", "params": [""],"order": [], "returns": {}}, + { "method": "eth_blockByNumber", "params": [0],"order": [], "returns": {}}, + { "method": "eth_transactionByHash", "params": ["", 0], "order": [], "returns": {}}, + { "method": "eth_transactionByNumber", "params": [0, 0], "order": [], "returns": {}}, + { "method": "eth_uncleByHash", "params": ["", 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_newFilter", "params": [{}], "order": [], "returns": 0}, + { "method": "eth_newFilterString", "params": [""], "order": [], "returns": 0}, + { "method": "eth_uninstallFilter", "params": [0], "order": [], "returns": true}, + { "method": "eth_changed", "params": [0], "order": [], "returns": false}, + { "method": "eth_getMessages", "params": [0], "order": [], "returns": []}, + + { "method": "db_put", "params": ["", "", ""], "order": [], "returns": true}, + { "method": "db_get", "params": ["", ""], "order": [], "returns": ""}, + { "method": "db_putString", "params": ["", "", ""], "order": [], "returns": true}, + { "method": "db_getString", "params": ["", ""], "order": [], "returns": ""}, + + { "method": "shh_post", "params": [{}], "order": [], "returns": true}, + { "method": "shh_newIdentity", "params": [], "order": [], "returns": ""}, + { "method": "shh_haveIdentity", "params": [""], "order": [], "returns": false}, + { "method": "shh_newGroup", "params": ["", ""], "order": [], "returns": ""}, + { "method": "shh_addToGroup", "params": ["", ""], "order": [], "returns": ""}, - { "method": "shhNewFilter", "params": [{}], "order": [], "returns": 0}, - { "method": "shhUninstallFilter", "params": [0], "order": [], "returns": true}, - { "method": "shhChanged", "params": [0], "order": [], "returns": []} + { "method": "shh_newFilter", "params": [{}], "order": [], "returns": 0}, + { "method": "shh_uninstallFilter", "params": [0], "order": [], "returns": true}, + { "method": "shh_changed", "params": [0], "order": [], "returns": []} ] diff --git a/test/jsonrpc.cpp b/test/jsonrpc.cpp index 68c30734a..4c748a954 100644 --- a/test/jsonrpc.cpp +++ b/test/jsonrpc.cpp @@ -74,14 +74,14 @@ BOOST_FIXTURE_TEST_SUITE(environment, Setup) BOOST_AUTO_TEST_CASE(jsonrpc_defaultBlock) { cnote << "Testing jsonrpc defaultBlock..."; - int defaultBlock = jsonrpcClient->defaultBlock(); + int defaultBlock = jsonrpcClient->eth_defaultBlock(); BOOST_CHECK_EQUAL(defaultBlock, web3->ethereum()->getDefault()); } BOOST_AUTO_TEST_CASE(jsonrpc_gasPrice) { cnote << "Testing jsonrpc gasPrice..."; - string gasPrice = jsonrpcClient->gasPrice(); + string gasPrice = jsonrpcClient->eth_gasPrice(); BOOST_CHECK_EQUAL(gasPrice, toJS(10 * dev::eth::szabo)); } @@ -90,11 +90,11 @@ BOOST_AUTO_TEST_CASE(jsonrpc_isListening) cnote << "Testing jsonrpc isListening..."; web3->startNetwork(); - bool listeningOn = jsonrpcClient->listening(); + bool listeningOn = jsonrpcClient->eth_listening(); BOOST_CHECK_EQUAL(listeningOn, web3->isNetworkStarted()); web3->stopNetwork(); - bool listeningOff = jsonrpcClient->listening(); + bool listeningOff = jsonrpcClient->eth_listening(); BOOST_CHECK_EQUAL(listeningOff, web3->isNetworkStarted()); } @@ -103,11 +103,11 @@ BOOST_AUTO_TEST_CASE(jsonrpc_isMining) cnote << "Testing jsonrpc isMining..."; web3->ethereum()->startMining(); - bool miningOn = jsonrpcClient->mining(); + bool miningOn = jsonrpcClient->eth_mining(); BOOST_CHECK_EQUAL(miningOn, web3->ethereum()->isMining()); web3->ethereum()->stopMining(); - bool miningOff = jsonrpcClient->mining(); + bool miningOff = jsonrpcClient->eth_mining(); BOOST_CHECK_EQUAL(miningOff, web3->ethereum()->isMining()); } @@ -116,7 +116,7 @@ BOOST_AUTO_TEST_CASE(jsonrpc_accounts) cnote << "Testing jsonrpc accounts..."; std::vector keys = {KeyPair::create(), KeyPair::create()}; jsonrpcServer->setAccounts(keys); - Json::Value k = jsonrpcClient->accounts(); + Json::Value k = jsonrpcClient->eth_accounts(); jsonrpcServer->setAccounts({}); BOOST_CHECK_EQUAL(k.isArray(), true); BOOST_CHECK_EQUAL(k.size(), keys.size()); @@ -133,10 +133,10 @@ BOOST_AUTO_TEST_CASE(jsonrpc_accounts) BOOST_AUTO_TEST_CASE(jsonrpc_number) { cnote << "Testing jsonrpc number2..."; - int number = jsonrpcClient->number(); + int number = jsonrpcClient->eth_number(); BOOST_CHECK_EQUAL(number, web3->ethereum()->number() + 1); dev::eth::mine(*(web3->ethereum()), 1); - int numberAfter = jsonrpcClient->number(); + int numberAfter = jsonrpcClient->eth_number(); BOOST_CHECK_EQUAL(number + 1, numberAfter); BOOST_CHECK_EQUAL(numberAfter, web3->ethereum()->number() + 1); } @@ -144,7 +144,7 @@ BOOST_AUTO_TEST_CASE(jsonrpc_number) BOOST_AUTO_TEST_CASE(jsonrpc_peerCount) { cnote << "Testing jsonrpc peerCount..."; - int peerCount = jsonrpcClient->peerCount(); + int peerCount = jsonrpcClient->eth_peerCount(); BOOST_CHECK_EQUAL(web3->peerCount(), peerCount); } @@ -152,10 +152,10 @@ BOOST_AUTO_TEST_CASE(jsonrpc_setListening) { cnote << "Testing jsonrpc setListening..."; - jsonrpcClient->setListening(true); + jsonrpcClient->eth_setListening(true); BOOST_CHECK_EQUAL(web3->isNetworkStarted(), true); - jsonrpcClient->setListening(false); + jsonrpcClient->eth_setListening(false); BOOST_CHECK_EQUAL(web3->isNetworkStarted(), false); } @@ -163,10 +163,10 @@ BOOST_AUTO_TEST_CASE(jsonrpc_setMining) { cnote << "Testing jsonrpc setMining..."; - jsonrpcClient->setMining(true); + jsonrpcClient->eth_setMining(true); BOOST_CHECK_EQUAL(web3->ethereum()->isMining(), true); - jsonrpcClient->setMining(false); + jsonrpcClient->eth_setMining(false); BOOST_CHECK_EQUAL(web3->ethereum()->isMining(), false); } @@ -175,14 +175,14 @@ BOOST_AUTO_TEST_CASE(jsonrpc_stateAt) cnote << "Testing jsonrpc stateAt..."; dev::KeyPair key = KeyPair::create(); auto address = key.address(); - string stateAt = jsonrpcClient->stateAt(toJS(address), "0"); + string stateAt = jsonrpcClient->eth_stateAt(toJS(address), "0"); BOOST_CHECK_EQUAL(toJS(web3->ethereum()->stateAt(address, jsToU256("0"), 0)), stateAt); } BOOST_AUTO_TEST_CASE(jsonrpc_transact) { cnote << "Testing jsonrpc transact..."; - string coinbase = jsonrpcClient->coinbase(); + string coinbase = jsonrpcClient->eth_coinbase(); BOOST_CHECK_EQUAL(jsToAddress(coinbase), web3->ethereum()->address()); dev::KeyPair key = KeyPair::create(); @@ -190,14 +190,14 @@ BOOST_AUTO_TEST_CASE(jsonrpc_transact) auto receiver = KeyPair::create(); web3->ethereum()->setAddress(address); - coinbase = jsonrpcClient->coinbase(); + coinbase = jsonrpcClient->eth_coinbase(); BOOST_CHECK_EQUAL(jsToAddress(coinbase), web3->ethereum()->address()); BOOST_CHECK_EQUAL(jsToAddress(coinbase), address); jsonrpcServer->setAccounts({key}); auto balance = web3->ethereum()->balanceAt(address, 0); - string balanceString = jsonrpcClient->balanceAt(toJS(address)); - double countAt = jsonrpcClient->countAt(toJS(address)); + string balanceString = jsonrpcClient->eth_balanceAt(toJS(address)); + double countAt = jsonrpcClient->eth_countAt(toJS(address)); BOOST_CHECK_EQUAL(countAt, (double)(uint64_t)web3->ethereum()->countAt(address)); BOOST_CHECK_EQUAL(countAt, 0); @@ -206,7 +206,7 @@ BOOST_AUTO_TEST_CASE(jsonrpc_transact) dev::eth::mine(*(web3->ethereum()), 1); balance = web3->ethereum()->balanceAt(address, 0); - balanceString = jsonrpcClient->balanceAt(toJS(address)); + balanceString = jsonrpcClient->eth_balanceAt(toJS(address)); BOOST_CHECK_EQUAL(toJS(balance), balanceString); BOOST_CHECK_EQUAL(jsToDecimal(balanceString), "1500000000000000000"); @@ -223,13 +223,13 @@ BOOST_AUTO_TEST_CASE(jsonrpc_transact) t["gas"] = toJS(gas); t["gasPrice"] = toJS(gasPrice); - jsonrpcClient->transact(t); + jsonrpcClient->eth_transact(t); jsonrpcServer->setAccounts({}); dev::eth::mine(*(web3->ethereum()), 1); - countAt = jsonrpcClient->countAt(toJS(address)); + countAt = jsonrpcClient->eth_countAt(toJS(address)); auto balance2 = web3->ethereum()->balanceAt(receiver.address()); - string balanceString2 = jsonrpcClient->balanceAt(toJS(receiver.address())); + string balanceString2 = jsonrpcClient->eth_balanceAt(toJS(receiver.address())); BOOST_CHECK_EQUAL(countAt, (double)(uint64_t)web3->ethereum()->countAt(address)); BOOST_CHECK_EQUAL(countAt, 1); diff --git a/test/webthreestubclient.h b/test/webthreestubclient.h index 6beee5bb6..179c620a7 100644 --- a/test/webthreestubclient.h +++ b/test/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,26 +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) + bool eth_listening() throw (jsonrpc::JsonRpcException) { Json::Value p; - p.append(param1); - - Json::Value result = this->client->CallMethod("haveIdentity",p); + p = Json::nullValue; + Json::Value result = this->client->CallMethod("eth_listening",p); if (result.isBool()) return result.asBool(); else @@ -251,23 +254,24 @@ p.append(param2); } - bool listening() throw (jsonrpc::JsonRpcException) + std::string eth_lll(const std::string& param1) throw (jsonrpc::JsonRpcException) { Json::Value p; - p = Json::nullValue; - Json::Value result = this->client->CallMethod("listening",p); - if (result.isBool()) - return result.asBool(); + 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 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 +279,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 +292,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 +305,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 +329,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 +355,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 +368,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 +381,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 +477,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 +491,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