import { ethers } from "ethers"; import React from "react"; import BlockLink from "../../components/BlockLink"; import TimestampAge from "../../components/TimestampAge"; import { ExtendedBlock } from "../../useErigonHooks"; const ELASTICITY_MULTIPLIER = 2; type BlockRecordProps = { now: number; block: ExtendedBlock; }; const BlockRecord: React.FC = ({ now, block }) => { 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 (
{ethers.utils.commify(block.gasUsed.toString())}
{ethers.utils.commify(gasTarget.toString())}
{block.baseFeePerGas?.toString()} wei
{ethers.utils.commify(ethers.utils.formatEther(totalReward))} Ether
{ethers.utils.commify( ethers.utils.formatUnits( block.gasUsed.mul(block.baseFeePerGas!).toString(), 9 ) )}{" "} Gwei
); }; export default React.memo(BlockRecord);