@xyo-network/xl1-protocol-sdk 2.1.4 → 2.1.6

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.
Files changed (33) hide show
  1. package/dist/neutral/CreatableProvider/AbstractCreatableProvider.d.ts +1 -0
  2. package/dist/neutral/CreatableProvider/AbstractCreatableProvider.d.ts.map +1 -1
  3. package/dist/neutral/config/Actor.d.ts +6 -0
  4. package/dist/neutral/config/Actor.d.ts.map +1 -1
  5. package/dist/neutral/config/Actors.d.ts +1 -0
  6. package/dist/neutral/config/Actors.d.ts.map +1 -1
  7. package/dist/neutral/config/Base.d.ts +1 -0
  8. package/dist/neutral/config/Base.d.ts.map +1 -1
  9. package/dist/neutral/config/Config.d.ts +4 -0
  10. package/dist/neutral/config/Config.d.ts.map +1 -1
  11. package/dist/neutral/config/HostActor.d.ts +6 -0
  12. package/dist/neutral/config/HostActor.d.ts.map +1 -1
  13. package/dist/neutral/config/storage/Storage.d.ts +1 -0
  14. package/dist/neutral/config/storage/Storage.d.ts.map +1 -1
  15. package/dist/neutral/config/storage/driver/R2.d.ts +1 -0
  16. package/dist/neutral/config/storage/driver/R2.d.ts.map +1 -1
  17. package/dist/neutral/context/Actor.d.ts +6 -0
  18. package/dist/neutral/context/Actor.d.ts.map +1 -1
  19. package/dist/neutral/context/HostActor.d.ts +6 -0
  20. package/dist/neutral/context/HostActor.d.ts.map +1 -1
  21. package/dist/neutral/getFileConfig.d.ts +2 -0
  22. package/dist/neutral/getFileConfig.d.ts.map +1 -1
  23. package/dist/neutral/getFileConfig.mjs +5 -0
  24. package/dist/neutral/getFileConfig.mjs.map +2 -2
  25. package/dist/neutral/index.mjs +21 -17
  26. package/dist/neutral/index.mjs.map +3 -3
  27. package/dist/neutral/model/CreatableProviderContext.zod.d.ts +6 -0
  28. package/dist/neutral/model/CreatableProviderContext.zod.d.ts.map +1 -1
  29. package/dist/neutral/summary/primitives/schemas/schemasMaxStep.d.ts +1 -1
  30. package/dist/neutral/summary/primitives/schemas/schemasMaxStep.d.ts.map +1 -1
  31. package/dist/neutral/test/index.mjs +5 -0
  32. package/dist/neutral/test/index.mjs.map +2 -2
  33. package/package.json +9 -9
@@ -1398,6 +1398,11 @@ var R2ConfigZod = z13.object({
1398
1398
  title: "storage.r2.chainStateBucket",
1399
1399
  type: "string"
1400
1400
  }),
1401
+ indexBucket: z13.string().nonempty().optional().register(globalRegistry9, {
1402
+ description: "Cloudflare R2 bucket for the chain index (the step-summary families); defaults to `bucket` when unset",
1403
+ title: "storage.r2.indexBucket",
1404
+ type: "string"
1405
+ }),
1401
1406
  prefix: z13.string().nonempty().optional().register(globalRegistry9, {
1402
1407
  description: "Optional key prefix namespacing this store within the bucket",
1403
1408
  title: "storage.r2.prefix",
@@ -3581,7 +3586,7 @@ import {
3581
3586
  BlockViewerMoniker,
3582
3587
  isChainQualifiedHeadConfig as isChainQualifiedHeadConfig4,
3583
3588
  isChainQualifiedRangeConfig as isChainQualifiedRangeConfig4,
3584
- StepSizes as StepSizes13,
3589
+ StepSizes as StepSizes12,
3585
3590
  TransferSchema as TransferSchema2
3586
3591
  } from "@xyo-network/xl1-protocol-lib";
3587
3592
  import { Semaphore } from "async-mutex";
@@ -3803,8 +3808,7 @@ async function blocksStepSummaryFromRange(context, semaphores, blockViewer, summ
3803
3808
  }
3804
3809
 
3805
3810
  // src/summary/primitives/schemas/schemasMaxStep.ts
3806
- import { StepSizes as StepSizes10 } from "@xyo-network/xl1-protocol-lib";
3807
- var schemasMaxStep = StepSizes10.length - 1;
3811
+ var schemasMaxStep = 5;
3808
3812
 
3809
3813
  // src/summary/primitives/schemas/schemasStepSummaryFromRange.ts
3810
3814
  import { assertEx as assertEx29 } from "@xylabs/sdk-js";
@@ -3814,7 +3818,7 @@ import {
3814
3818
  isHashMeta,
3815
3819
  PayloadBuilder as PayloadBuilder17
3816
3820
  } from "@xyo-network/sdk-js";
3817
- import { StepSizes as StepSizes11 } from "@xyo-network/xl1-protocol-lib";
3821
+ import { StepSizes as StepSizes10 } from "@xyo-network/xl1-protocol-lib";
3818
3822
  async function schemasStepSummaryFromRange(context, semaphores, blockViewer, summaryMap, range) {
3819
3823
  const [frameHead] = assertEx29(await blockViewer.blockByNumber(range[1]), () => `Block not found for number: ${range[1]}`);
3820
3824
  const frameSize = range[1] - range[0] + 1;
@@ -3836,8 +3840,8 @@ async function schemasStepSummaryFromRange(context, semaphores, blockViewer, sum
3836
3840
  schemas
3837
3841
  });
3838
3842
  } else {
3839
- const step = StepSizes11.indexOf(frameSize);
3840
- assertEx29(step !== -1, () => `Invalid step size: ${frameSize}. Must be one of ${StepSizes11.join(", ")}`);
3843
+ const step = StepSizes10.indexOf(frameSize);
3844
+ assertEx29(step !== -1, () => `Invalid step size: ${frameSize}. Must be one of ${StepSizes10.join(", ")}`);
3841
3845
  const summaryResult = await summaryMap.get(`${frameHead._hash}|${frameSize}`);
3842
3846
  if (isAnyPayload5(summaryResult)) {
3843
3847
  result = summaryResult;
@@ -3911,7 +3915,7 @@ var transfersMaxStep = 4;
3911
3915
  // src/summary/primitives/transfers/transfersStepSummaryFromRange.ts
3912
3916
  import { assertEx as assertEx31, spanRootAsync as spanRootAsync6 } from "@xylabs/sdk-js";
3913
3917
  import { isAnyPayload as isAnyPayload6 } from "@xyo-network/sdk-js";
3914
- import { asXL1BlockNumber as asXL1BlockNumber7, StepSizes as StepSizes12 } from "@xyo-network/xl1-protocol-lib";
3918
+ import { asXL1BlockNumber as asXL1BlockNumber7, StepSizes as StepSizes11 } from "@xyo-network/xl1-protocol-lib";
3915
3919
  function transfersSummaryKey(frameHeadHash, frameSize) {
3916
3920
  return `${frameHeadHash}|${frameSize}`;
3917
3921
  }
@@ -3938,8 +3942,8 @@ async function transfersStepSummaryFromRange(context, semaphores, blockViewer, s
3938
3942
  transfers
3939
3943
  };
3940
3944
  } else {
3941
- const step = StepSizes12.indexOf(asXL1BlockNumber7(frameSize, true));
3942
- assertEx31(step !== -1, () => `Invalid step size: ${frameSize}. Must be one of ${StepSizes12.join(", ")}`);
3945
+ const step = StepSizes11.indexOf(asXL1BlockNumber7(frameSize, true));
3946
+ assertEx31(step !== -1, () => `Invalid step size: ${frameSize}. Must be one of ${StepSizes11.join(", ")}`);
3943
3947
  const key = transfersSummaryKey(frameHead._hash, frameSize);
3944
3948
  const summaryResult = await summaryMap.get(key);
3945
3949
  if (isAnyPayload6(summaryResult)) {
@@ -4027,9 +4031,9 @@ async function transfersSummary(context, semaphores, blockViewer, summaryMap, co
4027
4031
  // src/simple/accountBalance/SimpleAccountBalanceViewer.ts
4028
4032
  var SimpleAccountBalanceViewer = class extends AbstractCreatableProvider {
4029
4033
  moniker = SimpleAccountBalanceViewer.defaultMoniker;
4030
- _balanceStepSemaphores = StepSizes13.map(() => new Semaphore(20));
4034
+ _balanceStepSemaphores = StepSizes12.map(() => new Semaphore(20));
4031
4035
  _blockViewer;
4032
- _transferStepSemaphores = StepSizes13.map(() => new Semaphore(20));
4036
+ _transferStepSemaphores = StepSizes12.map(() => new Semaphore(20));
4033
4037
  get balancesSummaryMap() {
4034
4038
  return this.params.balancesSummaryMap;
4035
4039
  }
@@ -4150,7 +4154,7 @@ var SimpleAccountBalanceViewer = class extends AbstractCreatableProvider {
4150
4154
  }
4151
4155
  async distillTransferHistory(address, range, max = 50) {
4152
4156
  return await this.spanAsync("distillTransferHistory", async () => {
4153
- if (range[1] - range[0] <= StepSizes13[0] || max <= 1) {
4157
+ if (range[1] - range[0] <= StepSizes12[0] || max <= 1) {
4154
4158
  return Array.from({ length: range[1] - range[0] + 1 }, (_, i) => range[1] - i).slice(0, max).map((n) => asXL1BlockNumber8(n, true));
4155
4159
  }
4156
4160
  const frames = deepCalculateFramesFromRange(asXL1BlockRange10(range, true), transfersMaxStep);
@@ -4165,7 +4169,7 @@ var SimpleAccountBalanceViewer = class extends AbstractCreatableProvider {
4165
4169
  });
4166
4170
  const resultBlockNumbers = /* @__PURE__ */ new Set();
4167
4171
  for (const [frame] of sortedTransferSummaryPairs) {
4168
- if (frame[1] - frame[0] + 1 > StepSizes13[0]) {
4172
+ if (frame[1] - frame[0] + 1 > StepSizes12[0]) {
4169
4173
  const values = await this.distillTransferHistory(address, asXL1BlockRange10([frame[0], frame[1] - 1], true), max - resultBlockNumbers.size);
4170
4174
  for (const value of values) {
4171
4175
  resultBlockNumbers.add(value);
@@ -4239,7 +4243,7 @@ import {
4239
4243
  BlockViewerMoniker as BlockViewerMoniker2,
4240
4244
  FinalizationViewerMoniker,
4241
4245
  stepSize as stepSize2,
4242
- StepSizes as StepSizes14
4246
+ StepSizes as StepSizes13
4243
4247
  } from "@xyo-network/xl1-protocol-lib";
4244
4248
  import { Semaphore as Semaphore2 } from "async-mutex";
4245
4249
 
@@ -4283,7 +4287,7 @@ var SimpleBlockViewer = class extends AbstractCreatableProvider {
4283
4287
  finalizationViewer;
4284
4288
  payloadCache = new LruCacheMap2({ max: 1e4 });
4285
4289
  signedHydratedBlockWithHashMetaCache = new LruCacheMap2({ max: 2e3, ttl: 1e3 * 60 * 60 });
4286
- _blockStepSemaphores = StepSizes14.map(() => new Semaphore2(20));
4290
+ _blockStepSemaphores = StepSizes13.map(() => new Semaphore2(20));
4287
4291
  _blocksSummaryMap;
4288
4292
  _headPollHash;
4289
4293
  _headPollInProgress = false;
@@ -6992,7 +6996,7 @@ import {
6992
6996
  isBlockBoundWitness,
6993
6997
  rewardAddressFromStepIdentity,
6994
6998
  StepRewardFractions,
6995
- StepSizes as StepSizes15,
6999
+ StepSizes as StepSizes14,
6996
7000
  XL1_PROTOCOL_VERSION,
6997
7001
  XYO_STEP_REWARD_ADDRESS as XYO_STEP_REWARD_ADDRESS3,
6998
7002
  XYO_ZERO_ADDRESS as XYO_ZERO_ADDRESS2
@@ -7074,7 +7078,7 @@ async function buildBlock(options) {
7074
7078
  }
7075
7079
  }
7076
7080
  const completedStepRewardTransfers = [];
7077
- for (const [i, step] of StepSizes15.entries()) {
7081
+ for (const [i, step] of StepSizes14.entries()) {
7078
7082
  if (blockNumber < step) {
7079
7083
  break;
7080
7084
  }