You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Token decimal is immutable and can be retrieved from /api/v1/tokens/{id}.
We can't change how the value is presented in the existing property since that'll be a breaking change and cause issues for applications treating it properly.
If I, as an end-user, fetch my balance for 50 tokens. I now need to call the mirror node 51 total times to be able to correctly use that information (balance + decimals).
It's not a breaking change to add a new decimals field to the response from /api/v1/accounts/{id}/tokens.
It would not be performant to join on token for /api/v1/accounts/{id}/tokens to add decimal since they have different distribution columns for our sharded database.
Instead, we could fix the bug that makes /api/v1/tokens?token.id=0.0.X&token.id=0.0.Y not work by ensuring it uses an IN clause. However, the list API doesn't show decimals currently so would require a HIP to add the field. But if that was in place your use case would only require 2 queries. Also note that decimals is immutable so even though it might require 50 lookups now you could cache it indefinitely within the app.
steven-sheehy
changed the title
Decimals are not returned with the token balance in the new token relationship API
HIP-873: Decimals are not returned with the token balance in the new token relationship API
Feb 3, 2024
Description
A token balance without the associated number of decimals to know how to interpret that balance is dangerous to present to an end user.
Steps to reproduce
/api/v1/accounts/{id}/tokens
API.Additional context
No response
Hedera network
mainnet, testnet, previewnet
Version
v1
Operating system
None
The text was updated successfully, but these errors were encountered: