feat(spring-sample): Reorganize Hiero API endpoints into domain-driven controllers#138
Open
Twiineenock wants to merge 9 commits into
Open
feat(spring-sample): Reorganize Hiero API endpoints into domain-driven controllers#138Twiineenock wants to merge 9 commits into
Twiineenock wants to merge 9 commits into
Conversation
…trollers - Created AccountController and BlockController - Added DTOs for account lifecycle operations - Removed legacy HieroEndpoint.java - Ensured Spring Boot 3 compatibility with explicit @PathVariable names Signed-off-by: Twiineenock <twiineenockfox@gmail.com>
Signed-off-by: Twiineenock <twiineenockfox@gmail.com>
Signed-off-by: Twiineenock <twiineenockfox@gmail.com>
Signed-off-by: Twiineenock <twiineenockfox@gmail.com>
Signed-off-by: Twiineenock <twiineenockfox@gmail.com>
Signed-off-by: Twiineenock <twiineenockfox@gmail.com>
605a463 to
64d14d3
Compare
Signed-off-by: Twiineenock <twiineenockfox@gmail.com>
2 tasks
- Implement input trimming across all controllers to prevent ID parsing failures. - Add NFT association endpoint and NftAssociateRequest DTO. - Organize Swagger schemas into logical groups using @Schema(name). - Enforce logical resource ordering in Swagger UI via custom OpenApiCustomizer. - Resolve file creation range errors and topic message parsing issues. Signed-off-by: Twiineenock <twiineenockfox@gmail.com>
…abilities Signed-off-by: Twiineenock <twiineenockfox@gmail.com>
Member
|
From my point of view this is not a sample. It should be a project on its own that provides REST based Access to a Hiero network. In the end it is a REST proxy for Hiero. What we should do:
Very good work! |
Contributor
Author
Thanks @hendrikebbers |
Contributor
Author
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

Overview
This PR initiates the transition from a monolithic API structure to a modular, domain-driven architecture for the Hiero Enterprise Spring Boot sample. By introducing dedicated controllers and structured DTOs, we improve the maintainability, discoverability, and scalability of the API surface.
Core Architectural Changes
HieroEndpoint.javawith domain-specific controllers (AccountController,BlockController).dtopackage to manage request and response payloads, ensuring clear API contracts.@PathVariableand@RequestBodyto ensure compatibility with modern Spring reflection standards.Endpoints Implemented
1. Account Resource (
/api/v1/hiero/accounts)/: Creates a new Hiero account (returnsaccountId,publicKey, andprivateKey)./: Updates account metadata such as memos or keys./: Deletes a Hiero account using its private key./balance/{accountId}: Fetches the real-time Hbar balance from the network./info/{accountId}: Retrieves detailed account metadata from the Hiero Mirror Node.2. Block Resource (
/api/v1/hiero/blocks)/: Returns a paginated list of the most recent blocks processed by the network./{number}: Fetches detailed information for a specific block by its sequence number.Verification Results
Fungible Token Resource Endpoints
/api/v1/hiero/fungible-token— Create a new fungible token./api/v1/hiero/fungible-token/{tokenId}— Retrieve detailed information and metadata for a specific token./api/v1/hiero/fungible-token/{tokenId}/mint— Mint additional units of a token to the treasury./api/v1/hiero/fungible-token/{tokenId}/transfer— Transfer tokens between accounts (requires sender credentials).NFT Resource Implementation
Added support for core NFT lifecycle operations by integrating the
NftClientandNftRepositoryservices. This addition includes:/api/v1/hiero/nfts: Create a new NFT collection./api/v1/hiero/nfts/{nftId}: Retrieve NFT collection metadata./api/v1/hiero/nfts/{nftId}/mint: Mint unique NFT instances./api/v1/hiero/nfts/{nftId}/serial/{serial}: Fetch a specific NFT instance./api/v1/hiero/nfts/{nftId}/transfer: Securely transfer NFT ownership.All endpoints have been verified on the testnet and utilize dedicated request DTOs for structured data handling.
Consensus (Topic) Resource
Exposes full lifecycle management for Hiero Topics and HCS messages.
POST /api/v1/hiero/topics: Create a new topic.PUT /api/v1/hiero/topics: Update topic configuration (memo, keys).DELETE /api/v1/hiero/topics/{topicId}: Delete a topic.POST /api/v1/hiero/topics/message: Submit a message to a topic.GET /api/v1/hiero/topics/{topicId}/info: Retrieve topic metadata via Mirror Node.GET /api/v1/hiero/topics/{topicId}/message: Retrieve all messages for a topic.GET /api/v1/hiero/topics/{topicId}/message/{sequenceNumber}: Retrieve a specific message by sequence number.Network Resource
Provides global network-wide information including rates, fees, and supply statistics.
/api/v1/hiero/network/exchange-rate: Retrieve current and next HBAR/USD exchange rates./api/v1/hiero/network/fee: Retrieve a comprehensive list of network transaction fees./api/v1/hiero/network/stake: Retrieve network staking reward and pool information./api/v1/hiero/network/supplies: Retrieve HBAR supply details (released and total supply).File Resource
Manages Hedera on-chain files including creation, updates, and metadata queries.
/api/v1/hiero/files: Create a new file (supports Base64 content)./api/v1/hiero/files/{fileId}: Update file content or expiration time./api/v1/hiero/files/{fileId}: Delete an existing file./api/v1/hiero/files/{fileId}/content: Retrieve file content as a Base64 string./api/v1/hiero/files/{fileId}/size: Retrieve the current size of the file in bytes.