@ensnode/ensnode-sdk 0.36.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,15 +1,56 @@
1
- // src/ens/constants.ts
2
- import { namehash } from "viem";
3
- var ROOT_NODE = namehash("");
4
- var ETH_NODE = namehash("eth");
5
- var BASENAMES_NODE = namehash("base.eth");
6
- var LINEANAMES_NODE = namehash("linea.eth");
7
- var ADDR_REVERSE_NODE = namehash("addr.reverse");
1
+ // src/api/deserialize.ts
2
+ import { prettifyError as prettifyError2 } from "zod/v4";
8
3
 
9
- // src/ens/subname-helpers.ts
10
- import { concat, keccak256, toHex } from "viem";
11
- var makeSubdomainNode = (labelHash, node) => keccak256(concat([node, labelHash]));
12
- var uint256ToHex32 = (num) => toHex(num, { size: 32 });
4
+ // src/api/zod-schemas.ts
5
+ import { namehash as namehash2 } from "viem";
6
+ import z7 from "zod/v4";
7
+
8
+ // src/ensindexer/indexing-status/zod-schemas.ts
9
+ import z2 from "zod/v4";
10
+
11
+ // src/ens/is-normalized.ts
12
+ import { normalize } from "viem/ens";
13
+ function isNormalizedName(name) {
14
+ try {
15
+ return name === normalize(name);
16
+ } catch {
17
+ return false;
18
+ }
19
+ }
20
+ function isNormalizedLabel(label) {
21
+ if (label === "") return false;
22
+ if (label.includes(".")) return false;
23
+ try {
24
+ return label === normalize(label);
25
+ } catch {
26
+ return false;
27
+ }
28
+ }
29
+
30
+ // src/shared/account-id.ts
31
+ import { isAddressEqual } from "viem";
32
+ var accountIdEqual = (a, b) => {
33
+ return a.chainId === b.chainId && isAddressEqual(a.address, b.address);
34
+ };
35
+
36
+ // src/shared/address.ts
37
+ function asLowerCaseAddress(address) {
38
+ return address.toLowerCase();
39
+ }
40
+
41
+ // src/shared/cache.ts
42
+ import { getUnixTime } from "date-fns";
43
+
44
+ // src/shared/deserialize.ts
45
+ import { prettifyError } from "zod/v4";
46
+
47
+ // src/shared/zod-schemas.ts
48
+ import { AccountId as CaipAccountId } from "caip";
49
+ import { isAddress as isAddress2, isHex as isHex2, size } from "viem";
50
+ import z from "zod/v4";
51
+
52
+ // src/ens/index.ts
53
+ import { getENSRootChainId } from "@ensnode/datasources";
13
54
 
14
55
  // src/ens/coin-type.ts
15
56
  import {
@@ -34,29 +75,63 @@ var bigintToCoinType = (value) => {
34
75
  return Number(value);
35
76
  };
36
77
 
37
- // src/ens/names.ts
38
- import { ens_beautify } from "@adraffy/ens-normalize";
78
+ // src/ens/constants.ts
79
+ import { namehash } from "viem";
80
+ var ROOT_NODE = namehash("");
81
+ var ETH_NODE = namehash("eth");
82
+ var BASENAMES_NODE = namehash("base.eth");
83
+ var LINEANAMES_NODE = namehash("linea.eth");
84
+ var ADDR_REVERSE_NODE = namehash("addr.reverse");
39
85
 
40
- // src/ens/is-normalized.ts
41
- import { normalize } from "viem/ens";
42
- function isNormalizedName(name) {
43
- try {
44
- return name === normalize(name);
45
- } catch {
46
- return false;
47
- }
86
+ // src/ens/dns-encoded-name.ts
87
+ import { bytesToString, hexToBytes } from "viem";
88
+ function decodeDNSEncodedLiteralName(packet) {
89
+ return decodeDNSEncodedName(packet);
48
90
  }
49
- function isNormalizedLabel(label) {
50
- if (label === "") return false;
51
- if (label.includes(".")) return false;
52
- try {
53
- return label === normalize(label);
54
- } catch {
55
- return false;
91
+ function decodeDNSEncodedName(packet) {
92
+ const segments = [];
93
+ const bytes = hexToBytes(packet);
94
+ if (bytes.length === 0) throw new Error(`Packet is empty.`);
95
+ let offset = 0;
96
+ while (offset < bytes.length) {
97
+ const len = bytes[offset];
98
+ if (len === void 0) {
99
+ throw new Error(`Invariant: bytes[offset] is undefined after offset < bytes.length check.`);
100
+ }
101
+ if (len < 0 || len > 255) {
102
+ throw new Error(
103
+ `Invariant: this should be literally impossible, but an unsigned byte was less than zero or greater than 255. The value in question is ${len}`
104
+ );
105
+ }
106
+ if (len === 0) break;
107
+ const segment = bytesToString(bytes.subarray(offset + 1, offset + len + 1));
108
+ segments.push(segment);
109
+ offset += len + 1;
56
110
  }
111
+ if (offset >= bytes.length) throw new Error(`Overflow, offset >= bytes.length`);
112
+ if (offset !== bytes.length - 1) throw new Error(`Junk at end of name`);
113
+ return segments;
114
+ }
115
+
116
+ // src/ens/labelhash.ts
117
+ import { isHex } from "viem";
118
+ function isLabelHash(maybeLabelHash) {
119
+ const expectedLength = maybeLabelHash.length === 66;
120
+ const expectedEncoding = isHex(maybeLabelHash);
121
+ const expectedCasing = maybeLabelHash === maybeLabelHash.toLowerCase();
122
+ return expectedLength && expectedEncoding && expectedCasing;
123
+ }
124
+
125
+ // src/ens/encode-labelhash.ts
126
+ var encodeLabelHash = (labelHash) => `[${labelHash.slice(2)}]`;
127
+ function isEncodedLabelHash(maybeEncodedLabelHash) {
128
+ const expectedFormatting = maybeEncodedLabelHash.startsWith("[") && maybeEncodedLabelHash.endsWith("]");
129
+ const includesLabelHash = isLabelHash(`0x${maybeEncodedLabelHash.slice(1, -1)}`);
130
+ return expectedFormatting && includesLabelHash;
57
131
  }
58
132
 
59
133
  // src/ens/names.ts
134
+ import { ens_beautify } from "@adraffy/ens-normalize";
60
135
  var getNameHierarchy = (name) => name.split(".").map((_, i, labels) => labels.slice(i).join("."));
61
136
  var beautifyName = (name) => {
62
137
  const beautifiedLabels = name.split(".").map((label) => {
@@ -69,6 +144,37 @@ var beautifyName = (name) => {
69
144
  return beautifiedLabels.join(".");
70
145
  };
71
146
 
147
+ // src/ens/parse-reverse-name.ts
148
+ import { hexToBigInt, isAddress } from "viem";
149
+ var REVERSE_NAME_REGEX = /^([0-9a-fA-F]+)\.([0-9a-f]{1,64}|addr|default)\.reverse$/;
150
+ var parseAddressLabel = (addressLabel) => {
151
+ const maybeAddress = `0x${addressLabel}`;
152
+ if (!isAddress(maybeAddress)) {
153
+ throw new Error(`Invalid EVM address "${maybeAddress}"`);
154
+ }
155
+ return asLowerCaseAddress(maybeAddress);
156
+ };
157
+ var parseCoinTypeLabel = (coinTypeLabel) => {
158
+ if (coinTypeLabel === "default") return DEFAULT_EVM_COIN_TYPE;
159
+ if (coinTypeLabel === "addr") return ETH_COIN_TYPE;
160
+ return bigintToCoinType(hexToBigInt(`0x${coinTypeLabel}`));
161
+ };
162
+ function parseReverseName(name) {
163
+ const match = name.match(REVERSE_NAME_REGEX);
164
+ if (!match) return null;
165
+ try {
166
+ const [, addressLabel, coinTypeLabel] = match;
167
+ if (!addressLabel) return null;
168
+ if (!coinTypeLabel) return null;
169
+ return {
170
+ address: parseAddressLabel(addressLabel),
171
+ coinType: parseCoinTypeLabel(coinTypeLabel)
172
+ };
173
+ } catch {
174
+ return null;
175
+ }
176
+ }
177
+
72
178
  // src/ens/reverse-name.ts
73
179
  var addrReverseLabel = (address) => address.slice(2);
74
180
  var coinTypeReverseLabel = (coinType) => coinType.toString(16);
@@ -87,86 +193,104 @@ function reverseName(address, coinType) {
87
193
  return `${label}.${middle}.reverse`;
88
194
  }
89
195
 
196
+ // src/ens/subname-helpers.ts
197
+ import { concat, keccak256, toHex } from "viem";
198
+ var makeSubdomainNode = (labelHash, node) => keccak256(concat([node, labelHash]));
199
+ var uint256ToHex32 = (num) => toHex(num, { size: 32 });
200
+
90
201
  // src/ens/types.ts
91
202
  import { ENSNamespaceIds } from "@ensnode/datasources";
92
203
 
93
- // src/ens/parse-reverse-name.ts
94
- import { hexToBigInt, isAddress as isAddress2 } from "viem";
95
-
96
- // src/shared/address.ts
97
- function asLowerCaseAddress(address) {
98
- return address.toLowerCase();
99
- }
100
-
101
- // src/shared/cache.ts
102
- var LruCache = class {
103
- _cache = /* @__PURE__ */ new Map();
104
- _capacity;
105
- /**
106
- * Create a new LRU cache with the given capacity.
107
- *
108
- * @param capacity The maximum number of items in the cache. If set to 0, the cache is effectively disabled.
109
- * @throws Error if capacity is not a non-negative integer.
110
- */
111
- constructor(capacity) {
112
- if (!Number.isInteger(capacity)) {
113
- throw new Error(
114
- `LruCache requires capacity to be an integer but a capacity of ${capacity} was requested.`
115
- );
116
- }
117
- if (capacity < 0) {
118
- throw new Error(
119
- `LruCache requires a non-negative capacity but a capacity of ${capacity} was requested.`
120
- );
121
- }
122
- this._capacity = capacity;
123
- }
124
- set(key, value) {
125
- this._cache.set(key, value);
126
- if (this._cache.size > this._capacity) {
127
- const oldestKey = this._cache.keys().next().value;
128
- this._cache.delete(oldestKey);
129
- }
130
- }
131
- get(key) {
132
- const value = this._cache.get(key);
133
- if (value) {
134
- this._cache.delete(key);
135
- this._cache.set(key, value);
136
- }
137
- return value;
138
- }
139
- clear() {
140
- this._cache.clear();
141
- }
142
- get size() {
143
- return this._cache.size;
144
- }
145
- get capacity() {
146
- return this._capacity;
204
+ // src/shared/currencies.ts
205
+ var CurrencyIds = {
206
+ ETH: "ETH",
207
+ USDC: "USDC",
208
+ DAI: "DAI"
209
+ };
210
+ var currencyInfo = {
211
+ [CurrencyIds.ETH]: {
212
+ id: CurrencyIds.ETH,
213
+ name: "ETH",
214
+ decimals: 18
215
+ },
216
+ [CurrencyIds.USDC]: {
217
+ id: CurrencyIds.USDC,
218
+ name: "USDC",
219
+ decimals: 6
220
+ },
221
+ [CurrencyIds.DAI]: {
222
+ id: CurrencyIds.DAI,
223
+ name: "Dai Stablecoin",
224
+ decimals: 18
147
225
  }
148
226
  };
149
-
150
- // src/shared/collections.ts
151
- var uniq = (arr) => [...new Set(arr)];
152
-
153
- // src/shared/serialize.ts
154
- function serializeChainId(chainId) {
155
- return chainId.toString();
227
+ function getCurrencyInfo(currencyId) {
228
+ return currencyInfo[currencyId];
156
229
  }
157
- function serializeDatetime(datetime) {
158
- return datetime.toISOString();
230
+ function priceEth(amount) {
231
+ return {
232
+ amount,
233
+ currency: CurrencyIds.ETH
234
+ };
159
235
  }
160
- function serializeUrl(url) {
161
- return url.toString();
236
+ function priceUsdc(amount) {
237
+ return {
238
+ amount,
239
+ currency: CurrencyIds.USDC
240
+ };
241
+ }
242
+ function priceDai(amount) {
243
+ return {
244
+ amount,
245
+ currency: CurrencyIds.DAI
246
+ };
247
+ }
248
+ function isPriceCurrencyEqual(priceA, priceB) {
249
+ return priceA.currency === priceB.currency;
250
+ }
251
+ function isPriceEqual(priceA, priceB) {
252
+ return isPriceCurrencyEqual(priceA, priceB) && priceA.amount === priceB.amount;
253
+ }
254
+ function addPrices(...prices) {
255
+ const firstPrice = prices[0];
256
+ const allPricesInSameCurrency = prices.every((price) => isPriceCurrencyEqual(firstPrice, price));
257
+ if (allPricesInSameCurrency === false) {
258
+ throw new Error("All prices must have the same currency to be added together.");
259
+ }
260
+ const { currency } = firstPrice;
261
+ return prices.reduce(
262
+ (acc, price) => ({
263
+ amount: acc.amount + price.amount,
264
+ currency
265
+ }),
266
+ {
267
+ amount: 0n,
268
+ currency: firstPrice.currency
269
+ }
270
+ );
162
271
  }
163
272
 
164
- // src/shared/deserialize.ts
165
- import { prettifyError } from "zod/v4";
273
+ // src/shared/reinterpretation.ts
274
+ import { labelhash as labelToLabelHash } from "viem";
275
+ function reinterpretLabel(label) {
276
+ if (label === "") {
277
+ throw new Error(
278
+ `Cannot reinterpret an empty label that violates the invariants of an InterpretedLabel.`
279
+ );
280
+ }
281
+ if (isEncodedLabelHash(label)) return label;
282
+ if (isNormalizedLabel(label)) return label;
283
+ return encodeLabelHash(labelToLabelHash(label));
284
+ }
285
+ function reinterpretName(name) {
286
+ if (name === "") return name;
287
+ const interpretedLabels = name.split(".");
288
+ const reinterpretedLabels = interpretedLabels.map(reinterpretLabel);
289
+ const reinterpretedName = reinterpretedLabels.join(".");
290
+ return reinterpretedName;
291
+ }
166
292
 
167
293
  // src/shared/zod-schemas.ts
168
- import { isAddress } from "viem";
169
- import z from "zod/v4";
170
294
  var makeIntegerSchema = (valueLabel = "Value") => z.int({
171
295
  error: `${valueLabel} must be an integer.`
172
296
  });
@@ -181,10 +305,20 @@ var makeDurationSchema = (valueLabel = "Value") => z.coerce.number({
181
305
  }).pipe(makeNonNegativeIntegerSchema(valueLabel));
182
306
  var makeChainIdSchema = (valueLabel = "Chain ID") => makePositiveIntegerSchema(valueLabel).transform((val) => val);
183
307
  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}`));
308
+ var makeLowercaseAddressSchema = (valueLabel = "EVM address") => z.string().check((ctx) => {
309
+ if (!isAddress2(ctx.value)) {
310
+ ctx.issues.push({
311
+ code: "custom",
312
+ message: `${valueLabel} must be a valid EVM address`,
313
+ input: ctx.value
314
+ });
315
+ }
316
+ }).transform((val) => asLowerCaseAddress(val));
184
317
  var makeDatetimeSchema = (valueLabel = "Datetime string") => z.iso.datetime({ error: `${valueLabel} must be a string in ISO 8601 format.` }).transform((v) => new Date(v));
185
318
  var makeUnixTimestampSchema = (valueLabel = "Timestamp") => makeIntegerSchema(valueLabel);
186
319
  var makeUrlSchema = (valueLabel = "Value") => z.url({
187
- error: `${valueLabel} must be a valid URL string (e.g., http://localhost:8080 or https://example.com).`
320
+ error: `${valueLabel} must be a valid URL string (e.g., http://localhost:8080 or https://example.com).`,
321
+ abort: true
188
322
  }).transform((v) => new URL(v));
189
323
  var makeBlockNumberSchema = (valueLabel = "Block number") => makeNonNegativeIntegerSchema(valueLabel);
190
324
  var makeBlockrangeSchema = (valueLabel = "Value") => z.strictObject(
@@ -218,23 +352,79 @@ var makeENSNamespaceIdSchema = (valueLabel = "ENSNamespaceId") => z.enum(ENSName
218
352
  return `Invalid ${valueLabel}. Supported ENS namespace IDs are: ${Object.keys(ENSNamespaceIds).join(", ")}`;
219
353
  }
220
354
  });
221
-
222
- // src/shared/deserialize.ts
223
- function deserializeChainId(maybeChainId, valueLabel) {
224
- const schema = makeChainIdStringSchema(valueLabel);
225
- const parsed = schema.safeParse(maybeChainId);
226
- if (parsed.error) {
227
- throw new Error(`Cannot deserialize ChainId:
228
- ${prettifyError(parsed.error)}
229
- `);
230
- }
231
- return parsed.data;
232
- }
233
- function deserializeDatetime(maybeDatetime, valueLabel) {
234
- const schema = makeDatetimeSchema(valueLabel);
235
- const parsed = schema.safeParse(maybeDatetime);
236
- if (parsed.error) {
237
- throw new Error(`Cannot deserialize Datetime:
355
+ var makePriceAmountSchema = (valueLabel = "Amount") => z.coerce.bigint({
356
+ error: `${valueLabel} must represent a bigint.`
357
+ }).nonnegative({
358
+ error: `${valueLabel} must not be negative.`
359
+ });
360
+ var makePriceCurrencySchema = (currency, valueLabel = "Price Currency") => z.strictObject({
361
+ amount: makePriceAmountSchema(`${valueLabel} amount`),
362
+ currency: z.literal(currency, {
363
+ error: `${valueLabel} currency must be set to '${currency}'.`
364
+ })
365
+ });
366
+ var makePriceEthSchema = (valueLabel = "Price ETH") => makePriceCurrencySchema(CurrencyIds.ETH, valueLabel).transform((v) => v);
367
+ var makeAccountIdSchema = (valueLabel = "AccountId") => z.strictObject({
368
+ chainId: makeChainIdStringSchema(`${valueLabel} chain ID`),
369
+ address: makeLowercaseAddressSchema(`${valueLabel} address`)
370
+ });
371
+ var makeSerializedAccountIdSchema = (valueLabel = "Account ID") => z.coerce.string().transform((v) => {
372
+ const result = new CaipAccountId(v);
373
+ return {
374
+ chainId: result.chainId.reference,
375
+ address: result.address
376
+ };
377
+ }).pipe(makeAccountIdSchema(valueLabel));
378
+ var makeHexStringSchema = (options, valueLabel = "String representation of bytes array") => z.string().check(function invariant_isHexEncoded(ctx) {
379
+ if (!isHex2(ctx.value)) {
380
+ ctx.issues.push({
381
+ code: "custom",
382
+ input: ctx.value,
383
+ message: `${valueLabel} must start with '0x'.`
384
+ });
385
+ }
386
+ }).transform((v) => v).check(function invariant_encodesRequiredBytesCount(ctx) {
387
+ const expectedBytesCount = options.bytesCount;
388
+ const actualBytesCount = size(ctx.value);
389
+ if (actualBytesCount !== expectedBytesCount) {
390
+ ctx.issues.push({
391
+ code: "custom",
392
+ input: ctx.value,
393
+ message: `${valueLabel} must represent exactly ${expectedBytesCount} bytes. Currently represented bytes count: ${actualBytesCount}.`
394
+ });
395
+ }
396
+ });
397
+ var makeNodeSchema = (valueLabel = "Node") => makeHexStringSchema({ bytesCount: 32 }, valueLabel);
398
+ var makeTransactionHashSchema = (valueLabel = "Transaction hash") => makeHexStringSchema({ bytesCount: 32 }, valueLabel);
399
+ var makeReinterpretedNameSchema = (valueLabel = "Reinterpreted Name") => z.string().transform((v) => v).check((ctx) => {
400
+ try {
401
+ reinterpretName(ctx.value);
402
+ } catch (error) {
403
+ const errorMessage = error instanceof Error ? error.message : "Unknown error";
404
+ ctx.issues.push({
405
+ code: "custom",
406
+ input: ctx.value,
407
+ message: `${valueLabel} cannot be reinterpreted: ${errorMessage}`
408
+ });
409
+ }
410
+ }).transform(reinterpretName);
411
+
412
+ // src/shared/deserialize.ts
413
+ function deserializeChainId(maybeChainId, valueLabel) {
414
+ const schema = makeChainIdStringSchema(valueLabel);
415
+ const parsed = schema.safeParse(maybeChainId);
416
+ if (parsed.error) {
417
+ throw new Error(`Cannot deserialize ChainId:
418
+ ${prettifyError(parsed.error)}
419
+ `);
420
+ }
421
+ return parsed.data;
422
+ }
423
+ function deserializeDatetime(maybeDatetime, valueLabel) {
424
+ const schema = makeDatetimeSchema(valueLabel);
425
+ const parsed = schema.safeParse(maybeDatetime);
426
+ if (parsed.error) {
427
+ throw new Error(`Cannot deserialize Datetime:
238
428
  ${prettifyError(parsed.error)}
239
429
  `);
240
430
  }
@@ -300,12 +490,171 @@ ${prettifyError(parsed.error)}
300
490
  }
301
491
  return parsed.data;
302
492
  }
493
+ function deserializeAccountId(maybeAccountId, valueLabel) {
494
+ const schema = makeSerializedAccountIdSchema(valueLabel);
495
+ const parsed = schema.safeParse(maybeAccountId);
496
+ if (parsed.error) {
497
+ throw new RangeError(`Cannot deserialize AccountId:
498
+ ${prettifyError(parsed.error)}
499
+ `);
500
+ }
501
+ return parsed.data;
502
+ }
303
503
 
304
- // src/shared/account-id.ts
305
- import { isAddressEqual } from "viem";
306
- var accountIdEqual = (a, b) => {
307
- return a.chainId === b.chainId && isAddressEqual(a.address, b.address);
504
+ // src/shared/datetime.ts
505
+ function durationBetween(start, end) {
506
+ return deserializeDuration(end - start, "Duration");
507
+ }
508
+ function addDuration(timestamp, duration) {
509
+ return deserializeUnixTimestamp(timestamp + duration, "UnixTimestamp");
510
+ }
511
+
512
+ // src/shared/cache.ts
513
+ var LruCache = class {
514
+ _cache = /* @__PURE__ */ new Map();
515
+ _capacity;
516
+ /**
517
+ * Create a new LRU cache with the given capacity.
518
+ *
519
+ * @param capacity The maximum number of items in the cache. If set to 0, the cache is effectively disabled.
520
+ * @throws Error if capacity is not a non-negative integer.
521
+ */
522
+ constructor(capacity) {
523
+ if (!Number.isInteger(capacity)) {
524
+ throw new Error(
525
+ `LruCache requires capacity to be an integer but a capacity of ${capacity} was requested.`
526
+ );
527
+ }
528
+ if (capacity < 0) {
529
+ throw new Error(
530
+ `LruCache requires a non-negative capacity but a capacity of ${capacity} was requested.`
531
+ );
532
+ }
533
+ this._capacity = capacity;
534
+ }
535
+ set(key, value) {
536
+ this._cache.set(key, value);
537
+ if (this._cache.size > this._capacity) {
538
+ const oldestKey = this._cache.keys().next().value;
539
+ this._cache.delete(oldestKey);
540
+ }
541
+ }
542
+ get(key) {
543
+ const value = this._cache.get(key);
544
+ if (value) {
545
+ this._cache.delete(key);
546
+ this._cache.set(key, value);
547
+ }
548
+ return value;
549
+ }
550
+ clear() {
551
+ this._cache.clear();
552
+ }
553
+ get size() {
554
+ return this._cache.size;
555
+ }
556
+ get capacity() {
557
+ return this._capacity;
558
+ }
559
+ };
560
+ var TtlCache = class {
561
+ _cache = /* @__PURE__ */ new Map();
562
+ _ttl;
563
+ /**
564
+ * Create a new TTL cache with the given TTL.
565
+ *
566
+ * @param ttl Time-to-live duration in seconds. Items expire after this duration.
567
+ */
568
+ constructor(ttl) {
569
+ this._ttl = ttl;
570
+ }
571
+ _cleanup() {
572
+ const now = getUnixTime(/* @__PURE__ */ new Date());
573
+ for (const [key, entry] of this._cache.entries()) {
574
+ if (entry.expiresAt <= now) {
575
+ this._cache.delete(key);
576
+ }
577
+ }
578
+ }
579
+ set(key, value) {
580
+ this._cleanup();
581
+ const expiresAt = addDuration(getUnixTime(/* @__PURE__ */ new Date()), this._ttl);
582
+ this._cache.set(key, { value, expiresAt });
583
+ }
584
+ get(key) {
585
+ this._cleanup();
586
+ const entry = this._cache.get(key);
587
+ if (!entry) {
588
+ return void 0;
589
+ }
590
+ if (entry.expiresAt <= getUnixTime(/* @__PURE__ */ new Date())) {
591
+ this._cache.delete(key);
592
+ return void 0;
593
+ }
594
+ return entry.value;
595
+ }
596
+ clear() {
597
+ this._cache.clear();
598
+ }
599
+ get size() {
600
+ this._cleanup();
601
+ return this._cache.size;
602
+ }
603
+ get capacity() {
604
+ return Number.MAX_SAFE_INTEGER;
605
+ }
606
+ has(key) {
607
+ this._cleanup();
608
+ const entry = this._cache.get(key);
609
+ if (!entry) {
610
+ return false;
611
+ }
612
+ if (entry.expiresAt <= getUnixTime(/* @__PURE__ */ new Date())) {
613
+ this._cache.delete(key);
614
+ return false;
615
+ }
616
+ return true;
617
+ }
618
+ delete(key) {
619
+ return this._cache.delete(key);
620
+ }
308
621
  };
622
+ function staleWhileRevalidate(options) {
623
+ const { fn, ttl } = options;
624
+ let cache = null;
625
+ let cacheInitializer = null;
626
+ return async () => {
627
+ if (!cache) {
628
+ if (cacheInitializer) {
629
+ return cacheInitializer;
630
+ }
631
+ cacheInitializer = fn().then((value) => {
632
+ cache = { value, updatedAt: getUnixTime(/* @__PURE__ */ new Date()) };
633
+ cacheInitializer = null;
634
+ return value;
635
+ }).catch(() => {
636
+ cacheInitializer = null;
637
+ return null;
638
+ });
639
+ return cacheInitializer;
640
+ }
641
+ const isStale = durationBetween(cache.updatedAt, getUnixTime(/* @__PURE__ */ new Date())) > ttl;
642
+ if (!isStale) return cache.value;
643
+ if (cache.inProgressRevalidation) return cache.value;
644
+ const revalidationPromise = fn().then((value) => {
645
+ cache = { value, updatedAt: getUnixTime(/* @__PURE__ */ new Date()) };
646
+ }).catch(() => {
647
+ if (cache) {
648
+ cache.inProgressRevalidation = void 0;
649
+ }
650
+ });
651
+ cache.inProgressRevalidation = revalidationPromise;
652
+ return cache.value;
653
+ };
654
+ }
655
+
656
+ // src/shared/collections.ts
657
+ var uniq = (arr) => [...new Set(arr)];
309
658
 
310
659
  // src/shared/labelhash.ts
311
660
  import { keccak256 as keccak2562, stringToBytes } from "viem";
@@ -326,317 +675,60 @@ function literalLabelsToLiteralName(labels) {
326
675
  return labels.join(".");
327
676
  }
328
677
 
329
- // src/shared/url.ts
330
- function isHttpProtocol(url) {
331
- return ["http:", "https:"].includes(url.protocol);
332
- }
333
- function isWebSocketProtocol(url) {
334
- return ["ws:", "wss:"].includes(url.protocol);
335
- }
678
+ // src/shared/null-bytes.ts
679
+ var hasNullByte = (value) => value.indexOf("\0") !== -1;
680
+ var stripNullBytes = (value) => value.replaceAll("\0", "");
336
681
 
337
- // src/ens/parse-reverse-name.ts
338
- var REVERSE_NAME_REGEX = /^([0-9a-fA-F]+)\.([0-9a-f]{1,64}|addr|default)\.reverse$/;
339
- var parseAddressLabel = (addressLabel) => {
340
- const maybeAddress = `0x${addressLabel}`;
341
- if (!isAddress2(maybeAddress)) {
342
- throw new Error(`Invalid EVM address "${maybeAddress}"`);
682
+ // src/shared/numbers.ts
683
+ function bigIntToNumber(n) {
684
+ if (n < Number.MIN_SAFE_INTEGER) {
685
+ throw new Error(
686
+ `The bigint '${n.toString()}' value is too low to be to converted into a number.'`
687
+ );
343
688
  }
344
- return asLowerCaseAddress(maybeAddress);
345
- };
346
- var parseCoinTypeLabel = (coinTypeLabel) => {
347
- if (coinTypeLabel === "default") return DEFAULT_EVM_COIN_TYPE;
348
- if (coinTypeLabel === "addr") return ETH_COIN_TYPE;
349
- return bigintToCoinType(hexToBigInt(`0x${coinTypeLabel}`));
350
- };
351
- function parseReverseName(name) {
352
- const match = name.match(REVERSE_NAME_REGEX);
353
- if (!match) return null;
354
- try {
355
- const [, addressLabel, coinTypeLabel] = match;
356
- if (!addressLabel) return null;
357
- if (!coinTypeLabel) return null;
358
- return {
359
- address: parseAddressLabel(addressLabel),
360
- coinType: parseCoinTypeLabel(coinTypeLabel)
361
- };
362
- } catch {
363
- return null;
689
+ if (n > Number.MAX_SAFE_INTEGER) {
690
+ throw new Error(
691
+ `The bigint '${n.toString()}' value is too high to be to converted into a number.'`
692
+ );
364
693
  }
694
+ return Number(n);
365
695
  }
366
696
 
367
- // src/ens/encode-labelhash.ts
368
- var encodeLabelHash = (labelHash) => `[${labelHash.slice(2)}]`;
369
-
370
- // src/ens/dns-encoded-name.ts
371
- import { bytesToString, hexToBytes } from "viem";
372
- function decodeDNSEncodedLiteralName(packet) {
373
- return decodeDNSEncodedName(packet);
697
+ // src/shared/serialize.ts
698
+ import { AccountId as CaipAccountId2 } from "caip";
699
+ function serializeChainId(chainId) {
700
+ return chainId.toString();
374
701
  }
375
- function decodeDNSEncodedName(packet) {
376
- const segments = [];
377
- const bytes = hexToBytes(packet);
378
- if (bytes.length === 0) throw new Error(`Packet is empty.`);
379
- let offset = 0;
380
- while (offset < bytes.length) {
381
- const len = bytes[offset];
382
- if (len === void 0) {
383
- throw new Error(`Invariant: bytes[offset] is undefined after offset < bytes.length check.`);
384
- }
385
- if (len < 0 || len > 255) {
386
- throw new Error(
387
- `Invariant: this should be literally impossible, but an unsigned byte was less than zero or greater than 255. The value in question is ${len}`
388
- );
389
- }
390
- if (len === 0) break;
391
- const segment = bytesToString(bytes.subarray(offset + 1, offset + len + 1));
392
- segments.push(segment);
393
- offset += len + 1;
394
- }
395
- if (offset >= bytes.length) throw new Error(`Overflow, offset >= bytes.length`);
396
- if (offset !== bytes.length - 1) throw new Error(`Junk at end of name`);
397
- return segments;
702
+ function serializeDatetime(datetime) {
703
+ return datetime.toISOString();
398
704
  }
399
-
400
- // src/ens/index.ts
401
- import { getENSRootChainId } from "@ensnode/datasources";
402
-
403
- // src/ensindexer/config/deserialize.ts
404
- import { prettifyError as prettifyError2 } from "zod/v4";
405
-
406
- // src/ensindexer/config/zod-schemas.ts
407
- import z2 from "zod/v4";
408
-
409
- // src/ensindexer/config/helpers.ts
410
- import { ENSNamespaceIds as ENSNamespaceIds2 } from "@ensnode/datasources";
411
-
412
- // src/ensindexer/config/types.ts
413
- var PluginName = /* @__PURE__ */ ((PluginName2) => {
414
- PluginName2["Subgraph"] = "subgraph";
415
- PluginName2["Basenames"] = "basenames";
416
- PluginName2["Lineanames"] = "lineanames";
417
- PluginName2["ThreeDNS"] = "threedns";
418
- PluginName2["ProtocolAcceleration"] = "protocol-acceleration";
419
- PluginName2["Referrals"] = "referrals";
420
- PluginName2["TokenScope"] = "tokenscope";
421
- return PluginName2;
422
- })(PluginName || {});
423
-
424
- // src/ensindexer/config/helpers.ts
425
- function isSubgraphCompatible(config) {
426
- const onlySubgraphPluginActivated = config.plugins.length === 1 && config.plugins[0] === "subgraph" /* Subgraph */;
427
- const isSubgraphLabelSet = config.labelSet.labelSetId === "subgraph" && config.labelSet.labelSetVersion === 0;
428
- const isEnsTestEnvLabelSet = config.labelSet.labelSetId === "ens-test-env" && config.labelSet.labelSetVersion === 0;
429
- const labelSetIsSubgraphCompatible = isSubgraphLabelSet || config.namespace === ENSNamespaceIds2.EnsTestEnv && isEnsTestEnvLabelSet;
430
- return onlySubgraphPluginActivated && labelSetIsSubgraphCompatible;
705
+ function serializeUrl(url) {
706
+ return url.toString();
431
707
  }
432
-
433
- // src/ensindexer/config/validations.ts
434
- function invariant_ensDbVersionIsSameAsEnsIndexerVersion(ctx) {
435
- const versionInfo = ctx.value;
436
- if (versionInfo.ensDb !== versionInfo.ensIndexer) {
437
- ctx.issues.push({
438
- code: "custom",
439
- input: versionInfo,
440
- message: "`ensDb` version must be same as `ensIndexer` version"
441
- });
442
- }
708
+ function serializePrice(price) {
709
+ return {
710
+ currency: price.currency,
711
+ amount: price.amount.toString()
712
+ };
713
+ }
714
+ function serializePriceEth(price) {
715
+ return serializePrice(price);
716
+ }
717
+ function serializeAccountId(accountId) {
718
+ return CaipAccountId2.format({
719
+ chainId: { namespace: "eip155", reference: accountId.chainId.toString() },
720
+ address: accountId.address
721
+ }).toLowerCase();
443
722
  }
444
723
 
445
- // src/ensindexer/config/zod-schemas.ts
446
- var makeIndexedChainIdsSchema = (valueLabel = "Indexed Chain IDs") => z2.array(makeChainIdSchema(valueLabel), {
447
- error: `${valueLabel} must be an array.`
448
- }).min(1, { error: `${valueLabel} list must include at least one element.` }).transform((v) => new Set(v));
449
- var makePluginsListSchema = (valueLabel = "Plugins") => z2.array(z2.string(), {
450
- error: `${valueLabel} must be a list of strings.`
451
- }).min(1, {
452
- error: `${valueLabel} must be a list of strings with at least one string value`
453
- }).refine((arr) => arr.length === uniq(arr).length, {
454
- error: `${valueLabel} cannot contain duplicate values.`
455
- });
456
- var makeDatabaseSchemaNameSchema = (valueLabel = "Database schema name") => z2.string({ error: `${valueLabel} must be a string` }).trim().nonempty({
457
- error: `${valueLabel} is required and must be a non-empty string.`
458
- });
459
- var makeLabelSetIdSchema = (valueLabel) => {
460
- return z2.string({ error: `${valueLabel} must be a string` }).min(1, { error: `${valueLabel} must be 1-50 characters long` }).max(50, { error: `${valueLabel} must be 1-50 characters long` }).regex(/^[a-z-]+$/, {
461
- error: `${valueLabel} can only contain lowercase letters (a-z) and hyphens (-)`
462
- });
463
- };
464
- var makeLabelSetVersionSchema = (valueLabel) => {
465
- return z2.coerce.number({ error: `${valueLabel} must be an integer.` }).pipe(makeNonNegativeIntegerSchema(valueLabel));
466
- };
467
- var makeFullyPinnedLabelSetSchema = (valueLabel = "Label set") => {
468
- let valueLabelLabelSetId = valueLabel;
469
- let valueLabelLabelSetVersion = valueLabel;
470
- if (valueLabel == "LABEL_SET") {
471
- valueLabelLabelSetId = "LABEL_SET_ID";
472
- valueLabelLabelSetVersion = "LABEL_SET_VERSION";
473
- } else {
474
- valueLabelLabelSetId = valueLabel + ".labelSetId";
475
- valueLabelLabelSetVersion = valueLabel + ".labelSetVersion";
476
- }
477
- return z2.object({
478
- labelSetId: makeLabelSetIdSchema(valueLabelLabelSetId),
479
- labelSetVersion: makeLabelSetVersionSchema(valueLabelLabelSetVersion)
480
- });
481
- };
482
- var makeNonEmptyStringSchema = (valueLabel = "Value") => z2.string().nonempty({ error: `${valueLabel} must be a non-empty string.` });
483
- var makeENSIndexerVersionInfoSchema = (valueLabel = "Value") => z2.strictObject(
484
- {
485
- nodejs: makeNonEmptyStringSchema(),
486
- ponder: makeNonEmptyStringSchema(),
487
- ensDb: makeNonEmptyStringSchema(),
488
- ensIndexer: makeNonEmptyStringSchema(),
489
- ensNormalize: makeNonEmptyStringSchema(),
490
- ensRainbow: makeNonEmptyStringSchema(),
491
- ensRainbowSchema: makePositiveIntegerSchema()
492
- },
493
- {
494
- error: `${valueLabel} must be a valid ENSIndexerVersionInfo object.`
495
- }
496
- ).check(invariant_ensDbVersionIsSameAsEnsIndexerVersion);
497
- function invariant_isSubgraphCompatibleRequirements(ctx) {
498
- const { value: config } = ctx;
499
- if (config.isSubgraphCompatible && !isSubgraphCompatible(config)) {
500
- ctx.issues.push({
501
- code: "custom",
502
- input: config,
503
- message: `'isSubgraphCompatible' requires only the '${"subgraph" /* Subgraph */}' plugin to be active and labelSet must be {labelSetId: "subgraph", labelSetVersion: 0}`
504
- });
505
- }
506
- }
507
- var makeENSIndexerPublicConfigSchema = (valueLabel = "ENSIndexerPublicConfig") => z2.object({
508
- labelSet: makeFullyPinnedLabelSetSchema(`${valueLabel}.labelSet`),
509
- indexedChainIds: makeIndexedChainIdsSchema(`${valueLabel}.indexedChainIds`),
510
- isSubgraphCompatible: z2.boolean({ error: `${valueLabel}.isSubgraphCompatible` }),
511
- namespace: makeENSNamespaceIdSchema(`${valueLabel}.namespace`),
512
- plugins: makePluginsListSchema(`${valueLabel}.plugins`),
513
- databaseSchemaName: makeDatabaseSchemaNameSchema(`${valueLabel}.databaseSchemaName`),
514
- versionInfo: makeENSIndexerVersionInfoSchema(`${valueLabel}.versionInfo`)
515
- }).check(invariant_isSubgraphCompatibleRequirements);
516
-
517
- // src/ensindexer/config/deserialize.ts
518
- function deserializeENSIndexerPublicConfig(maybeConfig, valueLabel) {
519
- const schema = makeENSIndexerPublicConfigSchema(valueLabel);
520
- const parsed = schema.safeParse(maybeConfig);
521
- if (parsed.error) {
522
- throw new Error(`Cannot deserialize ENSIndexerPublicConfig:
523
- ${prettifyError2(parsed.error)}
524
- `);
525
- }
526
- return parsed.data;
527
- }
528
-
529
- // src/ensindexer/config/serialize.ts
530
- function serializeIndexedChainIds(indexedChainIds) {
531
- return Array.from(indexedChainIds);
532
- }
533
- function serializeENSIndexerPublicConfig(config) {
534
- const {
535
- labelSet,
536
- indexedChainIds,
537
- databaseSchemaName,
538
- isSubgraphCompatible: isSubgraphCompatible2,
539
- namespace,
540
- plugins,
541
- versionInfo
542
- } = config;
543
- return {
544
- labelSet,
545
- indexedChainIds: serializeIndexedChainIds(indexedChainIds),
546
- databaseSchemaName,
547
- isSubgraphCompatible: isSubgraphCompatible2,
548
- namespace,
549
- plugins,
550
- versionInfo
551
- };
552
- }
553
-
554
- // src/ensindexer/config/labelset-utils.ts
555
- function buildLabelSetId(maybeLabelSetId) {
556
- return makeLabelSetIdSchema("LabelSetId").parse(maybeLabelSetId);
557
- }
558
- function buildLabelSetVersion(maybeLabelSetVersion) {
559
- return makeLabelSetVersionSchema("LabelSetVersion").parse(maybeLabelSetVersion);
560
- }
561
- function buildEnsRainbowClientLabelSet(labelSetId, labelSetVersion) {
562
- if (labelSetVersion !== void 0 && labelSetId === void 0) {
563
- throw new Error("When a labelSetVersion is defined, labelSetId must also be defined.");
564
- }
565
- return { labelSetId, labelSetVersion };
566
- }
567
- function validateSupportedLabelSetAndVersion(serverSet, clientSet) {
568
- if (clientSet.labelSetId === void 0) {
569
- return;
570
- }
571
- if (serverSet.labelSetId !== clientSet.labelSetId) {
572
- throw new Error(
573
- `Server label set ID "${serverSet.labelSetId}" does not match client's requested label set ID "${clientSet.labelSetId}".`
574
- );
575
- }
576
- if (clientSet.labelSetVersion !== void 0 && serverSet.highestLabelSetVersion < clientSet.labelSetVersion) {
577
- throw new Error(
578
- `Server highest label set version ${serverSet.highestLabelSetVersion} is less than client's requested version ${clientSet.labelSetVersion} for label set ID "${clientSet.labelSetId}".`
579
- );
580
- }
581
- }
582
-
583
- // src/ensindexer/config/label-utils.ts
584
- import { hexToBytes as hexToBytes2 } from "viem";
585
- function labelHashToBytes(labelHash) {
586
- try {
587
- if (labelHash.length !== 66) {
588
- throw new Error(`Invalid labelHash length ${labelHash.length} characters (expected 66)`);
589
- }
590
- if (labelHash !== labelHash.toLowerCase()) {
591
- throw new Error("Labelhash must be in lowercase");
592
- }
593
- if (!labelHash.startsWith("0x")) {
594
- throw new Error("Labelhash must be 0x-prefixed");
595
- }
596
- const bytes = hexToBytes2(labelHash);
597
- if (bytes.length !== 32) {
598
- throw new Error(`Invalid labelHash length ${bytes.length} bytes (expected 32)`);
599
- }
600
- return bytes;
601
- } catch (e) {
602
- if (e instanceof Error) {
603
- throw e;
604
- }
605
- throw new Error("Invalid hex format");
606
- }
724
+ // src/shared/url.ts
725
+ function isHttpProtocol(url) {
726
+ return ["http:", "https:"].includes(url.protocol);
607
727
  }
608
-
609
- // src/ensindexer/config/parsing.ts
610
- function parseNonNegativeInteger(maybeNumber) {
611
- const trimmed = maybeNumber.trim();
612
- if (!trimmed) {
613
- throw new Error("Input cannot be empty");
614
- }
615
- if (trimmed === "-0") {
616
- throw new Error("Negative zero is not a valid non-negative integer");
617
- }
618
- const num = Number(maybeNumber);
619
- if (Number.isNaN(num)) {
620
- throw new Error(`"${maybeNumber}" is not a valid number`);
621
- }
622
- if (!Number.isFinite(num)) {
623
- throw new Error(`"${maybeNumber}" is not a finite number`);
624
- }
625
- if (!Number.isInteger(num)) {
626
- throw new Error(`"${maybeNumber}" is not an integer`);
627
- }
628
- if (num < 0) {
629
- throw new Error(`"${maybeNumber}" is not a non-negative integer`);
630
- }
631
- return num;
728
+ function isWebSocketProtocol(url) {
729
+ return ["ws:", "wss:"].includes(url.protocol);
632
730
  }
633
731
 
634
- // src/ensindexer/indexing-status/deserialize.ts
635
- import { prettifyError as prettifyError3 } from "zod/v4";
636
-
637
- // src/ensindexer/indexing-status/zod-schemas.ts
638
- import z3 from "zod/v4";
639
-
640
732
  // src/ensindexer/indexing-status/types.ts
641
733
  var ChainIndexingConfigTypeIds = {
642
734
  /**
@@ -761,7 +853,7 @@ function getTimestampForHighestOmnichainKnownBlock(chains) {
761
853
  for (const chain of chains) {
762
854
  switch (chain.chainStatus) {
763
855
  case ChainIndexingStatusIds.Queued:
764
- if (chain.config.endBlock) {
856
+ if (chain.config.configType === ChainIndexingConfigTypeIds.Definite && chain.config.endBlock) {
765
857
  latestKnownBlockTimestamps.push(chain.config.endBlock.timestamp);
766
858
  }
767
859
  break;
@@ -839,6 +931,9 @@ function sortChainStatusesByStartBlockAsc(chains) {
839
931
  // src/ensindexer/indexing-status/validations.ts
840
932
  function invariant_chainSnapshotQueuedBlocks(ctx) {
841
933
  const { config } = ctx.value;
934
+ if (config.configType === ChainIndexingConfigTypeIds.Indefinite) {
935
+ return;
936
+ }
842
937
  if (config.endBlock && isBeforeOrEqualTo(config.startBlock, config.endBlock) === false) {
843
938
  ctx.issues.push({
844
939
  code: "custom",
@@ -863,6 +958,9 @@ function invariant_chainSnapshotBackfillBlocks(ctx) {
863
958
  message: "`latestIndexedBlock` must be before or same as `backfillEndBlock`."
864
959
  });
865
960
  }
961
+ if (config.configType === ChainIndexingConfigTypeIds.Indefinite) {
962
+ return;
963
+ }
866
964
  if (config.endBlock && isEqualTo(backfillEndBlock, config.endBlock) === false) {
867
965
  ctx.issues.push({
868
966
  code: "custom",
@@ -1000,188 +1098,809 @@ function invariant_omnichainStatusSnapshotBackfillHasValidChains(ctx) {
1000
1098
  });
1001
1099
  }
1002
1100
  }
1003
- function invariant_omnichainStatusSnapshotCompletedHasValidChains(ctx) {
1004
- const chains = ctx.value;
1005
- const hasValidChains = checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotCompleted(
1006
- Array.from(chains.values())
1007
- );
1008
- if (hasValidChains === false) {
1009
- ctx.issues.push({
1010
- code: "custom",
1011
- input: chains,
1012
- message: `For omnichain status snapshot 'completed', all chains must have "completed" status.`
1013
- });
1014
- }
1101
+ function invariant_omnichainStatusSnapshotCompletedHasValidChains(ctx) {
1102
+ const chains = ctx.value;
1103
+ const hasValidChains = checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotCompleted(
1104
+ Array.from(chains.values())
1105
+ );
1106
+ if (hasValidChains === false) {
1107
+ ctx.issues.push({
1108
+ code: "custom",
1109
+ input: chains,
1110
+ message: `For omnichain status snapshot 'completed', all chains must have "completed" status.`
1111
+ });
1112
+ }
1113
+ }
1114
+ function invariant_slowestChainEqualsToOmnichainSnapshotTime(ctx) {
1115
+ const { slowestChainIndexingCursor, omnichainSnapshot } = ctx.value;
1116
+ const { omnichainIndexingCursor } = omnichainSnapshot;
1117
+ if (slowestChainIndexingCursor !== omnichainIndexingCursor) {
1118
+ console.log("invariant_slowestChainEqualsToOmnichainSnapshotTime", {
1119
+ slowestChainIndexingCursor,
1120
+ omnichainIndexingCursor
1121
+ });
1122
+ ctx.issues.push({
1123
+ code: "custom",
1124
+ input: ctx.value,
1125
+ message: `'slowestChainIndexingCursor' must be equal to 'omnichainSnapshot.omnichainIndexingCursor'`
1126
+ });
1127
+ }
1128
+ }
1129
+ function invariant_snapshotTimeIsTheHighestKnownBlockTimestamp(ctx) {
1130
+ const { snapshotTime, omnichainSnapshot } = ctx.value;
1131
+ const chains = Array.from(omnichainSnapshot.chains.values());
1132
+ const startBlockTimestamps = chains.map((chain) => chain.config.startBlock.timestamp);
1133
+ const endBlockTimestamps = chains.map((chain) => chain.config).filter((chainConfig) => chainConfig.configType === ChainIndexingConfigTypeIds.Definite).map((chainConfig) => chainConfig.endBlock.timestamp);
1134
+ const backfillEndBlockTimestamps = chains.filter((chain) => chain.chainStatus === ChainIndexingStatusIds.Backfill).map((chain) => chain.backfillEndBlock.timestamp);
1135
+ const latestKnownBlockTimestamps = chains.filter((chain) => chain.chainStatus === ChainIndexingStatusIds.Following).map((chain) => chain.latestKnownBlock.timestamp);
1136
+ const highestKnownBlockTimestamp = Math.max(
1137
+ ...startBlockTimestamps,
1138
+ ...endBlockTimestamps,
1139
+ ...backfillEndBlockTimestamps,
1140
+ ...latestKnownBlockTimestamps
1141
+ );
1142
+ if (snapshotTime < highestKnownBlockTimestamp) {
1143
+ ctx.issues.push({
1144
+ code: "custom",
1145
+ input: ctx.value,
1146
+ message: `'snapshotTime' must be greater than or equal to the "highest known block timestamp" (${highestKnownBlockTimestamp})`
1147
+ });
1148
+ }
1149
+ }
1150
+ function invariant_realtimeIndexingStatusProjectionProjectedAtIsAfterOrEqualToSnapshotTime(ctx) {
1151
+ const projection = ctx.value;
1152
+ const { snapshot, projectedAt } = projection;
1153
+ if (snapshot.snapshotTime > projectedAt) {
1154
+ ctx.issues.push({
1155
+ code: "custom",
1156
+ input: projection,
1157
+ message: "`projectedAt` must be after or same as `snapshot.snapshotTime`."
1158
+ });
1159
+ }
1160
+ }
1161
+ function invariant_realtimeIndexingStatusProjectionWorstCaseDistanceIsCorrect(ctx) {
1162
+ const projection = ctx.value;
1163
+ const { projectedAt, snapshot, worstCaseDistance } = projection;
1164
+ const { omnichainSnapshot } = snapshot;
1165
+ const expectedWorstCaseDistance = projectedAt - omnichainSnapshot.omnichainIndexingCursor;
1166
+ if (worstCaseDistance !== expectedWorstCaseDistance) {
1167
+ ctx.issues.push({
1168
+ code: "custom",
1169
+ input: projection,
1170
+ message: "`worstCaseDistance` must be the exact difference between `projectedAt` and `snapshot.omnichainIndexingCursor`."
1171
+ });
1172
+ }
1173
+ }
1174
+
1175
+ // src/ensindexer/indexing-status/zod-schemas.ts
1176
+ var makeChainIndexingConfigSchema = (valueLabel = "Value") => z2.discriminatedUnion("configType", [
1177
+ z2.strictObject({
1178
+ configType: z2.literal(ChainIndexingConfigTypeIds.Indefinite),
1179
+ startBlock: makeBlockRefSchema(valueLabel)
1180
+ }),
1181
+ z2.strictObject({
1182
+ configType: z2.literal(ChainIndexingConfigTypeIds.Definite),
1183
+ startBlock: makeBlockRefSchema(valueLabel),
1184
+ endBlock: makeBlockRefSchema(valueLabel)
1185
+ })
1186
+ ]);
1187
+ var makeChainIndexingStatusSnapshotQueuedSchema = (valueLabel = "Value") => z2.strictObject({
1188
+ chainStatus: z2.literal(ChainIndexingStatusIds.Queued),
1189
+ config: makeChainIndexingConfigSchema(valueLabel)
1190
+ }).check(invariant_chainSnapshotQueuedBlocks);
1191
+ var makeChainIndexingStatusSnapshotBackfillSchema = (valueLabel = "Value") => z2.strictObject({
1192
+ chainStatus: z2.literal(ChainIndexingStatusIds.Backfill),
1193
+ config: makeChainIndexingConfigSchema(valueLabel),
1194
+ latestIndexedBlock: makeBlockRefSchema(valueLabel),
1195
+ backfillEndBlock: makeBlockRefSchema(valueLabel)
1196
+ }).check(invariant_chainSnapshotBackfillBlocks);
1197
+ var makeChainIndexingStatusSnapshotCompletedSchema = (valueLabel = "Value") => z2.strictObject({
1198
+ chainStatus: z2.literal(ChainIndexingStatusIds.Completed),
1199
+ config: z2.strictObject({
1200
+ configType: z2.literal(ChainIndexingConfigTypeIds.Definite),
1201
+ startBlock: makeBlockRefSchema(valueLabel),
1202
+ endBlock: makeBlockRefSchema(valueLabel)
1203
+ }),
1204
+ latestIndexedBlock: makeBlockRefSchema(valueLabel)
1205
+ }).check(invariant_chainSnapshotCompletedBlocks);
1206
+ var makeChainIndexingStatusSnapshotFollowingSchema = (valueLabel = "Value") => z2.strictObject({
1207
+ chainStatus: z2.literal(ChainIndexingStatusIds.Following),
1208
+ config: z2.strictObject({
1209
+ configType: z2.literal(ChainIndexingConfigTypeIds.Indefinite),
1210
+ startBlock: makeBlockRefSchema(valueLabel)
1211
+ }),
1212
+ latestIndexedBlock: makeBlockRefSchema(valueLabel),
1213
+ latestKnownBlock: makeBlockRefSchema(valueLabel)
1214
+ }).check(invariant_chainSnapshotFollowingBlocks);
1215
+ var makeChainIndexingStatusSnapshotSchema = (valueLabel = "Value") => z2.discriminatedUnion("chainStatus", [
1216
+ makeChainIndexingStatusSnapshotQueuedSchema(valueLabel),
1217
+ makeChainIndexingStatusSnapshotBackfillSchema(valueLabel),
1218
+ makeChainIndexingStatusSnapshotCompletedSchema(valueLabel),
1219
+ makeChainIndexingStatusSnapshotFollowingSchema(valueLabel)
1220
+ ]);
1221
+ var makeChainIndexingStatusesSchema = (valueLabel = "Value") => z2.record(makeChainIdStringSchema(), makeChainIndexingStatusSnapshotSchema(valueLabel), {
1222
+ error: "Chains indexing statuses must be an object mapping valid chain IDs to their indexing status snapshots."
1223
+ }).transform((serializedChainsIndexingStatus) => {
1224
+ const chainsIndexingStatus = /* @__PURE__ */ new Map();
1225
+ for (const [chainIdString, chainStatus] of Object.entries(serializedChainsIndexingStatus)) {
1226
+ chainsIndexingStatus.set(deserializeChainId(chainIdString), chainStatus);
1227
+ }
1228
+ return chainsIndexingStatus;
1229
+ });
1230
+ var makeOmnichainIndexingStatusSnapshotUnstartedSchema = (valueLabel) => z2.strictObject({
1231
+ omnichainStatus: z2.literal(OmnichainIndexingStatusIds.Unstarted),
1232
+ chains: makeChainIndexingStatusesSchema(valueLabel).check(invariant_omnichainSnapshotUnstartedHasValidChains).transform((chains) => chains),
1233
+ omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
1234
+ });
1235
+ var makeOmnichainIndexingStatusSnapshotBackfillSchema = (valueLabel) => z2.strictObject({
1236
+ omnichainStatus: z2.literal(OmnichainIndexingStatusIds.Backfill),
1237
+ chains: makeChainIndexingStatusesSchema(valueLabel).check(invariant_omnichainStatusSnapshotBackfillHasValidChains).transform(
1238
+ (chains) => chains
1239
+ ),
1240
+ omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
1241
+ });
1242
+ var makeOmnichainIndexingStatusSnapshotCompletedSchema = (valueLabel) => z2.strictObject({
1243
+ omnichainStatus: z2.literal(OmnichainIndexingStatusIds.Completed),
1244
+ chains: makeChainIndexingStatusesSchema(valueLabel).check(invariant_omnichainStatusSnapshotCompletedHasValidChains).transform((chains) => chains),
1245
+ omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
1246
+ });
1247
+ var makeOmnichainIndexingStatusSnapshotFollowingSchema = (valueLabel) => z2.strictObject({
1248
+ omnichainStatus: z2.literal(OmnichainIndexingStatusIds.Following),
1249
+ chains: makeChainIndexingStatusesSchema(valueLabel),
1250
+ omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
1251
+ });
1252
+ var makeOmnichainIndexingStatusSnapshotSchema = (valueLabel = "Omnichain Indexing Snapshot") => z2.discriminatedUnion("omnichainStatus", [
1253
+ makeOmnichainIndexingStatusSnapshotUnstartedSchema(valueLabel),
1254
+ makeOmnichainIndexingStatusSnapshotBackfillSchema(valueLabel),
1255
+ makeOmnichainIndexingStatusSnapshotCompletedSchema(valueLabel),
1256
+ makeOmnichainIndexingStatusSnapshotFollowingSchema(valueLabel)
1257
+ ]).check(invariant_omnichainSnapshotStatusIsConsistentWithChainSnapshot).check(invariant_omnichainIndexingCursorLowerThanEarliestStartBlockAcrossQueuedChains).check(
1258
+ invariant_omnichainIndexingCursorLowerThanOrEqualToLatestBackfillEndBlockAcrossBackfillChains
1259
+ ).check(invariant_omnichainIndexingCursorIsEqualToHighestLatestIndexedBlockAcrossIndexedChain);
1260
+ var makeCrossChainIndexingStatusSnapshotOmnichainSchema = (valueLabel = "Cross-chain Indexing Status Snapshot Omnichain") => z2.strictObject({
1261
+ strategy: z2.literal(CrossChainIndexingStrategyIds.Omnichain),
1262
+ slowestChainIndexingCursor: makeUnixTimestampSchema(valueLabel),
1263
+ snapshotTime: makeUnixTimestampSchema(valueLabel),
1264
+ omnichainSnapshot: makeOmnichainIndexingStatusSnapshotSchema(valueLabel)
1265
+ }).check(invariant_slowestChainEqualsToOmnichainSnapshotTime).check(invariant_snapshotTimeIsTheHighestKnownBlockTimestamp);
1266
+ var makeCrossChainIndexingStatusSnapshotSchema = (valueLabel = "Cross-chain Indexing Status Snapshot") => z2.discriminatedUnion("strategy", [
1267
+ makeCrossChainIndexingStatusSnapshotOmnichainSchema(valueLabel)
1268
+ ]);
1269
+ var makeRealtimeIndexingStatusProjectionSchema = (valueLabel = "Realtime Indexing Status Projection") => z2.strictObject({
1270
+ projectedAt: makeUnixTimestampSchema(valueLabel),
1271
+ worstCaseDistance: makeDurationSchema(valueLabel),
1272
+ snapshot: makeCrossChainIndexingStatusSnapshotSchema(valueLabel)
1273
+ }).check(invariant_realtimeIndexingStatusProjectionProjectedAtIsAfterOrEqualToSnapshotTime).check(invariant_realtimeIndexingStatusProjectionWorstCaseDistanceIsCorrect);
1274
+
1275
+ // src/ensindexer/config/zod-schemas.ts
1276
+ import z3 from "zod/v4";
1277
+
1278
+ // src/ensindexer/config/is-subgraph-compatible.ts
1279
+ import { ENSNamespaceIds as ENSNamespaceIds2 } from "@ensnode/datasources";
1280
+
1281
+ // src/ensindexer/config/types.ts
1282
+ var PluginName = /* @__PURE__ */ ((PluginName2) => {
1283
+ PluginName2["Subgraph"] = "subgraph";
1284
+ PluginName2["Basenames"] = "basenames";
1285
+ PluginName2["Lineanames"] = "lineanames";
1286
+ PluginName2["ThreeDNS"] = "threedns";
1287
+ PluginName2["ProtocolAcceleration"] = "protocol-acceleration";
1288
+ PluginName2["Registrars"] = "registrars";
1289
+ PluginName2["TokenScope"] = "tokenscope";
1290
+ return PluginName2;
1291
+ })(PluginName || {});
1292
+
1293
+ // src/ensindexer/config/is-subgraph-compatible.ts
1294
+ function isSubgraphCompatible(config) {
1295
+ const onlySubgraphPluginActivated = config.plugins.length === 1 && config.plugins[0] === "subgraph" /* Subgraph */;
1296
+ const isSubgraphLabelSet = config.labelSet.labelSetId === "subgraph" && config.labelSet.labelSetVersion === 0;
1297
+ const isEnsTestEnvLabelSet = config.labelSet.labelSetId === "ens-test-env" && config.labelSet.labelSetVersion === 0;
1298
+ const labelSetIsSubgraphCompatible = isSubgraphLabelSet || config.namespace === ENSNamespaceIds2.EnsTestEnv && isEnsTestEnvLabelSet;
1299
+ return onlySubgraphPluginActivated && labelSetIsSubgraphCompatible;
1300
+ }
1301
+
1302
+ // src/ensindexer/config/validations.ts
1303
+ function invariant_ensDbVersionIsSameAsEnsIndexerVersion(ctx) {
1304
+ const versionInfo = ctx.value;
1305
+ if (versionInfo.ensDb !== versionInfo.ensIndexer) {
1306
+ ctx.issues.push({
1307
+ code: "custom",
1308
+ input: versionInfo,
1309
+ message: "`ensDb` version must be same as `ensIndexer` version"
1310
+ });
1311
+ }
1312
+ }
1313
+
1314
+ // src/ensindexer/config/zod-schemas.ts
1315
+ var makeIndexedChainIdsSchema = (valueLabel = "Indexed Chain IDs") => z3.array(makeChainIdSchema(valueLabel), {
1316
+ error: `${valueLabel} must be an array.`
1317
+ }).min(1, { error: `${valueLabel} list must include at least one element.` }).transform((v) => new Set(v));
1318
+ var makePluginsListSchema = (valueLabel = "Plugins") => z3.array(z3.string(), {
1319
+ error: `${valueLabel} must be a list of strings.`
1320
+ }).min(1, {
1321
+ error: `${valueLabel} must be a list of strings with at least one string value`
1322
+ }).refine((arr) => arr.length === uniq(arr).length, {
1323
+ error: `${valueLabel} cannot contain duplicate values.`
1324
+ });
1325
+ var makeDatabaseSchemaNameSchema = (valueLabel = "Database schema name") => z3.string({ error: `${valueLabel} must be a string` }).trim().nonempty({
1326
+ error: `${valueLabel} is required and must be a non-empty string.`
1327
+ });
1328
+ var makeLabelSetIdSchema = (valueLabel) => {
1329
+ return z3.string({ error: `${valueLabel} must be a string` }).min(1, { error: `${valueLabel} must be 1-50 characters long` }).max(50, { error: `${valueLabel} must be 1-50 characters long` }).regex(/^[a-z-]+$/, {
1330
+ error: `${valueLabel} can only contain lowercase letters (a-z) and hyphens (-)`
1331
+ });
1332
+ };
1333
+ var makeLabelSetVersionSchema = (valueLabel) => {
1334
+ return z3.coerce.number({ error: `${valueLabel} must be an integer.` }).pipe(makeNonNegativeIntegerSchema(valueLabel));
1335
+ };
1336
+ var makeFullyPinnedLabelSetSchema = (valueLabel = "Label set") => {
1337
+ let valueLabelLabelSetId = valueLabel;
1338
+ let valueLabelLabelSetVersion = valueLabel;
1339
+ if (valueLabel === "LABEL_SET") {
1340
+ valueLabelLabelSetId = "LABEL_SET_ID";
1341
+ valueLabelLabelSetVersion = "LABEL_SET_VERSION";
1342
+ } else {
1343
+ valueLabelLabelSetId = `${valueLabel}.labelSetId`;
1344
+ valueLabelLabelSetVersion = `${valueLabel}.labelSetVersion`;
1345
+ }
1346
+ return z3.object({
1347
+ labelSetId: makeLabelSetIdSchema(valueLabelLabelSetId),
1348
+ labelSetVersion: makeLabelSetVersionSchema(valueLabelLabelSetVersion)
1349
+ });
1350
+ };
1351
+ var makeNonEmptyStringSchema = (valueLabel = "Value") => z3.string().nonempty({ error: `${valueLabel} must be a non-empty string.` });
1352
+ var makeENSIndexerVersionInfoSchema = (valueLabel = "Value") => z3.strictObject(
1353
+ {
1354
+ nodejs: makeNonEmptyStringSchema(),
1355
+ ponder: makeNonEmptyStringSchema(),
1356
+ ensDb: makeNonEmptyStringSchema(),
1357
+ ensIndexer: makeNonEmptyStringSchema(),
1358
+ ensNormalize: makeNonEmptyStringSchema(),
1359
+ ensRainbow: makeNonEmptyStringSchema(),
1360
+ ensRainbowSchema: makePositiveIntegerSchema()
1361
+ },
1362
+ {
1363
+ error: `${valueLabel} must be a valid ENSIndexerVersionInfo object.`
1364
+ }
1365
+ ).check(invariant_ensDbVersionIsSameAsEnsIndexerVersion);
1366
+ function invariant_isSubgraphCompatibleRequirements(ctx) {
1367
+ const { value: config } = ctx;
1368
+ if (config.isSubgraphCompatible && !isSubgraphCompatible(config)) {
1369
+ ctx.issues.push({
1370
+ code: "custom",
1371
+ input: config,
1372
+ message: `'isSubgraphCompatible' requires only the '${"subgraph" /* Subgraph */}' plugin to be active and labelSet must be {labelSetId: "subgraph", labelSetVersion: 0}`
1373
+ });
1374
+ }
1375
+ }
1376
+ var makeENSIndexerPublicConfigSchema = (valueLabel = "ENSIndexerPublicConfig") => z3.object({
1377
+ labelSet: makeFullyPinnedLabelSetSchema(`${valueLabel}.labelSet`),
1378
+ indexedChainIds: makeIndexedChainIdsSchema(`${valueLabel}.indexedChainIds`),
1379
+ isSubgraphCompatible: z3.boolean({ error: `${valueLabel}.isSubgraphCompatible` }),
1380
+ namespace: makeENSNamespaceIdSchema(`${valueLabel}.namespace`),
1381
+ plugins: makePluginsListSchema(`${valueLabel}.plugins`),
1382
+ databaseSchemaName: makeDatabaseSchemaNameSchema(`${valueLabel}.databaseSchemaName`),
1383
+ versionInfo: makeENSIndexerVersionInfoSchema(`${valueLabel}.versionInfo`)
1384
+ }).check(invariant_isSubgraphCompatibleRequirements);
1385
+
1386
+ // src/shared/config/build-rpc-urls.ts
1387
+ import {
1388
+ arbitrum,
1389
+ arbitrumSepolia,
1390
+ base,
1391
+ baseSepolia,
1392
+ holesky,
1393
+ linea,
1394
+ lineaSepolia,
1395
+ mainnet,
1396
+ optimism,
1397
+ optimismSepolia,
1398
+ scroll,
1399
+ scrollSepolia,
1400
+ sepolia
1401
+ } from "viem/chains";
1402
+
1403
+ // src/shared/config/rpc-configs-from-env.ts
1404
+ import { getENSNamespace } from "@ensnode/datasources";
1405
+
1406
+ // src/shared/config/validatons.ts
1407
+ import { getENSRootChainId as getENSRootChainId2 } from "@ensnode/datasources";
1408
+ function invariant_rpcEndpointConfigIncludesAtLeastOneHTTPProtocolURL(ctx) {
1409
+ const endpoints = ctx.value;
1410
+ const httpEndpoints = endpoints.filter(isHttpProtocol);
1411
+ if (httpEndpoints.length < 1) {
1412
+ ctx.issues.push({
1413
+ code: "custom",
1414
+ input: endpoints,
1415
+ message: `RPC endpoint configuration for a chain must include at least one http/https protocol URL.`
1416
+ });
1417
+ }
1418
+ }
1419
+ function invariant_rpcEndpointConfigIncludesAtMostOneWebSocketsProtocolURL(ctx) {
1420
+ const endpoints = ctx.value;
1421
+ const wsEndpoints = endpoints.filter(isWebSocketProtocol);
1422
+ if (wsEndpoints.length > 1) {
1423
+ ctx.issues.push({
1424
+ code: "custom",
1425
+ input: endpoints,
1426
+ message: `RPC endpoint configuration for a chain must include at most one websocket (ws/wss) protocol URL.`
1427
+ });
1428
+ }
1429
+ }
1430
+
1431
+ // src/shared/config/zod-schemas.ts
1432
+ import { z as z4 } from "zod/v4";
1433
+ import { ENSNamespaceIds as ENSNamespaceIds3 } from "@ensnode/datasources";
1434
+ var DatabaseSchemaNameSchema = z4.string({
1435
+ error: "DATABASE_SCHEMA is required."
1436
+ }).trim().min(1, {
1437
+ error: "DATABASE_SCHEMA is required and cannot be an empty string."
1438
+ });
1439
+ var RpcConfigSchema = z4.string().transform((val) => val.split(",")).pipe(z4.array(makeUrlSchema("RPC URL"))).check(invariant_rpcEndpointConfigIncludesAtLeastOneHTTPProtocolURL).check(invariant_rpcEndpointConfigIncludesAtMostOneWebSocketsProtocolURL);
1440
+ var RpcConfigsSchema = z4.record(makeChainIdStringSchema("RPC URL"), RpcConfigSchema, {
1441
+ error: "Chains configuration must be an object mapping valid chain IDs to their configs."
1442
+ }).transform((records) => {
1443
+ const rpcConfigs = /* @__PURE__ */ new Map();
1444
+ for (const [chainIdString, rpcConfig] of Object.entries(records)) {
1445
+ const httpRPCs = rpcConfig.filter(isHttpProtocol);
1446
+ const websocketRPC = rpcConfig.find(isWebSocketProtocol);
1447
+ rpcConfigs.set(deserializeChainId(chainIdString), {
1448
+ httpRPCs,
1449
+ websocketRPC
1450
+ });
1451
+ }
1452
+ return rpcConfigs;
1453
+ });
1454
+ var EnsIndexerUrlSchema = makeUrlSchema("ENSINDEXER_URL");
1455
+ var ENSNamespaceSchema = z4.enum(ENSNamespaceIds3, {
1456
+ error: ({ input }) => `Invalid NAMESPACE. Got '${input}', but supported ENS namespaces are: ${Object.keys(ENSNamespaceIds3).join(", ")}`
1457
+ });
1458
+ var PortSchema = z4.coerce.number({ error: "PORT must be a number." }).min(1, { error: "PORT must be greater than 1." }).max(65535, { error: "PORT must be less than 65535" }).optional();
1459
+ var TheGraphApiKeySchema = z4.string().optional();
1460
+
1461
+ // src/shared/datasources-with-resolvers.ts
1462
+ import {
1463
+ DatasourceNames,
1464
+ maybeGetDatasource
1465
+ } from "@ensnode/datasources";
1466
+ var DATASOURCE_NAMES_WITH_RESOLVERS = [
1467
+ DatasourceNames.ENSRoot,
1468
+ DatasourceNames.Basenames,
1469
+ DatasourceNames.Lineanames,
1470
+ DatasourceNames.ThreeDNSOptimism,
1471
+ DatasourceNames.ThreeDNSBase
1472
+ ];
1473
+
1474
+ // src/shared/log-level.ts
1475
+ import { z as z5 } from "zod/v4";
1476
+ var LogLevelSchema = z5.enum(["fatal", "error", "warn", "info", "debug", "trace", "silent"]);
1477
+
1478
+ // src/shared/protocol-acceleration/interpret-record-values.ts
1479
+ import { isAddress as isAddress3, isAddressEqual as isAddressEqual2, zeroAddress } from "viem";
1480
+
1481
+ // src/registrars/zod-schemas.ts
1482
+ import { decodeEncodedReferrer as decodeEncodedReferrer2, ENCODED_REFERRER_BYTE_LENGTH } from "@namehash/ens-referrals";
1483
+ import z6 from "zod/v4";
1484
+
1485
+ // src/registrars/registrar-action.ts
1486
+ import { decodeEncodedReferrer, zeroEncodedReferrer } from "@namehash/ens-referrals";
1487
+
1488
+ // src/registrars/subregistry.ts
1489
+ function serializeSubregistry(subregistry) {
1490
+ return {
1491
+ subregistryId: serializeAccountId(subregistry.subregistryId),
1492
+ node: subregistry.node
1493
+ };
1494
+ }
1495
+
1496
+ // src/registrars/registration-lifecycle.ts
1497
+ function serializeRegistrationLifecycle(registrationLifecycle) {
1498
+ return {
1499
+ subregistry: serializeSubregistry(registrationLifecycle.subregistry),
1500
+ node: registrationLifecycle.node,
1501
+ expiresAt: registrationLifecycle.expiresAt
1502
+ };
1503
+ }
1504
+
1505
+ // src/registrars/registrar-action.ts
1506
+ var RegistrarActionTypes = {
1507
+ Registration: "registration",
1508
+ Renewal: "renewal"
1509
+ };
1510
+ function isRegistrarActionPricingAvailable(registrarActionPricing) {
1511
+ const { baseCost, premium, total } = registrarActionPricing;
1512
+ return baseCost !== null && premium !== null && total !== null;
1513
+ }
1514
+ function isRegistrarActionReferralAvailable(registrarActionReferral) {
1515
+ const { encodedReferrer, decodedReferrer } = registrarActionReferral;
1516
+ return encodedReferrer !== null && decodedReferrer !== null;
1517
+ }
1518
+ function serializeRegistrarActionPricing(pricing) {
1519
+ if (isRegistrarActionPricingAvailable(pricing)) {
1520
+ return {
1521
+ baseCost: serializePriceEth(pricing.baseCost),
1522
+ premium: serializePriceEth(pricing.premium),
1523
+ total: serializePriceEth(pricing.total)
1524
+ };
1525
+ }
1526
+ return pricing;
1527
+ }
1528
+ function serializeRegistrarAction(registrarAction) {
1529
+ return {
1530
+ id: registrarAction.id,
1531
+ type: registrarAction.type,
1532
+ incrementalDuration: registrarAction.incrementalDuration,
1533
+ registrant: registrarAction.registrant,
1534
+ registrationLifecycle: serializeRegistrationLifecycle(registrarAction.registrationLifecycle),
1535
+ pricing: serializeRegistrarActionPricing(registrarAction.pricing),
1536
+ referral: registrarAction.referral,
1537
+ block: registrarAction.block,
1538
+ transactionHash: registrarAction.transactionHash,
1539
+ eventIds: registrarAction.eventIds
1540
+ };
1541
+ }
1542
+
1543
+ // src/registrars/zod-schemas.ts
1544
+ var makeSubregistrySchema = (valueLabel = "Subregistry") => z6.object({
1545
+ subregistryId: makeSerializedAccountIdSchema(`${valueLabel} Subregistry ID`),
1546
+ node: makeNodeSchema(`${valueLabel} Node`)
1547
+ });
1548
+ var makeRegistrationLifecycleSchema = (valueLabel = "Registration Lifecycle") => z6.object({
1549
+ subregistry: makeSubregistrySchema(`${valueLabel} Subregistry`),
1550
+ node: makeNodeSchema(`${valueLabel} Node`),
1551
+ expiresAt: makeUnixTimestampSchema(`${valueLabel} Expires at`)
1552
+ });
1553
+ function invariant_registrarActionPricingTotalIsSumOfBaseCostAndPremium(ctx) {
1554
+ const { baseCost, premium, total } = ctx.value;
1555
+ const actualTotal = addPrices(baseCost, premium);
1556
+ if (!isPriceEqual(actualTotal, total)) {
1557
+ ctx.issues.push({
1558
+ code: "custom",
1559
+ input: ctx.value,
1560
+ message: `'total' must be equal to the sum of 'baseCost' and 'premium'`
1561
+ });
1562
+ }
1563
+ }
1564
+ var makeRegistrarActionPricingSchema = (valueLabel = "Registrar Action Pricing") => z6.union([
1565
+ // pricing available
1566
+ z6.object({
1567
+ baseCost: makePriceEthSchema(`${valueLabel} Base Cost`),
1568
+ premium: makePriceEthSchema(`${valueLabel} Premium`),
1569
+ total: makePriceEthSchema(`${valueLabel} Total`)
1570
+ }).check(invariant_registrarActionPricingTotalIsSumOfBaseCostAndPremium).transform((v) => v),
1571
+ // pricing unknown
1572
+ z6.object({
1573
+ baseCost: z6.null(),
1574
+ premium: z6.null(),
1575
+ total: z6.null()
1576
+ }).transform((v) => v)
1577
+ ]);
1578
+ function invariant_registrarActionDecodedReferrerBasedOnRawReferrer(ctx) {
1579
+ const { encodedReferrer, decodedReferrer } = ctx.value;
1580
+ try {
1581
+ const expectedDecodedReferrer = decodeEncodedReferrer2(encodedReferrer).toLowerCase();
1582
+ if (decodedReferrer !== expectedDecodedReferrer) {
1583
+ ctx.issues.push({
1584
+ code: "custom",
1585
+ input: ctx.value,
1586
+ message: `'decodedReferrer' must be based on 'encodedReferrer'`
1587
+ });
1588
+ }
1589
+ } catch (error) {
1590
+ const errorMessage = error instanceof Error ? error.message : "Unknown error";
1591
+ ctx.issues.push({
1592
+ code: "custom",
1593
+ input: ctx.value,
1594
+ message: errorMessage
1595
+ });
1596
+ }
1597
+ }
1598
+ var makeRegistrarActionReferralSchema = (valueLabel = "Registrar Action Referral") => z6.union([
1599
+ // referral available
1600
+ z6.object({
1601
+ encodedReferrer: makeHexStringSchema(
1602
+ { bytesCount: ENCODED_REFERRER_BYTE_LENGTH },
1603
+ `${valueLabel} Encoded Referrer`
1604
+ ),
1605
+ decodedReferrer: makeLowercaseAddressSchema(`${valueLabel} Decoded Referrer`)
1606
+ }).check(invariant_registrarActionDecodedReferrerBasedOnRawReferrer),
1607
+ // referral not applicable
1608
+ z6.object({
1609
+ encodedReferrer: z6.null(),
1610
+ decodedReferrer: z6.null()
1611
+ })
1612
+ ]);
1613
+ function invariant_eventIdsInitialElementIsTheActionId(ctx) {
1614
+ const { id, eventIds } = ctx.value;
1615
+ if (eventIds[0] !== id) {
1616
+ ctx.issues.push({
1617
+ code: "custom",
1618
+ input: ctx.value,
1619
+ message: "The initial element of `eventIds` must be the `id` value"
1620
+ });
1621
+ }
1622
+ }
1623
+ var EventIdSchema = z6.string().nonempty();
1624
+ var EventIdsSchema = z6.array(EventIdSchema).min(1).transform((v) => v);
1625
+ var makeBaseRegistrarActionSchema = (valueLabel = "Base Registrar Action") => z6.object({
1626
+ id: EventIdSchema,
1627
+ incrementalDuration: makeDurationSchema(`${valueLabel} Incremental Duration`),
1628
+ registrant: makeLowercaseAddressSchema(`${valueLabel} Registrant`),
1629
+ registrationLifecycle: makeRegistrationLifecycleSchema(
1630
+ `${valueLabel} Registration Lifecycle`
1631
+ ),
1632
+ pricing: makeRegistrarActionPricingSchema(`${valueLabel} Pricing`),
1633
+ referral: makeRegistrarActionReferralSchema(`${valueLabel} Referral`),
1634
+ block: makeBlockRefSchema(`${valueLabel} Block`),
1635
+ transactionHash: makeTransactionHashSchema(`${valueLabel} Transaction Hash`),
1636
+ eventIds: EventIdsSchema
1637
+ }).check(invariant_eventIdsInitialElementIsTheActionId);
1638
+ var makeRegistrarActionRegistrationSchema = (valueLabel = "Registration ") => makeBaseRegistrarActionSchema(valueLabel).extend({
1639
+ type: z6.literal(RegistrarActionTypes.Registration)
1640
+ });
1641
+ var makeRegistrarActionRenewalSchema = (valueLabel = "Renewal") => makeBaseRegistrarActionSchema(valueLabel).extend({
1642
+ type: z6.literal(RegistrarActionTypes.Renewal)
1643
+ });
1644
+ var makeRegistrarActionSchema = (valueLabel = "Registrar Action") => z6.discriminatedUnion("type", [
1645
+ makeRegistrarActionRegistrationSchema(`${valueLabel} Registration`),
1646
+ makeRegistrarActionRenewalSchema(`${valueLabel} Renewal`)
1647
+ ]);
1648
+
1649
+ // src/api/types.ts
1650
+ var IndexingStatusResponseCodes = {
1651
+ /**
1652
+ * Represents that the indexing status is available.
1653
+ */
1654
+ Ok: "ok",
1655
+ /**
1656
+ * Represents that the indexing status is unavailable.
1657
+ */
1658
+ Error: "error"
1659
+ };
1660
+ var RegistrarActionsFilterTypes = {
1661
+ BySubregistryNode: "bySubregistryNode",
1662
+ WithEncodedReferral: "withEncodedReferral"
1663
+ };
1664
+ var RegistrarActionsOrders = {
1665
+ LatestRegistrarActions: "orderBy[timestamp]=desc"
1666
+ };
1667
+ var RegistrarActionsResponseCodes = {
1668
+ /**
1669
+ * Represents that Registrar Actions are available.
1670
+ */
1671
+ Ok: "ok",
1672
+ /**
1673
+ * Represents that Registrar Actions are unavailable.
1674
+ */
1675
+ Error: "error"
1676
+ };
1677
+
1678
+ // src/api/zod-schemas.ts
1679
+ var ErrorResponseSchema = z7.object({
1680
+ message: z7.string(),
1681
+ details: z7.optional(z7.unknown())
1682
+ });
1683
+ var makeIndexingStatusResponseOkSchema = (valueLabel = "Indexing Status Response OK") => z7.strictObject({
1684
+ responseCode: z7.literal(IndexingStatusResponseCodes.Ok),
1685
+ realtimeProjection: makeRealtimeIndexingStatusProjectionSchema(valueLabel)
1686
+ });
1687
+ var makeIndexingStatusResponseErrorSchema = (_valueLabel = "Indexing Status Response Error") => z7.strictObject({
1688
+ responseCode: z7.literal(IndexingStatusResponseCodes.Error)
1689
+ });
1690
+ var makeIndexingStatusResponseSchema = (valueLabel = "Indexing Status Response") => z7.discriminatedUnion("responseCode", [
1691
+ makeIndexingStatusResponseOkSchema(valueLabel),
1692
+ makeIndexingStatusResponseErrorSchema(valueLabel)
1693
+ ]);
1694
+ function invariant_registrationLifecycleNodeMatchesName(ctx) {
1695
+ const { name, action } = ctx.value;
1696
+ const expectedNode = action.registrationLifecycle.node;
1697
+ const actualNode = namehash2(name);
1698
+ if (actualNode !== expectedNode) {
1699
+ ctx.issues.push({
1700
+ code: "custom",
1701
+ input: ctx.value,
1702
+ message: `The 'action.registrationLifecycle.node' must match namehash of 'name'`
1703
+ });
1704
+ }
1705
+ }
1706
+ var makeNamedRegistrarActionSchema = (valueLabel = "Named Registrar Action") => z7.object({
1707
+ action: makeRegistrarActionSchema(valueLabel),
1708
+ name: makeReinterpretedNameSchema(valueLabel)
1709
+ }).check(invariant_registrationLifecycleNodeMatchesName);
1710
+ var makeRegistrarActionsResponseOkSchema = (valueLabel = "Registrar Actions Response OK") => z7.strictObject({
1711
+ responseCode: z7.literal(RegistrarActionsResponseCodes.Ok),
1712
+ registrarActions: z7.array(makeNamedRegistrarActionSchema(valueLabel))
1713
+ });
1714
+ var makeRegistrarActionsResponseErrorSchema = (_valueLabel = "Registrar Actions Response Error") => z7.strictObject({
1715
+ responseCode: z7.literal(RegistrarActionsResponseCodes.Error),
1716
+ error: ErrorResponseSchema
1717
+ });
1718
+ var makeRegistrarActionsResponseSchema = (valueLabel = "Registrar Actions Response") => z7.discriminatedUnion("responseCode", [
1719
+ makeRegistrarActionsResponseOkSchema(valueLabel),
1720
+ makeRegistrarActionsResponseErrorSchema(valueLabel)
1721
+ ]);
1722
+
1723
+ // src/api/deserialize.ts
1724
+ function deserializeErrorResponse(maybeErrorResponse) {
1725
+ const parsed = ErrorResponseSchema.safeParse(maybeErrorResponse);
1726
+ if (parsed.error) {
1727
+ throw new Error(`Cannot deserialize ErrorResponse:
1728
+ ${prettifyError2(parsed.error)}
1729
+ `);
1730
+ }
1731
+ return parsed.data;
1732
+ }
1733
+ function deserializeIndexingStatusResponse(maybeResponse) {
1734
+ const parsed = makeIndexingStatusResponseSchema().safeParse(maybeResponse);
1735
+ if (parsed.error) {
1736
+ throw new Error(`Cannot deserialize IndexingStatusResponse:
1737
+ ${prettifyError2(parsed.error)}
1738
+ `);
1739
+ }
1740
+ return parsed.data;
1741
+ }
1742
+ function deserializeRegistrarActionsResponse(maybeResponse) {
1743
+ const parsed = makeRegistrarActionsResponseSchema().safeParse(maybeResponse);
1744
+ if (parsed.error) {
1745
+ throw new Error(
1746
+ `Cannot deserialize RegistrarActionsResponse:
1747
+ ${prettifyError2(parsed.error)}
1748
+ `
1749
+ );
1750
+ }
1751
+ return parsed.data;
1752
+ }
1753
+
1754
+ // src/api/registrar-actions/filters.ts
1755
+ function byParentNode(parentNode) {
1756
+ if (typeof parentNode === "undefined") {
1757
+ return void 0;
1758
+ }
1759
+ return {
1760
+ filterType: RegistrarActionsFilterTypes.BySubregistryNode,
1761
+ value: parentNode
1762
+ };
1763
+ }
1764
+ function withReferral(withReferral2) {
1765
+ if (!withReferral2) {
1766
+ return void 0;
1767
+ }
1768
+ return {
1769
+ filterType: RegistrarActionsFilterTypes.WithEncodedReferral
1770
+ };
1771
+ }
1772
+ var registrarActionsFilter = {
1773
+ byParentNode,
1774
+ withReferral
1775
+ };
1776
+
1777
+ // src/ensindexer/config/deserialize.ts
1778
+ import { prettifyError as prettifyError3 } from "zod/v4";
1779
+ function deserializeENSIndexerPublicConfig(maybeConfig, valueLabel) {
1780
+ const schema = makeENSIndexerPublicConfigSchema(valueLabel);
1781
+ const parsed = schema.safeParse(maybeConfig);
1782
+ if (parsed.error) {
1783
+ throw new Error(`Cannot deserialize ENSIndexerPublicConfig:
1784
+ ${prettifyError3(parsed.error)}
1785
+ `);
1786
+ }
1787
+ return parsed.data;
1788
+ }
1789
+
1790
+ // src/ensindexer/config/label-utils.ts
1791
+ import { hexToBytes as hexToBytes2 } from "viem";
1792
+ function labelHashToBytes(labelHash) {
1793
+ try {
1794
+ if (labelHash.length !== 66) {
1795
+ throw new Error(`Invalid labelHash length ${labelHash.length} characters (expected 66)`);
1796
+ }
1797
+ if (labelHash !== labelHash.toLowerCase()) {
1798
+ throw new Error("Labelhash must be in lowercase");
1799
+ }
1800
+ if (!labelHash.startsWith("0x")) {
1801
+ throw new Error("Labelhash must be 0x-prefixed");
1802
+ }
1803
+ const bytes = hexToBytes2(labelHash);
1804
+ if (bytes.length !== 32) {
1805
+ throw new Error(`Invalid labelHash length ${bytes.length} bytes (expected 32)`);
1806
+ }
1807
+ return bytes;
1808
+ } catch (e) {
1809
+ if (e instanceof Error) {
1810
+ throw e;
1811
+ }
1812
+ throw new Error("Invalid hex format");
1813
+ }
1814
+ }
1815
+
1816
+ // src/ensindexer/config/labelset-utils.ts
1817
+ function buildLabelSetId(maybeLabelSetId) {
1818
+ return makeLabelSetIdSchema("LabelSetId").parse(maybeLabelSetId);
1015
1819
  }
1016
- function invariant_slowestChainEqualsToOmnichainSnapshotTime(ctx) {
1017
- const { slowestChainIndexingCursor, omnichainSnapshot } = ctx.value;
1018
- const { omnichainIndexingCursor } = omnichainSnapshot;
1019
- if (slowestChainIndexingCursor !== omnichainIndexingCursor) {
1020
- console.log("invariant_slowestChainEqualsToOmnichainSnapshotTime", {
1021
- slowestChainIndexingCursor,
1022
- omnichainIndexingCursor
1023
- });
1024
- ctx.issues.push({
1025
- code: "custom",
1026
- input: ctx.value,
1027
- message: `'slowestChainIndexingCursor' must be equal to 'omnichainSnapshot.omnichainIndexingCursor'`
1028
- });
1029
- }
1820
+ function buildLabelSetVersion(maybeLabelSetVersion) {
1821
+ return makeLabelSetVersionSchema("LabelSetVersion").parse(maybeLabelSetVersion);
1030
1822
  }
1031
- function invariant_snapshotTimeIsTheHighestKnownBlockTimestamp(ctx) {
1032
- const { snapshotTime, omnichainSnapshot } = ctx.value;
1033
- const chains = Array.from(omnichainSnapshot.chains.values());
1034
- const startBlockTimestamps = chains.map((chain) => chain.config.startBlock.timestamp);
1035
- const endBlockTimestamps = chains.filter((chain) => chain.config.configType === ChainIndexingConfigTypeIds.Definite).map((chain) => chain.config.endBlock.timestamp);
1036
- const backfillEndBlockTimestamps = chains.filter((chain) => chain.chainStatus === ChainIndexingStatusIds.Backfill).map((chain) => chain.backfillEndBlock.timestamp);
1037
- const latestKnownBlockTimestamps = chains.filter((chain) => chain.chainStatus === ChainIndexingStatusIds.Following).map((chain) => chain.latestKnownBlock.timestamp);
1038
- const highestKnownBlockTimestamp = Math.max(
1039
- ...startBlockTimestamps,
1040
- ...endBlockTimestamps,
1041
- ...backfillEndBlockTimestamps,
1042
- ...latestKnownBlockTimestamps
1043
- );
1044
- if (snapshotTime < highestKnownBlockTimestamp) {
1045
- ctx.issues.push({
1046
- code: "custom",
1047
- input: ctx.value,
1048
- message: `'snapshotTime' must be greater than or equal to the "highest known block timestamp" (${highestKnownBlockTimestamp})`
1049
- });
1823
+ function buildEnsRainbowClientLabelSet(labelSetId, labelSetVersion) {
1824
+ if (labelSetVersion !== void 0 && labelSetId === void 0) {
1825
+ throw new Error("When a labelSetVersion is defined, labelSetId must also be defined.");
1050
1826
  }
1827
+ return { labelSetId, labelSetVersion };
1051
1828
  }
1052
- function invariant_realtimeIndexingStatusProjectionProjectedAtIsAfterOrEqualToSnapshotTime(ctx) {
1053
- const projection = ctx.value;
1054
- const { snapshot, projectedAt } = projection;
1055
- if (snapshot.snapshotTime > projectedAt) {
1056
- ctx.issues.push({
1057
- code: "custom",
1058
- input: projection,
1059
- message: "`projectedAt` must be after or same as `snapshot.snapshotTime`."
1060
- });
1829
+ function validateSupportedLabelSetAndVersion(serverSet, clientSet) {
1830
+ if (clientSet.labelSetId === void 0) {
1831
+ return;
1061
1832
  }
1062
- }
1063
- function invariant_realtimeIndexingStatusProjectionWorstCaseDistanceIsCorrect(ctx) {
1064
- const projection = ctx.value;
1065
- const { projectedAt, snapshot, worstCaseDistance } = projection;
1066
- const { omnichainSnapshot } = snapshot;
1067
- const expectedWorstCaseDistance = projectedAt - omnichainSnapshot.omnichainIndexingCursor;
1068
- if (worstCaseDistance !== expectedWorstCaseDistance) {
1069
- ctx.issues.push({
1070
- code: "custom",
1071
- input: projection,
1072
- message: "`worstCaseDistance` must be the exact difference between `projectedAt` and `snapshot.omnichainIndexingCursor`."
1073
- });
1833
+ if (serverSet.labelSetId !== clientSet.labelSetId) {
1834
+ throw new Error(
1835
+ `Server label set ID "${serverSet.labelSetId}" does not match client's requested label set ID "${clientSet.labelSetId}".`
1836
+ );
1837
+ }
1838
+ if (clientSet.labelSetVersion !== void 0 && serverSet.highestLabelSetVersion < clientSet.labelSetVersion) {
1839
+ throw new Error(
1840
+ `Server highest label set version ${serverSet.highestLabelSetVersion} is less than client's requested version ${clientSet.labelSetVersion} for label set ID "${clientSet.labelSetId}".`
1841
+ );
1074
1842
  }
1075
1843
  }
1076
1844
 
1077
- // src/ensindexer/indexing-status/zod-schemas.ts
1078
- var makeChainIndexingConfigSchema = (valueLabel = "Value") => z3.discriminatedUnion("configType", [
1079
- z3.strictObject({
1080
- configType: z3.literal(ChainIndexingConfigTypeIds.Indefinite),
1081
- startBlock: makeBlockRefSchema(valueLabel)
1082
- }),
1083
- z3.strictObject({
1084
- configType: z3.literal(ChainIndexingConfigTypeIds.Definite),
1085
- startBlock: makeBlockRefSchema(valueLabel),
1086
- endBlock: makeBlockRefSchema(valueLabel)
1087
- })
1088
- ]);
1089
- var makeChainIndexingStatusSnapshotQueuedSchema = (valueLabel = "Value") => z3.strictObject({
1090
- chainStatus: z3.literal(ChainIndexingStatusIds.Queued),
1091
- config: makeChainIndexingConfigSchema(valueLabel)
1092
- }).check(invariant_chainSnapshotQueuedBlocks);
1093
- var makeChainIndexingStatusSnapshotBackfillSchema = (valueLabel = "Value") => z3.strictObject({
1094
- chainStatus: z3.literal(ChainIndexingStatusIds.Backfill),
1095
- config: makeChainIndexingConfigSchema(valueLabel),
1096
- latestIndexedBlock: makeBlockRefSchema(valueLabel),
1097
- backfillEndBlock: makeBlockRefSchema(valueLabel)
1098
- }).check(invariant_chainSnapshotBackfillBlocks);
1099
- var makeChainIndexingStatusSnapshotCompletedSchema = (valueLabel = "Value") => z3.strictObject({
1100
- chainStatus: z3.literal(ChainIndexingStatusIds.Completed),
1101
- config: z3.strictObject({
1102
- configType: z3.literal(ChainIndexingConfigTypeIds.Definite),
1103
- startBlock: makeBlockRefSchema(valueLabel),
1104
- endBlock: makeBlockRefSchema(valueLabel)
1105
- }),
1106
- latestIndexedBlock: makeBlockRefSchema(valueLabel)
1107
- }).check(invariant_chainSnapshotCompletedBlocks);
1108
- var makeChainIndexingStatusSnapshotFollowingSchema = (valueLabel = "Value") => z3.strictObject({
1109
- chainStatus: z3.literal(ChainIndexingStatusIds.Following),
1110
- config: z3.strictObject({
1111
- configType: z3.literal(ChainIndexingConfigTypeIds.Indefinite),
1112
- startBlock: makeBlockRefSchema(valueLabel)
1113
- }),
1114
- latestIndexedBlock: makeBlockRefSchema(valueLabel),
1115
- latestKnownBlock: makeBlockRefSchema(valueLabel)
1116
- }).check(invariant_chainSnapshotFollowingBlocks);
1117
- var makeChainIndexingStatusSnapshotSchema = (valueLabel = "Value") => z3.discriminatedUnion("chainStatus", [
1118
- makeChainIndexingStatusSnapshotQueuedSchema(valueLabel),
1119
- makeChainIndexingStatusSnapshotBackfillSchema(valueLabel),
1120
- makeChainIndexingStatusSnapshotCompletedSchema(valueLabel),
1121
- makeChainIndexingStatusSnapshotFollowingSchema(valueLabel)
1122
- ]);
1123
- var makeChainIndexingStatusesSchema = (valueLabel = "Value") => z3.record(makeChainIdStringSchema(), makeChainIndexingStatusSnapshotSchema(valueLabel), {
1124
- error: "Chains indexing statuses must be an object mapping valid chain IDs to their indexing status snapshots."
1125
- }).transform((serializedChainsIndexingStatus) => {
1126
- const chainsIndexingStatus = /* @__PURE__ */ new Map();
1127
- for (const [chainIdString, chainStatus] of Object.entries(serializedChainsIndexingStatus)) {
1128
- chainsIndexingStatus.set(deserializeChainId(chainIdString), chainStatus);
1845
+ // src/ensindexer/config/parsing.ts
1846
+ function parseNonNegativeInteger(maybeNumber) {
1847
+ const trimmed = maybeNumber.trim();
1848
+ if (!trimmed) {
1849
+ throw new Error("Input cannot be empty");
1129
1850
  }
1130
- return chainsIndexingStatus;
1131
- });
1132
- var makeOmnichainIndexingStatusSnapshotUnstartedSchema = (valueLabel) => z3.strictObject({
1133
- omnichainStatus: z3.literal(OmnichainIndexingStatusIds.Unstarted),
1134
- chains: makeChainIndexingStatusesSchema(valueLabel).check(invariant_omnichainSnapshotUnstartedHasValidChains).transform((chains) => chains),
1135
- omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
1136
- });
1137
- var makeOmnichainIndexingStatusSnapshotBackfillSchema = (valueLabel) => z3.strictObject({
1138
- omnichainStatus: z3.literal(OmnichainIndexingStatusIds.Backfill),
1139
- chains: makeChainIndexingStatusesSchema(valueLabel).check(invariant_omnichainStatusSnapshotBackfillHasValidChains).transform(
1140
- (chains) => chains
1141
- ),
1142
- omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
1143
- });
1144
- var makeOmnichainIndexingStatusSnapshotCompletedSchema = (valueLabel) => z3.strictObject({
1145
- omnichainStatus: z3.literal(OmnichainIndexingStatusIds.Completed),
1146
- chains: makeChainIndexingStatusesSchema(valueLabel).check(invariant_omnichainStatusSnapshotCompletedHasValidChains).transform((chains) => chains),
1147
- omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
1148
- });
1149
- var makeOmnichainIndexingStatusSnapshotFollowingSchema = (valueLabel) => z3.strictObject({
1150
- omnichainStatus: z3.literal(OmnichainIndexingStatusIds.Following),
1151
- chains: makeChainIndexingStatusesSchema(valueLabel),
1152
- omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
1153
- });
1154
- var makeOmnichainIndexingStatusSnapshotSchema = (valueLabel = "Omnichain Indexing Snapshot") => z3.discriminatedUnion("omnichainStatus", [
1155
- makeOmnichainIndexingStatusSnapshotUnstartedSchema(valueLabel),
1156
- makeOmnichainIndexingStatusSnapshotBackfillSchema(valueLabel),
1157
- makeOmnichainIndexingStatusSnapshotCompletedSchema(valueLabel),
1158
- makeOmnichainIndexingStatusSnapshotFollowingSchema(valueLabel)
1159
- ]).check(invariant_omnichainSnapshotStatusIsConsistentWithChainSnapshot).check(invariant_omnichainIndexingCursorLowerThanEarliestStartBlockAcrossQueuedChains).check(
1160
- invariant_omnichainIndexingCursorLowerThanOrEqualToLatestBackfillEndBlockAcrossBackfillChains
1161
- ).check(invariant_omnichainIndexingCursorIsEqualToHighestLatestIndexedBlockAcrossIndexedChain);
1162
- var makeCrossChainIndexingStatusSnapshotOmnichainSchema = (valueLabel = "Cross-chain Indexing Status Snapshot Omnichain") => z3.strictObject({
1163
- strategy: z3.literal(CrossChainIndexingStrategyIds.Omnichain),
1164
- slowestChainIndexingCursor: makeUnixTimestampSchema(valueLabel),
1165
- snapshotTime: makeUnixTimestampSchema(valueLabel),
1166
- omnichainSnapshot: makeOmnichainIndexingStatusSnapshotSchema(valueLabel)
1167
- }).check(invariant_slowestChainEqualsToOmnichainSnapshotTime).check(invariant_snapshotTimeIsTheHighestKnownBlockTimestamp);
1168
- var makeCrossChainIndexingStatusSnapshotSchema = (valueLabel = "Cross-chain Indexing Status Snapshot") => z3.discriminatedUnion("strategy", [
1169
- makeCrossChainIndexingStatusSnapshotOmnichainSchema(valueLabel)
1170
- ]);
1171
- var makeRealtimeIndexingStatusProjectionSchema = (valueLabel = "Realtime Indexing Status Projection") => z3.strictObject({
1172
- projectedAt: makeUnixTimestampSchema(valueLabel),
1173
- worstCaseDistance: makeDurationSchema(valueLabel),
1174
- snapshot: makeCrossChainIndexingStatusSnapshotSchema(valueLabel)
1175
- }).check(invariant_realtimeIndexingStatusProjectionProjectedAtIsAfterOrEqualToSnapshotTime).check(invariant_realtimeIndexingStatusProjectionWorstCaseDistanceIsCorrect);
1851
+ if (trimmed === "-0") {
1852
+ throw new Error("Negative zero is not a valid non-negative integer");
1853
+ }
1854
+ const num = Number(maybeNumber);
1855
+ if (Number.isNaN(num)) {
1856
+ throw new Error(`"${maybeNumber}" is not a valid number`);
1857
+ }
1858
+ if (!Number.isFinite(num)) {
1859
+ throw new Error(`"${maybeNumber}" is not a finite number`);
1860
+ }
1861
+ if (!Number.isInteger(num)) {
1862
+ throw new Error(`"${maybeNumber}" is not an integer`);
1863
+ }
1864
+ if (num < 0) {
1865
+ throw new Error(`"${maybeNumber}" is not a non-negative integer`);
1866
+ }
1867
+ return num;
1868
+ }
1869
+
1870
+ // src/ensindexer/config/serialize.ts
1871
+ function serializeIndexedChainIds(indexedChainIds) {
1872
+ return Array.from(indexedChainIds);
1873
+ }
1874
+ function serializeENSIndexerPublicConfig(config) {
1875
+ const {
1876
+ labelSet,
1877
+ indexedChainIds,
1878
+ databaseSchemaName,
1879
+ isSubgraphCompatible: isSubgraphCompatible2,
1880
+ namespace,
1881
+ plugins,
1882
+ versionInfo
1883
+ } = config;
1884
+ return {
1885
+ labelSet,
1886
+ indexedChainIds: serializeIndexedChainIds(indexedChainIds),
1887
+ databaseSchemaName,
1888
+ isSubgraphCompatible: isSubgraphCompatible2,
1889
+ namespace,
1890
+ plugins,
1891
+ versionInfo
1892
+ };
1893
+ }
1176
1894
 
1177
1895
  // src/ensindexer/indexing-status/deserialize.ts
1896
+ import { prettifyError as prettifyError4 } from "zod/v4";
1178
1897
  function deserializeChainIndexingStatusSnapshot(maybeSnapshot, valueLabel) {
1179
1898
  const schema = makeChainIndexingStatusSnapshotSchema(valueLabel);
1180
1899
  const parsed = schema.safeParse(maybeSnapshot);
1181
1900
  if (parsed.error) {
1182
1901
  throw new Error(
1183
1902
  `Cannot deserialize into ChainIndexingStatusSnapshot:
1184
- ${prettifyError3(parsed.error)}
1903
+ ${prettifyError4(parsed.error)}
1185
1904
  `
1186
1905
  );
1187
1906
  }
@@ -1193,7 +1912,7 @@ function deserializeOmnichainIndexingStatusSnapshot(maybeSnapshot, valueLabel) {
1193
1912
  if (parsed.error) {
1194
1913
  throw new Error(
1195
1914
  `Cannot deserialize into OmnichainIndexingStatusSnapshot:
1196
- ${prettifyError3(parsed.error)}
1915
+ ${prettifyError4(parsed.error)}
1197
1916
  `
1198
1917
  );
1199
1918
  }
@@ -1205,7 +1924,7 @@ function deserializeCrossChainIndexingStatusSnapshot(maybeSnapshot, valueLabel)
1205
1924
  if (parsed.error) {
1206
1925
  throw new Error(
1207
1926
  `Cannot deserialize into CrossChainIndexingStatusSnapshot:
1208
- ${prettifyError3(parsed.error)}
1927
+ ${prettifyError4(parsed.error)}
1209
1928
  `
1210
1929
  );
1211
1930
  }
@@ -1217,7 +1936,7 @@ function deserializeRealtimeIndexingStatusProjection(maybeProjection, valueLabel
1217
1936
  if (parsed.error) {
1218
1937
  throw new Error(
1219
1938
  `Cannot deserialize into RealtimeIndexingStatusProjection:
1220
- ${prettifyError3(parsed.error)}
1939
+ ${prettifyError4(parsed.error)}
1221
1940
  `
1222
1941
  );
1223
1942
  }
@@ -1281,100 +2000,82 @@ function serializeOmnichainIndexingStatusSnapshot(indexingStatus) {
1281
2000
  omnichainStatus: OmnichainIndexingStatusIds.Completed,
1282
2001
  chains: serializeChainIndexingSnapshots(indexingStatus.chains),
1283
2002
  omnichainIndexingCursor: indexingStatus.omnichainIndexingCursor
1284
- };
1285
- }
1286
- case OmnichainIndexingStatusIds.Following:
1287
- return {
1288
- omnichainStatus: OmnichainIndexingStatusIds.Following,
1289
- chains: serializeChainIndexingSnapshots(indexingStatus.chains),
1290
- omnichainIndexingCursor: indexingStatus.omnichainIndexingCursor
1291
- };
1292
- }
1293
- }
1294
-
1295
- // src/tracing/index.ts
1296
- var TraceableENSProtocol = /* @__PURE__ */ ((TraceableENSProtocol2) => {
1297
- TraceableENSProtocol2["ForwardResolution"] = "forward-resolution";
1298
- TraceableENSProtocol2["ReverseResolution"] = "reverse-resolution";
1299
- return TraceableENSProtocol2;
1300
- })(TraceableENSProtocol || {});
1301
- var ForwardResolutionProtocolStep = /* @__PURE__ */ ((ForwardResolutionProtocolStep2) => {
1302
- ForwardResolutionProtocolStep2["Operation"] = "forward-resolution";
1303
- ForwardResolutionProtocolStep2["FindResolver"] = "find-resolver";
1304
- ForwardResolutionProtocolStep2["ActiveResolverExists"] = "active-resolver-exists";
1305
- ForwardResolutionProtocolStep2["AccelerateENSIP19ReverseResolver"] = "accelerate-ensip-19-reverse-resolver";
1306
- ForwardResolutionProtocolStep2["AccelerateKnownOffchainLookupResolver"] = "accelerate-known-offchain-lookup-resolver";
1307
- ForwardResolutionProtocolStep2["AccelerateKnownOnchainStaticResolver"] = "accelerate-known-onchain-static-resolver";
1308
- ForwardResolutionProtocolStep2["RequireResolver"] = "require-resolver";
1309
- ForwardResolutionProtocolStep2["ExecuteResolveCalls"] = "execute-resolve-calls";
1310
- return ForwardResolutionProtocolStep2;
1311
- })(ForwardResolutionProtocolStep || {});
1312
- var ReverseResolutionProtocolStep = /* @__PURE__ */ ((ReverseResolutionProtocolStep2) => {
1313
- ReverseResolutionProtocolStep2["Operation"] = "reverse-resolution";
1314
- ReverseResolutionProtocolStep2["ResolveReverseName"] = "resolve-reverse-name";
1315
- ReverseResolutionProtocolStep2["NameRecordExists"] = "name-record-exists-check";
1316
- ReverseResolutionProtocolStep2["ForwardResolveAddressRecord"] = "forward-resolve-address-record";
1317
- ReverseResolutionProtocolStep2["VerifyResolvedAddressMatchesAddress"] = "verify-resolved-address-matches-address";
1318
- return ReverseResolutionProtocolStep2;
1319
- })(ReverseResolutionProtocolStep || {});
1320
- var PROTOCOL_ATTRIBUTE_PREFIX = "ens";
1321
- var ATTR_PROTOCOL_NAME = `${PROTOCOL_ATTRIBUTE_PREFIX}.protocol`;
1322
- var ATTR_PROTOCOL_STEP = `${PROTOCOL_ATTRIBUTE_PREFIX}.protocol.step`;
1323
- var ATTR_PROTOCOL_STEP_RESULT = `${PROTOCOL_ATTRIBUTE_PREFIX}.protocol.step.result`;
1324
-
1325
- // src/api/deserialize.ts
1326
- import { prettifyError as prettifyError4 } from "zod/v4";
1327
-
1328
- // src/api/zod-schemas.ts
1329
- import z4 from "zod/v4";
2003
+ };
2004
+ }
2005
+ case OmnichainIndexingStatusIds.Following:
2006
+ return {
2007
+ omnichainStatus: OmnichainIndexingStatusIds.Following,
2008
+ chains: serializeChainIndexingSnapshots(indexingStatus.chains),
2009
+ omnichainIndexingCursor: indexingStatus.omnichainIndexingCursor
2010
+ };
2011
+ }
2012
+ }
1330
2013
 
1331
- // src/api/types.ts
1332
- var IndexingStatusResponseCodes = {
2014
+ // src/api/registrar-actions/prerequisites.ts
2015
+ var registrarActionsPrerequisites = Object.freeze({
1333
2016
  /**
1334
- * Represents that the indexing status is available.
2017
+ * Required plugins to enable Registrar Actions API routes.
2018
+ *
2019
+ * 1. `registrars` plugin is required so that data in the `registrarActions`
2020
+ * table is populated.
2021
+ * 2. `subgraph`, `basenames`, and `lineanames` are required to get the data
2022
+ * for the name associated with each registrar action.
2023
+ * 3. In theory not all of `subgraph`, `basenames`, and `lineanames` plugins
2024
+ * might be required. Ex: At least one, but the current logic in
2025
+ * the `registrars` plugin always indexes registrar actions across
2026
+ * Ethnames (subgraph), Basenames, and Lineanames and therefore we need to
2027
+ * ensure each value in the registrar actions table has
2028
+ * an associated record in the domains table.
1335
2029
  */
1336
- Ok: "ok",
2030
+ requiredPlugins: [
2031
+ "subgraph" /* Subgraph */,
2032
+ "basenames" /* Basenames */,
2033
+ "lineanames" /* Lineanames */,
2034
+ "registrars" /* Registrars */
2035
+ ],
1337
2036
  /**
1338
- * Represents that the indexing status is unavailable.
2037
+ * Check if provided ENSApiPublicConfig supports the Registrar Actions API.
1339
2038
  */
1340
- Error: "error"
1341
- };
1342
-
1343
- // src/api/zod-schemas.ts
1344
- var ErrorResponseSchema = z4.object({
1345
- message: z4.string(),
1346
- details: z4.optional(z4.unknown())
1347
- });
1348
- var makeIndexingStatusResponseOkSchema = (valueLabel = "Indexing Status Response OK") => z4.strictObject({
1349
- responseCode: z4.literal(IndexingStatusResponseCodes.Ok),
1350
- realtimeProjection: makeRealtimeIndexingStatusProjectionSchema(valueLabel)
1351
- });
1352
- var makeIndexingStatusResponseErrorSchema = (valueLabel = "Indexing Status Response Error") => z4.strictObject({
1353
- responseCode: z4.literal(IndexingStatusResponseCodes.Error)
2039
+ hasEnsIndexerConfigSupport(config) {
2040
+ return registrarActionsPrerequisites.requiredPlugins.every(
2041
+ (plugin) => config.plugins.includes(plugin)
2042
+ );
2043
+ },
2044
+ /**
2045
+ * Required Indexing Status IDs
2046
+ *
2047
+ * Database indexes are created by the time the omnichain indexing status
2048
+ * is either `completed` or `following`.
2049
+ */
2050
+ supportedIndexingStatusIds: [
2051
+ OmnichainIndexingStatusIds.Completed,
2052
+ OmnichainIndexingStatusIds.Following
2053
+ ],
2054
+ /**
2055
+ * Check if provided indexing status supports the Registrar Actions API.
2056
+ */
2057
+ hasIndexingStatusSupport(omnichainIndexingStatusId) {
2058
+ return registrarActionsPrerequisites.supportedIndexingStatusIds.some(
2059
+ (supportedIndexingStatusId) => supportedIndexingStatusId === omnichainIndexingStatusId
2060
+ );
2061
+ }
1354
2062
  });
1355
- var makeIndexingStatusResponseSchema = (valueLabel = "Indexing Status Response") => z4.discriminatedUnion("responseCode", [
1356
- makeIndexingStatusResponseOkSchema(valueLabel),
1357
- makeIndexingStatusResponseErrorSchema(valueLabel)
1358
- ]);
1359
2063
 
1360
- // src/api/deserialize.ts
1361
- function deserializeErrorResponse(maybeErrorResponse) {
1362
- const parsed = ErrorResponseSchema.safeParse(maybeErrorResponse);
1363
- if (parsed.error) {
1364
- throw new Error(`Cannot deserialize ErrorResponse:
1365
- ${prettifyError4(parsed.error)}
1366
- `);
2064
+ // src/registrars/ethnames-subregistry.ts
2065
+ import { DatasourceNames as DatasourceNames2, maybeGetDatasource as maybeGetDatasource2 } from "@ensnode/datasources";
2066
+ function getEthnamesSubregistryId(namespace) {
2067
+ const datasource = maybeGetDatasource2(namespace, DatasourceNames2.ENSRoot);
2068
+ if (!datasource) {
2069
+ throw new Error(`Datasource not found for ${namespace} ${DatasourceNames2.ENSRoot}`);
1367
2070
  }
1368
- return parsed.data;
1369
- }
1370
- function deserializeIndexingStatusResponse(maybeResponse) {
1371
- const parsed = makeIndexingStatusResponseSchema().safeParse(maybeResponse);
1372
- if (parsed.error) {
1373
- throw new Error(`Cannot deserialize IndexingStatusResponse:
1374
- ${prettifyError4(parsed.error)}
1375
- `);
2071
+ const address = datasource.contracts.BaseRegistrar?.address;
2072
+ if (address === void 0 || Array.isArray(address)) {
2073
+ throw new Error(`BaseRegistrar contract not found or has multiple addresses for ${namespace}`);
1376
2074
  }
1377
- return parsed.data;
2075
+ return {
2076
+ chainId: datasource.chain.id,
2077
+ address
2078
+ };
1378
2079
  }
1379
2080
 
1380
2081
  // src/api/serialize.ts
@@ -1389,6 +2090,26 @@ function serializeIndexingStatusResponse(response) {
1389
2090
  return response;
1390
2091
  }
1391
2092
  }
2093
+ function serializeNamedRegistrarAction({
2094
+ action,
2095
+ name
2096
+ }) {
2097
+ return {
2098
+ action: serializeRegistrarAction(action),
2099
+ name
2100
+ };
2101
+ }
2102
+ function serializeRegistrarActionsResponse(response) {
2103
+ switch (response.responseCode) {
2104
+ case RegistrarActionsResponseCodes.Ok:
2105
+ return {
2106
+ responseCode: response.responseCode,
2107
+ registrarActions: response.registrarActions.map(serializeNamedRegistrarAction)
2108
+ };
2109
+ case RegistrarActionsResponseCodes.Error:
2110
+ return response;
2111
+ }
2112
+ }
1392
2113
 
1393
2114
  // src/client-error.ts
1394
2115
  var ClientError = class _ClientError extends Error {
@@ -1403,6 +2124,161 @@ var ClientError = class _ClientError extends Error {
1403
2124
  }
1404
2125
  };
1405
2126
 
2127
+ // src/ensanalytics/deserialize.ts
2128
+ import { prettifyError as prettifyError5 } from "zod/v4";
2129
+
2130
+ // src/ensanalytics/zod-schemas.ts
2131
+ import z8 from "zod/v4";
2132
+
2133
+ // src/ensanalytics/types.ts
2134
+ var ITEMS_PER_PAGE_DEFAULT = 25;
2135
+ var ITEMS_PER_PAGE_MAX = 100;
2136
+ var PaginatedAggregatedReferrersResponseCodes = {
2137
+ /**
2138
+ * Represents that the aggregated referrers data is available.
2139
+ * @note The response may contain an empty array for the first page if there are no qualified referrers.
2140
+ * When the array is empty, total will be 0, page will be 1, and both hasNext and hasPrev will be false.
2141
+ */
2142
+ Ok: "ok",
2143
+ /**
2144
+ * Represents that the aggregated referrers data is not available.
2145
+ */
2146
+ Error: "error"
2147
+ };
2148
+
2149
+ // src/ensanalytics/zod-schemas.ts
2150
+ var makeAggregatedReferrerMetricsSchema = (valueLabel = "AggregatedReferrerMetrics") => z8.object({
2151
+ referrer: makeLowercaseAddressSchema(`${valueLabel}.referrer`),
2152
+ totalReferrals: makePositiveIntegerSchema(`${valueLabel}.totalReferrals`),
2153
+ totalIncrementalDuration: makeDurationSchema(`${valueLabel}.totalIncrementalDuration`)
2154
+ });
2155
+ var makeAggregatedReferrerMetricsContributionSchema = (valueLabel = "AggregatedReferrerMetricsContribution") => makeAggregatedReferrerMetricsSchema(valueLabel).extend({
2156
+ totalReferralsContribution: z8.number({
2157
+ error: `${valueLabel}.totalReferralsContribution must be a number`
2158
+ }).min(0, `${valueLabel}.totalReferralsContribution must be >= 0`).max(1, `${valueLabel}.totalReferralsContribution must be <= 1`),
2159
+ totalIncrementalDurationContribution: z8.number({
2160
+ error: `${valueLabel}.totalIncrementalDurationContribution must be a number`
2161
+ }).min(0, `${valueLabel}.totalIncrementalDurationContribution must be >= 0`).max(1, `${valueLabel}.totalIncrementalDurationContribution must be <= 1`)
2162
+ });
2163
+ var makePaginationParamsSchema = (valueLabel = "PaginationParams") => z8.object({
2164
+ page: makePositiveIntegerSchema(`${valueLabel}.page`).default(1),
2165
+ itemsPerPage: makePositiveIntegerSchema(`${valueLabel}.itemsPerPage`).max(ITEMS_PER_PAGE_MAX, `${valueLabel}.itemsPerPage must not exceed ${ITEMS_PER_PAGE_MAX}`).default(ITEMS_PER_PAGE_DEFAULT)
2166
+ });
2167
+ var makePaginatedAggregatedReferrersSchema = (valueLabel = "PaginatedAggregatedReferrers") => z8.object({
2168
+ referrers: z8.array(
2169
+ makeAggregatedReferrerMetricsContributionSchema(`${valueLabel}.referrers[item]`)
2170
+ ),
2171
+ total: makeNonNegativeIntegerSchema(`${valueLabel}.total`),
2172
+ paginationParams: makePaginationParamsSchema(`${valueLabel}.paginationParams`),
2173
+ hasNext: z8.boolean(),
2174
+ hasPrev: z8.boolean(),
2175
+ updatedAt: makeUnixTimestampSchema(`${valueLabel}.updatedAt`)
2176
+ }).check((ctx) => {
2177
+ const { paginationParams, hasNext, hasPrev, total } = ctx.value;
2178
+ const expectedHasPrev = paginationParams.page > 1;
2179
+ if (hasPrev !== expectedHasPrev) {
2180
+ ctx.issues.push({
2181
+ code: "custom",
2182
+ message: `${valueLabel}.hasPrev must be ${expectedHasPrev} when page is ${paginationParams.page}`,
2183
+ input: ctx.value
2184
+ });
2185
+ }
2186
+ const endIndex = paginationParams.page * paginationParams.itemsPerPage;
2187
+ const expectedHasNext = endIndex < total;
2188
+ if (hasNext !== expectedHasNext) {
2189
+ ctx.issues.push({
2190
+ code: "custom",
2191
+ message: `${valueLabel}.hasNext must be ${expectedHasNext} when page=${paginationParams.page}, itemsPerPage=${paginationParams.itemsPerPage}, total=${total}`,
2192
+ input: ctx.value
2193
+ });
2194
+ }
2195
+ });
2196
+ var makePaginatedAggregatedReferrersResponseOkSchema = (valueLabel = "PaginatedAggregatedReferrersResponse") => z8.object({
2197
+ responseCode: z8.literal(PaginatedAggregatedReferrersResponseCodes.Ok),
2198
+ data: makePaginatedAggregatedReferrersSchema(`${valueLabel}.data`)
2199
+ });
2200
+ var makePaginatedAggregatedReferrersResponseErrorSchema = (_valueLabel = "PaginatedAggregatedReferrersResponse") => z8.object({
2201
+ responseCode: z8.literal(PaginatedAggregatedReferrersResponseCodes.Error),
2202
+ error: z8.string(),
2203
+ errorMessage: z8.string()
2204
+ });
2205
+ var makePaginatedAggregatedReferrersResponseSchema = (valueLabel = "PaginatedAggregatedReferrersResponse") => z8.union([
2206
+ makePaginatedAggregatedReferrersResponseOkSchema(valueLabel),
2207
+ makePaginatedAggregatedReferrersResponseErrorSchema(valueLabel)
2208
+ ]);
2209
+
2210
+ // src/ensanalytics/deserialize.ts
2211
+ function deserializePaginatedAggregatedReferrersResponse(maybeResponse, valueLabel) {
2212
+ const schema = makePaginatedAggregatedReferrersResponseSchema(valueLabel);
2213
+ const parsed = schema.safeParse(maybeResponse);
2214
+ if (parsed.error) {
2215
+ throw new Error(
2216
+ `Cannot deserialize PaginatedAggregatedReferrersResponse:
2217
+ ${prettifyError5(parsed.error)}
2218
+ `
2219
+ );
2220
+ }
2221
+ return parsed.data;
2222
+ }
2223
+
2224
+ // src/ensanalytics/serialize.ts
2225
+ function serializePaginatedAggregatedReferrersResponse(response) {
2226
+ switch (response.responseCode) {
2227
+ case PaginatedAggregatedReferrersResponseCodes.Ok:
2228
+ return response;
2229
+ case PaginatedAggregatedReferrersResponseCodes.Error:
2230
+ return response;
2231
+ }
2232
+ }
2233
+
2234
+ // src/ensapi/config/deserialize.ts
2235
+ import { prettifyError as prettifyError6, ZodError } from "zod/v4";
2236
+
2237
+ // src/ensapi/config/zod-schemas.ts
2238
+ import { z as z9 } from "zod/v4";
2239
+ var TheGraphCannotFallbackReasonSchema = z9.enum({
2240
+ NotSubgraphCompatible: "not-subgraph-compatible",
2241
+ NoApiKey: "no-api-key",
2242
+ NoSubgraphUrl: "no-subgraph-url"
2243
+ });
2244
+ var TheGraphFallbackSchema = z9.strictObject({
2245
+ canFallback: z9.boolean(),
2246
+ reason: TheGraphCannotFallbackReasonSchema.nullable()
2247
+ });
2248
+ function makeENSApiPublicConfigSchema(valueLabel) {
2249
+ const label = valueLabel ?? "ENSApiPublicConfig";
2250
+ return z9.strictObject({
2251
+ version: z9.string().min(1, `${label}.version must be a non-empty string`),
2252
+ theGraphFallback: TheGraphFallbackSchema,
2253
+ ensIndexerPublicConfig: makeENSIndexerPublicConfigSchema(`${label}.ensIndexerPublicConfig`)
2254
+ });
2255
+ }
2256
+
2257
+ // src/ensapi/config/deserialize.ts
2258
+ function deserializeENSApiPublicConfig(maybeConfig, valueLabel) {
2259
+ const schema = makeENSApiPublicConfigSchema(valueLabel);
2260
+ try {
2261
+ return schema.parse(maybeConfig);
2262
+ } catch (error) {
2263
+ if (error instanceof ZodError) {
2264
+ throw new Error(`Cannot deserialize ENSApiPublicConfig:
2265
+ ${prettifyError6(error)}
2266
+ `);
2267
+ }
2268
+ throw error;
2269
+ }
2270
+ }
2271
+
2272
+ // src/ensapi/config/serialize.ts
2273
+ function serializeENSApiPublicConfig(config) {
2274
+ const { version, theGraphFallback, ensIndexerPublicConfig } = config;
2275
+ return {
2276
+ version,
2277
+ theGraphFallback,
2278
+ ensIndexerPublicConfig: serializeENSIndexerPublicConfig(ensIndexerPublicConfig)
2279
+ };
2280
+ }
2281
+
1406
2282
  // src/client.ts
1407
2283
  var DEFAULT_ENSNODE_API_URL = "https://api.alpha.ensnode.io";
1408
2284
  var ENSNodeClient = class _ENSNodeClient {
@@ -1606,7 +2482,7 @@ var ENSNodeClient = class _ENSNodeClient {
1606
2482
  const errorResponse = deserializeErrorResponse(responseData);
1607
2483
  throw new Error(`Fetching ENSNode Config Failed: ${errorResponse.message}`);
1608
2484
  }
1609
- return deserializeENSIndexerPublicConfig(responseData);
2485
+ return deserializeENSApiPublicConfig(responseData);
1610
2486
  }
1611
2487
  /**
1612
2488
  * Fetch ENSNode Indexing Status
@@ -1639,12 +2515,170 @@ var ENSNodeClient = class _ENSNodeClient {
1639
2515
  }
1640
2516
  return deserializeIndexingStatusResponse(responseData);
1641
2517
  }
2518
+ /**
2519
+ * Fetch Paginated Aggregated Referrers
2520
+ *
2521
+ * Retrieves a paginated list of aggregated referrer metrics with contribution percentages.
2522
+ * Each referrer's contribution is calculated as a percentage of the grand totals across all referrers.
2523
+ *
2524
+ * @param request - Pagination parameters
2525
+ * @param request.page - The page number to retrieve (1-indexed, default: 1)
2526
+ * @param request.itemsPerPage - Number of items per page (default: 25, max: 100)
2527
+ * @returns {PaginatedAggregatedReferrersResponse}
2528
+ *
2529
+ * @throws if the ENSNode request fails
2530
+ * @throws if the ENSNode API returns an error response
2531
+ * @throws if the ENSNode response breaks required invariants
2532
+ *
2533
+ * @example
2534
+ * ```typescript
2535
+ * // Get first page with default page size (25 items)
2536
+ * const response = await client.getAggregatedReferrers();
2537
+ * if (response.responseCode === 'ok') {
2538
+ * console.log(response.data.referrers);
2539
+ * console.log(`Page ${response.data.paginationParams.page} of ${Math.ceil(response.data.total / response.data.paginationParams.itemsPerPage)}`);
2540
+ * }
2541
+ * ```
2542
+ *
2543
+ * @example
2544
+ * ```typescript
2545
+ * // Get second page with 50 items per page
2546
+ * const response = await client.getAggregatedReferrers({ page: 2, itemsPerPage: 50 });
2547
+ * ```
2548
+ */
2549
+ async getAggregatedReferrers(request) {
2550
+ const url = new URL(`/ensanalytics/aggregated-referrers`, this.options.url);
2551
+ if (request?.page) url.searchParams.set("page", request.page.toString());
2552
+ if (request?.itemsPerPage)
2553
+ url.searchParams.set("itemsPerPage", request.itemsPerPage.toString());
2554
+ const response = await fetch(url);
2555
+ let responseData;
2556
+ try {
2557
+ responseData = await response.json();
2558
+ } catch {
2559
+ throw new Error("Malformed response data: invalid JSON");
2560
+ }
2561
+ return deserializePaginatedAggregatedReferrersResponse(
2562
+ responseData
2563
+ );
2564
+ }
2565
+ /**
2566
+ * Fetch ENSNode Registrar Actions
2567
+ *
2568
+ * @param {RegistrarActionsRequestFilter} request.filter is
2569
+ * an optional request filter configuration.
2570
+ * @param {number} request.limit sets the maximum count of results in the response.
2571
+ * @param {RegistrarActionsRequestOrder} request.order sets the order of
2572
+ * results in the response by field and direction.
2573
+ * @returns {RegistrarActionsResponse}
2574
+ *
2575
+ * @throws if the ENSNode request fails
2576
+ * @throws if the ENSNode API returns an error response
2577
+ * @throws if the ENSNode response breaks required invariants
2578
+ *
2579
+ * @example
2580
+ * ```ts
2581
+ * import {
2582
+ * registrarActionsFilter,,
2583
+ * ENSNodeClient,
2584
+ * } from "@ensnode/ensnode-sdk";
2585
+ * import { namehash } from "viem/ens";
2586
+ *
2587
+ * const client: ENSNodeClient;
2588
+ *
2589
+ * // get latest registrar action records across all indexed subregistries
2590
+ * // NOTE: when no `limit` value is passed,
2591
+ * // the default RESPONSE_ITEMS_PER_PAGE_DEFAULT applies.
2592
+ * const registrarActions = await client.registrarActions();
2593
+ *
2594
+ * // get latest 5 registrar action records across all indexed subregistries
2595
+ * // NOTE: when a `limit` value is passed, it must be lower than or equal to
2596
+ * // the RESPONSE_ITEMS_PER_PAGE_MAX value.
2597
+ * const registrarActions = await client.registrarActions({
2598
+ * limit: 5,
2599
+ * });
2600
+ *
2601
+ * // get latest registrar action records associated with
2602
+ * // subregistry managing `eth` name
2603
+ * await client.registrarActions({
2604
+ * filters: [registrarActionsFilter.byParentNode(namehash('eth'))],
2605
+ * });
2606
+ *
2607
+ * // get latest registrar action records which include referral info
2608
+ * await client.registrarActions({
2609
+ * filters: [registrarActionsFilter.withReferral(true)],
2610
+ * });
2611
+ *
2612
+ * // get latest 10 registrar action records associated with
2613
+ * // subregistry managing `base.eth` name
2614
+ * await client.registrarActions({
2615
+ * filters: [registrarActionsFilter.byParentNode(namehash('base.eth'))],
2616
+ * limit: 10
2617
+ * });
2618
+ * ```
2619
+ */
2620
+ async registrarActions(request = {}) {
2621
+ const buildUrlPath = (filters) => {
2622
+ const bySubregistryNodeFilter = filters?.find(
2623
+ (f) => f.filterType === RegistrarActionsFilterTypes.BySubregistryNode
2624
+ );
2625
+ return bySubregistryNodeFilter ? new URL(`/api/registrar-actions/${bySubregistryNodeFilter.value}`, this.options.url) : new URL(`/api/registrar-actions`, this.options.url);
2626
+ };
2627
+ const buildWithReferralArg = (filters) => {
2628
+ const withReferralFilter = filters?.find(
2629
+ (f) => f.filterType === RegistrarActionsFilterTypes.WithEncodedReferral
2630
+ );
2631
+ return withReferralFilter ? { key: "withReferral", value: "true" } : null;
2632
+ };
2633
+ const buildOrderArg = (order) => {
2634
+ switch (order) {
2635
+ case RegistrarActionsOrders.LatestRegistrarActions: {
2636
+ const [field, direction] = order.split("=");
2637
+ return {
2638
+ key: `sort[${field}]`,
2639
+ value: `${direction}`
2640
+ };
2641
+ }
2642
+ }
2643
+ };
2644
+ const url = buildUrlPath(request.filters);
2645
+ if (request.order) {
2646
+ const orderArgs = buildOrderArg(request.order);
2647
+ url.searchParams.set(orderArgs.key, orderArgs.value);
2648
+ }
2649
+ if (request.itemsPerPage) {
2650
+ url.searchParams.set("itemsPerPage", request.itemsPerPage.toString());
2651
+ }
2652
+ const referralArg = buildWithReferralArg(request.filters);
2653
+ if (referralArg) {
2654
+ url.searchParams.set(referralArg.key, referralArg.value);
2655
+ }
2656
+ const response = await fetch(url);
2657
+ let responseData;
2658
+ try {
2659
+ responseData = await response.json();
2660
+ } catch {
2661
+ throw new Error("Malformed response data: invalid JSON");
2662
+ }
2663
+ if (!response.ok) {
2664
+ let errorResponse;
2665
+ try {
2666
+ errorResponse = deserializeErrorResponse(responseData);
2667
+ } catch {
2668
+ console.log("Registrar Actions API: handling a known server error.");
2669
+ }
2670
+ if (typeof errorResponse !== "undefined") {
2671
+ throw new Error(`Fetching ENSNode Registrar Actions Failed: ${errorResponse.message}`);
2672
+ }
2673
+ }
2674
+ return deserializeRegistrarActionsResponse(responseData);
2675
+ }
1642
2676
  };
1643
2677
 
1644
- // src/resolution/resolver-records-selection.ts
1645
- var isSelectionEmpty = (selection) => !selection.name && !selection.addresses?.length && !selection.texts?.length;
2678
+ // src/identity/identity.ts
2679
+ import { getENSRootChainId as getENSRootChainId3 } from "@ensnode/datasources";
1646
2680
 
1647
- // src/resolution/types.ts
2681
+ // src/identity/types.ts
1648
2682
  var ResolutionStatusIds = {
1649
2683
  /**
1650
2684
  * Represents that the `Identity` is not resolved yet.
@@ -1665,66 +2699,7 @@ var ResolutionStatusIds = {
1665
2699
  Unknown: "unknown"
1666
2700
  };
1667
2701
 
1668
- // src/resolution/default-records-selection.ts
1669
- import {
1670
- DatasourceNames,
1671
- ENSNamespaceIds as ENSNamespaceIds3,
1672
- maybeGetDatasource
1673
- } from "@ensnode/datasources";
1674
- var getENSIP19SupportedCoinTypes = (namespace) => uniq(
1675
- [
1676
- maybeGetDatasource(namespace, DatasourceNames.ReverseResolverBase),
1677
- maybeGetDatasource(namespace, DatasourceNames.ReverseResolverLinea),
1678
- maybeGetDatasource(namespace, DatasourceNames.ReverseResolverOptimism),
1679
- maybeGetDatasource(namespace, DatasourceNames.ReverseResolverArbitrum),
1680
- maybeGetDatasource(namespace, DatasourceNames.ReverseResolverScroll)
1681
- ].filter((ds) => ds !== void 0).map((ds) => ds.chain.id)
1682
- ).map(evmChainIdToCoinType);
1683
- var getCommonCoinTypes = (namespace) => {
1684
- return [ETH_COIN_TYPE, ...getENSIP19SupportedCoinTypes(namespace)];
1685
- };
1686
- var TEXTS = [
1687
- "url",
1688
- "avatar",
1689
- "header",
1690
- "description",
1691
- "email",
1692
- "com.twitter",
1693
- "com.farcaster",
1694
- "com.github"
1695
- ];
1696
- var DefaultRecordsSelection = {
1697
- [ENSNamespaceIds3.Mainnet]: {
1698
- addresses: getCommonCoinTypes(ENSNamespaceIds3.Mainnet),
1699
- texts: TEXTS
1700
- },
1701
- [ENSNamespaceIds3.Sepolia]: {
1702
- addresses: getCommonCoinTypes(ENSNamespaceIds3.Sepolia),
1703
- texts: TEXTS
1704
- },
1705
- [ENSNamespaceIds3.Holesky]: {
1706
- addresses: getCommonCoinTypes(ENSNamespaceIds3.Holesky),
1707
- texts: TEXTS
1708
- },
1709
- [ENSNamespaceIds3.EnsTestEnv]: {
1710
- addresses: getCommonCoinTypes(ENSNamespaceIds3.EnsTestEnv),
1711
- texts: TEXTS
1712
- }
1713
- };
1714
-
1715
- // src/resolution/ensip19-chainid.ts
1716
- import { getENSRootChainId as getENSRootChainId2 } from "@ensnode/datasources";
1717
- import { mainnet } from "viem/chains";
1718
- var getResolvePrimaryNameChainIdParam = (chainId, namespaceId) => {
1719
- const ensRootChainId = getENSRootChainId2(namespaceId);
1720
- return chainId === ensRootChainId ? mainnet.id : chainId;
1721
- };
1722
- var translateDefaultableChainIdToChainId = (chainId, namespaceId) => {
1723
- return chainId === DEFAULT_EVM_CHAIN_ID ? getENSRootChainId2(namespaceId) : chainId;
1724
- };
1725
-
1726
- // src/resolution/identity.ts
1727
- import { getENSRootChainId as getENSRootChainId3 } from "@ensnode/datasources";
2702
+ // src/identity/identity.ts
1728
2703
  function buildUnresolvedIdentity(address, namespaceId, chainId) {
1729
2704
  return {
1730
2705
  resolutionStatus: ResolutionStatusIds.Unresolved,
@@ -1735,6 +2710,50 @@ function buildUnresolvedIdentity(address, namespaceId, chainId) {
1735
2710
  function isResolvedIdentity(identity) {
1736
2711
  return identity.resolutionStatus !== ResolutionStatusIds.Unresolved;
1737
2712
  }
2713
+
2714
+ // src/resolution/ensip19-chainid.ts
2715
+ import { mainnet as mainnet2 } from "viem/chains";
2716
+ import { getENSRootChainId as getENSRootChainId4 } from "@ensnode/datasources";
2717
+ var getResolvePrimaryNameChainIdParam = (chainId, namespaceId) => {
2718
+ const ensRootChainId = getENSRootChainId4(namespaceId);
2719
+ return chainId === ensRootChainId ? mainnet2.id : chainId;
2720
+ };
2721
+ var translateDefaultableChainIdToChainId = (chainId, namespaceId) => {
2722
+ return chainId === DEFAULT_EVM_CHAIN_ID ? getENSRootChainId4(namespaceId) : chainId;
2723
+ };
2724
+
2725
+ // src/resolution/resolver-records-selection.ts
2726
+ var isSelectionEmpty = (selection) => !selection.name && !selection.addresses?.length && !selection.texts?.length;
2727
+
2728
+ // src/tracing/index.ts
2729
+ var TraceableENSProtocol = /* @__PURE__ */ ((TraceableENSProtocol2) => {
2730
+ TraceableENSProtocol2["ForwardResolution"] = "forward-resolution";
2731
+ TraceableENSProtocol2["ReverseResolution"] = "reverse-resolution";
2732
+ return TraceableENSProtocol2;
2733
+ })(TraceableENSProtocol || {});
2734
+ var ForwardResolutionProtocolStep = /* @__PURE__ */ ((ForwardResolutionProtocolStep2) => {
2735
+ ForwardResolutionProtocolStep2["Operation"] = "forward-resolution";
2736
+ ForwardResolutionProtocolStep2["FindResolver"] = "find-resolver";
2737
+ ForwardResolutionProtocolStep2["ActiveResolverExists"] = "active-resolver-exists";
2738
+ ForwardResolutionProtocolStep2["AccelerateENSIP19ReverseResolver"] = "accelerate-ensip-19-reverse-resolver";
2739
+ ForwardResolutionProtocolStep2["AccelerateKnownOffchainLookupResolver"] = "accelerate-known-offchain-lookup-resolver";
2740
+ ForwardResolutionProtocolStep2["AccelerateKnownOnchainStaticResolver"] = "accelerate-known-onchain-static-resolver";
2741
+ ForwardResolutionProtocolStep2["RequireResolver"] = "require-resolver";
2742
+ ForwardResolutionProtocolStep2["ExecuteResolveCalls"] = "execute-resolve-calls";
2743
+ return ForwardResolutionProtocolStep2;
2744
+ })(ForwardResolutionProtocolStep || {});
2745
+ var ReverseResolutionProtocolStep = /* @__PURE__ */ ((ReverseResolutionProtocolStep2) => {
2746
+ ReverseResolutionProtocolStep2["Operation"] = "reverse-resolution";
2747
+ ReverseResolutionProtocolStep2["ResolveReverseName"] = "resolve-reverse-name";
2748
+ ReverseResolutionProtocolStep2["NameRecordExists"] = "name-record-exists-check";
2749
+ ReverseResolutionProtocolStep2["ForwardResolveAddressRecord"] = "forward-resolve-address-record";
2750
+ ReverseResolutionProtocolStep2["VerifyResolvedAddressMatchesAddress"] = "verify-resolved-address-matches-address";
2751
+ return ReverseResolutionProtocolStep2;
2752
+ })(ReverseResolutionProtocolStep || {});
2753
+ var PROTOCOL_ATTRIBUTE_PREFIX = "ens";
2754
+ var ATTR_PROTOCOL_NAME = `${PROTOCOL_ATTRIBUTE_PREFIX}.protocol`;
2755
+ var ATTR_PROTOCOL_STEP = `${PROTOCOL_ATTRIBUTE_PREFIX}.protocol.step`;
2756
+ var ATTR_PROTOCOL_STEP_RESULT = `${PROTOCOL_ATTRIBUTE_PREFIX}.protocol.step.result`;
1738
2757
  export {
1739
2758
  ADDR_REVERSE_NODE,
1740
2759
  ATTR_PROTOCOL_NAME,
@@ -1745,29 +2764,41 @@ export {
1745
2764
  ChainIndexingStatusIds,
1746
2765
  ClientError,
1747
2766
  CrossChainIndexingStrategyIds,
1748
- DEFAULT_ENSNODE_API_URL,
2767
+ CurrencyIds,
1749
2768
  DEFAULT_EVM_CHAIN_ID,
1750
2769
  DEFAULT_EVM_COIN_TYPE,
1751
- DefaultRecordsSelection,
1752
2770
  ENSNamespaceIds,
1753
2771
  ENSNodeClient,
1754
2772
  ETH_COIN_TYPE,
1755
2773
  ETH_NODE,
1756
2774
  ForwardResolutionProtocolStep,
2775
+ ITEMS_PER_PAGE_DEFAULT,
2776
+ ITEMS_PER_PAGE_MAX,
1757
2777
  IndexingStatusResponseCodes,
1758
2778
  LINEANAMES_NODE,
1759
2779
  LruCache,
1760
2780
  OmnichainIndexingStatusIds,
1761
2781
  PROTOCOL_ATTRIBUTE_PREFIX,
2782
+ PaginatedAggregatedReferrersResponseCodes,
1762
2783
  PluginName,
1763
2784
  ROOT_NODE,
2785
+ RegistrarActionTypes,
2786
+ RegistrarActionsFilterTypes,
2787
+ RegistrarActionsOrders,
2788
+ RegistrarActionsResponseCodes,
1764
2789
  ResolutionStatusIds,
1765
2790
  ReverseResolutionProtocolStep,
2791
+ TheGraphCannotFallbackReasonSchema,
2792
+ TheGraphFallbackSchema,
1766
2793
  TraceableENSProtocol,
2794
+ TtlCache,
1767
2795
  accountIdEqual,
2796
+ addDuration,
2797
+ addPrices,
1768
2798
  addrReverseLabel,
1769
2799
  asLowerCaseAddress,
1770
2800
  beautifyName,
2801
+ bigIntToNumber,
1771
2802
  bigintToCoinType,
1772
2803
  buildEnsRainbowClientLabelSet,
1773
2804
  buildLabelSetId,
@@ -1783,6 +2814,8 @@ export {
1783
2814
  createRealtimeIndexingStatusProjection,
1784
2815
  decodeDNSEncodedLiteralName,
1785
2816
  decodeDNSEncodedName,
2817
+ decodeEncodedReferrer,
2818
+ deserializeAccountId,
1786
2819
  deserializeBlockNumber,
1787
2820
  deserializeBlockRef,
1788
2821
  deserializeBlockrange,
@@ -1791,27 +2824,39 @@ export {
1791
2824
  deserializeCrossChainIndexingStatusSnapshot,
1792
2825
  deserializeDatetime,
1793
2826
  deserializeDuration,
2827
+ deserializeENSApiPublicConfig,
1794
2828
  deserializeENSIndexerPublicConfig,
1795
2829
  deserializeErrorResponse,
1796
2830
  deserializeIndexingStatusResponse,
1797
2831
  deserializeOmnichainIndexingStatusSnapshot,
2832
+ deserializePaginatedAggregatedReferrersResponse,
1798
2833
  deserializeRealtimeIndexingStatusProjection,
2834
+ deserializeRegistrarActionsResponse,
1799
2835
  deserializeUnixTimestamp,
1800
2836
  deserializeUrl,
2837
+ durationBetween,
1801
2838
  encodeLabelHash,
1802
2839
  evmChainIdToCoinType,
1803
- getCommonCoinTypes,
2840
+ getCurrencyInfo,
1804
2841
  getENSRootChainId,
2842
+ getEthnamesSubregistryId,
1805
2843
  getNameHierarchy,
1806
2844
  getOmnichainIndexingCursor,
1807
2845
  getOmnichainIndexingStatus,
1808
2846
  getResolvePrimaryNameChainIdParam,
1809
2847
  getTimestampForHighestOmnichainKnownBlock,
1810
2848
  getTimestampForLowestOmnichainStartBlock,
2849
+ hasNullByte,
1811
2850
  interpretedLabelsToInterpretedName,
2851
+ isEncodedLabelHash,
1812
2852
  isHttpProtocol,
2853
+ isLabelHash,
1813
2854
  isNormalizedLabel,
1814
2855
  isNormalizedName,
2856
+ isPriceCurrencyEqual,
2857
+ isPriceEqual,
2858
+ isRegistrarActionPricingAvailable,
2859
+ isRegistrarActionReferralAvailable,
1815
2860
  isResolvedIdentity,
1816
2861
  isSelectionEmpty,
1817
2862
  isSubgraphCompatible,
@@ -1821,24 +2866,44 @@ export {
1821
2866
  literalLabelToInterpretedLabel,
1822
2867
  literalLabelsToInterpretedName,
1823
2868
  literalLabelsToLiteralName,
2869
+ makeENSApiPublicConfigSchema,
1824
2870
  makeSubdomainNode,
1825
2871
  parseNonNegativeInteger,
1826
2872
  parseReverseName,
2873
+ priceDai,
2874
+ priceEth,
2875
+ priceUsdc,
2876
+ registrarActionsFilter,
2877
+ registrarActionsPrerequisites,
1827
2878
  reverseName,
2879
+ serializeAccountId,
1828
2880
  serializeChainId,
1829
2881
  serializeChainIndexingSnapshots,
1830
2882
  serializeCrossChainIndexingStatusSnapshotOmnichain,
1831
2883
  serializeDatetime,
2884
+ serializeENSApiPublicConfig,
1832
2885
  serializeENSIndexerPublicConfig,
1833
2886
  serializeIndexedChainIds,
1834
2887
  serializeIndexingStatusResponse,
2888
+ serializeNamedRegistrarAction,
1835
2889
  serializeOmnichainIndexingStatusSnapshot,
2890
+ serializePaginatedAggregatedReferrersResponse,
2891
+ serializePrice,
2892
+ serializePriceEth,
1836
2893
  serializeRealtimeIndexingStatusProjection,
2894
+ serializeRegistrarAction,
2895
+ serializeRegistrarActionPricing,
2896
+ serializeRegistrarActionsResponse,
2897
+ serializeRegistrationLifecycle,
2898
+ serializeSubregistry,
1837
2899
  serializeUrl,
1838
2900
  sortChainStatusesByStartBlockAsc,
2901
+ staleWhileRevalidate,
2902
+ stripNullBytes,
1839
2903
  translateDefaultableChainIdToChainId,
1840
2904
  uint256ToHex32,
1841
2905
  uniq,
1842
- validateSupportedLabelSetAndVersion
2906
+ validateSupportedLabelSetAndVersion,
2907
+ zeroEncodedReferrer
1843
2908
  };
1844
2909
  //# sourceMappingURL=index.js.map