Skip to content

[Frontend] IncomingStreams formatTokenAmount mis-scales already-human amounts #575

@ogazboiz

Description

@ogazboiz

Telegram: https://t.me/+DOylgFv1jyJlNzM0

Why this matters

In frontend/src/components/IncomingStreams.tsx:

function formatTokenAmount(value: number, decimals = 7): string {
  if (!Number.isFinite(value)) return '0.0000000';
  return formatAmount(BigInt(Math.floor(value)), decimals);
}

value here is an already human-scaled token amount (the Stream mapper in lib/dashboard.ts divides raw stroops by 1e7). Passing it through formatAmount(BigInt(Math.floor(value)), 7) re-interprets it as raw base units and floors it, so e.g. 10.5 renders as 0.0000010 instead of 10.5. The Deposited/Withdrawn/Claimable columns in the incoming-streams table therefore show wildly wrong (tiny) numbers.

Acceptance criteria

  • Format the human number directly (e.g. Intl.NumberFormat with up to 7 fraction digits, as IncomingStreamCard does) rather than round-tripping through formatAmount for base units
  • Deposited/withdrawn/claimable display the correct magnitudes

Files to touch

  • frontend/src/components/IncomingStreams.tsx

Out of scope

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programbugSomething isn't workingfrontendFrontend related tasks

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions