@@ -4,17 +4,28 @@ import React, { useState } from 'react';
44import type { Stream } from '@/lib/dashboard' ;
55import { useStreamingAmount } from '@/hooks/useStreamingAmount' ;
66import toast from 'react-hot-toast' ;
7- import { formatAmount } from '@/lib/amount' ;
7+
88
99interface IncomingStreamsProps {
1010 streams : Stream [ ] ;
1111 onWithdraw : ( stream : Stream ) => Promise < void > ;
1212 withdrawingStreamId ?: string | null ;
1313}
1414
15- function formatTokenAmount ( value : number , decimals : number = 7 ) : string {
15+ /**
16+ * Format an already-human-scaled token amount (e.g. 10.5) for display.
17+ *
18+ * Values coming from the Stream interface have already been divided by 1e7
19+ * (stroops → token units) by the dashboard mapper, so we must NOT re-scale
20+ * them through formatAmount. Instead we format the number directly using
21+ * Intl.NumberFormat, consistent with IncomingStreamCard.
22+ */
23+ function formatTokenAmount ( value : number , maximumFractionDigits = 7 ) : string {
1624 if ( ! Number . isFinite ( value ) ) return '0.0000000' ;
17- return formatAmount ( BigInt ( Math . floor ( value ) ) , decimals ) ;
25+ return new Intl . NumberFormat ( 'en-US' , {
26+ minimumFractionDigits : 0 ,
27+ maximumFractionDigits,
28+ } ) . format ( value ) ;
1829}
1930
2031const ClaimableAmount : React . FC < { stream : Stream } > = ( { stream } ) => {
0 commit comments