Skip to content

Commit 8c731b1

Browse files
committed
refactor: use formatSmallUSD
1 parent a68c4f6 commit 8c731b1

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

app/[locale]/what-is-ether/_components/GasTable.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getTranslations } from "next-intl/server"
1+
import { getLocale, getTranslations } from "next-intl/server"
22

33
import {
44
Table,
@@ -9,10 +9,13 @@ import {
99
TableRow,
1010
} from "@/components/ui/table"
1111

12+
import { formatSmallUSD } from "@/lib/utils/numbers"
13+
1214
const GasTable = async () => {
1315
const t = await getTranslations({
1416
namespace: "page-what-is-ether",
1517
})
18+
const locale = await getLocale()
1619

1720
const etherscanApiKey = process.env.ETHERSCAN_API_KEY
1821

@@ -30,7 +33,7 @@ const GasTable = async () => {
3033
const calculateCost = (gasUnits: number) => {
3134
const costInETH = gasUnits * gasPrice * 1e-9 // Convert gwei to ETH
3235
const costInUSD = costInETH * ethPriceUSD
33-
return `$${costInUSD.toFixed(2)}`
36+
return formatSmallUSD(costInUSD, locale)
3437
}
3538

3639
return (

0 commit comments

Comments
 (0)