@xyo-network/xl1-protocol 1.3.12 → 1.3.13

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.
@@ -20,12 +20,17 @@ var toEthAddress = /* @__PURE__ */ __name((value) => {
20
20
  }));
21
21
  }, "toEthAddress");
22
22
 
23
+ // src/network/Status.ts
24
+ import { isPayloadOfSchemaType } from "@xyo-network/payload-model";
25
+ var NetworkStatusSchema = "network.xyo.chain.status";
26
+ var isNetworkStatus = isPayloadOfSchemaType(NetworkStatusSchema);
27
+
23
28
  // src/payload/elevatable/ChainStakeIntent.ts
24
29
  import { AsObjectFactory } from "@xylabs/object";
25
- import { isPayloadOfSchemaType } from "@xyo-network/payload-model";
30
+ import { isPayloadOfSchemaType as isPayloadOfSchemaType2 } from "@xyo-network/payload-model";
26
31
  var ChainStakeIntentSchema = "network.xyo.chain.stake.intent";
27
32
  var isChainStakeIntent = /* @__PURE__ */ __name((x) => {
28
- return isPayloadOfSchemaType(ChainStakeIntentSchema)(x) && asNonNegativeInteger(x.nbf) !== void 0 && asNonNegativeInteger(x.exp) !== void 0;
33
+ return isPayloadOfSchemaType2(ChainStakeIntentSchema)(x) && asNonNegativeInteger(x.nbf) !== void 0 && asNonNegativeInteger(x.exp) !== void 0;
29
34
  }, "isChainStakeIntent");
30
35
  var asChainStakeIntent = AsObjectFactory.create(isChainStakeIntent);
31
36
  var asOptionalChainStakeIntent = AsObjectFactory.createOptional(isChainStakeIntent);
@@ -47,18 +52,18 @@ var asExecutable = /* @__PURE__ */ __name((value) => {
47
52
 
48
53
  // src/payload/elevatable/Hash.ts
49
54
  import { AsObjectFactory as AsObjectFactory2 } from "@xylabs/object";
50
- import { isPayloadOfSchemaType as isPayloadOfSchemaType2 } from "@xyo-network/payload-model";
55
+ import { isPayloadOfSchemaType as isPayloadOfSchemaType3 } from "@xyo-network/payload-model";
51
56
  var HashSchema = "network.xyo.hash";
52
- var isHashPayload = isPayloadOfSchemaType2(HashSchema);
57
+ var isHashPayload = isPayloadOfSchemaType3(HashSchema);
53
58
  var asHashPayload = AsObjectFactory2.create(isHashPayload);
54
59
  var asHashPayloadWithStorageMeta = AsObjectFactory2.create(isHashPayload);
55
60
  var asOptionalHashPayload = AsObjectFactory2.createOptional(isHashPayload);
56
61
 
57
62
  // src/payload/elevatable/TransferPayload.ts
58
63
  import { AsObjectFactory as AsObjectFactory3 } from "@xylabs/object";
59
- import { isPayloadOfSchemaType as isPayloadOfSchemaType3 } from "@xyo-network/payload-model";
64
+ import { isPayloadOfSchemaType as isPayloadOfSchemaType4 } from "@xyo-network/payload-model";
60
65
  var TransferSchema = "network.xyo.transfer";
61
- var isTransfer = isPayloadOfSchemaType3(TransferSchema);
66
+ var isTransfer = isPayloadOfSchemaType4(TransferSchema);
62
67
  var asTransfer = AsObjectFactory3.create(isTransfer);
63
68
  var asOptionalTransfer = AsObjectFactory3.createOptional(isTransfer);
64
69
 
@@ -123,9 +128,9 @@ var asOptionalBlockBoundWitnessWithStorageMeta = AsObjectFactory5.createOptional
123
128
 
124
129
  // src/protocol/BlockNumber.ts
125
130
  import { AsObjectFactory as AsObjectFactory6 } from "@xylabs/object";
126
- import { isPayloadOfSchemaType as isPayloadOfSchemaType4, isPayloadOfSchemaTypeWithSources } from "@xyo-network/payload-model";
131
+ import { isPayloadOfSchemaType as isPayloadOfSchemaType5, isPayloadOfSchemaTypeWithSources } from "@xyo-network/payload-model";
127
132
  var BlockNumberSchema = "network.xyo.chain.block.number";
128
- var isBlockNumber = isPayloadOfSchemaType4(BlockNumberSchema);
133
+ var isBlockNumber = isPayloadOfSchemaType5(BlockNumberSchema);
129
134
  var asBlockNumber = AsObjectFactory6.create(isBlockNumber);
130
135
  var asOptionalBlockNumber = AsObjectFactory6.createOptional(isBlockNumber);
131
136
  var isBlockNumberWithSources = isPayloadOfSchemaTypeWithSources(BlockNumberSchema);
@@ -133,7 +138,7 @@ var asBlockNumberWithSources = AsObjectFactory6.create(isBlockNumberWithSources)
133
138
  var asOptionalBlockNumberWithSources = AsObjectFactory6.createOptional(isBlockNumberWithSources);
134
139
 
135
140
  // src/protocol/Steps.ts
136
- var Steps = [
141
+ var StepSizes = [
137
142
  10,
138
143
  105,
139
144
  1103,
@@ -144,21 +149,21 @@ var Steps = [
144
149
  ];
145
150
 
146
151
  // src/services/Chain/ChainIdentification.ts
147
- import { isPayloadOfSchemaType as isPayloadOfSchemaType5 } from "@xyo-network/payload-model";
152
+ import { isPayloadOfSchemaType as isPayloadOfSchemaType6 } from "@xyo-network/payload-model";
148
153
  var ChainIdentificationPayloadSchema = "network.xyo.chain.identification";
149
- var isChainIdentificationPayload = isPayloadOfSchemaType5(ChainIdentificationPayloadSchema);
154
+ var isChainIdentificationPayload = isPayloadOfSchemaType6(ChainIdentificationPayloadSchema);
150
155
 
151
156
  // src/services/Chain/ChainInformation.ts
152
- import { isPayloadOfSchemaType as isPayloadOfSchemaType6 } from "@xyo-network/payload-model";
157
+ import { isPayloadOfSchemaType as isPayloadOfSchemaType7 } from "@xyo-network/payload-model";
153
158
  var ChainInformationPayloadSchema = "network.xyo.chain.information";
154
- var isChainInformationPayload = isPayloadOfSchemaType6(ChainInformationPayloadSchema);
159
+ var isChainInformationPayload = isPayloadOfSchemaType7(ChainInformationPayloadSchema);
155
160
 
156
161
  // src/services/stakeIntent/ChainIndexingServiceStateSchema.ts
157
162
  import { AsObjectFactory as AsObjectFactory7 } from "@xylabs/object";
158
- import { isPayloadOfSchemaType as isPayloadOfSchemaType7, isStorageMeta as isStorageMeta3 } from "@xyo-network/payload-model";
163
+ import { isPayloadOfSchemaType as isPayloadOfSchemaType8, isStorageMeta as isStorageMeta3 } from "@xyo-network/payload-model";
159
164
  var ChainIndexingServiceStateSchema = "network.xyo.chain.indexing.service.state";
160
165
  var isChainIndexingServiceState = /* @__PURE__ */ __name((payload) => {
161
- return isPayloadOfSchemaType7(ChainIndexingServiceStateSchema)(payload);
166
+ return isPayloadOfSchemaType8(ChainIndexingServiceStateSchema)(payload);
162
167
  }, "isChainIndexingServiceState");
163
168
  var asChainIndexingServiceState = AsObjectFactory7.create(isChainIndexingServiceState);
164
169
  var isChainIndexingServiceStateWithStorageMeta = /* @__PURE__ */ __name((value) => isChainIndexingServiceState(value) && isStorageMeta3(value), "isChainIndexingServiceStateWithStorageMeta");
@@ -173,7 +178,8 @@ export {
173
178
  ChainStakeIntentSchema,
174
179
  ETH_ZERO_ADDRESS,
175
180
  HashSchema,
176
- Steps,
181
+ NetworkStatusSchema,
182
+ StepSizes,
177
183
  TransferSchema,
178
184
  asBlockBoundWitness,
179
185
  asBlockBoundWitnessWithStorageMeta,
@@ -214,6 +220,7 @@ export {
214
220
  isChainStakeIntent,
215
221
  isExecutable,
216
222
  isHashPayload,
223
+ isNetworkStatus,
217
224
  isSigned,
218
225
  isSignedTransactionBoundWitness,
219
226
  isSignedTransactionBoundWitnessWithStorageMeta,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ethereum.ts","../../src/payload/elevatable/ChainStakeIntent.ts","../../src/payload/elevatable/Executable.ts","../../src/payload/elevatable/Hash.ts","../../src/payload/elevatable/TransferPayload.ts","../../src/protocol/AllowedBlockPayload.ts","../../src/protocol/TransactionBoundWitness.ts","../../src/protocol/BlockBoundWitness.ts","../../src/protocol/BlockNumber.ts","../../src/protocol/Steps.ts","../../src/services/Chain/ChainIdentification.ts","../../src/services/Chain/ChainInformation.ts","../../src/services/stakeIntent/ChainIndexingServiceStateSchema.ts"],"sourcesContent":["import type { Hex } from '@xylabs/hex'\nimport { toHex } from '@xylabs/hex'\nimport type { AccountInstance } from '@xyo-network/account-model'\nimport { getAddress } from 'ethers'\nimport { parseUnits } from 'ethers/utils'\n\nexport interface GasConfig {\n gasLimit?: number\n gasPrice?: bigint\n}\n\nexport const getDefaultGasConfig = (): GasConfig => {\n return {\n gasLimit: 2_000_000, // Set the gas limit\n gasPrice: parseUnits('100', 'gwei'),\n }\n}\n\nexport type EthAddress = Hex\n\nexport const ETH_ZERO_ADDRESS: EthAddress = '0x0000000000000000000000000000000000000000' as const\n\nexport const toEthAddress = (value: bigint | string | AccountInstance): EthAddress => {\n const address = (typeof value === 'object') ? value.address : value\n return getAddress(toHex(address, { prefix: true, bitLength: 160 })) as EthAddress\n}\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 '../../protocol/BlockDuration.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: 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 { 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 './TransactionBoundWitness.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 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 { WithStorageMeta } from '@xyo-network/payload-model'\nimport { isStorageMeta } from '@xyo-network/payload-model'\n\nimport type {\n FromFields,\n OptionalExecutable,\n} from '../payload/index.ts'\nimport type { BlockDuration } from './BlockDuration.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 isSignedTransactionBoundWitnessWithStorageMeta = (value: unknown): value is WithStorageMeta<Signed<TransactionBoundWitness>> =>\n isSignedTransactionBoundWitness(value)\n && isStorageMeta(value)\n\nexport const asTransactionBoundWitness = AsObjectFactory.create(isTransactionBoundWitness)\nexport const asOptionalTransactionBoundWitness = AsObjectFactory.createOptional(isTransactionBoundWitness)\n\nexport const asTransactionBoundWitnessWithStorageMeta = AsObjectFactory.create(isTransactionBoundWitnessWithStorageMeta)\nexport const asOptionalTransactionBoundWitnessWithStorageMeta = AsObjectFactory.createOptional(isTransactionBoundWitnessWithStorageMeta)\n","import type { Hash, Hex } from '@xylabs/hex'\nimport { isHex } from '@xylabs/hex'\nimport { AsObjectFactory } from '@xylabs/object'\nimport type { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { isBoundWitness } from '@xyo-network/boundwitness-model'\nimport type { WithStorageMeta } from '@xyo-network/payload-model'\nimport { 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 isBlockBoundWitnessWithStorageMeta = (value: unknown): value is WithStorageMeta<BlockBoundWitness> => {\n return isBlockBoundWitness(value) && isStorageMeta(value)\n}\n\nexport const asBlockBoundWitness = AsObjectFactory.create(isBlockBoundWitness)\nexport const asOptionalBlockBoundWitness = AsObjectFactory.createOptional(isBlockBoundWitness)\n\nexport const asBlockBoundWitnessWithStorageMeta = AsObjectFactory.create(isBlockBoundWitnessWithStorageMeta)\nexport const asOptionalBlockBoundWitnessWithStorageMeta = AsObjectFactory.createOptional(isBlockBoundWitnessWithStorageMeta)\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","export const Steps = [10, 105, 1103, 11_576, 121_551, 1_276_282, 13_400_956]\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\nexport const asOptionalChainIndexingServiceStateWithStorageMeta\n= AsObjectFactory.createOptional<WithStorageMeta<ChainIndexingServiceState>>(isChainIndexingServiceStateWithStorageMeta)\n"],"mappings":";;;;AACA,SAASA,aAAa;AAEtB,SAASC,kBAAkB;AAC3B,SAASC,kBAAkB;AAOpB,IAAMC,sBAAsB,6BAAA;AACjC,SAAO;IACLC,UAAU;IACVC,UAAUC,WAAW,OAAO,MAAA;EAC9B;AACF,GALmC;AAS5B,IAAMC,mBAA+B;AAErC,IAAMC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BM,OAAiCG,wBAAAA;AAClF,IAAME,mCAAmCX,iBAAgBQ,eAAyCC,wBAAAA;;;ACtClG,IAAMG,QAAQ;EAAC;EAAI;EAAK;EAAM;EAAQ;EAAS;EAAW;;;;ACEjE,SAASC,yBAAAA,8BAA6B;AAE/B,IAAMC,mCAAmC;AAYzC,IAAMC,+BAA+BF,uBAAkDC,gCAAAA;;;ACf9F,SAASE,yBAAAA,8BAA6B;AAE/B,IAAMC,gCAAgC;AAgBtC,IAAMC,4BAA4BF,uBAA+CC,6BAAAA;;;ACjBxF,SAASE,mBAAAA,wBAAuB;AAEhC,SAASC,yBAAAA,wBAAuBC,iBAAAA,sBAAqB;AAiB9C,IAAMC,kCAAkC;AAWxC,IAAMC,8BAA8B,wBAAkCC,YAAAA;AAC3E,SAAOC,uBAAoDH,+BAAAA,EAAiCE,OAAAA;AAC9F,GAF2C;AAGpC,IAAME,8BAA8BC,iBAAgBC,OAA6CL,2BAAAA;AAEjG,IAAMM,6CACX,wBAAkCC,UAClCP,4BAA+BO,KAAAA,KAAUC,eAAcD,KAAAA,GADvD;AAGK,IAAME,6CACXL,iBAAgBC,OAAmDC,0CAAAA;AAE9D,IAAMI,qDACXN,iBAAgBO,eAA2DL,0CAAAA;","names":["toHex","getAddress","parseUnits","getDefaultGasConfig","gasLimit","gasPrice","parseUnits","ETH_ZERO_ADDRESS","toEthAddress","value","address","getAddress","toHex","prefix","bitLength","AsObjectFactory","isPayloadOfSchemaType","ChainStakeIntentSchema","isChainStakeIntent","x","isPayloadOfSchemaType","asNonNegativeInteger","nbf","undefined","exp","asChainStakeIntent","AsObjectFactory","create","asOptionalChainStakeIntent","createOptional","num","Number","isInteger","isAnyPayload","hasFrom","value","from","undefined","isExecutable","isAnyPayload","Array","isArray","script","asExecutable","AsObjectFactory","isPayloadOfSchemaType","HashSchema","isHashPayload","asHashPayload","create","asHashPayloadWithStorageMeta","asOptionalHashPayload","createOptional","AsObjectFactory","isPayloadOfSchemaType","TransferSchema","isTransfer","asTransfer","create","asOptionalTransfer","createOptional","BoundWitnessSchema","isHashStorageMeta","isSchema","isSchemaPayload","SchemaSchema","AsObjectFactory","isBoundWitness","isStorageMeta","isTransactionBoundWitness","value","typedObj","isBoundWitness","chain","undefined","fees","exp","nbf","isSignedTransactionBoundWitness","isSigned","$signatures","length","addresses","isTransactionBoundWitnessWithStorageMeta","isStorageMeta","isSignedTransactionBoundWitnessWithStorageMeta","asTransactionBoundWitness","AsObjectFactory","create","asOptionalTransactionBoundWitness","createOptional","asTransactionBoundWitnessWithStorageMeta","asOptionalTransactionBoundWitnessWithStorageMeta","AllowedBlockPayloadSchemas","TransferSchema","ChainStakeIntentSchema","SchemaSchema","BoundWitnessSchema","HashSchema","isAllowedBlockPayloadSchema","value","isSchema","includes","isAllowedBlockPayload","isTransfer","isChainStakeIntent","isSchemaPayload","isTransactionBoundWitness","isHashPayload","isAllowedBlockPayloadWithHashStorageMeta","isHashStorageMeta","isHex","AsObjectFactory","isBoundWitness","isStorageMeta","isBlockBoundWitness","value","typedObj","isBoundWitness","Number","isInteger","block","isHex","chain","isBlockBoundWitnessWithStorageMeta","isStorageMeta","asBlockBoundWitness","AsObjectFactory","create","asOptionalBlockBoundWitness","createOptional","asBlockBoundWitnessWithStorageMeta","asOptionalBlockBoundWitnessWithStorageMeta","AsObjectFactory","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","BlockNumberSchema","isBlockNumber","asBlockNumber","create","asOptionalBlockNumber","createOptional","isBlockNumberWithSources","asBlockNumberWithSources","asOptionalBlockNumberWithSources","Steps","isPayloadOfSchemaType","ChainIdentificationPayloadSchema","isChainIdentificationPayload","isPayloadOfSchemaType","ChainInformationPayloadSchema","isChainInformationPayload","AsObjectFactory","isPayloadOfSchemaType","isStorageMeta","ChainIndexingServiceStateSchema","isChainIndexingServiceState","payload","isPayloadOfSchemaType","asChainIndexingServiceState","AsObjectFactory","create","isChainIndexingServiceStateWithStorageMeta","value","isStorageMeta","asChainIndexingServiceStateWithStorageMeta","asOptionalChainIndexingServiceStateWithStorageMeta","createOptional"]}
1
+ {"version":3,"sources":["../../src/ethereum.ts","../../src/network/Status.ts","../../src/payload/elevatable/ChainStakeIntent.ts","../../src/payload/elevatable/Executable.ts","../../src/payload/elevatable/Hash.ts","../../src/payload/elevatable/TransferPayload.ts","../../src/protocol/AllowedBlockPayload.ts","../../src/protocol/TransactionBoundWitness.ts","../../src/protocol/BlockBoundWitness.ts","../../src/protocol/BlockNumber.ts","../../src/protocol/Steps.ts","../../src/services/Chain/ChainIdentification.ts","../../src/services/Chain/ChainInformation.ts","../../src/services/stakeIntent/ChainIndexingServiceStateSchema.ts"],"sourcesContent":["import type { Hex } from '@xylabs/hex'\nimport { toHex } from '@xylabs/hex'\nimport type { AccountInstance } from '@xyo-network/account-model'\nimport { getAddress } from 'ethers'\nimport { parseUnits } from 'ethers/utils'\n\nexport interface GasConfig {\n gasLimit?: number\n gasPrice?: bigint\n}\n\nexport const getDefaultGasConfig = (): GasConfig => {\n return {\n gasLimit: 2_000_000, // Set the gas limit\n gasPrice: parseUnits('100', 'gwei'),\n }\n}\n\nexport type EthAddress = Hex\n\nexport const ETH_ZERO_ADDRESS: EthAddress = '0x0000000000000000000000000000000000000000' as const\n\nexport const toEthAddress = (value: bigint | string | AccountInstance): EthAddress => {\n const address = (typeof value === 'object') ? value.address : value\n return getAddress(toHex(address, { prefix: true, bitLength: 160 })) as EthAddress\n}\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'\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 { AsObjectFactory } from '@xylabs/object'\nimport type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\n\nimport type { BlockDuration } from '../../protocol/BlockDuration.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: 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 { 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 './TransactionBoundWitness.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 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 { WithStorageMeta } from '@xyo-network/payload-model'\nimport { isStorageMeta } from '@xyo-network/payload-model'\n\nimport type {\n FromFields,\n OptionalExecutable,\n} from '../payload/index.ts'\nimport type { BlockDuration } from './BlockDuration.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 isSignedTransactionBoundWitnessWithStorageMeta = (value: unknown): value is WithStorageMeta<Signed<TransactionBoundWitness>> =>\n isSignedTransactionBoundWitness(value)\n && isStorageMeta(value)\n\nexport const asTransactionBoundWitness = AsObjectFactory.create(isTransactionBoundWitness)\nexport const asOptionalTransactionBoundWitness = AsObjectFactory.createOptional(isTransactionBoundWitness)\n\nexport const asTransactionBoundWitnessWithStorageMeta = AsObjectFactory.create(isTransactionBoundWitnessWithStorageMeta)\nexport const asOptionalTransactionBoundWitnessWithStorageMeta = AsObjectFactory.createOptional(isTransactionBoundWitnessWithStorageMeta)\n","import type { Hash, Hex } from '@xylabs/hex'\nimport { isHex } from '@xylabs/hex'\nimport { AsObjectFactory } from '@xylabs/object'\nimport type { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { isBoundWitness } from '@xyo-network/boundwitness-model'\nimport type { WithStorageMeta } from '@xyo-network/payload-model'\nimport { 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 isBlockBoundWitnessWithStorageMeta = (value: unknown): value is WithStorageMeta<BlockBoundWitness> => {\n return isBlockBoundWitness(value) && isStorageMeta(value)\n}\n\nexport const asBlockBoundWitness = AsObjectFactory.create(isBlockBoundWitness)\nexport const asOptionalBlockBoundWitness = AsObjectFactory.createOptional(isBlockBoundWitness)\n\nexport const asBlockBoundWitnessWithStorageMeta = AsObjectFactory.create(isBlockBoundWitnessWithStorageMeta)\nexport const asOptionalBlockBoundWitnessWithStorageMeta = AsObjectFactory.createOptional(isBlockBoundWitnessWithStorageMeta)\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","export const StepSizes = [10, 105, 1103, 11_576, 121_551, 1_276_282, 13_400_956]\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\nexport const asOptionalChainIndexingServiceStateWithStorageMeta\n= AsObjectFactory.createOptional<WithStorageMeta<ChainIndexingServiceState>>(isChainIndexingServiceStateWithStorageMeta)\n"],"mappings":";;;;AACA,SAASA,aAAa;AAEtB,SAASC,kBAAkB;AAC3B,SAASC,kBAAkB;AAOpB,IAAMC,sBAAsB,6BAAA;AACjC,SAAO;IACLC,UAAU;IACVC,UAAUC,WAAW,OAAO,MAAA;EAC9B;AACF,GALmC;AAS5B,IAAMC,mBAA+B;AAErC,IAAMC,eAAe,wBAACC,UAAAA;AAC3B,QAAMC,UAAW,OAAOD,UAAU,WAAYA,MAAMC,UAAUD;AAC9D,SAAOE,WAAWC,MAA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,OAAiCG,wBAAAA;AAClF,IAAME,mCAAmCX,iBAAgBQ,eAAyCC,wBAAAA;;;ACtClG,IAAMG,YAAY;EAAC;EAAI;EAAK;EAAM;EAAQ;EAAS;EAAW;;;;ACErE,SAASC,yBAAAA,8BAA6B;AAE/B,IAAMC,mCAAmC;AAYzC,IAAMC,+BAA+BF,uBAAkDC,gCAAAA;;;ACf9F,SAASE,yBAAAA,8BAA6B;AAE/B,IAAMC,gCAAgC;AAgBtC,IAAMC,4BAA4BF,uBAA+CC,6BAAAA;;;ACjBxF,SAASE,mBAAAA,wBAAuB;AAEhC,SAASC,yBAAAA,wBAAuBC,iBAAAA,sBAAqB;AAiB9C,IAAMC,kCAAkC;AAWxC,IAAMC,8BAA8B,wBAAkCC,YAAAA;AAC3E,SAAOC,uBAAoDH,+BAAAA,EAAiCE,OAAAA;AAC9F,GAF2C;AAGpC,IAAME,8BAA8BC,iBAAgBC,OAA6CL,2BAAAA;AAEjG,IAAMM,6CACX,wBAAkCC,UAClCP,4BAA+BO,KAAAA,KAAUC,eAAcD,KAAAA,GADvD;AAGK,IAAME,6CACXL,iBAAgBC,OAAmDC,0CAAAA;AAE9D,IAAMI,qDACXN,iBAAgBO,eAA2DL,0CAAAA;","names":["toHex","getAddress","parseUnits","getDefaultGasConfig","gasLimit","gasPrice","parseUnits","ETH_ZERO_ADDRESS","toEthAddress","value","address","getAddress","toHex","prefix","bitLength","isPayloadOfSchemaType","NetworkStatusSchema","isNetworkStatus","AsObjectFactory","isPayloadOfSchemaType","ChainStakeIntentSchema","isChainStakeIntent","x","isPayloadOfSchemaType","asNonNegativeInteger","nbf","undefined","exp","asChainStakeIntent","AsObjectFactory","create","asOptionalChainStakeIntent","createOptional","num","Number","isInteger","isAnyPayload","hasFrom","value","from","undefined","isExecutable","isAnyPayload","Array","isArray","script","asExecutable","AsObjectFactory","isPayloadOfSchemaType","HashSchema","isHashPayload","asHashPayload","create","asHashPayloadWithStorageMeta","asOptionalHashPayload","createOptional","AsObjectFactory","isPayloadOfSchemaType","TransferSchema","isTransfer","asTransfer","create","asOptionalTransfer","createOptional","BoundWitnessSchema","isHashStorageMeta","isSchema","isSchemaPayload","SchemaSchema","AsObjectFactory","isBoundWitness","isStorageMeta","isTransactionBoundWitness","value","typedObj","isBoundWitness","chain","undefined","fees","exp","nbf","isSignedTransactionBoundWitness","isSigned","$signatures","length","addresses","isTransactionBoundWitnessWithStorageMeta","isStorageMeta","isSignedTransactionBoundWitnessWithStorageMeta","asTransactionBoundWitness","AsObjectFactory","create","asOptionalTransactionBoundWitness","createOptional","asTransactionBoundWitnessWithStorageMeta","asOptionalTransactionBoundWitnessWithStorageMeta","AllowedBlockPayloadSchemas","TransferSchema","ChainStakeIntentSchema","SchemaSchema","BoundWitnessSchema","HashSchema","isAllowedBlockPayloadSchema","value","isSchema","includes","isAllowedBlockPayload","isTransfer","isChainStakeIntent","isSchemaPayload","isTransactionBoundWitness","isHashPayload","isAllowedBlockPayloadWithHashStorageMeta","isHashStorageMeta","isHex","AsObjectFactory","isBoundWitness","isStorageMeta","isBlockBoundWitness","value","typedObj","isBoundWitness","Number","isInteger","block","isHex","chain","isBlockBoundWitnessWithStorageMeta","isStorageMeta","asBlockBoundWitness","AsObjectFactory","create","asOptionalBlockBoundWitness","createOptional","asBlockBoundWitnessWithStorageMeta","asOptionalBlockBoundWitnessWithStorageMeta","AsObjectFactory","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","BlockNumberSchema","isBlockNumber","asBlockNumber","create","asOptionalBlockNumber","createOptional","isBlockNumberWithSources","asBlockNumberWithSources","asOptionalBlockNumberWithSources","StepSizes","isPayloadOfSchemaType","ChainIdentificationPayloadSchema","isChainIdentificationPayload","isPayloadOfSchemaType","ChainInformationPayloadSchema","isChainInformationPayload","AsObjectFactory","isPayloadOfSchemaType","isStorageMeta","ChainIndexingServiceStateSchema","isChainIndexingServiceState","payload","isPayloadOfSchemaType","asChainIndexingServiceState","AsObjectFactory","create","isChainIndexingServiceStateWithStorageMeta","value","isStorageMeta","asChainIndexingServiceStateWithStorageMeta","asOptionalChainIndexingServiceStateWithStorageMeta","createOptional"]}
@@ -20,12 +20,17 @@ var toEthAddress = /* @__PURE__ */ __name((value) => {
20
20
  }));
21
21
  }, "toEthAddress");
22
22
 
23
+ // src/network/Status.ts
24
+ import { isPayloadOfSchemaType } from "@xyo-network/payload-model";
25
+ var NetworkStatusSchema = "network.xyo.chain.status";
26
+ var isNetworkStatus = isPayloadOfSchemaType(NetworkStatusSchema);
27
+
23
28
  // src/payload/elevatable/ChainStakeIntent.ts
24
29
  import { AsObjectFactory } from "@xylabs/object";
25
- import { isPayloadOfSchemaType } from "@xyo-network/payload-model";
30
+ import { isPayloadOfSchemaType as isPayloadOfSchemaType2 } from "@xyo-network/payload-model";
26
31
  var ChainStakeIntentSchema = "network.xyo.chain.stake.intent";
27
32
  var isChainStakeIntent = /* @__PURE__ */ __name((x) => {
28
- return isPayloadOfSchemaType(ChainStakeIntentSchema)(x) && asNonNegativeInteger(x.nbf) !== void 0 && asNonNegativeInteger(x.exp) !== void 0;
33
+ return isPayloadOfSchemaType2(ChainStakeIntentSchema)(x) && asNonNegativeInteger(x.nbf) !== void 0 && asNonNegativeInteger(x.exp) !== void 0;
29
34
  }, "isChainStakeIntent");
30
35
  var asChainStakeIntent = AsObjectFactory.create(isChainStakeIntent);
31
36
  var asOptionalChainStakeIntent = AsObjectFactory.createOptional(isChainStakeIntent);
@@ -47,18 +52,18 @@ var asExecutable = /* @__PURE__ */ __name((value) => {
47
52
 
48
53
  // src/payload/elevatable/Hash.ts
49
54
  import { AsObjectFactory as AsObjectFactory2 } from "@xylabs/object";
50
- import { isPayloadOfSchemaType as isPayloadOfSchemaType2 } from "@xyo-network/payload-model";
55
+ import { isPayloadOfSchemaType as isPayloadOfSchemaType3 } from "@xyo-network/payload-model";
51
56
  var HashSchema = "network.xyo.hash";
52
- var isHashPayload = isPayloadOfSchemaType2(HashSchema);
57
+ var isHashPayload = isPayloadOfSchemaType3(HashSchema);
53
58
  var asHashPayload = AsObjectFactory2.create(isHashPayload);
54
59
  var asHashPayloadWithStorageMeta = AsObjectFactory2.create(isHashPayload);
55
60
  var asOptionalHashPayload = AsObjectFactory2.createOptional(isHashPayload);
56
61
 
57
62
  // src/payload/elevatable/TransferPayload.ts
58
63
  import { AsObjectFactory as AsObjectFactory3 } from "@xylabs/object";
59
- import { isPayloadOfSchemaType as isPayloadOfSchemaType3 } from "@xyo-network/payload-model";
64
+ import { isPayloadOfSchemaType as isPayloadOfSchemaType4 } from "@xyo-network/payload-model";
60
65
  var TransferSchema = "network.xyo.transfer";
61
- var isTransfer = isPayloadOfSchemaType3(TransferSchema);
66
+ var isTransfer = isPayloadOfSchemaType4(TransferSchema);
62
67
  var asTransfer = AsObjectFactory3.create(isTransfer);
63
68
  var asOptionalTransfer = AsObjectFactory3.createOptional(isTransfer);
64
69
 
@@ -123,9 +128,9 @@ var asOptionalBlockBoundWitnessWithStorageMeta = AsObjectFactory5.createOptional
123
128
 
124
129
  // src/protocol/BlockNumber.ts
125
130
  import { AsObjectFactory as AsObjectFactory6 } from "@xylabs/object";
126
- import { isPayloadOfSchemaType as isPayloadOfSchemaType4, isPayloadOfSchemaTypeWithSources } from "@xyo-network/payload-model";
131
+ import { isPayloadOfSchemaType as isPayloadOfSchemaType5, isPayloadOfSchemaTypeWithSources } from "@xyo-network/payload-model";
127
132
  var BlockNumberSchema = "network.xyo.chain.block.number";
128
- var isBlockNumber = isPayloadOfSchemaType4(BlockNumberSchema);
133
+ var isBlockNumber = isPayloadOfSchemaType5(BlockNumberSchema);
129
134
  var asBlockNumber = AsObjectFactory6.create(isBlockNumber);
130
135
  var asOptionalBlockNumber = AsObjectFactory6.createOptional(isBlockNumber);
131
136
  var isBlockNumberWithSources = isPayloadOfSchemaTypeWithSources(BlockNumberSchema);
@@ -133,7 +138,7 @@ var asBlockNumberWithSources = AsObjectFactory6.create(isBlockNumberWithSources)
133
138
  var asOptionalBlockNumberWithSources = AsObjectFactory6.createOptional(isBlockNumberWithSources);
134
139
 
135
140
  // src/protocol/Steps.ts
136
- var Steps = [
141
+ var StepSizes = [
137
142
  10,
138
143
  105,
139
144
  1103,
@@ -144,21 +149,21 @@ var Steps = [
144
149
  ];
145
150
 
146
151
  // src/services/Chain/ChainIdentification.ts
147
- import { isPayloadOfSchemaType as isPayloadOfSchemaType5 } from "@xyo-network/payload-model";
152
+ import { isPayloadOfSchemaType as isPayloadOfSchemaType6 } from "@xyo-network/payload-model";
148
153
  var ChainIdentificationPayloadSchema = "network.xyo.chain.identification";
149
- var isChainIdentificationPayload = isPayloadOfSchemaType5(ChainIdentificationPayloadSchema);
154
+ var isChainIdentificationPayload = isPayloadOfSchemaType6(ChainIdentificationPayloadSchema);
150
155
 
151
156
  // src/services/Chain/ChainInformation.ts
152
- import { isPayloadOfSchemaType as isPayloadOfSchemaType6 } from "@xyo-network/payload-model";
157
+ import { isPayloadOfSchemaType as isPayloadOfSchemaType7 } from "@xyo-network/payload-model";
153
158
  var ChainInformationPayloadSchema = "network.xyo.chain.information";
154
- var isChainInformationPayload = isPayloadOfSchemaType6(ChainInformationPayloadSchema);
159
+ var isChainInformationPayload = isPayloadOfSchemaType7(ChainInformationPayloadSchema);
155
160
 
156
161
  // src/services/stakeIntent/ChainIndexingServiceStateSchema.ts
157
162
  import { AsObjectFactory as AsObjectFactory7 } from "@xylabs/object";
158
- import { isPayloadOfSchemaType as isPayloadOfSchemaType7, isStorageMeta as isStorageMeta3 } from "@xyo-network/payload-model";
163
+ import { isPayloadOfSchemaType as isPayloadOfSchemaType8, isStorageMeta as isStorageMeta3 } from "@xyo-network/payload-model";
159
164
  var ChainIndexingServiceStateSchema = "network.xyo.chain.indexing.service.state";
160
165
  var isChainIndexingServiceState = /* @__PURE__ */ __name((payload) => {
161
- return isPayloadOfSchemaType7(ChainIndexingServiceStateSchema)(payload);
166
+ return isPayloadOfSchemaType8(ChainIndexingServiceStateSchema)(payload);
162
167
  }, "isChainIndexingServiceState");
163
168
  var asChainIndexingServiceState = AsObjectFactory7.create(isChainIndexingServiceState);
164
169
  var isChainIndexingServiceStateWithStorageMeta = /* @__PURE__ */ __name((value) => isChainIndexingServiceState(value) && isStorageMeta3(value), "isChainIndexingServiceStateWithStorageMeta");
@@ -173,7 +178,8 @@ export {
173
178
  ChainStakeIntentSchema,
174
179
  ETH_ZERO_ADDRESS,
175
180
  HashSchema,
176
- Steps,
181
+ NetworkStatusSchema,
182
+ StepSizes,
177
183
  TransferSchema,
178
184
  asBlockBoundWitness,
179
185
  asBlockBoundWitnessWithStorageMeta,
@@ -214,6 +220,7 @@ export {
214
220
  isChainStakeIntent,
215
221
  isExecutable,
216
222
  isHashPayload,
223
+ isNetworkStatus,
217
224
  isSigned,
218
225
  isSignedTransactionBoundWitness,
219
226
  isSignedTransactionBoundWitnessWithStorageMeta,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ethereum.ts","../../src/payload/elevatable/ChainStakeIntent.ts","../../src/payload/elevatable/Executable.ts","../../src/payload/elevatable/Hash.ts","../../src/payload/elevatable/TransferPayload.ts","../../src/protocol/AllowedBlockPayload.ts","../../src/protocol/TransactionBoundWitness.ts","../../src/protocol/BlockBoundWitness.ts","../../src/protocol/BlockNumber.ts","../../src/protocol/Steps.ts","../../src/services/Chain/ChainIdentification.ts","../../src/services/Chain/ChainInformation.ts","../../src/services/stakeIntent/ChainIndexingServiceStateSchema.ts"],"sourcesContent":["import type { Hex } from '@xylabs/hex'\nimport { toHex } from '@xylabs/hex'\nimport type { AccountInstance } from '@xyo-network/account-model'\nimport { getAddress } from 'ethers'\nimport { parseUnits } from 'ethers/utils'\n\nexport interface GasConfig {\n gasLimit?: number\n gasPrice?: bigint\n}\n\nexport const getDefaultGasConfig = (): GasConfig => {\n return {\n gasLimit: 2_000_000, // Set the gas limit\n gasPrice: parseUnits('100', 'gwei'),\n }\n}\n\nexport type EthAddress = Hex\n\nexport const ETH_ZERO_ADDRESS: EthAddress = '0x0000000000000000000000000000000000000000' as const\n\nexport const toEthAddress = (value: bigint | string | AccountInstance): EthAddress => {\n const address = (typeof value === 'object') ? value.address : value\n return getAddress(toHex(address, { prefix: true, bitLength: 160 })) as EthAddress\n}\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 '../../protocol/BlockDuration.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: 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 { 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 './TransactionBoundWitness.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 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 { WithStorageMeta } from '@xyo-network/payload-model'\nimport { isStorageMeta } from '@xyo-network/payload-model'\n\nimport type {\n FromFields,\n OptionalExecutable,\n} from '../payload/index.ts'\nimport type { BlockDuration } from './BlockDuration.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 isSignedTransactionBoundWitnessWithStorageMeta = (value: unknown): value is WithStorageMeta<Signed<TransactionBoundWitness>> =>\n isSignedTransactionBoundWitness(value)\n && isStorageMeta(value)\n\nexport const asTransactionBoundWitness = AsObjectFactory.create(isTransactionBoundWitness)\nexport const asOptionalTransactionBoundWitness = AsObjectFactory.createOptional(isTransactionBoundWitness)\n\nexport const asTransactionBoundWitnessWithStorageMeta = AsObjectFactory.create(isTransactionBoundWitnessWithStorageMeta)\nexport const asOptionalTransactionBoundWitnessWithStorageMeta = AsObjectFactory.createOptional(isTransactionBoundWitnessWithStorageMeta)\n","import type { Hash, Hex } from '@xylabs/hex'\nimport { isHex } from '@xylabs/hex'\nimport { AsObjectFactory } from '@xylabs/object'\nimport type { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { isBoundWitness } from '@xyo-network/boundwitness-model'\nimport type { WithStorageMeta } from '@xyo-network/payload-model'\nimport { 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 isBlockBoundWitnessWithStorageMeta = (value: unknown): value is WithStorageMeta<BlockBoundWitness> => {\n return isBlockBoundWitness(value) && isStorageMeta(value)\n}\n\nexport const asBlockBoundWitness = AsObjectFactory.create(isBlockBoundWitness)\nexport const asOptionalBlockBoundWitness = AsObjectFactory.createOptional(isBlockBoundWitness)\n\nexport const asBlockBoundWitnessWithStorageMeta = AsObjectFactory.create(isBlockBoundWitnessWithStorageMeta)\nexport const asOptionalBlockBoundWitnessWithStorageMeta = AsObjectFactory.createOptional(isBlockBoundWitnessWithStorageMeta)\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","export const Steps = [10, 105, 1103, 11_576, 121_551, 1_276_282, 13_400_956]\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\nexport const asOptionalChainIndexingServiceStateWithStorageMeta\n= AsObjectFactory.createOptional<WithStorageMeta<ChainIndexingServiceState>>(isChainIndexingServiceStateWithStorageMeta)\n"],"mappings":";;;;AACA,SAASA,aAAa;AAEtB,SAASC,kBAAkB;AAC3B,SAASC,kBAAkB;AAOpB,IAAMC,sBAAsB,6BAAA;AACjC,SAAO;IACLC,UAAU;IACVC,UAAUC,WAAW,OAAO,MAAA;EAC9B;AACF,GALmC;AAS5B,IAAMC,mBAA+B;AAErC,IAAMC,eAAe,wBAACC,UAAAA;AAC3B,QAAMC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AAmCX,iBAAgBQ,eAAyCC,wBAAAA;;;ACtClG,IAAMG,QAAQ;EAAC;EAAI;EAAK;EAAM;EAAQ;EAAS;EAAW;;;;ACEjE,SAASC,yBAAAA,8BAA6B;AAE/B,IAAMC,mCAAmC;AAYzC,IAAMC,+BAA+BF,uBAAkDC,gCAAAA;;;ACf9F,SAASE,yBAAAA,8BAA6B;AAE/B,IAAMC,gCAAgC;AAgBtC,IAAMC,4BAA4BF,uBAA+CC,6BAAAA;;;ACjBxF,SAASE,mBAAAA,wBAAuB;AAEhC,SAASC,yBAAAA,wBAAuBC,iBAAAA,sBAAqB;AAiB9C,IAAMC,kCAAkC;AAWxC,IAAMC,8BAA8B,wBAAkCC,YAAAA;AAC3E,SAAOC,uBAAoDH,+BAAAA,EAAiCE,OAAAA;AAC9F,GAF2C;AAGpC,IAAME,8BAA8BC,iBAAgBC,OAA6CL,2BAAAA;AAEjG,IAAMM,6CACX,wBAAkCC,UAClCP,4BAA+BO,KAAAA,KAAUC,eAAcD,KAAAA,GADvD;AAGK,IAAME,6CACXL,iBAAgBC,OAAmDC,0CAAAA;AAE9D,IAAMI,qDACXN,iBAAgBO,eAA2DL,0CAAAA;","names":["toHex","getAddress","parseUnits","getDefaultGasConfig","gasLimit","gasPrice","parseUnits","ETH_ZERO_ADDRESS","toEthAddress","value","address","getAddress","toHex","prefix","bitLength","AsObjectFactory","isPayloadOfSchemaType","ChainStakeIntentSchema","isChainStakeIntent","x","isPayloadOfSchemaType","asNonNegativeInteger","nbf","undefined","exp","asChainStakeIntent","AsObjectFactory","create","asOptionalChainStakeIntent","createOptional","num","Number","isInteger","isAnyPayload","hasFrom","value","from","undefined","isExecutable","isAnyPayload","Array","isArray","script","asExecutable","AsObjectFactory","isPayloadOfSchemaType","HashSchema","isHashPayload","asHashPayload","create","asHashPayloadWithStorageMeta","asOptionalHashPayload","createOptional","AsObjectFactory","isPayloadOfSchemaType","TransferSchema","isTransfer","asTransfer","create","asOptionalTransfer","createOptional","BoundWitnessSchema","isHashStorageMeta","isSchema","isSchemaPayload","SchemaSchema","AsObjectFactory","isBoundWitness","isStorageMeta","isTransactionBoundWitness","value","typedObj","isBoundWitness","chain","undefined","fees","exp","nbf","isSignedTransactionBoundWitness","isSigned","$signatures","length","addresses","isTransactionBoundWitnessWithStorageMeta","isStorageMeta","isSignedTransactionBoundWitnessWithStorageMeta","asTransactionBoundWitness","AsObjectFactory","create","asOptionalTransactionBoundWitness","createOptional","asTransactionBoundWitnessWithStorageMeta","asOptionalTransactionBoundWitnessWithStorageMeta","AllowedBlockPayloadSchemas","TransferSchema","ChainStakeIntentSchema","SchemaSchema","BoundWitnessSchema","HashSchema","isAllowedBlockPayloadSchema","value","isSchema","includes","isAllowedBlockPayload","isTransfer","isChainStakeIntent","isSchemaPayload","isTransactionBoundWitness","isHashPayload","isAllowedBlockPayloadWithHashStorageMeta","isHashStorageMeta","isHex","AsObjectFactory","isBoundWitness","isStorageMeta","isBlockBoundWitness","value","typedObj","isBoundWitness","Number","isInteger","block","isHex","chain","isBlockBoundWitnessWithStorageMeta","isStorageMeta","asBlockBoundWitness","AsObjectFactory","create","asOptionalBlockBoundWitness","createOptional","asBlockBoundWitnessWithStorageMeta","asOptionalBlockBoundWitnessWithStorageMeta","AsObjectFactory","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","BlockNumberSchema","isBlockNumber","asBlockNumber","create","asOptionalBlockNumber","createOptional","isBlockNumberWithSources","asBlockNumberWithSources","asOptionalBlockNumberWithSources","Steps","isPayloadOfSchemaType","ChainIdentificationPayloadSchema","isChainIdentificationPayload","isPayloadOfSchemaType","ChainInformationPayloadSchema","isChainInformationPayload","AsObjectFactory","isPayloadOfSchemaType","isStorageMeta","ChainIndexingServiceStateSchema","isChainIndexingServiceState","payload","isPayloadOfSchemaType","asChainIndexingServiceState","AsObjectFactory","create","isChainIndexingServiceStateWithStorageMeta","value","isStorageMeta","asChainIndexingServiceStateWithStorageMeta","asOptionalChainIndexingServiceStateWithStorageMeta","createOptional"]}
1
+ {"version":3,"sources":["../../src/ethereum.ts","../../src/network/Status.ts","../../src/payload/elevatable/ChainStakeIntent.ts","../../src/payload/elevatable/Executable.ts","../../src/payload/elevatable/Hash.ts","../../src/payload/elevatable/TransferPayload.ts","../../src/protocol/AllowedBlockPayload.ts","../../src/protocol/TransactionBoundWitness.ts","../../src/protocol/BlockBoundWitness.ts","../../src/protocol/BlockNumber.ts","../../src/protocol/Steps.ts","../../src/services/Chain/ChainIdentification.ts","../../src/services/Chain/ChainInformation.ts","../../src/services/stakeIntent/ChainIndexingServiceStateSchema.ts"],"sourcesContent":["import type { Hex } from '@xylabs/hex'\nimport { toHex } from '@xylabs/hex'\nimport type { AccountInstance } from '@xyo-network/account-model'\nimport { getAddress } from 'ethers'\nimport { parseUnits } from 'ethers/utils'\n\nexport interface GasConfig {\n gasLimit?: number\n gasPrice?: bigint\n}\n\nexport const getDefaultGasConfig = (): GasConfig => {\n return {\n gasLimit: 2_000_000, // Set the gas limit\n gasPrice: parseUnits('100', 'gwei'),\n }\n}\n\nexport type EthAddress = Hex\n\nexport const ETH_ZERO_ADDRESS: EthAddress = '0x0000000000000000000000000000000000000000' as const\n\nexport const toEthAddress = (value: bigint | string | AccountInstance): EthAddress => {\n const address = (typeof value === 'object') ? value.address : value\n return getAddress(toHex(address, { prefix: true, bitLength: 160 })) as EthAddress\n}\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'\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 { AsObjectFactory } from '@xylabs/object'\nimport type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\n\nimport type { BlockDuration } from '../../protocol/BlockDuration.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: 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 { 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 './TransactionBoundWitness.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 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 { WithStorageMeta } from '@xyo-network/payload-model'\nimport { isStorageMeta } from '@xyo-network/payload-model'\n\nimport type {\n FromFields,\n OptionalExecutable,\n} from '../payload/index.ts'\nimport type { BlockDuration } from './BlockDuration.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 isSignedTransactionBoundWitnessWithStorageMeta = (value: unknown): value is WithStorageMeta<Signed<TransactionBoundWitness>> =>\n isSignedTransactionBoundWitness(value)\n && isStorageMeta(value)\n\nexport const asTransactionBoundWitness = AsObjectFactory.create(isTransactionBoundWitness)\nexport const asOptionalTransactionBoundWitness = AsObjectFactory.createOptional(isTransactionBoundWitness)\n\nexport const asTransactionBoundWitnessWithStorageMeta = AsObjectFactory.create(isTransactionBoundWitnessWithStorageMeta)\nexport const asOptionalTransactionBoundWitnessWithStorageMeta = AsObjectFactory.createOptional(isTransactionBoundWitnessWithStorageMeta)\n","import type { Hash, Hex } from '@xylabs/hex'\nimport { isHex } from '@xylabs/hex'\nimport { AsObjectFactory } from '@xylabs/object'\nimport type { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { isBoundWitness } from '@xyo-network/boundwitness-model'\nimport type { WithStorageMeta } from '@xyo-network/payload-model'\nimport { 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 isBlockBoundWitnessWithStorageMeta = (value: unknown): value is WithStorageMeta<BlockBoundWitness> => {\n return isBlockBoundWitness(value) && isStorageMeta(value)\n}\n\nexport const asBlockBoundWitness = AsObjectFactory.create(isBlockBoundWitness)\nexport const asOptionalBlockBoundWitness = AsObjectFactory.createOptional(isBlockBoundWitness)\n\nexport const asBlockBoundWitnessWithStorageMeta = AsObjectFactory.create(isBlockBoundWitnessWithStorageMeta)\nexport const asOptionalBlockBoundWitnessWithStorageMeta = AsObjectFactory.createOptional(isBlockBoundWitnessWithStorageMeta)\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","export const StepSizes = [10, 105, 1103, 11_576, 121_551, 1_276_282, 13_400_956]\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\nexport const asOptionalChainIndexingServiceStateWithStorageMeta\n= AsObjectFactory.createOptional<WithStorageMeta<ChainIndexingServiceState>>(isChainIndexingServiceStateWithStorageMeta)\n"],"mappings":";;;;AACA,SAASA,aAAa;AAEtB,SAASC,kBAAkB;AAC3B,SAASC,kBAAkB;AAOpB,IAAMC,sBAAsB,6BAAA;AACjC,SAAO;IACLC,UAAU;IACVC,UAAUC,WAAW,OAAO,MAAA;EAC9B;AACF,GALmC;AAS5B,IAAMC,mBAA+B;AAErC,IAAMC,eAAe,wBAACC,UAAAA;AAC3B,QAAMC,UAAW,OAAOD,UAAU,WAAYA,MAAMC,UAAUD;AAC9D,SAAOE,WAAWC,MAAMF,SAAS;IAAEG,QAAQ;IAAMC,WAA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mCX,iBAAgBQ,eAAyCC,wBAAAA;;;ACtClG,IAAMG,YAAY;EAAC;EAAI;EAAK;EAAM;EAAQ;EAAS;EAAW;;;;ACErE,SAASC,yBAAAA,8BAA6B;AAE/B,IAAMC,mCAAmC;AAYzC,IAAMC,+BAA+BF,uBAAkDC,gCAAAA;;;ACf9F,SAASE,yBAAAA,8BAA6B;AAE/B,IAAMC,gCAAgC;AAgBtC,IAAMC,4BAA4BF,uBAA+CC,6BAAAA;;;ACjBxF,SAASE,mBAAAA,wBAAuB;AAEhC,SAASC,yBAAAA,wBAAuBC,iBAAAA,sBAAqB;AAiB9C,IAAMC,kCAAkC;AAWxC,IAAMC,8BAA8B,wBAAkCC,YAAAA;AAC3E,SAAOC,uBAAoDH,+BAAAA,EAAiCE,OAAAA;AAC9F,GAF2C;AAGpC,IAAME,8BAA8BC,iBAAgBC,OAA6CL,2BAAAA;AAEjG,IAAMM,6CACX,wBAAkCC,UAClCP,4BAA+BO,KAAAA,KAAUC,eAAcD,KAAAA,GADvD;AAGK,IAAME,6CACXL,iBAAgBC,OAAmDC,0CAAAA;AAE9D,IAAMI,qDACXN,iBAAgBO,eAA2DL,0CAAAA;","names":["toHex","getAddress","parseUnits","getDefaultGasConfig","gasLimit","gasPrice","parseUnits","ETH_ZERO_ADDRESS","toEthAddress","value","address","getAddress","toHex","prefix","bitLength","isPayloadOfSchemaType","NetworkStatusSchema","isNetworkStatus","AsObjectFactory","isPayloadOfSchemaType","ChainStakeIntentSchema","isChainStakeIntent","x","isPayloadOfSchemaType","asNonNegativeInteger","nbf","undefined","exp","asChainStakeIntent","AsObjectFactory","create","asOptionalChainStakeIntent","createOptional","num","Number","isInteger","isAnyPayload","hasFrom","value","from","undefined","isExecutable","isAnyPayload","Array","isArray","script","asExecutable","AsObjectFactory","isPayloadOfSchemaType","HashSchema","isHashPayload","asHashPayload","create","asHashPayloadWithStorageMeta","asOptionalHashPayload","createOptional","AsObjectFactory","isPayloadOfSchemaType","TransferSchema","isTransfer","asTransfer","create","asOptionalTransfer","createOptional","BoundWitnessSchema","isHashStorageMeta","isSchema","isSchemaPayload","SchemaSchema","AsObjectFactory","isBoundWitness","isStorageMeta","isTransactionBoundWitness","value","typedObj","isBoundWitness","chain","undefined","fees","exp","nbf","isSignedTransactionBoundWitness","isSigned","$signatures","length","addresses","isTransactionBoundWitnessWithStorageMeta","isStorageMeta","isSignedTransactionBoundWitnessWithStorageMeta","asTransactionBoundWitness","AsObjectFactory","create","asOptionalTransactionBoundWitness","createOptional","asTransactionBoundWitnessWithStorageMeta","asOptionalTransactionBoundWitnessWithStorageMeta","AllowedBlockPayloadSchemas","TransferSchema","ChainStakeIntentSchema","SchemaSchema","BoundWitnessSchema","HashSchema","isAllowedBlockPayloadSchema","value","isSchema","includes","isAllowedBlockPayload","isTransfer","isChainStakeIntent","isSchemaPayload","isTransactionBoundWitness","isHashPayload","isAllowedBlockPayloadWithHashStorageMeta","isHashStorageMeta","isHex","AsObjectFactory","isBoundWitness","isStorageMeta","isBlockBoundWitness","value","typedObj","isBoundWitness","Number","isInteger","block","isHex","chain","isBlockBoundWitnessWithStorageMeta","isStorageMeta","asBlockBoundWitness","AsObjectFactory","create","asOptionalBlockBoundWitness","createOptional","asBlockBoundWitnessWithStorageMeta","asOptionalBlockBoundWitnessWithStorageMeta","AsObjectFactory","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","BlockNumberSchema","isBlockNumber","asBlockNumber","create","asOptionalBlockNumber","createOptional","isBlockNumberWithSources","asBlockNumberWithSources","asOptionalBlockNumberWithSources","StepSizes","isPayloadOfSchemaType","ChainIdentificationPayloadSchema","isChainIdentificationPayload","isPayloadOfSchemaType","ChainInformationPayloadSchema","isChainInformationPayload","AsObjectFactory","isPayloadOfSchemaType","isStorageMeta","ChainIndexingServiceStateSchema","isChainIndexingServiceState","payload","isPayloadOfSchemaType","asChainIndexingServiceState","AsObjectFactory","create","isChainIndexingServiceStateWithStorageMeta","value","isStorageMeta","asChainIndexingServiceStateWithStorageMeta","asOptionalChainIndexingServiceStateWithStorageMeta","createOptional"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ChainIterator.d.ts","sourceRoot":"","sources":["../../src/ChainIterator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAA;AAEpE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AACzE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAC5D,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAC/E,OAAO,KAAK,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAEjF,MAAM,WAAW,aAAa,CAAC,IAAI,EAAE,KAAK,CAAE,SAAQ,cAAc,CAAC,IAAI,EAAE,iBAAiB,CAAC,EAAE,kBAAkB,CAAC,IAAI,EAAE,iBAAiB,CAAC;IACtI,mBAAmB,EAAE,mBAAmB,CAAA;IACxC,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,CAAA;IACtB,QAAQ,CAAC,MAAM,CAAC,EAAE,IAAI,GAAG,SAAS,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAA;IACjF,UAAU,CAAC,IAAI,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACvC;AAED,MAAM,WAAW,qBAAqB,CAAC,IAAI,EAAE,KAAK,CAAE,SAAQ,aAAa,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,WAAW,CAAC,UAAU,EAAE,sBAAsB,CAAC;CAAG;AAE1I,MAAM,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,CAAC,MAAM,CAAC,EAAE,IAAI,GAAG,SAAS,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAA;IACjF,UAAU,CAAC,IAAI,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACvC;AAED,MAAM,WAAW,qBAAqB,CAAC,IAAI,EAAE,KAAK,CAAE,SAAQ,aAAa,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,WAAW,CAAC,UAAU,EAAE,sBAAsB,CAAC;CAAI;AAE3I,MAAM,WAAW,wBAAyB,SAAQ,aAAa,CAAC,MAAM,EAAE,iBAAiB,CAAC;CAAI;AAC9F,MAAM,WAAW,gCAAiC,SAAQ,qBAAqB,CAAC,MAAM,EAAE,iBAAiB,CAAC;CAAI;AAE9G,MAAM,WAAW,iBAAkB,SAAQ,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC;CAAI;AACxE,MAAM,WAAW,yBAA0B,SAAQ,qBAAqB,CAAC,IAAI,EAAE,IAAI,CAAC;CAAI;AAExF,MAAM,WAAW,sBAAuB,SAAQ,iBAAiB;IAC/D,cAAc,EAAE,iBAAiB,CAAA;IACjC,IAAI,EAAE,iBAAiB,CAAA;CACxB"}
@@ -3,6 +3,7 @@ export * from './chain/index.ts';
3
3
  export * from './ChainIterator.ts';
4
4
  export * from './ChainIteratorEventData.ts';
5
5
  export * from './ethereum.ts';
6
+ export * from './network/index.ts';
6
7
  export * from './OpenTelemetryProviders.ts';
7
8
  export * from './payload/index.ts';
8
9
  export * from './protocol/index.ts';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA;AAChC,cAAc,oBAAoB,CAAA;AAClC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,eAAe,CAAA;AAC7B,cAAc,6BAA6B,CAAA;AAC3C,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AACrC,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA;AAChC,cAAc,oBAAoB,CAAA;AAClC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,eAAe,CAAA;AAC7B,cAAc,oBAAoB,CAAA;AAClC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AACrC,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA"}
@@ -0,0 +1,17 @@
1
+ import type { Payload } from '@xyo-network/payload-model';
2
+ export declare const NetworkStatusSchema: "network.xyo.chain.status";
3
+ export type NetworkStatusSchema = typeof NetworkStatusSchema;
4
+ export type NetworkStatusState = 'online' | 'offline' | 'degraded';
5
+ export type NetworkStatusUpdate = {
6
+ end: number;
7
+ start: number;
8
+ update: string;
9
+ };
10
+ export interface NetworkStatusFields {
11
+ description: string;
12
+ state: NetworkStatusState;
13
+ updates?: NetworkStatusUpdate[];
14
+ }
15
+ export type NetworkStatus = Payload<NetworkStatusFields, NetworkStatusSchema>;
16
+ export declare const isNetworkStatus: (x?: unknown | null) => x is NetworkStatus;
17
+ //# sourceMappingURL=Status.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Status.d.ts","sourceRoot":"","sources":["../../../src/network/Status.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAGzD,eAAO,MAAM,mBAAmB,EAAG,0BAAmC,CAAA;AACtE,MAAM,MAAM,mBAAmB,GAAG,OAAO,mBAAmB,CAAA;AAE5D,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,CAAA;AAElE,MAAM,MAAM,mBAAmB,GAAG;IAChC,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,kBAAkB,CAAA;IACzB,OAAO,CAAC,EAAE,mBAAmB,EAAE,CAAA;CAChC;AAED,MAAM,MAAM,aAAa,GAAG,OAAO,CAAC,mBAAmB,EAAE,mBAAmB,CAAC,CAAA;AAE7E,eAAO,MAAM,eAAe,4CAA4D,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './Status.ts';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/network/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA"}
@@ -1,2 +1,2 @@
1
- export declare const Steps: number[];
1
+ export declare const StepSizes: number[];
2
2
  //# sourceMappingURL=Steps.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Steps.d.ts","sourceRoot":"","sources":["../../../src/protocol/Steps.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,UAA0D,CAAA"}
1
+ {"version":3,"file":"Steps.d.ts","sourceRoot":"","sources":["../../../src/protocol/Steps.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,UAA0D,CAAA"}
@@ -0,0 +1,6 @@
1
+ import type { Promisable } from '@xylabs/promise';
2
+ import type { NetworkStatus } from '../network/index.ts';
3
+ export interface XyoNetwork {
4
+ status(): Promisable<NetworkStatus>;
5
+ }
6
+ //# sourceMappingURL=XyoNetwork.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"XyoNetwork.d.ts","sourceRoot":"","sources":["../../../src/provider/XyoNetwork.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAExD,MAAM,WAAW,UAAU;IACzB,MAAM,IAAI,UAAU,CAAC,aAAa,CAAC,CAAA;CACpC"}
@@ -2,12 +2,14 @@ import type { Address } from '@xylabs/hex';
2
2
  import type { Signed } from '@xyo-network/boundwitness-model';
3
3
  import type { Payload } from '@xyo-network/payload-model';
4
4
  import type { AllowedBlockPayload, TransactionBoundWitness, TransactionFeesBigInt } from '../protocol/index.ts';
5
+ import type { XyoNetwork } from './XyoNetwork.ts';
5
6
  import type { XyoRunner } from './XyoRunner.ts';
6
7
  import type { XyoSigner } from './XyoSigner.ts';
7
8
  import type { XyoStorage } from './XyoStorage.ts';
8
9
  import type { XyoViewer } from './XyoViewer.ts';
9
10
  import type { XyoWallet } from './XyoWallet.ts';
10
11
  export interface XyoProvider {
12
+ network?: XyoNetwork;
11
13
  runner?: XyoRunner;
12
14
  send?: (elevatedPayloads: AllowedBlockPayload[], additionalPayloads: Payload[], chain?: Address, nbf?: number, exp?: number, from?: Address, fees?: TransactionFeesBigInt) => Promise<Signed<TransactionBoundWitness>>;
13
15
  signer?: XyoSigner;
@@ -1 +1 @@
1
- {"version":3,"file":"XyoProvider.d.ts","sourceRoot":"","sources":["../../../src/provider/XyoProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AAC7D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEzD,OAAO,KAAK,EACV,mBAAmB,EAAE,uBAAuB,EAAE,qBAAqB,EACpE,MAAM,sBAAsB,CAAA;AAC7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;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AAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE/C,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,EAAE,UAAU,CAAA;IACpB,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,IAAI,CAAC,EAAE,CACL,gBAAgB,EAAE,mBAAmB,EAAE,EACvC,kBAAkB,EAAE,OAAO,EAAE,EAC7B,KAAK,CAAC,EAAE,OAAO,EACf,GAAG,CAAC,EAAE,MAAM,EACZ,GAAG,CAAC,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,OAAO,EACd,IAAI,CAAC,EAAE,qBAAqB,KACzB,OAAO,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAC,CAAA;IAC7C,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,OAAO,CAAC,EAAE,UAAU,CAAA;IACpB,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,MAAM,CAAC,EAAE,SAAS,CAAA;CACnB"}
@@ -1,3 +1,4 @@
1
+ export * from './XyoNetwork.ts';
1
2
  export * from './XyoProvider.ts';
2
3
  export * from './XyoRunner.ts';
3
4
  export * from './XyoSigner.ts';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/provider/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/provider/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,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.3.12",
4
+ "version": "1.3.13",
5
5
  "description": "XYO Layer One Protocol",
6
6
  "homepage": "https://xylabs.com",
7
7
  "bugs": {
@@ -31,31 +31,31 @@
31
31
  "types": "./dist/types/index.d.ts",
32
32
  "dependencies": {
33
33
  "@opentelemetry/api": "^1.9.0",
34
- "@xylabs/base": "^4.8.9",
35
- "@xylabs/hex": "^4.8.9",
36
- "@xylabs/logger": "^4.8.9",
37
- "@xylabs/object": "^4.8.9",
38
- "@xylabs/promise": "^4.8.9",
39
- "@xyo-network/account-model": "^3.14.16",
40
- "@xyo-network/archivist-model": "^3.14.16",
41
- "@xyo-network/boundwitness-model": "^3.14.16",
42
- "@xyo-network/module-event-emitter": "^3.14.16",
43
- "@xyo-network/module-events": "^3.14.16",
44
- "@xyo-network/payload-model": "^3.14.16",
45
- "@xyo-network/schema-payload-plugin": "^3.14.16",
46
- "@xyo-network/wallet-model": "^3.14.16",
47
- "ethers": "6.13.7"
34
+ "@xylabs/base": "^4.9.15",
35
+ "@xylabs/hex": "^4.9.15",
36
+ "@xylabs/logger": "^4.9.15",
37
+ "@xylabs/object": "^4.9.15",
38
+ "@xylabs/promise": "^4.9.15",
39
+ "@xyo-network/account-model": "^3.15.5",
40
+ "@xyo-network/archivist-model": "^3.15.5",
41
+ "@xyo-network/boundwitness-model": "^3.15.5",
42
+ "@xyo-network/module-event-emitter": "^3.15.5",
43
+ "@xyo-network/module-events": "^3.15.5",
44
+ "@xyo-network/payload-model": "^3.15.5",
45
+ "@xyo-network/schema-payload-plugin": "^3.15.5",
46
+ "@xyo-network/wallet-model": "^3.15.5",
47
+ "ethers": "6.14.0"
48
48
  },
49
49
  "devDependencies": {
50
- "@types/node": "^22.15.3",
50
+ "@types/node": "^22.15.17",
51
51
  "@xylabs/eslint-config-flat": "^6.5.5",
52
52
  "@xylabs/ts-scripts-yarn3": "^6.5.5",
53
53
  "@xylabs/tsconfig": "^6.5.5",
54
- "dependency-cruiser": "^16.10.1",
54
+ "dependency-cruiser": "^16.10.2",
55
55
  "dotenv": "^16.5.0",
56
56
  "eslint": "^9.26.0",
57
57
  "eslint-import-resolver-typescript": "^4.3.4",
58
- "knip": "^5.53.0",
58
+ "knip": "^5.55.1",
59
59
  "react": "^19.1.0",
60
60
  "rimraf": "^6.0.1",
61
61
  "typescript": "^5.8.3",
@@ -64,6 +64,7 @@
64
64
  "vite-tsconfig-paths": "^5.1.4",
65
65
  "vitest": "^3.1.3"
66
66
  },
67
+ "packageManager": "yarn@4.9.1",
67
68
  "engines": {
68
69
  "node": ">=22.3 <23"
69
70
  },
@@ -15,13 +15,13 @@ export interface ChainIterator<TKey, THead> extends ReadRepository<TKey, BlockBo
15
15
  updateHead(head: THead): Promise<void>
16
16
  }
17
17
 
18
- export interface EventingChainIterator<TKey, THead> extends ChainIterator<TKey, THead>, BaseEmitter<BaseParams, ChainIteratorEventData> {}
18
+ export interface EventingChainIterator<TKey, THead> extends ChainIterator<TKey, THead>, BaseEmitter<BaseParams, ChainIteratorEventData> { }
19
19
 
20
- export interface ChainBlockNumberIterator extends ChainIterator<number, BlockBoundWitness> {}
21
- export interface EventingChainBlockNumberIterator extends EventingChainIterator<number, BlockBoundWitness> {}
20
+ export interface ChainBlockNumberIterator extends ChainIterator<number, BlockBoundWitness> { }
21
+ export interface EventingChainBlockNumberIterator extends EventingChainIterator<number, BlockBoundWitness> { }
22
22
 
23
- export interface ChainHashIterator extends ChainIterator<Hash, Hash> {}
24
- export interface EventingChainHashIterator extends EventingChainIterator<Hash, Hash> {}
23
+ export interface ChainHashIterator extends ChainIterator<Hash, Hash> { }
24
+ export interface EventingChainHashIterator extends EventingChainIterator<Hash, Hash> { }
25
25
 
26
26
  export interface XyoChainIteratorParams extends BaseServiceParams {
27
27
  chainArchivist: ArchivistInstance
package/src/index.ts CHANGED
@@ -3,6 +3,7 @@ export * from './chain/index.ts'
3
3
  export * from './ChainIterator.ts'
4
4
  export * from './ChainIteratorEventData.ts'
5
5
  export * from './ethereum.ts'
6
+ export * from './network/index.ts'
6
7
  export * from './OpenTelemetryProviders.ts'
7
8
  export * from './payload/index.ts'
8
9
  export * from './protocol/index.ts'
@@ -0,0 +1,23 @@
1
+ import type { Payload } from '@xyo-network/payload-model'
2
+ import { isPayloadOfSchemaType } from '@xyo-network/payload-model'
3
+
4
+ export const NetworkStatusSchema = 'network.xyo.chain.status' as const
5
+ export type NetworkStatusSchema = typeof NetworkStatusSchema
6
+
7
+ export type NetworkStatusState = 'online' | 'offline' | 'degraded'
8
+
9
+ export type NetworkStatusUpdate = {
10
+ end: number
11
+ start: number
12
+ update: string
13
+ }
14
+
15
+ export interface NetworkStatusFields {
16
+ description: string
17
+ state: NetworkStatusState
18
+ updates?: NetworkStatusUpdate[]
19
+ }
20
+
21
+ export type NetworkStatus = Payload<NetworkStatusFields, NetworkStatusSchema>
22
+
23
+ export const isNetworkStatus = isPayloadOfSchemaType<NetworkStatus>(NetworkStatusSchema)
@@ -0,0 +1 @@
1
+ export * from './Status.ts'
@@ -1 +1 @@
1
- export const Steps = [10, 105, 1103, 11_576, 121_551, 1_276_282, 13_400_956]
1
+ export const StepSizes = [10, 105, 1103, 11_576, 121_551, 1_276_282, 13_400_956]
@@ -0,0 +1,7 @@
1
+ import type { Promisable } from '@xylabs/promise'
2
+
3
+ import type { NetworkStatus } from '../network/index.ts'
4
+
5
+ export interface XyoNetwork {
6
+ status(): Promisable<NetworkStatus>
7
+ }
@@ -5,6 +5,7 @@ import type { Payload } from '@xyo-network/payload-model'
5
5
  import type {
6
6
  AllowedBlockPayload, TransactionBoundWitness, TransactionFeesBigInt,
7
7
  } from '../protocol/index.ts'
8
+ import type { XyoNetwork } from './XyoNetwork.ts'
8
9
  import type { XyoRunner } from './XyoRunner.ts'
9
10
  import type { XyoSigner } from './XyoSigner.ts'
10
11
  import type { XyoStorage } from './XyoStorage.ts'
@@ -12,6 +13,7 @@ import type { XyoViewer } from './XyoViewer.ts'
12
13
  import type { XyoWallet } from './XyoWallet.ts'
13
14
 
14
15
  export interface XyoProvider {
16
+ network?: XyoNetwork
15
17
  runner?: XyoRunner
16
18
  send?: (
17
19
  elevatedPayloads: AllowedBlockPayload[],
@@ -1,3 +1,4 @@
1
+ export * from './XyoNetwork.ts'
1
2
  export * from './XyoProvider.ts'
2
3
  export * from './XyoRunner.ts'
3
4
  export * from './XyoSigner.ts'