@ensnode/ensnode-sdk 1.13.1 → 1.15.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 +70 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +36 -1257
- package/dist/index.d.ts +36 -1257
- package/dist/index.js +70 -12
- package/dist/index.js.map +1 -1
- package/dist/internal.cjs +3409 -0
- package/dist/internal.cjs.map +1 -0
- package/dist/internal.d.cts +4198 -0
- package/dist/internal.d.ts +4198 -0
- package/dist/internal.js +3410 -0
- package/dist/internal.js.map +1 -0
- package/dist/namespace-specific-value-CPvcFpGI.d.cts +1260 -0
- package/dist/namespace-specific-value-CPvcFpGI.d.ts +1260 -0
- package/package.json +16 -6
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
|
-
|
|
1769
|
-
|
|
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
|
-
|
|
1774
|
-
|
|
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 '${"
|
|
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) {
|
|
@@ -4683,6 +4711,30 @@ var SWRCache = class {
|
|
|
4683
4711
|
}
|
|
4684
4712
|
return this.cache.result;
|
|
4685
4713
|
}
|
|
4714
|
+
/**
|
|
4715
|
+
* Synchronously returns the most recently cached result without triggering revalidation.
|
|
4716
|
+
*
|
|
4717
|
+
* Unlike {@link read}, this method is synchronous and never causes any I/O — it simply
|
|
4718
|
+
* returns whatever value is already in memory. Use this when you need a best-effort
|
|
4719
|
+
* snapshot of the cached value and can tolerate stale data.
|
|
4720
|
+
*
|
|
4721
|
+
* @returns the most recently cached `ValueType`, or an `Error` if the last fetch failed.
|
|
4722
|
+
* @throws if the cache has not been initialized yet (i.e. {@link read} has never been awaited
|
|
4723
|
+
* and `proactivelyInitialize` was not set to `true`).
|
|
4724
|
+
*
|
|
4725
|
+
* @example
|
|
4726
|
+
* ```ts
|
|
4727
|
+
* // Ensure cache is initialized first
|
|
4728
|
+
* await cache.read();
|
|
4729
|
+
*
|
|
4730
|
+
* // Later, peek synchronously without triggering revalidation
|
|
4731
|
+
* const result = cache.peek();
|
|
4732
|
+
* ```
|
|
4733
|
+
*/
|
|
4734
|
+
peek() {
|
|
4735
|
+
if (!this.cache) throw new Error("Cache is not initialized yet");
|
|
4736
|
+
return this.cache.result;
|
|
4737
|
+
}
|
|
4686
4738
|
/**
|
|
4687
4739
|
* Destroys the background revalidation interval, if exists.
|
|
4688
4740
|
*/
|
|
@@ -4761,7 +4813,7 @@ var TtlCache = class {
|
|
|
4761
4813
|
|
|
4762
4814
|
// src/shared/config/indexed-blockranges.ts
|
|
4763
4815
|
var import_datasources8 = require("@ensnode/datasources");
|
|
4764
|
-
function buildIndexedBlockranges(namespace, pluginsDatasourceNames) {
|
|
4816
|
+
function buildIndexedBlockranges(namespace, globalBlockrangeEndBlock, pluginsDatasourceNames) {
|
|
4765
4817
|
const indexedBlockranges = /* @__PURE__ */ new Map();
|
|
4766
4818
|
for (const [, datasourceNames] of pluginsDatasourceNames) {
|
|
4767
4819
|
for (const datasourceName of datasourceNames) {
|
|
@@ -4771,9 +4823,12 @@ function buildIndexedBlockranges(namespace, pluginsDatasourceNames) {
|
|
|
4771
4823
|
const datasourceContracts = Object.values(datasource.contracts);
|
|
4772
4824
|
for (const datasourceContract of datasourceContracts) {
|
|
4773
4825
|
const currentChainIndexedBlockrange = indexedBlockranges.get(datasourceChainId);
|
|
4826
|
+
if (typeof globalBlockrangeEndBlock === "number" && datasourceContract.startBlock > globalBlockrangeEndBlock) {
|
|
4827
|
+
continue;
|
|
4828
|
+
}
|
|
4774
4829
|
const contractIndexedBlockrange = buildBlockNumberRange(
|
|
4775
4830
|
datasourceContract.startBlock,
|
|
4776
|
-
datasourceContract.endBlock
|
|
4831
|
+
datasourceContract.endBlock ?? globalBlockrangeEndBlock
|
|
4777
4832
|
);
|
|
4778
4833
|
const indexedBlockrange = currentChainIndexedBlockrange ? mergeBlockNumberRanges(currentChainIndexedBlockrange, contractIndexedBlockrange) : contractIndexedBlockrange;
|
|
4779
4834
|
if (indexedBlockrange.rangeType !== RangeTypeIds.LeftBounded && indexedBlockrange.rangeType !== RangeTypeIds.Bounded) {
|
|
@@ -5044,6 +5099,9 @@ function hasSubgraphApiConfigSupport(config) {
|
|
|
5044
5099
|
reason: `The connected ENSNode's Config must have the '${"subgraph" /* Subgraph */}' plugin enabled.`
|
|
5045
5100
|
};
|
|
5046
5101
|
}
|
|
5102
|
+
function hasSubgraphApiIndexingStatusSupport(indexingStatus) {
|
|
5103
|
+
return hasBackfillCompleted(indexingStatus);
|
|
5104
|
+
}
|
|
5047
5105
|
|
|
5048
5106
|
// src/tracing/ens-protocol-tracing.ts
|
|
5049
5107
|
var PROTOCOL_ATTRIBUTE_PREFIX = "ens";
|