|
@ -40,7 +40,6 @@ static Json::Value toJson(dev::eth::BlockInfo const& _bi) |
|
|
{ |
|
|
{ |
|
|
Json::Value res; |
|
|
Json::Value res; |
|
|
res["hash"] = boost::lexical_cast<string>(_bi.hash); |
|
|
res["hash"] = boost::lexical_cast<string>(_bi.hash); |
|
|
|
|
|
|
|
|
res["parentHash"] = toJS(_bi.parentHash); |
|
|
res["parentHash"] = toJS(_bi.parentHash); |
|
|
res["sha3Uncles"] = toJS(_bi.sha3Uncles); |
|
|
res["sha3Uncles"] = toJS(_bi.sha3Uncles); |
|
|
res["miner"] = toJS(_bi.coinbaseAddress); |
|
|
res["miner"] = toJS(_bi.coinbaseAddress); |
|
@ -81,7 +80,6 @@ static Json::Value toJson(dev::eth::PastMessages const& _pms) |
|
|
Json::Value res; |
|
|
Json::Value res; |
|
|
for (dev::eth::PastMessage const& t: _pms) |
|
|
for (dev::eth::PastMessage const& t: _pms) |
|
|
res.append(toJson(t)); |
|
|
res.append(toJson(t)); |
|
|
|
|
|
|
|
|
return res; |
|
|
return res; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -143,7 +141,6 @@ static dev::eth::MessageFilter toMessageFilter(Json::Value const& _json) |
|
|
else |
|
|
else |
|
|
filter.altered(jsToAddress(_json["altered"].asString())); |
|
|
filter.altered(jsToAddress(_json["altered"].asString())); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return filter; |
|
|
return filter; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -163,7 +160,6 @@ static shh::Envelope toSealed(Json::Value const& _json, shh::Message const& _m, |
|
|
{ |
|
|
{ |
|
|
unsigned ttl = 50; |
|
|
unsigned ttl = 50; |
|
|
unsigned workToProve = 50; |
|
|
unsigned workToProve = 50; |
|
|
|
|
|
|
|
|
shh::BuildTopic bt; |
|
|
shh::BuildTopic bt; |
|
|
|
|
|
|
|
|
if (!_json["ttl"].empty()) |
|
|
if (!_json["ttl"].empty()) |
|
@ -209,13 +205,11 @@ static Json::Value toJson(h256 const& _h, shh::Envelope const& _e, shh::Message |
|
|
{ |
|
|
{ |
|
|
Json::Value res; |
|
|
Json::Value res; |
|
|
res["hash"] = toJS(_h); |
|
|
res["hash"] = toJS(_h); |
|
|
|
|
|
|
|
|
res["expiry"] = (int)_e.expiry(); |
|
|
res["expiry"] = (int)_e.expiry(); |
|
|
res["sent"] = (int)_e.sent(); |
|
|
res["sent"] = (int)_e.sent(); |
|
|
res["ttl"] = (int)_e.ttl(); |
|
|
res["ttl"] = (int)_e.ttl(); |
|
|
res["workProved"] = (int)_e.workProved(); |
|
|
res["workProved"] = (int)_e.workProved(); |
|
|
res["topic"] = toJS(_e.topic()); |
|
|
res["topic"] = toJS(_e.topic()); |
|
|
|
|
|
|
|
|
res["payload"] = asString(_m.payload()); |
|
|
res["payload"] = asString(_m.payload()); |
|
|
res["from"] = toJS(_m.from()); |
|
|
res["from"] = toJS(_m.from()); |
|
|
res["to"] = toJS(_m.to()); |
|
|
res["to"] = toJS(_m.to()); |
|
@ -228,7 +222,6 @@ WebThreeStubServer::WebThreeStubServer(jsonrpc::AbstractServerConnector* _conn, |
|
|
m_web3(_web3) |
|
|
m_web3(_web3) |
|
|
{ |
|
|
{ |
|
|
setAccounts(_accounts); |
|
|
setAccounts(_accounts); |
|
|
|
|
|
|
|
|
auto path = getDataDir() + "/.web3"; |
|
|
auto path = getDataDir() + "/.web3"; |
|
|
boost::filesystem::create_directories(path); |
|
|
boost::filesystem::create_directories(path); |
|
|
ldb::Options o; |
|
|
ldb::Options o; |
|
@ -248,7 +241,6 @@ void WebThreeStubServer::setIdentities(std::vector<dev::KeyPair> const& _ids) |
|
|
m_ids.clear(); |
|
|
m_ids.clear(); |
|
|
for (auto i: _ids) |
|
|
for (auto i: _ids) |
|
|
m_ids[i.pub()] = i.secret(); |
|
|
m_ids[i.pub()] = i.secret(); |
|
|
// emit ids changed?
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
dev::eth::Interface* WebThreeStubServer::client() const |
|
|
dev::eth::Interface* WebThreeStubServer::client() const |
|
@ -293,7 +285,6 @@ Json::Value WebThreeStubServer::blockByHash(std::string const& _hash) |
|
|
{ |
|
|
{ |
|
|
if (!client()) |
|
|
if (!client()) |
|
|
return ""; |
|
|
return ""; |
|
|
|
|
|
|
|
|
return toJson(client()->blockInfo(jsToFixed<32>(_hash))); |
|
|
return toJson(client()->blockInfo(jsToFixed<32>(_hash))); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -301,7 +292,6 @@ Json::Value WebThreeStubServer::blockByNumber(int const& _number) |
|
|
{ |
|
|
{ |
|
|
if (!client()) |
|
|
if (!client()) |
|
|
return ""; |
|
|
return ""; |
|
|
|
|
|
|
|
|
return toJson(client()->blockInfo(client()->hashFromNumber(_number))); |
|
|
return toJson(client()->blockInfo(client()->hashFromNumber(_number))); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -339,7 +329,6 @@ static TransactionSkeleton toTransaction(Json::Value const& _json) |
|
|
for (auto i: _json["dataclose"]) |
|
|
for (auto i: _json["dataclose"]) |
|
|
dev::operator +=(ret.data, jsToBytes(i.asString())); |
|
|
dev::operator +=(ret.data, jsToBytes(i.asString())); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return ret; |
|
|
return ret; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -636,7 +625,6 @@ Json::Value WebThreeStubServer::transactionByHash(std::string const& _hash, int |
|
|
{ |
|
|
{ |
|
|
if (!client()) |
|
|
if (!client()) |
|
|
return ""; |
|
|
return ""; |
|
|
|
|
|
|
|
|
return toJson(client()->transaction(jsToFixed<32>(_hash), _i)); |
|
|
return toJson(client()->transaction(jsToFixed<32>(_hash), _i)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -644,7 +632,6 @@ Json::Value WebThreeStubServer::transactionByNumber(int const& _number, int cons |
|
|
{ |
|
|
{ |
|
|
if (!client()) |
|
|
if (!client()) |
|
|
return ""; |
|
|
return ""; |
|
|
|
|
|
|
|
|
return toJson(client()->transaction(client()->hashFromNumber(_number), _i)); |
|
|
return toJson(client()->transaction(client()->hashFromNumber(_number), _i)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -652,7 +639,6 @@ Json::Value WebThreeStubServer::uncleByHash(std::string const& _hash, int const& |
|
|
{ |
|
|
{ |
|
|
if (!client()) |
|
|
if (!client()) |
|
|
return ""; |
|
|
return ""; |
|
|
|
|
|
|
|
|
return toJson(client()->uncle(jsToFixed<32>(_hash), _i)); |
|
|
return toJson(client()->uncle(jsToFixed<32>(_hash), _i)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -660,7 +646,6 @@ Json::Value WebThreeStubServer::uncleByNumber(int const& _number, int const& _i) |
|
|
{ |
|
|
{ |
|
|
if (!client()) |
|
|
if (!client()) |
|
|
return ""; |
|
|
return ""; |
|
|
|
|
|
|
|
|
return toJson(client()->uncle(client()->hashFromNumber(_number), _i)); |
|
|
return toJson(client()->uncle(client()->hashFromNumber(_number), _i)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|