-
Notifications
You must be signed in to change notification settings - Fork 75
feat: implemented rest of the TCK endpt for FileService. #1252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
rwalworth
merged 4 commits into
hiero-ledger:main
from
Adityarya11:feat/remaining-file-TCK-endpt
Mar 19, 2026
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
d977886
feat: implemented rest of the TCK endpt for FileService.
Adityarya11 cdd6bf3
clang-format
Adityarya11 72be666
sanitized the code to match existing patterns.
Adityarya11 c79b5f8
Merge branch 'main' into feat/remaining-file-TCK-endpt
Adityarya11 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Adityarya11 marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| #ifndef HIERO_TCK_CPP_APPEND_FILE_PARAMS_H_ | ||
| #define HIERO_TCK_CPP_APPEND_FILE_PARAMS_H_ | ||
|
|
||
| #include "common/CommonTransactionParams.h" | ||
| #include "json/JsonUtils.h" | ||
|
|
||
| #include <nlohmann/json.hpp> | ||
| #include <optional> | ||
| #include <string> | ||
|
|
||
| namespace Hiero::TCK::FileService | ||
| { | ||
| /** | ||
| * Struct to hold the arguments for an `appendFile` JSON-RPC method call. | ||
| */ | ||
| struct AppendFileParams | ||
| { | ||
| /** | ||
| * The ID of the file to append to. | ||
| */ | ||
| std::optional<std::string> mFileId; | ||
|
|
||
| /** | ||
| * The contents of the file. | ||
| */ | ||
| std::string mContents; | ||
|
|
||
| /** | ||
| * Maximum number of chunks allowed for this transaction | ||
| */ | ||
| std::optional<int> mMaxChunks; | ||
|
|
||
| /** | ||
| * Size of each chunk in bytes | ||
| */ | ||
| std::optional<int> mChunkSize; | ||
|
|
||
| /** | ||
| * Any parameters common to all transaction types. | ||
| */ | ||
| std::optional<CommonTransactionParams> mCommonTxParams; | ||
| }; | ||
|
|
||
| } // namespace Hiero::TCK::FileService | ||
|
|
||
| namespace nlohmann | ||
| { | ||
| /** | ||
| * JSON serializer template specialisation required to convert AppendFileParams argument Properly | ||
| */ | ||
| template<> | ||
| struct [[maybe_unused]] adl_serializer<Hiero::TCK::FileService::AppendFileParams> | ||
| { | ||
| /** | ||
| * Convert a Json Object to a AppendFileParams | ||
| * | ||
| * @param jsonFrom The JSON object with which to fill the AppendFileParams | ||
| * @param params The AppendFileParams to fill with the JSON object. | ||
| */ | ||
| static void from_json(const json& jsonFrom, Hiero::TCK::FileService::AppendFileParams& params) | ||
| { | ||
| params.mFileId = Hiero::TCK::getOptionalJsonParameter<std::string>(jsonFrom, "fileId"); | ||
|
|
||
| params.mContents = Hiero::TCK::getRequiredJsonParameter<std::string>(jsonFrom, "contents"); | ||
|
|
||
| params.mMaxChunks = Hiero::TCK::getOptionalJsonParameter<int>(jsonFrom, "maxChunks"); | ||
|
|
||
| params.mChunkSize = Hiero::TCK::getOptionalJsonParameter<int>(jsonFrom, "chunkSize"); | ||
|
|
||
| params.mCommonTxParams = | ||
| Hiero::TCK::getOptionalJsonParameter<Hiero::TCK::CommonTransactionParams>(jsonFrom, "commonTransactionParams"); | ||
| } | ||
| }; | ||
|
|
||
| } // namespace nlohmann | ||
|
|
||
| #endif // HIERO_TCK_CPP_APPEND_FILE_PARAMS_H_ |
rwalworth marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| #ifndef HIERO_TCK_CPP_GET_FILE_CONTENTS_PARAMS_H_ | ||
| #define HIERO_TCK_CPP_GET_FILE_CONTENTS_PARAMS_H_ | ||
|
|
||
| #include "json/JsonUtils.h" | ||
|
|
||
| #include <nlohmann/json.hpp> | ||
| #include <optional> | ||
| #include <string> | ||
|
|
||
| namespace Hiero::TCK::FileService | ||
| { | ||
| /** | ||
| * Struct to hold the arguments for a `getFileContents` JSON-RPC method call. | ||
| */ | ||
| struct GetFileContentsParams | ||
| { | ||
| /** | ||
| * The ID of the file to query. | ||
| */ | ||
| std::string mFileId; | ||
|
|
||
| /** | ||
| * Explicit payment amount for the query in tinybars. | ||
| */ | ||
| std::optional<std::string> mQueryPayment; | ||
|
|
||
| /** | ||
| * Maximum payment amount for the query in tinybars. | ||
| */ | ||
| std::optional<std::string> mMaxQueryPayment; | ||
| }; | ||
|
|
||
| } // namespace Hiero::TCK::FileService | ||
|
|
||
| namespace nlohmann | ||
| { | ||
| /** | ||
| * JSON serializer template specialisation required to convert GetFileContentsParams arguments properly | ||
| */ | ||
| template<> | ||
| struct [[maybe_unused]] adl_serializer<Hiero::TCK::FileService::GetFileContentsParams> | ||
| { | ||
| /** | ||
| * Convert a Json Object to a GetFileContentsParams | ||
| * | ||
| * @param jsonFrom The JSON object with which to fill the GetFileContentsParams | ||
| * @param params The GetFileContentsParams to fill with the JSON object. | ||
| */ | ||
| static void from_json(const json& jsonFrom, Hiero::TCK::FileService::GetFileContentsParams& params) | ||
| { | ||
| params.mFileId = Hiero::TCK::getRequiredJsonParameter<std::string>(jsonFrom, "fileId"); | ||
|
|
||
| params.mQueryPayment = Hiero::TCK::getOptionalJsonParameter<std::string>(jsonFrom, "queryPayment"); | ||
|
|
||
| params.mMaxQueryPayment = Hiero::TCK::getOptionalJsonParameter<std::string>(jsonFrom, "maxQueryPayment"); | ||
| } | ||
| }; | ||
|
|
||
| } // namespace nlohmann | ||
|
|
||
| #endif // HIERO_TCK_CPP_GET_FILE_CONTENTS_PARAMS_H_ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| #ifndef HIERO_TCK_CPP_GET_FILE_INFO_PARAMS_H_ | ||
| #define HIERO_TCK_CPP_GET_FILE_INFO_PARAMS_H_ | ||
|
|
||
| #include "json/JsonUtils.h" | ||
|
|
||
| #include <nlohmann/json.hpp> | ||
| #include <optional> | ||
| #include <string> | ||
|
|
||
| namespace Hiero::TCK::FileService | ||
| { | ||
| /** | ||
| * Struct to hold the arguments for a `getFileInfo` JSON-RPC method call. | ||
| */ | ||
| struct GetFileInfoParams | ||
| { | ||
| /** | ||
| * The ID of the file to query. | ||
| */ | ||
| std::optional<std::string> mFileId; | ||
| }; | ||
|
|
||
| } // namespace Hiero::TCK::FileService | ||
|
|
||
| namespace nlohmann | ||
| { | ||
| /** | ||
| * JSON serializer template specialization required to convert GetFileInfoParams arguments properly. | ||
| */ | ||
| template<> | ||
| struct [[maybe_unused]] adl_serializer<Hiero::TCK::FileService::GetFileInfoParams> | ||
| { | ||
| static void from_json(const json& jsonFrom, Hiero::TCK::FileService::GetFileInfoParams& params) | ||
| { | ||
| params.mFileId = Hiero::TCK::getOptionalJsonParameter<std::string>(jsonFrom, "fileId"); | ||
| } | ||
| }; | ||
|
|
||
| } // namespace nlohmann | ||
|
|
||
| #endif // HIERO_TCK_CPP_GET_FILE_INFO_PARAMS_H_ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.