feat: implement smart contract event and log observation API#129
Open
imshubham22apr-gif wants to merge 1 commit into
Open
feat: implement smart contract event and log observation API#129imshubham22apr-gif wants to merge 1 commit into
imshubham22apr-gif wants to merge 1 commit into
Conversation
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.
This PR implements the high-level Smart Contract Event and Log Observation API, allowing developers to easily monitor and react to EVM events emitted by smart contracts on the Hiero network.
Previously, developers had to manually poll and parse raw logs. This update provides a structured data model and automated polling mechanism integrated directly into the Spring and MicroProfile modules.
Key Changes:
Enhanced Data Model: Updated ContractLog to include all EVM-specific fields (address, bloom, blockHash, etc.).
Repository Abstraction: Introduced ContractLogRepository for simple, abstracted log querying by ContractId.
Automated Observation: Added EventObserver and HieroEventSubscriber (Spring) to handle background polling and event decoding.
REST API Support: Updated the Mirror Node client to support the /api/v1/contracts/{id}/results/logs endpoint.
Sample Applications: Added a new hiero-enterprise-events-sample and updated existing samples to demonstrate log fetching and real-time observation.
Related issue(s): Fixes #73
Notes for reviewer:
The implementation supports both Spring Boot (Jackson) and MicroProfile (JSON-B) for JSON parsing.
A background polling thread (hiero-event-observer) is used to monitor for new logs without blocking the main application.
Verified the implementation with a new integration test suite (EventObservationIntegrationTest).