aboutsummaryrefslogtreecommitdiffstats
path: root/test/RPCSession.cpp
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-02-10 02:41:51 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-02-10 21:24:56 +0800
commit702ee20a0179afe607383554ee89b0f863e14f63 (patch)
tree8c17629066ed981e04fd0027bc769dbd95bf7da3 /test/RPCSession.cpp
parent4cf44f1b41fe021653a6f45c72c19253dd352459 (diff)
downloaddexon-solidity-702ee20a0179afe607383554ee89b0f863e14f63.tar
dexon-solidity-702ee20a0179afe607383554ee89b0f863e14f63.tar.gz
dexon-solidity-702ee20a0179afe607383554ee89b0f863e14f63.tar.bz2
dexon-solidity-702ee20a0179afe607383554ee89b0f863e14f63.tar.lz
dexon-solidity-702ee20a0179afe607383554ee89b0f863e14f63.tar.xz
dexon-solidity-702ee20a0179afe607383554ee89b0f863e14f63.tar.zst
dexon-solidity-702ee20a0179afe607383554ee89b0f863e14f63.zip
Create getBlockByNumber RPC method
Diffstat (limited to 'test/RPCSession.cpp')
-rw-r--r--test/RPCSession.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/test/RPCSession.cpp b/test/RPCSession.cpp
index a58355d0..c27e73d4 100644
--- a/test/RPCSession.cpp
+++ b/test/RPCSession.cpp
@@ -131,6 +131,12 @@ string RPCSession::eth_getCode(string const& _address, string const& _blockNumbe
return rpcCall("eth_getCode", { quote(_address), quote(_blockNumber) }).asString();
}
+Json::Value RPCSession::eth_getBlockByNumber(string const& _blockNumber, bool _fullObjects)
+{
+ // NOTE: to_string() converts bool to 0 or 1
+ return rpcCall("eth_getBlockByNumber", { quote(_blockNumber), _fullObjects ? "true" : "false" });
+}
+
RPCSession::TransactionReceipt RPCSession::eth_getTransactionReceipt(string const& _transactionHash)
{
TransactionReceipt receipt;
@@ -290,9 +296,9 @@ Json::Value RPCSession::rpcCall(string const& _methodName, vector<string> const&
request += "],\"id\":" + to_string(m_rpcSequence) + "}";
++m_rpcSequence;
- //cout << "Request: " << request << endl;
+ // cout << "Request: " << request << endl;
string reply = m_ipcSocket.sendRequest(request);
- //cout << "Reply: " << reply << endl;
+ // cout << "Reply: " << reply << endl;
Json::Value result;
BOOST_REQUIRE(Json::Reader().parse(reply, result, false));