From 8a359c7e6e79ebc9c308aa13ef81d9727d6e5fb0 Mon Sep 17 00:00:00 2001 From: gsstoykov Date: Wed, 16 Oct 2024 17:16:02 +0300 Subject: [PATCH] feat: Add Stub for AddressBookService Signed-off-by: gsstoykov --- HederaApi.cmake | 4 ++-- src/sdk/main/include/impl/Node.h | 6 ++++++ src/sdk/main/src/impl/Node.cc | 6 ++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/HederaApi.cmake b/HederaApi.cmake index bd7766013..6b5275dc0 100644 --- a/HederaApi.cmake +++ b/HederaApi.cmake @@ -1,5 +1,5 @@ -set(HAPI_LIBRARY_HASH "46507656510baa279f3ce6d94e0044ef47128ba051467a3748ed55e6cb779db3" CACHE STRING "Use the configured hash to verify the Hedera API protobuf library release") -set(HAPI_LIBRARY_URL "https://github.com/hashgraph/hedera-protobufs-cpp/releases/download/v0.54.0/hapi-library-bb992044.tar.gz" CACHE STRING "Use the configured URL to download the Hedera API protobuf library package") +set(HAPI_LIBRARY_HASH "248299d525ec55425b755565726fc40a9bb9aa8335447f7c07956c9ace1ef64c" CACHE STRING "Use the configured hash to verify the Hedera API protobuf library release") +set(HAPI_LIBRARY_URL "https://github.com/hashgraph/hedera-protobufs-cpp/releases/download/v0.55.0/hapi-library-32c2a4a2.tar.gz" CACHE STRING "Use the configured URL to download the Hedera API protobuf library package") set(HAPI_LOCAL_LIBRARY_PATH "" CACHE STRING "Overrides the configured HAPI_LIBRARY_URL setting and instead uses the local path to retrieve the artifacts") diff --git a/src/sdk/main/include/impl/Node.h b/src/sdk/main/include/impl/Node.h index 953754b14..07eb4f0f0 100644 --- a/src/sdk/main/include/impl/Node.h +++ b/src/sdk/main/include/impl/Node.h @@ -20,6 +20,7 @@ #ifndef HEDERA_SDK_CPP_IMPL_NODE_H_ #define HEDERA_SDK_CPP_IMPL_NODE_H_ +#include #include #include #include @@ -236,6 +237,11 @@ class Node : public BaseNode */ std::unique_ptr mUtilStub = nullptr; + /** + * Pointer to the gRPC stub used to communicate with the address book service living on the remote node. + */ + std::unique_ptr mAddressBookStub = nullptr; + /** * The AccountId that runs the remote node represented by this Node. */ diff --git a/src/sdk/main/src/impl/Node.cc b/src/sdk/main/src/impl/Node.cc index 41b6a57e9..eebd8827c 100644 --- a/src/sdk/main/src/impl/Node.cc +++ b/src/sdk/main/src/impl/Node.cc @@ -105,6 +105,8 @@ grpc::Status Node::submitTransaction(proto::TransactionBody::DataCase funcEnum, switch (funcEnum) { + case proto::TransactionBody::DataCase::kNodeCreate: + return mAddressBookStub->createNode(&context, transaction, response); case proto::TransactionBody::DataCase::kConsensusCreateTopic: return mConsensusStub->createTopic(&context, transaction, response); case proto::TransactionBody::DataCase::kConsensusDeleteTopic: @@ -149,8 +151,6 @@ grpc::Status Node::submitTransaction(proto::TransactionBody::DataCase funcEnum, return mFileStub->updateFile(&context, transaction, response); case proto::TransactionBody::DataCase::kFreeze: return mFreezeStub->freeze(&context, transaction, response); - case proto::TransactionBody::DataCase::kNodeCreate: - return mFreezeStub->freeze(&context, transaction, response); case proto::TransactionBody::DataCase::kScheduleCreate: return mScheduleStub->createSchedule(&context, transaction, response); case proto::TransactionBody::DataCase::kScheduleDelete: @@ -288,6 +288,7 @@ void Node::initializeStubs() if (!mSmartContractStub) mSmartContractStub = proto::SmartContractService::NewStub(getChannel()); if (!mTokenStub) mTokenStub = proto::TokenService::NewStub(getChannel()); if (!mUtilStub) mUtilStub = proto::UtilService::NewStub(getChannel()); + if (!mAddressBookStub) mAddressBookStub = proto::AddressBookService::NewStub(getChannel()); // clang-format on } @@ -303,6 +304,7 @@ void Node::closeStubs() mSmartContractStub = nullptr; mTokenStub = nullptr; mUtilStub = nullptr; + mAddressBookStub = nullptr; } } // namespace Hedera::internal