Skip to content

Commit f275f95

Browse files
authored
fix: ensure BTC fee is displayed without exponential notation (#1868)
1 parent 0c491d9 commit f275f95

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

apps/browser-extension-wallet/src/views/bitcoin-mode/features/send/components/ReviewTransaction.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { Bitcoin } from '@lace/bitcoin';
1010
import { useTranslation } from 'react-i18next';
1111

1212
const SATS_IN_BTC = 100_000_000;
13+
const MAXIMUM_FEE_DECIMAL = 8;
1314

1415
interface ReviewTransactionProps {
1516
unsignedTransaction: Bitcoin.UnsignedTransaction;
@@ -98,7 +99,12 @@ export const ReviewTransaction: React.FC<ReviewTransactionProps> = ({
9899
})}
99100
<Flex flexDirection="column" w="$fill" alignItems="flex-end" gap="$4">
100101
<Text.Body.Normal weight="$medium" data-testid="output-summary-fee">
101-
{Number.parseFloat((Number(feeInBtc) / SATS_IN_BTC).toFixed(8))} BTC
102+
{(Number(feeInBtc) / SATS_IN_BTC).toLocaleString('en-US', {
103+
minimumFractionDigits: 0,
104+
maximumFractionDigits: MAXIMUM_FEE_DECIMAL,
105+
useGrouping: false
106+
})}{' '}
107+
BTC
102108
</Text.Body.Normal>
103109
<Text.Body.Normal weight="$medium" data-testid="output-summary-fee-rate" className={styles.feeRateLabel}>
104110
{((feeRate * SATS_IN_BTC) / 1000).toFixed(2)} sats/vB

0 commit comments

Comments
 (0)