void EtherIPC::handleUnlockAccount() { QJsonValue jv; if ( !readReply(jv) ) { return bail(); } const bool result = jv.toBool(false); if ( !result ) { setError("Unlock account failure"); if ( parseVersionNum() == 100002 ) { fError += " Geth v1.0.2 has a bug with unlocking empty password accounts! Consider updating"; } emit error(); } emit unlockAccountDone(result, fActiveRequest.getIndex()); done(); }
void EtherIPC::handleGetAccounts() { QJsonValue jv; if ( !readReply(jv) ) { return bail(); } QJsonArray refs = jv.toArray(); foreach( QJsonValue r, refs ) { const QString hash = r.toString("INVALID"); fAccountList.append(AccountInfo(hash, QString(), 0)); } emit getAccountsDone(fAccountList); // TODO: figure out a way to get account transaction history newFilter(); done(); }
void EtherIPC::handleGetFilterChanges() { QJsonValue jv; if ( !readReply(jv) ) { return bail(); } QJsonArray ar = jv.toArray(); foreach( const QJsonValue v, ar ) { if ( v.isObject() ) { // event filter result const QJsonObject logs = v.toObject(); emit newEvent(logs, fActiveRequest.getType() == GetFilterChanges); // get logs is not "new" } else { // block filter (we don't use transaction filters yet) const QString hash = v.toString("bogus"); getBlockByHash(hash); } } done(); }
void EtherIPC::handleGetClientVersion() { QJsonValue jv; if ( !readReply(jv) ) { return bail(); } fClientVersion = jv.toString(); const int vn = parseVersionNum(); if ( vn > 0 && vn < 100002 ) { setError("Geth version 1.0.1 and older contain a critical bug! Please update immediately."); emit error(); } if ( vn > 0 && vn < 103005 ) { setError("Geth version 1.3.4 and older are Frontier versions. Please update to Homestead (1.3.5+)"); emit error(); } emit clientVersionChanged(fClientVersion); done(); }