diff options
author | Marek Kotewicz <marek.kotewicz@gmail.com> | 2014-11-11 05:51:10 +0800 |
---|---|---|
committer | Marek Kotewicz <marek.kotewicz@gmail.com> | 2014-11-11 05:51:10 +0800 |
commit | 43094643847bf64e8a4559e3243a4b09f9d8fbcb (patch) | |
tree | d6adb528dffbd77fc422cc2dc45a4ba60b02bb77 /jsonrpc.cpp | |
parent | 96292f9199e605c729d2197ccae5ec7127825852 (diff) | |
download | dexon-solidity-43094643847bf64e8a4559e3243a4b09f9d8fbcb.tar dexon-solidity-43094643847bf64e8a4559e3243a4b09f9d8fbcb.tar.gz dexon-solidity-43094643847bf64e8a4559e3243a4b09f9d8fbcb.tar.bz2 dexon-solidity-43094643847bf64e8a4559e3243a4b09f9d8fbcb.tar.lz dexon-solidity-43094643847bf64e8a4559e3243a4b09f9d8fbcb.tar.xz dexon-solidity-43094643847bf64e8a4559e3243a4b09f9d8fbcb.tar.zst dexon-solidity-43094643847bf64e8a4559e3243a4b09f9d8fbcb.zip |
merge
Diffstat (limited to 'jsonrpc.cpp')
-rw-r--r-- | jsonrpc.cpp | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/jsonrpc.cpp b/jsonrpc.cpp index 68c30734..4c748a95 100644 --- a/jsonrpc.cpp +++ b/jsonrpc.cpp @@ -74,14 +74,14 @@ BOOST_FIXTURE_TEST_SUITE(environment, Setup) BOOST_AUTO_TEST_CASE(jsonrpc_defaultBlock) { cnote << "Testing jsonrpc defaultBlock..."; - int defaultBlock = jsonrpcClient->defaultBlock(); + int defaultBlock = jsonrpcClient->eth_defaultBlock(); BOOST_CHECK_EQUAL(defaultBlock, web3->ethereum()->getDefault()); } BOOST_AUTO_TEST_CASE(jsonrpc_gasPrice) { cnote << "Testing jsonrpc gasPrice..."; - string gasPrice = jsonrpcClient->gasPrice(); + string gasPrice = jsonrpcClient->eth_gasPrice(); BOOST_CHECK_EQUAL(gasPrice, toJS(10 * dev::eth::szabo)); } @@ -90,11 +90,11 @@ BOOST_AUTO_TEST_CASE(jsonrpc_isListening) cnote << "Testing jsonrpc isListening..."; web3->startNetwork(); - bool listeningOn = jsonrpcClient->listening(); + bool listeningOn = jsonrpcClient->eth_listening(); BOOST_CHECK_EQUAL(listeningOn, web3->isNetworkStarted()); web3->stopNetwork(); - bool listeningOff = jsonrpcClient->listening(); + bool listeningOff = jsonrpcClient->eth_listening(); BOOST_CHECK_EQUAL(listeningOff, web3->isNetworkStarted()); } @@ -103,11 +103,11 @@ BOOST_AUTO_TEST_CASE(jsonrpc_isMining) cnote << "Testing jsonrpc isMining..."; web3->ethereum()->startMining(); - bool miningOn = jsonrpcClient->mining(); + bool miningOn = jsonrpcClient->eth_mining(); BOOST_CHECK_EQUAL(miningOn, web3->ethereum()->isMining()); web3->ethereum()->stopMining(); - bool miningOff = jsonrpcClient->mining(); + bool miningOff = jsonrpcClient->eth_mining(); BOOST_CHECK_EQUAL(miningOff, web3->ethereum()->isMining()); } @@ -116,7 +116,7 @@ BOOST_AUTO_TEST_CASE(jsonrpc_accounts) cnote << "Testing jsonrpc accounts..."; std::vector <dev::KeyPair> keys = {KeyPair::create(), KeyPair::create()}; jsonrpcServer->setAccounts(keys); - Json::Value k = jsonrpcClient->accounts(); + Json::Value k = jsonrpcClient->eth_accounts(); jsonrpcServer->setAccounts({}); BOOST_CHECK_EQUAL(k.isArray(), true); BOOST_CHECK_EQUAL(k.size(), keys.size()); @@ -133,10 +133,10 @@ BOOST_AUTO_TEST_CASE(jsonrpc_accounts) BOOST_AUTO_TEST_CASE(jsonrpc_number) { cnote << "Testing jsonrpc number2..."; - int number = jsonrpcClient->number(); + int number = jsonrpcClient->eth_number(); BOOST_CHECK_EQUAL(number, web3->ethereum()->number() + 1); dev::eth::mine(*(web3->ethereum()), 1); - int numberAfter = jsonrpcClient->number(); + int numberAfter = jsonrpcClient->eth_number(); BOOST_CHECK_EQUAL(number + 1, numberAfter); BOOST_CHECK_EQUAL(numberAfter, web3->ethereum()->number() + 1); } @@ -144,7 +144,7 @@ BOOST_AUTO_TEST_CASE(jsonrpc_number) BOOST_AUTO_TEST_CASE(jsonrpc_peerCount) { cnote << "Testing jsonrpc peerCount..."; - int peerCount = jsonrpcClient->peerCount(); + int peerCount = jsonrpcClient->eth_peerCount(); BOOST_CHECK_EQUAL(web3->peerCount(), peerCount); } @@ -152,10 +152,10 @@ BOOST_AUTO_TEST_CASE(jsonrpc_setListening) { cnote << "Testing jsonrpc setListening..."; - jsonrpcClient->setListening(true); + jsonrpcClient->eth_setListening(true); BOOST_CHECK_EQUAL(web3->isNetworkStarted(), true); - jsonrpcClient->setListening(false); + jsonrpcClient->eth_setListening(false); BOOST_CHECK_EQUAL(web3->isNetworkStarted(), false); } @@ -163,10 +163,10 @@ BOOST_AUTO_TEST_CASE(jsonrpc_setMining) { cnote << "Testing jsonrpc setMining..."; - jsonrpcClient->setMining(true); + jsonrpcClient->eth_setMining(true); BOOST_CHECK_EQUAL(web3->ethereum()->isMining(), true); - jsonrpcClient->setMining(false); + jsonrpcClient->eth_setMining(false); BOOST_CHECK_EQUAL(web3->ethereum()->isMining(), false); } @@ -175,14 +175,14 @@ BOOST_AUTO_TEST_CASE(jsonrpc_stateAt) cnote << "Testing jsonrpc stateAt..."; dev::KeyPair key = KeyPair::create(); auto address = key.address(); - string stateAt = jsonrpcClient->stateAt(toJS(address), "0"); + string stateAt = jsonrpcClient->eth_stateAt(toJS(address), "0"); BOOST_CHECK_EQUAL(toJS(web3->ethereum()->stateAt(address, jsToU256("0"), 0)), stateAt); } BOOST_AUTO_TEST_CASE(jsonrpc_transact) { cnote << "Testing jsonrpc transact..."; - string coinbase = jsonrpcClient->coinbase(); + string coinbase = jsonrpcClient->eth_coinbase(); BOOST_CHECK_EQUAL(jsToAddress(coinbase), web3->ethereum()->address()); dev::KeyPair key = KeyPair::create(); @@ -190,14 +190,14 @@ BOOST_AUTO_TEST_CASE(jsonrpc_transact) auto receiver = KeyPair::create(); web3->ethereum()->setAddress(address); - coinbase = jsonrpcClient->coinbase(); + coinbase = jsonrpcClient->eth_coinbase(); BOOST_CHECK_EQUAL(jsToAddress(coinbase), web3->ethereum()->address()); BOOST_CHECK_EQUAL(jsToAddress(coinbase), address); jsonrpcServer->setAccounts({key}); auto balance = web3->ethereum()->balanceAt(address, 0); - string balanceString = jsonrpcClient->balanceAt(toJS(address)); - double countAt = jsonrpcClient->countAt(toJS(address)); + string balanceString = jsonrpcClient->eth_balanceAt(toJS(address)); + double countAt = jsonrpcClient->eth_countAt(toJS(address)); BOOST_CHECK_EQUAL(countAt, (double)(uint64_t)web3->ethereum()->countAt(address)); BOOST_CHECK_EQUAL(countAt, 0); @@ -206,7 +206,7 @@ BOOST_AUTO_TEST_CASE(jsonrpc_transact) dev::eth::mine(*(web3->ethereum()), 1); balance = web3->ethereum()->balanceAt(address, 0); - balanceString = jsonrpcClient->balanceAt(toJS(address)); + balanceString = jsonrpcClient->eth_balanceAt(toJS(address)); BOOST_CHECK_EQUAL(toJS(balance), balanceString); BOOST_CHECK_EQUAL(jsToDecimal(balanceString), "1500000000000000000"); @@ -223,13 +223,13 @@ BOOST_AUTO_TEST_CASE(jsonrpc_transact) t["gas"] = toJS(gas); t["gasPrice"] = toJS(gasPrice); - jsonrpcClient->transact(t); + jsonrpcClient->eth_transact(t); jsonrpcServer->setAccounts({}); dev::eth::mine(*(web3->ethereum()), 1); - countAt = jsonrpcClient->countAt(toJS(address)); + countAt = jsonrpcClient->eth_countAt(toJS(address)); auto balance2 = web3->ethereum()->balanceAt(receiver.address()); - string balanceString2 = jsonrpcClient->balanceAt(toJS(receiver.address())); + string balanceString2 = jsonrpcClient->eth_balanceAt(toJS(receiver.address())); BOOST_CHECK_EQUAL(countAt, (double)(uint64_t)web3->ethereum()->countAt(address)); BOOST_CHECK_EQUAL(countAt, 1); |