Fixes for miner fee reward display post-london

This commit is contained in:
Willian Mitsuda 2021-08-15 00:45:24 -03:00
parent 8396e91bb1
commit 0ba7ad0cff
2 changed files with 5 additions and 12 deletions

View File

@ -48,7 +48,7 @@ const Block: React.FC = () => {
}, [block]); }, [block]);
const burntFees = const burntFees =
block?.baseFeePerGas && block.baseFeePerGas.mul(block.gasUsed); block?.baseFeePerGas && block.baseFeePerGas.mul(block.gasUsed);
const netFeeReward = block && block.feeReward.sub(burntFees ?? 0); const netFeeReward = block?.feeReward ?? BigNumber.from(0);
const gasUsedPerc = const gasUsedPerc =
block && block.gasUsed.mul(10000).div(block.gasLimit).toNumber() / 100; block && block.gasUsed.mul(10000).div(block.gasLimit).toNumber() / 100;
@ -91,18 +91,12 @@ const Block: React.FC = () => {
<DecoratedAddressLink address={block.miner} miner /> <DecoratedAddressLink address={block.miner} miner />
</InfoRow> </InfoRow>
<InfoRow title="Block Reward"> <InfoRow title="Block Reward">
<TransactionValue <TransactionValue value={block.blockReward.add(netFeeReward)} />
value={block.blockReward.add(netFeeReward ?? 0)} {!netFeeReward.isZero() && (
/>
{!block.feeReward.isZero() && (
<> <>
{" "} {" "}
(<TransactionValue value={block.blockReward} hideUnit /> +{" "} (<TransactionValue value={block.blockReward} hideUnit /> +{" "}
<TransactionValue <TransactionValue value={netFeeReward} hideUnit />)
value={netFeeReward ?? BigNumber.from(0)}
hideUnit
/>
)
</> </>
)} )}
</InfoRow> </InfoRow>

View File

@ -48,12 +48,11 @@ export const readBlock = async (
const _rawBlock = await blockPromise; const _rawBlock = await blockPromise;
const _block = provider.formatter.block(_rawBlock.block); const _block = provider.formatter.block(_rawBlock.block);
const _rawIssuance = _rawBlock.issuance; const _rawIssuance = _rawBlock.issuance;
const fees = provider.formatter.bigNumber(_rawBlock.totalFees);
const extBlock: ExtendedBlock = { const extBlock: ExtendedBlock = {
blockReward: provider.formatter.bigNumber(_rawIssuance.blockReward ?? 0), blockReward: provider.formatter.bigNumber(_rawIssuance.blockReward ?? 0),
unclesReward: provider.formatter.bigNumber(_rawIssuance.uncleReward ?? 0), unclesReward: provider.formatter.bigNumber(_rawIssuance.uncleReward ?? 0),
feeReward: fees, feeReward: provider.formatter.bigNumber(_rawBlock.totalFees),
size: provider.formatter.number(_rawBlock.block.size), size: provider.formatter.number(_rawBlock.block.size),
sha3Uncles: _rawBlock.block.sha3Uncles, sha3Uncles: _rawBlock.block.sha3Uncles,
stateRoot: _rawBlock.block.stateRoot, stateRoot: _rawBlock.block.stateRoot,