Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions frontend/src/components/IncomingStreams.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,28 @@ import React, { useState } from 'react';
import type { Stream } from '@/lib/dashboard';
import { useStreamingAmount } from '@/hooks/useStreamingAmount';
import toast from 'react-hot-toast';
import { formatAmount } from '@/lib/amount';


interface IncomingStreamsProps {
streams: Stream[];
onWithdraw: (stream: Stream) => Promise<void>;
withdrawingStreamId?: string | null;
}

function formatTokenAmount(value: number, decimals: number = 7): string {
/**
* Format an already-human-scaled token amount (e.g. 10.5) for display.
*
* Values coming from the Stream interface have already been divided by 1e7
* (stroops → token units) by the dashboard mapper, so we must NOT re-scale
* them through formatAmount. Instead we format the number directly using
* Intl.NumberFormat, consistent with IncomingStreamCard.
*/
function formatTokenAmount(value: number, maximumFractionDigits = 7): string {
if (!Number.isFinite(value)) return '0.0000000';
return formatAmount(BigInt(Math.floor(value)), decimals);
return new Intl.NumberFormat('en-US', {
minimumFractionDigits: 0,
maximumFractionDigits,
}).format(value);
}

const ClaimableAmount: React.FC<{ stream: Stream }> = ({ stream }) => {
Expand Down
Loading