From fafd0aed91fa585578143a43d156c68162d2f984 Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Fri, 31 Oct 2014 14:52:21 +0100 Subject: [PATCH] common fixes --- alethzero/MainWin.cpp | 4 +- libjsqrc/main.js | 22 ++++++++ libjsqrc/qt.js | 22 ++++++++ libweb3jsonrpc/WebThreeStubServer.cpp | 6 +-- libweb3jsonrpc/spec.json | 73 +++++++++++++-------------- 5 files changed, 84 insertions(+), 43 deletions(-) diff --git a/alethzero/MainWin.cpp b/alethzero/MainWin.cpp index 5f9d9786b..8756498fd 100644 --- a/alethzero/MainWin.cpp +++ b/alethzero/MainWin.cpp @@ -88,14 +88,14 @@ static QString fromRaw(dev::h256 _n, unsigned* _inc = nullptr) static std::vector keysAsVector(QList const& keys) { auto list = keys.toStdList(); - return {std::begin(list), std::end(list)}; + return {begin(list), end(list)}; } static QString contentsOfQResource(std::string const& res) { QFile file(QString::fromStdString(res)); if (!file.open(QFile::ReadOnly)) - return ""; + BOOST_THROW_EXCEPTION(FileError()); QTextStream in(&file); return in.readAll(); } diff --git a/libjsqrc/main.js b/libjsqrc/main.js index 1f609220b..3e0a62c40 100644 --- a/libjsqrc/main.js +++ b/libjsqrc/main.js @@ -1,3 +1,25 @@ +/* + This file is part of ethereum.js. + + ethereum.js is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + ethereum.js is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with ethereum.js. If not, see . +*/ +/** @file ethereum.js + * @authors: + * Marek Kotewicz + * @date 2014 + */ + (function(window) { function isPromise(o) { return o instanceof Promise diff --git a/libjsqrc/qt.js b/libjsqrc/qt.js index 644c37737..f0312eb2f 100644 --- a/libjsqrc/qt.js +++ b/libjsqrc/qt.js @@ -1,3 +1,25 @@ +/* + This file is part of ethereum.js. + + ethereum.js is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + ethereum.js is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with ethereum.js. If not, see . +*/ +/** @file ethereum.js + * @authors: + * Marek Kotewicz + * @date 2014 + */ + (function() { var QtProvider = function() { this.handlers = []; diff --git a/libweb3jsonrpc/WebThreeStubServer.cpp b/libweb3jsonrpc/WebThreeStubServer.cpp index e81e5c8b8..e7eb62e04 100644 --- a/libweb3jsonrpc/WebThreeStubServer.cpp +++ b/libweb3jsonrpc/WebThreeStubServer.cpp @@ -100,9 +100,8 @@ static Json::Value toJson(dev::eth::Transaction const& _t) static dev::eth::MessageFilter toMessageFilter(Json::Value const& _json) { dev::eth::MessageFilter filter; - if (!_json.isObject() || _json.empty()){ + if (!_json.isObject() || _json.empty()) return filter; - } if (!_json["earliest"].empty()) filter.withEarliest(_json["earliest"].asInt()); @@ -298,9 +297,8 @@ Json::Value WebThreeStubServer::blockByNumber(int const& _number) static TransactionSkeleton toTransaction(Json::Value const& _json) { TransactionSkeleton ret; - if (!_json.isObject() || _json.empty()){ + if (!_json.isObject() || _json.empty()) return ret; - } if (!_json["from"].empty()) ret.from = jsToAddress(_json["from"].asString()); diff --git a/libweb3jsonrpc/spec.json b/libweb3jsonrpc/spec.json index 7b8e27bec..1e7065970 100644 --- a/libweb3jsonrpc/spec.json +++ b/libweb3jsonrpc/spec.json @@ -1,40 +1,40 @@ [ - { "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": "account", "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": "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": "account", "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": "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": ""}, @@ -46,11 +46,10 @@ { "method": "haveIdentity", "params": [""], "order": [], "returns": false}, { "method": "newGroup", "params": ["", ""], "order": [], "returns": ""}, { "method": "addToGroup", "params": ["", ""], "order": [], "returns": ""}, - + { "method": "shhNewFilter", "params": [{}], "order": [], "returns": 0}, - { "method": "shhUninstallFilter", "params": [0], "order": [], "returns": true}, - { "method": "shhChanged", "params": [0], "order": [], "returns": []} + { "method": "shhUninstallFilter", "params": [0], "order": [], "returns": true}, + { "method": "shhChanged", "params": [0], "order": [], "returns": []} ] -