From 94faa79edef125024f36875becf88733a7e5c69c Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Thu, 29 Jul 2021 23:31:28 -0300 Subject: [PATCH] Fix type 2 gas column display raising exceptions --- src/BlockTransactions.tsx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/BlockTransactions.tsx b/src/BlockTransactions.tsx index 30d39c0..2ce687b 100644 --- a/src/BlockTransactions.tsx +++ b/src/BlockTransactions.tsx @@ -63,10 +63,18 @@ const BlockTransactions: React.FC = () => { to: t.to, createdContractAddress: _receipts[i].contractAddress, value: t.value, - fee: provider.formatter - .bigNumber(_receipts[i].gasUsed) - .mul(t.gasPrice!), - gasPrice: t.gasPrice!, + fee: + t.type !== 2 + ? provider.formatter + .bigNumber(_receipts[i].gasUsed) + .mul(t.gasPrice!) + : provider.formatter + .bigNumber(_receipts[i].gasUsed) + .mul(t.maxPriorityFeePerGas!.add(_block.baseFeePerGas!)), + gasPrice: + t.type !== 2 + ? t.gasPrice! + : t.maxPriorityFeePerGas!.add(_block.baseFeePerGas!), data: t.data, status: provider.formatter.number(_receipts[i].status), };