import React from "react"; import { ResolvedAddresses, resolverRendererRegistry, } from "../api/address-resolver"; import PlainAddress from "./PlainAddress"; type AddressOrENSNameProps = { address: string; selectedAddress?: string; text?: string; dontOverrideColors?: boolean; resolvedAddresses?: ResolvedAddresses | undefined; }; const AddressOrENSName: React.FC = ({ address, selectedAddress, text, dontOverrideColors, resolvedAddresses, }) => { const resolvedAddress = resolvedAddresses?.[address]; const linkable = address !== selectedAddress; if (resolvedAddress === undefined) { return ( ); } const [resolver, resolvedName] = resolvedAddress; const renderer = resolverRendererRegistry.get(resolver); if (renderer === undefined) { return ( ); } return renderer(address, resolvedName, linkable, !!dontOverrideColors); }; export default AddressOrENSName;