Browse Source

Add API for getting address from secret.

cl-refactor
Gav Wood 11 years ago
parent
commit
3fd089d425
  1. 5
      libqethereum/QEthereum.cpp
  2. 2
      libqethereum/QEthereum.h

5
libqethereum/QEthereum.cpp

@ -208,6 +208,11 @@ QString padded(QString const& _s, unsigned _l, unsigned _r)
//"0xff".bin().unbin()
QString QEthereum::secretToAddress(QString _s) const
{
return toQJS(KeyPair(toSecret(_s)).address());
}
QString padded(QString const& _s, unsigned _l)
{
if (_s.startsWith("0x") || !_s.contains(QRegExp("[^0-9]")))

2
libqethereum/QEthereum.h

@ -366,6 +366,8 @@ public:
Q_INVOKABLE QString ethTest() const { return "Hello world!"; }
Q_INVOKABLE QEthereum* self() { return this; }
Q_INVOKABLE QString secretToAddress(QString _s) const;
Q_INVOKABLE QString pad(QString _s, unsigned _l) const { return padded(_s, _l); }
Q_INVOKABLE QString pad(QString _s, unsigned _l, unsigned _r) const { return padded(_s, _l, _r); }
Q_INVOKABLE QString unpad(QString _s) const { return unpadded(_s); }

Loading…
Cancel
Save