{formError}
}Examples:
diff --git a/packages/namehash-ui/src/components/identity/Name.tsx b/packages/namehash-ui/src/components/identity/Name.tsx index a4bec4f1a0..3128b652d5 100644 --- a/packages/namehash-ui/src/components/identity/Name.tsx +++ b/packages/namehash-ui/src/components/identity/Name.tsx @@ -1,5 +1,5 @@ import type { Name } from "enssdk"; -import { beautifyName } from "enssdk"; +import { beautifyInterpretedName, isInterpretedName } from "enssdk"; interface NameDisplayProps { name: Name; @@ -9,10 +9,16 @@ interface NameDisplayProps { /** * Displays an ENS name in beautified form. * - * @param name - The name to display in beautified form. + * If the provided name is not a valid InterpretedName, displays + * "(invalid name)" instead. * + * @param name - The name to display. */ export function NameDisplay({ name, className = "nhui:font-medium" }: NameDisplayProps) { - const beautifiedName = beautifyName(name); + if (!isInterpretedName(name)) { + return (invalid name); + } + + const beautifiedName = beautifyInterpretedName(name); return {beautifiedName}; } diff --git a/packages/namehash-ui/src/utils/ensManager.ts b/packages/namehash-ui/src/utils/ensManager.ts index 4b488e3328..85b077b577 100644 --- a/packages/namehash-ui/src/utils/ensManager.ts +++ b/packages/namehash-ui/src/utils/ensManager.ts @@ -1,4 +1,4 @@ -import type { Address, Name } from "enssdk"; +import { type Address, isNormalizedName, type Name } from "enssdk"; import type { ENSNamespaceId } from "@ensnode/datasources"; import { ENSNamespaceIds } from "@ensnode/ensnode-sdk"; @@ -28,10 +28,13 @@ export function getEnsManagerUrl(namespaceId: ENSNamespaceId): URL | null { /** * Builds the URL of the external ENS Manager App Profile page for a given name and ENS Namespace. * - * @returns URL to the Profile page in the external ENS Manager App for a given name and ENS Namespace, - * or null if this URL is not known + * Returns null if the name is not normalized or the namespace has no known ENS Manager App. + * + * @returns URL to the Profile page in the external ENS Manager App, or null */ export function getEnsManagerNameDetailsUrl(name: Name, namespaceId: ENSNamespaceId): URL | null { + if (!isNormalizedName(name)) return null; + const baseUrl = getEnsManagerUrl(namespaceId); if (!baseUrl) return null;