11import type { FaucetBalances } from '../hooks/useBalances' ;
22import { useConfig } from '../hooks/useConfig' ;
3+ import { btcToSats } from '../utils' ;
4+ import { formatBTC } from '../utils' ;
35
46interface FaucetBalanceProps {
57 faucet : FaucetBalances ;
68 title : string ;
79}
810
9- function formatSats ( sats : number ) : string {
10- if ( sats === 0 ) return '0 SATS' ;
11-
12- const formattedNumber = sats . toLocaleString ( 'en-US' ) ;
13- return `${ formattedNumber } SATS` ;
14- }
15-
16- function getHealthStatus ( balanceSats : number , thresholdSats : number ) : string {
11+ function getHealthStatus ( balanceSats : number , thresholdBtc : number ) : string {
12+ const thresholdSats = btcToSats ( thresholdBtc ) ;
1713 return balanceSats >= thresholdSats ? 'Healthy' : 'Low' ;
1814}
1915
@@ -24,12 +20,12 @@ export default function FaucetBalance({ faucet, title }: FaucetBalanceProps) {
2420 {
2521 name : 'Signet wallet' ,
2622 balance_sats : faucet . l1_balance_sats ,
27- threshold_sats : config . faucetBalanceSatsThresholds . signet ,
23+ threshold_btc : config . faucetBalanceBtcThresholds . signet ,
2824 } ,
2925 {
3026 name : 'Alpen wallet' ,
3127 balance_sats : faucet . l2_balance_sats ,
32- threshold_sats : config . faucetBalanceSatsThresholds . alpen ,
28+ threshold_btc : config . faucetBalanceBtcThresholds . alpen ,
3329 } ,
3430 ] ;
3531
@@ -50,14 +46,10 @@ export default function FaucetBalance({ faucet, title }: FaucetBalanceProps) {
5046 { faucetWallets . map ( wallet => (
5147 < tr key = { wallet . name } className = "operators-row" >
5248 < td className = "table-cell" > { wallet . name } </ td >
49+ < td className = "table-cell" > { formatBTC ( wallet . balance_sats ) } </ td >
50+ < td className = "table-cell" > { wallet . threshold_btc } BTC</ td >
5351 < td className = "table-cell" >
54- { formatSats ( wallet . balance_sats ) }
55- </ td >
56- < td className = "table-cell" >
57- { formatSats ( wallet . threshold_sats ) }
58- </ td >
59- < td className = "table-cell" >
60- { getHealthStatus ( wallet . balance_sats , wallet . threshold_sats ) }
52+ { getHealthStatus ( wallet . balance_sats , wallet . threshold_btc ) }
6153 </ td >
6254 </ tr >
6355 ) ) }
0 commit comments