2021-12-06 17:02:23 +01:00
|
|
|
import React from 'react';
|
|
|
|
|
|
|
|
import {
|
|
|
|
COLORS,
|
|
|
|
FONT_WEIGHT,
|
|
|
|
TYPOGRAPHY,
|
|
|
|
} from '../../../../helpers/constants/design-system';
|
2022-01-06 23:40:31 +01:00
|
|
|
import { roundToDecimalPlacesRemovingExtraZeroes } from '../../../../helpers/utils/util';
|
2021-12-06 17:02:23 +01:00
|
|
|
import { useGasFeeContext } from '../../../../contexts/gasFee';
|
|
|
|
import I18nValue from '../../../ui/i18n-value';
|
|
|
|
import Typography from '../../../ui/typography/typography';
|
|
|
|
|
2021-12-18 00:00:25 +01:00
|
|
|
import { BaseFeeTooltip } from './tooltips';
|
|
|
|
import LatestPriorityFeeField from './latest-priority-fee-field';
|
2021-12-06 17:02:23 +01:00
|
|
|
import StatusSlider from './status-slider';
|
|
|
|
|
|
|
|
const NetworkStatistics = () => {
|
|
|
|
const { gasFeeEstimates } = useGasFeeContext();
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="network-statistics">
|
|
|
|
<Typography
|
|
|
|
color={COLORS.UI4}
|
|
|
|
fontWeight={FONT_WEIGHT.BOLD}
|
|
|
|
margin={[3, 0]}
|
|
|
|
variant={TYPOGRAPHY.H8}
|
|
|
|
>
|
|
|
|
<I18nValue messageKey="networkStatus" />
|
|
|
|
</Typography>
|
|
|
|
<div className="network-statistics__info">
|
|
|
|
<div className="network-statistics__info__field">
|
|
|
|
<span className="network-statistics__info__field-data">
|
|
|
|
<BaseFeeTooltip>
|
|
|
|
{gasFeeEstimates?.estimatedBaseFee &&
|
2022-01-06 23:40:31 +01:00
|
|
|
`${roundToDecimalPlacesRemovingExtraZeroes(
|
|
|
|
gasFeeEstimates?.estimatedBaseFee,
|
|
|
|
0,
|
|
|
|
)} GWEI`}
|
2021-12-06 17:02:23 +01:00
|
|
|
</BaseFeeTooltip>
|
|
|
|
</span>
|
|
|
|
<span className="network-statistics__info__field-label">
|
|
|
|
<I18nValue messageKey="baseFee" />
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
<div className="network-statistics__info__separator" />
|
2021-12-18 00:00:25 +01:00
|
|
|
<LatestPriorityFeeField />
|
2021-12-06 17:02:23 +01:00
|
|
|
<div className="network-statistics__info__separator" />
|
|
|
|
<div className="network-statistics__info__field">
|
|
|
|
<StatusSlider />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default NetworkStatistics;
|