@xyo-network/xl1-protocol-sdk 1.30.3 → 1.30.4

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.
@@ -201,37 +201,132 @@ var blockPayloadsFromHydratedBlock = (block) => {
201
201
  };
202
202
 
203
203
  // src/block/hydrate/BoundWitnessHydrator.ts
204
- import { assertEx as assertEx3 } from "@xylabs/sdk-js";
205
204
  import {
206
- isAnyPayload,
207
- isBoundWitness,
208
- PayloadBuilder
209
- } from "@xyo-network/sdk-js";
205
+ assertEx as assertEx4,
206
+ isDefined,
207
+ isUndefined as isUndefined3
208
+ } from "@xylabs/sdk-js";
209
+ import { isBoundWitness, PayloadBuilder as PayloadBuilder2 } from "@xyo-network/sdk-js";
210
210
  import { LRUCache } from "lru-cache";
211
- var DEFAULT_CACHE_MAX = 5e3;
212
- var DEFAULT_CACHE_TTL = Number.MAX_SAFE_INTEGER;
213
- var BoundWitnessHydrator = class {
214
- asBoundWitness;
215
- asHydrated;
211
+
212
+ // src/primitives/datalake/addDataLakePayloadsToPayloads.ts
213
+ import { isUndefined } from "@xylabs/sdk-js";
214
+ import { isAnyPayload, PayloadBuilder } from "@xyo-network/sdk-js";
215
+ async function addDataLakePayloadsToPayloads(hashes, payloads, dataLakeViewer) {
216
+ if (isUndefined(dataLakeViewer)) return [payloads, []];
217
+ const missingPayloadHashes = hashes.filter((hash) => !payloads.some((p) => p._hash === hash));
218
+ const payloadsFromDataLake = await PayloadBuilder.addHashMeta(
219
+ await PayloadBuilder.addHashMeta((await dataLakeViewer.get(missingPayloadHashes)).filter(isAnyPayload))
220
+ );
221
+ return [[...payloads, ...payloadsFromDataLake], payloadsFromDataLake.map((p) => p._hash)];
222
+ }
223
+
224
+ // src/primitives/datalake/addDataLakePayloads.ts
225
+ async function addDataLakePayloads([boundWitness, payloads], dataLakeViewer) {
226
+ const [updatedPayloads, foundHashes] = await addDataLakePayloadsToPayloads(boundWitness.payload_hashes, payloads, dataLakeViewer);
227
+ return [
228
+ [
229
+ boundWitness,
230
+ updatedPayloads
231
+ ],
232
+ foundHashes
233
+ ];
234
+ }
235
+
236
+ // src/primitives/datalake/PayloadLocator.ts
237
+ import { assertEx as assertEx3, isUndefined as isUndefined2 } from "@xylabs/sdk-js";
238
+ import { isAnyPayload as isAnyPayload2 } from "@xyo-network/sdk-js";
239
+ var PayloadLocator = class {
216
240
  datalakes;
217
- isNestedBoundWitness;
218
- payloadCache;
219
- sourceCache;
220
241
  /**
221
242
  * @throws if `params.datalakes` is empty. Required at construction to fail fast on misconfig.
222
- * The only zero-datalake hydrate calls that would succeed anyway are degenerate (maxDepth=0
223
- * or a BW with empty payload_hashes) — not load-bearing enough to justify loosening the guard.
224
- * If lifecycle ordering ever requires construction before sources are wired, prefer adding
225
- * an `addDatalake()` mutator over removing this assertion.
243
+ * The only zero-datalake calls that wouldn't already throw are degenerate (no hashes input),
244
+ * not load-bearing enough to justify loosening the guard.
226
245
  */
227
246
  constructor(params) {
228
- assertEx3(params.datalakes.length > 0, () => "BoundWitnessHydrator requires at least one datalake");
247
+ assertEx3(params.datalakes.length > 0, () => "PayloadLocator requires at least one datalake");
229
248
  const seen = /* @__PURE__ */ new Set();
230
249
  for (const dl of params.datalakes) {
231
250
  assertEx3(!seen.has(dl.name), () => `Duplicate datalake name: ${dl.name}`);
232
251
  seen.add(dl.name);
233
252
  }
234
253
  this.datalakes = params.datalakes;
254
+ }
255
+ async findAll(input) {
256
+ if (typeof input === "string") {
257
+ const m = await this.findAllBatch([input]);
258
+ return m.get(input) ?? [];
259
+ }
260
+ return await this.findAllBatch(input);
261
+ }
262
+ async findFirst(input) {
263
+ if (typeof input === "string") {
264
+ const m = await this.findFirstBatch([input]);
265
+ return m.get(input);
266
+ }
267
+ return await this.findFirstBatch(input);
268
+ }
269
+ /** Fetch a single hash from a single datalake, filtering non-Payload entries. */
270
+ async fetchOne(dl, hash) {
271
+ const arr = await dl.viewer.get([hash]);
272
+ for (const item of arr) {
273
+ if (isAnyPayload2(item)) return item;
274
+ }
275
+ return void 0;
276
+ }
277
+ async findAllBatch(hashes) {
278
+ const result = /* @__PURE__ */ new Map();
279
+ if (hashes.length === 0) return result;
280
+ const buckets = hashes.map(() => []);
281
+ for (const dl of this.datalakes) {
282
+ const fetched = await Promise.all(hashes.map(async (h) => await this.fetchOne(dl, h)));
283
+ for (const [i, p] of fetched.entries()) {
284
+ if (isUndefined2(p)) continue;
285
+ buckets[i].push({ payload: p, source: dl.name });
286
+ }
287
+ }
288
+ for (const [i, h] of hashes.entries()) result.set(h, buckets[i]);
289
+ return result;
290
+ }
291
+ async findFirstBatch(hashes) {
292
+ const result = /* @__PURE__ */ new Map();
293
+ if (hashes.length === 0) return result;
294
+ const remaining = new Set(hashes);
295
+ for (const dl of this.datalakes) {
296
+ if (remaining.size === 0) break;
297
+ const needHashes = [];
298
+ for (const h of hashes) if (remaining.has(h)) needHashes.push(h);
299
+ const fetched = await Promise.all(needHashes.map(async (h) => await this.fetchOne(dl, h)));
300
+ for (const [i, h] of needHashes.entries()) {
301
+ const p = fetched[i];
302
+ if (isUndefined2(p)) continue;
303
+ result.set(h, { payload: p, source: dl.name });
304
+ remaining.delete(h);
305
+ }
306
+ }
307
+ return result;
308
+ }
309
+ };
310
+
311
+ // src/block/hydrate/BoundWitnessHydrator.ts
312
+ var DEFAULT_CACHE_MAX = 5e3;
313
+ var DEFAULT_CACHE_TTL = Number.MAX_SAFE_INTEGER;
314
+ var BoundWitnessHydrator = class {
315
+ asBoundWitness;
316
+ asHydrated;
317
+ isNestedBoundWitness;
318
+ locator;
319
+ payloadCache;
320
+ sourceCache;
321
+ /**
322
+ * @throws if `params.datalakes` is empty (propagated from PayloadLocator). Required at construction
323
+ * to fail fast on misconfig. The only zero-datalake hydrate calls that would succeed anyway are
324
+ * degenerate (maxDepth=0 or a BW with empty payload_hashes) — not load-bearing enough to justify
325
+ * loosening the guard. If lifecycle ordering ever requires construction before sources are wired,
326
+ * prefer adding an `addDatalake()` mutator over removing this assertion.
327
+ */
328
+ constructor(params) {
329
+ this.locator = new PayloadLocator({ datalakes: params.datalakes });
235
330
  this.asBoundWitness = params.asBoundWitness;
236
331
  this.asHydrated = params.asHydrated;
237
332
  this.isNestedBoundWitness = params.isNestedBoundWitness ?? isBoundWitness;
@@ -269,11 +364,11 @@ var BoundWitnessHydrator = class {
269
364
  const fetched = await this.fetchByHashes(bw.payload_hashes, sources);
270
365
  if (minDepth >= 1) {
271
366
  const missing = bw.payload_hashes.filter((h) => !fetched.has(h));
272
- assertEx3(missing.length === 0, () => `Unable to find all payloads for BoundWitness: missing ${missing.join(", ")}`);
367
+ assertEx4(missing.length === 0, () => `Unable to find all payloads for BoundWitness: missing ${missing.join(", ")}`);
273
368
  }
274
369
  for (const h of bw.payload_hashes) {
275
370
  const p = fetched.get(h);
276
- if (p === void 0 || orderedHashes.has(h)) continue;
371
+ if (isUndefined3(p) || orderedHashes.has(h)) continue;
277
372
  orderedHashes.add(h);
278
373
  orderedPayloads.push(p);
279
374
  }
@@ -289,73 +384,56 @@ var BoundWitnessHydrator = class {
289
384
  const fetched = await this.fetchByHashes(nestedHashes, sources);
290
385
  if (minDepth >= 2) {
291
386
  const missing = nestedHashes.filter((h) => !fetched.has(h));
292
- assertEx3(missing.length === 0, () => `Unable to find all nested payloads for BoundWitness: missing ${missing.join(", ")}`);
387
+ assertEx4(missing.length === 0, () => `Unable to find all nested payloads for BoundWitness: missing ${missing.join(", ")}`);
293
388
  }
294
389
  for (const h of nestedHashes) {
295
390
  const p = fetched.get(h);
296
- if (p === void 0 || orderedHashes.has(h)) continue;
391
+ if (isUndefined3(p) || orderedHashes.has(h)) continue;
297
392
  orderedHashes.add(h);
298
393
  orderedPayloads.push(p);
299
394
  }
300
395
  }
301
396
  async fetchByHash(hash, sources) {
302
397
  const cached = this.payloadCache.get(hash);
303
- if (cached !== void 0) {
398
+ if (isDefined(cached)) {
304
399
  const cachedSource = this.sourceCache.get(hash);
305
- if (cachedSource !== void 0) sources.set(hash, cachedSource);
400
+ if (isDefined(cachedSource)) sources.set(hash, cachedSource);
306
401
  return cached;
307
402
  }
308
- for (const dl of this.datalakes) {
309
- const results = await dl.viewer.get([hash]);
310
- for (const data of results) {
311
- if (!isAnyPayload(data)) continue;
312
- this.payloadCache.set(hash, data);
313
- this.sourceCache.set(hash, dl.name);
314
- sources.set(hash, dl.name);
315
- return data;
316
- }
317
- }
318
- return void 0;
403
+ const located = await this.locator.findFirst(hash);
404
+ if (isUndefined3(located)) return void 0;
405
+ this.payloadCache.set(hash, located.payload);
406
+ this.sourceCache.set(hash, located.source);
407
+ sources.set(hash, located.source);
408
+ return located.payload;
319
409
  }
320
410
  async fetchByHashes(hashes, sources) {
321
411
  const result = /* @__PURE__ */ new Map();
322
- const remaining = /* @__PURE__ */ new Set();
412
+ const remaining = [];
323
413
  for (const h of hashes) {
324
414
  const cached = this.payloadCache.get(h);
325
- if (cached === void 0) {
326
- remaining.add(h);
415
+ if (isUndefined3(cached)) {
416
+ remaining.push(h);
327
417
  continue;
328
418
  }
329
419
  result.set(h, cached);
330
420
  const cachedSource = this.sourceCache.get(h);
331
- if (cachedSource !== void 0) sources.set(h, cachedSource);
421
+ if (isDefined(cachedSource)) sources.set(h, cachedSource);
332
422
  }
333
- for (const dl of this.datalakes) {
334
- if (remaining.size === 0) break;
335
- const needHashes = [...remaining];
336
- const fetched = await Promise.all(needHashes.map(async (h) => {
337
- const arr = await dl.viewer.get([h]);
338
- for (const item of arr) {
339
- if (isAnyPayload(item)) return item;
340
- }
341
- return void 0;
342
- }));
343
- for (const [i, h] of needHashes.entries()) {
344
- const p = fetched[i];
345
- if (p === void 0) continue;
346
- result.set(h, p);
347
- this.payloadCache.set(h, p);
348
- this.sourceCache.set(h, dl.name);
349
- sources.set(h, dl.name);
350
- remaining.delete(h);
351
- }
423
+ if (remaining.length === 0) return result;
424
+ const located = await this.locator.findFirst(remaining);
425
+ for (const [h, { payload, source }] of located) {
426
+ result.set(h, payload);
427
+ this.payloadCache.set(h, payload);
428
+ this.sourceCache.set(h, source);
429
+ sources.set(h, source);
352
430
  }
353
431
  return result;
354
432
  }
355
433
  async hydrateInternal(input, maxDepth, minDepth) {
356
- assertEx3(maxDepth >= 0 && maxDepth <= 2, () => `maxDepth must be 0, 1, or 2 (got ${maxDepth})`);
357
- assertEx3(minDepth >= 0 && minDepth <= 2, () => `minDepth must be 0, 1, or 2 (got ${minDepth})`);
358
- assertEx3(maxDepth >= minDepth, () => `maxDepth (${maxDepth}) must be >= minDepth (${minDepth})`);
434
+ assertEx4(maxDepth >= 0 && maxDepth <= 2, () => `maxDepth must be 0, 1, or 2 (got ${maxDepth})`);
435
+ assertEx4(minDepth >= 0 && minDepth <= 2, () => `minDepth must be 0, 1, or 2 (got ${minDepth})`);
436
+ assertEx4(maxDepth >= minDepth, () => `maxDepth (${maxDepth}) must be >= minDepth (${minDepth})`);
359
437
  const sources = /* @__PURE__ */ new Map();
360
438
  const bw = await this.resolveBoundWitness(input, sources);
361
439
  if (maxDepth === 0) {
@@ -371,13 +449,13 @@ var BoundWitnessHydrator = class {
371
449
  }
372
450
  async resolveBoundWitness(input, sources) {
373
451
  if (typeof input === "string") {
374
- const fetched = assertEx3(
452
+ const fetched = assertEx4(
375
453
  await this.fetchByHash(input, sources),
376
454
  () => `BoundWitness ${input} not found in any datalake`
377
455
  );
378
456
  return this.asBoundWitness(fetched, true);
379
457
  }
380
- const withMeta = "_hash" in input ? input : await PayloadBuilder.addStorageMeta(input);
458
+ const withMeta = "_hash" in input ? input : await PayloadBuilder2.addStorageMeta(input);
381
459
  return this.asBoundWitness(withMeta, true);
382
460
  }
383
461
  };
@@ -445,30 +523,30 @@ var unflattenHydratedBlock = (flattened) => toHydratedBlock(tryUnflattenHydrated
445
523
  var flattenHydratedBlocks = (hydratedBlocks) => hydratedBlocks.flatMap((blk) => flattenHydratedBlock(blk));
446
524
 
447
525
  // src/block/hydrate/hydrateBlock.ts
448
- import { assertEx as assertEx4 } from "@xylabs/sdk-js";
526
+ import { assertEx as assertEx5 } from "@xylabs/sdk-js";
449
527
  import { asAnyPayload } from "@xyo-network/sdk-js";
450
528
  import { asBlockBoundWitnessWithStorageMeta as asBlockBoundWitnessWithStorageMeta2, isTransactionBoundWitnessWithStorageMeta } from "@xyo-network/xl1-protocol-lib";
451
529
  var hydrateBlock = async (context, hash, maxDepth = 1, minDepth = maxDepth) => {
452
- assertEx4(maxDepth >= 0, () => "maxDepth must be greater than or equal to 0");
453
- assertEx4(minDepth >= 0, () => "minDepth must be greater than or equal to 0");
454
- assertEx4(maxDepth >= minDepth, () => "maxDepth must be greater than or equal to minDepth");
530
+ assertEx5(maxDepth >= 0, () => "maxDepth must be greater than or equal to 0");
531
+ assertEx5(minDepth >= 0, () => "minDepth must be greater than or equal to 0");
532
+ assertEx5(maxDepth >= minDepth, () => "maxDepth must be greater than or equal to minDepth");
455
533
  const { chainMap } = context;
456
534
  const [block] = await chainMap.get([hash]);
457
- const bw = assertEx4(asBlockBoundWitnessWithStorageMeta2(
458
- assertEx4(block, () => `block ${hash} not found`)
535
+ const bw = assertEx5(asBlockBoundWitnessWithStorageMeta2(
536
+ assertEx5(block, () => `block ${hash} not found`)
459
537
  ), () => `hash ${hash} is not a BlockBoundWitness`);
460
538
  if (maxDepth === 0) return [bw, []];
461
539
  const blkPayloads = (await chainMap.get(bw.payload_hashes)).map((p) => asAnyPayload(p, true));
462
- if (minDepth === 1) assertEx4(allHashesPresent(bw.payload_hashes, blkPayloads), () => `Unable to find all payloads for block ${hash}`);
540
+ if (minDepth === 1) assertEx5(allHashesPresent(bw.payload_hashes, blkPayloads), () => `Unable to find all payloads for block ${hash}`);
463
541
  if (maxDepth === 1) return [bw, blkPayloads];
464
542
  const transactions = blkPayloads.filter(isTransactionBoundWitnessWithStorageMeta);
465
543
  const transactionsPayloadHashes = transactions.flatMap((tx) => tx.payload_hashes);
466
544
  const transactionsPayloads = (await chainMap.get(transactionsPayloadHashes)).map((p) => asAnyPayload(p, true));
467
- assertEx4(allHashesPresent(transactionsPayloadHashes, transactionsPayloads), () => `Unable to find all payloads for transactions in block ${hash}`);
545
+ assertEx5(allHashesPresent(transactionsPayloadHashes, transactionsPayloads), () => `Unable to find all payloads for transactions in block ${hash}`);
468
546
  const allPayloadsHashes = new Set([...blkPayloads, ...transactionsPayloads].flatMap((p) => p._hash));
469
547
  const allPayloads = (await chainMap.get([...allPayloadsHashes])).map((p) => asAnyPayload(p, true));
470
548
  const allPayloadsFiltered = allPayloads.filter((p) => allPayloadsHashes.has(p._hash));
471
- if (maxDepth === 2) assertEx4(allHashesPresent(
549
+ if (maxDepth === 2) assertEx5(allHashesPresent(
472
550
  [...allPayloadsHashes],
473
551
  allPayloadsFiltered
474
552
  ), () => `Unable to find all payloads for transactions in block ${hash}`);
@@ -482,10 +560,10 @@ var transactionsFromHydratedBlock = (block) => {
482
560
  };
483
561
 
484
562
  // src/block/hydrate/tryHydrateBlock.ts
485
- import { assertEx as assertEx5 } from "@xylabs/sdk-js";
563
+ import { assertEx as assertEx6 } from "@xylabs/sdk-js";
486
564
  import { isBlockBoundWitnessWithStorageMeta, isTransactionBoundWitnessWithStorageMeta as isTransactionBoundWitnessWithStorageMeta2 } from "@xyo-network/xl1-protocol-lib";
487
565
  var tryHydrateBlock = async (archivist, hash, maxDepth = 1) => {
488
- assertEx5(maxDepth >= 0, () => "maxDepth must be greater than or equal to 0");
566
+ assertEx6(maxDepth >= 0, () => "maxDepth must be greater than or equal to 0");
489
567
  const bw = (await archivist.get([hash])).find(isBlockBoundWitnessWithStorageMeta);
490
568
  if (!bw) return void 0;
491
569
  if (maxDepth === 0) return [bw, []];
@@ -503,7 +581,7 @@ var tryHydrateBlock = async (archivist, hash, maxDepth = 1) => {
503
581
  // src/block/primitives/blockFromBlockNumber.ts
504
582
  import {
505
583
  asHash,
506
- isDefined as isDefined3,
584
+ isDefined as isDefined4,
507
585
  spanAsync
508
586
  } from "@xylabs/sdk-js";
509
587
  import { toSafeJsonString } from "@xylabs/sdk-js";
@@ -515,9 +593,9 @@ import {
515
593
 
516
594
  // src/ChainContextHelpers.ts
517
595
  import {
518
- isDefined as isDefined2,
596
+ isDefined as isDefined3,
519
597
  isObject,
520
- isUndefined,
598
+ isUndefined as isUndefined4,
521
599
  timeBudget
522
600
  } from "@xylabs/sdk-js";
523
601
 
@@ -561,7 +639,7 @@ var LruCacheMap = class {
561
639
  };
562
640
 
563
641
  // src/driver/memory/MemoryMap.ts
564
- import { isDefined } from "@xylabs/sdk-js";
642
+ import { isDefined as isDefined2 } from "@xylabs/sdk-js";
565
643
  var MemoryMap = class {
566
644
  map;
567
645
  constructor() {
@@ -580,7 +658,7 @@ var MemoryMap = class {
580
658
  const results = [];
581
659
  for (const id of ids) {
582
660
  const data = this.map.get(id);
583
- if (isDefined(data)) {
661
+ if (isDefined2(data)) {
584
662
  results.push(data);
585
663
  }
586
664
  }
@@ -604,7 +682,7 @@ function contextCache(context, name, create) {
604
682
  if (!isObject(context.caches)) {
605
683
  throw new Error("Context does not have an appropriate caches property");
606
684
  }
607
- if (isUndefined(context.caches[name])) {
685
+ if (isUndefined4(context.caches[name])) {
608
686
  context.caches[name] = create?.() ?? new MemoryMap();
609
687
  }
610
688
  return context.caches[name];
@@ -617,7 +695,7 @@ async function withContextCacheResponse(context, name, key, func, { max = 1e4 }
617
695
  );
618
696
  const { timeBudgetLimit = 0 } = context;
619
697
  const cacheResult = await cache.get(key);
620
- if (isDefined2(cacheResult)) {
698
+ if (isDefined3(cacheResult)) {
621
699
  return cacheResult;
622
700
  }
623
701
  const result = timeBudgetLimit > 0 ? timeBudget(name, context.logger, func, timeBudgetLimit) : func();
@@ -632,7 +710,7 @@ async function blockFromBlockNumber(context, blockNumber) {
632
710
  const { chainMap, head } = context;
633
711
  return await withContextCacheResponse(context, "blockFromBlockNumber", cacheKey, async () => {
634
712
  const [result] = await chainMap.get([head._hash]);
635
- if (!isDefined3(result)) {
713
+ if (!isDefined4(result)) {
636
714
  throw new Error(`Head block not found for hash: ${head._hash}`);
637
715
  }
638
716
  let currentBlock = asSignedBlockBoundWitnessWithStorageMeta(
@@ -655,7 +733,7 @@ async function blockFromBlockNumber(context, blockNumber) {
655
733
  const [newBlock] = await chainMap.get([
656
734
  asHash(jumpHash, () => `Jump hash not found for block number [${blockNumber}]: ${jumpBlockNumber} ${toSafeJsonString(currentBlock, 10)}`)
657
735
  ]);
658
- if (!isDefined3(newBlock)) {
736
+ if (!isDefined4(newBlock)) {
659
737
  throw new Error(`Block not found for jump hash: ${jumpHash}`);
660
738
  }
661
739
  currentBlock = asSignedBlockBoundWitnessWithStorageMeta(
@@ -746,12 +824,12 @@ function toStepIdentityString({ block, step }) {
746
824
 
747
825
  // src/block/primitives/validateTransactionOpcodes.ts
748
826
  import {
749
- assertEx as assertEx6,
827
+ assertEx as assertEx7,
750
828
  isHash,
751
829
  toSafeJsonString as toSafeJsonString2
752
830
  } from "@xylabs/sdk-js";
753
831
  import {
754
- PayloadBuilder as PayloadBuilder2
832
+ PayloadBuilder as PayloadBuilder3
755
833
  } from "@xyo-network/sdk-js";
756
834
  import { isExecutable } from "@xyo-network/xl1-protocol-lib";
757
835
  async function validateTransactionsOpcodes(txs) {
@@ -763,14 +841,14 @@ async function validateTransactionsOpcodes(txs) {
763
841
  switch (opCode) {
764
842
  case "elevate": {
765
843
  const [hash, ...rest] = args;
766
- const txPayloadsWithStorageMeta = await PayloadBuilder2.addStorageMeta(txPayloads);
767
- assertEx6(rest.length === 0, () => `Invalid elevate operation ${opCode} ${args.join(", ")} - Too many Arguments`);
844
+ const txPayloadsWithStorageMeta = await PayloadBuilder3.addStorageMeta(txPayloads);
845
+ assertEx7(rest.length === 0, () => `Invalid elevate operation ${opCode} ${args.join(", ")} - Too many Arguments`);
768
846
  if (isHash(hash)) {
769
- assertEx6(
847
+ assertEx7(
770
848
  txBw.payload_hashes.includes(hash),
771
849
  () => `Invalid elevate operation ${opCode} ${args.join(", ")} - Hash not in payload hashes => ${toSafeJsonString2(txBw, 20)}`
772
850
  );
773
- const txPayload = assertEx6(
851
+ const txPayload = assertEx7(
774
852
  txPayloadsWithStorageMeta.find((p) => p._hash === hash),
775
853
  () => `Invalid elevate operation ${opCode} ${args.join(", ")} - Payload not found`
776
854
  );
@@ -1241,11 +1319,11 @@ var RpcRemoteConfigZod = z11.union([HttpRpcRemoteConfigZod, PostMessageRpcRemote
1241
1319
  var RemoteConfigZod = z11.object({ rpc: RpcRemoteConfigZod.optional() }).describe("Configuration for remote connections, including RPC");
1242
1320
 
1243
1321
  // src/config/storage/driver/Mongo.ts
1244
- import { isDefined as isDefined4, isUndefined as isUndefined2 } from "@xylabs/sdk-js";
1322
+ import { isDefined as isDefined5, isUndefined as isUndefined5 } from "@xylabs/sdk-js";
1245
1323
  import { globalRegistry as globalRegistry8, z as z12 } from "zod";
1246
1324
  var hasMongoConfig = (config) => {
1247
- if (isUndefined2(config)) return false;
1248
- return isDefined4(config.connectionString) && isDefined4(config.database) && isDefined4(config.domain);
1325
+ if (isUndefined5(config)) return false;
1326
+ return isDefined5(config.connectionString) && isDefined5(config.database) && isDefined5(config.domain);
1249
1327
  };
1250
1328
  var MongoConfigZod = z12.object({
1251
1329
  // TODO: Create from other arguments
@@ -1348,11 +1426,11 @@ function blockRangeSteps(range, steps) {
1348
1426
  }
1349
1427
 
1350
1428
  // src/primitives/block/rate/blockRate.ts
1351
- import { isDefined as isDefined6, isFalsy } from "@xylabs/sdk-js";
1429
+ import { isDefined as isDefined7, isFalsy } from "@xylabs/sdk-js";
1352
1430
  import { asXL1BlockRange } from "@xyo-network/xl1-protocol-lib";
1353
1431
 
1354
1432
  // src/primitives/block/rate/timeHelpers.ts
1355
- import { assertEx as assertEx7, isDefined as isDefined5 } from "@xylabs/sdk-js";
1433
+ import { assertEx as assertEx8, isDefined as isDefined6 } from "@xylabs/sdk-js";
1356
1434
  var rateMultipliers = {
1357
1435
  millis: 1,
1358
1436
  seconds: 1e3,
@@ -1370,7 +1448,7 @@ var timeDurations = (timeInMs) => ({
1370
1448
  weeks: timeInMs / (1e3 * 60 * 60 * 24 * 7)
1371
1449
  });
1372
1450
  var getTimeConfigInMilliseconds = (timeConfig) => {
1373
- const assertedTimeConfig = assertEx7(isDefined5(timeConfig) ? timeConfig : void 0, () => "Time configuration must be provided");
1451
+ const assertedTimeConfig = assertEx8(isDefined6(timeConfig) ? timeConfig : void 0, () => "Time configuration must be provided");
1374
1452
  let totalMilliseconds = 0;
1375
1453
  if ("years" in assertedTimeConfig) {
1376
1454
  totalMilliseconds += assertedTimeConfig.years * 31536e6;
@@ -1409,13 +1487,13 @@ var blockRate = (startBlock, endBlock, timeUnit) => {
1409
1487
  throw new Error("Time difference must be greater than 0");
1410
1488
  }
1411
1489
  const rate = heightDifference / timeDifference;
1412
- const timeUnitValue = isDefined6(timeUnit) ? timeUnit : "millis";
1413
- const returnedTimeDifference = isDefined6(timeUnit) ? timeDurations(timeDifference)[timeUnit] : timeDifference;
1490
+ const timeUnitValue = isDefined7(timeUnit) ? timeUnit : "millis";
1491
+ const returnedTimeDifference = isDefined7(timeUnit) ? timeDurations(timeDifference)[timeUnit] : timeDifference;
1414
1492
  const timePerBlock = returnedTimeDifference / heightDifference;
1415
1493
  return {
1416
1494
  range: asXL1BlockRange([startingBlock.block, endingBlock.block], true),
1417
1495
  span: heightDifference,
1418
- rate: isDefined6(timeUnit) ? rate * rateMultipliers[timeUnit] : rate,
1496
+ rate: isDefined7(timeUnit) ? rate * rateMultipliers[timeUnit] : rate,
1419
1497
  timeUnit: timeUnitValue,
1420
1498
  timeDifference: returnedTimeDifference,
1421
1499
  timePerBlock
@@ -1443,7 +1521,7 @@ var calculateBlockRate = async (viewer, range, timeUnit) => {
1443
1521
  };
1444
1522
 
1445
1523
  // src/primitives/block/rate/stepRate.ts
1446
- import { assertEx as assertEx8 } from "@xylabs/sdk-js";
1524
+ import { assertEx as assertEx9 } from "@xylabs/sdk-js";
1447
1525
  import {
1448
1526
  asXL1BlockRange as asXL1BlockRange2,
1449
1527
  isValidStep,
@@ -1455,26 +1533,26 @@ var stepRate = async (viewer, start, step, count = 1, timeUnit) => {
1455
1533
  return await calculateBlockRate(viewer, range, timeUnit);
1456
1534
  };
1457
1535
  var calculateStepSizeRate = async (viewer, start, stepIndex, count = 1, timeUnit) => {
1458
- assertEx8(isValidStep(stepIndex), () => `Invalid step index: ${stepIndex}`);
1536
+ assertEx9(isValidStep(stepIndex), () => `Invalid step index: ${stepIndex}`);
1459
1537
  const step = StepSizes4[stepIndex];
1460
1538
  return await stepRate(viewer, start, step, count, timeUnit);
1461
1539
  };
1462
1540
 
1463
1541
  // src/primitives/block/rate/timeRate.ts
1464
1542
  import {
1465
- assertEx as assertEx9,
1466
- isDefined as isDefined7,
1543
+ assertEx as assertEx10,
1544
+ isDefined as isDefined8,
1467
1545
  isDefinedNotNull
1468
1546
  } from "@xylabs/sdk-js";
1469
1547
  import { asXL1BlockNumber as asXL1BlockNumber3, asXL1BlockRange as asXL1BlockRange3 } from "@xyo-network/xl1-protocol-lib";
1470
1548
  var DEFAULT_TOLERANCE_MS = 3e4;
1471
1549
  var DEFAULT_MAX_ATTEMPTS = 10;
1472
1550
  var calculateTimeRate = async (viewer, timeConfig, startBlockNumber, timeUnit, toleranceMs = DEFAULT_TOLERANCE_MS, maxAttempts = DEFAULT_MAX_ATTEMPTS) => {
1473
- assertEx9(Object.keys(timeConfig ?? {}).length === 1, () => "Only one time unit should be specified in timeConfig");
1551
+ assertEx10(Object.keys(timeConfig ?? {}).length === 1, () => "Only one time unit should be specified in timeConfig");
1474
1552
  const startBlock = isDefinedNotNull(startBlockNumber) ? await viewer.blockByNumber(startBlockNumber) : null;
1475
1553
  const resolvedStartBlock = isDefinedNotNull(startBlock) ? startBlock[0] : (await viewer.currentBlock())[0];
1476
1554
  const timeInMilliseconds = getTimeConfigInMilliseconds(timeConfig);
1477
- assertEx9(timeInMilliseconds > 0, () => "Time duration must be greater than zero");
1555
+ assertEx10(timeInMilliseconds > 0, () => "Time duration must be greater than zero");
1478
1556
  const blocksPerMillisecondRate = 1 / (12 * 1e3);
1479
1557
  const initialBlocksInDuration = Math.floor(blocksPerMillisecondRate * timeInMilliseconds);
1480
1558
  const endBlockNumber = await findEndBlockRecursive(
@@ -1492,15 +1570,15 @@ var calculateTimeRate = async (viewer, timeConfig, startBlockNumber, timeUnit, t
1492
1570
  );
1493
1571
  };
1494
1572
  var findEndBlockRecursive = async (viewer, startBlock, targetTimeMs, estimatedBlocksBack, toleranceMs, attemptsRemaining) => {
1495
- assertEx9(attemptsRemaining >= 0, () => "Maximum attempts reached while searching for end block");
1573
+ assertEx10(attemptsRemaining >= 0, () => "Maximum attempts reached while searching for end block");
1496
1574
  const startBlockEpoch = startBlock.$epoch;
1497
1575
  const estimatedEndBlockNumber = asXL1BlockNumber3(startBlock.block - estimatedBlocksBack, true);
1498
1576
  if (estimatedEndBlockNumber < 0) {
1499
1577
  throw new Error("Estimated end block number is less than zero");
1500
1578
  }
1501
1579
  const endBlock = await viewer.blockByNumber(estimatedEndBlockNumber);
1502
- const resolvedEndBlock = assertEx9(
1503
- isDefined7(endBlock?.[0]) ? endBlock[0] : void 0,
1580
+ const resolvedEndBlock = assertEx10(
1581
+ isDefined8(endBlock?.[0]) ? endBlock[0] : void 0,
1504
1582
  () => `Could not retrieve block ${estimatedEndBlockNumber} for time rate calculation`
1505
1583
  );
1506
1584
  const endBlockEpoch = resolvedEndBlock.$epoch;
@@ -1536,8 +1614,8 @@ var findEndBlockRecursive = async (viewer, startBlock, targetTimeMs, estimatedBl
1536
1614
 
1537
1615
  // src/primitives/chain/getWindowedChain.ts
1538
1616
  import {
1539
- assertEx as assertEx10,
1540
- isDefined as isDefined8,
1617
+ assertEx as assertEx11,
1618
+ isDefined as isDefined9,
1541
1619
  isNull,
1542
1620
  spanRootAsync
1543
1621
  } from "@xylabs/sdk-js";
@@ -1551,14 +1629,14 @@ async function getWindowedChain(context, blockViewer, maxWindowSize, previousCha
1551
1629
  while (currentBlock !== null && newChain.length < maxWindowSize) {
1552
1630
  const currentBlockNumber = currentBlock[0].block;
1553
1631
  const nextBlock = newChain[0];
1554
- if (isDefined8(nextBlock)) {
1632
+ if (isDefined9(nextBlock)) {
1555
1633
  const nextBlockNumber = nextBlock[0].block;
1556
- assertEx10(
1634
+ assertEx11(
1557
1635
  currentBlockNumber === nextBlockNumber - 1,
1558
1636
  () => `[getWindowedChain] Non-monotonic block sequence detected: current=${currentBlockNumber}, next=${nextBlockNumber}`
1559
1637
  );
1560
1638
  }
1561
- assertEx10(
1639
+ assertEx11(
1562
1640
  currentBlockNumber <= head[0].block,
1563
1641
  () => `[getWindowedChain] Current block number (${currentBlockNumber}) exceeds head block number (${head[0].block})`
1564
1642
  );
@@ -1573,7 +1651,7 @@ async function getWindowedChain(context, blockViewer, maxWindowSize, previousCha
1573
1651
 
1574
1652
  // src/primitives/chain/step/chainStepRewardAddress.ts
1575
1653
  import {
1576
- assertEx as assertEx13,
1654
+ assertEx as assertEx14,
1577
1655
  exists,
1578
1656
  toAddress as toAddress2
1579
1657
  } from "@xylabs/sdk-js";
@@ -1606,7 +1684,7 @@ function stepBlockRange({ block, step }) {
1606
1684
  }
1607
1685
 
1608
1686
  // src/primitives/step/stepTransferIndex.ts
1609
- import { assertEx as assertEx11 } from "@xylabs/sdk-js";
1687
+ import { assertEx as assertEx12 } from "@xylabs/sdk-js";
1610
1688
  import { StepSizes as StepSizes6 } from "@xyo-network/xl1-protocol-lib";
1611
1689
  function stepTransferIndex(block, step) {
1612
1690
  let rewardTransferCount = 0;
@@ -1620,16 +1698,16 @@ function stepTransferIndex(block, step) {
1620
1698
  rewardTransferCount++;
1621
1699
  }
1622
1700
  }
1623
- assertEx11(rewardTransferIndex >= 0, () => `Could not find step size for step ${step} at block ${block}`);
1701
+ assertEx12(rewardTransferIndex >= 0, () => `Could not find step size for step ${step} at block ${block}`);
1624
1702
  return [rewardTransferIndex, rewardTransferCount];
1625
1703
  }
1626
1704
 
1627
1705
  // src/primitives/chain/step/stepRewardBlock.ts
1628
- import { assertEx as assertEx12 } from "@xylabs/sdk-js";
1706
+ import { assertEx as assertEx13 } from "@xylabs/sdk-js";
1629
1707
  import { StepSizes as StepSizes7 } from "@xyo-network/xl1-protocol-lib";
1630
1708
  async function stepRewardBlock(context, blockViewer, { block, step }) {
1631
- assertEx12(block % StepSizes7[step] === 0, () => `Block must be the first block of the step [${StepSizes7[step]}], got ${block}`);
1632
- return assertEx12(await blockViewer.blockByNumber(block), () => `Could not find block for block number ${block}`);
1709
+ assertEx13(block % StepSizes7[step] === 0, () => `Block must be the first block of the step [${StepSizes7[step]}], got ${block}`);
1710
+ return assertEx13(await blockViewer.blockByNumber(block), () => `Could not find block for block number ${block}`);
1633
1711
  }
1634
1712
 
1635
1713
  // src/primitives/chain/step/chainStepRewardAddress.ts
@@ -1640,7 +1718,7 @@ async function chainStepRewardAddress(context, blockViewer, { block, step }) {
1640
1718
  const transfersFromPool = payloads.filter(isTransfer).map((p) => asTransfer(p)).filter(exists).filter((t) => t.from === XYO_STEP_REWARD_ADDRESS);
1641
1719
  const fromEntries = Object.entries(mergeTransfers(transfersFromPool)[XYO_STEP_REWARD_ADDRESS]);
1642
1720
  const sortedTransferAmounts = fromEntries.toSorted(([, a], [, b]) => a > b ? -1 : a < b ? 1 : 0);
1643
- assertEx13(
1721
+ assertEx14(
1644
1722
  sortedTransferAmounts.length === transferCount,
1645
1723
  () => `Step Transfers mismatch ${block} (${blockBw._hash}) [${sortedTransferAmounts.length} - ${transferCount}]`
1646
1724
  );
@@ -1648,7 +1726,7 @@ async function chainStepRewardAddress(context, blockViewer, { block, step }) {
1648
1726
  }
1649
1727
 
1650
1728
  // src/primitives/chain/step/stepRewardTotal.ts
1651
- import { assertEx as assertEx14, isDefined as isDefined9 } from "@xylabs/sdk-js";
1729
+ import { assertEx as assertEx15, isDefined as isDefined10 } from "@xylabs/sdk-js";
1652
1730
  import {
1653
1731
  asAttoXL1,
1654
1732
  asXL1BlockRange as asXL1BlockRange5,
@@ -1743,16 +1821,16 @@ function stepInRange(step, range) {
1743
1821
  return stepRange[0] >= range[0] && stepRange[1] <= range[1];
1744
1822
  }
1745
1823
  async function stepRewardTotal(context, blockViewer, { block, step }, multipliers) {
1746
- const cacheKey = `${block}|${step}|${isDefined9(multipliers)}`;
1824
+ const cacheKey = `${block}|${step}|${isDefined10(multipliers)}`;
1747
1825
  return await withContextCacheResponse(context, "stepRewardTotal", cacheKey, async () => {
1748
1826
  const [blockBw, payloads] = await stepRewardBlock(context, blockViewer, { block, step });
1749
- assertEx14(blockBw.block === block, () => `Block Mismatch: expected ${block}, got ${blockBw.block}`);
1827
+ assertEx15(blockBw.block === block, () => `Block Mismatch: expected ${block}, got ${blockBw.block}`);
1750
1828
  const [transferIndex] = stepTransferIndex(block, step);
1751
- const stepTransfer = assertEx14(
1829
+ const stepTransfer = assertEx15(
1752
1830
  payloads.find((p) => isTransfer5(p) && p.from === XYO_STEP_REWARD_ADDRESS2),
1753
1831
  () => `No step transfer found for step ${step} at block ${block} (${blockBw._hash})`
1754
1832
  );
1755
- const rewards = assertEx14(
1833
+ const rewards = assertEx15(
1756
1834
  netTransfersForPayloads(context, [stepTransfer])[XYO_STEP_REWARD_ADDRESS2],
1757
1835
  () => `No rewards found for step reward address ${XYO_STEP_REWARD_ADDRESS2} at block ${block} (${blockBw._hash})`
1758
1836
  );
@@ -1795,7 +1873,7 @@ async function stepsRewardTotal(context, blockViewer, steps, multipliers) {
1795
1873
  }
1796
1874
 
1797
1875
  // src/primitives/chain/time/externalBlockNumberFromXL1BlockNumber.ts
1798
- import { assertEx as assertEx15, isArray } from "@xylabs/sdk-js";
1876
+ import { assertEx as assertEx16, isArray } from "@xylabs/sdk-js";
1799
1877
  import {
1800
1878
  asBlockNumber,
1801
1879
  asTimePayload,
@@ -1806,7 +1884,7 @@ async function externalBlockNumberFromXL1BlockNumber(context, blockViewer, xl1Bl
1806
1884
  const cacheKey = `${xl1BlockNumber}-${externalTimeName}-${externalGenesisTime ?? "default"}`;
1807
1885
  return await withContextCacheResponse(context, functionName, cacheKey, async () => {
1808
1886
  const [, payloads = []] = await blockViewer.blockByNumber(xl1BlockNumber) ?? [];
1809
- assertEx15(isArray(payloads));
1887
+ assertEx16(isArray(payloads));
1810
1888
  const timePayload = asTimePayload(payloads.find(isTimePayload));
1811
1889
  return asBlockNumber(
1812
1890
  timePayload?.[externalTimeName] ?? externalGenesisTime ?? 23372716,
@@ -1831,32 +1909,8 @@ async function externalBlockRangeFromStep(context, blockViewer, stepIdentity) {
1831
1909
  });
1832
1910
  }
1833
1911
 
1834
- // src/primitives/datalake/addDataLakePayloadsToPayloads.ts
1835
- import { isUndefined as isUndefined3 } from "@xylabs/sdk-js";
1836
- import { isAnyPayload as isAnyPayload2, PayloadBuilder as PayloadBuilder3 } from "@xyo-network/sdk-js";
1837
- async function addDataLakePayloadsToPayloads(hashes, payloads, dataLakeViewer) {
1838
- if (isUndefined3(dataLakeViewer)) return [payloads, []];
1839
- const missingPayloadHashes = hashes.filter((hash) => !payloads.some((p) => p._hash === hash));
1840
- const payloadsFromDataLake = await PayloadBuilder3.addHashMeta(
1841
- await PayloadBuilder3.addHashMeta((await dataLakeViewer.get(missingPayloadHashes)).filter(isAnyPayload2))
1842
- );
1843
- return [[...payloads, ...payloadsFromDataLake], payloadsFromDataLake.map((p) => p._hash)];
1844
- }
1845
-
1846
- // src/primitives/datalake/addDataLakePayloads.ts
1847
- async function addDataLakePayloads([boundWitness, payloads], dataLakeViewer) {
1848
- const [updatedPayloads, foundHashes] = await addDataLakePayloadsToPayloads(boundWitness.payload_hashes, payloads, dataLakeViewer);
1849
- return [
1850
- [
1851
- boundWitness,
1852
- updatedPayloads
1853
- ],
1854
- foundHashes
1855
- ];
1856
- }
1857
-
1858
1912
  // src/primitives/mapToMapType.ts
1859
- import { isDefined as isDefined10 } from "@xylabs/sdk-js";
1913
+ import { isDefined as isDefined11 } from "@xylabs/sdk-js";
1860
1914
  function mapToMapType(map) {
1861
1915
  return {
1862
1916
  get: (key) => map.get(key),
@@ -1875,7 +1929,7 @@ function mapToMapType(map) {
1875
1929
  const result = [];
1876
1930
  for (const key of keys) {
1877
1931
  const value = map.get(key);
1878
- if (isDefined10(value)) {
1932
+ if (isDefined11(value)) {
1879
1933
  result.push(value);
1880
1934
  }
1881
1935
  }
@@ -1890,7 +1944,7 @@ function mapToMapType(map) {
1890
1944
  }
1891
1945
 
1892
1946
  // src/primitives/readPayloadMapFromStore.ts
1893
- import { isDefined as isDefined11 } from "@xylabs/sdk-js";
1947
+ import { isDefined as isDefined12 } from "@xylabs/sdk-js";
1894
1948
  function readPayloadMapFromStore(store) {
1895
1949
  if (isReadArchivist(store)) {
1896
1950
  return {
@@ -1901,7 +1955,7 @@ function readPayloadMapFromStore(store) {
1901
1955
  return await store.get(hashes);
1902
1956
  },
1903
1957
  has: async (hash) => {
1904
- return isDefined11((await store.get([hash]))[0]);
1958
+ return isDefined12((await store.get([hash]))[0]);
1905
1959
  }
1906
1960
  };
1907
1961
  }
@@ -1917,7 +1971,7 @@ function payloadMapFromStore(store) {
1917
1971
  return await store.get(hashes);
1918
1972
  },
1919
1973
  has: async (hash) => {
1920
- return isDefined11((await store.get([hash]))[0]);
1974
+ return isDefined12((await store.get([hash]))[0]);
1921
1975
  },
1922
1976
  clear: async () => {
1923
1977
  return await store.clear();
@@ -1963,7 +2017,7 @@ function rewardFromBlockNumber(blockNumber) {
1963
2017
  import { XYO_NETWORK_STAKING_ADDRESS } from "@xyo-network/xl1-protocol-lib";
1964
2018
 
1965
2019
  // src/primitives/stake/activeStakeAtTimeByAddress.ts
1966
- import { isDefined as isDefined12 } from "@xylabs/sdk-js";
2020
+ import { isDefined as isDefined13 } from "@xylabs/sdk-js";
1967
2021
 
1968
2022
  // src/primitives/stake/mergedAddRemoveStakeEventsByStaker.ts
1969
2023
  async function mergedAddRemoveStakeEventsByStaker(chainEvents, range, staked, staker) {
@@ -1982,7 +2036,7 @@ async function activeStakeAtTimeByAddress(chain, staked, time, staker) {
1982
2036
  for (const event of stakeEvents) {
1983
2037
  if (event.time > time) break;
1984
2038
  if (event.args.staked !== staked) continue;
1985
- if (isDefined12(staker) && event.args.staker !== staker) continue;
2039
+ if (isDefined13(staker) && event.args.staker !== staker) continue;
1986
2040
  if (event.name === "StakeAdded") {
1987
2041
  result += event.args.amount;
1988
2042
  } else if (event.name === "StakeRemoved") {
@@ -1993,7 +2047,7 @@ async function activeStakeAtTimeByAddress(chain, staked, time, staker) {
1993
2047
  }
1994
2048
 
1995
2049
  // src/primitives/stake/activeStakeAtTimeByPosition.ts
1996
- import { isUndefined as isUndefined4 } from "@xylabs/sdk-js";
2050
+ import { isUndefined as isUndefined6 } from "@xylabs/sdk-js";
1997
2051
 
1998
2052
  // src/primitives/stake/mergedAddRemoveStakeEventsByPosition.ts
1999
2053
  async function mergedAddRemoveStakeEventsByPosition(chainEvents, range, position) {
@@ -2011,7 +2065,7 @@ async function activeStakeAtTimeByPosition(chainStakeEvents, externalTime, posit
2011
2065
  let result = 0n;
2012
2066
  for (const event of stakeEvents) {
2013
2067
  if (event.time > externalTime) break;
2014
- if (isUndefined4(position) || position === Number(event.args.id)) {
2068
+ if (isUndefined6(position) || position === Number(event.args.id)) {
2015
2069
  if (event.name === "StakeAdded") {
2016
2070
  result += event.args.amount;
2017
2071
  } else if (event.name === "StakeRemoved") {
@@ -2057,13 +2111,13 @@ async function allStakersForStep(context, blockViewer, stakeEventsViewer, stepCo
2057
2111
  }
2058
2112
 
2059
2113
  // src/primitives/stake/weightedStakeForRangeByPosition.ts
2060
- import { isDefined as isDefined13 } from "@xylabs/sdk-js";
2114
+ import { isDefined as isDefined14 } from "@xylabs/sdk-js";
2061
2115
  import { asBlockNumber as asBlockNumber2 } from "@xyo-network/xl1-protocol-lib";
2062
2116
  async function weightedStakeForRangeByPosition(context, blockViewer, stakeEventsViewer, externalRange, staked, positionId) {
2063
- const cacheKey = isDefined13(positionId) ? `${externalRange[0]}-${externalRange[1]}-${positionId}` : `${externalRange[0]}-${externalRange[1]}-all`;
2117
+ const cacheKey = isDefined14(positionId) ? `${externalRange[0]}-${externalRange[1]}-${positionId}` : `${externalRange[0]}-${externalRange[1]}-all`;
2064
2118
  return await withContextCacheResponse(context, "weightedStakeForRangeByPosition", cacheKey, async () => {
2065
2119
  let weightedStakeSum = 0n;
2066
- if (isDefined13(positionId)) {
2120
+ if (isDefined14(positionId)) {
2067
2121
  const mergedEvents = (await mergedAddRemoveStakeEventsByPosition(
2068
2122
  stakeEventsViewer,
2069
2123
  [0, externalRange[1]],
@@ -2071,7 +2125,7 @@ async function weightedStakeForRangeByPosition(context, blockViewer, stakeEvents
2071
2125
  )).toSorted((a, b) => a.time - b.time);
2072
2126
  let currentTime = externalRange[0];
2073
2127
  let currentStake = 0n;
2074
- if (isDefined13(staked) && mergedEvents.at(0)?.args.staked !== staked) {
2128
+ if (isDefined14(staked) && mergedEvents.at(0)?.args.staked !== staked) {
2075
2129
  return 0n;
2076
2130
  }
2077
2131
  for (const event of mergedEvents) {
@@ -2143,7 +2197,7 @@ var findMostRecentBlock = async (chainArchivist, nextOptions = DEFAULT_NEXT_OPTI
2143
2197
  };
2144
2198
 
2145
2199
  // src/primitives/state/hydratedBlockByNumber.ts
2146
- import { assertEx as assertEx16, spanAsync as spanAsync2 } from "@xylabs/sdk-js";
2200
+ import { assertEx as assertEx17, spanAsync as spanAsync2 } from "@xylabs/sdk-js";
2147
2201
  async function hydratedBlockByNumber(context, blockNumber) {
2148
2202
  return await spanAsync2("hydratedBlockByNumber", async () => {
2149
2203
  if (blockNumber < 0) throw new Error(`Block number ${blockNumber} is less than 0`);
@@ -2151,7 +2205,7 @@ async function hydratedBlockByNumber(context, blockNumber) {
2151
2205
  if (blockNumber % 1 !== 0) throw new Error(`Block number ${blockNumber} is not an integer`);
2152
2206
  const cacheKey = `${blockNumber}`;
2153
2207
  return await withContextCacheResponse(context, "hydratedBlockByNumber", cacheKey, async () => {
2154
- const block = assertEx16(
2208
+ const block = assertEx17(
2155
2209
  await blockFromBlockNumber(context, blockNumber),
2156
2210
  () => `Could not find block for block number ${blockNumber}`
2157
2211
  );
@@ -2202,7 +2256,7 @@ function findBestUncle(finalizedWindowedChain, uncles, options) {
2202
2256
 
2203
2257
  // src/primitives/uncle/findUncles.ts
2204
2258
  import {
2205
- assertEx as assertEx17,
2259
+ assertEx as assertEx18,
2206
2260
  exists as exists2
2207
2261
  } from "@xylabs/sdk-js";
2208
2262
  import { isTransactionBoundWitness as isTransactionBoundWitness2 } from "@xyo-network/xl1-protocol-lib";
@@ -2232,7 +2286,7 @@ function blocksToChains(blocks) {
2232
2286
  }
2233
2287
  function toValidUncle(_context, finalizedWindowedChain, possibleUncle) {
2234
2288
  const finalizedWindowStartBlockNumber = finalizedWindowedChain.at(0)?.[0].block ?? -1;
2235
- const finalizedHead = assertEx17(finalizedWindowedChain.at(-1), () => "finalizedWindowedChain is empty");
2289
+ const finalizedHead = assertEx18(finalizedWindowedChain.at(-1), () => "finalizedWindowedChain is empty");
2236
2290
  const prunedPossibleUncle = possibleUncle.filter((b) => b[0].block > finalizedHead[0].block);
2237
2291
  if (prunedPossibleUncle.length === 0) {
2238
2292
  return;
@@ -2476,7 +2530,7 @@ import { PayloadBundleSchema as PayloadBundleSchema2 } from "@xyo-network/sdk-js
2476
2530
  import { PayloadBuilder as PayloadBuilder12 } from "@xyo-network/sdk-js";
2477
2531
 
2478
2532
  // src/transaction/buildTransaction.ts
2479
- import { assertEx as assertEx18, toHex } from "@xylabs/sdk-js";
2533
+ import { assertEx as assertEx19, toHex } from "@xylabs/sdk-js";
2480
2534
  import {
2481
2535
  asAnyPayload as asAnyPayload2,
2482
2536
  BoundWitnessBuilder,
@@ -2505,7 +2559,7 @@ async function buildTransaction(chain, onChainPayloads, offChainPayloads, signer
2505
2559
  }
2506
2560
  const fields = {
2507
2561
  ...txBoundWitnessFields,
2508
- from: from ?? (Array.isArray(signer) ? assertEx18(signer.at(0)?.address) : signer.address)
2562
+ from: from ?? (Array.isArray(signer) ? assertEx19(signer.at(0)?.address) : signer.address)
2509
2563
  };
2510
2564
  if (script.length > 0) {
2511
2565
  fields.script = script;
@@ -2547,7 +2601,7 @@ async function buildUnsignedTransaction(chain, onChainPayloads, offChainPayloads
2547
2601
  }
2548
2602
 
2549
2603
  // src/transaction/confirmSubmittedTransaction.ts
2550
- import { delay, isDefined as isDefined14 } from "@xylabs/sdk-js";
2604
+ import { delay, isDefined as isDefined15 } from "@xylabs/sdk-js";
2551
2605
  var DEFAULT_CONFIRMATION_ATTEMPTS = 20;
2552
2606
  var DEFAULT_DELAY_BETWEEN_ATTEMPTS = 1e3;
2553
2607
  var confirmSubmittedTransaction = async (viewer, txHash, options) => {
@@ -2556,7 +2610,7 @@ var confirmSubmittedTransaction = async (viewer, txHash, options) => {
2556
2610
  let attempts = 0;
2557
2611
  while (true) {
2558
2612
  const tx = await viewer.transaction.byHash(txHash) ?? void 0;
2559
- if (isDefined14(tx)) {
2613
+ if (isDefined15(tx)) {
2560
2614
  options?.logger?.debug("Transaction confirmed", txHash);
2561
2615
  return tx;
2562
2616
  } else {
@@ -2573,7 +2627,7 @@ var confirmSubmittedTransaction = async (viewer, txHash, options) => {
2573
2627
  };
2574
2628
 
2575
2629
  // src/transaction/hydrateTransaction.ts
2576
- import { assertEx as assertEx19 } from "@xylabs/sdk-js";
2630
+ import { assertEx as assertEx20 } from "@xylabs/sdk-js";
2577
2631
  import {
2578
2632
  asAnyPayload as asAnyPayload3,
2579
2633
  hydrateTypedBoundWitness,
@@ -2648,7 +2702,7 @@ var tryHydrateElevatedTransaction = async ({ chainMap }, hash) => {
2648
2702
  return void 0;
2649
2703
  };
2650
2704
  var hydrateElevatedTransaction = async (context, hash) => {
2651
- return assertEx19(await tryHydrateElevatedTransaction(context, hash), () => "Hydration failed");
2705
+ return assertEx20(await tryHydrateElevatedTransaction(context, hash), () => "Hydration failed");
2652
2706
  };
2653
2707
 
2654
2708
  // src/transaction/primitives/transactionBlockByteCount.ts
@@ -2701,13 +2755,13 @@ function transactionRequiredGas(hydratedTransaction) {
2701
2755
 
2702
2756
  // src/transaction/signTransaction.ts
2703
2757
  import {
2704
- assertEx as assertEx20,
2758
+ assertEx as assertEx21,
2705
2759
  hexFromArrayBuffer,
2706
2760
  toArrayBuffer
2707
2761
  } from "@xylabs/sdk-js";
2708
2762
  import { PayloadBuilder as PayloadBuilder10 } from "@xyo-network/sdk-js";
2709
2763
  async function signTransaction(tx, account) {
2710
- assertEx20(tx.from === account.address, () => "Signer address does not match transaction from address");
2764
+ assertEx21(tx.from === account.address, () => "Signer address does not match transaction from address");
2711
2765
  const unsignedTx = structuredClone(tx);
2712
2766
  unsignedTx.addresses = [account.address];
2713
2767
  unsignedTx.previous_hashes = [account.previousHash ?? null];
@@ -2722,7 +2776,7 @@ async function signTransaction(tx, account) {
2722
2776
  }
2723
2777
 
2724
2778
  // src/transaction/TransactionBuilder.ts
2725
- import { assertEx as assertEx21, Base } from "@xylabs/sdk-js";
2779
+ import { assertEx as assertEx22, Base } from "@xylabs/sdk-js";
2726
2780
  import { PayloadBuilder as PayloadBuilder11 } from "@xyo-network/sdk-js";
2727
2781
  import {
2728
2782
  asXL1BlockNumber as asXL1BlockNumber4,
@@ -2742,9 +2796,9 @@ var TransactionBuilder = class extends Base {
2742
2796
  super(options);
2743
2797
  }
2744
2798
  async build() {
2745
- const chain = assertEx21(this._chain, () => "Chain must be set before building the transaction");
2746
- const fees = assertEx21(this._fees, () => "Fees must be set before building the transaction");
2747
- const blockRange = assertEx21(this._blockRange, () => "Block range must be set before building the transaction");
2799
+ const chain = assertEx22(this._chain, () => "Chain must be set before building the transaction");
2800
+ const fees = assertEx22(this._fees, () => "Fees must be set before building the transaction");
2801
+ const blockRange = assertEx22(this._blockRange, () => "Block range must be set before building the transaction");
2748
2802
  return await buildTransaction(
2749
2803
  chain,
2750
2804
  this._elevatedPayloads,
@@ -2774,7 +2828,7 @@ var TransactionBuilder = class extends Base {
2774
2828
  }
2775
2829
  elevatedPayload(payload) {
2776
2830
  const allowedPayload = isAllowedBlockPayload2(payload) ? payload : void 0;
2777
- const allowPayloadExists = assertEx21(allowedPayload, () => "Payload must be an AllowedBlockPayload");
2831
+ const allowPayloadExists = assertEx22(allowedPayload, () => "Payload must be an AllowedBlockPayload");
2778
2832
  this._elevatedPayloads.push(allowPayloadExists);
2779
2833
  return this;
2780
2834
  }
@@ -2876,12 +2930,12 @@ var toActorConfigContext = zodToFactory5(ActorConfigContext, "toActorConfigConte
2876
2930
  // src/CreatableProvider/AbstractCreatableProvider.ts
2877
2931
  import {
2878
2932
  AbstractCreatable,
2879
- assertEx as assertEx23,
2933
+ assertEx as assertEx24,
2880
2934
  IdLogger
2881
2935
  } from "@xylabs/sdk-js";
2882
2936
 
2883
2937
  // src/CreatableProvider/ProviderFactory.ts
2884
- import { assertEx as assertEx22 } from "@xylabs/sdk-js";
2938
+ import { assertEx as assertEx23 } from "@xylabs/sdk-js";
2885
2939
  function providerFactoryDescription(factory, labels) {
2886
2940
  return `${factory.providerName}:${factory.defaultMoniker}:${JSON.stringify(labels ?? factory.labels ?? {})}`;
2887
2941
  }
@@ -2902,7 +2956,7 @@ var ProviderFactory = class _ProviderFactory {
2902
2956
  this.dependencies = dependencies;
2903
2957
  this.monikers = creatableProvider2.monikers;
2904
2958
  this.scope = scope;
2905
- assertEx22(this.monikers.includes(this.defaultMoniker), () => "defaultMoniker must be in monikers");
2959
+ assertEx23(this.monikers.includes(this.defaultMoniker), () => "defaultMoniker must be in monikers");
2906
2960
  this.labels = Object.assign({}, creatableProvider2.labels ?? {}, labels ?? {});
2907
2961
  this.providerName = creatableProvider2.name;
2908
2962
  this._uniqueId = Symbol(providerFactoryDescription(this));
@@ -2930,7 +2984,7 @@ var ProviderFactory = class _ProviderFactory {
2930
2984
  break;
2931
2985
  }
2932
2986
  case "context": {
2933
- const context = assertEx22(
2987
+ const context = assertEx23(
2934
2988
  params?.context,
2935
2989
  () => "Context is required for context-scoped providers"
2936
2990
  );
@@ -2951,7 +3005,7 @@ var ProviderFactory = class _ProviderFactory {
2951
3005
  scopeObject[this.resolvedMoniker] = resultPromise;
2952
3006
  const result = await resultPromise;
2953
3007
  if (start) {
2954
- assertEx22(await result.start(), () => `Failed to start provider instance [${this.resolvedMoniker}]`);
3008
+ assertEx23(await result.start(), () => `Failed to start provider instance [${this.resolvedMoniker}]`);
2955
3009
  }
2956
3010
  return result;
2957
3011
  }
@@ -2996,9 +3050,9 @@ var AbstractCreatableProvider = class extends AbstractCreatable {
2996
3050
  return factory;
2997
3051
  }
2998
3052
  static async paramsHandler(params = {}) {
2999
- const context = assertEx23(params.context, () => new Error("Context is required"));
3000
- const config = assertEx23(context.config, () => new Error("Context config is required"));
3001
- const locator = assertEx23(context.locator, () => new Error("Context locator is required"));
3053
+ const context = assertEx24(params.context, () => new Error("Context is required"));
3054
+ const config = assertEx24(context.config, () => new Error("Context config is required"));
3055
+ const locator = assertEx24(context.locator, () => new Error("Context locator is required"));
3002
3056
  return await super.paramsHandler({
3003
3057
  ...params,
3004
3058
  statusReporter: params.statusReporter ?? context.statusReporter,
@@ -3110,7 +3164,7 @@ function labeledCreatableProviderFactory() {
3110
3164
 
3111
3165
  // src/CreatableProvider/ProviderFactoryLocator.ts
3112
3166
  import { hasAllLabels } from "@xylabs/sdk-js";
3113
- import { assertEx as assertEx24 } from "@xylabs/sdk-js";
3167
+ import { assertEx as assertEx25 } from "@xylabs/sdk-js";
3114
3168
  var ProviderFactoryLocator = class _ProviderFactoryLocator {
3115
3169
  _context;
3116
3170
  _registry;
@@ -3142,7 +3196,7 @@ var ProviderFactoryLocator = class _ProviderFactoryLocator {
3142
3196
  this._frozen = true;
3143
3197
  }
3144
3198
  async getInstance(moniker, { start = true, labels } = {}) {
3145
- return assertEx24(
3199
+ return assertEx25(
3146
3200
  await this.tryGetInstance(moniker, { start, labels }),
3147
3201
  () => `No provider instance for the supplied config moniker [${moniker}]${labels ? ` & labels [${JSON.stringify(labels)}]` : ""} could be created`
3148
3202
  );
@@ -3157,7 +3211,7 @@ var ProviderFactoryLocator = class _ProviderFactoryLocator {
3157
3211
  * @returns A provider factory that matches the supplied moniker and labels or throws if one is not found
3158
3212
  */
3159
3213
  locate(moniker, labels) {
3160
- return assertEx24(
3214
+ return assertEx25(
3161
3215
  this.tryLocate(moniker, labels),
3162
3216
  () => `No module factory for the supplied config moniker [${moniker}]${labels ? ` & labels [${JSON.stringify(labels)}]` : ""} registered`
3163
3217
  );
@@ -3179,10 +3233,10 @@ var ProviderFactoryLocator = class _ProviderFactoryLocator {
3179
3233
  * @param labels The labels for the module factory
3180
3234
  */
3181
3235
  register(factory, labels, primary = false) {
3182
- assertEx24(!this._frozen, () => "Cannot register a module factory after the locator has been frozen");
3236
+ assertEx25(!this._frozen, () => "Cannot register a module factory after the locator has been frozen");
3183
3237
  if (this.validateDepsOnRegister) {
3184
3238
  const missingDeps = factory.dependencies.filter((dep) => !this.registered(dep));
3185
- assertEx24(missingDeps.length === 0, () => `Cannot register module factory [${factory.uniqueId.description}] due to missing dependencies: ${missingDeps.join(", ")}`);
3239
+ assertEx25(missingDeps.length === 0, () => `Cannot register module factory [${factory.uniqueId.description}] due to missing dependencies: ${missingDeps.join(", ")}`);
3186
3240
  }
3187
3241
  registerCreatableProviderFactory(this._registry, factory, labels, primary);
3188
3242
  return this;
@@ -3230,7 +3284,7 @@ var ProviderFactoryLocator = class _ProviderFactoryLocator {
3230
3284
  for (const moniker in this.registry) {
3231
3285
  for (const factory of this.registry[moniker] ?? []) {
3232
3286
  const missingDeps = factory.dependencies.filter((dep) => !this.registered(dep));
3233
- assertEx24(missingDeps.length === 0, () => `Module factory [${factory.uniqueId.description}] is missing dependencies: ${missingDeps.join(", ")}`);
3287
+ assertEx25(missingDeps.length === 0, () => `Module factory [${factory.uniqueId.description}] is missing dependencies: ${missingDeps.join(", ")}`);
3234
3288
  }
3235
3289
  }
3236
3290
  }
@@ -3264,13 +3318,13 @@ var asHostActorConfigContext = zodAsFactory7(HostActorConfigContext, "asHostActo
3264
3318
  var toHostActorConfigContext = zodToFactory6(HostActorConfigContext, "toHostActorConfigContext");
3265
3319
 
3266
3320
  // src/createDeclarationPayload.ts
3267
- import { isDefined as isDefined15 } from "@xylabs/sdk-js";
3321
+ import { isDefined as isDefined16 } from "@xylabs/sdk-js";
3268
3322
  import { PayloadBuilder as PayloadBuilder13 } from "@xyo-network/sdk-js";
3269
3323
  import {
3270
3324
  ChainStakeIntentSchema
3271
3325
  } from "@xyo-network/xl1-protocol-lib";
3272
3326
  var createDeclarationIntent = (address, intent, nbf, exp) => {
3273
- const expiration = isDefined15(exp) ? exp : nbf + 1e4;
3327
+ const expiration = isDefined16(exp) ? exp : nbf + 1e4;
3274
3328
  const redeclarationIntent = new PayloadBuilder13({ schema: ChainStakeIntentSchema }).fields({
3275
3329
  from: address,
3276
3330
  intent,
@@ -3369,7 +3423,7 @@ var signEIP712Message = async (signer, data) => {
3369
3423
  };
3370
3424
 
3371
3425
  // src/eip-712/verify.ts
3372
- import { asHash as asHash3, isUndefined as isUndefined5 } from "@xylabs/sdk-js";
3426
+ import { asHash as asHash3, isUndefined as isUndefined7 } from "@xylabs/sdk-js";
3373
3427
  import { PayloadBuilder as PayloadBuilder16 } from "@xyo-network/sdk-js";
3374
3428
  import { verifyTypedData } from "ethers";
3375
3429
  var verifyEIP712Message = async (data, sig) => {
@@ -3380,7 +3434,7 @@ var verifyEIP712Message = async (data, sig) => {
3380
3434
  } = sig;
3381
3435
  const { schema, ...fields } = data;
3382
3436
  const signedHash = asHash3(hash);
3383
- if (isUndefined5(signedHash) || signedHash !== await PayloadBuilder16.hash(data)) return false;
3437
+ if (isUndefined7(signedHash) || signedHash !== await PayloadBuilder16.hash(data)) return false;
3384
3438
  const recoveredAddress = verifyTypedData(fields.domain, fields.types, fields.values, signature);
3385
3439
  return recoveredAddress.toLowerCase() === address.toLowerCase();
3386
3440
  };
@@ -3449,9 +3503,9 @@ var toPositiveBigInt = (value) => {
3449
3503
  // src/simple/accountBalance/SimpleAccountBalanceViewer.ts
3450
3504
  import {
3451
3505
  asHash as asHash4,
3452
- assertEx as assertEx31,
3506
+ assertEx as assertEx32,
3453
3507
  exists as exists3,
3454
- isDefined as isDefined16,
3508
+ isDefined as isDefined17,
3455
3509
  ZERO_ADDRESS
3456
3510
  } from "@xylabs/sdk-js";
3457
3511
  import {
@@ -3521,18 +3575,18 @@ var asTransfersStepSummaryWithStorageMeta = AsObjectFactory7.create(isTransfersS
3521
3575
 
3522
3576
  // src/summary/primitives/balances/balancesStepSummaryFromRange.ts
3523
3577
  import { spanRootAsync as spanRootAsync2 } from "@xylabs/sdk-js";
3524
- import { assertEx as assertEx25 } from "@xylabs/sdk-js";
3578
+ import { assertEx as assertEx26 } from "@xylabs/sdk-js";
3525
3579
  import { isAnyPayload as isAnyPayload3 } from "@xyo-network/sdk-js";
3526
3580
  import { asXL1BlockNumber as asXL1BlockNumber5, StepSizes as StepSizes8 } from "@xyo-network/xl1-protocol-lib";
3527
3581
  async function balancesStepSummaryFromRange(context, semaphores, blockViewer, summaryMap, range) {
3528
3582
  const cacheKey = `${range[0]}|${range[1]}`;
3529
3583
  return await withContextCacheResponse(context, "balancesStepSummaryFromRange", cacheKey, async () => {
3530
3584
  return await spanRootAsync2("balancesStepSummaryFromRange", async () => {
3531
- const [frameHead] = assertEx25(await blockViewer.blockByNumber(range[1]), () => `Block not found for number: ${range[1]}`);
3585
+ const [frameHead] = assertEx26(await blockViewer.blockByNumber(range[1]), () => `Block not found for number: ${range[1]}`);
3532
3586
  const frameSize = range[1] - range[0] + 1;
3533
3587
  const key = `${frameHead._hash}|${frameSize}`;
3534
3588
  return frameSize === 1 ? await spanRootAsync2(`balancesStepSummaryFromRange.frameSize=1[${key}]`, async () => {
3535
- const [, payloads] = assertEx25(await blockViewer.blockByNumber(range[0]), () => `Block not found for number: ${range[0]}`);
3589
+ const [, payloads] = assertEx26(await blockViewer.blockByNumber(range[0]), () => `Block not found for number: ${range[0]}`);
3536
3590
  const balances = {};
3537
3591
  for (const [address, balance] of Object.entries(netBalancesForPayloads(context, payloads))) {
3538
3592
  balances[address] = toSignedBigInt(balance);
@@ -3545,7 +3599,7 @@ async function balancesStepSummaryFromRange(context, semaphores, blockViewer, su
3545
3599
  };
3546
3600
  }, { ...context, timeBudgetLimit: 500 }) : await spanRootAsync2(`balancesStepSummaryFromRange.frameSize>1[${key}]`, async () => {
3547
3601
  const step = StepSizes8.indexOf(asXL1BlockNumber5(frameSize, true));
3548
- assertEx25(step !== -1, () => `Invalid step size: ${frameSize}. Must be one of ${StepSizes8.join(", ")}`);
3602
+ assertEx26(step !== -1, () => `Invalid step size: ${frameSize}. Must be one of ${StepSizes8.join(", ")}`);
3549
3603
  const summaryResult = await summaryMap.get(`${frameHead._hash}|${frameSize}`);
3550
3604
  if (isAnyPayload3(summaryResult)) {
3551
3605
  return summaryResult;
@@ -3591,7 +3645,7 @@ async function balancesStepSummaryFromRange(context, semaphores, blockViewer, su
3591
3645
  // src/summary/primitives/balances/balancesSummary.ts
3592
3646
  import {
3593
3647
  asAddress,
3594
- assertEx as assertEx26,
3648
+ assertEx as assertEx27,
3595
3649
  spanRootAsync as spanRootAsync3
3596
3650
  } from "@xylabs/sdk-js";
3597
3651
  import {
@@ -3603,7 +3657,7 @@ import {
3603
3657
  async function balancesSummary(context, semaphores, blockViewer, summaryMap, config) {
3604
3658
  return await spanRootAsync3("balancesSummary", async () => {
3605
3659
  const headHash = isChainQualifiedHeadConfig(config) ? config.head : await blockViewer.currentBlockHash();
3606
- const [head] = assertEx26(await blockViewer.blockByHash(headHash), () => `Block not found for hash: ${headHash}`);
3660
+ const [head] = assertEx27(await blockViewer.blockByHash(headHash), () => `Block not found for hash: ${headHash}`);
3607
3661
  const headBoundWitness = asBlockBoundWitnessWithStorageMeta3(head, () => `Found Block not a BlockWithHashMeta: ${headHash}`);
3608
3662
  const range = isChainQualifiedRangeConfig(config) ? config.range : asXL1BlockRange7([0, headBoundWitness.block], true);
3609
3663
  const ranges = deepCalculateFramesFromRange(asXL1BlockRange7(
@@ -3623,7 +3677,7 @@ async function balancesSummary(context, semaphores, blockViewer, summaryMap, con
3623
3677
  }
3624
3678
 
3625
3679
  // src/summary/primitives/schemas/schemasStepSummaryFromRange.ts
3626
- import { assertEx as assertEx27 } from "@xylabs/sdk-js";
3680
+ import { assertEx as assertEx28 } from "@xylabs/sdk-js";
3627
3681
  import {
3628
3682
  isAnyPayload as isAnyPayload4,
3629
3683
  isBoundWitness as isBoundWitness2,
@@ -3632,11 +3686,11 @@ import {
3632
3686
  } from "@xyo-network/sdk-js";
3633
3687
  import { StepSizes as StepSizes9 } from "@xyo-network/xl1-protocol-lib";
3634
3688
  async function schemasStepSummaryFromRange(context, semaphores, blockViewer, summaryMap, range) {
3635
- const [frameHead] = assertEx27(await blockViewer.blockByNumber(range[1]), () => `Block not found for number: ${range[1]}`);
3689
+ const [frameHead] = assertEx28(await blockViewer.blockByNumber(range[1]), () => `Block not found for number: ${range[1]}`);
3636
3690
  const frameSize = range[1] - range[0] + 1;
3637
3691
  let result;
3638
3692
  if (frameSize === 1) {
3639
- const [block, payloads] = assertEx27(await blockViewer.blockByNumber(range[0]), () => `Block not found for number: ${range[0]}`);
3693
+ const [block, payloads] = assertEx28(await blockViewer.blockByNumber(range[0]), () => `Block not found for number: ${range[0]}`);
3640
3694
  const boundWitnesses = [block, ...payloads.filter((x) => isBoundWitness2(x) && isHashMeta(x))];
3641
3695
  const schemas = {};
3642
3696
  for (const bw of boundWitnesses) {
@@ -3653,7 +3707,7 @@ async function schemasStepSummaryFromRange(context, semaphores, blockViewer, sum
3653
3707
  });
3654
3708
  } else {
3655
3709
  const step = StepSizes9.indexOf(frameSize);
3656
- assertEx27(step !== -1, () => `Invalid step size: ${frameSize}. Must be one of ${StepSizes9.join(", ")}`);
3710
+ assertEx28(step !== -1, () => `Invalid step size: ${frameSize}. Must be one of ${StepSizes9.join(", ")}`);
3657
3711
  const summaryResult = await summaryMap.get(`${frameHead._hash}|${frameSize}`);
3658
3712
  if (isAnyPayload4(summaryResult)) {
3659
3713
  result = summaryResult;
@@ -3692,7 +3746,7 @@ async function schemasStepSummaryFromRange(context, semaphores, blockViewer, sum
3692
3746
  }
3693
3747
 
3694
3748
  // src/summary/primitives/schemas/schemasSummary.ts
3695
- import { assertEx as assertEx28, spanRootAsync as spanRootAsync4 } from "@xylabs/sdk-js";
3749
+ import { assertEx as assertEx29, spanRootAsync as spanRootAsync4 } from "@xylabs/sdk-js";
3696
3750
  import {
3697
3751
  asBlockBoundWitnessWithStorageMeta as asBlockBoundWitnessWithStorageMeta4,
3698
3752
  asXL1BlockRange as asXL1BlockRange8,
@@ -3702,7 +3756,7 @@ import {
3702
3756
  async function schemasSummary(context, semaphores, blockViewer, summaryMap, config) {
3703
3757
  return await spanRootAsync4("schemasSummary", async () => {
3704
3758
  const headHash = isChainQualifiedHeadConfig2(config) ? config.head : await blockViewer.currentBlockHash();
3705
- const [head] = assertEx28(await blockViewer.blockByHash(headHash), () => `Block not found for hash: ${headHash}`);
3759
+ const [head] = assertEx29(await blockViewer.blockByHash(headHash), () => `Block not found for hash: ${headHash}`);
3706
3760
  const headBoundWitness = asBlockBoundWitnessWithStorageMeta4(head, () => `Found Block not a BlockWithHashMeta: ${headHash}`);
3707
3761
  const range = isChainQualifiedRangeConfig2(config) ? config.range : asXL1BlockRange8([0, headBoundWitness.block], true);
3708
3762
  const ranges = deepCalculateFramesFromRange(asXL1BlockRange8(
@@ -3722,7 +3776,7 @@ async function schemasSummary(context, semaphores, blockViewer, summaryMap, conf
3722
3776
  }
3723
3777
 
3724
3778
  // src/summary/primitives/transfers/transfersStepSummaryFromRange.ts
3725
- import { assertEx as assertEx29, spanRootAsync as spanRootAsync5 } from "@xylabs/sdk-js";
3779
+ import { assertEx as assertEx30, spanRootAsync as spanRootAsync5 } from "@xylabs/sdk-js";
3726
3780
  import { isAnyPayload as isAnyPayload5 } from "@xyo-network/sdk-js";
3727
3781
  import { asXL1BlockNumber as asXL1BlockNumber6, StepSizes as StepSizes10 } from "@xyo-network/xl1-protocol-lib";
3728
3782
  function transfersSummaryKey(frameHeadHash, frameSize) {
@@ -3732,11 +3786,11 @@ async function transfersStepSummaryFromRange(context, semaphores, blockViewer, s
3732
3786
  const cacheKey = `${range[0]}|${range[1]}`;
3733
3787
  return await withContextCacheResponse(context, "transfersStepSummaryFromRange", cacheKey, async () => {
3734
3788
  return await spanRootAsync5("transfersStepSummaryFromRange", async () => {
3735
- const [frameHead] = assertEx29(await blockViewer.blockByNumber(range[1]), () => `Block not found for number: ${range[1]}`);
3789
+ const [frameHead] = assertEx30(await blockViewer.blockByNumber(range[1]), () => `Block not found for number: ${range[1]}`);
3736
3790
  const frameSize = range[1] - range[0] + 1;
3737
3791
  let result;
3738
3792
  if (frameSize === 1) {
3739
- const [, payloads] = assertEx29(await blockViewer.blockByNumber(range[0]), () => `Block not found for number: ${range[0]}`);
3793
+ const [, payloads] = assertEx30(await blockViewer.blockByNumber(range[0]), () => `Block not found for number: ${range[0]}`);
3740
3794
  const transfers = {};
3741
3795
  for (const [from, toMap] of Object.entries(netTransfersForPayloads(context, payloads))) {
3742
3796
  transfers[from] = transfers[from] ?? {};
@@ -3752,7 +3806,7 @@ async function transfersStepSummaryFromRange(context, semaphores, blockViewer, s
3752
3806
  };
3753
3807
  } else {
3754
3808
  const step = StepSizes10.indexOf(asXL1BlockNumber6(frameSize, true));
3755
- assertEx29(step !== -1, () => `Invalid step size: ${frameSize}. Must be one of ${StepSizes10.join(", ")}`);
3809
+ assertEx30(step !== -1, () => `Invalid step size: ${frameSize}. Must be one of ${StepSizes10.join(", ")}`);
3756
3810
  const key = transfersSummaryKey(frameHead._hash, frameSize);
3757
3811
  const summaryResult = await summaryMap.get(key);
3758
3812
  if (isAnyPayload5(summaryResult)) {
@@ -3805,7 +3859,7 @@ async function transfersStepSummaryFromRange(context, semaphores, blockViewer, s
3805
3859
  // src/summary/primitives/transfers/transfersSummary.ts
3806
3860
  import {
3807
3861
  asAddress as asAddress2,
3808
- assertEx as assertEx30,
3862
+ assertEx as assertEx31,
3809
3863
  spanRootAsync as spanRootAsync6
3810
3864
  } from "@xylabs/sdk-js";
3811
3865
  import {
@@ -3817,7 +3871,7 @@ import {
3817
3871
  async function transfersSummary(context, semaphores, blockViewer, summaryMap, config) {
3818
3872
  return await spanRootAsync6("transferSummary", async () => {
3819
3873
  const headHash = isChainQualifiedHeadConfig3(config) ? config.head : await blockViewer.currentBlockHash();
3820
- const [head] = assertEx30(await blockViewer.blockByHash(headHash), () => `Block not found for hash: ${headHash}`);
3874
+ const [head] = assertEx31(await blockViewer.blockByHash(headHash), () => `Block not found for hash: ${headHash}`);
3821
3875
  const headBoundWitness = asBlockBoundWitnessWithStorageMeta5(head, () => `Found Block not a BlockWithHashMeta: ${headHash}`);
3822
3876
  const range = isChainQualifiedRangeConfig3(config) ? config.range : asXL1BlockRange9([0, headBoundWitness.block], true);
3823
3877
  const ranges = deepCalculateFramesFromRange(asXL1BlockRange9(
@@ -3858,8 +3912,8 @@ var SimpleAccountBalanceViewer = class extends AbstractCreatableProvider {
3858
3912
  static async paramsHandler(params = {}) {
3859
3913
  return {
3860
3914
  ...await super.paramsHandler(params),
3861
- balancesSummaryMap: assertEx31(params.balancesSummaryMap, () => "balancesSummaryMap is required"),
3862
- transfersSummaryMap: assertEx31(params.transfersSummaryMap, () => "transfersSummaryMap is required")
3915
+ balancesSummaryMap: assertEx32(params.balancesSummaryMap, () => "balancesSummaryMap is required"),
3916
+ transfersSummaryMap: assertEx32(params.transfersSummaryMap, () => "transfersSummaryMap is required")
3863
3917
  };
3864
3918
  }
3865
3919
  async accountBalance(address, config) {
@@ -3880,11 +3934,11 @@ var SimpleAccountBalanceViewer = class extends AbstractCreatableProvider {
3880
3934
  const transferIndexes = block[0].payload_schemas.map((schema, index) => schema === TransferSchema2 ? index : void 0).filter(exists3);
3881
3935
  const transfers = transferIndexes.map((index) => {
3882
3936
  const hash = block[0].payload_hashes[index];
3883
- return assertEx31(
3937
+ return assertEx32(
3884
3938
  block[1].find((p) => p._hash === hash),
3885
3939
  () => `Error: Could not find Transfer with hash ${hash} in block ${block[0]._hash}`
3886
3940
  );
3887
- }).filter(exists3).filter((t) => t.from === address || isDefined16(t.transfers[address]));
3941
+ }).filter(exists3).filter((t) => t.from === address || isDefined17(t.transfers[address]));
3888
3942
  if (transfers.length === 0) {
3889
3943
  continue;
3890
3944
  }
@@ -3913,7 +3967,7 @@ var SimpleAccountBalanceViewer = class extends AbstractCreatableProvider {
3913
3967
  const head = isChainQualifiedHeadConfig4(config) ? config.head : await this.blockViewer.currentBlockHash();
3914
3968
  const range = isChainQualifiedRangeConfig4(config) ? config.range : asXL1BlockRange10([
3915
3969
  0,
3916
- assertEx31(
3970
+ assertEx32(
3917
3971
  await this.blockViewer.blockByHash(head),
3918
3972
  () => `Error: Could not find block with hash ${head}`
3919
3973
  )[0].block
@@ -3928,11 +3982,11 @@ var SimpleAccountBalanceViewer = class extends AbstractCreatableProvider {
3928
3982
  const qualifiedRange = qualifiedEntries[0][1][1].range;
3929
3983
  const qualifiedHeadHash = qualifiedEntries[0][1][1].head;
3930
3984
  for (const [_, [__, { range: range2, head: head2 }]] of qualifiedEntries) {
3931
- assertEx31(
3985
+ assertEx32(
3932
3986
  range2[0] === qualifiedRange[0] && range2[1] === qualifiedRange[1],
3933
3987
  () => "Inconsistent ranges in qualifiedAccountBalanceHistories"
3934
3988
  );
3935
- assertEx31(
3989
+ assertEx32(
3936
3990
  head2 === qualifiedHeadHash,
3937
3991
  () => "Inconsistent head hashes in qualifiedAccountBalanceHistories"
3938
3992
  );
@@ -4003,7 +4057,7 @@ var SimpleAccountBalanceViewer = class extends AbstractCreatableProvider {
4003
4057
  return await this.spanAsync("qualifiedAccountBalanceHistory", async () => {
4004
4058
  const range = asRange(headOrRange);
4005
4059
  const headHash = asHash4(headOrRange);
4006
- const [head] = assertEx31(isDefined16(headHash) ? await this.blockViewer.blockByHash(headHash) : await this.blockViewer.currentBlock(), () => "Could not resolve head block");
4060
+ const [head] = assertEx32(isDefined17(headHash) ? await this.blockViewer.blockByHash(headHash) : await this.blockViewer.currentBlock(), () => "Could not resolve head block");
4007
4061
  const startingRange = asXL1BlockRange10(range ?? [0, head.block], true);
4008
4062
  const blockNumbers = await this.distillTransferHistory(address, startingRange);
4009
4063
  const blocks = (await Promise.all(blockNumbers.map(async (bn) => await this.blockViewer.blockByNumber(bn)))).filter(exists3);
@@ -4012,11 +4066,11 @@ var SimpleAccountBalanceViewer = class extends AbstractCreatableProvider {
4012
4066
  const transferIndexes = block[0].payload_schemas.map((schema, index) => schema === TransferSchema2 ? index : void 0).filter(exists3);
4013
4067
  const transfers = transferIndexes.map((index) => {
4014
4068
  const hash = block[0].payload_hashes[index];
4015
- return assertEx31(
4069
+ return assertEx32(
4016
4070
  block[1].find((p) => p._hash === hash),
4017
4071
  () => `Error: Could not find Transfer with hash ${hash} in block ${block[0]._hash}`
4018
4072
  );
4019
- }).filter(exists3).filter((t) => t.from === address || isDefined16(t.transfers[address]));
4073
+ }).filter(exists3).filter((t) => t.from === address || isDefined17(t.transfers[address]));
4020
4074
  if (transfers.length === 0) {
4021
4075
  continue;
4022
4076
  }
@@ -4042,9 +4096,9 @@ SimpleAccountBalanceViewer = __decorateClass([
4042
4096
 
4043
4097
  // src/simple/block/SimpleBlockViewer.ts
4044
4098
  import {
4045
- assertEx as assertEx32,
4099
+ assertEx as assertEx33,
4046
4100
  exists as exists4,
4047
- isUndefined as isUndefined6
4101
+ isUndefined as isUndefined8
4048
4102
  } from "@xylabs/sdk-js";
4049
4103
  import {
4050
4104
  asSignedHydratedBlockWithHashMeta,
@@ -4119,11 +4173,11 @@ var SimpleBlockViewer = class extends AbstractCreatableProvider {
4119
4173
  static async paramsHandler(params) {
4120
4174
  const headPollIntervalMs = params.headPollIntervalMs;
4121
4175
  if (headPollIntervalMs !== void 0) {
4122
- assertEx32(headPollIntervalMs >= MIN_HEAD_POLL_INTERVAL_MS, () => `headPollIntervalMs must be at least ${MIN_HEAD_POLL_INTERVAL_MS}ms`);
4176
+ assertEx33(headPollIntervalMs >= MIN_HEAD_POLL_INTERVAL_MS, () => `headPollIntervalMs must be at least ${MIN_HEAD_POLL_INTERVAL_MS}ms`);
4123
4177
  }
4124
4178
  return {
4125
4179
  ...await super.paramsHandler(params),
4126
- finalizedArchivist: assertEx32(params.finalizedArchivist, () => "finalizedArchivist is required"),
4180
+ finalizedArchivist: assertEx33(params.finalizedArchivist, () => "finalizedArchivist is required"),
4127
4181
  headPollIntervalMs
4128
4182
  };
4129
4183
  }
@@ -4144,7 +4198,7 @@ var SimpleBlockViewer = class extends AbstractCreatableProvider {
4144
4198
  async blockByNumber(blockNumber) {
4145
4199
  return await this.spanAsync("blockByNumber", async () => {
4146
4200
  const chainContext = await this.getChainContextRead();
4147
- if (isUndefined6(chainContext.head)) {
4201
+ if (isUndefined8(chainContext.head)) {
4148
4202
  return null;
4149
4203
  }
4150
4204
  return await this.blockByNumberWithContext(chainContext, blockNumber);
@@ -4152,8 +4206,8 @@ var SimpleBlockViewer = class extends AbstractCreatableProvider {
4152
4206
  }
4153
4207
  async blocksByHash(hash, limit = 50) {
4154
4208
  return await this.spanAsync("blocksByHash", async () => {
4155
- assertEx32(limit > 0, () => "limit must be greater than 0");
4156
- assertEx32(limit <= 100, () => "limit must be less than 100");
4209
+ assertEx33(limit > 0, () => "limit must be greater than 0");
4210
+ assertEx33(limit <= 100, () => "limit must be less than 100");
4157
4211
  const blocks = [];
4158
4212
  let current = await this.blockByHash(hash);
4159
4213
  while (current && blocks.length < limit) {
@@ -4167,10 +4221,10 @@ var SimpleBlockViewer = class extends AbstractCreatableProvider {
4167
4221
  }
4168
4222
  async blocksByNumber(blockNumber, limit = 50) {
4169
4223
  return await this.spanAsync("blocksByNumber", async () => {
4170
- assertEx32(limit > 0, () => "limit must be greater than 0");
4171
- assertEx32(limit <= 100, () => "limit must be less than 100");
4224
+ assertEx33(limit > 0, () => "limit must be greater than 0");
4225
+ assertEx33(limit <= 100, () => "limit must be less than 100");
4172
4226
  const chainContext = await this.getChainContextRead();
4173
- if (isUndefined6(chainContext.head)) {
4227
+ if (isUndefined8(chainContext.head)) {
4174
4228
  return [];
4175
4229
  }
4176
4230
  const blocks = [];
@@ -4186,7 +4240,7 @@ var SimpleBlockViewer = class extends AbstractCreatableProvider {
4186
4240
  }
4187
4241
  async chainId(blockNumber = "latest") {
4188
4242
  return await this.spanAsync("chainId", async () => {
4189
- return blockNumber === "latest" ? (await this.finalizationViewer.headBlock()).chain : assertEx32(await this.blockByNumber(blockNumber), () => `Block not found [${blockNumber}]`)[0].chain;
4243
+ return blockNumber === "latest" ? (await this.finalizationViewer.headBlock()).chain : assertEx33(await this.blockByNumber(blockNumber), () => `Block not found [${blockNumber}]`)[0].chain;
4190
4244
  }, this.context);
4191
4245
  }
4192
4246
  async createHandler() {
@@ -4317,7 +4371,7 @@ SimpleBlockRewardViewer = __decorateClass([
4317
4371
  ], SimpleBlockRewardViewer);
4318
4372
 
4319
4373
  // src/simple/blockValidation/SimpleBlockValidationViewer.ts
4320
- import { assertEx as assertEx33 } from "@xylabs/sdk-js";
4374
+ import { assertEx as assertEx34 } from "@xylabs/sdk-js";
4321
4375
  import { PayloadBuilder as PayloadBuilder18 } from "@xyo-network/sdk-js";
4322
4376
  import {
4323
4377
  AccountBalanceViewerMoniker as AccountBalanceViewerMoniker2,
@@ -4370,7 +4424,7 @@ var SimpleBlockValidationViewer = class extends AbstractCreatableProvider {
4370
4424
  head: void 0
4371
4425
  };
4372
4426
  const blocksWithMeta = await Promise.all(blocks.map((b) => Promise.all([PayloadBuilder18.addHashMeta(b[0]), PayloadBuilder18.addHashMeta(b[1])])));
4373
- const head = isChainQualifiedHeadConfig5(config) ? assertEx33(
4427
+ const head = isChainQualifiedHeadConfig5(config) ? assertEx34(
4374
4428
  (await this.blockViewer.blockByHash(config.head))?.[0],
4375
4429
  () => `Specified a head that is not in the chain [${config.head}]`
4376
4430
  ) : void 0;
@@ -4452,7 +4506,7 @@ SimpleBlockValidationViewer = __decorateClass([
4452
4506
 
4453
4507
  // src/simple/chainContractViewer/SimpleChainContractViewer.ts
4454
4508
  import {
4455
- assertEx as assertEx34
4509
+ assertEx as assertEx35
4456
4510
  } from "@xylabs/sdk-js";
4457
4511
  import {
4458
4512
  ChainContractViewerMoniker as ChainContractViewerMoniker2,
@@ -4473,7 +4527,7 @@ var SimpleChainContractViewer = class extends AbstractCreatableProvider {
4473
4527
  let contractViewer = this;
4474
4528
  let forkedAtBlockNumber = await contractViewer.forkedAtBlockNumber();
4475
4529
  while (forkedAtBlockNumber !== null && blockNumber <= forkedAtBlockNumber) {
4476
- contractViewer = assertEx34(await contractViewer.forkedChainContractViewer());
4530
+ contractViewer = assertEx35(await contractViewer.forkedChainContractViewer());
4477
4531
  forkedAtBlockNumber = await contractViewer.forkedAtBlockNumber();
4478
4532
  chainId = await contractViewer.chainId();
4479
4533
  }
@@ -4527,7 +4581,7 @@ var SimpleXyoClient = class {
4527
4581
 
4528
4582
  // src/simple/datalake/RestDataLakeRunner.ts
4529
4583
  import {
4530
- assertEx as assertEx35,
4584
+ assertEx as assertEx36,
4531
4585
  exists as exists6
4532
4586
  } from "@xylabs/sdk-js";
4533
4587
  import { isAnyPayload as isAnyPayload7, PayloadZodLoose } from "@xyo-network/sdk-js";
@@ -4600,7 +4654,7 @@ var RestDataLakeRunner = class extends AbstractRestDataLake {
4600
4654
  async insert(items) {
4601
4655
  const allowedItems = items.map((item) => {
4602
4656
  if (isAnyPayload7(item) && this.isAllowed(item)) {
4603
- assertEx35(typeof item === "object" && item !== null, () => "Data must be an object");
4657
+ assertEx36(typeof item === "object" && item !== null, () => "Data must be an object");
4604
4658
  return item;
4605
4659
  }
4606
4660
  return null;
@@ -4750,7 +4804,7 @@ SimpleFinalizationRunner = __decorateClass([
4750
4804
 
4751
4805
  // src/simple/finalization/SimpleFinalizationViewer.ts
4752
4806
  import {
4753
- assertEx as assertEx36
4807
+ assertEx as assertEx37
4754
4808
  } from "@xylabs/sdk-js";
4755
4809
  import {
4756
4810
  asSignedHydratedBlockWithStorageMeta as asSignedHydratedBlockWithStorageMeta2,
@@ -4780,7 +4834,7 @@ var SimpleFinalizationViewer = class extends AbstractCreatableProvider {
4780
4834
  static async paramsHandler(params) {
4781
4835
  return {
4782
4836
  ...await super.paramsHandler(params),
4783
- finalizedArchivist: assertEx36(params.finalizedArchivist, () => "finalizedArchivist is required")
4837
+ finalizedArchivist: assertEx37(params.finalizedArchivist, () => "finalizedArchivist is required")
4784
4838
  };
4785
4839
  }
4786
4840
  chainId() {
@@ -4788,18 +4842,18 @@ var SimpleFinalizationViewer = class extends AbstractCreatableProvider {
4788
4842
  }
4789
4843
  async createHandler() {
4790
4844
  await super.createHandler();
4791
- this._chainId = assertEx36(this.config.chain.id ?? (await findMostRecentBlock(this.params.finalizedArchivist))?.chain, () => "chain.id is required if empty archivist");
4845
+ this._chainId = assertEx37(this.config.chain.id ?? (await findMostRecentBlock(this.params.finalizedArchivist))?.chain, () => "chain.id is required if empty archivist");
4792
4846
  this._store = { chainMap: this.params.finalizedArchivist };
4793
4847
  }
4794
4848
  async head() {
4795
4849
  return await this.spanAsync("head", async () => {
4796
- const currentHead = assertEx36(await this.getCurrentHead(), () => "Could not find most recent block [currentBlock]");
4850
+ const currentHead = assertEx37(await this.getCurrentHead(), () => "Could not find most recent block [currentBlock]");
4797
4851
  const cache = this.hydratedBlockCache;
4798
4852
  const block = await cache.get(currentHead._hash);
4799
4853
  if (!block) {
4800
4854
  this.logger?.error(`Could not find current block with hash ${currentHead._hash}`);
4801
4855
  }
4802
- return assertEx36(block, () => "Could not find current block");
4856
+ return assertEx37(block, () => "Could not find current block");
4803
4857
  }, this.context);
4804
4858
  }
4805
4859
  async headBlock() {
@@ -4825,8 +4879,8 @@ var SimpleFinalizationViewer = class extends AbstractCreatableProvider {
4825
4879
  }
4826
4880
  async getCurrentHead() {
4827
4881
  const chainArchivist = this.finalizedArchivist;
4828
- const result = assertEx36(await findMostRecentBlock(chainArchivist), () => "Could not find most recent block [getCurrentHead]");
4829
- assertEx36(result?.chain === this._chainId, () => "Chain ID does not match head block chain ID");
4882
+ const result = assertEx37(await findMostRecentBlock(chainArchivist), () => "Could not find most recent block [getCurrentHead]");
4883
+ assertEx37(result?.chain === this._chainId, () => "Chain ID does not match head block chain ID");
4830
4884
  return result;
4831
4885
  }
4832
4886
  };
@@ -4856,9 +4910,9 @@ var SimpleXyoGateway = class _SimpleXyoGateway extends AbstractCreatableProvider
4856
4910
 
4857
4911
  // src/simple/gateway/SimpleXyoGatewayRunner.ts
4858
4912
  import {
4859
- assertEx as assertEx37,
4913
+ assertEx as assertEx38,
4860
4914
  BigIntToJsonZod,
4861
- isDefined as isDefined17
4915
+ isDefined as isDefined18
4862
4916
  } from "@xylabs/sdk-js";
4863
4917
  import { PayloadBuilder as PayloadBuilder20 } from "@xyo-network/sdk-js";
4864
4918
  import {
@@ -4889,23 +4943,23 @@ var SimpleXyoGatewayRunner = class _SimpleXyoGatewayRunner extends AbstractCreat
4889
4943
  return this._signer;
4890
4944
  }
4891
4945
  async addPayloadsToChain(onChain, offChain, options) {
4892
- const viewer = assertEx37(this.connection.viewer, () => "No viewer available on connection");
4946
+ const viewer = assertEx38(this.connection.viewer, () => "No viewer available on connection");
4893
4947
  const {
4894
4948
  nbf,
4895
4949
  exp,
4896
4950
  chain,
4897
4951
  fees
4898
4952
  } = options ?? {};
4899
- const resolvedChainId = isDefined17(chain) ? chain : await viewer.chainId();
4900
- const resolvedNbf = asXL1BlockNumber9(isDefined17(nbf) ? nbf : await viewer.currentBlockNumber(), true);
4901
- const resolvedExp = asXL1BlockNumber9(isDefined17(exp) ? exp : resolvedNbf + 10, true);
4953
+ const resolvedChainId = isDefined18(chain) ? chain : await viewer.chainId();
4954
+ const resolvedNbf = asXL1BlockNumber9(isDefined18(nbf) ? nbf : await viewer.currentBlockNumber(), true);
4955
+ const resolvedExp = asXL1BlockNumber9(isDefined18(exp) ? exp : resolvedNbf + 10, true);
4902
4956
  const tx = await buildUnsignedTransaction(resolvedChainId, onChain, offChain, resolvedNbf, resolvedExp, await this.signer.address(), fees);
4903
4957
  return await this.addTransactionToChain(tx, await PayloadBuilder20.addHashMeta(offChain));
4904
4958
  }
4905
4959
  async addTransactionToChain(tx, offChain = []) {
4906
4960
  const connection = this.connection;
4907
4961
  const signer = this.signer;
4908
- const runner = assertEx37(connection.runner, () => "No runner available on connection");
4962
+ const runner = assertEx38(connection.runner, () => "No runner available on connection");
4909
4963
  let signedTx;
4910
4964
  if (isSignedHydratedTransaction(tx)) {
4911
4965
  const [bw, payloads] = tx;
@@ -4920,7 +4974,7 @@ var SimpleXyoGatewayRunner = class _SimpleXyoGatewayRunner extends AbstractCreat
4920
4974
  }
4921
4975
  async confirmSubmittedTransaction(txHash, options) {
4922
4976
  return await confirmSubmittedTransaction(
4923
- assertEx37(this.connection.viewer, () => "Connection viewer is undefined"),
4977
+ assertEx38(this.connection.viewer, () => "Connection viewer is undefined"),
4924
4978
  txHash,
4925
4979
  options
4926
4980
  );
@@ -4957,7 +5011,7 @@ var SimpleXyoGatewayRunner = class _SimpleXyoGatewayRunner extends AbstractCreat
4957
5011
 
4958
5012
  // src/simple/mempool/SimpleMempoolRunner.ts
4959
5013
  import {
4960
- assertEx as assertEx38,
5014
+ assertEx as assertEx39,
4961
5015
  exists as exists8
4962
5016
  } from "@xylabs/sdk-js";
4963
5017
  import {
@@ -5035,8 +5089,8 @@ var SimpleMempoolRunner = class extends AbstractCreatableProvider {
5035
5089
  static async paramsHandler(params) {
5036
5090
  return {
5037
5091
  ...await super.paramsHandler(params),
5038
- pendingBlocksArchivist: assertEx38(params?.pendingBlocksArchivist, () => "pendingBlocksArchivist is required"),
5039
- pendingTransactionsArchivist: assertEx38(params?.pendingTransactionsArchivist, () => "pendingTransactionsArchivist is required")
5092
+ pendingBlocksArchivist: assertEx39(params?.pendingBlocksArchivist, () => "pendingBlocksArchivist is required"),
5093
+ pendingTransactionsArchivist: assertEx39(params?.pendingTransactionsArchivist, () => "pendingTransactionsArchivist is required")
5040
5094
  };
5041
5095
  }
5042
5096
  async createHandler() {
@@ -5074,7 +5128,7 @@ var SimpleMempoolRunner = class extends AbstractCreatableProvider {
5074
5128
  return b;
5075
5129
  }
5076
5130
  }).filter(exists8);
5077
- assertEx38(
5131
+ assertEx39(
5078
5132
  remainingBlockMap.length === remainingBlocks.length,
5079
5133
  () => `remainingBlockMap length should match remainingBlocks length [${remainingBlockMap.length}/${remainingBlocks.length}]`
5080
5134
  );
@@ -5136,7 +5190,7 @@ var SimpleMempoolRunner = class extends AbstractCreatableProvider {
5136
5190
  return t;
5137
5191
  }
5138
5192
  }).filter(exists8);
5139
- assertEx38(
5193
+ assertEx39(
5140
5194
  remainingTransactionMap.length === remainingTransactions.length,
5141
5195
  () => `remainingTransactionMap length should match remainingTransactions length [${remainingTransactionMap.length}/${remainingTransactions.length}]`
5142
5196
  );
@@ -5387,7 +5441,7 @@ SimpleMempoolRunner = __decorateClass([
5387
5441
  // src/simple/mempool/SimpleMempoolViewer.ts
5388
5442
  import {
5389
5443
  exists as exists9,
5390
- isDefined as isDefined18,
5444
+ isDefined as isDefined19,
5391
5445
  isHash as isHash2
5392
5446
  } from "@xylabs/sdk-js";
5393
5447
  import { isHashMeta as isHashMeta2, isPayloadBundle as isPayloadBundle2 } from "@xyo-network/sdk-js";
@@ -5451,7 +5505,7 @@ var SimpleMempoolViewer = class extends AbstractCreatableProvider {
5451
5505
  let cursor = void 0;
5452
5506
  if (isHash2(providedCursor)) {
5453
5507
  const [p] = await this.pendingBlocksArchivist.get([providedCursor]);
5454
- if (isDefined18(p)) {
5508
+ if (isDefined19(p)) {
5455
5509
  cursor = p._sequence;
5456
5510
  }
5457
5511
  }
@@ -5470,7 +5524,7 @@ var SimpleMempoolViewer = class extends AbstractCreatableProvider {
5470
5524
  let cursor = void 0;
5471
5525
  if (isHash2(providedCursor)) {
5472
5526
  const [p] = await this.pendingTransactionsArchivist.get([providedCursor]);
5473
- if (isDefined18(p)) {
5527
+ if (isDefined19(p)) {
5474
5528
  cursor = p._sequence;
5475
5529
  }
5476
5530
  }
@@ -5485,7 +5539,7 @@ var SimpleMempoolViewer = class extends AbstractCreatableProvider {
5485
5539
  const hydratedWithBundle = (await Promise.all(
5486
5540
  filteredBundles.map(async (bundle3) => {
5487
5541
  const tx = await bundledPayloadToHydratedTransaction(bundle3);
5488
- return isDefined18(tx) ? { bundle: bundle3, tx } : void 0;
5542
+ return isDefined19(tx) ? { bundle: bundle3, tx } : void 0;
5489
5543
  })
5490
5544
  )).filter(exists9);
5491
5545
  const currentBlock = await this.windowedBlockViewer.currentBlock();
@@ -5606,7 +5660,7 @@ function deduplicateWithBundleBySigner(items) {
5606
5660
 
5607
5661
  // src/simple/network/SimpleXyoNetwork.ts
5608
5662
  import { fetchJsonGet } from "@xylabs/fetch";
5609
- import { isUndefined as isUndefined7 } from "@xylabs/sdk-js";
5663
+ import { isUndefined as isUndefined9 } from "@xylabs/sdk-js";
5610
5664
  import { isNetworkStatus } from "@xyo-network/xl1-protocol-lib";
5611
5665
 
5612
5666
  // src/simple/network/lib/FailedNetworkStatusPayloads.ts
@@ -5654,7 +5708,7 @@ var SimpleXyoNetwork = class {
5654
5708
  }
5655
5709
  async status() {
5656
5710
  const statusNetwork = StatusNetworks[this._networkId];
5657
- if (isUndefined7(statusNetwork)) {
5711
+ if (isUndefined9(statusNetwork)) {
5658
5712
  throw new Error(`Unknown status network ID: ${this._networkId}`);
5659
5713
  }
5660
5714
  return await this.makeRequest(statusNetwork.statusUrl);
@@ -5679,7 +5733,7 @@ var SimpleXyoNetwork = class {
5679
5733
  };
5680
5734
 
5681
5735
  // src/simple/permissions/SimpleXyoPermissions.ts
5682
- import { assertEx as assertEx39 } from "@xylabs/sdk-js";
5736
+ import { assertEx as assertEx40 } from "@xylabs/sdk-js";
5683
5737
  var SimpleXyoPermissions = class {
5684
5738
  invoker;
5685
5739
  _store;
@@ -5688,7 +5742,7 @@ var SimpleXyoPermissions = class {
5688
5742
  this.invoker = store.invoker;
5689
5743
  }
5690
5744
  get store() {
5691
- return assertEx39(this._store, () => "Store must be defined to get permissions");
5745
+ return assertEx40(this._store, () => "Store must be defined to get permissions");
5692
5746
  }
5693
5747
  async getPermissions() {
5694
5748
  return await this.store.getPermissions();
@@ -5741,7 +5795,7 @@ var SimpleXyoPermissions = class {
5741
5795
  };
5742
5796
 
5743
5797
  // src/simple/permissions/store/MemoryPermissions.ts
5744
- import { assertEx as assertEx40 } from "@xylabs/sdk-js";
5798
+ import { assertEx as assertEx41 } from "@xylabs/sdk-js";
5745
5799
  var MemoryPermissionsStore = class {
5746
5800
  _invoker;
5747
5801
  permissions = [];
@@ -5749,7 +5803,7 @@ var MemoryPermissionsStore = class {
5749
5803
  this._invoker = invoker;
5750
5804
  }
5751
5805
  get invoker() {
5752
- return assertEx40(this._invoker, () => "Invoker must be defined to get permissions");
5806
+ return assertEx41(this._invoker, () => "Invoker must be defined to get permissions");
5753
5807
  }
5754
5808
  async getPermissions() {
5755
5809
  await Promise.resolve();
@@ -5840,7 +5894,7 @@ var SimpleXyoSigner = class _SimpleXyoSigner extends AbstractCreatableProvider {
5840
5894
  };
5841
5895
 
5842
5896
  // src/simple/StakeEventsViewer/SimpleStakeEventsViewer.ts
5843
- import { isDefined as isDefined19 } from "@xylabs/sdk-js";
5897
+ import { isDefined as isDefined20 } from "@xylabs/sdk-js";
5844
5898
  import {
5845
5899
  StakeEventsViewerMoniker
5846
5900
  } from "@xyo-network/xl1-protocol-lib";
@@ -5855,7 +5909,7 @@ var SimpleStakeEventsViewer = class extends AbstractCreatableProvider {
5855
5909
  stakeEvents(range, { name } = {}) {
5856
5910
  const positions = this.positionsFromRange(range);
5857
5911
  const events = this.eventsFromPositions(positions);
5858
- if (isDefined19(name)) {
5912
+ if (isDefined20(name)) {
5859
5913
  return events.filter((event) => event.name === name);
5860
5914
  }
5861
5915
  return events;
@@ -5921,7 +5975,7 @@ SimpleStakeEventsViewer = __decorateClass([
5921
5975
 
5922
5976
  // src/simple/StakeTotalsViewer/SimpleStakeTotalsViewer.ts
5923
5977
  import { asAddress as asAddress3 } from "@xylabs/sdk-js";
5924
- import { assertEx as assertEx41 } from "@xylabs/sdk-js";
5978
+ import { assertEx as assertEx42 } from "@xylabs/sdk-js";
5925
5979
  import {
5926
5980
  StakeTotalsViewerMoniker,
5927
5981
  StakeViewerMoniker
@@ -5964,7 +6018,7 @@ var SimpleStakeTotalsViewer = class extends AbstractCreatableProvider {
5964
6018
  }
5965
6019
  async createHandler() {
5966
6020
  await super.createHandler();
5967
- this._stakeViewer = assertEx41(
6021
+ this._stakeViewer = assertEx42(
5968
6022
  await this.locateAndCreate(StakeViewerMoniker),
5969
6023
  () => "Failed to create StakeViewer"
5970
6024
  );
@@ -6022,7 +6076,7 @@ import {
6022
6076
  asAddress as asAddress4,
6023
6077
  toAddress as toAddress6
6024
6078
  } from "@xylabs/sdk-js";
6025
- import { assertEx as assertEx42 } from "@xylabs/sdk-js";
6079
+ import { assertEx as assertEx43 } from "@xylabs/sdk-js";
6026
6080
  import {
6027
6081
  StakeEventsViewerMoniker as StakeEventsViewerMoniker2,
6028
6082
  StakeViewerMoniker as StakeViewerMoniker2
@@ -6031,7 +6085,7 @@ var SimpleStakeViewer = class extends AbstractCreatableProvider {
6031
6085
  moniker = SimpleStakeViewer.defaultMoniker;
6032
6086
  _chainStakeEventsViewer;
6033
6087
  get stakeEvents() {
6034
- return assertEx42(this._chainStakeEventsViewer, () => "Stake events viewer not set");
6088
+ return assertEx43(this._chainStakeEventsViewer, () => "Stake events viewer not set");
6035
6089
  }
6036
6090
  get positions() {
6037
6091
  return this.params.positions;
@@ -6071,7 +6125,7 @@ var SimpleStakeViewer = class extends AbstractCreatableProvider {
6071
6125
  }
6072
6126
  async createHandler() {
6073
6127
  await super.createHandler();
6074
- this._chainStakeEventsViewer = assertEx42(
6128
+ this._chainStakeEventsViewer = assertEx43(
6075
6129
  await this.locateAndCreate(StakeEventsViewerMoniker2),
6076
6130
  () => "Failed to create StakeEventsViewer"
6077
6131
  );
@@ -6106,7 +6160,7 @@ var SimpleStakeViewer = class extends AbstractCreatableProvider {
6106
6160
  return toAddress6(toAddress6(1n));
6107
6161
  }
6108
6162
  stakeById(id) {
6109
- return assertEx42(this.positions[id], () => new Error(`Stake with id ${id} not found`));
6163
+ return assertEx43(this.positions[id], () => new Error(`Stake with id ${id} not found`));
6110
6164
  }
6111
6165
  stakeByStaker(staker, slot) {
6112
6166
  return this.positions.filter((s) => asAddress4(s.staker) === asAddress4(staker))[slot];
@@ -6156,8 +6210,8 @@ SimpleStakeViewer = __decorateClass([
6156
6210
  // src/simple/timeSync2/SimpleTimeSyncViewer.ts
6157
6211
  import {
6158
6212
  asHash as asHash5,
6159
- assertEx as assertEx43,
6160
- isDefined as isDefined20
6213
+ assertEx as assertEx44,
6214
+ isDefined as isDefined21
6161
6215
  } from "@xylabs/sdk-js";
6162
6216
  import {
6163
6217
  asTimePayload as asTimePayload2,
@@ -6178,10 +6232,10 @@ var SimpleTimeSyncViewer = class extends AbstractCreatableProvider {
6178
6232
  async convertTime(fromDomain, toDomain, from) {
6179
6233
  switch (fromDomain) {
6180
6234
  case "xl1": {
6181
- const [block, payloads] = assertEx43(await this.blockViewer.blockByNumber(asXL1BlockNumber10(from, true)), () => "Block not found");
6235
+ const [block, payloads] = assertEx44(await this.blockViewer.blockByNumber(asXL1BlockNumber10(from, true)), () => "Block not found");
6182
6236
  const timeSchemaIndex = block.payload_schemas.indexOf(TimeSchema);
6183
6237
  const hash = timeSchemaIndex === -1 ? void 0 : block.payload_hashes[timeSchemaIndex];
6184
- const timePayload = asTimePayload2(isDefined20(hash) ? payloads.find((p) => p._hash === hash) : void 0);
6238
+ const timePayload = asTimePayload2(isDefined21(hash) ? payloads.find((p) => p._hash === hash) : void 0);
6185
6239
  if (timePayload === void 0) return 0;
6186
6240
  switch (toDomain) {
6187
6241
  case "xl1": {
@@ -6233,10 +6287,10 @@ var SimpleTimeSyncViewer = class extends AbstractCreatableProvider {
6233
6287
  return [Date.now(), null];
6234
6288
  }
6235
6289
  case "ethereum": {
6236
- const provider = assertEx43(this.ethProvider, () => "Ethereum provider not configured");
6290
+ const provider = assertEx44(this.ethProvider, () => "Ethereum provider not configured");
6237
6291
  const blockNumber = await provider.getBlockNumber() ?? 0;
6238
6292
  const block = await provider.getBlock(blockNumber);
6239
- const blockHash = asHash5(assertEx43(block?.hash, () => "Block hash not found"), true);
6293
+ const blockHash = asHash5(assertEx44(block?.hash, () => "Block hash not found"), true);
6240
6294
  return [blockNumber, blockHash];
6241
6295
  }
6242
6296
  default: {
@@ -6251,10 +6305,10 @@ var SimpleTimeSyncViewer = class extends AbstractCreatableProvider {
6251
6305
  // this is for the previous block
6252
6306
  xl1,
6253
6307
  // this is for the previous block
6254
- xl1Hash: assertEx43(xl1Hash, () => "No xl1 hash available from time sync service"),
6308
+ xl1Hash: assertEx44(xl1Hash, () => "No xl1 hash available from time sync service"),
6255
6309
  epoch: Date.now()
6256
6310
  };
6257
- if (isDefined20(this.ethProvider)) {
6311
+ if (isDefined21(this.ethProvider)) {
6258
6312
  const [ethereum, ethHashOrNull] = await this.currentTimeAndHash("ethereum");
6259
6313
  const ethereumHash = asHash5(ethHashOrNull, () => "No ethereum hash available from time sync service");
6260
6314
  timePayload.ethereum = ethereum;
@@ -6271,7 +6325,7 @@ SimpleTimeSyncViewer = __decorateClass([
6271
6325
  ], SimpleTimeSyncViewer);
6272
6326
 
6273
6327
  // src/simple/transactionValidation/SimpleTransactionValidationViewer.ts
6274
- import { assertEx as assertEx44 } from "@xylabs/sdk-js";
6328
+ import { assertEx as assertEx45 } from "@xylabs/sdk-js";
6275
6329
  import { PayloadBuilder as PayloadBuilder24 } from "@xyo-network/sdk-js";
6276
6330
  import {
6277
6331
  AccountBalanceViewerMoniker as AccountBalanceViewerMoniker3,
@@ -6322,7 +6376,7 @@ var SimpleTransactionValidationViewer = class extends AbstractCreatableProvider
6322
6376
  head: void 0
6323
6377
  };
6324
6378
  const transactionsWithMeta = await Promise.all(transactions.map((b) => Promise.all([PayloadBuilder24.addHashMeta(b[0]), PayloadBuilder24.addHashMeta(b[1])])));
6325
- const head = isChainQualifiedHeadConfig6(config) ? assertEx44(
6379
+ const head = isChainQualifiedHeadConfig6(config) ? assertEx45(
6326
6380
  (await this.blockViewer.blockByHash(config.head))?.[0],
6327
6381
  () => `Specified a head that is not in the chain [${config.head}]`
6328
6382
  ) : void 0;
@@ -6389,7 +6443,7 @@ SimpleTransactionValidationViewer = __decorateClass([
6389
6443
 
6390
6444
  // src/simple/TransactionViewer/SimpleTransactionViewer.ts
6391
6445
  import {
6392
- assertEx as assertEx45,
6446
+ assertEx as assertEx46,
6393
6447
  exists as exists10
6394
6448
  } from "@xylabs/sdk-js";
6395
6449
  import { BoundWitnessSchema } from "@xyo-network/sdk-js";
@@ -6408,7 +6462,7 @@ var SimpleTransactionViewer = class extends AbstractCreatableProvider {
6408
6462
  }
6409
6463
  async byBlockHashAndIndex(blockHash, transactionIndex) {
6410
6464
  return await this.spanAsync("byBlockHashAndIndex", async () => {
6411
- assertEx45(transactionIndex >= 0, () => "transactionIndex must be greater than or equal to 0");
6465
+ assertEx46(transactionIndex >= 0, () => "transactionIndex must be greater than or equal to 0");
6412
6466
  try {
6413
6467
  const block = await this.blockViewer.blockByHash(blockHash);
6414
6468
  if (!block) return null;
@@ -6472,7 +6526,7 @@ SimpleTransactionViewer = __decorateClass([
6472
6526
 
6473
6527
  // src/simple/windowedBlock/SimpleWindowedBlockViewer.ts
6474
6528
  import {
6475
- assertEx as assertEx46,
6529
+ assertEx as assertEx47,
6476
6530
  exists as exists11,
6477
6531
  isNull as isNull2
6478
6532
  } from "@xylabs/sdk-js";
@@ -6543,7 +6597,7 @@ var SimpleWindowedBlockViewer = class extends AbstractCreatableProvider {
6543
6597
  }
6544
6598
  async createHandler() {
6545
6599
  await super.createHandler();
6546
- this._blockViewer = assertEx46(
6600
+ this._blockViewer = assertEx47(
6547
6601
  this.params.blockViewer ?? await this.locator.getInstance(BlockViewerMoniker7),
6548
6602
  () => "BlockViewer instance is required"
6549
6603
  );
@@ -6552,13 +6606,13 @@ var SimpleWindowedBlockViewer = class extends AbstractCreatableProvider {
6552
6606
  this._transactionHashMap = new MemoryMap();
6553
6607
  }
6554
6608
  currentBlock() {
6555
- return assertEx46(this._chain.at(-1));
6609
+ return assertEx47(this._chain.at(-1));
6556
6610
  }
6557
6611
  currentBlockHash() {
6558
- return assertEx46(this._chain.at(-1)?.[0]._hash);
6612
+ return assertEx47(this._chain.at(-1)?.[0]._hash);
6559
6613
  }
6560
6614
  currentBlockNumber() {
6561
- return assertEx46(this._chain.at(-1)?.[0].block);
6615
+ return assertEx47(this._chain.at(-1)?.[0].block);
6562
6616
  }
6563
6617
  async payloadByHash(hash) {
6564
6618
  const payloads = await this.payloadsByHash([hash]);
@@ -6717,13 +6771,13 @@ var RuntimeStatusMonitor = class extends LoggerStatusReporter {
6717
6771
  };
6718
6772
 
6719
6773
  // src/time/primitives/xl1BlockNumberToEthBlockNumber.ts
6720
- import { assertEx as assertEx47 } from "@xylabs/sdk-js";
6774
+ import { assertEx as assertEx48 } from "@xylabs/sdk-js";
6721
6775
  import { asTimePayload as asTimePayload3, TimeSchema as TimeSchema2 } from "@xyo-network/xl1-protocol-lib";
6722
6776
  async function xl1BlockNumberToEthBlockNumber(context, xl1BlockNumber) {
6723
6777
  const blockHash = await hashFromBlockNumber(context, xl1BlockNumber);
6724
6778
  const hydratedBlock = await hydrateBlock(context, blockHash);
6725
6779
  const timePayload = asTimePayload3(hydratedBlock[1].find((p) => p.schema === TimeSchema2), { required: true });
6726
- return assertEx47(timePayload.ethereum, () => "No ethereum timestamp found on block");
6780
+ return assertEx48(timePayload.ethereum, () => "No ethereum timestamp found on block");
6727
6781
  }
6728
6782
 
6729
6783
  // src/validation/lib/isLocalhost.ts
@@ -6808,6 +6862,7 @@ export {
6808
6862
  MissingCapabilityError,
6809
6863
  MnemonicStringZod,
6810
6864
  PRODUCER_DIVERSITY_BONUS,
6865
+ PayloadLocator,
6811
6866
  PostMessageRpcRemoteConfigZod,
6812
6867
  ProviderConfigZod,
6813
6868
  ProviderFactory,