@ensnode/ensnode-sdk 1.9.0 → 1.10.1

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
@@ -354,6 +140,32 @@ function addPrices(...prices) {
354
140
  }
355
141
  );
356
142
  }
143
+ function subtractPrice(a, b) {
144
+ if (!isPriceCurrencyEqual(a, b)) {
145
+ throw new Error("All prices must have the same currency to be subtracted.");
146
+ }
147
+ const resultAmount = a.amount - b.amount;
148
+ if (resultAmount < 0n) {
149
+ throw new Error("subtractPrice result must be non-negative.");
150
+ }
151
+ return { amount: resultAmount, currency: a.currency };
152
+ }
153
+ function minPrice(...prices) {
154
+ const firstPrice = prices[0];
155
+ const allPricesInSameCurrency = prices.every((price) => isPriceCurrencyEqual(firstPrice, price));
156
+ if (allPricesInSameCurrency === false) {
157
+ throw new Error("All prices must have the same currency to be compared.");
158
+ }
159
+ return prices.reduce((acc, price) => price.amount < acc.amount ? price : acc);
160
+ }
161
+ function maxPrice(...prices) {
162
+ const firstPrice = prices[0];
163
+ const allPricesInSameCurrency = prices.every((price) => isPriceCurrencyEqual(firstPrice, price));
164
+ if (allPricesInSameCurrency === false) {
165
+ throw new Error("All prices must have the same currency to be compared.");
166
+ }
167
+ return prices.reduce((acc, price) => price.amount > acc.amount ? price : acc);
168
+ }
357
169
  function scalePrice(price, scaleFactor) {
358
170
  const scaledAmount = scaleBigintByNumber(price.amount, scaleFactor);
359
171
  return {
@@ -392,26 +204,6 @@ function parseDai(value) {
392
204
  return priceDai(amount);
393
205
  }
394
206
 
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
207
  // src/shared/zod-schemas.ts
416
208
  var makeIntegerSchema = (valueLabel = "Value") => z.int({
417
209
  error: `${valueLabel} must be an integer.`
@@ -427,15 +219,15 @@ var makeDurationSchema = (valueLabel = "Value") => z.number({
427
219
  }).pipe(makeNonNegativeIntegerSchema(valueLabel));
428
220
  var makeChainIdSchema = (valueLabel = "Chain ID") => makePositiveIntegerSchema(valueLabel).transform((val) => val);
429
221
  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)) {
222
+ var makeNormalizedAddressSchema = (valueLabel = "EVM address") => z.string().check((ctx) => {
223
+ if (!isAddress(ctx.value, { strict: false })) {
432
224
  ctx.issues.push({
433
225
  code: "custom",
434
226
  message: `${valueLabel} must be a valid EVM address`,
435
227
  input: ctx.value
436
228
  });
437
229
  }
438
- }).transform((val) => asLowerCaseAddress(val));
230
+ }).transform((val) => toNormalizedAddress(val));
439
231
  var makeDatetimeSchema = (valueLabel = "Datetime string") => z.iso.datetime({ error: `${valueLabel} must be a string in ISO 8601 format.` }).transform((v) => new Date(v));
440
232
  var makeUnixTimestampSchema = (valueLabel = "Timestamp") => makeIntegerSchema(valueLabel);
441
233
  var makeUrlSchema = (valueLabel = "Value") => z.url({
@@ -473,7 +265,7 @@ var makePriceUsdcSchema = (valueLabel = "Price USDC") => makePriceCurrencySchema
473
265
  var makePriceDaiSchema = (valueLabel = "Price DAI") => makePriceCurrencySchema(CurrencyIds.DAI, valueLabel).transform((v) => v);
474
266
  var makeAccountIdSchema = (valueLabel = "AccountId") => z.strictObject({
475
267
  chainId: makeChainIdSchema(`${valueLabel} chain ID`),
476
- address: makeLowercaseAddressSchema(`${valueLabel} address`)
268
+ address: makeNormalizedAddressSchema(`${valueLabel} address`)
477
269
  });
478
270
  var makeAccountIdStringSchema = (valueLabel = "Account ID String") => z.coerce.string().transform((v) => {
479
271
  const result = new CaipAccountId(v);
@@ -483,7 +275,7 @@ var makeAccountIdStringSchema = (valueLabel = "Account ID String") => z.coerce.s
483
275
  };
484
276
  }).pipe(makeAccountIdSchema(valueLabel));
485
277
  var makeHexStringSchema = (options, valueLabel = "String representation of bytes array") => z.string().check(function invariant_isHexEncoded(ctx) {
486
- if (!isHex3(ctx.value)) {
278
+ if (!isHex(ctx.value)) {
487
279
  ctx.issues.push({
488
280
  code: "custom",
489
281
  input: ctx.value,
@@ -522,9 +314,8 @@ var makeLabelSetIdSchema = (valueLabel = "Label set ID") => {
522
314
  error: `${valueLabel} can only contain lowercase letters (a-z) and hyphens (-)`
523
315
  });
524
316
  };
525
- var makeLabelSetVersionSchema = (valueLabel = "Label set version") => {
526
- return z2.coerce.number({ error: `${valueLabel} must be an integer.` }).pipe(makeNonNegativeIntegerSchema(valueLabel));
527
- };
317
+ var makeLabelSetVersionSchema = (valueLabel = "Label set version") => makeNonNegativeIntegerSchema(valueLabel);
318
+ var makeLabelSetVersionStringSchema = (valueLabel = "Label set version") => z2.coerce.number({ error: `${valueLabel} must be a non-negative integer` }).pipe(makeLabelSetVersionSchema(valueLabel));
528
319
  var makeEnsRainbowPublicConfigSchema = (valueLabel = "EnsRainbowPublicConfig") => z2.object({
529
320
  version: z2.string().nonempty({ error: `${valueLabel}.version must be a non-empty string.` }),
530
321
  labelSet: z2.object({
@@ -569,7 +360,7 @@ function buildLabelSetId(maybeLabelSetId) {
569
360
  return makeLabelSetIdSchema("LabelSetId").parse(maybeLabelSetId);
570
361
  }
571
362
  function buildLabelSetVersion(maybeLabelSetVersion) {
572
- return makeLabelSetVersionSchema("LabelSetVersion").parse(maybeLabelSetVersion);
363
+ return makeLabelSetVersionStringSchema("LabelSetVersion").parse(maybeLabelSetVersion);
573
364
  }
574
365
  function buildEnsRainbowClientLabelSet(labelSetId, labelSetVersion) {
575
366
  if (labelSetVersion !== void 0 && labelSetId === void 0) {
@@ -621,7 +412,7 @@ var makePluginsListSchema = (valueLabel = "Plugins") => z3.array(z3.string(), {
621
412
  }).refine((arr) => arr.length === uniq(arr).length, {
622
413
  error: `${valueLabel} cannot contain duplicate values.`
623
414
  });
624
- var makeDatabaseSchemaNameSchema = (valueLabel = "Database schema name") => z3.string({ error: `${valueLabel} must be a string` }).trim().nonempty({
415
+ var makeEnsIndexerSchemaNameSchema = (valueLabel = "ENS Indexer Schema Name") => z3.string({ error: `${valueLabel} must be a string` }).trim().nonempty({
625
416
  error: `${valueLabel} is required and must be a non-empty string.`
626
417
  });
627
418
  var makeFullyPinnedLabelSetSchema = (valueLabel = "Label set") => {
@@ -636,13 +427,12 @@ var makeFullyPinnedLabelSetSchema = (valueLabel = "Label set") => {
636
427
  }
637
428
  return z3.object({
638
429
  labelSetId: makeLabelSetIdSchema(valueLabelLabelSetId),
639
- labelSetVersion: makeLabelSetVersionSchema(valueLabelLabelSetVersion)
430
+ labelSetVersion: makeLabelSetVersionStringSchema(valueLabelLabelSetVersion)
640
431
  });
641
432
  };
642
433
  var makeNonEmptyStringSchema = (valueLabel = "Value") => z3.string().nonempty({ error: `${valueLabel} must be a non-empty string.` });
643
434
  var makeEnsIndexerVersionInfoSchema = (valueLabel = "Value") => z3.object(
644
435
  {
645
- nodejs: makeNonEmptyStringSchema(),
646
436
  ponder: makeNonEmptyStringSchema(),
647
437
  ensDb: makeNonEmptyStringSchema(),
648
438
  ensIndexer: makeNonEmptyStringSchema(),
@@ -677,7 +467,7 @@ function invariant_ensRainbowSupportedLabelSetAndVersion(ctx) {
677
467
  }
678
468
  }
679
469
  var makeEnsIndexerPublicConfigSchema = (valueLabel = "ENSIndexerPublicConfig") => z3.object({
680
- databaseSchemaName: makeDatabaseSchemaNameSchema(`${valueLabel}.databaseSchemaName`),
470
+ ensIndexerSchemaName: makeEnsIndexerSchemaNameSchema(`${valueLabel}.ensIndexerSchemaName`),
681
471
  ensRainbowPublicConfig: makeEnsRainbowPublicConfigSchema(
682
472
  `${valueLabel}.ensRainbowPublicConfig`
683
473
  ),
@@ -691,7 +481,7 @@ var makeEnsIndexerPublicConfigSchema = (valueLabel = "ENSIndexerPublicConfig") =
691
481
  versionInfo: makeEnsIndexerVersionInfoSchema(`${valueLabel}.versionInfo`)
692
482
  }).check(invariant_isSubgraphCompatibleRequirements).check(invariant_ensRainbowSupportedLabelSetAndVersion);
693
483
  var makeSerializedEnsIndexerPublicConfigSchema = (valueLabel = "Serialized ENSIndexerPublicConfig") => z3.object({
694
- databaseSchemaName: makeDatabaseSchemaNameSchema(`${valueLabel}.databaseSchemaName`),
484
+ ensIndexerSchemaName: makeEnsIndexerSchemaNameSchema(`${valueLabel}.ensIndexerSchemaName`),
695
485
  ensRainbowPublicConfig: makeEnsRainbowPublicConfigSchema(
696
486
  `${valueLabel}.ensRainbowPublicConfig`
697
487
  ),
@@ -745,23 +535,27 @@ var TheGraphFallbackSchema = z4.discriminatedUnion("canFallback", [
745
535
  ]);
746
536
 
747
537
  // src/ensapi/config/zod-schemas.ts
538
+ var makeEnsApiVersionInfoSchema = (valueLabel = "ENS API version info") => z5.object({
539
+ ensApi: z5.string().nonempty(`${valueLabel}.ensApi must be a non-empty string`),
540
+ ensNormalize: z5.string().nonempty(`${valueLabel}.ensNormalize must be a non-empty string`)
541
+ });
748
542
  function makeEnsApiPublicConfigSchema(valueLabel) {
749
543
  const label = valueLabel ?? "ENSApiPublicConfig";
750
544
  return z5.object({
751
- version: z5.string().min(1, `${label}.version must be a non-empty string`),
752
545
  theGraphFallback: TheGraphFallbackSchema,
753
- ensIndexerPublicConfig: makeEnsIndexerPublicConfigSchema(`${label}.ensIndexerPublicConfig`)
546
+ ensIndexerPublicConfig: makeEnsIndexerPublicConfigSchema(`${label}.ensIndexerPublicConfig`),
547
+ versionInfo: makeEnsApiVersionInfoSchema(`${label}.versionInfo`)
754
548
  });
755
549
  }
756
550
  var makeENSApiPublicConfigSchema = makeEnsApiPublicConfigSchema;
757
551
  function makeSerializedEnsApiPublicConfigSchema(valueLabel) {
758
552
  const label = valueLabel ?? "ENSApiPublicConfig";
759
553
  return z5.object({
760
- version: z5.string().min(1, `${label}.version must be a non-empty string`),
761
- theGraphFallback: TheGraphFallbackSchema,
762
554
  ensIndexerPublicConfig: makeSerializedEnsIndexerPublicConfigSchema(
763
555
  `${label}.ensIndexerPublicConfig`
764
- )
556
+ ),
557
+ theGraphFallback: TheGraphFallbackSchema,
558
+ versionInfo: makeEnsApiVersionInfoSchema(`${label}.versionInfo`)
765
559
  });
766
560
  }
767
561
 
@@ -785,19 +579,13 @@ ${prettifyError2(parsed.error)}
785
579
  }
786
580
  var deserializeENSApiPublicConfig = deserializeEnsApiPublicConfig;
787
581
 
788
- // src/ensapi/api/config/deserialize.ts
789
- function deserializeEnsApiConfigResponse(maybeResponse) {
790
- return deserializeEnsApiPublicConfig(maybeResponse);
791
- }
792
- var deserializeConfigResponse = deserializeEnsApiConfigResponse;
793
-
794
582
  // src/ensindexer/config/serialize.ts
795
583
  function serializeIndexedChainIds(indexedChainIds) {
796
584
  return Array.from(indexedChainIds);
797
585
  }
798
586
  function serializeEnsIndexerPublicConfig(config) {
799
587
  const {
800
- databaseSchemaName,
588
+ ensIndexerSchemaName,
801
589
  ensRainbowPublicConfig,
802
590
  indexedChainIds,
803
591
  isSubgraphCompatible: isSubgraphCompatible2,
@@ -807,7 +595,7 @@ function serializeEnsIndexerPublicConfig(config) {
807
595
  versionInfo
808
596
  } = config;
809
597
  return {
810
- databaseSchemaName,
598
+ ensIndexerSchemaName,
811
599
  ensRainbowPublicConfig,
812
600
  indexedChainIds: serializeIndexedChainIds(indexedChainIds),
813
601
  isSubgraphCompatible: isSubgraphCompatible2,
@@ -821,22 +609,26 @@ var serializeENSIndexerPublicConfig = serializeEnsIndexerPublicConfig;
821
609
 
822
610
  // src/ensapi/config/serialize.ts
823
611
  function serializeEnsApiPublicConfig(config) {
824
- const { version, theGraphFallback, ensIndexerPublicConfig } = config;
612
+ const { ensIndexerPublicConfig, theGraphFallback, versionInfo } = config;
825
613
  return {
826
- version,
614
+ ensIndexerPublicConfig: serializeEnsIndexerPublicConfig(ensIndexerPublicConfig),
827
615
  theGraphFallback,
828
- ensIndexerPublicConfig: serializeEnsIndexerPublicConfig(ensIndexerPublicConfig)
616
+ versionInfo
829
617
  };
830
618
  }
831
619
  var serializeENSApiPublicConfig = serializeEnsApiPublicConfig;
832
620
 
833
- // src/ensapi/api/config/serialize.ts
834
- function serializeEnsApiConfigResponse(response) {
835
- return serializeEnsApiPublicConfig(response);
621
+ // src/ensindexer/api/config/deserialize.ts
622
+ function deserializeEnsIndexerConfigResponse(maybeResponse) {
623
+ return deserializeEnsIndexerPublicConfig(maybeResponse, "EnsIndexerConfigResponse");
624
+ }
625
+
626
+ // src/ensindexer/api/config/serialize.ts
627
+ function serializeEnsIndexerConfigResponse(response) {
628
+ return serializeEnsIndexerPublicConfig(response);
836
629
  }
837
- var serializeConfigResponse = serializeEnsApiConfigResponse;
838
630
 
839
- // src/ensapi/api/indexing-status/deserialize.ts
631
+ // src/ensindexer/api/indexing-status/deserialize.ts
840
632
  import { prettifyError as prettifyError8 } from "zod/v4";
841
633
 
842
634
  // src/indexing-status/deserialize/realtime-indexing-status-projection.ts
@@ -1763,8 +1555,8 @@ ${prettifyError7(parsed.error)}
1763
1555
  return parsed.data;
1764
1556
  }
1765
1557
 
1766
- // src/ensapi/api/indexing-status/response.ts
1767
- var EnsApiIndexingStatusResponseCodes = {
1558
+ // src/ensindexer/api/indexing-status/response.ts
1559
+ var EnsIndexerIndexingStatusResponseCodes = {
1768
1560
  /**
1769
1561
  * Represents that the indexing status is available.
1770
1562
  */
@@ -1774,33 +1566,32 @@ var EnsApiIndexingStatusResponseCodes = {
1774
1566
  */
1775
1567
  Error: "error"
1776
1568
  };
1777
- var IndexingStatusResponseCodes = EnsApiIndexingStatusResponseCodes;
1778
1569
 
1779
- // src/ensapi/api/indexing-status/zod-schemas.ts
1570
+ // src/ensindexer/api/indexing-status/zod-schemas.ts
1780
1571
  import { z as z10 } from "zod/v4";
1781
- var makeEnsApiIndexingStatusResponseOkSchema = (valueLabel = "Indexing Status Response OK") => z10.strictObject({
1782
- responseCode: z10.literal(EnsApiIndexingStatusResponseCodes.Ok),
1572
+ var makeEnsIndexerIndexingStatusResponseOkSchema = (valueLabel = "Indexing Status Response OK") => z10.strictObject({
1573
+ responseCode: z10.literal(EnsIndexerIndexingStatusResponseCodes.Ok),
1783
1574
  realtimeProjection: makeRealtimeIndexingStatusProjectionSchema(valueLabel)
1784
1575
  });
1785
- var makeEnsApiIndexingStatusResponseErrorSchema = (_valueLabel = "Indexing Status Response Error") => z10.strictObject({
1786
- responseCode: z10.literal(EnsApiIndexingStatusResponseCodes.Error)
1576
+ var makeEnsIndexerIndexingStatusResponseErrorSchema = (_valueLabel = "Indexing Status Response Error") => z10.strictObject({
1577
+ responseCode: z10.literal(EnsIndexerIndexingStatusResponseCodes.Error)
1787
1578
  });
1788
- var makeEnsApiIndexingStatusResponseSchema = (valueLabel = "Indexing Status Response") => z10.discriminatedUnion("responseCode", [
1789
- makeEnsApiIndexingStatusResponseOkSchema(valueLabel),
1790
- makeEnsApiIndexingStatusResponseErrorSchema(valueLabel)
1579
+ var makeEnsIndexerIndexingStatusResponseSchema = (valueLabel = "Indexing Status Response") => z10.discriminatedUnion("responseCode", [
1580
+ makeEnsIndexerIndexingStatusResponseOkSchema(valueLabel),
1581
+ makeEnsIndexerIndexingStatusResponseErrorSchema(valueLabel)
1791
1582
  ]);
1792
- var makeSerializedEnsApiIndexingStatusResponseOkSchema = (valueLabel = "Serialized Indexing Status Response OK") => z10.strictObject({
1793
- responseCode: z10.literal(EnsApiIndexingStatusResponseCodes.Ok),
1583
+ var makeSerializedEnsIndexerIndexingStatusResponseOkSchema = (valueLabel = "Serialized Indexing Status Response OK") => z10.strictObject({
1584
+ responseCode: z10.literal(EnsIndexerIndexingStatusResponseCodes.Ok),
1794
1585
  realtimeProjection: makeSerializedRealtimeIndexingStatusProjectionSchema(valueLabel)
1795
1586
  });
1796
- var makeSerializedEnsApiIndexingStatusResponseSchema = (valueLabel = "Serialized Indexing Status Response") => z10.discriminatedUnion("responseCode", [
1797
- makeSerializedEnsApiIndexingStatusResponseOkSchema(valueLabel),
1798
- makeEnsApiIndexingStatusResponseErrorSchema(valueLabel)
1587
+ var makeSerializedEnsIndexerIndexingStatusResponseSchema = (valueLabel = "Serialized Indexing Status Response") => z10.discriminatedUnion("responseCode", [
1588
+ makeSerializedEnsIndexerIndexingStatusResponseOkSchema(valueLabel),
1589
+ makeEnsIndexerIndexingStatusResponseErrorSchema(valueLabel)
1799
1590
  ]);
1800
1591
 
1801
- // src/ensapi/api/indexing-status/deserialize.ts
1802
- function buildUnvalidatedEnsApiIndexingStatusResponse(serializedResponse) {
1803
- if (serializedResponse.responseCode !== EnsApiIndexingStatusResponseCodes.Ok) {
1592
+ // src/ensindexer/api/indexing-status/deserialize.ts
1593
+ function buildUnvalidatedEnsIndexerIndexingStatusResponse(serializedResponse) {
1594
+ if (serializedResponse.responseCode !== EnsIndexerIndexingStatusResponseCodes.Ok) {
1804
1595
  return serializedResponse;
1805
1596
  }
1806
1597
  return {
@@ -1810,21 +1601,19 @@ function buildUnvalidatedEnsApiIndexingStatusResponse(serializedResponse) {
1810
1601
  )
1811
1602
  };
1812
1603
  }
1813
- function deserializeEnsApiIndexingStatusResponse(maybeResponse) {
1814
- const parsed = makeSerializedEnsApiIndexingStatusResponseSchema().transform(buildUnvalidatedEnsApiIndexingStatusResponse).pipe(makeEnsApiIndexingStatusResponseSchema()).safeParse(maybeResponse);
1604
+ function deserializeEnsIndexerIndexingStatusResponse(maybeResponse) {
1605
+ const parsed = makeSerializedEnsIndexerIndexingStatusResponseSchema().transform(buildUnvalidatedEnsIndexerIndexingStatusResponse).pipe(makeEnsIndexerIndexingStatusResponseSchema()).safeParse(maybeResponse);
1815
1606
  if (parsed.error) {
1816
1607
  throw new Error(
1817
- `Cannot deserialize EnsApiIndexingStatusResponse:
1608
+ `Cannot deserialize EnsIndexerIndexingStatusResponse:
1818
1609
  ${prettifyError8(parsed.error)}
1819
1610
  `
1820
1611
  );
1821
1612
  }
1822
1613
  return parsed.data;
1823
1614
  }
1824
- var deserializeIndexingStatusResponse = deserializeEnsApiIndexingStatusResponse;
1825
1615
 
1826
1616
  // src/shared/serialize.ts
1827
- import { AccountId as CaipAccountId2, AssetId as CaipAssetId } from "caip";
1828
1617
  function serializeChainId(chainId) {
1829
1618
  return chainId.toString();
1830
1619
  }
@@ -1849,23 +1638,6 @@ function serializePriceUsdc(price) {
1849
1638
  function serializePriceDai(price) {
1850
1639
  return serializePrice(price);
1851
1640
  }
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
1641
 
1870
1642
  // src/indexing-status/serialize/chain-indexing-status-snapshot.ts
1871
1643
  function serializeChainIndexingSnapshots(chains) {
@@ -1937,160 +1709,532 @@ function serializeRealtimeIndexingStatusProjection(indexingProjection) {
1937
1709
  };
1938
1710
  }
1939
1711
 
1940
- // src/ensapi/api/indexing-status/serialize.ts
1941
- function serializeEnsApiIndexingStatusResponse(response) {
1712
+ // src/ensindexer/api/indexing-status/serialize.ts
1713
+ function serializeEnsIndexerIndexingStatusResponse(response) {
1942
1714
  switch (response.responseCode) {
1943
- case EnsApiIndexingStatusResponseCodes.Ok:
1715
+ case EnsIndexerIndexingStatusResponseCodes.Ok:
1944
1716
  return {
1945
1717
  responseCode: response.responseCode,
1946
1718
  realtimeProjection: serializeRealtimeIndexingStatusProjection(response.realtimeProjection)
1947
1719
  };
1948
- case EnsApiIndexingStatusResponseCodes.Error:
1720
+ case EnsIndexerIndexingStatusResponseCodes.Error:
1949
1721
  return response;
1950
1722
  }
1951
1723
  }
1952
- var serializeIndexingStatusResponse = serializeEnsApiIndexingStatusResponse;
1953
-
1954
- // src/ensapi/api/name-tokens/deserialize.ts
1955
- import { prettifyError as prettifyError10 } from "zod/v4";
1956
-
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
1724
 
1999
- // src/tokenscope/assets.ts
2000
- import { isAddressEqual as isAddressEqual2, zeroAddress as zeroAddress2 } from "viem";
1725
+ // src/ensindexer/api/shared/errors/deserialize.ts
2001
1726
  import { prettifyError as prettifyError9 } from "zod/v4";
2002
1727
 
2003
- // src/tokenscope/zod-schemas.ts
2004
- import { AssetId as CaipAssetId2 } from "caip";
2005
- import { zeroAddress } from "viem";
1728
+ // src/ensindexer/api/shared/errors/zod-schemas.ts
2006
1729
  import { z as z11 } from "zod/v4";
1730
+ var ErrorResponseSchema = z11.object({
1731
+ message: z11.string(),
1732
+ details: z11.optional(z11.unknown())
1733
+ });
2007
1734
 
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;
1735
+ // src/ensindexer/api/shared/errors/deserialize.ts
1736
+ function deserializeErrorResponse(maybeErrorResponse) {
1737
+ const parsed = ErrorResponseSchema.safeParse(maybeErrorResponse);
1738
+ if (parsed.error) {
1739
+ throw new Error(`Cannot deserialize ErrorResponse:
1740
+ ${prettifyError9(parsed.error)}
1741
+ `);
2025
1742
  }
1743
+ return parsed.data;
2026
1744
  }
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
- });
1745
+
1746
+ // src/ensindexer/client.ts
1747
+ var EnsIndexerClient = class {
1748
+ constructor(options) {
1749
+ this.options = options;
2056
1750
  }
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.`
1751
+ getOptions() {
1752
+ return Object.freeze({
1753
+ url: new URL(this.options.url.href)
2081
1754
  });
2082
1755
  }
2083
- }
2084
- var makeNameTokenOwnershipSchema = (valueLabel = "Name Token Ownership") => z11.discriminatedUnion("ownershipType", [
1756
+ /**
1757
+ * Fetch ENSIndexer Config
1758
+ *
1759
+ * Fetch the ENSIndexer's configuration.
1760
+ *
1761
+ * @returns {EnsIndexerConfigResponse}
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 config() {
1768
+ const url = new URL(`/api/config`, 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
+ const errorResponse = deserializeErrorResponse(responseData);
1778
+ throw new Error(`Fetching ENSIndexer Config Failed: ${errorResponse.message}`);
1779
+ }
1780
+ return deserializeEnsIndexerConfigResponse(
1781
+ responseData
1782
+ );
1783
+ }
1784
+ /**
1785
+ * Fetch ENSIndexer Indexing Status
1786
+ *
1787
+ * @returns {EnsIndexerIndexingStatusResponse}
1788
+ *
1789
+ * @throws if the ENSIndexer request fails
1790
+ * @throws if the ENSIndexer returns a non-ok response
1791
+ * @throws if the ENSIndexer response breaks required invariants
1792
+ */
1793
+ async indexingStatus() {
1794
+ const url = new URL(`/api/indexing-status`, this.options.url);
1795
+ const response = await fetch(url);
1796
+ let responseData;
1797
+ try {
1798
+ responseData = await response.json();
1799
+ } catch {
1800
+ throw new Error("Malformed response data: invalid JSON");
1801
+ }
1802
+ if (!response.ok) {
1803
+ let errorResponse;
1804
+ try {
1805
+ errorResponse = deserializeErrorResponse(responseData);
1806
+ } catch {
1807
+ }
1808
+ if (typeof errorResponse !== "undefined") {
1809
+ throw new Error(`Fetching ENSIndexer Indexing Status Failed: ${errorResponse.message}`);
1810
+ }
1811
+ }
1812
+ return deserializeEnsIndexerIndexingStatusResponse(
1813
+ responseData
1814
+ );
1815
+ }
1816
+ };
1817
+
1818
+ // src/ensindexer/config/compatibility.ts
1819
+ function validateEnsIndexerPublicConfigCompatibility(configA, configB) {
1820
+ if (configA.indexedChainIds.symmetricDifference(configB.indexedChainIds).size > 0) {
1821
+ throw new Error(
1822
+ [
1823
+ `'indexedChainIds' must be compatible.`,
1824
+ `Stored Config 'indexedChainIds': '${Array.from(configA.indexedChainIds).join(", ")}'.`,
1825
+ `Current Config 'indexedChainIds': '${Array.from(configB.indexedChainIds).join(", ")}'.`
1826
+ ].join(" ")
1827
+ );
1828
+ }
1829
+ if (configA.isSubgraphCompatible !== configB.isSubgraphCompatible) {
1830
+ throw new Error(
1831
+ [
1832
+ `'isSubgraphCompatible' flag must be compatible.`,
1833
+ `Stored Config 'isSubgraphCompatible' flag: '${configA.isSubgraphCompatible}'.`,
1834
+ `Current Config 'isSubgraphCompatible' flag: '${configB.isSubgraphCompatible}'.`
1835
+ ].join(" ")
1836
+ );
1837
+ }
1838
+ if (configA.namespace !== configB.namespace) {
1839
+ throw new Error(
1840
+ [
1841
+ `'namespace' must be compatible.`,
1842
+ `Stored Config 'namespace': '${configA.namespace}'.`,
1843
+ `Current Config 'namespace': '${configB.namespace}'.`
1844
+ ].join(" ")
1845
+ );
1846
+ }
1847
+ if (configA.labelSet.labelSetId !== configB.labelSet.labelSetId) {
1848
+ throw new Error(
1849
+ [
1850
+ `'labelSet.labelSetId' must be compatible.`,
1851
+ `Stored Config 'labelSet.labelSetId': '${configA.labelSet.labelSetId}'.`,
1852
+ `Current Config 'labelSet.labelSetId': '${configB.labelSet.labelSetId}'.`
1853
+ ].join(" ")
1854
+ );
1855
+ }
1856
+ if (configA.labelSet.labelSetVersion !== configB.labelSet.labelSetVersion) {
1857
+ throw new Error(
1858
+ [
1859
+ `'labelSet.labelSetVersion' must be compatible.`,
1860
+ `Stored Config 'labelSet.labelSetVersion': '${configA.labelSet.labelSetVersion}'.`,
1861
+ `Current Config 'labelSet.labelSetVersion': '${configB.labelSet.labelSetVersion}'.`
1862
+ ].join(" ")
1863
+ );
1864
+ }
1865
+ const configAPluginsSet = new Set(configA.plugins);
1866
+ const configBPluginsSet = new Set(configB.plugins);
1867
+ if (configAPluginsSet.symmetricDifference(configBPluginsSet).size > 0) {
1868
+ throw new Error(
1869
+ [
1870
+ `'plugins' must be compatible.`,
1871
+ `Stored Config 'plugins': '${configA.plugins.join(", ")}'.`,
1872
+ `Current Config 'plugins': '${configB.plugins.join(", ")}'.`
1873
+ ].join(" ")
1874
+ );
1875
+ }
1876
+ }
1877
+
1878
+ // src/ensindexer/config/label-utils.ts
1879
+ import { hexToBytes } from "viem";
1880
+ function labelHashToBytes(labelHash) {
1881
+ try {
1882
+ if (labelHash.length !== 66) {
1883
+ throw new Error(`Invalid labelHash length ${labelHash.length} characters (expected 66)`);
1884
+ }
1885
+ if (labelHash !== labelHash.toLowerCase()) {
1886
+ throw new Error("Labelhash must be in lowercase");
1887
+ }
1888
+ if (!labelHash.startsWith("0x")) {
1889
+ throw new Error("Labelhash must be 0x-prefixed");
1890
+ }
1891
+ const bytes = hexToBytes(labelHash);
1892
+ if (bytes.length !== 32) {
1893
+ throw new Error(`Invalid labelHash length ${bytes.length} bytes (expected 32)`);
1894
+ }
1895
+ return bytes;
1896
+ } catch (e) {
1897
+ if (e instanceof Error) {
1898
+ throw e;
1899
+ }
1900
+ throw new Error("Invalid hex format");
1901
+ }
1902
+ }
1903
+
1904
+ // src/ensindexer/config/parsing.ts
1905
+ function parseNonNegativeInteger(maybeNumber) {
1906
+ const trimmed = maybeNumber.trim();
1907
+ if (!trimmed) {
1908
+ throw new Error("Input cannot be empty");
1909
+ }
1910
+ if (trimmed === "-0") {
1911
+ throw new Error("Negative zero is not a valid non-negative integer");
1912
+ }
1913
+ const num = Number(maybeNumber);
1914
+ if (Number.isNaN(num)) {
1915
+ throw new Error(`"${maybeNumber}" is not a valid number`);
1916
+ }
1917
+ if (!Number.isFinite(num)) {
1918
+ throw new Error(`"${maybeNumber}" is not a finite number`);
1919
+ }
1920
+ if (!Number.isInteger(num)) {
1921
+ throw new Error(`"${maybeNumber}" is not an integer`);
1922
+ }
1923
+ if (num < 0) {
1924
+ throw new Error(`"${maybeNumber}" is not a non-negative integer`);
1925
+ }
1926
+ return num;
1927
+ }
1928
+
1929
+ // src/ensindexer/config/validate/ensindexer-public-config.ts
1930
+ import { prettifyError as prettifyError10 } from "zod/v4";
1931
+ function validateEnsIndexerPublicConfig(unvalidatedConfig) {
1932
+ const schema = makeEnsIndexerPublicConfigSchema();
1933
+ const result = schema.safeParse(unvalidatedConfig);
1934
+ if (!result.success) {
1935
+ throw new Error(`Invalid ENSIndexerPublicConfig: ${prettifyError10(result.error)}`);
1936
+ }
1937
+ return result.data;
1938
+ }
1939
+
1940
+ // src/ensindexer/config/validate/ensindexer-version-info.ts
1941
+ import { prettifyError as prettifyError11 } from "zod/v4";
1942
+ function validateEnsIndexerVersionInfo(unvalidatedVersionInfo) {
1943
+ const schema = makeEnsIndexerVersionInfoSchema();
1944
+ const result = schema.safeParse(unvalidatedVersionInfo);
1945
+ if (!result.success) {
1946
+ throw new Error(`Invalid EnsIndexerVersionInfo: ${prettifyError11(result.error)}`);
1947
+ }
1948
+ return result.data;
1949
+ }
1950
+
1951
+ // src/ensnode/api/indexing-status/deserialize.ts
1952
+ import { prettifyError as prettifyError13 } from "zod/v4";
1953
+
1954
+ // src/stack-info/deserialize/ensnode-stack-info.ts
1955
+ import { prettifyError as prettifyError12 } from "zod/v4";
1956
+
1957
+ // src/stack-info/zod-schemas/ensnode-stack-info.ts
1958
+ import { z as z13 } from "zod/v4";
1959
+
1960
+ // src/ensdb/zod-schemas/config.ts
1961
+ import { z as z12 } from "zod/v4";
1962
+ var makeEnsDbVersionInfoSchema = (valueLabel) => {
1963
+ const label = valueLabel ?? "EnsDbVersionInfo";
1964
+ return z12.object({
1965
+ postgresql: z12.string().nonempty(`${label}.postgresql must be a non-empty string`).describe("Version of the PostgreSQL server hosting the ENSDb instance.")
1966
+ }).describe(label);
1967
+ };
1968
+ var makeEnsDbPublicConfigSchema = (valueLabel) => {
1969
+ const label = valueLabel ?? "EnsDbPublicConfig";
1970
+ return z12.object({
1971
+ versionInfo: makeEnsDbVersionInfoSchema(`${label}.versionInfo`)
1972
+ }).describe(label);
1973
+ };
1974
+
1975
+ // src/stack-info/zod-schemas/ensnode-stack-info.ts
1976
+ function makeSerializedEnsNodeStackInfoSchema(valueLabel) {
1977
+ const label = valueLabel ?? "ENSNodeStackInfo";
1978
+ return z13.object({
1979
+ ensApi: makeSerializedEnsApiPublicConfigSchema(`${label}.ensApi`),
1980
+ ensDb: makeEnsDbPublicConfigSchema(`${label}.ensDb`),
1981
+ ensIndexer: makeSerializedEnsIndexerPublicConfigSchema(`${label}.ensIndexer`),
1982
+ ensRainbow: makeEnsRainbowPublicConfigSchema(`${label}.ensRainbow`).optional()
1983
+ });
1984
+ }
1985
+ function makeEnsNodeStackInfoSchema(valueLabel) {
1986
+ const label = valueLabel ?? "ENSNodeStackInfo";
1987
+ return z13.object({
1988
+ ensApi: makeEnsApiPublicConfigSchema(`${label}.ensApi`),
1989
+ ensDb: makeEnsDbPublicConfigSchema(`${label}.ensDb`),
1990
+ ensIndexer: makeEnsIndexerPublicConfigSchema(`${label}.ensIndexer`),
1991
+ ensRainbow: makeEnsRainbowPublicConfigSchema(`${label}.ensRainbow`).optional()
1992
+ });
1993
+ }
1994
+
1995
+ // src/stack-info/deserialize/ensnode-stack-info.ts
1996
+ function buildUnvalidatedEnsNodeStackInfo(serializedStackInfo) {
1997
+ const { ensApi, ensIndexer, ...rest } = serializedStackInfo;
1998
+ return {
1999
+ ...rest,
2000
+ ensApi: buildUnvalidatedEnsApiPublicConfig(ensApi),
2001
+ ensIndexer: buildUnvalidatedEnsIndexerPublicConfig(ensIndexer)
2002
+ };
2003
+ }
2004
+ function deserializeEnsNodeStackInfo(maybeStackInfo, valueLabel) {
2005
+ const parsed = makeSerializedEnsNodeStackInfoSchema(valueLabel).transform(buildUnvalidatedEnsNodeStackInfo).pipe(makeEnsNodeStackInfoSchema(valueLabel)).safeParse(maybeStackInfo);
2006
+ if (parsed.error) {
2007
+ throw new Error(`Cannot deserialize EnsNodeStackInfo:
2008
+ ${prettifyError12(parsed.error)}
2009
+ `);
2010
+ }
2011
+ return parsed.data;
2012
+ }
2013
+
2014
+ // src/ensnode/api/indexing-status/response.ts
2015
+ var EnsApiIndexingStatusResponseCodes = {
2016
+ /**
2017
+ * Represents that the indexing status is available.
2018
+ */
2019
+ Ok: "ok",
2020
+ /**
2021
+ * Represents that the indexing status is unavailable.
2022
+ */
2023
+ Error: "error"
2024
+ };
2025
+ var IndexingStatusResponseCodes = EnsApiIndexingStatusResponseCodes;
2026
+
2027
+ // src/ensnode/api/indexing-status/zod-schemas.ts
2028
+ import { z as z14 } from "zod/v4";
2029
+ var makeEnsApiIndexingStatusResponseOkSchema = (valueLabel = "Indexing Status Response OK") => z14.strictObject({
2030
+ responseCode: z14.literal(EnsApiIndexingStatusResponseCodes.Ok),
2031
+ realtimeProjection: makeRealtimeIndexingStatusProjectionSchema(valueLabel),
2032
+ stackInfo: makeEnsNodeStackInfoSchema(valueLabel)
2033
+ });
2034
+ var makeEnsApiIndexingStatusResponseErrorSchema = (_valueLabel = "Indexing Status Response Error") => z14.strictObject({
2035
+ responseCode: z14.literal(EnsApiIndexingStatusResponseCodes.Error)
2036
+ });
2037
+ var makeEnsApiIndexingStatusResponseSchema = (valueLabel = "Indexing Status Response") => z14.discriminatedUnion("responseCode", [
2038
+ makeEnsApiIndexingStatusResponseOkSchema(valueLabel),
2039
+ makeEnsApiIndexingStatusResponseErrorSchema(valueLabel)
2040
+ ]);
2041
+ var makeSerializedEnsApiIndexingStatusResponseOkSchema = (valueLabel = "Serialized Indexing Status Response OK") => z14.object({
2042
+ responseCode: z14.literal(EnsApiIndexingStatusResponseCodes.Ok),
2043
+ realtimeProjection: makeSerializedRealtimeIndexingStatusProjectionSchema(valueLabel),
2044
+ stackInfo: makeSerializedEnsNodeStackInfoSchema(valueLabel)
2045
+ });
2046
+ var makeSerializedEnsApiIndexingStatusResponseSchema = (valueLabel = "Serialized Indexing Status Response") => z14.discriminatedUnion("responseCode", [
2047
+ makeSerializedEnsApiIndexingStatusResponseOkSchema(valueLabel),
2048
+ makeEnsApiIndexingStatusResponseErrorSchema(valueLabel)
2049
+ ]);
2050
+
2051
+ // src/ensnode/api/indexing-status/deserialize.ts
2052
+ function buildUnvalidatedEnsApiIndexingStatusResponse(serializedResponse) {
2053
+ if (serializedResponse.responseCode !== EnsApiIndexingStatusResponseCodes.Ok) {
2054
+ return serializedResponse;
2055
+ }
2056
+ const { realtimeProjection, stackInfo, ...rest } = serializedResponse;
2057
+ return {
2058
+ realtimeProjection: buildUnvalidatedRealtimeIndexingStatusProjection(realtimeProjection),
2059
+ stackInfo: buildUnvalidatedEnsNodeStackInfo(stackInfo),
2060
+ ...rest
2061
+ };
2062
+ }
2063
+ function deserializeEnsApiIndexingStatusResponse(maybeResponse) {
2064
+ const parsed = makeSerializedEnsApiIndexingStatusResponseSchema().transform(buildUnvalidatedEnsApiIndexingStatusResponse).pipe(makeEnsApiIndexingStatusResponseSchema()).safeParse(maybeResponse);
2065
+ if (parsed.error) {
2066
+ throw new Error(
2067
+ `Cannot deserialize EnsApiIndexingStatusResponse:
2068
+ ${prettifyError13(parsed.error)}
2069
+ `
2070
+ );
2071
+ }
2072
+ return parsed.data;
2073
+ }
2074
+ var deserializeIndexingStatusResponse = deserializeEnsApiIndexingStatusResponse;
2075
+
2076
+ // src/stack-info/serialize/ensnode-stack-info.ts
2077
+ function serializeEnsNodeStackInfo(stackInfo) {
2078
+ return {
2079
+ ensApi: serializeEnsApiPublicConfig(stackInfo.ensApi),
2080
+ ensDb: stackInfo.ensDb,
2081
+ ensIndexer: serializeEnsIndexerPublicConfig(stackInfo.ensIndexer),
2082
+ ensRainbow: stackInfo.ensRainbow
2083
+ };
2084
+ }
2085
+
2086
+ // src/ensnode/api/indexing-status/serialize.ts
2087
+ function serializeEnsApiIndexingStatusResponse(response) {
2088
+ switch (response.responseCode) {
2089
+ case EnsApiIndexingStatusResponseCodes.Ok:
2090
+ return {
2091
+ responseCode: response.responseCode,
2092
+ realtimeProjection: serializeRealtimeIndexingStatusProjection(response.realtimeProjection),
2093
+ stackInfo: serializeEnsNodeStackInfo(response.stackInfo)
2094
+ };
2095
+ case EnsApiIndexingStatusResponseCodes.Error:
2096
+ return response;
2097
+ }
2098
+ }
2099
+ var serializeIndexingStatusResponse = serializeEnsApiIndexingStatusResponse;
2100
+
2101
+ // src/ensnode/api/name-tokens/deserialize.ts
2102
+ import { prettifyError as prettifyError15 } from "zod/v4";
2103
+
2104
+ // src/ensnode/api/name-tokens/zod-schemas.ts
2105
+ import { namehashInterpretedName } from "enssdk";
2106
+ import { z as z17 } from "zod/v4";
2107
+
2108
+ // src/tokenscope/name-token.ts
2109
+ import { getParentInterpretedName } from "enssdk";
2110
+ import { isAddressEqual as isAddressEqual3, zeroAddress as zeroAddress3 } from "viem";
2111
+ import { DatasourceNames } from "@ensnode/datasources";
2112
+
2113
+ // src/shared/account-id.ts
2114
+ import { isAddressEqual } from "viem";
2115
+ var accountIdEqual = (a, b) => {
2116
+ return a.chainId === b.chainId && isAddressEqual(a.address, b.address);
2117
+ };
2118
+
2119
+ // src/shared/datasource-contract.ts
2120
+ import {
2121
+ maybeGetDatasource
2122
+ } from "@ensnode/datasources";
2123
+ var maybeGetDatasourceContract = (namespaceId, datasourceName, contractName) => {
2124
+ const datasource = maybeGetDatasource(namespaceId, datasourceName);
2125
+ if (!datasource) return void 0;
2126
+ const address = datasource.contracts[contractName]?.address;
2127
+ if (address === void 0 || Array.isArray(address)) return void 0;
2128
+ return {
2129
+ chainId: datasource.chain.id,
2130
+ address
2131
+ };
2132
+ };
2133
+ var getDatasourceContract = (namespaceId, datasourceName, contractName) => {
2134
+ const contract = maybeGetDatasourceContract(namespaceId, datasourceName, contractName);
2135
+ if (!contract) {
2136
+ throw new Error(
2137
+ `Expected contract not found for ${namespaceId} ${datasourceName} ${contractName}`
2138
+ );
2139
+ }
2140
+ return contract;
2141
+ };
2142
+ var makeContractMatcher = (namespace, b) => (datasourceName, contractName) => {
2143
+ const a = maybeGetDatasourceContract(namespace, datasourceName, contractName);
2144
+ return a && accountIdEqual(a, b);
2145
+ };
2146
+
2147
+ // src/tokenscope/assets.ts
2148
+ import {
2149
+ stringifyAssetId
2150
+ } from "enssdk";
2151
+ import { isAddressEqual as isAddressEqual2, zeroAddress as zeroAddress2 } from "viem";
2152
+ import { prettifyError as prettifyError14 } from "zod/v4";
2153
+
2154
+ // src/tokenscope/zod-schemas.ts
2155
+ import { AssetId as CaipAssetId } from "caip";
2156
+ import { AssetNamespaces } from "enssdk";
2157
+ import { zeroAddress } from "viem";
2158
+ import { z as z15 } from "zod/v4";
2159
+ var tokenIdSchemaSerializable = z15.string();
2160
+ var tokenIdSchemaNative = z15.preprocess(
2161
+ (v) => typeof v === "string" ? BigInt(v) : v,
2162
+ z15.bigint().positive()
2163
+ );
2164
+ function makeTokenIdSchema(_valueLabel = "Token ID Schema", serializable = false) {
2165
+ if (serializable) {
2166
+ return tokenIdSchemaSerializable;
2167
+ } else {
2168
+ return tokenIdSchemaNative;
2169
+ }
2170
+ }
2171
+ var makeAssetIdSchema = (valueLabel = "Asset ID Schema", serializable) => {
2172
+ return z15.object({
2173
+ assetNamespace: z15.enum(AssetNamespaces),
2174
+ contract: makeAccountIdSchema(valueLabel),
2175
+ tokenId: makeTokenIdSchema(valueLabel, serializable ?? false)
2176
+ });
2177
+ };
2178
+ var makeAssetIdStringSchema = (valueLabel = "Asset ID String Schema") => z15.preprocess((v) => {
2179
+ if (typeof v === "string") {
2180
+ const result = new CaipAssetId(v);
2181
+ return {
2182
+ assetNamespace: result.assetName.namespace,
2183
+ contract: {
2184
+ chainId: Number(result.chainId.reference),
2185
+ address: result.assetName.reference
2186
+ },
2187
+ tokenId: result.tokenId
2188
+ };
2189
+ }
2190
+ return v;
2191
+ }, makeAssetIdSchema(valueLabel));
2192
+ function invariant_nameTokenOwnershipHasNonZeroAddressOwner(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' other than the zero address.`
2199
+ });
2200
+ }
2201
+ }
2202
+ var makeNameTokenOwnershipNameWrapperSchema = (valueLabel = "Name Token Ownership NameWrapper") => z15.object({
2203
+ ownershipType: z15.literal(NameTokenOwnershipTypes.NameWrapper),
2204
+ owner: makeAccountIdSchema(`${valueLabel}.owner`)
2205
+ }).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
2206
+ var makeNameTokenOwnershipFullyOnchainSchema = (valueLabel = "Name Token Ownership Fully Onchain") => z15.object({
2207
+ ownershipType: z15.literal(NameTokenOwnershipTypes.FullyOnchain),
2208
+ owner: makeAccountIdSchema(`${valueLabel}.owner`)
2209
+ }).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
2210
+ var makeNameTokenOwnershipBurnedSchema = (valueLabel = "Name Token Ownership Burned") => z15.object({
2211
+ ownershipType: z15.literal(NameTokenOwnershipTypes.Burned),
2212
+ owner: makeAccountIdSchema(`${valueLabel}.owner`)
2213
+ }).check(invariant_nameTokenOwnershipHasZeroAddressOwner);
2214
+ var makeNameTokenOwnershipUnknownSchema = (valueLabel = "Name Token Ownership Unknown") => z15.object({
2215
+ ownershipType: z15.literal(NameTokenOwnershipTypes.Unknown),
2216
+ owner: makeAccountIdSchema(`${valueLabel}.owner`)
2217
+ }).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
2218
+ function invariant_nameTokenOwnershipHasZeroAddressOwner(ctx) {
2219
+ const ownership = ctx.value;
2220
+ if (ctx.value.owner.address !== zeroAddress) {
2221
+ ctx.issues.push({
2222
+ code: "custom",
2223
+ input: ctx.value,
2224
+ message: `Name Token Ownership with '${ownership.ownershipType}' must have 'address' set to the zero address.`
2225
+ });
2226
+ }
2227
+ }
2228
+ var makeNameTokenOwnershipSchema = (valueLabel = "Name Token Ownership") => z15.discriminatedUnion("ownershipType", [
2085
2229
  makeNameTokenOwnershipNameWrapperSchema(valueLabel),
2086
2230
  makeNameTokenOwnershipFullyOnchainSchema(valueLabel),
2087
2231
  makeNameTokenOwnershipBurnedSchema(valueLabel),
2088
2232
  makeNameTokenOwnershipUnknownSchema(valueLabel)
2089
2233
  ]);
2090
- var makeNameTokenSchema = (valueLabel = "Name Token Schema", serializable) => z11.object({
2234
+ var makeNameTokenSchema = (valueLabel = "Name Token Schema", serializable) => z15.object({
2091
2235
  token: makeAssetIdSchema(`${valueLabel}.token`, serializable),
2092
2236
  ownership: makeNameTokenOwnershipSchema(`${valueLabel}.ownership`),
2093
- mintStatus: z11.enum(NFTMintStatuses)
2237
+ mintStatus: z15.enum(NFTMintStatuses)
2094
2238
  });
2095
2239
 
2096
2240
  // src/tokenscope/assets.ts
@@ -2098,7 +2242,7 @@ function serializeAssetId(assetId) {
2098
2242
  return {
2099
2243
  assetNamespace: assetId.assetNamespace,
2100
2244
  contract: assetId.contract,
2101
- tokenId: uint256ToHex32(assetId.tokenId)
2245
+ tokenId: assetId.tokenId.toString()
2102
2246
  };
2103
2247
  }
2104
2248
  function deserializeAssetId(maybeAssetId, valueLabel) {
@@ -2106,7 +2250,7 @@ function deserializeAssetId(maybeAssetId, valueLabel) {
2106
2250
  const parsed = schema.safeParse(maybeAssetId);
2107
2251
  if (parsed.error) {
2108
2252
  throw new RangeError(`Cannot deserialize AssetId:
2109
- ${prettifyError9(parsed.error)}
2253
+ ${prettifyError14(parsed.error)}
2110
2254
  `);
2111
2255
  }
2112
2256
  return parsed.data;
@@ -2116,7 +2260,7 @@ function parseAssetId(maybeAssetId, valueLabel) {
2116
2260
  const parsed = schema.safeParse(maybeAssetId);
2117
2261
  if (parsed.error) {
2118
2262
  throw new RangeError(`Cannot parse AssetId:
2119
- ${prettifyError9(parsed.error)}
2263
+ ${prettifyError14(parsed.error)}
2120
2264
  `);
2121
2265
  }
2122
2266
  return parsed.data;
@@ -2139,7 +2283,7 @@ var NFTMintStatuses = {
2139
2283
  Burned: "burned"
2140
2284
  };
2141
2285
  var formatNFTTransferEventMetadata = (metadata) => {
2142
- const assetIdString = formatAssetId(metadata.nft);
2286
+ const assetIdString = stringifyAssetId(metadata.nft);
2143
2287
  return [
2144
2288
  `Event: ${metadata.eventHandlerName}`,
2145
2289
  `Chain ID: ${metadata.chainId}`,
@@ -2402,7 +2546,8 @@ function getNameTokenOwnership(namespaceId, name, owner) {
2402
2546
  owner
2403
2547
  };
2404
2548
  }
2405
- const parentName = getParentNameFQDN(name);
2549
+ const parentName = getParentInterpretedName(name);
2550
+ if (parentName === null) throw new Error(`Invariant: '${name}' has no parent Name.`);
2406
2551
  if (parentName === "eth") {
2407
2552
  return {
2408
2553
  ownershipType: NameTokenOwnershipTypes.FullyOnchain,
@@ -2415,14 +2560,14 @@ function getNameTokenOwnership(namespaceId, name, owner) {
2415
2560
  };
2416
2561
  }
2417
2562
 
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())
2563
+ // src/ensnode/api/shared/errors/zod-schemas.ts
2564
+ import { z as z16 } from "zod/v4";
2565
+ var makeErrorResponseSchema = () => z16.object({
2566
+ message: z16.string(),
2567
+ details: z16.optional(z16.unknown())
2423
2568
  });
2424
2569
 
2425
- // src/ensapi/api/name-tokens/response.ts
2570
+ // src/ensnode/api/name-tokens/response.ts
2426
2571
  var NameTokensResponseCodes = {
2427
2572
  /**
2428
2573
  * Represents a response when Name Tokens API can respond with requested data.
@@ -2457,16 +2602,16 @@ var NameTokensResponseErrorCodes = {
2457
2602
  IndexingStatusUnsupported: "unsupported-indexing-status"
2458
2603
  };
2459
2604
 
2460
- // src/ensapi/api/name-tokens/zod-schemas.ts
2461
- var makeRegisteredNameTokenSchema = (valueLabel = "Registered Name Token", serializable) => z13.object({
2605
+ // src/ensnode/api/name-tokens/zod-schemas.ts
2606
+ var makeRegisteredNameTokenSchema = (valueLabel = "Registered Name Token", serializable) => z17.object({
2462
2607
  domainId: makeNodeSchema(`${valueLabel}.domainId`),
2463
2608
  name: makeReinterpretedNameSchema(valueLabel),
2464
- tokens: z13.array(makeNameTokenSchema(`${valueLabel}.tokens`, serializable)).nonempty(),
2609
+ tokens: z17.array(makeNameTokenSchema(`${valueLabel}.tokens`, serializable)).nonempty(),
2465
2610
  expiresAt: makeUnixTimestampSchema(`${valueLabel}.expiresAt`),
2466
2611
  accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`)
2467
2612
  }).check(function invariant_nameIsAssociatedWithDomainId(ctx) {
2468
2613
  const { name, domainId } = ctx.value;
2469
- if (namehash2(name) !== domainId) {
2614
+ if (namehashInterpretedName(name) !== domainId) {
2470
2615
  ctx.issues.push({
2471
2616
  code: "custom",
2472
2617
  input: ctx.value,
@@ -2503,51 +2648,51 @@ var makeRegisteredNameTokenSchema = (valueLabel = "Registered Name Token", seria
2503
2648
  });
2504
2649
  }
2505
2650
  });
2506
- var makeNameTokensResponseOkSchema = (valueLabel = "Name Tokens Response OK", serializable) => z13.strictObject({
2507
- responseCode: z13.literal(NameTokensResponseCodes.Ok),
2651
+ var makeNameTokensResponseOkSchema = (valueLabel = "Name Tokens Response OK", serializable) => z17.strictObject({
2652
+ responseCode: z17.literal(NameTokensResponseCodes.Ok),
2508
2653
  registeredNameTokens: makeRegisteredNameTokenSchema(`${valueLabel}.nameTokens`, serializable)
2509
2654
  });
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
2655
+ var makeNameTokensResponseErrorNameTokensNotIndexedSchema = (_valueLabel = "Name Tokens Response Error Name Not Indexed") => z17.strictObject({
2656
+ responseCode: z17.literal(NameTokensResponseCodes.Error),
2657
+ errorCode: z17.literal(NameTokensResponseErrorCodes.NameTokensNotIndexed),
2658
+ error: makeErrorResponseSchema()
2514
2659
  });
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
2660
+ var makeNameTokensResponseErrorEnsIndexerConfigUnsupported = (_valueLabel = "Name Tokens Response Error ENSIndexer Config Unsupported") => z17.strictObject({
2661
+ responseCode: z17.literal(NameTokensResponseCodes.Error),
2662
+ errorCode: z17.literal(NameTokensResponseErrorCodes.EnsIndexerConfigUnsupported),
2663
+ error: makeErrorResponseSchema()
2519
2664
  });
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
2665
+ var makeNameTokensResponseErrorNameIndexingStatusUnsupported = (_valueLabel = "Name Tokens Response Error Indexing Status Unsupported") => z17.strictObject({
2666
+ responseCode: z17.literal(NameTokensResponseCodes.Error),
2667
+ errorCode: z17.literal(NameTokensResponseErrorCodes.IndexingStatusUnsupported),
2668
+ error: makeErrorResponseSchema()
2524
2669
  });
2525
- var makeNameTokensResponseErrorSchema = (valueLabel = "Name Tokens Response Error") => z13.discriminatedUnion("errorCode", [
2670
+ var makeNameTokensResponseErrorSchema = (valueLabel = "Name Tokens Response Error") => z17.discriminatedUnion("errorCode", [
2526
2671
  makeNameTokensResponseErrorNameTokensNotIndexedSchema(valueLabel),
2527
2672
  makeNameTokensResponseErrorEnsIndexerConfigUnsupported(valueLabel),
2528
2673
  makeNameTokensResponseErrorNameIndexingStatusUnsupported(valueLabel)
2529
2674
  ]);
2530
2675
  var makeNameTokensResponseSchema = (valueLabel = "Name Tokens Response", serializable) => {
2531
- return z13.discriminatedUnion("responseCode", [
2676
+ return z17.discriminatedUnion("responseCode", [
2532
2677
  makeNameTokensResponseOkSchema(valueLabel, serializable ?? false),
2533
2678
  makeNameTokensResponseErrorSchema(valueLabel)
2534
2679
  ]);
2535
2680
  };
2536
2681
 
2537
- // src/ensapi/api/name-tokens/deserialize.ts
2682
+ // src/ensnode/api/name-tokens/deserialize.ts
2538
2683
  function deserializedNameTokensResponse(maybeResponse) {
2539
2684
  const parsed = makeNameTokensResponseSchema("Name Tokens Response", false).safeParse(
2540
2685
  maybeResponse
2541
2686
  );
2542
2687
  if (parsed.error) {
2543
2688
  throw new Error(`Cannot deserialize NameTokensResponse:
2544
- ${prettifyError10(parsed.error)}
2689
+ ${prettifyError15(parsed.error)}
2545
2690
  `);
2546
2691
  }
2547
2692
  return parsed.data;
2548
2693
  }
2549
2694
 
2550
- // src/ensapi/api/name-tokens/prerequisites.ts
2695
+ // src/ensnode/api/name-tokens/prerequisites.ts
2551
2696
  var nameTokensPrerequisites = Object.freeze({
2552
2697
  /**
2553
2698
  * Required plugins to enable Name Tokens API routes.
@@ -2586,7 +2731,7 @@ var nameTokensPrerequisites = Object.freeze({
2586
2731
  }
2587
2732
  });
2588
2733
 
2589
- // src/ensapi/api/name-tokens/serialize.ts
2734
+ // src/ensnode/api/name-tokens/serialize.ts
2590
2735
  function serializeRegisteredNameTokens({
2591
2736
  domainId,
2592
2737
  name,
@@ -2614,18 +2759,19 @@ function serializeNameTokensResponse(response) {
2614
2759
  }
2615
2760
  }
2616
2761
 
2617
- // src/ensapi/api/registrar-actions/deserialize.ts
2618
- import { prettifyError as prettifyError11 } from "zod/v4";
2762
+ // src/ensnode/api/registrar-actions/deserialize.ts
2763
+ import { prettifyError as prettifyError16 } from "zod/v4";
2619
2764
 
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";
2765
+ // src/ensnode/api/registrar-actions/zod-schemas.ts
2766
+ import { namehashInterpretedName as namehashInterpretedName2 } from "enssdk";
2767
+ import { z as z20 } from "zod/v4";
2623
2768
 
2624
2769
  // src/registrars/zod-schemas.ts
2625
- import { z as z14 } from "zod/v4";
2770
+ import { z as z18 } from "zod/v4";
2626
2771
 
2627
2772
  // src/registrars/encoded-referrer.ts
2628
- import { getAddress, pad, size as size2, slice, zeroAddress as zeroAddress4 } from "viem";
2773
+ import { isNormalizedAddress, toNormalizedAddress as toNormalizedAddress2 } from "enssdk";
2774
+ import { pad, size as size2, slice, zeroAddress as zeroAddress4 } from "viem";
2629
2775
  var ENCODED_REFERRER_BYTE_OFFSET = 12;
2630
2776
  var ENCODED_REFERRER_BYTE_LENGTH = 32;
2631
2777
  var EXPECTED_ENCODED_REFERRER_PADDING = pad("0x", {
@@ -2637,8 +2783,8 @@ var ZERO_ENCODED_REFERRER = pad("0x", {
2637
2783
  dir: "left"
2638
2784
  });
2639
2785
  function buildEncodedReferrer(address) {
2640
- const lowercaseAddress = address.toLowerCase();
2641
- return pad(lowercaseAddress, { size: ENCODED_REFERRER_BYTE_LENGTH, dir: "left" });
2786
+ if (!isNormalizedAddress(address)) throw new Error(`Address '${address}' is not normalized.`);
2787
+ return pad(address, { size: ENCODED_REFERRER_BYTE_LENGTH, dir: "left" });
2642
2788
  }
2643
2789
  function decodeEncodedReferrer(encodedReferrer) {
2644
2790
  if (size2(encodedReferrer) !== ENCODED_REFERRER_BYTE_LENGTH) {
@@ -2647,12 +2793,10 @@ function decodeEncodedReferrer(encodedReferrer) {
2647
2793
  );
2648
2794
  }
2649
2795
  const padding = slice(encodedReferrer, 0, ENCODED_REFERRER_BYTE_OFFSET);
2650
- if (padding !== EXPECTED_ENCODED_REFERRER_PADDING) {
2651
- return zeroAddress4;
2652
- }
2796
+ if (padding !== EXPECTED_ENCODED_REFERRER_PADDING) return zeroAddress4;
2653
2797
  const decodedReferrer = slice(encodedReferrer, ENCODED_REFERRER_BYTE_OFFSET);
2654
2798
  try {
2655
- return getAddress(decodedReferrer);
2799
+ return toNormalizedAddress2(decodedReferrer);
2656
2800
  } catch {
2657
2801
  throw new Error(`Decoded referrer value must be a valid EVM address.`);
2658
2802
  }
@@ -2697,11 +2841,11 @@ function serializeRegistrarAction(registrarAction) {
2697
2841
  }
2698
2842
 
2699
2843
  // src/registrars/zod-schemas.ts
2700
- var makeSubregistrySchema = (valueLabel = "Subregistry") => z14.object({
2844
+ var makeSubregistrySchema = (valueLabel = "Subregistry") => z18.object({
2701
2845
  subregistryId: makeAccountIdSchema(`${valueLabel} Subregistry ID`),
2702
2846
  node: makeNodeSchema(`${valueLabel} Node`)
2703
2847
  });
2704
- var makeRegistrationLifecycleSchema = (valueLabel = "Registration Lifecycle") => z14.object({
2848
+ var makeRegistrationLifecycleSchema = (valueLabel = "Registration Lifecycle") => z18.object({
2705
2849
  subregistry: makeSubregistrySchema(`${valueLabel} Subregistry`),
2706
2850
  node: makeNodeSchema(`${valueLabel} Node`),
2707
2851
  expiresAt: makeUnixTimestampSchema(`${valueLabel} Expires at`)
@@ -2717,24 +2861,24 @@ function invariant_registrarActionPricingTotalIsSumOfBaseCostAndPremium(ctx) {
2717
2861
  });
2718
2862
  }
2719
2863
  }
2720
- var makeRegistrarActionPricingSchema = (valueLabel = "Registrar Action Pricing") => z14.union([
2864
+ var makeRegistrarActionPricingSchema = (valueLabel = "Registrar Action Pricing") => z18.union([
2721
2865
  // pricing available
2722
- z14.object({
2866
+ z18.object({
2723
2867
  baseCost: makePriceEthSchema(`${valueLabel} Base Cost`),
2724
2868
  premium: makePriceEthSchema(`${valueLabel} Premium`),
2725
2869
  total: makePriceEthSchema(`${valueLabel} Total`)
2726
2870
  }).check(invariant_registrarActionPricingTotalIsSumOfBaseCostAndPremium).transform((v) => v),
2727
2871
  // pricing unknown
2728
- z14.object({
2729
- baseCost: z14.null(),
2730
- premium: z14.null(),
2731
- total: z14.null()
2872
+ z18.object({
2873
+ baseCost: z18.null(),
2874
+ premium: z18.null(),
2875
+ total: z18.null()
2732
2876
  }).transform((v) => v)
2733
2877
  ]);
2734
2878
  function invariant_registrarActionDecodedReferrerBasedOnRawReferrer(ctx) {
2735
2879
  const { encodedReferrer, decodedReferrer } = ctx.value;
2736
2880
  try {
2737
- const expectedDecodedReferrer = decodeEncodedReferrer(encodedReferrer).toLowerCase();
2881
+ const expectedDecodedReferrer = decodeEncodedReferrer(encodedReferrer);
2738
2882
  if (decodedReferrer !== expectedDecodedReferrer) {
2739
2883
  ctx.issues.push({
2740
2884
  code: "custom",
@@ -2751,19 +2895,19 @@ function invariant_registrarActionDecodedReferrerBasedOnRawReferrer(ctx) {
2751
2895
  });
2752
2896
  }
2753
2897
  }
2754
- var makeRegistrarActionReferralSchema = (valueLabel = "Registrar Action Referral") => z14.union([
2898
+ var makeRegistrarActionReferralSchema = (valueLabel = "Registrar Action Referral") => z18.union([
2755
2899
  // referral available
2756
- z14.object({
2900
+ z18.object({
2757
2901
  encodedReferrer: makeHexStringSchema(
2758
2902
  { bytesCount: ENCODED_REFERRER_BYTE_LENGTH },
2759
2903
  `${valueLabel} Encoded Referrer`
2760
2904
  ),
2761
- decodedReferrer: makeLowercaseAddressSchema(`${valueLabel} Decoded Referrer`)
2905
+ decodedReferrer: makeNormalizedAddressSchema(`${valueLabel} Decoded Referrer`)
2762
2906
  }).check(invariant_registrarActionDecodedReferrerBasedOnRawReferrer),
2763
2907
  // referral not applicable
2764
- z14.object({
2765
- encodedReferrer: z14.null(),
2766
- decodedReferrer: z14.null()
2908
+ z18.object({
2909
+ encodedReferrer: z18.null(),
2910
+ decodedReferrer: z18.null()
2767
2911
  })
2768
2912
  ]);
2769
2913
  function invariant_eventIdsInitialElementIsTheActionId(ctx) {
@@ -2776,54 +2920,53 @@ function invariant_eventIdsInitialElementIsTheActionId(ctx) {
2776
2920
  });
2777
2921
  }
2778
2922
  }
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({
2923
+ var EventIdSchema = z18.string().nonempty();
2924
+ var EventIdsSchema = z18.array(EventIdSchema).min(1).transform((v) => v);
2925
+ var makeBaseRegistrarActionSchemaWithoutCheck = (valueLabel = "Base Registrar Action") => z18.object({
2782
2926
  id: EventIdSchema,
2783
2927
  incrementalDuration: makeDurationSchema(`${valueLabel} Incremental Duration`),
2784
- registrant: makeLowercaseAddressSchema(`${valueLabel} Registrant`),
2785
- registrationLifecycle: makeRegistrationLifecycleSchema(
2786
- `${valueLabel} Registration Lifecycle`
2787
- ),
2928
+ registrant: makeNormalizedAddressSchema(`${valueLabel} Registrant`),
2929
+ registrationLifecycle: makeRegistrationLifecycleSchema(`${valueLabel} Registration Lifecycle`),
2788
2930
  pricing: makeRegistrarActionPricingSchema(`${valueLabel} Pricing`),
2789
2931
  referral: makeRegistrarActionReferralSchema(`${valueLabel} Referral`),
2790
2932
  block: makeBlockRefSchema(`${valueLabel} Block`),
2791
2933
  transactionHash: makeTransactionHashSchema(`${valueLabel} Transaction Hash`),
2792
2934
  eventIds: EventIdsSchema
2793
- }).check(invariant_eventIdsInitialElementIsTheActionId);
2935
+ });
2936
+ var makeBaseRegistrarActionSchema = (valueLabel = "Base Registrar Action") => makeBaseRegistrarActionSchemaWithoutCheck(valueLabel).check(
2937
+ invariant_eventIdsInitialElementIsTheActionId
2938
+ );
2794
2939
  var makeRegistrarActionRegistrationSchema = (valueLabel = "Registration ") => makeBaseRegistrarActionSchema(valueLabel).extend({
2795
- type: z14.literal(RegistrarActionTypes.Registration)
2940
+ type: z18.literal(RegistrarActionTypes.Registration)
2796
2941
  });
2797
2942
  var makeRegistrarActionRenewalSchema = (valueLabel = "Renewal") => makeBaseRegistrarActionSchema(valueLabel).extend({
2798
- type: z14.literal(RegistrarActionTypes.Renewal)
2943
+ type: z18.literal(RegistrarActionTypes.Renewal)
2799
2944
  });
2800
- var makeRegistrarActionSchema = (valueLabel = "Registrar Action") => z14.discriminatedUnion("type", [
2945
+ var makeRegistrarActionSchema = (valueLabel = "Registrar Action") => z18.discriminatedUnion("type", [
2801
2946
  makeRegistrarActionRegistrationSchema(`${valueLabel} Registration`),
2802
2947
  makeRegistrarActionRenewalSchema(`${valueLabel} Renewal`)
2803
2948
  ]);
2804
2949
 
2805
- // src/ensapi/api/shared/pagination/zod-schemas.ts
2806
- import { z as z15 } from "zod/v4";
2950
+ // src/ensnode/api/shared/pagination/zod-schemas.ts
2951
+ import { z as z19 } from "zod/v4";
2807
2952
 
2808
- // src/ensapi/api/shared/pagination/request.ts
2953
+ // src/ensnode/api/shared/pagination/request.ts
2809
2954
  var RECORDS_PER_PAGE_DEFAULT = 10;
2810
2955
  var RECORDS_PER_PAGE_MAX = 100;
2811
2956
 
2812
- // src/ensapi/api/shared/pagination/zod-schemas.ts
2813
- var makeRequestPageParamsSchema = (valueLabel = "RequestPageParams") => z15.object({
2957
+ // src/ensnode/api/shared/pagination/zod-schemas.ts
2958
+ var makeRequestPageParamsSchema = (valueLabel = "RequestPageParams") => z19.object({
2814
2959
  page: makePositiveIntegerSchema(`${valueLabel}.page`),
2815
2960
  recordsPerPage: makePositiveIntegerSchema(`${valueLabel}.recordsPerPage`).max(
2816
2961
  RECORDS_PER_PAGE_MAX,
2817
2962
  `${valueLabel}.recordsPerPage must not exceed ${RECORDS_PER_PAGE_MAX}`
2818
2963
  )
2819
2964
  });
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()
2965
+ var makeResponsePageContextSchemaWithNoRecords = (valueLabel = "ResponsePageContextWithNoRecords") => z19.object({
2966
+ totalRecords: z19.literal(0),
2967
+ totalPages: z19.literal(1),
2968
+ hasNext: z19.literal(false),
2969
+ hasPrev: z19.literal(false)
2827
2970
  }).extend(makeRequestPageParamsSchema(valueLabel).shape);
2828
2971
  function invariant_responsePageWithRecordsIsCorrect(ctx) {
2829
2972
  const { hasNext, hasPrev, recordsPerPage, page, totalRecords, startIndex, endIndex } = ctx.value;
@@ -2858,20 +3001,20 @@ function invariant_responsePageWithRecordsIsCorrect(ctx) {
2858
3001
  });
2859
3002
  }
2860
3003
  }
2861
- var makeResponsePageContextSchemaWithRecords = (valueLabel = "ResponsePageContextWithRecords") => z15.object({
3004
+ var makeResponsePageContextSchemaWithRecords = (valueLabel = "ResponsePageContextWithRecords") => z19.object({
2862
3005
  totalRecords: makePositiveIntegerSchema(`${valueLabel}.totalRecords`),
2863
3006
  totalPages: makePositiveIntegerSchema(`${valueLabel}.totalPages`),
2864
- hasNext: z15.boolean(),
2865
- hasPrev: z15.boolean(),
3007
+ hasNext: z19.boolean(),
3008
+ hasPrev: z19.boolean(),
2866
3009
  startIndex: makeNonNegativeIntegerSchema(`${valueLabel}.startIndex`),
2867
3010
  endIndex: makeNonNegativeIntegerSchema(`${valueLabel}.endIndex`)
2868
3011
  }).extend(makeRequestPageParamsSchema(valueLabel).shape).check(invariant_responsePageWithRecordsIsCorrect);
2869
- var makeResponsePageContextSchema = (valueLabel = "ResponsePageContext") => z15.union([
3012
+ var makeResponsePageContextSchema = (valueLabel = "ResponsePageContext") => z19.union([
2870
3013
  makeResponsePageContextSchemaWithNoRecords(valueLabel),
2871
3014
  makeResponsePageContextSchemaWithRecords(valueLabel)
2872
3015
  ]);
2873
3016
 
2874
- // src/ensapi/api/registrar-actions/response.ts
3017
+ // src/ensnode/api/registrar-actions/response.ts
2875
3018
  var RegistrarActionsResponseCodes = {
2876
3019
  /**
2877
3020
  * Represents that Registrar Actions are available.
@@ -2883,11 +3026,11 @@ var RegistrarActionsResponseCodes = {
2883
3026
  Error: "error"
2884
3027
  };
2885
3028
 
2886
- // src/ensapi/api/registrar-actions/zod-schemas.ts
3029
+ // src/ensnode/api/registrar-actions/zod-schemas.ts
2887
3030
  function invariant_registrationLifecycleNodeMatchesName(ctx) {
2888
3031
  const { name, action } = ctx.value;
2889
3032
  const expectedNode = action.registrationLifecycle.node;
2890
- const actualNode = namehash3(name);
3033
+ const actualNode = namehashInterpretedName2(name);
2891
3034
  if (actualNode !== expectedNode) {
2892
3035
  ctx.issues.push({
2893
3036
  code: "custom",
@@ -2896,39 +3039,39 @@ function invariant_registrationLifecycleNodeMatchesName(ctx) {
2896
3039
  });
2897
3040
  }
2898
3041
  }
2899
- var makeNamedRegistrarActionSchema = (valueLabel = "Named Registrar Action") => z16.object({
3042
+ var makeNamedRegistrarActionSchema = (valueLabel = "Named Registrar Action") => z20.object({
2900
3043
  action: makeRegistrarActionSchema(valueLabel),
2901
3044
  name: makeReinterpretedNameSchema(valueLabel)
2902
3045
  }).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)),
3046
+ var makeRegistrarActionsResponseOkSchema = (valueLabel = "Registrar Actions Response OK") => z20.object({
3047
+ responseCode: z20.literal(RegistrarActionsResponseCodes.Ok),
3048
+ registrarActions: z20.array(makeNamedRegistrarActionSchema(valueLabel)),
2906
3049
  pageContext: makeResponsePageContextSchema(`${valueLabel}.pageContext`),
2907
- accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`).optional()
3050
+ accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`)
2908
3051
  });
2909
- var makeRegistrarActionsResponseErrorSchema = (_valueLabel = "Registrar Actions Response Error") => z16.strictObject({
2910
- responseCode: z16.literal(RegistrarActionsResponseCodes.Error),
2911
- error: ErrorResponseSchema
3052
+ var makeRegistrarActionsResponseErrorSchema = (_valueLabel = "Registrar Actions Response Error") => z20.strictObject({
3053
+ responseCode: z20.literal(RegistrarActionsResponseCodes.Error),
3054
+ error: makeErrorResponseSchema()
2912
3055
  });
2913
- var makeRegistrarActionsResponseSchema = (valueLabel = "Registrar Actions Response") => z16.discriminatedUnion("responseCode", [
3056
+ var makeRegistrarActionsResponseSchema = (valueLabel = "Registrar Actions Response") => z20.discriminatedUnion("responseCode", [
2914
3057
  makeRegistrarActionsResponseOkSchema(valueLabel),
2915
3058
  makeRegistrarActionsResponseErrorSchema(valueLabel)
2916
3059
  ]);
2917
3060
 
2918
- // src/ensapi/api/registrar-actions/deserialize.ts
3061
+ // src/ensnode/api/registrar-actions/deserialize.ts
2919
3062
  function deserializeRegistrarActionsResponse(maybeResponse) {
2920
3063
  const parsed = makeRegistrarActionsResponseSchema().safeParse(maybeResponse);
2921
3064
  if (parsed.error) {
2922
3065
  throw new Error(
2923
3066
  `Cannot deserialize RegistrarActionsResponse:
2924
- ${prettifyError11(parsed.error)}
3067
+ ${prettifyError16(parsed.error)}
2925
3068
  `
2926
3069
  );
2927
3070
  }
2928
3071
  return parsed.data;
2929
3072
  }
2930
3073
 
2931
- // src/ensapi/api/registrar-actions/request.ts
3074
+ // src/ensnode/api/registrar-actions/request.ts
2932
3075
  var RegistrarActionsFilterTypes = {
2933
3076
  BySubregistryNode: "bySubregistryNode",
2934
3077
  WithEncodedReferral: "withEncodedReferral",
@@ -2948,7 +3091,7 @@ var RegistrarActionsOrders = {
2948
3091
  LatestRegistrarActions: "orderBy[timestamp]=desc"
2949
3092
  };
2950
3093
 
2951
- // src/ensapi/api/registrar-actions/filters.ts
3094
+ // src/ensnode/api/registrar-actions/filters.ts
2952
3095
  function byParentNode(parentNode) {
2953
3096
  if (typeof parentNode === "undefined") {
2954
3097
  return void 0;
@@ -3001,7 +3144,7 @@ var registrarActionsFilter = {
3001
3144
  endTimestamp
3002
3145
  };
3003
3146
 
3004
- // src/ensapi/api/registrar-actions/prerequisites.ts
3147
+ // src/ensnode/api/registrar-actions/prerequisites.ts
3005
3148
  var registrarActionsRequiredPlugins = [
3006
3149
  "subgraph" /* Subgraph */,
3007
3150
  "basenames" /* Basenames */,
@@ -3033,7 +3176,7 @@ function hasRegistrarActionsIndexingStatusSupport(omnichainIndexingStatusId) {
3033
3176
  };
3034
3177
  }
3035
3178
 
3036
- // src/ensapi/api/registrar-actions/serialize.ts
3179
+ // src/ensnode/api/registrar-actions/serialize.ts
3037
3180
  function serializeNamedRegistrarAction({
3038
3181
  action,
3039
3182
  name
@@ -3057,19 +3200,19 @@ function serializeRegistrarActionsResponse(response) {
3057
3200
  }
3058
3201
  }
3059
3202
 
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);
3203
+ // src/ensnode/api/shared/errors/deserialize.ts
3204
+ import { prettifyError as prettifyError17 } from "zod/v4";
3205
+ function deserializeErrorResponse2(maybeErrorResponse) {
3206
+ const parsed = makeErrorResponseSchema().safeParse(maybeErrorResponse);
3064
3207
  if (parsed.error) {
3065
3208
  throw new Error(`Cannot deserialize ErrorResponse:
3066
- ${prettifyError12(parsed.error)}
3209
+ ${prettifyError17(parsed.error)}
3067
3210
  `);
3068
3211
  }
3069
3212
  return parsed.data;
3070
3213
  }
3071
3214
 
3072
- // src/ensapi/api/shared/pagination/build-page-context.ts
3215
+ // src/ensnode/api/shared/pagination/build-page-context.ts
3073
3216
  function buildPageContext(page, recordsPerPage, totalRecords) {
3074
3217
  const totalPages = Math.max(1, Math.ceil(totalRecords / recordsPerPage));
3075
3218
  if (page > totalPages) {
@@ -3104,7 +3247,7 @@ function buildPageContext(page, recordsPerPage, totalRecords) {
3104
3247
  };
3105
3248
  }
3106
3249
 
3107
- // src/ensapi/client-error.ts
3250
+ // src/ensnode/client-error.ts
3108
3251
  var ClientError = class _ClientError extends Error {
3109
3252
  details;
3110
3253
  constructor(message, details) {
@@ -3117,17 +3260,17 @@ var ClientError = class _ClientError extends Error {
3117
3260
  }
3118
3261
  };
3119
3262
 
3120
- // src/ensapi/deployments.ts
3263
+ // src/ensnode/deployments.ts
3121
3264
  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";
3265
+ var DEFAULT_ENSNODE_URL_MAINNET = "https://api.alpha.ensnode.io";
3266
+ var DEFAULT_ENSNODE_URL_SEPOLIA = "https://api.alpha-sepolia.ensnode.io";
3124
3267
  var getDefaultEnsNodeUrl = (namespace) => {
3125
3268
  const effectiveNamespace = namespace ?? ENSNamespaceIds3.Mainnet;
3126
3269
  switch (effectiveNamespace) {
3127
3270
  case ENSNamespaceIds3.Mainnet:
3128
- return new URL(DEFAULT_ENSNODE_API_URL_MAINNET);
3271
+ return new URL(DEFAULT_ENSNODE_URL_MAINNET);
3129
3272
  case ENSNamespaceIds3.Sepolia:
3130
- return new URL(DEFAULT_ENSNODE_API_URL_SEPOLIA);
3273
+ return new URL(DEFAULT_ENSNODE_URL_SEPOLIA);
3131
3274
  default:
3132
3275
  throw new Error(
3133
3276
  `ENSNamespaceId ${effectiveNamespace} does not have a default ENSNode URL defined`
@@ -3135,8 +3278,8 @@ var getDefaultEnsNodeUrl = (namespace) => {
3135
3278
  }
3136
3279
  };
3137
3280
 
3138
- // src/ensapi/client.ts
3139
- var EnsApiClient = class _EnsApiClient {
3281
+ // src/ensnode/client.ts
3282
+ var EnsNodeClient = class _EnsNodeClient {
3140
3283
  options;
3141
3284
  static defaultOptions() {
3142
3285
  return {
@@ -3145,7 +3288,7 @@ var EnsApiClient = class _EnsApiClient {
3145
3288
  }
3146
3289
  constructor(options = {}) {
3147
3290
  this.options = {
3148
- ..._EnsApiClient.defaultOptions(),
3291
+ ..._EnsNodeClient.defaultOptions(),
3149
3292
  ...options
3150
3293
  };
3151
3294
  }
@@ -3189,15 +3332,21 @@ var EnsApiClient = class _EnsApiClient {
3189
3332
  */
3190
3333
  async resolveRecords(name, selection, options) {
3191
3334
  const url = new URL(`/api/resolve/records/${encodeURIComponent(name)}`, this.options.url);
3192
- if (selection.name) {
3193
- url.searchParams.set("name", "true");
3194
- }
3335
+ if (selection.name) url.searchParams.set("name", "true");
3336
+ if (selection.contenthash) url.searchParams.set("contenthash", "true");
3337
+ if (selection.pubkey) url.searchParams.set("pubkey", "true");
3338
+ if (selection.dnszonehash) url.searchParams.set("dnszonehash", "true");
3339
+ if (selection.version) url.searchParams.set("version", "true");
3340
+ if (selection.abi !== void 0) url.searchParams.set("abi", selection.abi.toString());
3195
3341
  if (selection.addresses && selection.addresses.length > 0) {
3196
3342
  url.searchParams.set("addresses", selection.addresses.join(","));
3197
3343
  }
3198
3344
  if (selection.texts && selection.texts.length > 0) {
3199
3345
  url.searchParams.set("texts", selection.texts.join(","));
3200
3346
  }
3347
+ if (selection.interfaces && selection.interfaces.length > 0) {
3348
+ url.searchParams.set("interfaces", selection.interfaces.join(","));
3349
+ }
3201
3350
  if (options?.trace) url.searchParams.set("trace", "true");
3202
3351
  if (options?.accelerate) url.searchParams.set("accelerate", "true");
3203
3352
  const response = await fetch(url);
@@ -3206,6 +3355,11 @@ var EnsApiClient = class _EnsApiClient {
3206
3355
  throw ClientError.fromErrorResponse(error);
3207
3356
  }
3208
3357
  const data = await response.json();
3358
+ const records = data.records;
3359
+ if (typeof records.version === "string") records.version = BigInt(records.version);
3360
+ if (records.abi && typeof records.abi.contentType === "string") {
3361
+ records.abi.contentType = BigInt(records.abi.contentType);
3362
+ }
3209
3363
  return data;
3210
3364
  }
3211
3365
  /**
@@ -3313,32 +3467,6 @@ var EnsApiClient = class _EnsApiClient {
3313
3467
  const data = await response.json();
3314
3468
  return data;
3315
3469
  }
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
3470
  /**
3343
3471
  * Fetch ENSApi Indexing Status
3344
3472
  *
@@ -3360,7 +3488,7 @@ var EnsApiClient = class _EnsApiClient {
3360
3488
  if (!response.ok) {
3361
3489
  let errorResponse;
3362
3490
  try {
3363
- errorResponse = deserializeErrorResponse(responseData);
3491
+ errorResponse = deserializeErrorResponse2(responseData);
3364
3492
  } catch {
3365
3493
  }
3366
3494
  if (typeof errorResponse !== "undefined") {
@@ -3391,11 +3519,13 @@ var EnsApiClient = class _EnsApiClient {
3391
3519
  * ```ts
3392
3520
  * import {
3393
3521
  * registrarActionsFilter,
3394
- * EnsApiClient,
3522
+ * EnsNodeClient,
3395
3523
  * } from "@ensnode/ensnode-sdk";
3396
- * import { namehash } from "viem/ens";
3524
+ * import { ETH_NODE, namehashInterpretedName, asInterpretedName } from "enssdk";
3397
3525
  *
3398
- * const client: EnsApiClient;
3526
+ * const BASE_NODE = namehashInterpretedName(asInterpretedName("base.eth"));
3527
+ *
3528
+ * const client: EnsNodeClient;
3399
3529
  *
3400
3530
  * // Get first page with default page size (10 records)
3401
3531
  * const response = await client.registrarActions();
@@ -3415,7 +3545,7 @@ var EnsApiClient = class _EnsApiClient {
3415
3545
  * // get latest registrar action records associated with
3416
3546
  * // subregistry managing `eth` name
3417
3547
  * await client.registrarActions({
3418
- * filters: [registrarActionsFilter.byParentNode(namehash('eth'))],
3548
+ * filters: [registrarActionsFilter.byParentNode(ETH_NODE)],
3419
3549
  * });
3420
3550
  *
3421
3551
  * // get latest registrar action records which include referral info
@@ -3431,7 +3561,7 @@ var EnsApiClient = class _EnsApiClient {
3431
3561
  * // get latest 10 registrar action records associated with
3432
3562
  * // subregistry managing `base.eth` name
3433
3563
  * await client.registrarActions({
3434
- * filters: [registrarActionsFilter.byParentNode(namehash('base.eth'))],
3564
+ * filters: [registrarActionsFilter.byParentNode(BASE_NODE)],
3435
3565
  * recordsPerPage: 10
3436
3566
  * });
3437
3567
  *
@@ -3535,230 +3665,55 @@ var EnsApiClient = class _EnsApiClient {
3535
3665
  if (!response.ok) {
3536
3666
  let errorResponse;
3537
3667
  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}`);
3668
+ errorResponse = deserializeErrorResponse2(responseData);
3669
+ } catch {
3670
+ console.log("Registrar Actions API: handling a known server error.");
3671
+ }
3672
+ if (typeof errorResponse !== "undefined") {
3673
+ throw new Error(`Fetching ENSNode Registrar Actions Failed: ${errorResponse.message}`);
3674
+ }
3746
3675
  }
3747
- return deserializeEnsIndexerConfigResponse(
3748
- responseData
3749
- );
3676
+ return deserializeRegistrarActionsResponse(responseData);
3750
3677
  }
3751
3678
  /**
3752
- * Fetch ENSIndexer Indexing Status
3679
+ * Fetch Name Tokens for requested name.
3753
3680
  *
3754
- * @returns {EnsIndexerIndexingStatusResponse}
3681
+ * @param request.name - Name for which Name Tokens will be fetched.
3682
+ * @returns {NameTokensResponse}
3755
3683
  *
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
3684
+ * @throws if the ENSNode request fails
3685
+ * @throws if the ENSNode API returns an error response
3686
+ * @throws if the ENSNode response breaks required invariants
3687
+ *
3688
+ * @example
3689
+ * ```ts
3690
+ * import {
3691
+ * EnsNodeClient,
3692
+ * } from "@ensnode/ensnode-sdk";
3693
+ * import { namehashInterpretedName, asInterpretedName } from "enssdk";
3694
+ *
3695
+ * const VITALIK_NAME = asInterpretedName("vitalik.eth");
3696
+ * const VITALIK_DOMAIN_ID = namehashInterpretedName(VITALIK_NAME);
3697
+ *
3698
+ * const client: EnsNodeClient;
3699
+ *
3700
+ * // get latest name token records from the indexed subregistry based on the requested name
3701
+ * const response = await client.nameTokens({
3702
+ * name: VITALIK_NAME,
3703
+ * });
3704
+ *
3705
+ * const response = await client.nameTokens({
3706
+ * domainId: VITALIK_DOMAIN_ID,
3707
+ * })
3708
+ * ```
3759
3709
  */
3760
- async indexingStatus() {
3761
- const url = new URL(`/api/indexing-status`, this.options.url);
3710
+ async nameTokens(request) {
3711
+ const url = new URL(`/api/name-tokens`, this.options.url);
3712
+ if (request.name !== void 0) {
3713
+ url.searchParams.set("name", request.name);
3714
+ } else if (request.domainId !== void 0) {
3715
+ url.searchParams.set("domainId", request.domainId);
3716
+ }
3762
3717
  const response = await fetch(url);
3763
3718
  let responseData;
3764
3719
  try {
@@ -3771,181 +3726,15 @@ var EnsIndexerClient = class {
3771
3726
  try {
3772
3727
  errorResponse = deserializeErrorResponse2(responseData);
3773
3728
  } catch {
3729
+ console.log("Name Tokens API: handling a known server error.");
3774
3730
  }
3775
3731
  if (typeof errorResponse !== "undefined") {
3776
- throw new Error(`Fetching ENSIndexer Indexing Status Failed: ${errorResponse.message}`);
3732
+ throw new Error(`Fetching ENSNode Name Tokens Failed: ${errorResponse.message}`);
3777
3733
  }
3778
3734
  }
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)}`);
3735
+ return deserializedNameTokensResponse(responseData);
3914
3736
  }
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
3737
  };
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
3738
 
3950
3739
  // src/identity/identity.ts
3951
3740
  import { getENSRootChainId as getENSRootChainId2 } from "@ensnode/datasources";
@@ -3984,14 +3773,14 @@ function isResolvedIdentity(identity) {
3984
3773
  }
3985
3774
 
3986
3775
  // src/indexing-status/deserialize/chain-indexing-status-snapshot.ts
3987
- import { prettifyError as prettifyError17 } from "zod/v4";
3776
+ import { prettifyError as prettifyError18 } from "zod/v4";
3988
3777
  function deserializeChainIndexingStatusSnapshot(maybeSnapshot, valueLabel) {
3989
3778
  const schema = makeChainIndexingStatusSnapshotSchema(valueLabel);
3990
3779
  const parsed = schema.safeParse(maybeSnapshot);
3991
3780
  if (parsed.error) {
3992
3781
  throw new Error(
3993
3782
  `Cannot deserialize into ChainIndexingStatusSnapshot:
3994
- ${prettifyError17(parsed.error)}
3783
+ ${prettifyError18(parsed.error)}
3995
3784
  `
3996
3785
  );
3997
3786
  }
@@ -4009,32 +3798,43 @@ function createRealtimeIndexingStatusProjection(snapshot, now) {
4009
3798
  }
4010
3799
 
4011
3800
  // src/indexing-status/validate/chain-indexing-status-snapshot.ts
4012
- import { prettifyError as prettifyError18 } from "zod/v4";
3801
+ import { prettifyError as prettifyError19 } from "zod/v4";
4013
3802
  function validateChainIndexingStatusSnapshot(unvalidatedSnapshot, valueLabel) {
4014
3803
  const schema = makeChainIndexingStatusSnapshotSchema(valueLabel);
4015
3804
  const parsed = schema.safeParse(unvalidatedSnapshot);
4016
3805
  if (parsed.error) {
4017
3806
  throw new Error(`Invalid ChainIndexingStatusSnapshot:
4018
- ${prettifyError18(parsed.error)}
3807
+ ${prettifyError19(parsed.error)}
4019
3808
  `);
4020
3809
  }
4021
3810
  return parsed.data;
4022
3811
  }
4023
3812
 
4024
3813
  // src/indexing-status/validate/realtime-indexing-status-projection.ts
4025
- import { prettifyError as prettifyError19 } from "zod/v4";
3814
+ import { prettifyError as prettifyError20 } from "zod/v4";
4026
3815
  function validateRealtimeIndexingStatusProjection(unvalidatedProjection, valueLabel) {
4027
3816
  const schema = makeRealtimeIndexingStatusProjectionSchema(valueLabel);
4028
3817
  const parsed = schema.safeParse(unvalidatedProjection);
4029
3818
  if (parsed.error) {
4030
3819
  throw new Error(`Invalid RealtimeIndexingStatusProjection:
4031
- ${prettifyError19(parsed.error)}
3820
+ ${prettifyError20(parsed.error)}
4032
3821
  `);
4033
3822
  }
4034
3823
  return parsed.data;
4035
3824
  }
4036
3825
 
3826
+ // src/omnigraph-api/prerequisites.ts
3827
+ function hasOmnigraphApiConfigSupport(config) {
3828
+ const supported = config.plugins.includes("ensv2" /* ENSv2 */);
3829
+ if (supported) return { supported };
3830
+ return {
3831
+ supported: false,
3832
+ reason: `The connected ENSNode's Config must have the '${"ensv2" /* ENSv2 */}' plugin enabled.`
3833
+ };
3834
+ }
3835
+
4037
3836
  // src/registrars/basenames-subregistry.ts
3837
+ import { asInterpretedName } from "enssdk";
4038
3838
  import {
4039
3839
  DatasourceNames as DatasourceNames2,
4040
3840
  ENSNamespaceIds as ENSNamespaceIds4,
@@ -4049,18 +3849,15 @@ function getBasenamesSubregistryId(namespace) {
4049
3849
  if (address === void 0 || Array.isArray(address)) {
4050
3850
  throw new Error(`BaseRegistrar contract not found or has multiple addresses for ${namespace}`);
4051
3851
  }
4052
- return {
4053
- chainId: datasource.chain.id,
4054
- address
4055
- };
3852
+ return { chainId: datasource.chain.id, address };
4056
3853
  }
4057
3854
  function getBasenamesSubregistryManagedName(namespaceId) {
4058
3855
  switch (namespaceId) {
4059
3856
  case ENSNamespaceIds4.Mainnet:
4060
- return "base.eth";
3857
+ return asInterpretedName("base.eth");
4061
3858
  case ENSNamespaceIds4.Sepolia:
4062
3859
  case ENSNamespaceIds4.SepoliaV2:
4063
- return "basetest.eth";
3860
+ return asInterpretedName("basetest.eth");
4064
3861
  case ENSNamespaceIds4.EnsTestEnv:
4065
3862
  throw new Error(
4066
3863
  `No registrar managed name is known for the 'basenames' subregistry within the "${namespaceId}" namespace.`
@@ -4069,6 +3866,7 @@ function getBasenamesSubregistryManagedName(namespaceId) {
4069
3866
  }
4070
3867
 
4071
3868
  // src/registrars/ethnames-subregistry.ts
3869
+ import { asInterpretedName as asInterpretedName2 } from "enssdk";
4072
3870
  import {
4073
3871
  DatasourceNames as DatasourceNames3,
4074
3872
  ENSNamespaceIds as ENSNamespaceIds5,
@@ -4083,10 +3881,7 @@ function getEthnamesSubregistryId(namespace) {
4083
3881
  if (address === void 0 || Array.isArray(address)) {
4084
3882
  throw new Error(`BaseRegistrar contract not found or has multiple addresses for ${namespace}`);
4085
3883
  }
4086
- return {
4087
- chainId: datasource.chain.id,
4088
- address
4089
- };
3884
+ return { chainId: datasource.chain.id, address };
4090
3885
  }
4091
3886
  function getEthnamesSubregistryManagedName(namespaceId) {
4092
3887
  switch (namespaceId) {
@@ -4094,11 +3889,12 @@ function getEthnamesSubregistryManagedName(namespaceId) {
4094
3889
  case ENSNamespaceIds5.Sepolia:
4095
3890
  case ENSNamespaceIds5.SepoliaV2:
4096
3891
  case ENSNamespaceIds5.EnsTestEnv:
4097
- return "eth";
3892
+ return asInterpretedName2("eth");
4098
3893
  }
4099
3894
  }
4100
3895
 
4101
3896
  // src/registrars/lineanames-subregistry.ts
3897
+ import { asInterpretedName as asInterpretedName3 } from "enssdk";
4102
3898
  import {
4103
3899
  DatasourceNames as DatasourceNames4,
4104
3900
  ENSNamespaceIds as ENSNamespaceIds6,
@@ -4113,18 +3909,15 @@ function getLineanamesSubregistryId(namespace) {
4113
3909
  if (address === void 0 || Array.isArray(address)) {
4114
3910
  throw new Error(`BaseRegistrar contract not found or has multiple addresses for ${namespace}`);
4115
3911
  }
4116
- return {
4117
- chainId: datasource.chain.id,
4118
- address
4119
- };
3912
+ return { chainId: datasource.chain.id, address };
4120
3913
  }
4121
3914
  function getLineanamesSubregistryManagedName(namespaceId) {
4122
3915
  switch (namespaceId) {
4123
3916
  case ENSNamespaceIds6.Mainnet:
4124
- return "linea.eth";
3917
+ return asInterpretedName3("linea.eth");
4125
3918
  case ENSNamespaceIds6.Sepolia:
4126
3919
  case ENSNamespaceIds6.SepoliaV2:
4127
- return "linea-sepolia.eth";
3920
+ return asInterpretedName3("linea-sepolia.eth");
4128
3921
  case ENSNamespaceIds6.EnsTestEnv:
4129
3922
  throw new Error(
4130
3923
  `No registrar managed name is known for the 'Lineanames' subregistry within the "${namespaceId}" namespace.`
@@ -4148,6 +3941,7 @@ function isRegistrationInGracePeriod(info, now) {
4148
3941
  }
4149
3942
 
4150
3943
  // src/resolution/ensip19-chainid.ts
3944
+ import { DEFAULT_EVM_CHAIN_ID } from "enssdk";
4151
3945
  import { mainnet } from "viem/chains";
4152
3946
  import { getENSRootChainId as getENSRootChainId3 } from "@ensnode/datasources";
4153
3947
  var getResolvePrimaryNameChainIdParam = (chainId, namespaceId) => {
@@ -4159,7 +3953,7 @@ var translateDefaultableChainIdToChainId = (chainId, namespaceId) => {
4159
3953
  };
4160
3954
 
4161
3955
  // src/resolution/resolver-records-selection.ts
4162
- var isSelectionEmpty = (selection) => !selection.name && !selection.addresses?.length && !selection.texts?.length;
3956
+ 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
3957
 
4164
3958
  // src/shared/cache/lru-cache.ts
4165
3959
  var LruCache = class {
@@ -4218,13 +4012,13 @@ import { getUnixTime as getUnixTime2 } from "date-fns/getUnixTime";
4218
4012
  import { getUnixTime } from "date-fns/getUnixTime";
4219
4013
 
4220
4014
  // src/shared/deserialize.ts
4221
- import z19, { prettifyError as prettifyError20 } from "zod/v4";
4015
+ import z21, { prettifyError as prettifyError21 } from "zod/v4";
4222
4016
  function deserializeChainId(maybeChainId, valueLabel) {
4223
4017
  const schema = makeChainIdStringSchema(valueLabel);
4224
4018
  const parsed = schema.safeParse(maybeChainId);
4225
4019
  if (parsed.error) {
4226
4020
  throw new Error(`Cannot deserialize ChainId:
4227
- ${prettifyError20(parsed.error)}
4021
+ ${prettifyError21(parsed.error)}
4228
4022
  `);
4229
4023
  }
4230
4024
  return parsed.data;
@@ -4234,7 +4028,7 @@ function deserializeDatetime(maybeDatetime, valueLabel) {
4234
4028
  const parsed = schema.safeParse(maybeDatetime);
4235
4029
  if (parsed.error) {
4236
4030
  throw new Error(`Cannot deserialize Datetime:
4237
- ${prettifyError20(parsed.error)}
4031
+ ${prettifyError21(parsed.error)}
4238
4032
  `);
4239
4033
  }
4240
4034
  return parsed.data;
@@ -4244,7 +4038,7 @@ function deserializeUnixTimestamp(maybeTimestamp, valueLabel) {
4244
4038
  const parsed = schema.safeParse(maybeTimestamp);
4245
4039
  if (parsed.error) {
4246
4040
  throw new Error(`Cannot deserialize Unix Timestamp:
4247
- ${prettifyError20(parsed.error)}
4041
+ ${prettifyError21(parsed.error)}
4248
4042
  `);
4249
4043
  }
4250
4044
  return parsed.data;
@@ -4254,7 +4048,7 @@ function deserializeUrl(maybeUrl, valueLabel) {
4254
4048
  const parsed = schema.safeParse(maybeUrl);
4255
4049
  if (parsed.error) {
4256
4050
  throw new Error(`Cannot deserialize URL:
4257
- ${prettifyError20(parsed.error)}
4051
+ ${prettifyError21(parsed.error)}
4258
4052
  `);
4259
4053
  }
4260
4054
  return parsed.data;
@@ -4264,7 +4058,7 @@ function deserializeBlockNumber(maybeBlockNumber, valueLabel) {
4264
4058
  const parsed = schema.safeParse(maybeBlockNumber);
4265
4059
  if (parsed.error) {
4266
4060
  throw new Error(`Cannot deserialize BlockNumber:
4267
- ${prettifyError20(parsed.error)}
4061
+ ${prettifyError21(parsed.error)}
4268
4062
  `);
4269
4063
  }
4270
4064
  return parsed.data;
@@ -4274,17 +4068,17 @@ function deserializeBlockRef(maybeBlockRef, valueLabel) {
4274
4068
  const parsed = schema.safeParse(maybeBlockRef);
4275
4069
  if (parsed.error) {
4276
4070
  throw new Error(`Cannot deserialize BlockRef:
4277
- ${prettifyError20(parsed.error)}
4071
+ ${prettifyError21(parsed.error)}
4278
4072
  `);
4279
4073
  }
4280
4074
  return parsed.data;
4281
4075
  }
4282
4076
  function deserializeDuration(maybeDuration, valueLabel) {
4283
- const schema = z19.coerce.number().pipe(makeDurationSchema(valueLabel));
4077
+ const schema = z21.coerce.number().pipe(makeDurationSchema(valueLabel));
4284
4078
  const parsed = schema.safeParse(maybeDuration);
4285
4079
  if (parsed.error) {
4286
4080
  throw new RangeError(`Cannot deserialize Duration:
4287
- ${prettifyError20(parsed.error)}
4081
+ ${prettifyError21(parsed.error)}
4288
4082
  `);
4289
4083
  }
4290
4084
  return parsed.data;
@@ -4294,7 +4088,7 @@ function parseAccountId(maybeAccountId, valueLabel) {
4294
4088
  const parsed = schema.safeParse(maybeAccountId);
4295
4089
  if (parsed.error) {
4296
4090
  throw new RangeError(`Cannot deserialize AccountId:
4297
- ${prettifyError20(parsed.error)}
4091
+ ${prettifyError21(parsed.error)}
4298
4092
  `);
4299
4093
  }
4300
4094
  return parsed.data;
@@ -4304,7 +4098,7 @@ function deserializePriceEth(maybePrice, valueLabel) {
4304
4098
  const parsed = schema.safeParse(maybePrice);
4305
4099
  if (parsed.error) {
4306
4100
  throw new Error(`Cannot deserialize PriceEth:
4307
- ${prettifyError20(parsed.error)}
4101
+ ${prettifyError21(parsed.error)}
4308
4102
  `);
4309
4103
  }
4310
4104
  return parsed.data;
@@ -4314,7 +4108,7 @@ function deserializePriceUsdc(maybePrice, valueLabel) {
4314
4108
  const parsed = schema.safeParse(maybePrice);
4315
4109
  if (parsed.error) {
4316
4110
  throw new Error(`Cannot deserialize PriceUsdc:
4317
- ${prettifyError20(parsed.error)}
4111
+ ${prettifyError21(parsed.error)}
4318
4112
  `);
4319
4113
  }
4320
4114
  return parsed.data;
@@ -4324,7 +4118,7 @@ function deserializePriceDai(maybePrice, valueLabel) {
4324
4118
  const parsed = schema.safeParse(maybePrice);
4325
4119
  if (parsed.error) {
4326
4120
  throw new Error(`Cannot deserialize PriceDai:
4327
- ${prettifyError20(parsed.error)}
4121
+ ${prettifyError21(parsed.error)}
4328
4122
  `);
4329
4123
  }
4330
4124
  return parsed.data;
@@ -4511,7 +4305,8 @@ import { isAddressEqual as isAddressEqual4, zeroAddress as zeroAddress5 } from "
4511
4305
  var interpretAddress = (owner) => isAddressEqual4(zeroAddress5, owner) ? null : owner;
4512
4306
 
4513
4307
  // src/shared/interpretation/interpret-record-values.ts
4514
- import { isAddress as isAddress3, isAddressEqual as isAddressEqual5, zeroAddress as zeroAddress6 } from "viem";
4308
+ import { isInterpretedName, toNormalizedAddress as toNormalizedAddress3 } from "enssdk";
4309
+ import { isAddress as isAddress2, isAddressEqual as isAddressEqual5, zeroAddress as zeroAddress6 } from "viem";
4515
4310
 
4516
4311
  // src/shared/null-bytes.ts
4517
4312
  var hasNullByte = (value) => value.indexOf("\0") !== -1;
@@ -4520,16 +4315,16 @@ var stripNullBytes = (value) => value.replaceAll("\0", "");
4520
4315
  // src/shared/interpretation/interpret-record-values.ts
4521
4316
  function interpretNameRecordValue(value) {
4522
4317
  if (value === "") return null;
4523
- if (!isNormalizedName(value)) return null;
4318
+ if (!isInterpretedName(value)) return null;
4524
4319
  return value;
4525
4320
  }
4526
4321
  function interpretAddressRecordValue(value) {
4527
4322
  if (hasNullByte(value)) return null;
4528
4323
  if (value === "") return null;
4529
4324
  if (value === "0x") return null;
4530
- if (!isAddress3(value)) return value;
4325
+ if (!isAddress2(value, { strict: false })) return value;
4531
4326
  if (isAddressEqual5(value, zeroAddress6)) return null;
4532
- return asLowerCaseAddress(value);
4327
+ return toNormalizedAddress3(value);
4533
4328
  }
4534
4329
  function interpretTextRecordKey(key) {
4535
4330
  if (hasNullByte(key)) return null;
@@ -4542,83 +4337,19 @@ function interpretTextRecordValue(value) {
4542
4337
  return value;
4543
4338
  }
4544
4339
 
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);
4340
+ // src/shared/interpretation/interpret-resolver-values.ts
4341
+ import { size as size3, zeroHash } from "viem";
4342
+ function interpretContenthashValue(value) {
4343
+ if (size3(value) === 0) return null;
4344
+ return value;
4588
4345
  }
4589
- function isInterpretedName(name) {
4590
- return name.split(".").every(isInterpetedLabel);
4346
+ function interpretPubkeyValue(x, y) {
4347
+ if (x === zeroHash && y === zeroHash) return null;
4348
+ return { x, y };
4591
4349
  }
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 };
4350
+ function interpretDnszonehashValue(value) {
4351
+ if (size3(value) === 0) return null;
4352
+ return value;
4622
4353
  }
4623
4354
 
4624
4355
  // src/shared/namespace-specific-value.ts
@@ -4627,6 +4358,7 @@ function getNamespaceSpecificValue(namespace, value) {
4627
4358
  }
4628
4359
 
4629
4360
  // src/shared/root-registry.ts
4361
+ import { makeRegistryId } from "enssdk";
4630
4362
  import { DatasourceNames as DatasourceNames5 } from "@ensnode/datasources";
4631
4363
  var getENSv1Registry = (namespace) => getDatasourceContract(namespace, DatasourceNames5.ENSRoot, "ENSv1Registry");
4632
4364
  var isENSv1Registry = (namespace, contract) => accountIdEqual(getENSv1Registry(namespace), contract);
@@ -4648,6 +4380,16 @@ function isWebSocketProtocol(url) {
4648
4380
  return ["ws:", "wss:"].includes(url.protocol);
4649
4381
  }
4650
4382
 
4383
+ // src/stack-info/ensnode-stack-info.ts
4384
+ function buildEnsNodeStackInfo(ensApiPublicConfig, ensDbPublicConfig) {
4385
+ return {
4386
+ ensApi: ensApiPublicConfig,
4387
+ ensDb: ensDbPublicConfig,
4388
+ ensIndexer: ensApiPublicConfig.ensIndexerPublicConfig,
4389
+ ensRainbow: ensApiPublicConfig.ensIndexerPublicConfig.ensRainbowPublicConfig
4390
+ };
4391
+ }
4392
+
4651
4393
  // src/subgraph-api/prerequisites.ts
4652
4394
  function hasSubgraphApiConfigSupport(config) {
4653
4395
  const supported = config.plugins.includes("subgraph" /* Subgraph */);
@@ -4688,39 +4430,28 @@ var ReverseResolutionProtocolStep = /* @__PURE__ */ ((ReverseResolutionProtocolS
4688
4430
  return ReverseResolutionProtocolStep2;
4689
4431
  })(ReverseResolutionProtocolStep || {});
4690
4432
  export {
4691
- ADDR_REVERSE_NODE,
4692
4433
  ATTR_PROTOCOL_NAME,
4693
4434
  ATTR_PROTOCOL_STEP,
4694
4435
  ATTR_PROTOCOL_STEP_RESULT,
4695
- AssetNamespaces,
4696
- BASENAMES_NODE,
4697
4436
  ChainIndexingStatusIds,
4698
4437
  ClientError,
4699
4438
  CrossChainIndexingStrategyIds,
4700
4439
  CurrencyIds,
4701
- DEFAULT_ENSNODE_API_URL_MAINNET,
4702
- DEFAULT_ENSNODE_API_URL_SEPOLIA,
4703
- DEFAULT_EVM_CHAIN_ID,
4704
- DEFAULT_EVM_COIN_TYPE,
4440
+ DEFAULT_ENSNODE_URL_MAINNET,
4441
+ DEFAULT_ENSNODE_URL_SEPOLIA,
4705
4442
  ENCODED_REFERRER_BYTE_LENGTH,
4706
4443
  ENCODED_REFERRER_BYTE_OFFSET,
4707
- ENSNamespaceIds,
4708
- ENSNodeClient,
4709
- ENS_ROOT,
4710
- ETH_COIN_TYPE,
4711
- ETH_NODE,
4444
+ ENSNamespaceIds7 as ENSNamespaceIds,
4712
4445
  EXPECTED_ENCODED_REFERRER_PADDING,
4713
- EnsApiClient,
4714
4446
  EnsApiIndexingStatusResponseCodes,
4715
4447
  EnsIndexerClient,
4716
4448
  EnsIndexerIndexingStatusResponseCodes,
4449
+ EnsNodeClient,
4717
4450
  ForwardResolutionProtocolStep,
4718
4451
  IndexingStatusResponseCodes,
4719
- LINEANAMES_NODE,
4720
4452
  LruCache,
4721
4453
  NFTMintStatuses,
4722
4454
  NFTTransferTypes,
4723
- NODE_ANY,
4724
4455
  NameTokenOwnershipTypes,
4725
4456
  NameTokensResponseCodes,
4726
4457
  NameTokensResponseErrorCodes,
@@ -4729,8 +4460,6 @@ export {
4729
4460
  PluginName,
4730
4461
  RECORDS_PER_PAGE_DEFAULT,
4731
4462
  RECORDS_PER_PAGE_MAX,
4732
- ROOT_NODE,
4733
- ROOT_RESOURCE,
4734
4463
  RangeTypeIds,
4735
4464
  RegistrarActionTypes,
4736
4465
  RegistrarActionsFilterTypes,
@@ -4747,16 +4476,13 @@ export {
4747
4476
  accountIdEqual,
4748
4477
  addDuration,
4749
4478
  addPrices,
4750
- addrReverseLabel,
4751
- asLowerCaseAddress,
4752
- beautifyName,
4753
4479
  bigIntToNumber,
4754
- bigintToCoinType,
4755
4480
  buildAssetId,
4756
4481
  buildBlockNumberRange,
4757
4482
  buildBlockRefRange,
4758
4483
  buildCrossChainIndexingStatusSnapshotOmnichain,
4759
4484
  buildEncodedReferrer,
4485
+ buildEnsNodeStackInfo,
4760
4486
  buildEnsRainbowClientLabelSet,
4761
4487
  buildIndexedBlockranges,
4762
4488
  buildLabelSetId,
@@ -4765,38 +4491,34 @@ export {
4765
4491
  buildPageContext,
4766
4492
  buildUnresolvedIdentity,
4767
4493
  buildUnvalidatedCrossChainIndexingStatusSnapshot,
4494
+ buildUnvalidatedEnsApiPublicConfig,
4768
4495
  buildUnvalidatedEnsIndexerPublicConfig,
4496
+ buildUnvalidatedEnsNodeStackInfo,
4769
4497
  buildUnvalidatedOmnichainIndexingStatusSnapshot,
4770
4498
  buildUnvalidatedRealtimeIndexingStatusProjection,
4771
4499
  checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotBackfill,
4772
4500
  checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotCompleted,
4773
4501
  checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotFollowing,
4774
4502
  checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotUnstarted,
4775
- coinTypeReverseLabel,
4776
- coinTypeToEvmChainId,
4777
- constructSubInterpretedName,
4778
4503
  createRealtimeIndexingStatusProjection,
4779
- decodeDNSEncodedLiteralName,
4780
- decodeDNSEncodedName,
4781
4504
  decodeEncodedReferrer,
4782
4505
  deserializeAssetId,
4783
4506
  deserializeBlockNumber,
4784
4507
  deserializeBlockRef,
4785
4508
  deserializeChainId,
4786
4509
  deserializeChainIndexingStatusSnapshot,
4787
- deserializeConfigResponse,
4788
4510
  deserializeCrossChainIndexingStatusSnapshot,
4789
4511
  deserializeDatetime,
4790
4512
  deserializeDuration,
4791
4513
  deserializeENSApiPublicConfig,
4792
4514
  deserializeENSIndexerPublicConfig,
4793
- deserializeEnsApiConfigResponse,
4794
4515
  deserializeEnsApiIndexingStatusResponse,
4795
4516
  deserializeEnsApiPublicConfig,
4796
4517
  deserializeEnsIndexerConfigResponse,
4797
4518
  deserializeEnsIndexerIndexingStatusResponse,
4798
4519
  deserializeEnsIndexerPublicConfig,
4799
- deserializeErrorResponse,
4520
+ deserializeEnsNodeStackInfo,
4521
+ deserializeErrorResponse2 as deserializeErrorResponse,
4800
4522
  deserializeIndexingStatusResponse,
4801
4523
  deserializeOmnichainIndexingStatusSnapshot,
4802
4524
  deserializePriceDai,
@@ -4808,16 +4530,9 @@ export {
4808
4530
  deserializeUrl,
4809
4531
  deserializedNameTokensResponse,
4810
4532
  durationBetween,
4811
- encodeLabelHash,
4812
- encodedLabelToLabelhash,
4813
- ensureInterpretedLabel,
4814
- evmChainIdToCoinType,
4815
- formatAccountId,
4816
- formatAssetId,
4817
4533
  formatNFTTransferEventMetadata,
4818
4534
  getBasenamesSubregistryId,
4819
4535
  getBasenamesSubregistryManagedName,
4820
- getCanonicalId,
4821
4536
  getCurrencyInfo,
4822
4537
  getDatasourceContract,
4823
4538
  getDefaultEnsNodeUrl,
@@ -4832,40 +4547,30 @@ export {
4832
4547
  getLineanamesSubregistryId,
4833
4548
  getLineanamesSubregistryManagedName,
4834
4549
  getNFTTransferType,
4835
- getNameHierarchy,
4836
4550
  getNameTokenOwnership,
4837
4551
  getNameWrapperAccounts,
4838
4552
  getNamespaceSpecificValue,
4839
4553
  getOmnichainIndexingCursor,
4840
4554
  getOmnichainIndexingStatus,
4841
- getParentNameFQDN,
4842
4555
  getResolvePrimaryNameChainIdParam,
4843
4556
  getTimestampForHighestOmnichainKnownBlock,
4844
4557
  getTimestampForLowestOmnichainStartBlock,
4845
- hasGraphqlApiConfigSupport,
4846
4558
  hasNullByte,
4559
+ hasOmnigraphApiConfigSupport,
4847
4560
  hasRegistrarActionsConfigSupport,
4848
4561
  hasRegistrarActionsIndexingStatusSupport,
4849
4562
  hasSubgraphApiConfigSupport,
4850
4563
  interpretAddress,
4851
4564
  interpretAddressRecordValue,
4565
+ interpretContenthashValue,
4566
+ interpretDnszonehashValue,
4852
4567
  interpretNameRecordValue,
4568
+ interpretPubkeyValue,
4853
4569
  interpretTextRecordKey,
4854
4570
  interpretTextRecordValue,
4855
- interpretTokenIdAsLabelHash,
4856
- interpretTokenIdAsNode,
4857
- interpretedLabelsToInterpretedName,
4858
- interpretedLabelsToLabelHashPath,
4859
- interpretedNameToInterpretedLabels,
4860
4571
  isENSv1Registry,
4861
4572
  isENSv2RootRegistry,
4862
- isEncodedLabelHash,
4863
4573
  isHttpProtocol,
4864
- isInterpetedLabel,
4865
- isInterpretedName,
4866
- isLabelHash,
4867
- isNormalizedLabel,
4868
- isNormalizedName,
4869
4574
  isPccFuseSet,
4870
4575
  isPriceCurrencyEqual,
4871
4576
  isPriceEqual,
@@ -4879,65 +4584,45 @@ export {
4879
4584
  isSubgraphCompatible,
4880
4585
  isWebSocketProtocol,
4881
4586
  labelHashToBytes,
4882
- labelhashLiteralLabel,
4883
- literalLabelToInterpretedLabel,
4884
- literalLabelsToInterpretedName,
4885
- literalLabelsToLiteralName,
4886
4587
  makeContractMatcher,
4887
4588
  makeENSApiPublicConfigSchema,
4888
- makeENSv1DomainId,
4889
- makeENSv2DomainId,
4890
4589
  makeEnsApiPublicConfigSchema,
4891
- makePermissionsId,
4892
- makePermissionsResourceId,
4893
- makePermissionsUserId,
4894
- makeRegistrationId,
4895
- makeRegistryId,
4896
- makeRenewalId,
4897
- makeResolverId,
4898
- makeResolverRecordsId,
4899
4590
  makeSerializedEnsApiPublicConfigSchema,
4900
- makeSubdomainNode,
4591
+ maxPrice,
4901
4592
  maybeGetDatasourceContract,
4902
4593
  maybeGetENSv2RootRegistry,
4903
4594
  maybeGetENSv2RootRegistryId,
4904
4595
  mergeBlockNumberRanges,
4596
+ minPrice,
4905
4597
  nameTokensPrerequisites,
4906
4598
  parseAccountId,
4907
4599
  parseAssetId,
4908
4600
  parseDai,
4909
- parseEncodedLabelHash,
4910
4601
  parseEth,
4911
- parseLabelHash,
4912
- parseLabelHashOrEncodedLabelHash,
4913
4602
  parseNonNegativeInteger,
4914
- parsePartialInterpretedName,
4915
- parseReverseName,
4916
4603
  parseTimestamp,
4917
4604
  parseUsdc,
4918
4605
  priceDai,
4919
4606
  priceEth,
4920
4607
  priceUsdc,
4921
4608
  registrarActionsFilter,
4922
- reverseName,
4923
4609
  scaleBigintByNumber,
4924
4610
  scalePrice,
4925
4611
  serializeAssetId,
4926
4612
  serializeChainId,
4927
4613
  serializeChainIndexingSnapshots,
4928
- serializeConfigResponse,
4929
4614
  serializeCrossChainIndexingStatusSnapshot,
4930
4615
  serializeCrossChainIndexingStatusSnapshotOmnichain,
4931
4616
  serializeDatetime,
4932
4617
  serializeDomainAssetId,
4933
4618
  serializeENSApiPublicConfig,
4934
4619
  serializeENSIndexerPublicConfig,
4935
- serializeEnsApiConfigResponse,
4936
4620
  serializeEnsApiIndexingStatusResponse,
4937
4621
  serializeEnsApiPublicConfig,
4938
4622
  serializeEnsIndexerConfigResponse,
4939
4623
  serializeEnsIndexerIndexingStatusResponse,
4940
4624
  serializeEnsIndexerPublicConfig,
4625
+ serializeEnsNodeStackInfo,
4941
4626
  serializeIndexedChainIds,
4942
4627
  serializeIndexingStatusResponse,
4943
4628
  serializeNameToken,
@@ -4956,8 +4641,8 @@ export {
4956
4641
  serializeUrl,
4957
4642
  sortChainStatusesByStartBlockAsc,
4958
4643
  stripNullBytes,
4644
+ subtractPrice,
4959
4645
  translateDefaultableChainIdToChainId,
4960
- uint256ToHex32,
4961
4646
  uniq,
4962
4647
  validateChainIndexingStatusSnapshot,
4963
4648
  validateCrossChainIndexingStatusSnapshot,