hashgraph / hashgraph/hedera-sdk-reference
Add support to return token balances for an account and contract account
- Dominant language
- HTML
- Stars
- 7
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
### Problem
HIP: https://hips.hedera.com/hip/hip-367
The token balances (tokens that are created via Hedera Token Service) information for accounts and smart contract accounts have been deprecated. This needs to be replaced with the mirror node API that provides the data.
The fields in the SDKs were deprecated for the HAPI queries that were impacted:
**HAPI**
Account Balance Query:
- `repeated TokenBalance tokenBalances = 4`
Account Info Query:
- `repeated TokenRelationship tokenRelationships = 15`
Contract Info Query:
- `repeated TokenRelationship tokenRelationships = 11;`
https://github.com/hashgraph/hedera-sdk-java/issues/1053
https://github.com/hashgraph/hedera-sdk-js/issues/1192
Mirror node released a REST API that provides the token relationships information that was deprecated in the Hedera APIs (protobufs).
https://github.com/hashgraph/hedera-mirror-node/issues/4142
https://mainnet-public.mirrornode.hedera.com/api/v1/docs/#/tokens/listTokenBalancesById
https://mainnet-public.mirrornode.hedera.com/api/v1/docs/#/accounts/listTokenRelationshipByAccountId
**Goal**
The SDK should still support returning the token balances for the queries that deprecated the field for token balances, but instead of querying the data from consensus nodes, they should use the mirror node rest API
### Solution
Propose a design for returning token balances from the mirror node API.
### Alternatives
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.