diff --git a/alethzero/MainWin.cpp b/alethzero/MainWin.cpp index 8d24dc36c..2a0a056a5 100644 --- a/alethzero/MainWin.cpp +++ b/alethzero/MainWin.cpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/alethzero/OurWebThreeStubServer.h b/alethzero/OurWebThreeStubServer.h index 5223d79bd..16981f9e1 100644 --- a/alethzero/OurWebThreeStubServer.h +++ b/alethzero/OurWebThreeStubServer.h @@ -20,7 +20,7 @@ */ #include -#include +#include #include #include @@ -35,7 +35,7 @@ public: std::vector const& _accounts, Main* main); virtual std::string shh_newIdentity() override; - virtual bool authenticate(dev::TransactionSkeleton const& _t); + virtual bool authenticate(dev::eth::TransactionSkeleton const& _t); signals: void onNewId(QString _s); diff --git a/libdevcore/CommonJS.cpp b/libethcore/CommonJS.cpp similarity index 99% rename from libdevcore/CommonJS.cpp rename to libethcore/CommonJS.cpp index 980cb9081..3ed4e2796 100644 --- a/libdevcore/CommonJS.cpp +++ b/libethcore/CommonJS.cpp @@ -72,6 +72,31 @@ bytes unpadLeft(bytes _b) return _b; } +std::string fromRaw(h256 _n, unsigned* _inc) +{ + if (_n) + { + std::string s((char const*)_n.data(), 32); + auto l = s.find_first_of('\0'); + if (!l) + return ""; + if (l != std::string::npos) + { + auto p = s.find_first_not_of('\0', l); + if (!(p == std::string::npos || (_inc && p == 31))) + return ""; + if (_inc) + *_inc = (byte)s[31]; + s.resize(l); + } + for (auto i: s) + if (i < 32) + return ""; + return s; + } + return ""; +} + std::string prettyU256(u256 _n) { unsigned inc = 0; @@ -98,31 +123,6 @@ std::string prettyU256(u256 _n) return s.str(); } -std::string fromRaw(h256 _n, unsigned* _inc) -{ - if (_n) - { - std::string s((char const*)_n.data(), 32); - auto l = s.find_first_of('\0'); - if (!l) - return ""; - if (l != std::string::npos) - { - auto p = s.find_first_not_of('\0', l); - if (!(p == std::string::npos || (_inc && p == 31))) - return ""; - if (_inc) - *_inc = (byte)s[31]; - s.resize(l); - } - for (auto i: s) - if (i < 32) - return ""; - return s; - } - return ""; -} - Address fromString(std::string const& _sn) { if (_sn.size() == 40) @@ -132,3 +132,4 @@ Address fromString(std::string const& _sn) } } + diff --git a/libdevcore/CommonJS.h b/libethcore/CommonJS.h similarity index 94% rename from libdevcore/CommonJS.h rename to libethcore/CommonJS.h index 59e6c1d34..ccc3b3103 100644 --- a/libdevcore/CommonJS.h +++ b/libethcore/CommonJS.h @@ -24,9 +24,11 @@ #pragma once #include -#include -#include "Common.h" -#include "CommonData.h" +#include +#include +#include +#include +#include "CommonEth.h" namespace dev { @@ -94,16 +96,8 @@ template boost::multiprecision::number(_s); } -inline Public jsToPublic(std::string const& _s) { return jsToFixed(_s); } -inline Secret jsToSecret(std::string const& _s) { return jsToFixed(_s); } inline u256 jsToU256(std::string const& _s) { return jsToInt<32>(_s); } -inline std::string jsToBinary(std::string const& _s) -{ - return dev::toString(unpadded(jsToBytes(_s))); -} - inline std::string jsToDecimal(std::string const& _s) { return dev::toString(jsToU256(_s)); @@ -125,6 +119,29 @@ inline double jsFromFixed(std::string const& _s) return (double)jsToU256(_s) / (double)(dev::u256(1) << 128); } +} + +// devcrypto + +#include + +namespace dev +{ + +inline Public jsToPublic(std::string const& _s) { return jsToFixed(_s); } +inline Secret jsToSecret(std::string const& _s) { return jsToFixed(_s); } + +} + + +// ethcore +namespace dev +{ +namespace eth +{ + +inline Address jsToAddress(std::string const& _s) { return jsToFixed(_s); } + struct TransactionSkeleton { Address from; @@ -136,3 +153,4 @@ struct TransactionSkeleton }; } +} diff --git a/libweb3jsonrpc/WebThreeStubServerBase.cpp b/libweb3jsonrpc/WebThreeStubServerBase.cpp index 26a3382c8..bcaa31036 100644 --- a/libweb3jsonrpc/WebThreeStubServerBase.cpp +++ b/libweb3jsonrpc/WebThreeStubServerBase.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/libweb3jsonrpc/WebThreeStubServerBase.h b/libweb3jsonrpc/WebThreeStubServerBase.h index ee583efa3..ffb9e1738 100644 --- a/libweb3jsonrpc/WebThreeStubServerBase.h +++ b/libweb3jsonrpc/WebThreeStubServerBase.h @@ -36,9 +36,9 @@ namespace dev { class WebThreeNetworkFace; class KeyPair; -struct TransactionSkeleton; namespace eth { +struct TransactionSkeleton; class Interface; } namespace shh @@ -122,7 +122,7 @@ public: std::map const& ids() const { return m_ids; } protected: - virtual bool authenticate(dev::TransactionSkeleton const& _t); + virtual bool authenticate(dev::eth::TransactionSkeleton const& _t); protected: virtual dev::eth::Interface* client() = 0; diff --git a/mix/ClientModel.cpp b/mix/ClientModel.cpp index 91e6bdd83..3a2b50999 100644 --- a/mix/ClientModel.cpp +++ b/mix/ClientModel.cpp @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include "AppContext.h" #include "DebuggingStateWrapper.h" diff --git a/mix/ContractCallDataEncoder.cpp b/mix/ContractCallDataEncoder.cpp index bdec95ca4..29b43bc11 100644 --- a/mix/ContractCallDataEncoder.cpp +++ b/mix/ContractCallDataEncoder.cpp @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include "QVariableDeclaration.h" #include "QVariableDefinition.h" diff --git a/mix/DebuggingStateWrapper.cpp b/mix/DebuggingStateWrapper.cpp index 42d0c97ac..d32be4989 100644 --- a/mix/DebuggingStateWrapper.cpp +++ b/mix/DebuggingStateWrapper.cpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/mix/QBigInt.cpp b/mix/QBigInt.cpp index 191d20459..21d32a9c3 100644 --- a/mix/QBigInt.cpp +++ b/mix/QBigInt.cpp @@ -21,7 +21,7 @@ #include #include -#include +#include #include "QBigInt.h" using namespace dev; diff --git a/mix/QBigInt.h b/mix/QBigInt.h index c6ec72305..0712ff984 100644 --- a/mix/QBigInt.h +++ b/mix/QBigInt.h @@ -26,7 +26,7 @@ #include "boost/variant/multivisitors.hpp" #include #include -#include +#include #include using namespace dev; diff --git a/mix/QVariableDefinition.cpp b/mix/QVariableDefinition.cpp index a76388d68..c78273f99 100644 --- a/mix/QVariableDefinition.cpp +++ b/mix/QVariableDefinition.cpp @@ -20,7 +20,7 @@ */ #include -#include +#include #include "QVariableDefinition.h" using namespace dev::mix; diff --git a/test/commonjs.cpp b/test/commonjs.cpp index 860b713dd..041a14f68 100644 --- a/test/commonjs.cpp +++ b/test/commonjs.cpp @@ -20,7 +20,8 @@ */ #include -#include +#include +#include BOOST_AUTO_TEST_SUITE(commonjs) using namespace std; @@ -41,7 +42,7 @@ BOOST_AUTO_TEST_CASE(jsToAddress) cnote << "Testing jsToPublic..."; KeyPair kp = KeyPair::create(); string string = toJS(kp.address()); - Address address = dev::jsToAddress(string); + Address address = dev::eth::jsToAddress(string); BOOST_CHECK_EQUAL(kp.address(), address); } diff --git a/test/jsonrpc.cpp b/test/jsonrpc.cpp index 1f0a466b2..eaa9edc45 100644 --- a/test/jsonrpc.cpp +++ b/test/jsonrpc.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include #include