@ensnode/ensnode-sdk 0.0.0-next-20260707183518 → 0.0.0-next-20260708171350

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -287,22 +287,86 @@ var PARENT_CANNOT_CONTROL = 65536;
287
287
  var isPccFuseSet = (fuses) => (fuses & PARENT_CANNOT_CONTROL) === PARENT_CANNOT_CONTROL;
288
288
 
289
289
  // src/ensapi/config/deserialize.ts
290
- var import_v47 = require("zod/v4");
290
+ var import_v43 = require("zod/v4");
291
+
292
+ // src/ensapi/config/zod-schemas.ts
293
+ var import_v42 = require("zod/v4");
294
+
295
+ // src/shared/config/thegraph.ts
296
+ var import_v4 = require("zod/v4");
297
+ var TheGraphCannotFallbackReasonSchema = import_v4.z.enum({
298
+ NotSubgraphCompatible: "not-subgraph-compatible",
299
+ NoApiKey: "no-api-key",
300
+ NoSubgraphUrl: "no-subgraph-url"
301
+ });
302
+ var TheGraphFallbackSchema = import_v4.z.discriminatedUnion("canFallback", [
303
+ import_v4.z.strictObject({
304
+ canFallback: import_v4.z.literal(true),
305
+ url: import_v4.z.string()
306
+ }),
307
+ import_v4.z.strictObject({
308
+ canFallback: import_v4.z.literal(false),
309
+ reason: TheGraphCannotFallbackReasonSchema
310
+ })
311
+ ]);
312
+
313
+ // src/ensapi/config/zod-schemas.ts
314
+ var makeEnsApiVersionInfoSchema = (valueLabel = "ENS API version info") => import_v42.z.object({
315
+ commit: import_v42.z.optional(import_v42.z.string().nonempty(`${valueLabel}.commit must be a non-empty string`)),
316
+ ensApi: import_v42.z.string().nonempty(`${valueLabel}.ensApi must be a non-empty string`),
317
+ ensNormalize: import_v42.z.string().nonempty(`${valueLabel}.ensNormalize must be a non-empty string`)
318
+ });
319
+ function makeEnsApiPublicConfigSchema(valueLabel) {
320
+ const label = valueLabel ?? "ENSApiPublicConfig";
321
+ return import_v42.z.object({
322
+ theGraphFallback: TheGraphFallbackSchema,
323
+ versionInfo: makeEnsApiVersionInfoSchema(`${label}.versionInfo`)
324
+ });
325
+ }
326
+ var makeENSApiPublicConfigSchema = makeEnsApiPublicConfigSchema;
327
+ function makeSerializedEnsApiPublicConfigSchema(valueLabel) {
328
+ const label = valueLabel ?? "ENSApiPublicConfig";
329
+ return import_v42.z.object({
330
+ theGraphFallback: TheGraphFallbackSchema,
331
+ versionInfo: makeEnsApiVersionInfoSchema(`${label}.versionInfo`)
332
+ });
333
+ }
334
+
335
+ // src/ensapi/config/deserialize.ts
336
+ function buildUnvalidatedEnsApiPublicConfig(serializedPublicConfig) {
337
+ return serializedPublicConfig;
338
+ }
339
+ function deserializeEnsApiPublicConfig(maybePublicConfig, valueLabel) {
340
+ const parsed = makeSerializedEnsApiPublicConfigSchema(valueLabel).transform(buildUnvalidatedEnsApiPublicConfig).pipe(makeEnsApiPublicConfigSchema(valueLabel)).safeParse(maybePublicConfig);
341
+ if (parsed.error) {
342
+ throw new Error(`Cannot deserialize EnsApiPublicConfig:
343
+ ${(0, import_v43.prettifyError)(parsed.error)}
344
+ `);
345
+ }
346
+ return parsed.data;
347
+ }
348
+ var deserializeENSApiPublicConfig = deserializeEnsApiPublicConfig;
349
+
350
+ // src/ensapi/config/serialize.ts
351
+ function serializeEnsApiPublicConfig(config) {
352
+ return config;
353
+ }
354
+ var serializeENSApiPublicConfig = serializeEnsApiPublicConfig;
291
355
 
292
356
  // src/ensindexer/config/deserialize.ts
293
- var import_v44 = require("zod/v4");
357
+ var import_v47 = require("zod/v4");
294
358
 
295
359
  // src/ensindexer/config/zod-schemas.ts
296
- var import_v43 = require("zod/v4");
360
+ var import_v46 = require("zod/v4");
297
361
 
298
362
  // src/ensrainbow/zod-schemas/config.ts
299
- var import_v42 = require("zod/v4");
363
+ var import_v45 = require("zod/v4");
300
364
 
301
365
  // src/shared/zod-schemas.ts
302
366
  var import_caip = require("caip");
303
367
  var import_enssdk = require("enssdk");
304
368
  var import_viem2 = require("viem");
305
- var import_v4 = require("zod/v4");
369
+ var import_v44 = require("zod/v4");
306
370
 
307
371
  // src/shared/currencies.ts
308
372
  var import_viem = require("viem");
@@ -501,7 +565,7 @@ function parseEnsTokens(value) {
501
565
  }
502
566
 
503
567
  // src/shared/zod-schemas.ts
504
- var makeIntegerSchema = (valueLabel = "Value") => import_v4.z.int({
568
+ var makeIntegerSchema = (valueLabel = "Value") => import_v44.z.int({
505
569
  error: `${valueLabel} must be an integer.`
506
570
  });
507
571
  var makePositiveIntegerSchema = (valueLabel = "Value") => makeIntegerSchema(valueLabel).positive({
@@ -510,12 +574,12 @@ var makePositiveIntegerSchema = (valueLabel = "Value") => makeIntegerSchema(valu
510
574
  var makeNonNegativeIntegerSchema = (valueLabel = "Value") => makeIntegerSchema(valueLabel).nonnegative({
511
575
  error: `${valueLabel} must be a non-negative integer (>=0).`
512
576
  });
513
- var makeDurationSchema = (valueLabel = "Value") => import_v4.z.number({
577
+ var makeDurationSchema = (valueLabel = "Value") => import_v44.z.number({
514
578
  error: `${valueLabel} must be a number.`
515
579
  }).pipe(makeNonNegativeIntegerSchema(valueLabel));
516
580
  var makeChainIdSchema = (valueLabel = "Chain ID") => makePositiveIntegerSchema(valueLabel).transform((val) => val);
517
- var makeChainIdStringSchema = (valueLabel = "Chain ID String") => import_v4.z.string({ error: `${valueLabel} must be a string representing a chain ID.` }).pipe(import_v4.z.coerce.number({ error: `${valueLabel} must represent a positive integer (>0).` })).pipe(makeChainIdSchema(`The numeric value represented by ${valueLabel}`));
518
- var makeNormalizedAddressSchema = (valueLabel = "EVM address") => import_v4.z.string().check((ctx) => {
581
+ var makeChainIdStringSchema = (valueLabel = "Chain ID String") => import_v44.z.string({ error: `${valueLabel} must be a string representing a chain ID.` }).pipe(import_v44.z.coerce.number({ error: `${valueLabel} must represent a positive integer (>0).` })).pipe(makeChainIdSchema(`The numeric value represented by ${valueLabel}`));
582
+ var makeNormalizedAddressSchema = (valueLabel = "EVM address") => import_v44.z.string().check((ctx) => {
519
583
  if (!(0, import_viem2.isAddress)(ctx.value, { strict: false })) {
520
584
  ctx.issues.push({
521
585
  code: "custom",
@@ -524,14 +588,14 @@ var makeNormalizedAddressSchema = (valueLabel = "EVM address") => import_v4.z.st
524
588
  });
525
589
  }
526
590
  }).transform((val) => (0, import_enssdk.toNormalizedAddress)(val));
527
- var makeDatetimeSchema = (valueLabel = "Datetime string") => import_v4.z.iso.datetime({ error: `${valueLabel} must be a string in ISO 8601 format.` }).transform((v) => new Date(v));
591
+ var makeDatetimeSchema = (valueLabel = "Datetime string") => import_v44.z.iso.datetime({ error: `${valueLabel} must be a string in ISO 8601 format.` }).transform((v) => new Date(v));
528
592
  var makeUnixTimestampSchema = (valueLabel = "Timestamp") => makeIntegerSchema(valueLabel);
529
- var makeUrlSchema = (valueLabel = "Value") => import_v4.z.url({
593
+ var makeUrlSchema = (valueLabel = "Value") => import_v44.z.url({
530
594
  error: `${valueLabel} must be a valid URL string (e.g., http://localhost:8080 or https://example.com).`,
531
595
  abort: true
532
596
  }).transform((v) => new URL(v));
533
597
  var makeBlockNumberSchema = (valueLabel = "Block number") => makeNonNegativeIntegerSchema(valueLabel);
534
- var makeBlockRefSchema = (valueLabel = "Value") => import_v4.z.strictObject(
598
+ var makeBlockRefSchema = (valueLabel = "Value") => import_v44.z.strictObject(
535
599
  {
536
600
  timestamp: makeUnixTimestampSchema(`${valueLabel}.timestamp`),
537
601
  number: makeBlockNumberSchema(`${valueLabel}.number`)
@@ -540,19 +604,19 @@ var makeBlockRefSchema = (valueLabel = "Value") => import_v4.z.strictObject(
540
604
  error: `${valueLabel} must be a valid BlockRef object.`
541
605
  }
542
606
  );
543
- var makeENSNamespaceIdSchema = (valueLabel = "ENSNamespaceId") => import_v4.z.enum(import_datasources.ENSNamespaceIds, {
607
+ var makeENSNamespaceIdSchema = (valueLabel = "ENSNamespaceId") => import_v44.z.enum(import_datasources.ENSNamespaceIds, {
544
608
  error() {
545
609
  return `Invalid ${valueLabel}. Supported ENS namespace IDs are: ${Object.keys(import_datasources.ENSNamespaceIds).join(", ")}`;
546
610
  }
547
611
  });
548
- var makePriceAmountSchema = (valueLabel = "Amount") => import_v4.z.coerce.bigint({
612
+ var makePriceAmountSchema = (valueLabel = "Amount") => import_v44.z.coerce.bigint({
549
613
  error: `${valueLabel} must represent a bigint.`
550
614
  }).nonnegative({
551
615
  error: `${valueLabel} must not be negative.`
552
616
  });
553
- var makePriceCurrencySchema = (currency, valueLabel = "Price Currency") => import_v4.z.strictObject({
617
+ var makePriceCurrencySchema = (currency, valueLabel = "Price Currency") => import_v44.z.strictObject({
554
618
  amount: makePriceAmountSchema(`${valueLabel} amount`),
555
- currency: import_v4.z.literal(currency, {
619
+ currency: import_v44.z.literal(currency, {
556
620
  error: `${valueLabel} currency must be set to '${currency}'.`
557
621
  })
558
622
  });
@@ -560,18 +624,18 @@ var makePriceEthSchema = (valueLabel = "Price ETH") => makePriceCurrencySchema(C
560
624
  var makePriceUsdcSchema = (valueLabel = "Price USDC") => makePriceCurrencySchema(CurrencyIds.USDC, valueLabel).transform((v) => v);
561
625
  var makePriceDaiSchema = (valueLabel = "Price DAI") => makePriceCurrencySchema(CurrencyIds.DAI, valueLabel).transform((v) => v);
562
626
  var makePriceEnsTokensSchema = (valueLabel = "Price ENSTokens") => makePriceCurrencySchema(CurrencyIds.ENSTokens, valueLabel).transform((v) => v);
563
- var makeAccountIdSchema = (valueLabel = "AccountId") => import_v4.z.strictObject({
627
+ var makeAccountIdSchema = (valueLabel = "AccountId") => import_v44.z.strictObject({
564
628
  chainId: makeChainIdSchema(`${valueLabel} chain ID`),
565
629
  address: makeNormalizedAddressSchema(`${valueLabel} address`)
566
630
  });
567
- var makeAccountIdStringSchema = (valueLabel = "Account ID String") => import_v4.z.coerce.string().transform((v) => {
631
+ var makeAccountIdStringSchema = (valueLabel = "Account ID String") => import_v44.z.coerce.string().transform((v) => {
568
632
  const result = new import_caip.AccountId(v);
569
633
  return {
570
634
  chainId: Number(result.chainId.reference),
571
635
  address: result.address
572
636
  };
573
637
  }).pipe(makeAccountIdSchema(valueLabel));
574
- var makeHexStringSchema = (options, valueLabel = "String representation of bytes array") => import_v4.z.string().check(function invariant_isHexEncoded(ctx) {
638
+ var makeHexStringSchema = (options, valueLabel = "String representation of bytes array") => import_v44.z.string().check(function invariant_isHexEncoded(ctx) {
575
639
  if (!(0, import_viem2.isHex)(ctx.value)) {
576
640
  ctx.issues.push({
577
641
  code: "custom",
@@ -592,7 +656,7 @@ var makeHexStringSchema = (options, valueLabel = "String representation of bytes
592
656
  });
593
657
  var makeNodeSchema = (valueLabel = "Node") => makeHexStringSchema({ bytesCount: 32 }, valueLabel);
594
658
  var makeTransactionHashSchema = (valueLabel = "Transaction hash") => makeHexStringSchema({ bytesCount: 32 }, valueLabel);
595
- var makeReinterpretedNameSchema = (valueLabel = "Reinterpreted Name") => import_v4.z.string().transform((v) => v).check((ctx) => {
659
+ var makeReinterpretedNameSchema = (valueLabel = "Reinterpreted Name") => import_v44.z.string().transform((v) => v).check((ctx) => {
596
660
  try {
597
661
  (0, import_enssdk.reinterpretName)(ctx.value);
598
662
  } catch (error) {
@@ -607,24 +671,24 @@ var makeReinterpretedNameSchema = (valueLabel = "Reinterpreted Name") => import_
607
671
 
608
672
  // src/ensrainbow/zod-schemas/config.ts
609
673
  var makeLabelSetIdSchema = (valueLabel = "Label set ID") => {
610
- return import_v42.z.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-]+$/, {
674
+ return import_v45.z.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-]+$/, {
611
675
  error: `${valueLabel} can only contain lowercase letters (a-z) and hyphens (-)`
612
676
  });
613
677
  };
614
678
  var makeLabelSetVersionSchema = (valueLabel = "Label set version") => makeNonNegativeIntegerSchema(valueLabel);
615
- var makeLabelSetVersionStringSchema = (valueLabel = "Label set version") => import_v42.z.coerce.number({ error: `${valueLabel} must be a non-negative integer` }).pipe(makeLabelSetVersionSchema(valueLabel));
616
- var makeEnsRainbowPublicConfigSchema = (valueLabel = "EnsRainbowPublicConfig") => import_v42.z.object({
617
- serverLabelSet: import_v42.z.object({
679
+ var makeLabelSetVersionStringSchema = (valueLabel = "Label set version") => import_v45.z.coerce.number({ error: `${valueLabel} must be a non-negative integer` }).pipe(makeLabelSetVersionSchema(valueLabel));
680
+ var makeEnsRainbowPublicConfigSchema = (valueLabel = "EnsRainbowPublicConfig") => import_v45.z.object({
681
+ serverLabelSet: import_v45.z.object({
618
682
  labelSetId: makeLabelSetIdSchema(`${valueLabel}.serverLabelSet.labelSetId`),
619
683
  highestLabelSetVersion: makeLabelSetVersionSchema(
620
684
  `${valueLabel}.serverLabelSet.highestLabelSetVersion`
621
685
  )
622
686
  }),
623
- versionInfo: import_v42.z.object({
624
- commit: import_v42.z.optional(
625
- import_v42.z.string().nonempty(`${valueLabel}.versionInfo.commit must be a non-empty string.`)
687
+ versionInfo: import_v45.z.object({
688
+ commit: import_v45.z.optional(
689
+ import_v45.z.string().nonempty(`${valueLabel}.versionInfo.commit must be a non-empty string.`)
626
690
  ),
627
- ensRainbow: import_v42.z.string().nonempty(`${valueLabel}.versionInfo.ensRainbow must be a non-empty string.`)
691
+ ensRainbow: import_v45.z.string().nonempty(`${valueLabel}.versionInfo.ensRainbow must be a non-empty string.`)
628
692
  })
629
693
  });
630
694
 
@@ -657,35 +721,6 @@ function isSubgraphCompatible(config) {
657
721
  return onlySubgraphPluginActivated && labelSetIsSubgraphCompatible;
658
722
  }
659
723
 
660
- // src/ensindexer/config/labelset-utils.ts
661
- function buildLabelSetId(maybeLabelSetId) {
662
- return makeLabelSetIdSchema("LabelSetId").parse(maybeLabelSetId);
663
- }
664
- function buildLabelSetVersion(maybeLabelSetVersion) {
665
- return makeLabelSetVersionStringSchema("LabelSetVersion").parse(maybeLabelSetVersion);
666
- }
667
- function buildEnsRainbowClientLabelSet(labelSetId, labelSetVersion) {
668
- if (labelSetVersion !== void 0 && labelSetId === void 0) {
669
- throw new Error("When a labelSetVersion is defined, labelSetId must also be defined.");
670
- }
671
- return { labelSetId, labelSetVersion };
672
- }
673
- function validateSupportedLabelSetAndVersion(serverSet, clientSet) {
674
- if (clientSet.labelSetId === void 0) {
675
- return;
676
- }
677
- if (serverSet.labelSetId !== clientSet.labelSetId) {
678
- throw new Error(
679
- `Server label set ID "${serverSet.labelSetId}" does not match client's requested label set ID "${clientSet.labelSetId}".`
680
- );
681
- }
682
- if (clientSet.labelSetVersion !== void 0 && serverSet.highestLabelSetVersion < clientSet.labelSetVersion) {
683
- throw new Error(
684
- `Server highest label set version ${serverSet.highestLabelSetVersion} is less than client's requested version ${clientSet.labelSetVersion} for label set ID "${clientSet.labelSetId}".`
685
- );
686
- }
687
- }
688
-
689
724
  // src/ensindexer/config/validations.ts
690
725
  function invariant_ensDbVersionIsSameAsEnsIndexerVersion(ctx) {
691
726
  const versionInfo = ctx.value;
@@ -699,22 +734,22 @@ function invariant_ensDbVersionIsSameAsEnsIndexerVersion(ctx) {
699
734
  }
700
735
 
701
736
  // src/ensindexer/config/zod-schemas.ts
702
- var makeIndexedChainIdsSchema = (valueLabel = "Indexed Chain IDs") => import_v43.z.set(makeChainIdSchema(valueLabel), { error: `${valueLabel} must be a set` }).min(1, {
737
+ var makeIndexedChainIdsSchema = (valueLabel = "Indexed Chain IDs") => import_v46.z.set(makeChainIdSchema(valueLabel), { error: `${valueLabel} must be a set` }).min(1, {
703
738
  error: `${valueLabel} must be a set with at least one chain ID.`
704
739
  });
705
- var makeSerializedIndexedChainIdsSchema = (valueLabel = "Indexed Chain IDs") => import_v43.z.array(makeChainIdSchema(valueLabel), {
740
+ var makeSerializedIndexedChainIdsSchema = (valueLabel = "Indexed Chain IDs") => import_v46.z.array(makeChainIdSchema(valueLabel), {
706
741
  error: `${valueLabel} must be an array.`
707
742
  }).min(1, {
708
743
  error: `${valueLabel} must be an array with at least one chain ID.`
709
744
  });
710
- var makePluginsListSchema = (valueLabel = "Plugins") => import_v43.z.array(import_v43.z.string(), {
745
+ var makePluginsListSchema = (valueLabel = "Plugins") => import_v46.z.array(import_v46.z.string(), {
711
746
  error: `${valueLabel} must be a list of strings.`
712
747
  }).min(1, {
713
748
  error: `${valueLabel} must be a list of strings with at least one string value`
714
749
  }).refine((arr) => arr.length === uniq(arr).length, {
715
750
  error: `${valueLabel} cannot contain duplicate values.`
716
751
  });
717
- var makeEnsIndexerSchemaNameSchema = (valueLabel = "ENS Indexer Schema Name") => import_v43.z.string({ error: `${valueLabel} must be a string` }).trim().nonempty({
752
+ var makeEnsIndexerSchemaNameSchema = (valueLabel = "ENS Indexer Schema Name") => import_v46.z.string({ error: `${valueLabel} must be a string` }).trim().nonempty({
718
753
  error: `${valueLabel} is required and must be a non-empty string.`
719
754
  });
720
755
  var makeFullyPinnedLabelSetSchema = (valueLabel = "Label set") => {
@@ -727,16 +762,16 @@ var makeFullyPinnedLabelSetSchema = (valueLabel = "Label set") => {
727
762
  valueLabelLabelSetId = `${valueLabel}.labelSetId`;
728
763
  valueLabelLabelSetVersion = `${valueLabel}.labelSetVersion`;
729
764
  }
730
- return import_v43.z.object({
765
+ return import_v46.z.object({
731
766
  labelSetId: makeLabelSetIdSchema(valueLabelLabelSetId),
732
767
  labelSetVersion: makeLabelSetVersionStringSchema(valueLabelLabelSetVersion)
733
768
  });
734
769
  };
735
- var makeNonEmptyStringSchema = (valueLabel = "Value") => import_v43.z.string().nonempty({ error: `${valueLabel} must be a non-empty string.` });
736
- var makeEnsIndexerVersionInfoSchema = (valueLabel = "Value") => import_v43.z.object(
770
+ var makeNonEmptyStringSchema = (valueLabel = "Value") => import_v46.z.string().nonempty({ error: `${valueLabel} must be a non-empty string.` });
771
+ var makeEnsIndexerVersionInfoSchema = (valueLabel = "Value") => import_v46.z.object(
737
772
  {
738
773
  ponder: makeNonEmptyStringSchema(),
739
- commit: import_v43.z.optional(makeNonEmptyStringSchema()),
774
+ commit: import_v46.z.optional(makeNonEmptyStringSchema()),
740
775
  ensDb: makeNonEmptyStringSchema(),
741
776
  ensIndexer: makeNonEmptyStringSchema(),
742
777
  ensNormalize: makeNonEmptyStringSchema()
@@ -755,41 +790,21 @@ function invariant_isSubgraphCompatibleRequirements(ctx) {
755
790
  });
756
791
  }
757
792
  }
758
- function invariant_ensRainbowSupportedLabelSetAndVersion(ctx) {
759
- const { clientLabelSet } = ctx.value;
760
- const { serverLabelSet } = ctx.value.ensRainbowPublicConfig;
761
- try {
762
- validateSupportedLabelSetAndVersion(serverLabelSet, clientLabelSet);
763
- } catch (error) {
764
- const errorMessage = error instanceof Error ? error.message : "Unknown error";
765
- ctx.issues.push({
766
- code: "custom",
767
- input: ctx.value,
768
- message: `The ENSRainbow label set and version specified in the config are not supported by the ENSRainbow version specified in ensRainbowPublicConfig. Cause: ${errorMessage}`
769
- });
770
- }
771
- }
772
- var makeEnsIndexerPublicConfigSchema = (valueLabel = "ENSIndexerPublicConfig") => import_v43.z.object({
793
+ var makeEnsIndexerPublicConfigSchema = (valueLabel = "ENSIndexerPublicConfig") => import_v46.z.object({
773
794
  ensIndexerSchemaName: makeEnsIndexerSchemaNameSchema(`${valueLabel}.ensIndexerSchemaName`),
774
- ensRainbowPublicConfig: makeEnsRainbowPublicConfigSchema(
775
- `${valueLabel}.ensRainbowPublicConfig`
776
- ),
777
795
  indexedChainIds: makeIndexedChainIdsSchema(`${valueLabel}.indexedChainIds`),
778
- isSubgraphCompatible: import_v43.z.boolean({
796
+ isSubgraphCompatible: import_v46.z.boolean({
779
797
  error: `${valueLabel}.isSubgraphCompatible must be a boolean value.`
780
798
  }),
781
799
  clientLabelSet: makeFullyPinnedLabelSetSchema(`${valueLabel}.clientLabelSet`),
782
800
  namespace: makeENSNamespaceIdSchema(`${valueLabel}.namespace`),
783
801
  plugins: makePluginsListSchema(`${valueLabel}.plugins`),
784
802
  versionInfo: makeEnsIndexerVersionInfoSchema(`${valueLabel}.versionInfo`)
785
- }).check(invariant_isSubgraphCompatibleRequirements).check(invariant_ensRainbowSupportedLabelSetAndVersion);
786
- var makeSerializedEnsIndexerPublicConfigSchema = (valueLabel = "Serialized ENSIndexerPublicConfig") => import_v43.z.object({
803
+ }).check(invariant_isSubgraphCompatibleRequirements);
804
+ var makeSerializedEnsIndexerPublicConfigSchema = (valueLabel = "Serialized ENSIndexerPublicConfig") => import_v46.z.object({
787
805
  ensIndexerSchemaName: makeEnsIndexerSchemaNameSchema(`${valueLabel}.ensIndexerSchemaName`),
788
- ensRainbowPublicConfig: makeEnsRainbowPublicConfigSchema(
789
- `${valueLabel}.ensRainbowPublicConfig`
790
- ),
791
806
  indexedChainIds: makeSerializedIndexedChainIdsSchema(`${valueLabel}.indexedChainIds`),
792
- isSubgraphCompatible: import_v43.z.boolean({
807
+ isSubgraphCompatible: import_v46.z.boolean({
793
808
  error: `${valueLabel}.isSubgraphCompatible must be a boolean value.`
794
809
  }),
795
810
  clientLabelSet: makeFullyPinnedLabelSetSchema(`${valueLabel}.clientLabelSet`),
@@ -809,79 +824,17 @@ function deserializeEnsIndexerPublicConfig(maybePublicConfig, valueLabel) {
809
824
  const parsed = makeSerializedEnsIndexerPublicConfigSchema(valueLabel).transform(buildUnvalidatedEnsIndexerPublicConfig).pipe(makeEnsIndexerPublicConfigSchema(valueLabel)).safeParse(maybePublicConfig);
810
825
  if (parsed.error) {
811
826
  throw new Error(`Cannot deserialize EnsIndexerPublicConfig:
812
- ${(0, import_v44.prettifyError)(parsed.error)}
827
+ ${(0, import_v47.prettifyError)(parsed.error)}
813
828
  `);
814
829
  }
815
830
  return parsed.data;
816
831
  }
817
832
  var deserializeENSIndexerPublicConfig = deserializeEnsIndexerPublicConfig;
818
833
 
819
- // src/ensapi/config/zod-schemas.ts
820
- var import_v46 = require("zod/v4");
821
-
822
- // src/shared/config/thegraph.ts
823
- var import_v45 = require("zod/v4");
824
- var TheGraphCannotFallbackReasonSchema = import_v45.z.enum({
825
- NotSubgraphCompatible: "not-subgraph-compatible",
826
- NoApiKey: "no-api-key",
827
- NoSubgraphUrl: "no-subgraph-url"
828
- });
829
- var TheGraphFallbackSchema = import_v45.z.discriminatedUnion("canFallback", [
830
- import_v45.z.strictObject({
831
- canFallback: import_v45.z.literal(true),
832
- url: import_v45.z.string()
833
- }),
834
- import_v45.z.strictObject({
835
- canFallback: import_v45.z.literal(false),
836
- reason: TheGraphCannotFallbackReasonSchema
837
- })
838
- ]);
839
-
840
- // src/ensapi/config/zod-schemas.ts
841
- var makeEnsApiVersionInfoSchema = (valueLabel = "ENS API version info") => import_v46.z.object({
842
- commit: import_v46.z.optional(import_v46.z.string().nonempty(`${valueLabel}.commit must be a non-empty string`)),
843
- ensApi: import_v46.z.string().nonempty(`${valueLabel}.ensApi must be a non-empty string`),
844
- ensNormalize: import_v46.z.string().nonempty(`${valueLabel}.ensNormalize must be a non-empty string`)
845
- });
846
- function makeEnsApiPublicConfigSchema(valueLabel) {
847
- const label = valueLabel ?? "ENSApiPublicConfig";
848
- return import_v46.z.object({
849
- theGraphFallback: TheGraphFallbackSchema,
850
- ensIndexerPublicConfig: makeEnsIndexerPublicConfigSchema(`${label}.ensIndexerPublicConfig`),
851
- versionInfo: makeEnsApiVersionInfoSchema(`${label}.versionInfo`)
852
- });
853
- }
854
- var makeENSApiPublicConfigSchema = makeEnsApiPublicConfigSchema;
855
- function makeSerializedEnsApiPublicConfigSchema(valueLabel) {
856
- const label = valueLabel ?? "ENSApiPublicConfig";
857
- return import_v46.z.object({
858
- ensIndexerPublicConfig: makeSerializedEnsIndexerPublicConfigSchema(
859
- `${label}.ensIndexerPublicConfig`
860
- ),
861
- theGraphFallback: TheGraphFallbackSchema,
862
- versionInfo: makeEnsApiVersionInfoSchema(`${label}.versionInfo`)
863
- });
864
- }
865
-
866
- // src/ensapi/config/deserialize.ts
867
- function buildUnvalidatedEnsApiPublicConfig(serializedPublicConfig) {
868
- return {
869
- ...serializedPublicConfig,
870
- ensIndexerPublicConfig: buildUnvalidatedEnsIndexerPublicConfig(
871
- serializedPublicConfig.ensIndexerPublicConfig
872
- )
873
- };
874
- }
875
- function deserializeEnsApiPublicConfig(maybePublicConfig, valueLabel) {
876
- const parsed = makeSerializedEnsApiPublicConfigSchema(valueLabel).transform(buildUnvalidatedEnsApiPublicConfig).pipe(makeEnsApiPublicConfigSchema(valueLabel)).safeParse(maybePublicConfig);
877
- if (parsed.error) {
878
- throw new Error(`Cannot deserialize EnsApiPublicConfig:
879
- ${(0, import_v47.prettifyError)(parsed.error)}
880
- `);
881
- }
882
- return parsed.data;
834
+ // src/ensindexer/api/config/deserialize.ts
835
+ function deserializeEnsIndexerConfigResponse(maybeResponse) {
836
+ return deserializeEnsIndexerPublicConfig(maybeResponse, "EnsIndexerConfigResponse");
883
837
  }
884
- var deserializeENSApiPublicConfig = deserializeEnsApiPublicConfig;
885
838
 
886
839
  // src/ensindexer/config/serialize.ts
887
840
  function serializeIndexedChainIds(indexedChainIds) {
@@ -890,7 +843,6 @@ function serializeIndexedChainIds(indexedChainIds) {
890
843
  function serializeEnsIndexerPublicConfig(config) {
891
844
  const {
892
845
  ensIndexerSchemaName,
893
- ensRainbowPublicConfig,
894
846
  indexedChainIds,
895
847
  isSubgraphCompatible: isSubgraphCompatible2,
896
848
  clientLabelSet,
@@ -900,7 +852,6 @@ function serializeEnsIndexerPublicConfig(config) {
900
852
  } = config;
901
853
  return {
902
854
  ensIndexerSchemaName,
903
- ensRainbowPublicConfig,
904
855
  indexedChainIds: serializeIndexedChainIds(indexedChainIds),
905
856
  isSubgraphCompatible: isSubgraphCompatible2,
906
857
  clientLabelSet,
@@ -911,22 +862,6 @@ function serializeEnsIndexerPublicConfig(config) {
911
862
  }
912
863
  var serializeENSIndexerPublicConfig = serializeEnsIndexerPublicConfig;
913
864
 
914
- // src/ensapi/config/serialize.ts
915
- function serializeEnsApiPublicConfig(config) {
916
- const { ensIndexerPublicConfig, theGraphFallback, versionInfo } = config;
917
- return {
918
- ensIndexerPublicConfig: serializeEnsIndexerPublicConfig(ensIndexerPublicConfig),
919
- theGraphFallback,
920
- versionInfo
921
- };
922
- }
923
- var serializeENSApiPublicConfig = serializeEnsApiPublicConfig;
924
-
925
- // src/ensindexer/api/config/deserialize.ts
926
- function deserializeEnsIndexerConfigResponse(maybeResponse) {
927
- return deserializeEnsIndexerPublicConfig(maybeResponse, "EnsIndexerConfigResponse");
928
- }
929
-
930
865
  // src/ensindexer/api/config/serialize.ts
931
866
  function serializeEnsIndexerConfigResponse(response) {
932
867
  return serializeEnsIndexerPublicConfig(response);
@@ -2221,6 +2156,35 @@ function labelHashToBytes(labelHash) {
2221
2156
  }
2222
2157
  }
2223
2158
 
2159
+ // src/ensindexer/config/labelset-utils.ts
2160
+ function buildLabelSetId(maybeLabelSetId) {
2161
+ return makeLabelSetIdSchema("LabelSetId").parse(maybeLabelSetId);
2162
+ }
2163
+ function buildLabelSetVersion(maybeLabelSetVersion) {
2164
+ return makeLabelSetVersionStringSchema("LabelSetVersion").parse(maybeLabelSetVersion);
2165
+ }
2166
+ function buildEnsRainbowClientLabelSet(labelSetId, labelSetVersion) {
2167
+ if (labelSetVersion !== void 0 && labelSetId === void 0) {
2168
+ throw new Error("When a labelSetVersion is defined, labelSetId must also be defined.");
2169
+ }
2170
+ return { labelSetId, labelSetVersion };
2171
+ }
2172
+ function validateSupportedLabelSetAndVersion(serverSet, clientSet) {
2173
+ if (clientSet.labelSetId === void 0) {
2174
+ return;
2175
+ }
2176
+ if (serverSet.labelSetId !== clientSet.labelSetId) {
2177
+ throw new Error(
2178
+ `Server label set ID "${serverSet.labelSetId}" does not match client's requested label set ID "${clientSet.labelSetId}".`
2179
+ );
2180
+ }
2181
+ if (clientSet.labelSetVersion !== void 0 && serverSet.highestLabelSetVersion < clientSet.labelSetVersion) {
2182
+ throw new Error(
2183
+ `Server highest label set version ${serverSet.highestLabelSetVersion} is less than client's requested version ${clientSet.labelSetVersion} for label set ID "${clientSet.labelSetId}".`
2184
+ );
2185
+ }
2186
+ }
2187
+
2224
2188
  // src/ensindexer/config/parsing.ts
2225
2189
  function parseNonNegativeInteger(maybeNumber) {
2226
2190
  const trimmed = maybeNumber.trim();