mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
common changes to unify apis
This commit is contained in:
parent
46149f7249
commit
9cbed56278
@ -33,10 +33,10 @@ p["block"] = block;
|
||||
|
||||
}
|
||||
|
||||
Json::Value block(const std::string& numberOrHash) throw (jsonrpc::JsonRpcException)
|
||||
Json::Value block(const Json::Value& params) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p["numberOrHash"] = numberOrHash;
|
||||
p["params"] = params;
|
||||
|
||||
Json::Value result = this->client->CallMethod("block",p);
|
||||
if (result.isObject())
|
||||
@ -199,10 +199,10 @@ p["s"] = s;
|
||||
|
||||
}
|
||||
|
||||
Json::Value messages(const Json::Value& json) throw (jsonrpc::JsonRpcException)
|
||||
Json::Value messages(const Json::Value& params) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p["json"] = json;
|
||||
p["params"] = params;
|
||||
|
||||
Json::Value result = this->client->CallMethod("messages",p);
|
||||
if (result.isArray())
|
||||
@ -380,11 +380,11 @@ p["storage"] = storage;
|
||||
|
||||
}
|
||||
|
||||
Json::Value transaction(const int& i, const std::string& numberOrHash) throw (jsonrpc::JsonRpcException)
|
||||
Json::Value transaction(const int& i, const Json::Value& params) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p["i"] = i;
|
||||
p["numberOrHash"] = numberOrHash;
|
||||
p["params"] = params;
|
||||
|
||||
Json::Value result = this->client->CallMethod("transaction",p);
|
||||
if (result.isObject())
|
||||
@ -394,11 +394,11 @@ p["numberOrHash"] = numberOrHash;
|
||||
|
||||
}
|
||||
|
||||
Json::Value uncle(const int& i, const std::string& numberOrHash) throw (jsonrpc::JsonRpcException)
|
||||
Json::Value uncle(const int& i, const Json::Value& params) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p["i"] = i;
|
||||
p["numberOrHash"] = numberOrHash;
|
||||
p["params"] = params;
|
||||
|
||||
Json::Value result = this->client->CallMethod("uncle",p);
|
||||
if (result.isObject())
|
||||
@ -408,10 +408,10 @@ p["numberOrHash"] = numberOrHash;
|
||||
|
||||
}
|
||||
|
||||
std::string watch(const std::string& json) throw (jsonrpc::JsonRpcException)
|
||||
std::string watch(const std::string& params) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p["json"] = json;
|
||||
p["params"] = params;
|
||||
|
||||
Json::Value result = this->client->CallMethod("watch",p);
|
||||
if (result.isString())
|
||||
|
31
jsonrpc.cpp
31
jsonrpc.cpp
@ -58,11 +58,7 @@ BOOST_AUTO_TEST_CASE(jsonrpc_balanceAt)
|
||||
dev::KeyPair key = KeyPair::create();
|
||||
auto address = key.address();
|
||||
string balance = jsonrpcClient->balanceAt(toJS(address), 0);
|
||||
BOOST_CHECK_EQUAL(jsToDecimal(toJS(web3.ethereum()->balanceAt(address))), balance);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(jsonrpc_block)
|
||||
{
|
||||
BOOST_CHECK_EQUAL(toJS(web3.ethereum()->balanceAt(address)), balance);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(jsonrpc_call)
|
||||
@ -162,17 +158,23 @@ BOOST_AUTO_TEST_CASE(jsonrpc_keys)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(jsonrpc_lll)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(jsonrpc_messages)
|
||||
{
|
||||
cnote << "Testing jsonrpc messages...";
|
||||
Json::Value msgs = jsonrpcClient->messages(Json::Value());
|
||||
auto messages = web3.ethereum()->messages(dev::eth::MessageFilter());
|
||||
BOOST_CHECK_EQUAL(msgs.isArray(), true);
|
||||
BOOST_CHECK_EQUAL(msgs.size(), messages.size());
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(jsonrpc_number)
|
||||
{
|
||||
cnote << "Testing jsonrpc number...";
|
||||
int number = jsonrpcClient->number();
|
||||
BOOST_CHECK_EQUAL(number, web3.ethereum()->number() + 1);
|
||||
cnote << "Testing jsonrpc number...";
|
||||
int number = jsonrpcClient->number();
|
||||
BOOST_CHECK_EQUAL(number, web3.ethereum()->number() + 1);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(jsonrpc_number2)
|
||||
@ -293,19 +295,6 @@ BOOST_AUTO_TEST_CASE(jsonrpc_transact)
|
||||
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)
|
||||
{
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(jsonrpc_watch)
|
||||
{
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user