@ensnode/ensnode-sdk 1.13.0 → 1.14.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.
@@ -0,0 +1,3290 @@
1
+ // src/ensapi/config/zod-schemas.ts
2
+ import { z as z5 } from "zod/v4";
3
+
4
+ // src/ensindexer/config/zod-schemas.ts
5
+ import { z as z3 } from "zod/v4";
6
+
7
+ // src/ensrainbow/zod-schemas/config.ts
8
+ import { z as z2 } from "zod/v4";
9
+
10
+ // src/shared/zod-schemas.ts
11
+ import { AccountId as CaipAccountId } from "caip";
12
+ import { reinterpretName, toNormalizedAddress } from "enssdk";
13
+ import { isAddress, isHex, size } from "viem";
14
+ import { z } from "zod/v4";
15
+
16
+ // src/ens/index.ts
17
+ import { ENSNamespaceIds, getENSRootChainId } from "@ensnode/datasources";
18
+
19
+ // src/shared/currencies.ts
20
+ import { parseUnits } from "viem";
21
+ var CurrencyIds = {
22
+ ETH: "ETH",
23
+ USDC: "USDC",
24
+ DAI: "DAI",
25
+ ENSTokens: "ENSTokens"
26
+ };
27
+ var currencyInfo = {
28
+ [CurrencyIds.ETH]: {
29
+ id: CurrencyIds.ETH,
30
+ name: "ETH",
31
+ decimals: 18
32
+ },
33
+ [CurrencyIds.USDC]: {
34
+ id: CurrencyIds.USDC,
35
+ name: "USDC",
36
+ decimals: 6
37
+ },
38
+ [CurrencyIds.DAI]: {
39
+ id: CurrencyIds.DAI,
40
+ name: "Dai Stablecoin",
41
+ decimals: 18
42
+ },
43
+ [CurrencyIds.ENSTokens]: {
44
+ id: CurrencyIds.ENSTokens,
45
+ name: "$ENS Tokens",
46
+ decimals: 18
47
+ }
48
+ };
49
+ function isPriceCurrencyEqual(priceA, priceB) {
50
+ return priceA.currency === priceB.currency;
51
+ }
52
+ function isPriceEqual(priceA, priceB) {
53
+ return isPriceCurrencyEqual(priceA, priceB) && priceA.amount === priceB.amount;
54
+ }
55
+ function addPrices(...prices) {
56
+ const firstPrice = prices[0];
57
+ const allPricesInSameCurrency = prices.every((price) => isPriceCurrencyEqual(firstPrice, price));
58
+ if (allPricesInSameCurrency === false) {
59
+ throw new Error("All prices must have the same currency to be added together.");
60
+ }
61
+ const { currency } = firstPrice;
62
+ return prices.reduce(
63
+ (acc, price) => ({
64
+ amount: acc.amount + price.amount,
65
+ currency
66
+ }),
67
+ {
68
+ amount: 0n,
69
+ currency: firstPrice.currency
70
+ }
71
+ );
72
+ }
73
+
74
+ // src/shared/zod-schemas.ts
75
+ var makeBooleanStringSchema = (valueLabel = "Value") => z.string().pipe(
76
+ z.enum(["true", "false"], {
77
+ error: `${valueLabel} must be 'true' or 'false'.`
78
+ })
79
+ ).transform((val) => val === "true");
80
+ var makeFiniteNonNegativeNumberSchema = (valueLabel = "Value") => z.number({
81
+ // NOTE: Zod's implementation of `number` automatically rejects NaN and Infinity values.
82
+ // and therefore the finite check is implicit.
83
+ error: `${valueLabel} must be a finite number.`
84
+ }).nonnegative({
85
+ error: `${valueLabel} must be a non-negative number (>=0).`
86
+ });
87
+ var makeIntegerSchema = (valueLabel = "Value") => z.int({
88
+ error: `${valueLabel} must be an integer.`
89
+ });
90
+ var makePositiveIntegerSchema = (valueLabel = "Value") => makeIntegerSchema(valueLabel).positive({
91
+ error: `${valueLabel} must be a positive integer (>0).`
92
+ });
93
+ var makeNonNegativeIntegerSchema = (valueLabel = "Value") => makeIntegerSchema(valueLabel).nonnegative({
94
+ error: `${valueLabel} must be a non-negative integer (>=0).`
95
+ });
96
+ var makeDurationSchema = (valueLabel = "Value") => z.number({
97
+ error: `${valueLabel} must be a number.`
98
+ }).pipe(makeNonNegativeIntegerSchema(valueLabel));
99
+ var makeChainIdSchema = (valueLabel = "Chain ID") => makePositiveIntegerSchema(valueLabel).transform((val) => val);
100
+ 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}`));
101
+ var makeDefaultableChainIdSchema = (valueLabel = "Defaultable Chain ID") => makeNonNegativeIntegerSchema(valueLabel).transform((val) => val);
102
+ var makeDefaultableChainIdStringSchema = (valueLabel = "Defaultable Chain ID String") => z.string({ error: `${valueLabel} must be a string representing a chain ID.` }).pipe(z.coerce.number({ error: `${valueLabel} must represent a non-negative integer (>=0).` })).pipe(makeDefaultableChainIdSchema(`The numeric value represented by ${valueLabel}`));
103
+ var makeCoinTypeSchema = (valueLabel = "Coin Type") => z.number({ error: `${valueLabel} must be a number.` }).int({ error: `${valueLabel} must be an integer.` }).nonnegative({ error: `${valueLabel} must be a non-negative integer (>=0).` }).transform((val) => val);
104
+ var makeCoinTypeStringSchema = (valueLabel = "Coin Type String") => z.string({ error: `${valueLabel} must be a string representing a coin type.` }).pipe(z.coerce.number({ error: `${valueLabel} must represent a non-negative integer (>=0).` })).pipe(makeCoinTypeSchema(`The numeric value represented by ${valueLabel}`));
105
+ var makeNormalizedAddressSchema = (valueLabel = "EVM address") => z.string().check((ctx) => {
106
+ if (!isAddress(ctx.value, { strict: false })) {
107
+ ctx.issues.push({
108
+ code: "custom",
109
+ message: `${valueLabel} must be a valid EVM address`,
110
+ input: ctx.value
111
+ });
112
+ }
113
+ }).transform((val) => toNormalizedAddress(val));
114
+ var makeDatetimeSchema = (valueLabel = "Datetime string") => z.iso.datetime({ error: `${valueLabel} must be a string in ISO 8601 format.` }).transform((v) => new Date(v));
115
+ var makeUnixTimestampSchema = (valueLabel = "Timestamp") => makeIntegerSchema(valueLabel);
116
+ var makeUrlSchema = (valueLabel = "Value") => z.url({
117
+ error: `${valueLabel} must be a valid URL string (e.g., http://localhost:8080 or https://example.com).`,
118
+ abort: true
119
+ }).transform((v) => new URL(v));
120
+ var makeCommaSeparatedList = (valueLabel = "Value") => z.string({ error: `${valueLabel} must be a comma separated list.` }).transform((val) => val.split(",").filter(Boolean)).refine((val) => val.length > 0, {
121
+ error: `${valueLabel} must be a comma separated list with at least one value.`
122
+ });
123
+ var makeBlockNumberSchema = (valueLabel = "Block number") => makeNonNegativeIntegerSchema(valueLabel);
124
+ var makeBlockRefSchema = (valueLabel = "Value") => z.strictObject(
125
+ {
126
+ timestamp: makeUnixTimestampSchema(`${valueLabel}.timestamp`),
127
+ number: makeBlockNumberSchema(`${valueLabel}.number`)
128
+ },
129
+ {
130
+ error: `${valueLabel} must be a valid BlockRef object.`
131
+ }
132
+ );
133
+ var makeENSNamespaceIdSchema = (valueLabel = "ENSNamespaceId") => z.enum(ENSNamespaceIds, {
134
+ error() {
135
+ return `Invalid ${valueLabel}. Supported ENS namespace IDs are: ${Object.keys(ENSNamespaceIds).join(", ")}`;
136
+ }
137
+ });
138
+ var makePriceAmountSchema = (valueLabel = "Amount") => z.coerce.bigint({
139
+ error: `${valueLabel} must represent a bigint.`
140
+ }).nonnegative({
141
+ error: `${valueLabel} must not be negative.`
142
+ });
143
+ var makeSerializedCurrencyAmountSchema = (valueLabel = "Serialized Currency Amount") => z.string({ error: `${valueLabel} must be a string.` }).regex(/^\d+$/, {
144
+ error: `${valueLabel} can only contain digits (0-9) and must represent a non-negative integer.`
145
+ });
146
+ var makePriceCurrencySchema = (currency, valueLabel = "Price Currency") => z.strictObject({
147
+ amount: makePriceAmountSchema(`${valueLabel} amount`),
148
+ currency: z.literal(currency, {
149
+ error: `${valueLabel} currency must be set to '${currency}'.`
150
+ })
151
+ });
152
+ var makeSerializedPriceCurrencySchema = (currency, valueLabel = "Price Currency") => z.strictObject({
153
+ amount: makeSerializedCurrencyAmountSchema(`${valueLabel} amount`),
154
+ currency: z.literal(currency, {
155
+ error: `${valueLabel} currency must be set to '${currency}'.`
156
+ })
157
+ });
158
+ var makePriceSchema = (valueLabel = "Price") => z.discriminatedUnion(
159
+ "currency",
160
+ [
161
+ makePriceCurrencySchema(CurrencyIds.ETH, valueLabel),
162
+ makePriceCurrencySchema(CurrencyIds.USDC, valueLabel),
163
+ makePriceCurrencySchema(CurrencyIds.DAI, valueLabel),
164
+ makePriceCurrencySchema(CurrencyIds.ENSTokens, valueLabel)
165
+ ],
166
+ { error: `${valueLabel} currency must be one of ${Object.values(CurrencyIds).join(", ")}` }
167
+ );
168
+ var makePriceEthSchema = (valueLabel = "Price ETH") => makePriceCurrencySchema(CurrencyIds.ETH, valueLabel).transform((v) => v);
169
+ var makeSerializedPriceEthSchema = (valueLabel = "Serialized Price ETH") => makeSerializedPriceCurrencySchema(CurrencyIds.ETH, valueLabel).transform(
170
+ (v) => v
171
+ );
172
+ var makePriceUsdcSchema = (valueLabel = "Price USDC") => makePriceCurrencySchema(CurrencyIds.USDC, valueLabel).transform((v) => v);
173
+ var makePriceDaiSchema = (valueLabel = "Price DAI") => makePriceCurrencySchema(CurrencyIds.DAI, valueLabel).transform((v) => v);
174
+ var makePriceEnsTokensSchema = (valueLabel = "Price ENSTokens") => makePriceCurrencySchema(CurrencyIds.ENSTokens, valueLabel).transform((v) => v);
175
+ var makeAccountIdSchema = (valueLabel = "AccountId") => z.strictObject({
176
+ chainId: makeChainIdSchema(`${valueLabel} chain ID`),
177
+ address: makeNormalizedAddressSchema(`${valueLabel} address`)
178
+ });
179
+ var makeAccountIdStringSchema = (valueLabel = "Account ID String") => z.coerce.string().transform((v) => {
180
+ const result = new CaipAccountId(v);
181
+ return {
182
+ chainId: Number(result.chainId.reference),
183
+ address: result.address
184
+ };
185
+ }).pipe(makeAccountIdSchema(valueLabel));
186
+ var makeHexStringSchema = (options, valueLabel = "String representation of bytes array") => z.string().check(function invariant_isHexEncoded(ctx) {
187
+ if (!isHex(ctx.value)) {
188
+ ctx.issues.push({
189
+ code: "custom",
190
+ input: ctx.value,
191
+ message: `${valueLabel} must be a hexadecimal value which starts with '0x'.`
192
+ });
193
+ }
194
+ }).transform((v) => v).check(function invariant_encodesRequiredBytesCount(ctx) {
195
+ const expectedBytesCount = options.bytesCount;
196
+ const actualBytesCount = size(ctx.value);
197
+ if (actualBytesCount !== expectedBytesCount) {
198
+ ctx.issues.push({
199
+ code: "custom",
200
+ input: ctx.value,
201
+ message: `${valueLabel} must represent exactly ${expectedBytesCount} bytes. Currently represented bytes count: ${actualBytesCount}.`
202
+ });
203
+ }
204
+ });
205
+ var makeNodeSchema = (valueLabel = "Node") => makeHexStringSchema({ bytesCount: 32 }, valueLabel);
206
+ var makeTransactionHashSchema = (valueLabel = "Transaction hash") => makeHexStringSchema({ bytesCount: 32 }, valueLabel);
207
+ var makeReinterpretedNameSchema = (valueLabel = "Reinterpreted Name") => z.string().transform((v) => v).check((ctx) => {
208
+ try {
209
+ reinterpretName(ctx.value);
210
+ } catch (error) {
211
+ const errorMessage = error instanceof Error ? error.message : "Unknown error";
212
+ ctx.issues.push({
213
+ code: "custom",
214
+ input: ctx.value,
215
+ message: `${valueLabel} cannot be reinterpreted: ${errorMessage}`
216
+ });
217
+ }
218
+ }).transform(reinterpretName);
219
+
220
+ // src/ensrainbow/zod-schemas/config.ts
221
+ var makeLabelSetIdSchema = (valueLabel = "Label set ID") => {
222
+ 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-]+$/, {
223
+ error: `${valueLabel} can only contain lowercase letters (a-z) and hyphens (-)`
224
+ });
225
+ };
226
+ var makeLabelSetVersionSchema = (valueLabel = "Label set version") => makeNonNegativeIntegerSchema(valueLabel);
227
+ var makeLabelSetVersionStringSchema = (valueLabel = "Label set version") => z2.coerce.number({ error: `${valueLabel} must be a non-negative integer` }).pipe(makeLabelSetVersionSchema(valueLabel));
228
+ var makeEnsRainbowPublicConfigSchema = (valueLabel = "EnsRainbowPublicConfig") => z2.object({
229
+ serverLabelSet: z2.object({
230
+ labelSetId: makeLabelSetIdSchema(`${valueLabel}.serverLabelSet.labelSetId`),
231
+ highestLabelSetVersion: makeLabelSetVersionSchema(
232
+ `${valueLabel}.serverLabelSet.highestLabelSetVersion`
233
+ )
234
+ }),
235
+ versionInfo: z2.object({
236
+ ensRainbow: z2.string().nonempty({ error: `${valueLabel}.versionInfo.ensRainbow must be a non-empty string.` })
237
+ })
238
+ });
239
+
240
+ // src/shared/collections.ts
241
+ var uniq = (arr) => [...new Set(arr)];
242
+
243
+ // src/ensindexer/config/is-subgraph-compatible.ts
244
+ import { ENSNamespaceIds as ENSNamespaceIds2 } from "@ensnode/datasources";
245
+ function isSubgraphCompatible(config) {
246
+ const onlySubgraphPluginActivated = config.plugins.length === 1 && config.plugins[0] === "subgraph" /* Subgraph */;
247
+ const isSubgraphLabelSet = config.clientLabelSet.labelSetId === "subgraph" && config.clientLabelSet.labelSetVersion === 0;
248
+ const isEnsTestEnvLabelSet = config.clientLabelSet.labelSetId === "ens-test-env" && config.clientLabelSet.labelSetVersion === 0;
249
+ const labelSetIsSubgraphCompatible = isSubgraphLabelSet || config.namespace === ENSNamespaceIds2.EnsTestEnv && isEnsTestEnvLabelSet;
250
+ return onlySubgraphPluginActivated && labelSetIsSubgraphCompatible;
251
+ }
252
+
253
+ // src/ensindexer/config/labelset-utils.ts
254
+ function validateSupportedLabelSetAndVersion(serverSet, clientSet) {
255
+ if (clientSet.labelSetId === void 0) {
256
+ return;
257
+ }
258
+ if (serverSet.labelSetId !== clientSet.labelSetId) {
259
+ throw new Error(
260
+ `Server label set ID "${serverSet.labelSetId}" does not match client's requested label set ID "${clientSet.labelSetId}".`
261
+ );
262
+ }
263
+ if (clientSet.labelSetVersion !== void 0 && serverSet.highestLabelSetVersion < clientSet.labelSetVersion) {
264
+ throw new Error(
265
+ `Server highest label set version ${serverSet.highestLabelSetVersion} is less than client's requested version ${clientSet.labelSetVersion} for label set ID "${clientSet.labelSetId}".`
266
+ );
267
+ }
268
+ }
269
+
270
+ // src/ensindexer/config/validations.ts
271
+ function invariant_ensDbVersionIsSameAsEnsIndexerVersion(ctx) {
272
+ const versionInfo = ctx.value;
273
+ if (versionInfo.ensDb !== versionInfo.ensIndexer) {
274
+ ctx.issues.push({
275
+ code: "custom",
276
+ input: versionInfo,
277
+ message: "`ensDb` version must be same as `ensIndexer` version"
278
+ });
279
+ }
280
+ }
281
+
282
+ // src/ensindexer/config/zod-schemas.ts
283
+ var makeIndexedChainIdsSchema = (valueLabel = "Indexed Chain IDs") => z3.set(makeChainIdSchema(valueLabel), { error: `${valueLabel} must be a set` }).min(1, {
284
+ error: `${valueLabel} must be a set with at least one chain ID.`
285
+ });
286
+ var makeSerializedIndexedChainIdsSchema = (valueLabel = "Indexed Chain IDs") => z3.array(makeChainIdSchema(valueLabel), {
287
+ error: `${valueLabel} must be an array.`
288
+ }).min(1, {
289
+ error: `${valueLabel} must be an array with at least one chain ID.`
290
+ });
291
+ var makePluginsListSchema = (valueLabel = "Plugins") => z3.array(z3.string(), {
292
+ error: `${valueLabel} must be a list of strings.`
293
+ }).min(1, {
294
+ error: `${valueLabel} must be a list of strings with at least one string value`
295
+ }).refine((arr) => arr.length === uniq(arr).length, {
296
+ error: `${valueLabel} cannot contain duplicate values.`
297
+ });
298
+ var makeEnsIndexerSchemaNameSchema = (valueLabel = "ENS Indexer Schema Name") => z3.string({ error: `${valueLabel} must be a string` }).trim().nonempty({
299
+ error: `${valueLabel} is required and must be a non-empty string.`
300
+ });
301
+ var makeFullyPinnedLabelSetSchema = (valueLabel = "Label set") => {
302
+ let valueLabelLabelSetId = valueLabel;
303
+ let valueLabelLabelSetVersion = valueLabel;
304
+ if (valueLabel === "LABEL_SET") {
305
+ valueLabelLabelSetId = "LABEL_SET_ID";
306
+ valueLabelLabelSetVersion = "LABEL_SET_VERSION";
307
+ } else {
308
+ valueLabelLabelSetId = `${valueLabel}.labelSetId`;
309
+ valueLabelLabelSetVersion = `${valueLabel}.labelSetVersion`;
310
+ }
311
+ return z3.object({
312
+ labelSetId: makeLabelSetIdSchema(valueLabelLabelSetId),
313
+ labelSetVersion: makeLabelSetVersionStringSchema(valueLabelLabelSetVersion)
314
+ });
315
+ };
316
+ var makeNonEmptyStringSchema = (valueLabel = "Value") => z3.string().nonempty({ error: `${valueLabel} must be a non-empty string.` });
317
+ var makeEnsIndexerVersionInfoSchema = (valueLabel = "Value") => z3.object(
318
+ {
319
+ ponder: makeNonEmptyStringSchema(),
320
+ ensDb: makeNonEmptyStringSchema(),
321
+ ensIndexer: makeNonEmptyStringSchema(),
322
+ ensNormalize: makeNonEmptyStringSchema()
323
+ },
324
+ {
325
+ error: `${valueLabel} must be a valid ENSIndexerVersionInfo object.`
326
+ }
327
+ ).check(invariant_ensDbVersionIsSameAsEnsIndexerVersion);
328
+ var makeENSIndexerVersionInfoSchema = makeEnsIndexerVersionInfoSchema;
329
+ function invariant_isSubgraphCompatibleRequirements(ctx) {
330
+ const { value: config } = ctx;
331
+ if (config.isSubgraphCompatible && !isSubgraphCompatible(config)) {
332
+ ctx.issues.push({
333
+ code: "custom",
334
+ input: config,
335
+ message: `'isSubgraphCompatible' requires only the '${"subgraph" /* Subgraph */}' plugin to be active and 'clientLabelSet' must be {labelSetId: "subgraph", labelSetVersion: 0}`
336
+ });
337
+ }
338
+ }
339
+ function invariant_ensRainbowSupportedLabelSetAndVersion(ctx) {
340
+ const { clientLabelSet } = ctx.value;
341
+ const { serverLabelSet } = ctx.value.ensRainbowPublicConfig;
342
+ try {
343
+ validateSupportedLabelSetAndVersion(serverLabelSet, clientLabelSet);
344
+ } catch (error) {
345
+ const errorMessage = error instanceof Error ? error.message : "Unknown error";
346
+ ctx.issues.push({
347
+ code: "custom",
348
+ input: ctx.value,
349
+ message: `The ENSRainbow label set and version specified in the config are not supported by the ENSRainbow version specified in ensRainbowPublicConfig. Cause: ${errorMessage}`
350
+ });
351
+ }
352
+ }
353
+ var makeEnsIndexerPublicConfigSchema = (valueLabel = "ENSIndexerPublicConfig") => z3.object({
354
+ ensIndexerSchemaName: makeEnsIndexerSchemaNameSchema(`${valueLabel}.ensIndexerSchemaName`),
355
+ ensRainbowPublicConfig: makeEnsRainbowPublicConfigSchema(
356
+ `${valueLabel}.ensRainbowPublicConfig`
357
+ ),
358
+ indexedChainIds: makeIndexedChainIdsSchema(`${valueLabel}.indexedChainIds`),
359
+ isSubgraphCompatible: z3.boolean({
360
+ error: `${valueLabel}.isSubgraphCompatible must be a boolean value.`
361
+ }),
362
+ clientLabelSet: makeFullyPinnedLabelSetSchema(`${valueLabel}.clientLabelSet`),
363
+ namespace: makeENSNamespaceIdSchema(`${valueLabel}.namespace`),
364
+ plugins: makePluginsListSchema(`${valueLabel}.plugins`),
365
+ versionInfo: makeEnsIndexerVersionInfoSchema(`${valueLabel}.versionInfo`)
366
+ }).check(invariant_isSubgraphCompatibleRequirements).check(invariant_ensRainbowSupportedLabelSetAndVersion);
367
+ var makeENSIndexerPublicConfigSchema = makeEnsIndexerPublicConfigSchema;
368
+ var makeSerializedEnsIndexerPublicConfigSchema = (valueLabel = "Serialized ENSIndexerPublicConfig") => z3.object({
369
+ ensIndexerSchemaName: makeEnsIndexerSchemaNameSchema(`${valueLabel}.ensIndexerSchemaName`),
370
+ ensRainbowPublicConfig: makeEnsRainbowPublicConfigSchema(
371
+ `${valueLabel}.ensRainbowPublicConfig`
372
+ ),
373
+ indexedChainIds: makeSerializedIndexedChainIdsSchema(`${valueLabel}.indexedChainIds`),
374
+ isSubgraphCompatible: z3.boolean({
375
+ error: `${valueLabel}.isSubgraphCompatible must be a boolean value.`
376
+ }),
377
+ clientLabelSet: makeFullyPinnedLabelSetSchema(`${valueLabel}.clientLabelSet`),
378
+ namespace: makeENSNamespaceIdSchema(`${valueLabel}.namespace`),
379
+ plugins: makePluginsListSchema(`${valueLabel}.plugins`),
380
+ versionInfo: makeEnsIndexerVersionInfoSchema(`${valueLabel}.versionInfo`)
381
+ });
382
+
383
+ // src/shared/config/thegraph.ts
384
+ import { z as z4 } from "zod/v4";
385
+ var TheGraphCannotFallbackReasonSchema = z4.enum({
386
+ NotSubgraphCompatible: "not-subgraph-compatible",
387
+ NoApiKey: "no-api-key",
388
+ NoSubgraphUrl: "no-subgraph-url"
389
+ });
390
+ var TheGraphFallbackSchema = z4.discriminatedUnion("canFallback", [
391
+ z4.strictObject({
392
+ canFallback: z4.literal(true),
393
+ url: z4.string()
394
+ }),
395
+ z4.strictObject({
396
+ canFallback: z4.literal(false),
397
+ reason: TheGraphCannotFallbackReasonSchema
398
+ })
399
+ ]);
400
+
401
+ // src/ensapi/config/zod-schemas.ts
402
+ var makeEnsApiVersionInfoSchema = (valueLabel = "ENS API version info") => z5.object({
403
+ ensApi: z5.string().nonempty(`${valueLabel}.ensApi must be a non-empty string`),
404
+ ensNormalize: z5.string().nonempty(`${valueLabel}.ensNormalize must be a non-empty string`)
405
+ });
406
+ function makeEnsApiPublicConfigSchema(valueLabel) {
407
+ const label = valueLabel ?? "ENSApiPublicConfig";
408
+ return z5.object({
409
+ theGraphFallback: TheGraphFallbackSchema,
410
+ ensIndexerPublicConfig: makeEnsIndexerPublicConfigSchema(`${label}.ensIndexerPublicConfig`),
411
+ versionInfo: makeEnsApiVersionInfoSchema(`${label}.versionInfo`)
412
+ });
413
+ }
414
+ var makeENSApiPublicConfigSchema = makeEnsApiPublicConfigSchema;
415
+ function makeSerializedEnsApiPublicConfigSchema(valueLabel) {
416
+ const label = valueLabel ?? "ENSApiPublicConfig";
417
+ return z5.object({
418
+ ensIndexerPublicConfig: makeSerializedEnsIndexerPublicConfigSchema(
419
+ `${label}.ensIndexerPublicConfig`
420
+ ),
421
+ theGraphFallback: TheGraphFallbackSchema,
422
+ versionInfo: makeEnsApiVersionInfoSchema(`${label}.versionInfo`)
423
+ });
424
+ }
425
+
426
+ // src/ensnode/api/indexing-status/zod-schemas.ts
427
+ import { z as z12 } from "zod/v4";
428
+
429
+ // src/indexing-status/zod-schema/realtime-indexing-status-projection.ts
430
+ import { z as z9 } from "zod/v4";
431
+
432
+ // src/indexing-status/zod-schema/cross-chain-indexing-status-snapshot.ts
433
+ import { z as z8 } from "zod/v4";
434
+
435
+ // src/shared/block-ref.ts
436
+ function isBefore(blockA, blockB) {
437
+ return blockA.number < blockB.number;
438
+ }
439
+ function isEqualTo(blockA, blockB) {
440
+ return blockA.number === blockB.number && blockA.timestamp === blockB.timestamp;
441
+ }
442
+ function isBeforeOrEqualTo(blockA, blockB) {
443
+ return isBefore(blockA, blockB) || isEqualTo(blockA, blockB);
444
+ }
445
+
446
+ // src/shared/blockrange.ts
447
+ var RangeTypeIds = {
448
+ Unbounded: "unbounded",
449
+ LeftBounded: "left-bounded",
450
+ RightBounded: "right-bounded",
451
+ Bounded: "bounded"
452
+ };
453
+
454
+ // src/indexing-status/chain-indexing-status-snapshot.ts
455
+ var ChainIndexingStatusIds = {
456
+ /**
457
+ * Represents that indexing of the chain is not ready to begin yet because:
458
+ * - ENSIndexer is in its initialization phase and the data to build a
459
+ * "true" {@link ChainIndexingStatusSnapshot} for the chain is still being loaded; or
460
+ * - ENSIndexer is using an omnichain indexing strategy and the
461
+ * `omnichainIndexingCursor` is <= `config.startBlock.timestamp` for the chain's
462
+ * {@link ChainIndexingStatusSnapshot}.
463
+ */
464
+ Queued: "chain-queued",
465
+ /**
466
+ * Represents that indexing of the chain is in progress and under a special
467
+ * "backfill" phase that optimizes for accelerated indexing until reaching the
468
+ * "fixed target" `backfillEndBlock`.
469
+ */
470
+ Backfill: "chain-backfill",
471
+ /**
472
+ * Represents that the "backfill" phase of indexing the chain is completed
473
+ * and that the chain is configured to be indexed for an indefinite range.
474
+ * Therefore, indexing of the chain remains indefinitely in progress where
475
+ * ENSIndexer will continuously work to discover and index new blocks as they
476
+ * are added to the chain across time.
477
+ */
478
+ Following: "chain-following",
479
+ /**
480
+ * Represents that indexing of the chain is completed as the chain is configured
481
+ * to be indexed for a definite range and the indexing of all blocks through
482
+ * that definite range is completed.
483
+ */
484
+ Completed: "chain-completed"
485
+ };
486
+
487
+ // src/indexing-status/cross-chain-indexing-status-snapshot.ts
488
+ var CrossChainIndexingStrategyIds = {
489
+ /**
490
+ * Represents that the indexing of events across all indexed chains will
491
+ * proceed in a deterministic "omnichain" ordering by block timestamp, chain ID,
492
+ * and block number.
493
+ *
494
+ * This strategy is "deterministic" in that the order of processing cross-chain indexed
495
+ * events and each resulting indexed data state transition recorded in ENSDb is always
496
+ * the same for each ENSIndexer instance operating with an equivalent
497
+ * `ENSIndexerConfig` and ENSIndexer version. However it also has the drawbacks of:
498
+ * - increased indexing latency that must wait for the slowest indexed chain to
499
+ * add new blocks or to discover new blocks through the configured RPCs.
500
+ * - if any indexed chain gets "stuck" due to chain or RPC failures, all indexed chains
501
+ * will be affected.
502
+ */
503
+ Omnichain: "omnichain"
504
+ };
505
+ function getHighestKnownBlockTimestamp(chains) {
506
+ if (chains.length === 0) {
507
+ throw new Error(
508
+ "Invariant violation: at least one chain is required to determine the highest known block timestamp"
509
+ );
510
+ }
511
+ const startBlockTimestamps = chains.map((chain) => chain.config.startBlock.timestamp);
512
+ const endBlockTimestamps = chains.map((chain) => chain.config).filter((chainConfig) => chainConfig.rangeType === RangeTypeIds.Bounded).map((chainConfig) => chainConfig.endBlock.timestamp);
513
+ const backfillEndBlockTimestamps = chains.filter((chain) => chain.chainStatus === ChainIndexingStatusIds.Backfill).map((chain) => chain.backfillEndBlock.timestamp);
514
+ const latestKnownBlockTimestamps = chains.filter((chain) => chain.chainStatus === ChainIndexingStatusIds.Following).map((chain) => chain.latestKnownBlock.timestamp);
515
+ return Math.max(
516
+ ...startBlockTimestamps,
517
+ ...endBlockTimestamps,
518
+ ...backfillEndBlockTimestamps,
519
+ ...latestKnownBlockTimestamps
520
+ );
521
+ }
522
+
523
+ // src/indexing-status/zod-schema/omnichain-indexing-status-snapshot.ts
524
+ import { z as z7 } from "zod/v4";
525
+
526
+ // src/indexing-status/omnichain-indexing-status-snapshot.ts
527
+ var OmnichainIndexingStatusIds = {
528
+ /**
529
+ * Represents that omnichain indexing is not ready to begin yet because
530
+ * ENSIndexer is in its initialization phase and the data to build a "true"
531
+ * {@link OmnichainIndexingStatusSnapshot} is still being loaded.
532
+ */
533
+ Unstarted: "omnichain-unstarted",
534
+ /**
535
+ * Represents that omnichain indexing is in an overall "backfill" status because
536
+ * - At least one indexed chain has a `chainStatus` of
537
+ * {@link ChainIndexingStatusIds.Backfill}; and
538
+ * - No indexed chain has a `chainStatus` of {@link ChainIndexingStatusIds.Following}.
539
+ */
540
+ Backfill: "omnichain-backfill",
541
+ /**
542
+ * Represents that omnichain indexing is in an overall "following" status because
543
+ * at least one indexed chain has a `chainStatus` of
544
+ * {@link ChainIndexingStatusIds.Following}.
545
+ */
546
+ Following: "omnichain-following",
547
+ /**
548
+ * Represents that omnichain indexing has completed because all indexed chains have
549
+ * a `chainStatus` of {@link ChainIndexingStatusIds.Completed}.
550
+ */
551
+ Completed: "omnichain-completed"
552
+ };
553
+ function checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotUnstarted(chains) {
554
+ return chains.every((chain) => chain.chainStatus === ChainIndexingStatusIds.Queued);
555
+ }
556
+ function checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotBackfill(chains) {
557
+ const atLeastOneChainInTargetStatus = chains.some(
558
+ (chain) => chain.chainStatus === ChainIndexingStatusIds.Backfill
559
+ );
560
+ const otherChainsHaveValidStatuses = chains.every(
561
+ (chain) => chain.chainStatus === ChainIndexingStatusIds.Queued || chain.chainStatus === ChainIndexingStatusIds.Backfill || chain.chainStatus === ChainIndexingStatusIds.Completed
562
+ );
563
+ return atLeastOneChainInTargetStatus && otherChainsHaveValidStatuses;
564
+ }
565
+ function checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotCompleted(chains) {
566
+ const allChainsHaveValidStatuses = chains.every(
567
+ (chain) => chain.chainStatus === ChainIndexingStatusIds.Completed
568
+ );
569
+ return allChainsHaveValidStatuses;
570
+ }
571
+ function checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotFollowing(chains) {
572
+ const allChainsHaveValidStatuses = chains.some(
573
+ (chain) => chain.chainStatus === ChainIndexingStatusIds.Following
574
+ );
575
+ return allChainsHaveValidStatuses;
576
+ }
577
+ function getOmnichainIndexingStatus(chains) {
578
+ if (checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotFollowing(chains)) {
579
+ return OmnichainIndexingStatusIds.Following;
580
+ }
581
+ if (checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotBackfill(chains)) {
582
+ return OmnichainIndexingStatusIds.Backfill;
583
+ }
584
+ if (checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotUnstarted(chains)) {
585
+ return OmnichainIndexingStatusIds.Unstarted;
586
+ }
587
+ if (checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotCompleted(chains)) {
588
+ return OmnichainIndexingStatusIds.Completed;
589
+ }
590
+ throw new Error(`Unable to determine omnichain indexing status for provided chains.`);
591
+ }
592
+
593
+ // src/indexing-status/zod-schema/chain-indexing-status-snapshot.ts
594
+ import { z as z6 } from "zod/v4";
595
+ function invariant_chainSnapshotQueuedBlocks(ctx) {
596
+ const { config } = ctx.value;
597
+ if (config.rangeType === RangeTypeIds.LeftBounded) {
598
+ return;
599
+ }
600
+ if (isBeforeOrEqualTo(config.startBlock, config.endBlock) === false) {
601
+ ctx.issues.push({
602
+ code: "custom",
603
+ input: ctx.value,
604
+ message: "`config.startBlock` must be before or same as `config.endBlock`."
605
+ });
606
+ }
607
+ }
608
+ function invariant_chainSnapshotBackfillBlocks(ctx) {
609
+ const { config, latestIndexedBlock, backfillEndBlock } = ctx.value;
610
+ if (isBeforeOrEqualTo(config.startBlock, latestIndexedBlock) === false) {
611
+ ctx.issues.push({
612
+ code: "custom",
613
+ input: ctx.value,
614
+ message: "`config.startBlock` must be before or same as `latestIndexedBlock`."
615
+ });
616
+ }
617
+ if (isBeforeOrEqualTo(latestIndexedBlock, backfillEndBlock) === false) {
618
+ ctx.issues.push({
619
+ code: "custom",
620
+ input: ctx.value,
621
+ message: "`latestIndexedBlock` must be before or same as `backfillEndBlock`."
622
+ });
623
+ }
624
+ if (config.rangeType === RangeTypeIds.LeftBounded) {
625
+ return;
626
+ }
627
+ if (isEqualTo(backfillEndBlock, config.endBlock) === false) {
628
+ ctx.issues.push({
629
+ code: "custom",
630
+ input: ctx.value,
631
+ message: "`backfillEndBlock` must be the same as `config.endBlock`."
632
+ });
633
+ }
634
+ }
635
+ function invariant_chainSnapshotCompletedBlocks(ctx) {
636
+ const { config, latestIndexedBlock } = ctx.value;
637
+ if (isBeforeOrEqualTo(config.startBlock, latestIndexedBlock) === false) {
638
+ ctx.issues.push({
639
+ code: "custom",
640
+ input: ctx.value,
641
+ message: "`config.startBlock` must be before or same as `latestIndexedBlock`."
642
+ });
643
+ }
644
+ if (isBeforeOrEqualTo(latestIndexedBlock, config.endBlock) === false) {
645
+ ctx.issues.push({
646
+ code: "custom",
647
+ input: ctx.value,
648
+ message: "`latestIndexedBlock` must be before or same as `config.endBlock`."
649
+ });
650
+ }
651
+ }
652
+ function invariant_chainSnapshotFollowingBlocks(ctx) {
653
+ const { config, latestIndexedBlock, latestKnownBlock } = ctx.value;
654
+ if (isBeforeOrEqualTo(config.startBlock, latestIndexedBlock) === false) {
655
+ ctx.issues.push({
656
+ code: "custom",
657
+ input: ctx.value,
658
+ message: "`config.startBlock` must be before or same as `latestIndexedBlock`."
659
+ });
660
+ }
661
+ if (isBeforeOrEqualTo(latestIndexedBlock, latestKnownBlock) === false) {
662
+ ctx.issues.push({
663
+ code: "custom",
664
+ input: ctx.value,
665
+ message: "`latestIndexedBlock` must be before or same as `latestKnownBlock`."
666
+ });
667
+ }
668
+ }
669
+ var makeChainIndexingStatusSnapshotQueuedSchema = (valueLabel = "Value") => z6.object({
670
+ chainStatus: z6.literal(ChainIndexingStatusIds.Queued),
671
+ config: z6.discriminatedUnion("rangeType", [
672
+ z6.object({
673
+ rangeType: z6.literal(RangeTypeIds.LeftBounded),
674
+ startBlock: makeBlockRefSchema(valueLabel)
675
+ }),
676
+ z6.object({
677
+ rangeType: z6.literal(RangeTypeIds.Bounded),
678
+ startBlock: makeBlockRefSchema(valueLabel),
679
+ endBlock: makeBlockRefSchema(valueLabel)
680
+ })
681
+ ])
682
+ }).check(invariant_chainSnapshotQueuedBlocks);
683
+ var makeChainIndexingStatusSnapshotBackfillSchema = (valueLabel = "Value") => z6.object({
684
+ chainStatus: z6.literal(ChainIndexingStatusIds.Backfill),
685
+ config: z6.discriminatedUnion("rangeType", [
686
+ z6.object({
687
+ rangeType: z6.literal(RangeTypeIds.LeftBounded),
688
+ startBlock: makeBlockRefSchema(valueLabel)
689
+ }),
690
+ z6.object({
691
+ rangeType: z6.literal(RangeTypeIds.Bounded),
692
+ startBlock: makeBlockRefSchema(valueLabel),
693
+ endBlock: makeBlockRefSchema(valueLabel)
694
+ })
695
+ ]),
696
+ latestIndexedBlock: makeBlockRefSchema(valueLabel),
697
+ backfillEndBlock: makeBlockRefSchema(valueLabel)
698
+ }).check(invariant_chainSnapshotBackfillBlocks);
699
+ var makeChainIndexingStatusSnapshotCompletedSchema = (valueLabel = "Value") => z6.object({
700
+ chainStatus: z6.literal(ChainIndexingStatusIds.Completed),
701
+ config: z6.object({
702
+ rangeType: z6.literal(RangeTypeIds.Bounded),
703
+ startBlock: makeBlockRefSchema(valueLabel),
704
+ endBlock: makeBlockRefSchema(valueLabel)
705
+ }),
706
+ latestIndexedBlock: makeBlockRefSchema(valueLabel)
707
+ }).check(invariant_chainSnapshotCompletedBlocks);
708
+ var makeChainIndexingStatusSnapshotFollowingSchema = (valueLabel = "Value") => z6.object({
709
+ chainStatus: z6.literal(ChainIndexingStatusIds.Following),
710
+ config: z6.object({
711
+ rangeType: z6.literal(RangeTypeIds.LeftBounded),
712
+ startBlock: makeBlockRefSchema(valueLabel)
713
+ }),
714
+ latestIndexedBlock: makeBlockRefSchema(valueLabel),
715
+ latestKnownBlock: makeBlockRefSchema(valueLabel)
716
+ }).check(invariant_chainSnapshotFollowingBlocks);
717
+
718
+ // src/indexing-status/zod-schema/omnichain-indexing-status-snapshot.ts
719
+ function invariant_omnichainSnapshotStatusIsConsistentWithChainSnapshot(ctx) {
720
+ const snapshot = ctx.value;
721
+ const chains = Array.from(snapshot.chains.values());
722
+ const expectedOmnichainStatus = getOmnichainIndexingStatus(chains);
723
+ const actualOmnichainStatus = snapshot.omnichainStatus;
724
+ if (expectedOmnichainStatus !== actualOmnichainStatus) {
725
+ ctx.issues.push({
726
+ code: "custom",
727
+ input: snapshot,
728
+ message: `'${actualOmnichainStatus}' is an invalid omnichainStatus. Expected '${expectedOmnichainStatus}' based on the statuses of individual chains.`
729
+ });
730
+ }
731
+ }
732
+ function invariant_omnichainIndexingCursorLowerThanEarliestStartBlockAcrossQueuedChains(ctx) {
733
+ const snapshot = ctx.value;
734
+ const queuedChains = Array.from(snapshot.chains.values()).filter(
735
+ (chain) => chain.chainStatus === ChainIndexingStatusIds.Queued
736
+ );
737
+ if (queuedChains.length === 0) {
738
+ return;
739
+ }
740
+ const queuedChainStartBlocks = queuedChains.map((chain) => chain.config.startBlock.timestamp);
741
+ const queuedChainEarliestStartBlock = Math.min(...queuedChainStartBlocks);
742
+ if (snapshot.omnichainIndexingCursor >= queuedChainEarliestStartBlock) {
743
+ ctx.issues.push({
744
+ code: "custom",
745
+ input: snapshot,
746
+ message: "`omnichainIndexingCursor` must be lower than the earliest start block across all queued chains."
747
+ });
748
+ }
749
+ }
750
+ function invariant_omnichainIndexingCursorLowerThanOrEqualToLatestBackfillEndBlockAcrossBackfillChains(ctx) {
751
+ const snapshot = ctx.value;
752
+ const backfillChains = Array.from(snapshot.chains.values()).filter(
753
+ (chain) => chain.chainStatus === ChainIndexingStatusIds.Backfill
754
+ );
755
+ if (backfillChains.length === 0) {
756
+ return;
757
+ }
758
+ const backfillEndBlocks = backfillChains.map((chain) => chain.backfillEndBlock.timestamp);
759
+ const highestBackfillEndBlock = Math.max(...backfillEndBlocks);
760
+ if (snapshot.omnichainIndexingCursor > highestBackfillEndBlock) {
761
+ ctx.issues.push({
762
+ code: "custom",
763
+ input: snapshot,
764
+ message: "`omnichainIndexingCursor` must be lower than or equal to the highest `backfillEndBlock` across all backfill chains."
765
+ });
766
+ }
767
+ }
768
+ function invariant_omnichainIndexingCursorIsEqualToHighestLatestIndexedBlockAcrossIndexedChain(ctx) {
769
+ const snapshot = ctx.value;
770
+ const indexedChains = Array.from(snapshot.chains.values()).filter(
771
+ (chain) => chain.chainStatus === ChainIndexingStatusIds.Backfill || chain.chainStatus === ChainIndexingStatusIds.Completed || chain.chainStatus === ChainIndexingStatusIds.Following
772
+ );
773
+ if (indexedChains.length === 0) {
774
+ return;
775
+ }
776
+ const indexedChainLatestIndexedBlocks = indexedChains.map(
777
+ (chain) => chain.latestIndexedBlock.timestamp
778
+ );
779
+ const indexedChainHighestLatestIndexedBlock = Math.max(...indexedChainLatestIndexedBlocks);
780
+ if (snapshot.omnichainIndexingCursor !== indexedChainHighestLatestIndexedBlock) {
781
+ ctx.issues.push({
782
+ code: "custom",
783
+ input: snapshot,
784
+ message: "`omnichainIndexingCursor` must be same as the highest `latestIndexedBlock` across all indexed chains."
785
+ });
786
+ }
787
+ }
788
+ function invariant_omnichainSnapshotUnstartedHasValidChains(ctx) {
789
+ const snapshot = ctx.value;
790
+ const hasValidChains = checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotUnstarted(
791
+ Array.from(snapshot.chains.values())
792
+ );
793
+ if (hasValidChains === false) {
794
+ ctx.issues.push({
795
+ code: "custom",
796
+ input: snapshot,
797
+ message: `For omnichain status snapshot 'unstarted', all chains must have "queued" status.`
798
+ });
799
+ }
800
+ }
801
+ function invariant_omnichainStatusSnapshotBackfillHasValidChains(ctx) {
802
+ const snapshot = ctx.value;
803
+ const hasValidChains = checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotBackfill(
804
+ Array.from(snapshot.chains.values())
805
+ );
806
+ if (hasValidChains === false) {
807
+ ctx.issues.push({
808
+ code: "custom",
809
+ input: snapshot,
810
+ message: `For omnichain status snapshot 'backfill', at least one chain must be in "backfill" status and each chain has to have a status of either "queued", "backfill" or "completed".`
811
+ });
812
+ }
813
+ }
814
+ function invariant_omnichainStatusSnapshotCompletedHasValidChains(ctx) {
815
+ const snapshot = ctx.value;
816
+ const hasValidChains = checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotCompleted(
817
+ Array.from(snapshot.chains.values())
818
+ );
819
+ if (hasValidChains === false) {
820
+ ctx.issues.push({
821
+ code: "custom",
822
+ input: snapshot,
823
+ message: `For omnichain status snapshot 'completed', all chains must have "completed" status.`
824
+ });
825
+ }
826
+ }
827
+ function invariant_omnichainStatusSnapshotFollowingHasValidChains(ctx) {
828
+ const snapshot = ctx.value;
829
+ const hasValidChains = checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotFollowing(
830
+ Array.from(snapshot.chains.values())
831
+ );
832
+ if (hasValidChains === false) {
833
+ ctx.issues.push({
834
+ code: "custom",
835
+ input: snapshot,
836
+ message: "For omnichainStatus 'following', at least one chain must be in 'following' status."
837
+ });
838
+ }
839
+ }
840
+ var makeOmnichainIndexingStatusSnapshotUnstartedSchema = (valueLabel) => z7.object({
841
+ omnichainStatus: z7.literal(OmnichainIndexingStatusIds.Unstarted),
842
+ chains: z7.map(
843
+ makeChainIdSchema(),
844
+ z7.discriminatedUnion("chainStatus", [
845
+ makeChainIndexingStatusSnapshotQueuedSchema(valueLabel)
846
+ ]),
847
+ {
848
+ error: "Chains indexing statuses must be a Map with ChainId as keys and ChainIndexingStatusSnapshot as values."
849
+ }
850
+ ),
851
+ omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
852
+ }).check(invariant_omnichainSnapshotUnstartedHasValidChains);
853
+ var makeOmnichainIndexingStatusSnapshotBackfillSchema = (valueLabel) => z7.object({
854
+ omnichainStatus: z7.literal(OmnichainIndexingStatusIds.Backfill),
855
+ chains: z7.map(
856
+ makeChainIdSchema(),
857
+ z7.discriminatedUnion("chainStatus", [
858
+ makeChainIndexingStatusSnapshotQueuedSchema(valueLabel),
859
+ makeChainIndexingStatusSnapshotBackfillSchema(valueLabel),
860
+ makeChainIndexingStatusSnapshotCompletedSchema(valueLabel)
861
+ ]),
862
+ {
863
+ error: "Chains indexing statuses must be a Map with ChainId as keys and ChainIndexingStatusSnapshot as values."
864
+ }
865
+ ),
866
+ omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
867
+ }).check(invariant_omnichainStatusSnapshotBackfillHasValidChains);
868
+ var makeOmnichainIndexingStatusSnapshotCompletedSchema = (valueLabel) => z7.object({
869
+ omnichainStatus: z7.literal(OmnichainIndexingStatusIds.Completed),
870
+ chains: z7.map(
871
+ makeChainIdSchema(),
872
+ z7.discriminatedUnion("chainStatus", [
873
+ makeChainIndexingStatusSnapshotCompletedSchema(valueLabel)
874
+ ]),
875
+ {
876
+ error: "Chains indexing statuses must be a Map with ChainId as keys and ChainIndexingStatusSnapshot as values."
877
+ }
878
+ ),
879
+ omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
880
+ }).check(invariant_omnichainStatusSnapshotCompletedHasValidChains);
881
+ var makeOmnichainIndexingStatusSnapshotFollowingSchema = (valueLabel) => z7.object({
882
+ omnichainStatus: z7.literal(OmnichainIndexingStatusIds.Following),
883
+ chains: z7.map(
884
+ makeChainIdSchema(),
885
+ z7.discriminatedUnion("chainStatus", [
886
+ makeChainIndexingStatusSnapshotQueuedSchema(valueLabel),
887
+ makeChainIndexingStatusSnapshotBackfillSchema(valueLabel),
888
+ makeChainIndexingStatusSnapshotFollowingSchema(valueLabel),
889
+ makeChainIndexingStatusSnapshotCompletedSchema(valueLabel)
890
+ ]),
891
+ {
892
+ error: "Chains indexing statuses must be a Map with ChainId as keys and ChainIndexingStatusSnapshot as values."
893
+ }
894
+ ),
895
+ omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
896
+ }).check(invariant_omnichainStatusSnapshotFollowingHasValidChains);
897
+ var makeOmnichainIndexingStatusSnapshotSchema = (valueLabel = "Omnichain Indexing Snapshot") => z7.discriminatedUnion("omnichainStatus", [
898
+ makeOmnichainIndexingStatusSnapshotUnstartedSchema(valueLabel),
899
+ makeOmnichainIndexingStatusSnapshotBackfillSchema(valueLabel),
900
+ makeOmnichainIndexingStatusSnapshotCompletedSchema(valueLabel),
901
+ makeOmnichainIndexingStatusSnapshotFollowingSchema(valueLabel)
902
+ ]).check(invariant_omnichainSnapshotStatusIsConsistentWithChainSnapshot).check(invariant_omnichainIndexingCursorLowerThanEarliestStartBlockAcrossQueuedChains).check(
903
+ invariant_omnichainIndexingCursorLowerThanOrEqualToLatestBackfillEndBlockAcrossBackfillChains
904
+ ).check(invariant_omnichainIndexingCursorIsEqualToHighestLatestIndexedBlockAcrossIndexedChain);
905
+ var makeSerializedOmnichainIndexingStatusSnapshotUnstartedSchema = (valueLabel) => z7.object({
906
+ omnichainStatus: z7.literal(OmnichainIndexingStatusIds.Unstarted),
907
+ chains: z7.record(
908
+ makeChainIdStringSchema(),
909
+ z7.discriminatedUnion("chainStatus", [
910
+ makeChainIndexingStatusSnapshotQueuedSchema(valueLabel)
911
+ ])
912
+ ),
913
+ omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
914
+ });
915
+ var makeSerializedOmnichainIndexingStatusSnapshotBackfillSchema = (valueLabel) => z7.object({
916
+ omnichainStatus: z7.literal(OmnichainIndexingStatusIds.Backfill),
917
+ chains: z7.record(
918
+ makeChainIdStringSchema(),
919
+ z7.discriminatedUnion("chainStatus", [
920
+ makeChainIndexingStatusSnapshotQueuedSchema(valueLabel),
921
+ makeChainIndexingStatusSnapshotBackfillSchema(valueLabel),
922
+ makeChainIndexingStatusSnapshotCompletedSchema(valueLabel)
923
+ ])
924
+ ),
925
+ omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
926
+ });
927
+ var makeSerializedOmnichainIndexingStatusSnapshotCompletedSchema = (valueLabel) => z7.object({
928
+ omnichainStatus: z7.literal(OmnichainIndexingStatusIds.Completed),
929
+ chains: z7.record(
930
+ makeChainIdStringSchema(),
931
+ z7.discriminatedUnion("chainStatus", [
932
+ makeChainIndexingStatusSnapshotCompletedSchema(valueLabel)
933
+ ])
934
+ ),
935
+ omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
936
+ });
937
+ var makeSerializedOmnichainIndexingStatusSnapshotFollowingSchema = (valueLabel) => z7.object({
938
+ omnichainStatus: z7.literal(OmnichainIndexingStatusIds.Following),
939
+ chains: z7.record(
940
+ makeChainIdStringSchema(),
941
+ z7.discriminatedUnion("chainStatus", [
942
+ makeChainIndexingStatusSnapshotQueuedSchema(valueLabel),
943
+ makeChainIndexingStatusSnapshotBackfillSchema(valueLabel),
944
+ makeChainIndexingStatusSnapshotFollowingSchema(valueLabel),
945
+ makeChainIndexingStatusSnapshotCompletedSchema(valueLabel)
946
+ ])
947
+ ),
948
+ omnichainIndexingCursor: makeUnixTimestampSchema(valueLabel)
949
+ });
950
+ var makeSerializedOmnichainIndexingStatusSnapshotSchema = (valueLabel = "Value") => z7.discriminatedUnion("omnichainStatus", [
951
+ makeSerializedOmnichainIndexingStatusSnapshotUnstartedSchema(valueLabel),
952
+ makeSerializedOmnichainIndexingStatusSnapshotBackfillSchema(valueLabel),
953
+ makeSerializedOmnichainIndexingStatusSnapshotCompletedSchema(valueLabel),
954
+ makeSerializedOmnichainIndexingStatusSnapshotFollowingSchema(valueLabel)
955
+ ]);
956
+
957
+ // src/indexing-status/zod-schema/cross-chain-indexing-status-snapshot.ts
958
+ function invariant_slowestChainEqualsToOmnichainSnapshotTime(ctx) {
959
+ const { slowestChainIndexingCursor, omnichainSnapshot } = ctx.value;
960
+ const { omnichainIndexingCursor } = omnichainSnapshot;
961
+ if (slowestChainIndexingCursor !== omnichainIndexingCursor) {
962
+ ctx.issues.push({
963
+ code: "custom",
964
+ input: ctx.value,
965
+ message: `'slowestChainIndexingCursor' must be equal to 'omnichainSnapshot.omnichainIndexingCursor'`
966
+ });
967
+ }
968
+ }
969
+ function invariant_snapshotTimeIsTheHighestKnownBlockTimestamp(ctx) {
970
+ const { snapshotTime, omnichainSnapshot } = ctx.value;
971
+ const chains = Array.from(omnichainSnapshot.chains.values());
972
+ const highestKnownBlockTimestamp = getHighestKnownBlockTimestamp(chains);
973
+ if (snapshotTime < highestKnownBlockTimestamp) {
974
+ ctx.issues.push({
975
+ code: "custom",
976
+ input: ctx.value,
977
+ message: `'snapshotTime' (${snapshotTime}) must be greater than or equal to the "highest known block timestamp" (${highestKnownBlockTimestamp})`
978
+ });
979
+ }
980
+ }
981
+ var makeCrossChainIndexingStatusSnapshotOmnichainSchema = (valueLabel = "Cross-chain Indexing Status Snapshot Omnichain") => z8.object({
982
+ strategy: z8.literal(CrossChainIndexingStrategyIds.Omnichain),
983
+ slowestChainIndexingCursor: makeUnixTimestampSchema(valueLabel),
984
+ snapshotTime: makeUnixTimestampSchema(valueLabel),
985
+ omnichainSnapshot: makeOmnichainIndexingStatusSnapshotSchema(valueLabel)
986
+ }).check(invariant_slowestChainEqualsToOmnichainSnapshotTime).check(invariant_snapshotTimeIsTheHighestKnownBlockTimestamp);
987
+ var makeCrossChainIndexingStatusSnapshotSchema = (valueLabel = "Cross-chain Indexing Status Snapshot") => z8.discriminatedUnion("strategy", [
988
+ makeCrossChainIndexingStatusSnapshotOmnichainSchema(valueLabel)
989
+ ]);
990
+ var makeSerializedCrossChainIndexingStatusSnapshotSchema = (valueLabel = "Serialized Cross-chain Indexing Status Snapshot") => z8.object({
991
+ strategy: z8.enum(CrossChainIndexingStrategyIds),
992
+ slowestChainIndexingCursor: makeUnixTimestampSchema(valueLabel),
993
+ snapshotTime: makeUnixTimestampSchema(valueLabel),
994
+ omnichainSnapshot: makeSerializedOmnichainIndexingStatusSnapshotSchema(valueLabel)
995
+ });
996
+
997
+ // src/indexing-status/zod-schema/realtime-indexing-status-projection.ts
998
+ function invariant_realtimeIndexingStatusProjectionProjectedAtIsAfterOrEqualToSnapshotTime(ctx) {
999
+ const projection = ctx.value;
1000
+ const { snapshot, projectedAt } = projection;
1001
+ if (snapshot.snapshotTime > projectedAt) {
1002
+ ctx.issues.push({
1003
+ code: "custom",
1004
+ input: projection,
1005
+ message: "`projectedAt` must be after or same as `snapshot.snapshotTime`."
1006
+ });
1007
+ }
1008
+ }
1009
+ function invariant_realtimeIndexingStatusProjectionWorstCaseDistanceIsCorrect(ctx) {
1010
+ const projection = ctx.value;
1011
+ const { projectedAt, snapshot, worstCaseDistance } = projection;
1012
+ const expectedWorstCaseDistance = projectedAt - snapshot.slowestChainIndexingCursor;
1013
+ if (worstCaseDistance !== expectedWorstCaseDistance) {
1014
+ ctx.issues.push({
1015
+ code: "custom",
1016
+ input: projection,
1017
+ message: "`worstCaseDistance` must be the exact difference between `projectedAt` and `snapshot.slowestChainIndexingCursor`."
1018
+ });
1019
+ }
1020
+ }
1021
+ var makeRealtimeIndexingStatusProjectionSchema = (valueLabel = "Realtime Indexing Status Projection") => z9.object({
1022
+ projectedAt: makeUnixTimestampSchema(valueLabel).describe(
1023
+ "The timestamp representing 'now' as of the time this projection was generated."
1024
+ ),
1025
+ worstCaseDistance: makeDurationSchema(valueLabel).describe(
1026
+ "The distance between `projectedAt` and `snapshot.slowestChainIndexingCursor` in seconds. This is a worst-case distance because it assumes no indexing progress has been made since `snapshot.snapshotTime` and that each indexed chain has added a new block as of `projectedAt`."
1027
+ ),
1028
+ snapshot: makeCrossChainIndexingStatusSnapshotSchema(valueLabel).describe(
1029
+ "The cross-chain indexing status snapshot that this projection is based on."
1030
+ )
1031
+ }).check(invariant_realtimeIndexingStatusProjectionProjectedAtIsAfterOrEqualToSnapshotTime).check(invariant_realtimeIndexingStatusProjectionWorstCaseDistanceIsCorrect);
1032
+ var makeSerializedRealtimeIndexingStatusProjectionSchema = (valueLabel = "Value") => z9.object({
1033
+ snapshot: makeSerializedCrossChainIndexingStatusSnapshotSchema(valueLabel).describe(
1034
+ "The cross-chain indexing status snapshot that this projection is based on."
1035
+ ),
1036
+ projectedAt: makeUnixTimestampSchema(valueLabel).describe(
1037
+ "The timestamp representing 'now' as of the time this projection was generated."
1038
+ ),
1039
+ worstCaseDistance: makeDurationSchema(valueLabel).describe(
1040
+ "The distance between `projectedAt` and `snapshot.slowestChainIndexingCursor` in seconds. This is a worst-case distance because it assumes no indexing progress has been made since `snapshot.snapshotTime` and that each indexed chain has added a new block as of `projectedAt`."
1041
+ )
1042
+ });
1043
+
1044
+ // src/stack-info/zod-schemas/ensindexer-stack-info.ts
1045
+ import { z as z11 } from "zod/v4";
1046
+
1047
+ // src/ensdb/zod-schemas/config.ts
1048
+ import { z as z10 } from "zod/v4";
1049
+ var makeEnsDbVersionInfoSchema = (valueLabel) => {
1050
+ const label = valueLabel ?? "EnsDbVersionInfo";
1051
+ return z10.object({
1052
+ postgresql: z10.string().nonempty(`${label}.postgresql must be a non-empty string`).describe("Version of the PostgreSQL server hosting the ENSDb instance.")
1053
+ });
1054
+ };
1055
+ var makeEnsDbPublicConfigSchema = (valueLabel) => {
1056
+ const label = valueLabel ?? "EnsDbPublicConfig";
1057
+ return z10.object({
1058
+ versionInfo: makeEnsDbVersionInfoSchema(`${label}.versionInfo`)
1059
+ });
1060
+ };
1061
+
1062
+ // src/stack-info/zod-schemas/ensindexer-stack-info.ts
1063
+ function makeSerializedEnsIndexerStackInfoSchema(valueLabel) {
1064
+ const label = valueLabel ?? "ENSIndexerStackInfo";
1065
+ return z11.object({
1066
+ ensDb: makeEnsDbPublicConfigSchema(`${label}.ensDb`),
1067
+ ensIndexer: makeSerializedEnsIndexerPublicConfigSchema(`${label}.ensIndexer`),
1068
+ ensRainbow: makeEnsRainbowPublicConfigSchema(`${label}.ensRainbow`)
1069
+ });
1070
+ }
1071
+ function invariant_ensRainbowCompatibilityWithEnsIndexer(ctx) {
1072
+ const { ensIndexer, ensRainbow } = ctx.value;
1073
+ const { clientLabelSet } = ensIndexer;
1074
+ const { serverLabelSet } = ensRainbow;
1075
+ if (clientLabelSet.labelSetId !== serverLabelSet.labelSetId) {
1076
+ ctx.issues.push({
1077
+ code: "custom",
1078
+ input: ctx.value,
1079
+ message: `ENSRainbow's label set (id: ${serverLabelSet.labelSetId}) must be the same as ENSIndexer's label set (id: ${clientLabelSet.labelSetId}).`
1080
+ });
1081
+ }
1082
+ if (clientLabelSet.labelSetVersion > serverLabelSet.highestLabelSetVersion) {
1083
+ ctx.issues.push({
1084
+ code: "custom",
1085
+ input: ctx.value,
1086
+ message: `ENSRainbow's server label set version (highest: ${serverLabelSet.highestLabelSetVersion}) must be greater than or equal to ENSIndexer's client label set version (current: ${clientLabelSet.labelSetVersion}).`
1087
+ });
1088
+ }
1089
+ }
1090
+ function makeEnsIndexerStackInfoSchema(valueLabel) {
1091
+ const label = valueLabel ?? "ENSIndexerStackInfo";
1092
+ return z11.object({
1093
+ ensDb: makeEnsDbPublicConfigSchema(`${label}.ensDb`),
1094
+ ensIndexer: makeEnsIndexerPublicConfigSchema(`${label}.ensIndexer`),
1095
+ ensRainbow: makeEnsRainbowPublicConfigSchema(`${label}.ensRainbow`)
1096
+ }).check(invariant_ensRainbowCompatibilityWithEnsIndexer);
1097
+ }
1098
+
1099
+ // src/stack-info/zod-schemas/ensnode-stack-info.ts
1100
+ function invariant_ensApiCompatibilityWithEnsIndexerAndEnsRainbow(ctx) {
1101
+ const { ensApi, ensIndexer, ensRainbow } = ctx.value;
1102
+ if (ensIndexer.versionInfo.ensDb !== ensApi.versionInfo.ensApi) {
1103
+ ctx.issues.push({
1104
+ code: "custom",
1105
+ path: ["ensIndexer", "versionInfo", "ensDb"],
1106
+ input: ensIndexer.versionInfo.ensDb,
1107
+ message: `Version Mismatch: ENSDB@${ensIndexer.versionInfo.ensDb} !== ENSApi@${ensApi.versionInfo.ensApi}`
1108
+ });
1109
+ }
1110
+ if (ensIndexer.versionInfo.ensIndexer !== ensApi.versionInfo.ensApi) {
1111
+ ctx.issues.push({
1112
+ code: "custom",
1113
+ path: ["ensIndexer", "versionInfo", "ensIndexer"],
1114
+ input: ensIndexer.versionInfo.ensIndexer,
1115
+ message: `Version Mismatch: ENSIndexer@${ensIndexer.versionInfo.ensIndexer} !== ENSApi@${ensApi.versionInfo.ensApi}`
1116
+ });
1117
+ }
1118
+ if (ensRainbow.versionInfo.ensRainbow !== ensApi.versionInfo.ensApi) {
1119
+ ctx.issues.push({
1120
+ code: "custom",
1121
+ path: ["ensRainbow", "versionInfo", "ensRainbow"],
1122
+ input: ensRainbow.versionInfo.ensRainbow,
1123
+ message: `Version Mismatch: ENSRainbow@${ensRainbow.versionInfo.ensRainbow} !== ENSApi@${ensApi.versionInfo.ensApi}`
1124
+ });
1125
+ }
1126
+ if (ensIndexer.versionInfo.ensNormalize !== ensApi.versionInfo.ensNormalize) {
1127
+ ctx.issues.push({
1128
+ code: "custom",
1129
+ path: ["ensIndexer", "versionInfo", "ensNormalize"],
1130
+ input: ensIndexer.versionInfo.ensNormalize,
1131
+ message: `Dependency Version Mismatch: '@adraffy/ens-normalize' version must be the same between ENSIndexer and ENSApi. Found ENSApi@${ensApi.versionInfo.ensNormalize} and ENSIndexer@${ensIndexer.versionInfo.ensNormalize}`
1132
+ });
1133
+ }
1134
+ }
1135
+ function makeSerializedEnsNodeStackInfoSchema(valueLabel) {
1136
+ const label = valueLabel ?? "ENSNodeStackInfo";
1137
+ return makeSerializedEnsIndexerStackInfoSchema(label).extend({
1138
+ ensApi: makeSerializedEnsApiPublicConfigSchema(`${label}.ensApi`)
1139
+ });
1140
+ }
1141
+ function makeEnsNodeStackInfoSchema(valueLabel) {
1142
+ const label = valueLabel ?? "ENSNodeStackInfo";
1143
+ return makeEnsIndexerStackInfoSchema(label).extend({
1144
+ ensApi: makeEnsApiPublicConfigSchema(`${label}.ensApi`)
1145
+ }).check(invariant_ensApiCompatibilityWithEnsIndexerAndEnsRainbow).check(invariant_ensRainbowCompatibilityWithEnsIndexer);
1146
+ }
1147
+
1148
+ // src/ensnode/api/indexing-status/response.ts
1149
+ var EnsApiIndexingStatusResponseCodes = {
1150
+ /**
1151
+ * Represents that the indexing status is available.
1152
+ */
1153
+ Ok: "ok",
1154
+ /**
1155
+ * Represents that the indexing status is unavailable.
1156
+ */
1157
+ Error: "error"
1158
+ };
1159
+
1160
+ // src/ensnode/api/indexing-status/zod-schemas.ts
1161
+ var makeEnsApiIndexingStatusResponseOkSchema = (valueLabel = "Indexing Status Response OK") => z12.strictObject({
1162
+ responseCode: z12.literal(EnsApiIndexingStatusResponseCodes.Ok),
1163
+ realtimeProjection: makeRealtimeIndexingStatusProjectionSchema(valueLabel),
1164
+ stackInfo: makeEnsNodeStackInfoSchema(valueLabel)
1165
+ });
1166
+ var makeEnsApiIndexingStatusResponseErrorSchema = (_valueLabel = "Indexing Status Response Error") => z12.strictObject({
1167
+ responseCode: z12.literal(EnsApiIndexingStatusResponseCodes.Error)
1168
+ });
1169
+ var makeEnsApiIndexingStatusResponseSchema = (valueLabel = "Indexing Status Response") => z12.discriminatedUnion("responseCode", [
1170
+ makeEnsApiIndexingStatusResponseOkSchema(valueLabel),
1171
+ makeEnsApiIndexingStatusResponseErrorSchema(valueLabel)
1172
+ ]);
1173
+ var makeIndexingStatusResponseSchema = makeEnsApiIndexingStatusResponseSchema;
1174
+ var makeSerializedEnsApiIndexingStatusResponseOkSchema = (valueLabel = "Serialized Indexing Status Response OK") => z12.object({
1175
+ responseCode: z12.literal(EnsApiIndexingStatusResponseCodes.Ok),
1176
+ realtimeProjection: makeSerializedRealtimeIndexingStatusProjectionSchema(valueLabel),
1177
+ stackInfo: makeSerializedEnsNodeStackInfoSchema(valueLabel)
1178
+ });
1179
+ var makeSerializedEnsApiIndexingStatusResponseSchema = (valueLabel = "Serialized Indexing Status Response") => z12.discriminatedUnion("responseCode", [
1180
+ makeSerializedEnsApiIndexingStatusResponseOkSchema(valueLabel),
1181
+ makeEnsApiIndexingStatusResponseErrorSchema(valueLabel)
1182
+ ]);
1183
+
1184
+ // src/ensnode/api/name-tokens/examples.ts
1185
+ var nameTokensResponseOkExample = {
1186
+ responseCode: "ok",
1187
+ registeredNameTokens: {
1188
+ domainId: "0xee6c4522aab0003e8d14cd40a6af439055fd2577951148c14b6cea9a53475835",
1189
+ name: "vitalik.eth",
1190
+ tokens: [
1191
+ {
1192
+ token: {
1193
+ assetNamespace: "erc721",
1194
+ contract: {
1195
+ chainId: 1,
1196
+ address: "0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85"
1197
+ },
1198
+ tokenId: "0xaf2caa1c2ca1d027f1ac823b529d0a67cd144264b2789fa2ea4d63a67c7103cc"
1199
+ },
1200
+ ownership: {
1201
+ ownershipType: "fully-onchain",
1202
+ owner: {
1203
+ chainId: 1,
1204
+ address: "0x220866b1a2219f40e72f5c628b65d54268ca3a9d"
1205
+ }
1206
+ },
1207
+ mintStatus: "minted"
1208
+ }
1209
+ ],
1210
+ expiresAt: 2461152330,
1211
+ accurateAsOf: 17e8
1212
+ }
1213
+ };
1214
+ var nameTokensServiceUnavailableExample = {
1215
+ responseCode: "error",
1216
+ errorCode: "unsupported-ensindexer-config",
1217
+ error: {
1218
+ message: "Name Tokens API is not available",
1219
+ details: "Connected ENSIndexer must have all following plugins active: registrars, tokenscope"
1220
+ }
1221
+ };
1222
+ var nameTokensNotIndexedExample = {
1223
+ responseCode: "error",
1224
+ errorCode: "name-tokens-not-indexed",
1225
+ error: {
1226
+ message: "No indexed Name Tokens found",
1227
+ details: "This ENSNode instance has not been configured to index tokens for the requested name: 'vitalik.eth'"
1228
+ }
1229
+ };
1230
+
1231
+ // src/ensnode/api/name-tokens/zod-schemas.ts
1232
+ import { namehashInterpretedName } from "enssdk";
1233
+ import { z as z15 } from "zod/v4";
1234
+
1235
+ // src/tokenscope/name-token.ts
1236
+ import { getParentInterpretedName } from "enssdk";
1237
+ import { isAddressEqual as isAddressEqual3, zeroAddress as zeroAddress3 } from "viem";
1238
+ import { DatasourceNames } from "@ensnode/datasources";
1239
+
1240
+ // src/shared/account-id.ts
1241
+ import { isAddressEqual } from "viem";
1242
+ var accountIdEqual = (a, b) => {
1243
+ return a.chainId === b.chainId && isAddressEqual(a.address, b.address);
1244
+ };
1245
+
1246
+ // src/shared/datasource-contract.ts
1247
+ import {
1248
+ maybeGetDatasource
1249
+ } from "@ensnode/datasources";
1250
+ var maybeGetDatasourceContract = (namespaceId, datasourceName, contractName) => {
1251
+ const datasource = maybeGetDatasource(namespaceId, datasourceName);
1252
+ if (!datasource) return void 0;
1253
+ const address = datasource.contracts[contractName]?.address;
1254
+ if (address === void 0 || Array.isArray(address)) return void 0;
1255
+ return {
1256
+ chainId: datasource.chain.id,
1257
+ address
1258
+ };
1259
+ };
1260
+ var getDatasourceContract = (namespaceId, datasourceName, contractName) => {
1261
+ const contract = maybeGetDatasourceContract(namespaceId, datasourceName, contractName);
1262
+ if (!contract) {
1263
+ throw new Error(
1264
+ `Expected contract not found for ${namespaceId} ${datasourceName} ${contractName}`
1265
+ );
1266
+ }
1267
+ return contract;
1268
+ };
1269
+ var makeContractMatcher = (namespace, b) => (datasourceName, contractName) => {
1270
+ const a = maybeGetDatasourceContract(namespace, datasourceName, contractName);
1271
+ return a && accountIdEqual(a, b);
1272
+ };
1273
+
1274
+ // src/tokenscope/assets.ts
1275
+ import {
1276
+ stringifyAssetId
1277
+ } from "enssdk";
1278
+ import { isAddressEqual as isAddressEqual2, zeroAddress as zeroAddress2 } from "viem";
1279
+ import { prettifyError } from "zod/v4";
1280
+
1281
+ // src/tokenscope/zod-schemas.ts
1282
+ import { AssetId as CaipAssetId } from "caip";
1283
+ import { AssetNamespaces } from "enssdk";
1284
+ import { zeroAddress } from "viem";
1285
+ import { z as z13 } from "zod/v4";
1286
+ var tokenIdSchemaSerializable = z13.string();
1287
+ var tokenIdSchemaNative = z13.preprocess(
1288
+ (v) => typeof v === "string" ? BigInt(v) : v,
1289
+ z13.bigint().positive()
1290
+ );
1291
+ function makeTokenIdSchema(_valueLabel = "Token ID Schema", serializable = false) {
1292
+ if (serializable) {
1293
+ return tokenIdSchemaSerializable;
1294
+ } else {
1295
+ return tokenIdSchemaNative;
1296
+ }
1297
+ }
1298
+ var makeAssetIdSchema = (valueLabel = "Asset ID Schema", serializable) => {
1299
+ return z13.object({
1300
+ assetNamespace: z13.enum(AssetNamespaces),
1301
+ contract: makeAccountIdSchema(valueLabel),
1302
+ tokenId: makeTokenIdSchema(valueLabel, serializable ?? false)
1303
+ });
1304
+ };
1305
+ var makeAssetIdStringSchema = (valueLabel = "Asset ID String Schema") => z13.preprocess((v) => {
1306
+ if (typeof v === "string") {
1307
+ const result = new CaipAssetId(v);
1308
+ return {
1309
+ assetNamespace: result.assetName.namespace,
1310
+ contract: {
1311
+ chainId: Number(result.chainId.reference),
1312
+ address: result.assetName.reference
1313
+ },
1314
+ tokenId: result.tokenId
1315
+ };
1316
+ }
1317
+ return v;
1318
+ }, makeAssetIdSchema(valueLabel));
1319
+ var makeDomainAssetSchema = (valueLabel = "Domain Asset Schema") => makeAssetIdSchema(valueLabel).extend({
1320
+ domainId: makeNodeSchema(`${valueLabel}.domainId`)
1321
+ });
1322
+ function invariant_nameTokenOwnershipHasNonZeroAddressOwner(ctx) {
1323
+ const ownership = ctx.value;
1324
+ if (ctx.value.owner.address === zeroAddress) {
1325
+ ctx.issues.push({
1326
+ code: "custom",
1327
+ input: ctx.value,
1328
+ message: `Name Token Ownership with '${ownership.ownershipType}' must have 'address' other than the zero address.`
1329
+ });
1330
+ }
1331
+ }
1332
+ var makeNameTokenOwnershipNameWrapperSchema = (valueLabel = "Name Token Ownership NameWrapper") => z13.object({
1333
+ ownershipType: z13.literal(NameTokenOwnershipTypes.NameWrapper),
1334
+ owner: makeAccountIdSchema(`${valueLabel}.owner`)
1335
+ }).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
1336
+ var makeNameTokenOwnershipFullyOnchainSchema = (valueLabel = "Name Token Ownership Fully Onchain") => z13.object({
1337
+ ownershipType: z13.literal(NameTokenOwnershipTypes.FullyOnchain),
1338
+ owner: makeAccountIdSchema(`${valueLabel}.owner`)
1339
+ }).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
1340
+ var makeNameTokenOwnershipBurnedSchema = (valueLabel = "Name Token Ownership Burned") => z13.object({
1341
+ ownershipType: z13.literal(NameTokenOwnershipTypes.Burned),
1342
+ owner: makeAccountIdSchema(`${valueLabel}.owner`)
1343
+ }).check(invariant_nameTokenOwnershipHasZeroAddressOwner);
1344
+ var makeNameTokenOwnershipUnknownSchema = (valueLabel = "Name Token Ownership Unknown") => z13.object({
1345
+ ownershipType: z13.literal(NameTokenOwnershipTypes.Unknown),
1346
+ owner: makeAccountIdSchema(`${valueLabel}.owner`)
1347
+ }).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
1348
+ function invariant_nameTokenOwnershipHasZeroAddressOwner(ctx) {
1349
+ const ownership = ctx.value;
1350
+ if (ctx.value.owner.address !== zeroAddress) {
1351
+ ctx.issues.push({
1352
+ code: "custom",
1353
+ input: ctx.value,
1354
+ message: `Name Token Ownership with '${ownership.ownershipType}' must have 'address' set to the zero address.`
1355
+ });
1356
+ }
1357
+ }
1358
+ var makeNameTokenOwnershipSchema = (valueLabel = "Name Token Ownership") => z13.discriminatedUnion("ownershipType", [
1359
+ makeNameTokenOwnershipNameWrapperSchema(valueLabel),
1360
+ makeNameTokenOwnershipFullyOnchainSchema(valueLabel),
1361
+ makeNameTokenOwnershipBurnedSchema(valueLabel),
1362
+ makeNameTokenOwnershipUnknownSchema(valueLabel)
1363
+ ]);
1364
+ var makeNameTokenSchema = (valueLabel = "Name Token Schema", serializable) => z13.object({
1365
+ token: makeAssetIdSchema(`${valueLabel}.token`, serializable),
1366
+ ownership: makeNameTokenOwnershipSchema(`${valueLabel}.ownership`),
1367
+ mintStatus: z13.enum(NFTMintStatuses)
1368
+ });
1369
+
1370
+ // src/tokenscope/assets.ts
1371
+ var NFTMintStatuses = {
1372
+ Minted: "minted",
1373
+ Burned: "burned"
1374
+ };
1375
+
1376
+ // src/tokenscope/name-token.ts
1377
+ var NameTokenOwnershipTypes = {
1378
+ /**
1379
+ * Name Token is owned by NameWrapper account.
1380
+ */
1381
+ NameWrapper: "namewrapper",
1382
+ /**
1383
+ * Name Token is owned fully onchain.
1384
+ *
1385
+ * This ownership type can only apply to direct subnames of `.eth`
1386
+ */
1387
+ FullyOnchain: "fully-onchain",
1388
+ /**
1389
+ * Name Token ownership has been transferred to the null address.
1390
+ */
1391
+ Burned: "burned",
1392
+ /**
1393
+ * Name Token ownership is unknown.
1394
+ */
1395
+ Unknown: "unknown"
1396
+ };
1397
+
1398
+ // src/ensnode/api/shared/errors/zod-schemas.ts
1399
+ import { z as z14 } from "zod/v4";
1400
+ var makeErrorResponseSchema = () => z14.object({
1401
+ message: z14.string().describe("A description of the error that occurred."),
1402
+ details: z14.optional(z14.unknown()).describe("Additional details about the error.")
1403
+ });
1404
+
1405
+ // src/ensnode/api/name-tokens/response.ts
1406
+ var NameTokensResponseCodes = {
1407
+ /**
1408
+ * Represents a response when Name Tokens API can respond with requested data.
1409
+ */
1410
+ Ok: "ok",
1411
+ /**
1412
+ * Represents a response when Name Tokens API could not respond with requested data.
1413
+ */
1414
+ Error: "error"
1415
+ };
1416
+ var NameTokensResponseErrorCodes = {
1417
+ /**
1418
+ * Name tokens not indexed
1419
+ *
1420
+ * Represents an error when tokens for the requested name are not indexed by
1421
+ * the ENSNode instance's configuration.
1422
+ */
1423
+ NameTokensNotIndexed: "name-tokens-not-indexed",
1424
+ /**
1425
+ * Unsupported ENSIndexer Config
1426
+ *
1427
+ * Represents a prerequisites error when connected ENSIndexer config lacks
1428
+ * params required to enable Name Tokens API.
1429
+ */
1430
+ EnsIndexerConfigUnsupported: "unsupported-ensindexer-config",
1431
+ /**
1432
+ * Unsupported Indexing Status
1433
+ *
1434
+ * Represents a prerequisites error when Indexing Status has not yet reached
1435
+ * status required to enable Name Tokens API.
1436
+ */
1437
+ IndexingStatusUnsupported: "unsupported-indexing-status"
1438
+ };
1439
+
1440
+ // src/ensnode/api/name-tokens/zod-schemas.ts
1441
+ var makeRegisteredNameTokenSchema = (valueLabel = "Registered Name Token", serializable) => z15.object({
1442
+ domainId: makeNodeSchema(`${valueLabel}.domainId`),
1443
+ name: makeReinterpretedNameSchema(valueLabel),
1444
+ tokens: z15.array(makeNameTokenSchema(`${valueLabel}.tokens`, serializable)).nonempty(),
1445
+ expiresAt: makeUnixTimestampSchema(`${valueLabel}.expiresAt`),
1446
+ accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`)
1447
+ }).check(function invariant_nameIsAssociatedWithDomainId(ctx) {
1448
+ const { name, domainId } = ctx.value;
1449
+ if (namehashInterpretedName(name) !== domainId) {
1450
+ ctx.issues.push({
1451
+ code: "custom",
1452
+ input: ctx.value,
1453
+ message: `'name' must be associated with 'domainId': ${domainId}`
1454
+ });
1455
+ }
1456
+ }).check(
1457
+ function invariant_nameTokensOwnershipTypeNameWrapperRequiresOwnershipTypeFullyOnchainOrUnknown(ctx) {
1458
+ const { tokens } = ctx.value;
1459
+ const containsOwnershipNameWrapper = tokens.some(
1460
+ (t) => t.ownership.ownershipType === NameTokenOwnershipTypes.NameWrapper
1461
+ );
1462
+ const containsOwnershipFullyOnchainOrUnknown = tokens.some(
1463
+ (t) => t.ownership.ownershipType === NameTokenOwnershipTypes.FullyOnchain || t.ownership.ownershipType === NameTokenOwnershipTypes.Unknown
1464
+ );
1465
+ if (containsOwnershipNameWrapper && !containsOwnershipFullyOnchainOrUnknown) {
1466
+ ctx.issues.push({
1467
+ code: "custom",
1468
+ input: ctx.value,
1469
+ message: `'tokens' must contain name token with ownership type 'fully-onchain' or 'unknown' when name token with ownership type 'namewrapper' in listed`
1470
+ });
1471
+ }
1472
+ }
1473
+ ).check(function invariant_nameTokensContainAtMostOneWithOwnershipTypeEffective(ctx) {
1474
+ const { tokens } = ctx.value;
1475
+ const tokensCountWithOwnershipFullyOnchain = tokens.filter(
1476
+ (t) => t.ownership.ownershipType === NameTokenOwnershipTypes.FullyOnchain
1477
+ ).length;
1478
+ if (tokensCountWithOwnershipFullyOnchain > 1) {
1479
+ ctx.issues.push({
1480
+ code: "custom",
1481
+ input: ctx.value,
1482
+ message: `'tokens' must contain at most one name token with ownership type 'fully-onchain', current count: ${tokensCountWithOwnershipFullyOnchain}`
1483
+ });
1484
+ }
1485
+ });
1486
+ var makeNameTokensResponseOkSchema = (valueLabel = "Name Tokens Response OK", serializable) => z15.strictObject({
1487
+ responseCode: z15.literal(NameTokensResponseCodes.Ok),
1488
+ registeredNameTokens: makeRegisteredNameTokenSchema(`${valueLabel}.nameTokens`, serializable)
1489
+ });
1490
+ var makeNameTokensResponseErrorNameTokensNotIndexedSchema = (_valueLabel = "Name Tokens Response Error Name Not Indexed") => z15.strictObject({
1491
+ responseCode: z15.literal(NameTokensResponseCodes.Error),
1492
+ errorCode: z15.literal(NameTokensResponseErrorCodes.NameTokensNotIndexed),
1493
+ error: makeErrorResponseSchema()
1494
+ });
1495
+ var makeNameTokensResponseErrorEnsIndexerConfigUnsupported = (_valueLabel = "Name Tokens Response Error ENSIndexer Config Unsupported") => z15.strictObject({
1496
+ responseCode: z15.literal(NameTokensResponseCodes.Error),
1497
+ errorCode: z15.literal(NameTokensResponseErrorCodes.EnsIndexerConfigUnsupported),
1498
+ error: makeErrorResponseSchema()
1499
+ });
1500
+ var makeNameTokensResponseErrorNameIndexingStatusUnsupported = (_valueLabel = "Name Tokens Response Error Indexing Status Unsupported") => z15.strictObject({
1501
+ responseCode: z15.literal(NameTokensResponseCodes.Error),
1502
+ errorCode: z15.literal(NameTokensResponseErrorCodes.IndexingStatusUnsupported),
1503
+ error: makeErrorResponseSchema()
1504
+ });
1505
+ var makeNameTokensResponseErrorSchema = (valueLabel = "Name Tokens Response Error") => z15.discriminatedUnion("errorCode", [
1506
+ makeNameTokensResponseErrorNameTokensNotIndexedSchema(valueLabel),
1507
+ makeNameTokensResponseErrorEnsIndexerConfigUnsupported(valueLabel),
1508
+ makeNameTokensResponseErrorNameIndexingStatusUnsupported(valueLabel)
1509
+ ]);
1510
+ var makeNameTokensResponseSchema = (valueLabel = "Name Tokens Response", serializable) => {
1511
+ return z15.discriminatedUnion("responseCode", [
1512
+ makeNameTokensResponseOkSchema(valueLabel, serializable ?? false),
1513
+ makeNameTokensResponseErrorSchema(valueLabel)
1514
+ ]);
1515
+ };
1516
+
1517
+ // src/ensnode/api/realtime/zod-schemas.ts
1518
+ import { z as z16 } from "zod/v4";
1519
+ var realtimeResponseSchemaOk = z16.object({
1520
+ maxWorstCaseDistance: makeDurationSchema().describe(
1521
+ "The requested maximum acceptable worst-case indexing distance in seconds."
1522
+ ),
1523
+ slowestChainIndexingCursor: makeUnixTimestampSchema().describe(
1524
+ "The timestamp of the slowest chain's latest indexed block."
1525
+ ),
1526
+ worstCaseDistance: makeDurationSchema().describe(
1527
+ "The actual worst-case distance in seconds between 'now' and the slowest chain's indexing cursor. This allows your client to programmatically determine whether the ENSNode instance is sufficiently synchronized for your use case."
1528
+ )
1529
+ });
1530
+ var realtimeResponseSchemaError = makeErrorResponseSchema();
1531
+
1532
+ // src/ensnode/api/registrar-actions/examples.ts
1533
+ var registrarActionsResponseOkExample = {
1534
+ responseCode: "ok",
1535
+ registrarActions: [
1536
+ {
1537
+ action: {
1538
+ type: "registration",
1539
+ id: "0x0000000000000000000000000000000000000000000000000000000000000001",
1540
+ incrementalDuration: 31536e3,
1541
+ registrant: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
1542
+ registrationLifecycle: {
1543
+ subregistry: {
1544
+ subregistryId: {
1545
+ chainId: 1,
1546
+ address: "0x253553366da8546fc250f225fe3d25d0c782303b"
1547
+ },
1548
+ node: "0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae"
1549
+ },
1550
+ node: "0xee6c4522aab0003e8d14cd40a6af439055fd2577951148c14b6cea9a53475835",
1551
+ expiresAt: 1893456e3
1552
+ },
1553
+ pricing: {
1554
+ baseCost: { amount: "1000000000000000", currency: "ETH" },
1555
+ premium: { amount: "0", currency: "ETH" },
1556
+ total: { amount: "1000000000000000", currency: "ETH" }
1557
+ },
1558
+ referral: { encodedReferrer: null, decodedReferrer: null },
1559
+ block: { timestamp: 17e8, number: 185e5 },
1560
+ transactionHash: "0x0000000000000000000000000000000000000000000000000000000000000001",
1561
+ eventIds: ["0x0000000000000000000000000000000000000000000000000000000000000001"]
1562
+ },
1563
+ name: "vitalik.eth"
1564
+ }
1565
+ ],
1566
+ pageContext: {
1567
+ page: 1,
1568
+ recordsPerPage: 25,
1569
+ totalRecords: 1,
1570
+ totalPages: 1,
1571
+ hasNext: false,
1572
+ hasPrev: false,
1573
+ startIndex: 0,
1574
+ endIndex: 0
1575
+ },
1576
+ accurateAsOf: 17e8
1577
+ };
1578
+
1579
+ // src/ensnode/api/registrar-actions/zod-schemas.ts
1580
+ import { namehashInterpretedName as namehashInterpretedName2 } from "enssdk";
1581
+ import { z as z19 } from "zod/v4";
1582
+
1583
+ // src/registrars/zod-schemas.ts
1584
+ import { z as z17 } from "zod/v4";
1585
+
1586
+ // src/registrars/encoded-referrer.ts
1587
+ import { isNormalizedAddress, toNormalizedAddress as toNormalizedAddress2 } from "enssdk";
1588
+ import { pad, size as size2, slice, zeroAddress as zeroAddress4 } from "viem";
1589
+ var ENCODED_REFERRER_BYTE_OFFSET = 12;
1590
+ var ENCODED_REFERRER_BYTE_LENGTH = 32;
1591
+ var EXPECTED_ENCODED_REFERRER_PADDING = pad("0x", {
1592
+ size: ENCODED_REFERRER_BYTE_OFFSET,
1593
+ dir: "left"
1594
+ });
1595
+ var ZERO_ENCODED_REFERRER = pad("0x", {
1596
+ size: ENCODED_REFERRER_BYTE_LENGTH,
1597
+ dir: "left"
1598
+ });
1599
+ function decodeEncodedReferrer(encodedReferrer) {
1600
+ if (size2(encodedReferrer) !== ENCODED_REFERRER_BYTE_LENGTH) {
1601
+ throw new Error(
1602
+ `Encoded referrer value must be represented by ${ENCODED_REFERRER_BYTE_LENGTH} bytes.`
1603
+ );
1604
+ }
1605
+ const padding = slice(encodedReferrer, 0, ENCODED_REFERRER_BYTE_OFFSET);
1606
+ if (padding !== EXPECTED_ENCODED_REFERRER_PADDING) return zeroAddress4;
1607
+ const decodedReferrer = slice(encodedReferrer, ENCODED_REFERRER_BYTE_OFFSET);
1608
+ try {
1609
+ return toNormalizedAddress2(decodedReferrer);
1610
+ } catch {
1611
+ throw new Error(`Decoded referrer value must be a valid EVM address.`);
1612
+ }
1613
+ }
1614
+
1615
+ // src/shared/serialize.ts
1616
+ function serializeChainId(chainId) {
1617
+ return chainId.toString();
1618
+ }
1619
+
1620
+ // src/registrars/registrar-action.ts
1621
+ var RegistrarActionTypes = {
1622
+ Registration: "registration",
1623
+ Renewal: "renewal"
1624
+ };
1625
+
1626
+ // src/registrars/zod-schemas.ts
1627
+ var makeSubregistrySchema = (valueLabel = "Subregistry") => z17.object({
1628
+ subregistryId: makeAccountIdSchema(`${valueLabel} Subregistry ID`),
1629
+ node: makeNodeSchema(`${valueLabel} Node`)
1630
+ });
1631
+ var makeRegistrationLifecycleSchema = (valueLabel = "Registration Lifecycle") => z17.object({
1632
+ subregistry: makeSubregistrySchema(`${valueLabel} Subregistry`),
1633
+ node: makeNodeSchema(`${valueLabel} Node`),
1634
+ expiresAt: makeUnixTimestampSchema(`${valueLabel} Expires at`)
1635
+ });
1636
+ function invariant_registrarActionPricingTotalIsSumOfBaseCostAndPremium(ctx) {
1637
+ const { baseCost, premium, total } = ctx.value;
1638
+ const actualTotal = addPrices(baseCost, premium);
1639
+ if (!isPriceEqual(actualTotal, total)) {
1640
+ ctx.issues.push({
1641
+ code: "custom",
1642
+ input: ctx.value,
1643
+ message: `'total' must be equal to the sum of 'baseCost' and 'premium'`
1644
+ });
1645
+ }
1646
+ }
1647
+ var makeRegistrarActionPricingSchema = (valueLabel = "Registrar Action Pricing") => z17.union([
1648
+ // pricing available
1649
+ z17.object({
1650
+ baseCost: makePriceEthSchema(`${valueLabel} Base Cost`),
1651
+ premium: makePriceEthSchema(`${valueLabel} Premium`),
1652
+ total: makePriceEthSchema(`${valueLabel} Total`)
1653
+ }).check(invariant_registrarActionPricingTotalIsSumOfBaseCostAndPremium).transform((v) => v),
1654
+ // pricing unknown
1655
+ z17.object({
1656
+ baseCost: z17.null(),
1657
+ premium: z17.null(),
1658
+ total: z17.null()
1659
+ }).transform((v) => v)
1660
+ ]);
1661
+ var makeSerializedRegistrarActionPricingSchema = (valueLabel = "Serialized Registrar Action Pricing") => z17.union([
1662
+ // pricing available
1663
+ z17.object({
1664
+ baseCost: makeSerializedPriceEthSchema(`${valueLabel} Base Cost`),
1665
+ premium: makeSerializedPriceEthSchema(`${valueLabel} Premium`),
1666
+ total: makeSerializedPriceEthSchema(`${valueLabel} Total`)
1667
+ }),
1668
+ // pricing unknown
1669
+ z17.object({
1670
+ baseCost: z17.null(),
1671
+ premium: z17.null(),
1672
+ total: z17.null()
1673
+ })
1674
+ ]);
1675
+ function invariant_registrarActionDecodedReferrerBasedOnRawReferrer(ctx) {
1676
+ const { encodedReferrer, decodedReferrer } = ctx.value;
1677
+ try {
1678
+ const expectedDecodedReferrer = decodeEncodedReferrer(encodedReferrer);
1679
+ if (decodedReferrer !== expectedDecodedReferrer) {
1680
+ ctx.issues.push({
1681
+ code: "custom",
1682
+ input: ctx.value,
1683
+ message: `'decodedReferrer' must be based on 'encodedReferrer'`
1684
+ });
1685
+ }
1686
+ } catch (error) {
1687
+ const errorMessage = error instanceof Error ? error.message : "Unknown error";
1688
+ ctx.issues.push({
1689
+ code: "custom",
1690
+ input: ctx.value,
1691
+ message: errorMessage
1692
+ });
1693
+ }
1694
+ }
1695
+ var makeRegistrarActionReferralSchema = (valueLabel = "Registrar Action Referral") => z17.union([
1696
+ // referral available
1697
+ z17.object({
1698
+ encodedReferrer: makeHexStringSchema(
1699
+ { bytesCount: ENCODED_REFERRER_BYTE_LENGTH },
1700
+ `${valueLabel} Encoded Referrer`
1701
+ ),
1702
+ decodedReferrer: makeNormalizedAddressSchema(`${valueLabel} Decoded Referrer`)
1703
+ }).check(invariant_registrarActionDecodedReferrerBasedOnRawReferrer),
1704
+ // referral not applicable
1705
+ z17.object({
1706
+ encodedReferrer: z17.null(),
1707
+ decodedReferrer: z17.null()
1708
+ })
1709
+ ]);
1710
+ function invariant_eventIdsInitialElementIsTheActionId(ctx) {
1711
+ const { id, eventIds } = ctx.value;
1712
+ if (eventIds[0] !== id) {
1713
+ ctx.issues.push({
1714
+ code: "custom",
1715
+ input: ctx.value,
1716
+ message: "The initial element of `eventIds` must be the `id` value"
1717
+ });
1718
+ }
1719
+ }
1720
+ var EventIdSchema = z17.string().nonempty();
1721
+ var EventIdsSchema = z17.array(EventIdSchema).min(1).transform((v) => v);
1722
+ var makeBaseRegistrarActionSchemaWithoutCheck = (valueLabel = "Base Registrar Action") => z17.object({
1723
+ id: EventIdSchema,
1724
+ incrementalDuration: makeDurationSchema(`${valueLabel} Incremental Duration`),
1725
+ registrant: makeNormalizedAddressSchema(`${valueLabel} Registrant`),
1726
+ registrationLifecycle: makeRegistrationLifecycleSchema(`${valueLabel} Registration Lifecycle`),
1727
+ pricing: makeRegistrarActionPricingSchema(`${valueLabel} Pricing`),
1728
+ referral: makeRegistrarActionReferralSchema(`${valueLabel} Referral`),
1729
+ block: makeBlockRefSchema(`${valueLabel} Block`),
1730
+ transactionHash: makeTransactionHashSchema(`${valueLabel} Transaction Hash`),
1731
+ eventIds: EventIdsSchema
1732
+ });
1733
+ var makeBaseRegistrarActionSchema = (valueLabel = "Base Registrar Action") => makeBaseRegistrarActionSchemaWithoutCheck(valueLabel).check(
1734
+ invariant_eventIdsInitialElementIsTheActionId
1735
+ );
1736
+ var makeRegistrarActionRegistrationSchema = (valueLabel = "Registration ") => makeBaseRegistrarActionSchema(valueLabel).extend({
1737
+ type: z17.literal(RegistrarActionTypes.Registration)
1738
+ });
1739
+ var makeRegistrarActionRenewalSchema = (valueLabel = "Renewal") => makeBaseRegistrarActionSchema(valueLabel).extend({
1740
+ type: z17.literal(RegistrarActionTypes.Renewal)
1741
+ });
1742
+ var makeRegistrarActionSchema = (valueLabel = "Registrar Action") => z17.discriminatedUnion("type", [
1743
+ makeRegistrarActionRegistrationSchema(`${valueLabel} Registration`),
1744
+ makeRegistrarActionRenewalSchema(`${valueLabel} Renewal`)
1745
+ ]);
1746
+ var makeSerializedBaseRegistrarActionSchema = (valueLabel = "Serialized Base Registrar Action") => makeBaseRegistrarActionSchemaWithoutCheck(valueLabel).extend({
1747
+ pricing: makeSerializedRegistrarActionPricingSchema(`${valueLabel} Pricing`)
1748
+ });
1749
+ var makeSerializedRegistrarActionRegistrationSchema = (valueLabel = "Serialized Registration") => makeSerializedBaseRegistrarActionSchema(valueLabel).extend({
1750
+ type: z17.literal(RegistrarActionTypes.Registration)
1751
+ });
1752
+ var makeSerializedRegistrarActionRenewalSchema = (valueLabel = "Serialized Renewal") => makeSerializedBaseRegistrarActionSchema(valueLabel).extend({
1753
+ type: z17.literal(RegistrarActionTypes.Renewal)
1754
+ });
1755
+ var makeSerializedRegistrarActionSchema = (valueLabel = "Serialized Registrar Action") => z17.discriminatedUnion("type", [
1756
+ makeSerializedRegistrarActionRegistrationSchema(`${valueLabel} Registration`),
1757
+ makeSerializedRegistrarActionRenewalSchema(`${valueLabel} Renewal`)
1758
+ ]);
1759
+
1760
+ // src/ensnode/api/shared/pagination/zod-schemas.ts
1761
+ import { z as z18 } from "zod/v4";
1762
+
1763
+ // src/ensnode/api/shared/pagination/request.ts
1764
+ var RECORDS_PER_PAGE_MAX = 100;
1765
+
1766
+ // src/ensnode/api/shared/pagination/zod-schemas.ts
1767
+ var makeRequestPageParamsSchema = (valueLabel = "RequestPageParams") => z18.object({
1768
+ page: makePositiveIntegerSchema(`${valueLabel}.page`),
1769
+ recordsPerPage: makePositiveIntegerSchema(`${valueLabel}.recordsPerPage`).max(
1770
+ RECORDS_PER_PAGE_MAX,
1771
+ `${valueLabel}.recordsPerPage must not exceed ${RECORDS_PER_PAGE_MAX}`
1772
+ )
1773
+ });
1774
+ var makeResponsePageContextSchemaWithNoRecords = (valueLabel = "ResponsePageContextWithNoRecords") => z18.object({
1775
+ totalRecords: z18.literal(0),
1776
+ totalPages: z18.literal(1),
1777
+ hasNext: z18.literal(false),
1778
+ hasPrev: z18.literal(false)
1779
+ }).extend(makeRequestPageParamsSchema(valueLabel).shape);
1780
+ function invariant_responsePageWithRecordsIsCorrect(ctx) {
1781
+ const { hasNext, hasPrev, recordsPerPage, page, totalRecords, startIndex, endIndex } = ctx.value;
1782
+ const expectedHasNext = page * recordsPerPage < totalRecords;
1783
+ if (hasNext !== expectedHasNext) {
1784
+ ctx.issues.push({
1785
+ code: "custom",
1786
+ input: ctx.value,
1787
+ message: `hasNext must be equal to '${expectedHasNext ? "true" : "false"}'`
1788
+ });
1789
+ }
1790
+ const expectedHasPrev = page > 1;
1791
+ if (hasPrev !== expectedHasPrev) {
1792
+ ctx.issues.push({
1793
+ code: "custom",
1794
+ input: ctx.value,
1795
+ message: `hasPrev must be equal to '${expectedHasPrev ? "true" : "false"}'`
1796
+ });
1797
+ }
1798
+ if (endIndex < startIndex) {
1799
+ ctx.issues.push({
1800
+ code: "custom",
1801
+ input: ctx.value,
1802
+ message: `endIndex must be greater than or equal to startIndex`
1803
+ });
1804
+ }
1805
+ if (endIndex >= totalRecords) {
1806
+ ctx.issues.push({
1807
+ code: "custom",
1808
+ input: ctx.value,
1809
+ message: `endIndex must be lower than totalRecords`
1810
+ });
1811
+ }
1812
+ }
1813
+ var makeResponsePageContextSchemaWithRecords = (valueLabel = "ResponsePageContextWithRecords") => z18.object({
1814
+ totalRecords: makePositiveIntegerSchema(`${valueLabel}.totalRecords`),
1815
+ totalPages: makePositiveIntegerSchema(`${valueLabel}.totalPages`),
1816
+ hasNext: z18.boolean(),
1817
+ hasPrev: z18.boolean(),
1818
+ startIndex: makeNonNegativeIntegerSchema(`${valueLabel}.startIndex`),
1819
+ endIndex: makeNonNegativeIntegerSchema(`${valueLabel}.endIndex`)
1820
+ }).extend(makeRequestPageParamsSchema(valueLabel).shape).check(invariant_responsePageWithRecordsIsCorrect);
1821
+ var makeResponsePageContextSchema = (valueLabel = "ResponsePageContext") => z18.union([
1822
+ makeResponsePageContextSchemaWithNoRecords(valueLabel),
1823
+ makeResponsePageContextSchemaWithRecords(valueLabel)
1824
+ ]);
1825
+
1826
+ // src/ensnode/api/registrar-actions/response.ts
1827
+ var RegistrarActionsResponseCodes = {
1828
+ /**
1829
+ * Represents that Registrar Actions are available.
1830
+ */
1831
+ Ok: "ok",
1832
+ /**
1833
+ * Represents that Registrar Actions are unavailable.
1834
+ */
1835
+ Error: "error"
1836
+ };
1837
+
1838
+ // src/ensnode/api/registrar-actions/zod-schemas.ts
1839
+ function invariant_registrationLifecycleNodeMatchesName(ctx) {
1840
+ const { name, action } = ctx.value;
1841
+ const expectedNode = action.registrationLifecycle.node;
1842
+ const actualNode = namehashInterpretedName2(name);
1843
+ if (actualNode !== expectedNode) {
1844
+ ctx.issues.push({
1845
+ code: "custom",
1846
+ input: ctx.value,
1847
+ message: `The 'action.registrationLifecycle.node' must match namehash of 'name'`
1848
+ });
1849
+ }
1850
+ }
1851
+ var makeNamedRegistrarActionSchema = (valueLabel = "Named Registrar Action") => z19.object({
1852
+ action: makeRegistrarActionSchema(valueLabel),
1853
+ name: makeReinterpretedNameSchema(valueLabel)
1854
+ }).check(invariant_registrationLifecycleNodeMatchesName);
1855
+ var makeSerializedNamedRegistrarActionSchema = (valueLabel = "Serialized Named Registrar Action") => z19.object({
1856
+ action: makeSerializedRegistrarActionSchema(valueLabel),
1857
+ name: makeReinterpretedNameSchema(valueLabel)
1858
+ });
1859
+ var makeRegistrarActionsResponseOkSchema = (valueLabel = "Registrar Actions Response OK") => z19.object({
1860
+ responseCode: z19.literal(RegistrarActionsResponseCodes.Ok),
1861
+ registrarActions: z19.array(makeNamedRegistrarActionSchema(valueLabel)),
1862
+ pageContext: makeResponsePageContextSchema(`${valueLabel}.pageContext`),
1863
+ accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`)
1864
+ });
1865
+ var makeRegistrarActionsResponseErrorSchema = (_valueLabel = "Registrar Actions Response Error") => z19.strictObject({
1866
+ responseCode: z19.literal(RegistrarActionsResponseCodes.Error),
1867
+ error: makeErrorResponseSchema()
1868
+ });
1869
+ var makeRegistrarActionsResponseSchema = (valueLabel = "Registrar Actions Response") => z19.discriminatedUnion("responseCode", [
1870
+ makeRegistrarActionsResponseOkSchema(valueLabel),
1871
+ makeRegistrarActionsResponseErrorSchema(valueLabel)
1872
+ ]);
1873
+ var makeSerializedRegistrarActionsResponseOkSchema = (valueLabel = "Serialized Registrar Actions Response OK") => z19.object({
1874
+ responseCode: z19.literal(RegistrarActionsResponseCodes.Ok),
1875
+ registrarActions: z19.array(makeSerializedNamedRegistrarActionSchema(valueLabel)),
1876
+ pageContext: makeResponsePageContextSchema(`${valueLabel}.pageContext`),
1877
+ accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`)
1878
+ });
1879
+
1880
+ // src/ensnode/api/resolution/examples.ts
1881
+ var resolveRecordsResponseExample = {
1882
+ records: {
1883
+ addresses: { "60": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045" },
1884
+ texts: {
1885
+ description: "mi pinxe lo crino tcati"
1886
+ }
1887
+ },
1888
+ accelerationRequested: false,
1889
+ accelerationAttempted: false
1890
+ };
1891
+ var resolvePrimaryNameResponseExample = {
1892
+ name: "jesse.base.eth",
1893
+ accelerationRequested: false,
1894
+ accelerationAttempted: false
1895
+ };
1896
+ var resolvePrimaryNamesResponseExample = {
1897
+ names: {
1898
+ "1": "jesse.base.eth",
1899
+ "10": null,
1900
+ "8453": "jesse.base.eth",
1901
+ "42161": null,
1902
+ "59144": null,
1903
+ "534352": null
1904
+ },
1905
+ accelerationRequested: false,
1906
+ accelerationAttempted: false
1907
+ };
1908
+
1909
+ // src/ensnode/api/resolution/zod-schemas.ts
1910
+ import { z as z20 } from "zod/v4";
1911
+ var makeResolverRecordsResponseSchema = () => z20.object({
1912
+ name: z20.string().nullable().optional(),
1913
+ addresses: z20.record(z20.string(), z20.string().nullable()).optional(),
1914
+ texts: z20.record(z20.string(), z20.string().nullable()).optional(),
1915
+ contenthash: z20.string().nullable().optional(),
1916
+ pubkey: z20.object({ x: z20.string(), y: z20.string() }).nullable().optional(),
1917
+ dnszonehash: z20.string().nullable().optional(),
1918
+ version: z20.string().nullable().optional(),
1919
+ abi: z20.object({ contentType: z20.string(), data: z20.string() }).nullable().optional(),
1920
+ interfaces: z20.record(z20.string(), z20.string().nullable()).optional()
1921
+ });
1922
+ var makeResolveRecordsResponseSchema = () => z20.object({
1923
+ records: makeResolverRecordsResponseSchema(),
1924
+ accelerationRequested: z20.boolean(),
1925
+ accelerationAttempted: z20.boolean(),
1926
+ // TODO: Find a better way to handle recursive types, patch solution is .unknown()
1927
+ trace: z20.array(z20.unknown()).optional()
1928
+ });
1929
+ var makeResolvePrimaryNameResponseSchema = () => z20.object({
1930
+ name: z20.string().nullable(),
1931
+ accelerationRequested: z20.boolean(),
1932
+ accelerationAttempted: z20.boolean(),
1933
+ trace: z20.array(z20.unknown()).optional()
1934
+ });
1935
+ var makeResolvePrimaryNamesResponseSchema = () => z20.object({
1936
+ names: z20.record(z20.number(), z20.string().nullable()),
1937
+ accelerationRequested: z20.boolean(),
1938
+ accelerationAttempted: z20.boolean(),
1939
+ trace: z20.array(z20.unknown()).optional()
1940
+ });
1941
+
1942
+ // src/ensnode/api/shared/errors/examples.ts
1943
+ var errorResponseBadRequestExample = {
1944
+ message: "Invalid Input"
1945
+ };
1946
+ var errorResponseInvalidNameExample = {
1947
+ message: "Invalid Input",
1948
+ details: {
1949
+ errors: [],
1950
+ properties: {
1951
+ name: { errors: ["Must be normalized, see https://docs.ens.domains/resolution/names/"] }
1952
+ }
1953
+ }
1954
+ };
1955
+ var errorResponseInvalidAddressExample = {
1956
+ message: "Invalid Input",
1957
+ details: {
1958
+ errors: [],
1959
+ properties: { address: { errors: ["EVM address must be a valid EVM address"] } }
1960
+ }
1961
+ };
1962
+ var errorResponseInternalServerErrorExample = {
1963
+ message: "Internal Server Error"
1964
+ };
1965
+
1966
+ // src/omnigraph-api/example-queries.ts
1967
+ import { asInterpretedName, toNormalizedAddress as toNormalizedAddress3 } from "enssdk";
1968
+ import { DatasourceNames as DatasourceNames2, ENSNamespaceIds as ENSNamespaceIds3 } from "@ensnode/datasources";
1969
+ import { accounts } from "@ensnode/datasources/devnet";
1970
+ var SEPOLIA_V2_V2_ETH_REGISTRY = maybeGetDatasourceContract(
1971
+ ENSNamespaceIds3.SepoliaV2,
1972
+ DatasourceNames2.ENSv2Root,
1973
+ "ETHRegistry"
1974
+ );
1975
+ var SEPOLIA_V2_V2_ETH_REGISTRAR = maybeGetDatasourceContract(
1976
+ ENSNamespaceIds3.SepoliaV2,
1977
+ DatasourceNames2.ENSv2Root,
1978
+ "ETHRegistrar"
1979
+ );
1980
+ var ENS_TEST_ENV_V2_ETH_REGISTRY = maybeGetDatasourceContract(
1981
+ ENSNamespaceIds3.EnsTestEnv,
1982
+ DatasourceNames2.ENSv2Root,
1983
+ "ETHRegistry"
1984
+ );
1985
+ var ENS_TEST_ENV_V2_ETH_REGISTRAR = maybeGetDatasourceContract(
1986
+ ENSNamespaceIds3.EnsTestEnv,
1987
+ DatasourceNames2.ENSv2Root,
1988
+ "ETHRegistrar"
1989
+ );
1990
+ var VITALIK_ADDRESS = toNormalizedAddress3("0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045");
1991
+ var _SEPOLIA_V2_USER_ADDRESS = toNormalizedAddress3("0x2f8e8b1126e75fde0b7f731e7cb5847eba2d2574");
1992
+ var SEPOLIA_V2_ADDRESS_WITH_LOT_OF_NAMES = toNormalizedAddress3(
1993
+ "0x205d2686da3bf33f64c17f21462c51b5ead462cf"
1994
+ );
1995
+ var DEVNET_NAME_WITH_OWNED_RESOLVER = asInterpretedName("example.eth");
1996
+ var SEPOLIA_V2_NAME_WITH_OWNED_RESOLVER = asInterpretedName("sfmonicdebmig.eth");
1997
+ var SEPOLIA_V2_TEST_NAME = asInterpretedName("test-name.eth");
1998
+ function getGraphqlApiExampleQueryById(id) {
1999
+ const found = graphqlApiExampleQueryById.get(id);
2000
+ if (!found) {
2001
+ throw new Error(`Unknown GraphQL API example query id: ${id}`);
2002
+ }
2003
+ return found;
2004
+ }
2005
+ var GRAPHQL_API_EXAMPLE_QUERIES = [
2006
+ ////////////////
2007
+ // Hello World
2008
+ ////////////////
2009
+ {
2010
+ id: "hello-world",
2011
+ query: `#
2012
+ # Welcome to this interactive playground for
2013
+ # ENSNode's GraphQL API!
2014
+ #
2015
+ # You can get started by typing your query here or by using
2016
+ # the Explorer on the left to select the data you want to query.
2017
+ #
2018
+ # There are also example queries in the tabs above \u261D\uFE0F
2019
+ query HelloWorld {
2020
+ domain(by: { name: "eth" }) { canonical { name { interpreted } } owner { address } }
2021
+ }`,
2022
+ variables: { default: {} }
2023
+ },
2024
+ /////////////////
2025
+ // Find Domains
2026
+ /////////////////
2027
+ {
2028
+ id: "find-domains",
2029
+ query: `
2030
+ query FindDomains(
2031
+ $name: DomainsNameFilter!
2032
+ $order: DomainsOrderInput
2033
+ ) {
2034
+ domains(
2035
+ where: { name: $name }
2036
+ order: $order
2037
+ first: 20
2038
+ ) {
2039
+ edges {
2040
+ node {
2041
+ __typename
2042
+ id
2043
+ label { interpreted hash }
2044
+ canonical { name { interpreted } }
2045
+
2046
+ registration { expiry event { timestamp } }
2047
+ }
2048
+ }
2049
+ }
2050
+ }`,
2051
+ variables: {
2052
+ default: { name: { starts_with: "vitalik" }, order: { by: "NAME", dir: "DESC" } },
2053
+ [ENSNamespaceIds3.EnsTestEnv]: {
2054
+ name: { starts_with: "c" },
2055
+ order: { by: "NAME", dir: "DESC" }
2056
+ },
2057
+ [ENSNamespaceIds3.SepoliaV2]: {
2058
+ name: { starts_with: "test-na" },
2059
+ order: { by: "NAME", dir: "DESC" }
2060
+ }
2061
+ }
2062
+ },
2063
+ ///////////////////
2064
+ // Domain By Name
2065
+ ///////////////////
2066
+ {
2067
+ id: "domain-by-name",
2068
+ query: `
2069
+ query DomainByName($name: InterpretedName!) {
2070
+ domain(by: {name: $name}) {
2071
+ __typename
2072
+ id
2073
+ label { interpreted hash }
2074
+ canonical { name { interpreted } node path { id } }
2075
+ owner { address }
2076
+ subregistry { contract { chainId address } }
2077
+
2078
+ ... on ENSv1Domain {
2079
+ rootRegistryOwner { address }
2080
+ }
2081
+ }
2082
+ }`,
2083
+ variables: {
2084
+ default: { name: "eth" },
2085
+ [ENSNamespaceIds3.SepoliaV2]: { name: SEPOLIA_V2_TEST_NAME }
2086
+ }
2087
+ },
2088
+ //////////////////////
2089
+ // Domain Subdomains
2090
+ //////////////////////
2091
+ {
2092
+ id: "domain-subdomains",
2093
+ query: `
2094
+ query DomainSubdomains($name: InterpretedName!) {
2095
+ domain(by: {name: $name}) {
2096
+ canonical { name { interpreted } }
2097
+ subdomains(first: 10) {
2098
+ edges {
2099
+ node {
2100
+ canonical { name { interpreted } }
2101
+ }
2102
+ }
2103
+ }
2104
+ }
2105
+ }`,
2106
+ variables: { default: { name: "eth" } }
2107
+ },
2108
+ /////////////////
2109
+ // Domain Events
2110
+ /////////////////
2111
+ {
2112
+ id: "domain-events",
2113
+ query: `
2114
+ query DomainEvents($name: InterpretedName!) {
2115
+ domain(by: {name: $name}) {
2116
+ events {
2117
+ totalCount
2118
+ edges {
2119
+ node {
2120
+ from
2121
+ to
2122
+ topics
2123
+ data
2124
+ timestamp
2125
+ transactionHash
2126
+ }
2127
+ }
2128
+ }
2129
+ }
2130
+ }`,
2131
+ variables: {
2132
+ default: { name: "newowner.eth" },
2133
+ [ENSNamespaceIds3.SepoliaV2]: { name: "sfmonicdebmig.eth" }
2134
+ }
2135
+ },
2136
+ ////////////////////
2137
+ // Account Domains
2138
+ ////////////////////
2139
+ {
2140
+ id: "domains-by-address",
2141
+ query: `
2142
+ query AccountDomains(
2143
+ $address: Address!
2144
+ ) {
2145
+ account(by: { address: $address }) {
2146
+ domains {
2147
+ edges {
2148
+ node {
2149
+ label { interpreted }
2150
+ canonical { name { interpreted } }
2151
+ }
2152
+ }
2153
+ }
2154
+ }
2155
+ }`,
2156
+ variables: {
2157
+ default: { address: VITALIK_ADDRESS },
2158
+ [ENSNamespaceIds3.EnsTestEnv]: { address: accounts.owner.address },
2159
+ [ENSNamespaceIds3.SepoliaV2]: { address: SEPOLIA_V2_ADDRESS_WITH_LOT_OF_NAMES }
2160
+ }
2161
+ },
2162
+ ////////////////////
2163
+ // Account Events
2164
+ ////////////////////
2165
+ {
2166
+ id: "account-events",
2167
+ query: `
2168
+ query AccountEvents(
2169
+ $address: Address!
2170
+ ) {
2171
+ account(by: { address: $address }) {
2172
+ events { totalCount edges { node { topics data timestamp } } }
2173
+ }
2174
+ }`,
2175
+ variables: {
2176
+ default: { address: VITALIK_ADDRESS },
2177
+ [ENSNamespaceIds3.EnsTestEnv]: { address: accounts.deployer.address },
2178
+ [ENSNamespaceIds3.SepoliaV2]: { address: SEPOLIA_V2_ADDRESS_WITH_LOT_OF_NAMES }
2179
+ }
2180
+ },
2181
+ /////////////////////
2182
+ // Registry Domains
2183
+ /////////////////////
2184
+ {
2185
+ id: "registry-domains",
2186
+ query: `
2187
+ query RegistryDomains(
2188
+ $registry: AccountIdInput!
2189
+ ) {
2190
+ registry(by: { contract: $registry }) {
2191
+ domains {
2192
+ edges {
2193
+ node {
2194
+ label { interpreted }
2195
+ canonical { name { interpreted } }
2196
+ }
2197
+ }
2198
+ }
2199
+ }
2200
+ }`,
2201
+ variables: {
2202
+ // TODO: this only accesses v2 registries, so we default to ens-test-env for now
2203
+ default: { registry: ENS_TEST_ENV_V2_ETH_REGISTRY },
2204
+ [ENSNamespaceIds3.SepoliaV2]: { registry: SEPOLIA_V2_V2_ETH_REGISTRY }
2205
+ }
2206
+ },
2207
+ ////////////////////////////
2208
+ // Permissions By Contract
2209
+ ////////////////////////////
2210
+ {
2211
+ id: "permissions-by-contract",
2212
+ query: `
2213
+ query PermissionsByContract(
2214
+ $contract: AccountIdInput!
2215
+ ) {
2216
+ permissions(by: { contract: $contract }) {
2217
+ resources {
2218
+ edges {
2219
+ node {
2220
+ resource
2221
+ users {
2222
+ edges {
2223
+ node {
2224
+ id
2225
+ user { address }
2226
+ roles
2227
+ }
2228
+ }
2229
+ }
2230
+ }
2231
+ }
2232
+ }
2233
+ events { totalCount edges { node { topics data timestamp } } }
2234
+ }
2235
+ }`,
2236
+ variables: {
2237
+ // TODO: same as above
2238
+ default: { contract: ENS_TEST_ENV_V2_ETH_REGISTRAR },
2239
+ // TODO: example response is empty for this address on Sepolia V2
2240
+ [ENSNamespaceIds3.SepoliaV2]: { contract: SEPOLIA_V2_V2_ETH_REGISTRAR }
2241
+ }
2242
+ },
2243
+ ////////////////////////
2244
+ // Permissions By User
2245
+ ////////////////////////
2246
+ {
2247
+ id: "permissions-by-user",
2248
+ query: `
2249
+ query PermissionsByUser($address: Address!) {
2250
+ account(by: { address: $address }) {
2251
+ permissions {
2252
+ edges {
2253
+ node {
2254
+ resource
2255
+ roles
2256
+ }
2257
+ }
2258
+ }
2259
+ }
2260
+ }`,
2261
+ variables: {
2262
+ default: { address: accounts.deployer.address },
2263
+ // TODO: example response is empty for this address on Sepolia V2
2264
+ [ENSNamespaceIds3.SepoliaV2]: { address: SEPOLIA_V2_ADDRESS_WITH_LOT_OF_NAMES }
2265
+ }
2266
+ },
2267
+ //////////////////////////////////
2268
+ // Account Resolver Permissions
2269
+ //////////////////////////////////
2270
+ {
2271
+ id: "account-resolver-permissions",
2272
+ query: `
2273
+ query AccountResolverPermissions($address: Address!) {
2274
+ account(by: { address: $address }) {
2275
+ resolverPermissions {
2276
+ edges {
2277
+ node {
2278
+ resolver {
2279
+ contract {
2280
+ address
2281
+ }
2282
+ }
2283
+ }
2284
+ }
2285
+ }
2286
+ }
2287
+ }`,
2288
+ variables: {
2289
+ default: { address: accounts.deployer.address },
2290
+ [ENSNamespaceIds3.SepoliaV2]: { address: SEPOLIA_V2_ADDRESS_WITH_LOT_OF_NAMES }
2291
+ }
2292
+ },
2293
+ //////////////////////////////
2294
+ // Domain's Assigned Resolver
2295
+ //////////////////////////////
2296
+ {
2297
+ id: "domain-resolver",
2298
+ query: `
2299
+ query DomainResolver($name: InterpretedName!) {
2300
+ domain(by: { name: $name }) {
2301
+ resolver {
2302
+ assigned {
2303
+ records { edges { node { node keys coinTypes } } }
2304
+ permissions { resources { edges { node { resource users { edges { node { user { address } roles } } } } } } }
2305
+ events { totalCount edges { node { topics data timestamp } } }
2306
+ }
2307
+ }
2308
+ }
2309
+ }`,
2310
+ variables: {
2311
+ default: { name: "vitalik.eth" },
2312
+ [ENSNamespaceIds3.EnsTestEnv]: { name: DEVNET_NAME_WITH_OWNED_RESOLVER },
2313
+ [ENSNamespaceIds3.SepoliaV2]: { name: SEPOLIA_V2_NAME_WITH_OWNED_RESOLVER }
2314
+ }
2315
+ },
2316
+ //////////////
2317
+ // Namegraph
2318
+ //////////////
2319
+ {
2320
+ id: "namegraph",
2321
+ query: `
2322
+ query Namegraph {
2323
+ root {
2324
+ id
2325
+ domains {
2326
+ edges {
2327
+ node {
2328
+ canonical { name { interpreted } }
2329
+
2330
+ subdomains {
2331
+ edges {
2332
+ node {
2333
+ canonical { name { interpreted } }
2334
+
2335
+ subdomains {
2336
+ edges {
2337
+ node {
2338
+ canonical { name { interpreted } }
2339
+ }
2340
+ }
2341
+ }
2342
+ }
2343
+ }
2344
+ }
2345
+ }
2346
+ }
2347
+ }
2348
+ }
2349
+ }`,
2350
+ variables: { default: {} }
2351
+ }
2352
+ ];
2353
+ var graphqlApiExampleQueryById = new Map(
2354
+ GRAPHQL_API_EXAMPLE_QUERIES.map((entry) => [entry.id, entry])
2355
+ );
2356
+
2357
+ // src/rpc/eip-165.ts
2358
+ var EIP_165_ABI = [
2359
+ {
2360
+ inputs: [
2361
+ {
2362
+ internalType: "bytes4",
2363
+ name: "interfaceID",
2364
+ type: "bytes4"
2365
+ }
2366
+ ],
2367
+ name: "supportsInterface",
2368
+ outputs: [
2369
+ {
2370
+ internalType: "bool",
2371
+ name: "",
2372
+ type: "bool"
2373
+ }
2374
+ ],
2375
+ stateMutability: "view",
2376
+ type: "function"
2377
+ }
2378
+ ];
2379
+ async function supportsInterface({
2380
+ publicClient,
2381
+ interfaceId: selector,
2382
+ address
2383
+ }) {
2384
+ try {
2385
+ return await publicClient.readContract({
2386
+ abi: EIP_165_ABI,
2387
+ functionName: "supportsInterface",
2388
+ address,
2389
+ args: [selector]
2390
+ });
2391
+ } catch {
2392
+ return false;
2393
+ }
2394
+ }
2395
+ var makeSupportsInterfaceReader = (interfaceId) => (args) => supportsInterface({
2396
+ ...args,
2397
+ interfaceId
2398
+ });
2399
+
2400
+ // src/rpc/is-extended-resolver.ts
2401
+ var IExtendedResolverInterfaceId = "0x9061b923";
2402
+ var isExtendedResolver = makeSupportsInterfaceReader(IExtendedResolverInterfaceId);
2403
+
2404
+ // src/shared/config/build-rpc-urls.ts
2405
+ import {
2406
+ arbitrum,
2407
+ arbitrumSepolia,
2408
+ base,
2409
+ baseSepolia,
2410
+ linea,
2411
+ lineaSepolia,
2412
+ mainnet,
2413
+ optimism,
2414
+ optimismSepolia,
2415
+ scroll,
2416
+ scrollSepolia,
2417
+ sepolia
2418
+ } from "viem/chains";
2419
+ function buildAlchemyBaseUrl(chainId, key) {
2420
+ switch (chainId) {
2421
+ case mainnet.id:
2422
+ return `eth-mainnet.g.alchemy.com/v2/${key}`;
2423
+ case sepolia.id:
2424
+ return `eth-sepolia.g.alchemy.com/v2/${key}`;
2425
+ case arbitrum.id:
2426
+ return `arb-mainnet.g.alchemy.com/v2/${key}`;
2427
+ case arbitrumSepolia.id:
2428
+ return `arb-sepolia.g.alchemy.com/v2/${key}`;
2429
+ case base.id:
2430
+ return `base-mainnet.g.alchemy.com/v2/${key}`;
2431
+ case baseSepolia.id:
2432
+ return `base-sepolia.g.alchemy.com/v2/${key}`;
2433
+ case optimism.id:
2434
+ return `opt-mainnet.g.alchemy.com/v2/${key}`;
2435
+ case optimismSepolia.id:
2436
+ return `opt-sepolia.g.alchemy.com/v2/${key}`;
2437
+ case linea.id:
2438
+ return `linea-mainnet.g.alchemy.com/v2/${key}`;
2439
+ case lineaSepolia.id:
2440
+ return `linea-sepolia.g.alchemy.com/v2/${key}`;
2441
+ case scroll.id:
2442
+ return `scroll-mainnet.g.alchemy.com/v2/${key}`;
2443
+ case scrollSepolia.id:
2444
+ return `scroll-sepolia.g.alchemy.com/v2/${key}`;
2445
+ default:
2446
+ return void 0;
2447
+ }
2448
+ }
2449
+ function buildDRPCUrl(chainId, key) {
2450
+ switch (chainId) {
2451
+ case mainnet.id:
2452
+ return `https://lb.drpc.live/ethereum/${key}`;
2453
+ case sepolia.id:
2454
+ return `https://lb.drpc.live/ethereum-sepolia/${key}`;
2455
+ case arbitrum.id:
2456
+ return `https://lb.drpc.live/arbitrum/${key}`;
2457
+ case arbitrumSepolia.id:
2458
+ return `https://lb.drpc.live/arbitrum-sepolia/${key}`;
2459
+ case base.id:
2460
+ return `https://lb.drpc.live/base/${key}`;
2461
+ case baseSepolia.id:
2462
+ return `https://lb.drpc.live/base-sepolia/${key}`;
2463
+ case optimism.id:
2464
+ return `https://lb.drpc.live/optimism/${key}`;
2465
+ case optimismSepolia.id:
2466
+ return `https://lb.drpc.live/optimism-sepolia/${key}`;
2467
+ case linea.id:
2468
+ return `https://lb.drpc.live/linea/${key}`;
2469
+ case lineaSepolia.id:
2470
+ return `https://lb.drpc.live/linea-sepolia/${key}`;
2471
+ case scroll.id:
2472
+ return `https://lb.drpc.live/scroll/${key}`;
2473
+ case scrollSepolia.id:
2474
+ return `https://lb.drpc.live/scroll-sepolia/${key}`;
2475
+ default:
2476
+ return void 0;
2477
+ }
2478
+ }
2479
+ function buildQuickNodeURL(chainId, apiKey, endpointName) {
2480
+ switch (chainId) {
2481
+ case mainnet.id:
2482
+ return `${endpointName}.quiknode.pro/${apiKey}`;
2483
+ case sepolia.id:
2484
+ return `${endpointName}.ethereum-sepolia.quiknode.pro/${apiKey}`;
2485
+ case arbitrum.id:
2486
+ return `${endpointName}.arbitrum-mainnet.quiknode.pro/${apiKey}`;
2487
+ case arbitrumSepolia.id:
2488
+ return `${endpointName}.arbitrum-sepolia.quiknode.pro/${apiKey}`;
2489
+ case base.id:
2490
+ return `${endpointName}.base-mainnet.quiknode.pro/${apiKey}`;
2491
+ case baseSepolia.id:
2492
+ return `${endpointName}.base-sepolia.quiknode.pro/${apiKey}`;
2493
+ case optimism.id:
2494
+ return `${endpointName}.optimism.quiknode.pro/${apiKey}`;
2495
+ case optimismSepolia.id:
2496
+ return `${endpointName}.optimism-sepolia.quiknode.pro/${apiKey}`;
2497
+ case linea.id:
2498
+ return `${endpointName}.linea-mainnet.quiknode.pro/${apiKey}`;
2499
+ case lineaSepolia.id:
2500
+ return void 0;
2501
+ case scroll.id:
2502
+ return `${endpointName}.scroll-mainnet.quiknode.pro/${apiKey}`;
2503
+ case scrollSepolia.id:
2504
+ return `${endpointName}.scroll-testnet.quiknode.pro/${apiKey}`;
2505
+ default:
2506
+ return void 0;
2507
+ }
2508
+ }
2509
+ function alchemySupportsChain(chainId) {
2510
+ return buildAlchemyBaseUrl(chainId, "") !== void 0;
2511
+ }
2512
+ function dRPCSupportsChain(chainId) {
2513
+ return buildDRPCUrl(chainId, "") !== void 0;
2514
+ }
2515
+ function quickNodeSupportsChain(chainId) {
2516
+ return buildQuickNodeURL(chainId, "", "") !== void 0;
2517
+ }
2518
+
2519
+ // src/shared/config/pretty-printing.ts
2520
+ function configJSONReplacer(key, value) {
2521
+ if (value instanceof URL) return value.href;
2522
+ if (key === "abi") return "(truncated ABI output)";
2523
+ if (value instanceof Map) return Object.fromEntries(value);
2524
+ if (value instanceof Set) return Array.from(value);
2525
+ return value;
2526
+ }
2527
+ var stringifyConfig = (json, options = { pretty: false }) => JSON.stringify(json, configJSONReplacer, options.pretty ? 2 : void 0);
2528
+
2529
+ // src/shared/config/redacting.ts
2530
+ var REDACTED = "*****";
2531
+ function redactUrl(url) {
2532
+ return new URL(`/${REDACTED}`, url.origin);
2533
+ }
2534
+ function redactString(_) {
2535
+ return REDACTED;
2536
+ }
2537
+ function redactRpcConfigs(rpcConfigs) {
2538
+ const redactedRpcConfigs = /* @__PURE__ */ new Map();
2539
+ for (const [chainId, rpcConfig] of rpcConfigs.entries()) {
2540
+ const redactedHttpRPCs = rpcConfig.httpRPCs.map(redactUrl);
2541
+ const redactedWebsocketRPC = rpcConfig.websocketRPC ? redactUrl(rpcConfig.websocketRPC) : void 0;
2542
+ redactedRpcConfigs.set(chainId, {
2543
+ httpRPCs: redactedHttpRPCs,
2544
+ websocketRPC: redactedWebsocketRPC
2545
+ });
2546
+ }
2547
+ return redactedRpcConfigs;
2548
+ }
2549
+
2550
+ // src/shared/config/rpc-configs-from-env.ts
2551
+ import {
2552
+ ensTestEnvChain,
2553
+ getENSNamespace
2554
+ } from "@ensnode/datasources";
2555
+ var RpcAutoGenModes = {
2556
+ /**
2557
+ * Auto-generates only HTTP RPCs for supported chains.
2558
+ */
2559
+ HttpOnly: "http-only",
2560
+ /**
2561
+ * Auto-generates both HTTP and WebSocket RPCs for supported chains.
2562
+ */
2563
+ HttpAndWs: "http-and-ws"
2564
+ };
2565
+ var DEFAULT_RPC_AUTO_GEN_MODE = RpcAutoGenModes.HttpOnly;
2566
+ function buildRpcAutoGenMode(env) {
2567
+ const mode = env.RPC_AUTO_GEN_MODE;
2568
+ if (!mode) {
2569
+ return DEFAULT_RPC_AUTO_GEN_MODE;
2570
+ }
2571
+ if (!Object.values(RpcAutoGenModes).includes(mode)) {
2572
+ throw new Error(
2573
+ `Invalid RPC_AUTO_GEN_MODE env var: ${mode}. Valid values are: ${Object.values(RpcAutoGenModes).join(", ")}`
2574
+ );
2575
+ }
2576
+ return mode;
2577
+ }
2578
+ function buildRpcConfigsFromEnv(env, namespace) {
2579
+ const alchemyApiKey = env.ALCHEMY_API_KEY;
2580
+ const quickNodeApiKey = env.QUICKNODE_API_KEY;
2581
+ const quickNodeEndpointName = env.QUICKNODE_ENDPOINT_NAME;
2582
+ const dRPCKey = env.DRPC_API_KEY;
2583
+ if (quickNodeApiKey && !quickNodeEndpointName) {
2584
+ throw new Error(
2585
+ "Use of the QUICKNODE_API_KEY environment variable requires use of the QUICKNODE_ENDPOINT_NAME environment variable as well."
2586
+ );
2587
+ }
2588
+ if (quickNodeEndpointName && !quickNodeApiKey) {
2589
+ throw new Error(
2590
+ "Use of the QUICKNODE_ENDPOINT_NAME environment variable requires use of the QUICKNODE_API_KEY environment variable as well."
2591
+ );
2592
+ }
2593
+ const chainsInNamespace = Object.entries(getENSNamespace(namespace)).map(
2594
+ ([, datasource]) => datasource.chain
2595
+ );
2596
+ const rpcAutoGenMode = buildRpcAutoGenMode(env);
2597
+ const rpcConfigs = {};
2598
+ for (const chain of chainsInNamespace) {
2599
+ const specificValue = env[`RPC_URL_${chain.id}`];
2600
+ if (specificValue) {
2601
+ rpcConfigs[serializeChainId(chain.id)] = specificValue;
2602
+ continue;
2603
+ }
2604
+ if (chain.id === ensTestEnvChain.id) {
2605
+ rpcConfigs[serializeChainId(ensTestEnvChain.id)] = ensTestEnvChain.rpcUrls.default.http[0];
2606
+ continue;
2607
+ }
2608
+ const httpUrls = [
2609
+ // alchemy, if specified and available
2610
+ alchemyApiKey && alchemySupportsChain(chain.id) && `https://${buildAlchemyBaseUrl(chain.id, alchemyApiKey)}`,
2611
+ // QuickNode, if specified and available
2612
+ quickNodeApiKey && quickNodeEndpointName && quickNodeSupportsChain(chain.id) && `https://${buildQuickNodeURL(chain.id, quickNodeApiKey, quickNodeEndpointName)}`,
2613
+ // dRPC, if specified and available
2614
+ dRPCKey && dRPCSupportsChain(chain.id) && buildDRPCUrl(chain.id, dRPCKey)
2615
+ ];
2616
+ const wsUrl = rpcAutoGenMode === RpcAutoGenModes.HttpAndWs && alchemyApiKey && alchemySupportsChain(chain.id) && //
2617
+ `wss://${buildAlchemyBaseUrl(chain.id, alchemyApiKey)}`;
2618
+ const urls = [...httpUrls, wsUrl].filter(Boolean);
2619
+ if (urls.length > 0) {
2620
+ rpcConfigs[serializeChainId(chain.id)] = urls.join(
2621
+ ","
2622
+ );
2623
+ }
2624
+ }
2625
+ return rpcConfigs;
2626
+ }
2627
+
2628
+ // src/shared/config/validatons.ts
2629
+ import { getENSRootChainId as getENSRootChainId2 } from "@ensnode/datasources";
2630
+
2631
+ // src/shared/url.ts
2632
+ function isHttpProtocol(url) {
2633
+ return ["http:", "https:"].includes(url.protocol);
2634
+ }
2635
+ function isWebSocketProtocol(url) {
2636
+ return ["ws:", "wss:"].includes(url.protocol);
2637
+ }
2638
+
2639
+ // src/shared/config/validatons.ts
2640
+ function invariant_rpcEndpointConfigIncludesAtLeastOneHTTPProtocolURL(ctx) {
2641
+ const endpoints = ctx.value;
2642
+ const httpEndpoints = endpoints.filter(isHttpProtocol);
2643
+ if (httpEndpoints.length < 1) {
2644
+ ctx.issues.push({
2645
+ code: "custom",
2646
+ input: endpoints,
2647
+ message: `RPC endpoint configuration for a chain must include at least one http/https protocol URL.`
2648
+ });
2649
+ }
2650
+ }
2651
+ function invariant_rpcEndpointConfigIncludesAtMostOneWebSocketsProtocolURL(ctx) {
2652
+ const endpoints = ctx.value;
2653
+ const wsEndpoints = endpoints.filter(isWebSocketProtocol);
2654
+ if (wsEndpoints.length > 1) {
2655
+ ctx.issues.push({
2656
+ code: "custom",
2657
+ input: endpoints,
2658
+ message: `RPC endpoint configuration for a chain must include at most one websocket (ws/wss) protocol URL.`
2659
+ });
2660
+ }
2661
+ }
2662
+ function invariant_rpcConfigsSpecifiedForRootChain(ctx) {
2663
+ const { value: config } = ctx;
2664
+ const ensRootChainId = getENSRootChainId2(config.namespace);
2665
+ if (!config.rpcConfigs.has(ensRootChainId)) {
2666
+ ctx.issues.push({
2667
+ code: "custom",
2668
+ input: config,
2669
+ message: `An RPC Config for the ENS Root Chain ('${ensRootChainId}') is required, but none was specified.`
2670
+ });
2671
+ }
2672
+ }
2673
+
2674
+ // src/shared/config/zod-schemas.ts
2675
+ import { z as z22 } from "zod/v4";
2676
+ import { ENSNamespaceIds as ENSNamespaceIds4 } from "@ensnode/datasources";
2677
+
2678
+ // src/shared/deserialize.ts
2679
+ import z21, { prettifyError as prettifyError2 } from "zod/v4";
2680
+ function deserializeChainId(maybeChainId, valueLabel) {
2681
+ const schema = makeChainIdStringSchema(valueLabel);
2682
+ const parsed = schema.safeParse(maybeChainId);
2683
+ if (parsed.error) {
2684
+ throw new Error(`Cannot deserialize ChainId:
2685
+ ${prettifyError2(parsed.error)}
2686
+ `);
2687
+ }
2688
+ return parsed.data;
2689
+ }
2690
+
2691
+ // src/shared/config/zod-schemas.ts
2692
+ var RpcConfigSchema = z22.string().transform((val) => val.split(",")).pipe(z22.array(makeUrlSchema("RPC URL"))).check(invariant_rpcEndpointConfigIncludesAtLeastOneHTTPProtocolURL).check(invariant_rpcEndpointConfigIncludesAtMostOneWebSocketsProtocolURL);
2693
+ var RpcConfigsSchema = z22.record(makeChainIdStringSchema("RPC URL"), RpcConfigSchema, {
2694
+ error: "Chains configuration must be an object mapping valid chain IDs to their configs."
2695
+ }).transform((records) => {
2696
+ const rpcConfigs = /* @__PURE__ */ new Map();
2697
+ for (const [chainIdString, rpcConfig] of Object.entries(records)) {
2698
+ const httpRPCs = rpcConfig.filter(isHttpProtocol);
2699
+ const websocketRPC = rpcConfig.find(isWebSocketProtocol);
2700
+ rpcConfigs.set(deserializeChainId(chainIdString), {
2701
+ httpRPCs,
2702
+ websocketRPC
2703
+ });
2704
+ }
2705
+ return rpcConfigs;
2706
+ });
2707
+ var ENSNamespaceSchema = z22.enum(ENSNamespaceIds4, {
2708
+ error: ({ input }) => `Invalid NAMESPACE. Got '${input}', but supported ENS namespaces are: ${Object.keys(ENSNamespaceIds4).join(", ")}`
2709
+ });
2710
+ var PortNumberSchema = z22.coerce.number({ error: "PORT must be a number." }).int({ error: "PORT must be an integer." }).min(1, { error: "PORT must be greater than or equal to 1." }).max(65535, { error: "PORT must be less than or equal to 65535." });
2711
+ var OptionalPortNumberSchema = PortNumberSchema.optional();
2712
+ var TheGraphApiKeySchema = z22.string().optional();
2713
+
2714
+ // src/shared/config-templates.ts
2715
+ import { ENSNamespaceIds as ENSNamespaceIds5 } from "@ensnode/datasources";
2716
+ var ConfigTemplateIds = {
2717
+ Mainnet: "mainnet",
2718
+ Sepolia: "sepolia",
2719
+ Alpha: "alpha",
2720
+ AlphaSepolia: "alpha-sepolia"
2721
+ };
2722
+ function isConfigTemplateSubgraphCompatible(configTemplateId) {
2723
+ switch (configTemplateId) {
2724
+ // these ConfigTemplates are run with SUBGRAPH_COMPAT, meaning they are Subgraph Compatible
2725
+ case ConfigTemplateIds.Mainnet:
2726
+ case ConfigTemplateIds.Sepolia:
2727
+ return true;
2728
+ // these instances are NOT run with SUBGRAPH_COMPAT, meaning they are NOT Subgraph Compatible
2729
+ case ConfigTemplateIds.Alpha:
2730
+ case ConfigTemplateIds.AlphaSepolia:
2731
+ return false;
2732
+ default:
2733
+ throw new Error("never");
2734
+ }
2735
+ }
2736
+ function namespaceForConfigTemplateId(configTemplateId) {
2737
+ switch (configTemplateId) {
2738
+ case ConfigTemplateIds.Alpha:
2739
+ case ConfigTemplateIds.Mainnet:
2740
+ return ENSNamespaceIds5.Mainnet;
2741
+ case ConfigTemplateIds.AlphaSepolia:
2742
+ case ConfigTemplateIds.Sepolia:
2743
+ return ENSNamespaceIds5.Sepolia;
2744
+ default:
2745
+ throw new Error("never");
2746
+ }
2747
+ }
2748
+
2749
+ // src/shared/datasources-with-ensv2-contracts.ts
2750
+ import {
2751
+ DatasourceNames as DatasourceNames3,
2752
+ maybeGetDatasource as maybeGetDatasource2
2753
+ } from "@ensnode/datasources";
2754
+ var DATASOURCE_NAMES_WITH_ENSv2_CONTRACTS = [
2755
+ DatasourceNames3.ENSv2Root
2756
+ ];
2757
+ var getDatasourcesWithENSv2Contracts = (namespace) => DATASOURCE_NAMES_WITH_ENSv2_CONTRACTS.map(
2758
+ (datasourceName) => maybeGetDatasource2(namespace, datasourceName)
2759
+ ).filter((datasource) => !!datasource).map((datasource) => {
2760
+ if (!datasource.contracts.Registry || !datasource.contracts.EnhancedAccessControl) {
2761
+ throw new Error(
2762
+ `Invariant: Datasource does not define 'Registry' and 'EnhancedAccessControl' contracts. Defined contracts: ${JSON.stringify(Object.keys(datasource.contracts))}`
2763
+ );
2764
+ }
2765
+ return datasource;
2766
+ });
2767
+
2768
+ // src/shared/datasources-with-resolvers.ts
2769
+ import {
2770
+ DatasourceNames as DatasourceNames4,
2771
+ maybeGetDatasource as maybeGetDatasource3
2772
+ } from "@ensnode/datasources";
2773
+ var DATASOURCE_NAMES_WITH_RESOLVERS = [
2774
+ DatasourceNames4.ENSRoot,
2775
+ DatasourceNames4.Basenames,
2776
+ DatasourceNames4.Lineanames,
2777
+ DatasourceNames4.ThreeDNSOptimism,
2778
+ DatasourceNames4.ThreeDNSBase,
2779
+ // all datasources that define ENSv2 contracts also define Resolver
2780
+ ...DATASOURCE_NAMES_WITH_ENSv2_CONTRACTS
2781
+ ];
2782
+ var getDatasourcesWithResolvers = (namespace) => DATASOURCE_NAMES_WITH_RESOLVERS.map(
2783
+ (datasourceName) => maybeGetDatasource3(namespace, datasourceName)
2784
+ ).filter((datasource) => !!datasource).map((datasource) => {
2785
+ if (!datasource.contracts.Resolver) {
2786
+ throw new Error(
2787
+ `Invariant: Datasource does not define a 'Resolver' contract. Defined contracts: ${JSON.stringify(Object.keys(datasource.contracts))}`
2788
+ );
2789
+ }
2790
+ return datasource;
2791
+ });
2792
+
2793
+ // src/shared/interpretation/interpret-address.ts
2794
+ import { isAddressEqual as isAddressEqual4, zeroAddress as zeroAddress5 } from "viem";
2795
+ var interpretAddress = (owner) => isAddressEqual4(zeroAddress5, owner) ? null : owner;
2796
+
2797
+ // src/shared/interpretation/interpret-record-values.ts
2798
+ import { isInterpretedName, toNormalizedAddress as toNormalizedAddress4 } from "enssdk";
2799
+ import { isAddress as isAddress2, isAddressEqual as isAddressEqual5, zeroAddress as zeroAddress6 } from "viem";
2800
+
2801
+ // src/shared/null-bytes.ts
2802
+ var hasNullByte = (value) => value.indexOf("\0") !== -1;
2803
+
2804
+ // src/shared/interpretation/interpret-record-values.ts
2805
+ function interpretNameRecordValue(value) {
2806
+ if (value === "") return null;
2807
+ if (!isInterpretedName(value)) return null;
2808
+ return value;
2809
+ }
2810
+ function interpretAddressRecordValue(value) {
2811
+ if (hasNullByte(value)) return null;
2812
+ if (value === "") return null;
2813
+ if (value === "0x") return null;
2814
+ if (!isAddress2(value, { strict: false })) return value;
2815
+ if (isAddressEqual5(value, zeroAddress6)) return null;
2816
+ return toNormalizedAddress4(value);
2817
+ }
2818
+ function interpretTextRecordKey(key) {
2819
+ if (hasNullByte(key)) return null;
2820
+ if (key === "") return null;
2821
+ return key;
2822
+ }
2823
+ function interpretTextRecordValue(value) {
2824
+ if (hasNullByte(value)) return null;
2825
+ if (value === "") return null;
2826
+ return value;
2827
+ }
2828
+
2829
+ // src/shared/interpretation/interpret-resolver-values.ts
2830
+ import { size as size3, zeroHash } from "viem";
2831
+ function interpretContenthashValue(value) {
2832
+ if (size3(value) === 0) return null;
2833
+ return value;
2834
+ }
2835
+ function interpretPubkeyValue(x, y) {
2836
+ if (x === zeroHash && y === zeroHash) return null;
2837
+ return { x, y };
2838
+ }
2839
+ function interpretDnszonehashValue(value) {
2840
+ if (size3(value) === 0) return null;
2841
+ return value;
2842
+ }
2843
+
2844
+ // src/shared/log-level.ts
2845
+ import { z as z23 } from "zod/v4";
2846
+ var LogLevelSchema = z23.enum(["fatal", "error", "warn", "info", "debug", "trace", "silent"]);
2847
+ function getLogLevelFromEnv(env, defaultLogLevel) {
2848
+ try {
2849
+ return LogLevelSchema.default(defaultLogLevel).parse(env.LOG_LEVEL);
2850
+ } catch {
2851
+ console.warn(
2852
+ `Invalid LOG_LEVEL '${env.LOG_LEVEL}', expected one of '${Object.values(LogLevelSchema.enum).join("' | '")}' defaulting to '${defaultLogLevel}'`
2853
+ );
2854
+ return defaultLogLevel;
2855
+ }
2856
+ }
2857
+
2858
+ // src/shared/protocol-acceleration/is-bridged-resolver.ts
2859
+ import {
2860
+ makeENSv1DomainId,
2861
+ makeENSv1VirtualRegistryId
2862
+ } from "enssdk";
2863
+ import { DatasourceNames as DatasourceNames7, maybeGetDatasource as maybeGetDatasource4 } from "@ensnode/datasources";
2864
+
2865
+ // src/shared/managed-names.ts
2866
+ import {
2867
+ asInterpretedName as asInterpretedName2,
2868
+ ENS_ROOT_NAME,
2869
+ namehashInterpretedName as namehashInterpretedName3,
2870
+ stringifyAccountId
2871
+ } from "enssdk";
2872
+ import { DatasourceNames as DatasourceNames5 } from "@ensnode/datasources";
2873
+
2874
+ // src/shared/to-json.ts
2875
+ var toJson = (value, options) => JSON.stringify(
2876
+ value,
2877
+ (_key, val) => typeof val === "bigint" ? String(val) : val,
2878
+ options?.pretty ? 2 : void 0
2879
+ );
2880
+
2881
+ // src/shared/managed-names.ts
2882
+ var MANAGED_NAME_BY_NAMESPACE = {
2883
+ sepolia: {
2884
+ "base.eth": "basetest.eth",
2885
+ "linea.eth": "linea-sepolia.eth"
2886
+ }
2887
+ };
2888
+ var getContractsByManagedName = (namespace) => {
2889
+ const ensRootRegistry = getDatasourceContract(
2890
+ namespace,
2891
+ DatasourceNames5.ENSRoot,
2892
+ "ENSv1Registry"
2893
+ );
2894
+ const ensRootRegistryOld = getDatasourceContract(
2895
+ namespace,
2896
+ DatasourceNames5.ENSRoot,
2897
+ "ENSv1RegistryOld"
2898
+ );
2899
+ const ethnamesNameWrapper = getDatasourceContract(
2900
+ namespace,
2901
+ DatasourceNames5.ENSRoot,
2902
+ "NameWrapper"
2903
+ );
2904
+ const basenamesRegistry = maybeGetDatasourceContract(
2905
+ namespace,
2906
+ DatasourceNames5.Basenames,
2907
+ "Registry"
2908
+ );
2909
+ const lineanamesRegistry = maybeGetDatasourceContract(
2910
+ namespace,
2911
+ DatasourceNames5.Lineanames,
2912
+ "Registry"
2913
+ );
2914
+ const lineanamesNameWrapper = maybeGetDatasourceContract(
2915
+ namespace,
2916
+ DatasourceNames5.Lineanames,
2917
+ "NameWrapper"
2918
+ );
2919
+ return {
2920
+ [ENS_ROOT_NAME]: {
2921
+ registry: ensRootRegistry,
2922
+ contracts: [ensRootRegistry, ensRootRegistryOld]
2923
+ },
2924
+ eth: {
2925
+ registry: ensRootRegistry,
2926
+ contracts: [
2927
+ getDatasourceContract(namespace, DatasourceNames5.ENSRoot, "BaseRegistrar"),
2928
+ getDatasourceContract(
2929
+ namespace,
2930
+ DatasourceNames5.ENSRoot,
2931
+ "UnwrappedEthRegistrarController"
2932
+ ),
2933
+ maybeGetDatasourceContract(
2934
+ namespace,
2935
+ DatasourceNames5.ENSRoot,
2936
+ "LegacyEthRegistrarController"
2937
+ ),
2938
+ maybeGetDatasourceContract(
2939
+ namespace,
2940
+ DatasourceNames5.ENSRoot,
2941
+ "WrappedEthRegistrarController"
2942
+ ),
2943
+ maybeGetDatasourceContract(
2944
+ namespace,
2945
+ DatasourceNames5.ENSRoot,
2946
+ "UniversalRegistrarRenewalWithReferrer"
2947
+ ),
2948
+ ethnamesNameWrapper
2949
+ ].filter((c) => !!c)
2950
+ },
2951
+ ...basenamesRegistry && {
2952
+ "base.eth": {
2953
+ registry: basenamesRegistry,
2954
+ contracts: [
2955
+ basenamesRegistry,
2956
+ maybeGetDatasourceContract(namespace, DatasourceNames5.Basenames, "BaseRegistrar"),
2957
+ maybeGetDatasourceContract(namespace, DatasourceNames5.Basenames, "EARegistrarController"),
2958
+ maybeGetDatasourceContract(namespace, DatasourceNames5.Basenames, "RegistrarController"),
2959
+ maybeGetDatasourceContract(
2960
+ namespace,
2961
+ DatasourceNames5.Basenames,
2962
+ "UpgradeableRegistrarController"
2963
+ )
2964
+ ].filter((c) => !!c)
2965
+ }
2966
+ },
2967
+ ...lineanamesRegistry && {
2968
+ "linea.eth": {
2969
+ registry: lineanamesRegistry,
2970
+ contracts: [
2971
+ lineanamesRegistry,
2972
+ maybeGetDatasourceContract(namespace, DatasourceNames5.Lineanames, "BaseRegistrar"),
2973
+ maybeGetDatasourceContract(
2974
+ namespace,
2975
+ DatasourceNames5.Lineanames,
2976
+ "EthRegistrarController"
2977
+ ),
2978
+ lineanamesNameWrapper
2979
+ ].filter((c) => !!c)
2980
+ }
2981
+ }
2982
+ };
2983
+ };
2984
+ var cache = /* @__PURE__ */ new Map();
2985
+ var getManagedName = (namespace, contract) => {
2986
+ const cacheKey = `${namespace}:${stringifyAccountId(contract)}`;
2987
+ const cached = cache.get(cacheKey);
2988
+ if (cached !== void 0) return cached;
2989
+ for (const [managedName, group] of Object.entries(getContractsByManagedName(namespace))) {
2990
+ const isAnyOfTheContracts = group.contracts.some(
2991
+ (_contract) => accountIdEqual(_contract, contract)
2992
+ );
2993
+ if (isAnyOfTheContracts) {
2994
+ const namespaceSpecific = MANAGED_NAME_BY_NAMESPACE[namespace]?.[managedName];
2995
+ const name = asInterpretedName2(namespaceSpecific ?? managedName);
2996
+ const node = namehashInterpretedName3(name);
2997
+ const result = { name, node, registry: group.registry };
2998
+ cache.set(cacheKey, result);
2999
+ return result;
3000
+ }
3001
+ }
3002
+ throw new Error(
3003
+ `The following contract ${toJson(contract, { pretty: true })} does not have a configured Managed Name in namespace '${namespace}'.`
3004
+ );
3005
+ };
3006
+
3007
+ // src/shared/root-registry.ts
3008
+ import { makeENSv1RegistryId, makeENSv2RegistryId } from "enssdk";
3009
+ import { DatasourceNames as DatasourceNames6 } from "@ensnode/datasources";
3010
+ var getENSv1RootRegistry = (namespace) => getDatasourceContract(namespace, DatasourceNames6.ENSRoot, "ENSv1Registry");
3011
+
3012
+ // src/shared/protocol-acceleration/is-bridged-resolver.ts
3013
+ var cache2 = /* @__PURE__ */ new Map();
3014
+ var getBridgedResolverConfigs = (namespace) => {
3015
+ const cached = cache2.get(namespace);
3016
+ if (cached) return cached;
3017
+ const configs = [];
3018
+ const basenames = maybeGetDatasource4(namespace, DatasourceNames7.Basenames);
3019
+ if (basenames) {
3020
+ const resolver = getDatasourceContract(
3021
+ namespace,
3022
+ DatasourceNames7.ENSRoot,
3023
+ "BasenamesL1Resolver"
3024
+ );
3025
+ const registry = getDatasourceContract(namespace, DatasourceNames7.Basenames, "Registry");
3026
+ const { node } = getManagedName(namespace, registry);
3027
+ configs.push({
3028
+ resolver,
3029
+ originDomainId: makeENSv1DomainId(getENSv1RootRegistry(namespace), node),
3030
+ targetRegistry: registry,
3031
+ targetRegistryId: makeENSv1VirtualRegistryId(registry, node)
3032
+ });
3033
+ }
3034
+ const lineanames = maybeGetDatasource4(namespace, DatasourceNames7.Lineanames);
3035
+ if (lineanames) {
3036
+ const resolver = getDatasourceContract(
3037
+ namespace,
3038
+ DatasourceNames7.ENSRoot,
3039
+ "LineanamesL1Resolver"
3040
+ );
3041
+ const registry = getDatasourceContract(namespace, DatasourceNames7.Lineanames, "Registry");
3042
+ const { node } = getManagedName(namespace, registry);
3043
+ configs.push({
3044
+ resolver,
3045
+ originDomainId: makeENSv1DomainId(getENSv1RootRegistry(namespace), node),
3046
+ targetRegistry: registry,
3047
+ targetRegistryId: makeENSv1VirtualRegistryId(registry, node)
3048
+ });
3049
+ }
3050
+ cache2.set(namespace, configs);
3051
+ return configs;
3052
+ };
3053
+ function isBridgedResolver(namespace, resolver) {
3054
+ return getBridgedResolverConfigs(namespace).find(
3055
+ (config) => accountIdEqual(config.resolver, resolver)
3056
+ ) ?? null;
3057
+ }
3058
+
3059
+ // src/shared/protocol-acceleration/is-ensip-19-reverse-resolver.ts
3060
+ import { DatasourceNames as DatasourceNames8 } from "@ensnode/datasources";
3061
+ function isKnownENSIP19ReverseResolver(namespace, resolver) {
3062
+ const resolverEq = makeContractMatcher(namespace, resolver);
3063
+ return [
3064
+ // DefaultReverseResolver (default.reverse)
3065
+ resolverEq(DatasourceNames8.ReverseResolverRoot, "DefaultReverseResolver3"),
3066
+ // the following are each ChainReverseResolver ([coinType].reverse)
3067
+ resolverEq(DatasourceNames8.ReverseResolverRoot, "BaseReverseResolver"),
3068
+ resolverEq(DatasourceNames8.ReverseResolverRoot, "LineaReverseResolver"),
3069
+ resolverEq(DatasourceNames8.ReverseResolverRoot, "OptimismReverseResolver"),
3070
+ resolverEq(DatasourceNames8.ReverseResolverRoot, "ArbitrumReverseResolver"),
3071
+ resolverEq(DatasourceNames8.ReverseResolverRoot, "ScrollReverseResolver")
3072
+ ].some(Boolean);
3073
+ }
3074
+
3075
+ // src/shared/protocol-acceleration/is-static-resolver.ts
3076
+ import { DatasourceNames as DatasourceNames9 } from "@ensnode/datasources";
3077
+ function isStaticResolver(namespace, resolver) {
3078
+ const resolverEq = makeContractMatcher(namespace, resolver);
3079
+ return [
3080
+ // ENS Root Chain
3081
+ resolverEq(DatasourceNames9.ReverseResolverRoot, "DefaultPublicResolver0"),
3082
+ resolverEq(DatasourceNames9.ReverseResolverRoot, "DefaultPublicResolver1"),
3083
+ resolverEq(DatasourceNames9.ReverseResolverRoot, "DefaultPublicResolver2"),
3084
+ resolverEq(DatasourceNames9.ReverseResolverRoot, "DefaultPublicResolver3"),
3085
+ resolverEq(DatasourceNames9.ReverseResolverRoot, "DefaultPublicResolver4"),
3086
+ resolverEq(DatasourceNames9.ReverseResolverRoot, "DefaultPublicResolver5"),
3087
+ resolverEq(DatasourceNames9.ENSRoot, "ArgentResolver"),
3088
+ resolverEq(DatasourceNames9.ENSRoot, "LoopringResolver"),
3089
+ // Basenames
3090
+ resolverEq(DatasourceNames9.Basenames, "L2Resolver1"),
3091
+ resolverEq(DatasourceNames9.Basenames, "L2Resolver2"),
3092
+ // Lineanames
3093
+ resolverEq(DatasourceNames9.Lineanames, "DefaultPublicResolver"),
3094
+ // ThreeDNS
3095
+ resolverEq(DatasourceNames9.ThreeDNSBase, "Resolver"),
3096
+ resolverEq(DatasourceNames9.ThreeDNSOptimism, "Resolver")
3097
+ ].some(Boolean);
3098
+ }
3099
+ function staticResolverImplementsAddressRecordDefaulting(namespace, resolver) {
3100
+ const resolverEq = makeContractMatcher(namespace, resolver);
3101
+ return [
3102
+ // ENS Root Chain
3103
+ resolverEq(DatasourceNames9.ReverseResolverRoot, "DefaultPublicResolver5"),
3104
+ // Base Chain
3105
+ resolverEq(DatasourceNames9.Basenames, "L2Resolver2")
3106
+ ].some(Boolean);
3107
+ }
3108
+
3109
+ // src/shared/thegraph.ts
3110
+ import { ENSNamespaceIds as ENSNamespaceIds6 } from "@ensnode/datasources";
3111
+ var canFallbackToTheGraph = ({
3112
+ namespace,
3113
+ theGraphApiKey,
3114
+ isSubgraphCompatible: isSubgraphCompatible2
3115
+ }) => {
3116
+ if (!isSubgraphCompatible2) return { canFallback: false, reason: "not-subgraph-compatible" };
3117
+ const hasApiKey = theGraphApiKey !== void 0;
3118
+ if (!hasApiKey) return { canFallback: false, reason: "no-api-key" };
3119
+ const url = makeTheGraphSubgraphUrl(namespace, theGraphApiKey);
3120
+ if (url === null) return { canFallback: false, reason: "no-subgraph-url" };
3121
+ return { canFallback: true, url };
3122
+ };
3123
+ var makeTheGraphSubgraphUrl = (namespace, apiKey) => {
3124
+ switch (namespace) {
3125
+ case ENSNamespaceIds6.Mainnet:
3126
+ return `https://gateway.thegraph.com/api/${apiKey}/subgraphs/id/5XqPmWe6gjyrJtFn9cLy237i4cWw2j9HcUJEXsP5qGtH`;
3127
+ case ENSNamespaceIds6.Sepolia:
3128
+ return `https://gateway.thegraph.com/api/${apiKey}/subgraphs/id/G1SxZs317YUb9nQX3CC98hDyvxfMJNZH5pPRGpNrtvwN`;
3129
+ case ENSNamespaceIds6.SepoliaV2:
3130
+ case ENSNamespaceIds6.EnsTestEnv:
3131
+ return null;
3132
+ default:
3133
+ throw new Error("never");
3134
+ }
3135
+ };
3136
+ export {
3137
+ ConfigTemplateIds,
3138
+ DATASOURCE_NAMES_WITH_ENSv2_CONTRACTS,
3139
+ DATASOURCE_NAMES_WITH_RESOLVERS,
3140
+ ENSNamespaceSchema,
3141
+ GRAPHQL_API_EXAMPLE_QUERIES,
3142
+ OptionalPortNumberSchema,
3143
+ PortNumberSchema,
3144
+ RpcConfigsSchema,
3145
+ TheGraphApiKeySchema,
3146
+ TheGraphCannotFallbackReasonSchema,
3147
+ TheGraphFallbackSchema,
3148
+ alchemySupportsChain,
3149
+ buildAlchemyBaseUrl,
3150
+ buildDRPCUrl,
3151
+ buildQuickNodeURL,
3152
+ buildRpcAutoGenMode,
3153
+ buildRpcConfigsFromEnv,
3154
+ canFallbackToTheGraph,
3155
+ dRPCSupportsChain,
3156
+ errorResponseBadRequestExample,
3157
+ errorResponseInternalServerErrorExample,
3158
+ errorResponseInvalidAddressExample,
3159
+ errorResponseInvalidNameExample,
3160
+ getDatasourcesWithENSv2Contracts,
3161
+ getDatasourcesWithResolvers,
3162
+ getGraphqlApiExampleQueryById,
3163
+ getLogLevelFromEnv,
3164
+ interpretAddress,
3165
+ interpretAddressRecordValue,
3166
+ interpretContenthashValue,
3167
+ interpretDnszonehashValue,
3168
+ interpretNameRecordValue,
3169
+ interpretPubkeyValue,
3170
+ interpretTextRecordKey,
3171
+ interpretTextRecordValue,
3172
+ invariant_ensRainbowSupportedLabelSetAndVersion,
3173
+ invariant_isSubgraphCompatibleRequirements,
3174
+ invariant_rpcConfigsSpecifiedForRootChain,
3175
+ invariant_rpcEndpointConfigIncludesAtLeastOneHTTPProtocolURL,
3176
+ invariant_rpcEndpointConfigIncludesAtMostOneWebSocketsProtocolURL,
3177
+ isBridgedResolver,
3178
+ isConfigTemplateSubgraphCompatible,
3179
+ isExtendedResolver,
3180
+ isKnownENSIP19ReverseResolver,
3181
+ isStaticResolver,
3182
+ makeAccountIdSchema,
3183
+ makeAccountIdStringSchema,
3184
+ makeAssetIdSchema,
3185
+ makeAssetIdStringSchema,
3186
+ makeBaseRegistrarActionSchema,
3187
+ makeBlockNumberSchema,
3188
+ makeBlockRefSchema,
3189
+ makeBooleanStringSchema,
3190
+ makeChainIdSchema,
3191
+ makeChainIdStringSchema,
3192
+ makeCoinTypeSchema,
3193
+ makeCoinTypeStringSchema,
3194
+ makeCommaSeparatedList,
3195
+ makeDatetimeSchema,
3196
+ makeDefaultableChainIdSchema,
3197
+ makeDefaultableChainIdStringSchema,
3198
+ makeDomainAssetSchema,
3199
+ makeDurationSchema,
3200
+ makeENSApiPublicConfigSchema,
3201
+ makeENSIndexerPublicConfigSchema,
3202
+ makeENSIndexerVersionInfoSchema,
3203
+ makeENSNamespaceIdSchema,
3204
+ makeEnsApiIndexingStatusResponseErrorSchema,
3205
+ makeEnsApiIndexingStatusResponseOkSchema,
3206
+ makeEnsApiIndexingStatusResponseSchema,
3207
+ makeEnsApiPublicConfigSchema,
3208
+ makeEnsIndexerPublicConfigSchema,
3209
+ makeEnsIndexerSchemaNameSchema,
3210
+ makeEnsIndexerVersionInfoSchema,
3211
+ makeErrorResponseSchema,
3212
+ makeFiniteNonNegativeNumberSchema,
3213
+ makeFullyPinnedLabelSetSchema,
3214
+ makeHexStringSchema,
3215
+ makeIndexedChainIdsSchema,
3216
+ makeIndexingStatusResponseSchema,
3217
+ makeIntegerSchema,
3218
+ makeNameTokenOwnershipBurnedSchema,
3219
+ makeNameTokenOwnershipFullyOnchainSchema,
3220
+ makeNameTokenOwnershipNameWrapperSchema,
3221
+ makeNameTokenOwnershipSchema,
3222
+ makeNameTokenOwnershipUnknownSchema,
3223
+ makeNameTokenSchema,
3224
+ makeNameTokensResponseErrorEnsIndexerConfigUnsupported,
3225
+ makeNameTokensResponseErrorNameIndexingStatusUnsupported,
3226
+ makeNameTokensResponseErrorNameTokensNotIndexedSchema,
3227
+ makeNameTokensResponseErrorSchema,
3228
+ makeNameTokensResponseOkSchema,
3229
+ makeNameTokensResponseSchema,
3230
+ makeNamedRegistrarActionSchema,
3231
+ makeNodeSchema,
3232
+ makeNonNegativeIntegerSchema,
3233
+ makeNormalizedAddressSchema,
3234
+ makePluginsListSchema,
3235
+ makePositiveIntegerSchema,
3236
+ makePriceCurrencySchema,
3237
+ makePriceDaiSchema,
3238
+ makePriceEnsTokensSchema,
3239
+ makePriceEthSchema,
3240
+ makePriceSchema,
3241
+ makePriceUsdcSchema,
3242
+ makeRegisteredNameTokenSchema,
3243
+ makeRegistrarActionRegistrationSchema,
3244
+ makeRegistrarActionRenewalSchema,
3245
+ makeRegistrarActionSchema,
3246
+ makeRegistrarActionsResponseErrorSchema,
3247
+ makeRegistrarActionsResponseOkSchema,
3248
+ makeRegistrarActionsResponseSchema,
3249
+ makeRegistrationLifecycleSchema,
3250
+ makeReinterpretedNameSchema,
3251
+ makeRequestPageParamsSchema,
3252
+ makeResolvePrimaryNameResponseSchema,
3253
+ makeResolvePrimaryNamesResponseSchema,
3254
+ makeResolveRecordsResponseSchema,
3255
+ makeResponsePageContextSchema,
3256
+ makeResponsePageContextSchemaWithNoRecords,
3257
+ makeResponsePageContextSchemaWithRecords,
3258
+ makeSerializedEnsApiIndexingStatusResponseOkSchema,
3259
+ makeSerializedEnsApiIndexingStatusResponseSchema,
3260
+ makeSerializedEnsApiPublicConfigSchema,
3261
+ makeSerializedEnsIndexerPublicConfigSchema,
3262
+ makeSerializedIndexedChainIdsSchema,
3263
+ makeSerializedPriceCurrencySchema,
3264
+ makeSerializedPriceEthSchema,
3265
+ makeSerializedRegistrarActionPricingSchema,
3266
+ makeSerializedRegistrarActionSchema,
3267
+ makeSerializedRegistrarActionsResponseOkSchema,
3268
+ makeSupportsInterfaceReader,
3269
+ makeTokenIdSchema,
3270
+ makeTransactionHashSchema,
3271
+ makeUnixTimestampSchema,
3272
+ makeUrlSchema,
3273
+ nameTokensNotIndexedExample,
3274
+ nameTokensResponseOkExample,
3275
+ nameTokensServiceUnavailableExample,
3276
+ namespaceForConfigTemplateId,
3277
+ quickNodeSupportsChain,
3278
+ realtimeResponseSchemaError,
3279
+ realtimeResponseSchemaOk,
3280
+ redactRpcConfigs,
3281
+ redactString,
3282
+ redactUrl,
3283
+ registrarActionsResponseOkExample,
3284
+ resolvePrimaryNameResponseExample,
3285
+ resolvePrimaryNamesResponseExample,
3286
+ resolveRecordsResponseExample,
3287
+ staticResolverImplementsAddressRecordDefaulting,
3288
+ stringifyConfig
3289
+ };
3290
+ //# sourceMappingURL=internal.js.map