Skip to content

Commit

Permalink
Another trick to simplify the logic is to set the default to Gwei. Ac…
Browse files Browse the repository at this point in the history
…tually, I like this approach better.
  • Loading branch information
butcher73 committed Nov 13, 2024
1 parent 429202f commit 31ea6c0
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/features/messages/cards/GasDetailsCard.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import BigNumber from 'bignumber.js';
import { utils } from 'ethers';
import Image from 'next/image';
import { useEffect, useMemo, useState } from 'react';
import { useMemo, useState } from 'react';

import { fromWei, toTitleCase } from '@hyperlane-xyz/utils';
import { Tooltip } from '@hyperlane-xyz/widgets';
Expand Down Expand Up @@ -37,12 +37,7 @@ export function GasDetailsCard({ message, blur, igpPayments = {} }: Props) {
];
}, [message, multiProvider]);

const [decimals, setDecimals] = useState<number>(unitOptions[0].value);

// Update `decimals` after the component mounts to ensure it matches the initial `unitOptions` value
useEffect(() => {
setDecimals(unitOptions[0].value);
}, [unitOptions]);
const [decimals, setDecimals] = useState<number>(9);

const { totalGasAmount, paymentFormatted, numPayments, avgPrice, paymentsWithAddr } =
useMemo(() => {
Expand Down

0 comments on commit 31ea6c0

Please sign in to comment.