From 24ae87a092d801f1976e75a7a369d55efab34141 Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Mon, 5 Jul 2021 18:08:52 -0300 Subject: [PATCH] Add flashbot classification --- src/Transaction.tsx | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/src/Transaction.tsx b/src/Transaction.tsx index c233f0d..c538bc4 100644 --- a/src/Transaction.tsx +++ b/src/Transaction.tsx @@ -1,4 +1,4 @@ -import React, { useState, useEffect, useCallback } from "react"; +import React, { useState, useEffect, useCallback, useMemo } from "react"; import { Route, Switch, useParams } from "react-router-dom"; import { BigNumber, ethers } from "ethers"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; @@ -112,6 +112,18 @@ const Transaction: React.FC = () => { }, [txhash]); const [transfers, setTransfers] = useState(); + const sendsEthToMiner = useMemo(() => { + if (!txData || !transfers) { + return false; + } + + for (const t of transfers) { + if (t.to === txData.miner) { + return true; + } + } + return false; + }, [txData, transfers]); const traceTransfersUsingOtsTrace = useCallback(async () => { if (!txData) { @@ -263,9 +275,17 @@ const Transaction: React.FC = () => { Ether - Ether ( - {" "} - Gwei) +
+ + Ether ( + {" "} + Gwei) + + {sendsEthToMiner && Flashbots} +
N/A