diff --git a/eth/EthStubServer.cpp b/eth/EthStubServer.cpp index 86bb1ba58..dd82541de 100644 --- a/eth/EthStubServer.cpp +++ b/eth/EthStubServer.cpp @@ -138,6 +138,11 @@ std::string EthStubServer::storageAt(const std::string& _a, const std::string& x return toJS(m_client.stateAt(jsToAddress(_a), jsToU256(x), 0)); } +std::string EthStubServer::stateAt(const std::string& _a, const std::string& x, const std::string& b) +{ + return toJS(m_client.stateAt(jsToAddress(_a), jsToU256(x), std::atol(b.c_str()))); +} + Json::Value EthStubServer::transact(const std::string& _aDest, const std::string& _bData, const std::string& _sec, const std::string& _xGas, const std::string& _xGasPrice, const std::string& _xValue) { m_client.transact(jsToSecret(_sec), jsToU256(_xValue), jsToAddress(_aDest), jsToBytes(_bData), jsToU256(_xGas), jsToU256(_xGasPrice)); diff --git a/eth/EthStubServer.h b/eth/EthStubServer.h index 28af916a2..8046eb4ca 100644 --- a/eth/EthStubServer.h +++ b/eth/EthStubServer.h @@ -49,6 +49,7 @@ public: virtual Json::Value keys(); virtual int peerCount(); virtual std::string storageAt(const std::string& a, const std::string& x); + virtual std::string stateAt(const std::string& a, const std::string& x, const std::string& b); virtual Json::Value transact(const std::string& aDest, const std::string& bData, const std::string& sec, const std::string& xGas, const std::string& xGasPrice, const std::string& xValue); virtual std::string txCountAt(const std::string& a); virtual std::string secretToAddress(const std::string& a); diff --git a/eth/abstractethstubserver.h b/eth/abstractethstubserver.h index 940e4c809..e6e21fcf9 100644 --- a/eth/abstractethstubserver.h +++ b/eth/abstractethstubserver.h @@ -30,6 +30,7 @@ class AbstractEthStubServer : public jsonrpc::AbstractServerbindAndAddMethod(new jsonrpc::Procedure("procedures", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_ARRAY, NULL), &AbstractEthStubServer::proceduresI); this->bindAndAddMethod(new jsonrpc::Procedure("secretToAddress", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_STRING, "a",jsonrpc::JSON_STRING, NULL), &AbstractEthStubServer::secretToAddressI); this->bindAndAddMethod(new jsonrpc::Procedure("storageAt", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_STRING, "a",jsonrpc::JSON_STRING,"x",jsonrpc::JSON_STRING, NULL), &AbstractEthStubServer::storageAtI); + this->bindAndAddMethod(new jsonrpc::Procedure("stateAt", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_STRING, "a",jsonrpc::JSON_STRING,"x",jsonrpc::JSON_STRING,"b",jsonrpc::JSON_STRING, NULL), &AbstractEthStubServer::stateAtI); this->bindAndAddMethod(new jsonrpc::Procedure("transact", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_OBJECT, "aDest",jsonrpc::JSON_STRING,"bData",jsonrpc::JSON_STRING,"sec",jsonrpc::JSON_STRING,"xGas",jsonrpc::JSON_STRING,"xGasPrice",jsonrpc::JSON_STRING,"xValue",jsonrpc::JSON_STRING, NULL), &AbstractEthStubServer::transactI); this->bindAndAddMethod(new jsonrpc::Procedure("txCountAt", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_STRING, "a",jsonrpc::JSON_STRING, NULL), &AbstractEthStubServer::txCountAtI); @@ -120,6 +121,11 @@ class AbstractEthStubServer : public jsonrpc::AbstractServerstorageAt(request["a"].asString(), request["x"].asString()); } + inline virtual void stateAtI(const Json::Value& request, Json::Value& response) + { + response = this->stateAt(request["a"].asString(), request["x"].asString(), request["b"].asString()); + } + inline virtual void transactI(const Json::Value& request, Json::Value& response) { response = this->transact(request["aDest"].asString(), request["bData"].asString(), request["sec"].asString(), request["xGas"].asString(), request["xGasPrice"].asString(), request["xValue"].asString()); @@ -148,6 +154,7 @@ class AbstractEthStubServer : public jsonrpc::AbstractServer