fix(api): format stream amounts with the token's real decimals - #28
Open
jayteemoney wants to merge 1 commit into
Open
jayteemoney wants to merge 1 commit into
jayteemoney wants to merge 1 commit into
Conversation
/api/streams/:id formatted every amount as if the token had 8 decimals, so USDA (6 decimals) showed 100x too small: stream 11 read "0.012" instead of "1.20". Decimals are now read from the token contract's SIP-010 get-decimals and cached per instance, so any token formats correctly, listed or not. If the read fails the formatted fields are null rather than a wrong number. Adds tokenDecimals to the response. Verified on a local mainnet build: all 11 streams (USDA) format correctly, and get-decimals parses as 8 for sBTC, ALEX and xBTC. Claude-Session: https://claude.ai/code/session_011DndgWvvL6sUfzTgmC67Wq
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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.
Bug
/api/streams/:idformatted every amount as 8 decimals. USDA has 6, so stream 11 showed0.012instead of1.20.Fix
get-decimals), cached per instance. Works for any SIP-010 token, not just listed ones.nullinstead of wrong.tokenDecimalsfield in the response. Guide updated.Verified
1.20.get-decimalsparses as 8 for sBTC, ALEX, xBTC.Not changed:
/api/daos/:admintotalDepositedFormattedsums deposits across tokens, so no single decimal scale is correct for it.🤖 Generated with Claude Code
https://claude.ai/code/session_011DndgWvvL6sUfzTgmC67Wq