Skip to content

Commit f4489fe

Browse files
authored
Merge pull request #1484 from scroll-tech/use-Gwei
fix: use Gwei
2 parents 5d87840 + cc6983a commit f4489fe

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/components/Header/GasPriceViewer.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useMemo, useState } from "react"
2-
import { formatUnits } from "viem"
2+
import { formatGwei } from "viem"
33
import { useGasPrice } from "wagmi"
44

55
import { Box, Button, Fade, Paper, Popper, Stack, Typography } from "@mui/material"
@@ -25,14 +25,14 @@ const GasPriceViewer = () => {
2525

2626
const displayedScrollGasPrice = useMemo(() => {
2727
if (scrollGasPrice) {
28-
return Number(formatUnits(scrollGasPrice, 6)).toFixed(2)
28+
return Number(formatGwei(scrollGasPrice)).toFixed(3)
2929
}
3030
return "-"
3131
}, [scrollGasPrice])
3232

3333
const displayedEthereumGasPrice = useMemo(() => {
3434
if (ethereumGasPrice) {
35-
return Number(formatUnits(ethereumGasPrice, 6)).toFixed(2)
35+
return Number(formatGwei(ethereumGasPrice)).toFixed(3)
3636
}
3737
return "-"
3838
}, [ethereumGasPrice])
@@ -96,7 +96,7 @@ const GasPriceViewer = () => {
9696
{displayedScrollGasPrice}
9797
</Typography>
9898
<Typography component="span" sx={{ fontSize: "1.6rem", lineHeight: "2.4rem" }}>
99-
Mwei
99+
Gwei
100100
</Typography>
101101
<Popper
102102
open={Boolean(anchorEl)}
@@ -136,12 +136,12 @@ const GasPriceViewer = () => {
136136
<Typography sx={{ fontSize: "inherit", lineHeight: "inherit", textAlign: "right", fontFamily: "var(--developer-page-font-family)" }}>
137137
{displayedScrollGasPrice}
138138
</Typography>
139-
<span>Mwei</span>
139+
<span>Gwei</span>
140140
<span className="font-[600]">Ethereum</span>
141141
<Typography sx={{ fontSize: "inherit", lineHeight: "inherit", textAlign: "right", fontFamily: "var(--developer-page-font-family)" }}>
142142
{displayedEthereumGasPrice}
143143
</Typography>
144-
<span>Mwei</span>
144+
<span>Gwei</span>
145145
<Button
146146
sx={{
147147
fontSize: "1.6rem",

src/components/Header/MobileGasPriceViewer.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { motion } from "motion/react"
22
import { useEffect, useMemo, useRef, useState } from "react"
3-
import { formatUnits } from "viem"
3+
import { formatGwei } from "viem"
44
import { useGasPrice } from "wagmi"
55

66
import { Box, Button, Collapse, Stack, Typography } from "@mui/material"
@@ -35,14 +35,14 @@ const MobileGasPriceViewer = props => {
3535

3636
const displayedScrollGasPrice = useMemo(() => {
3737
if (scrollGasPrice) {
38-
return commafy(formatUnits(scrollGasPrice, 6).toString(), 2)
38+
return commafy(formatGwei(scrollGasPrice).toString(), 3)
3939
}
4040
return "-"
4141
}, [scrollGasPrice])
4242

4343
const displayedEthereumGasPrice = useMemo(() => {
4444
if (ethereumGasPrice) {
45-
return commafy(formatUnits(ethereumGasPrice, 6).toString(), 2)
45+
return commafy(formatGwei(ethereumGasPrice).toString(), 3)
4646
}
4747
return "-"
4848
}, [ethereumGasPrice])
@@ -143,7 +143,7 @@ const MobileGasPriceViewer = props => {
143143
{displayedScrollGasPrice}
144144
</Typography>
145145
<Typography component="span" sx={{ color: "inherit", fontSize: "1.6rem", lineHeight: "2.4rem" }}>
146-
Mwei
146+
Gwei
147147
</Typography>
148148
</Stack>
149149
<Collapse in={gasPricePanelVisible} sx={{ width: "100%" }} timeout="auto" unmountOnExit>
@@ -174,7 +174,7 @@ const MobileGasPriceViewer = props => {
174174
>
175175
{displayedScrollGasPrice}
176176
</Typography>
177-
<span>Mwei</span>
177+
<span>Gwei</span>
178178
<span className="font-[600]">Ethereum</span>
179179
<Typography
180180
sx={{
@@ -187,7 +187,7 @@ const MobileGasPriceViewer = props => {
187187
>
188188
{displayedEthereumGasPrice}
189189
</Typography>
190-
<span>Mwei</span>
190+
<span>Gwei</span>
191191
<Button
192192
sx={{
193193
fontSize: "1.6rem",

0 commit comments

Comments
 (0)