From 0ba7ad0cff87052b067058509ced84ee8a13f96d Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Sun, 15 Aug 2021 00:45:24 -0300 Subject: [PATCH] Fixes for miner fee reward display post-london --- src/Block.tsx | 14 ++++---------- src/useErigonHooks.ts | 3 +-- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/Block.tsx b/src/Block.tsx index 875d2f4..9f3a652 100644 --- a/src/Block.tsx +++ b/src/Block.tsx @@ -48,7 +48,7 @@ const Block: React.FC = () => { }, [block]); const burntFees = block?.baseFeePerGas && block.baseFeePerGas.mul(block.gasUsed); - const netFeeReward = block && block.feeReward.sub(burntFees ?? 0); + const netFeeReward = block?.feeReward ?? BigNumber.from(0); const gasUsedPerc = block && block.gasUsed.mul(10000).div(block.gasLimit).toNumber() / 100; @@ -91,18 +91,12 @@ const Block: React.FC = () => { - - {!block.feeReward.isZero() && ( + + {!netFeeReward.isZero() && ( <> {" "} ( +{" "} - - ) + ) )} diff --git a/src/useErigonHooks.ts b/src/useErigonHooks.ts index 4067f4c..48bc5ac 100644 --- a/src/useErigonHooks.ts +++ b/src/useErigonHooks.ts @@ -48,12 +48,11 @@ export const readBlock = async ( const _rawBlock = await blockPromise; const _block = provider.formatter.block(_rawBlock.block); const _rawIssuance = _rawBlock.issuance; - const fees = provider.formatter.bigNumber(_rawBlock.totalFees); const extBlock: ExtendedBlock = { blockReward: provider.formatter.bigNumber(_rawIssuance.blockReward ?? 0), unclesReward: provider.formatter.bigNumber(_rawIssuance.uncleReward ?? 0), - feeReward: fees, + feeReward: provider.formatter.bigNumber(_rawBlock.totalFees), size: provider.formatter.number(_rawBlock.block.size), sha3Uncles: _rawBlock.block.sha3Uncles, stateRoot: _rawBlock.block.stateRoot,