Skip to content

fix(analytics): use token decimals instead of hardcoded 7 (FlowwStar/FlowStar#367)#404

Open
jdjioe5-cpu wants to merge 1 commit into
FlowwStar:mainfrom
jdjioe5-cpu:fix/issue-367-token-decimals
Open

fix(analytics): use token decimals instead of hardcoded 7 (FlowwStar/FlowStar#367)#404
jdjioe5-cpu wants to merge 1 commit into
FlowwStar:mainfrom
jdjioe5-cpu:fix/issue-367-token-decimals

Conversation

@jdjioe5-cpu

Copy link
Copy Markdown

Closes #367. Adds decimals field to TokenShare type and uses token.decimals instead of hardcoded 7 in formatTokenAmount at charts.tsx:67 and :87.

)

Closes FlowwStar#367.

- components/analytics/charts.tsx: add `decimals: number` to TokenShare
  and replace the hardcoded `formatTokenAmount(amount, 7)` at lines 67
  and 87 with `formatTokenAmount(amount, token.decimals)` so custom
  tokens render with their own decimals in both the top-tokens card and
  the token-distribution card.
- app/app/analytics/page.tsx: extend the AnalyticsSnapshot.TokenShare
  shape (both tokenShares and topTokens) to include `decimals`, and
  copy `decimals` from the existing tokenGroups entry in the
  tokenShares constructor at line ~122.

No behavior change for XLM (decimals=7). Custom-token analytics now
display the correct decimal place.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

good first issue: use actual token decimals instead of hardcoded 7 in analytics charts

1 participant