hashgraph / hedera-sdk-go

Hedera™ Hashgraph SDK for Go
https://docs.hedera.com/docs/hedera-sdks
Apache License 2.0
108 stars 65 forks source link

feat(HIP-367) Mirror Node Queries #930

Closed gsstoykov closed 5 months ago

gsstoykov commented 5 months ago

This PR introduces the SDK capability for querying AccountInfo, ContractInfo, AccountBalance and TokenRelationships from the Mirror Node. Currently not all Mirror Node queries will be used by the SDK but the AccountInfo and TokenRelationship queries are needed in order to populate the SDK fields for TokenBalances and TokenRelationships thus resolving the deprecations described in https://github.com/hashgraph/hedera-sdk-reference/issues/144.

Related issue(s):

Fixes https://github.com/hashgraph/hedera-sdk-go/issues/841

Notes for reviewer: Currently the GO SDK has no straightforward way of verifying JSON objects. A note for future implementations would be adding a more sophisticated JSON validation.

At some point we should discuss approaches for testing the Mirror Node responses. Currently the responses are only validated through the flows of the integration tests. All tests including AccountInfo, ContractInfo, AccountBalance and TokenRelationships serve as validation of the queries.

Tests and examples are now dependant on Mirror Node update times so data from the queries will be assumed to be valid after a 2-3 second delay. Currently there is no way for working around that delay time as it is dependant on the Mirror Node itself.

Checklist

codecov[bot] commented 5 months ago

Codecov Report

Attention: Patch coverage is 71.07438% with 35 lines in your changes are missing coverage. Please review.

Project coverage is 72.86%. Comparing base (a3f6b87) to head (6647b38).

Files Patch % Lines
mirror_node_gateway.go 67.56% 9 Missing and 3 partials :warning:
contract_info_query.go 40.00% 6 Missing and 3 partials :warning:
account_info_query.go 57.89% 4 Missing and 4 partials :warning:
account_balance_query.go 68.42% 3 Missing and 3 partials :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #930 +/- ## ========================================== + Coverage 72.75% 72.86% +0.10% ========================================== Files 165 167 +2 Lines 23251 23370 +119 ========================================== + Hits 16917 17028 +111 + Misses 5653 5638 -15 - Partials 681 704 +23 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

sonarcloud[bot] commented 5 months ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud