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
7 changes: 0 additions & 7 deletions .changeset/icy-clubs-shave.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { ENSNamespaceId } from "@ensnode/datasources";
import { PluginName } from "@ensnode/ensnode-sdk";
import { fromUnixTime } from "date-fns";
import { base, mainnet } from "viem/chains";
Expand Down Expand Up @@ -33,12 +32,12 @@ describe("View Models", () => {
const result = ensNodeEnvViewModel({
ACTIVE_PLUGINS: [PluginName.Subgraph],
DATABASE_SCHEMA: "public",
NAMESPACE: ENSNamespaceId.EnsTestEnv,
NAMESPACE: "ens-test-env",
});

expect(result).toEqual([
{ label: "Active Plugins", value: [PluginName.Subgraph] },
{ label: "ENS Namespace", value: ENSNamespaceId.EnsTestEnv },
{ label: "ENS Namespace", value: "ens-test-env" },
{ label: "Database Schema", value: "public" },
]);
});
Expand All @@ -51,7 +50,7 @@ describe("View Models", () => {
const mainnetStatus = ensNodeNetworkStatus[mainnet.id];
const baseStatus = ensNodeNetworkStatus[base.id];

expect(globalIndexingStatusViewModel(ensNodeNetworkStatus, ENSNamespaceId.Mainnet)).toEqual({
expect(globalIndexingStatusViewModel(ensNodeNetworkStatus, "mainnet")).toEqual({
networkStatuses: [
{
name: "Ethereum",
Expand Down
6 changes: 3 additions & 3 deletions apps/ensindexer/src/config/config.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
DEFAULT_RPC_RATE_LIMIT,
} from "@/lib/lib-config";
import { uniq } from "@/lib/lib-helpers";
import { ENSNamespaceId } from "@ensnode/datasources";
import { ENSNamespaceIds } from "@ensnode/datasources";
import { PluginName } from "@ensnode/ensnode-sdk";

const chainIdSchema = z.number().int().min(1);
Expand Down Expand Up @@ -56,9 +56,9 @@ const RpcConfigSchema = z.object({
});

const ENSNamespaceSchema = z
.enum(ENSNamespaceId, {
.enum(ENSNamespaceIds, {
error: (issue) => {
return `Invalid NAMESPACE. Supported ENS namespaces are: ${Object.keys(ENSNamespaceId).join(", ")}`;
return `Invalid NAMESPACE. Supported ENS namespaces are: ${Object.keys(ENSNamespaceIds).join(", ")}`;
},
})
.default(DEFAULT_NAMESPACE);
Expand Down
4 changes: 2 additions & 2 deletions apps/ensindexer/src/config/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Blockrange } from "@/lib/types";
import type { ENSNamespaceId } from "@ensnode/datasources";
import type { ENSNamespaceId, ENSNamespaceIds } from "@ensnode/datasources";
import type { PluginName } from "@ensnode/ensnode-sdk";

/**
Expand Down Expand Up @@ -32,7 +32,7 @@ export interface ENSIndexerConfig {
/**
* The ENS namespace that ENSNode operates in the context of, defaulting to 'mainnet' (DEFAULT_NAMESPACE).
*
* See {@link ENSNamespaceId} for available namespace identifiers.
* See {@link ENSNamespaceIds} for available namespace identifiers.
*/
namespace: ENSNamespaceId;

Expand Down
4 changes: 2 additions & 2 deletions apps/ensindexer/src/lib/lib-config.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import type { ENSIndexerConfig, RpcConfigEnvironment } from "@/config/types";
import { ENSNamespaceId } from "@ensnode/datasources";
import { ENSNamespaceIds } from "@ensnode/datasources";

export const DEFAULT_RPC_RATE_LIMIT = 500;
export const DEFAULT_ENSADMIN_URL = "https://admin.ensnode.io";
export const DEFAULT_PORT = 42069;
export const DEFAULT_HEAL_REVERSE_ADDRESSES = true;
export const DEFAULT_INDEX_ADDITIONAL_RESOLVER_RECORDS = true;
export const DEFAULT_NAMESPACE = ENSNamespaceId.Mainnet;
export const DEFAULT_NAMESPACE = ENSNamespaceIds.Mainnet;

/**
* Extracts dynamic chain configuration from environment variables.
Expand Down
4 changes: 1 addition & 3 deletions apps/ensindexer/src/lib/plugin-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,7 @@ export function parseLabelAndNameFromOnChainMetadata(uri: string): [Label, Name]
* those plugins pass the typechecker. ENSNode ensures that non-active plugins are not executed,
* so the issue of type/value mismatch does not occur during execution.
*/
type ENSNamespaceFullyDefinedAtCompileTime = ReturnType<
typeof getENSNamespace<ENSNamespaceId.Mainnet>
>;
type ENSNamespaceFullyDefinedAtCompileTime = ReturnType<typeof getENSNamespace<"mainnet">>;

/**
* Returns the ENSNamespace for the provided `namespaceId`, cast to ENSNamespaceFullyDefinedAtCompileTime.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export function getRegistrarManagedName(namespaceId: ENSNamespaceId): RegistrarM
return "basetest.eth";
case "holesky":
case "ens-test-env":
default:
throw new Error(
`No registrar managed name is known for the Basenames plugin within the "${namespaceId}" namespace.`,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export function getRegistrarManagedName(namespaceId: ENSNamespaceId): RegistrarM
return "linea-sepolia.eth";
case "holesky":
case "ens-test-env":
default:
throw new Error(
`No registrar managed name is known for the Linea Names plugin within the "${namespaceId}" namespace.`,
);
Expand Down
4 changes: 2 additions & 2 deletions apps/ensindexer/test/dns-helpers.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, expect, it } from "vitest";

import { decodeDNSPacketBytes, decodeTXTData, parseRRSet } from "@/lib/dns-helpers";
import { ENSNamespaceId, getDatasource } from "@ensnode/datasources";
import { getDatasource } from "@ensnode/datasources";
import { TxtAnswer } from "dns-packet";
import { decodeEventLog, hexToBytes, toBytes, zeroHash } from "viem";

Expand All @@ -10,7 +10,7 @@ import { decodeEventLog, hexToBytes, toBytes, zeroHash } from "viem";
const {
args: { record },
} = decodeEventLog({
abi: getDatasource(ENSNamespaceId.Mainnet, "threedns-base").contracts.Resolver.abi,
abi: getDatasource("mainnet", "threedns-base").contracts.Resolver.abi,
topics: [
"0xaaac3b4b3e6807b5b4585562beabaa2de9bd07db514a1eba2c11d1af5b9d9dc7",
"0x6470e2677db6a5bb6c69e51fce7271aeeb5f2808ea7dfdf34b703749555b3e10",
Expand Down
19 changes: 12 additions & 7 deletions packages/datasources/src/lib/types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Abi, Address, Chain } from "viem";

/**
* ENSNamespaceId enum encodes the set of identifiers for well-known ENS namespaces.
* ENSNamespaceIds encodes the set of identifiers for well-known ENS namespaces.
*
* Each ENS namespace is a single, unified set of ENS names with a distinct onchain root
* Registry (the ensroot Datasource) and the capability of spanning from that root Registry across
Expand All @@ -26,12 +26,17 @@ import type { Abi, Address, Chain } from "viem";
* protocol changes, running deterministic test suites, and local development.
* https://github.com/ensdomains/ens-test-env
*/
export enum ENSNamespaceId {
Mainnet = "mainnet",
Sepolia = "sepolia",
Holesky = "holesky",
EnsTestEnv = "ens-test-env",
}
export const ENSNamespaceIds = {
Mainnet: "mainnet",
Sepolia: "sepolia",
Holesky: "holesky",
EnsTestEnv: "ens-test-env",
} as const;

/**
* ENSNamespaceId is the derived string union of possible ENS namespace identifiers.
*/
export type ENSNamespaceId = (typeof ENSNamespaceIds)[keyof typeof ENSNamespaceIds];

/**
* A Datasource describes a set of contracts on a given chain that interact with the ENS protocol.
Expand Down