@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.js CHANGED
@@ -363,6 +363,7 @@ var PluginName = /* @__PURE__ */ ((PluginName2) => {
363
363
  PluginName2["Registrars"] = "registrars";
364
364
  PluginName2["TokenScope"] = "tokenscope";
365
365
  PluginName2["ENSv2"] = "ensv2";
366
+ PluginName2["Unigraph"] = "unigraph";
366
367
  return PluginName2;
367
368
  })(PluginName || {});
368
369
 
@@ -1491,14 +1492,26 @@ function invariant_realtimeIndexingStatusProjectionWorstCaseDistanceIsCorrect(ct
1491
1492
  }
1492
1493
  }
1493
1494
  var makeRealtimeIndexingStatusProjectionSchema = (valueLabel = "Realtime Indexing Status Projection") => z9.object({
1494
- projectedAt: makeUnixTimestampSchema(valueLabel),
1495
- worstCaseDistance: makeDurationSchema(valueLabel),
1496
- snapshot: makeCrossChainIndexingStatusSnapshotSchema(valueLabel)
1495
+ projectedAt: makeUnixTimestampSchema(valueLabel).describe(
1496
+ "The timestamp representing 'now' as of the time this projection was generated."
1497
+ ),
1498
+ worstCaseDistance: makeDurationSchema(valueLabel).describe(
1499
+ "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`."
1500
+ ),
1501
+ snapshot: makeCrossChainIndexingStatusSnapshotSchema(valueLabel).describe(
1502
+ "The cross-chain indexing status snapshot that this projection is based on."
1503
+ )
1497
1504
  }).check(invariant_realtimeIndexingStatusProjectionProjectedAtIsAfterOrEqualToSnapshotTime).check(invariant_realtimeIndexingStatusProjectionWorstCaseDistanceIsCorrect);
1498
1505
  var makeSerializedRealtimeIndexingStatusProjectionSchema = (valueLabel = "Value") => z9.object({
1499
- snapshot: makeSerializedCrossChainIndexingStatusSnapshotSchema(valueLabel),
1500
- projectedAt: makeUnixTimestampSchema(valueLabel),
1501
- worstCaseDistance: makeDurationSchema(valueLabel)
1506
+ snapshot: makeSerializedCrossChainIndexingStatusSnapshotSchema(valueLabel).describe(
1507
+ "The cross-chain indexing status snapshot that this projection is based on."
1508
+ ),
1509
+ projectedAt: makeUnixTimestampSchema(valueLabel).describe(
1510
+ "The timestamp representing 'now' as of the time this projection was generated."
1511
+ ),
1512
+ worstCaseDistance: makeDurationSchema(valueLabel).describe(
1513
+ "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`."
1514
+ )
1502
1515
  });
1503
1516
 
1504
1517
  // src/indexing-status/deserialize/cross-chain-indexing-status-snapshot.ts
@@ -2684,8 +2697,8 @@ function getNameTokenOwnership(namespaceId, name, owner) {
2684
2697
  // src/ensnode/api/shared/errors/zod-schemas.ts
2685
2698
  import { z as z16 } from "zod/v4";
2686
2699
  var makeErrorResponseSchema = () => z16.object({
2687
- message: z16.string(),
2688
- details: z16.optional(z16.unknown())
2700
+ message: z16.string().describe("A description of the error that occurred."),
2701
+ details: z16.optional(z16.unknown()).describe("Additional details about the error.")
2689
2702
  });
2690
2703
 
2691
2704
  // src/ensnode/api/name-tokens/response.ts
@@ -4126,15 +4139,28 @@ function isResolvedIdentity(identity) {
4126
4139
  return identity.resolutionStatus !== ResolutionStatusIds.Unresolved;
4127
4140
  }
4128
4141
 
4142
+ // src/ensnode/api/prerequisites.ts
4143
+ function hasBackfillCompleted(indexingStatus) {
4144
+ const supported = indexingStatus === OmnichainIndexingStatusIds.Completed || indexingStatus === OmnichainIndexingStatusIds.Following;
4145
+ if (supported) return { supported };
4146
+ return {
4147
+ supported: false,
4148
+ reason: `The connected ENSNode's Indexing Status must be "${OmnichainIndexingStatusIds.Completed}" or "${OmnichainIndexingStatusIds.Following}". Currently, it is "${indexingStatus}".`
4149
+ };
4150
+ }
4151
+
4129
4152
  // src/omnigraph-api/prerequisites.ts
4130
4153
  function hasOmnigraphApiConfigSupport(config) {
4131
- const supported = config.plugins.includes("ensv2" /* ENSv2 */);
4154
+ const supported = config.plugins.includes("unigraph" /* Unigraph */) || config.plugins.includes("ensv2" /* ENSv2 */);
4132
4155
  if (supported) return { supported };
4133
4156
  return {
4134
4157
  supported: false,
4135
- reason: `The connected ENSNode's Config must have the '${"ensv2" /* ENSv2 */}' plugin enabled.`
4158
+ reason: `The connected ENSNode's Config must have the '${"unigraph" /* Unigraph */}' plugin enabled.`
4136
4159
  };
4137
4160
  }
4161
+ function hasOmnigraphApiIndexingStatusSupport(indexingStatus) {
4162
+ return hasBackfillCompleted(indexingStatus);
4163
+ }
4138
4164
 
4139
4165
  // src/registrars/registration-expiration.ts
4140
4166
  function isRegistrationExpired(info, now) {
@@ -4494,7 +4520,7 @@ var TtlCache = class {
4494
4520
  import {
4495
4521
  maybeGetDatasource as maybeGetDatasource2
4496
4522
  } from "@ensnode/datasources";
4497
- function buildIndexedBlockranges(namespace, pluginsDatasourceNames) {
4523
+ function buildIndexedBlockranges(namespace, globalBlockrangeEndBlock, pluginsDatasourceNames) {
4498
4524
  const indexedBlockranges = /* @__PURE__ */ new Map();
4499
4525
  for (const [, datasourceNames] of pluginsDatasourceNames) {
4500
4526
  for (const datasourceName of datasourceNames) {
@@ -4504,9 +4530,12 @@ function buildIndexedBlockranges(namespace, pluginsDatasourceNames) {
4504
4530
  const datasourceContracts = Object.values(datasource.contracts);
4505
4531
  for (const datasourceContract of datasourceContracts) {
4506
4532
  const currentChainIndexedBlockrange = indexedBlockranges.get(datasourceChainId);
4533
+ if (typeof globalBlockrangeEndBlock === "number" && datasourceContract.startBlock > globalBlockrangeEndBlock) {
4534
+ continue;
4535
+ }
4507
4536
  const contractIndexedBlockrange = buildBlockNumberRange(
4508
4537
  datasourceContract.startBlock,
4509
- datasourceContract.endBlock
4538
+ datasourceContract.endBlock ?? globalBlockrangeEndBlock
4510
4539
  );
4511
4540
  const indexedBlockrange = currentChainIndexedBlockrange ? mergeBlockNumberRanges(currentChainIndexedBlockrange, contractIndexedBlockrange) : contractIndexedBlockrange;
4512
4541
  if (indexedBlockrange.rangeType !== RangeTypeIds.LeftBounded && indexedBlockrange.rangeType !== RangeTypeIds.Bounded) {
@@ -4782,6 +4811,9 @@ function hasSubgraphApiConfigSupport(config) {
4782
4811
  reason: `The connected ENSNode's Config must have the '${"subgraph" /* Subgraph */}' plugin enabled.`
4783
4812
  };
4784
4813
  }
4814
+ function hasSubgraphApiIndexingStatusSupport(indexingStatus) {
4815
+ return hasBackfillCompleted(indexingStatus);
4816
+ }
4785
4817
 
4786
4818
  // src/tracing/ens-protocol-tracing.ts
4787
4819
  var PROTOCOL_ATTRIBUTE_PREFIX = "ens";
@@ -4945,9 +4977,11 @@ export {
4945
4977
  getTimestampForLowestOmnichainStartBlock,
4946
4978
  hasNullByte,
4947
4979
  hasOmnigraphApiConfigSupport,
4980
+ hasOmnigraphApiIndexingStatusSupport,
4948
4981
  hasRegistrarActionsConfigSupport,
4949
4982
  hasRegistrarActionsIndexingStatusSupport,
4950
4983
  hasSubgraphApiConfigSupport,
4984
+ hasSubgraphApiIndexingStatusSupport,
4951
4985
  interpretAddress,
4952
4986
  interpretAddressRecordValue,
4953
4987
  interpretContenthashValue,