Skip to content

Commit

Permalink
Fix rebase onto C++20 branch errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Doy-lee committed May 15, 2024
1 parent 67dfa89 commit be110ea
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 17 deletions.
4 changes: 2 additions & 2 deletions include/ethyl/signer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ class Signer {
std::vector<unsigned char> sign(std::string_view hash, std::span<const unsigned char> seckey);

// Client usage methods
std::vector<unsigned char> signMessage(const std::string& message, const std::vector<unsigned char>& seckey);
std::string signTransaction(Transaction& tx, const std::vector<unsigned char>& seckey);
std::vector<unsigned char> signMessage(std::string_view message, std::span<const unsigned char> seckey);
std::string signTransaction(Transaction& tx, std::span<const unsigned char> seckey);

void populateTransaction(Transaction& tx, std::string sender_address);
std::string sendTransaction(Transaction& tx, std::span<const unsigned char> seckey);
Expand Down
20 changes: 5 additions & 15 deletions src/provider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,12 @@

namespace ethyl
{
<<<<<<< HEAD
Provider::Provider(std::string name, std::string url)
: clientName{std::move(name)}, url{std::move(url)} {
// Initialize client
=======
bool Provider::addClient(std::string name, std::string url) {
bool result = url.size();
if (result) {
clients.emplace_back(Client{std::move(name), std::move(url)});
}
return result;
>>>>>>> 589a2a9 (Support multiple RPC backends/backup clients)
}

bool Provider::connectToNetwork() {
Expand All @@ -49,19 +43,15 @@ void Provider::disconnectFromNetwork() {
std::cout << "Disconnected from the Ethereum network.\n";
}

<<<<<<< HEAD
cpr::Response Provider::makeJsonRpcRequest(std::string_view method, const nlohmann::json& params) {
if (url.str() == "")
throw std::runtime_error("No URL provided to provider");
=======
cpr::Response Provider::makeJsonRpcRequest(const std::string& method, const nlohmann::json& params, std::optional<std::chrono::milliseconds> timeout) {
cpr::Response Provider::makeJsonRpcRequest(std::string_view method,
const nlohmann::json& params,
std::optional<std::chrono::milliseconds> timeout) {
if (clients.empty()) {
throw std::runtime_error(
"No clients were set for the provider. Ensure that a client was "
"added to the provider before issuing a request.");
}

>>>>>>> 589a2a9 (Support multiple RPC backends/backup clients)
nlohmann::json bodyJson;
bodyJson["jsonrpc"] = "2.0";
bodyJson["method"] = method;
Expand Down Expand Up @@ -191,7 +181,7 @@ uint64_t Provider::evm_increaseTime(std::chrono::seconds seconds) {
nlohmann::json params = nlohmann::json::array();
params.push_back(seconds.count());

cpr::Response response = makeJsonRpcRequest("evm_increaseTime", params);
cpr::Response response = makeJsonRpcRequest("evm_increaseTime", params, connectTimeout);
if (response.status_code != 200) {
throw std::runtime_error("Unable to set time");
}
Expand All @@ -205,7 +195,7 @@ uint64_t Provider::evm_increaseTime(std::chrono::seconds seconds) {
} else if (responseJson["result"].is_null()) {
throw std::runtime_error("Null result in response");
}
response = makeJsonRpcRequest("evm_mine", nlohmann::json::array());
response = makeJsonRpcRequest("evm_mine", nlohmann::json::array(), connectTimeout);
if (response.status_code != 200) {
throw std::runtime_error("Unable to set time");
}
Expand Down

0 comments on commit be110ea

Please sign in to comment.