Skip to content

feat(mirror): add contract results and logs from mirror node#121

Open
alejandroGM0 wants to merge 3 commits into
hiero-ledger:mainfrom
alejandroGM0:feat/mirrornode-contract-results-logs
Open

feat(mirror): add contract results and logs from mirror node#121
alejandroGM0 wants to merge 3 commits into
hiero-ledger:mainfrom
alejandroGM0:feat/mirrornode-contract-results-logs

Conversation

@alejandroGM0

@alejandroGM0 alejandroGM0 commented May 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds mirror-node support for reading smart contract execution data by contract ID.

This PR introduces typed APIs for:

  • Contract execution results
  • Contract log entries

The new APIs are available through the base mirror-node repository layer and are wired through both Spring Boot and MicroProfile integrations. The sample applications also expose simple HTTP endpoints so the behavior can be tested manually against a configured mirror node.

API Additions

Base Module

Adds two new data records:

  • ContractResult for mirror-node contract execution result payloads
  • ContractLog for mirror-node contract log payloads

Extends ContractRepository with:

  • findResultsById(ContractId contractId)
  • findResultsById(String contractId)
  • findLogsById(ContractId contractId)
  • findLogsById(String contractId)

Extends MirrorNodeClient with:

  • queryContractResults(ContractId contractId)
  • queryContractResults(String contractId)
  • queryContractLogs(ContractId contractId)
  • queryContractLogs(String contractId)

All methods return paged results using the existing Page<T> abstraction.

Spring Boot Integration

The Spring implementation now supports the new contract result and log queries through:

  • MirrorNodeClientImpl
  • MirrorNodeJsonConverterImpl
  • ContractRepository

Additional tests cover repository behavior and JSON conversion for contract result/log responses.

MicroProfile Integration

The MicroProfile implementation mirrors the Spring support:

  • Adds mirror-node client methods for contract results and logs
  • Adds JSON conversion for the new response types
  • Adds repository and converter tests

Sample Endpoints

Both sample applications now expose:

  • GET /contracts/{contractId}/results
  • GET /contracts/{contractId}/logs

Each endpoint returns a JSON object containing:

  • contractId
  • pageIndex
  • size
  • hasNext
  • data

This makes it easy to verify the new contract result and log queries against a live mirror node.

Testing

Added coverage for:

  • ContractRepositoryImpl
  • Spring ContractRepositoryTest
  • Spring MirrorNodeJsonConverterImplContractTest
  • MicroProfile ContractRepositoryTest
  • MicroProfile MirrorNodeJsonConverterImplContractTest

Notes

image image

Signed-off-by: Alejandro <26930485+alejandroGM0@users.noreply.github.com>
Handle nullable contract result fields from mirror node responses and expose contract logs/results lookup endpoints in Spring and MicroProfile samples.

Signed-off-by: Alejandro <26930485+alejandroGM0@users.noreply.github.com>
Signed-off-by: Alejandro <26930485+alejandroGM0@users.noreply.github.com>
@alejandroGM0 alejandroGM0 marked this pull request as draft May 1, 2026 15:22
@alejandroGM0 alejandroGM0 marked this pull request as ready for review May 1, 2026 15:31
@aceppaluni

Copy link
Copy Markdown
Contributor

@alejandroGM0 can you link the issue this is solving?

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.

2 participants