Move metadata reading one level up

This commit is contained in:
Willian Mitsuda 2021-09-05 21:13:01 -03:00
parent 605302ee64
commit 71e359eb92
2 changed files with 15 additions and 7 deletions

View File

@ -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 (
<StandardFrame>
@ -287,7 +292,10 @@ const AddressTransactions: React.FC = () => {
</ContentFrame>
</Route>
<Route path="/address/:addressOrName/contract" exact>
<Contracts checksummedAddress={checksummedAddress} />
<Contracts
checksummedAddress={checksummedAddress}
rawMetadata={rawMetadata}
/>
</Route>
</Switch>
</Tab.Panels>

View File

@ -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<ContractsProps> = ({ checksummedAddress }) => {
const { provider } = useContext(RuntimeContext);
const rawMetadata = useSourcify(
const Contracts: React.FC<ContractsProps> = ({
checksummedAddress,
provider?.network.chainId
);
rawMetadata,
}) => {
const { provider } = useContext(RuntimeContext);
const [selected, setSelected] = useState<string>();
useEffect(() => {