Browse Source

Protocol changes for PoC-5 plus JS APIs.

cl-refactor
Gav Wood 11 years ago
parent
commit
f36c16b8a9
  1. 2
      libethereum/CommonEth.cpp
  2. 3
      libethereum/CommonEth.h
  3. 2
      libethereum/PeerServer.cpp
  4. 1
      libqethereum/QEthereum.cpp
  5. 7
      libqethereum/QEthereum.h

2
libethereum/CommonEth.cpp

@ -28,6 +28,8 @@ using namespace eth;
//#define ETH_ADDRESS_DEBUG 1
const unsigned eth::c_protocolVersion = 14;
static const vector<pair<u256, string>> g_units =
{
{((((u256(1000000000) * 1000000000) * 1000000000) * 1000000000) * 1000000000) * 1000000000, "Uether"},

3
libethereum/CommonEth.h

@ -29,6 +29,9 @@
namespace eth
{
/// Current protocol version.
extern const unsigned c_protocolVersion;
/// A secret key: 32 bytes.
/// @NOTE This is not endian-specific; it's just a bunch of bytes.
using Secret = h256;

2
libethereum/PeerServer.cpp

@ -115,7 +115,7 @@ PeerServer::~PeerServer()
unsigned PeerServer::protocolVersion()
{
return 13;
return c_protocolVersion;
}
void PeerServer::determinePublic(string const& _publicAddress, bool _upnp)

1
libqethereum/QEthereum.cpp

@ -255,6 +255,7 @@ void QEthereum::setup(QWebFrame* _e)
_e->evaluateJavaScript("String.prototype.bin = function() { return eth.toBinary(this) }");
_e->evaluateJavaScript("String.prototype.unbin = function(l) { return eth.fromBinary(this) }");
_e->evaluateJavaScript("String.prototype.unpad = function(l) { return eth.unpad(this) }");
_e->evaluateJavaScript("String.prototype.dec = function() { return eth.toDecimal(this) }");
}
void QEthereum::teardown(QWebFrame*)

7
libqethereum/QEthereum.h

@ -304,6 +304,7 @@ inline QString asQString(eth::bytes const& _s)
}
eth::bytes toBytes(QString const& _s);
QString padded(QString const& _s, unsigned _l, unsigned _r);
QString padded(QString const& _s, unsigned _l);
QString unpadded(QString _s);
@ -345,6 +346,11 @@ inline QString toBinary(QString const& _s)
return asQString(toBytes(_s));
}
inline QString toDecimal(QString const& _s)
{
return QString::fromStdString(eth::toString(toU256(_s)));
}
inline QString fromBinary(QString const& _s)
{
return QString::fromStdString("0x" + eth::toHex(asBytes(_s)));
@ -373,6 +379,7 @@ public:
Q_INVOKABLE QString unpad(QString _s) const { return unpadded(_s); }
Q_INVOKABLE QString toBinary(QString _s) const { return ::toBinary(_s); }
Q_INVOKABLE QString fromBinary(QString _s) const { return ::fromBinary(_s); }
Q_INVOKABLE QString toDecimal(QString _s) const { return ::toDecimal(_s); }
Q_INVOKABLE QString/*eth::u256*/ balanceAt(QString/*eth::Address*/ _a) const;
Q_INVOKABLE QString/*eth::u256*/ storageAt(QString/*eth::Address*/ _a, QString/*eth::u256*/ _p) const;

Loading…
Cancel
Save