mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge remote-tracking branch 'debris/mk_jsonrpc_upgrade' into build_enhancement
This basically pulls in libjson-rpc-cpp 0.3.2, updated from previous 0.2.1. v0.3.2 completely changes its own setup, hence such a massive change builds fine on Ubuntu, needs check on OS X Conflicts: CMakeLists.txt cmake/EthDependenciesDeprecated.cmake eth/CMakeLists.txt libqethereum/CMakeLists.txt libweb3jsonrpc/CMakeLists.txt neth/CMakeLists.txt test/CMakeLists.txt
This commit is contained in:
commit
5c19ce88ff
@ -4,7 +4,8 @@ aux_source_directory(. SRC_LIST)
|
||||
list(REMOVE_ITEM SRC_LIST "./createRandomTest.cpp")
|
||||
|
||||
include_directories(..)
|
||||
include_directories(${CRYPTOPP_INCLUDE_DIR})
|
||||
include_directories(${CRYPTOPP_INCLUDE_DIRS})
|
||||
include_directories(${JSONCPP_INCLUDE_DIRS})
|
||||
|
||||
file(GLOB HEADERS "*.h")
|
||||
add_executable(testeth ${SRC_LIST} ${HEADERS})
|
||||
@ -22,6 +23,7 @@ target_link_libraries(testeth webthree)
|
||||
target_link_libraries(testeth ${CRYPTOPP_LIBRARIES})
|
||||
|
||||
if(JSON_RPC_CPP_FOUND)
|
||||
target_link_libraries(testeth ${JSONCPP_LIBRARIES})
|
||||
target_link_libraries(testeth web3jsonrpc)
|
||||
endif()
|
||||
|
||||
|
@ -139,7 +139,7 @@ BOOST_AUTO_TEST_CASE(cryptopp_ecdsa_sipaseckp256k1)
|
||||
Secret secret(sha3(sbytes));
|
||||
KeyPair key(secret);
|
||||
|
||||
bytes m({0xFF});
|
||||
bytes m(1, 0xff);
|
||||
int tests = 2;
|
||||
while (m[0]++, tests--)
|
||||
{
|
||||
|
78
jsonrpc.cpp
78
jsonrpc.cpp
@ -29,8 +29,9 @@
|
||||
#include <libwebthree/WebThree.h>
|
||||
#include <libweb3jsonrpc/WebThreeStubServer.h>
|
||||
#include <libweb3jsonrpc/CorsHttpServer.h>
|
||||
#include <jsonrpc/connectors/httpserver.h>
|
||||
#include <jsonrpc/connectors/httpclient.h>
|
||||
#include <json/json.h>
|
||||
#include <jsonrpccpp/server/connectors/httpserver.h>
|
||||
#include <jsonrpccpp/client/connectors/httpclient.h>
|
||||
#include <set>
|
||||
#include "JsonSpiritHeaders.h"
|
||||
#include "TestHelper.h"
|
||||
@ -61,11 +62,12 @@ struct Setup
|
||||
|
||||
web3->setIdealPeerCount(5);
|
||||
web3->ethereum()->setForceMining(true);
|
||||
jsonrpcServer = unique_ptr<WebThreeStubServer>(new WebThreeStubServer(new jsonrpc::CorsHttpServer(8080), *web3, {}));
|
||||
auto server = new jsonrpc::CorsHttpServer(8080);
|
||||
jsonrpcServer = unique_ptr<WebThreeStubServer>(new WebThreeStubServer(*server, *web3, {}));
|
||||
jsonrpcServer->setIdentities({});
|
||||
jsonrpcServer->StartListening();
|
||||
|
||||
jsonrpcClient = unique_ptr<WebThreeStubClient>(new WebThreeStubClient(new jsonrpc::HttpClient("http://localhost:8080")));
|
||||
auto client = new jsonrpc::HttpClient("http://localhost:8080");
|
||||
jsonrpcClient = unique_ptr<WebThreeStubClient>(new WebThreeStubClient(*client));
|
||||
}
|
||||
};
|
||||
|
||||
@ -237,7 +239,73 @@ BOOST_AUTO_TEST_CASE(jsonrpc_transact)
|
||||
BOOST_CHECK_EQUAL(jsToDecimal(balanceString2), "750000000000000000");
|
||||
BOOST_CHECK_EQUAL(txAmount, balance2);
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(simple_contract)
|
||||
{
|
||||
cnote << "Testing jsonrpc contract...";
|
||||
KeyPair kp = KeyPair::create();
|
||||
web3->ethereum()->setAddress(kp.address());
|
||||
jsonrpcServer->setAccounts({kp});
|
||||
|
||||
dev::eth::mine(*(web3->ethereum()), 1);
|
||||
|
||||
char const* sourceCode = "contract test {\n"
|
||||
" function f(uint a) returns(uint d) { return a * 7; }\n"
|
||||
"}\n";
|
||||
|
||||
string compiled = jsonrpcClient->eth_solidity(sourceCode);
|
||||
|
||||
Json::Value create;
|
||||
create["code"] = compiled;
|
||||
string contractAddress = jsonrpcClient->eth_transact(create);
|
||||
dev::eth::mine(*(web3->ethereum()), 1);
|
||||
|
||||
Json::Value call;
|
||||
call["to"] = contractAddress;
|
||||
call["data"] = "0x00000000000000000000000000000000000000000000000000000000000000001";
|
||||
string result = jsonrpcClient->eth_call(call);
|
||||
BOOST_CHECK_EQUAL(result, "0x0000000000000000000000000000000000000000000000000000000000000007");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(contract_storage)
|
||||
{
|
||||
cnote << "Testing jsonrpc contract storage...";
|
||||
KeyPair kp = KeyPair::create();
|
||||
web3->ethereum()->setAddress(kp.address());
|
||||
jsonrpcServer->setAccounts({kp});
|
||||
|
||||
dev::eth::mine(*(web3->ethereum()), 1);
|
||||
|
||||
char const* sourceCode = R"(
|
||||
contract test {
|
||||
uint hello;
|
||||
function writeHello(uint value) returns(bool d){
|
||||
hello = value;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
)";
|
||||
|
||||
string compiled = jsonrpcClient->eth_solidity(sourceCode);
|
||||
|
||||
Json::Value create;
|
||||
create["code"] = compiled;
|
||||
string contractAddress = jsonrpcClient->eth_transact(create);
|
||||
dev::eth::mine(*(web3->ethereum()), 1);
|
||||
|
||||
Json::Value transact;
|
||||
transact["to"] = contractAddress;
|
||||
transact["data"] = "0x00000000000000000000000000000000000000000000000000000000000000003";
|
||||
jsonrpcClient->eth_transact(transact);
|
||||
dev::eth::mine(*(web3->ethereum()), 1);
|
||||
|
||||
Json::Value storage = jsonrpcClient->eth_storageAt(contractAddress);
|
||||
BOOST_CHECK_EQUAL(storage.getMemberNames().size(), 1);
|
||||
for (auto name: storage.getMemberNames())
|
||||
BOOST_CHECK_EQUAL(storage[name].asString(), "0x03");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
|
@ -128,8 +128,6 @@ BOOST_AUTO_TEST_CASE(different_argument_numbers)
|
||||
byte(Instruction::JUMP),
|
||||
byte(Instruction::JUMPDEST),
|
||||
// stack here: ret e h f(1,2,3)
|
||||
byte(Instruction::DUP2),
|
||||
byte(Instruction::POP),
|
||||
byte(Instruction::SWAP1),
|
||||
// stack here: ret e f(1,2,3) h
|
||||
byte(Instruction::POP),
|
||||
|
@ -32,6 +32,9 @@ using namespace std;
|
||||
|
||||
namespace dev
|
||||
{
|
||||
/// Provider another overload for toBigEndian to encode arguments and return values.
|
||||
inline bytes toBigEndian(bool _value) { return bytes({byte(_value)}); }
|
||||
|
||||
namespace solidity
|
||||
{
|
||||
namespace test
|
||||
@ -137,6 +140,7 @@ private:
|
||||
m_output = executive.out().toVector();
|
||||
}
|
||||
|
||||
protected:
|
||||
Address m_contractAddress;
|
||||
eth::State m_state;
|
||||
u256 const m_gasPrice = 100 * eth::szabo;
|
||||
@ -496,6 +500,206 @@ BOOST_AUTO_TEST_CASE(state_smoke_test)
|
||||
BOOST_CHECK(callContractFunction(0, bytes(1, 0x00)) == toBigEndian(u256(0x3)));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(simple_mapping)
|
||||
{
|
||||
char const* sourceCode = "contract test {\n"
|
||||
" mapping(uint8 => uint8) table;\n"
|
||||
" function get(uint8 k) returns (uint8 v) {\n"
|
||||
" return table[k];\n"
|
||||
" }\n"
|
||||
" function set(uint8 k, uint8 v) {\n"
|
||||
" table[k] = v;\n"
|
||||
" }\n"
|
||||
"}";
|
||||
compileAndRun(sourceCode);
|
||||
|
||||
BOOST_CHECK(callContractFunction(0, bytes({0x00})) == bytes({0x00}));
|
||||
BOOST_CHECK(callContractFunction(0, bytes({0x01})) == bytes({0x00}));
|
||||
BOOST_CHECK(callContractFunction(0, bytes({0xa7})) == bytes({0x00}));
|
||||
callContractFunction(1, bytes({0x01, 0xa1}));
|
||||
BOOST_CHECK(callContractFunction(0, bytes({0x00})) == bytes({0x00}));
|
||||
BOOST_CHECK(callContractFunction(0, bytes({0x01})) == bytes({0xa1}));
|
||||
BOOST_CHECK(callContractFunction(0, bytes({0xa7})) == bytes({0x00}));
|
||||
callContractFunction(1, bytes({0x00, 0xef}));
|
||||
BOOST_CHECK(callContractFunction(0, bytes({0x00})) == bytes({0xef}));
|
||||
BOOST_CHECK(callContractFunction(0, bytes({0x01})) == bytes({0xa1}));
|
||||
BOOST_CHECK(callContractFunction(0, bytes({0xa7})) == bytes({0x00}));
|
||||
callContractFunction(1, bytes({0x01, 0x05}));
|
||||
BOOST_CHECK(callContractFunction(0, bytes({0x00})) == bytes({0xef}));
|
||||
BOOST_CHECK(callContractFunction(0, bytes({0x01})) == bytes({0x05}));
|
||||
BOOST_CHECK(callContractFunction(0, bytes({0xa7})) == bytes({0x00}));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(mapping_state)
|
||||
{
|
||||
char const* sourceCode = "contract Ballot {\n"
|
||||
" mapping(address => bool) canVote;\n"
|
||||
" mapping(address => uint) voteCount;\n"
|
||||
" mapping(address => bool) voted;\n"
|
||||
" function getVoteCount(address addr) returns (uint retVoteCount) {\n"
|
||||
" return voteCount[addr];\n"
|
||||
" }\n"
|
||||
" function grantVoteRight(address addr) {\n"
|
||||
" canVote[addr] = true;\n"
|
||||
" }\n"
|
||||
" function vote(address voter, address vote) returns (bool success) {\n"
|
||||
" if (!canVote[voter] || voted[voter]) return false;\n"
|
||||
" voted[voter] = true;\n"
|
||||
" voteCount[vote] = voteCount[vote] + 1;\n"
|
||||
" return true;\n"
|
||||
" }\n"
|
||||
"}\n";
|
||||
compileAndRun(sourceCode);
|
||||
class Ballot
|
||||
{
|
||||
public:
|
||||
u256 getVoteCount(u160 _address) { return m_voteCount[_address]; }
|
||||
void grantVoteRight(u160 _address) { m_canVote[_address] = true; }
|
||||
bool vote(u160 _voter, u160 _vote)
|
||||
{
|
||||
if (!m_canVote[_voter] || m_voted[_voter]) return false;
|
||||
m_voted[_voter] = true;
|
||||
m_voteCount[_vote]++;
|
||||
return true;
|
||||
}
|
||||
private:
|
||||
map<u160, bool> m_canVote;
|
||||
map<u160, u256> m_voteCount;
|
||||
map<u160, bool> m_voted;
|
||||
} ballot;
|
||||
|
||||
auto getVoteCount = bind(&Ballot::getVoteCount, &ballot, _1);
|
||||
auto grantVoteRight = bind(&Ballot::grantVoteRight, &ballot, _1);
|
||||
auto vote = bind(&Ballot::vote, &ballot, _1, _2);
|
||||
testSolidityAgainstCpp(0, getVoteCount, u160(0));
|
||||
testSolidityAgainstCpp(0, getVoteCount, u160(1));
|
||||
testSolidityAgainstCpp(0, getVoteCount, u160(2));
|
||||
// voting without vote right shourd be rejected
|
||||
testSolidityAgainstCpp(2, vote, u160(0), u160(2));
|
||||
testSolidityAgainstCpp(0, getVoteCount, u160(0));
|
||||
testSolidityAgainstCpp(0, getVoteCount, u160(1));
|
||||
testSolidityAgainstCpp(0, getVoteCount, u160(2));
|
||||
// grant vote rights
|
||||
testSolidityAgainstCpp(1, grantVoteRight, u160(0));
|
||||
testSolidityAgainstCpp(1, grantVoteRight, u160(1));
|
||||
// vote, should increase 2's vote count
|
||||
testSolidityAgainstCpp(2, vote, u160(0), u160(2));
|
||||
testSolidityAgainstCpp(0, getVoteCount, u160(0));
|
||||
testSolidityAgainstCpp(0, getVoteCount, u160(1));
|
||||
testSolidityAgainstCpp(0, getVoteCount, u160(2));
|
||||
// vote again, should be rejected
|
||||
testSolidityAgainstCpp(2, vote, u160(0), u160(1));
|
||||
testSolidityAgainstCpp(0, getVoteCount, u160(0));
|
||||
testSolidityAgainstCpp(0, getVoteCount, u160(1));
|
||||
testSolidityAgainstCpp(0, getVoteCount, u160(2));
|
||||
// vote without right to vote
|
||||
testSolidityAgainstCpp(2, vote, u160(2), u160(1));
|
||||
testSolidityAgainstCpp(0, getVoteCount, u160(0));
|
||||
testSolidityAgainstCpp(0, getVoteCount, u160(1));
|
||||
testSolidityAgainstCpp(0, getVoteCount, u160(2));
|
||||
// grant vote right and now vote again
|
||||
testSolidityAgainstCpp(1, grantVoteRight, u160(2));
|
||||
testSolidityAgainstCpp(2, vote, u160(2), u160(1));
|
||||
testSolidityAgainstCpp(0, getVoteCount, u160(0));
|
||||
testSolidityAgainstCpp(0, getVoteCount, u160(1));
|
||||
testSolidityAgainstCpp(0, getVoteCount, u160(2));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(mapping_state_inc_dec)
|
||||
{
|
||||
char const* sourceCode = "contract test {\n"
|
||||
" uint value;\n"
|
||||
" mapping(uint => uint) table;\n"
|
||||
" function f(uint x) returns (uint y) {\n"
|
||||
" value = x;\n"
|
||||
" if (x > 0) table[++value] = 8;\n"
|
||||
" if (x > 1) value--;\n"
|
||||
" if (x > 2) table[value]++;\n"
|
||||
" return --table[value++];\n"
|
||||
" }\n"
|
||||
"}\n";
|
||||
compileAndRun(sourceCode);
|
||||
|
||||
u256 value = 0;
|
||||
map<u256, u256> table;
|
||||
auto f = [&](u256 const& _x) -> u256
|
||||
{
|
||||
value = _x;
|
||||
if (_x > 0)
|
||||
table[++value] = 8;
|
||||
if (_x > 1)
|
||||
value --;
|
||||
if (_x > 2)
|
||||
table[value]++;
|
||||
return --table[value++];
|
||||
};
|
||||
testSolidityAgainstCppOnRange(0, f, 0, 5);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(multi_level_mapping)
|
||||
{
|
||||
char const* sourceCode = "contract test {\n"
|
||||
" mapping(uint => mapping(uint => uint)) table;\n"
|
||||
" function f(uint x, uint y, uint z) returns (uint w) {\n"
|
||||
" if (z == 0) return table[x][y];\n"
|
||||
" else return table[x][y] = z;\n"
|
||||
" }\n"
|
||||
"}\n";
|
||||
compileAndRun(sourceCode);
|
||||
|
||||
map<u256, map<u256, u256>> table;
|
||||
auto f = [&](u256 const& _x, u256 const& _y, u256 const& _z) -> u256
|
||||
{
|
||||
if (_z == 0) return table[_x][_y];
|
||||
else return table[_x][_y] = _z;
|
||||
};
|
||||
testSolidityAgainstCpp(0, f, u256(4), u256(5), u256(0));
|
||||
testSolidityAgainstCpp(0, f, u256(5), u256(4), u256(0));
|
||||
testSolidityAgainstCpp(0, f, u256(4), u256(5), u256(9));
|
||||
testSolidityAgainstCpp(0, f, u256(4), u256(5), u256(0));
|
||||
testSolidityAgainstCpp(0, f, u256(5), u256(4), u256(0));
|
||||
testSolidityAgainstCpp(0, f, u256(5), u256(4), u256(7));
|
||||
testSolidityAgainstCpp(0, f, u256(4), u256(5), u256(0));
|
||||
testSolidityAgainstCpp(0, f, u256(5), u256(4), u256(0));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(structs)
|
||||
{
|
||||
char const* sourceCode = "contract test {\n"
|
||||
" struct s1 {\n"
|
||||
" uint8 x;\n"
|
||||
" bool y;\n"
|
||||
" }\n"
|
||||
" struct s2 {\n"
|
||||
" uint32 z;\n"
|
||||
" s1 s1data;\n"
|
||||
" mapping(uint8 => s2) recursive;\n"
|
||||
" }\n"
|
||||
" s2 data;\n"
|
||||
" function check() returns (bool ok) {\n"
|
||||
" return data.z == 1 && data.s1data.x == 2 && \n"
|
||||
" data.s1data.y == true && \n"
|
||||
" data.recursive[3].recursive[4].z == 5 && \n"
|
||||
" data.recursive[4].recursive[3].z == 6 && \n"
|
||||
" data.recursive[0].s1data.y == false && \n"
|
||||
" data.recursive[4].z == 9;\n"
|
||||
" }\n"
|
||||
" function set() {\n"
|
||||
" data.z = 1;\n"
|
||||
" data.s1data.x = 2;\n"
|
||||
" data.s1data.y = true;\n"
|
||||
" data.recursive[3].recursive[4].z = 5;\n"
|
||||
" data.recursive[4].recursive[3].z = 6;\n"
|
||||
" data.recursive[0].s1data.y = false;\n"
|
||||
" data.recursive[4].z = 9;\n"
|
||||
" }\n"
|
||||
"}\n";
|
||||
compileAndRun(sourceCode);
|
||||
BOOST_CHECK(callContractFunction(0) == bytes({0x00}));
|
||||
BOOST_CHECK(callContractFunction(1) == bytes());
|
||||
BOOST_CHECK(callContractFunction(0) == bytes({0x01}));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
}
|
||||
|
@ -121,6 +121,44 @@ BOOST_AUTO_TEST_CASE(reference_to_later_declaration)
|
||||
BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(struct_definition_directly_recursive)
|
||||
{
|
||||
char const* text = "contract test {\n"
|
||||
" struct MyStructName {\n"
|
||||
" address addr;\n"
|
||||
" MyStructName x;\n"
|
||||
" }\n"
|
||||
"}\n";
|
||||
BOOST_CHECK_THROW(parseTextAndResolveNames(text), ParserError);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(struct_definition_indirectly_recursive)
|
||||
{
|
||||
char const* text = "contract test {\n"
|
||||
" struct MyStructName1 {\n"
|
||||
" address addr;\n"
|
||||
" uint256 count;\n"
|
||||
" MyStructName2 x;\n"
|
||||
" }\n"
|
||||
" struct MyStructName2 {\n"
|
||||
" MyStructName1 x;\n"
|
||||
" }\n"
|
||||
"}\n";
|
||||
BOOST_CHECK_THROW(parseTextAndResolveNames(text), ParserError);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(struct_definition_recursion_via_mapping)
|
||||
{
|
||||
char const* text = "contract test {\n"
|
||||
" struct MyStructName1 {\n"
|
||||
" address addr;\n"
|
||||
" uint256 count;\n"
|
||||
" mapping(uint => MyStructName1) x;\n"
|
||||
" }\n"
|
||||
"}\n";
|
||||
BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(type_inference_smoke_test)
|
||||
{
|
||||
char const* text = "contract test {\n"
|
||||
|
@ -1,588 +1,500 @@
|
||||
/**
|
||||
* THIS FILE IS GENERATED BY jsonrpcstub, DO NOT CHANGE IT!!!!!
|
||||
* This file is generated by jsonrpcstub, DO NOT CHANGE IT MANUALLY!
|
||||
*/
|
||||
|
||||
#ifndef _WEBTHREESTUBCLIENT_H_
|
||||
#define _WEBTHREESTUBCLIENT_H_
|
||||
#ifndef JSONRPC_CPP_STUB_WEBTHREESTUBCLIENT_H_
|
||||
#define JSONRPC_CPP_STUB_WEBTHREESTUBCLIENT_H_
|
||||
|
||||
#include <jsonrpc/rpc.h>
|
||||
#include <jsonrpccpp/client.h>
|
||||
|
||||
class WebThreeStubClient
|
||||
class WebThreeStubClient : public jsonrpc::Client
|
||||
{
|
||||
public:
|
||||
WebThreeStubClient(jsonrpc::AbstractClientConnector* conn)
|
||||
{
|
||||
this->client = new jsonrpc::Client(conn);
|
||||
}
|
||||
~WebThreeStubClient()
|
||||
{
|
||||
delete this->client;
|
||||
}
|
||||
|
||||
std::string db_get(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
p.append(param2);
|
||||
|
||||
Json::Value result = this->client->CallMethod("db_get",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
|
||||
}
|
||||
|
||||
std::string db_getString(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
p.append(param2);
|
||||
|
||||
Json::Value result = this->client->CallMethod("db_getString",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
|
||||
}
|
||||
|
||||
bool db_put(const std::string& param1, const std::string& param2, const std::string& param3) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
p.append(param2);
|
||||
p.append(param3);
|
||||
|
||||
Json::Value result = this->client->CallMethod("db_put",p);
|
||||
if (result.isBool())
|
||||
return result.asBool();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
|
||||
}
|
||||
|
||||
bool db_putString(const std::string& param1, const std::string& param2, const std::string& param3) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
p.append(param2);
|
||||
p.append(param3);
|
||||
|
||||
Json::Value result = this->client->CallMethod("db_putString",p);
|
||||
if (result.isBool())
|
||||
return result.asBool();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
|
||||
}
|
||||
|
||||
Json::Value eth_accounts() throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p = Json::nullValue;
|
||||
Json::Value result = this->client->CallMethod("eth_accounts",p);
|
||||
if (result.isArray())
|
||||
return result;
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
|
||||
}
|
||||
|
||||
std::string eth_balanceAt(const std::string& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
|
||||
Json::Value result = this->client->CallMethod("eth_balanceAt",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
|
||||
}
|
||||
|
||||
Json::Value eth_blockByHash(const std::string& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
|
||||
Json::Value result = this->client->CallMethod("eth_blockByHash",p);
|
||||
if (result.isObject())
|
||||
return result;
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
|
||||
}
|
||||
|
||||
Json::Value eth_blockByNumber(const int& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
|
||||
Json::Value result = this->client->CallMethod("eth_blockByNumber",p);
|
||||
if (result.isObject())
|
||||
return result;
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
|
||||
}
|
||||
|
||||
std::string eth_call(const Json::Value& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
|
||||
Json::Value result = this->client->CallMethod("eth_call",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
|
||||
}
|
||||
|
||||
bool eth_changed(const int& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
|
||||
Json::Value result = this->client->CallMethod("eth_changed",p);
|
||||
if (result.isBool())
|
||||
return result.asBool();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
|
||||
}
|
||||
|
||||
std::string eth_codeAt(const std::string& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
|
||||
Json::Value result = this->client->CallMethod("eth_codeAt",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
|
||||
}
|
||||
WebThreeStubClient(jsonrpc::IClientConnector &conn) : jsonrpc::Client(conn) {}
|
||||
|
||||
std::string eth_coinbase() throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p = Json::nullValue;
|
||||
Json::Value result = this->client->CallMethod("eth_coinbase",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
|
||||
Json::Value result = this->CallMethod("eth_coinbase",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
|
||||
std::string eth_compile(const std::string& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
|
||||
Json::Value result = this->client->CallMethod("eth_compile",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
|
||||
}
|
||||
|
||||
double eth_countAt(const std::string& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
|
||||
Json::Value result = this->client->CallMethod("eth_countAt",p);
|
||||
if (result.isDouble())
|
||||
return result.asDouble();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
|
||||
}
|
||||
|
||||
int eth_defaultBlock() throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p = Json::nullValue;
|
||||
Json::Value result = this->client->CallMethod("eth_defaultBlock",p);
|
||||
if (result.isInt())
|
||||
return result.asInt();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
|
||||
}
|
||||
|
||||
std::string eth_gasPrice() throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p = Json::nullValue;
|
||||
Json::Value result = this->client->CallMethod("eth_gasPrice",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
|
||||
}
|
||||
|
||||
Json::Value eth_getMessages(const int& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
|
||||
Json::Value result = this->client->CallMethod("eth_getMessages",p);
|
||||
if (result.isArray())
|
||||
return result;
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
|
||||
}
|
||||
|
||||
bool eth_listening() throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p = Json::nullValue;
|
||||
Json::Value result = this->client->CallMethod("eth_listening",p);
|
||||
if (result.isBool())
|
||||
return result.asBool();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
|
||||
}
|
||||
|
||||
std::string eth_lll(const std::string& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
|
||||
Json::Value result = this->client->CallMethod("eth_lll",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
|
||||
}
|
||||
|
||||
bool eth_mining() throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p = Json::nullValue;
|
||||
Json::Value result = this->client->CallMethod("eth_mining",p);
|
||||
if (result.isBool())
|
||||
return result.asBool();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
|
||||
}
|
||||
|
||||
int eth_newFilter(const Json::Value& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
|
||||
Json::Value result = this->client->CallMethod("eth_newFilter",p);
|
||||
if (result.isInt())
|
||||
return result.asInt();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
|
||||
}
|
||||
|
||||
int eth_newFilterString(const std::string& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
|
||||
Json::Value result = this->client->CallMethod("eth_newFilterString",p);
|
||||
if (result.isInt())
|
||||
return result.asInt();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
|
||||
}
|
||||
|
||||
int eth_number() throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p = Json::nullValue;
|
||||
Json::Value result = this->client->CallMethod("eth_number",p);
|
||||
if (result.isInt())
|
||||
return result.asInt();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
|
||||
}
|
||||
|
||||
int eth_peerCount() throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p = Json::nullValue;
|
||||
Json::Value result = this->client->CallMethod("eth_peerCount",p);
|
||||
if (result.isInt())
|
||||
return result.asInt();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
|
||||
}
|
||||
|
||||
bool eth_setCoinbase(const std::string& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
|
||||
Json::Value result = this->client->CallMethod("eth_setCoinbase",p);
|
||||
if (result.isBool())
|
||||
return result.asBool();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
|
||||
Json::Value result = this->CallMethod("eth_setCoinbase",p);
|
||||
if (result.isBool())
|
||||
return result.asBool();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
|
||||
bool eth_setDefaultBlock(const int& param1) throw (jsonrpc::JsonRpcException)
|
||||
bool eth_listening() throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
|
||||
Json::Value result = this->client->CallMethod("eth_setDefaultBlock",p);
|
||||
if (result.isBool())
|
||||
return result.asBool();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
|
||||
p = Json::nullValue;
|
||||
Json::Value result = this->CallMethod("eth_listening",p);
|
||||
if (result.isBool())
|
||||
return result.asBool();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
|
||||
bool eth_setListening(const bool& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
|
||||
Json::Value result = this->client->CallMethod("eth_setListening",p);
|
||||
if (result.isBool())
|
||||
return result.asBool();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
|
||||
Json::Value result = this->CallMethod("eth_setListening",p);
|
||||
if (result.isBool())
|
||||
return result.asBool();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
bool eth_mining() throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p = Json::nullValue;
|
||||
Json::Value result = this->CallMethod("eth_mining",p);
|
||||
if (result.isBool())
|
||||
return result.asBool();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
|
||||
bool eth_setMining(const bool& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
|
||||
Json::Value result = this->client->CallMethod("eth_setMining",p);
|
||||
if (result.isBool())
|
||||
return result.asBool();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
|
||||
Json::Value result = this->CallMethod("eth_setMining",p);
|
||||
if (result.isBool())
|
||||
return result.asBool();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
std::string eth_gasPrice() throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p = Json::nullValue;
|
||||
Json::Value result = this->CallMethod("eth_gasPrice",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
Json::Value eth_accounts() throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p = Json::nullValue;
|
||||
Json::Value result = this->CallMethod("eth_accounts",p);
|
||||
if (result.isArray())
|
||||
return result;
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
int eth_peerCount() throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p = Json::nullValue;
|
||||
Json::Value result = this->CallMethod("eth_peerCount",p);
|
||||
if (result.isInt())
|
||||
return result.asInt();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
int eth_defaultBlock() throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p = Json::nullValue;
|
||||
Json::Value result = this->CallMethod("eth_defaultBlock",p);
|
||||
if (result.isInt())
|
||||
return result.asInt();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
bool eth_setDefaultBlock(const int& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
Json::Value result = this->CallMethod("eth_setDefaultBlock",p);
|
||||
if (result.isBool())
|
||||
return result.asBool();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
int eth_number() throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p = Json::nullValue;
|
||||
Json::Value result = this->CallMethod("eth_number",p);
|
||||
if (result.isInt())
|
||||
return result.asInt();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
std::string eth_balanceAt(const std::string& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
Json::Value result = this->CallMethod("eth_balanceAt",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
|
||||
std::string eth_stateAt(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
p.append(param2);
|
||||
|
||||
Json::Value result = this->client->CallMethod("eth_stateAt",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
|
||||
p.append(param2);
|
||||
Json::Value result = this->CallMethod("eth_stateAt",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
Json::Value eth_storageAt(const std::string& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
Json::Value result = this->CallMethod("eth_storageAt",p);
|
||||
if (result.isObject())
|
||||
return result;
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
double eth_countAt(const std::string& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
Json::Value result = this->CallMethod("eth_countAt",p);
|
||||
if (result.isDouble())
|
||||
return result.asDouble();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
std::string eth_codeAt(const std::string& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
Json::Value result = this->CallMethod("eth_codeAt",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
|
||||
std::string eth_transact(const Json::Value& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
|
||||
Json::Value result = this->client->CallMethod("eth_transact",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
|
||||
Json::Value result = this->CallMethod("eth_transact",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
std::string eth_call(const Json::Value& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
Json::Value result = this->CallMethod("eth_call",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
Json::Value eth_blockByHash(const std::string& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
Json::Value result = this->CallMethod("eth_blockByHash",p);
|
||||
if (result.isObject())
|
||||
return result;
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
Json::Value eth_blockByNumber(const int& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
Json::Value result = this->CallMethod("eth_blockByNumber",p);
|
||||
if (result.isObject())
|
||||
return result;
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
|
||||
Json::Value eth_transactionByHash(const std::string& param1, const int& param2) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
p.append(param2);
|
||||
|
||||
Json::Value result = this->client->CallMethod("eth_transactionByHash",p);
|
||||
if (result.isObject())
|
||||
return result;
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
|
||||
p.append(param2);
|
||||
Json::Value result = this->CallMethod("eth_transactionByHash",p);
|
||||
if (result.isObject())
|
||||
return result;
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
|
||||
Json::Value eth_transactionByNumber(const int& param1, const int& param2) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
p.append(param2);
|
||||
|
||||
Json::Value result = this->client->CallMethod("eth_transactionByNumber",p);
|
||||
if (result.isObject())
|
||||
return result;
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
|
||||
p.append(param2);
|
||||
Json::Value result = this->CallMethod("eth_transactionByNumber",p);
|
||||
if (result.isObject())
|
||||
return result;
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
|
||||
Json::Value eth_uncleByHash(const std::string& param1, const int& param2) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
p.append(param2);
|
||||
|
||||
Json::Value result = this->client->CallMethod("eth_uncleByHash",p);
|
||||
if (result.isObject())
|
||||
return result;
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
|
||||
p.append(param2);
|
||||
Json::Value result = this->CallMethod("eth_uncleByHash",p);
|
||||
if (result.isObject())
|
||||
return result;
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
|
||||
Json::Value eth_uncleByNumber(const int& param1, const int& param2) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
p.append(param2);
|
||||
|
||||
Json::Value result = this->client->CallMethod("eth_uncleByNumber",p);
|
||||
if (result.isObject())
|
||||
return result;
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
|
||||
p.append(param2);
|
||||
Json::Value result = this->CallMethod("eth_uncleByNumber",p);
|
||||
if (result.isObject())
|
||||
return result;
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
Json::Value eth_compilers() throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p = Json::nullValue;
|
||||
Json::Value result = this->CallMethod("eth_compilers",p);
|
||||
if (result.isArray())
|
||||
return result;
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
std::string eth_lll(const std::string& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
Json::Value result = this->CallMethod("eth_lll",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
std::string eth_solidity(const std::string& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
Json::Value result = this->CallMethod("eth_solidity",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
std::string eth_serpent(const std::string& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
Json::Value result = this->CallMethod("eth_serpent",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
int eth_newFilter(const Json::Value& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
Json::Value result = this->CallMethod("eth_newFilter",p);
|
||||
if (result.isInt())
|
||||
return result.asInt();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
int eth_newFilterString(const std::string& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
Json::Value result = this->CallMethod("eth_newFilterString",p);
|
||||
if (result.isInt())
|
||||
return result.asInt();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
|
||||
bool eth_uninstallFilter(const int& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
|
||||
Json::Value result = this->client->CallMethod("eth_uninstallFilter",p);
|
||||
if (result.isBool())
|
||||
return result.asBool();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
|
||||
Json::Value result = this->CallMethod("eth_uninstallFilter",p);
|
||||
if (result.isBool())
|
||||
return result.asBool();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
|
||||
std::string shh_addToGroup(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
|
||||
bool eth_changed(const int& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
p.append(param2);
|
||||
|
||||
Json::Value result = this->client->CallMethod("shh_addToGroup",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
|
||||
Json::Value result = this->CallMethod("eth_changed",p);
|
||||
if (result.isBool())
|
||||
return result.asBool();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
|
||||
Json::Value shh_changed(const int& param1) throw (jsonrpc::JsonRpcException)
|
||||
Json::Value eth_filterLogs(const int& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
|
||||
Json::Value result = this->client->CallMethod("shh_changed",p);
|
||||
if (result.isArray())
|
||||
return result;
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
|
||||
Json::Value result = this->CallMethod("eth_filterLogs",p);
|
||||
if (result.isArray())
|
||||
return result;
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
|
||||
bool shh_haveIdentity(const std::string& param1) throw (jsonrpc::JsonRpcException)
|
||||
Json::Value eth_logs(const Json::Value& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
|
||||
Json::Value result = this->client->CallMethod("shh_haveIdentity",p);
|
||||
if (result.isBool())
|
||||
return result.asBool();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
|
||||
Json::Value result = this->CallMethod("eth_logs",p);
|
||||
if (result.isArray())
|
||||
return result;
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
|
||||
int shh_newFilter(const Json::Value& param1) throw (jsonrpc::JsonRpcException)
|
||||
bool db_put(const std::string& param1, const std::string& param2, const std::string& param3) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
|
||||
Json::Value result = this->client->CallMethod("shh_newFilter",p);
|
||||
if (result.isInt())
|
||||
return result.asInt();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
|
||||
p.append(param2);
|
||||
p.append(param3);
|
||||
Json::Value result = this->CallMethod("db_put",p);
|
||||
if (result.isBool())
|
||||
return result.asBool();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
|
||||
std::string shh_newGroup(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
|
||||
std::string db_get(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
p.append(param2);
|
||||
|
||||
Json::Value result = this->client->CallMethod("shh_newGroup",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
|
||||
p.append(param2);
|
||||
Json::Value result = this->CallMethod("db_get",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
|
||||
std::string shh_newIdentity() throw (jsonrpc::JsonRpcException)
|
||||
bool db_putString(const std::string& param1, const std::string& param2, const std::string& param3) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p = Json::nullValue;
|
||||
Json::Value result = this->client->CallMethod("shh_newIdentity",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
|
||||
p.append(param1);
|
||||
p.append(param2);
|
||||
p.append(param3);
|
||||
Json::Value result = this->CallMethod("db_putString",p);
|
||||
if (result.isBool())
|
||||
return result.asBool();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
std::string db_getString(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
p.append(param2);
|
||||
Json::Value result = this->CallMethod("db_getString",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
|
||||
bool shh_post(const Json::Value& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
|
||||
Json::Value result = this->client->CallMethod("shh_post",p);
|
||||
if (result.isBool())
|
||||
return result.asBool();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
|
||||
Json::Value result = this->CallMethod("shh_post",p);
|
||||
if (result.isBool())
|
||||
return result.asBool();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
std::string shh_newIdentity() throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p = Json::nullValue;
|
||||
Json::Value result = this->CallMethod("shh_newIdentity",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
bool shh_haveIdentity(const std::string& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
Json::Value result = this->CallMethod("shh_haveIdentity",p);
|
||||
if (result.isBool())
|
||||
return result.asBool();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
std::string shh_newGroup(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
p.append(param2);
|
||||
Json::Value result = this->CallMethod("shh_newGroup",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
std::string shh_addToGroup(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
p.append(param2);
|
||||
Json::Value result = this->CallMethod("shh_addToGroup",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
int shh_newFilter(const Json::Value& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
Json::Value result = this->CallMethod("shh_newFilter",p);
|
||||
if (result.isInt())
|
||||
return result.asInt();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
|
||||
bool shh_uninstallFilter(const int& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
|
||||
Json::Value result = this->client->CallMethod("shh_uninstallFilter",p);
|
||||
if (result.isBool())
|
||||
return result.asBool();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
|
||||
Json::Value result = this->CallMethod("shh_uninstallFilter",p);
|
||||
if (result.isBool())
|
||||
return result.asBool();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
Json::Value shh_changed(const int& param1) throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p.append(param1);
|
||||
Json::Value result = this->CallMethod("shh_changed",p);
|
||||
if (result.isArray())
|
||||
return result;
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
|
||||
private:
|
||||
jsonrpc::Client* client;
|
||||
};
|
||||
#endif //_WEBTHREESTUBCLIENT_H_
|
||||
|
||||
#endif //JSONRPC_CPP_WEBTHREESTUBCLIENT_H_
|
||||
|
Loading…
Reference in New Issue
Block a user