mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
14 lines
452 B
TypeScript
14 lines
452 B
TypeScript
import getValueWithUnit from 'lib/getValueWithUnit';
|
|
import { currencyUnits } from 'lib/units';
|
|
|
|
export const getBaseFeeValue = (baseFee: string | null) => {
|
|
if (!baseFee) {
|
|
return null;
|
|
}
|
|
const valGwei = getValueWithUnit(baseFee, 'gwei');
|
|
if (valGwei.isGreaterThanOrEqualTo(0.0001)) {
|
|
return `${ valGwei.toFormat(4) } ${ currencyUnits.gwei }`;
|
|
}
|
|
return `${ getValueWithUnit(baseFee, 'wei').toFormat() } ${ currencyUnits.wei }`;
|
|
};
|