feat(mirror): add contract results and logs from mirror node#121
Open
alejandroGM0 wants to merge 3 commits into
Open
feat(mirror): add contract results and logs from mirror node#121alejandroGM0 wants to merge 3 commits into
alejandroGM0 wants to merge 3 commits into
Conversation
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>
Contributor
|
@alejandroGM0 can you link the issue this is solving? |
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.
Summary
Adds mirror-node support for reading smart contract execution data by contract ID.
This PR introduces typed APIs for:
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:
ContractResultfor mirror-node contract execution result payloadsContractLogfor mirror-node contract log payloadsExtends
ContractRepositorywith:findResultsById(ContractId contractId)findResultsById(String contractId)findLogsById(ContractId contractId)findLogsById(String contractId)Extends
MirrorNodeClientwith: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:
MirrorNodeClientImplMirrorNodeJsonConverterImplContractRepositoryAdditional tests cover repository behavior and JSON conversion for contract result/log responses.
MicroProfile Integration
The MicroProfile implementation mirrors the Spring support:
Sample Endpoints
Both sample applications now expose:
GET /contracts/{contractId}/resultsGET /contracts/{contractId}/logsEach endpoint returns a JSON object containing:
contractIdpageIndexsizehasNextdataThis makes it easy to verify the new contract result and log queries against a live mirror node.
Testing
Added coverage for:
ContractRepositoryImplContractRepositoryTestMirrorNodeJsonConverterImplContractTestContractRepositoryTestMirrorNodeJsonConverterImplContractTestNotes