mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add new JSON API for better abstraction and for supporting strict JSON parsing
This commit is contained in:
1 parent
dcc4083b23
commit
0f29ac4e56
15 files changed
+337
-53
No files matched your search
+6
-8
@@ -23,8 +23,7 @@
|
||||
|
||||
#include <libdevcore/CommonData.h>
|
||||
|
||||
#include <json/reader.h>
|
||||
#include <json/writer.h>
|
||||
#include <libdevcore/JSON.h>
|
||||
|
||||
#include <string>
|
||||
#include <stdio.h>
|
||||
@@ -216,7 +215,7 @@ string RPCSession::personal_newAccount(string const& _password)
|
||||
|
||||
void RPCSession::test_setChainParams(vector<string> const& _accounts)
|
||||
{
|
||||
static std::string const c_configString = R"(
|
||||
static string const c_configString = R"(
|
||||
{
|
||||
"sealEngine": "NoProof",
|
||||
"params": {
|
||||
@@ -249,10 +248,10 @@ void RPCSession::test_setChainParams(vector<string> const& _accounts)
|
||||
)";
|
||||
|
||||
Json::Value config;
|
||||
BOOST_REQUIRE(Json::Reader().parse(c_configString, config));
|
||||
BOOST_REQUIRE(jsonParseStrict(c_configString, config));
|
||||
for (auto const& account: _accounts)
|
||||
config["accounts"][account]["wei"] = "0x100000000000000000000000000000000000000000";
|
||||
test_setChainParams(Json::FastWriter().write(config));
|
||||
test_setChainParams(jsonCompactPrint(config));
|
||||
}
|
||||
|
||||
void RPCSession::test_setChainParams(string const& _config)
|
||||
@@ -328,7 +327,7 @@ Json::Value RPCSession::rpcCall(string const& _methodName, vector<string> const&
|
||||
BOOST_TEST_MESSAGE("Reply: " + reply);
|
||||
|
||||
Json::Value result;
|
||||
BOOST_REQUIRE(Json::Reader().parse(reply, result, false));
|
||||
BOOST_REQUIRE(jsonParseStrict(reply, result));
|
||||
|
||||
if (result.isMember("error"))
|
||||
{
|
||||
@@ -371,6 +370,5 @@ string RPCSession::TransactionData::toJson() const
|
||||
json["gasprice"] = gasPrice;
|
||||
json["value"] = value;
|
||||
json["data"] = data;
|
||||
return Json::FastWriter().write(json);
|
||||
|
||||
return jsonCompactPrint(json);
|
||||
}
|
||||
Reference in new issue
Block a user