Browse Source

value in messages

cl-refactor
Marek Kotewicz 10 years ago
parent
commit
83f286ab45
  1. 1
      libethrpc/EthStubServer.cpp
  2. 17
      test/jsonrpc.cpp

1
libethrpc/EthStubServer.cpp

@ -58,6 +58,7 @@ static Json::Value toJson(const dev::eth::PastMessage& t)
res["output"] = jsFromBinary(t.output);
res["to"] = toJS(t.to);
res["from"] = toJS(t.from);
res["value"] = jsToDecimal(toJS(t.value));
res["origin"] = toJS(t.origin);
res["timestamp"] = toJS(t.timestamp);
res["coinbase"] = toJS(t.coinbase);

17
test/jsonrpc.cpp

@ -3,6 +3,7 @@
#if ETH_JSONRPC && 1
#include <boost/test/unit_test.hpp>
#include <boost/lexical_cast.hpp>
#include <libdevcore/Log.h>
#include <libdevcore/CommonIO.h>
#include <libdevcore/CommonJS.h>
@ -276,7 +277,7 @@ BOOST_AUTO_TEST_CASE(jsonrpc_transact)
Json::Value t;
t["from"] = toJS(key.secret());
t["value"] = toJS(txAmount);
t["value"] = jsToDecimal(toJS(txAmount));
t["to"] = toJS(receiver.address());
t["data"] = toJS(bytes());
t["gas"] = toJS(gas);
@ -286,19 +287,19 @@ BOOST_AUTO_TEST_CASE(jsonrpc_transact)
dev::eth::mine(*(web3.ethereum()), 1);
auto balance2 = web3.ethereum()->balanceAt(receiver.address());
auto number = web3.ethereum()->number();
auto messages = jsonrpcClient->messages(Json::Value());
BOOST_REQUIRE(balance2 > 0);
BOOST_CHECK_EQUAL(txAmount, balance2);
// auto ax = jsToFixed(number);
// Json::Value p = jsonrpcClient->transaction(0, jsToFixed(number));
// TODO, check transactions
BOOST_CHECK_EQUAL(txAmount, jsToU256(messages[0u]["value"].asString()));
}
BOOST_AUTO_TEST_CASE(jsonrpc_transaction)
{
// TODO! not working?
// auto messages = jsonrpcClient->messages(Json::Value());
// auto transactionNumber = messages[0u]["path"][0u].asInt();
// auto transactionBlock = messages[0u]["block"].asString();
// Json::Value p = jsonrpcClient->transaction(transactionNumber, transactionBlock);
}
BOOST_AUTO_TEST_CASE(jsonrpc_uncle)

Loading…
Cancel
Save