support custom wei

This commit is contained in:
isstuev
2024-10-28 12:03:55 +01:00
parent 471782cdc0
commit b94934240f
+3 -2
View File
@@ -1,4 +1,5 @@
import getValueWithUnit from 'lib/getValueWithUnit';
import { currencyUnits } from 'lib/units';
export const getBaseFeeValue = (baseFee: string | null) => {
if (!baseFee) {
@@ -6,7 +7,7 @@ export const getBaseFeeValue = (baseFee: string | null) => {
}
const valGwei = getValueWithUnit(baseFee, 'gwei');
if (valGwei.isGreaterThanOrEqualTo(0.0001)) {
return valGwei.toFormat(4) + ' Gwei';
return `${ valGwei.toFormat(4) } ${ currencyUnits.gwei }`;
}
return getValueWithUnit(baseFee, 'wei').toFormat() + ' wei';
return `${ getValueWithUnit(baseFee, 'wei').toFormat() } ${ currencyUnits.wei }`;
};