Skip to content

Commit

Permalink
Fix get contract deployed in latest block, request returns result object
Browse files Browse the repository at this point in the history
  • Loading branch information
Doy-lee committed Jul 5, 2024
1 parent bb394ba commit 1ef9490
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/provider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ std::string Provider::getContractDeployedInLatestBlock() {
throw std::runtime_error("Failed to get the latest block");

nlohmann::json blockJson = *result;
for (const auto& tx : blockJson["result"]["transactions"]) {
for (const auto& tx : blockJson["transactions"]) {
std::optional<nlohmann::json> transactionReceipt = getTransactionReceipt(tx["hash"].get<std::string>());
if (transactionReceipt.has_value())
return transactionReceipt->at("contractAddress").get<std::string>();
Expand Down

0 comments on commit 1ef9490

Please sign in to comment.