@xyo-network/xl1-protocol 1.12.57 → 1.12.58

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.
@@ -279,35 +279,110 @@ var XL1Amount = class _XL1Amount {
279
279
  import { BoundWitnessSchema } from "@xyo-network/boundwitness-model";
280
280
  import { isHashStorageMeta as isHashStorageMeta2, isSchema } from "@xyo-network/payload-model";
281
281
  import { isSchemaPayload, SchemaSchema } from "@xyo-network/schema-payload-plugin";
282
- import z2 from "zod";
282
+ import z4 from "zod";
283
283
 
284
284
  // src/payload/elevatable/Bridge/BridgeDestinationObservation.ts
285
+ import { HexZod as HexZod2 } from "@xylabs/hex";
285
286
  import { AsObjectFactory } from "@xylabs/object";
286
- import { isPayloadOfSchemaType } from "@xyo-network/payload-model";
287
+ import { isPayloadOfZodType } from "@xyo-network/payload-model";
288
+
289
+ // src/payload/elevatable/Bridge/BridgeDetails.ts
290
+ import { HexZod } from "@xylabs/hex";
291
+ import z2 from "zod";
292
+ var BridgeDetailsDestinationFieldsZod = z2.object({
293
+ /**
294
+ * Destination network
295
+ */
296
+ dest: HexZod.describe("The destination network identifier"),
297
+ /**
298
+ * Destination address (EOA or contract)
299
+ */
300
+ destAddress: HexZod.describe("The destination address (EOA or contract)"),
301
+ /**
302
+ * Token amount to bridge to destination
303
+ */
304
+ destAmount: HexZod.describe("The token amount to bridge to destination"),
305
+ /**
306
+ * Token being bridged to
307
+ */
308
+ destToken: HexZod.describe("The token being bridged to")
309
+ });
310
+ var BridgeDetailsSourceFieldsZod = z2.object({
311
+ /**
312
+ * Source network
313
+ */
314
+ src: HexZod.describe("The source network identifier"),
315
+ /**
316
+ * Source address (EOA or contract)
317
+ */
318
+ srcAddress: HexZod.describe("The source address (EOA or contract)"),
319
+ /**
320
+ * Token amount to bridge from source
321
+ */
322
+ srcAmount: HexZod.describe("The token amount to bridge from source"),
323
+ /**
324
+ * Token being bridged from
325
+ */
326
+ srcToken: HexZod.describe("The token being bridged from")
327
+ });
328
+ var BridgeDetailsFieldsZod = BridgeDetailsSourceFieldsZod.extend(
329
+ BridgeDetailsDestinationFieldsZod.shape
330
+ );
331
+
332
+ // src/payload/elevatable/Bridge/BridgeDestinationObservation.ts
287
333
  var BridgeDestinationObservationSchema = "network.xyo.chain.bridge.observation.destination";
288
- var isBridgeDestinationObservation = isPayloadOfSchemaType(BridgeDestinationObservationSchema);
334
+ var BridgeDestinationObservationFieldsZod = BridgeDetailsFieldsZod.extend({
335
+ /**
336
+ * Destination chain confirmation
337
+ */
338
+ destConfirmation: HexZod2.optional().describe("Destination chain confirmation")
339
+ });
340
+ var isBridgeDestinationObservation = isPayloadOfZodType(
341
+ BridgeDestinationObservationFieldsZod,
342
+ BridgeDestinationObservationSchema
343
+ );
289
344
  var asBridgeDestinationObservation = AsObjectFactory.create(isBridgeDestinationObservation);
290
345
 
291
346
  // src/payload/elevatable/Bridge/BridgeIntent.ts
292
347
  import { AsObjectFactory as AsObjectFactory2 } from "@xylabs/object";
293
- import { isPayloadOfSchemaType as isPayloadOfSchemaType2 } from "@xyo-network/payload-model";
348
+ import { isPayloadOfZodType as isPayloadOfZodType2 } from "@xyo-network/payload-model";
349
+ import z3 from "zod";
294
350
  var BridgeIntentSchema = "network.xyo.chain.bridge.intent";
295
- var isBridgeIntent = isPayloadOfSchemaType2(BridgeIntentSchema);
351
+ var BridgeIntentFieldsZod = BridgeDetailsFieldsZod.extend({
352
+ /**
353
+ * Unique identifier for replay protection
354
+ */
355
+ nonce: z3.string().describe("Unique identifier for replay protection")
356
+ });
357
+ var isBridgeIntent = isPayloadOfZodType2(
358
+ BridgeIntentFieldsZod,
359
+ BridgeIntentSchema
360
+ );
296
361
  var asBridgeIntent = AsObjectFactory2.create(isBridgeIntent);
297
362
 
298
363
  // src/payload/elevatable/Bridge/BridgeSourceObservation.ts
364
+ import { HexZod as HexZod3 } from "@xylabs/hex";
299
365
  import { AsObjectFactory as AsObjectFactory3 } from "@xylabs/object";
300
- import { isPayloadOfSchemaType as isPayloadOfSchemaType3 } from "@xyo-network/payload-model";
366
+ import { isPayloadOfZodType as isPayloadOfZodType3 } from "@xyo-network/payload-model";
301
367
  var BridgeSourceObservationSchema = "network.xyo.chain.bridge.observation.source";
302
- var isBridgeSourceObservation = isPayloadOfSchemaType3(BridgeSourceObservationSchema);
368
+ var BridgeSourceObservationFieldsZod = BridgeDetailsFieldsZod.extend({
369
+ /**
370
+ * Source chain confirmation
371
+ */
372
+ srcConfirmation: HexZod3.optional().describe("Source chain confirmation")
373
+ });
374
+ var isBridgeSourceObservation = isPayloadOfZodType3(
375
+ BridgeSourceObservationFieldsZod,
376
+ BridgeSourceObservationSchema
377
+ );
303
378
  var asBridgeSourceObservation = AsObjectFactory3.create(isBridgeSourceObservation);
304
379
 
305
380
  // src/payload/elevatable/ChainStakeIntent.ts
306
381
  import { AsObjectFactory as AsObjectFactory4 } from "@xylabs/object";
307
- import { isPayloadOfSchemaType as isPayloadOfSchemaType4, isStorageMeta } from "@xyo-network/payload-model";
382
+ import { isPayloadOfSchemaType, isStorageMeta } from "@xyo-network/payload-model";
308
383
  var ChainStakeIntentSchema = "network.xyo.chain.stake.intent";
309
384
  var isChainStakeIntent = (x) => {
310
- return isPayloadOfSchemaType4(ChainStakeIntentSchema)(x) && asNonNegativeInteger(x.nbf) !== void 0 && asNonNegativeInteger(x.exp) !== void 0;
385
+ return isPayloadOfSchemaType(ChainStakeIntentSchema)(x) && asNonNegativeInteger(x.nbf) !== void 0 && asNonNegativeInteger(x.exp) !== void 0;
311
386
  };
312
387
  var asChainStakeIntent = AsObjectFactory4.create(isChainStakeIntent);
313
388
  var isChainStakeIntentWithStorageMeta = (x) => {
@@ -331,37 +406,37 @@ var asExecutable = (value) => {
331
406
 
332
407
  // src/payload/elevatable/Hash.ts
333
408
  import { AsObjectFactory as AsObjectFactory5 } from "@xylabs/object";
334
- import { isPayloadOfSchemaType as isPayloadOfSchemaType5 } from "@xyo-network/payload-model";
409
+ import { isPayloadOfSchemaType as isPayloadOfSchemaType2 } from "@xyo-network/payload-model";
335
410
  var HashSchema = "network.xyo.hash";
336
- var isHashPayload = isPayloadOfSchemaType5(HashSchema);
411
+ var isHashPayload = isPayloadOfSchemaType2(HashSchema);
337
412
  var asHashPayload = AsObjectFactory5.create(isHashPayload);
338
413
  var asHashPayloadWithStorageMeta = AsObjectFactory5.create(isHashPayload);
339
414
 
340
415
  // src/payload/elevatable/StepComplete.ts
341
416
  import { AsObjectFactory as AsObjectFactory6 } from "@xylabs/object";
342
- import { isPayloadOfSchemaType as isPayloadOfSchemaType6 } from "@xyo-network/payload-model";
417
+ import { isPayloadOfSchemaType as isPayloadOfSchemaType3 } from "@xyo-network/payload-model";
343
418
  var StepCompleteSchema = "network.xyo.chain.step.complete";
344
- var isStepComplete = isPayloadOfSchemaType6(StepCompleteSchema);
419
+ var isStepComplete = isPayloadOfSchemaType3(StepCompleteSchema);
345
420
  var asStepComplete = AsObjectFactory6.create(isStepComplete);
346
421
 
347
422
  // src/payload/elevatable/Time.ts
348
423
  import { AsObjectFactory as AsObjectFactory7 } from "@xylabs/object";
349
- import { isPayloadOfSchemaType as isPayloadOfSchemaType7 } from "@xyo-network/payload-model";
424
+ import { isPayloadOfSchemaType as isPayloadOfSchemaType4 } from "@xyo-network/payload-model";
350
425
  var TimeSchema = "network.xyo.time";
351
426
  var isSafeEpoch = (value) => {
352
427
  return typeof value === "number" && value < 2 * Date.now();
353
428
  };
354
429
  var isTimePayload = (value) => {
355
- return isPayloadOfSchemaType7(TimeSchema)(value) && isSafeEpoch(value.epoch);
430
+ return isPayloadOfSchemaType4(TimeSchema)(value) && isSafeEpoch(value.epoch);
356
431
  };
357
432
  var asTimePayload = AsObjectFactory7.create(isTimePayload);
358
433
  var asTimePayloadWithStorageMeta = AsObjectFactory7.create(isTimePayload);
359
434
 
360
435
  // src/payload/elevatable/TransferPayload.ts
361
436
  import { AsObjectFactory as AsObjectFactory8 } from "@xylabs/object";
362
- import { isPayloadOfSchemaType as isPayloadOfSchemaType8 } from "@xyo-network/payload-model";
437
+ import { isPayloadOfSchemaType as isPayloadOfSchemaType5 } from "@xyo-network/payload-model";
363
438
  var TransferSchema = "network.xyo.transfer";
364
- var isTransfer = isPayloadOfSchemaType8(TransferSchema);
439
+ var isTransfer = isPayloadOfSchemaType5(TransferSchema);
365
440
  var asTransfer = AsObjectFactory8.create(isTransfer);
366
441
 
367
442
  // src/transaction/AnyHydratedTransaction.ts
@@ -533,7 +608,7 @@ var isAllowedBlockPayload = (value) => {
533
608
  var isAllowedBlockPayloadWithHashStorageMeta = (value) => {
534
609
  return isAllowedBlockPayload(value) && isHashStorageMeta2(value);
535
610
  };
536
- var AllowedBlockPayloadZod = z2.object({ schema: z2.enum(AllowedBlockPayloadSchemas) });
611
+ var AllowedBlockPayloadZod = z4.object({ schema: z4.enum(AllowedBlockPayloadSchemas) });
537
612
 
538
613
  // src/block/BlockBoundWitness.ts
539
614
  import { isHex as isHex2 } from "@xylabs/hex";
@@ -663,19 +738,19 @@ var XL1_PROTOCOL_VERSION = XL1_PROTOCOL_VERSION_MAJOR * 1e6 + XL1_PROTOCOL_VERSI
663
738
  // src/fields/BlockNumber.ts
664
739
  import { AsObjectFactory as AsObjectFactory21 } from "@xylabs/object";
665
740
  import {
666
- isPayloadOfSchemaType as isPayloadOfSchemaType9,
741
+ isPayloadOfSchemaType as isPayloadOfSchemaType6,
667
742
  isPayloadOfSchemaTypeWithSources
668
743
  } from "@xyo-network/payload-model";
669
744
  var BlockNumberSchema = "network.xyo.chain.block.number";
670
- var isBlockNumber = isPayloadOfSchemaType9(BlockNumberSchema);
745
+ var isBlockNumber = isPayloadOfSchemaType6(BlockNumberSchema);
671
746
  var asBlockNumber = AsObjectFactory21.create(isBlockNumber);
672
747
  var isBlockNumberWithSources = isPayloadOfSchemaTypeWithSources(BlockNumberSchema);
673
748
  var asBlockNumberWithSources = AsObjectFactory21.create(isBlockNumberWithSources);
674
749
 
675
750
  // src/network/Status.ts
676
- import { isPayloadOfSchemaType as isPayloadOfSchemaType10 } from "@xyo-network/payload-model";
751
+ import { isPayloadOfSchemaType as isPayloadOfSchemaType7 } from "@xyo-network/payload-model";
677
752
  var NetworkStatusSchema = "network.xyo.chain.status";
678
- var isNetworkStatus = isPayloadOfSchemaType10(NetworkStatusSchema);
753
+ var isNetworkStatus = isPayloadOfSchemaType7(NetworkStatusSchema);
679
754
 
680
755
  // src/provider/XyoDataLake.ts
681
756
  var isDataLakeViewer = (value) => {
@@ -687,10 +762,10 @@ var isDataLakeProvider = (value) => {
687
762
 
688
763
  // src/services/StakeIntentService/ChainIndexingServiceStateSchema.ts
689
764
  import { AsObjectFactory as AsObjectFactory22 } from "@xylabs/object";
690
- import { isPayloadOfSchemaType as isPayloadOfSchemaType11, isStorageMeta as isStorageMeta8 } from "@xyo-network/payload-model";
765
+ import { isPayloadOfSchemaType as isPayloadOfSchemaType8, isStorageMeta as isStorageMeta8 } from "@xyo-network/payload-model";
691
766
  var ChainIndexingServiceStateSchema = "network.xyo.chain.indexing.service.state";
692
767
  var isChainIndexingServiceState = (payload) => {
693
- return isPayloadOfSchemaType11(ChainIndexingServiceStateSchema)(payload);
768
+ return isPayloadOfSchemaType8(ChainIndexingServiceStateSchema)(payload);
694
769
  };
695
770
  var asChainIndexingServiceState = AsObjectFactory22.create(isChainIndexingServiceState);
696
771
  var isChainIndexingServiceStateWithStorageMeta = (value) => isChainIndexingServiceState(value) && isStorageMeta8(value);
@@ -782,8 +857,14 @@ export {
782
857
  BlockNumberSchema,
783
858
  BlockValidationError,
784
859
  BoundWitnessValidationError,
860
+ BridgeDestinationObservationFieldsZod,
785
861
  BridgeDestinationObservationSchema,
862
+ BridgeDetailsDestinationFieldsZod,
863
+ BridgeDetailsFieldsZod,
864
+ BridgeDetailsSourceFieldsZod,
865
+ BridgeIntentFieldsZod,
786
866
  BridgeIntentSchema,
867
+ BridgeSourceObservationFieldsZod,
787
868
  BridgeSourceObservationSchema,
788
869
  ChainIndexingServiceStateSchema,
789
870
  ChainStakeIntentSchema,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/amount/splitOnDecimal.ts","../../src/amount/splitOnDecimalToString.ts","../../src/amount/ShiftedBigInt.ts","../../src/amount/Xl1Amount.ts","../../src/xl1/isXL1Factory.ts","../../src/xl1/xl1MaxValue.ts","../../src/xl1/XL1Units.ts","../../src/xl1/AttoXL1.ts","../../src/xl1/FemtoXL1.ts","../../src/xl1/MicroXL1.ts","../../src/xl1/MilliXL1.ts","../../src/xl1/NanoXL1.ts","../../src/xl1/PicoXL1.ts","../../src/xl1/XL1.ts","../../src/block/AllowedBlockPayload.ts","../../src/payload/elevatable/Bridge/BridgeDestinationObservation.ts","../../src/payload/elevatable/Bridge/BridgeIntent.ts","../../src/payload/elevatable/Bridge/BridgeSourceObservation.ts","../../src/payload/elevatable/ChainStakeIntent.ts","../../src/payload/elevatable/Executable.ts","../../src/payload/elevatable/Hash.ts","../../src/payload/elevatable/StepComplete.ts","../../src/payload/elevatable/Time.ts","../../src/payload/elevatable/TransferPayload.ts","../../src/transaction/AnyHydratedTransaction.ts","../../src/isHydratedBoundWitness.ts","../../src/transaction/TransactionBoundWitness.ts","../../src/transaction/HydratedTransaction.ts","../../src/transaction/HydratedTransactionWithStorageMeta.ts","../../src/transaction/SignedHydratedTransaction.ts","../../src/transaction/SignedHydratedTransactionWithStorageMeta.ts","../../src/transaction/TransactionBoundWitnessDeprecated.ts","../../src/transaction/TransactionFeesFields.ts","../../src/transaction/UnsignedHydratedTransaction.ts","../../src/block/BlockBoundWitness.ts","../../src/block/HydratedBlock.ts","../../src/constants/addresses.ts","../../src/constants/defaultRewardRatio.ts","../../src/constants/minTransactionFees.ts","../../src/constants/defaultTransactionFees.ts","../../src/constants/StepSizes.ts","../../src/constants/TransactionGasCosts.ts","../../src/constants/version.ts","../../src/fields/BlockNumber.ts","../../src/network/Status.ts","../../src/provider/XyoDataLake.ts","../../src/services/StakeIntentService/ChainIndexingServiceStateSchema.ts","../../src/validation/error.ts","../../src/validation/block/error.ts","../../src/validation/boundwitness/error.ts","../../src/validation/payload/error.ts","../../src/validation/transaction/error.ts"],"sourcesContent":["export const splitOnDecimal = (value: bigint, places = 18): [bigint, bigint] => {\n const whole = value / BigInt(10 ** places)\n const decimal = value % BigInt(10 ** places)\n return [whole, decimal]\n}\n","import { splitOnDecimal } from './splitOnDecimal.ts'\n\nexport const splitOnDecimalToString = (\n value: bigint,\n places = 18,\n maxDecimal = places,\n maxCharacters = 9,\n minDecimals = 1,\n locale: Intl.LocalesArgument = 'en-US',\n): string => {\n const [whole, decimal] = splitOnDecimal(value, places)\n if (whole === 0n && decimal < 10 ** maxDecimal && decimal !== 0n) return '< 0.'.padEnd(maxDecimal + 5, '0') + '1'\n\n const wholeCharacters = whole.toString(10).length\n const calcMaxDecimalCharacters = maxCharacters === -1 ? places : wholeCharacters > maxCharacters ? 0 : maxCharacters - wholeCharacters\n const maxDecimalCharacters = Math.min(maxDecimal, calcMaxDecimalCharacters)\n\n // Format whole number with thousand separators according to locale\n const formattedWhole = new Intl.NumberFormat(locale, {\n maximumFractionDigits: 0,\n useGrouping: true,\n }).format(whole)\n\n // Get decimal separator for the locale\n const decimalSeparator = new Intl.NumberFormat(locale)\n .formatToParts(1.1)\n .find(part => part.type === 'decimal')?.value ?? '.'\n\n // Pad decimal part to correct number of places\n let paddedDecimal = decimal.toString().padStart(places, '0').slice(0, maxDecimalCharacters)\n // remove unneeded trailing zeros (honoring minDecimals)\n while (paddedDecimal.length > minDecimals && paddedDecimal.endsWith('0')) {\n paddedDecimal = paddedDecimal.slice(0, -1)\n }\n\n return `${formattedWhole}${paddedDecimal.length > 0 ? decimalSeparator : ''}${paddedDecimal}`\n}\n","import type { ShiftedBigIntConfig } from './ShiftedBigIntConfig.ts'\nimport { splitOnDecimalToString } from './splitOnDecimalToString.ts'\n\nexport class ShiftedBigInt {\n static readonly defaultConfig: ShiftedBigIntConfig = {\n places: 18,\n maxDecimal: 18,\n maxCharacters: 9,\n minDecimals: 1,\n locale: 'en-US',\n }\n\n config: ShiftedBigIntConfig\n value: bigint\n\n constructor(\n value: bigint | ShiftedBigInt,\n config: Partial<ShiftedBigIntConfig> = {},\n ) {\n this.value = typeof value === 'bigint' ? value : value.value\n this.config = {\n ...ShiftedBigInt.defaultConfig, ...(typeof value === 'bigint' ? {} : value.config), ...config,\n }\n }\n\n get locale(): Intl.LocalesArgument {\n return this.config.locale ?? 'en-US'\n }\n\n get maxCharacters(): number {\n return this.config.maxCharacters ?? 9\n }\n\n get maxDecimal(): number {\n return this.config.maxDecimal ?? this.places\n }\n\n get minDecimals(): number {\n return this.config.minDecimals ?? 1\n }\n\n get places(): number {\n return this.config.places ?? 18\n }\n\n toFullString(): string {\n return splitOnDecimalToString(\n this.value,\n this.places,\n this.places,\n Infinity,\n this.places,\n this.locale,\n )\n }\n\n toShortString(): string {\n return splitOnDecimalToString(\n this.value,\n this.places,\n this.maxDecimal,\n this.maxCharacters,\n this.minDecimals,\n this.locale,\n )\n }\n\n toString(): string {\n return this.toFullString()\n }\n}\n","/* eslint-disable @typescript-eslint/member-ordering */\nimport { assertEx } from '@xylabs/assert'\n\nimport {\n AttoXL1, FemtoXL1, MicroXL1, MilliXL1, NanoXL1, PicoXL1, XL1Places,\n} from '../xl1/index.ts'\nimport { ShiftedBigInt } from './ShiftedBigInt.ts'\nimport type { ShiftedBigIntConfig } from './ShiftedBigIntConfig.ts'\n\nconst MAX_XL1_AMOUNT = 2n ** 256n - 1n\nconst allowedPlaces = Object.values(XL1Places)\n\nexport interface XL1AmountInstance {\n value: AttoXL1\n\n to(places: bigint | number): bigint\n\n milli: MilliXL1\n\n micro: MicroXL1\n\n nano: NanoXL1\n\n pico: PicoXL1\n\n femto: FemtoXL1\n\n atto: AttoXL1\n\n toString(places: number, config: Partial<ShiftedBigIntConfig>): string\n}\n\nexport class XL1Amount implements XL1AmountInstance {\n value: AttoXL1\n private locale: Intl.LocalesArgument\n\n constructor(value: bigint, locale: Intl.LocalesArgument = 'en-US') {\n this.locale = locale\n this.value = AttoXL1(value > MAX_XL1_AMOUNT ? MAX_XL1_AMOUNT : value < 0n ? 0n : value)\n }\n\n static from(value: bigint, places: bigint = XL1Places.atto) {\n assertEx(allowedPlaces.includes(places), () => `Invalid conversion places (${places} not in ${allowedPlaces})`)\n return new XL1Amount(value * 10n ** BigInt(places))\n }\n\n static fromMilli(value: MilliXL1) {\n return this.from(value, XL1Places.milli)\n }\n\n static fromMicro(value: MicroXL1) {\n return this.from(value, XL1Places.micro)\n }\n\n static fromNano(value: NanoXL1) {\n return this.from(value, XL1Places.nano)\n }\n\n static fromPico(value: PicoXL1) {\n return this.from(value, XL1Places.pico)\n }\n\n static fromFemto(value: FemtoXL1) {\n return this.from(value, XL1Places.femto)\n }\n\n static fromAtto(value: AttoXL1) {\n return this.from(value, XL1Places.atto)\n }\n\n to(places: number | bigint = XL1Places.atto) {\n return this.value / 10n ** BigInt(places)\n }\n\n get milli() {\n return MilliXL1(this.to(XL1Places.milli))\n }\n\n get micro() {\n return MicroXL1(this.to(XL1Places.micro))\n }\n\n get nano() {\n return NanoXL1(this.to(XL1Places.nano))\n }\n\n get pico() {\n return PicoXL1(this.to(XL1Places.pico))\n }\n\n get femto() {\n return FemtoXL1(this.to(XL1Places.femto))\n }\n\n get atto() {\n return AttoXL1(this.to(XL1Places.atto))\n }\n\n toString(places: number = Number(XL1Places.atto), config: Partial<ShiftedBigIntConfig> = {}): string {\n assertEx(allowedPlaces.includes(BigInt(places)), () => `Invalid conversion places (${places} not in ${allowedPlaces})`)\n return new ShiftedBigInt(\n this.value,\n {\n places,\n locale: this.locale,\n maxDecimal: places,\n minDecimals: 0,\n maxCharacters: places,\n ...config,\n },\n ).toShortString()\n }\n}\n","import * as z from 'zod'\n\nimport { xl1MaxValue } from './xl1MaxValue.ts'\n\nexport const isXL1Factory = <T extends bigint>(places: bigint) => (val: unknown): val is T => {\n if (typeof val !== 'bigint') return false\n return val >= 0n && val <= xl1MaxValue(places)\n}\n\nexport const XL1ZodFactory = <T extends bigint>(places: bigint, name: string) => {\n const is = isXL1Factory<T>(places)\n const message = `Invalid value for ${name}, must be between 0 and ${xl1MaxValue(places)}`\n return z.bigint().refine(\n (x) => {\n const result = is(x)\n return result\n },\n { message },\n )\n}\n\nexport const XL1TransformZodFactory = <T extends bigint>(places: bigint, name: string) => {\n const is = isXL1Factory<T>(places)\n const message = `Invalid value for ${name}, must be between 0 and ${xl1MaxValue(places)}`\n return z.union([z.bigint(), z.number(), z.string(), z.boolean()]).transform(val => BigInt(val) as T).refine(\n (x) => {\n const result = is(x)\n return result\n },\n { message },\n )\n}\n\nexport const asXL1Factory = <T extends bigint>(places: bigint) => {\n const zod = XL1ZodFactory<T>(places, 'local')\n return (val: unknown): T => {\n const result = zod.safeParse(val)\n if (result.success) {\n return result.data as T\n }\n throw result.error\n }\n}\n\nexport const toXL1Factory = <T extends bigint>(places: bigint) => {\n const zod = XL1TransformZodFactory<T>(places, 'local')\n return (val: unknown): T | undefined => {\n const result = zod.safeParse(val)\n return result.success ? result.data as T : undefined\n }\n}\n","export const xl1MaxValue = (places: bigint) => 10n ** (32n - places) - 1n\n","type XL1Units = 'xl1' | 'milli' | 'micro' | 'nano' | 'pico' | 'femto' | 'atto'\n\nexport const XL1Places: Record<XL1Units, bigint> = {\n xl1: 18n,\n milli: 15n,\n micro: 12n,\n nano: 9n,\n pico: 6n,\n femto: 3n,\n atto: 0n,\n} as const\n\n/**\n * Convert factor by which a respective unit is multiplied to convert it to AttoXL1 or\n * by which AttoXL1 is divided to convert it to respective unit is multiplied.\n */\nexport const AttoXL1ConvertFactor: Record<XL1Units, bigint> = {\n xl1: 10n ** XL1Places.xl1,\n milli: 10n ** XL1Places.milli,\n micro: 10n ** XL1Places.micro,\n nano: 10n ** XL1Places.nano,\n pico: 10n ** XL1Places.pico,\n femto: 10n ** XL1Places.femto,\n atto: 10n ** XL1Places.atto,\n} as const\n","import {\n asXL1Factory, isXL1Factory, toXL1Factory,\n} from './isXL1Factory.ts'\nimport { xl1MaxValue } from './xl1MaxValue.ts'\nimport { XL1Places } from './XL1Units.ts'\n\nexport const AttoXL1MaxValue = xl1MaxValue(XL1Places.atto)\nexport type AttoXL1 = bigint & { readonly _tag: 'AttoXL1' }\nexport const isAttoXL1 = isXL1Factory<AttoXL1>(XL1Places.atto)\nexport const asAttoXL1 = asXL1Factory<AttoXL1>(XL1Places.atto)\nexport const toAttoXL1 = toXL1Factory<AttoXL1>(XL1Places.atto)\n\nexport const AttoXL1 = asAttoXL1\n","import {\n asXL1Factory, isXL1Factory, toXL1Factory,\n} from './isXL1Factory.ts'\nimport { xl1MaxValue } from './xl1MaxValue.ts'\nimport { XL1Places } from './XL1Units.ts'\n\nexport const FemtoXL1MaxValue = xl1MaxValue(XL1Places.femto)\nexport type FemtoXL1 = bigint & { readonly _tag: 'FemtoXL1' }\nexport const isFemtoXL1 = isXL1Factory<FemtoXL1>(XL1Places.femto)\nexport const asFemtoXL1 = asXL1Factory<FemtoXL1>(XL1Places.femto)\n\nexport const toFemtoXL1 = toXL1Factory<FemtoXL1>(XL1Places.femto)\n\nexport const FemtoXL1 = asFemtoXL1\n","import {\n asXL1Factory, isXL1Factory, toXL1Factory,\n} from './isXL1Factory.ts'\nimport { xl1MaxValue } from './xl1MaxValue.ts'\nimport { XL1Places } from './XL1Units.ts'\n\nexport const MicroXL1MaxValue = xl1MaxValue(XL1Places.micro)\nexport type MicroXL1 = bigint & { readonly _tag: 'MicroXL1' }\nexport const isMicroXL1 = isXL1Factory<MicroXL1>(XL1Places.micro)\nexport const asMicroXL1 = asXL1Factory<MicroXL1>(XL1Places.micro)\n\nexport const toMicroXL1 = toXL1Factory<MicroXL1>(XL1Places.micro)\n\nexport const MicroXL1 = asMicroXL1\n","import {\n asXL1Factory, isXL1Factory, toXL1Factory,\n} from './isXL1Factory.ts'\nimport { xl1MaxValue } from './xl1MaxValue.ts'\nimport { XL1Places } from './XL1Units.ts'\n\nexport const MilliXL1MaxValue = xl1MaxValue(XL1Places.milli)\nexport type MilliXL1 = bigint & { readonly _tag: 'MilliXL1' }\nexport const isMilliXL1 = isXL1Factory<MilliXL1>(XL1Places.milli)\nexport const asMilliXL1 = asXL1Factory<MilliXL1>(XL1Places.milli)\n\nexport const toMilliXL1 = toXL1Factory<MilliXL1>(XL1Places.milli)\n\nexport const MilliXL1 = asMilliXL1\n","import {\n asXL1Factory, isXL1Factory, toXL1Factory,\n} from './isXL1Factory.ts'\nimport { xl1MaxValue } from './xl1MaxValue.ts'\nimport { XL1Places } from './XL1Units.ts'\n\nexport const NanoXL1MaxValue = xl1MaxValue(XL1Places.nano)\nexport type NanoXL1 = bigint & { readonly _tag: 'NanoXL1' }\nexport const isNanoXL1 = isXL1Factory<NanoXL1>(XL1Places.nano)\nexport const asNanoXL1 = asXL1Factory<NanoXL1>(XL1Places.nano)\n\nexport const toNanoXL1 = toXL1Factory<NanoXL1>(XL1Places.nano)\n\nexport const NanoXL1 = asNanoXL1\n","import {\n asXL1Factory, isXL1Factory, toXL1Factory,\n} from './isXL1Factory.ts'\nimport { xl1MaxValue } from './xl1MaxValue.ts'\nimport { XL1Places } from './XL1Units.ts'\n\nexport const PicoXL1MaxValue = xl1MaxValue(XL1Places.pico)\nexport type PicoXL1 = bigint & { readonly _tag: 'PicoXL1' }\nexport const isPicoXL1 = isXL1Factory<PicoXL1>(XL1Places.pico)\nexport const asPicoXL1 = asXL1Factory<PicoXL1>(XL1Places.pico)\n\nexport const toPicoXL1 = toXL1Factory<PicoXL1>(XL1Places.pico)\n\nexport const PicoXL1 = asPicoXL1\n","import {\n asXL1Factory, isXL1Factory, toXL1Factory,\n} from './isXL1Factory.ts'\nimport { xl1MaxValue } from './xl1MaxValue.ts'\nimport { XL1Places } from './XL1Units.ts'\n\nexport const XL1MaxValue = xl1MaxValue(XL1Places.xl1)\nexport type XL1 = bigint & { readonly _tag: 'XL1' }\nexport const isXL1 = isXL1Factory<XL1>(XL1Places.xl1)\nexport const asXL1 = asXL1Factory<XL1>(XL1Places.xl1)\n\nexport const toXL1 = toXL1Factory<XL1>(XL1Places.xl1)\n\nexport const XL1 = asXL1\n","import { BoundWitnessSchema } from '@xyo-network/boundwitness-model'\nimport type { Schema, WithStorageMeta } from '@xyo-network/payload-model'\nimport { isHashStorageMeta, isSchema } from '@xyo-network/payload-model'\nimport type { SchemaPayload } from '@xyo-network/schema-payload-plugin'\nimport { isSchemaPayload, SchemaSchema } from '@xyo-network/schema-payload-plugin'\nimport z from 'zod'\n\nimport type {\n BridgeDestinationObservation, BridgeIntent, BridgeSourceObservation, ChainStakeIntent, HashPayload, StepComplete, TimePayload, Transfer,\n} from '../payload/index.ts'\nimport {\n BridgeDestinationObservationSchema, BridgeIntentSchema, BridgeSourceObservationSchema, ChainStakeIntentSchema, HashSchema,\n isBridgeDestinationObservation, isBridgeIntent, isBridgeSourceObservation, isChainStakeIntent, isHashPayload, isTimePayload, isTransfer, StepCompleteSchema,\n TimeSchema, TransferSchema,\n} from '../payload/index.ts'\nimport { isTransactionBoundWitness, type TransactionBoundWitness } from '../transaction/index.ts'\n\nexport type AllowedBlockPayload\n = Transfer\n | BridgeDestinationObservation\n | BridgeIntent\n | BridgeSourceObservation\n | ChainStakeIntent\n | HashPayload\n | SchemaPayload\n | StepComplete\n | TimePayload\n | TransactionBoundWitness\n\nexport const AllowedBlockPayloadSchemas: Schema[] = [\n BoundWitnessSchema,\n BridgeDestinationObservationSchema,\n BridgeIntentSchema,\n BridgeSourceObservationSchema,\n ChainStakeIntentSchema,\n HashSchema,\n SchemaSchema,\n StepCompleteSchema,\n TimeSchema,\n TransferSchema,\n]\n\nexport type AllowedBlockPayloadSchema = typeof AllowedBlockPayloadSchemas[number]\n\nexport const isAllowedBlockPayloadSchema = (value: unknown): value is AllowedBlockPayloadSchema => {\n return isSchema(value) && AllowedBlockPayloadSchemas.includes(value)\n}\n\nexport const isAllowedBlockPayload = (value: unknown): value is AllowedBlockPayload => {\n return isTransfer(value)\n || isBridgeDestinationObservation(value)\n || isBridgeIntent(value)\n || isBridgeSourceObservation(value)\n || isChainStakeIntent(value)\n || isHashPayload(value)\n || isSchemaPayload(value)\n || isTimePayload(value)\n || isTransactionBoundWitness(value)\n}\n\nexport const isAllowedBlockPayloadWithHashStorageMeta = (value: unknown): value is WithStorageMeta<AllowedBlockPayload> => {\n return isAllowedBlockPayload(value) && isHashStorageMeta(value)\n}\n\nexport const AllowedBlockPayloadZod = z.object({ schema: z.enum(AllowedBlockPayloadSchemas) })\n","import type { Hex } from '@xylabs/hex'\nimport { AsObjectFactory } from '@xylabs/object'\nimport type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\n\nimport type { BridgeDetailsFields } from './BridgeDetails.ts'\n\nexport const BridgeDestinationObservationSchema = 'network.xyo.chain.bridge.observation.destination' as const\nexport type BridgeDestinationObservationSchema = typeof BridgeDestinationObservationSchema\n\n/**\n * Represents an observation that confirms a bridge action occurred on the destination chain.\n */\nexport interface BridgeDestinationObservationFields extends BridgeDetailsFields {\n /**\n * Destination chain confirmation\n */\n destConfirmation?: Hex\n}\n\n/**\n * Represents an observation that confirms a bridge action occurred on the destination chain.\n */\nexport type BridgeDestinationObservation = Payload<BridgeDestinationObservationFields, BridgeDestinationObservationSchema>\n\nexport const isBridgeDestinationObservation = isPayloadOfSchemaType<BridgeDestinationObservation>(BridgeDestinationObservationSchema)\n\nexport const asBridgeDestinationObservation = AsObjectFactory.create(isBridgeDestinationObservation)\n","import { AsObjectFactory } from '@xylabs/object'\nimport type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\n\nimport type { BridgeDetailsFields } from './BridgeDetails.ts'\n\nexport const BridgeIntentSchema = 'network.xyo.chain.bridge.intent' as const\nexport type BridgeIntentSchema = typeof BridgeIntentSchema\n\n/**\n * Represents an Addresses intent to initiate a token bridge.\n */\nexport interface BridgeIntentFields extends BridgeDetailsFields {\n /**\n * Unique identifier for replay protection\n */\n nonce: string\n}\n\nexport type BridgeIntent = Payload<BridgeIntentFields, BridgeIntentSchema>\n\nexport const isBridgeIntent = isPayloadOfSchemaType<BridgeIntent>(BridgeIntentSchema)\n\nexport const asBridgeIntent = AsObjectFactory.create(isBridgeIntent)\n","import type { Hex } from '@xylabs/hex'\nimport { AsObjectFactory } from '@xylabs/object'\nimport type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\n\nimport type { BridgeDetailsFields } from './BridgeDetails.ts'\n\nexport const BridgeSourceObservationSchema = 'network.xyo.chain.bridge.observation.source' as const\nexport type BridgeSourceObservationSchema = typeof BridgeSourceObservationSchema\n\n/**\n * Represents an observation that confirms a bridge action occurred on the source chain.\n */\nexport interface BridgeSourceObservationFields extends BridgeDetailsFields {\n /**\n * Source chain confirmation\n */\n srcConfirmation?: Hex\n}\n\n/**\n * Represents an observation that confirms a bridge action occurred on the source chain.\n */\nexport type BridgeSourceObservation = Payload<BridgeSourceObservationFields, BridgeSourceObservationSchema>\n\nexport const isBridgeSourceObservation = isPayloadOfSchemaType<BridgeSourceObservation>(BridgeSourceObservationSchema)\n\nexport const asBridgeSourceObservation = AsObjectFactory.create(isBridgeSourceObservation)\n","import { AsObjectFactory } from '@xylabs/object'\nimport type { Payload, WithStorageMeta } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType, isStorageMeta } from '@xyo-network/payload-model'\n\nimport type { BlockDuration } from '../../fields/index.ts'\nimport type { FromFields } from './Executable.ts'\n\nexport const ChainStakeIntentSchema = 'network.xyo.chain.stake.intent' as const\nexport type ChainStakeIntentSchema = typeof ChainStakeIntentSchema\n\nexport type Intent = 'producer' // | 'bank'\n\nexport interface ChainStakeIntentFields extends BlockDuration, FromFields {\n /*\n * The intent of the staking\n */\n intent: Intent\n}\n\nexport type ChainStakeIntent = Payload<ChainStakeIntentFields, ChainStakeIntentSchema>\n\nexport const isChainStakeIntent = (x?: unknown | null): x is ChainStakeIntent => {\n return isPayloadOfSchemaType<ChainStakeIntent>(ChainStakeIntentSchema)(x)\n && asNonNegativeInteger(x.nbf) !== undefined\n && asNonNegativeInteger(x.exp) !== undefined\n}\nexport const asChainStakeIntent = AsObjectFactory.create(isChainStakeIntent)\n\nexport const isChainStakeIntentWithStorageMeta = (x?: unknown | null): x is WithStorageMeta<ChainStakeIntent> => {\n return isChainStakeIntent(x) && isStorageMeta(x)\n}\n\nconst asNonNegativeInteger = (num: number) => {\n return (Number.isInteger(num) && num >= 0) ? num : undefined\n}\n","import type { Address } from '@xylabs/hex'\nimport type { EmptyObject } from '@xylabs/object'\nimport { isAnyPayload } from '@xyo-network/payload-model'\n\nexport interface FromFields {\n // the address that is treated as the source of this action\n from: Address\n}\n\nexport const hasFrom = (value: unknown): value is FromFields => {\n return (value as FromFields).from !== undefined\n}\n\nexport interface ExecutableFields {\n script: string[]\n}\n\nexport type Executable<T extends EmptyObject = EmptyObject> = T & ExecutableFields\nexport type OptionalExecutable<T extends EmptyObject = EmptyObject> = T & Partial<ExecutableFields>\n\nexport const isExecutable = <T extends EmptyObject>(value: T | undefined): value is Executable<T> => {\n return isAnyPayload(value) && Array.isArray((value as unknown as ExecutableFields).script)\n}\n\nexport const asExecutable = <T extends EmptyObject>(value: T | undefined): Executable<T> | undefined => {\n return isExecutable(value)\n ? value as unknown as Executable<T>\n : undefined\n}\n","import type { Hash } from '@xylabs/hex'\nimport { AsObjectFactory } from '@xylabs/object'\nimport type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\n\nexport const HashSchema = 'network.xyo.hash' as const\nexport type HashSchema = typeof HashSchema\n\nexport interface HashFields {\n hash: Hash\n}\n\nexport type HashPayload = Payload<HashFields, HashSchema>\n\nexport const isHashPayload = isPayloadOfSchemaType<HashPayload>(HashSchema)\n\nexport const asHashPayload = AsObjectFactory.create(isHashPayload)\nexport const asHashPayloadWithStorageMeta = AsObjectFactory.create(isHashPayload)\n","import type { Hash } from '@xylabs/hex'\nimport { AsObjectFactory } from '@xylabs/object'\nimport type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\n\nimport type { FromFields } from './Executable.ts'\n\nexport const StepCompleteSchema = 'network.xyo.chain.step.complete' as const\nexport type StepCompleteSchema = typeof StepCompleteSchema\n\n/* This records the completion of a step in the network - needed for network staking rewards */\n/* We will only write these for steps that are eligible for rewards Step 3 (2311) */\n\nexport interface StepCompleteFields extends FromFields {\n block: number /* The block number on the XL1 network */\n hash: Hash /* The Step Hash */\n size: number /* The size of the step */\n stakeBlock: number /* The block number on ethereum or other staking system */\n}\n\n// if this payload is included in a boundwitness, it needs to be available for inspection to be included in block\nexport type StepComplete = Payload<StepCompleteFields, StepCompleteSchema>\n\nexport const isStepComplete = isPayloadOfSchemaType<StepComplete>(StepCompleteSchema)\n\nexport const asStepComplete = AsObjectFactory.create(isStepComplete)\n","import type { Hash } from '@xylabs/hex'\nimport { AsObjectFactory } from '@xylabs/object'\nimport type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\n\n// xl1 = xl1 block number, epoch = epoch number, ethereum = ethereum block number\nexport type TimeDomain = 'xl1' | 'epoch' | 'ethereum'\n\nexport const TimeSchema = 'network.xyo.time' as const\nexport type TimeSchema = typeof TimeSchema\n\nexport interface XL1TimeFields {\n // block number\n xl1?: number\n // block hash\n xl1Hash?: Hash\n}\n\nexport interface EthereumTimeFields {\n // block number\n ethereum?: number\n // block hash\n ethereumHash?: Hash\n}\n\nexport interface TimeFields extends XL1TimeFields, EthereumTimeFields {\n // in milliseconds\n epoch: number\n}\n\nexport type TimePayload = Payload<TimeFields, TimeSchema>\n\n// to prevent scaling problems, we use double the current time as a max safe epoch\nexport const isSafeEpoch = (value: unknown): value is number => {\n return typeof value === 'number' && value < 2 * Date.now()\n}\n\nexport const isTimePayload = (value: unknown): value is TimePayload => {\n return isPayloadOfSchemaType<TimePayload>(TimeSchema)(value) && isSafeEpoch(value.epoch)\n}\n\nexport const asTimePayload = AsObjectFactory.create(isTimePayload)\nexport const asTimePayloadWithStorageMeta = AsObjectFactory.create(isTimePayload)\n","import type {\n Address,\n Hex,\n} from '@xylabs/hex'\nimport { AsObjectFactory } from '@xylabs/object'\nimport type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\n\nimport type { FromFields } from './Executable.ts'\n\nexport const TransferSchema = 'network.xyo.transfer' as const\nexport type TransferSchema = typeof TransferSchema\n\nexport interface TransferFields extends FromFields {\n epoch: number\n // the amount that is being sent to other addresses\n transfers: Partial<Record<Address, Hex>>\n}\n\n// if this payload is included in a boundwitness, it needs to be available for inspection to be included in block\nexport type Transfer = Payload<TransferFields, TransferSchema>\n\nexport const isTransfer = isPayloadOfSchemaType<Transfer>(TransferSchema)\n\nexport const asTransfer = AsObjectFactory.create(isTransfer)\n","import { AsObjectFactory } from '@xylabs/object'\nimport { type Payload } from '@xyo-network/payload-model'\n\nimport { isHydratedBoundWitness } from '../isHydratedBoundWitness.ts'\nimport { isTransactionBoundWitness, type TransactionBoundWitness } from './TransactionBoundWitness.ts'\n\nexport type AnyHydratedTransaction<T extends TransactionBoundWitness = TransactionBoundWitness,\n P extends Payload = Payload> = [T, P[]]\n\nexport const isAnyHydratedTransaction = (\n value: unknown,\n): value is AnyHydratedTransaction => {\n return (\n isHydratedBoundWitness(value) && isTransactionBoundWitness(value[0])\n )\n}\n\nexport const asAnyHydratedTransaction = AsObjectFactory.create<AnyHydratedTransaction>(\n isAnyHydratedTransaction,\n)\n","import { AsObjectFactory } from '@xylabs/object'\nimport type { HydratedBoundWitness, HydratedBoundWitnessWithStorageMeta } from '@xyo-network/archivist-model'\nimport { isBoundWitness } from '@xyo-network/boundwitness-model'\nimport { isAnyPayload, isStorageMeta } from '@xyo-network/payload-model'\n\nexport const isHydratedBoundWitness = (\n value: unknown,\n): value is HydratedBoundWitness => {\n return (\n Array.isArray(value)\n && value.length === 2\n && isBoundWitness(value[0])\n && Array.isArray(value[1])\n && !value[1].some(item => (!isAnyPayload(item)))\n )\n}\n\nexport const isHydratedBoundWitnessWithStorageMeta = (\n value: unknown,\n): value is HydratedBoundWitnessWithStorageMeta => {\n return (\n isHydratedBoundWitness(value)\n && isStorageMeta(value[0])\n && !value[1].some(item => (!isStorageMeta(item)))\n )\n}\n\nexport const asHydratedBoundWitness = AsObjectFactory.create<HydratedBoundWitness>(\n isHydratedBoundWitness,\n)\n\nexport const asHydratedBoundWitnessWithStorageMeta = AsObjectFactory.create<HydratedBoundWitnessWithStorageMeta>(\n isHydratedBoundWitnessWithStorageMeta,\n)\n","import {\n type Address, type Hex, isAddress,\n} from '@xylabs/hex'\nimport { AsObjectFactory } from '@xylabs/object'\nimport type { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { isBoundWitness } from '@xyo-network/boundwitness-model'\n\nimport type { BlockDuration } from '../fields/index.ts'\nimport type { FromFields, OptionalExecutable } from '../payload/index.ts'\nimport type { TransactionFeesFields } from './TransactionFeesFields.ts'\n\nexport interface TransactionBoundWitnessFields extends BlockDuration, TransactionFeesFields {\n chain: Hex | Address & { __chain: true }\n}\n\nexport type TransactionBoundWitness = BoundWitness<TransactionBoundWitnessFields & OptionalExecutable & FromFields>\n\nexport const isTransactionBoundWitness = (value: unknown): value is TransactionBoundWitness => {\n const typedObj = value as TransactionBoundWitness\n return isBoundWitness(value)\n && isAddress(typedObj.chain)\n && typedObj.fees !== undefined\n && typedObj.exp !== undefined\n && typedObj.nbf !== undefined\n}\n\nexport const asTransactionBoundWitness = AsObjectFactory.create(isTransactionBoundWitness)\n","import { AsObjectFactory } from '@xylabs/object'\nimport { isSigned, type Signed } from '@xyo-network/boundwitness-model'\nimport {\n isStorageMeta, type Payload, type WithStorageMeta,\n} from '@xyo-network/payload-model'\n\nimport { isHydratedBoundWitness } from '../isHydratedBoundWitness.ts'\nimport { isTransactionBoundWitness, type TransactionBoundWitness } from './TransactionBoundWitness.ts'\n\n/** @deprecated Use HydratedTransactionWithStorageMeta instead */\nexport type HydratedTransaction<T extends TransactionBoundWitness = TransactionBoundWitness,\n P extends Payload = Payload> = [WithStorageMeta<Signed<T>>, WithStorageMeta<P>[]]\n\n/** @deprecated Use isHydratedTransactionWithStorageMeta instead */\nexport const isHydratedTransaction = (\n value: unknown,\n// eslint-disable-next-line sonarjs/deprecation\n): value is HydratedTransaction => {\n return (\n isHydratedBoundWitness(value) && isTransactionBoundWitness(value[0]) && isSigned(value[0]) && isStorageMeta(value[0])\n )\n}\n\n/** @deprecated Use asHydratedTransactionWithStorageMeta instead */\n// eslint-disable-next-line sonarjs/deprecation\nexport const asHydratedTransaction = AsObjectFactory.create<HydratedTransaction>(\n // eslint-disable-next-line sonarjs/deprecation\n isHydratedTransaction,\n)\n","import { AsObjectFactory } from '@xylabs/object'\nimport { type Signed } from '@xyo-network/boundwitness-model'\nimport {\n isStorageMeta, type Payload, type WithStorageMeta,\n} from '@xyo-network/payload-model'\n\nimport { isAnyHydratedTransaction } from './AnyHydratedTransaction.ts'\nimport { type TransactionBoundWitness } from './TransactionBoundWitness.ts'\n\nexport type HydratedTransactionWithStorageMeta<T extends TransactionBoundWitness = TransactionBoundWitness,\n P extends Payload = Payload> = [WithStorageMeta<Signed<T>>, WithStorageMeta<P>[]]\n\nexport const isHydratedTransactionWithStorageMeta = (\n value: unknown,\n): value is HydratedTransactionWithStorageMeta => {\n return (\n isAnyHydratedTransaction(value) && isStorageMeta(value[0]) && !value[1].some(v => !isStorageMeta(v))\n )\n}\n\nexport const asHydratedTransactionWithStorageMeta = AsObjectFactory.create<HydratedTransactionWithStorageMeta>(\n isHydratedTransactionWithStorageMeta,\n)\n","import { AsObjectFactory } from '@xylabs/object'\nimport type { Signed } from '@xyo-network/boundwitness-model'\nimport { isSigned } from '@xyo-network/boundwitness-model'\nimport type { Payload } from '@xyo-network/payload-model'\n\nimport { isAnyHydratedTransaction } from './AnyHydratedTransaction.ts'\nimport { type TransactionBoundWitness } from './TransactionBoundWitness.ts'\n\nexport type SignedHydratedTransaction<T extends TransactionBoundWitness = TransactionBoundWitness,\n P extends Payload = Payload> = [Signed<T>, P[]]\n\nexport const isSignedHydratedTransaction = (\n value: unknown,\n): value is SignedHydratedTransaction => {\n return (\n isAnyHydratedTransaction(value) && isSigned(value[0])\n )\n}\n\nexport const asSignedHydratedTransaction = AsObjectFactory.create<SignedHydratedTransaction>(\n isSignedHydratedTransaction,\n)\n","import { AsObjectFactory } from '@xylabs/object'\nimport { type Signed } from '@xyo-network/boundwitness-model'\nimport {\n isStorageMeta, type Payload, type WithStorageMeta,\n} from '@xyo-network/payload-model'\n\nimport { isSignedHydratedTransaction } from './SignedHydratedTransaction.ts'\nimport { type TransactionBoundWitness } from './TransactionBoundWitness.ts'\n\nexport type SignedHydratedTransactionWithStorageMeta<T extends TransactionBoundWitness = TransactionBoundWitness,\n P extends Payload = Payload> = [WithStorageMeta<Signed<T>>, WithStorageMeta<P>[]]\n\nexport const isSignedHydratedTransactionWithStorageMeta = (\n value: unknown,\n): value is SignedHydratedTransactionWithStorageMeta => {\n return (\n isSignedHydratedTransaction(value) && isStorageMeta(value[0]) && !value[1].some(v => !isStorageMeta(v))\n )\n}\n\nexport const asSignedHydratedTransactionWithStorageMeta = AsObjectFactory.create<SignedHydratedTransactionWithStorageMeta>(\n isSignedHydratedTransactionWithStorageMeta,\n)\n","import { AsObjectFactory } from '@xylabs/object'\nimport type { Signed } from '@xyo-network/boundwitness-model'\nimport { isSigned } from '@xyo-network/boundwitness-model'\nimport type { WithHashStorageMeta, WithStorageMeta } from '@xyo-network/payload-model'\nimport { isHashStorageMeta, isStorageMeta } from '@xyo-network/payload-model'\n\nimport { isTransactionBoundWitness, type TransactionBoundWitness } from './TransactionBoundWitness.ts'\n\nexport const isSignedTransactionBoundWitness = (value: unknown): value is Signed<TransactionBoundWitness> => {\n return isTransactionBoundWitness(value) && isSigned(value)\n}\n\nexport const isTransactionBoundWitnessWithStorageMeta = (value: unknown): value is WithStorageMeta<TransactionBoundWitness> =>\n isTransactionBoundWitness(value)\n && isStorageMeta(value)\n\nexport const isTransactionBoundWitnessWithHashStorageMeta = (value: unknown): value is WithHashStorageMeta<TransactionBoundWitness> =>\n isTransactionBoundWitness(value)\n && isHashStorageMeta(value)\n\nexport const isSignedTransactionBoundWitnessWithStorageMeta = (value: unknown): value is WithStorageMeta<Signed<TransactionBoundWitness>> =>\n\n isSignedTransactionBoundWitness(value)\n && isStorageMeta(value)\n\nexport const isSignedTransactionBoundWitnessWithHashStorageMeta = (value: unknown): value is WithHashStorageMeta<Signed<TransactionBoundWitness>> =>\n\n isSignedTransactionBoundWitness(value)\n && isHashStorageMeta(value)\n\nexport const asTransactionBoundWitnessWithStorageMeta = AsObjectFactory.create(isTransactionBoundWitnessWithStorageMeta)\n\nexport const asTransactionBoundWitnessWithHashStorageMeta = AsObjectFactory.create(isTransactionBoundWitnessWithHashStorageMeta)\n","import { type Hex, isHex } from '@xylabs/hex'\nimport { AsObjectFactory } from '@xylabs/object'\nimport { isObject } from '@xylabs/typeof'\n\nimport { type AttoXL1, isAttoXL1 } from '../xl1/index.ts'\n\nexport interface TransactionFeesBigInt {\n base: AttoXL1\n gasLimit: AttoXL1\n gasPrice: AttoXL1\n priority: AttoXL1\n}\n\nexport type TransactionFeesHex = {\n [K in keyof TransactionFeesBigInt]: Hex;\n}\n\nexport interface TransactionFeesFields {\n fees: TransactionFeesHex\n}\n\nexport const isTransactionFeesBigInt = (value: unknown): value is TransactionFeesBigInt => {\n if (!isObject(value)) {\n return false\n }\n const {\n base, gasLimit, gasPrice, priority,\n } = value as TransactionFeesBigInt\n return (\n isAttoXL1(base)\n && isAttoXL1(gasLimit)\n && isAttoXL1(gasPrice)\n && isAttoXL1(priority)\n )\n}\n\nexport const asTransactionFeesBigInt = AsObjectFactory.create<TransactionFeesBigInt>(\n isTransactionFeesBigInt,\n)\n\nexport const isTransactionFeesHex = (value: unknown): value is TransactionFeesHex => {\n if (!isObject(value)) {\n return false\n }\n const {\n base, gasLimit, gasPrice, priority,\n } = value as TransactionFeesHex\n return (\n isHex(base)\n && isHex(gasLimit)\n && isHex(gasPrice)\n && isHex(priority)\n )\n}\n\nexport const asTransactionFeesHex = AsObjectFactory.create<TransactionFeesHex>(\n isTransactionFeesHex,\n)\n","import { AsObjectFactory } from '@xylabs/object'\nimport { isUnsigned } from '@xyo-network/boundwitness-model'\nimport type { Payload } from '@xyo-network/payload-model'\n\nimport { isAnyHydratedTransaction } from './AnyHydratedTransaction.ts'\nimport { type TransactionBoundWitness } from './TransactionBoundWitness.ts'\n\nexport type UnsignedHydratedTransaction<T extends TransactionBoundWitness = TransactionBoundWitness,\n P extends Payload = Payload> = [T, P[]]\n\nexport const isUnsignedHydratedTransaction = (\n value: unknown,\n): value is UnsignedHydratedTransaction => {\n return (\n isAnyHydratedTransaction(value) && isUnsigned(value[0])\n )\n}\n\nexport const asUnsignedHydratedTransaction = AsObjectFactory.create<UnsignedHydratedTransaction>(\n isUnsignedHydratedTransaction,\n)\n","import type { Hash } from '@xylabs/hex'\nimport { isHex } from '@xylabs/hex'\nimport { AsObjectFactory } from '@xylabs/object'\nimport type { BoundWitness, Signed } from '@xyo-network/boundwitness-model'\nimport { isBoundWitness, isSigned } from '@xyo-network/boundwitness-model'\nimport type { WithHashStorageMeta, WithStorageMeta } from '@xyo-network/payload-model'\nimport { isHashStorageMeta, isStorageMeta } from '@xyo-network/payload-model'\n\nimport type { Chain } from '../model.ts'\n\nexport interface BlockBoundWitnessMeta {\n $epoch: number\n}\n\nexport interface BlockBoundWitnessFields {\n /** Block number */\n block: number\n /** Chain id - this should be \"0\" for the genesis block */\n chain: Chain\n /** Previous block hash if not block 0 */\n previous: Hash | null /* the previous block hash */\n /** Version of the protocol being used major * 1,000,000 + minor * 1,000 + patch */\n protocol: number\n /** Step hashes */\n step_hashes: Hash[]\n}\n\nexport type BlockBoundWitness = BoundWitness<BlockBoundWitnessFields & BlockBoundWitnessMeta>\n\nexport const isBlockBoundWitness = (value: unknown): value is BlockBoundWitness => {\n const typedObj = value as BlockBoundWitness\n return isBoundWitness(value)\n && Number.isInteger(typedObj.block)\n && isHex(typedObj.chain)\n}\n\nexport const isSignedBlockBoundWitness = (value: unknown): value is Signed<BlockBoundWitness> => {\n return isBlockBoundWitness(value) && isSigned(value)\n}\n\nexport const isBlockBoundWitnessWithStorageMeta = (value: unknown): value is WithStorageMeta<BlockBoundWitness> => {\n return isBlockBoundWitness(value) && isStorageMeta(value)\n}\n\nexport const isSignedBlockBoundWitnessWithStorageMeta = (value: unknown): value is Signed<WithStorageMeta<BlockBoundWitness>> => {\n return isBlockBoundWitnessWithStorageMeta(value) && isSigned(value)\n}\n\nexport const isBlockBoundWitnessWithHashStorageMeta = (value: unknown): value is WithHashStorageMeta<BlockBoundWitness> => {\n return isBlockBoundWitness(value) && isHashStorageMeta(value)\n}\n\nexport const isSignedBlockBoundWitnessWithHashStorageMeta = (value: unknown): value is Signed<WithHashStorageMeta<BlockBoundWitness>> => {\n return isBlockBoundWitnessWithHashStorageMeta(value) && isSigned(value)\n}\n\nexport const asBlockBoundWitness = AsObjectFactory.create(isBlockBoundWitness)\nexport const asSignedBlockBoundWitness = AsObjectFactory.create(isSignedBlockBoundWitness)\n\nexport const asBlockBoundWitnessWithStorageMeta = AsObjectFactory.create(isBlockBoundWitnessWithStorageMeta)\nexport const asSignedBlockBoundWitnessWithStorageMeta = AsObjectFactory.create(isSignedBlockBoundWitnessWithStorageMeta)\n\nexport const asBlockBoundWitnessWithHashStorageMeta = AsObjectFactory.create(isBlockBoundWitnessWithHashStorageMeta)\nexport const asSignedBlockBoundWitnessWithHashStorageMeta = AsObjectFactory.create(isSignedBlockBoundWitnessWithHashStorageMeta)\n","import { AsObjectFactory } from '@xylabs/object'\nimport type { Signed } from '@xyo-network/boundwitness-model'\nimport { type Payload, type WithStorageMeta } from '@xyo-network/payload-model'\n\nimport { isHydratedBoundWitness } from '../isHydratedBoundWitness.ts'\nimport {\n type BlockBoundWitness,\n isBlockBoundWitnessWithStorageMeta,\n} from './BlockBoundWitness.ts'\n\nexport type HydratedBlock<T extends BlockBoundWitness = BlockBoundWitness,\n P extends Payload = Payload> = [WithStorageMeta<Signed<T>>, WithStorageMeta<P>[]]\n\nexport const isHydratedBlock = (\n value: unknown,\n): value is HydratedBlock => {\n return (\n isHydratedBoundWitness(value) && isBlockBoundWitnessWithStorageMeta(value[0])\n )\n}\n\nexport const asHydratedBlock = AsObjectFactory.create<HydratedBlock>(\n isHydratedBlock,\n)\n","import type { Address, EthAddress } from '@xylabs/hex'\n\n/**\n * The Zero Address is used as a marker address for various protocol operations.\n */\nexport const XYO_ZERO_ADDRESS = '0000000000000000000000000000000000000000' as const as Address\n\n/**\n * The Bridge Address is used as a marker address for bridge transactions.\n */\nexport const XYO_BRIDGE_ADDRESS = '3012193230121932301219323012193230121932' as const as Address\n\n/**\n * The Network Staking Address is used as a marker address for staking the network.\n */\nexport const XYO_NETWORK_STAKING_ADDRESS = '1969196919691969196919691969196919691969' as const as Address\n\n/**\n * The Step Reward Address is used as a marker address for step rewards.\n */\nexport const XYO_STEP_REWARD_ADDRESS = '1216197612161976121619761216197612161976' as const as Address\n\nexport const XL1_ETH_MAIN_ERC20_CONTRACT_ADDRESS = '0xf72aE3E0DA743033AbD7A407557D684c1aE66aed' as const as EthAddress\n\nexport const XL1_ETH_MAIN_SUB_GOVERNOR_ADDRESS = '0xbA296Bc5D0949C0484f08c56c30FB95CC4675A29' as const as EthAddress\n\nexport const XL1_ETH_MAIN_REWARDS_ADDRESS = '0x1a546e091FB4EFb274DC584334a28b8754c4ece7' as const as EthAddress\n\nexport const XL1_ETH_MAIN_STAKED_XYO_CHAIN_ADDRESS = '0x319e667cED10452A117472811130444dED357F26' as const as EthAddress\n\nexport const XL1_ETH_MAIN_GOVERNANCE_ADDRESS = '0x7595710956d6B14b4f2F51a8dF41379eEeC9074E' as const as EthAddress\n","// the percent of the block rewards the producer gets\nexport const defaultRewardRatio = 0.05 as const // 5.0% goes to block producer\n","import type { TransactionFeesBigInt } from '../transaction/index.ts'\nimport { AttoXL1, AttoXL1ConvertFactor } from '../xl1/index.ts'\n\nexport const minTransactionFees: TransactionFeesBigInt = {\n base: AttoXL1(1000n * AttoXL1ConvertFactor.nano),\n gasPrice: AttoXL1(10n * AttoXL1ConvertFactor.nano),\n gasLimit: AttoXL1(1_000_000n * AttoXL1ConvertFactor.nano),\n priority: AttoXL1(0n * AttoXL1ConvertFactor.nano),\n} as const\n","import type { TransactionFeesBigInt } from '../transaction/index.ts'\nimport { AttoXL1, AttoXL1ConvertFactor } from '../xl1/index.ts'\nimport { minTransactionFees } from './minTransactionFees.ts'\n\nexport const defaultTransactionFees: TransactionFeesBigInt = {\n base: minTransactionFees.base,\n gasPrice: AttoXL1(10n * AttoXL1ConvertFactor.nano),\n gasLimit: AttoXL1(1_000_000n * AttoXL1ConvertFactor.nano),\n priority: minTransactionFees.priority,\n} as const\n","import { AsTypeFactory } from '@xylabs/object'\n\n// StepsV2 are primorial(n+2) + 1, where n is the index of the step size\n// primorial(n+2) = 2 → 2×3=6 → 6×5=30 → 30×7=210 → 210×11=2310\n\nexport const StepSizes = [7, 31, 211, 2311, 30_031, 510_511, 9_699_691, 223_092_871, 6_469_693_231] as const\n\nexport function isValidStep(step: unknown): step is number {\n if (typeof step === 'number' && Number.isInteger(step)) {\n return ((step >= 0) && (step < StepSizes.length))\n }\n return false\n}\n\nexport const asValidStep = AsTypeFactory.create<number>(isValidStep)\n\nexport function stepSize(step: number): number {\n const validatedStep = asValidStep(step, () => `Invalid step (${step}), must be an integer between 0 and ${StepSizes.length - 1}`, { required: true })\n return StepSizes[validatedStep]\n}\n\nexport const StepRewardFractions = [\n [0n, 1n], // 0%\n [0n, 1n], // 0%\n [0n, 1n], // 0%\n [1n, 10_000n], // 0.01%\n [2n, 1000n], // 0.2%\n [3n, 100n], // 3%\n [45n, 100n], // 45%\n] as const\n","export const TransactionGasCosts = {\n /**\n * The cost of storing each character that is added to the chain\n * This includes the transaction JSON and all the elevated payloads' JSON\n */\n characterStorage: 10n,\n\n /** The cost of static validating every payload that will be included in the chain */\n payloadValidation: 1000n,\n\n /** The cost of validating each signature that will be included in the chain */\n signatureValidation: 1000n,\n\n /** The cost of validating each hash that will be included in the chain */\n hashValidation: 100n,\n\n /** The cost of validating a balance state, triggered by a Transfer payload or gas collection */\n balanceValidation: 100n,\n} as const\n\n/** Gas Calculation\n *\n * 1 Million microXL1 (mXL1) = 1 XL1\n *\n * Gas amount is calculated as follows:\n *\n * 1. Each byte in the transaction cost 10 gas\n * 2. Each payload validation in the transaction costs 1000 gas\n * 3. Each signature verification in the transaction costs 1000 gas\n * 4. Each hash validation in the transaction costs 100 gas\n * 5. Each balance validation in the transaction costs 100 gas\n * 6. Processing/Compute/Storage Cost?\n * 7. operation Costs?\n *\n * The total gas cost is calculated by multiplying the gas amount by the gas price.\n *\n * minGasPrice is initially set to 100 mXL1\n * minBase is initially set to 1000 mXL1\n * minPriority is always 0 mXL1, but can be set to increase the priority of the transaction\n *\n */\n","export const XL1_PROTOCOL_VERSION_MAJOR = 1 as const\nexport const XL1_PROTOCOL_VERSION_MINOR = 2 as const\nexport const XL1_PROTOCOL_VERSION_PATCH = 0 as const\nexport const XL1_PROTOCOL_VERSION_STRING = `${XL1_PROTOCOL_VERSION_MAJOR}.${XL1_PROTOCOL_VERSION_MINOR}.${XL1_PROTOCOL_VERSION_PATCH}` as const\nexport const XL1_PROTOCOL_VERSION = XL1_PROTOCOL_VERSION_MAJOR * 1_000_000 + XL1_PROTOCOL_VERSION_MINOR * 1000 + XL1_PROTOCOL_VERSION_PATCH\n","import type { Hex } from '@xylabs/hex'\nimport { AsObjectFactory } from '@xylabs/object'\nimport type { Payload, WithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\n isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nexport const BlockNumberSchema = 'network.xyo.chain.block.number' as const\nexport type BlockNumberSchema = typeof BlockNumberSchema\n\nexport interface BlockNumberFields {\n /**\n * The block number\n */\n block: Hex\n}\n/**\n * The number of a block\n */\nexport type BlockNumber = Payload<BlockNumberFields, BlockNumberSchema>\n\n/**\n * Identity function for determining if an object is a BlockNumber\n */\nexport const isBlockNumber = isPayloadOfSchemaType<BlockNumber>(BlockNumberSchema)\nexport const asBlockNumber = AsObjectFactory.create<BlockNumber>(isBlockNumber)\n\n/**\n * Identity function for determining if an object is a BlockNumber with sources\n */\nexport const isBlockNumberWithSources = isPayloadOfSchemaTypeWithSources<BlockNumber>(BlockNumberSchema)\nexport const asBlockNumberWithSources = AsObjectFactory.create<WithSources<BlockNumber>>(isBlockNumberWithSources)\n","import type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\n\nexport const NetworkStatusSchema = 'network.xyo.chain.status' as const\nexport type NetworkStatusSchema = typeof NetworkStatusSchema\n\nexport type NetworkStatusState = 'online' | 'offline' | 'degraded' | 'unknown'\n\nexport type NetworkStatusUpdate = {\n end: number\n start: number\n update: string\n}\n\nexport interface NetworkStatusFields {\n description: string\n state: NetworkStatusState\n updates?: NetworkStatusUpdate[]\n}\n\nexport type NetworkStatus = Payload<NetworkStatusFields, NetworkStatusSchema>\n\nexport const isNetworkStatus = isPayloadOfSchemaType<NetworkStatus>(NetworkStatusSchema)\n","import type { Hash } from '@xylabs/hex'\nimport type { Promisable } from '@xylabs/promise'\nimport type { Payload } from '@xyo-network/payload-model'\n\nexport type DataLakeData = Payload | ArrayBuffer\n\nexport interface XyoDataLakeViewer {\n // if resolves to hash payload, keep going until hitting a non-payload or maxDepth, or unable to find\n fetch(hashes: Hash[], maxDepth?: number): Promisable<DataLakeData[]>\n // same as fetch but never follows hash payloads\n get(hashes: Hash[]): Promisable<DataLakeData[]>\n // same as fetch, except returns each step in tuple containing the result and the steps\n trace(hash: Hash): Promisable<[DataLakeData | undefined, Payload[]]>\n}\n\nexport interface XyoDataLake extends XyoDataLakeViewer {\n add(items: DataLakeData[]): Promisable<DataLakeData[]>\n}\n\n/** @deprecated use XyoDataLake instead */\nexport interface XyoDataLakeProvider extends XyoDataLake {\n}\n\nexport const isDataLakeViewer = (value: unknown): value is XyoDataLakeViewer => {\n return (\n typeof value === 'object'\n && value !== null\n && 'fetch' in value\n && typeof (value as XyoDataLakeViewer).fetch === 'function'\n && 'get' in value\n && typeof (value as XyoDataLakeViewer).get === 'function'\n && 'trace' in value\n && typeof (value as XyoDataLakeViewer).trace === 'function'\n )\n}\n\nexport const isDataLakeProvider = (value: unknown): value is XyoDataLake => {\n return (\n isDataLakeViewer(value)\n && 'add' in value\n && typeof (value as XyoDataLake).add === 'function'\n )\n}\n","import type { Hash } from '@xylabs/hex'\nimport type { JsonValue } from '@xylabs/object'\nimport { AsObjectFactory } from '@xylabs/object'\nimport type { Payload, WithStorageMeta } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType, isStorageMeta } from '@xyo-network/payload-model'\n\nexport interface ChainIndexingServiceStateFields<T extends JsonValue = JsonValue> {\n /**\n * The hash of the last block that this service has indexing\n */\n endBlockHash: Hash\n /**\n * The hash of the block that the service started indexing. If undefined, the service is\n * assumed to have started indexing from the genesis block\n */\n startBlockHash?: Hash\n /**\n * The indexed state for the range\n */\n state: T\n}\nexport const ChainIndexingServiceStateSchema = 'network.xyo.chain.indexing.service.state' as const\nexport type ChainIndexingServiceStateSchema = typeof ChainIndexingServiceStateSchema\n\n/**\n * The result of a ChainIndexingServiceState\n */\nexport type ChainIndexingServiceState<T extends JsonValue = JsonValue> = Payload<ChainIndexingServiceStateFields<T>, ChainIndexingServiceStateSchema>\n\n/**\n * Identity functions for determining if an object is an ChainIndexingServiceState\n */\nexport const isChainIndexingServiceState = <T extends JsonValue = JsonValue>(payload?: unknown): payload is ChainIndexingServiceState<T> => {\n return isPayloadOfSchemaType<ChainIndexingServiceState<T>>(ChainIndexingServiceStateSchema)(payload)\n}\nexport const asChainIndexingServiceState = AsObjectFactory.create<ChainIndexingServiceState<JsonValue>>(isChainIndexingServiceState)\n\nexport const isChainIndexingServiceStateWithStorageMeta\n = <T extends JsonValue = JsonValue>(value: unknown): value is WithStorageMeta<ChainIndexingServiceState<T>> =>\n isChainIndexingServiceState<T>(value) && isStorageMeta(value)\n\nexport const asChainIndexingServiceStateWithStorageMeta\n = AsObjectFactory.create<WithStorageMeta<ChainIndexingServiceState>>(isChainIndexingServiceStateWithStorageMeta)\n","import { type Hash, isHash } from '@xylabs/hex'\nimport { isError } from '@xylabs/typeof'\nimport type { Payload } from '@xyo-network/payload-model'\n\nexport class ValidationError<TValue = Payload> extends Error {\n hash: Hash\n value: TValue\n constructor(hash: Hash, value: TValue, message?: string, cause?: unknown) {\n super(message)\n this.hash = hash\n this.name = this.constructor.name\n this.value = value\n this.cause = cause\n }\n}\n\nexport const isValidationError = <TValue = Payload>(\n error: unknown,\n): error is ValidationError<TValue> => {\n return (\n isError(error) && isHash((error as ValidationError<TValue>)?.hash) && (error as ValidationError<TValue>)?.value !== undefined\n )\n}\n","import type { Hash, Hex } from '@xylabs/hex'\n\nimport { type BlockBoundWitness, type HydratedBlock } from '../../block/index.ts'\nimport type { Chain } from '../../model.ts'\nimport { isValidationError, ValidationError } from '../error.ts'\n\nexport class BlockValidationError extends ValidationError<BlockBoundWitness> {}\n\nexport const isBlockValidationError = (\n error: unknown,\n): error is BlockValidationError => {\n if (!isValidationError(error)) return false\n return (\n error.name === BlockValidationError.constructor.name\n )\n}\n\nexport class HydratedBlockValidationError extends ValidationError<HydratedBlock> {}\n\nexport const isHydratedBlockValidationError = (\n error: unknown,\n): error is HydratedBlockValidationError => {\n if (!isValidationError(error)) return false\n return (\n error.name === HydratedBlockValidationError.constructor.name\n )\n}\n\nexport class HydratedBlockStateValidationError extends ValidationError<HydratedBlock> {\n chainId: Chain\n constructor(hash: Hash, chainId: Hex, value: HydratedBlock, message?: string, cause?: unknown) {\n super(hash, value, message, cause)\n this.chainId = chainId\n }\n}\n\nexport const isHydratedBlockStateValidationError = (\n error: unknown,\n): error is HydratedBlockStateValidationError => {\n if (!isValidationError(error)) return false\n return (\n error.name === HydratedBlockStateValidationError.constructor.name\n )\n}\n","import type { HydratedBoundWitness } from '@xyo-network/archivist-model'\nimport { type BoundWitness } from '@xyo-network/boundwitness-model'\n\nimport { isValidationError, ValidationError } from '../error.ts'\n\nexport class BoundWitnessValidationError extends ValidationError<BoundWitness> {}\n\nexport const isBoundWitnessValidationError = (\n error: unknown,\n): error is BoundWitnessValidationError => {\n if (!isValidationError(error)) return false\n return (\n error.name === BoundWitnessValidationError.constructor.name\n )\n}\n\nexport class HydratedBoundWitnessValidationError extends ValidationError<HydratedBoundWitness> {}\n\nexport const isHydratedBoundWitnessValidationError = (\n error: unknown,\n): error is HydratedBoundWitnessValidationError => {\n if (!isValidationError(error)) return false\n return (\n error.name === HydratedBoundWitnessValidationError.constructor.name\n )\n}\n","import type { Hash } from '@xylabs/hex'\nimport { type Payload } from '@xyo-network/payload-model'\n\nimport { type HydratedBlock } from '../../block/index.ts'\nimport { isValidationError, ValidationError } from '../error.ts'\n\nexport class InBlockPayloadValidationError extends ValidationError<Payload> {\n block: HydratedBlock\n constructor(hash: Hash, block: HydratedBlock, value: Payload, message?: string, cause?: unknown) {\n super(hash, value, message, cause)\n this.block = block\n }\n}\n\nexport const isInBlockPayloadValidationError = (\n error: unknown,\n): error is InBlockPayloadValidationError => {\n if (!isValidationError(error)) return false\n return (\n error.name === InBlockPayloadValidationError.constructor.name\n )\n}\n","import { type SignedHydratedTransaction } from '../../transaction/index.ts'\nimport { isValidationError, ValidationError } from '../error.ts'\n\nexport class HydratedTransactionValidationError extends ValidationError<SignedHydratedTransaction> {}\n\nexport const isHydratedTransactionValidationError = (\n error: unknown,\n): error is HydratedTransactionValidationError => {\n if (!isValidationError(error)) return false\n return (\n error.name === HydratedTransactionValidationError.constructor.name\n )\n}\n"],"mappings":";AAAO,IAAM,iBAAiB,CAAC,OAAe,SAAS,OAAyB;AAC9E,QAAM,QAAQ,QAAQ,OAAO,MAAM,MAAM;AACzC,QAAM,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CAAwC,CACnD,UACiD;AACjD,MAAI,CAAC,kBAAkB,KAAK,EAAG,QAAO;AACtC,SACE,MAAM,SAAS,oCAAoC,YAAY;AAEnE;;;ACnBO,IAAM,gCAAN,cAA4C,gBAAyB;AAAA,EAC1E;AAAA,EACA,YAAY,MAAY,OAAsB,OAAgB,SAAkB,OAAiB;AAC/F,UAAM,MAAM,OAAO,SAAS,KAAK;AACjC,SAAK,QAAQ;AAAA,EACf;AACF;AAEO,IAAM,kCAAkC,CAC7C,UAC2C;AAC3C,MAAI,CAAC,kBAAkB,KAAK,EAAG,QAAO;AACtC,SACE,MAAM,SAAS,8BAA8B,YAAY;AAE7D;;;AClBO,IAAM,qCAAN,cAAiD,gBAA2C;AAAC;AAE7F,IAAM,uCAAuC,CAClD,UACgD;AAChD,MAAI,CAAC,kBAAkB,KAAK,EAAG,QAAO;AACtC,SACE,MAAM,SAAS,mCAAmC,YAAY;AAElE;","names":["isHashStorageMeta","z","AsObjectFactory","isPayloadOfSchemaType","AsObjectFactory","isPayloadOfSchemaType","AsObjectFactory","isPayloadOfSchemaType","AsObjectFactory","isPayloadOfSchemaType","AsObjectFactory","isPayloadOfSchemaType","AsObjectFactory","isPayloadOfSchemaType","AsObjectFactory","isPayloadOfSchemaType","AsObjectFactory","AsObjectFactory","isAnyPayload","isStorageMeta","AsObjectFactory","isBoundWitness","AsObjectFactory","AsObjectFactory","isStorageMeta","isStorageMeta","AsObjectFactory","AsObjectFactory","isStorageMeta","isStorageMeta","AsObjectFactory","AsObjectFactory","isSigned","isSigned","AsObjectFactory","AsObjectFactory","isStorageMeta","isStorageMeta","AsObjectFactory","AsObjectFactory","isSigned","isStorageMeta","isSigned","isStorageMeta","AsObjectFactory","AsObjectFactory","AsObjectFactory","AsObjectFactory","AsObjectFactory","isHashStorageMeta","z","isHex","AsObjectFactory","isBoundWitness","isSigned","isHashStorageMeta","isStorageMeta","AsObjectFactory","AsObjectFactory","AsObjectFactory","isPayloadOfSchemaType","isPayloadOfSchemaType","AsObjectFactory","isPayloadOfSchemaType","isStorageMeta"]}
1
+ {"version":3,"sources":["../../src/amount/splitOnDecimal.ts","../../src/amount/splitOnDecimalToString.ts","../../src/amount/ShiftedBigInt.ts","../../src/amount/Xl1Amount.ts","../../src/xl1/isXL1Factory.ts","../../src/xl1/xl1MaxValue.ts","../../src/xl1/XL1Units.ts","../../src/xl1/AttoXL1.ts","../../src/xl1/FemtoXL1.ts","../../src/xl1/MicroXL1.ts","../../src/xl1/MilliXL1.ts","../../src/xl1/NanoXL1.ts","../../src/xl1/PicoXL1.ts","../../src/xl1/XL1.ts","../../src/block/AllowedBlockPayload.ts","../../src/payload/elevatable/Bridge/BridgeDestinationObservation.ts","../../src/payload/elevatable/Bridge/BridgeDetails.ts","../../src/payload/elevatable/Bridge/BridgeIntent.ts","../../src/payload/elevatable/Bridge/BridgeSourceObservation.ts","../../src/payload/elevatable/ChainStakeIntent.ts","../../src/payload/elevatable/Executable.ts","../../src/payload/elevatable/Hash.ts","../../src/payload/elevatable/StepComplete.ts","../../src/payload/elevatable/Time.ts","../../src/payload/elevatable/TransferPayload.ts","../../src/transaction/AnyHydratedTransaction.ts","../../src/isHydratedBoundWitness.ts","../../src/transaction/TransactionBoundWitness.ts","../../src/transaction/HydratedTransaction.ts","../../src/transaction/HydratedTransactionWithStorageMeta.ts","../../src/transaction/SignedHydratedTransaction.ts","../../src/transaction/SignedHydratedTransactionWithStorageMeta.ts","../../src/transaction/TransactionBoundWitnessDeprecated.ts","../../src/transaction/TransactionFeesFields.ts","../../src/transaction/UnsignedHydratedTransaction.ts","../../src/block/BlockBoundWitness.ts","../../src/block/HydratedBlock.ts","../../src/constants/addresses.ts","../../src/constants/defaultRewardRatio.ts","../../src/constants/minTransactionFees.ts","../../src/constants/defaultTransactionFees.ts","../../src/constants/StepSizes.ts","../../src/constants/TransactionGasCosts.ts","../../src/constants/version.ts","../../src/fields/BlockNumber.ts","../../src/network/Status.ts","../../src/provider/XyoDataLake.ts","../../src/services/StakeIntentService/ChainIndexingServiceStateSchema.ts","../../src/validation/error.ts","../../src/validation/block/error.ts","../../src/validation/boundwitness/error.ts","../../src/validation/payload/error.ts","../../src/validation/transaction/error.ts"],"sourcesContent":["export const splitOnDecimal = (value: bigint, places = 18): [bigint, bigint] => {\n const whole = value / BigInt(10 ** places)\n const decimal = value % BigInt(10 ** places)\n return [whole, decimal]\n}\n","import { splitOnDecimal } from './splitOnDecimal.ts'\n\nexport const splitOnDecimalToString = (\n value: bigint,\n places = 18,\n maxDecimal = places,\n maxCharacters = 9,\n minDecimals = 1,\n locale: Intl.LocalesArgument = 'en-US',\n): string => {\n const [whole, decimal] = splitOnDecimal(value, places)\n if (whole === 0n && decimal < 10 ** maxDecimal && decimal !== 0n) return '< 0.'.padEnd(maxDecimal + 5, '0') + '1'\n\n const wholeCharacters = whole.toString(10).length\n const calcMaxDecimalCharacters = maxCharacters === -1 ? places : wholeCharacters > maxCharacters ? 0 : maxCharacters - wholeCharacters\n const maxDecimalCharacters = Math.min(maxDecimal, calcMaxDecimalCharacters)\n\n // Format whole number with thousand separators according to locale\n const formattedWhole = new Intl.NumberFormat(locale, {\n maximumFractionDigits: 0,\n useGrouping: true,\n }).format(whole)\n\n // Get decimal separator for the locale\n const decimalSeparator = new Intl.NumberFormat(locale)\n .formatToParts(1.1)\n .find(part => part.type === 'decimal')?.value ?? '.'\n\n // Pad decimal part to correct number of places\n let paddedDecimal = decimal.toString().padStart(places, '0').slice(0, maxDecimalCharacters)\n // remove unneeded trailing zeros (honoring minDecimals)\n while (paddedDecimal.length > minDecimals && paddedDecimal.endsWith('0')) {\n paddedDecimal = paddedDecimal.slice(0, -1)\n }\n\n return `${formattedWhole}${paddedDecimal.length > 0 ? decimalSeparator : ''}${paddedDecimal}`\n}\n","import type { ShiftedBigIntConfig } from './ShiftedBigIntConfig.ts'\nimport { splitOnDecimalToString } from './splitOnDecimalToString.ts'\n\nexport class ShiftedBigInt {\n static readonly defaultConfig: ShiftedBigIntConfig = {\n places: 18,\n maxDecimal: 18,\n maxCharacters: 9,\n minDecimals: 1,\n locale: 'en-US',\n }\n\n config: ShiftedBigIntConfig\n value: bigint\n\n constructor(\n value: bigint | ShiftedBigInt,\n config: Partial<ShiftedBigIntConfig> = {},\n ) {\n this.value = typeof value === 'bigint' ? value : value.value\n this.config = {\n ...ShiftedBigInt.defaultConfig, ...(typeof value === 'bigint' ? {} : value.config), ...config,\n }\n }\n\n get locale(): Intl.LocalesArgument {\n return this.config.locale ?? 'en-US'\n }\n\n get maxCharacters(): number {\n return this.config.maxCharacters ?? 9\n }\n\n get maxDecimal(): number {\n return this.config.maxDecimal ?? this.places\n }\n\n get minDecimals(): number {\n return this.config.minDecimals ?? 1\n }\n\n get places(): number {\n return this.config.places ?? 18\n }\n\n toFullString(): string {\n return splitOnDecimalToString(\n this.value,\n this.places,\n this.places,\n Infinity,\n this.places,\n this.locale,\n )\n }\n\n toShortString(): string {\n return splitOnDecimalToString(\n this.value,\n this.places,\n this.maxDecimal,\n this.maxCharacters,\n this.minDecimals,\n this.locale,\n )\n }\n\n toString(): string {\n return this.toFullString()\n }\n}\n","/* eslint-disable @typescript-eslint/member-ordering */\nimport { assertEx } from '@xylabs/assert'\n\nimport {\n AttoXL1, FemtoXL1, MicroXL1, MilliXL1, NanoXL1, PicoXL1, XL1Places,\n} from '../xl1/index.ts'\nimport { ShiftedBigInt } from './ShiftedBigInt.ts'\nimport type { ShiftedBigIntConfig } from './ShiftedBigIntConfig.ts'\n\nconst MAX_XL1_AMOUNT = 2n ** 256n - 1n\nconst allowedPlaces = Object.values(XL1Places)\n\nexport interface XL1AmountInstance {\n value: AttoXL1\n\n to(places: bigint | number): bigint\n\n milli: MilliXL1\n\n micro: MicroXL1\n\n nano: NanoXL1\n\n pico: PicoXL1\n\n femto: FemtoXL1\n\n atto: AttoXL1\n\n toString(places: number, config: Partial<ShiftedBigIntConfig>): string\n}\n\nexport class XL1Amount implements XL1AmountInstance {\n value: AttoXL1\n private locale: Intl.LocalesArgument\n\n constructor(value: bigint, locale: Intl.LocalesArgument = 'en-US') {\n this.locale = locale\n this.value = AttoXL1(value > MAX_XL1_AMOUNT ? MAX_XL1_AMOUNT : value < 0n ? 0n : value)\n }\n\n static from(value: bigint, places: bigint = XL1Places.atto) {\n assertEx(allowedPlaces.includes(places), () => `Invalid conversion places (${places} not in ${allowedPlaces})`)\n return new XL1Amount(value * 10n ** BigInt(places))\n }\n\n static fromMilli(value: MilliXL1) {\n return this.from(value, XL1Places.milli)\n }\n\n static fromMicro(value: MicroXL1) {\n return this.from(value, XL1Places.micro)\n }\n\n static fromNano(value: NanoXL1) {\n return this.from(value, XL1Places.nano)\n }\n\n static fromPico(value: PicoXL1) {\n return this.from(value, XL1Places.pico)\n }\n\n static fromFemto(value: FemtoXL1) {\n return this.from(value, XL1Places.femto)\n }\n\n static fromAtto(value: AttoXL1) {\n return this.from(value, XL1Places.atto)\n }\n\n to(places: number | bigint = XL1Places.atto) {\n return this.value / 10n ** BigInt(places)\n }\n\n get milli() {\n return MilliXL1(this.to(XL1Places.milli))\n }\n\n get micro() {\n return MicroXL1(this.to(XL1Places.micro))\n }\n\n get nano() {\n return NanoXL1(this.to(XL1Places.nano))\n }\n\n get pico() {\n return PicoXL1(this.to(XL1Places.pico))\n }\n\n get femto() {\n return FemtoXL1(this.to(XL1Places.femto))\n }\n\n get atto() {\n return AttoXL1(this.to(XL1Places.atto))\n }\n\n toString(places: number = Number(XL1Places.atto), config: Partial<ShiftedBigIntConfig> = {}): string {\n assertEx(allowedPlaces.includes(BigInt(places)), () => `Invalid conversion places (${places} not in ${allowedPlaces})`)\n return new ShiftedBigInt(\n this.value,\n {\n places,\n locale: this.locale,\n maxDecimal: places,\n minDecimals: 0,\n maxCharacters: places,\n ...config,\n },\n ).toShortString()\n }\n}\n","import * as z from 'zod'\n\nimport { xl1MaxValue } from './xl1MaxValue.ts'\n\nexport const isXL1Factory = <T extends bigint>(places: bigint) => (val: unknown): val is T => {\n if (typeof val !== 'bigint') return false\n return val >= 0n && val <= xl1MaxValue(places)\n}\n\nexport const XL1ZodFactory = <T extends bigint>(places: bigint, name: string) => {\n const is = isXL1Factory<T>(places)\n const message = `Invalid value for ${name}, must be between 0 and ${xl1MaxValue(places)}`\n return z.bigint().refine(\n (x) => {\n const result = is(x)\n return result\n },\n { message },\n )\n}\n\nexport const XL1TransformZodFactory = <T extends bigint>(places: bigint, name: string) => {\n const is = isXL1Factory<T>(places)\n const message = `Invalid value for ${name}, must be between 0 and ${xl1MaxValue(places)}`\n return z.union([z.bigint(), z.number(), z.string(), z.boolean()]).transform(val => BigInt(val) as T).refine(\n (x) => {\n const result = is(x)\n return result\n },\n { message },\n )\n}\n\nexport const asXL1Factory = <T extends bigint>(places: bigint) => {\n const zod = XL1ZodFactory<T>(places, 'local')\n return (val: unknown): T => {\n const result = zod.safeParse(val)\n if (result.success) {\n return result.data as T\n }\n throw result.error\n }\n}\n\nexport const toXL1Factory = <T extends bigint>(places: bigint) => {\n const zod = XL1TransformZodFactory<T>(places, 'local')\n return (val: unknown): T | undefined => {\n const result = zod.safeParse(val)\n return result.success ? result.data as T : undefined\n }\n}\n","export const xl1MaxValue = (places: bigint) => 10n ** (32n - places) - 1n\n","type XL1Units = 'xl1' | 'milli' | 'micro' | 'nano' | 'pico' | 'femto' | 'atto'\n\nexport const XL1Places: Record<XL1Units, bigint> = {\n xl1: 18n,\n milli: 15n,\n micro: 12n,\n nano: 9n,\n pico: 6n,\n femto: 3n,\n atto: 0n,\n} as const\n\n/**\n * Convert factor by which a respective unit is multiplied to convert it to AttoXL1 or\n * by which AttoXL1 is divided to convert it to respective unit is multiplied.\n */\nexport const AttoXL1ConvertFactor: Record<XL1Units, bigint> = {\n xl1: 10n ** XL1Places.xl1,\n milli: 10n ** XL1Places.milli,\n micro: 10n ** XL1Places.micro,\n nano: 10n ** XL1Places.nano,\n pico: 10n ** XL1Places.pico,\n femto: 10n ** XL1Places.femto,\n atto: 10n ** XL1Places.atto,\n} as const\n","import {\n asXL1Factory, isXL1Factory, toXL1Factory,\n} from './isXL1Factory.ts'\nimport { xl1MaxValue } from './xl1MaxValue.ts'\nimport { XL1Places } from './XL1Units.ts'\n\nexport const AttoXL1MaxValue = xl1MaxValue(XL1Places.atto)\nexport type AttoXL1 = bigint & { readonly _tag: 'AttoXL1' }\nexport const isAttoXL1 = isXL1Factory<AttoXL1>(XL1Places.atto)\nexport const asAttoXL1 = asXL1Factory<AttoXL1>(XL1Places.atto)\nexport const toAttoXL1 = toXL1Factory<AttoXL1>(XL1Places.atto)\n\nexport const AttoXL1 = asAttoXL1\n","import {\n asXL1Factory, isXL1Factory, toXL1Factory,\n} from './isXL1Factory.ts'\nimport { xl1MaxValue } from './xl1MaxValue.ts'\nimport { XL1Places } from './XL1Units.ts'\n\nexport const FemtoXL1MaxValue = xl1MaxValue(XL1Places.femto)\nexport type FemtoXL1 = bigint & { readonly _tag: 'FemtoXL1' }\nexport const isFemtoXL1 = isXL1Factory<FemtoXL1>(XL1Places.femto)\nexport const asFemtoXL1 = asXL1Factory<FemtoXL1>(XL1Places.femto)\n\nexport const toFemtoXL1 = toXL1Factory<FemtoXL1>(XL1Places.femto)\n\nexport const FemtoXL1 = asFemtoXL1\n","import {\n asXL1Factory, isXL1Factory, toXL1Factory,\n} from './isXL1Factory.ts'\nimport { xl1MaxValue } from './xl1MaxValue.ts'\nimport { XL1Places } from './XL1Units.ts'\n\nexport const MicroXL1MaxValue = xl1MaxValue(XL1Places.micro)\nexport type MicroXL1 = bigint & { readonly _tag: 'MicroXL1' }\nexport const isMicroXL1 = isXL1Factory<MicroXL1>(XL1Places.micro)\nexport const asMicroXL1 = asXL1Factory<MicroXL1>(XL1Places.micro)\n\nexport const toMicroXL1 = toXL1Factory<MicroXL1>(XL1Places.micro)\n\nexport const MicroXL1 = asMicroXL1\n","import {\n asXL1Factory, isXL1Factory, toXL1Factory,\n} from './isXL1Factory.ts'\nimport { xl1MaxValue } from './xl1MaxValue.ts'\nimport { XL1Places } from './XL1Units.ts'\n\nexport const MilliXL1MaxValue = xl1MaxValue(XL1Places.milli)\nexport type MilliXL1 = bigint & { readonly _tag: 'MilliXL1' }\nexport const isMilliXL1 = isXL1Factory<MilliXL1>(XL1Places.milli)\nexport const asMilliXL1 = asXL1Factory<MilliXL1>(XL1Places.milli)\n\nexport const toMilliXL1 = toXL1Factory<MilliXL1>(XL1Places.milli)\n\nexport const MilliXL1 = asMilliXL1\n","import {\n asXL1Factory, isXL1Factory, toXL1Factory,\n} from './isXL1Factory.ts'\nimport { xl1MaxValue } from './xl1MaxValue.ts'\nimport { XL1Places } from './XL1Units.ts'\n\nexport const NanoXL1MaxValue = xl1MaxValue(XL1Places.nano)\nexport type NanoXL1 = bigint & { readonly _tag: 'NanoXL1' }\nexport const isNanoXL1 = isXL1Factory<NanoXL1>(XL1Places.nano)\nexport const asNanoXL1 = asXL1Factory<NanoXL1>(XL1Places.nano)\n\nexport const toNanoXL1 = toXL1Factory<NanoXL1>(XL1Places.nano)\n\nexport const NanoXL1 = asNanoXL1\n","import {\n asXL1Factory, isXL1Factory, toXL1Factory,\n} from './isXL1Factory.ts'\nimport { xl1MaxValue } from './xl1MaxValue.ts'\nimport { XL1Places } from './XL1Units.ts'\n\nexport const PicoXL1MaxValue = xl1MaxValue(XL1Places.pico)\nexport type PicoXL1 = bigint & { readonly _tag: 'PicoXL1' }\nexport const isPicoXL1 = isXL1Factory<PicoXL1>(XL1Places.pico)\nexport const asPicoXL1 = asXL1Factory<PicoXL1>(XL1Places.pico)\n\nexport const toPicoXL1 = toXL1Factory<PicoXL1>(XL1Places.pico)\n\nexport const PicoXL1 = asPicoXL1\n","import {\n asXL1Factory, isXL1Factory, toXL1Factory,\n} from './isXL1Factory.ts'\nimport { xl1MaxValue } from './xl1MaxValue.ts'\nimport { XL1Places } from './XL1Units.ts'\n\nexport const XL1MaxValue = xl1MaxValue(XL1Places.xl1)\nexport type XL1 = bigint & { readonly _tag: 'XL1' }\nexport const isXL1 = isXL1Factory<XL1>(XL1Places.xl1)\nexport const asXL1 = asXL1Factory<XL1>(XL1Places.xl1)\n\nexport const toXL1 = toXL1Factory<XL1>(XL1Places.xl1)\n\nexport const XL1 = asXL1\n","import { BoundWitnessSchema } from '@xyo-network/boundwitness-model'\nimport type { Schema, WithStorageMeta } from '@xyo-network/payload-model'\nimport { isHashStorageMeta, isSchema } from '@xyo-network/payload-model'\nimport type { SchemaPayload } from '@xyo-network/schema-payload-plugin'\nimport { isSchemaPayload, SchemaSchema } from '@xyo-network/schema-payload-plugin'\nimport z from 'zod'\n\nimport type {\n BridgeDestinationObservation, BridgeIntent, BridgeSourceObservation, ChainStakeIntent, HashPayload, StepComplete, TimePayload, Transfer,\n} from '../payload/index.ts'\nimport {\n BridgeDestinationObservationSchema, BridgeIntentSchema, BridgeSourceObservationSchema, ChainStakeIntentSchema, HashSchema,\n isBridgeDestinationObservation, isBridgeIntent, isBridgeSourceObservation, isChainStakeIntent, isHashPayload, isTimePayload, isTransfer, StepCompleteSchema,\n TimeSchema, TransferSchema,\n} from '../payload/index.ts'\nimport { isTransactionBoundWitness, type TransactionBoundWitness } from '../transaction/index.ts'\n\nexport type AllowedBlockPayload\n = Transfer\n | BridgeDestinationObservation\n | BridgeIntent\n | BridgeSourceObservation\n | ChainStakeIntent\n | HashPayload\n | SchemaPayload\n | StepComplete\n | TimePayload\n | TransactionBoundWitness\n\nexport const AllowedBlockPayloadSchemas: Schema[] = [\n BoundWitnessSchema,\n BridgeDestinationObservationSchema,\n BridgeIntentSchema,\n BridgeSourceObservationSchema,\n ChainStakeIntentSchema,\n HashSchema,\n SchemaSchema,\n StepCompleteSchema,\n TimeSchema,\n TransferSchema,\n]\n\nexport type AllowedBlockPayloadSchema = typeof AllowedBlockPayloadSchemas[number]\n\nexport const isAllowedBlockPayloadSchema = (value: unknown): value is AllowedBlockPayloadSchema => {\n return isSchema(value) && AllowedBlockPayloadSchemas.includes(value)\n}\n\nexport const isAllowedBlockPayload = (value: unknown): value is AllowedBlockPayload => {\n return isTransfer(value)\n || isBridgeDestinationObservation(value)\n || isBridgeIntent(value)\n || isBridgeSourceObservation(value)\n || isChainStakeIntent(value)\n || isHashPayload(value)\n || isSchemaPayload(value)\n || isTimePayload(value)\n || isTransactionBoundWitness(value)\n}\n\nexport const isAllowedBlockPayloadWithHashStorageMeta = (value: unknown): value is WithStorageMeta<AllowedBlockPayload> => {\n return isAllowedBlockPayload(value) && isHashStorageMeta(value)\n}\n\nexport const AllowedBlockPayloadZod = z.object({ schema: z.enum(AllowedBlockPayloadSchemas) })\n","import { HexZod } from '@xylabs/hex'\nimport { AsObjectFactory } from '@xylabs/object'\nimport type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfZodType } from '@xyo-network/payload-model'\nimport type z from 'zod'\n\nimport { BridgeDetailsFieldsZod } from './BridgeDetails.ts'\n\nexport const BridgeDestinationObservationSchema = 'network.xyo.chain.bridge.observation.destination' as const\nexport type BridgeDestinationObservationSchema = typeof BridgeDestinationObservationSchema\n\n/**\n * Represents an observation that confirms a bridge action occurred on the destination chain.\n */\nexport const BridgeDestinationObservationFieldsZod = BridgeDetailsFieldsZod.extend({\n /**\n * Destination chain confirmation\n */\n destConfirmation: HexZod.optional().describe('Destination chain confirmation'),\n})\n\nexport type BridgeDestinationObservationFields = z.infer<typeof BridgeDestinationObservationFieldsZod>\n\n/**\n * Represents an observation that confirms a bridge action occurred on the destination chain.\n */\nexport type BridgeDestinationObservation = Payload<BridgeDestinationObservationFields, BridgeDestinationObservationSchema>\n\nexport const isBridgeDestinationObservation = isPayloadOfZodType<BridgeDestinationObservation>(\n BridgeDestinationObservationFieldsZod,\n BridgeDestinationObservationSchema,\n)\n\nexport const asBridgeDestinationObservation = AsObjectFactory.create(isBridgeDestinationObservation)\n","import { HexZod } from '@xylabs/hex'\nimport z from 'zod'\n\n/**\n * Represents a transfer destination\n */\nexport const BridgeDetailsDestinationFieldsZod = z.object({\n /**\n * Destination network\n */\n dest: HexZod.describe('The destination network identifier'),\n /**\n * Destination address (EOA or contract)\n */\n destAddress: HexZod.describe('The destination address (EOA or contract)'),\n /**\n * Token amount to bridge to destination\n */\n destAmount: HexZod.describe('The token amount to bridge to destination'),\n /**\n * Token being bridged to\n */\n destToken: HexZod.describe('The token being bridged to'),\n})\n\n/**\n * Represents a transfer destination\n */\nexport type BridgeDetailsDestinationFields = z.infer<typeof BridgeDetailsDestinationFieldsZod>\n\n/**\n * Represents a transfer source\n */\nexport const BridgeDetailsSourceFieldsZod = z.object({\n /**\n * Source network\n */\n src: HexZod.describe('The source network identifier'),\n\n /**\n * Source address (EOA or contract)\n */\n srcAddress: HexZod.describe('The source address (EOA or contract)'),\n /**\n * Token amount to bridge from source\n */\n srcAmount: HexZod.describe('The token amount to bridge from source'),\n /**\n * Token being bridged from\n */\n srcToken: HexZod.describe('The token being bridged from'),\n})\n\n/**\n * Represents a transfer from a source chain/token/address/amount to a destination chain/token/address/amount.\n */\nexport const BridgeDetailsFieldsZod = BridgeDetailsSourceFieldsZod.extend(\n BridgeDetailsDestinationFieldsZod.shape,\n)\n\n/**\n * Represents a transfer from a source chain/token/address/amount to a destination chain/token/address/amount.\n */\nexport type BridgeDetailsFields = z.infer<typeof BridgeDetailsFieldsZod>\n","import { AsObjectFactory } from '@xylabs/object'\nimport type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfZodType } from '@xyo-network/payload-model'\nimport z from 'zod'\n\nimport { BridgeDetailsFieldsZod } from './BridgeDetails.ts'\n\nexport const BridgeIntentSchema = 'network.xyo.chain.bridge.intent' as const\nexport type BridgeIntentSchema = typeof BridgeIntentSchema\n\n/**\n * Represents an Address's intent to initiate a token bridge.\n */\nexport const BridgeIntentFieldsZod = BridgeDetailsFieldsZod.extend({\n /**\n * Unique identifier for replay protection\n */\n nonce: z.string().describe('Unique identifier for replay protection'),\n})\n\nexport type BridgeIntentFields = z.infer<typeof BridgeIntentFieldsZod>\n\nexport type BridgeIntent = Payload<BridgeIntentFields, BridgeIntentSchema>\n\nexport const isBridgeIntent = isPayloadOfZodType<BridgeIntent>(\n BridgeIntentFieldsZod,\n BridgeIntentSchema,\n)\n\nexport const asBridgeIntent = AsObjectFactory.create(isBridgeIntent)\n","import { HexZod } from '@xylabs/hex'\nimport { AsObjectFactory } from '@xylabs/object'\nimport type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfZodType } from '@xyo-network/payload-model'\nimport type z from 'zod'\n\nimport { BridgeDetailsFieldsZod } from './BridgeDetails.ts'\n\nexport const BridgeSourceObservationSchema = 'network.xyo.chain.bridge.observation.source' as const\nexport type BridgeSourceObservationSchema = typeof BridgeSourceObservationSchema\n\n/**\n * Represents an observation that confirms a bridge action occurred on the source chain.\n */\nexport const BridgeSourceObservationFieldsZod = BridgeDetailsFieldsZod.extend({\n /**\n * Source chain confirmation\n */\n srcConfirmation: HexZod.optional().describe('Source chain confirmation'),\n})\n\nexport type BridgeSourceObservationFields = z.infer<typeof BridgeSourceObservationFieldsZod>\n/**\n * Represents an observation that confirms a bridge action occurred on the source chain.\n */\nexport type BridgeSourceObservation = Payload<BridgeSourceObservationFields, BridgeSourceObservationSchema>\n\nexport const isBridgeSourceObservation = isPayloadOfZodType<BridgeSourceObservation>(\n BridgeSourceObservationFieldsZod,\n BridgeSourceObservationSchema,\n)\n\nexport const asBridgeSourceObservation = AsObjectFactory.create(isBridgeSourceObservation)\n","import { AsObjectFactory } from '@xylabs/object'\nimport type { Payload, WithStorageMeta } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType, isStorageMeta } from '@xyo-network/payload-model'\n\nimport type { BlockDuration } from '../../fields/index.ts'\nimport type { FromFields } from './Executable.ts'\n\nexport const ChainStakeIntentSchema = 'network.xyo.chain.stake.intent' as const\nexport type ChainStakeIntentSchema = typeof ChainStakeIntentSchema\n\nexport type Intent = 'producer' // | 'bank'\n\nexport interface ChainStakeIntentFields extends BlockDuration, FromFields {\n /*\n * The intent of the staking\n */\n intent: Intent\n}\n\nexport type ChainStakeIntent = Payload<ChainStakeIntentFields, ChainStakeIntentSchema>\n\nexport const isChainStakeIntent = (x?: unknown | null): x is ChainStakeIntent => {\n return isPayloadOfSchemaType<ChainStakeIntent>(ChainStakeIntentSchema)(x)\n && asNonNegativeInteger(x.nbf) !== undefined\n && asNonNegativeInteger(x.exp) !== undefined\n}\nexport const asChainStakeIntent = AsObjectFactory.create(isChainStakeIntent)\n\nexport const isChainStakeIntentWithStorageMeta = (x?: unknown | null): x is WithStorageMeta<ChainStakeIntent> => {\n return isChainStakeIntent(x) && isStorageMeta(x)\n}\n\nconst asNonNegativeInteger = (num: number) => {\n return (Number.isInteger(num) && num >= 0) ? num : undefined\n}\n","import type { Address } from '@xylabs/hex'\nimport type { EmptyObject } from '@xylabs/object'\nimport { isAnyPayload } from '@xyo-network/payload-model'\n\nexport interface FromFields {\n // the address that is treated as the source of this action\n from: Address\n}\n\nexport const hasFrom = (value: unknown): value is FromFields => {\n return (value as FromFields).from !== undefined\n}\n\nexport interface ExecutableFields {\n script: string[]\n}\n\nexport type Executable<T extends EmptyObject = EmptyObject> = T & ExecutableFields\nexport type OptionalExecutable<T extends EmptyObject = EmptyObject> = T & Partial<ExecutableFields>\n\nexport const isExecutable = <T extends EmptyObject>(value: T | undefined): value is Executable<T> => {\n return isAnyPayload(value) && Array.isArray((value as unknown as ExecutableFields).script)\n}\n\nexport const asExecutable = <T extends EmptyObject>(value: T | undefined): Executable<T> | undefined => {\n return isExecutable(value)\n ? value as unknown as Executable<T>\n : undefined\n}\n","import type { Hash } from '@xylabs/hex'\nimport { AsObjectFactory } from '@xylabs/object'\nimport type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\n\nexport const HashSchema = 'network.xyo.hash' as const\nexport type HashSchema = typeof HashSchema\n\nexport interface HashFields {\n hash: Hash\n}\n\nexport type HashPayload = Payload<HashFields, HashSchema>\n\nexport const isHashPayload = isPayloadOfSchemaType<HashPayload>(HashSchema)\n\nexport const asHashPayload = AsObjectFactory.create(isHashPayload)\nexport const asHashPayloadWithStorageMeta = AsObjectFactory.create(isHashPayload)\n","import type { Hash } from '@xylabs/hex'\nimport { AsObjectFactory } from '@xylabs/object'\nimport type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\n\nimport type { FromFields } from './Executable.ts'\n\nexport const StepCompleteSchema = 'network.xyo.chain.step.complete' as const\nexport type StepCompleteSchema = typeof StepCompleteSchema\n\n/* This records the completion of a step in the network - needed for network staking rewards */\n/* We will only write these for steps that are eligible for rewards Step 3 (2311) */\n\nexport interface StepCompleteFields extends FromFields {\n block: number /* The block number on the XL1 network */\n hash: Hash /* The Step Hash */\n size: number /* The size of the step */\n stakeBlock: number /* The block number on ethereum or other staking system */\n}\n\n// if this payload is included in a boundwitness, it needs to be available for inspection to be included in block\nexport type StepComplete = Payload<StepCompleteFields, StepCompleteSchema>\n\nexport const isStepComplete = isPayloadOfSchemaType<StepComplete>(StepCompleteSchema)\n\nexport const asStepComplete = AsObjectFactory.create(isStepComplete)\n","import type { Hash } from '@xylabs/hex'\nimport { AsObjectFactory } from '@xylabs/object'\nimport type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\n\n// xl1 = xl1 block number, epoch = epoch number, ethereum = ethereum block number\nexport type TimeDomain = 'xl1' | 'epoch' | 'ethereum'\n\nexport const TimeSchema = 'network.xyo.time' as const\nexport type TimeSchema = typeof TimeSchema\n\nexport interface XL1TimeFields {\n // block number\n xl1?: number\n // block hash\n xl1Hash?: Hash\n}\n\nexport interface EthereumTimeFields {\n // block number\n ethereum?: number\n // block hash\n ethereumHash?: Hash\n}\n\nexport interface TimeFields extends XL1TimeFields, EthereumTimeFields {\n // in milliseconds\n epoch: number\n}\n\nexport type TimePayload = Payload<TimeFields, TimeSchema>\n\n// to prevent scaling problems, we use double the current time as a max safe epoch\nexport const isSafeEpoch = (value: unknown): value is number => {\n return typeof value === 'number' && value < 2 * Date.now()\n}\n\nexport const isTimePayload = (value: unknown): value is TimePayload => {\n return isPayloadOfSchemaType<TimePayload>(TimeSchema)(value) && isSafeEpoch(value.epoch)\n}\n\nexport const asTimePayload = AsObjectFactory.create(isTimePayload)\nexport const asTimePayloadWithStorageMeta = AsObjectFactory.create(isTimePayload)\n","import type {\n Address,\n Hex,\n} from '@xylabs/hex'\nimport { AsObjectFactory } from '@xylabs/object'\nimport type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\n\nimport type { FromFields } from './Executable.ts'\n\nexport const TransferSchema = 'network.xyo.transfer' as const\nexport type TransferSchema = typeof TransferSchema\n\nexport interface TransferFields extends FromFields {\n epoch: number\n // the amount that is being sent to other addresses\n transfers: Partial<Record<Address, Hex>>\n}\n\n// if this payload is included in a boundwitness, it needs to be available for inspection to be included in block\nexport type Transfer = Payload<TransferFields, TransferSchema>\n\nexport const isTransfer = isPayloadOfSchemaType<Transfer>(TransferSchema)\n\nexport const asTransfer = AsObjectFactory.create(isTransfer)\n","import { AsObjectFactory } from '@xylabs/object'\nimport { type Payload } from '@xyo-network/payload-model'\n\nimport { isHydratedBoundWitness } from '../isHydratedBoundWitness.ts'\nimport { isTransactionBoundWitness, type TransactionBoundWitness } from './TransactionBoundWitness.ts'\n\nexport type AnyHydratedTransaction<T extends TransactionBoundWitness = TransactionBoundWitness,\n P extends Payload = Payload> = [T, P[]]\n\nexport const isAnyHydratedTransaction = (\n value: unknown,\n): value is AnyHydratedTransaction => {\n return (\n isHydratedBoundWitness(value) && isTransactionBoundWitness(value[0])\n )\n}\n\nexport const asAnyHydratedTransaction = AsObjectFactory.create<AnyHydratedTransaction>(\n isAnyHydratedTransaction,\n)\n","import { AsObjectFactory } from '@xylabs/object'\nimport type { HydratedBoundWitness, HydratedBoundWitnessWithStorageMeta } from '@xyo-network/archivist-model'\nimport { isBoundWitness } from '@xyo-network/boundwitness-model'\nimport { isAnyPayload, isStorageMeta } from '@xyo-network/payload-model'\n\nexport const isHydratedBoundWitness = (\n value: unknown,\n): value is HydratedBoundWitness => {\n return (\n Array.isArray(value)\n && value.length === 2\n && isBoundWitness(value[0])\n && Array.isArray(value[1])\n && !value[1].some(item => (!isAnyPayload(item)))\n )\n}\n\nexport const isHydratedBoundWitnessWithStorageMeta = (\n value: unknown,\n): value is HydratedBoundWitnessWithStorageMeta => {\n return (\n isHydratedBoundWitness(value)\n && isStorageMeta(value[0])\n && !value[1].some(item => (!isStorageMeta(item)))\n )\n}\n\nexport const asHydratedBoundWitness = AsObjectFactory.create<HydratedBoundWitness>(\n isHydratedBoundWitness,\n)\n\nexport const asHydratedBoundWitnessWithStorageMeta = AsObjectFactory.create<HydratedBoundWitnessWithStorageMeta>(\n isHydratedBoundWitnessWithStorageMeta,\n)\n","import {\n type Address, type Hex, isAddress,\n} from '@xylabs/hex'\nimport { AsObjectFactory } from '@xylabs/object'\nimport type { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { isBoundWitness } from '@xyo-network/boundwitness-model'\n\nimport type { BlockDuration } from '../fields/index.ts'\nimport type { FromFields, OptionalExecutable } from '../payload/index.ts'\nimport type { TransactionFeesFields } from './TransactionFeesFields.ts'\n\nexport interface TransactionBoundWitnessFields extends BlockDuration, TransactionFeesFields {\n chain: Hex | Address & { __chain: true }\n}\n\nexport type TransactionBoundWitness = BoundWitness<TransactionBoundWitnessFields & OptionalExecutable & FromFields>\n\nexport const isTransactionBoundWitness = (value: unknown): value is TransactionBoundWitness => {\n const typedObj = value as TransactionBoundWitness\n return isBoundWitness(value)\n && isAddress(typedObj.chain)\n && typedObj.fees !== undefined\n && typedObj.exp !== undefined\n && typedObj.nbf !== undefined\n}\n\nexport const asTransactionBoundWitness = AsObjectFactory.create(isTransactionBoundWitness)\n","import { AsObjectFactory } from '@xylabs/object'\nimport { isSigned, type Signed } from '@xyo-network/boundwitness-model'\nimport {\n isStorageMeta, type Payload, type WithStorageMeta,\n} from '@xyo-network/payload-model'\n\nimport { isHydratedBoundWitness } from '../isHydratedBoundWitness.ts'\nimport { isTransactionBoundWitness, type TransactionBoundWitness } from './TransactionBoundWitness.ts'\n\n/** @deprecated Use HydratedTransactionWithStorageMeta instead */\nexport type HydratedTransaction<T extends TransactionBoundWitness = TransactionBoundWitness,\n P extends Payload = Payload> = [WithStorageMeta<Signed<T>>, WithStorageMeta<P>[]]\n\n/** @deprecated Use isHydratedTransactionWithStorageMeta instead */\nexport const isHydratedTransaction = (\n value: unknown,\n// eslint-disable-next-line sonarjs/deprecation\n): value is HydratedTransaction => {\n return (\n isHydratedBoundWitness(value) && isTransactionBoundWitness(value[0]) && isSigned(value[0]) && isStorageMeta(value[0])\n )\n}\n\n/** @deprecated Use asHydratedTransactionWithStorageMeta instead */\n// eslint-disable-next-line sonarjs/deprecation\nexport const asHydratedTransaction = AsObjectFactory.create<HydratedTransaction>(\n // eslint-disable-next-line sonarjs/deprecation\n isHydratedTransaction,\n)\n","import { AsObjectFactory } from '@xylabs/object'\nimport { type Signed } from '@xyo-network/boundwitness-model'\nimport {\n isStorageMeta, type Payload, type WithStorageMeta,\n} from '@xyo-network/payload-model'\n\nimport { isAnyHydratedTransaction } from './AnyHydratedTransaction.ts'\nimport { type TransactionBoundWitness } from './TransactionBoundWitness.ts'\n\nexport type HydratedTransactionWithStorageMeta<T extends TransactionBoundWitness = TransactionBoundWitness,\n P extends Payload = Payload> = [WithStorageMeta<Signed<T>>, WithStorageMeta<P>[]]\n\nexport const isHydratedTransactionWithStorageMeta = (\n value: unknown,\n): value is HydratedTransactionWithStorageMeta => {\n return (\n isAnyHydratedTransaction(value) && isStorageMeta(value[0]) && !value[1].some(v => !isStorageMeta(v))\n )\n}\n\nexport const asHydratedTransactionWithStorageMeta = AsObjectFactory.create<HydratedTransactionWithStorageMeta>(\n isHydratedTransactionWithStorageMeta,\n)\n","import { AsObjectFactory } from '@xylabs/object'\nimport type { Signed } from '@xyo-network/boundwitness-model'\nimport { isSigned } from '@xyo-network/boundwitness-model'\nimport type { Payload } from '@xyo-network/payload-model'\n\nimport { isAnyHydratedTransaction } from './AnyHydratedTransaction.ts'\nimport { type TransactionBoundWitness } from './TransactionBoundWitness.ts'\n\nexport type SignedHydratedTransaction<T extends TransactionBoundWitness = TransactionBoundWitness,\n P extends Payload = Payload> = [Signed<T>, P[]]\n\nexport const isSignedHydratedTransaction = (\n value: unknown,\n): value is SignedHydratedTransaction => {\n return (\n isAnyHydratedTransaction(value) && isSigned(value[0])\n )\n}\n\nexport const asSignedHydratedTransaction = AsObjectFactory.create<SignedHydratedTransaction>(\n isSignedHydratedTransaction,\n)\n","import { AsObjectFactory } from '@xylabs/object'\nimport { type Signed } from '@xyo-network/boundwitness-model'\nimport {\n isStorageMeta, type Payload, type WithStorageMeta,\n} from '@xyo-network/payload-model'\n\nimport { isSignedHydratedTransaction } from './SignedHydratedTransaction.ts'\nimport { type TransactionBoundWitness } from './TransactionBoundWitness.ts'\n\nexport type SignedHydratedTransactionWithStorageMeta<T extends TransactionBoundWitness = TransactionBoundWitness,\n P extends Payload = Payload> = [WithStorageMeta<Signed<T>>, WithStorageMeta<P>[]]\n\nexport const isSignedHydratedTransactionWithStorageMeta = (\n value: unknown,\n): value is SignedHydratedTransactionWithStorageMeta => {\n return (\n isSignedHydratedTransaction(value) && isStorageMeta(value[0]) && !value[1].some(v => !isStorageMeta(v))\n )\n}\n\nexport const asSignedHydratedTransactionWithStorageMeta = AsObjectFactory.create<SignedHydratedTransactionWithStorageMeta>(\n isSignedHydratedTransactionWithStorageMeta,\n)\n","import { AsObjectFactory } from '@xylabs/object'\nimport type { Signed } from '@xyo-network/boundwitness-model'\nimport { isSigned } from '@xyo-network/boundwitness-model'\nimport type { WithHashStorageMeta, WithStorageMeta } from '@xyo-network/payload-model'\nimport { isHashStorageMeta, isStorageMeta } from '@xyo-network/payload-model'\n\nimport { isTransactionBoundWitness, type TransactionBoundWitness } from './TransactionBoundWitness.ts'\n\nexport const isSignedTransactionBoundWitness = (value: unknown): value is Signed<TransactionBoundWitness> => {\n return isTransactionBoundWitness(value) && isSigned(value)\n}\n\nexport const isTransactionBoundWitnessWithStorageMeta = (value: unknown): value is WithStorageMeta<TransactionBoundWitness> =>\n isTransactionBoundWitness(value)\n && isStorageMeta(value)\n\nexport const isTransactionBoundWitnessWithHashStorageMeta = (value: unknown): value is WithHashStorageMeta<TransactionBoundWitness> =>\n isTransactionBoundWitness(value)\n && isHashStorageMeta(value)\n\nexport const isSignedTransactionBoundWitnessWithStorageMeta = (value: unknown): value is WithStorageMeta<Signed<TransactionBoundWitness>> =>\n\n isSignedTransactionBoundWitness(value)\n && isStorageMeta(value)\n\nexport const isSignedTransactionBoundWitnessWithHashStorageMeta = (value: unknown): value is WithHashStorageMeta<Signed<TransactionBoundWitness>> =>\n\n isSignedTransactionBoundWitness(value)\n && isHashStorageMeta(value)\n\nexport const asTransactionBoundWitnessWithStorageMeta = AsObjectFactory.create(isTransactionBoundWitnessWithStorageMeta)\n\nexport const asTransactionBoundWitnessWithHashStorageMeta = AsObjectFactory.create(isTransactionBoundWitnessWithHashStorageMeta)\n","import { type Hex, isHex } from '@xylabs/hex'\nimport { AsObjectFactory } from '@xylabs/object'\nimport { isObject } from '@xylabs/typeof'\n\nimport { type AttoXL1, isAttoXL1 } from '../xl1/index.ts'\n\nexport interface TransactionFeesBigInt {\n base: AttoXL1\n gasLimit: AttoXL1\n gasPrice: AttoXL1\n priority: AttoXL1\n}\n\nexport type TransactionFeesHex = {\n [K in keyof TransactionFeesBigInt]: Hex;\n}\n\nexport interface TransactionFeesFields {\n fees: TransactionFeesHex\n}\n\nexport const isTransactionFeesBigInt = (value: unknown): value is TransactionFeesBigInt => {\n if (!isObject(value)) {\n return false\n }\n const {\n base, gasLimit, gasPrice, priority,\n } = value as TransactionFeesBigInt\n return (\n isAttoXL1(base)\n && isAttoXL1(gasLimit)\n && isAttoXL1(gasPrice)\n && isAttoXL1(priority)\n )\n}\n\nexport const asTransactionFeesBigInt = AsObjectFactory.create<TransactionFeesBigInt>(\n isTransactionFeesBigInt,\n)\n\nexport const isTransactionFeesHex = (value: unknown): value is TransactionFeesHex => {\n if (!isObject(value)) {\n return false\n }\n const {\n base, gasLimit, gasPrice, priority,\n } = value as TransactionFeesHex\n return (\n isHex(base)\n && isHex(gasLimit)\n && isHex(gasPrice)\n && isHex(priority)\n )\n}\n\nexport const asTransactionFeesHex = AsObjectFactory.create<TransactionFeesHex>(\n isTransactionFeesHex,\n)\n","import { AsObjectFactory } from '@xylabs/object'\nimport { isUnsigned } from '@xyo-network/boundwitness-model'\nimport type { Payload } from '@xyo-network/payload-model'\n\nimport { isAnyHydratedTransaction } from './AnyHydratedTransaction.ts'\nimport { type TransactionBoundWitness } from './TransactionBoundWitness.ts'\n\nexport type UnsignedHydratedTransaction<T extends TransactionBoundWitness = TransactionBoundWitness,\n P extends Payload = Payload> = [T, P[]]\n\nexport const isUnsignedHydratedTransaction = (\n value: unknown,\n): value is UnsignedHydratedTransaction => {\n return (\n isAnyHydratedTransaction(value) && isUnsigned(value[0])\n )\n}\n\nexport const asUnsignedHydratedTransaction = AsObjectFactory.create<UnsignedHydratedTransaction>(\n isUnsignedHydratedTransaction,\n)\n","import type { Hash } from '@xylabs/hex'\nimport { isHex } from '@xylabs/hex'\nimport { AsObjectFactory } from '@xylabs/object'\nimport type { BoundWitness, Signed } from '@xyo-network/boundwitness-model'\nimport { isBoundWitness, isSigned } from '@xyo-network/boundwitness-model'\nimport type { WithHashStorageMeta, WithStorageMeta } from '@xyo-network/payload-model'\nimport { isHashStorageMeta, isStorageMeta } from '@xyo-network/payload-model'\n\nimport type { Chain } from '../model.ts'\n\nexport interface BlockBoundWitnessMeta {\n $epoch: number\n}\n\nexport interface BlockBoundWitnessFields {\n /** Block number */\n block: number\n /** Chain id - this should be \"0\" for the genesis block */\n chain: Chain\n /** Previous block hash if not block 0 */\n previous: Hash | null /* the previous block hash */\n /** Version of the protocol being used major * 1,000,000 + minor * 1,000 + patch */\n protocol: number\n /** Step hashes */\n step_hashes: Hash[]\n}\n\nexport type BlockBoundWitness = BoundWitness<BlockBoundWitnessFields & BlockBoundWitnessMeta>\n\nexport const isBlockBoundWitness = (value: unknown): value is BlockBoundWitness => {\n const typedObj = value as BlockBoundWitness\n return isBoundWitness(value)\n && Number.isInteger(typedObj.block)\n && isHex(typedObj.chain)\n}\n\nexport const isSignedBlockBoundWitness = (value: unknown): value is Signed<BlockBoundWitness> => {\n return isBlockBoundWitness(value) && isSigned(value)\n}\n\nexport const isBlockBoundWitnessWithStorageMeta = (value: unknown): value is WithStorageMeta<BlockBoundWitness> => {\n return isBlockBoundWitness(value) && isStorageMeta(value)\n}\n\nexport const isSignedBlockBoundWitnessWithStorageMeta = (value: unknown): value is Signed<WithStorageMeta<BlockBoundWitness>> => {\n return isBlockBoundWitnessWithStorageMeta(value) && isSigned(value)\n}\n\nexport const isBlockBoundWitnessWithHashStorageMeta = (value: unknown): value is WithHashStorageMeta<BlockBoundWitness> => {\n return isBlockBoundWitness(value) && isHashStorageMeta(value)\n}\n\nexport const isSignedBlockBoundWitnessWithHashStorageMeta = (value: unknown): value is Signed<WithHashStorageMeta<BlockBoundWitness>> => {\n return isBlockBoundWitnessWithHashStorageMeta(value) && isSigned(value)\n}\n\nexport const asBlockBoundWitness = AsObjectFactory.create(isBlockBoundWitness)\nexport const asSignedBlockBoundWitness = AsObjectFactory.create(isSignedBlockBoundWitness)\n\nexport const asBlockBoundWitnessWithStorageMeta = AsObjectFactory.create(isBlockBoundWitnessWithStorageMeta)\nexport const asSignedBlockBoundWitnessWithStorageMeta = AsObjectFactory.create(isSignedBlockBoundWitnessWithStorageMeta)\n\nexport const asBlockBoundWitnessWithHashStorageMeta = AsObjectFactory.create(isBlockBoundWitnessWithHashStorageMeta)\nexport const asSignedBlockBoundWitnessWithHashStorageMeta = AsObjectFactory.create(isSignedBlockBoundWitnessWithHashStorageMeta)\n","import { AsObjectFactory } from '@xylabs/object'\nimport type { Signed } from '@xyo-network/boundwitness-model'\nimport { type Payload, type WithStorageMeta } from '@xyo-network/payload-model'\n\nimport { isHydratedBoundWitness } from '../isHydratedBoundWitness.ts'\nimport {\n type BlockBoundWitness,\n isBlockBoundWitnessWithStorageMeta,\n} from './BlockBoundWitness.ts'\n\nexport type HydratedBlock<T extends BlockBoundWitness = BlockBoundWitness,\n P extends Payload = Payload> = [WithStorageMeta<Signed<T>>, WithStorageMeta<P>[]]\n\nexport const isHydratedBlock = (\n value: unknown,\n): value is HydratedBlock => {\n return (\n isHydratedBoundWitness(value) && isBlockBoundWitnessWithStorageMeta(value[0])\n )\n}\n\nexport const asHydratedBlock = AsObjectFactory.create<HydratedBlock>(\n isHydratedBlock,\n)\n","import type { Address, EthAddress } from '@xylabs/hex'\n\n/**\n * The Zero Address is used as a marker address for various protocol operations.\n */\nexport const XYO_ZERO_ADDRESS = '0000000000000000000000000000000000000000' as const as Address\n\n/**\n * The Bridge Address is used as a marker address for bridge transactions.\n */\nexport const XYO_BRIDGE_ADDRESS = '3012193230121932301219323012193230121932' as const as Address\n\n/**\n * The Network Staking Address is used as a marker address for staking the network.\n */\nexport const XYO_NETWORK_STAKING_ADDRESS = '1969196919691969196919691969196919691969' as const as Address\n\n/**\n * The Step Reward Address is used as a marker address for step rewards.\n */\nexport const XYO_STEP_REWARD_ADDRESS = '1216197612161976121619761216197612161976' as const as Address\n\nexport const XL1_ETH_MAIN_ERC20_CONTRACT_ADDRESS = '0xf72aE3E0DA743033AbD7A407557D684c1aE66aed' as const as EthAddress\n\nexport const XL1_ETH_MAIN_SUB_GOVERNOR_ADDRESS = '0xbA296Bc5D0949C0484f08c56c30FB95CC4675A29' as const as EthAddress\n\nexport const XL1_ETH_MAIN_REWARDS_ADDRESS = '0x1a546e091FB4EFb274DC584334a28b8754c4ece7' as const as EthAddress\n\nexport const XL1_ETH_MAIN_STAKED_XYO_CHAIN_ADDRESS = '0x319e667cED10452A117472811130444dED357F26' as const as EthAddress\n\nexport const XL1_ETH_MAIN_GOVERNANCE_ADDRESS = '0x7595710956d6B14b4f2F51a8dF41379eEeC9074E' as const as EthAddress\n","// the percent of the block rewards the producer gets\nexport const defaultRewardRatio = 0.05 as const // 5.0% goes to block producer\n","import type { TransactionFeesBigInt } from '../transaction/index.ts'\nimport { AttoXL1, AttoXL1ConvertFactor } from '../xl1/index.ts'\n\nexport const minTransactionFees: TransactionFeesBigInt = {\n base: AttoXL1(1000n * AttoXL1ConvertFactor.nano),\n gasPrice: AttoXL1(10n * AttoXL1ConvertFactor.nano),\n gasLimit: AttoXL1(1_000_000n * AttoXL1ConvertFactor.nano),\n priority: AttoXL1(0n * AttoXL1ConvertFactor.nano),\n} as const\n","import type { TransactionFeesBigInt } from '../transaction/index.ts'\nimport { AttoXL1, AttoXL1ConvertFactor } from '../xl1/index.ts'\nimport { minTransactionFees } from './minTransactionFees.ts'\n\nexport const defaultTransactionFees: TransactionFeesBigInt = {\n base: minTransactionFees.base,\n gasPrice: AttoXL1(10n * AttoXL1ConvertFactor.nano),\n gasLimit: AttoXL1(1_000_000n * AttoXL1ConvertFactor.nano),\n priority: minTransactionFees.priority,\n} as const\n","import { AsTypeFactory } from '@xylabs/object'\n\n// StepsV2 are primorial(n+2) + 1, where n is the index of the step size\n// primorial(n+2) = 2 → 2×3=6 → 6×5=30 → 30×7=210 → 210×11=2310\n\nexport const StepSizes = [7, 31, 211, 2311, 30_031, 510_511, 9_699_691, 223_092_871, 6_469_693_231] as const\n\nexport function isValidStep(step: unknown): step is number {\n if (typeof step === 'number' && Number.isInteger(step)) {\n return ((step >= 0) && (step < StepSizes.length))\n }\n return false\n}\n\nexport const asValidStep = AsTypeFactory.create<number>(isValidStep)\n\nexport function stepSize(step: number): number {\n const validatedStep = asValidStep(step, () => `Invalid step (${step}), must be an integer between 0 and ${StepSizes.length - 1}`, { required: true })\n return StepSizes[validatedStep]\n}\n\nexport const StepRewardFractions = [\n [0n, 1n], // 0%\n [0n, 1n], // 0%\n [0n, 1n], // 0%\n [1n, 10_000n], // 0.01%\n [2n, 1000n], // 0.2%\n [3n, 100n], // 3%\n [45n, 100n], // 45%\n] as const\n","export const TransactionGasCosts = {\n /**\n * The cost of storing each character that is added to the chain\n * This includes the transaction JSON and all the elevated payloads' JSON\n */\n characterStorage: 10n,\n\n /** The cost of static validating every payload that will be included in the chain */\n payloadValidation: 1000n,\n\n /** The cost of validating each signature that will be included in the chain */\n signatureValidation: 1000n,\n\n /** The cost of validating each hash that will be included in the chain */\n hashValidation: 100n,\n\n /** The cost of validating a balance state, triggered by a Transfer payload or gas collection */\n balanceValidation: 100n,\n} as const\n\n/** Gas Calculation\n *\n * 1 Million microXL1 (mXL1) = 1 XL1\n *\n * Gas amount is calculated as follows:\n *\n * 1. Each byte in the transaction cost 10 gas\n * 2. Each payload validation in the transaction costs 1000 gas\n * 3. Each signature verification in the transaction costs 1000 gas\n * 4. Each hash validation in the transaction costs 100 gas\n * 5. Each balance validation in the transaction costs 100 gas\n * 6. Processing/Compute/Storage Cost?\n * 7. operation Costs?\n *\n * The total gas cost is calculated by multiplying the gas amount by the gas price.\n *\n * minGasPrice is initially set to 100 mXL1\n * minBase is initially set to 1000 mXL1\n * minPriority is always 0 mXL1, but can be set to increase the priority of the transaction\n *\n */\n","export const XL1_PROTOCOL_VERSION_MAJOR = 1 as const\nexport const XL1_PROTOCOL_VERSION_MINOR = 2 as const\nexport const XL1_PROTOCOL_VERSION_PATCH = 0 as const\nexport const XL1_PROTOCOL_VERSION_STRING = `${XL1_PROTOCOL_VERSION_MAJOR}.${XL1_PROTOCOL_VERSION_MINOR}.${XL1_PROTOCOL_VERSION_PATCH}` as const\nexport const XL1_PROTOCOL_VERSION = XL1_PROTOCOL_VERSION_MAJOR * 1_000_000 + XL1_PROTOCOL_VERSION_MINOR * 1000 + XL1_PROTOCOL_VERSION_PATCH\n","import type { Hex } from '@xylabs/hex'\nimport { AsObjectFactory } from '@xylabs/object'\nimport type { Payload, WithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\n isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nexport const BlockNumberSchema = 'network.xyo.chain.block.number' as const\nexport type BlockNumberSchema = typeof BlockNumberSchema\n\nexport interface BlockNumberFields {\n /**\n * The block number\n */\n block: Hex\n}\n/**\n * The number of a block\n */\nexport type BlockNumber = Payload<BlockNumberFields, BlockNumberSchema>\n\n/**\n * Identity function for determining if an object is a BlockNumber\n */\nexport const isBlockNumber = isPayloadOfSchemaType<BlockNumber>(BlockNumberSchema)\nexport const asBlockNumber = AsObjectFactory.create<BlockNumber>(isBlockNumber)\n\n/**\n * Identity function for determining if an object is a BlockNumber with sources\n */\nexport const isBlockNumberWithSources = isPayloadOfSchemaTypeWithSources<BlockNumber>(BlockNumberSchema)\nexport const asBlockNumberWithSources = AsObjectFactory.create<WithSources<BlockNumber>>(isBlockNumberWithSources)\n","import type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\n\nexport const NetworkStatusSchema = 'network.xyo.chain.status' as const\nexport type NetworkStatusSchema = typeof NetworkStatusSchema\n\nexport type NetworkStatusState = 'online' | 'offline' | 'degraded' | 'unknown'\n\nexport type NetworkStatusUpdate = {\n end: number\n start: number\n update: string\n}\n\nexport interface NetworkStatusFields {\n description: string\n state: NetworkStatusState\n updates?: NetworkStatusUpdate[]\n}\n\nexport type NetworkStatus = Payload<NetworkStatusFields, NetworkStatusSchema>\n\nexport const isNetworkStatus = isPayloadOfSchemaType<NetworkStatus>(NetworkStatusSchema)\n","import type { Hash } from '@xylabs/hex'\nimport type { Promisable } from '@xylabs/promise'\nimport type { Payload } from '@xyo-network/payload-model'\n\nexport type DataLakeData = Payload | ArrayBuffer\n\nexport interface XyoDataLakeViewer {\n // if resolves to hash payload, keep going until hitting a non-payload or maxDepth, or unable to find\n fetch(hashes: Hash[], maxDepth?: number): Promisable<DataLakeData[]>\n // same as fetch but never follows hash payloads\n get(hashes: Hash[]): Promisable<DataLakeData[]>\n // same as fetch, except returns each step in tuple containing the result and the steps\n trace(hash: Hash): Promisable<[DataLakeData | undefined, Payload[]]>\n}\n\nexport interface XyoDataLake extends XyoDataLakeViewer {\n add(items: DataLakeData[]): Promisable<DataLakeData[]>\n}\n\n/** @deprecated use XyoDataLake instead */\nexport interface XyoDataLakeProvider extends XyoDataLake {\n}\n\nexport const isDataLakeViewer = (value: unknown): value is XyoDataLakeViewer => {\n return (\n typeof value === 'object'\n && value !== null\n && 'fetch' in value\n && typeof (value as XyoDataLakeViewer).fetch === 'function'\n && 'get' in value\n && typeof (value as XyoDataLakeViewer).get === 'function'\n && 'trace' in value\n && typeof (value as XyoDataLakeViewer).trace === 'function'\n )\n}\n\nexport const isDataLakeProvider = (value: unknown): value is XyoDataLake => {\n return (\n isDataLakeViewer(value)\n && 'add' in value\n && typeof (value as XyoDataLake).add === 'function'\n )\n}\n","import type { Hash } from '@xylabs/hex'\nimport type { JsonValue } from '@xylabs/object'\nimport { AsObjectFactory } from '@xylabs/object'\nimport type { Payload, WithStorageMeta } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType, isStorageMeta } from '@xyo-network/payload-model'\n\nexport interface ChainIndexingServiceStateFields<T extends JsonValue = JsonValue> {\n /**\n * The hash of the last block that this service has indexing\n */\n endBlockHash: Hash\n /**\n * The hash of the block that the service started indexing. If undefined, the service is\n * assumed to have started indexing from the genesis block\n */\n startBlockHash?: Hash\n /**\n * The indexed state for the range\n */\n state: T\n}\nexport const ChainIndexingServiceStateSchema = 'network.xyo.chain.indexing.service.state' as const\nexport type ChainIndexingServiceStateSchema = typeof ChainIndexingServiceStateSchema\n\n/**\n * The result of a ChainIndexingServiceState\n */\nexport type ChainIndexingServiceState<T extends JsonValue = JsonValue> = Payload<ChainIndexingServiceStateFields<T>, ChainIndexingServiceStateSchema>\n\n/**\n * Identity functions for determining if an object is an ChainIndexingServiceState\n */\nexport const isChainIndexingServiceState = <T extends JsonValue = JsonValue>(payload?: unknown): payload is ChainIndexingServiceState<T> => {\n return isPayloadOfSchemaType<ChainIndexingServiceState<T>>(ChainIndexingServiceStateSchema)(payload)\n}\nexport const asChainIndexingServiceState = AsObjectFactory.create<ChainIndexingServiceState<JsonValue>>(isChainIndexingServiceState)\n\nexport const isChainIndexingServiceStateWithStorageMeta\n = <T extends JsonValue = JsonValue>(value: unknown): value is WithStorageMeta<ChainIndexingServiceState<T>> =>\n isChainIndexingServiceState<T>(value) && isStorageMeta(value)\n\nexport const asChainIndexingServiceStateWithStorageMeta\n = AsObjectFactory.create<WithStorageMeta<ChainIndexingServiceState>>(isChainIndexingServiceStateWithStorageMeta)\n","import { type Hash, isHash } from '@xylabs/hex'\nimport { isError } from '@xylabs/typeof'\nimport type { Payload } from '@xyo-network/payload-model'\n\nexport class ValidationError<TValue = Payload> extends Error {\n hash: Hash\n value: TValue\n constructor(hash: Hash, value: TValue, message?: string, cause?: unknown) {\n super(message)\n this.hash = hash\n this.name = this.constructor.name\n this.value = value\n this.cause = cause\n }\n}\n\nexport const isValidationError = <TValue = Payload>(\n error: unknown,\n): error is ValidationError<TValue> => {\n return (\n isError(error) && isHash((error as ValidationError<TValue>)?.hash) && (error as ValidationError<TValue>)?.value !== undefined\n )\n}\n","import type { Hash, Hex } from '@xylabs/hex'\n\nimport { type BlockBoundWitness, type HydratedBlock } from '../../block/index.ts'\nimport type { Chain } from '../../model.ts'\nimport { isValidationError, ValidationError } from '../error.ts'\n\nexport class BlockValidationError extends ValidationError<BlockBoundWitness> {}\n\nexport const isBlockValidationError = (\n error: unknown,\n): error is BlockValidationError => {\n if (!isValidationError(error)) return false\n return (\n error.name === BlockValidationError.constructor.name\n )\n}\n\nexport class HydratedBlockValidationError extends ValidationError<HydratedBlock> {}\n\nexport const isHydratedBlockValidationError = (\n error: unknown,\n): error is HydratedBlockValidationError => {\n if (!isValidationError(error)) return false\n return (\n error.name === HydratedBlockValidationError.constructor.name\n )\n}\n\nexport class HydratedBlockStateValidationError extends ValidationError<HydratedBlock> {\n chainId: Chain\n constructor(hash: Hash, chainId: Hex, value: HydratedBlock, message?: string, cause?: unknown) {\n super(hash, value, message, cause)\n this.chainId = chainId\n }\n}\n\nexport const isHydratedBlockStateValidationError = (\n error: unknown,\n): error is HydratedBlockStateValidationError => {\n if (!isValidationError(error)) return false\n return (\n error.name === HydratedBlockStateValidationError.constructor.name\n )\n}\n","import type { HydratedBoundWitness } from '@xyo-network/archivist-model'\nimport { type BoundWitness } from '@xyo-network/boundwitness-model'\n\nimport { isValidationError, ValidationError } from '../error.ts'\n\nexport class BoundWitnessValidationError extends ValidationError<BoundWitness> {}\n\nexport const isBoundWitnessValidationError = (\n error: unknown,\n): error is BoundWitnessValidationError => {\n if (!isValidationError(error)) return false\n return (\n error.name === BoundWitnessValidationError.constructor.name\n )\n}\n\nexport class HydratedBoundWitnessValidationError extends ValidationError<HydratedBoundWitness> {}\n\nexport const isHydratedBoundWitnessValidationError = (\n error: unknown,\n): error is HydratedBoundWitnessValidationError => {\n if (!isValidationError(error)) return false\n return (\n error.name === HydratedBoundWitnessValidationError.constructor.name\n )\n}\n","import type { Hash } from '@xylabs/hex'\nimport { type Payload } from '@xyo-network/payload-model'\n\nimport { type HydratedBlock } from '../../block/index.ts'\nimport { isValidationError, ValidationError } from '../error.ts'\n\nexport class InBlockPayloadValidationError extends ValidationError<Payload> {\n block: HydratedBlock\n constructor(hash: Hash, block: HydratedBlock, value: Payload, message?: string, cause?: unknown) {\n super(hash, value, message, cause)\n this.block = block\n }\n}\n\nexport const isInBlockPayloadValidationError = (\n error: unknown,\n): error is InBlockPayloadValidationError => {\n if (!isValidationError(error)) return false\n return (\n error.name === InBlockPayloadValidationError.constructor.name\n )\n}\n","import { type SignedHydratedTransaction } from '../../transaction/index.ts'\nimport { isValidationError, ValidationError } from '../error.ts'\n\nexport class HydratedTransactionValidationError extends ValidationError<SignedHydratedTransaction> {}\n\nexport const isHydratedTransactionValidationError = (\n error: unknown,\n): error is HydratedTransactionValidationError => {\n if (!isValidationError(error)) return false\n return (\n error.name === HydratedTransactionValidationError.constructor.name\n )\n}\n"],"mappings":";AAAO,IAAM,iBAAiB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EAAG,QAAO;AACtC,SACE,MAAM,SAAS,oCAAoC,YAAY;AAEnE;;;ACnBO,IAAM,gCAAN,cAA4C,gBAAyB;AAAA,EAC1E;AAAA,EACA,YAAY,MAAY,OAAsB,OAAgB,SAAkB,OAAiB;AAC/F,UAAM,MAAM,OAAO,SAAS,KAAK;AACjC,SAAK,QAAQ;AAAA,EACf;AACF;AAEO,IAAM,kCAAkC,CAC7C,UAC2C;AAC3C,MAAI,CAAC,kBAAkB,KAAK,EAAG,QAAO;AACtC,SACE,MAAM,SAAS,8BAA8B,YAAY;AAE7D;;;AClBO,IAAM,qCAAN,cAAiD,gBAA2C;AAAC;AAE7F,IAAM,uCAAuC,CAClD,UACgD;AAChD,MAAI,CAAC,kBAAkB,KAAK,EAAG,QAAO;AACtC,SACE,MAAM,SAAS,mCAAmC,YAAY;AAElE;","names":["isHashStorageMeta","z","HexZod","z","HexZod","AsObjectFactory","isPayloadOfZodType","z","z","isPayloadOfZodType","AsObjectFactory","HexZod","AsObjectFactory","isPayloadOfZodType","HexZod","isPayloadOfZodType","AsObjectFactory","AsObjectFactory","AsObjectFactory","isPayloadOfSchemaType","AsObjectFactory","isPayloadOfSchemaType","AsObjectFactory","isPayloadOfSchemaType","AsObjectFactory","isPayloadOfSchemaType","AsObjectFactory","AsObjectFactory","isAnyPayload","isStorageMeta","AsObjectFactory","isBoundWitness","AsObjectFactory","AsObjectFactory","isStorageMeta","isStorageMeta","AsObjectFactory","AsObjectFactory","isStorageMeta","isStorageMeta","AsObjectFactory","AsObjectFactory","isSigned","isSigned","AsObjectFactory","AsObjectFactory","isStorageMeta","isStorageMeta","AsObjectFactory","AsObjectFactory","isSigned","isStorageMeta","isSigned","isStorageMeta","AsObjectFactory","AsObjectFactory","AsObjectFactory","AsObjectFactory","AsObjectFactory","isHashStorageMeta","z","isHex","AsObjectFactory","isBoundWitness","isSigned","isHashStorageMeta","isStorageMeta","AsObjectFactory","AsObjectFactory","AsObjectFactory","isPayloadOfSchemaType","isPayloadOfSchemaType","AsObjectFactory","isPayloadOfSchemaType","isStorageMeta"]}
@@ -1,17 +1,58 @@
1
- import type { Hex } from '@xylabs/hex';
2
1
  import type { Payload } from '@xyo-network/payload-model';
3
- import type { BridgeDetailsFields } from './BridgeDetails.ts';
2
+ import type z from 'zod';
4
3
  export declare const BridgeDestinationObservationSchema: "network.xyo.chain.bridge.observation.destination";
5
4
  export type BridgeDestinationObservationSchema = typeof BridgeDestinationObservationSchema;
6
5
  /**
7
6
  * Represents an observation that confirms a bridge action occurred on the destination chain.
8
7
  */
9
- export interface BridgeDestinationObservationFields extends BridgeDetailsFields {
10
- /**
11
- * Destination chain confirmation
12
- */
13
- destConfirmation?: Hex;
14
- }
8
+ export declare const BridgeDestinationObservationFieldsZod: z.ZodObject<{
9
+ src: z.ZodType<import("@xylabs/typeof").Brand<Lowercase<string>, {
10
+ readonly __hex: true;
11
+ }>, unknown, z.z.core.$ZodTypeInternals<import("@xylabs/typeof").Brand<Lowercase<string>, {
12
+ readonly __hex: true;
13
+ }>, unknown>>;
14
+ srcAddress: z.ZodType<import("@xylabs/typeof").Brand<Lowercase<string>, {
15
+ readonly __hex: true;
16
+ }>, unknown, z.z.core.$ZodTypeInternals<import("@xylabs/typeof").Brand<Lowercase<string>, {
17
+ readonly __hex: true;
18
+ }>, unknown>>;
19
+ srcAmount: z.ZodType<import("@xylabs/typeof").Brand<Lowercase<string>, {
20
+ readonly __hex: true;
21
+ }>, unknown, z.z.core.$ZodTypeInternals<import("@xylabs/typeof").Brand<Lowercase<string>, {
22
+ readonly __hex: true;
23
+ }>, unknown>>;
24
+ srcToken: z.ZodType<import("@xylabs/typeof").Brand<Lowercase<string>, {
25
+ readonly __hex: true;
26
+ }>, unknown, z.z.core.$ZodTypeInternals<import("@xylabs/typeof").Brand<Lowercase<string>, {
27
+ readonly __hex: true;
28
+ }>, unknown>>;
29
+ dest: z.ZodType<import("@xylabs/typeof").Brand<Lowercase<string>, {
30
+ readonly __hex: true;
31
+ }>, unknown, z.z.core.$ZodTypeInternals<import("@xylabs/typeof").Brand<Lowercase<string>, {
32
+ readonly __hex: true;
33
+ }>, unknown>>;
34
+ destAddress: z.ZodType<import("@xylabs/typeof").Brand<Lowercase<string>, {
35
+ readonly __hex: true;
36
+ }>, unknown, z.z.core.$ZodTypeInternals<import("@xylabs/typeof").Brand<Lowercase<string>, {
37
+ readonly __hex: true;
38
+ }>, unknown>>;
39
+ destAmount: z.ZodType<import("@xylabs/typeof").Brand<Lowercase<string>, {
40
+ readonly __hex: true;
41
+ }>, unknown, z.z.core.$ZodTypeInternals<import("@xylabs/typeof").Brand<Lowercase<string>, {
42
+ readonly __hex: true;
43
+ }>, unknown>>;
44
+ destToken: z.ZodType<import("@xylabs/typeof").Brand<Lowercase<string>, {
45
+ readonly __hex: true;
46
+ }>, unknown, z.z.core.$ZodTypeInternals<import("@xylabs/typeof").Brand<Lowercase<string>, {
47
+ readonly __hex: true;
48
+ }>, unknown>>;
49
+ destConfirmation: z.ZodOptional<z.ZodType<import("@xylabs/typeof").Brand<Lowercase<string>, {
50
+ readonly __hex: true;
51
+ }>, unknown, z.z.core.$ZodTypeInternals<import("@xylabs/typeof").Brand<Lowercase<string>, {
52
+ readonly __hex: true;
53
+ }>, unknown>>>;
54
+ }, z.z.core.$strip>;
55
+ export type BridgeDestinationObservationFields = z.infer<typeof BridgeDestinationObservationFieldsZod>;
15
56
  /**
16
57
  * Represents an observation that confirms a bridge action occurred on the destination chain.
17
58
  */
@@ -1 +1 @@
1
- {"version":3,"file":"BridgeDestinationObservation.d.ts","sourceRoot":"","sources":["../../../../../src/payload/elevatable/Bridge/BridgeDestinationObservation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AAEtC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAGzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAE7D,eAAO,MAAM,kCAAkC,EAAG,kDAA2D,CAAA;AAC7G,MAAM,MAAM,kCAAkC,GAAG,OAAO,kCAAkC,CAAA;AAE1F;;GAEG;AACH,MAAM,WAAW,kCAAmC,SAAQ,mBAAmB;IAC7E;;OAEG;IACH,gBAAgB,CAAC,EAAE,GAAG,CAAA;CACvB;AAED;;GAEG;AACH,MAAM,MAAM,4BAA4B,GAAG,OAAO,CAAC,kCAAkC,EAAE,kCAAkC,CAAC,CAAA;AAE1H,eAAO,MAAM,8BAA8B,2DAA0F,CAAA;AAErI,eAAO,MAAM,8BAA8B,uEAAyD,CAAA"}
1
+ {"version":3,"file":"BridgeDestinationObservation.d.ts","sourceRoot":"","sources":["../../../../../src/payload/elevatable/Bridge/BridgeDestinationObservation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEzD,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAIxB,eAAO,MAAM,kCAAkC,EAAG,kDAA2D,CAAA;AAC7G,MAAM,MAAM,kCAAkC,GAAG,OAAO,kCAAkC,CAAA;AAE1F;;GAEG;AACH,eAAO,MAAM,qCAAqC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAKhD,CAAA;AAEF,MAAM,MAAM,kCAAkC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qCAAqC,CAAC,CAAA;AAEtG;;GAEG;AACH,MAAM,MAAM,4BAA4B,GAAG,OAAO,CAAC,kCAAkC,EAAE,kCAAkC,CAAC,CAAA;AAE1H,eAAO,MAAM,8BAA8B,2DAG1C,CAAA;AAED,eAAO,MAAM,8BAA8B,uEAAyD,CAAA"}
@@ -1,49 +1,105 @@
1
- import type { Hex } from '@xylabs/hex';
1
+ import z from 'zod';
2
2
  /**
3
3
  * Represents a transfer destination
4
4
  */
5
- export interface BridgeDetailsDestinationFields {
6
- /**
7
- * Destination network
8
- */
9
- dest: Hex;
10
- /**
11
- * Destination address (EOA or contract)
12
- */
13
- destAddress: Hex;
14
- /**
15
- * Token amount to bridge to destination
16
- */
17
- destAmount: Hex;
18
- /**
19
- * Token being bridged to
20
- */
21
- destToken: Hex;
22
- }
5
+ export declare const BridgeDetailsDestinationFieldsZod: z.ZodObject<{
6
+ dest: z.ZodType<import("@xylabs/typeof").Brand<Lowercase<string>, {
7
+ readonly __hex: true;
8
+ }>, unknown, z.z.core.$ZodTypeInternals<import("@xylabs/typeof").Brand<Lowercase<string>, {
9
+ readonly __hex: true;
10
+ }>, unknown>>;
11
+ destAddress: z.ZodType<import("@xylabs/typeof").Brand<Lowercase<string>, {
12
+ readonly __hex: true;
13
+ }>, unknown, z.z.core.$ZodTypeInternals<import("@xylabs/typeof").Brand<Lowercase<string>, {
14
+ readonly __hex: true;
15
+ }>, unknown>>;
16
+ destAmount: z.ZodType<import("@xylabs/typeof").Brand<Lowercase<string>, {
17
+ readonly __hex: true;
18
+ }>, unknown, z.z.core.$ZodTypeInternals<import("@xylabs/typeof").Brand<Lowercase<string>, {
19
+ readonly __hex: true;
20
+ }>, unknown>>;
21
+ destToken: z.ZodType<import("@xylabs/typeof").Brand<Lowercase<string>, {
22
+ readonly __hex: true;
23
+ }>, unknown, z.z.core.$ZodTypeInternals<import("@xylabs/typeof").Brand<Lowercase<string>, {
24
+ readonly __hex: true;
25
+ }>, unknown>>;
26
+ }, z.z.core.$strip>;
27
+ /**
28
+ * Represents a transfer destination
29
+ */
30
+ export type BridgeDetailsDestinationFields = z.infer<typeof BridgeDetailsDestinationFieldsZod>;
23
31
  /**
24
32
  * Represents a transfer source
25
33
  */
26
- export interface BridgeDetailsSourceFields {
27
- /**
28
- * Source network
29
- */
30
- src: Hex;
31
- /**
32
- * Source address (EOA or contract)
33
- */
34
- srcAddress: Hex;
35
- /**
36
- * Token amount to bridge form source
37
- */
38
- srcAmount: Hex;
39
- /**
40
- * Token being bridged from
41
- */
42
- srcToken: Hex;
43
- }
34
+ export declare const BridgeDetailsSourceFieldsZod: z.ZodObject<{
35
+ src: z.ZodType<import("@xylabs/typeof").Brand<Lowercase<string>, {
36
+ readonly __hex: true;
37
+ }>, unknown, z.z.core.$ZodTypeInternals<import("@xylabs/typeof").Brand<Lowercase<string>, {
38
+ readonly __hex: true;
39
+ }>, unknown>>;
40
+ srcAddress: z.ZodType<import("@xylabs/typeof").Brand<Lowercase<string>, {
41
+ readonly __hex: true;
42
+ }>, unknown, z.z.core.$ZodTypeInternals<import("@xylabs/typeof").Brand<Lowercase<string>, {
43
+ readonly __hex: true;
44
+ }>, unknown>>;
45
+ srcAmount: z.ZodType<import("@xylabs/typeof").Brand<Lowercase<string>, {
46
+ readonly __hex: true;
47
+ }>, unknown, z.z.core.$ZodTypeInternals<import("@xylabs/typeof").Brand<Lowercase<string>, {
48
+ readonly __hex: true;
49
+ }>, unknown>>;
50
+ srcToken: z.ZodType<import("@xylabs/typeof").Brand<Lowercase<string>, {
51
+ readonly __hex: true;
52
+ }>, unknown, z.z.core.$ZodTypeInternals<import("@xylabs/typeof").Brand<Lowercase<string>, {
53
+ readonly __hex: true;
54
+ }>, unknown>>;
55
+ }, z.z.core.$strip>;
56
+ /**
57
+ * Represents a transfer from a source chain/token/address/amount to a destination chain/token/address/amount.
58
+ */
59
+ export declare const BridgeDetailsFieldsZod: z.ZodObject<{
60
+ src: z.ZodType<import("@xylabs/typeof").Brand<Lowercase<string>, {
61
+ readonly __hex: true;
62
+ }>, unknown, z.z.core.$ZodTypeInternals<import("@xylabs/typeof").Brand<Lowercase<string>, {
63
+ readonly __hex: true;
64
+ }>, unknown>>;
65
+ srcAddress: z.ZodType<import("@xylabs/typeof").Brand<Lowercase<string>, {
66
+ readonly __hex: true;
67
+ }>, unknown, z.z.core.$ZodTypeInternals<import("@xylabs/typeof").Brand<Lowercase<string>, {
68
+ readonly __hex: true;
69
+ }>, unknown>>;
70
+ srcAmount: z.ZodType<import("@xylabs/typeof").Brand<Lowercase<string>, {
71
+ readonly __hex: true;
72
+ }>, unknown, z.z.core.$ZodTypeInternals<import("@xylabs/typeof").Brand<Lowercase<string>, {
73
+ readonly __hex: true;
74
+ }>, unknown>>;
75
+ srcToken: z.ZodType<import("@xylabs/typeof").Brand<Lowercase<string>, {
76
+ readonly __hex: true;
77
+ }>, unknown, z.z.core.$ZodTypeInternals<import("@xylabs/typeof").Brand<Lowercase<string>, {
78
+ readonly __hex: true;
79
+ }>, unknown>>;
80
+ dest: z.ZodType<import("@xylabs/typeof").Brand<Lowercase<string>, {
81
+ readonly __hex: true;
82
+ }>, unknown, z.z.core.$ZodTypeInternals<import("@xylabs/typeof").Brand<Lowercase<string>, {
83
+ readonly __hex: true;
84
+ }>, unknown>>;
85
+ destAddress: z.ZodType<import("@xylabs/typeof").Brand<Lowercase<string>, {
86
+ readonly __hex: true;
87
+ }>, unknown, z.z.core.$ZodTypeInternals<import("@xylabs/typeof").Brand<Lowercase<string>, {
88
+ readonly __hex: true;
89
+ }>, unknown>>;
90
+ destAmount: z.ZodType<import("@xylabs/typeof").Brand<Lowercase<string>, {
91
+ readonly __hex: true;
92
+ }>, unknown, z.z.core.$ZodTypeInternals<import("@xylabs/typeof").Brand<Lowercase<string>, {
93
+ readonly __hex: true;
94
+ }>, unknown>>;
95
+ destToken: z.ZodType<import("@xylabs/typeof").Brand<Lowercase<string>, {
96
+ readonly __hex: true;
97
+ }>, unknown, z.z.core.$ZodTypeInternals<import("@xylabs/typeof").Brand<Lowercase<string>, {
98
+ readonly __hex: true;
99
+ }>, unknown>>;
100
+ }, z.z.core.$strip>;
44
101
  /**
45
102
  * Represents a transfer from a source chain/token/address/amount to a destination chain/token/address/amount.
46
103
  */
47
- export interface BridgeDetailsFields extends BridgeDetailsSourceFields, BridgeDetailsDestinationFields {
48
- }
104
+ export type BridgeDetailsFields = z.infer<typeof BridgeDetailsFieldsZod>;
49
105
  //# sourceMappingURL=BridgeDetails.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BridgeDetails.d.ts","sourceRoot":"","sources":["../../../../../src/payload/elevatable/Bridge/BridgeDetails.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AAEtC;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC7C;;OAEG;IACH,IAAI,EAAE,GAAG,CAAA;IAET;;OAEG;IACH,WAAW,EAAE,GAAG,CAAA;IAEhB;;OAEG;IACH,UAAU,EAAE,GAAG,CAAA;IAEf;;OAEG;IACH,SAAS,EAAE,GAAG,CAAA;CACf;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC;;OAEG;IACH,GAAG,EAAE,GAAG,CAAA;IAER;;OAEG;IACH,UAAU,EAAE,GAAG,CAAA;IAEf;;OAEG;IACH,SAAS,EAAE,GAAG,CAAA;IAEd;;OAEG;IACH,QAAQ,EAAE,GAAG,CAAA;CACd;AAED;;GAEG;AACH,MAAM,WAAW,mBAAoB,SAAQ,yBAAyB,EAAE,8BAA8B;CAAG"}
1
+ {"version":3,"file":"BridgeDetails.d.ts","sourceRoot":"","sources":["../../../../../src/payload/elevatable/Bridge/BridgeDetails.ts"],"names":[],"mappings":"AACA,OAAO,CAAC,MAAM,KAAK,CAAA;AAEnB;;GAEG;AACH,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;;;mBAiB5C,CAAA;AAEF;;GAEG;AACH,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iCAAiC,CAAC,CAAA;AAE9F;;GAEG;AACH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;mBAkBvC,CAAA;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAElC,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAA"}
@@ -1,16 +1,54 @@
1
1
  import type { Payload } from '@xyo-network/payload-model';
2
- import type { BridgeDetailsFields } from './BridgeDetails.ts';
2
+ import z from 'zod';
3
3
  export declare const BridgeIntentSchema: "network.xyo.chain.bridge.intent";
4
4
  export type BridgeIntentSchema = typeof BridgeIntentSchema;
5
5
  /**
6
- * Represents an Addresses intent to initiate a token bridge.
6
+ * Represents an Address's intent to initiate a token bridge.
7
7
  */
8
- export interface BridgeIntentFields extends BridgeDetailsFields {
9
- /**
10
- * Unique identifier for replay protection
11
- */
12
- nonce: string;
13
- }
8
+ export declare const BridgeIntentFieldsZod: z.ZodObject<{
9
+ src: z.ZodType<import("@xylabs/typeof").Brand<Lowercase<string>, {
10
+ readonly __hex: true;
11
+ }>, unknown, z.z.core.$ZodTypeInternals<import("@xylabs/typeof").Brand<Lowercase<string>, {
12
+ readonly __hex: true;
13
+ }>, unknown>>;
14
+ srcAddress: z.ZodType<import("@xylabs/typeof").Brand<Lowercase<string>, {
15
+ readonly __hex: true;
16
+ }>, unknown, z.z.core.$ZodTypeInternals<import("@xylabs/typeof").Brand<Lowercase<string>, {
17
+ readonly __hex: true;
18
+ }>, unknown>>;
19
+ srcAmount: z.ZodType<import("@xylabs/typeof").Brand<Lowercase<string>, {
20
+ readonly __hex: true;
21
+ }>, unknown, z.z.core.$ZodTypeInternals<import("@xylabs/typeof").Brand<Lowercase<string>, {
22
+ readonly __hex: true;
23
+ }>, unknown>>;
24
+ srcToken: z.ZodType<import("@xylabs/typeof").Brand<Lowercase<string>, {
25
+ readonly __hex: true;
26
+ }>, unknown, z.z.core.$ZodTypeInternals<import("@xylabs/typeof").Brand<Lowercase<string>, {
27
+ readonly __hex: true;
28
+ }>, unknown>>;
29
+ dest: z.ZodType<import("@xylabs/typeof").Brand<Lowercase<string>, {
30
+ readonly __hex: true;
31
+ }>, unknown, z.z.core.$ZodTypeInternals<import("@xylabs/typeof").Brand<Lowercase<string>, {
32
+ readonly __hex: true;
33
+ }>, unknown>>;
34
+ destAddress: z.ZodType<import("@xylabs/typeof").Brand<Lowercase<string>, {
35
+ readonly __hex: true;
36
+ }>, unknown, z.z.core.$ZodTypeInternals<import("@xylabs/typeof").Brand<Lowercase<string>, {
37
+ readonly __hex: true;
38
+ }>, unknown>>;
39
+ destAmount: z.ZodType<import("@xylabs/typeof").Brand<Lowercase<string>, {
40
+ readonly __hex: true;
41
+ }>, unknown, z.z.core.$ZodTypeInternals<import("@xylabs/typeof").Brand<Lowercase<string>, {
42
+ readonly __hex: true;
43
+ }>, unknown>>;
44
+ destToken: z.ZodType<import("@xylabs/typeof").Brand<Lowercase<string>, {
45
+ readonly __hex: true;
46
+ }>, unknown, z.z.core.$ZodTypeInternals<import("@xylabs/typeof").Brand<Lowercase<string>, {
47
+ readonly __hex: true;
48
+ }>, unknown>>;
49
+ nonce: z.ZodString;
50
+ }, z.z.core.$strip>;
51
+ export type BridgeIntentFields = z.infer<typeof BridgeIntentFieldsZod>;
14
52
  export type BridgeIntent = Payload<BridgeIntentFields, BridgeIntentSchema>;
15
53
  export declare const isBridgeIntent: (x?: unknown | null) => x is BridgeIntent;
16
54
  export declare const asBridgeIntent: import("@xylabs/object").AsTypeFunction<BridgeIntent>;
@@ -1 +1 @@
1
- {"version":3,"file":"BridgeIntent.d.ts","sourceRoot":"","sources":["../../../../../src/payload/elevatable/Bridge/BridgeIntent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAGzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAE7D,eAAO,MAAM,kBAAkB,EAAG,iCAA0C,CAAA;AAC5E,MAAM,MAAM,kBAAkB,GAAG,OAAO,kBAAkB,CAAA;AAE1D;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,mBAAmB;IAC7D;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,MAAM,YAAY,GAAG,OAAO,CAAC,kBAAkB,EAAE,kBAAkB,CAAC,CAAA;AAE1E,eAAO,MAAM,cAAc,2CAA0D,CAAA;AAErF,eAAO,MAAM,cAAc,uDAAyC,CAAA"}
1
+ {"version":3,"file":"BridgeIntent.d.ts","sourceRoot":"","sources":["../../../../../src/payload/elevatable/Bridge/BridgeIntent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEzD,OAAO,CAAC,MAAM,KAAK,CAAA;AAInB,eAAO,MAAM,kBAAkB,EAAG,iCAA0C,CAAA;AAC5E,MAAM,MAAM,kBAAkB,GAAG,OAAO,kBAAkB,CAAA;AAE1D;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAKhC,CAAA;AAEF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAEtE,MAAM,MAAM,YAAY,GAAG,OAAO,CAAC,kBAAkB,EAAE,kBAAkB,CAAC,CAAA;AAE1E,eAAO,MAAM,cAAc,2CAG1B,CAAA;AAED,eAAO,MAAM,cAAc,uDAAyC,CAAA"}
@@ -1,17 +1,58 @@
1
- import type { Hex } from '@xylabs/hex';
2
1
  import type { Payload } from '@xyo-network/payload-model';
3
- import type { BridgeDetailsFields } from './BridgeDetails.ts';
2
+ import type z from 'zod';
4
3
  export declare const BridgeSourceObservationSchema: "network.xyo.chain.bridge.observation.source";
5
4
  export type BridgeSourceObservationSchema = typeof BridgeSourceObservationSchema;
6
5
  /**
7
6
  * Represents an observation that confirms a bridge action occurred on the source chain.
8
7
  */
9
- export interface BridgeSourceObservationFields extends BridgeDetailsFields {
10
- /**
11
- * Source chain confirmation
12
- */
13
- srcConfirmation?: Hex;
14
- }
8
+ export declare const BridgeSourceObservationFieldsZod: z.ZodObject<{
9
+ src: z.ZodType<import("@xylabs/typeof").Brand<Lowercase<string>, {
10
+ readonly __hex: true;
11
+ }>, unknown, z.z.core.$ZodTypeInternals<import("@xylabs/typeof").Brand<Lowercase<string>, {
12
+ readonly __hex: true;
13
+ }>, unknown>>;
14
+ srcAddress: z.ZodType<import("@xylabs/typeof").Brand<Lowercase<string>, {
15
+ readonly __hex: true;
16
+ }>, unknown, z.z.core.$ZodTypeInternals<import("@xylabs/typeof").Brand<Lowercase<string>, {
17
+ readonly __hex: true;
18
+ }>, unknown>>;
19
+ srcAmount: z.ZodType<import("@xylabs/typeof").Brand<Lowercase<string>, {
20
+ readonly __hex: true;
21
+ }>, unknown, z.z.core.$ZodTypeInternals<import("@xylabs/typeof").Brand<Lowercase<string>, {
22
+ readonly __hex: true;
23
+ }>, unknown>>;
24
+ srcToken: z.ZodType<import("@xylabs/typeof").Brand<Lowercase<string>, {
25
+ readonly __hex: true;
26
+ }>, unknown, z.z.core.$ZodTypeInternals<import("@xylabs/typeof").Brand<Lowercase<string>, {
27
+ readonly __hex: true;
28
+ }>, unknown>>;
29
+ dest: z.ZodType<import("@xylabs/typeof").Brand<Lowercase<string>, {
30
+ readonly __hex: true;
31
+ }>, unknown, z.z.core.$ZodTypeInternals<import("@xylabs/typeof").Brand<Lowercase<string>, {
32
+ readonly __hex: true;
33
+ }>, unknown>>;
34
+ destAddress: z.ZodType<import("@xylabs/typeof").Brand<Lowercase<string>, {
35
+ readonly __hex: true;
36
+ }>, unknown, z.z.core.$ZodTypeInternals<import("@xylabs/typeof").Brand<Lowercase<string>, {
37
+ readonly __hex: true;
38
+ }>, unknown>>;
39
+ destAmount: z.ZodType<import("@xylabs/typeof").Brand<Lowercase<string>, {
40
+ readonly __hex: true;
41
+ }>, unknown, z.z.core.$ZodTypeInternals<import("@xylabs/typeof").Brand<Lowercase<string>, {
42
+ readonly __hex: true;
43
+ }>, unknown>>;
44
+ destToken: z.ZodType<import("@xylabs/typeof").Brand<Lowercase<string>, {
45
+ readonly __hex: true;
46
+ }>, unknown, z.z.core.$ZodTypeInternals<import("@xylabs/typeof").Brand<Lowercase<string>, {
47
+ readonly __hex: true;
48
+ }>, unknown>>;
49
+ srcConfirmation: z.ZodOptional<z.ZodType<import("@xylabs/typeof").Brand<Lowercase<string>, {
50
+ readonly __hex: true;
51
+ }>, unknown, z.z.core.$ZodTypeInternals<import("@xylabs/typeof").Brand<Lowercase<string>, {
52
+ readonly __hex: true;
53
+ }>, unknown>>>;
54
+ }, z.z.core.$strip>;
55
+ export type BridgeSourceObservationFields = z.infer<typeof BridgeSourceObservationFieldsZod>;
15
56
  /**
16
57
  * Represents an observation that confirms a bridge action occurred on the source chain.
17
58
  */
@@ -1 +1 @@
1
- {"version":3,"file":"BridgeSourceObservation.d.ts","sourceRoot":"","sources":["../../../../../src/payload/elevatable/Bridge/BridgeSourceObservation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AAEtC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAGzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAE7D,eAAO,MAAM,6BAA6B,EAAG,6CAAsD,CAAA;AACnG,MAAM,MAAM,6BAA6B,GAAG,OAAO,6BAA6B,CAAA;AAEhF;;GAEG;AACH,MAAM,WAAW,6BAA8B,SAAQ,mBAAmB;IACxE;;OAEG;IACH,eAAe,CAAC,EAAE,GAAG,CAAA;CACtB;AAED;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,OAAO,CAAC,6BAA6B,EAAE,6BAA6B,CAAC,CAAA;AAE3G,eAAO,MAAM,yBAAyB,sDAAgF,CAAA;AAEtH,eAAO,MAAM,yBAAyB,kEAAoD,CAAA"}
1
+ {"version":3,"file":"BridgeSourceObservation.d.ts","sourceRoot":"","sources":["../../../../../src/payload/elevatable/Bridge/BridgeSourceObservation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEzD,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAIxB,eAAO,MAAM,6BAA6B,EAAG,6CAAsD,CAAA;AACnG,MAAM,MAAM,6BAA6B,GAAG,OAAO,6BAA6B,CAAA;AAEhF;;GAEG;AACH,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAK3C,CAAA;AAEF,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAA;AAC5F;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,OAAO,CAAC,6BAA6B,EAAE,6BAA6B,CAAC,CAAA;AAE3G,eAAO,MAAM,yBAAyB,sDAGrC,CAAA;AAED,eAAO,MAAM,yBAAyB,kEAAoD,CAAA"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "http://json.schemastore.org/package.json",
3
3
  "name": "@xyo-network/xl1-protocol",
4
- "version": "1.12.57",
4
+ "version": "1.12.58",
5
5
  "description": "XYO Layer One Protocol",
6
6
  "homepage": "https://xylabs.com",
7
7
  "bugs": {
@@ -45,10 +45,10 @@
45
45
  "@xylabs/object": "~5.0.11",
46
46
  "@xylabs/promise": "~5.0.11",
47
47
  "@xylabs/typeof": "~5.0.11",
48
- "@xyo-network/archivist-model": "~5.1.3",
49
- "@xyo-network/boundwitness-model": "~5.1.3",
50
- "@xyo-network/payload-model": "~5.1.3",
51
- "@xyo-network/schema-payload-plugin": "~5.1.3",
48
+ "@xyo-network/archivist-model": "~5.1.5",
49
+ "@xyo-network/boundwitness-model": "~5.1.5",
50
+ "@xyo-network/payload-model": "~5.1.5",
51
+ "@xyo-network/schema-payload-plugin": "~5.1.5",
52
52
  "zod": "~4.1.12"
53
53
  },
54
54
  "devDependencies": {
@@ -58,7 +58,7 @@
58
58
  "@xylabs/eslint-config-flat": "~7.1.8",
59
59
  "@xylabs/ts-scripts-yarn3": "~7.1.8",
60
60
  "@xylabs/tsconfig": "~7.1.8",
61
- "@xyo-network/account-model": "~5.1.3",
61
+ "@xyo-network/account-model": "~5.1.5",
62
62
  "dependency-cruiser": "~17.0.2",
63
63
  "dotenv": "~17.2.3",
64
64
  "eslint": "~9.37.0",
@@ -1,9 +1,10 @@
1
- import type { Hex } from '@xylabs/hex'
1
+ import { HexZod } from '@xylabs/hex'
2
2
  import { AsObjectFactory } from '@xylabs/object'
3
3
  import type { Payload } from '@xyo-network/payload-model'
4
- import { isPayloadOfSchemaType } from '@xyo-network/payload-model'
4
+ import { isPayloadOfZodType } from '@xyo-network/payload-model'
5
+ import type z from 'zod'
5
6
 
6
- import type { BridgeDetailsFields } from './BridgeDetails.ts'
7
+ import { BridgeDetailsFieldsZod } from './BridgeDetails.ts'
7
8
 
8
9
  export const BridgeDestinationObservationSchema = 'network.xyo.chain.bridge.observation.destination' as const
9
10
  export type BridgeDestinationObservationSchema = typeof BridgeDestinationObservationSchema
@@ -11,18 +12,23 @@ export type BridgeDestinationObservationSchema = typeof BridgeDestinationObserva
11
12
  /**
12
13
  * Represents an observation that confirms a bridge action occurred on the destination chain.
13
14
  */
14
- export interface BridgeDestinationObservationFields extends BridgeDetailsFields {
15
+ export const BridgeDestinationObservationFieldsZod = BridgeDetailsFieldsZod.extend({
15
16
  /**
16
17
  * Destination chain confirmation
17
18
  */
18
- destConfirmation?: Hex
19
- }
19
+ destConfirmation: HexZod.optional().describe('Destination chain confirmation'),
20
+ })
21
+
22
+ export type BridgeDestinationObservationFields = z.infer<typeof BridgeDestinationObservationFieldsZod>
20
23
 
21
24
  /**
22
25
  * Represents an observation that confirms a bridge action occurred on the destination chain.
23
26
  */
24
27
  export type BridgeDestinationObservation = Payload<BridgeDestinationObservationFields, BridgeDestinationObservationSchema>
25
28
 
26
- export const isBridgeDestinationObservation = isPayloadOfSchemaType<BridgeDestinationObservation>(BridgeDestinationObservationSchema)
29
+ export const isBridgeDestinationObservation = isPayloadOfZodType<BridgeDestinationObservation>(
30
+ BridgeDestinationObservationFieldsZod,
31
+ BridgeDestinationObservationSchema,
32
+ )
27
33
 
28
34
  export const asBridgeDestinationObservation = AsObjectFactory.create(isBridgeDestinationObservation)
@@ -1,56 +1,64 @@
1
- import type { Hex } from '@xylabs/hex'
1
+ import { HexZod } from '@xylabs/hex'
2
+ import z from 'zod'
2
3
 
3
4
  /**
4
5
  * Represents a transfer destination
5
6
  */
6
- export interface BridgeDetailsDestinationFields {
7
+ export const BridgeDetailsDestinationFieldsZod = z.object({
7
8
  /**
8
9
  * Destination network
9
10
  */
10
- dest: Hex
11
-
11
+ dest: HexZod.describe('The destination network identifier'),
12
12
  /**
13
13
  * Destination address (EOA or contract)
14
14
  */
15
- destAddress: Hex
16
-
15
+ destAddress: HexZod.describe('The destination address (EOA or contract)'),
17
16
  /**
18
17
  * Token amount to bridge to destination
19
18
  */
20
- destAmount: Hex
21
-
19
+ destAmount: HexZod.describe('The token amount to bridge to destination'),
22
20
  /**
23
21
  * Token being bridged to
24
22
  */
25
- destToken: Hex
26
- }
23
+ destToken: HexZod.describe('The token being bridged to'),
24
+ })
25
+
26
+ /**
27
+ * Represents a transfer destination
28
+ */
29
+ export type BridgeDetailsDestinationFields = z.infer<typeof BridgeDetailsDestinationFieldsZod>
27
30
 
28
31
  /**
29
32
  * Represents a transfer source
30
33
  */
31
- export interface BridgeDetailsSourceFields {
34
+ export const BridgeDetailsSourceFieldsZod = z.object({
32
35
  /**
33
36
  * Source network
34
37
  */
35
- src: Hex
38
+ src: HexZod.describe('The source network identifier'),
36
39
 
37
40
  /**
38
41
  * Source address (EOA or contract)
39
42
  */
40
- srcAddress: Hex
41
-
43
+ srcAddress: HexZod.describe('The source address (EOA or contract)'),
42
44
  /**
43
- * Token amount to bridge form source
45
+ * Token amount to bridge from source
44
46
  */
45
- srcAmount: Hex
46
-
47
+ srcAmount: HexZod.describe('The token amount to bridge from source'),
47
48
  /**
48
49
  * Token being bridged from
49
50
  */
50
- srcToken: Hex
51
- }
51
+ srcToken: HexZod.describe('The token being bridged from'),
52
+ })
53
+
54
+ /**
55
+ * Represents a transfer from a source chain/token/address/amount to a destination chain/token/address/amount.
56
+ */
57
+ export const BridgeDetailsFieldsZod = BridgeDetailsSourceFieldsZod.extend(
58
+ BridgeDetailsDestinationFieldsZod.shape,
59
+ )
52
60
 
53
61
  /**
54
62
  * Represents a transfer from a source chain/token/address/amount to a destination chain/token/address/amount.
55
63
  */
56
- export interface BridgeDetailsFields extends BridgeDetailsSourceFields, BridgeDetailsDestinationFields {}
64
+ export type BridgeDetailsFields = z.infer<typeof BridgeDetailsFieldsZod>
@@ -1,24 +1,30 @@
1
1
  import { AsObjectFactory } from '@xylabs/object'
2
2
  import type { Payload } from '@xyo-network/payload-model'
3
- import { isPayloadOfSchemaType } from '@xyo-network/payload-model'
3
+ import { isPayloadOfZodType } from '@xyo-network/payload-model'
4
+ import z from 'zod'
4
5
 
5
- import type { BridgeDetailsFields } from './BridgeDetails.ts'
6
+ import { BridgeDetailsFieldsZod } from './BridgeDetails.ts'
6
7
 
7
8
  export const BridgeIntentSchema = 'network.xyo.chain.bridge.intent' as const
8
9
  export type BridgeIntentSchema = typeof BridgeIntentSchema
9
10
 
10
11
  /**
11
- * Represents an Addresses intent to initiate a token bridge.
12
+ * Represents an Address's intent to initiate a token bridge.
12
13
  */
13
- export interface BridgeIntentFields extends BridgeDetailsFields {
14
+ export const BridgeIntentFieldsZod = BridgeDetailsFieldsZod.extend({
14
15
  /**
15
16
  * Unique identifier for replay protection
16
17
  */
17
- nonce: string
18
- }
18
+ nonce: z.string().describe('Unique identifier for replay protection'),
19
+ })
20
+
21
+ export type BridgeIntentFields = z.infer<typeof BridgeIntentFieldsZod>
19
22
 
20
23
  export type BridgeIntent = Payload<BridgeIntentFields, BridgeIntentSchema>
21
24
 
22
- export const isBridgeIntent = isPayloadOfSchemaType<BridgeIntent>(BridgeIntentSchema)
25
+ export const isBridgeIntent = isPayloadOfZodType<BridgeIntent>(
26
+ BridgeIntentFieldsZod,
27
+ BridgeIntentSchema,
28
+ )
23
29
 
24
30
  export const asBridgeIntent = AsObjectFactory.create(isBridgeIntent)
@@ -1,9 +1,10 @@
1
- import type { Hex } from '@xylabs/hex'
1
+ import { HexZod } from '@xylabs/hex'
2
2
  import { AsObjectFactory } from '@xylabs/object'
3
3
  import type { Payload } from '@xyo-network/payload-model'
4
- import { isPayloadOfSchemaType } from '@xyo-network/payload-model'
4
+ import { isPayloadOfZodType } from '@xyo-network/payload-model'
5
+ import type z from 'zod'
5
6
 
6
- import type { BridgeDetailsFields } from './BridgeDetails.ts'
7
+ import { BridgeDetailsFieldsZod } from './BridgeDetails.ts'
7
8
 
8
9
  export const BridgeSourceObservationSchema = 'network.xyo.chain.bridge.observation.source' as const
9
10
  export type BridgeSourceObservationSchema = typeof BridgeSourceObservationSchema
@@ -11,18 +12,22 @@ export type BridgeSourceObservationSchema = typeof BridgeSourceObservationSchema
11
12
  /**
12
13
  * Represents an observation that confirms a bridge action occurred on the source chain.
13
14
  */
14
- export interface BridgeSourceObservationFields extends BridgeDetailsFields {
15
+ export const BridgeSourceObservationFieldsZod = BridgeDetailsFieldsZod.extend({
15
16
  /**
16
17
  * Source chain confirmation
17
18
  */
18
- srcConfirmation?: Hex
19
- }
19
+ srcConfirmation: HexZod.optional().describe('Source chain confirmation'),
20
+ })
20
21
 
22
+ export type BridgeSourceObservationFields = z.infer<typeof BridgeSourceObservationFieldsZod>
21
23
  /**
22
24
  * Represents an observation that confirms a bridge action occurred on the source chain.
23
25
  */
24
26
  export type BridgeSourceObservation = Payload<BridgeSourceObservationFields, BridgeSourceObservationSchema>
25
27
 
26
- export const isBridgeSourceObservation = isPayloadOfSchemaType<BridgeSourceObservation>(BridgeSourceObservationSchema)
28
+ export const isBridgeSourceObservation = isPayloadOfZodType<BridgeSourceObservation>(
29
+ BridgeSourceObservationFieldsZod,
30
+ BridgeSourceObservationSchema,
31
+ )
27
32
 
28
33
  export const asBridgeSourceObservation = AsObjectFactory.create(isBridgeSourceObservation)