@ensnode/ensnode-sdk 1.8.1 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,228 +1,13 @@
1
- // src/ens/index.ts
2
- import { getENSRootChainId } from "@ensnode/datasources";
3
-
4
- // src/ens/coin-type.ts
5
- import {
6
- coinTypeToEvmChainId as _coinTypeToEvmChainId,
7
- evmChainIdToCoinType as _evmChainIdToCoinType
8
- } from "@ensdomains/address-encoder/utils";
9
- var ETH_COIN_TYPE = 60;
10
- var DEFAULT_EVM_CHAIN_ID = 0;
11
- var DEFAULT_EVM_COIN_TYPE = 2147483648;
12
- var coinTypeToEvmChainId = (coinType) => {
13
- if (coinType === ETH_COIN_TYPE) return 1;
14
- return _coinTypeToEvmChainId(coinType);
15
- };
16
- var evmChainIdToCoinType = (chainId) => {
17
- if (chainId === 1) return ETH_COIN_TYPE;
18
- return _evmChainIdToCoinType(chainId);
19
- };
20
- var bigintToCoinType = (value) => {
21
- if (value > BigInt(Number.MAX_SAFE_INTEGER)) {
22
- throw new Error(`'${value}' cannot represent as CoinType, it is too large.`);
23
- }
24
- return Number(value);
25
- };
26
-
27
- // src/ens/constants.ts
28
- import { namehash, zeroHash } from "viem";
29
- var ROOT_NODE = namehash("");
30
- var ETH_NODE = namehash("eth");
31
- var BASENAMES_NODE = namehash("base.eth");
32
- var LINEANAMES_NODE = namehash("linea.eth");
33
- var ADDR_REVERSE_NODE = namehash("addr.reverse");
34
- var NODE_ANY = zeroHash;
35
- var ROOT_RESOURCE = 0n;
36
-
37
- // src/ens/dns-encoded-name.ts
38
- import { bytesToString, hexToBytes } from "viem";
39
- function decodeDNSEncodedLiteralName(packet) {
40
- return decodeDNSEncodedName(packet);
41
- }
42
- function decodeDNSEncodedName(packet) {
43
- const segments = [];
44
- const bytes = hexToBytes(packet);
45
- if (bytes.length === 0) throw new Error(`Packet is empty.`);
46
- let offset = 0;
47
- while (offset < bytes.length) {
48
- const len = bytes[offset];
49
- if (len === void 0) {
50
- throw new Error(`Invariant: bytes[offset] is undefined after offset < bytes.length check.`);
51
- }
52
- if (len < 0 || len > 255) {
53
- throw new Error(
54
- `Invariant: this should be literally impossible, but an unsigned byte was less than zero or greater than 255. The value in question is ${len}`
55
- );
56
- }
57
- if (len === 0) break;
58
- const segment = bytesToString(bytes.subarray(offset + 1, offset + len + 1));
59
- segments.push(segment);
60
- offset += len + 1;
61
- }
62
- if (offset >= bytes.length) throw new Error(`Overflow, offset >= bytes.length`);
63
- if (offset !== bytes.length - 1) throw new Error(`Junk at end of name`);
64
- return segments;
65
- }
66
-
67
- // src/ens/labelhash.ts
68
- import { isHex } from "viem";
69
- function isLabelHash(maybeLabelHash) {
70
- const expectedLength = maybeLabelHash.length === 66;
71
- const expectedEncoding = isHex(maybeLabelHash);
72
- const expectedCasing = maybeLabelHash === maybeLabelHash.toLowerCase();
73
- return expectedLength && expectedEncoding && expectedCasing;
74
- }
1
+ // src/index.ts
2
+ import { ENSNamespaceIds as ENSNamespaceIds7 } from "@ensnode/datasources";
75
3
 
76
- // src/ens/encode-labelhash.ts
77
- var encodeLabelHash = (labelHash) => `[${labelHash.slice(2)}]`;
78
- function isEncodedLabelHash(maybeEncodedLabelHash) {
79
- const expectedFormatting = maybeEncodedLabelHash.startsWith("[") && maybeEncodedLabelHash.endsWith("]");
80
- const includesLabelHash = isLabelHash(`0x${maybeEncodedLabelHash.slice(1, -1)}`);
81
- return expectedFormatting && includesLabelHash;
82
- }
4
+ // src/ens/index.ts
5
+ import { ENSNamespaceIds, getENSRootChainId } from "@ensnode/datasources";
83
6
 
84
7
  // src/ens/fuses.ts
85
8
  var PARENT_CANNOT_CONTROL = 65536;
86
9
  var isPccFuseSet = (fuses) => (fuses & PARENT_CANNOT_CONTROL) === PARENT_CANNOT_CONTROL;
87
10
 
88
- // src/ens/is-normalized.ts
89
- import { normalize } from "viem/ens";
90
- function isNormalizedName(name) {
91
- try {
92
- return name === normalize(name);
93
- } catch {
94
- return false;
95
- }
96
- }
97
- function isNormalizedLabel(label) {
98
- if (label === "") return false;
99
- if (label.includes(".")) return false;
100
- try {
101
- return label === normalize(label);
102
- } catch {
103
- return false;
104
- }
105
- }
106
-
107
- // src/ens/names.ts
108
- import { ens_beautify } from "@adraffy/ens-normalize";
109
- var ENS_ROOT = "";
110
- var getNameHierarchy = (name) => name.split(".").map((_, i, labels) => labels.slice(i).join("."));
111
- var getParentNameFQDN = (name) => {
112
- if (name === ENS_ROOT) {
113
- throw new Error("There is no parent name for ENS Root.");
114
- }
115
- const labels = name.split(".");
116
- if (labels.length === 1) {
117
- return ENS_ROOT;
118
- }
119
- return labels.slice(1).join(".");
120
- };
121
- var beautifyName = (name) => {
122
- const beautifiedLabels = name.split(".").map((label) => {
123
- if (isNormalizedLabel(label)) {
124
- return ens_beautify(label);
125
- } else {
126
- return label;
127
- }
128
- });
129
- return beautifiedLabels.join(".");
130
- };
131
-
132
- // src/ens/parse-labelhash.ts
133
- import { isHex as isHex2 } from "viem";
134
- function parseLabelHash(maybeLabelHash) {
135
- const hexPart = maybeLabelHash.startsWith("0x") ? maybeLabelHash.slice(2) : maybeLabelHash;
136
- if (!isHex2(`0x${hexPart}`, { strict: true })) {
137
- throw new Error(`Invalid labelHash: contains non-hex characters: ${maybeLabelHash}`);
138
- }
139
- const normalizedHexPart = hexPart.length % 2 === 1 ? `0${hexPart}` : hexPart;
140
- if (normalizedHexPart.length !== 64) {
141
- throw new Error(
142
- `Invalid labelHash length: expected 32 bytes (64 hex chars), got ${normalizedHexPart.length / 2} bytes: ${maybeLabelHash}`
143
- );
144
- }
145
- return `0x${normalizedHexPart.toLowerCase()}`;
146
- }
147
- function parseEncodedLabelHash(maybeEncodedLabelHash) {
148
- if (!maybeEncodedLabelHash.startsWith("[") || !maybeEncodedLabelHash.endsWith("]")) {
149
- throw new Error(
150
- `Invalid encoded labelHash: must be enclosed in square brackets: ${maybeEncodedLabelHash}`
151
- );
152
- }
153
- return parseLabelHash(maybeEncodedLabelHash.slice(1, -1));
154
- }
155
- function parseLabelHashOrEncodedLabelHash(maybeLabelHash) {
156
- if (maybeLabelHash.startsWith("[") && maybeLabelHash.endsWith("]")) {
157
- return parseEncodedLabelHash(maybeLabelHash);
158
- }
159
- return parseLabelHash(maybeLabelHash);
160
- }
161
-
162
- // src/ens/parse-reverse-name.ts
163
- import { hexToBigInt, isAddress } from "viem";
164
-
165
- // src/shared/address.ts
166
- function asLowerCaseAddress(address) {
167
- return address.toLowerCase();
168
- }
169
-
170
- // src/ens/parse-reverse-name.ts
171
- var REVERSE_NAME_REGEX = /^([0-9a-fA-F]+)\.([0-9a-f]{1,64}|addr|default)\.reverse$/;
172
- var parseAddressLabel = (addressLabel) => {
173
- const maybeAddress = `0x${addressLabel}`;
174
- if (!isAddress(maybeAddress)) {
175
- throw new Error(`Invalid EVM address "${maybeAddress}"`);
176
- }
177
- return asLowerCaseAddress(maybeAddress);
178
- };
179
- var parseCoinTypeLabel = (coinTypeLabel) => {
180
- if (coinTypeLabel === "default") return DEFAULT_EVM_COIN_TYPE;
181
- if (coinTypeLabel === "addr") return ETH_COIN_TYPE;
182
- return bigintToCoinType(hexToBigInt(`0x${coinTypeLabel}`));
183
- };
184
- function parseReverseName(name) {
185
- const match = name.match(REVERSE_NAME_REGEX);
186
- if (!match) return null;
187
- try {
188
- const [, addressLabel, coinTypeLabel] = match;
189
- if (!addressLabel) return null;
190
- if (!coinTypeLabel) return null;
191
- return {
192
- address: parseAddressLabel(addressLabel),
193
- coinType: parseCoinTypeLabel(coinTypeLabel)
194
- };
195
- } catch {
196
- return null;
197
- }
198
- }
199
-
200
- // src/ens/reverse-name.ts
201
- var addrReverseLabel = (address) => address.slice(2);
202
- var coinTypeReverseLabel = (coinType) => coinType.toString(16);
203
- function reverseName(address, coinType) {
204
- const label = addrReverseLabel(address);
205
- const middle = (() => {
206
- switch (coinType) {
207
- case ETH_COIN_TYPE:
208
- return "addr";
209
- case DEFAULT_EVM_COIN_TYPE:
210
- return "default";
211
- default:
212
- return coinTypeReverseLabel(coinType);
213
- }
214
- })();
215
- return `${label}.${middle}.reverse`;
216
- }
217
-
218
- // src/ens/subname-helpers.ts
219
- import { concat, keccak256, toHex } from "viem";
220
- var makeSubdomainNode = (labelHash, node) => keccak256(concat([node, labelHash]));
221
- var uint256ToHex32 = (num) => toHex(num, { size: 32 });
222
-
223
- // src/ens/types.ts
224
- import { ENSNamespaceIds } from "@ensnode/datasources";
225
-
226
11
  // src/ensapi/config/deserialize.ts
227
12
  import { prettifyError as prettifyError2 } from "zod/v4";
228
13
 
@@ -237,7 +22,8 @@ import { z as z2 } from "zod/v4";
237
22
 
238
23
  // src/shared/zod-schemas.ts
239
24
  import { AccountId as CaipAccountId } from "caip";
240
- import { isAddress as isAddress2, isHex as isHex3, size } from "viem";
25
+ import { reinterpretName, toNormalizedAddress } from "enssdk";
26
+ import { isAddress, isHex, size } from "viem";
241
27
  import { z } from "zod/v4";
242
28
 
243
29
  // src/shared/currencies.ts
@@ -392,26 +178,6 @@ function parseDai(value) {
392
178
  return priceDai(amount);
393
179
  }
394
180
 
395
- // src/shared/interpretation/reinterpretation.ts
396
- import { labelhash as labelToLabelHash } from "viem";
397
- function reinterpretLabel(label) {
398
- if (label === "") {
399
- throw new Error(
400
- `Cannot reinterpret an empty label that violates the invariants of an InterpretedLabel.`
401
- );
402
- }
403
- if (isEncodedLabelHash(label)) return label;
404
- if (isNormalizedLabel(label)) return label;
405
- return encodeLabelHash(labelToLabelHash(label));
406
- }
407
- function reinterpretName(name) {
408
- if (name === "") return name;
409
- const interpretedLabels = name.split(".");
410
- const reinterpretedLabels = interpretedLabels.map(reinterpretLabel);
411
- const reinterpretedName = reinterpretedLabels.join(".");
412
- return reinterpretedName;
413
- }
414
-
415
181
  // src/shared/zod-schemas.ts
416
182
  var makeIntegerSchema = (valueLabel = "Value") => z.int({
417
183
  error: `${valueLabel} must be an integer.`
@@ -427,15 +193,15 @@ var makeDurationSchema = (valueLabel = "Value") => z.number({
427
193
  }).pipe(makeNonNegativeIntegerSchema(valueLabel));
428
194
  var makeChainIdSchema = (valueLabel = "Chain ID") => makePositiveIntegerSchema(valueLabel).transform((val) => val);
429
195
  var makeChainIdStringSchema = (valueLabel = "Chain ID String") => z.string({ error: `${valueLabel} must be a string representing a chain ID.` }).pipe(z.coerce.number({ error: `${valueLabel} must represent a positive integer (>0).` })).pipe(makeChainIdSchema(`The numeric value represented by ${valueLabel}`));
430
- var makeLowercaseAddressSchema = (valueLabel = "EVM address") => z.string().check((ctx) => {
431
- if (!isAddress2(ctx.value)) {
196
+ var makeNormalizedAddressSchema = (valueLabel = "EVM address") => z.string().check((ctx) => {
197
+ if (!isAddress(ctx.value, { strict: false })) {
432
198
  ctx.issues.push({
433
199
  code: "custom",
434
200
  message: `${valueLabel} must be a valid EVM address`,
435
201
  input: ctx.value
436
202
  });
437
203
  }
438
- }).transform((val) => asLowerCaseAddress(val));
204
+ }).transform((val) => toNormalizedAddress(val));
439
205
  var makeDatetimeSchema = (valueLabel = "Datetime string") => z.iso.datetime({ error: `${valueLabel} must be a string in ISO 8601 format.` }).transform((v) => new Date(v));
440
206
  var makeUnixTimestampSchema = (valueLabel = "Timestamp") => makeIntegerSchema(valueLabel);
441
207
  var makeUrlSchema = (valueLabel = "Value") => z.url({
@@ -473,7 +239,7 @@ var makePriceUsdcSchema = (valueLabel = "Price USDC") => makePriceCurrencySchema
473
239
  var makePriceDaiSchema = (valueLabel = "Price DAI") => makePriceCurrencySchema(CurrencyIds.DAI, valueLabel).transform((v) => v);
474
240
  var makeAccountIdSchema = (valueLabel = "AccountId") => z.strictObject({
475
241
  chainId: makeChainIdSchema(`${valueLabel} chain ID`),
476
- address: makeLowercaseAddressSchema(`${valueLabel} address`)
242
+ address: makeNormalizedAddressSchema(`${valueLabel} address`)
477
243
  });
478
244
  var makeAccountIdStringSchema = (valueLabel = "Account ID String") => z.coerce.string().transform((v) => {
479
245
  const result = new CaipAccountId(v);
@@ -483,7 +249,7 @@ var makeAccountIdStringSchema = (valueLabel = "Account ID String") => z.coerce.s
483
249
  };
484
250
  }).pipe(makeAccountIdSchema(valueLabel));
485
251
  var makeHexStringSchema = (options, valueLabel = "String representation of bytes array") => z.string().check(function invariant_isHexEncoded(ctx) {
486
- if (!isHex3(ctx.value)) {
252
+ if (!isHex(ctx.value)) {
487
253
  ctx.issues.push({
488
254
  code: "custom",
489
255
  input: ctx.value,
@@ -522,9 +288,8 @@ var makeLabelSetIdSchema = (valueLabel = "Label set ID") => {
522
288
  error: `${valueLabel} can only contain lowercase letters (a-z) and hyphens (-)`
523
289
  });
524
290
  };
525
- var makeLabelSetVersionSchema = (valueLabel = "Label set version") => {
526
- return z2.coerce.number({ error: `${valueLabel} must be an integer.` }).pipe(makeNonNegativeIntegerSchema(valueLabel));
527
- };
291
+ var makeLabelSetVersionSchema = (valueLabel = "Label set version") => makeNonNegativeIntegerSchema(valueLabel);
292
+ var makeLabelSetVersionStringSchema = (valueLabel = "Label set version") => z2.coerce.number({ error: `${valueLabel} must be a non-negative integer` }).pipe(makeLabelSetVersionSchema(valueLabel));
528
293
  var makeEnsRainbowPublicConfigSchema = (valueLabel = "EnsRainbowPublicConfig") => z2.object({
529
294
  version: z2.string().nonempty({ error: `${valueLabel}.version must be a non-empty string.` }),
530
295
  labelSet: z2.object({
@@ -569,7 +334,7 @@ function buildLabelSetId(maybeLabelSetId) {
569
334
  return makeLabelSetIdSchema("LabelSetId").parse(maybeLabelSetId);
570
335
  }
571
336
  function buildLabelSetVersion(maybeLabelSetVersion) {
572
- return makeLabelSetVersionSchema("LabelSetVersion").parse(maybeLabelSetVersion);
337
+ return makeLabelSetVersionStringSchema("LabelSetVersion").parse(maybeLabelSetVersion);
573
338
  }
574
339
  function buildEnsRainbowClientLabelSet(labelSetId, labelSetVersion) {
575
340
  if (labelSetVersion !== void 0 && labelSetId === void 0) {
@@ -621,7 +386,7 @@ var makePluginsListSchema = (valueLabel = "Plugins") => z3.array(z3.string(), {
621
386
  }).refine((arr) => arr.length === uniq(arr).length, {
622
387
  error: `${valueLabel} cannot contain duplicate values.`
623
388
  });
624
- var makeDatabaseSchemaNameSchema = (valueLabel = "Database schema name") => z3.string({ error: `${valueLabel} must be a string` }).trim().nonempty({
389
+ var makeEnsIndexerSchemaNameSchema = (valueLabel = "ENS Indexer Schema Name") => z3.string({ error: `${valueLabel} must be a string` }).trim().nonempty({
625
390
  error: `${valueLabel} is required and must be a non-empty string.`
626
391
  });
627
392
  var makeFullyPinnedLabelSetSchema = (valueLabel = "Label set") => {
@@ -636,13 +401,12 @@ var makeFullyPinnedLabelSetSchema = (valueLabel = "Label set") => {
636
401
  }
637
402
  return z3.object({
638
403
  labelSetId: makeLabelSetIdSchema(valueLabelLabelSetId),
639
- labelSetVersion: makeLabelSetVersionSchema(valueLabelLabelSetVersion)
404
+ labelSetVersion: makeLabelSetVersionStringSchema(valueLabelLabelSetVersion)
640
405
  });
641
406
  };
642
407
  var makeNonEmptyStringSchema = (valueLabel = "Value") => z3.string().nonempty({ error: `${valueLabel} must be a non-empty string.` });
643
408
  var makeEnsIndexerVersionInfoSchema = (valueLabel = "Value") => z3.object(
644
409
  {
645
- nodejs: makeNonEmptyStringSchema(),
646
410
  ponder: makeNonEmptyStringSchema(),
647
411
  ensDb: makeNonEmptyStringSchema(),
648
412
  ensIndexer: makeNonEmptyStringSchema(),
@@ -677,7 +441,7 @@ function invariant_ensRainbowSupportedLabelSetAndVersion(ctx) {
677
441
  }
678
442
  }
679
443
  var makeEnsIndexerPublicConfigSchema = (valueLabel = "ENSIndexerPublicConfig") => z3.object({
680
- databaseSchemaName: makeDatabaseSchemaNameSchema(`${valueLabel}.databaseSchemaName`),
444
+ ensIndexerSchemaName: makeEnsIndexerSchemaNameSchema(`${valueLabel}.ensIndexerSchemaName`),
681
445
  ensRainbowPublicConfig: makeEnsRainbowPublicConfigSchema(
682
446
  `${valueLabel}.ensRainbowPublicConfig`
683
447
  ),
@@ -691,7 +455,7 @@ var makeEnsIndexerPublicConfigSchema = (valueLabel = "ENSIndexerPublicConfig") =
691
455
  versionInfo: makeEnsIndexerVersionInfoSchema(`${valueLabel}.versionInfo`)
692
456
  }).check(invariant_isSubgraphCompatibleRequirements).check(invariant_ensRainbowSupportedLabelSetAndVersion);
693
457
  var makeSerializedEnsIndexerPublicConfigSchema = (valueLabel = "Serialized ENSIndexerPublicConfig") => z3.object({
694
- databaseSchemaName: makeDatabaseSchemaNameSchema(`${valueLabel}.databaseSchemaName`),
458
+ ensIndexerSchemaName: makeEnsIndexerSchemaNameSchema(`${valueLabel}.ensIndexerSchemaName`),
695
459
  ensRainbowPublicConfig: makeEnsRainbowPublicConfigSchema(
696
460
  `${valueLabel}.ensRainbowPublicConfig`
697
461
  ),
@@ -745,23 +509,27 @@ var TheGraphFallbackSchema = z4.discriminatedUnion("canFallback", [
745
509
  ]);
746
510
 
747
511
  // src/ensapi/config/zod-schemas.ts
512
+ var makeEnsApiVersionInfoSchema = (valueLabel = "ENS API version info") => z5.object({
513
+ ensApi: z5.string().nonempty(`${valueLabel}.ensApi must be a non-empty string`),
514
+ ensNormalize: z5.string().nonempty(`${valueLabel}.ensNormalize must be a non-empty string`)
515
+ });
748
516
  function makeEnsApiPublicConfigSchema(valueLabel) {
749
517
  const label = valueLabel ?? "ENSApiPublicConfig";
750
518
  return z5.object({
751
- version: z5.string().min(1, `${label}.version must be a non-empty string`),
752
519
  theGraphFallback: TheGraphFallbackSchema,
753
- ensIndexerPublicConfig: makeEnsIndexerPublicConfigSchema(`${label}.ensIndexerPublicConfig`)
520
+ ensIndexerPublicConfig: makeEnsIndexerPublicConfigSchema(`${label}.ensIndexerPublicConfig`),
521
+ versionInfo: makeEnsApiVersionInfoSchema(`${label}.versionInfo`)
754
522
  });
755
523
  }
756
524
  var makeENSApiPublicConfigSchema = makeEnsApiPublicConfigSchema;
757
525
  function makeSerializedEnsApiPublicConfigSchema(valueLabel) {
758
526
  const label = valueLabel ?? "ENSApiPublicConfig";
759
527
  return z5.object({
760
- version: z5.string().min(1, `${label}.version must be a non-empty string`),
761
- theGraphFallback: TheGraphFallbackSchema,
762
528
  ensIndexerPublicConfig: makeSerializedEnsIndexerPublicConfigSchema(
763
529
  `${label}.ensIndexerPublicConfig`
764
- )
530
+ ),
531
+ theGraphFallback: TheGraphFallbackSchema,
532
+ versionInfo: makeEnsApiVersionInfoSchema(`${label}.versionInfo`)
765
533
  });
766
534
  }
767
535
 
@@ -785,19 +553,13 @@ ${prettifyError2(parsed.error)}
785
553
  }
786
554
  var deserializeENSApiPublicConfig = deserializeEnsApiPublicConfig;
787
555
 
788
- // src/ensapi/api/config/deserialize.ts
789
- function deserializeEnsApiConfigResponse(maybeResponse) {
790
- return deserializeEnsApiPublicConfig(maybeResponse);
791
- }
792
- var deserializeConfigResponse = deserializeEnsApiConfigResponse;
793
-
794
556
  // src/ensindexer/config/serialize.ts
795
557
  function serializeIndexedChainIds(indexedChainIds) {
796
558
  return Array.from(indexedChainIds);
797
559
  }
798
560
  function serializeEnsIndexerPublicConfig(config) {
799
561
  const {
800
- databaseSchemaName,
562
+ ensIndexerSchemaName,
801
563
  ensRainbowPublicConfig,
802
564
  indexedChainIds,
803
565
  isSubgraphCompatible: isSubgraphCompatible2,
@@ -807,7 +569,7 @@ function serializeEnsIndexerPublicConfig(config) {
807
569
  versionInfo
808
570
  } = config;
809
571
  return {
810
- databaseSchemaName,
572
+ ensIndexerSchemaName,
811
573
  ensRainbowPublicConfig,
812
574
  indexedChainIds: serializeIndexedChainIds(indexedChainIds),
813
575
  isSubgraphCompatible: isSubgraphCompatible2,
@@ -821,22 +583,26 @@ var serializeENSIndexerPublicConfig = serializeEnsIndexerPublicConfig;
821
583
 
822
584
  // src/ensapi/config/serialize.ts
823
585
  function serializeEnsApiPublicConfig(config) {
824
- const { version, theGraphFallback, ensIndexerPublicConfig } = config;
586
+ const { ensIndexerPublicConfig, theGraphFallback, versionInfo } = config;
825
587
  return {
826
- version,
588
+ ensIndexerPublicConfig: serializeEnsIndexerPublicConfig(ensIndexerPublicConfig),
827
589
  theGraphFallback,
828
- ensIndexerPublicConfig: serializeEnsIndexerPublicConfig(ensIndexerPublicConfig)
590
+ versionInfo
829
591
  };
830
592
  }
831
593
  var serializeENSApiPublicConfig = serializeEnsApiPublicConfig;
832
594
 
833
- // src/ensapi/api/config/serialize.ts
834
- function serializeEnsApiConfigResponse(response) {
835
- return serializeEnsApiPublicConfig(response);
595
+ // src/ensindexer/api/config/deserialize.ts
596
+ function deserializeEnsIndexerConfigResponse(maybeResponse) {
597
+ return deserializeEnsIndexerPublicConfig(maybeResponse, "EnsIndexerConfigResponse");
598
+ }
599
+
600
+ // src/ensindexer/api/config/serialize.ts
601
+ function serializeEnsIndexerConfigResponse(response) {
602
+ return serializeEnsIndexerPublicConfig(response);
836
603
  }
837
- var serializeConfigResponse = serializeEnsApiConfigResponse;
838
604
 
839
- // src/ensapi/api/indexing-status/deserialize.ts
605
+ // src/ensindexer/api/indexing-status/deserialize.ts
840
606
  import { prettifyError as prettifyError8 } from "zod/v4";
841
607
 
842
608
  // src/indexing-status/deserialize/realtime-indexing-status-projection.ts
@@ -1763,8 +1529,8 @@ ${prettifyError7(parsed.error)}
1763
1529
  return parsed.data;
1764
1530
  }
1765
1531
 
1766
- // src/ensapi/api/indexing-status/response.ts
1767
- var EnsApiIndexingStatusResponseCodes = {
1532
+ // src/ensindexer/api/indexing-status/response.ts
1533
+ var EnsIndexerIndexingStatusResponseCodes = {
1768
1534
  /**
1769
1535
  * Represents that the indexing status is available.
1770
1536
  */
@@ -1774,33 +1540,32 @@ var EnsApiIndexingStatusResponseCodes = {
1774
1540
  */
1775
1541
  Error: "error"
1776
1542
  };
1777
- var IndexingStatusResponseCodes = EnsApiIndexingStatusResponseCodes;
1778
1543
 
1779
- // src/ensapi/api/indexing-status/zod-schemas.ts
1544
+ // src/ensindexer/api/indexing-status/zod-schemas.ts
1780
1545
  import { z as z10 } from "zod/v4";
1781
- var makeEnsApiIndexingStatusResponseOkSchema = (valueLabel = "Indexing Status Response OK") => z10.strictObject({
1782
- responseCode: z10.literal(EnsApiIndexingStatusResponseCodes.Ok),
1546
+ var makeEnsIndexerIndexingStatusResponseOkSchema = (valueLabel = "Indexing Status Response OK") => z10.strictObject({
1547
+ responseCode: z10.literal(EnsIndexerIndexingStatusResponseCodes.Ok),
1783
1548
  realtimeProjection: makeRealtimeIndexingStatusProjectionSchema(valueLabel)
1784
1549
  });
1785
- var makeEnsApiIndexingStatusResponseErrorSchema = (_valueLabel = "Indexing Status Response Error") => z10.strictObject({
1786
- responseCode: z10.literal(EnsApiIndexingStatusResponseCodes.Error)
1550
+ var makeEnsIndexerIndexingStatusResponseErrorSchema = (_valueLabel = "Indexing Status Response Error") => z10.strictObject({
1551
+ responseCode: z10.literal(EnsIndexerIndexingStatusResponseCodes.Error)
1787
1552
  });
1788
- var makeEnsApiIndexingStatusResponseSchema = (valueLabel = "Indexing Status Response") => z10.discriminatedUnion("responseCode", [
1789
- makeEnsApiIndexingStatusResponseOkSchema(valueLabel),
1790
- makeEnsApiIndexingStatusResponseErrorSchema(valueLabel)
1553
+ var makeEnsIndexerIndexingStatusResponseSchema = (valueLabel = "Indexing Status Response") => z10.discriminatedUnion("responseCode", [
1554
+ makeEnsIndexerIndexingStatusResponseOkSchema(valueLabel),
1555
+ makeEnsIndexerIndexingStatusResponseErrorSchema(valueLabel)
1791
1556
  ]);
1792
- var makeSerializedEnsApiIndexingStatusResponseOkSchema = (valueLabel = "Serialized Indexing Status Response OK") => z10.strictObject({
1793
- responseCode: z10.literal(EnsApiIndexingStatusResponseCodes.Ok),
1557
+ var makeSerializedEnsIndexerIndexingStatusResponseOkSchema = (valueLabel = "Serialized Indexing Status Response OK") => z10.strictObject({
1558
+ responseCode: z10.literal(EnsIndexerIndexingStatusResponseCodes.Ok),
1794
1559
  realtimeProjection: makeSerializedRealtimeIndexingStatusProjectionSchema(valueLabel)
1795
1560
  });
1796
- var makeSerializedEnsApiIndexingStatusResponseSchema = (valueLabel = "Serialized Indexing Status Response") => z10.discriminatedUnion("responseCode", [
1797
- makeSerializedEnsApiIndexingStatusResponseOkSchema(valueLabel),
1798
- makeEnsApiIndexingStatusResponseErrorSchema(valueLabel)
1561
+ var makeSerializedEnsIndexerIndexingStatusResponseSchema = (valueLabel = "Serialized Indexing Status Response") => z10.discriminatedUnion("responseCode", [
1562
+ makeSerializedEnsIndexerIndexingStatusResponseOkSchema(valueLabel),
1563
+ makeEnsIndexerIndexingStatusResponseErrorSchema(valueLabel)
1799
1564
  ]);
1800
1565
 
1801
- // src/ensapi/api/indexing-status/deserialize.ts
1802
- function buildUnvalidatedEnsApiIndexingStatusResponse(serializedResponse) {
1803
- if (serializedResponse.responseCode !== EnsApiIndexingStatusResponseCodes.Ok) {
1566
+ // src/ensindexer/api/indexing-status/deserialize.ts
1567
+ function buildUnvalidatedEnsIndexerIndexingStatusResponse(serializedResponse) {
1568
+ if (serializedResponse.responseCode !== EnsIndexerIndexingStatusResponseCodes.Ok) {
1804
1569
  return serializedResponse;
1805
1570
  }
1806
1571
  return {
@@ -1810,21 +1575,19 @@ function buildUnvalidatedEnsApiIndexingStatusResponse(serializedResponse) {
1810
1575
  )
1811
1576
  };
1812
1577
  }
1813
- function deserializeEnsApiIndexingStatusResponse(maybeResponse) {
1814
- const parsed = makeSerializedEnsApiIndexingStatusResponseSchema().transform(buildUnvalidatedEnsApiIndexingStatusResponse).pipe(makeEnsApiIndexingStatusResponseSchema()).safeParse(maybeResponse);
1578
+ function deserializeEnsIndexerIndexingStatusResponse(maybeResponse) {
1579
+ const parsed = makeSerializedEnsIndexerIndexingStatusResponseSchema().transform(buildUnvalidatedEnsIndexerIndexingStatusResponse).pipe(makeEnsIndexerIndexingStatusResponseSchema()).safeParse(maybeResponse);
1815
1580
  if (parsed.error) {
1816
1581
  throw new Error(
1817
- `Cannot deserialize EnsApiIndexingStatusResponse:
1582
+ `Cannot deserialize EnsIndexerIndexingStatusResponse:
1818
1583
  ${prettifyError8(parsed.error)}
1819
1584
  `
1820
1585
  );
1821
1586
  }
1822
1587
  return parsed.data;
1823
1588
  }
1824
- var deserializeIndexingStatusResponse = deserializeEnsApiIndexingStatusResponse;
1825
1589
 
1826
1590
  // src/shared/serialize.ts
1827
- import { AccountId as CaipAccountId2, AssetId as CaipAssetId } from "caip";
1828
1591
  function serializeChainId(chainId) {
1829
1592
  return chainId.toString();
1830
1593
  }
@@ -1849,23 +1612,6 @@ function serializePriceUsdc(price) {
1849
1612
  function serializePriceDai(price) {
1850
1613
  return serializePrice(price);
1851
1614
  }
1852
- function formatAccountId(accountId) {
1853
- return CaipAccountId2.format({
1854
- chainId: { namespace: "eip155", reference: accountId.chainId.toString() },
1855
- address: accountId.address
1856
- }).toLowerCase();
1857
- }
1858
- function formatAssetId({
1859
- assetNamespace,
1860
- contract: { chainId, address },
1861
- tokenId
1862
- }) {
1863
- return CaipAssetId.format({
1864
- chainId: { namespace: "eip155", reference: chainId.toString() },
1865
- assetName: { namespace: assetNamespace, reference: address },
1866
- tokenId: uint256ToHex32(tokenId)
1867
- }).toLowerCase();
1868
- }
1869
1615
 
1870
1616
  // src/indexing-status/serialize/chain-indexing-status-snapshot.ts
1871
1617
  function serializeChainIndexingSnapshots(chains) {
@@ -1937,186 +1683,558 @@ function serializeRealtimeIndexingStatusProjection(indexingProjection) {
1937
1683
  };
1938
1684
  }
1939
1685
 
1940
- // src/ensapi/api/indexing-status/serialize.ts
1941
- function serializeEnsApiIndexingStatusResponse(response) {
1686
+ // src/ensindexer/api/indexing-status/serialize.ts
1687
+ function serializeEnsIndexerIndexingStatusResponse(response) {
1942
1688
  switch (response.responseCode) {
1943
- case EnsApiIndexingStatusResponseCodes.Ok:
1689
+ case EnsIndexerIndexingStatusResponseCodes.Ok:
1944
1690
  return {
1945
1691
  responseCode: response.responseCode,
1946
1692
  realtimeProjection: serializeRealtimeIndexingStatusProjection(response.realtimeProjection)
1947
1693
  };
1948
- case EnsApiIndexingStatusResponseCodes.Error:
1694
+ case EnsIndexerIndexingStatusResponseCodes.Error:
1949
1695
  return response;
1950
1696
  }
1951
1697
  }
1952
- var serializeIndexingStatusResponse = serializeEnsApiIndexingStatusResponse;
1953
-
1954
- // src/ensapi/api/name-tokens/deserialize.ts
1955
- import { prettifyError as prettifyError10 } from "zod/v4";
1956
1698
 
1957
- // src/ensapi/api/name-tokens/zod-schemas.ts
1958
- import { namehash as namehash2 } from "viem";
1959
- import { z as z13 } from "zod/v4";
1960
-
1961
- // src/tokenscope/name-token.ts
1962
- import { isAddressEqual as isAddressEqual3, zeroAddress as zeroAddress3 } from "viem";
1963
- import { DatasourceNames } from "@ensnode/datasources";
1964
-
1965
- // src/shared/account-id.ts
1966
- import { isAddressEqual } from "viem";
1967
- var accountIdEqual = (a, b) => {
1968
- return a.chainId === b.chainId && isAddressEqual(a.address, b.address);
1969
- };
1970
-
1971
- // src/shared/datasource-contract.ts
1972
- import {
1973
- maybeGetDatasource
1974
- } from "@ensnode/datasources";
1975
- var maybeGetDatasourceContract = (namespaceId, datasourceName, contractName) => {
1976
- const datasource = maybeGetDatasource(namespaceId, datasourceName);
1977
- if (!datasource) return void 0;
1978
- const address = datasource.contracts[contractName]?.address;
1979
- if (address === void 0 || Array.isArray(address)) return void 0;
1980
- return {
1981
- chainId: datasource.chain.id,
1982
- address
1983
- };
1984
- };
1985
- var getDatasourceContract = (namespaceId, datasourceName, contractName) => {
1986
- const contract = maybeGetDatasourceContract(namespaceId, datasourceName, contractName);
1987
- if (!contract) {
1988
- throw new Error(
1989
- `Expected contract not found for ${namespaceId} ${datasourceName} ${contractName}`
1990
- );
1991
- }
1992
- return contract;
1993
- };
1994
- var makeContractMatcher = (namespace, b) => (datasourceName, contractName) => {
1995
- const a = maybeGetDatasourceContract(namespace, datasourceName, contractName);
1996
- return a && accountIdEqual(a, b);
1997
- };
1998
-
1999
- // src/tokenscope/assets.ts
2000
- import { isAddressEqual as isAddressEqual2, zeroAddress as zeroAddress2 } from "viem";
1699
+ // src/ensindexer/api/shared/errors/deserialize.ts
2001
1700
  import { prettifyError as prettifyError9 } from "zod/v4";
2002
1701
 
2003
- // src/tokenscope/zod-schemas.ts
2004
- import { AssetId as CaipAssetId2 } from "caip";
2005
- import { zeroAddress } from "viem";
1702
+ // src/ensindexer/api/shared/errors/zod-schemas.ts
2006
1703
  import { z as z11 } from "zod/v4";
2007
-
2008
- // src/shared/types.ts
2009
- var AssetNamespaces = {
2010
- ERC721: "erc721",
2011
- ERC1155: "erc1155"
2012
- };
2013
-
2014
- // src/tokenscope/zod-schemas.ts
2015
- var tokenIdSchemaSerializable = z11.string();
2016
- var tokenIdSchemaNative = z11.preprocess(
2017
- (v) => typeof v === "string" ? BigInt(v) : v,
2018
- z11.bigint().positive()
2019
- );
2020
- function makeTokenIdSchema(_valueLabel = "Token ID Schema", serializable = false) {
2021
- if (serializable) {
2022
- return tokenIdSchemaSerializable;
2023
- } else {
2024
- return tokenIdSchemaNative;
2025
- }
2026
- }
2027
- var makeAssetIdSchema = (valueLabel = "Asset ID Schema", serializable) => {
2028
- return z11.object({
2029
- assetNamespace: z11.enum(AssetNamespaces),
2030
- contract: makeAccountIdSchema(valueLabel),
2031
- tokenId: makeTokenIdSchema(valueLabel, serializable ?? false)
2032
- });
2033
- };
2034
- var makeAssetIdStringSchema = (valueLabel = "Asset ID String Schema") => z11.preprocess((v) => {
2035
- if (typeof v === "string") {
2036
- const result = new CaipAssetId2(v);
2037
- return {
2038
- assetNamespace: result.assetName.namespace,
2039
- contract: {
2040
- chainId: Number(result.chainId.reference),
2041
- address: result.assetName.reference
2042
- },
2043
- tokenId: result.tokenId
2044
- };
2045
- }
2046
- return v;
2047
- }, makeAssetIdSchema(valueLabel));
2048
- function invariant_nameTokenOwnershipHasNonZeroAddressOwner(ctx) {
2049
- const ownership = ctx.value;
2050
- if (ctx.value.owner.address === zeroAddress) {
2051
- ctx.issues.push({
2052
- code: "custom",
2053
- input: ctx.value,
2054
- message: `Name Token Ownership with '${ownership.ownershipType}' must have 'address' other than the zero address.`
2055
- });
2056
- }
2057
- }
2058
- var makeNameTokenOwnershipNameWrapperSchema = (valueLabel = "Name Token Ownership NameWrapper") => z11.object({
2059
- ownershipType: z11.literal(NameTokenOwnershipTypes.NameWrapper),
2060
- owner: makeAccountIdSchema(`${valueLabel}.owner`)
2061
- }).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
2062
- var makeNameTokenOwnershipFullyOnchainSchema = (valueLabel = "Name Token Ownership Fully Onchain") => z11.object({
2063
- ownershipType: z11.literal(NameTokenOwnershipTypes.FullyOnchain),
2064
- owner: makeAccountIdSchema(`${valueLabel}.owner`)
2065
- }).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
2066
- var makeNameTokenOwnershipBurnedSchema = (valueLabel = "Name Token Ownership Burned") => z11.object({
2067
- ownershipType: z11.literal(NameTokenOwnershipTypes.Burned),
2068
- owner: makeAccountIdSchema(`${valueLabel}.owner`)
2069
- }).check(invariant_nameTokenOwnershipHasZeroAddressOwner);
2070
- var makeNameTokenOwnershipUnknownSchema = (valueLabel = "Name Token Ownership Unknown") => z11.object({
2071
- ownershipType: z11.literal(NameTokenOwnershipTypes.Unknown),
2072
- owner: makeAccountIdSchema(`${valueLabel}.owner`)
2073
- }).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
2074
- function invariant_nameTokenOwnershipHasZeroAddressOwner(ctx) {
2075
- const ownership = ctx.value;
2076
- if (ctx.value.owner.address !== zeroAddress) {
2077
- ctx.issues.push({
2078
- code: "custom",
2079
- input: ctx.value,
2080
- message: `Name Token Ownership with '${ownership.ownershipType}' must have 'address' set to the zero address.`
2081
- });
2082
- }
2083
- }
2084
- var makeNameTokenOwnershipSchema = (valueLabel = "Name Token Ownership") => z11.discriminatedUnion("ownershipType", [
2085
- makeNameTokenOwnershipNameWrapperSchema(valueLabel),
2086
- makeNameTokenOwnershipFullyOnchainSchema(valueLabel),
2087
- makeNameTokenOwnershipBurnedSchema(valueLabel),
2088
- makeNameTokenOwnershipUnknownSchema(valueLabel)
2089
- ]);
2090
- var makeNameTokenSchema = (valueLabel = "Name Token Schema", serializable) => z11.object({
2091
- token: makeAssetIdSchema(`${valueLabel}.token`, serializable),
2092
- ownership: makeNameTokenOwnershipSchema(`${valueLabel}.ownership`),
2093
- mintStatus: z11.enum(NFTMintStatuses)
1704
+ var ErrorResponseSchema = z11.object({
1705
+ message: z11.string(),
1706
+ details: z11.optional(z11.unknown())
2094
1707
  });
2095
1708
 
2096
- // src/tokenscope/assets.ts
2097
- function serializeAssetId(assetId) {
2098
- return {
2099
- assetNamespace: assetId.assetNamespace,
2100
- contract: assetId.contract,
2101
- tokenId: uint256ToHex32(assetId.tokenId)
2102
- };
2103
- }
2104
- function deserializeAssetId(maybeAssetId, valueLabel) {
2105
- const schema = makeAssetIdSchema(valueLabel);
2106
- const parsed = schema.safeParse(maybeAssetId);
1709
+ // src/ensindexer/api/shared/errors/deserialize.ts
1710
+ function deserializeErrorResponse(maybeErrorResponse) {
1711
+ const parsed = ErrorResponseSchema.safeParse(maybeErrorResponse);
2107
1712
  if (parsed.error) {
2108
- throw new RangeError(`Cannot deserialize AssetId:
1713
+ throw new Error(`Cannot deserialize ErrorResponse:
2109
1714
  ${prettifyError9(parsed.error)}
2110
1715
  `);
2111
1716
  }
2112
1717
  return parsed.data;
2113
1718
  }
2114
- function parseAssetId(maybeAssetId, valueLabel) {
2115
- const schema = makeAssetIdStringSchema(valueLabel);
1719
+
1720
+ // src/ensindexer/client.ts
1721
+ var EnsIndexerClient = class {
1722
+ constructor(options) {
1723
+ this.options = options;
1724
+ }
1725
+ getOptions() {
1726
+ return Object.freeze({
1727
+ url: new URL(this.options.url.href)
1728
+ });
1729
+ }
1730
+ /**
1731
+ * Fetch ENSIndexer Config
1732
+ *
1733
+ * Fetch the ENSIndexer's configuration.
1734
+ *
1735
+ * @returns {EnsIndexerConfigResponse}
1736
+ *
1737
+ * @throws if the ENSIndexer request fails
1738
+ * @throws if the ENSIndexer returns a non-ok response
1739
+ * @throws if the ENSIndexer response breaks required invariants
1740
+ */
1741
+ async config() {
1742
+ const url = new URL(`/api/config`, this.options.url);
1743
+ const response = await fetch(url);
1744
+ let responseData;
1745
+ try {
1746
+ responseData = await response.json();
1747
+ } catch {
1748
+ throw new Error("Malformed response data: invalid JSON");
1749
+ }
1750
+ if (!response.ok) {
1751
+ const errorResponse = deserializeErrorResponse(responseData);
1752
+ throw new Error(`Fetching ENSIndexer Config Failed: ${errorResponse.message}`);
1753
+ }
1754
+ return deserializeEnsIndexerConfigResponse(
1755
+ responseData
1756
+ );
1757
+ }
1758
+ /**
1759
+ * Fetch ENSIndexer Indexing Status
1760
+ *
1761
+ * @returns {EnsIndexerIndexingStatusResponse}
1762
+ *
1763
+ * @throws if the ENSIndexer request fails
1764
+ * @throws if the ENSIndexer returns a non-ok response
1765
+ * @throws if the ENSIndexer response breaks required invariants
1766
+ */
1767
+ async indexingStatus() {
1768
+ const url = new URL(`/api/indexing-status`, this.options.url);
1769
+ const response = await fetch(url);
1770
+ let responseData;
1771
+ try {
1772
+ responseData = await response.json();
1773
+ } catch {
1774
+ throw new Error("Malformed response data: invalid JSON");
1775
+ }
1776
+ if (!response.ok) {
1777
+ let errorResponse;
1778
+ try {
1779
+ errorResponse = deserializeErrorResponse(responseData);
1780
+ } catch {
1781
+ }
1782
+ if (typeof errorResponse !== "undefined") {
1783
+ throw new Error(`Fetching ENSIndexer Indexing Status Failed: ${errorResponse.message}`);
1784
+ }
1785
+ }
1786
+ return deserializeEnsIndexerIndexingStatusResponse(
1787
+ responseData
1788
+ );
1789
+ }
1790
+ };
1791
+
1792
+ // src/ensindexer/config/compatibility.ts
1793
+ function validateEnsIndexerPublicConfigCompatibility(configA, configB) {
1794
+ if (configA.indexedChainIds.symmetricDifference(configB.indexedChainIds).size > 0) {
1795
+ throw new Error(
1796
+ [
1797
+ `'indexedChainIds' must be compatible.`,
1798
+ `Stored Config 'indexedChainIds': '${Array.from(configA.indexedChainIds).join(", ")}'.`,
1799
+ `Current Config 'indexedChainIds': '${Array.from(configB.indexedChainIds).join(", ")}'.`
1800
+ ].join(" ")
1801
+ );
1802
+ }
1803
+ if (configA.isSubgraphCompatible !== configB.isSubgraphCompatible) {
1804
+ throw new Error(
1805
+ [
1806
+ `'isSubgraphCompatible' flag must be compatible.`,
1807
+ `Stored Config 'isSubgraphCompatible' flag: '${configA.isSubgraphCompatible}'.`,
1808
+ `Current Config 'isSubgraphCompatible' flag: '${configB.isSubgraphCompatible}'.`
1809
+ ].join(" ")
1810
+ );
1811
+ }
1812
+ if (configA.namespace !== configB.namespace) {
1813
+ throw new Error(
1814
+ [
1815
+ `'namespace' must be compatible.`,
1816
+ `Stored Config 'namespace': '${configA.namespace}'.`,
1817
+ `Current Config 'namespace': '${configB.namespace}'.`
1818
+ ].join(" ")
1819
+ );
1820
+ }
1821
+ if (configA.labelSet.labelSetId !== configB.labelSet.labelSetId) {
1822
+ throw new Error(
1823
+ [
1824
+ `'labelSet.labelSetId' must be compatible.`,
1825
+ `Stored Config 'labelSet.labelSetId': '${configA.labelSet.labelSetId}'.`,
1826
+ `Current Config 'labelSet.labelSetId': '${configB.labelSet.labelSetId}'.`
1827
+ ].join(" ")
1828
+ );
1829
+ }
1830
+ if (configA.labelSet.labelSetVersion !== configB.labelSet.labelSetVersion) {
1831
+ throw new Error(
1832
+ [
1833
+ `'labelSet.labelSetVersion' must be compatible.`,
1834
+ `Stored Config 'labelSet.labelSetVersion': '${configA.labelSet.labelSetVersion}'.`,
1835
+ `Current Config 'labelSet.labelSetVersion': '${configB.labelSet.labelSetVersion}'.`
1836
+ ].join(" ")
1837
+ );
1838
+ }
1839
+ const configAPluginsSet = new Set(configA.plugins);
1840
+ const configBPluginsSet = new Set(configB.plugins);
1841
+ if (configAPluginsSet.symmetricDifference(configBPluginsSet).size > 0) {
1842
+ throw new Error(
1843
+ [
1844
+ `'plugins' must be compatible.`,
1845
+ `Stored Config 'plugins': '${configA.plugins.join(", ")}'.`,
1846
+ `Current Config 'plugins': '${configB.plugins.join(", ")}'.`
1847
+ ].join(" ")
1848
+ );
1849
+ }
1850
+ }
1851
+
1852
+ // src/ensindexer/config/label-utils.ts
1853
+ import { hexToBytes } from "viem";
1854
+ function labelHashToBytes(labelHash) {
1855
+ try {
1856
+ if (labelHash.length !== 66) {
1857
+ throw new Error(`Invalid labelHash length ${labelHash.length} characters (expected 66)`);
1858
+ }
1859
+ if (labelHash !== labelHash.toLowerCase()) {
1860
+ throw new Error("Labelhash must be in lowercase");
1861
+ }
1862
+ if (!labelHash.startsWith("0x")) {
1863
+ throw new Error("Labelhash must be 0x-prefixed");
1864
+ }
1865
+ const bytes = hexToBytes(labelHash);
1866
+ if (bytes.length !== 32) {
1867
+ throw new Error(`Invalid labelHash length ${bytes.length} bytes (expected 32)`);
1868
+ }
1869
+ return bytes;
1870
+ } catch (e) {
1871
+ if (e instanceof Error) {
1872
+ throw e;
1873
+ }
1874
+ throw new Error("Invalid hex format");
1875
+ }
1876
+ }
1877
+
1878
+ // src/ensindexer/config/parsing.ts
1879
+ function parseNonNegativeInteger(maybeNumber) {
1880
+ const trimmed = maybeNumber.trim();
1881
+ if (!trimmed) {
1882
+ throw new Error("Input cannot be empty");
1883
+ }
1884
+ if (trimmed === "-0") {
1885
+ throw new Error("Negative zero is not a valid non-negative integer");
1886
+ }
1887
+ const num = Number(maybeNumber);
1888
+ if (Number.isNaN(num)) {
1889
+ throw new Error(`"${maybeNumber}" is not a valid number`);
1890
+ }
1891
+ if (!Number.isFinite(num)) {
1892
+ throw new Error(`"${maybeNumber}" is not a finite number`);
1893
+ }
1894
+ if (!Number.isInteger(num)) {
1895
+ throw new Error(`"${maybeNumber}" is not an integer`);
1896
+ }
1897
+ if (num < 0) {
1898
+ throw new Error(`"${maybeNumber}" is not a non-negative integer`);
1899
+ }
1900
+ return num;
1901
+ }
1902
+
1903
+ // src/ensindexer/config/validate/ensindexer-public-config.ts
1904
+ import { prettifyError as prettifyError10 } from "zod/v4";
1905
+ function validateEnsIndexerPublicConfig(unvalidatedConfig) {
1906
+ const schema = makeEnsIndexerPublicConfigSchema();
1907
+ const result = schema.safeParse(unvalidatedConfig);
1908
+ if (!result.success) {
1909
+ throw new Error(`Invalid ENSIndexerPublicConfig: ${prettifyError10(result.error)}`);
1910
+ }
1911
+ return result.data;
1912
+ }
1913
+
1914
+ // src/ensindexer/config/validate/ensindexer-version-info.ts
1915
+ import { prettifyError as prettifyError11 } from "zod/v4";
1916
+ function validateEnsIndexerVersionInfo(unvalidatedVersionInfo) {
1917
+ const schema = makeEnsIndexerVersionInfoSchema();
1918
+ const result = schema.safeParse(unvalidatedVersionInfo);
1919
+ if (!result.success) {
1920
+ throw new Error(`Invalid EnsIndexerVersionInfo: ${prettifyError11(result.error)}`);
1921
+ }
1922
+ return result.data;
1923
+ }
1924
+
1925
+ // src/ensnode/api/indexing-status/deserialize.ts
1926
+ import { prettifyError as prettifyError13 } from "zod/v4";
1927
+
1928
+ // src/stack-info/deserialize/ensnode-stack-info.ts
1929
+ import { prettifyError as prettifyError12 } from "zod/v4";
1930
+
1931
+ // src/stack-info/zod-schemas/ensnode-stack-info.ts
1932
+ import { z as z13 } from "zod/v4";
1933
+
1934
+ // src/ensdb/zod-schemas/config.ts
1935
+ import { z as z12 } from "zod/v4";
1936
+ var makeEnsDbVersionInfoSchema = (valueLabel) => {
1937
+ const label = valueLabel ?? "EnsDbVersionInfo";
1938
+ return z12.object({
1939
+ postgresql: z12.string().nonempty(`${label}.postgresql must be a non-empty string`).describe("Version of the PostgreSQL server hosting the ENSDb instance.")
1940
+ }).describe(label);
1941
+ };
1942
+ var makeEnsDbPublicConfigSchema = (valueLabel) => {
1943
+ const label = valueLabel ?? "EnsDbPublicConfig";
1944
+ return z12.object({
1945
+ versionInfo: makeEnsDbVersionInfoSchema(`${label}.versionInfo`)
1946
+ }).describe(label);
1947
+ };
1948
+
1949
+ // src/stack-info/zod-schemas/ensnode-stack-info.ts
1950
+ function makeSerializedEnsNodeStackInfoSchema(valueLabel) {
1951
+ const label = valueLabel ?? "ENSNodeStackInfo";
1952
+ return z13.object({
1953
+ ensApi: makeSerializedEnsApiPublicConfigSchema(`${label}.ensApi`),
1954
+ ensDb: makeEnsDbPublicConfigSchema(`${label}.ensDb`),
1955
+ ensIndexer: makeSerializedEnsIndexerPublicConfigSchema(`${label}.ensIndexer`),
1956
+ ensRainbow: makeEnsRainbowPublicConfigSchema(`${label}.ensRainbow`).optional()
1957
+ });
1958
+ }
1959
+ function makeEnsNodeStackInfoSchema(valueLabel) {
1960
+ const label = valueLabel ?? "ENSNodeStackInfo";
1961
+ return z13.object({
1962
+ ensApi: makeEnsApiPublicConfigSchema(`${label}.ensApi`),
1963
+ ensDb: makeEnsDbPublicConfigSchema(`${label}.ensDb`),
1964
+ ensIndexer: makeEnsIndexerPublicConfigSchema(`${label}.ensIndexer`),
1965
+ ensRainbow: makeEnsRainbowPublicConfigSchema(`${label}.ensRainbow`).optional()
1966
+ });
1967
+ }
1968
+
1969
+ // src/stack-info/deserialize/ensnode-stack-info.ts
1970
+ function buildUnvalidatedEnsNodeStackInfo(serializedStackInfo) {
1971
+ const { ensApi, ensIndexer, ...rest } = serializedStackInfo;
1972
+ return {
1973
+ ...rest,
1974
+ ensApi: buildUnvalidatedEnsApiPublicConfig(ensApi),
1975
+ ensIndexer: buildUnvalidatedEnsIndexerPublicConfig(ensIndexer)
1976
+ };
1977
+ }
1978
+ function deserializeEnsNodeStackInfo(maybeStackInfo, valueLabel) {
1979
+ const parsed = makeSerializedEnsNodeStackInfoSchema(valueLabel).transform(buildUnvalidatedEnsNodeStackInfo).pipe(makeEnsNodeStackInfoSchema(valueLabel)).safeParse(maybeStackInfo);
1980
+ if (parsed.error) {
1981
+ throw new Error(`Cannot deserialize EnsNodeStackInfo:
1982
+ ${prettifyError12(parsed.error)}
1983
+ `);
1984
+ }
1985
+ return parsed.data;
1986
+ }
1987
+
1988
+ // src/ensnode/api/indexing-status/response.ts
1989
+ var EnsApiIndexingStatusResponseCodes = {
1990
+ /**
1991
+ * Represents that the indexing status is available.
1992
+ */
1993
+ Ok: "ok",
1994
+ /**
1995
+ * Represents that the indexing status is unavailable.
1996
+ */
1997
+ Error: "error"
1998
+ };
1999
+ var IndexingStatusResponseCodes = EnsApiIndexingStatusResponseCodes;
2000
+
2001
+ // src/ensnode/api/indexing-status/zod-schemas.ts
2002
+ import { z as z14 } from "zod/v4";
2003
+ var makeEnsApiIndexingStatusResponseOkSchema = (valueLabel = "Indexing Status Response OK") => z14.strictObject({
2004
+ responseCode: z14.literal(EnsApiIndexingStatusResponseCodes.Ok),
2005
+ realtimeProjection: makeRealtimeIndexingStatusProjectionSchema(valueLabel),
2006
+ stackInfo: makeEnsNodeStackInfoSchema(valueLabel)
2007
+ });
2008
+ var makeEnsApiIndexingStatusResponseErrorSchema = (_valueLabel = "Indexing Status Response Error") => z14.strictObject({
2009
+ responseCode: z14.literal(EnsApiIndexingStatusResponseCodes.Error)
2010
+ });
2011
+ var makeEnsApiIndexingStatusResponseSchema = (valueLabel = "Indexing Status Response") => z14.discriminatedUnion("responseCode", [
2012
+ makeEnsApiIndexingStatusResponseOkSchema(valueLabel),
2013
+ makeEnsApiIndexingStatusResponseErrorSchema(valueLabel)
2014
+ ]);
2015
+ var makeSerializedEnsApiIndexingStatusResponseOkSchema = (valueLabel = "Serialized Indexing Status Response OK") => z14.object({
2016
+ responseCode: z14.literal(EnsApiIndexingStatusResponseCodes.Ok),
2017
+ realtimeProjection: makeSerializedRealtimeIndexingStatusProjectionSchema(valueLabel),
2018
+ stackInfo: makeSerializedEnsNodeStackInfoSchema(valueLabel)
2019
+ });
2020
+ var makeSerializedEnsApiIndexingStatusResponseSchema = (valueLabel = "Serialized Indexing Status Response") => z14.discriminatedUnion("responseCode", [
2021
+ makeSerializedEnsApiIndexingStatusResponseOkSchema(valueLabel),
2022
+ makeEnsApiIndexingStatusResponseErrorSchema(valueLabel)
2023
+ ]);
2024
+
2025
+ // src/ensnode/api/indexing-status/deserialize.ts
2026
+ function buildUnvalidatedEnsApiIndexingStatusResponse(serializedResponse) {
2027
+ if (serializedResponse.responseCode !== EnsApiIndexingStatusResponseCodes.Ok) {
2028
+ return serializedResponse;
2029
+ }
2030
+ const { realtimeProjection, stackInfo, ...rest } = serializedResponse;
2031
+ return {
2032
+ realtimeProjection: buildUnvalidatedRealtimeIndexingStatusProjection(realtimeProjection),
2033
+ stackInfo: buildUnvalidatedEnsNodeStackInfo(stackInfo),
2034
+ ...rest
2035
+ };
2036
+ }
2037
+ function deserializeEnsApiIndexingStatusResponse(maybeResponse) {
2038
+ const parsed = makeSerializedEnsApiIndexingStatusResponseSchema().transform(buildUnvalidatedEnsApiIndexingStatusResponse).pipe(makeEnsApiIndexingStatusResponseSchema()).safeParse(maybeResponse);
2039
+ if (parsed.error) {
2040
+ throw new Error(
2041
+ `Cannot deserialize EnsApiIndexingStatusResponse:
2042
+ ${prettifyError13(parsed.error)}
2043
+ `
2044
+ );
2045
+ }
2046
+ return parsed.data;
2047
+ }
2048
+ var deserializeIndexingStatusResponse = deserializeEnsApiIndexingStatusResponse;
2049
+
2050
+ // src/stack-info/serialize/ensnode-stack-info.ts
2051
+ function serializeEnsNodeStackInfo(stackInfo) {
2052
+ return {
2053
+ ensApi: serializeEnsApiPublicConfig(stackInfo.ensApi),
2054
+ ensDb: stackInfo.ensDb,
2055
+ ensIndexer: serializeEnsIndexerPublicConfig(stackInfo.ensIndexer),
2056
+ ensRainbow: stackInfo.ensRainbow
2057
+ };
2058
+ }
2059
+
2060
+ // src/ensnode/api/indexing-status/serialize.ts
2061
+ function serializeEnsApiIndexingStatusResponse(response) {
2062
+ switch (response.responseCode) {
2063
+ case EnsApiIndexingStatusResponseCodes.Ok:
2064
+ return {
2065
+ responseCode: response.responseCode,
2066
+ realtimeProjection: serializeRealtimeIndexingStatusProjection(response.realtimeProjection),
2067
+ stackInfo: serializeEnsNodeStackInfo(response.stackInfo)
2068
+ };
2069
+ case EnsApiIndexingStatusResponseCodes.Error:
2070
+ return response;
2071
+ }
2072
+ }
2073
+ var serializeIndexingStatusResponse = serializeEnsApiIndexingStatusResponse;
2074
+
2075
+ // src/ensnode/api/name-tokens/deserialize.ts
2076
+ import { prettifyError as prettifyError15 } from "zod/v4";
2077
+
2078
+ // src/ensnode/api/name-tokens/zod-schemas.ts
2079
+ import { namehashInterpretedName } from "enssdk";
2080
+ import { z as z17 } from "zod/v4";
2081
+
2082
+ // src/tokenscope/name-token.ts
2083
+ import { getParentInterpretedName } from "enssdk";
2084
+ import { isAddressEqual as isAddressEqual3, zeroAddress as zeroAddress3 } from "viem";
2085
+ import { DatasourceNames } from "@ensnode/datasources";
2086
+
2087
+ // src/shared/account-id.ts
2088
+ import { isAddressEqual } from "viem";
2089
+ var accountIdEqual = (a, b) => {
2090
+ return a.chainId === b.chainId && isAddressEqual(a.address, b.address);
2091
+ };
2092
+
2093
+ // src/shared/datasource-contract.ts
2094
+ import {
2095
+ maybeGetDatasource
2096
+ } from "@ensnode/datasources";
2097
+ var maybeGetDatasourceContract = (namespaceId, datasourceName, contractName) => {
2098
+ const datasource = maybeGetDatasource(namespaceId, datasourceName);
2099
+ if (!datasource) return void 0;
2100
+ const address = datasource.contracts[contractName]?.address;
2101
+ if (address === void 0 || Array.isArray(address)) return void 0;
2102
+ return {
2103
+ chainId: datasource.chain.id,
2104
+ address
2105
+ };
2106
+ };
2107
+ var getDatasourceContract = (namespaceId, datasourceName, contractName) => {
2108
+ const contract = maybeGetDatasourceContract(namespaceId, datasourceName, contractName);
2109
+ if (!contract) {
2110
+ throw new Error(
2111
+ `Expected contract not found for ${namespaceId} ${datasourceName} ${contractName}`
2112
+ );
2113
+ }
2114
+ return contract;
2115
+ };
2116
+ var makeContractMatcher = (namespace, b) => (datasourceName, contractName) => {
2117
+ const a = maybeGetDatasourceContract(namespace, datasourceName, contractName);
2118
+ return a && accountIdEqual(a, b);
2119
+ };
2120
+
2121
+ // src/tokenscope/assets.ts
2122
+ import {
2123
+ stringifyAssetId
2124
+ } from "enssdk";
2125
+ import { isAddressEqual as isAddressEqual2, zeroAddress as zeroAddress2 } from "viem";
2126
+ import { prettifyError as prettifyError14 } from "zod/v4";
2127
+
2128
+ // src/tokenscope/zod-schemas.ts
2129
+ import { AssetId as CaipAssetId } from "caip";
2130
+ import { AssetNamespaces } from "enssdk";
2131
+ import { zeroAddress } from "viem";
2132
+ import { z as z15 } from "zod/v4";
2133
+ var tokenIdSchemaSerializable = z15.string();
2134
+ var tokenIdSchemaNative = z15.preprocess(
2135
+ (v) => typeof v === "string" ? BigInt(v) : v,
2136
+ z15.bigint().positive()
2137
+ );
2138
+ function makeTokenIdSchema(_valueLabel = "Token ID Schema", serializable = false) {
2139
+ if (serializable) {
2140
+ return tokenIdSchemaSerializable;
2141
+ } else {
2142
+ return tokenIdSchemaNative;
2143
+ }
2144
+ }
2145
+ var makeAssetIdSchema = (valueLabel = "Asset ID Schema", serializable) => {
2146
+ return z15.object({
2147
+ assetNamespace: z15.enum(AssetNamespaces),
2148
+ contract: makeAccountIdSchema(valueLabel),
2149
+ tokenId: makeTokenIdSchema(valueLabel, serializable ?? false)
2150
+ });
2151
+ };
2152
+ var makeAssetIdStringSchema = (valueLabel = "Asset ID String Schema") => z15.preprocess((v) => {
2153
+ if (typeof v === "string") {
2154
+ const result = new CaipAssetId(v);
2155
+ return {
2156
+ assetNamespace: result.assetName.namespace,
2157
+ contract: {
2158
+ chainId: Number(result.chainId.reference),
2159
+ address: result.assetName.reference
2160
+ },
2161
+ tokenId: result.tokenId
2162
+ };
2163
+ }
2164
+ return v;
2165
+ }, makeAssetIdSchema(valueLabel));
2166
+ function invariant_nameTokenOwnershipHasNonZeroAddressOwner(ctx) {
2167
+ const ownership = ctx.value;
2168
+ if (ctx.value.owner.address === zeroAddress) {
2169
+ ctx.issues.push({
2170
+ code: "custom",
2171
+ input: ctx.value,
2172
+ message: `Name Token Ownership with '${ownership.ownershipType}' must have 'address' other than the zero address.`
2173
+ });
2174
+ }
2175
+ }
2176
+ var makeNameTokenOwnershipNameWrapperSchema = (valueLabel = "Name Token Ownership NameWrapper") => z15.object({
2177
+ ownershipType: z15.literal(NameTokenOwnershipTypes.NameWrapper),
2178
+ owner: makeAccountIdSchema(`${valueLabel}.owner`)
2179
+ }).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
2180
+ var makeNameTokenOwnershipFullyOnchainSchema = (valueLabel = "Name Token Ownership Fully Onchain") => z15.object({
2181
+ ownershipType: z15.literal(NameTokenOwnershipTypes.FullyOnchain),
2182
+ owner: makeAccountIdSchema(`${valueLabel}.owner`)
2183
+ }).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
2184
+ var makeNameTokenOwnershipBurnedSchema = (valueLabel = "Name Token Ownership Burned") => z15.object({
2185
+ ownershipType: z15.literal(NameTokenOwnershipTypes.Burned),
2186
+ owner: makeAccountIdSchema(`${valueLabel}.owner`)
2187
+ }).check(invariant_nameTokenOwnershipHasZeroAddressOwner);
2188
+ var makeNameTokenOwnershipUnknownSchema = (valueLabel = "Name Token Ownership Unknown") => z15.object({
2189
+ ownershipType: z15.literal(NameTokenOwnershipTypes.Unknown),
2190
+ owner: makeAccountIdSchema(`${valueLabel}.owner`)
2191
+ }).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
2192
+ function invariant_nameTokenOwnershipHasZeroAddressOwner(ctx) {
2193
+ const ownership = ctx.value;
2194
+ if (ctx.value.owner.address !== zeroAddress) {
2195
+ ctx.issues.push({
2196
+ code: "custom",
2197
+ input: ctx.value,
2198
+ message: `Name Token Ownership with '${ownership.ownershipType}' must have 'address' set to the zero address.`
2199
+ });
2200
+ }
2201
+ }
2202
+ var makeNameTokenOwnershipSchema = (valueLabel = "Name Token Ownership") => z15.discriminatedUnion("ownershipType", [
2203
+ makeNameTokenOwnershipNameWrapperSchema(valueLabel),
2204
+ makeNameTokenOwnershipFullyOnchainSchema(valueLabel),
2205
+ makeNameTokenOwnershipBurnedSchema(valueLabel),
2206
+ makeNameTokenOwnershipUnknownSchema(valueLabel)
2207
+ ]);
2208
+ var makeNameTokenSchema = (valueLabel = "Name Token Schema", serializable) => z15.object({
2209
+ token: makeAssetIdSchema(`${valueLabel}.token`, serializable),
2210
+ ownership: makeNameTokenOwnershipSchema(`${valueLabel}.ownership`),
2211
+ mintStatus: z15.enum(NFTMintStatuses)
2212
+ });
2213
+
2214
+ // src/tokenscope/assets.ts
2215
+ function serializeAssetId(assetId) {
2216
+ return {
2217
+ assetNamespace: assetId.assetNamespace,
2218
+ contract: assetId.contract,
2219
+ tokenId: assetId.tokenId.toString()
2220
+ };
2221
+ }
2222
+ function deserializeAssetId(maybeAssetId, valueLabel) {
2223
+ const schema = makeAssetIdSchema(valueLabel);
2224
+ const parsed = schema.safeParse(maybeAssetId);
2225
+ if (parsed.error) {
2226
+ throw new RangeError(`Cannot deserialize AssetId:
2227
+ ${prettifyError14(parsed.error)}
2228
+ `);
2229
+ }
2230
+ return parsed.data;
2231
+ }
2232
+ function parseAssetId(maybeAssetId, valueLabel) {
2233
+ const schema = makeAssetIdStringSchema(valueLabel);
2116
2234
  const parsed = schema.safeParse(maybeAssetId);
2117
2235
  if (parsed.error) {
2118
2236
  throw new RangeError(`Cannot parse AssetId:
2119
- ${prettifyError9(parsed.error)}
2237
+ ${prettifyError14(parsed.error)}
2120
2238
  `);
2121
2239
  }
2122
2240
  return parsed.data;
@@ -2139,7 +2257,7 @@ var NFTMintStatuses = {
2139
2257
  Burned: "burned"
2140
2258
  };
2141
2259
  var formatNFTTransferEventMetadata = (metadata) => {
2142
- const assetIdString = formatAssetId(metadata.nft);
2260
+ const assetIdString = stringifyAssetId(metadata.nft);
2143
2261
  return [
2144
2262
  `Event: ${metadata.eventHandlerName}`,
2145
2263
  `Chain ID: ${metadata.chainId}`,
@@ -2402,7 +2520,8 @@ function getNameTokenOwnership(namespaceId, name, owner) {
2402
2520
  owner
2403
2521
  };
2404
2522
  }
2405
- const parentName = getParentNameFQDN(name);
2523
+ const parentName = getParentInterpretedName(name);
2524
+ if (parentName === null) throw new Error(`Invariant: '${name}' has no parent Name.`);
2406
2525
  if (parentName === "eth") {
2407
2526
  return {
2408
2527
  ownershipType: NameTokenOwnershipTypes.FullyOnchain,
@@ -2415,14 +2534,14 @@ function getNameTokenOwnership(namespaceId, name, owner) {
2415
2534
  };
2416
2535
  }
2417
2536
 
2418
- // src/ensapi/api/shared/errors/zod-schemas.ts
2419
- import { z as z12 } from "zod/v4";
2420
- var ErrorResponseSchema = z12.object({
2421
- message: z12.string(),
2422
- details: z12.optional(z12.unknown())
2537
+ // src/ensnode/api/shared/errors/zod-schemas.ts
2538
+ import { z as z16 } from "zod/v4";
2539
+ var makeErrorResponseSchema = () => z16.object({
2540
+ message: z16.string(),
2541
+ details: z16.optional(z16.unknown())
2423
2542
  });
2424
2543
 
2425
- // src/ensapi/api/name-tokens/response.ts
2544
+ // src/ensnode/api/name-tokens/response.ts
2426
2545
  var NameTokensResponseCodes = {
2427
2546
  /**
2428
2547
  * Represents a response when Name Tokens API can respond with requested data.
@@ -2457,16 +2576,16 @@ var NameTokensResponseErrorCodes = {
2457
2576
  IndexingStatusUnsupported: "unsupported-indexing-status"
2458
2577
  };
2459
2578
 
2460
- // src/ensapi/api/name-tokens/zod-schemas.ts
2461
- var makeRegisteredNameTokenSchema = (valueLabel = "Registered Name Token", serializable) => z13.object({
2579
+ // src/ensnode/api/name-tokens/zod-schemas.ts
2580
+ var makeRegisteredNameTokenSchema = (valueLabel = "Registered Name Token", serializable) => z17.object({
2462
2581
  domainId: makeNodeSchema(`${valueLabel}.domainId`),
2463
2582
  name: makeReinterpretedNameSchema(valueLabel),
2464
- tokens: z13.array(makeNameTokenSchema(`${valueLabel}.tokens`, serializable)).nonempty(),
2583
+ tokens: z17.array(makeNameTokenSchema(`${valueLabel}.tokens`, serializable)).nonempty(),
2465
2584
  expiresAt: makeUnixTimestampSchema(`${valueLabel}.expiresAt`),
2466
2585
  accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`)
2467
2586
  }).check(function invariant_nameIsAssociatedWithDomainId(ctx) {
2468
2587
  const { name, domainId } = ctx.value;
2469
- if (namehash2(name) !== domainId) {
2588
+ if (namehashInterpretedName(name) !== domainId) {
2470
2589
  ctx.issues.push({
2471
2590
  code: "custom",
2472
2591
  input: ctx.value,
@@ -2503,51 +2622,51 @@ var makeRegisteredNameTokenSchema = (valueLabel = "Registered Name Token", seria
2503
2622
  });
2504
2623
  }
2505
2624
  });
2506
- var makeNameTokensResponseOkSchema = (valueLabel = "Name Tokens Response OK", serializable) => z13.strictObject({
2507
- responseCode: z13.literal(NameTokensResponseCodes.Ok),
2625
+ var makeNameTokensResponseOkSchema = (valueLabel = "Name Tokens Response OK", serializable) => z17.strictObject({
2626
+ responseCode: z17.literal(NameTokensResponseCodes.Ok),
2508
2627
  registeredNameTokens: makeRegisteredNameTokenSchema(`${valueLabel}.nameTokens`, serializable)
2509
2628
  });
2510
- var makeNameTokensResponseErrorNameTokensNotIndexedSchema = (_valueLabel = "Name Tokens Response Error Name Not Indexed") => z13.strictObject({
2511
- responseCode: z13.literal(NameTokensResponseCodes.Error),
2512
- errorCode: z13.literal(NameTokensResponseErrorCodes.NameTokensNotIndexed),
2513
- error: ErrorResponseSchema
2629
+ var makeNameTokensResponseErrorNameTokensNotIndexedSchema = (_valueLabel = "Name Tokens Response Error Name Not Indexed") => z17.strictObject({
2630
+ responseCode: z17.literal(NameTokensResponseCodes.Error),
2631
+ errorCode: z17.literal(NameTokensResponseErrorCodes.NameTokensNotIndexed),
2632
+ error: makeErrorResponseSchema()
2514
2633
  });
2515
- var makeNameTokensResponseErrorEnsIndexerConfigUnsupported = (_valueLabel = "Name Tokens Response Error ENSIndexer Config Unsupported") => z13.strictObject({
2516
- responseCode: z13.literal(NameTokensResponseCodes.Error),
2517
- errorCode: z13.literal(NameTokensResponseErrorCodes.EnsIndexerConfigUnsupported),
2518
- error: ErrorResponseSchema
2634
+ var makeNameTokensResponseErrorEnsIndexerConfigUnsupported = (_valueLabel = "Name Tokens Response Error ENSIndexer Config Unsupported") => z17.strictObject({
2635
+ responseCode: z17.literal(NameTokensResponseCodes.Error),
2636
+ errorCode: z17.literal(NameTokensResponseErrorCodes.EnsIndexerConfigUnsupported),
2637
+ error: makeErrorResponseSchema()
2519
2638
  });
2520
- var makeNameTokensResponseErrorNameIndexingStatusUnsupported = (_valueLabel = "Name Tokens Response Error Indexing Status Unsupported") => z13.strictObject({
2521
- responseCode: z13.literal(NameTokensResponseCodes.Error),
2522
- errorCode: z13.literal(NameTokensResponseErrorCodes.IndexingStatusUnsupported),
2523
- error: ErrorResponseSchema
2639
+ var makeNameTokensResponseErrorNameIndexingStatusUnsupported = (_valueLabel = "Name Tokens Response Error Indexing Status Unsupported") => z17.strictObject({
2640
+ responseCode: z17.literal(NameTokensResponseCodes.Error),
2641
+ errorCode: z17.literal(NameTokensResponseErrorCodes.IndexingStatusUnsupported),
2642
+ error: makeErrorResponseSchema()
2524
2643
  });
2525
- var makeNameTokensResponseErrorSchema = (valueLabel = "Name Tokens Response Error") => z13.discriminatedUnion("errorCode", [
2644
+ var makeNameTokensResponseErrorSchema = (valueLabel = "Name Tokens Response Error") => z17.discriminatedUnion("errorCode", [
2526
2645
  makeNameTokensResponseErrorNameTokensNotIndexedSchema(valueLabel),
2527
2646
  makeNameTokensResponseErrorEnsIndexerConfigUnsupported(valueLabel),
2528
2647
  makeNameTokensResponseErrorNameIndexingStatusUnsupported(valueLabel)
2529
2648
  ]);
2530
2649
  var makeNameTokensResponseSchema = (valueLabel = "Name Tokens Response", serializable) => {
2531
- return z13.discriminatedUnion("responseCode", [
2650
+ return z17.discriminatedUnion("responseCode", [
2532
2651
  makeNameTokensResponseOkSchema(valueLabel, serializable ?? false),
2533
2652
  makeNameTokensResponseErrorSchema(valueLabel)
2534
2653
  ]);
2535
2654
  };
2536
2655
 
2537
- // src/ensapi/api/name-tokens/deserialize.ts
2656
+ // src/ensnode/api/name-tokens/deserialize.ts
2538
2657
  function deserializedNameTokensResponse(maybeResponse) {
2539
2658
  const parsed = makeNameTokensResponseSchema("Name Tokens Response", false).safeParse(
2540
2659
  maybeResponse
2541
2660
  );
2542
2661
  if (parsed.error) {
2543
2662
  throw new Error(`Cannot deserialize NameTokensResponse:
2544
- ${prettifyError10(parsed.error)}
2663
+ ${prettifyError15(parsed.error)}
2545
2664
  `);
2546
2665
  }
2547
2666
  return parsed.data;
2548
2667
  }
2549
2668
 
2550
- // src/ensapi/api/name-tokens/prerequisites.ts
2669
+ // src/ensnode/api/name-tokens/prerequisites.ts
2551
2670
  var nameTokensPrerequisites = Object.freeze({
2552
2671
  /**
2553
2672
  * Required plugins to enable Name Tokens API routes.
@@ -2586,7 +2705,7 @@ var nameTokensPrerequisites = Object.freeze({
2586
2705
  }
2587
2706
  });
2588
2707
 
2589
- // src/ensapi/api/name-tokens/serialize.ts
2708
+ // src/ensnode/api/name-tokens/serialize.ts
2590
2709
  function serializeRegisteredNameTokens({
2591
2710
  domainId,
2592
2711
  name,
@@ -2614,18 +2733,19 @@ function serializeNameTokensResponse(response) {
2614
2733
  }
2615
2734
  }
2616
2735
 
2617
- // src/ensapi/api/registrar-actions/deserialize.ts
2618
- import { prettifyError as prettifyError11 } from "zod/v4";
2736
+ // src/ensnode/api/registrar-actions/deserialize.ts
2737
+ import { prettifyError as prettifyError16 } from "zod/v4";
2619
2738
 
2620
- // src/ensapi/api/registrar-actions/zod-schemas.ts
2621
- import { namehash as namehash3 } from "viem/ens";
2622
- import { z as z16 } from "zod/v4";
2739
+ // src/ensnode/api/registrar-actions/zod-schemas.ts
2740
+ import { namehashInterpretedName as namehashInterpretedName2 } from "enssdk";
2741
+ import { z as z20 } from "zod/v4";
2623
2742
 
2624
2743
  // src/registrars/zod-schemas.ts
2625
- import { z as z14 } from "zod/v4";
2744
+ import { z as z18 } from "zod/v4";
2626
2745
 
2627
2746
  // src/registrars/encoded-referrer.ts
2628
- import { getAddress, pad, size as size2, slice, zeroAddress as zeroAddress4 } from "viem";
2747
+ import { isNormalizedAddress, toNormalizedAddress as toNormalizedAddress2 } from "enssdk";
2748
+ import { pad, size as size2, slice, zeroAddress as zeroAddress4 } from "viem";
2629
2749
  var ENCODED_REFERRER_BYTE_OFFSET = 12;
2630
2750
  var ENCODED_REFERRER_BYTE_LENGTH = 32;
2631
2751
  var EXPECTED_ENCODED_REFERRER_PADDING = pad("0x", {
@@ -2637,8 +2757,8 @@ var ZERO_ENCODED_REFERRER = pad("0x", {
2637
2757
  dir: "left"
2638
2758
  });
2639
2759
  function buildEncodedReferrer(address) {
2640
- const lowercaseAddress = address.toLowerCase();
2641
- return pad(lowercaseAddress, { size: ENCODED_REFERRER_BYTE_LENGTH, dir: "left" });
2760
+ if (!isNormalizedAddress(address)) throw new Error(`Address '${address}' is not normalized.`);
2761
+ return pad(address, { size: ENCODED_REFERRER_BYTE_LENGTH, dir: "left" });
2642
2762
  }
2643
2763
  function decodeEncodedReferrer(encodedReferrer) {
2644
2764
  if (size2(encodedReferrer) !== ENCODED_REFERRER_BYTE_LENGTH) {
@@ -2647,12 +2767,10 @@ function decodeEncodedReferrer(encodedReferrer) {
2647
2767
  );
2648
2768
  }
2649
2769
  const padding = slice(encodedReferrer, 0, ENCODED_REFERRER_BYTE_OFFSET);
2650
- if (padding !== EXPECTED_ENCODED_REFERRER_PADDING) {
2651
- return zeroAddress4;
2652
- }
2770
+ if (padding !== EXPECTED_ENCODED_REFERRER_PADDING) return zeroAddress4;
2653
2771
  const decodedReferrer = slice(encodedReferrer, ENCODED_REFERRER_BYTE_OFFSET);
2654
2772
  try {
2655
- return getAddress(decodedReferrer);
2773
+ return toNormalizedAddress2(decodedReferrer);
2656
2774
  } catch {
2657
2775
  throw new Error(`Decoded referrer value must be a valid EVM address.`);
2658
2776
  }
@@ -2697,11 +2815,11 @@ function serializeRegistrarAction(registrarAction) {
2697
2815
  }
2698
2816
 
2699
2817
  // src/registrars/zod-schemas.ts
2700
- var makeSubregistrySchema = (valueLabel = "Subregistry") => z14.object({
2818
+ var makeSubregistrySchema = (valueLabel = "Subregistry") => z18.object({
2701
2819
  subregistryId: makeAccountIdSchema(`${valueLabel} Subregistry ID`),
2702
2820
  node: makeNodeSchema(`${valueLabel} Node`)
2703
2821
  });
2704
- var makeRegistrationLifecycleSchema = (valueLabel = "Registration Lifecycle") => z14.object({
2822
+ var makeRegistrationLifecycleSchema = (valueLabel = "Registration Lifecycle") => z18.object({
2705
2823
  subregistry: makeSubregistrySchema(`${valueLabel} Subregistry`),
2706
2824
  node: makeNodeSchema(`${valueLabel} Node`),
2707
2825
  expiresAt: makeUnixTimestampSchema(`${valueLabel} Expires at`)
@@ -2717,24 +2835,24 @@ function invariant_registrarActionPricingTotalIsSumOfBaseCostAndPremium(ctx) {
2717
2835
  });
2718
2836
  }
2719
2837
  }
2720
- var makeRegistrarActionPricingSchema = (valueLabel = "Registrar Action Pricing") => z14.union([
2838
+ var makeRegistrarActionPricingSchema = (valueLabel = "Registrar Action Pricing") => z18.union([
2721
2839
  // pricing available
2722
- z14.object({
2840
+ z18.object({
2723
2841
  baseCost: makePriceEthSchema(`${valueLabel} Base Cost`),
2724
2842
  premium: makePriceEthSchema(`${valueLabel} Premium`),
2725
2843
  total: makePriceEthSchema(`${valueLabel} Total`)
2726
2844
  }).check(invariant_registrarActionPricingTotalIsSumOfBaseCostAndPremium).transform((v) => v),
2727
2845
  // pricing unknown
2728
- z14.object({
2729
- baseCost: z14.null(),
2730
- premium: z14.null(),
2731
- total: z14.null()
2846
+ z18.object({
2847
+ baseCost: z18.null(),
2848
+ premium: z18.null(),
2849
+ total: z18.null()
2732
2850
  }).transform((v) => v)
2733
2851
  ]);
2734
2852
  function invariant_registrarActionDecodedReferrerBasedOnRawReferrer(ctx) {
2735
2853
  const { encodedReferrer, decodedReferrer } = ctx.value;
2736
2854
  try {
2737
- const expectedDecodedReferrer = decodeEncodedReferrer(encodedReferrer).toLowerCase();
2855
+ const expectedDecodedReferrer = decodeEncodedReferrer(encodedReferrer);
2738
2856
  if (decodedReferrer !== expectedDecodedReferrer) {
2739
2857
  ctx.issues.push({
2740
2858
  code: "custom",
@@ -2751,19 +2869,19 @@ function invariant_registrarActionDecodedReferrerBasedOnRawReferrer(ctx) {
2751
2869
  });
2752
2870
  }
2753
2871
  }
2754
- var makeRegistrarActionReferralSchema = (valueLabel = "Registrar Action Referral") => z14.union([
2872
+ var makeRegistrarActionReferralSchema = (valueLabel = "Registrar Action Referral") => z18.union([
2755
2873
  // referral available
2756
- z14.object({
2874
+ z18.object({
2757
2875
  encodedReferrer: makeHexStringSchema(
2758
2876
  { bytesCount: ENCODED_REFERRER_BYTE_LENGTH },
2759
2877
  `${valueLabel} Encoded Referrer`
2760
2878
  ),
2761
- decodedReferrer: makeLowercaseAddressSchema(`${valueLabel} Decoded Referrer`)
2879
+ decodedReferrer: makeNormalizedAddressSchema(`${valueLabel} Decoded Referrer`)
2762
2880
  }).check(invariant_registrarActionDecodedReferrerBasedOnRawReferrer),
2763
2881
  // referral not applicable
2764
- z14.object({
2765
- encodedReferrer: z14.null(),
2766
- decodedReferrer: z14.null()
2882
+ z18.object({
2883
+ encodedReferrer: z18.null(),
2884
+ decodedReferrer: z18.null()
2767
2885
  })
2768
2886
  ]);
2769
2887
  function invariant_eventIdsInitialElementIsTheActionId(ctx) {
@@ -2776,54 +2894,53 @@ function invariant_eventIdsInitialElementIsTheActionId(ctx) {
2776
2894
  });
2777
2895
  }
2778
2896
  }
2779
- var EventIdSchema = z14.string().nonempty();
2780
- var EventIdsSchema = z14.array(EventIdSchema).min(1).transform((v) => v);
2781
- var makeBaseRegistrarActionSchema = (valueLabel = "Base Registrar Action") => z14.object({
2897
+ var EventIdSchema = z18.string().nonempty();
2898
+ var EventIdsSchema = z18.array(EventIdSchema).min(1).transform((v) => v);
2899
+ var makeBaseRegistrarActionSchemaWithoutCheck = (valueLabel = "Base Registrar Action") => z18.object({
2782
2900
  id: EventIdSchema,
2783
2901
  incrementalDuration: makeDurationSchema(`${valueLabel} Incremental Duration`),
2784
- registrant: makeLowercaseAddressSchema(`${valueLabel} Registrant`),
2785
- registrationLifecycle: makeRegistrationLifecycleSchema(
2786
- `${valueLabel} Registration Lifecycle`
2787
- ),
2902
+ registrant: makeNormalizedAddressSchema(`${valueLabel} Registrant`),
2903
+ registrationLifecycle: makeRegistrationLifecycleSchema(`${valueLabel} Registration Lifecycle`),
2788
2904
  pricing: makeRegistrarActionPricingSchema(`${valueLabel} Pricing`),
2789
2905
  referral: makeRegistrarActionReferralSchema(`${valueLabel} Referral`),
2790
2906
  block: makeBlockRefSchema(`${valueLabel} Block`),
2791
2907
  transactionHash: makeTransactionHashSchema(`${valueLabel} Transaction Hash`),
2792
2908
  eventIds: EventIdsSchema
2793
- }).check(invariant_eventIdsInitialElementIsTheActionId);
2909
+ });
2910
+ var makeBaseRegistrarActionSchema = (valueLabel = "Base Registrar Action") => makeBaseRegistrarActionSchemaWithoutCheck(valueLabel).check(
2911
+ invariant_eventIdsInitialElementIsTheActionId
2912
+ );
2794
2913
  var makeRegistrarActionRegistrationSchema = (valueLabel = "Registration ") => makeBaseRegistrarActionSchema(valueLabel).extend({
2795
- type: z14.literal(RegistrarActionTypes.Registration)
2914
+ type: z18.literal(RegistrarActionTypes.Registration)
2796
2915
  });
2797
2916
  var makeRegistrarActionRenewalSchema = (valueLabel = "Renewal") => makeBaseRegistrarActionSchema(valueLabel).extend({
2798
- type: z14.literal(RegistrarActionTypes.Renewal)
2917
+ type: z18.literal(RegistrarActionTypes.Renewal)
2799
2918
  });
2800
- var makeRegistrarActionSchema = (valueLabel = "Registrar Action") => z14.discriminatedUnion("type", [
2919
+ var makeRegistrarActionSchema = (valueLabel = "Registrar Action") => z18.discriminatedUnion("type", [
2801
2920
  makeRegistrarActionRegistrationSchema(`${valueLabel} Registration`),
2802
2921
  makeRegistrarActionRenewalSchema(`${valueLabel} Renewal`)
2803
2922
  ]);
2804
2923
 
2805
- // src/ensapi/api/shared/pagination/zod-schemas.ts
2806
- import { z as z15 } from "zod/v4";
2924
+ // src/ensnode/api/shared/pagination/zod-schemas.ts
2925
+ import { z as z19 } from "zod/v4";
2807
2926
 
2808
- // src/ensapi/api/shared/pagination/request.ts
2927
+ // src/ensnode/api/shared/pagination/request.ts
2809
2928
  var RECORDS_PER_PAGE_DEFAULT = 10;
2810
2929
  var RECORDS_PER_PAGE_MAX = 100;
2811
2930
 
2812
- // src/ensapi/api/shared/pagination/zod-schemas.ts
2813
- var makeRequestPageParamsSchema = (valueLabel = "RequestPageParams") => z15.object({
2931
+ // src/ensnode/api/shared/pagination/zod-schemas.ts
2932
+ var makeRequestPageParamsSchema = (valueLabel = "RequestPageParams") => z19.object({
2814
2933
  page: makePositiveIntegerSchema(`${valueLabel}.page`),
2815
2934
  recordsPerPage: makePositiveIntegerSchema(`${valueLabel}.recordsPerPage`).max(
2816
2935
  RECORDS_PER_PAGE_MAX,
2817
2936
  `${valueLabel}.recordsPerPage must not exceed ${RECORDS_PER_PAGE_MAX}`
2818
2937
  )
2819
2938
  });
2820
- var makeResponsePageContextSchemaWithNoRecords = (valueLabel = "ResponsePageContextWithNoRecords") => z15.object({
2821
- totalRecords: z15.literal(0),
2822
- totalPages: z15.literal(1),
2823
- hasNext: z15.literal(false),
2824
- hasPrev: z15.literal(false),
2825
- startIndex: z15.undefined(),
2826
- endIndex: z15.undefined()
2939
+ var makeResponsePageContextSchemaWithNoRecords = (valueLabel = "ResponsePageContextWithNoRecords") => z19.object({
2940
+ totalRecords: z19.literal(0),
2941
+ totalPages: z19.literal(1),
2942
+ hasNext: z19.literal(false),
2943
+ hasPrev: z19.literal(false)
2827
2944
  }).extend(makeRequestPageParamsSchema(valueLabel).shape);
2828
2945
  function invariant_responsePageWithRecordsIsCorrect(ctx) {
2829
2946
  const { hasNext, hasPrev, recordsPerPage, page, totalRecords, startIndex, endIndex } = ctx.value;
@@ -2858,20 +2975,20 @@ function invariant_responsePageWithRecordsIsCorrect(ctx) {
2858
2975
  });
2859
2976
  }
2860
2977
  }
2861
- var makeResponsePageContextSchemaWithRecords = (valueLabel = "ResponsePageContextWithRecords") => z15.object({
2978
+ var makeResponsePageContextSchemaWithRecords = (valueLabel = "ResponsePageContextWithRecords") => z19.object({
2862
2979
  totalRecords: makePositiveIntegerSchema(`${valueLabel}.totalRecords`),
2863
2980
  totalPages: makePositiveIntegerSchema(`${valueLabel}.totalPages`),
2864
- hasNext: z15.boolean(),
2865
- hasPrev: z15.boolean(),
2981
+ hasNext: z19.boolean(),
2982
+ hasPrev: z19.boolean(),
2866
2983
  startIndex: makeNonNegativeIntegerSchema(`${valueLabel}.startIndex`),
2867
2984
  endIndex: makeNonNegativeIntegerSchema(`${valueLabel}.endIndex`)
2868
2985
  }).extend(makeRequestPageParamsSchema(valueLabel).shape).check(invariant_responsePageWithRecordsIsCorrect);
2869
- var makeResponsePageContextSchema = (valueLabel = "ResponsePageContext") => z15.union([
2986
+ var makeResponsePageContextSchema = (valueLabel = "ResponsePageContext") => z19.union([
2870
2987
  makeResponsePageContextSchemaWithNoRecords(valueLabel),
2871
2988
  makeResponsePageContextSchemaWithRecords(valueLabel)
2872
2989
  ]);
2873
2990
 
2874
- // src/ensapi/api/registrar-actions/response.ts
2991
+ // src/ensnode/api/registrar-actions/response.ts
2875
2992
  var RegistrarActionsResponseCodes = {
2876
2993
  /**
2877
2994
  * Represents that Registrar Actions are available.
@@ -2883,11 +3000,11 @@ var RegistrarActionsResponseCodes = {
2883
3000
  Error: "error"
2884
3001
  };
2885
3002
 
2886
- // src/ensapi/api/registrar-actions/zod-schemas.ts
3003
+ // src/ensnode/api/registrar-actions/zod-schemas.ts
2887
3004
  function invariant_registrationLifecycleNodeMatchesName(ctx) {
2888
3005
  const { name, action } = ctx.value;
2889
3006
  const expectedNode = action.registrationLifecycle.node;
2890
- const actualNode = namehash3(name);
3007
+ const actualNode = namehashInterpretedName2(name);
2891
3008
  if (actualNode !== expectedNode) {
2892
3009
  ctx.issues.push({
2893
3010
  code: "custom",
@@ -2896,39 +3013,39 @@ function invariant_registrationLifecycleNodeMatchesName(ctx) {
2896
3013
  });
2897
3014
  }
2898
3015
  }
2899
- var makeNamedRegistrarActionSchema = (valueLabel = "Named Registrar Action") => z16.object({
3016
+ var makeNamedRegistrarActionSchema = (valueLabel = "Named Registrar Action") => z20.object({
2900
3017
  action: makeRegistrarActionSchema(valueLabel),
2901
3018
  name: makeReinterpretedNameSchema(valueLabel)
2902
3019
  }).check(invariant_registrationLifecycleNodeMatchesName);
2903
- var makeRegistrarActionsResponseOkSchema = (valueLabel = "Registrar Actions Response OK") => z16.object({
2904
- responseCode: z16.literal(RegistrarActionsResponseCodes.Ok),
2905
- registrarActions: z16.array(makeNamedRegistrarActionSchema(valueLabel)),
3020
+ var makeRegistrarActionsResponseOkSchema = (valueLabel = "Registrar Actions Response OK") => z20.object({
3021
+ responseCode: z20.literal(RegistrarActionsResponseCodes.Ok),
3022
+ registrarActions: z20.array(makeNamedRegistrarActionSchema(valueLabel)),
2906
3023
  pageContext: makeResponsePageContextSchema(`${valueLabel}.pageContext`),
2907
- accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`).optional()
3024
+ accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`)
2908
3025
  });
2909
- var makeRegistrarActionsResponseErrorSchema = (_valueLabel = "Registrar Actions Response Error") => z16.strictObject({
2910
- responseCode: z16.literal(RegistrarActionsResponseCodes.Error),
2911
- error: ErrorResponseSchema
3026
+ var makeRegistrarActionsResponseErrorSchema = (_valueLabel = "Registrar Actions Response Error") => z20.strictObject({
3027
+ responseCode: z20.literal(RegistrarActionsResponseCodes.Error),
3028
+ error: makeErrorResponseSchema()
2912
3029
  });
2913
- var makeRegistrarActionsResponseSchema = (valueLabel = "Registrar Actions Response") => z16.discriminatedUnion("responseCode", [
3030
+ var makeRegistrarActionsResponseSchema = (valueLabel = "Registrar Actions Response") => z20.discriminatedUnion("responseCode", [
2914
3031
  makeRegistrarActionsResponseOkSchema(valueLabel),
2915
3032
  makeRegistrarActionsResponseErrorSchema(valueLabel)
2916
3033
  ]);
2917
3034
 
2918
- // src/ensapi/api/registrar-actions/deserialize.ts
3035
+ // src/ensnode/api/registrar-actions/deserialize.ts
2919
3036
  function deserializeRegistrarActionsResponse(maybeResponse) {
2920
3037
  const parsed = makeRegistrarActionsResponseSchema().safeParse(maybeResponse);
2921
3038
  if (parsed.error) {
2922
3039
  throw new Error(
2923
3040
  `Cannot deserialize RegistrarActionsResponse:
2924
- ${prettifyError11(parsed.error)}
3041
+ ${prettifyError16(parsed.error)}
2925
3042
  `
2926
3043
  );
2927
3044
  }
2928
3045
  return parsed.data;
2929
3046
  }
2930
3047
 
2931
- // src/ensapi/api/registrar-actions/request.ts
3048
+ // src/ensnode/api/registrar-actions/request.ts
2932
3049
  var RegistrarActionsFilterTypes = {
2933
3050
  BySubregistryNode: "bySubregistryNode",
2934
3051
  WithEncodedReferral: "withEncodedReferral",
@@ -2948,7 +3065,7 @@ var RegistrarActionsOrders = {
2948
3065
  LatestRegistrarActions: "orderBy[timestamp]=desc"
2949
3066
  };
2950
3067
 
2951
- // src/ensapi/api/registrar-actions/filters.ts
3068
+ // src/ensnode/api/registrar-actions/filters.ts
2952
3069
  function byParentNode(parentNode) {
2953
3070
  if (typeof parentNode === "undefined") {
2954
3071
  return void 0;
@@ -3001,7 +3118,7 @@ var registrarActionsFilter = {
3001
3118
  endTimestamp
3002
3119
  };
3003
3120
 
3004
- // src/ensapi/api/registrar-actions/prerequisites.ts
3121
+ // src/ensnode/api/registrar-actions/prerequisites.ts
3005
3122
  var registrarActionsRequiredPlugins = [
3006
3123
  "subgraph" /* Subgraph */,
3007
3124
  "basenames" /* Basenames */,
@@ -3033,7 +3150,7 @@ function hasRegistrarActionsIndexingStatusSupport(omnichainIndexingStatusId) {
3033
3150
  };
3034
3151
  }
3035
3152
 
3036
- // src/ensapi/api/registrar-actions/serialize.ts
3153
+ // src/ensnode/api/registrar-actions/serialize.ts
3037
3154
  function serializeNamedRegistrarAction({
3038
3155
  action,
3039
3156
  name
@@ -3057,19 +3174,19 @@ function serializeRegistrarActionsResponse(response) {
3057
3174
  }
3058
3175
  }
3059
3176
 
3060
- // src/ensapi/api/shared/errors/deserialize.ts
3061
- import { prettifyError as prettifyError12 } from "zod/v4";
3062
- function deserializeErrorResponse(maybeErrorResponse) {
3063
- const parsed = ErrorResponseSchema.safeParse(maybeErrorResponse);
3177
+ // src/ensnode/api/shared/errors/deserialize.ts
3178
+ import { prettifyError as prettifyError17 } from "zod/v4";
3179
+ function deserializeErrorResponse2(maybeErrorResponse) {
3180
+ const parsed = makeErrorResponseSchema().safeParse(maybeErrorResponse);
3064
3181
  if (parsed.error) {
3065
3182
  throw new Error(`Cannot deserialize ErrorResponse:
3066
- ${prettifyError12(parsed.error)}
3183
+ ${prettifyError17(parsed.error)}
3067
3184
  `);
3068
3185
  }
3069
3186
  return parsed.data;
3070
3187
  }
3071
3188
 
3072
- // src/ensapi/api/shared/pagination/build-page-context.ts
3189
+ // src/ensnode/api/shared/pagination/build-page-context.ts
3073
3190
  function buildPageContext(page, recordsPerPage, totalRecords) {
3074
3191
  const totalPages = Math.max(1, Math.ceil(totalRecords / recordsPerPage));
3075
3192
  if (page > totalPages) {
@@ -3104,7 +3221,7 @@ function buildPageContext(page, recordsPerPage, totalRecords) {
3104
3221
  };
3105
3222
  }
3106
3223
 
3107
- // src/ensapi/client-error.ts
3224
+ // src/ensnode/client-error.ts
3108
3225
  var ClientError = class _ClientError extends Error {
3109
3226
  details;
3110
3227
  constructor(message, details) {
@@ -3117,17 +3234,17 @@ var ClientError = class _ClientError extends Error {
3117
3234
  }
3118
3235
  };
3119
3236
 
3120
- // src/ensapi/deployments.ts
3237
+ // src/ensnode/deployments.ts
3121
3238
  import { ENSNamespaceIds as ENSNamespaceIds3 } from "@ensnode/datasources";
3122
- var DEFAULT_ENSNODE_API_URL_MAINNET = "https://api.alpha.ensnode.io";
3123
- var DEFAULT_ENSNODE_API_URL_SEPOLIA = "https://api.alpha-sepolia.ensnode.io";
3239
+ var DEFAULT_ENSNODE_URL_MAINNET = "https://api.alpha.ensnode.io";
3240
+ var DEFAULT_ENSNODE_URL_SEPOLIA = "https://api.alpha-sepolia.ensnode.io";
3124
3241
  var getDefaultEnsNodeUrl = (namespace) => {
3125
3242
  const effectiveNamespace = namespace ?? ENSNamespaceIds3.Mainnet;
3126
3243
  switch (effectiveNamespace) {
3127
3244
  case ENSNamespaceIds3.Mainnet:
3128
- return new URL(DEFAULT_ENSNODE_API_URL_MAINNET);
3245
+ return new URL(DEFAULT_ENSNODE_URL_MAINNET);
3129
3246
  case ENSNamespaceIds3.Sepolia:
3130
- return new URL(DEFAULT_ENSNODE_API_URL_SEPOLIA);
3247
+ return new URL(DEFAULT_ENSNODE_URL_SEPOLIA);
3131
3248
  default:
3132
3249
  throw new Error(
3133
3250
  `ENSNamespaceId ${effectiveNamespace} does not have a default ENSNode URL defined`
@@ -3135,8 +3252,8 @@ var getDefaultEnsNodeUrl = (namespace) => {
3135
3252
  }
3136
3253
  };
3137
3254
 
3138
- // src/ensapi/client.ts
3139
- var EnsApiClient = class _EnsApiClient {
3255
+ // src/ensnode/client.ts
3256
+ var EnsNodeClient = class _EnsNodeClient {
3140
3257
  options;
3141
3258
  static defaultOptions() {
3142
3259
  return {
@@ -3145,7 +3262,7 @@ var EnsApiClient = class _EnsApiClient {
3145
3262
  }
3146
3263
  constructor(options = {}) {
3147
3264
  this.options = {
3148
- ..._EnsApiClient.defaultOptions(),
3265
+ ..._EnsNodeClient.defaultOptions(),
3149
3266
  ...options
3150
3267
  };
3151
3268
  }
@@ -3189,15 +3306,21 @@ var EnsApiClient = class _EnsApiClient {
3189
3306
  */
3190
3307
  async resolveRecords(name, selection, options) {
3191
3308
  const url = new URL(`/api/resolve/records/${encodeURIComponent(name)}`, this.options.url);
3192
- if (selection.name) {
3193
- url.searchParams.set("name", "true");
3194
- }
3309
+ if (selection.name) url.searchParams.set("name", "true");
3310
+ if (selection.contenthash) url.searchParams.set("contenthash", "true");
3311
+ if (selection.pubkey) url.searchParams.set("pubkey", "true");
3312
+ if (selection.dnszonehash) url.searchParams.set("dnszonehash", "true");
3313
+ if (selection.version) url.searchParams.set("version", "true");
3314
+ if (selection.abi !== void 0) url.searchParams.set("abi", selection.abi.toString());
3195
3315
  if (selection.addresses && selection.addresses.length > 0) {
3196
3316
  url.searchParams.set("addresses", selection.addresses.join(","));
3197
3317
  }
3198
3318
  if (selection.texts && selection.texts.length > 0) {
3199
3319
  url.searchParams.set("texts", selection.texts.join(","));
3200
3320
  }
3321
+ if (selection.interfaces && selection.interfaces.length > 0) {
3322
+ url.searchParams.set("interfaces", selection.interfaces.join(","));
3323
+ }
3201
3324
  if (options?.trace) url.searchParams.set("trace", "true");
3202
3325
  if (options?.accelerate) url.searchParams.set("accelerate", "true");
3203
3326
  const response = await fetch(url);
@@ -3206,6 +3329,11 @@ var EnsApiClient = class _EnsApiClient {
3206
3329
  throw ClientError.fromErrorResponse(error);
3207
3330
  }
3208
3331
  const data = await response.json();
3332
+ const records = data.records;
3333
+ if (typeof records.version === "string") records.version = BigInt(records.version);
3334
+ if (records.abi && typeof records.abi.contentType === "string") {
3335
+ records.abi.contentType = BigInt(records.abi.contentType);
3336
+ }
3209
3337
  return data;
3210
3338
  }
3211
3339
  /**
@@ -3313,32 +3441,6 @@ var EnsApiClient = class _EnsApiClient {
3313
3441
  const data = await response.json();
3314
3442
  return data;
3315
3443
  }
3316
- /**
3317
- * Fetch ENSApi Config
3318
- *
3319
- * Fetch the ENSApi's configuration.
3320
- *
3321
- * @returns {EnsApiConfigResponse}
3322
- *
3323
- * @throws if the ENSApi request fails
3324
- * @throws if the ENSApi returns a non-ok response
3325
- * @throws if the ENSApi response breaks required invariants
3326
- */
3327
- async config() {
3328
- const url = new URL(`/api/config`, this.options.url);
3329
- const response = await fetch(url);
3330
- let responseData;
3331
- try {
3332
- responseData = await response.json();
3333
- } catch {
3334
- throw new Error("Malformed response data: invalid JSON");
3335
- }
3336
- if (!response.ok) {
3337
- const errorResponse = deserializeErrorResponse(responseData);
3338
- throw new Error(`Fetching ENSApi Config Failed: ${errorResponse.message}`);
3339
- }
3340
- return deserializeEnsApiConfigResponse(responseData);
3341
- }
3342
3444
  /**
3343
3445
  * Fetch ENSApi Indexing Status
3344
3446
  *
@@ -3360,7 +3462,7 @@ var EnsApiClient = class _EnsApiClient {
3360
3462
  if (!response.ok) {
3361
3463
  let errorResponse;
3362
3464
  try {
3363
- errorResponse = deserializeErrorResponse(responseData);
3465
+ errorResponse = deserializeErrorResponse2(responseData);
3364
3466
  } catch {
3365
3467
  }
3366
3468
  if (typeof errorResponse !== "undefined") {
@@ -3391,11 +3493,13 @@ var EnsApiClient = class _EnsApiClient {
3391
3493
  * ```ts
3392
3494
  * import {
3393
3495
  * registrarActionsFilter,
3394
- * EnsApiClient,
3496
+ * EnsNodeClient,
3395
3497
  * } from "@ensnode/ensnode-sdk";
3396
- * import { namehash } from "viem/ens";
3498
+ * import { ETH_NODE, namehashInterpretedName, asInterpretedName } from "enssdk";
3397
3499
  *
3398
- * const client: EnsApiClient;
3500
+ * const BASE_NODE = namehashInterpretedName(asInterpretedName("base.eth"));
3501
+ *
3502
+ * const client: EnsNodeClient;
3399
3503
  *
3400
3504
  * // Get first page with default page size (10 records)
3401
3505
  * const response = await client.registrarActions();
@@ -3415,7 +3519,7 @@ var EnsApiClient = class _EnsApiClient {
3415
3519
  * // get latest registrar action records associated with
3416
3520
  * // subregistry managing `eth` name
3417
3521
  * await client.registrarActions({
3418
- * filters: [registrarActionsFilter.byParentNode(namehash('eth'))],
3522
+ * filters: [registrarActionsFilter.byParentNode(ETH_NODE)],
3419
3523
  * });
3420
3524
  *
3421
3525
  * // get latest registrar action records which include referral info
@@ -3431,7 +3535,7 @@ var EnsApiClient = class _EnsApiClient {
3431
3535
  * // get latest 10 registrar action records associated with
3432
3536
  * // subregistry managing `base.eth` name
3433
3537
  * await client.registrarActions({
3434
- * filters: [registrarActionsFilter.byParentNode(namehash('base.eth'))],
3538
+ * filters: [registrarActionsFilter.byParentNode(BASE_NODE)],
3435
3539
  * recordsPerPage: 10
3436
3540
  * });
3437
3541
  *
@@ -3535,230 +3639,55 @@ var EnsApiClient = class _EnsApiClient {
3535
3639
  if (!response.ok) {
3536
3640
  let errorResponse;
3537
3641
  try {
3538
- errorResponse = deserializeErrorResponse(responseData);
3539
- } catch {
3540
- console.log("Registrar Actions API: handling a known server error.");
3541
- }
3542
- if (typeof errorResponse !== "undefined") {
3543
- throw new Error(`Fetching ENSNode Registrar Actions Failed: ${errorResponse.message}`);
3544
- }
3545
- }
3546
- return deserializeRegistrarActionsResponse(responseData);
3547
- }
3548
- /**
3549
- * Fetch Name Tokens for requested name.
3550
- *
3551
- * @param request.name - Name for which Name Tokens will be fetched.
3552
- * @returns {NameTokensResponse}
3553
- *
3554
- * @throws if the ENSNode request fails
3555
- * @throws if the ENSNode API returns an error response
3556
- * @throws if the ENSNode response breaks required invariants
3557
- *
3558
- * @example
3559
- * ```ts
3560
- * import {
3561
- * EnsApiClient,
3562
- * } from "@ensnode/ensnode-sdk";
3563
- * import { namehash } from "viem/ens";
3564
- *
3565
- * const client: EnsApiClient;
3566
- *
3567
- * // get latest name token records from the indexed subregistry based on the requested name
3568
- * const response = await client.nameTokens({
3569
- * name: "vitalik.eth"
3570
- * });
3571
- *
3572
- * const response = await client.nameTokens({
3573
- * domainId: "0xee6c4522aab0003e8d14cd40a6af439055fd2577951148c14b6cea9a53475835" // namehash('vitalik.eth')
3574
- * })
3575
- * ```
3576
- */
3577
- async nameTokens(request) {
3578
- const url = new URL(`/api/name-tokens`, this.options.url);
3579
- if (request.name !== void 0) {
3580
- url.searchParams.set("name", request.name);
3581
- } else if (request.domainId !== void 0) {
3582
- url.searchParams.set("domainId", request.domainId);
3583
- }
3584
- const response = await fetch(url);
3585
- let responseData;
3586
- try {
3587
- responseData = await response.json();
3588
- } catch {
3589
- throw new Error("Malformed response data: invalid JSON");
3590
- }
3591
- if (!response.ok) {
3592
- let errorResponse;
3593
- try {
3594
- errorResponse = deserializeErrorResponse(responseData);
3595
- } catch {
3596
- console.log("Name Tokens API: handling a known server error.");
3597
- }
3598
- if (typeof errorResponse !== "undefined") {
3599
- throw new Error(`Fetching ENSNode Name Tokens Failed: ${errorResponse.message}`);
3600
- }
3601
- }
3602
- return deserializedNameTokensResponse(responseData);
3603
- }
3604
- };
3605
- var ENSNodeClient = class extends EnsApiClient {
3606
- };
3607
-
3608
- // src/ensindexer/api/config/deserialize.ts
3609
- function deserializeEnsIndexerConfigResponse(maybeResponse) {
3610
- return deserializeEnsIndexerPublicConfig(maybeResponse, "EnsIndexerConfigResponse");
3611
- }
3612
-
3613
- // src/ensindexer/api/config/serialize.ts
3614
- function serializeEnsIndexerConfigResponse(response) {
3615
- return serializeEnsIndexerPublicConfig(response);
3616
- }
3617
-
3618
- // src/ensindexer/api/indexing-status/deserialize.ts
3619
- import { prettifyError as prettifyError13 } from "zod/v4";
3620
-
3621
- // src/ensindexer/api/indexing-status/response.ts
3622
- var EnsIndexerIndexingStatusResponseCodes = {
3623
- /**
3624
- * Represents that the indexing status is available.
3625
- */
3626
- Ok: "ok",
3627
- /**
3628
- * Represents that the indexing status is unavailable.
3629
- */
3630
- Error: "error"
3631
- };
3632
-
3633
- // src/ensindexer/api/indexing-status/zod-schemas.ts
3634
- import { z as z17 } from "zod/v4";
3635
- var makeEnsIndexerIndexingStatusResponseOkSchema = (valueLabel = "Indexing Status Response OK") => z17.strictObject({
3636
- responseCode: z17.literal(EnsIndexerIndexingStatusResponseCodes.Ok),
3637
- realtimeProjection: makeRealtimeIndexingStatusProjectionSchema(valueLabel)
3638
- });
3639
- var makeEnsIndexerIndexingStatusResponseErrorSchema = (_valueLabel = "Indexing Status Response Error") => z17.strictObject({
3640
- responseCode: z17.literal(EnsIndexerIndexingStatusResponseCodes.Error)
3641
- });
3642
- var makeEnsIndexerIndexingStatusResponseSchema = (valueLabel = "Indexing Status Response") => z17.discriminatedUnion("responseCode", [
3643
- makeEnsIndexerIndexingStatusResponseOkSchema(valueLabel),
3644
- makeEnsIndexerIndexingStatusResponseErrorSchema(valueLabel)
3645
- ]);
3646
- var makeSerializedEnsIndexerIndexingStatusResponseOkSchema = (valueLabel = "Serialized Indexing Status Response OK") => z17.strictObject({
3647
- responseCode: z17.literal(EnsIndexerIndexingStatusResponseCodes.Ok),
3648
- realtimeProjection: makeSerializedRealtimeIndexingStatusProjectionSchema(valueLabel)
3649
- });
3650
- var makeSerializedEnsIndexerIndexingStatusResponseSchema = (valueLabel = "Serialized Indexing Status Response") => z17.discriminatedUnion("responseCode", [
3651
- makeSerializedEnsIndexerIndexingStatusResponseOkSchema(valueLabel),
3652
- makeEnsIndexerIndexingStatusResponseErrorSchema(valueLabel)
3653
- ]);
3654
-
3655
- // src/ensindexer/api/indexing-status/deserialize.ts
3656
- function buildUnvalidatedEnsIndexerIndexingStatusResponse(serializedResponse) {
3657
- if (serializedResponse.responseCode !== EnsIndexerIndexingStatusResponseCodes.Ok) {
3658
- return serializedResponse;
3659
- }
3660
- return {
3661
- ...serializedResponse,
3662
- realtimeProjection: buildUnvalidatedRealtimeIndexingStatusProjection(
3663
- serializedResponse.realtimeProjection
3664
- )
3665
- };
3666
- }
3667
- function deserializeEnsIndexerIndexingStatusResponse(maybeResponse) {
3668
- const parsed = makeSerializedEnsIndexerIndexingStatusResponseSchema().transform(buildUnvalidatedEnsIndexerIndexingStatusResponse).pipe(makeEnsIndexerIndexingStatusResponseSchema()).safeParse(maybeResponse);
3669
- if (parsed.error) {
3670
- throw new Error(
3671
- `Cannot deserialize EnsIndexerIndexingStatusResponse:
3672
- ${prettifyError13(parsed.error)}
3673
- `
3674
- );
3675
- }
3676
- return parsed.data;
3677
- }
3678
-
3679
- // src/ensindexer/api/indexing-status/serialize.ts
3680
- function serializeEnsIndexerIndexingStatusResponse(response) {
3681
- switch (response.responseCode) {
3682
- case EnsIndexerIndexingStatusResponseCodes.Ok:
3683
- return {
3684
- responseCode: response.responseCode,
3685
- realtimeProjection: serializeRealtimeIndexingStatusProjection(response.realtimeProjection)
3686
- };
3687
- case EnsIndexerIndexingStatusResponseCodes.Error:
3688
- return response;
3689
- }
3690
- }
3691
-
3692
- // src/ensindexer/api/shared/errors/deserialize.ts
3693
- import { prettifyError as prettifyError14 } from "zod/v4";
3694
-
3695
- // src/ensindexer/api/shared/errors/zod-schemas.ts
3696
- import { z as z18 } from "zod/v4";
3697
- var ErrorResponseSchema2 = z18.object({
3698
- message: z18.string(),
3699
- details: z18.optional(z18.unknown())
3700
- });
3701
-
3702
- // src/ensindexer/api/shared/errors/deserialize.ts
3703
- function deserializeErrorResponse2(maybeErrorResponse) {
3704
- const parsed = ErrorResponseSchema2.safeParse(maybeErrorResponse);
3705
- if (parsed.error) {
3706
- throw new Error(`Cannot deserialize ErrorResponse:
3707
- ${prettifyError14(parsed.error)}
3708
- `);
3709
- }
3710
- return parsed.data;
3711
- }
3712
-
3713
- // src/ensindexer/client.ts
3714
- var EnsIndexerClient = class {
3715
- constructor(options) {
3716
- this.options = options;
3717
- }
3718
- getOptions() {
3719
- return Object.freeze({
3720
- url: new URL(this.options.url.href)
3721
- });
3722
- }
3723
- /**
3724
- * Fetch ENSIndexer Config
3725
- *
3726
- * Fetch the ENSIndexer's configuration.
3727
- *
3728
- * @returns {EnsIndexerConfigResponse}
3729
- *
3730
- * @throws if the ENSIndexer request fails
3731
- * @throws if the ENSIndexer returns a non-ok response
3732
- * @throws if the ENSIndexer response breaks required invariants
3733
- */
3734
- async config() {
3735
- const url = new URL(`/api/config`, this.options.url);
3736
- const response = await fetch(url);
3737
- let responseData;
3738
- try {
3739
- responseData = await response.json();
3740
- } catch {
3741
- throw new Error("Malformed response data: invalid JSON");
3742
- }
3743
- if (!response.ok) {
3744
- const errorResponse = deserializeErrorResponse2(responseData);
3745
- throw new Error(`Fetching ENSIndexer Config Failed: ${errorResponse.message}`);
3642
+ errorResponse = deserializeErrorResponse2(responseData);
3643
+ } catch {
3644
+ console.log("Registrar Actions API: handling a known server error.");
3645
+ }
3646
+ if (typeof errorResponse !== "undefined") {
3647
+ throw new Error(`Fetching ENSNode Registrar Actions Failed: ${errorResponse.message}`);
3648
+ }
3746
3649
  }
3747
- return deserializeEnsIndexerConfigResponse(
3748
- responseData
3749
- );
3650
+ return deserializeRegistrarActionsResponse(responseData);
3750
3651
  }
3751
3652
  /**
3752
- * Fetch ENSIndexer Indexing Status
3653
+ * Fetch Name Tokens for requested name.
3753
3654
  *
3754
- * @returns {EnsIndexerIndexingStatusResponse}
3655
+ * @param request.name - Name for which Name Tokens will be fetched.
3656
+ * @returns {NameTokensResponse}
3755
3657
  *
3756
- * @throws if the ENSIndexer request fails
3757
- * @throws if the ENSIndexer returns a non-ok response
3758
- * @throws if the ENSIndexer response breaks required invariants
3658
+ * @throws if the ENSNode request fails
3659
+ * @throws if the ENSNode API returns an error response
3660
+ * @throws if the ENSNode response breaks required invariants
3661
+ *
3662
+ * @example
3663
+ * ```ts
3664
+ * import {
3665
+ * EnsNodeClient,
3666
+ * } from "@ensnode/ensnode-sdk";
3667
+ * import { namehashInterpretedName, asInterpretedName } from "enssdk";
3668
+ *
3669
+ * const VITALIK_NAME = asInterpretedName("vitalik.eth");
3670
+ * const VITALIK_DOMAIN_ID = namehashInterpretedName(VITALIK_NAME);
3671
+ *
3672
+ * const client: EnsNodeClient;
3673
+ *
3674
+ * // get latest name token records from the indexed subregistry based on the requested name
3675
+ * const response = await client.nameTokens({
3676
+ * name: VITALIK_NAME,
3677
+ * });
3678
+ *
3679
+ * const response = await client.nameTokens({
3680
+ * domainId: VITALIK_DOMAIN_ID,
3681
+ * })
3682
+ * ```
3759
3683
  */
3760
- async indexingStatus() {
3761
- const url = new URL(`/api/indexing-status`, this.options.url);
3684
+ async nameTokens(request) {
3685
+ const url = new URL(`/api/name-tokens`, this.options.url);
3686
+ if (request.name !== void 0) {
3687
+ url.searchParams.set("name", request.name);
3688
+ } else if (request.domainId !== void 0) {
3689
+ url.searchParams.set("domainId", request.domainId);
3690
+ }
3762
3691
  const response = await fetch(url);
3763
3692
  let responseData;
3764
3693
  try {
@@ -3771,181 +3700,15 @@ var EnsIndexerClient = class {
3771
3700
  try {
3772
3701
  errorResponse = deserializeErrorResponse2(responseData);
3773
3702
  } catch {
3703
+ console.log("Name Tokens API: handling a known server error.");
3774
3704
  }
3775
3705
  if (typeof errorResponse !== "undefined") {
3776
- throw new Error(`Fetching ENSIndexer Indexing Status Failed: ${errorResponse.message}`);
3706
+ throw new Error(`Fetching ENSNode Name Tokens Failed: ${errorResponse.message}`);
3777
3707
  }
3778
3708
  }
3779
- return deserializeEnsIndexerIndexingStatusResponse(
3780
- responseData
3781
- );
3782
- }
3783
- };
3784
-
3785
- // src/ensindexer/config/compatibility.ts
3786
- function validateEnsIndexerPublicConfigCompatibility(configA, configB) {
3787
- if (configA.indexedChainIds.symmetricDifference(configB.indexedChainIds).size > 0) {
3788
- throw new Error(
3789
- [
3790
- `'indexedChainIds' must be compatible.`,
3791
- `Stored Config 'indexedChainIds': '${Array.from(configA.indexedChainIds).join(", ")}'.`,
3792
- `Current Config 'indexedChainIds': '${Array.from(configB.indexedChainIds).join(", ")}'.`
3793
- ].join(" ")
3794
- );
3795
- }
3796
- if (configA.isSubgraphCompatible !== configB.isSubgraphCompatible) {
3797
- throw new Error(
3798
- [
3799
- `'isSubgraphCompatible' flag must be compatible.`,
3800
- `Stored Config 'isSubgraphCompatible' flag: '${configA.isSubgraphCompatible}'.`,
3801
- `Current Config 'isSubgraphCompatible' flag: '${configB.isSubgraphCompatible}'.`
3802
- ].join(" ")
3803
- );
3804
- }
3805
- if (configA.namespace !== configB.namespace) {
3806
- throw new Error(
3807
- [
3808
- `'namespace' must be compatible.`,
3809
- `Stored Config 'namespace': '${configA.namespace}'.`,
3810
- `Current Config 'namespace': '${configB.namespace}'.`
3811
- ].join(" ")
3812
- );
3813
- }
3814
- if (configA.labelSet.labelSetId !== configB.labelSet.labelSetId) {
3815
- throw new Error(
3816
- [
3817
- `'labelSet.labelSetId' must be compatible.`,
3818
- `Stored Config 'labelSet.labelSetId': '${configA.labelSet.labelSetId}'.`,
3819
- `Current Config 'labelSet.labelSetId': '${configB.labelSet.labelSetId}'.`
3820
- ].join(" ")
3821
- );
3822
- }
3823
- if (configA.labelSet.labelSetVersion !== configB.labelSet.labelSetVersion) {
3824
- throw new Error(
3825
- [
3826
- `'labelSet.labelSetVersion' must be compatible.`,
3827
- `Stored Config 'labelSet.labelSetVersion': '${configA.labelSet.labelSetVersion}'.`,
3828
- `Current Config 'labelSet.labelSetVersion': '${configB.labelSet.labelSetVersion}'.`
3829
- ].join(" ")
3830
- );
3831
- }
3832
- const configAPluginsSet = new Set(configA.plugins);
3833
- const configBPluginsSet = new Set(configB.plugins);
3834
- if (configAPluginsSet.symmetricDifference(configBPluginsSet).size > 0) {
3835
- throw new Error(
3836
- [
3837
- `'plugins' must be compatible.`,
3838
- `Stored Config 'plugins': '${configA.plugins.join(", ")}'.`,
3839
- `Current Config 'plugins': '${configB.plugins.join(", ")}'.`
3840
- ].join(" ")
3841
- );
3842
- }
3843
- }
3844
-
3845
- // src/ensindexer/config/label-utils.ts
3846
- import { hexToBytes as hexToBytes2 } from "viem";
3847
- function labelHashToBytes(labelHash) {
3848
- try {
3849
- if (labelHash.length !== 66) {
3850
- throw new Error(`Invalid labelHash length ${labelHash.length} characters (expected 66)`);
3851
- }
3852
- if (labelHash !== labelHash.toLowerCase()) {
3853
- throw new Error("Labelhash must be in lowercase");
3854
- }
3855
- if (!labelHash.startsWith("0x")) {
3856
- throw new Error("Labelhash must be 0x-prefixed");
3857
- }
3858
- const bytes = hexToBytes2(labelHash);
3859
- if (bytes.length !== 32) {
3860
- throw new Error(`Invalid labelHash length ${bytes.length} bytes (expected 32)`);
3861
- }
3862
- return bytes;
3863
- } catch (e) {
3864
- if (e instanceof Error) {
3865
- throw e;
3866
- }
3867
- throw new Error("Invalid hex format");
3868
- }
3869
- }
3870
-
3871
- // src/ensindexer/config/parsing.ts
3872
- function parseNonNegativeInteger(maybeNumber) {
3873
- const trimmed = maybeNumber.trim();
3874
- if (!trimmed) {
3875
- throw new Error("Input cannot be empty");
3876
- }
3877
- if (trimmed === "-0") {
3878
- throw new Error("Negative zero is not a valid non-negative integer");
3879
- }
3880
- const num = Number(maybeNumber);
3881
- if (Number.isNaN(num)) {
3882
- throw new Error(`"${maybeNumber}" is not a valid number`);
3883
- }
3884
- if (!Number.isFinite(num)) {
3885
- throw new Error(`"${maybeNumber}" is not a finite number`);
3886
- }
3887
- if (!Number.isInteger(num)) {
3888
- throw new Error(`"${maybeNumber}" is not an integer`);
3889
- }
3890
- if (num < 0) {
3891
- throw new Error(`"${maybeNumber}" is not a non-negative integer`);
3892
- }
3893
- return num;
3894
- }
3895
-
3896
- // src/ensindexer/config/validate/ensindexer-public-config.ts
3897
- import { prettifyError as prettifyError15 } from "zod/v4";
3898
- function validateEnsIndexerPublicConfig(unvalidatedConfig) {
3899
- const schema = makeEnsIndexerPublicConfigSchema();
3900
- const result = schema.safeParse(unvalidatedConfig);
3901
- if (!result.success) {
3902
- throw new Error(`Invalid ENSIndexerPublicConfig: ${prettifyError15(result.error)}`);
3903
- }
3904
- return result.data;
3905
- }
3906
-
3907
- // src/ensindexer/config/validate/ensindexer-version-info.ts
3908
- import { prettifyError as prettifyError16 } from "zod/v4";
3909
- function validateEnsIndexerVersionInfo(unvalidatedVersionInfo) {
3910
- const schema = makeEnsIndexerVersionInfoSchema();
3911
- const result = schema.safeParse(unvalidatedVersionInfo);
3912
- if (!result.success) {
3913
- throw new Error(`Invalid EnsIndexerVersionInfo: ${prettifyError16(result.error)}`);
3709
+ return deserializedNameTokensResponse(responseData);
3914
3710
  }
3915
- return result.data;
3916
- }
3917
-
3918
- // src/ensv2/ids-lib.ts
3919
- import { hexToBigInt as hexToBigInt2 } from "viem";
3920
- var makeRegistryId = (accountId) => formatAccountId(accountId);
3921
- var makeENSv1DomainId = (node) => node;
3922
- var makeENSv2DomainId = (registry, canonicalId) => formatAssetId({
3923
- assetNamespace: AssetNamespaces.ERC1155,
3924
- contract: registry,
3925
- tokenId: canonicalId
3926
- });
3927
- var maskLower32Bits = (num) => num ^ num & 0xffffffffn;
3928
- var getCanonicalId = (input) => {
3929
- if (typeof input === "bigint") return maskLower32Bits(input);
3930
- return getCanonicalId(hexToBigInt2(input));
3931
3711
  };
3932
- var makePermissionsId = (contract) => formatAccountId(contract);
3933
- var makePermissionsResourceId = (contract, resource) => `${makePermissionsId(contract)}/${resource}`;
3934
- var makePermissionsUserId = (contract, resource, user) => `${makePermissionsId(contract)}/${resource}/${user}`;
3935
- var makeResolverId = (contract) => formatAccountId(contract);
3936
- var makeResolverRecordsId = (resolver, node) => `${makeResolverId(resolver)}/${node}`;
3937
- var makeRegistrationId = (domainId, index) => `${domainId}/${index}`;
3938
- var makeRenewalId = (domainId, registrationIndex, index) => `${makeRegistrationId(domainId, registrationIndex)}/${index}`;
3939
-
3940
- // src/graphql-api/prerequisites.ts
3941
- function hasGraphqlApiConfigSupport(config) {
3942
- const supported = config.plugins.includes("ensv2" /* ENSv2 */);
3943
- if (supported) return { supported };
3944
- return {
3945
- supported: false,
3946
- reason: `The connected ENSNode's Config must have the '${"ensv2" /* ENSv2 */}' plugin enabled.`
3947
- };
3948
- }
3949
3712
 
3950
3713
  // src/identity/identity.ts
3951
3714
  import { getENSRootChainId as getENSRootChainId2 } from "@ensnode/datasources";
@@ -3984,14 +3747,14 @@ function isResolvedIdentity(identity) {
3984
3747
  }
3985
3748
 
3986
3749
  // src/indexing-status/deserialize/chain-indexing-status-snapshot.ts
3987
- import { prettifyError as prettifyError17 } from "zod/v4";
3750
+ import { prettifyError as prettifyError18 } from "zod/v4";
3988
3751
  function deserializeChainIndexingStatusSnapshot(maybeSnapshot, valueLabel) {
3989
3752
  const schema = makeChainIndexingStatusSnapshotSchema(valueLabel);
3990
3753
  const parsed = schema.safeParse(maybeSnapshot);
3991
3754
  if (parsed.error) {
3992
3755
  throw new Error(
3993
3756
  `Cannot deserialize into ChainIndexingStatusSnapshot:
3994
- ${prettifyError17(parsed.error)}
3757
+ ${prettifyError18(parsed.error)}
3995
3758
  `
3996
3759
  );
3997
3760
  }
@@ -4009,32 +3772,43 @@ function createRealtimeIndexingStatusProjection(snapshot, now) {
4009
3772
  }
4010
3773
 
4011
3774
  // src/indexing-status/validate/chain-indexing-status-snapshot.ts
4012
- import { prettifyError as prettifyError18 } from "zod/v4";
3775
+ import { prettifyError as prettifyError19 } from "zod/v4";
4013
3776
  function validateChainIndexingStatusSnapshot(unvalidatedSnapshot, valueLabel) {
4014
3777
  const schema = makeChainIndexingStatusSnapshotSchema(valueLabel);
4015
3778
  const parsed = schema.safeParse(unvalidatedSnapshot);
4016
3779
  if (parsed.error) {
4017
3780
  throw new Error(`Invalid ChainIndexingStatusSnapshot:
4018
- ${prettifyError18(parsed.error)}
3781
+ ${prettifyError19(parsed.error)}
4019
3782
  `);
4020
3783
  }
4021
3784
  return parsed.data;
4022
3785
  }
4023
3786
 
4024
3787
  // src/indexing-status/validate/realtime-indexing-status-projection.ts
4025
- import { prettifyError as prettifyError19 } from "zod/v4";
3788
+ import { prettifyError as prettifyError20 } from "zod/v4";
4026
3789
  function validateRealtimeIndexingStatusProjection(unvalidatedProjection, valueLabel) {
4027
3790
  const schema = makeRealtimeIndexingStatusProjectionSchema(valueLabel);
4028
3791
  const parsed = schema.safeParse(unvalidatedProjection);
4029
3792
  if (parsed.error) {
4030
3793
  throw new Error(`Invalid RealtimeIndexingStatusProjection:
4031
- ${prettifyError19(parsed.error)}
3794
+ ${prettifyError20(parsed.error)}
4032
3795
  `);
4033
3796
  }
4034
3797
  return parsed.data;
4035
3798
  }
4036
3799
 
3800
+ // src/omnigraph-api/prerequisites.ts
3801
+ function hasOmnigraphApiConfigSupport(config) {
3802
+ const supported = config.plugins.includes("ensv2" /* ENSv2 */);
3803
+ if (supported) return { supported };
3804
+ return {
3805
+ supported: false,
3806
+ reason: `The connected ENSNode's Config must have the '${"ensv2" /* ENSv2 */}' plugin enabled.`
3807
+ };
3808
+ }
3809
+
4037
3810
  // src/registrars/basenames-subregistry.ts
3811
+ import { asInterpretedName } from "enssdk";
4038
3812
  import {
4039
3813
  DatasourceNames as DatasourceNames2,
4040
3814
  ENSNamespaceIds as ENSNamespaceIds4,
@@ -4049,18 +3823,15 @@ function getBasenamesSubregistryId(namespace) {
4049
3823
  if (address === void 0 || Array.isArray(address)) {
4050
3824
  throw new Error(`BaseRegistrar contract not found or has multiple addresses for ${namespace}`);
4051
3825
  }
4052
- return {
4053
- chainId: datasource.chain.id,
4054
- address
4055
- };
3826
+ return { chainId: datasource.chain.id, address };
4056
3827
  }
4057
3828
  function getBasenamesSubregistryManagedName(namespaceId) {
4058
3829
  switch (namespaceId) {
4059
3830
  case ENSNamespaceIds4.Mainnet:
4060
- return "base.eth";
3831
+ return asInterpretedName("base.eth");
4061
3832
  case ENSNamespaceIds4.Sepolia:
4062
3833
  case ENSNamespaceIds4.SepoliaV2:
4063
- return "basetest.eth";
3834
+ return asInterpretedName("basetest.eth");
4064
3835
  case ENSNamespaceIds4.EnsTestEnv:
4065
3836
  throw new Error(
4066
3837
  `No registrar managed name is known for the 'basenames' subregistry within the "${namespaceId}" namespace.`
@@ -4069,6 +3840,7 @@ function getBasenamesSubregistryManagedName(namespaceId) {
4069
3840
  }
4070
3841
 
4071
3842
  // src/registrars/ethnames-subregistry.ts
3843
+ import { asInterpretedName as asInterpretedName2 } from "enssdk";
4072
3844
  import {
4073
3845
  DatasourceNames as DatasourceNames3,
4074
3846
  ENSNamespaceIds as ENSNamespaceIds5,
@@ -4083,10 +3855,7 @@ function getEthnamesSubregistryId(namespace) {
4083
3855
  if (address === void 0 || Array.isArray(address)) {
4084
3856
  throw new Error(`BaseRegistrar contract not found or has multiple addresses for ${namespace}`);
4085
3857
  }
4086
- return {
4087
- chainId: datasource.chain.id,
4088
- address
4089
- };
3858
+ return { chainId: datasource.chain.id, address };
4090
3859
  }
4091
3860
  function getEthnamesSubregistryManagedName(namespaceId) {
4092
3861
  switch (namespaceId) {
@@ -4094,11 +3863,12 @@ function getEthnamesSubregistryManagedName(namespaceId) {
4094
3863
  case ENSNamespaceIds5.Sepolia:
4095
3864
  case ENSNamespaceIds5.SepoliaV2:
4096
3865
  case ENSNamespaceIds5.EnsTestEnv:
4097
- return "eth";
3866
+ return asInterpretedName2("eth");
4098
3867
  }
4099
3868
  }
4100
3869
 
4101
3870
  // src/registrars/lineanames-subregistry.ts
3871
+ import { asInterpretedName as asInterpretedName3 } from "enssdk";
4102
3872
  import {
4103
3873
  DatasourceNames as DatasourceNames4,
4104
3874
  ENSNamespaceIds as ENSNamespaceIds6,
@@ -4113,18 +3883,15 @@ function getLineanamesSubregistryId(namespace) {
4113
3883
  if (address === void 0 || Array.isArray(address)) {
4114
3884
  throw new Error(`BaseRegistrar contract not found or has multiple addresses for ${namespace}`);
4115
3885
  }
4116
- return {
4117
- chainId: datasource.chain.id,
4118
- address
4119
- };
3886
+ return { chainId: datasource.chain.id, address };
4120
3887
  }
4121
3888
  function getLineanamesSubregistryManagedName(namespaceId) {
4122
3889
  switch (namespaceId) {
4123
3890
  case ENSNamespaceIds6.Mainnet:
4124
- return "linea.eth";
3891
+ return asInterpretedName3("linea.eth");
4125
3892
  case ENSNamespaceIds6.Sepolia:
4126
3893
  case ENSNamespaceIds6.SepoliaV2:
4127
- return "linea-sepolia.eth";
3894
+ return asInterpretedName3("linea-sepolia.eth");
4128
3895
  case ENSNamespaceIds6.EnsTestEnv:
4129
3896
  throw new Error(
4130
3897
  `No registrar managed name is known for the 'Lineanames' subregistry within the "${namespaceId}" namespace.`
@@ -4148,6 +3915,7 @@ function isRegistrationInGracePeriod(info, now) {
4148
3915
  }
4149
3916
 
4150
3917
  // src/resolution/ensip19-chainid.ts
3918
+ import { DEFAULT_EVM_CHAIN_ID } from "enssdk";
4151
3919
  import { mainnet } from "viem/chains";
4152
3920
  import { getENSRootChainId as getENSRootChainId3 } from "@ensnode/datasources";
4153
3921
  var getResolvePrimaryNameChainIdParam = (chainId, namespaceId) => {
@@ -4159,7 +3927,7 @@ var translateDefaultableChainIdToChainId = (chainId, namespaceId) => {
4159
3927
  };
4160
3928
 
4161
3929
  // src/resolution/resolver-records-selection.ts
4162
- var isSelectionEmpty = (selection) => !selection.name && !selection.addresses?.length && !selection.texts?.length;
3930
+ var isSelectionEmpty = (selection) => !selection.name && !selection.addresses?.length && !selection.texts?.length && !selection.contenthash && !selection.pubkey && !selection.dnszonehash && selection.abi === void 0 && !selection.interfaces?.length && !selection.version;
4163
3931
 
4164
3932
  // src/shared/cache/lru-cache.ts
4165
3933
  var LruCache = class {
@@ -4218,13 +3986,13 @@ import { getUnixTime as getUnixTime2 } from "date-fns/getUnixTime";
4218
3986
  import { getUnixTime } from "date-fns/getUnixTime";
4219
3987
 
4220
3988
  // src/shared/deserialize.ts
4221
- import z19, { prettifyError as prettifyError20 } from "zod/v4";
3989
+ import z21, { prettifyError as prettifyError21 } from "zod/v4";
4222
3990
  function deserializeChainId(maybeChainId, valueLabel) {
4223
3991
  const schema = makeChainIdStringSchema(valueLabel);
4224
3992
  const parsed = schema.safeParse(maybeChainId);
4225
3993
  if (parsed.error) {
4226
3994
  throw new Error(`Cannot deserialize ChainId:
4227
- ${prettifyError20(parsed.error)}
3995
+ ${prettifyError21(parsed.error)}
4228
3996
  `);
4229
3997
  }
4230
3998
  return parsed.data;
@@ -4234,7 +4002,7 @@ function deserializeDatetime(maybeDatetime, valueLabel) {
4234
4002
  const parsed = schema.safeParse(maybeDatetime);
4235
4003
  if (parsed.error) {
4236
4004
  throw new Error(`Cannot deserialize Datetime:
4237
- ${prettifyError20(parsed.error)}
4005
+ ${prettifyError21(parsed.error)}
4238
4006
  `);
4239
4007
  }
4240
4008
  return parsed.data;
@@ -4244,7 +4012,7 @@ function deserializeUnixTimestamp(maybeTimestamp, valueLabel) {
4244
4012
  const parsed = schema.safeParse(maybeTimestamp);
4245
4013
  if (parsed.error) {
4246
4014
  throw new Error(`Cannot deserialize Unix Timestamp:
4247
- ${prettifyError20(parsed.error)}
4015
+ ${prettifyError21(parsed.error)}
4248
4016
  `);
4249
4017
  }
4250
4018
  return parsed.data;
@@ -4254,7 +4022,7 @@ function deserializeUrl(maybeUrl, valueLabel) {
4254
4022
  const parsed = schema.safeParse(maybeUrl);
4255
4023
  if (parsed.error) {
4256
4024
  throw new Error(`Cannot deserialize URL:
4257
- ${prettifyError20(parsed.error)}
4025
+ ${prettifyError21(parsed.error)}
4258
4026
  `);
4259
4027
  }
4260
4028
  return parsed.data;
@@ -4264,7 +4032,7 @@ function deserializeBlockNumber(maybeBlockNumber, valueLabel) {
4264
4032
  const parsed = schema.safeParse(maybeBlockNumber);
4265
4033
  if (parsed.error) {
4266
4034
  throw new Error(`Cannot deserialize BlockNumber:
4267
- ${prettifyError20(parsed.error)}
4035
+ ${prettifyError21(parsed.error)}
4268
4036
  `);
4269
4037
  }
4270
4038
  return parsed.data;
@@ -4274,17 +4042,17 @@ function deserializeBlockRef(maybeBlockRef, valueLabel) {
4274
4042
  const parsed = schema.safeParse(maybeBlockRef);
4275
4043
  if (parsed.error) {
4276
4044
  throw new Error(`Cannot deserialize BlockRef:
4277
- ${prettifyError20(parsed.error)}
4045
+ ${prettifyError21(parsed.error)}
4278
4046
  `);
4279
4047
  }
4280
4048
  return parsed.data;
4281
4049
  }
4282
4050
  function deserializeDuration(maybeDuration, valueLabel) {
4283
- const schema = z19.coerce.number().pipe(makeDurationSchema(valueLabel));
4051
+ const schema = z21.coerce.number().pipe(makeDurationSchema(valueLabel));
4284
4052
  const parsed = schema.safeParse(maybeDuration);
4285
4053
  if (parsed.error) {
4286
4054
  throw new RangeError(`Cannot deserialize Duration:
4287
- ${prettifyError20(parsed.error)}
4055
+ ${prettifyError21(parsed.error)}
4288
4056
  `);
4289
4057
  }
4290
4058
  return parsed.data;
@@ -4294,7 +4062,7 @@ function parseAccountId(maybeAccountId, valueLabel) {
4294
4062
  const parsed = schema.safeParse(maybeAccountId);
4295
4063
  if (parsed.error) {
4296
4064
  throw new RangeError(`Cannot deserialize AccountId:
4297
- ${prettifyError20(parsed.error)}
4065
+ ${prettifyError21(parsed.error)}
4298
4066
  `);
4299
4067
  }
4300
4068
  return parsed.data;
@@ -4304,7 +4072,7 @@ function deserializePriceEth(maybePrice, valueLabel) {
4304
4072
  const parsed = schema.safeParse(maybePrice);
4305
4073
  if (parsed.error) {
4306
4074
  throw new Error(`Cannot deserialize PriceEth:
4307
- ${prettifyError20(parsed.error)}
4075
+ ${prettifyError21(parsed.error)}
4308
4076
  `);
4309
4077
  }
4310
4078
  return parsed.data;
@@ -4314,7 +4082,7 @@ function deserializePriceUsdc(maybePrice, valueLabel) {
4314
4082
  const parsed = schema.safeParse(maybePrice);
4315
4083
  if (parsed.error) {
4316
4084
  throw new Error(`Cannot deserialize PriceUsdc:
4317
- ${prettifyError20(parsed.error)}
4085
+ ${prettifyError21(parsed.error)}
4318
4086
  `);
4319
4087
  }
4320
4088
  return parsed.data;
@@ -4324,7 +4092,7 @@ function deserializePriceDai(maybePrice, valueLabel) {
4324
4092
  const parsed = schema.safeParse(maybePrice);
4325
4093
  if (parsed.error) {
4326
4094
  throw new Error(`Cannot deserialize PriceDai:
4327
- ${prettifyError20(parsed.error)}
4095
+ ${prettifyError21(parsed.error)}
4328
4096
  `);
4329
4097
  }
4330
4098
  return parsed.data;
@@ -4511,7 +4279,8 @@ import { isAddressEqual as isAddressEqual4, zeroAddress as zeroAddress5 } from "
4511
4279
  var interpretAddress = (owner) => isAddressEqual4(zeroAddress5, owner) ? null : owner;
4512
4280
 
4513
4281
  // src/shared/interpretation/interpret-record-values.ts
4514
- import { isAddress as isAddress3, isAddressEqual as isAddressEqual5, zeroAddress as zeroAddress6 } from "viem";
4282
+ import { isInterpretedName, toNormalizedAddress as toNormalizedAddress3 } from "enssdk";
4283
+ import { isAddress as isAddress2, isAddressEqual as isAddressEqual5, zeroAddress as zeroAddress6 } from "viem";
4515
4284
 
4516
4285
  // src/shared/null-bytes.ts
4517
4286
  var hasNullByte = (value) => value.indexOf("\0") !== -1;
@@ -4520,16 +4289,16 @@ var stripNullBytes = (value) => value.replaceAll("\0", "");
4520
4289
  // src/shared/interpretation/interpret-record-values.ts
4521
4290
  function interpretNameRecordValue(value) {
4522
4291
  if (value === "") return null;
4523
- if (!isNormalizedName(value)) return null;
4292
+ if (!isInterpretedName(value)) return null;
4524
4293
  return value;
4525
4294
  }
4526
4295
  function interpretAddressRecordValue(value) {
4527
4296
  if (hasNullByte(value)) return null;
4528
4297
  if (value === "") return null;
4529
4298
  if (value === "0x") return null;
4530
- if (!isAddress3(value)) return value;
4299
+ if (!isAddress2(value, { strict: false })) return value;
4531
4300
  if (isAddressEqual5(value, zeroAddress6)) return null;
4532
- return asLowerCaseAddress(value);
4301
+ return toNormalizedAddress3(value);
4533
4302
  }
4534
4303
  function interpretTextRecordKey(key) {
4535
4304
  if (hasNullByte(key)) return null;
@@ -4542,83 +4311,19 @@ function interpretTextRecordValue(value) {
4542
4311
  return value;
4543
4312
  }
4544
4313
 
4545
- // src/shared/interpretation/interpret-tokenid.ts
4546
- var interpretTokenIdAsLabelHash = (tokenId) => uint256ToHex32(tokenId);
4547
- var interpretTokenIdAsNode = (tokenId) => uint256ToHex32(tokenId);
4548
-
4549
- // src/shared/interpretation/interpreted-names-and-labels.ts
4550
- import { isHex as isHex4 } from "viem";
4551
- import { labelhash } from "viem/ens";
4552
-
4553
- // src/shared/labelhash.ts
4554
- import { keccak256 as keccak2562, stringToBytes } from "viem";
4555
- var labelhashLiteralLabel = (label) => keccak2562(stringToBytes(label));
4556
-
4557
- // src/shared/interpretation/interpreted-names-and-labels.ts
4558
- function literalLabelToInterpretedLabel(label) {
4559
- if (isNormalizedLabel(label)) return label;
4560
- return encodeLabelHash(labelhashLiteralLabel(label));
4561
- }
4562
- function literalLabelsToInterpretedName(labels) {
4563
- return labels.map(literalLabelToInterpretedLabel).join(".");
4564
- }
4565
- function interpretedLabelsToInterpretedName(labels) {
4566
- return labels.join(".");
4567
- }
4568
- function literalLabelsToLiteralName(labels) {
4569
- return labels.join(".");
4570
- }
4571
- function interpretedNameToInterpretedLabels(name) {
4572
- return name.split(".");
4573
- }
4574
- function encodedLabelToLabelhash(label) {
4575
- if (label.length !== 66) return null;
4576
- if (label.indexOf("[") !== 0) return null;
4577
- if (label.indexOf("]") !== 65) return null;
4578
- const hash = `0x${label.slice(1, 65)}`;
4579
- if (!isHex4(hash)) return null;
4580
- return hash;
4581
- }
4582
- function isInterpetedLabel(label) {
4583
- if (label.startsWith("[")) {
4584
- const labelHash = encodedLabelToLabelhash(label);
4585
- return labelHash != null;
4586
- }
4587
- return isNormalizedLabel(label);
4314
+ // src/shared/interpretation/interpret-resolver-values.ts
4315
+ import { size as size3, zeroHash } from "viem";
4316
+ function interpretContenthashValue(value) {
4317
+ if (size3(value) === 0) return null;
4318
+ return value;
4588
4319
  }
4589
- function isInterpretedName(name) {
4590
- return name.split(".").every(isInterpetedLabel);
4320
+ function interpretPubkeyValue(x, y) {
4321
+ if (x === zeroHash && y === zeroHash) return null;
4322
+ return { x, y };
4591
4323
  }
4592
- function interpretedLabelsToLabelHashPath(labels) {
4593
- return labels.map((label) => {
4594
- if (!isInterpetedLabel(label)) {
4595
- throw new Error(
4596
- `Invariant(interpretedLabelsToLabelHashPath): Expected InterpretedLabel, received '${label}'.`
4597
- );
4598
- }
4599
- const maybeLabelHash = encodedLabelToLabelhash(label);
4600
- if (maybeLabelHash !== null) return maybeLabelHash;
4601
- return labelhash(label);
4602
- }).toReversed();
4603
- }
4604
- function constructSubInterpretedName(label, name) {
4605
- if (name === void 0 || name === "") return label;
4606
- return [label, name].join(".");
4607
- }
4608
- function ensureInterpretedLabel(labelHash, label) {
4609
- return label ?? encodeLabelHash(labelHash);
4610
- }
4611
- function parsePartialInterpretedName(partialInterpretedName) {
4612
- if (partialInterpretedName === "") return { concrete: [], partial: "" };
4613
- const concrete = partialInterpretedName.split(".");
4614
- const partial = concrete.pop();
4615
- if (!concrete.every(isInterpetedLabel)) {
4616
- throw new Error(
4617
- `Invariant(parsePartialInterpretedName): Concrete portion of Partial InterpretedName contains segments that are not InterpretedLabels.
4618
- ${JSON.stringify(concrete)}`
4619
- );
4620
- }
4621
- return { concrete, partial };
4324
+ function interpretDnszonehashValue(value) {
4325
+ if (size3(value) === 0) return null;
4326
+ return value;
4622
4327
  }
4623
4328
 
4624
4329
  // src/shared/namespace-specific-value.ts
@@ -4627,6 +4332,7 @@ function getNamespaceSpecificValue(namespace, value) {
4627
4332
  }
4628
4333
 
4629
4334
  // src/shared/root-registry.ts
4335
+ import { makeRegistryId } from "enssdk";
4630
4336
  import { DatasourceNames as DatasourceNames5 } from "@ensnode/datasources";
4631
4337
  var getENSv1Registry = (namespace) => getDatasourceContract(namespace, DatasourceNames5.ENSRoot, "ENSv1Registry");
4632
4338
  var isENSv1Registry = (namespace, contract) => accountIdEqual(getENSv1Registry(namespace), contract);
@@ -4648,6 +4354,16 @@ function isWebSocketProtocol(url) {
4648
4354
  return ["ws:", "wss:"].includes(url.protocol);
4649
4355
  }
4650
4356
 
4357
+ // src/stack-info/ensnode-stack-info.ts
4358
+ function buildEnsNodeStackInfo(ensApiPublicConfig, ensDbPublicConfig) {
4359
+ return {
4360
+ ensApi: ensApiPublicConfig,
4361
+ ensDb: ensDbPublicConfig,
4362
+ ensIndexer: ensApiPublicConfig.ensIndexerPublicConfig,
4363
+ ensRainbow: ensApiPublicConfig.ensIndexerPublicConfig.ensRainbowPublicConfig
4364
+ };
4365
+ }
4366
+
4651
4367
  // src/subgraph-api/prerequisites.ts
4652
4368
  function hasSubgraphApiConfigSupport(config) {
4653
4369
  const supported = config.plugins.includes("subgraph" /* Subgraph */);
@@ -4688,39 +4404,28 @@ var ReverseResolutionProtocolStep = /* @__PURE__ */ ((ReverseResolutionProtocolS
4688
4404
  return ReverseResolutionProtocolStep2;
4689
4405
  })(ReverseResolutionProtocolStep || {});
4690
4406
  export {
4691
- ADDR_REVERSE_NODE,
4692
4407
  ATTR_PROTOCOL_NAME,
4693
4408
  ATTR_PROTOCOL_STEP,
4694
4409
  ATTR_PROTOCOL_STEP_RESULT,
4695
- AssetNamespaces,
4696
- BASENAMES_NODE,
4697
4410
  ChainIndexingStatusIds,
4698
4411
  ClientError,
4699
4412
  CrossChainIndexingStrategyIds,
4700
4413
  CurrencyIds,
4701
- DEFAULT_ENSNODE_API_URL_MAINNET,
4702
- DEFAULT_ENSNODE_API_URL_SEPOLIA,
4703
- DEFAULT_EVM_CHAIN_ID,
4704
- DEFAULT_EVM_COIN_TYPE,
4414
+ DEFAULT_ENSNODE_URL_MAINNET,
4415
+ DEFAULT_ENSNODE_URL_SEPOLIA,
4705
4416
  ENCODED_REFERRER_BYTE_LENGTH,
4706
4417
  ENCODED_REFERRER_BYTE_OFFSET,
4707
- ENSNamespaceIds,
4708
- ENSNodeClient,
4709
- ENS_ROOT,
4710
- ETH_COIN_TYPE,
4711
- ETH_NODE,
4418
+ ENSNamespaceIds7 as ENSNamespaceIds,
4712
4419
  EXPECTED_ENCODED_REFERRER_PADDING,
4713
- EnsApiClient,
4714
4420
  EnsApiIndexingStatusResponseCodes,
4715
4421
  EnsIndexerClient,
4716
4422
  EnsIndexerIndexingStatusResponseCodes,
4423
+ EnsNodeClient,
4717
4424
  ForwardResolutionProtocolStep,
4718
4425
  IndexingStatusResponseCodes,
4719
- LINEANAMES_NODE,
4720
4426
  LruCache,
4721
4427
  NFTMintStatuses,
4722
4428
  NFTTransferTypes,
4723
- NODE_ANY,
4724
4429
  NameTokenOwnershipTypes,
4725
4430
  NameTokensResponseCodes,
4726
4431
  NameTokensResponseErrorCodes,
@@ -4729,8 +4434,6 @@ export {
4729
4434
  PluginName,
4730
4435
  RECORDS_PER_PAGE_DEFAULT,
4731
4436
  RECORDS_PER_PAGE_MAX,
4732
- ROOT_NODE,
4733
- ROOT_RESOURCE,
4734
4437
  RangeTypeIds,
4735
4438
  RegistrarActionTypes,
4736
4439
  RegistrarActionsFilterTypes,
@@ -4747,16 +4450,13 @@ export {
4747
4450
  accountIdEqual,
4748
4451
  addDuration,
4749
4452
  addPrices,
4750
- addrReverseLabel,
4751
- asLowerCaseAddress,
4752
- beautifyName,
4753
4453
  bigIntToNumber,
4754
- bigintToCoinType,
4755
4454
  buildAssetId,
4756
4455
  buildBlockNumberRange,
4757
4456
  buildBlockRefRange,
4758
4457
  buildCrossChainIndexingStatusSnapshotOmnichain,
4759
4458
  buildEncodedReferrer,
4459
+ buildEnsNodeStackInfo,
4760
4460
  buildEnsRainbowClientLabelSet,
4761
4461
  buildIndexedBlockranges,
4762
4462
  buildLabelSetId,
@@ -4765,38 +4465,34 @@ export {
4765
4465
  buildPageContext,
4766
4466
  buildUnresolvedIdentity,
4767
4467
  buildUnvalidatedCrossChainIndexingStatusSnapshot,
4468
+ buildUnvalidatedEnsApiPublicConfig,
4768
4469
  buildUnvalidatedEnsIndexerPublicConfig,
4470
+ buildUnvalidatedEnsNodeStackInfo,
4769
4471
  buildUnvalidatedOmnichainIndexingStatusSnapshot,
4770
4472
  buildUnvalidatedRealtimeIndexingStatusProjection,
4771
4473
  checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotBackfill,
4772
4474
  checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotCompleted,
4773
4475
  checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotFollowing,
4774
4476
  checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotUnstarted,
4775
- coinTypeReverseLabel,
4776
- coinTypeToEvmChainId,
4777
- constructSubInterpretedName,
4778
4477
  createRealtimeIndexingStatusProjection,
4779
- decodeDNSEncodedLiteralName,
4780
- decodeDNSEncodedName,
4781
4478
  decodeEncodedReferrer,
4782
4479
  deserializeAssetId,
4783
4480
  deserializeBlockNumber,
4784
4481
  deserializeBlockRef,
4785
4482
  deserializeChainId,
4786
4483
  deserializeChainIndexingStatusSnapshot,
4787
- deserializeConfigResponse,
4788
4484
  deserializeCrossChainIndexingStatusSnapshot,
4789
4485
  deserializeDatetime,
4790
4486
  deserializeDuration,
4791
4487
  deserializeENSApiPublicConfig,
4792
4488
  deserializeENSIndexerPublicConfig,
4793
- deserializeEnsApiConfigResponse,
4794
4489
  deserializeEnsApiIndexingStatusResponse,
4795
4490
  deserializeEnsApiPublicConfig,
4796
4491
  deserializeEnsIndexerConfigResponse,
4797
4492
  deserializeEnsIndexerIndexingStatusResponse,
4798
4493
  deserializeEnsIndexerPublicConfig,
4799
- deserializeErrorResponse,
4494
+ deserializeEnsNodeStackInfo,
4495
+ deserializeErrorResponse2 as deserializeErrorResponse,
4800
4496
  deserializeIndexingStatusResponse,
4801
4497
  deserializeOmnichainIndexingStatusSnapshot,
4802
4498
  deserializePriceDai,
@@ -4808,16 +4504,9 @@ export {
4808
4504
  deserializeUrl,
4809
4505
  deserializedNameTokensResponse,
4810
4506
  durationBetween,
4811
- encodeLabelHash,
4812
- encodedLabelToLabelhash,
4813
- ensureInterpretedLabel,
4814
- evmChainIdToCoinType,
4815
- formatAccountId,
4816
- formatAssetId,
4817
4507
  formatNFTTransferEventMetadata,
4818
4508
  getBasenamesSubregistryId,
4819
4509
  getBasenamesSubregistryManagedName,
4820
- getCanonicalId,
4821
4510
  getCurrencyInfo,
4822
4511
  getDatasourceContract,
4823
4512
  getDefaultEnsNodeUrl,
@@ -4832,40 +4521,30 @@ export {
4832
4521
  getLineanamesSubregistryId,
4833
4522
  getLineanamesSubregistryManagedName,
4834
4523
  getNFTTransferType,
4835
- getNameHierarchy,
4836
4524
  getNameTokenOwnership,
4837
4525
  getNameWrapperAccounts,
4838
4526
  getNamespaceSpecificValue,
4839
4527
  getOmnichainIndexingCursor,
4840
4528
  getOmnichainIndexingStatus,
4841
- getParentNameFQDN,
4842
4529
  getResolvePrimaryNameChainIdParam,
4843
4530
  getTimestampForHighestOmnichainKnownBlock,
4844
4531
  getTimestampForLowestOmnichainStartBlock,
4845
- hasGraphqlApiConfigSupport,
4846
4532
  hasNullByte,
4533
+ hasOmnigraphApiConfigSupport,
4847
4534
  hasRegistrarActionsConfigSupport,
4848
4535
  hasRegistrarActionsIndexingStatusSupport,
4849
4536
  hasSubgraphApiConfigSupport,
4850
4537
  interpretAddress,
4851
4538
  interpretAddressRecordValue,
4539
+ interpretContenthashValue,
4540
+ interpretDnszonehashValue,
4852
4541
  interpretNameRecordValue,
4542
+ interpretPubkeyValue,
4853
4543
  interpretTextRecordKey,
4854
4544
  interpretTextRecordValue,
4855
- interpretTokenIdAsLabelHash,
4856
- interpretTokenIdAsNode,
4857
- interpretedLabelsToInterpretedName,
4858
- interpretedLabelsToLabelHashPath,
4859
- interpretedNameToInterpretedLabels,
4860
4545
  isENSv1Registry,
4861
4546
  isENSv2RootRegistry,
4862
- isEncodedLabelHash,
4863
4547
  isHttpProtocol,
4864
- isInterpetedLabel,
4865
- isInterpretedName,
4866
- isLabelHash,
4867
- isNormalizedLabel,
4868
- isNormalizedName,
4869
4548
  isPccFuseSet,
4870
4549
  isPriceCurrencyEqual,
4871
4550
  isPriceEqual,
@@ -4879,25 +4558,10 @@ export {
4879
4558
  isSubgraphCompatible,
4880
4559
  isWebSocketProtocol,
4881
4560
  labelHashToBytes,
4882
- labelhashLiteralLabel,
4883
- literalLabelToInterpretedLabel,
4884
- literalLabelsToInterpretedName,
4885
- literalLabelsToLiteralName,
4886
4561
  makeContractMatcher,
4887
4562
  makeENSApiPublicConfigSchema,
4888
- makeENSv1DomainId,
4889
- makeENSv2DomainId,
4890
4563
  makeEnsApiPublicConfigSchema,
4891
- makePermissionsId,
4892
- makePermissionsResourceId,
4893
- makePermissionsUserId,
4894
- makeRegistrationId,
4895
- makeRegistryId,
4896
- makeRenewalId,
4897
- makeResolverId,
4898
- makeResolverRecordsId,
4899
4564
  makeSerializedEnsApiPublicConfigSchema,
4900
- makeSubdomainNode,
4901
4565
  maybeGetDatasourceContract,
4902
4566
  maybeGetENSv2RootRegistry,
4903
4567
  maybeGetENSv2RootRegistryId,
@@ -4906,38 +4570,31 @@ export {
4906
4570
  parseAccountId,
4907
4571
  parseAssetId,
4908
4572
  parseDai,
4909
- parseEncodedLabelHash,
4910
4573
  parseEth,
4911
- parseLabelHash,
4912
- parseLabelHashOrEncodedLabelHash,
4913
4574
  parseNonNegativeInteger,
4914
- parsePartialInterpretedName,
4915
- parseReverseName,
4916
4575
  parseTimestamp,
4917
4576
  parseUsdc,
4918
4577
  priceDai,
4919
4578
  priceEth,
4920
4579
  priceUsdc,
4921
4580
  registrarActionsFilter,
4922
- reverseName,
4923
4581
  scaleBigintByNumber,
4924
4582
  scalePrice,
4925
4583
  serializeAssetId,
4926
4584
  serializeChainId,
4927
4585
  serializeChainIndexingSnapshots,
4928
- serializeConfigResponse,
4929
4586
  serializeCrossChainIndexingStatusSnapshot,
4930
4587
  serializeCrossChainIndexingStatusSnapshotOmnichain,
4931
4588
  serializeDatetime,
4932
4589
  serializeDomainAssetId,
4933
4590
  serializeENSApiPublicConfig,
4934
4591
  serializeENSIndexerPublicConfig,
4935
- serializeEnsApiConfigResponse,
4936
4592
  serializeEnsApiIndexingStatusResponse,
4937
4593
  serializeEnsApiPublicConfig,
4938
4594
  serializeEnsIndexerConfigResponse,
4939
4595
  serializeEnsIndexerIndexingStatusResponse,
4940
4596
  serializeEnsIndexerPublicConfig,
4597
+ serializeEnsNodeStackInfo,
4941
4598
  serializeIndexedChainIds,
4942
4599
  serializeIndexingStatusResponse,
4943
4600
  serializeNameToken,
@@ -4957,7 +4614,6 @@ export {
4957
4614
  sortChainStatusesByStartBlockAsc,
4958
4615
  stripNullBytes,
4959
4616
  translateDefaultableChainIdToChainId,
4960
- uint256ToHex32,
4961
4617
  uniq,
4962
4618
  validateChainIndexingStatusSnapshot,
4963
4619
  validateCrossChainIndexingStatusSnapshot,