import React from "react"; import { FixedNumber } from "@ethersproject/bignumber"; import { commify, formatEther } from "@ethersproject/units"; import BlockLink from "../../components/BlockLink"; import TimestampAge from "../../components/TimestampAge"; import Blip from "./Blip"; import { ExtendedBlock } from "../../useErigonHooks"; import { useChainInfo } from "../../useChainInfo"; const ELASTICITY_MULTIPLIER = 2; type BlockRowProps = { now: number; block: ExtendedBlock; baseFeeDelta: number; }; const BlockRow: React.FC = ({ now, block, baseFeeDelta }) => { const { nativeCurrency: { symbol }, } = useChainInfo(); const gasTarget = block.gasLimit.div(ELASTICITY_MULTIPLIER); const burntFees = block?.baseFeePerGas && block.baseFeePerGas.mul(block.gasUsed); const netFeeReward = block && block.feeReward.sub(burntFees ?? 0); const totalReward = block.blockReward.add(netFeeReward ?? 0); return (
{commify(block.gasUsed.toString())}
{commify(gasTarget.toString())}
{FixedNumber.from(block.baseFeePerGas) .divUnsafe(FixedNumber.from(1e9)) .round(0) .toUnsafeFloat()}{" "} Gwei
{commify(formatEther(totalReward))} {symbol}
{commify(formatEther(block.gasUsed.mul(block.baseFeePerGas!)))} {symbol}
); }; export default React.memo(BlockRow);