Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .changeset/enssdk-migrate-core-types.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
"enssdk": minor
"@ensnode/ensnode-sdk": minor
---

Migrated core ENS types and utilities from `ensnode-sdk` to `enssdk`:
- `UnixTimestamp` type moved to enssdk
- `normalizeName` function (wraps `@adraffy/ens-normalize`) added; `isNormalizedName`/`isNormalizedLabel` consolidated into `normalization.ts`
- `makeSubdomainNode` moved to enssdk
- `reinterpretLabel`/`reinterpretName` moved to enssdk
- `labelhash` renamed to `labelhashInterpretedLabel` (requires branded `InterpretedLabel` input)
- `namehash` renamed to `namehashInterpretedName` (requires branded `InterpretedName` input)
- Added `asInterpretedLabel`, `asInterpretedName`, `asLiteralLabel` validated cast helpers
- Subregistry managed name functions now return `InterpretedName`
- Removed `@adraffy/ens-normalize` dependency from ensnode-sdk (provided by enssdk)
1 change: 1 addition & 0 deletions apps/ensadmin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"@ensnode/datasources": "workspace:*",
"@ensnode/ensnode-react": "workspace:*",
"@ensnode/ensnode-sdk": "workspace:*",
"enssdk": "workspace:*",
"@formkit/auto-animate": "^0.9.0",
"@graphiql/plugin-explorer": "5.1.1",
"@graphiql/react": "0.37.1",
Expand Down
3 changes: 1 addition & 2 deletions apps/ensadmin/src/app/@actions/name/page.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
"use client";

import { getEnsManagerNameDetailsUrl } from "@namehash/namehash-ui";
import type { Name } from "enssdk";
import { ScanSearch } from "lucide-react";
import Link from "next/link";
import { useSearchParams } from "next/navigation";

import type { Name } from "@ensnode/ensnode-sdk";

import { ExternalLinkWithIcon } from "@/components/link";
import { getRecordResolutionRelativePath } from "@/components/name-links";
import { Button } from "@/components/ui/button";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
"use client";

import { NameDisplay } from "@namehash/namehash-ui";
import type { Name } from "enssdk";
import Link from "next/link";
import { useSearchParams } from "next/navigation";

import type { Name } from "@ensnode/ensnode-sdk";

import {
BreadcrumbItem,
BreadcrumbLink,
Expand Down
3 changes: 1 addition & 2 deletions apps/ensadmin/src/app/@breadcrumbs/name/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
"use client";

import { NameDisplay } from "@namehash/namehash-ui";
import type { Name } from "enssdk";
import Link from "next/link";
import { useSearchParams } from "next/navigation";

import type { Name } from "@ensnode/ensnode-sdk";

import BreadcrumbsGroup from "@/components/breadcrumbs/group";
import {
BreadcrumbItem,
Expand Down
4 changes: 2 additions & 2 deletions apps/ensadmin/src/app/inspect/_lib/example-addresses.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Address } from "viem";
import type { Address, Name } from "enssdk";

import { ENSNamespaceIds, Name, NamespaceSpecificValue } from "@ensnode/ensnode-sdk";
import { ENSNamespaceIds, type NamespaceSpecificValue } from "@ensnode/ensnode-sdk";

export const EXAMPLE_ADDRESSES: NamespaceSpecificValue<Array<{ address: Address; name: Name }>> = {
default: [
Expand Down
4 changes: 3 additions & 1 deletion apps/ensadmin/src/app/inspect/_lib/example-names.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { ENSNamespaceIds, type Name, type NamespaceSpecificValue } from "@ensnode/ensnode-sdk";
import type { Name } from "enssdk";

import { ENSNamespaceIds, type NamespaceSpecificValue } from "@ensnode/ensnode-sdk";

export const EXAMPLE_NAMES: NamespaceSpecificValue<Name[]> = {
default: [
Expand Down
10 changes: 4 additions & 6 deletions apps/ensadmin/src/app/inspect/primary-name/page.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
"use client";

import { AddressDisplay, getChainName } from "@namehash/namehash-ui";
import type { Address, DefaultableChainId } from "enssdk";
import { DEFAULT_EVM_CHAIN_ID } from "enssdk";
import { useRouter, useSearchParams } from "next/navigation";
import { useEffect, useMemo, useState } from "react";
import { useDebouncedValue } from "rooks";
import { type Address, isAddress } from "viem";
import { isAddress } from "viem";

import { getENSRootChainId } from "@ensnode/datasources";
import { usePrimaryName } from "@ensnode/ensnode-react";
import {
DEFAULT_EVM_CHAIN_ID,
type DefaultableChainId,
getNamespaceSpecificValue,
} from "@ensnode/ensnode-sdk";
import { getNamespaceSpecificValue } from "@ensnode/ensnode-sdk";
import { makeDefaultableChainIdStringSchema } from "@ensnode/ensnode-sdk/internal";

import { RenderRequestsOutput } from "@/app/inspect/_components/render-requests-output";
Expand Down
3 changes: 2 additions & 1 deletion apps/ensadmin/src/app/inspect/primary-names/page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
"use client";

import { AddressDisplay } from "@namehash/namehash-ui";
import type { Address } from "enssdk";
import { useRouter, useSearchParams } from "next/navigation";
import { useEffect, useMemo, useState } from "react";
import { useDebouncedValue } from "rooks";
import { type Address, isAddress } from "viem";
import { isAddress } from "viem";

import { usePrimaryNames } from "@ensnode/ensnode-react";
import { getNamespaceSpecificValue } from "@ensnode/ensnode-sdk";
Expand Down
3 changes: 2 additions & 1 deletion apps/ensadmin/src/app/inspect/records/page.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
"use client";

import type { Name } from "enssdk";
import { User } from "lucide-react";
import Link from "next/link";
import { useRouter, useSearchParams } from "next/navigation";
import { useEffect, useMemo, useState } from "react";

import { useRecords } from "@ensnode/ensnode-react";
import { getNamespaceSpecificValue, type Name } from "@ensnode/ensnode-sdk";
import { getNamespaceSpecificValue } from "@ensnode/ensnode-sdk";

import { RenderRequestsOutput } from "@/app/inspect/_components/render-requests-output";
import { ResolveButton } from "@/app/inspect/_components/resolve-button";
Expand Down
9 changes: 3 additions & 6 deletions apps/ensadmin/src/app/mock/display-identity/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,16 @@ import {
getChainName,
getEnsManagerAddressDetailsUrl,
} from "@namehash/namehash-ui";
import type { Address, ChainId, DefaultableChainId, Name } from "enssdk";
import { asLowerCaseAddress, DEFAULT_EVM_CHAIN_ID } from "enssdk";
import { useState } from "react";
import { type Address, isAddress } from "viem";
import { isAddress } from "viem";

import { getENSNamespace, getENSRootChainId } from "@ensnode/datasources";
import {
asLowerCaseAddress,
type ChainId,
DEFAULT_EVM_CHAIN_ID,
type DefaultableChainId,
type ENSNamespaceId,
ENSNamespaceIds,
type Identity,
type Name,
type NamedIdentity,
type ResolutionStatusId,
ResolutionStatusIds,
Expand Down
16 changes: 9 additions & 7 deletions apps/ensadmin/src/app/mock/registrar-actions/mocks.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { Duration, InterpretedName, NamedRegistrarAction } from "@ensnode/ensnode-sdk";
import { asInterpretedName } from "enssdk";

import { type Duration, type NamedRegistrarAction } from "@ensnode/ensnode-sdk";

export const registrationWithReferral = {
action: {
Expand Down Expand Up @@ -45,7 +47,7 @@ export const registrationWithReferral = {
"176209761600000000111551110000000009545322000000000000006750000000000000071",
],
},
name: "nh35.eth" as InterpretedName,
name: asInterpretedName("nh35.eth"),
} satisfies NamedRegistrarAction;

export const renewalWithNoReferral = {
Expand Down Expand Up @@ -78,7 +80,7 @@ export const renewalWithNoReferral = {
"176304520800000000111551110000000009621987000000000000011350000000000000259",
],
},
name: "user1-extend.eth" as InterpretedName,
name: asInterpretedName("user1-extend.eth"),
} satisfies NamedRegistrarAction;

export const registrationWithNoReferralAndEncodedLabelHashes = {
Expand Down Expand Up @@ -115,7 +117,7 @@ export const registrationWithNoReferralAndEncodedLabelHashes = {
eventIds: ["176234701200000000111551110000000009566045000000000000014150000000000000198"],
},

name: "[e4310bf4547cb18b16b5348881d24a66d61fa94a013e5636b730b86ee64a3923].eth" as InterpretedName,
name: asInterpretedName("[e4310bf4547cb18b16b5348881d24a66d61fa94a013e5636b730b86ee64a3923].eth"),
} satisfies NamedRegistrarAction;

export const registrationWithZeroEncodedReferrer = {
Expand Down Expand Up @@ -151,7 +153,7 @@ export const registrationWithZeroEncodedReferrer = {
"176304488400000000111551110000000009621960000000000000003350000000000000031",
],
},
name: "alix407.eth" as InterpretedName,
name: asInterpretedName("alix407.eth"),
} satisfies NamedRegistrarAction;

export const registrationWithReferrerNotMatchingENSHolidayAwardsFormat = {
Expand Down Expand Up @@ -199,7 +201,7 @@ export const registrationWithReferrerNotMatchingENSHolidayAwardsFormat = {
"176305292400000000111551110000000009622628000000000000002750000000000000053",
],
},
name: "sonu100.eth" as InterpretedName,
name: asInterpretedName("sonu100.eth"),
} satisfies NamedRegistrarAction;

function registrarActionWithUpdatedIncrementalDuration(
Expand All @@ -209,7 +211,7 @@ function registrarActionWithUpdatedIncrementalDuration(
return {
...registrarAction,
action: { ...registrarAction.action, incrementalDuration },
name: `incrementalDuration-${incrementalDuration}.${registrarAction.name}` as InterpretedName,
name: asInterpretedName(`incrementalDuration-${incrementalDuration}.${registrarAction.name}`),
} satisfies NamedRegistrarAction;
}

Expand Down
3 changes: 1 addition & 2 deletions apps/ensadmin/src/app/mock/relative-time/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
"use client";

import { AbsoluteTime, InfoIcon, RelativeTime } from "@namehash/namehash-ui";
import type { UnixTimestamp } from "enssdk";
import { CheckIcon, X as XIcon } from "lucide-react";
import { useMemo, useState } from "react";

import type { UnixTimestamp } from "@ensnode/ensnode-sdk";

import mockDataJson from "@/app/mock/relative-time/data.json";
import { Button } from "@/components/ui/button";
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
"use client";

import type { Name } from "enssdk";

import { ASSUME_IMMUTABLE_QUERY, useRecords } from "@ensnode/ensnode-react";
import { type Name, type ResolverRecordsSelection } from "@ensnode/ensnode-sdk";
import type { ResolverRecordsSelection } from "@ensnode/ensnode-sdk";

import { Card, CardContent } from "@/components/ui/card";
import { useActiveNamespace } from "@/hooks/active/use-active-namespace";
Expand Down
3 changes: 2 additions & 1 deletion apps/ensadmin/src/app/name/_components/ProfileHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
"use client";

import { EnsAvatar, NameDisplay } from "@namehash/namehash-ui";
import type { Name } from "enssdk";

import type { ENSNamespaceId, Name } from "@ensnode/ensnode-sdk";
import type { ENSNamespaceId } from "@ensnode/ensnode-sdk";

import { ExternalLinkWithIcon } from "@/components/link";
import { Card, CardContent } from "@/components/ui/card";
Expand Down
7 changes: 2 additions & 5 deletions apps/ensadmin/src/app/name/page.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
"use client";

import { NameDisplay } from "@namehash/namehash-ui";
import type { Name } from "enssdk";
import { useRouter, useSearchParams } from "next/navigation";
import { type ChangeEvent, useMemo, useState } from "react";

import { ENSNamespaceIds } from "@ensnode/datasources";
import {
getNamespaceSpecificValue,
type Name,
type NamespaceSpecificValue,
} from "@ensnode/ensnode-sdk";
import { getNamespaceSpecificValue, type NamespaceSpecificValue } from "@ensnode/ensnode-sdk";

import { getNameDetailsRelativePath, NameLink } from "@/components/name-links";
import { Button } from "@/components/ui/button";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
*/

import { getBlockExplorerBlockUrl, RelativeTime } from "@namehash/namehash-ui";
import type { ChainId } from "enssdk";
import { ExternalLink as ExternalLinkIcon } from "lucide-react";

import type { BlockRef, ChainId } from "@ensnode/ensnode-sdk";
import type { BlockRef } from "@ensnode/ensnode-sdk";

interface BlockNumberProps {
chainId: ChainId;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { getUnixTime } from "date-fns";

import type { UnixTimestamp } from "@ensnode/ensnode-sdk";
import type { UnixTimestamp } from "enssdk";

/**
* Calculate the position of a date in a timeline.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,9 @@
*/

import { AbsoluteTime, ChainIcon, getChainName } from "@namehash/namehash-ui";
import type { ChainId, UnixTimestamp } from "enssdk";

import {
type BlockRef,
type ChainId,
ChainIndexingStatusIds,
type UnixTimestamp,
} from "@ensnode/ensnode-sdk";
import { type BlockRef, ChainIndexingStatusIds } from "@ensnode/ensnode-sdk";

import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
import { formatChainStatus } from "@/lib/indexing-status";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"use client";

import { formatRelativeTime, RelativeTime, useNow } from "@namehash/namehash-ui";
import type { UnixTimestamp } from "enssdk";
import { InfoIcon } from "lucide-react";

import type { Duration, UnixTimestamp } from "@ensnode/ensnode-sdk";
import type { Duration } from "@ensnode/ensnode-sdk";

import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";

Expand Down
3 changes: 1 addition & 2 deletions apps/ensadmin/src/components/name-links/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import type { Name } from "enssdk";
import type { PropsWithChildren } from "react";
import * as React from "react";

import { type Name } from "@ensnode/ensnode-sdk";

import { InternalLink } from "@/components/link";
import { useRawConnectionUrlParam } from "@/hooks/use-connection-url-param";

Expand Down
3 changes: 1 addition & 2 deletions apps/ensadmin/src/components/nav-main.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
"use client";

import type { UrlString } from "enssdk";
import { ChevronRight, type LucideIcon } from "lucide-react";
import Link from "next/link";
import { usePathname } from "next/navigation";

import type { UrlString } from "@ensnode/ensnode-sdk";

import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@/components/ui/collapsible";
import {
SidebarGroup,
Expand Down
10 changes: 4 additions & 6 deletions apps/ensadmin/src/lib/default-records-selection.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import type { CoinType } from "enssdk";
import { ETH_COIN_TYPE, evmChainIdToCoinType } from "enssdk";

import { type ENSNamespaceId, ENSNamespaceIds } from "@ensnode/datasources";
import {
CoinType,
ETH_COIN_TYPE,
evmChainIdToCoinType,
ResolverRecordsSelection,
} from "@ensnode/ensnode-sdk";
import type { ResolverRecordsSelection } from "@ensnode/ensnode-sdk";

import { getENSIP19SupportedChainIds } from "@/lib/get-ensip19-supported-chain-ids";

Expand Down
4 changes: 3 additions & 1 deletion apps/ensadmin/src/lib/get-ensip19-supported-chain-ids.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import type { ChainId } from "enssdk";

import { DatasourceNames, type ENSNamespaceId, maybeGetDatasource } from "@ensnode/datasources";
import { type ChainId, uniq } from "@ensnode/ensnode-sdk";
import { uniq } from "@ensnode/ensnode-sdk";

/**
* Returns the unique set of chain IDs that support ENSIP-19 reverse resolution
Expand Down
Loading
Loading