@ensnode/ensnode-sdk 1.6.0 → 1.7.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.d.cts CHANGED
@@ -1264,8 +1264,9 @@ declare function buildBlockNumberRange(startBlock?: BlockNumber, endBlock?: Bloc
1264
1264
  * Merge multiple block number ranges into a single range.
1265
1265
  *
1266
1266
  * The resulting range is a union that covers all input ranges:
1267
- * - Uses the minimum defined start block (undefined if no ranges define a start block)
1268
- * - Uses the maximum defined end block (undefined if no ranges define an end block)
1267
+ * - Uses the minimum start block when every input range has a start block
1268
+ * - Uses the maximum end block when every input range has an end block
1269
+ * - Leaves a side unbounded when any input range is unbounded on that side
1269
1270
  *
1270
1271
  * Returns an unbounded range if no ranges are provided.
1271
1272
  *
package/dist/index.d.ts CHANGED
@@ -1264,8 +1264,9 @@ declare function buildBlockNumberRange(startBlock?: BlockNumber, endBlock?: Bloc
1264
1264
  * Merge multiple block number ranges into a single range.
1265
1265
  *
1266
1266
  * The resulting range is a union that covers all input ranges:
1267
- * - Uses the minimum defined start block (undefined if no ranges define a start block)
1268
- * - Uses the maximum defined end block (undefined if no ranges define an end block)
1267
+ * - Uses the minimum start block when every input range has a start block
1268
+ * - Uses the maximum end block when every input range has an end block
1269
+ * - Leaves a side unbounded when any input range is unbounded on that side
1269
1270
  *
1270
1271
  * Returns an unbounded range if no ranges are provided.
1271
1272
  *
package/dist/index.js CHANGED
@@ -904,18 +904,29 @@ function mergeBlockNumberRanges(...ranges) {
904
904
  }
905
905
  let minStartBlock;
906
906
  let maxEndBlock;
907
+ let hasUnboundedStart = false;
908
+ let hasUnboundedEnd = false;
907
909
  for (const range of ranges) {
908
- if (range.startBlock !== void 0) {
909
- if (minStartBlock === void 0 || range.startBlock < minStartBlock) {
910
- minStartBlock = range.startBlock;
911
- }
910
+ if (range.startBlock === void 0) {
911
+ hasUnboundedStart = true;
912
+ } else if (minStartBlock === void 0 || range.startBlock < minStartBlock) {
913
+ minStartBlock = range.startBlock;
912
914
  }
913
- if (range.endBlock !== void 0) {
914
- if (maxEndBlock === void 0 || range.endBlock > maxEndBlock) {
915
- maxEndBlock = range.endBlock;
916
- }
915
+ if (range.endBlock === void 0) {
916
+ hasUnboundedEnd = true;
917
+ } else if (maxEndBlock === void 0 || range.endBlock > maxEndBlock) {
918
+ maxEndBlock = range.endBlock;
919
+ }
920
+ if (hasUnboundedStart && hasUnboundedEnd) {
921
+ return buildBlockNumberRange(void 0, void 0);
917
922
  }
918
923
  }
924
+ if (hasUnboundedStart) {
925
+ minStartBlock = void 0;
926
+ }
927
+ if (hasUnboundedEnd) {
928
+ maxEndBlock = void 0;
929
+ }
919
930
  return buildBlockNumberRange(minStartBlock, maxEndBlock);
920
931
  }
921
932
  function buildBlockRefRange(startBlock, endBlock) {