Skip to content

feat: implement smart contract event and log observation API#129

Open
imshubham22apr-gif wants to merge 1 commit into
hiero-ledger:mainfrom
imshubham22apr-gif:feat/issue-73-contract-logs
Open

feat: implement smart contract event and log observation API#129
imshubham22apr-gif wants to merge 1 commit into
hiero-ledger:mainfrom
imshubham22apr-gif:feat/issue-73-contract-logs

Conversation

@imshubham22apr-gif

Copy link
Copy Markdown

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Smart Contract Event and Log Observation API

1 participant