@xyo-network/xl1-protocol 1.4.32 → 1.4.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/neutral/index.mjs +4 -13
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/types/fields/BlockNumber.d.ts +0 -2
- package/dist/types/fields/BlockNumber.d.ts.map +1 -1
- package/dist/types/payload/AtomicBoundWitness.d.ts +0 -1
- package/dist/types/payload/AtomicBoundWitness.d.ts.map +1 -1
- package/dist/types/payload/elevatable/ChainStakeIntent.d.ts +0 -1
- package/dist/types/payload/elevatable/ChainStakeIntent.d.ts.map +1 -1
- package/dist/types/payload/elevatable/Hash.d.ts +0 -1
- package/dist/types/payload/elevatable/Hash.d.ts.map +1 -1
- package/dist/types/payload/elevatable/TransferPayload.d.ts +0 -1
- package/dist/types/payload/elevatable/TransferPayload.d.ts.map +1 -1
- package/dist/types/validation/block/HydratedBlockValidationFunction.d.ts +1 -1
- package/dist/types/validation/block/HydratedBlockValidationFunction.d.ts.map +1 -1
- package/dist/types/validation/block/error.d.ts +1 -1
- package/dist/types/validation/error.d.ts +2 -1
- package/dist/types/validation/error.d.ts.map +1 -1
- package/dist/types/validation/payload/error.d.ts +1 -1
- package/dist/types/validation/transaction/HydratedTransactionValidationFunction.d.ts +1 -1
- package/dist/types/validation/transaction/HydratedTransactionValidationFunction.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/fields/BlockNumber.ts +0 -2
- package/src/payload/AtomicBoundWitness.ts +0 -1
- package/src/payload/elevatable/ChainStakeIntent.ts +0 -1
- package/src/payload/elevatable/Hash.ts +0 -1
- package/src/payload/elevatable/TransferPayload.ts +0 -1
- package/src/validation/block/HydratedBlockValidationFunction.ts +1 -1
- package/src/validation/error.ts +5 -1
- package/src/validation/transaction/HydratedTransactionValidationFunction.ts +1 -1
package/dist/neutral/index.mjs
CHANGED
|
@@ -9,7 +9,6 @@ import { isPayloadOfSchemaType } from "@xyo-network/payload-model";
|
|
|
9
9
|
var AtomicBoundWitnessSchema = "network.xyo.boundwitness.atomic";
|
|
10
10
|
var isAtomicBoundWitness = isPayloadOfSchemaType(AtomicBoundWitnessSchema);
|
|
11
11
|
var asAtomicBoundWitness = AsObjectFactory.create(isAtomicBoundWitness);
|
|
12
|
-
var asOptionalAtomicBoundWitness = AsObjectFactory.createOptional(isAtomicBoundWitness);
|
|
13
12
|
|
|
14
13
|
// src/payload/elevatable/ChainStakeIntent.ts
|
|
15
14
|
import { AsObjectFactory as AsObjectFactory2 } from "@xylabs/object";
|
|
@@ -19,7 +18,6 @@ var isChainStakeIntent = (x) => {
|
|
|
19
18
|
return isPayloadOfSchemaType2(ChainStakeIntentSchema)(x) && asNonNegativeInteger(x.nbf) !== void 0 && asNonNegativeInteger(x.exp) !== void 0;
|
|
20
19
|
};
|
|
21
20
|
var asChainStakeIntent = AsObjectFactory2.create(isChainStakeIntent);
|
|
22
|
-
var asOptionalChainStakeIntent = AsObjectFactory2.createOptional(isChainStakeIntent);
|
|
23
21
|
var asNonNegativeInteger = (num) => {
|
|
24
22
|
return Number.isInteger(num) && num >= 0 ? num : void 0;
|
|
25
23
|
};
|
|
@@ -43,7 +41,6 @@ var HashSchema = "network.xyo.hash";
|
|
|
43
41
|
var isHashPayload = isPayloadOfSchemaType3(HashSchema);
|
|
44
42
|
var asHashPayload = AsObjectFactory3.create(isHashPayload);
|
|
45
43
|
var asHashPayloadWithStorageMeta = AsObjectFactory3.create(isHashPayload);
|
|
46
|
-
var asOptionalHashPayload = AsObjectFactory3.createOptional(isHashPayload);
|
|
47
44
|
|
|
48
45
|
// src/payload/elevatable/TransferPayload.ts
|
|
49
46
|
import { AsObjectFactory as AsObjectFactory4 } from "@xylabs/object";
|
|
@@ -51,7 +48,6 @@ import { isPayloadOfSchemaType as isPayloadOfSchemaType4 } from "@xyo-network/pa
|
|
|
51
48
|
var TransferSchema = "network.xyo.transfer";
|
|
52
49
|
var isTransfer = isPayloadOfSchemaType4(TransferSchema);
|
|
53
50
|
var asTransfer = AsObjectFactory4.create(isTransfer);
|
|
54
|
-
var asOptionalTransfer = AsObjectFactory4.createOptional(isTransfer);
|
|
55
51
|
|
|
56
52
|
// src/transaction/HydratedTransaction.ts
|
|
57
53
|
import { AsObjectFactory as AsObjectFactory6 } from "@xylabs/object";
|
|
@@ -244,10 +240,8 @@ import {
|
|
|
244
240
|
var BlockNumberSchema = "network.xyo.chain.block.number";
|
|
245
241
|
var isBlockNumber = isPayloadOfSchemaType5(BlockNumberSchema);
|
|
246
242
|
var asBlockNumber = AsObjectFactory9.create(isBlockNumber);
|
|
247
|
-
var asOptionalBlockNumber = AsObjectFactory9.createOptional(isBlockNumber);
|
|
248
243
|
var isBlockNumberWithSources = isPayloadOfSchemaTypeWithSources(BlockNumberSchema);
|
|
249
244
|
var asBlockNumberWithSources = AsObjectFactory9.create(isBlockNumberWithSources);
|
|
250
|
-
var asOptionalBlockNumberWithSources = AsObjectFactory9.createOptional(isBlockNumberWithSources);
|
|
251
245
|
|
|
252
246
|
// src/network/Status.ts
|
|
253
247
|
import { isPayloadOfSchemaType as isPayloadOfSchemaType6 } from "@xyo-network/payload-model";
|
|
@@ -291,10 +285,13 @@ var ValidationError = class extends Error {
|
|
|
291
285
|
return {
|
|
292
286
|
name: this.name,
|
|
293
287
|
message: this.message,
|
|
294
|
-
cause:
|
|
288
|
+
cause: this.cause,
|
|
295
289
|
stack: this.stack
|
|
296
290
|
};
|
|
297
291
|
}
|
|
292
|
+
toString() {
|
|
293
|
+
return JSON.stringify(this.toJson());
|
|
294
|
+
}
|
|
298
295
|
};
|
|
299
296
|
var isValidationError = (error) => {
|
|
300
297
|
return isError(error) && error?.cause !== void 0;
|
|
@@ -424,12 +421,6 @@ export {
|
|
|
424
421
|
asHashPayloadWithStorageMeta,
|
|
425
422
|
asHydratedBlock,
|
|
426
423
|
asHydratedTransaction,
|
|
427
|
-
asOptionalAtomicBoundWitness,
|
|
428
|
-
asOptionalBlockNumber,
|
|
429
|
-
asOptionalBlockNumberWithSources,
|
|
430
|
-
asOptionalChainStakeIntent,
|
|
431
|
-
asOptionalHashPayload,
|
|
432
|
-
asOptionalTransfer,
|
|
433
424
|
asSignedBlockBoundWitness,
|
|
434
425
|
asSignedBlockBoundWitnessWithHashStorageMeta,
|
|
435
426
|
asSignedBlockBoundWitnessWithStorageMeta,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/block/AllowedBlockPayload.ts","../../src/payload/AtomicBoundWitness.ts","../../src/payload/elevatable/ChainStakeIntent.ts","../../src/payload/elevatable/Executable.ts","../../src/payload/elevatable/Hash.ts","../../src/payload/elevatable/TransferPayload.ts","../../src/transaction/HydratedTransaction.ts","../../src/isHydratedBoundWitness.ts","../../src/transaction/TransactionBoundWitness.ts","../../src/block/BlockBoundWitness.ts","../../src/block/HydratedBlock.ts","../../src/xl1/XL1.ts","../../src/constants/minTransactionFees.ts","../../src/constants/defaultTransactionFees.ts","../../src/constants/StepSizes.ts","../../src/constants/TransactionGasCosts.ts","../../src/fields/BlockNumber.ts","../../src/network/Status.ts","../../src/services/Chain/ChainIdentification.ts","../../src/services/Chain/ChainInformation.ts","../../src/services/StakeIntentService/ChainIndexingServiceStateSchema.ts","../../src/validation/block/error.ts","../../src/validation/error.ts","../../src/validation/boundwitness/error.ts","../../src/validation/payload/error.ts","../../src/validation/transaction/error.ts"],"sourcesContent":["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'\n\nimport type {\n ChainStakeIntent, HashPayload, Transfer,\n} from '../payload/index.ts'\nimport {\n ChainStakeIntentSchema, HashSchema, isChainStakeIntent, isHashPayload, isTransfer, TransferSchema,\n} from '../payload/index.ts'\nimport { isTransactionBoundWitness, type TransactionBoundWitness } from '../transaction/index.ts'\n\nexport type AllowedBlockPayload = Transfer | ChainStakeIntent | SchemaPayload | TransactionBoundWitness | HashPayload\nexport const AllowedBlockPayloadSchemas: Schema[] = [TransferSchema, ChainStakeIntentSchema, SchemaSchema, BoundWitnessSchema, HashSchema]\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) || isChainStakeIntent(value) || isSchemaPayload(value) || isTransactionBoundWitness(value) || isHashPayload(value)\n}\n\nexport const isAllowedBlockPayloadWithHashStorageMeta = (value: unknown): value is WithStorageMeta<AllowedBlockPayload> => {\n return isAllowedBlockPayload(value) && isHashStorageMeta(value)\n}\n","import { AsObjectFactory } from '@xylabs/object'\nimport type { BoundWitness } from '@xyo-network/boundwitness-model'\nimport type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\n\nexport const AtomicBoundWitnessSchema = 'network.xyo.boundwitness.atomic' as const\nexport type AtomicBoundWitnessSchema = typeof AtomicBoundWitnessSchema\n\nexport interface AtomicBoundWitnessFields<TBoundWitness extends BoundWitness = BoundWitness> {\n bw: TBoundWitness\n}\n\nexport type AtomicBoundWitness = Payload<AtomicBoundWitnessFields, AtomicBoundWitnessSchema>\n\nexport const isAtomicBoundWitness = isPayloadOfSchemaType<AtomicBoundWitness>(AtomicBoundWitnessSchema)\n\nexport const asAtomicBoundWitness = AsObjectFactory.create(isAtomicBoundWitness)\nexport const asOptionalAtomicBoundWitness = AsObjectFactory.createOptional(isAtomicBoundWitness)\n","import { AsObjectFactory } from '@xylabs/object'\nimport type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } 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)\nexport const asOptionalChainStakeIntent = AsObjectFactory.createOptional(isChainStakeIntent)\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)\nexport const asOptionalHashPayload = AsObjectFactory.createOptional(isHashPayload)\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 another address\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)\nexport const asOptionalTransfer = AsObjectFactory.createOptional(isTransfer)\n","import { AsObjectFactory } from '@xylabs/object'\nimport type { Signed } from '@xyo-network/boundwitness-model'\nimport type { Payload, WithStorageMeta } from '@xyo-network/payload-model'\n\nimport { isHydratedBoundWitness } from '../isHydratedBoundWitness.ts'\nimport { isSignedTransactionBoundWitnessWithStorageMeta, type TransactionBoundWitness } from './TransactionBoundWitness.ts'\n\nexport type HydratedTransaction<T extends TransactionBoundWitness = TransactionBoundWitness, P extends Payload = Payload> =\n[WithStorageMeta<Signed<T>>, WithStorageMeta<P>[]]\n\nexport const isHydratedTransaction = (\n value: unknown,\n): value is HydratedTransaction => {\n return (\n isHydratedBoundWitness(value) && isSignedTransactionBoundWitnessWithStorageMeta(value[0])\n )\n}\n\nexport const asHydratedTransaction = AsObjectFactory.create<HydratedTransaction>(\n isHydratedTransaction,\n)\n","import type { HydratedBoundWitnessWithStorageMeta } from '@xyo-network/archivist-model'\nimport { isBoundWitnessWithStorageMeta } from '@xyo-network/boundwitness-model'\nimport { isAnyPayload, isStorageMeta } from '@xyo-network/payload-model'\n\nexport const isHydratedBoundWitness = (\n value: unknown,\n): value is HydratedBoundWitnessWithStorageMeta => {\n return (\n Array.isArray(value)\n && value.length === 2\n && isBoundWitnessWithStorageMeta(value[0])\n && Array.isArray(value[1])\n && !value[1].some(item => (!isAnyPayload(item) || !isStorageMeta(item)))\n )\n}\n","import type { Address } from '@xylabs/hex'\nimport { AsObjectFactory } from '@xylabs/object'\nimport type { BoundWitness, Signed } from '@xyo-network/boundwitness-model'\nimport { isBoundWitness } 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 { 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: Address\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 && typedObj.chain !== undefined\n && typedObj.fees !== undefined\n && typedObj.exp !== undefined\n && typedObj.nbf !== undefined\n}\n\nexport const isSignedTransactionBoundWitness = (value: unknown): value is Signed<TransactionBoundWitness> => {\n return isTransactionBoundWitness(value) && isSigned(value)\n}\n\nexport const isSigned = <T extends BoundWitness = BoundWitness>(value: unknown): value is Signed<T> =>\n isBoundWitness(value)\n && value.$signatures.length === value.addresses.length\n && value.addresses.length > 0\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 isSignedTransactionBoundWitness(value)\n && isStorageMeta(value)\n\nexport const isSignedTransactionBoundWitnessWithHashStorageMeta = (value: unknown): value is WithHashStorageMeta<Signed<TransactionBoundWitness>> =>\n isSignedTransactionBoundWitness(value)\n && isHashStorageMeta(value)\n\nexport const asTransactionBoundWitness = AsObjectFactory.create(isTransactionBoundWitness)\n\nexport const asTransactionBoundWitnessWithStorageMeta = AsObjectFactory.create(isTransactionBoundWitnessWithStorageMeta)\n\nexport const asTransactionBoundWitnessWithHashStorageMeta = AsObjectFactory.create(isTransactionBoundWitnessWithHashStorageMeta)\n","import type { Hash, Hex } 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\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: Hex\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: Hex[]\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","export type XL1 = bigint & { readonly _tag: 'XL1' } // 1e-18\nexport type MilliXL1 = bigint & { readonly _tag: 'MilliXL1' } // 1e-15 [XL1 * 1e3 = milliXL1] [milliXL1 / 1e3 = XL1]\nexport type MicroXL1 = bigint & { readonly _tag: 'MicroXL1' } // 1e-12 [XL1 * 1e6 = microXL1] [microXL1 / 1e6 = XL1]\nexport type NanoXL1 = bigint & { readonly _tag: 'NanoXL1' } // 1e-9 [XL1 * 1e9 = nanoXL1] [nanoXL1 / 1e9 = XL1]\nexport type PicoXL1 = bigint & { readonly _tag: 'PicoXL1' } // 1e-6 [XL1 * 1e12 = picoXL1] [picoXL1 / 1e12 = XL1]\nexport type FemtoXL1 = bigint & { readonly _tag: 'FemtoXL1' } // 1e-3 [XL1 * 1e15 = femtoXL1] [femtoXL1 / 1e15 = XL1]\nexport type AttoXL1 = bigint & { readonly _tag: 'AttoXL1' } // 1e-0 [XL1 * 1e18 = attoXL1] [attoXL1 / 1e18 = XL1]\n\nexport type TypingFunc<T extends bigint> = (value: bigint) => T\n\nexport const XL1: TypingFunc<XL1> = (value: bigint): XL1 => value as XL1\nexport const MilliXL1: TypingFunc<MilliXL1> = (value: bigint): MilliXL1 => value as MilliXL1\nexport const MicroXL1: TypingFunc<MicroXL1> = (value: bigint): MicroXL1 => value as MicroXL1\nexport const NanoXL1: TypingFunc<NanoXL1> = (value: bigint): NanoXL1 => value as NanoXL1\nexport const PicoXL1: TypingFunc<PicoXL1> = (value: bigint): PicoXL1 => value as PicoXL1\nexport const FemtoXL1: TypingFunc<FemtoXL1> = (value: bigint): FemtoXL1 => value as FemtoXL1\nexport const AttoXL1: TypingFunc<AttoXL1> = (value: bigint): AttoXL1 => value as AttoXL1\n\ntype XL1Units = 'xl1' | 'milli' | 'micro' | 'nano' | 'pico' | 'femto' | 'atto'\n\n/** @deprecated use XL1Places and xl1ConvertFactor(unit) instead */\nexport const XL1ConvertDict: Record<XL1Units, number> = {\n xl1: 18,\n milli: 15,\n micro: 12,\n nano: 9,\n pico: 6,\n femto: 3,\n atto: 0,\n} as const\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\n/** @deprecated use AttoXL1ConvertFactor instead */\nexport function xl1ConvertFactor(unit: XL1Units) {\n return 10n ** XL1Places[unit]\n}\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 = [10, 105, 1103, 11_576, 121_551, 1_276_282, 13_400_956, 223_092_871, 6_469_693_231] as const\nexport const StepSizesV2 = [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}`)\n return StepSizes[validatedStep]\n}\n\nexport function stepSizeV2(step: number): number {\n const validatedStep = asValidStep(step, () => `Invalid step (${step}), must be an integer between 0 and ${StepSizesV2.length - 1}`)\n return StepSizesV2[validatedStep]\n}\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","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 * The chain id\n */\n chain?: 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)\nexport const asOptionalBlockNumber = AsObjectFactory.createOptional<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)\nexport const asOptionalBlockNumberWithSources = AsObjectFactory.createOptional<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 { Address } from '@xylabs/hex'\nimport type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\n\nexport const ChainIdentificationPayloadSchema = 'network.xyo.chain.identification' as const\nexport type ChainIdentificationPayloadSchema = typeof ChainIdentificationPayloadSchema\n\n/**\n * Identification required to uniquely identify a chain\n */\nexport interface ChainIdentification {\n /** @field the id of the chain */\n id: Address\n}\n\nexport type ChainIdentificationPayload = Payload<ChainIdentification, ChainIdentificationPayloadSchema>\nexport const isChainIdentificationPayload = isPayloadOfSchemaType<ChainIdentificationPayload>(ChainIdentificationPayloadSchema)\n","import type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\n\nexport const ChainInformationPayloadSchema = 'network.xyo.chain.information' as const\nexport type ChainInformationPayloadSchema = typeof ChainInformationPayloadSchema\n\nimport type { ChainIdentification } from './ChainIdentification.ts'\n\n/**\n * Information required to produce a chain\n */\nexport interface ChainInformation extends ChainIdentification {\n // TODO: Add these fields which are currently promises on the smart contract\n // forkedAtBlockNumber: bigint\n // forkedAtHash: Hash\n // forkedChainId: Address\n}\n\nexport type ChainInformationPayload = Payload<ChainIdentification, ChainInformationPayloadSchema>\nexport const isChainInformationPayload = isPayloadOfSchemaType<ChainInformationPayload>(ChainInformationPayloadSchema)\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 Address, isAddress } from '@xylabs/hex'\nimport { isUndefined } from '@xylabs/typeof'\n\nimport {\n type BlockBoundWitness, type HydratedBlock, isBlockBoundWitness,\n} from '../../block/index.ts'\nimport { isHydratedBoundWitness } from '../../isHydratedBoundWitness.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 const { cause } = error as BlockValidationError\n return (\n isBlockBoundWitness(cause)\n )\n}\n\nexport class HydratedBlockValidationError extends ValidationError<HydratedBlock> {}\n\nexport const isHydratedBlockValidationError = (\n error: unknown,\n): error is HydratedBlockValidationError => {\n if (!isValidationError<HydratedBlock>(error)) return false\n const { cause } = error as HydratedBlockValidationError\n return (\n isHydratedBoundWitness(cause) && isBlockBoundWitness(cause[0])\n )\n}\n\nexport class HydratedBlockStateValidationError extends ValidationError<HydratedBlock> {\n chainId: Address\n constructor(chainId: Address, cause: HydratedBlock, message?: string) {\n super(cause, message)\n this.chainId = chainId\n }\n\n override toJson() {\n return {\n ...super.toJson(),\n chainId: this.chainId,\n }\n }\n}\n\nexport const isHydratedBlockStateValidationError = (\n error: unknown,\n): error is HydratedBlockStateValidationError => {\n if (!isValidationError<HydratedBlock>(error)) return false\n const { cause, chainId } = error as HydratedBlockStateValidationError\n return (\n isHydratedBoundWitness(cause) && isBlockBoundWitness(cause[0]) && (isUndefined(chainId) || isAddress(chainId))\n )\n}\n","import { isError } from '@xylabs/typeof'\nimport type { Payload } from '@xyo-network/payload-model'\n\nexport class ValidationError<TValue = Payload> extends Error {\n constructor(cause: TValue, message?: string) {\n super(message)\n this.cause = cause\n this.name = this.constructor.name\n }\n\n toJson() {\n return {\n name: this.name,\n message: this.message,\n cause: JSON.stringify(this.cause),\n stack: this.stack,\n }\n }\n}\n\nexport const isValidationError = <TValue = Payload>(\n error: unknown,\n): error is ValidationError<TValue> => {\n return (\n isError(error) && (error as ValidationError<TValue>)?.cause !== undefined\n )\n}\n","import type { HydratedBoundWitness } from '@xyo-network/archivist-model'\nimport { type BoundWitness, isBoundWitness } from '@xyo-network/boundwitness-model'\n\nimport { isHydratedBoundWitness } from '../../isHydratedBoundWitness.ts'\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 const { cause } = error as BoundWitnessValidationError\n return (\n isBoundWitness(cause)\n )\n}\n\nexport class HydratedBoundWitnessValidationError extends ValidationError<HydratedBoundWitness> {}\n\nexport const isHydratedBoundWitnessValidationError = (\n error: unknown,\n): error is HydratedBoundWitnessValidationError => {\n if (!isValidationError<HydratedBoundWitness>(error)) return false\n const { cause } = error as HydratedBoundWitnessValidationError\n return (\n isHydratedBoundWitness(cause)\n )\n}\n","import { isAnyPayload, type Payload } from '@xyo-network/payload-model'\n\nimport { type HydratedBlock, isHydratedBlock } from '../../block/index.ts'\nimport { isValidationError, ValidationError } from '../error.ts'\n\nexport class InBlockPayloadValidationError extends ValidationError<Payload> {\n block: HydratedBlock\n constructor(block: HydratedBlock, cause: Payload, message?: string) {\n super(cause, message)\n this.block = block\n }\n\n override toJson() {\n return {\n ...super.toJson(),\n block: JSON.stringify(this.block),\n }\n }\n}\n\nexport const isInBlockPayloadValidationError = (\n error: unknown,\n): error is InBlockPayloadValidationError => {\n if (!isValidationError(error)) return false\n const { block, cause } = error as InBlockPayloadValidationError\n return (\n isAnyPayload(cause) && isHydratedBlock(block)\n )\n}\n","import { type HydratedTransaction, isHydratedTransaction } from '../../transaction/index.ts'\nimport { isValidationError, ValidationError } from '../error.ts'\n\nexport class HydratedTransactionValidationError extends ValidationError<HydratedTransaction> {}\n\nexport const isHydratedTransactionValidationError = (\n error: unknown,\n): error is HydratedTransactionValidationError => {\n return (\n isValidationError(error) && isHydratedTransaction(error)\n )\n}\n"],"mappings":";AAAA,SAAS,0BAA0B;AAEnC,SAAS,qBAAAA,oBAAmB,gBAAgB;AAE5C,SAAS,iBAAiB,oBAAoB;;;ACJ9C,SAAS,uBAAuB;AAGhC,SAAS,6BAA6B;AAE/B,IAAM,2BAA2B;AASjC,IAAM,uBAAuB,sBAA0C,wBAAwB;AAE/F,IAAM,uBAAuB,gBAAgB,OAAO,oBAAoB;AACxE,IAAM,+BAA+B,gBAAgB,e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e,KAAK;AAExB;AAEO,IAAM,sCAAN,cAAkD,gBAAsC;AAAC;AAEzF,IAAM,wCAAwC,CACnD,UACiD;AACjD,MAAI,CAAC,kBAAwC,KAAK,EAAG,QAAO;AAC5D,QAAM,EAAE,MAAM,IAAI;AAClB,SACE,uBAAuB,KAAK;AAEhC;;;AC5BA,SAAS,gBAAAC,qBAAkC;AAKpC,IAAM,gCAAN,cAA4C,gBAAyB;AAAA,EAC1E;AAAA,EACA,YAAY,OAAsB,OAAgB,SAAkB;AAClE,UAAM,OAAO,OAAO;AACpB,SAAK,QAAQ;AAAA,EACf;AAAA,EAES,SAAS;AAChB,WAAO;AAAA,MACL,GAAG,MAAM,OAAO;AAAA,MAChB,OAAO,KAAK,UAAU,KAAK,KAAK;AAAA,IAClC;AAAA,EACF;AACF;AAEO,IAAM,kCAAkC,CAC7C,UAC2C;AAC3C,MAAI,CAAC,kBAAkB,KAAK,EAAG,QAAO;AACtC,QAAM,EAAE,OAAO,MAAM,IAAI;AACzB,SACEC,cAAa,KAAK,KAAK,gBAAgB,KAAK;AAEhD;;;ACzBO,IAAM,qCAAN,cAAiD,gBAAqC;AAAC;AAEvF,IAAM,uCAAuC,CAClD,UACgD;AAChD,SACE,kBAAkB,KAAK,KAAK,sBAAsB,KAAK;AAE3D;","names":["isHashStorageMeta","AsObjectFactory","isPayloadOfSchemaType","AsObjectFactory","isPayloadOfSchemaType","AsObjectFactory","isPayloadOfSchemaType","AsObjectFactory","isAnyPayload","AsObjectFactory","isStorageMeta","AsObjectFactory","isHashStorageMeta","AsObjectFactory","isBoundWitness","isSigned","isHashStorageMeta","isStorageMeta","AsObjectFactory","AsObjectFactory","AsObjectFactory","isPayloadOfSchemaType","isPayloadOfSchemaType","isPayloadOfSchemaType","isPayloadOfSchemaType","AsObjectFactory","isPayloadOfSchemaType","isStorageMeta","isBoundWitness","isBoundWitness","isAnyPayload","isAnyPayload"]}
|
|
1
|
+
{"version":3,"sources":["../../src/block/AllowedBlockPayload.ts","../../src/payload/AtomicBoundWitness.ts","../../src/payload/elevatable/ChainStakeIntent.ts","../../src/payload/elevatable/Executable.ts","../../src/payload/elevatable/Hash.ts","../../src/payload/elevatable/TransferPayload.ts","../../src/transaction/HydratedTransaction.ts","../../src/isHydratedBoundWitness.ts","../../src/transaction/TransactionBoundWitness.ts","../../src/block/BlockBoundWitness.ts","../../src/block/HydratedBlock.ts","../../src/xl1/XL1.ts","../../src/constants/minTransactionFees.ts","../../src/constants/defaultTransactionFees.ts","../../src/constants/StepSizes.ts","../../src/constants/TransactionGasCosts.ts","../../src/fields/BlockNumber.ts","../../src/network/Status.ts","../../src/services/Chain/ChainIdentification.ts","../../src/services/Chain/ChainInformation.ts","../../src/services/StakeIntentService/ChainIndexingServiceStateSchema.ts","../../src/validation/block/error.ts","../../src/validation/error.ts","../../src/validation/boundwitness/error.ts","../../src/validation/payload/error.ts","../../src/validation/transaction/error.ts"],"sourcesContent":["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'\n\nimport type {\n ChainStakeIntent, HashPayload, Transfer,\n} from '../payload/index.ts'\nimport {\n ChainStakeIntentSchema, HashSchema, isChainStakeIntent, isHashPayload, isTransfer, TransferSchema,\n} from '../payload/index.ts'\nimport { isTransactionBoundWitness, type TransactionBoundWitness } from '../transaction/index.ts'\n\nexport type AllowedBlockPayload = Transfer | ChainStakeIntent | SchemaPayload | TransactionBoundWitness | HashPayload\nexport const AllowedBlockPayloadSchemas: Schema[] = [TransferSchema, ChainStakeIntentSchema, SchemaSchema, BoundWitnessSchema, HashSchema]\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) || isChainStakeIntent(value) || isSchemaPayload(value) || isTransactionBoundWitness(value) || isHashPayload(value)\n}\n\nexport const isAllowedBlockPayloadWithHashStorageMeta = (value: unknown): value is WithStorageMeta<AllowedBlockPayload> => {\n return isAllowedBlockPayload(value) && isHashStorageMeta(value)\n}\n","import { AsObjectFactory } from '@xylabs/object'\nimport type { BoundWitness } from '@xyo-network/boundwitness-model'\nimport type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\n\nexport const AtomicBoundWitnessSchema = 'network.xyo.boundwitness.atomic' as const\nexport type AtomicBoundWitnessSchema = typeof AtomicBoundWitnessSchema\n\nexport interface AtomicBoundWitnessFields<TBoundWitness extends BoundWitness = BoundWitness> {\n bw: TBoundWitness\n}\n\nexport type AtomicBoundWitness = Payload<AtomicBoundWitnessFields, AtomicBoundWitnessSchema>\n\nexport const isAtomicBoundWitness = isPayloadOfSchemaType<AtomicBoundWitness>(AtomicBoundWitnessSchema)\n\nexport const asAtomicBoundWitness = AsObjectFactory.create(isAtomicBoundWitness)\n","import { AsObjectFactory } from '@xylabs/object'\nimport type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } 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\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 {\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 another address\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 { Signed } from '@xyo-network/boundwitness-model'\nimport type { Payload, WithStorageMeta } from '@xyo-network/payload-model'\n\nimport { isHydratedBoundWitness } from '../isHydratedBoundWitness.ts'\nimport { isSignedTransactionBoundWitnessWithStorageMeta, type TransactionBoundWitness } from './TransactionBoundWitness.ts'\n\nexport type HydratedTransaction<T extends TransactionBoundWitness = TransactionBoundWitness, P extends Payload = Payload> =\n[WithStorageMeta<Signed<T>>, WithStorageMeta<P>[]]\n\nexport const isHydratedTransaction = (\n value: unknown,\n): value is HydratedTransaction => {\n return (\n isHydratedBoundWitness(value) && isSignedTransactionBoundWitnessWithStorageMeta(value[0])\n )\n}\n\nexport const asHydratedTransaction = AsObjectFactory.create<HydratedTransaction>(\n isHydratedTransaction,\n)\n","import type { HydratedBoundWitnessWithStorageMeta } from '@xyo-network/archivist-model'\nimport { isBoundWitnessWithStorageMeta } from '@xyo-network/boundwitness-model'\nimport { isAnyPayload, isStorageMeta } from '@xyo-network/payload-model'\n\nexport const isHydratedBoundWitness = (\n value: unknown,\n): value is HydratedBoundWitnessWithStorageMeta => {\n return (\n Array.isArray(value)\n && value.length === 2\n && isBoundWitnessWithStorageMeta(value[0])\n && Array.isArray(value[1])\n && !value[1].some(item => (!isAnyPayload(item) || !isStorageMeta(item)))\n )\n}\n","import type { Address } from '@xylabs/hex'\nimport { AsObjectFactory } from '@xylabs/object'\nimport type { BoundWitness, Signed } from '@xyo-network/boundwitness-model'\nimport { isBoundWitness } 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 { 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: Address\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 && typedObj.chain !== undefined\n && typedObj.fees !== undefined\n && typedObj.exp !== undefined\n && typedObj.nbf !== undefined\n}\n\nexport const isSignedTransactionBoundWitness = (value: unknown): value is Signed<TransactionBoundWitness> => {\n return isTransactionBoundWitness(value) && isSigned(value)\n}\n\nexport const isSigned = <T extends BoundWitness = BoundWitness>(value: unknown): value is Signed<T> =>\n isBoundWitness(value)\n && value.$signatures.length === value.addresses.length\n && value.addresses.length > 0\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 isSignedTransactionBoundWitness(value)\n && isStorageMeta(value)\n\nexport const isSignedTransactionBoundWitnessWithHashStorageMeta = (value: unknown): value is WithHashStorageMeta<Signed<TransactionBoundWitness>> =>\n isSignedTransactionBoundWitness(value)\n && isHashStorageMeta(value)\n\nexport const asTransactionBoundWitness = AsObjectFactory.create(isTransactionBoundWitness)\n\nexport const asTransactionBoundWitnessWithStorageMeta = AsObjectFactory.create(isTransactionBoundWitnessWithStorageMeta)\n\nexport const asTransactionBoundWitnessWithHashStorageMeta = AsObjectFactory.create(isTransactionBoundWitnessWithHashStorageMeta)\n","import type { Hash, Hex } 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\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: Hex\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: Hex[]\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","export type XL1 = bigint & { readonly _tag: 'XL1' } // 1e-18\nexport type MilliXL1 = bigint & { readonly _tag: 'MilliXL1' } // 1e-15 [XL1 * 1e3 = milliXL1] [milliXL1 / 1e3 = XL1]\nexport type MicroXL1 = bigint & { readonly _tag: 'MicroXL1' } // 1e-12 [XL1 * 1e6 = microXL1] [microXL1 / 1e6 = XL1]\nexport type NanoXL1 = bigint & { readonly _tag: 'NanoXL1' } // 1e-9 [XL1 * 1e9 = nanoXL1] [nanoXL1 / 1e9 = XL1]\nexport type PicoXL1 = bigint & { readonly _tag: 'PicoXL1' } // 1e-6 [XL1 * 1e12 = picoXL1] [picoXL1 / 1e12 = XL1]\nexport type FemtoXL1 = bigint & { readonly _tag: 'FemtoXL1' } // 1e-3 [XL1 * 1e15 = femtoXL1] [femtoXL1 / 1e15 = XL1]\nexport type AttoXL1 = bigint & { readonly _tag: 'AttoXL1' } // 1e-0 [XL1 * 1e18 = attoXL1] [attoXL1 / 1e18 = XL1]\n\nexport type TypingFunc<T extends bigint> = (value: bigint) => T\n\nexport const XL1: TypingFunc<XL1> = (value: bigint): XL1 => value as XL1\nexport const MilliXL1: TypingFunc<MilliXL1> = (value: bigint): MilliXL1 => value as MilliXL1\nexport const MicroXL1: TypingFunc<MicroXL1> = (value: bigint): MicroXL1 => value as MicroXL1\nexport const NanoXL1: TypingFunc<NanoXL1> = (value: bigint): NanoXL1 => value as NanoXL1\nexport const PicoXL1: TypingFunc<PicoXL1> = (value: bigint): PicoXL1 => value as PicoXL1\nexport const FemtoXL1: TypingFunc<FemtoXL1> = (value: bigint): FemtoXL1 => value as FemtoXL1\nexport const AttoXL1: TypingFunc<AttoXL1> = (value: bigint): AttoXL1 => value as AttoXL1\n\ntype XL1Units = 'xl1' | 'milli' | 'micro' | 'nano' | 'pico' | 'femto' | 'atto'\n\n/** @deprecated use XL1Places and xl1ConvertFactor(unit) instead */\nexport const XL1ConvertDict: Record<XL1Units, number> = {\n xl1: 18,\n milli: 15,\n micro: 12,\n nano: 9,\n pico: 6,\n femto: 3,\n atto: 0,\n} as const\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\n/** @deprecated use AttoXL1ConvertFactor instead */\nexport function xl1ConvertFactor(unit: XL1Units) {\n return 10n ** XL1Places[unit]\n}\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 = [10, 105, 1103, 11_576, 121_551, 1_276_282, 13_400_956, 223_092_871, 6_469_693_231] as const\nexport const StepSizesV2 = [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}`)\n return StepSizes[validatedStep]\n}\n\nexport function stepSizeV2(step: number): number {\n const validatedStep = asValidStep(step, () => `Invalid step (${step}), must be an integer between 0 and ${StepSizesV2.length - 1}`)\n return StepSizesV2[validatedStep]\n}\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","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 * The chain id\n */\n chain?: 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 { Address } from '@xylabs/hex'\nimport type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\n\nexport const ChainIdentificationPayloadSchema = 'network.xyo.chain.identification' as const\nexport type ChainIdentificationPayloadSchema = typeof ChainIdentificationPayloadSchema\n\n/**\n * Identification required to uniquely identify a chain\n */\nexport interface ChainIdentification {\n /** @field the id of the chain */\n id: Address\n}\n\nexport type ChainIdentificationPayload = Payload<ChainIdentification, ChainIdentificationPayloadSchema>\nexport const isChainIdentificationPayload = isPayloadOfSchemaType<ChainIdentificationPayload>(ChainIdentificationPayloadSchema)\n","import type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\n\nexport const ChainInformationPayloadSchema = 'network.xyo.chain.information' as const\nexport type ChainInformationPayloadSchema = typeof ChainInformationPayloadSchema\n\nimport type { ChainIdentification } from './ChainIdentification.ts'\n\n/**\n * Information required to produce a chain\n */\nexport interface ChainInformation extends ChainIdentification {\n // TODO: Add these fields which are currently promises on the smart contract\n // forkedAtBlockNumber: bigint\n // forkedAtHash: Hash\n // forkedChainId: Address\n}\n\nexport type ChainInformationPayload = Payload<ChainIdentification, ChainInformationPayloadSchema>\nexport const isChainInformationPayload = isPayloadOfSchemaType<ChainInformationPayload>(ChainInformationPayloadSchema)\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 Address, isAddress } from '@xylabs/hex'\nimport { isUndefined } from '@xylabs/typeof'\n\nimport {\n type BlockBoundWitness, type HydratedBlock, isBlockBoundWitness,\n} from '../../block/index.ts'\nimport { isHydratedBoundWitness } from '../../isHydratedBoundWitness.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 const { cause } = error as BlockValidationError\n return (\n isBlockBoundWitness(cause)\n )\n}\n\nexport class HydratedBlockValidationError extends ValidationError<HydratedBlock> {}\n\nexport const isHydratedBlockValidationError = (\n error: unknown,\n): error is HydratedBlockValidationError => {\n if (!isValidationError<HydratedBlock>(error)) return false\n const { cause } = error as HydratedBlockValidationError\n return (\n isHydratedBoundWitness(cause) && isBlockBoundWitness(cause[0])\n )\n}\n\nexport class HydratedBlockStateValidationError extends ValidationError<HydratedBlock> {\n chainId: Address\n constructor(chainId: Address, cause: HydratedBlock, message?: string) {\n super(cause, message)\n this.chainId = chainId\n }\n\n override toJson() {\n return {\n ...super.toJson(),\n chainId: this.chainId,\n }\n }\n}\n\nexport const isHydratedBlockStateValidationError = (\n error: unknown,\n): error is HydratedBlockStateValidationError => {\n if (!isValidationError<HydratedBlock>(error)) return false\n const { cause, chainId } = error as HydratedBlockStateValidationError\n return (\n isHydratedBoundWitness(cause) && isBlockBoundWitness(cause[0]) && (isUndefined(chainId) || isAddress(chainId))\n )\n}\n","import { isError } from '@xylabs/typeof'\nimport type { Payload } from '@xyo-network/payload-model'\n\nexport class ValidationError<TValue = Payload> extends Error {\n constructor(cause: TValue, message?: string) {\n super(message)\n this.cause = cause\n this.name = this.constructor.name\n }\n\n toJson() {\n return {\n name: this.name,\n message: this.message,\n\n cause: this.cause,\n stack: this.stack,\n }\n }\n\n override toString() {\n return JSON.stringify(this.toJson())\n }\n}\n\nexport const isValidationError = <TValue = Payload>(\n error: unknown,\n): error is ValidationError<TValue> => {\n return (\n isError(error) && (error as ValidationError<TValue>)?.cause !== undefined\n )\n}\n","import type { HydratedBoundWitness } from '@xyo-network/archivist-model'\nimport { type BoundWitness, isBoundWitness } from '@xyo-network/boundwitness-model'\n\nimport { isHydratedBoundWitness } from '../../isHydratedBoundWitness.ts'\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 const { cause } = error as BoundWitnessValidationError\n return (\n isBoundWitness(cause)\n )\n}\n\nexport class HydratedBoundWitnessValidationError extends ValidationError<HydratedBoundWitness> {}\n\nexport const isHydratedBoundWitnessValidationError = (\n error: unknown,\n): error is HydratedBoundWitnessValidationError => {\n if (!isValidationError<HydratedBoundWitness>(error)) return false\n const { cause } = error as HydratedBoundWitnessValidationError\n return (\n isHydratedBoundWitness(cause)\n )\n}\n","import { isAnyPayload, type Payload } from '@xyo-network/payload-model'\n\nimport { type HydratedBlock, isHydratedBlock } from '../../block/index.ts'\nimport { isValidationError, ValidationError } from '../error.ts'\n\nexport class InBlockPayloadValidationError extends ValidationError<Payload> {\n block: HydratedBlock\n constructor(block: HydratedBlock, cause: Payload, message?: string) {\n super(cause, message)\n this.block = block\n }\n\n override toJson() {\n return {\n ...super.toJson(),\n block: JSON.stringify(this.block),\n }\n }\n}\n\nexport const isInBlockPayloadValidationError = (\n error: unknown,\n): error is InBlockPayloadValidationError => {\n if (!isValidationError(error)) return false\n const { block, cause } = error as InBlockPayloadValidationError\n return (\n isAnyPayload(cause) && isHydratedBlock(block)\n )\n}\n","import { type HydratedTransaction, isHydratedTransaction } from '../../transaction/index.ts'\nimport { isValidationError, ValidationError } from '../error.ts'\n\nexport class HydratedTransactionValidationError extends ValidationError<HydratedTransaction> {}\n\nexport const isHydratedTransactionValidationError = (\n error: unknown,\n): error is HydratedTransactionValidationError => {\n return (\n isValidationError(error) && isHydratedTransaction(error)\n )\n}\n"],"mappings":";AAAA,SAAS,0BAA0B;AAEnC,SAAS,qBAAAA,oBAAmB,gBAAgB;AAE5C,SAAS,iBAAiB,oBAAoB;;;ACJ9C,SAAS,uBAAuB;AAGhC,SAAS,6BAA6B;AAE/B,IAAM,2BAA2B;AASjC,IAAM,uBAAuB,sBAA0C,wBAAwB;AAE/F,IAAM,uBAAuB,gBAAgB,OAAO,oBAAoB;;;AChB/E,SAAS,mBAAAC,wBAAuB;AAEhC,SAAS,yBAAAC,8BAA6B;AAK/B,IAAM,yBAAyB;AAc/B,IAAM,qBAAqB,CAAC,MAA8C;AAC/E,SAAOA,uBAAwC,sBAAsB,EAAE,CAAC,KACnE,qBAAqB,EAAE,GAAG,MAAM,UAChC,qBAAqB,EAAE,GAAG,MAAM;AACvC;AACO,IAAM,qBAAqBD,iBAAgB,OAAO,kBAAkB;AAE3E,IAAM,uBAAuB,CAAC,QAAgB;AAC5C,SAAQ,OAAO,UAAU,GAAG,KAAK,OAAO,IAAK,MAAM;AACrD;;;AC5BA,SAAS,oBAAoB;AAOtB,IAAM,UAAU,CAAC,UAAwC;AAC9D,SAAQ,MAAqB,SAAS;AACxC;AASO,IAAM,eAAe,CAAwB,UAAiD;AACnG,SAAO,aAAa,KAAK,KAAK,MAAM,QAAS,MAAsC,MAAM;AAC3F;AAEO,IAAM,eAAe,CAAwB,UAAoD;AACtG,SAAO,aAAa,KAAK,IACrB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","names":["isHashStorageMeta","AsObjectFactory","isPayloadOfSchemaType","AsObjectFactory","isPayloadOfSchemaType","AsObjectFactory","isPayloadOfSchemaType","AsObjectFactory","isAnyPayload","AsObjectFactory","isStorageMeta","AsObjectFactory","isHashStorageMeta","AsObjectFactory","isBoundWitness","isSigned","isHashStorageMeta","isStorageMeta","AsObjectFactory","AsObjectFactory","AsObjectFactory","isPayloadOfSchemaType","isPayloadOfSchemaType","isPayloadOfSchemaType","isPayloadOfSchemaType","AsObjectFactory","isPayloadOfSchemaType","isStorageMeta","isBoundWitness","isBoundWitness","isAnyPayload","isAnyPayload"]}
|
|
@@ -21,11 +21,9 @@ export type BlockNumber = Payload<BlockNumberFields, BlockNumberSchema>;
|
|
|
21
21
|
*/
|
|
22
22
|
export declare const isBlockNumber: (x?: unknown | null) => x is BlockNumber;
|
|
23
23
|
export declare const asBlockNumber: import("@xylabs/object").AsTypeFunction<BlockNumber>;
|
|
24
|
-
export declare const asOptionalBlockNumber: (value: import("@xylabs/promise").AnyNonPromise) => BlockNumber | undefined;
|
|
25
24
|
/**
|
|
26
25
|
* Identity function for determining if an object is a BlockNumber with sources
|
|
27
26
|
*/
|
|
28
27
|
export declare const isBlockNumberWithSources: (x?: unknown | null) => x is WithSources<BlockNumber>;
|
|
29
28
|
export declare const asBlockNumberWithSources: import("@xylabs/object").AsTypeFunction<WithSources<BlockNumber>>;
|
|
30
|
-
export declare const asOptionalBlockNumberWithSources: (value: import("@xylabs/promise").AnyNonPromise) => WithSources<BlockNumber> | undefined;
|
|
31
29
|
//# sourceMappingURL=BlockNumber.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlockNumber.d.ts","sourceRoot":"","sources":["../../../src/fields/BlockNumber.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AAEtC,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAMtE,eAAO,MAAM,iBAAiB,EAAG,gCAAyC,CAAA;AAC1E,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAA;AAExD,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,KAAK,EAAE,GAAG,CAAA;IACV;;OAEG;IACH,KAAK,CAAC,EAAE,GAAG,CAAA;CACZ;AACD;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,CAAA;AAEvE;;GAEG;AACH,eAAO,MAAM,aAAa,0CAAwD,CAAA;AAClF,eAAO,MAAM,aAAa,sDAAqD,CAAA;
|
|
1
|
+
{"version":3,"file":"BlockNumber.d.ts","sourceRoot":"","sources":["../../../src/fields/BlockNumber.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AAEtC,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAMtE,eAAO,MAAM,iBAAiB,EAAG,gCAAyC,CAAA;AAC1E,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAA;AAExD,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,KAAK,EAAE,GAAG,CAAA;IACV;;OAEG;IACH,KAAK,CAAC,EAAE,GAAG,CAAA;CACZ;AACD;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,CAAA;AAEvE;;GAEG;AACH,eAAO,MAAM,aAAa,0CAAwD,CAAA;AAClF,eAAO,MAAM,aAAa,sDAAqD,CAAA;AAE/E;;GAEG;AACH,eAAO,MAAM,wBAAwB,uDAAmE,CAAA;AACxG,eAAO,MAAM,wBAAwB,mEAA6E,CAAA"}
|
|
@@ -8,5 +8,4 @@ export interface AtomicBoundWitnessFields<TBoundWitness extends BoundWitness = B
|
|
|
8
8
|
export type AtomicBoundWitness = Payload<AtomicBoundWitnessFields, AtomicBoundWitnessSchema>;
|
|
9
9
|
export declare const isAtomicBoundWitness: (x?: unknown | null) => x is AtomicBoundWitness;
|
|
10
10
|
export declare const asAtomicBoundWitness: import("@xylabs/object").AsTypeFunction<AtomicBoundWitness>;
|
|
11
|
-
export declare const asOptionalAtomicBoundWitness: (value: import("@xylabs/promise").AnyNonPromise) => AtomicBoundWitness | undefined;
|
|
12
11
|
//# sourceMappingURL=AtomicBoundWitness.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AtomicBoundWitness.d.ts","sourceRoot":"","sources":["../../../src/payload/AtomicBoundWitness.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AACnE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAGzD,eAAO,MAAM,wBAAwB,EAAG,iCAA0C,CAAA;AAClF,MAAM,MAAM,wBAAwB,GAAG,OAAO,wBAAwB,CAAA;AAEtE,MAAM,WAAW,wBAAwB,CAAC,aAAa,SAAS,YAAY,GAAG,YAAY;IACzF,EAAE,EAAE,aAAa,CAAA;CAClB;AAED,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC,wBAAwB,EAAE,wBAAwB,CAAC,CAAA;AAE5F,eAAO,MAAM,oBAAoB,iDAAsE,CAAA;AAEvG,eAAO,MAAM,oBAAoB,6DAA+C,CAAA
|
|
1
|
+
{"version":3,"file":"AtomicBoundWitness.d.ts","sourceRoot":"","sources":["../../../src/payload/AtomicBoundWitness.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AACnE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAGzD,eAAO,MAAM,wBAAwB,EAAG,iCAA0C,CAAA;AAClF,MAAM,MAAM,wBAAwB,GAAG,OAAO,wBAAwB,CAAA;AAEtE,MAAM,WAAW,wBAAwB,CAAC,aAAa,SAAS,YAAY,GAAG,YAAY;IACzF,EAAE,EAAE,aAAa,CAAA;CAClB;AAED,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC,wBAAwB,EAAE,wBAAwB,CAAC,CAAA;AAE5F,eAAO,MAAM,oBAAoB,iDAAsE,CAAA;AAEvG,eAAO,MAAM,oBAAoB,6DAA+C,CAAA"}
|
|
@@ -10,5 +10,4 @@ export interface ChainStakeIntentFields extends BlockDuration, FromFields {
|
|
|
10
10
|
export type ChainStakeIntent = Payload<ChainStakeIntentFields, ChainStakeIntentSchema>;
|
|
11
11
|
export declare const isChainStakeIntent: (x?: unknown | null) => x is ChainStakeIntent;
|
|
12
12
|
export declare const asChainStakeIntent: import("@xylabs/object").AsTypeFunction<ChainStakeIntent>;
|
|
13
|
-
export declare const asOptionalChainStakeIntent: (value: import("@xylabs/promise").AnyNonPromise) => ChainStakeIntent | undefined;
|
|
14
13
|
//# sourceMappingURL=ChainStakeIntent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChainStakeIntent.d.ts","sourceRoot":"","sources":["../../../../src/payload/elevatable/ChainStakeIntent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAGzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEjD,eAAO,MAAM,sBAAsB,EAAG,gCAAyC,CAAA;AAC/E,MAAM,MAAM,sBAAsB,GAAG,OAAO,sBAAsB,CAAA;AAElE,MAAM,MAAM,MAAM,GAAG,UAAU,CAAA;AAE/B,MAAM,WAAW,sBAAuB,SAAQ,aAAa,EAAE,UAAU;IAIvE,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC,sBAAsB,EAAE,sBAAsB,CAAC,CAAA;AAEtF,eAAO,MAAM,kBAAkB,GAAI,IAAI,OAAO,GAAG,IAAI,KAAG,CAAC,IAAI,gBAI5D,CAAA;AACD,eAAO,MAAM,kBAAkB,2DAA6C,CAAA
|
|
1
|
+
{"version":3,"file":"ChainStakeIntent.d.ts","sourceRoot":"","sources":["../../../../src/payload/elevatable/ChainStakeIntent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAGzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEjD,eAAO,MAAM,sBAAsB,EAAG,gCAAyC,CAAA;AAC/E,MAAM,MAAM,sBAAsB,GAAG,OAAO,sBAAsB,CAAA;AAElE,MAAM,MAAM,MAAM,GAAG,UAAU,CAAA;AAE/B,MAAM,WAAW,sBAAuB,SAAQ,aAAa,EAAE,UAAU;IAIvE,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC,sBAAsB,EAAE,sBAAsB,CAAC,CAAA;AAEtF,eAAO,MAAM,kBAAkB,GAAI,IAAI,OAAO,GAAG,IAAI,KAAG,CAAC,IAAI,gBAI5D,CAAA;AACD,eAAO,MAAM,kBAAkB,2DAA6C,CAAA"}
|
|
@@ -9,5 +9,4 @@ export type HashPayload = Payload<HashFields, HashSchema>;
|
|
|
9
9
|
export declare const isHashPayload: (x?: unknown | null) => x is HashPayload;
|
|
10
10
|
export declare const asHashPayload: import("@xylabs/object").AsTypeFunction<HashPayload>;
|
|
11
11
|
export declare const asHashPayloadWithStorageMeta: import("@xylabs/object").AsTypeFunction<HashPayload>;
|
|
12
|
-
export declare const asOptionalHashPayload: (value: import("@xylabs/promise").AnyNonPromise) => HashPayload | undefined;
|
|
13
12
|
//# sourceMappingURL=Hash.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Hash.d.ts","sourceRoot":"","sources":["../../../../src/payload/elevatable/Hash.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAEvC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAGzD,eAAO,MAAM,UAAU,EAAG,kBAA2B,CAAA;AACrD,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAA;AAE1C,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,IAAI,CAAA;CACX;AAED,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC,UAAU,EAAE,UAAU,CAAC,CAAA;AAEzD,eAAO,MAAM,aAAa,0CAAiD,CAAA;AAE3E,eAAO,MAAM,aAAa,sDAAwC,CAAA;AAClE,eAAO,MAAM,4BAA4B,sDAAwC,CAAA
|
|
1
|
+
{"version":3,"file":"Hash.d.ts","sourceRoot":"","sources":["../../../../src/payload/elevatable/Hash.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAEvC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAGzD,eAAO,MAAM,UAAU,EAAG,kBAA2B,CAAA;AACrD,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAA;AAE1C,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,IAAI,CAAA;CACX;AAED,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC,UAAU,EAAE,UAAU,CAAC,CAAA;AAEzD,eAAO,MAAM,aAAa,0CAAiD,CAAA;AAE3E,eAAO,MAAM,aAAa,sDAAwC,CAAA;AAClE,eAAO,MAAM,4BAA4B,sDAAwC,CAAA"}
|
|
@@ -10,5 +10,4 @@ export interface TransferFields extends FromFields {
|
|
|
10
10
|
export type Transfer = Payload<TransferFields, TransferSchema>;
|
|
11
11
|
export declare const isTransfer: (x?: unknown | null) => x is Transfer;
|
|
12
12
|
export declare const asTransfer: import("@xylabs/object").AsTypeFunction<Transfer>;
|
|
13
|
-
export declare const asOptionalTransfer: (value: import("@xylabs/promise").AnyNonPromise) => Transfer | undefined;
|
|
14
13
|
//# sourceMappingURL=TransferPayload.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransferPayload.d.ts","sourceRoot":"","sources":["../../../../src/payload/elevatable/TransferPayload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,GAAG,EACJ,MAAM,aAAa,CAAA;AAEpB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAGzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEjD,eAAO,MAAM,cAAc,EAAG,sBAA+B,CAAA;AAC7D,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAA;AAElD,MAAM,WAAW,cAAe,SAAQ,UAAU;IAChD,KAAK,EAAE,MAAM,CAAA;IAEb,SAAS,EAAE,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAA;CACzC;AAGD,MAAM,MAAM,QAAQ,GAAG,OAAO,CAAC,cAAc,EAAE,cAAc,CAAC,CAAA;AAE9D,eAAO,MAAM,UAAU,uCAAkD,CAAA;AAEzE,eAAO,MAAM,UAAU,mDAAqC,CAAA
|
|
1
|
+
{"version":3,"file":"TransferPayload.d.ts","sourceRoot":"","sources":["../../../../src/payload/elevatable/TransferPayload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,GAAG,EACJ,MAAM,aAAa,CAAA;AAEpB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAGzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEjD,eAAO,MAAM,cAAc,EAAG,sBAA+B,CAAA;AAC7D,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAA;AAElD,MAAM,WAAW,cAAe,SAAQ,UAAU;IAChD,KAAK,EAAE,MAAM,CAAA;IAEb,SAAS,EAAE,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAA;CACzC;AAGD,MAAM,MAAM,QAAQ,GAAG,OAAO,CAAC,cAAc,EAAE,cAAc,CAAC,CAAA;AAE9D,eAAO,MAAM,UAAU,uCAAkD,CAAA;AAEzE,eAAO,MAAM,UAAU,mDAAqC,CAAA"}
|
|
@@ -8,5 +8,5 @@ import type { HydratedBlockValidationError } from './error.ts';
|
|
|
8
8
|
* @param chainId The chain ID to use for validation.
|
|
9
9
|
* @returns An array of errors if the block is invalid, or an empty array if it is valid.
|
|
10
10
|
*/
|
|
11
|
-
export type
|
|
11
|
+
export type HydratedBlockValidationFunction = (hydratedBlock: HydratedBlock, chainId?: Address) => Promisable<(HydratedBlockValidationError | Error)[]>;
|
|
12
12
|
//# sourceMappingURL=HydratedBlockValidationFunction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HydratedBlockValidationFunction.d.ts","sourceRoot":"","sources":["../../../../src/validation/block/HydratedBlockValidationFunction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,YAAY,CAAA;AAE9D;;;;;GAKG;AACH,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"HydratedBlockValidationFunction.d.ts","sourceRoot":"","sources":["../../../../src/validation/block/HydratedBlockValidationFunction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,YAAY,CAAA;AAE9D;;;;;GAKG;AACH,MAAM,MAAM,+BAA+B,GAAG,CAC5C,aAAa,EAAE,aAAa,EAC5B,OAAO,CAAC,EAAE,OAAO,KACd,UAAU,CAAC,CAAC,4BAA4B,GAAG,KAAK,CAAC,EAAE,CAAC,CAAA"}
|
|
@@ -4,9 +4,10 @@ export declare class ValidationError<TValue = Payload> extends Error {
|
|
|
4
4
|
toJson(): {
|
|
5
5
|
name: string;
|
|
6
6
|
message: string;
|
|
7
|
-
cause:
|
|
7
|
+
cause: unknown;
|
|
8
8
|
stack: string | undefined;
|
|
9
9
|
};
|
|
10
|
+
toString(): string;
|
|
10
11
|
}
|
|
11
12
|
export declare const isValidationError: <TValue = Payload>(error: unknown) => error is ValidationError<TValue>;
|
|
12
13
|
//# sourceMappingURL=error.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../src/validation/error.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEzD,qBAAa,eAAe,CAAC,MAAM,GAAG,OAAO,CAAE,SAAQ,KAAK;gBAC9C,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM;IAM3C,MAAM;;;;;;
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../src/validation/error.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEzD,qBAAa,eAAe,CAAC,MAAM,GAAG,OAAO,CAAE,SAAQ,KAAK;gBAC9C,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM;IAM3C,MAAM;;;;;;IAUG,QAAQ;CAGlB;AAED,eAAO,MAAM,iBAAiB,GAAI,MAAM,GAAG,OAAO,EAChD,OAAO,OAAO,KACb,KAAK,IAAI,eAAe,CAAC,MAAM,CAIjC,CAAA"}
|
|
@@ -8,5 +8,5 @@ import type { HydratedTransactionValidationError } from './error.ts';
|
|
|
8
8
|
* @param chainId The chain ID to use for validation.
|
|
9
9
|
* @returns An array of errors if the transaction is invalid, or an empty array if it is valid.
|
|
10
10
|
*/
|
|
11
|
-
export type
|
|
11
|
+
export type HydratedTransactionValidationFunction<T extends TransactionBoundWitness = TransactionBoundWitness> = (hydratedTransaction: HydratedTransaction<T>, chainId?: Address) => Promisable<(HydratedTransactionValidationError | Error)[]>;
|
|
12
12
|
//# sourceMappingURL=HydratedTransactionValidationFunction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HydratedTransactionValidationFunction.d.ts","sourceRoot":"","sources":["../../../../src/validation/transaction/HydratedTransactionValidationFunction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAA;AAC9F,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,YAAY,CAAA;AAEpE;;;;;GAKG;AACH,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"HydratedTransactionValidationFunction.d.ts","sourceRoot":"","sources":["../../../../src/validation/transaction/HydratedTransactionValidationFunction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAA;AAC9F,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,YAAY,CAAA;AAEpE;;;;;GAKG;AACH,MAAM,MAAM,qCAAqC,CAAC,CAAC,SAAS,uBAAuB,GAAG,uBAAuB,IAAI,CAC/G,mBAAmB,EAAE,mBAAmB,CAAC,CAAC,CAAC,EAC3C,OAAO,CAAC,EAAE,OAAO,KACd,UAAU,CAAC,CAAC,kCAAkC,GAAG,KAAK,CAAC,EAAE,CAAC,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.4.
|
|
4
|
+
"version": "1.4.34",
|
|
5
5
|
"description": "XYO Layer One Protocol",
|
|
6
6
|
"homepage": "https://xylabs.com",
|
|
7
7
|
"bugs": {
|
|
@@ -56,9 +56,9 @@
|
|
|
56
56
|
"@xylabs/eslint-config-flat": "^6.5.8",
|
|
57
57
|
"@xylabs/ts-scripts-yarn3": "^6.5.8",
|
|
58
58
|
"@xylabs/tsconfig": "^6.5.8",
|
|
59
|
-
"dependency-cruiser": "^16.10.
|
|
59
|
+
"dependency-cruiser": "^16.10.3",
|
|
60
60
|
"dotenv": "^16.5.0",
|
|
61
|
-
"eslint": "^9.
|
|
61
|
+
"eslint": "^9.29.0",
|
|
62
62
|
"eslint-import-resolver-typescript": "^4.4.3",
|
|
63
63
|
"knip": "^5.61.0",
|
|
64
64
|
"typescript": "^5.8.3",
|
|
@@ -29,11 +29,9 @@ export type BlockNumber = Payload<BlockNumberFields, BlockNumberSchema>
|
|
|
29
29
|
*/
|
|
30
30
|
export const isBlockNumber = isPayloadOfSchemaType<BlockNumber>(BlockNumberSchema)
|
|
31
31
|
export const asBlockNumber = AsObjectFactory.create<BlockNumber>(isBlockNumber)
|
|
32
|
-
export const asOptionalBlockNumber = AsObjectFactory.createOptional<BlockNumber>(isBlockNumber)
|
|
33
32
|
|
|
34
33
|
/**
|
|
35
34
|
* Identity function for determining if an object is a BlockNumber with sources
|
|
36
35
|
*/
|
|
37
36
|
export const isBlockNumberWithSources = isPayloadOfSchemaTypeWithSources<BlockNumber>(BlockNumberSchema)
|
|
38
37
|
export const asBlockNumberWithSources = AsObjectFactory.create<WithSources<BlockNumber>>(isBlockNumberWithSources)
|
|
39
|
-
export const asOptionalBlockNumberWithSources = AsObjectFactory.createOptional<WithSources<BlockNumber>>(isBlockNumberWithSources)
|
|
@@ -15,4 +15,3 @@ export type AtomicBoundWitness = Payload<AtomicBoundWitnessFields, AtomicBoundWi
|
|
|
15
15
|
export const isAtomicBoundWitness = isPayloadOfSchemaType<AtomicBoundWitness>(AtomicBoundWitnessSchema)
|
|
16
16
|
|
|
17
17
|
export const asAtomicBoundWitness = AsObjectFactory.create(isAtomicBoundWitness)
|
|
18
|
-
export const asOptionalAtomicBoundWitness = AsObjectFactory.createOptional(isAtomicBoundWitness)
|
|
@@ -25,7 +25,6 @@ export const isChainStakeIntent = (x?: unknown | null): x is ChainStakeIntent =>
|
|
|
25
25
|
&& asNonNegativeInteger(x.exp) !== undefined
|
|
26
26
|
}
|
|
27
27
|
export const asChainStakeIntent = AsObjectFactory.create(isChainStakeIntent)
|
|
28
|
-
export const asOptionalChainStakeIntent = AsObjectFactory.createOptional(isChainStakeIntent)
|
|
29
28
|
|
|
30
29
|
const asNonNegativeInteger = (num: number) => {
|
|
31
30
|
return (Number.isInteger(num) && num >= 0) ? num : undefined
|
|
@@ -16,4 +16,3 @@ export const isHashPayload = isPayloadOfSchemaType<HashPayload>(HashSchema)
|
|
|
16
16
|
|
|
17
17
|
export const asHashPayload = AsObjectFactory.create(isHashPayload)
|
|
18
18
|
export const asHashPayloadWithStorageMeta = AsObjectFactory.create(isHashPayload)
|
|
19
|
-
export const asOptionalHashPayload = AsObjectFactory.createOptional(isHashPayload)
|
|
@@ -23,4 +23,3 @@ export type Transfer = Payload<TransferFields, TransferSchema>
|
|
|
23
23
|
export const isTransfer = isPayloadOfSchemaType<Transfer>(TransferSchema)
|
|
24
24
|
|
|
25
25
|
export const asTransfer = AsObjectFactory.create(isTransfer)
|
|
26
|
-
export const asOptionalTransfer = AsObjectFactory.createOptional(isTransfer)
|
|
@@ -10,7 +10,7 @@ import type { HydratedBlockValidationError } from './error.ts'
|
|
|
10
10
|
* @param chainId The chain ID to use for validation.
|
|
11
11
|
* @returns An array of errors if the block is invalid, or an empty array if it is valid.
|
|
12
12
|
*/
|
|
13
|
-
export type
|
|
13
|
+
export type HydratedBlockValidationFunction = (
|
|
14
14
|
hydratedBlock: HydratedBlock,
|
|
15
15
|
chainId?: Address,
|
|
16
16
|
) => Promisable<(HydratedBlockValidationError | Error)[]>
|
package/src/validation/error.ts
CHANGED
|
@@ -12,10 +12,14 @@ export class ValidationError<TValue = Payload> extends Error {
|
|
|
12
12
|
return {
|
|
13
13
|
name: this.name,
|
|
14
14
|
message: this.message,
|
|
15
|
-
cause:
|
|
15
|
+
cause: this.cause,
|
|
16
16
|
stack: this.stack,
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
+
|
|
20
|
+
override toString() {
|
|
21
|
+
return JSON.stringify(this.toJson())
|
|
22
|
+
}
|
|
19
23
|
}
|
|
20
24
|
|
|
21
25
|
export const isValidationError = <TValue = Payload>(
|
|
@@ -10,7 +10,7 @@ import type { HydratedTransactionValidationError } from './error.ts'
|
|
|
10
10
|
* @param chainId The chain ID to use for validation.
|
|
11
11
|
* @returns An array of errors if the transaction is invalid, or an empty array if it is valid.
|
|
12
12
|
*/
|
|
13
|
-
export type
|
|
13
|
+
export type HydratedTransactionValidationFunction<T extends TransactionBoundWitness = TransactionBoundWitness> = (
|
|
14
14
|
hydratedTransaction: HydratedTransaction<T>,
|
|
15
15
|
chainId?: Address,
|
|
16
16
|
) => Promisable<(HydratedTransactionValidationError | Error)[]>
|