|
@ -97,6 +97,24 @@ static Json::Value toJson(dev::eth::Transaction const& _t) |
|
|
return res; |
|
|
return res; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static Json::Value toJson(dev::eth::LogEntry const& _e) |
|
|
|
|
|
{ |
|
|
|
|
|
Json::Value res; |
|
|
|
|
|
res["data"] = jsFromBinary(_e.data); |
|
|
|
|
|
res["address"] = toJS(_e.address); |
|
|
|
|
|
for (auto const& t: _e.topics) |
|
|
|
|
|
res["topics"].append(toJS(t)); |
|
|
|
|
|
return res; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static Json::Value toJson(dev::eth::LogEntries const& _es) |
|
|
|
|
|
{ |
|
|
|
|
|
Json::Value res; |
|
|
|
|
|
for (dev::eth::LogEntry const& e: _es) |
|
|
|
|
|
res.append(toJson(e)); |
|
|
|
|
|
return res; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
static dev::eth::MessageFilter toMessageFilter(Json::Value const& _json) |
|
|
static dev::eth::MessageFilter toMessageFilter(Json::Value const& _json) |
|
|
{ |
|
|
{ |
|
|
dev::eth::MessageFilter filter; |
|
|
dev::eth::MessageFilter filter; |
|
@ -123,9 +141,9 @@ static dev::eth::MessageFilter toMessageFilter(Json::Value const& _json) |
|
|
{ |
|
|
{ |
|
|
if (_json["to"].isArray()) |
|
|
if (_json["to"].isArray()) |
|
|
for (auto i : _json["to"]) |
|
|
for (auto i : _json["to"]) |
|
|
filter.from(jsToAddress(i.asString())); |
|
|
filter.to(jsToAddress(i.asString())); |
|
|
else |
|
|
else |
|
|
filter.from(jsToAddress(_json["to"].asString())); |
|
|
filter.to(jsToAddress(_json["to"].asString())); |
|
|
} |
|
|
} |
|
|
if (!_json["altered"].empty()) |
|
|
if (!_json["altered"].empty()) |
|
|
{ |
|
|
{ |
|
@ -143,6 +161,48 @@ static dev::eth::MessageFilter toMessageFilter(Json::Value const& _json) |
|
|
return filter; |
|
|
return filter; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static dev::eth::LogFilter toLogFilter(Json::Value const& _json) |
|
|
|
|
|
{ |
|
|
|
|
|
dev::eth::LogFilter filter; |
|
|
|
|
|
if (!_json.isObject() || _json.empty()) |
|
|
|
|
|
return filter; |
|
|
|
|
|
|
|
|
|
|
|
if (!_json["earliest"].empty()) |
|
|
|
|
|
filter.withEarliest(_json["earliest"].asInt()); |
|
|
|
|
|
if (!_json["latest"].empty()) |
|
|
|
|
|
filter.withLatest(_json["lastest"].asInt()); |
|
|
|
|
|
if (!_json["max"].empty()) |
|
|
|
|
|
filter.withMax(_json["max"].asInt()); |
|
|
|
|
|
if (!_json["skip"].empty()) |
|
|
|
|
|
filter.withSkip(_json["skip"].asInt()); |
|
|
|
|
|
if (!_json["from"].empty()) |
|
|
|
|
|
{ |
|
|
|
|
|
if (_json["from"].isArray()) |
|
|
|
|
|
for (auto i : _json["from"]) |
|
|
|
|
|
filter.from(jsToAddress(i.asString())); |
|
|
|
|
|
else |
|
|
|
|
|
filter.from(jsToAddress(_json["from"].asString())); |
|
|
|
|
|
} |
|
|
|
|
|
if (!_json["address"].empty()) |
|
|
|
|
|
{ |
|
|
|
|
|
if (_json["address"].isArray()) |
|
|
|
|
|
for (auto i : _json["address"]) |
|
|
|
|
|
filter.address(jsToAddress(i.asString())); |
|
|
|
|
|
else |
|
|
|
|
|
filter.from(jsToAddress(_json["address"].asString())); |
|
|
|
|
|
} |
|
|
|
|
|
if (!_json["topics"].empty()) |
|
|
|
|
|
{ |
|
|
|
|
|
if (_json["topics"].isArray()) |
|
|
|
|
|
for (auto i: _json["topics"]) |
|
|
|
|
|
if (i.isString()) |
|
|
|
|
|
filter.topic(jsToU256(i.asString())); |
|
|
|
|
|
else if(_json["topics"].isString()) |
|
|
|
|
|
filter.topic(jsToU256(_json["topics"].asString())); |
|
|
|
|
|
} |
|
|
|
|
|
return filter; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
static shh::Message toMessage(Json::Value const& _json) |
|
|
static shh::Message toMessage(Json::Value const& _json) |
|
|
{ |
|
|
{ |
|
|
shh::Message ret; |
|
|
shh::Message ret; |
|
@ -252,13 +312,6 @@ std::shared_ptr<dev::shh::Interface> WebThreeStubServer::face() const |
|
|
return m_web3.whisper(); |
|
|
return m_web3.whisper(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
std::string WebThreeStubServer::account() |
|
|
|
|
|
{ |
|
|
|
|
|
if (!m_accounts.empty()) |
|
|
|
|
|
return toJS(m_accounts.begin()->first); |
|
|
|
|
|
return ""; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Json::Value WebThreeStubServer::accounts() |
|
|
Json::Value WebThreeStubServer::accounts() |
|
|
{ |
|
|
{ |
|
|
Json::Value ret(Json::arrayValue); |
|
|
Json::Value ret(Json::arrayValue); |
|
|