@ensnode/ensnode-sdk 1.7.0 → 1.8.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 +46 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +166 -222
- package/dist/index.d.ts +166 -222
- package/dist/index.js +46 -31
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -56,7 +56,6 @@ __export(index_exports, {
|
|
|
56
56
|
EnsApiIndexingStatusResponseCodes: () => EnsApiIndexingStatusResponseCodes,
|
|
57
57
|
EnsIndexerClient: () => EnsIndexerClient,
|
|
58
58
|
EnsIndexerIndexingStatusResponseCodes: () => EnsIndexerIndexingStatusResponseCodes,
|
|
59
|
-
EnsNodeMetadataKeys: () => EnsNodeMetadataKeys,
|
|
60
59
|
ForwardResolutionProtocolStep: () => ForwardResolutionProtocolStep,
|
|
61
60
|
IndexingStatusResponseCodes: () => IndexingStatusResponseCodes,
|
|
62
61
|
LINEANAMES_NODE: () => LINEANAMES_NODE,
|
|
@@ -170,6 +169,7 @@ __export(index_exports, {
|
|
|
170
169
|
getENSv2RootRegistryId: () => getENSv2RootRegistryId,
|
|
171
170
|
getEthnamesSubregistryId: () => getEthnamesSubregistryId,
|
|
172
171
|
getEthnamesSubregistryManagedName: () => getEthnamesSubregistryManagedName,
|
|
172
|
+
getHighestKnownBlockTimestamp: () => getHighestKnownBlockTimestamp,
|
|
173
173
|
getLatestIndexedBlockRef: () => getLatestIndexedBlockRef,
|
|
174
174
|
getLineanamesSubregistryId: () => getLineanamesSubregistryId,
|
|
175
175
|
getLineanamesSubregistryManagedName: () => getLineanamesSubregistryManagedName,
|
|
@@ -241,6 +241,8 @@ __export(index_exports, {
|
|
|
241
241
|
makeSerializedEnsApiPublicConfigSchema: () => makeSerializedEnsApiPublicConfigSchema,
|
|
242
242
|
makeSubdomainNode: () => makeSubdomainNode,
|
|
243
243
|
maybeGetDatasourceContract: () => maybeGetDatasourceContract,
|
|
244
|
+
maybeGetENSv2RootRegistry: () => maybeGetENSv2RootRegistry,
|
|
245
|
+
maybeGetENSv2RootRegistryId: () => maybeGetENSv2RootRegistryId,
|
|
244
246
|
mergeBlockNumberRanges: () => mergeBlockNumberRanges,
|
|
245
247
|
nameTokensPrerequisites: () => nameTokensPrerequisites,
|
|
246
248
|
parseAccountId: () => parseAccountId,
|
|
@@ -1159,7 +1161,7 @@ var import_v412 = require("zod/v4");
|
|
|
1159
1161
|
|
|
1160
1162
|
// src/shared/block-ref.ts
|
|
1161
1163
|
function isBefore(blockA, blockB) {
|
|
1162
|
-
return blockA.number < blockB.number
|
|
1164
|
+
return blockA.number < blockB.number;
|
|
1163
1165
|
}
|
|
1164
1166
|
function isEqualTo(blockA, blockB) {
|
|
1165
1167
|
return blockA.number === blockB.number && blockA.timestamp === blockB.timestamp;
|
|
@@ -1386,12 +1388,31 @@ function getLatestIndexedBlockRef(indexingStatus, chainId) {
|
|
|
1386
1388
|
}
|
|
1387
1389
|
return chainIndexingStatus.latestIndexedBlock;
|
|
1388
1390
|
}
|
|
1391
|
+
function getHighestKnownBlockTimestamp(chains) {
|
|
1392
|
+
if (chains.length === 0) {
|
|
1393
|
+
throw new Error(
|
|
1394
|
+
"Invariant violation: at least one chain is required to determine the highest known block timestamp"
|
|
1395
|
+
);
|
|
1396
|
+
}
|
|
1397
|
+
const startBlockTimestamps = chains.map((chain) => chain.config.startBlock.timestamp);
|
|
1398
|
+
const endBlockTimestamps = chains.map((chain) => chain.config).filter((chainConfig) => chainConfig.rangeType === RangeTypeIds.Bounded).map((chainConfig) => chainConfig.endBlock.timestamp);
|
|
1399
|
+
const backfillEndBlockTimestamps = chains.filter((chain) => chain.chainStatus === ChainIndexingStatusIds.Backfill).map((chain) => chain.backfillEndBlock.timestamp);
|
|
1400
|
+
const latestKnownBlockTimestamps = chains.filter((chain) => chain.chainStatus === ChainIndexingStatusIds.Following).map((chain) => chain.latestKnownBlock.timestamp);
|
|
1401
|
+
return Math.max(
|
|
1402
|
+
...startBlockTimestamps,
|
|
1403
|
+
...endBlockTimestamps,
|
|
1404
|
+
...backfillEndBlockTimestamps,
|
|
1405
|
+
...latestKnownBlockTimestamps
|
|
1406
|
+
);
|
|
1407
|
+
}
|
|
1389
1408
|
function buildCrossChainIndexingStatusSnapshotOmnichain(omnichainSnapshot, snapshotTime) {
|
|
1409
|
+
const chains = Array.from(omnichainSnapshot.chains.values());
|
|
1410
|
+
const adjustedSnapshotTime = Math.max(snapshotTime, getHighestKnownBlockTimestamp(chains));
|
|
1390
1411
|
return validateCrossChainIndexingStatusSnapshot({
|
|
1391
1412
|
strategy: CrossChainIndexingStrategyIds.Omnichain,
|
|
1392
1413
|
slowestChainIndexingCursor: omnichainSnapshot.omnichainIndexingCursor,
|
|
1393
1414
|
omnichainSnapshot,
|
|
1394
|
-
snapshotTime
|
|
1415
|
+
snapshotTime: adjustedSnapshotTime
|
|
1395
1416
|
});
|
|
1396
1417
|
}
|
|
1397
1418
|
|
|
@@ -1919,16 +1940,7 @@ function invariant_slowestChainEqualsToOmnichainSnapshotTime(ctx) {
|
|
|
1919
1940
|
function invariant_snapshotTimeIsTheHighestKnownBlockTimestamp(ctx) {
|
|
1920
1941
|
const { snapshotTime, omnichainSnapshot } = ctx.value;
|
|
1921
1942
|
const chains = Array.from(omnichainSnapshot.chains.values());
|
|
1922
|
-
const
|
|
1923
|
-
const endBlockTimestamps = chains.map((chain) => chain.config).filter((chainConfig) => chainConfig.rangeType === RangeTypeIds.Bounded).map((chainConfig) => chainConfig.endBlock.timestamp);
|
|
1924
|
-
const backfillEndBlockTimestamps = chains.filter((chain) => chain.chainStatus === ChainIndexingStatusIds.Backfill).map((chain) => chain.backfillEndBlock.timestamp);
|
|
1925
|
-
const latestKnownBlockTimestamps = chains.filter((chain) => chain.chainStatus === ChainIndexingStatusIds.Following).map((chain) => chain.latestKnownBlock.timestamp);
|
|
1926
|
-
const highestKnownBlockTimestamp = Math.max(
|
|
1927
|
-
...startBlockTimestamps,
|
|
1928
|
-
...endBlockTimestamps,
|
|
1929
|
-
...backfillEndBlockTimestamps,
|
|
1930
|
-
...latestKnownBlockTimestamps
|
|
1931
|
-
);
|
|
1943
|
+
const highestKnownBlockTimestamp = getHighestKnownBlockTimestamp(chains);
|
|
1932
1944
|
if (snapshotTime < highestKnownBlockTimestamp) {
|
|
1933
1945
|
ctx.issues.push({
|
|
1934
1946
|
code: "custom",
|
|
@@ -3234,6 +3246,14 @@ var RegistrarActionsFilterTypes = {
|
|
|
3234
3246
|
EndTimestamp: "endTimestamp"
|
|
3235
3247
|
};
|
|
3236
3248
|
var RegistrarActionsOrders = {
|
|
3249
|
+
/**
|
|
3250
|
+
* Returns registrar actions newest-first.
|
|
3251
|
+
*
|
|
3252
|
+
* Sorts by block timestamp descending. Because each action's identifier encodes
|
|
3253
|
+
* all ordering-relevant onchain properties, this also correctly orders actions
|
|
3254
|
+
* that share the same block timestamp by the chronological order in which they
|
|
3255
|
+
* were executed within the block.
|
|
3256
|
+
*/
|
|
3237
3257
|
LatestRegistrarActions: "orderBy[timestamp]=desc"
|
|
3238
3258
|
};
|
|
3239
3259
|
|
|
@@ -3894,13 +3914,6 @@ var EnsApiClient = class _EnsApiClient {
|
|
|
3894
3914
|
var ENSNodeClient = class extends EnsApiClient {
|
|
3895
3915
|
};
|
|
3896
3916
|
|
|
3897
|
-
// src/ensdb/ensnode-metadata.ts
|
|
3898
|
-
var EnsNodeMetadataKeys = {
|
|
3899
|
-
EnsDbVersion: "ensdb_version",
|
|
3900
|
-
EnsIndexerPublicConfig: "ensindexer_public_config",
|
|
3901
|
-
EnsIndexerIndexingStatus: "ensindexer_indexing_status"
|
|
3902
|
-
};
|
|
3903
|
-
|
|
3904
3917
|
// src/ensindexer/api/config/deserialize.ts
|
|
3905
3918
|
function deserializeEnsIndexerConfigResponse(maybeResponse) {
|
|
3906
3919
|
return deserializeEnsIndexerPublicConfig(maybeResponse, "EnsIndexerConfigResponse");
|
|
@@ -4761,18 +4774,14 @@ var TtlCache = class {
|
|
|
4761
4774
|
|
|
4762
4775
|
// src/shared/config/indexed-blockranges.ts
|
|
4763
4776
|
var import_datasources12 = require("@ensnode/datasources");
|
|
4764
|
-
function buildIndexedBlockranges(namespace,
|
|
4777
|
+
function buildIndexedBlockranges(namespace, pluginsDatasourceNames) {
|
|
4765
4778
|
const indexedBlockranges = /* @__PURE__ */ new Map();
|
|
4766
|
-
for (const [
|
|
4767
|
-
for (const
|
|
4768
|
-
const
|
|
4769
|
-
if (!
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
);
|
|
4773
|
-
}
|
|
4774
|
-
const datasourceChainId = requiredDatasource.chain.id;
|
|
4775
|
-
const datasourceContracts = Object.values(requiredDatasource.contracts);
|
|
4779
|
+
for (const [, datasourceNames] of pluginsDatasourceNames) {
|
|
4780
|
+
for (const datasourceName of datasourceNames) {
|
|
4781
|
+
const datasource = (0, import_datasources12.maybeGetDatasource)(namespace, datasourceName);
|
|
4782
|
+
if (!datasource) continue;
|
|
4783
|
+
const datasourceChainId = datasource.chain.id;
|
|
4784
|
+
const datasourceContracts = Object.values(datasource.contracts);
|
|
4776
4785
|
for (const datasourceContract of datasourceContracts) {
|
|
4777
4786
|
const currentChainIndexedBlockrange = indexedBlockranges.get(datasourceChainId);
|
|
4778
4787
|
const contractIndexedBlockrange = buildBlockNumberRange(
|
|
@@ -4919,6 +4928,12 @@ var isENSv1Registry = (namespace, contract) => accountIdEqual(getENSv1Registry(n
|
|
|
4919
4928
|
var getENSv2RootRegistry = (namespace) => getDatasourceContract(namespace, import_datasources13.DatasourceNames.ENSv2Root, "RootRegistry");
|
|
4920
4929
|
var getENSv2RootRegistryId = (namespace) => makeRegistryId(getENSv2RootRegistry(namespace));
|
|
4921
4930
|
var isENSv2RootRegistry = (namespace, contract) => accountIdEqual(getENSv2RootRegistry(namespace), contract);
|
|
4931
|
+
var maybeGetENSv2RootRegistry = (namespace) => maybeGetDatasourceContract(namespace, import_datasources13.DatasourceNames.ENSv2Root, "RootRegistry");
|
|
4932
|
+
var maybeGetENSv2RootRegistryId = (namespace) => {
|
|
4933
|
+
const root = maybeGetENSv2RootRegistry(namespace);
|
|
4934
|
+
if (!root) return void 0;
|
|
4935
|
+
return makeRegistryId(root);
|
|
4936
|
+
};
|
|
4922
4937
|
|
|
4923
4938
|
// src/shared/url.ts
|
|
4924
4939
|
function isHttpProtocol(url) {
|