Exemple #1
0
Json::Value toJson(dev::eth::TransactionReceipt const& _tr, std::pair<h256, unsigned> _location, BlockNumber _blockNumber, Transaction const& _t)
{
    Json::Value res;
    h256 h = _t.sha3();
    res["transactionHash"] = toJS(h);
    res["transactionIndex"] = _location.second;
    res["blockHash"] = toJS(_location.first);
    res["blockNumber"] = _blockNumber;
    res["cumulativeGasUsed"] = toJS(_tr.gasUsed()); // TODO: check if this is fine
    res["gasUsed"] = toJS(_tr.gasUsed());
    res["contractAddress"] = toJS(toAddress(_t.from(), _t.nonce()));
    res["logs"] = Json::Value(Json::arrayValue);
    for (unsigned i = 0; i < _tr.log().size(); i++)
    {
        LogEntry e = _tr.log()[i];
        Json::Value l = toJson(e);
        l["type"] = "mined";
        l["blockNumber"] = _blockNumber;
        l["blockHash"] = toJS(_location.first);
        l["logIndex"] = i;
        l["transactionHash"] = toJS(h);
        l["transactionIndex"] = _location.second;
        res["logs"].append(l);
    }
    return res;
}
Exemple #2
0
Json::Value toJson(dev::eth::TransactionReceipt const& _t)
{
    Json::Value res;
    res["stateRoot"] = toJS(_t.stateRoot());
    res["gasUsed"] = toJS(_t.gasUsed());
    res["bloom"] = toJS(_t.bloom());
    res["log"] = dev::toJson(_t.log());
    return res;
}
Exemple #3
0
Json::Value toJson(dev::eth::TransactionReceipt const& _t)
{
    Json::Value res;
    if (_t.hasStatusCode())
        res["status"] = toString(_t.statusCode());
    else
        res["stateRoot"] = toJS(_t.stateRoot());
    res["gasUsed"] = toJS(_t.cumulativeGasUsed());
    res["bloom"] = toJS(_t.bloom());
    res["log"] = dev::toJson(_t.log());
    return res;
}