From 71e359eb924160a5f20eb903d2ab5e0eaee1703a Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Sun, 5 Sep 2021 21:13:01 -0300 Subject: [PATCH] Move metadata reading one level up --- src/AddressTransactions.tsx | 10 +++++++++- src/address/Contracts.tsx | 12 ++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/AddressTransactions.tsx b/src/AddressTransactions.tsx index c5b96a5..1970b8c 100644 --- a/src/AddressTransactions.tsx +++ b/src/AddressTransactions.tsx @@ -33,6 +33,7 @@ import { useENSCache } from "./useReverseCache"; import { useFeeToggler } from "./search/useFeeToggler"; import { SelectionContext, useSelection } from "./useSelection"; import { useMultipleETHUSDOracle } from "./usePriceOracle"; +import { useSourcify } from "./useSourcify"; type BlockParams = { addressOrName: string; @@ -180,6 +181,10 @@ const AddressTransactions: React.FC = () => { const [feeDisplay, feeDisplayToggler] = useFeeToggler(); const selectionCtx = useSelection(); + const rawMetadata = useSourcify( + checksummedAddress, + provider?.network.chainId + ); return ( @@ -287,7 +292,10 @@ const AddressTransactions: React.FC = () => { - + diff --git a/src/address/Contracts.tsx b/src/address/Contracts.tsx index bea7485..892fe67 100644 --- a/src/address/Contracts.tsx +++ b/src/address/Contracts.tsx @@ -4,18 +4,18 @@ import ContentFrame from "../ContentFrame"; import InfoRow from "../components/InfoRow"; import Contract from "./Contract"; import { RuntimeContext } from "../useRuntime"; -import { useSourcify } from "../useSourcify"; +import { Metadata } from "../useSourcify"; type ContractsProps = { checksummedAddress: string; + rawMetadata: Metadata | null | undefined; }; -const Contracts: React.FC = ({ checksummedAddress }) => { +const Contracts: React.FC = ({ + checksummedAddress, + rawMetadata, +}) => { const { provider } = useContext(RuntimeContext); - const rawMetadata = useSourcify( - checksummedAddress, - provider?.network.chainId - ); const [selected, setSelected] = useState(); useEffect(() => {