@ensnode/ensnode-sdk 0.0.0-next-20260619182740 → 0.0.0-next-20260619184733

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
@@ -4820,7 +4820,7 @@ var TtlCache = class {
4820
4820
 
4821
4821
  // src/shared/config/indexed-blockranges.ts
4822
4822
  var import_datasources8 = require("@ensnode/datasources");
4823
- function buildIndexedBlockranges(namespace, globalBlockrangeEndBlock, pluginsDatasourceNames) {
4823
+ function buildIndexedBlockranges(namespace, chainEndBlocks, pluginsDatasourceNames) {
4824
4824
  const indexedBlockranges = /* @__PURE__ */ new Map();
4825
4825
  for (const [, datasourceNames] of pluginsDatasourceNames) {
4826
4826
  for (const datasourceName of datasourceNames) {
@@ -4828,14 +4828,19 @@ function buildIndexedBlockranges(namespace, globalBlockrangeEndBlock, pluginsDat
4828
4828
  if (!datasource) continue;
4829
4829
  const datasourceChainId = datasource.chain.id;
4830
4830
  const datasourceContracts = Object.values(datasource.contracts);
4831
+ const chainEndBlock = chainEndBlocks.get(datasourceChainId);
4831
4832
  for (const datasourceContract of datasourceContracts) {
4832
4833
  const currentChainIndexedBlockrange = indexedBlockranges.get(datasourceChainId);
4833
- if (typeof globalBlockrangeEndBlock === "number" && datasourceContract.startBlock > globalBlockrangeEndBlock) {
4834
+ if (typeof chainEndBlock === "number" && datasourceContract.startBlock > chainEndBlock) {
4834
4835
  continue;
4835
4836
  }
4837
+ const effectiveEndBlock = Math.min(
4838
+ datasourceContract.endBlock ?? Infinity,
4839
+ chainEndBlock ?? Infinity
4840
+ );
4836
4841
  const contractIndexedBlockrange = buildBlockNumberRange(
4837
4842
  datasourceContract.startBlock,
4838
- datasourceContract.endBlock ?? globalBlockrangeEndBlock
4843
+ Number.isFinite(effectiveEndBlock) ? effectiveEndBlock : void 0
4839
4844
  );
4840
4845
  const indexedBlockrange = currentChainIndexedBlockrange ? mergeBlockNumberRanges(currentChainIndexedBlockrange, contractIndexedBlockrange) : contractIndexedBlockrange;
4841
4846
  if (indexedBlockrange.rangeType !== RangeTypeIds.LeftBounded && indexedBlockrange.rangeType !== RangeTypeIds.Bounded) {