@ensnode/ensnode-sdk 1.13.1 → 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.
package/dist/index.cjs CHANGED
@@ -162,9 +162,11 @@ __export(index_exports, {
162
162
  getTimestampForLowestOmnichainStartBlock: () => getTimestampForLowestOmnichainStartBlock,
163
163
  hasNullByte: () => hasNullByte,
164
164
  hasOmnigraphApiConfigSupport: () => hasOmnigraphApiConfigSupport,
165
+ hasOmnigraphApiIndexingStatusSupport: () => hasOmnigraphApiIndexingStatusSupport,
165
166
  hasRegistrarActionsConfigSupport: () => hasRegistrarActionsConfigSupport,
166
167
  hasRegistrarActionsIndexingStatusSupport: () => hasRegistrarActionsIndexingStatusSupport,
167
168
  hasSubgraphApiConfigSupport: () => hasSubgraphApiConfigSupport,
169
+ hasSubgraphApiIndexingStatusSupport: () => hasSubgraphApiIndexingStatusSupport,
168
170
  interpretAddress: () => interpretAddress,
169
171
  interpretAddressRecordValue: () => interpretAddressRecordValue,
170
172
  interpretContenthashValue: () => interpretContenthashValue,
@@ -636,6 +638,7 @@ var PluginName = /* @__PURE__ */ ((PluginName2) => {
636
638
  PluginName2["Registrars"] = "registrars";
637
639
  PluginName2["TokenScope"] = "tokenscope";
638
640
  PluginName2["ENSv2"] = "ensv2";
641
+ PluginName2["Unigraph"] = "unigraph";
639
642
  return PluginName2;
640
643
  })(PluginName || {});
641
644
 
@@ -1764,14 +1767,26 @@ function invariant_realtimeIndexingStatusProjectionWorstCaseDistanceIsCorrect(ct
1764
1767
  }
1765
1768
  }
1766
1769
  var makeRealtimeIndexingStatusProjectionSchema = (valueLabel = "Realtime Indexing Status Projection") => import_v413.z.object({
1767
- projectedAt: makeUnixTimestampSchema(valueLabel),
1768
- worstCaseDistance: makeDurationSchema(valueLabel),
1769
- snapshot: makeCrossChainIndexingStatusSnapshotSchema(valueLabel)
1770
+ projectedAt: makeUnixTimestampSchema(valueLabel).describe(
1771
+ "The timestamp representing 'now' as of the time this projection was generated."
1772
+ ),
1773
+ worstCaseDistance: makeDurationSchema(valueLabel).describe(
1774
+ "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`."
1775
+ ),
1776
+ snapshot: makeCrossChainIndexingStatusSnapshotSchema(valueLabel).describe(
1777
+ "The cross-chain indexing status snapshot that this projection is based on."
1778
+ )
1770
1779
  }).check(invariant_realtimeIndexingStatusProjectionProjectedAtIsAfterOrEqualToSnapshotTime).check(invariant_realtimeIndexingStatusProjectionWorstCaseDistanceIsCorrect);
1771
1780
  var makeSerializedRealtimeIndexingStatusProjectionSchema = (valueLabel = "Value") => import_v413.z.object({
1772
- snapshot: makeSerializedCrossChainIndexingStatusSnapshotSchema(valueLabel),
1773
- projectedAt: makeUnixTimestampSchema(valueLabel),
1774
- worstCaseDistance: makeDurationSchema(valueLabel)
1781
+ snapshot: makeSerializedCrossChainIndexingStatusSnapshotSchema(valueLabel).describe(
1782
+ "The cross-chain indexing status snapshot that this projection is based on."
1783
+ ),
1784
+ projectedAt: makeUnixTimestampSchema(valueLabel).describe(
1785
+ "The timestamp representing 'now' as of the time this projection was generated."
1786
+ ),
1787
+ worstCaseDistance: makeDurationSchema(valueLabel).describe(
1788
+ "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`."
1789
+ )
1775
1790
  });
1776
1791
 
1777
1792
  // src/indexing-status/deserialize/cross-chain-indexing-status-snapshot.ts
@@ -2953,8 +2968,8 @@ function getNameTokenOwnership(namespaceId, name, owner) {
2953
2968
  // src/ensnode/api/shared/errors/zod-schemas.ts
2954
2969
  var import_v431 = require("zod/v4");
2955
2970
  var makeErrorResponseSchema = () => import_v431.z.object({
2956
- message: import_v431.z.string(),
2957
- details: import_v431.z.optional(import_v431.z.unknown())
2971
+ message: import_v431.z.string().describe("A description of the error that occurred."),
2972
+ details: import_v431.z.optional(import_v431.z.unknown()).describe("Additional details about the error.")
2958
2973
  });
2959
2974
 
2960
2975
  // src/ensnode/api/name-tokens/response.ts
@@ -4395,15 +4410,28 @@ function isResolvedIdentity(identity) {
4395
4410
  return identity.resolutionStatus !== ResolutionStatusIds.Unresolved;
4396
4411
  }
4397
4412
 
4413
+ // src/ensnode/api/prerequisites.ts
4414
+ function hasBackfillCompleted(indexingStatus) {
4415
+ const supported = indexingStatus === OmnichainIndexingStatusIds.Completed || indexingStatus === OmnichainIndexingStatusIds.Following;
4416
+ if (supported) return { supported };
4417
+ return {
4418
+ supported: false,
4419
+ reason: `The connected ENSNode's Indexing Status must be "${OmnichainIndexingStatusIds.Completed}" or "${OmnichainIndexingStatusIds.Following}". Currently, it is "${indexingStatus}".`
4420
+ };
4421
+ }
4422
+
4398
4423
  // src/omnigraph-api/prerequisites.ts
4399
4424
  function hasOmnigraphApiConfigSupport(config) {
4400
- const supported = config.plugins.includes("ensv2" /* ENSv2 */);
4425
+ const supported = config.plugins.includes("unigraph" /* Unigraph */) || config.plugins.includes("ensv2" /* ENSv2 */);
4401
4426
  if (supported) return { supported };
4402
4427
  return {
4403
4428
  supported: false,
4404
- reason: `The connected ENSNode's Config must have the '${"ensv2" /* ENSv2 */}' plugin enabled.`
4429
+ reason: `The connected ENSNode's Config must have the '${"unigraph" /* Unigraph */}' plugin enabled.`
4405
4430
  };
4406
4431
  }
4432
+ function hasOmnigraphApiIndexingStatusSupport(indexingStatus) {
4433
+ return hasBackfillCompleted(indexingStatus);
4434
+ }
4407
4435
 
4408
4436
  // src/registrars/registration-expiration.ts
4409
4437
  function isRegistrationExpired(info, now) {
@@ -4761,7 +4789,7 @@ var TtlCache = class {
4761
4789
 
4762
4790
  // src/shared/config/indexed-blockranges.ts
4763
4791
  var import_datasources8 = require("@ensnode/datasources");
4764
- function buildIndexedBlockranges(namespace, pluginsDatasourceNames) {
4792
+ function buildIndexedBlockranges(namespace, globalBlockrangeEndBlock, pluginsDatasourceNames) {
4765
4793
  const indexedBlockranges = /* @__PURE__ */ new Map();
4766
4794
  for (const [, datasourceNames] of pluginsDatasourceNames) {
4767
4795
  for (const datasourceName of datasourceNames) {
@@ -4771,9 +4799,12 @@ function buildIndexedBlockranges(namespace, pluginsDatasourceNames) {
4771
4799
  const datasourceContracts = Object.values(datasource.contracts);
4772
4800
  for (const datasourceContract of datasourceContracts) {
4773
4801
  const currentChainIndexedBlockrange = indexedBlockranges.get(datasourceChainId);
4802
+ if (typeof globalBlockrangeEndBlock === "number" && datasourceContract.startBlock > globalBlockrangeEndBlock) {
4803
+ continue;
4804
+ }
4774
4805
  const contractIndexedBlockrange = buildBlockNumberRange(
4775
4806
  datasourceContract.startBlock,
4776
- datasourceContract.endBlock
4807
+ datasourceContract.endBlock ?? globalBlockrangeEndBlock
4777
4808
  );
4778
4809
  const indexedBlockrange = currentChainIndexedBlockrange ? mergeBlockNumberRanges(currentChainIndexedBlockrange, contractIndexedBlockrange) : contractIndexedBlockrange;
4779
4810
  if (indexedBlockrange.rangeType !== RangeTypeIds.LeftBounded && indexedBlockrange.rangeType !== RangeTypeIds.Bounded) {
@@ -5044,6 +5075,9 @@ function hasSubgraphApiConfigSupport(config) {
5044
5075
  reason: `The connected ENSNode's Config must have the '${"subgraph" /* Subgraph */}' plugin enabled.`
5045
5076
  };
5046
5077
  }
5078
+ function hasSubgraphApiIndexingStatusSupport(indexingStatus) {
5079
+ return hasBackfillCompleted(indexingStatus);
5080
+ }
5047
5081
 
5048
5082
  // src/tracing/ens-protocol-tracing.ts
5049
5083
  var PROTOCOL_ATTRIBUTE_PREFIX = "ens";