From f0e96990efea88be5dd390afbf7c0ad8903e9698 Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Wed, 28 Jul 2021 18:44:50 -0300 Subject: [PATCH] Add burnt/miner fee split info --- src/transaction/Details.tsx | 388 +++++++++++++++++--------------- src/transaction/RewardSplit.tsx | 54 +++++ 2 files changed, 256 insertions(+), 186 deletions(-) create mode 100644 src/transaction/RewardSplit.tsx diff --git a/src/transaction/Details.tsx b/src/transaction/Details.tsx index 86b0c0e..1a1cd64 100644 --- a/src/transaction/Details.tsx +++ b/src/transaction/Details.tsx @@ -16,6 +16,7 @@ import Timestamp from "../components/Timestamp"; import InternalTransactionOperation from "../components/InternalTransactionOperation"; import MethodName from "../components/MethodName"; import TransactionType from "../components/TransactionType"; +import RewardSplit from "./RewardSplit"; import GasValue from "../components/GasValue"; import FormattedBalance from "../components/FormattedBalance"; import TokenTransferItem from "../TokenTransferItem"; @@ -33,198 +34,213 @@ const Details: React.FC = ({ txData, internalOps, sendsEthToMiner, -}) => ( - - -
- {txData.transactionHash} - -
-
- - {txData.status ? ( - - - Success - - ) : ( - - - Fail - - )} - - -
- - -
-
- - - - -
- - - - -
-
- - {txData.to ? ( -
- - - - -
- ) : ( -
- - - - -
- )} - {internalOps && ( -
- {internalOps.map((op, i) => ( - - ))} -
- )} -
- - - - {txData.tokenTransfers.length > 0 && ( - -
- {txData.tokenTransfers.map((t, i) => ( - - ))} +}) => { + const hasEIP1559 = + txData.blockBaseFeePerGas !== undefined && + txData.blockBaseFeePerGas !== null; + + return ( + + +
+ {txData.transactionHash} +
- )} - - - {ethers.utils.formatEther(txData.value)} Ether - - - - Type ( - - EIP-2718 - - ) - - } - > - - - {txData.blockBaseFeePerGas && ( - - - {" "} - Gwei ( - {" "} - wei) - - - )} - {txData.type === 2 && ( - <> - - - Ether ( - {" "} - Gwei) + + {txData.status ? ( + + + Success - - - - Ether ( - Gwei) - - - - )} - - Ether - - -
- - Ether ( - Gwei) - - {sendsEthToMiner && ( - - Flashbots + ) : ( + + + Fail )} -
-
- -
-
- /{" "} - + + +
+ +
- + + + + +
+ + + + +
+
+ + {txData.to ? ( +
+ + + + +
+ ) : ( +
+ + + + +
+ )} + {internalOps && ( +
+ {internalOps.map((op, i) => ( + + ))} +
+ )} +
+ + + + {txData.tokenTransfers.length > 0 && ( + +
+ {txData.tokenTransfers.map((t, i) => ( + + ))} +
+
+ )} + + + {ethers.utils.formatEther(txData.value)} Ether + + + + Type ( + + EIP-2718 + + ) + + } + > + + + {hasEIP1559 && ( + + + {" "} + Gwei ( + {" "} + wei) + + + )} + {txData.type === 2 && ( + <> + + + Ether ( + {" "} + Gwei) + + + + + Ether ( + {" "} + Gwei) + + + + )} + +
+
+ Ether +
+ {hasEIP1559 && } +
+
+ +
+ + Ether ( + Gwei) + + {sendsEthToMiner && ( + + Flashbots + + )} +
+
+ +
+
+ /{" "} + +
+ +
+
+ N/A + {txData.nonce} + + + {txData.transactionIndex} + + + +