@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.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
|
-
|
|
1496
|
-
|
|
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
|
-
|
|
1501
|
-
|
|
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 '${"
|
|
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) {
|
|
@@ -4414,6 +4440,30 @@ var SWRCache = class {
|
|
|
4414
4440
|
}
|
|
4415
4441
|
return this.cache.result;
|
|
4416
4442
|
}
|
|
4443
|
+
/**
|
|
4444
|
+
* Synchronously returns the most recently cached result without triggering revalidation.
|
|
4445
|
+
*
|
|
4446
|
+
* Unlike {@link read}, this method is synchronous and never causes any I/O — it simply
|
|
4447
|
+
* returns whatever value is already in memory. Use this when you need a best-effort
|
|
4448
|
+
* snapshot of the cached value and can tolerate stale data.
|
|
4449
|
+
*
|
|
4450
|
+
* @returns the most recently cached `ValueType`, or an `Error` if the last fetch failed.
|
|
4451
|
+
* @throws if the cache has not been initialized yet (i.e. {@link read} has never been awaited
|
|
4452
|
+
* and `proactivelyInitialize` was not set to `true`).
|
|
4453
|
+
*
|
|
4454
|
+
* @example
|
|
4455
|
+
* ```ts
|
|
4456
|
+
* // Ensure cache is initialized first
|
|
4457
|
+
* await cache.read();
|
|
4458
|
+
*
|
|
4459
|
+
* // Later, peek synchronously without triggering revalidation
|
|
4460
|
+
* const result = cache.peek();
|
|
4461
|
+
* ```
|
|
4462
|
+
*/
|
|
4463
|
+
peek() {
|
|
4464
|
+
if (!this.cache) throw new Error("Cache is not initialized yet");
|
|
4465
|
+
return this.cache.result;
|
|
4466
|
+
}
|
|
4417
4467
|
/**
|
|
4418
4468
|
* Destroys the background revalidation interval, if exists.
|
|
4419
4469
|
*/
|
|
@@ -4494,7 +4544,7 @@ var TtlCache = class {
|
|
|
4494
4544
|
import {
|
|
4495
4545
|
maybeGetDatasource as maybeGetDatasource2
|
|
4496
4546
|
} from "@ensnode/datasources";
|
|
4497
|
-
function buildIndexedBlockranges(namespace, pluginsDatasourceNames) {
|
|
4547
|
+
function buildIndexedBlockranges(namespace, globalBlockrangeEndBlock, pluginsDatasourceNames) {
|
|
4498
4548
|
const indexedBlockranges = /* @__PURE__ */ new Map();
|
|
4499
4549
|
for (const [, datasourceNames] of pluginsDatasourceNames) {
|
|
4500
4550
|
for (const datasourceName of datasourceNames) {
|
|
@@ -4504,9 +4554,12 @@ function buildIndexedBlockranges(namespace, pluginsDatasourceNames) {
|
|
|
4504
4554
|
const datasourceContracts = Object.values(datasource.contracts);
|
|
4505
4555
|
for (const datasourceContract of datasourceContracts) {
|
|
4506
4556
|
const currentChainIndexedBlockrange = indexedBlockranges.get(datasourceChainId);
|
|
4557
|
+
if (typeof globalBlockrangeEndBlock === "number" && datasourceContract.startBlock > globalBlockrangeEndBlock) {
|
|
4558
|
+
continue;
|
|
4559
|
+
}
|
|
4507
4560
|
const contractIndexedBlockrange = buildBlockNumberRange(
|
|
4508
4561
|
datasourceContract.startBlock,
|
|
4509
|
-
datasourceContract.endBlock
|
|
4562
|
+
datasourceContract.endBlock ?? globalBlockrangeEndBlock
|
|
4510
4563
|
);
|
|
4511
4564
|
const indexedBlockrange = currentChainIndexedBlockrange ? mergeBlockNumberRanges(currentChainIndexedBlockrange, contractIndexedBlockrange) : contractIndexedBlockrange;
|
|
4512
4565
|
if (indexedBlockrange.rangeType !== RangeTypeIds.LeftBounded && indexedBlockrange.rangeType !== RangeTypeIds.Bounded) {
|
|
@@ -4782,6 +4835,9 @@ function hasSubgraphApiConfigSupport(config) {
|
|
|
4782
4835
|
reason: `The connected ENSNode's Config must have the '${"subgraph" /* Subgraph */}' plugin enabled.`
|
|
4783
4836
|
};
|
|
4784
4837
|
}
|
|
4838
|
+
function hasSubgraphApiIndexingStatusSupport(indexingStatus) {
|
|
4839
|
+
return hasBackfillCompleted(indexingStatus);
|
|
4840
|
+
}
|
|
4785
4841
|
|
|
4786
4842
|
// src/tracing/ens-protocol-tracing.ts
|
|
4787
4843
|
var PROTOCOL_ATTRIBUTE_PREFIX = "ens";
|
|
@@ -4945,9 +5001,11 @@ export {
|
|
|
4945
5001
|
getTimestampForLowestOmnichainStartBlock,
|
|
4946
5002
|
hasNullByte,
|
|
4947
5003
|
hasOmnigraphApiConfigSupport,
|
|
5004
|
+
hasOmnigraphApiIndexingStatusSupport,
|
|
4948
5005
|
hasRegistrarActionsConfigSupport,
|
|
4949
5006
|
hasRegistrarActionsIndexingStatusSupport,
|
|
4950
5007
|
hasSubgraphApiConfigSupport,
|
|
5008
|
+
hasSubgraphApiIndexingStatusSupport,
|
|
4951
5009
|
interpretAddress,
|
|
4952
5010
|
interpretAddressRecordValue,
|
|
4953
5011
|
interpretContenthashValue,
|