From 3fa2add09fcab82edf469cc5094cee573c0f3fd5 Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Thu, 24 Mar 2022 15:39:09 -0300 Subject: [PATCH] Add eoa/contract indicator to contract creator addr on addr page --- src/address/AddressTransactionResults.tsx | 58 +++++++++++++---------- src/components/TransactionAddress.tsx | 6 ++- src/useBlockTagContext.tsx | 4 +- 3 files changed, 40 insertions(+), 28 deletions(-) diff --git a/src/address/AddressTransactionResults.tsx b/src/address/AddressTransactionResults.tsx index 1a95535..fcdffeb 100644 --- a/src/address/AddressTransactionResults.tsx +++ b/src/address/AddressTransactionResults.tsx @@ -20,6 +20,7 @@ import { useParams, useSearchParams } from "react-router-dom"; import { ChecksummedAddress, ProcessedTransaction } from "../types"; import { useContractsMetadata } from "../hooks"; import { useAddressBalance, useContractCreator } from "../useErigonHooks"; +import { BlockNumberContext } from "../useBlockTagContext"; type AddressTransactionResultsProps = { address: ChecksummedAddress; @@ -133,34 +134,39 @@ const AddressTransactionResults: React.FC = ({ return ( - {balance && ( - -
- - {!balance.isZero() && priceMap["latest"] !== undefined && ( - - + {balance && ( + +
+ + {!balance.isZero() && priceMap["latest"] !== undefined && ( + + + + )} +
+
+ )} + {creator && ( + +
+
+ - - )} -
- - )} - {creator && ( - -
-
- - + +
+
+ +
-
- -
-
-
- )} + + )} + = ({ const toHasCode = useHasCode( provider, address, - blockNumber !== undefined ? blockNumber - 1 : undefined + blockNumber !== undefined + ? blockNumber === "latest" + ? "latest" + : blockNumber - 1 + : undefined ); return ( diff --git a/src/useBlockTagContext.tsx b/src/useBlockTagContext.tsx index 8504fca..5cf2094 100644 --- a/src/useBlockTagContext.tsx +++ b/src/useBlockTagContext.tsx @@ -10,6 +10,8 @@ import { createContext, useContext } from "react"; * at the time (block) the transaction happened it was still an EOA (create2), * so it should be displayed as an EOA. */ -export const BlockNumberContext = createContext(undefined); +export const BlockNumberContext = createContext( + undefined +); export const useBlockNumberContext = () => useContext(BlockNumberContext);