@xyo-network/xl1-protocol 1.4.16 → 1.4.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/neutral/index.mjs +60 -48
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/provider/v2/index.mjs +1 -0
- package/dist/neutral/provider/v2/index.mjs.map +1 -0
- package/dist/types/payload/AtomicBoundWitness.d.ts +15 -0
- package/dist/types/payload/AtomicBoundWitness.d.ts.map +1 -0
- package/dist/types/payload/index.d.ts +1 -0
- package/dist/types/payload/index.d.ts.map +1 -1
- package/dist/types/provider/v2/ListProvider.d.ts +1 -1
- package/dist/types/provider/v2/ListProvider.d.ts.map +1 -1
- package/dist/types/provider/v2/QueueProvider.d.ts +8 -0
- package/dist/types/provider/v2/QueueProvider.d.ts.map +1 -0
- package/dist/types/provider/v2/index.d.ts +5 -0
- package/dist/types/provider/v2/index.d.ts.map +1 -1
- package/dist/types/provider/v2/viewer/Chain.d.ts +2 -0
- package/dist/types/provider/v2/viewer/Chain.d.ts.map +1 -1
- package/dist/types/provider/v2/viewer/PendingTransactions.d.ts +9 -0
- package/dist/types/provider/v2/viewer/PendingTransactions.d.ts.map +1 -0
- package/package.json +6 -1
- package/src/payload/AtomicBoundWitness.ts +18 -0
- package/src/payload/index.ts +1 -0
- package/src/provider/v2/ListProvider.ts +1 -1
- package/src/provider/v2/QueueProvider.ts +8 -0
- package/src/provider/v2/index.ts +5 -0
- package/src/provider/v2/viewer/Chain.ts +2 -0
- package/src/provider/v2/viewer/PendingTransactions.ts +10 -0
- package/xy.config.ts +2 -2
- package/dist/node/index.mjs +0 -292
- package/dist/node/index.mjs.map +0 -1
package/dist/neutral/index.mjs
CHANGED
|
@@ -3,15 +3,23 @@ import { BoundWitnessSchema } from "@xyo-network/boundwitness-model";
|
|
|
3
3
|
import { isHashStorageMeta, isSchema } from "@xyo-network/payload-model";
|
|
4
4
|
import { isSchemaPayload, SchemaSchema } from "@xyo-network/schema-payload-plugin";
|
|
5
5
|
|
|
6
|
-
// src/payload/
|
|
6
|
+
// src/payload/AtomicBoundWitness.ts
|
|
7
7
|
import { AsObjectFactory } from "@xylabs/object";
|
|
8
8
|
import { isPayloadOfSchemaType } from "@xyo-network/payload-model";
|
|
9
|
+
var AtomicBoundWitnessSchema = "network.xyo.boundwitness.atomic";
|
|
10
|
+
var isAtomicBoundWitness = isPayloadOfSchemaType(AtomicBoundWitnessSchema);
|
|
11
|
+
var asAtomicBoundWitness = AsObjectFactory.create(isAtomicBoundWitness);
|
|
12
|
+
var asOptionalAtomicBoundWitness = AsObjectFactory.createOptional(isAtomicBoundWitness);
|
|
13
|
+
|
|
14
|
+
// src/payload/elevatable/ChainStakeIntent.ts
|
|
15
|
+
import { AsObjectFactory as AsObjectFactory2 } from "@xylabs/object";
|
|
16
|
+
import { isPayloadOfSchemaType as isPayloadOfSchemaType2 } from "@xyo-network/payload-model";
|
|
9
17
|
var ChainStakeIntentSchema = "network.xyo.chain.stake.intent";
|
|
10
18
|
var isChainStakeIntent = (x) => {
|
|
11
|
-
return
|
|
19
|
+
return isPayloadOfSchemaType2(ChainStakeIntentSchema)(x) && asNonNegativeInteger(x.nbf) !== void 0 && asNonNegativeInteger(x.exp) !== void 0;
|
|
12
20
|
};
|
|
13
|
-
var asChainStakeIntent =
|
|
14
|
-
var asOptionalChainStakeIntent =
|
|
21
|
+
var asChainStakeIntent = AsObjectFactory2.create(isChainStakeIntent);
|
|
22
|
+
var asOptionalChainStakeIntent = AsObjectFactory2.createOptional(isChainStakeIntent);
|
|
15
23
|
var asNonNegativeInteger = (num) => {
|
|
16
24
|
return Number.isInteger(num) && num >= 0 ? num : void 0;
|
|
17
25
|
};
|
|
@@ -29,31 +37,31 @@ var asExecutable = (value) => {
|
|
|
29
37
|
};
|
|
30
38
|
|
|
31
39
|
// src/payload/elevatable/Hash.ts
|
|
32
|
-
import { AsObjectFactory as
|
|
33
|
-
import { isPayloadOfSchemaType as
|
|
40
|
+
import { AsObjectFactory as AsObjectFactory3 } from "@xylabs/object";
|
|
41
|
+
import { isPayloadOfSchemaType as isPayloadOfSchemaType3 } from "@xyo-network/payload-model";
|
|
34
42
|
var HashSchema = "network.xyo.hash";
|
|
35
|
-
var isHashPayload =
|
|
36
|
-
var asHashPayload =
|
|
37
|
-
var asHashPayloadWithStorageMeta =
|
|
38
|
-
var asOptionalHashPayload =
|
|
43
|
+
var isHashPayload = isPayloadOfSchemaType3(HashSchema);
|
|
44
|
+
var asHashPayload = AsObjectFactory3.create(isHashPayload);
|
|
45
|
+
var asHashPayloadWithStorageMeta = AsObjectFactory3.create(isHashPayload);
|
|
46
|
+
var asOptionalHashPayload = AsObjectFactory3.createOptional(isHashPayload);
|
|
39
47
|
|
|
40
48
|
// src/payload/elevatable/TransferPayload.ts
|
|
41
|
-
import { AsObjectFactory as
|
|
42
|
-
import { isPayloadOfSchemaType as
|
|
49
|
+
import { AsObjectFactory as AsObjectFactory4 } from "@xylabs/object";
|
|
50
|
+
import { isPayloadOfSchemaType as isPayloadOfSchemaType4 } from "@xyo-network/payload-model";
|
|
43
51
|
var TransferSchema = "network.xyo.transfer";
|
|
44
|
-
var isTransfer =
|
|
45
|
-
var asTransfer =
|
|
46
|
-
var asOptionalTransfer =
|
|
52
|
+
var isTransfer = isPayloadOfSchemaType4(TransferSchema);
|
|
53
|
+
var asTransfer = AsObjectFactory4.create(isTransfer);
|
|
54
|
+
var asOptionalTransfer = AsObjectFactory4.createOptional(isTransfer);
|
|
47
55
|
|
|
48
56
|
// src/transaction/HydratedBoundWitnessPayload.ts
|
|
49
|
-
import { AsObjectFactory as
|
|
50
|
-
import { isPayloadOfSchemaType as
|
|
57
|
+
import { AsObjectFactory as AsObjectFactory5 } from "@xylabs/object";
|
|
58
|
+
import { isPayloadOfSchemaType as isPayloadOfSchemaType5 } from "@xyo-network/payload-model";
|
|
51
59
|
var HydratedBoundWitnessSchema = "network.xyo.boundwitness.hydrated";
|
|
52
|
-
var isHydratedBoundWitnessPayload =
|
|
53
|
-
var asHydratedBoundWitnessPayload =
|
|
60
|
+
var isHydratedBoundWitnessPayload = isPayloadOfSchemaType5(HydratedBoundWitnessSchema);
|
|
61
|
+
var asHydratedBoundWitnessPayload = AsObjectFactory5.createOptional(isHydratedBoundWitnessPayload);
|
|
54
62
|
|
|
55
63
|
// src/transaction/TransactionBoundWitness.ts
|
|
56
|
-
import { AsObjectFactory as
|
|
64
|
+
import { AsObjectFactory as AsObjectFactory6 } from "@xylabs/object";
|
|
57
65
|
import { isBoundWitness } from "@xyo-network/boundwitness-model";
|
|
58
66
|
import { isStorageMeta } from "@xyo-network/payload-model";
|
|
59
67
|
var isTransactionBoundWitness = (value) => {
|
|
@@ -66,10 +74,10 @@ var isSignedTransactionBoundWitness = (value) => {
|
|
|
66
74
|
var isSigned = (value) => isBoundWitness(value) && value.$signatures.length === value.addresses.length && value.addresses.length > 0;
|
|
67
75
|
var isTransactionBoundWitnessWithStorageMeta = (value) => isTransactionBoundWitness(value) && isStorageMeta(value);
|
|
68
76
|
var isSignedTransactionBoundWitnessWithStorageMeta = (value) => isSignedTransactionBoundWitness(value) && isStorageMeta(value);
|
|
69
|
-
var asTransactionBoundWitness =
|
|
70
|
-
var asOptionalTransactionBoundWitness =
|
|
71
|
-
var asTransactionBoundWitnessWithStorageMeta =
|
|
72
|
-
var asOptionalTransactionBoundWitnessWithStorageMeta =
|
|
77
|
+
var asTransactionBoundWitness = AsObjectFactory6.create(isTransactionBoundWitness);
|
|
78
|
+
var asOptionalTransactionBoundWitness = AsObjectFactory6.createOptional(isTransactionBoundWitness);
|
|
79
|
+
var asTransactionBoundWitnessWithStorageMeta = AsObjectFactory6.create(isTransactionBoundWitnessWithStorageMeta);
|
|
80
|
+
var asOptionalTransactionBoundWitnessWithStorageMeta = AsObjectFactory6.createOptional(isTransactionBoundWitnessWithStorageMeta);
|
|
73
81
|
|
|
74
82
|
// src/block/AllowedBlockPayload.ts
|
|
75
83
|
var AllowedBlockPayloadSchemas = [TransferSchema, ChainStakeIntentSchema, SchemaSchema, BoundWitnessSchema, HashSchema];
|
|
@@ -85,7 +93,7 @@ var isAllowedBlockPayloadWithHashStorageMeta = (value) => {
|
|
|
85
93
|
|
|
86
94
|
// src/block/BlockBoundWitness.ts
|
|
87
95
|
import { isHex } from "@xylabs/hex";
|
|
88
|
-
import { AsObjectFactory as
|
|
96
|
+
import { AsObjectFactory as AsObjectFactory7 } from "@xylabs/object";
|
|
89
97
|
import { isBoundWitness as isBoundWitness2 } from "@xyo-network/boundwitness-model";
|
|
90
98
|
import { isStorageMeta as isStorageMeta2 } from "@xyo-network/payload-model";
|
|
91
99
|
var isBlockBoundWitness = (value) => {
|
|
@@ -95,10 +103,10 @@ var isBlockBoundWitness = (value) => {
|
|
|
95
103
|
var isBlockBoundWitnessWithStorageMeta = (value) => {
|
|
96
104
|
return isBlockBoundWitness(value) && isStorageMeta2(value);
|
|
97
105
|
};
|
|
98
|
-
var asBlockBoundWitness =
|
|
99
|
-
var asOptionalBlockBoundWitness =
|
|
100
|
-
var asBlockBoundWitnessWithStorageMeta =
|
|
101
|
-
var asOptionalBlockBoundWitnessWithStorageMeta =
|
|
106
|
+
var asBlockBoundWitness = AsObjectFactory7.create(isBlockBoundWitness);
|
|
107
|
+
var asOptionalBlockBoundWitness = AsObjectFactory7.createOptional(isBlockBoundWitness);
|
|
108
|
+
var asBlockBoundWitnessWithStorageMeta = AsObjectFactory7.create(isBlockBoundWitnessWithStorageMeta);
|
|
109
|
+
var asOptionalBlockBoundWitnessWithStorageMeta = AsObjectFactory7.createOptional(isBlockBoundWitnessWithStorageMeta);
|
|
102
110
|
|
|
103
111
|
// src/xl1/XL1.ts
|
|
104
112
|
var XL1 = (value) => value;
|
|
@@ -176,47 +184,48 @@ var TransactionGasCosts = {
|
|
|
176
184
|
};
|
|
177
185
|
|
|
178
186
|
// src/fields/BlockNumber.ts
|
|
179
|
-
import { AsObjectFactory as
|
|
187
|
+
import { AsObjectFactory as AsObjectFactory8 } from "@xylabs/object";
|
|
180
188
|
import {
|
|
181
|
-
isPayloadOfSchemaType as
|
|
189
|
+
isPayloadOfSchemaType as isPayloadOfSchemaType6,
|
|
182
190
|
isPayloadOfSchemaTypeWithSources
|
|
183
191
|
} from "@xyo-network/payload-model";
|
|
184
192
|
var BlockNumberSchema = "network.xyo.chain.block.number";
|
|
185
|
-
var isBlockNumber =
|
|
186
|
-
var asBlockNumber =
|
|
187
|
-
var asOptionalBlockNumber =
|
|
193
|
+
var isBlockNumber = isPayloadOfSchemaType6(BlockNumberSchema);
|
|
194
|
+
var asBlockNumber = AsObjectFactory8.create(isBlockNumber);
|
|
195
|
+
var asOptionalBlockNumber = AsObjectFactory8.createOptional(isBlockNumber);
|
|
188
196
|
var isBlockNumberWithSources = isPayloadOfSchemaTypeWithSources(BlockNumberSchema);
|
|
189
|
-
var asBlockNumberWithSources =
|
|
190
|
-
var asOptionalBlockNumberWithSources =
|
|
197
|
+
var asBlockNumberWithSources = AsObjectFactory8.create(isBlockNumberWithSources);
|
|
198
|
+
var asOptionalBlockNumberWithSources = AsObjectFactory8.createOptional(isBlockNumberWithSources);
|
|
191
199
|
|
|
192
200
|
// src/network/Status.ts
|
|
193
|
-
import { isPayloadOfSchemaType as
|
|
201
|
+
import { isPayloadOfSchemaType as isPayloadOfSchemaType7 } from "@xyo-network/payload-model";
|
|
194
202
|
var NetworkStatusSchema = "network.xyo.chain.status";
|
|
195
|
-
var isNetworkStatus =
|
|
203
|
+
var isNetworkStatus = isPayloadOfSchemaType7(NetworkStatusSchema);
|
|
196
204
|
|
|
197
205
|
// src/services/Chain/ChainIdentification.ts
|
|
198
|
-
import { isPayloadOfSchemaType as
|
|
206
|
+
import { isPayloadOfSchemaType as isPayloadOfSchemaType8 } from "@xyo-network/payload-model";
|
|
199
207
|
var ChainIdentificationPayloadSchema = "network.xyo.chain.identification";
|
|
200
|
-
var isChainIdentificationPayload =
|
|
208
|
+
var isChainIdentificationPayload = isPayloadOfSchemaType8(ChainIdentificationPayloadSchema);
|
|
201
209
|
|
|
202
210
|
// src/services/Chain/ChainInformation.ts
|
|
203
|
-
import { isPayloadOfSchemaType as
|
|
211
|
+
import { isPayloadOfSchemaType as isPayloadOfSchemaType9 } from "@xyo-network/payload-model";
|
|
204
212
|
var ChainInformationPayloadSchema = "network.xyo.chain.information";
|
|
205
|
-
var isChainInformationPayload =
|
|
213
|
+
var isChainInformationPayload = isPayloadOfSchemaType9(ChainInformationPayloadSchema);
|
|
206
214
|
|
|
207
215
|
// src/services/stakeIntent/ChainIndexingServiceStateSchema.ts
|
|
208
|
-
import { AsObjectFactory as
|
|
209
|
-
import { isPayloadOfSchemaType as
|
|
216
|
+
import { AsObjectFactory as AsObjectFactory9 } from "@xylabs/object";
|
|
217
|
+
import { isPayloadOfSchemaType as isPayloadOfSchemaType10, isStorageMeta as isStorageMeta3 } from "@xyo-network/payload-model";
|
|
210
218
|
var ChainIndexingServiceStateSchema = "network.xyo.chain.indexing.service.state";
|
|
211
219
|
var isChainIndexingServiceState = (payload) => {
|
|
212
|
-
return
|
|
220
|
+
return isPayloadOfSchemaType10(ChainIndexingServiceStateSchema)(payload);
|
|
213
221
|
};
|
|
214
|
-
var asChainIndexingServiceState =
|
|
222
|
+
var asChainIndexingServiceState = AsObjectFactory9.create(isChainIndexingServiceState);
|
|
215
223
|
var isChainIndexingServiceStateWithStorageMeta = (value) => isChainIndexingServiceState(value) && isStorageMeta3(value);
|
|
216
|
-
var asChainIndexingServiceStateWithStorageMeta =
|
|
217
|
-
var asOptionalChainIndexingServiceStateWithStorageMeta =
|
|
224
|
+
var asChainIndexingServiceStateWithStorageMeta = AsObjectFactory9.create(isChainIndexingServiceStateWithStorageMeta);
|
|
225
|
+
var asOptionalChainIndexingServiceStateWithStorageMeta = AsObjectFactory9.createOptional(isChainIndexingServiceStateWithStorageMeta);
|
|
218
226
|
export {
|
|
219
227
|
AllowedBlockPayloadSchemas,
|
|
228
|
+
AtomicBoundWitnessSchema,
|
|
220
229
|
AttoXL1,
|
|
221
230
|
AttoXL1ConvertFactor,
|
|
222
231
|
BlockNumberSchema,
|
|
@@ -238,6 +247,7 @@ export {
|
|
|
238
247
|
XL1,
|
|
239
248
|
XL1ConvertDict,
|
|
240
249
|
XL1Places,
|
|
250
|
+
asAtomicBoundWitness,
|
|
241
251
|
asBlockBoundWitness,
|
|
242
252
|
asBlockBoundWitnessWithStorageMeta,
|
|
243
253
|
asBlockNumber,
|
|
@@ -249,6 +259,7 @@ export {
|
|
|
249
259
|
asHashPayload,
|
|
250
260
|
asHashPayloadWithStorageMeta,
|
|
251
261
|
asHydratedBoundWitnessPayload,
|
|
262
|
+
asOptionalAtomicBoundWitness,
|
|
252
263
|
asOptionalBlockBoundWitness,
|
|
253
264
|
asOptionalBlockBoundWitnessWithStorageMeta,
|
|
254
265
|
asOptionalBlockNumber,
|
|
@@ -267,6 +278,7 @@ export {
|
|
|
267
278
|
isAllowedBlockPayload,
|
|
268
279
|
isAllowedBlockPayloadSchema,
|
|
269
280
|
isAllowedBlockPayloadWithHashStorageMeta,
|
|
281
|
+
isAtomicBoundWitness,
|
|
270
282
|
isBlockBoundWitness,
|
|
271
283
|
isBlockBoundWitnessWithStorageMeta,
|
|
272
284
|
isBlockNumber,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/block/AllowedBlockPayload.ts","../../src/payload/elevatable/ChainStakeIntent.ts","../../src/payload/elevatable/Executable.ts","../../src/payload/elevatable/Hash.ts","../../src/payload/elevatable/TransferPayload.ts","../../src/transaction/HydratedBoundWitnessPayload.ts","../../src/transaction/TransactionBoundWitness.ts","../../src/block/BlockBoundWitness.ts","../../src/xl1/XL1.ts","../../src/constants/minTransactionFees.ts","../../src/constants/defaultTransactionFees.ts","../../src/constants/StepSizes.ts","../../src/constants/TransactionGasCosts.ts","../../src/fields/BlockNumber.ts","../../src/network/Status.ts","../../src/services/Chain/ChainIdentification.ts","../../src/services/Chain/ChainInformation.ts","../../src/services/stakeIntent/ChainIndexingServiceStateSchema.ts"],"sourcesContent":["import { BoundWitnessSchema } from '@xyo-network/boundwitness-model'\nimport type { Schema, WithStorageMeta } from '@xyo-network/payload-model'\nimport { isHashStorageMeta, isSchema } from '@xyo-network/payload-model'\nimport type { SchemaPayload } from '@xyo-network/schema-payload-plugin'\nimport { isSchemaPayload, SchemaSchema } from '@xyo-network/schema-payload-plugin'\n\nimport type {\n ChainStakeIntent, HashPayload, Transfer,\n} from '../payload/index.ts'\nimport {\n ChainStakeIntentSchema, HashSchema, isChainStakeIntent, isHashPayload, isTransfer, TransferSchema,\n} from '../payload/index.ts'\nimport { isTransactionBoundWitness, type TransactionBoundWitness } from '../transaction/index.ts'\n\nexport type AllowedBlockPayload = Transfer | ChainStakeIntent | SchemaPayload | TransactionBoundWitness | HashPayload\nexport const AllowedBlockPayloadSchemas: Schema[] = [TransferSchema, ChainStakeIntentSchema, SchemaSchema, BoundWitnessSchema, HashSchema]\nexport type AllowedBlockPayloadSchema = typeof AllowedBlockPayloadSchemas[number]\n\nexport const isAllowedBlockPayloadSchema = (value: unknown): value is AllowedBlockPayloadSchema => {\n return isSchema(value) && AllowedBlockPayloadSchemas.includes(value)\n}\n\nexport const isAllowedBlockPayload = (value: unknown): value is AllowedBlockPayload => {\n return isTransfer(value) || isChainStakeIntent(value) || isSchemaPayload(value) || isTransactionBoundWitness(value) || isHashPayload(value)\n}\n\nexport const isAllowedBlockPayloadWithHashStorageMeta = (value: unknown): value is WithStorageMeta<AllowedBlockPayload> => {\n return isAllowedBlockPayload(value) && isHashStorageMeta(value)\n}\n","import { AsObjectFactory } from '@xylabs/object'\nimport type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\n\nimport type { BlockDuration } from '../../fields/index.ts'\nimport type { FromFields } from './Executable.ts'\n\nexport const ChainStakeIntentSchema = 'network.xyo.chain.stake.intent' as const\nexport type ChainStakeIntentSchema = typeof ChainStakeIntentSchema\n\nexport type Intent = 'producer' // | 'bank'\n\nexport interface ChainStakeIntentFields extends BlockDuration, FromFields {\n /*\n * The intent of the staking\n */\n intent: Intent\n}\n\nexport type ChainStakeIntent = Payload<ChainStakeIntentFields, ChainStakeIntentSchema>\n\nexport const isChainStakeIntent = (x?: unknown | null): x is ChainStakeIntent => {\n return isPayloadOfSchemaType<ChainStakeIntent>(ChainStakeIntentSchema)(x)\n && asNonNegativeInteger(x.nbf) !== undefined\n && asNonNegativeInteger(x.exp) !== undefined\n}\nexport const asChainStakeIntent = AsObjectFactory.create(isChainStakeIntent)\nexport const asOptionalChainStakeIntent = AsObjectFactory.createOptional(isChainStakeIntent)\n\nconst asNonNegativeInteger = (num: number) => {\n return (Number.isInteger(num) && num >= 0) ? num : undefined\n}\n","import type { Address } from '@xylabs/hex'\nimport type { EmptyObject } from '@xylabs/object'\nimport { isAnyPayload } from '@xyo-network/payload-model'\n\nexport interface FromFields {\n // the address that is treated as the source of this action\n from: Address\n}\n\nexport const hasFrom = (value: unknown): value is FromFields => {\n return (value as FromFields).from !== undefined\n}\n\nexport interface ExecutableFields {\n script: string[]\n}\n\nexport type Executable<T extends EmptyObject = EmptyObject> = T & ExecutableFields\nexport type OptionalExecutable<T extends EmptyObject = EmptyObject> = T & Partial<ExecutableFields>\n\nexport const isExecutable = <T extends EmptyObject>(value: T | undefined): value is Executable<T> => {\n return isAnyPayload(value) && Array.isArray((value as unknown as ExecutableFields).script)\n}\n\nexport const asExecutable = <T extends EmptyObject>(value: T | undefined): Executable<T> | undefined => {\n return isExecutable(value)\n ? value as unknown as Executable<T>\n : undefined\n}\n","import type { Hash } from '@xylabs/hex'\nimport { AsObjectFactory } from '@xylabs/object'\nimport type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\n\nexport const HashSchema = 'network.xyo.hash' as const\nexport type HashSchema = typeof HashSchema\n\nexport interface HashFields {\n hash: Hash\n}\n\nexport type HashPayload = Payload<HashFields, HashSchema>\n\nexport const isHashPayload = isPayloadOfSchemaType<HashPayload>(HashSchema)\n\nexport const asHashPayload = AsObjectFactory.create(isHashPayload)\nexport const asHashPayloadWithStorageMeta = AsObjectFactory.create(isHashPayload)\nexport const asOptionalHashPayload = AsObjectFactory.createOptional(isHashPayload)\n","import type {\n Address,\n Hex,\n} from '@xylabs/hex'\nimport { AsObjectFactory } from '@xylabs/object'\nimport type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\n\nimport type { FromFields } from './Executable.ts'\n\nexport const TransferSchema = 'network.xyo.transfer' as const\nexport type TransferSchema = typeof TransferSchema\n\nexport interface TransferFields extends FromFields {\n epoch: number\n // the amount that is being sent to another address\n transfers: Partial<Record<Address, Hex>>\n}\n\n// if this payload is included in a boundwitness, it needs to be available for inspection to be included in block\nexport type Transfer = Payload<TransferFields, TransferSchema>\n\nexport const isTransfer = isPayloadOfSchemaType<Transfer>(TransferSchema)\n\nexport const asTransfer = AsObjectFactory.create(isTransfer)\nexport const asOptionalTransfer = AsObjectFactory.createOptional(isTransfer)\n","import { AsObjectFactory } from '@xylabs/object'\nimport type { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { isPayloadOfSchemaType, type Payload } from '@xyo-network/payload-model'\n\nexport const HydratedBoundWitnessSchema = 'network.xyo.boundwitness.hydrated'\nexport type HydratedBoundWitnessSchema = typeof HydratedBoundWitnessSchema\n\nexport type HydratedBoundWitnessPayload = Payload<{\n bw: BoundWitness\n payloads: Payload[]\n},\n HydratedBoundWitnessSchema>\n\nexport const isHydratedBoundWitnessPayload = isPayloadOfSchemaType<HydratedBoundWitnessPayload>(HydratedBoundWitnessSchema)\nexport const asHydratedBoundWitnessPayload = AsObjectFactory.createOptional<HydratedBoundWitnessPayload>(isHydratedBoundWitnessPayload)\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 { BlockDuration } from '../fields/index.ts'\nimport type { FromFields, OptionalExecutable } from '../payload/index.ts'\nimport type { TransactionFeesFields } from './TransactionFeesFields.ts'\n\nexport interface TransactionBoundWitnessFields extends BlockDuration, TransactionFeesFields {\n chain: Address\n}\n\nexport type TransactionBoundWitness = BoundWitness<TransactionBoundWitnessFields & OptionalExecutable & FromFields>\n\nexport const isTransactionBoundWitness = (value: unknown): value is TransactionBoundWitness => {\n const typedObj = value as TransactionBoundWitness\n return isBoundWitness(value)\n && typedObj.chain !== undefined\n && typedObj.fees !== undefined\n && typedObj.exp !== undefined\n && typedObj.nbf !== undefined\n}\n\nexport const isSignedTransactionBoundWitness = (value: unknown): value is Signed<TransactionBoundWitness> => {\n return isTransactionBoundWitness(value) && isSigned(value)\n}\n\nexport const isSigned = <T extends BoundWitness = BoundWitness>(value: unknown): value is Signed<T> =>\n isBoundWitness(value)\n && value.$signatures.length === value.addresses.length\n && value.addresses.length > 0\n\nexport const isTransactionBoundWitnessWithStorageMeta = (value: unknown): value is WithStorageMeta<TransactionBoundWitness> =>\n isTransactionBoundWitness(value)\n && isStorageMeta(value)\n\nexport const 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","export type XL1 = bigint & { readonly _tag: 'XL1' } // 1e-18\nexport type MilliXL1 = bigint & { readonly _tag: 'MilliXL1' } // 1e-15 [XL1 * 1e3 = milliXL1] [milliXL1 / 1e3 = XL1]\nexport type MicroXL1 = bigint & { readonly _tag: 'MicroXL1' } // 1e-12 [XL1 * 1e6 = microXL1] [microXL1 / 1e6 = XL1]\nexport type NanoXL1 = bigint & { readonly _tag: 'NanoXL1' } // 1e-9 [XL1 * 1e9 = nanoXL1] [nanoXL1 / 1e9 = XL1]\nexport type PicoXL1 = bigint & { readonly _tag: 'PicoXL1' } // 1e-6 [XL1 * 1e12 = picoXL1] [picoXL1 / 1e12 = XL1]\nexport type FemtoXL1 = bigint & { readonly _tag: 'FemtoXL1' } // 1e-3 [XL1 * 1e15 = femtoXL1] [femtoXL1 / 1e15 = XL1]\nexport type AttoXL1 = bigint & { readonly _tag: 'AttoXL1' } // 1e-0 [XL1 * 1e18 = attoXL1] [attoXL1 / 1e18 = XL1]\n\nexport type TypingFunc<T extends bigint> = (value: bigint) => T\n\nexport const XL1: TypingFunc<XL1> = (value: bigint): XL1 => value as XL1\nexport const MilliXL1: TypingFunc<MilliXL1> = (value: bigint): MilliXL1 => value as MilliXL1\nexport const MicroXL1: TypingFunc<MicroXL1> = (value: bigint): MicroXL1 => value as MicroXL1\nexport const NanoXL1: TypingFunc<NanoXL1> = (value: bigint): NanoXL1 => value as NanoXL1\nexport const PicoXL1: TypingFunc<PicoXL1> = (value: bigint): PicoXL1 => value as PicoXL1\nexport const FemtoXL1: TypingFunc<FemtoXL1> = (value: bigint): FemtoXL1 => value as FemtoXL1\nexport const AttoXL1: TypingFunc<AttoXL1> = (value: bigint): AttoXL1 => value as AttoXL1\n\ntype XL1Units = 'xl1' | 'milli' | 'micro' | 'nano' | 'pico' | 'femto' | 'atto'\n\n/** @deprecated use XL1Places and xl1ConvertFactor(unit) instead */\nexport const XL1ConvertDict: Record<XL1Units, number> = {\n xl1: 18,\n milli: 15,\n micro: 12,\n nano: 9,\n pico: 6,\n femto: 3,\n atto: 0,\n} as const\n\nexport const XL1Places: Record<XL1Units, bigint> = {\n xl1: 18n,\n milli: 15n,\n micro: 12n,\n nano: 9n,\n pico: 6n,\n femto: 3n,\n atto: 0n,\n} as const\n\n/**\n * Convert factor by which a respective unit is multiplied to convert it to AttoXL1 or\n * by which AttoXL1 is divided to convert it to respective unit is multiplied.\n */\nexport const AttoXL1ConvertFactor: Record<XL1Units, bigint> = {\n xl1: 10n ** XL1Places.xl1,\n milli: 10n ** XL1Places.milli,\n micro: 10n ** XL1Places.micro,\n nano: 10n ** XL1Places.nano,\n pico: 10n ** XL1Places.pico,\n femto: 10n ** XL1Places.femto,\n atto: 10n ** XL1Places.atto,\n} as const\n\n/** @deprecated use AttoXL1ConvertFactor instead */\nexport function xl1ConvertFactor(unit: XL1Units) {\n return 10n ** XL1Places[unit]\n}\n","import type { TransactionFeesBigInt } from '../transaction/index.ts'\nimport { AttoXL1, AttoXL1ConvertFactor } from '../xl1/index.ts'\n\nexport const minTransactionFees: TransactionFeesBigInt = {\n base: AttoXL1(1000n * AttoXL1ConvertFactor.micro),\n gasPrice: AttoXL1(10n * AttoXL1ConvertFactor.micro),\n gasLimit: AttoXL1(1_000_000n * AttoXL1ConvertFactor.micro),\n priority: AttoXL1(0n * AttoXL1ConvertFactor.micro),\n} as const\n","import type { TransactionFeesBigInt } from '../transaction/index.ts'\nimport { AttoXL1, AttoXL1ConvertFactor } from '../xl1/index.ts'\nimport { minTransactionFees } from './minTransactionFees.ts'\n\nexport const defaultTransactionFees: TransactionFeesBigInt = {\n base: minTransactionFees.base,\n gasPrice: AttoXL1(10n * AttoXL1ConvertFactor.micro),\n gasLimit: AttoXL1(1_000_000n * AttoXL1ConvertFactor.micro),\n priority: minTransactionFees.priority,\n} as const\n","export const StepSizes = [10, 105, 1103, 11_576, 121_551, 1_276_282, 13_400_956] as const\n","export const TransactionGasCosts = {\n /**\n * The cost of storing each character that is added to the chain\n * This includes the transaction JSON and all the elevated payloads' JSON\n */\n characterStorage: 10n,\n\n /** The cost of static validating every payload that will be included in the chain */\n payloadValidation: 1000n,\n\n /** The cost of validating each signature that will be included in the chain */\n signatureValidation: 1000n,\n\n /** The cost of validating each hash that will be included in the chain */\n hashValidation: 100n,\n\n /** The cost of validating a balance state, triggered by a Transfer payload or gas collection */\n balanceValidation: 100n,\n} as const\n\n/** Gas Calculation\n *\n * 1 Million microXL1 (mXL1) = 1 XL1\n *\n * Gas amount is calculated as follows:\n *\n * 1. Each byte in the transaction cost 10 gas\n * 2. Each payload validation in the transaction costs 1000 gas\n * 3. Each signature verification in the transaction costs 1000 gas\n * 4. Each hash validation in the transaction costs 100 gas\n * 5. Each balance validation in the transaction costs 100 gas\n * 6. Processing/Compute/Storage Cost?\n * 7. operation Costs?\n *\n * The total gas cost is calculated by multiplying the gas amount by the gas price.\n *\n * minGasPrice is initially set to 100 mXL1\n * minBase is initially set to 1000 mXL1\n * minPriority is always 0 mXL1, but can be set to increase the priority of the transaction\n *\n */\n","import type { Hex } from '@xylabs/hex'\nimport { AsObjectFactory } from '@xylabs/object'\nimport type { Payload, WithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\n isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nexport const BlockNumberSchema = 'network.xyo.chain.block.number' as const\nexport type BlockNumberSchema = typeof BlockNumberSchema\n\nexport interface BlockNumberFields {\n /**\n * The block number\n */\n block: Hex\n /**\n * The chain id\n */\n chain?: Hex\n}\n/**\n * The number of a block\n */\nexport type BlockNumber = Payload<BlockNumberFields, BlockNumberSchema>\n\n/**\n * Identity function for determining if an object is a BlockNumber\n */\nexport const isBlockNumber = isPayloadOfSchemaType<BlockNumber>(BlockNumberSchema)\nexport const asBlockNumber = AsObjectFactory.create<BlockNumber>(isBlockNumber)\nexport const asOptionalBlockNumber = AsObjectFactory.createOptional<BlockNumber>(isBlockNumber)\n\n/**\n * Identity function for determining if an object is a BlockNumber with sources\n */\nexport const isBlockNumberWithSources = isPayloadOfSchemaTypeWithSources<BlockNumber>(BlockNumberSchema)\nexport const asBlockNumberWithSources = AsObjectFactory.create<WithSources<BlockNumber>>(isBlockNumberWithSources)\nexport const asOptionalBlockNumberWithSources = AsObjectFactory.createOptional<WithSources<BlockNumber>>(isBlockNumberWithSources)\n","import type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\n\nexport const NetworkStatusSchema = 'network.xyo.chain.status' as const\nexport type NetworkStatusSchema = typeof NetworkStatusSchema\n\nexport type NetworkStatusState = 'online' | 'offline' | 'degraded' | 'unknown'\n\nexport type NetworkStatusUpdate = {\n end: number\n start: number\n update: string\n}\n\nexport interface NetworkStatusFields {\n description: string\n state: NetworkStatusState\n updates?: NetworkStatusUpdate[]\n}\n\nexport type NetworkStatus = Payload<NetworkStatusFields, NetworkStatusSchema>\n\nexport const isNetworkStatus = isPayloadOfSchemaType<NetworkStatus>(NetworkStatusSchema)\n","import type { Address } from '@xylabs/hex'\nimport type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\n\nexport const ChainIdentificationPayloadSchema = 'network.xyo.chain.identification' as const\nexport type ChainIdentificationPayloadSchema = typeof ChainIdentificationPayloadSchema\n\n/**\n * Identification required to uniquely identify a chain\n */\nexport interface ChainIdentification {\n /** @field the id of the chain */\n id: Address\n}\n\nexport type ChainIdentificationPayload = Payload<ChainIdentification, ChainIdentificationPayloadSchema>\nexport const isChainIdentificationPayload = isPayloadOfSchemaType<ChainIdentificationPayload>(ChainIdentificationPayloadSchema)\n","import type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\n\nexport const ChainInformationPayloadSchema = 'network.xyo.chain.information' as const\nexport type ChainInformationPayloadSchema = typeof ChainInformationPayloadSchema\n\nimport type { ChainIdentification } from './ChainIdentification.ts'\n\n/**\n * Information required to produce a chain\n */\nexport interface ChainInformation extends ChainIdentification {\n // TODO: Add these fields which are currently promises on the smart contract\n // forkedAtBlockNumber: bigint\n // forkedAtHash: Hash\n // forkedChainId: Address\n}\n\nexport type ChainInformationPayload = Payload<ChainIdentification, ChainInformationPayloadSchema>\nexport const isChainInformationPayload = isPayloadOfSchemaType<ChainInformationPayload>(ChainInformationPayloadSchema)\n","import type { Hash } from '@xylabs/hex'\nimport type { JsonValue } from '@xylabs/object'\nimport { AsObjectFactory } from '@xylabs/object'\nimport type { Payload, WithStorageMeta } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType, isStorageMeta } from '@xyo-network/payload-model'\n\nexport interface ChainIndexingServiceStateFields<T extends JsonValue = JsonValue> {\n /**\n * The hash of the last block that this service has indexing\n */\n endBlockHash: Hash\n /**\n * The hash of the block that the service started indexing. If undefined, the service is\n * assumed to have started indexing from the genesis block\n */\n startBlockHash?: Hash\n /**\n * The indexed state for the range\n */\n state: T\n}\nexport const ChainIndexingServiceStateSchema = 'network.xyo.chain.indexing.service.state' as const\nexport type ChainIndexingServiceStateSchema = typeof ChainIndexingServiceStateSchema\n\n/**\n * The result of a ChainIndexingServiceState\n */\nexport type ChainIndexingServiceState<T extends JsonValue = JsonValue> = Payload<ChainIndexingServiceStateFields<T>, ChainIndexingServiceStateSchema>\n\n/**\n * Identity functions for determining if an object is an ChainIndexingServiceState\n */\nexport const isChainIndexingServiceState = <T extends JsonValue = JsonValue>(payload?: unknown): payload is ChainIndexingServiceState<T> => {\n return isPayloadOfSchemaType<ChainIndexingServiceState<T>>(ChainIndexingServiceStateSchema)(payload)\n}\nexport const asChainIndexingServiceState = AsObjectFactory.create<ChainIndexingServiceState<JsonValue>>(isChainIndexingServiceState)\n\nexport const isChainIndexingServiceStateWithStorageMeta\n= <T extends JsonValue = JsonValue>(value: unknown): value is WithStorageMeta<ChainIndexingServiceState<T>> =>\n isChainIndexingServiceState<T>(value) && isStorageMeta(value)\n\nexport const asChainIndexingServiceStateWithStorageMeta\n= AsObjectFactory.create<WithStorageMeta<ChainIndexingServiceState>>(isChainIndexingServiceStateWithStorageMeta)\n\nexport const asOptionalChainIndexingServiceStateWithStorageMeta\n= AsObjectFactory.createOptional<WithStorageMeta<ChainIndexingServiceState>>(isChainIndexingServiceStateWithStorageMeta)\n"],"mappings":";AAAA,SAAS,0BAA0B;AAEnC,SAAS,mBAAmB,gBAAgB;AAE5C,SAAS,iBAAiB,oBAAoB;;;ACJ9C,SAAS,uBAAuB;AAEhC,SAAS,6BAA6B;AAK/B,IAAM,yBA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,gCAAgC;AAgBtC,IAAM,4BAA4BA,uBAA+C,6BAA6B;;;ACjBrH,SAAS,mBAAAC,wBAAuB;AAEhC,SAAS,yBAAAC,wBAAuB,iBAAAC,sBAAqB;AAiB9C,IAAM,kCAAkC;AAWxC,IAAM,8BAA8B,CAAkC,YAA+D;AAC1I,SAAOD,uBAAoD,+BAA+B,EAAE,OAAO;AACrG;AACO,IAAM,8BAA8BD,iBAAgB,OAA6C,2BAA2B;AAE5H,IAAM,6CACX,CAAkC,UAClC,4BAA+B,KAAK,KAAKE,eAAc,KAAK;AAEvD,IAAM,6CACXF,iBAAgB,OAAmD,0CAA0C;AAExG,IAAM,qDACXA,iBAAgB,eAA2D,0CAA0C;","names":["AsObjectFactory","isPayloadOfSchemaType","AsObjectFactory","isPayloadOfSchemaType","AsObjectFactory","isPayloadOfSchemaType","AsObjectFactory","AsObjectFactory","isBoundWitness","isStorageMeta","AsObjectFactory","isPayloadOfSchemaType","isPayloadOfSchemaType","isPayloadOfSchemaType","isPayloadOfSchemaType","AsObjectFactory","isPayloadOfSchemaType","isStorageMeta"]}
|
|
1
|
+
{"version":3,"sources":["../../src/block/AllowedBlockPayload.ts","../../src/payload/AtomicBoundWitness.ts","../../src/payload/elevatable/ChainStakeIntent.ts","../../src/payload/elevatable/Executable.ts","../../src/payload/elevatable/Hash.ts","../../src/payload/elevatable/TransferPayload.ts","../../src/transaction/HydratedBoundWitnessPayload.ts","../../src/transaction/TransactionBoundWitness.ts","../../src/block/BlockBoundWitness.ts","../../src/xl1/XL1.ts","../../src/constants/minTransactionFees.ts","../../src/constants/defaultTransactionFees.ts","../../src/constants/StepSizes.ts","../../src/constants/TransactionGasCosts.ts","../../src/fields/BlockNumber.ts","../../src/network/Status.ts","../../src/services/Chain/ChainIdentification.ts","../../src/services/Chain/ChainInformation.ts","../../src/services/stakeIntent/ChainIndexingServiceStateSchema.ts"],"sourcesContent":["import { BoundWitnessSchema } from '@xyo-network/boundwitness-model'\nimport type { Schema, WithStorageMeta } from '@xyo-network/payload-model'\nimport { isHashStorageMeta, isSchema } from '@xyo-network/payload-model'\nimport type { SchemaPayload } from '@xyo-network/schema-payload-plugin'\nimport { isSchemaPayload, SchemaSchema } from '@xyo-network/schema-payload-plugin'\n\nimport type {\n ChainStakeIntent, HashPayload, Transfer,\n} from '../payload/index.ts'\nimport {\n ChainStakeIntentSchema, HashSchema, isChainStakeIntent, isHashPayload, isTransfer, TransferSchema,\n} from '../payload/index.ts'\nimport { isTransactionBoundWitness, type TransactionBoundWitness } from '../transaction/index.ts'\n\nexport type AllowedBlockPayload = Transfer | ChainStakeIntent | SchemaPayload | TransactionBoundWitness | HashPayload\nexport const AllowedBlockPayloadSchemas: Schema[] = [TransferSchema, ChainStakeIntentSchema, SchemaSchema, BoundWitnessSchema, HashSchema]\nexport type AllowedBlockPayloadSchema = typeof AllowedBlockPayloadSchemas[number]\n\nexport const isAllowedBlockPayloadSchema = (value: unknown): value is AllowedBlockPayloadSchema => {\n return isSchema(value) && AllowedBlockPayloadSchemas.includes(value)\n}\n\nexport const isAllowedBlockPayload = (value: unknown): value is AllowedBlockPayload => {\n return isTransfer(value) || isChainStakeIntent(value) || isSchemaPayload(value) || isTransactionBoundWitness(value) || isHashPayload(value)\n}\n\nexport const isAllowedBlockPayloadWithHashStorageMeta = (value: unknown): value is WithStorageMeta<AllowedBlockPayload> => {\n return isAllowedBlockPayload(value) && isHashStorageMeta(value)\n}\n","import { AsObjectFactory } from '@xylabs/object'\nimport type { BoundWitness } from '@xyo-network/boundwitness-model'\nimport type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\n\nexport const AtomicBoundWitnessSchema = 'network.xyo.boundwitness.atomic' as const\nexport type AtomicBoundWitnessSchema = typeof AtomicBoundWitnessSchema\n\nexport interface AtomicBoundWitnessFields<TBoundWitness extends BoundWitness = BoundWitness> {\n bw: TBoundWitness\n}\n\nexport type AtomicBoundWitness = Payload<AtomicBoundWitnessFields, AtomicBoundWitnessSchema>\n\nexport const isAtomicBoundWitness = isPayloadOfSchemaType<AtomicBoundWitness>(AtomicBoundWitnessSchema)\n\nexport const asAtomicBoundWitness = AsObjectFactory.create(isAtomicBoundWitness)\nexport const asOptionalAtomicBoundWitness = AsObjectFactory.createOptional(isAtomicBoundWitness)\n","import { AsObjectFactory } from '@xylabs/object'\nimport type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\n\nimport type { BlockDuration } from '../../fields/index.ts'\nimport type { FromFields } from './Executable.ts'\n\nexport const ChainStakeIntentSchema = 'network.xyo.chain.stake.intent' as const\nexport type ChainStakeIntentSchema = typeof ChainStakeIntentSchema\n\nexport type Intent = 'producer' // | 'bank'\n\nexport interface ChainStakeIntentFields extends BlockDuration, FromFields {\n /*\n * The intent of the staking\n */\n intent: Intent\n}\n\nexport type ChainStakeIntent = Payload<ChainStakeIntentFields, ChainStakeIntentSchema>\n\nexport const isChainStakeIntent = (x?: unknown | null): x is ChainStakeIntent => {\n return isPayloadOfSchemaType<ChainStakeIntent>(ChainStakeIntentSchema)(x)\n && asNonNegativeInteger(x.nbf) !== undefined\n && asNonNegativeInteger(x.exp) !== undefined\n}\nexport const asChainStakeIntent = AsObjectFactory.create(isChainStakeIntent)\nexport const asOptionalChainStakeIntent = AsObjectFactory.createOptional(isChainStakeIntent)\n\nconst asNonNegativeInteger = (num: number) => {\n return (Number.isInteger(num) && num >= 0) ? num : undefined\n}\n","import type { Address } from '@xylabs/hex'\nimport type { EmptyObject } from '@xylabs/object'\nimport { isAnyPayload } from '@xyo-network/payload-model'\n\nexport interface FromFields {\n // the address that is treated as the source of this action\n from: Address\n}\n\nexport const hasFrom = (value: unknown): value is FromFields => {\n return (value as FromFields).from !== undefined\n}\n\nexport interface ExecutableFields {\n script: string[]\n}\n\nexport type Executable<T extends EmptyObject = EmptyObject> = T & ExecutableFields\nexport type OptionalExecutable<T extends EmptyObject = EmptyObject> = T & Partial<ExecutableFields>\n\nexport const isExecutable = <T extends EmptyObject>(value: T | undefined): value is Executable<T> => {\n return isAnyPayload(value) && Array.isArray((value as unknown as ExecutableFields).script)\n}\n\nexport const asExecutable = <T extends EmptyObject>(value: T | undefined): Executable<T> | undefined => {\n return isExecutable(value)\n ? value as unknown as Executable<T>\n : undefined\n}\n","import type { Hash } from '@xylabs/hex'\nimport { AsObjectFactory } from '@xylabs/object'\nimport type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\n\nexport const HashSchema = 'network.xyo.hash' as const\nexport type HashSchema = typeof HashSchema\n\nexport interface HashFields {\n hash: Hash\n}\n\nexport type HashPayload = Payload<HashFields, HashSchema>\n\nexport const isHashPayload = isPayloadOfSchemaType<HashPayload>(HashSchema)\n\nexport const asHashPayload = AsObjectFactory.create(isHashPayload)\nexport const asHashPayloadWithStorageMeta = AsObjectFactory.create(isHashPayload)\nexport const asOptionalHashPayload = AsObjectFactory.createOptional(isHashPayload)\n","import type {\n Address,\n Hex,\n} from '@xylabs/hex'\nimport { AsObjectFactory } from '@xylabs/object'\nimport type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\n\nimport type { FromFields } from './Executable.ts'\n\nexport const TransferSchema = 'network.xyo.transfer' as const\nexport type TransferSchema = typeof TransferSchema\n\nexport interface TransferFields extends FromFields {\n epoch: number\n // the amount that is being sent to another address\n transfers: Partial<Record<Address, Hex>>\n}\n\n// if this payload is included in a boundwitness, it needs to be available for inspection to be included in block\nexport type Transfer = Payload<TransferFields, TransferSchema>\n\nexport const isTransfer = isPayloadOfSchemaType<Transfer>(TransferSchema)\n\nexport const asTransfer = AsObjectFactory.create(isTransfer)\nexport const asOptionalTransfer = AsObjectFactory.createOptional(isTransfer)\n","import { AsObjectFactory } from '@xylabs/object'\nimport type { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { isPayloadOfSchemaType, type Payload } from '@xyo-network/payload-model'\n\nexport const HydratedBoundWitnessSchema = 'network.xyo.boundwitness.hydrated'\nexport type HydratedBoundWitnessSchema = typeof HydratedBoundWitnessSchema\n\nexport type HydratedBoundWitnessPayload = Payload<{\n bw: BoundWitness\n payloads: Payload[]\n},\n HydratedBoundWitnessSchema>\n\nexport const isHydratedBoundWitnessPayload = isPayloadOfSchemaType<HydratedBoundWitnessPayload>(HydratedBoundWitnessSchema)\nexport const asHydratedBoundWitnessPayload = AsObjectFactory.createOptional<HydratedBoundWitnessPayload>(isHydratedBoundWitnessPayload)\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 { BlockDuration } from '../fields/index.ts'\nimport type { FromFields, OptionalExecutable } from '../payload/index.ts'\nimport type { TransactionFeesFields } from './TransactionFeesFields.ts'\n\nexport interface TransactionBoundWitnessFields extends BlockDuration, TransactionFeesFields {\n chain: Address\n}\n\nexport type TransactionBoundWitness = BoundWitness<TransactionBoundWitnessFields & OptionalExecutable & FromFields>\n\nexport const isTransactionBoundWitness = (value: unknown): value is TransactionBoundWitness => {\n const typedObj = value as TransactionBoundWitness\n return isBoundWitness(value)\n && typedObj.chain !== undefined\n && typedObj.fees !== undefined\n && typedObj.exp !== undefined\n && typedObj.nbf !== undefined\n}\n\nexport const isSignedTransactionBoundWitness = (value: unknown): value is Signed<TransactionBoundWitness> => {\n return isTransactionBoundWitness(value) && isSigned(value)\n}\n\nexport const isSigned = <T extends BoundWitness = BoundWitness>(value: unknown): value is Signed<T> =>\n isBoundWitness(value)\n && value.$signatures.length === value.addresses.length\n && value.addresses.length > 0\n\nexport const isTransactionBoundWitnessWithStorageMeta = (value: unknown): value is WithStorageMeta<TransactionBoundWitness> =>\n isTransactionBoundWitness(value)\n && isStorageMeta(value)\n\nexport const 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","export type XL1 = bigint & { readonly _tag: 'XL1' } // 1e-18\nexport type MilliXL1 = bigint & { readonly _tag: 'MilliXL1' } // 1e-15 [XL1 * 1e3 = milliXL1] [milliXL1 / 1e3 = XL1]\nexport type MicroXL1 = bigint & { readonly _tag: 'MicroXL1' } // 1e-12 [XL1 * 1e6 = microXL1] [microXL1 / 1e6 = XL1]\nexport type NanoXL1 = bigint & { readonly _tag: 'NanoXL1' } // 1e-9 [XL1 * 1e9 = nanoXL1] [nanoXL1 / 1e9 = XL1]\nexport type PicoXL1 = bigint & { readonly _tag: 'PicoXL1' } // 1e-6 [XL1 * 1e12 = picoXL1] [picoXL1 / 1e12 = XL1]\nexport type FemtoXL1 = bigint & { readonly _tag: 'FemtoXL1' } // 1e-3 [XL1 * 1e15 = femtoXL1] [femtoXL1 / 1e15 = XL1]\nexport type AttoXL1 = bigint & { readonly _tag: 'AttoXL1' } // 1e-0 [XL1 * 1e18 = attoXL1] [attoXL1 / 1e18 = XL1]\n\nexport type TypingFunc<T extends bigint> = (value: bigint) => T\n\nexport const XL1: TypingFunc<XL1> = (value: bigint): XL1 => value as XL1\nexport const MilliXL1: TypingFunc<MilliXL1> = (value: bigint): MilliXL1 => value as MilliXL1\nexport const MicroXL1: TypingFunc<MicroXL1> = (value: bigint): MicroXL1 => value as MicroXL1\nexport const NanoXL1: TypingFunc<NanoXL1> = (value: bigint): NanoXL1 => value as NanoXL1\nexport const PicoXL1: TypingFunc<PicoXL1> = (value: bigint): PicoXL1 => value as PicoXL1\nexport const FemtoXL1: TypingFunc<FemtoXL1> = (value: bigint): FemtoXL1 => value as FemtoXL1\nexport const AttoXL1: TypingFunc<AttoXL1> = (value: bigint): AttoXL1 => value as AttoXL1\n\ntype XL1Units = 'xl1' | 'milli' | 'micro' | 'nano' | 'pico' | 'femto' | 'atto'\n\n/** @deprecated use XL1Places and xl1ConvertFactor(unit) instead */\nexport const XL1ConvertDict: Record<XL1Units, number> = {\n xl1: 18,\n milli: 15,\n micro: 12,\n nano: 9,\n pico: 6,\n femto: 3,\n atto: 0,\n} as const\n\nexport const XL1Places: Record<XL1Units, bigint> = {\n xl1: 18n,\n milli: 15n,\n micro: 12n,\n nano: 9n,\n pico: 6n,\n femto: 3n,\n atto: 0n,\n} as const\n\n/**\n * Convert factor by which a respective unit is multiplied to convert it to AttoXL1 or\n * by which AttoXL1 is divided to convert it to respective unit is multiplied.\n */\nexport const AttoXL1ConvertFactor: Record<XL1Units, bigint> = {\n xl1: 10n ** XL1Places.xl1,\n milli: 10n ** XL1Places.milli,\n micro: 10n ** XL1Places.micro,\n nano: 10n ** XL1Places.nano,\n pico: 10n ** XL1Places.pico,\n femto: 10n ** XL1Places.femto,\n atto: 10n ** XL1Places.atto,\n} as const\n\n/** @deprecated use AttoXL1ConvertFactor instead */\nexport function xl1ConvertFactor(unit: XL1Units) {\n return 10n ** XL1Places[unit]\n}\n","import type { TransactionFeesBigInt } from '../transaction/index.ts'\nimport { AttoXL1, AttoXL1ConvertFactor } from '../xl1/index.ts'\n\nexport const minTransactionFees: TransactionFeesBigInt = {\n base: AttoXL1(1000n * AttoXL1ConvertFactor.micro),\n gasPrice: AttoXL1(10n * AttoXL1ConvertFactor.micro),\n gasLimit: AttoXL1(1_000_000n * AttoXL1ConvertFactor.micro),\n priority: AttoXL1(0n * AttoXL1ConvertFactor.micro),\n} as const\n","import type { TransactionFeesBigInt } from '../transaction/index.ts'\nimport { AttoXL1, AttoXL1ConvertFactor } from '../xl1/index.ts'\nimport { minTransactionFees } from './minTransactionFees.ts'\n\nexport const defaultTransactionFees: TransactionFeesBigInt = {\n base: minTransactionFees.base,\n gasPrice: AttoXL1(10n * AttoXL1ConvertFactor.micro),\n gasLimit: AttoXL1(1_000_000n * AttoXL1ConvertFactor.micro),\n priority: minTransactionFees.priority,\n} as const\n","export const StepSizes = [10, 105, 1103, 11_576, 121_551, 1_276_282, 13_400_956] as const\n","export const TransactionGasCosts = {\n /**\n * The cost of storing each character that is added to the chain\n * This includes the transaction JSON and all the elevated payloads' JSON\n */\n characterStorage: 10n,\n\n /** The cost of static validating every payload that will be included in the chain */\n payloadValidation: 1000n,\n\n /** The cost of validating each signature that will be included in the chain */\n signatureValidation: 1000n,\n\n /** The cost of validating each hash that will be included in the chain */\n hashValidation: 100n,\n\n /** The cost of validating a balance state, triggered by a Transfer payload or gas collection */\n balanceValidation: 100n,\n} as const\n\n/** Gas Calculation\n *\n * 1 Million microXL1 (mXL1) = 1 XL1\n *\n * Gas amount is calculated as follows:\n *\n * 1. Each byte in the transaction cost 10 gas\n * 2. Each payload validation in the transaction costs 1000 gas\n * 3. Each signature verification in the transaction costs 1000 gas\n * 4. Each hash validation in the transaction costs 100 gas\n * 5. Each balance validation in the transaction costs 100 gas\n * 6. Processing/Compute/Storage Cost?\n * 7. operation Costs?\n *\n * The total gas cost is calculated by multiplying the gas amount by the gas price.\n *\n * minGasPrice is initially set to 100 mXL1\n * minBase is initially set to 1000 mXL1\n * minPriority is always 0 mXL1, but can be set to increase the priority of the transaction\n *\n */\n","import type { Hex } from '@xylabs/hex'\nimport { AsObjectFactory } from '@xylabs/object'\nimport type { Payload, WithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\n isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nexport const BlockNumberSchema = 'network.xyo.chain.block.number' as const\nexport type BlockNumberSchema = typeof BlockNumberSchema\n\nexport interface BlockNumberFields {\n /**\n * The block number\n */\n block: Hex\n /**\n * The chain id\n */\n chain?: Hex\n}\n/**\n * The number of a block\n */\nexport type BlockNumber = Payload<BlockNumberFields, BlockNumberSchema>\n\n/**\n * Identity function for determining if an object is a BlockNumber\n */\nexport const isBlockNumber = isPayloadOfSchemaType<BlockNumber>(BlockNumberSchema)\nexport const asBlockNumber = AsObjectFactory.create<BlockNumber>(isBlockNumber)\nexport const asOptionalBlockNumber = AsObjectFactory.createOptional<BlockNumber>(isBlockNumber)\n\n/**\n * Identity function for determining if an object is a BlockNumber with sources\n */\nexport const isBlockNumberWithSources = isPayloadOfSchemaTypeWithSources<BlockNumber>(BlockNumberSchema)\nexport const asBlockNumberWithSources = AsObjectFactory.create<WithSources<BlockNumber>>(isBlockNumberWithSources)\nexport const asOptionalBlockNumberWithSources = AsObjectFactory.createOptional<WithSources<BlockNumber>>(isBlockNumberWithSources)\n","import type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\n\nexport const NetworkStatusSchema = 'network.xyo.chain.status' as const\nexport type NetworkStatusSchema = typeof NetworkStatusSchema\n\nexport type NetworkStatusState = 'online' | 'offline' | 'degraded' | 'unknown'\n\nexport type NetworkStatusUpdate = {\n end: number\n start: number\n update: string\n}\n\nexport interface NetworkStatusFields {\n description: string\n state: NetworkStatusState\n updates?: NetworkStatusUpdate[]\n}\n\nexport type NetworkStatus = Payload<NetworkStatusFields, NetworkStatusSchema>\n\nexport const isNetworkStatus = isPayloadOfSchemaType<NetworkStatus>(NetworkStatusSchema)\n","import type { Address } from '@xylabs/hex'\nimport type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\n\nexport const ChainIdentificationPayloadSchema = 'network.xyo.chain.identification' as const\nexport type ChainIdentificationPayloadSchema = typeof ChainIdentificationPayloadSchema\n\n/**\n * Identification required to uniquely identify a chain\n */\nexport interface ChainIdentification {\n /** @field the id of the chain */\n id: Address\n}\n\nexport type ChainIdentificationPayload = Payload<ChainIdentification, ChainIdentificationPayloadSchema>\nexport const isChainIdentificationPayload = isPayloadOfSchemaType<ChainIdentificationPayload>(ChainIdentificationPayloadSchema)\n","import type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\n\nexport const ChainInformationPayloadSchema = 'network.xyo.chain.information' as const\nexport type ChainInformationPayloadSchema = typeof ChainInformationPayloadSchema\n\nimport type { ChainIdentification } from './ChainIdentification.ts'\n\n/**\n * Information required to produce a chain\n */\nexport interface ChainInformation extends ChainIdentification {\n // TODO: Add these fields which are currently promises on the smart contract\n // forkedAtBlockNumber: bigint\n // forkedAtHash: Hash\n // forkedChainId: Address\n}\n\nexport type ChainInformationPayload = Payload<ChainIdentification, ChainInformationPayloadSchema>\nexport const isChainInformationPayload = isPayloadOfSchemaType<ChainInformationPayload>(ChainInformationPayloadSchema)\n","import type { Hash } from '@xylabs/hex'\nimport type { JsonValue } from '@xylabs/object'\nimport { AsObjectFactory } from '@xylabs/object'\nimport type { Payload, WithStorageMeta } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType, isStorageMeta } from '@xyo-network/payload-model'\n\nexport interface ChainIndexingServiceStateFields<T extends JsonValue = JsonValue> {\n /**\n * The hash of the last block that this service has indexing\n */\n endBlockHash: Hash\n /**\n * The hash of the block that the service started indexing. If undefined, the service is\n * assumed to have started indexing from the genesis block\n */\n startBlockHash?: Hash\n /**\n * The indexed state for the range\n */\n state: T\n}\nexport const ChainIndexingServiceStateSchema = 'network.xyo.chain.indexing.service.state' as const\nexport type ChainIndexingServiceStateSchema = typeof ChainIndexingServiceStateSchema\n\n/**\n * The result of a ChainIndexingServiceState\n */\nexport type ChainIndexingServiceState<T extends JsonValue = JsonValue> = Payload<ChainIndexingServiceStateFields<T>, ChainIndexingServiceStateSchema>\n\n/**\n * Identity functions for determining if an object is an ChainIndexingServiceState\n */\nexport const isChainIndexingServiceState = <T extends JsonValue = JsonValue>(payload?: unknown): payload is ChainIndexingServiceState<T> => {\n return isPayloadOfSchemaType<ChainIndexingServiceState<T>>(ChainIndexingServiceStateSchema)(payload)\n}\nexport const asChainIndexingServiceState = AsObjectFactory.create<ChainIndexingServiceState<JsonValue>>(isChainIndexingServiceState)\n\nexport const isChainIndexingServiceStateWithStorageMeta\n= <T extends JsonValue = JsonValue>(value: unknown): value is WithStorageMeta<ChainIndexingServiceState<T>> =>\n isChainIndexingServiceState<T>(value) && isStorageMeta(value)\n\nexport const asChainIndexingServiceStateWithStorageMeta\n= AsObjectFactory.create<WithStorageMeta<ChainIndexingServiceState>>(isChainIndexingServiceStateWithStorageMeta)\n\nexport const asOptionalChainIndexingServiceStateWithStorageMeta\n= AsObjectFactory.createOptional<WithStorageMeta<ChainIndexingServiceState>>(isChainIndexingServiceStateWithStorageMeta)\n"],"mappings":";AAAA,SAAS,0BAA0B;AAEnC,SAAS,mBAAmB,gBAAgB;AAE5C,SAAS,iBAAiB,oBAAoB;;;ACJ9C,SAAS,uBAAuB;AAGhC,SAAS,6BAA6B;AAE/B,IAAM,2BAA2B;AASjC,IAAM,uBAAuB,sBAA0C,wBAAwB;AAE/F,IAAM,uBAAuB,gBAAgB,OAAO,oBAAoB;AACxE,IAAM,+BAA+B,gBAAgB,eAAe,oBAAoB;;;ACjB/F,SAAS,mBAAAA,wBAAuB;AAEhC,SAAS,yBAAAC,8BAA6B;AAK/B,IAAM,yBAAyB;AAc/B,IAAM,qBAAqB,CAAC,MAA8C;AAC/E,SAAOA,uBAAwC,sBAAsB,EAAE,CAAC,KACnE,qBAAqB,EAAE,GAAG,MAAM,UAChC,qBAAqB,EAAE,GAAG,MAAM;AACvC;AACO,IAAM,qBAAqBD,iBAAgB,OAAO,kBAAkB;AACpE,IAAM,6BAA6BA,iBAAgB,eAAe,kBAAkB;AAE3F,IAAM,uBAAuB,CAAC,QAAgB;AAC5C,SAAQ,OAAO,UAAU,GAAG,KAAK,OAAO,IAAK,MAAM;AACrD;;;AC7BA,SAAS,oBAAoB;AAOtB,IAAM,UAAU,CAAC,UAAwC;AAC9D,SAAQ,MAAqB,SAAS;AACxC;AASO,IAAM,eAAe,CAAwB,UAAiD;AACnG,SAAO,aAAa,KAAK,KAAK,MAAM,QAAS,MAAsC,MAAM;AAC3F;AAEO,IAAM,eAAe,CAAwB,UAAoD;AACtG,SAA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nB,qBAAqB;AAAA;AAAA,EAGrB,gBAAgB;AAAA;AAAA,EAGhB,mBAAmB;AACrB;;;ACjBA,SAAS,mBAAAG,wBAAuB;AAEhC;AAAA,EACE,yBAAAC;AAAA,EACA;AAAA,OACK;AAEA,IAAM,oBAAoB;AAqB1B,IAAM,gBAAgBA,uBAAmC,iBAAiB;AAC1E,IAAM,gBAAgBD,iBAAgB,OAAoB,aAAa;AACvE,IAAM,wBAAwBA,iBAAgB,eAA4B,aAAa;AAKvF,IAAM,2BAA2B,iCAA8C,iBAAiB;AAChG,IAAM,2BAA2BA,iBAAgB,OAAiC,wBAAwB;AAC1G,IAAM,mCAAmCA,iBAAgB,eAAyC,wBAAwB;;;ACrCjI,SAAS,yBAAAE,8BAA6B;AAE/B,IAAM,sBAAsB;AAmB5B,IAAM,kBAAkBA,uBAAqC,mBAAmB;;;ACpBvF,SAAS,yBAAAC,8BAA6B;AAE/B,IAAM,mCAAmC;AAYzC,IAAM,+BAA+BA,uBAAkD,gCAAgC;;;ACf9H,SAAS,yBAAAC,8BAA6B;AAE/B,IAAM,gCAAgC;AAgBtC,IAAM,4BAA4BA,uBAA+C,6BAA6B;;;ACjBrH,SAAS,mBAAAC,wBAAuB;AAEhC,SAAS,yBAAAC,yBAAuB,iBAAAC,sBAAqB;AAiB9C,IAAM,kCAAkC;AAWxC,IAAM,8BAA8B,CAAkC,YAA+D;AAC1I,SAAOD,wBAAoD,+BAA+B,EAAE,OAAO;AACrG;AACO,IAAM,8BAA8BD,iBAAgB,OAA6C,2BAA2B;AAE5H,IAAM,6CACX,CAAkC,UAClC,4BAA+B,KAAK,KAAKE,eAAc,KAAK;AAEvD,IAAM,6CACXF,iBAAgB,OAAmD,0CAA0C;AAExG,IAAM,qDACXA,iBAAgB,eAA2D,0CAA0C;","names":["AsObjectFactory","isPayloadOfSchemaType","AsObjectFactory","isPayloadOfSchemaType","AsObjectFactory","isPayloadOfSchemaType","AsObjectFactory","isPayloadOfSchemaType","AsObjectFactory","AsObjectFactory","isBoundWitness","isStorageMeta","AsObjectFactory","isPayloadOfSchemaType","isPayloadOfSchemaType","isPayloadOfSchemaType","isPayloadOfSchemaType","AsObjectFactory","isPayloadOfSchemaType","isStorageMeta"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { BoundWitness } from '@xyo-network/boundwitness-model';
|
|
2
|
+
import type { Payload } from '@xyo-network/payload-model';
|
|
3
|
+
export declare const AtomicBoundWitnessSchema: "network.xyo.boundwitness.atomic";
|
|
4
|
+
export type AtomicBoundWitnessSchema = typeof AtomicBoundWitnessSchema;
|
|
5
|
+
export interface AtomicBoundWitnessFields<TBoundWitness extends BoundWitness = BoundWitness> {
|
|
6
|
+
bw: TBoundWitness;
|
|
7
|
+
}
|
|
8
|
+
export type AtomicBoundWitness = Payload<AtomicBoundWitnessFields, AtomicBoundWitnessSchema>;
|
|
9
|
+
export declare const isAtomicBoundWitness: (x?: unknown | null) => x is AtomicBoundWitness;
|
|
10
|
+
export declare const asAtomicBoundWitness: {
|
|
11
|
+
<TType extends AtomicBoundWitness>(value: import("@xylabs/promise").AnyNonPromise, config?: import("@xylabs/object").TypeCheckConfig): TType | undefined;
|
|
12
|
+
<TType extends AtomicBoundWitness>(value: import("@xylabs/promise").AnyNonPromise, assert: import("@xylabs/object").StringOrAlertFunction<AtomicBoundWitness>, config?: import("@xylabs/object").TypeCheckConfig): TType;
|
|
13
|
+
};
|
|
14
|
+
export declare const asOptionalAtomicBoundWitness: <TType extends AtomicBoundWitness>(value: import("@xylabs/promise").AnyNonPromise) => TType | undefined;
|
|
15
|
+
//# sourceMappingURL=AtomicBoundWitness.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AtomicBoundWitness.d.ts","sourceRoot":"","sources":["../../../src/payload/AtomicBoundWitness.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AACnE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAGzD,eAAO,MAAM,wBAAwB,EAAG,iCAA0C,CAAA;AAClF,MAAM,MAAM,wBAAwB,GAAG,OAAO,wBAAwB,CAAA;AAEtE,MAAM,WAAW,wBAAwB,CAAC,aAAa,SAAS,YAAY,GAAG,YAAY;IACzF,EAAE,EAAE,aAAa,CAAA;CAClB;AAED,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC,wBAAwB,EAAE,wBAAwB,CAAC,CAAA;AAE5F,eAAO,MAAM,oBAAoB,iDAAsE,CAAA;AAEvG,eAAO,MAAM,oBAAoB;;;CAA+C,CAAA;AAChF,eAAO,MAAM,4BAA4B,yGAAuD,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/payload/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/payload/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAA;AACvC,cAAc,uBAAuB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListProvider.d.ts","sourceRoot":"","sources":["../../../../src/provider/v2/ListProvider.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B,OAAO,CAAC,EAAE,CAAC,CAAA;IACX,IAAI,EAAE,CAAC,EAAE,CAAA;CACV;AAED,MAAM,WAAW,YAAY,CAAC,CAAC,CAAE,SAAQ,UAAU,CAAC,CAAC,CAAC;IACpD,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"ListProvider.d.ts","sourceRoot":"","sources":["../../../../src/provider/v2/ListProvider.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B,OAAO,CAAC,EAAE,CAAC,CAAA;IACX,IAAI,EAAE,CAAC,EAAE,CAAA;CACV;AAED,MAAM,WAAW,YAAY,CAAC,CAAC,CAAE,SAAQ,UAAU,CAAC,CAAC,CAAC;IACpD,GAAG,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI,CAAA;IAClB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CAChC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueueProvider.d.ts","sourceRoot":"","sources":["../../../../src/provider/v2/QueueProvider.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW,CAAC,CAAC,EAAE,CAAC;IAC/B,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,SAAS,CAAA;CACjD;AAED,MAAM,WAAW,aAAa,CAAC,CAAC,EAAE,CAAC,CAAE,SAAQ,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC;IAC5D,GAAG,IAAI,CAAC,CAAA;IACR,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI,CAAA;CACpB"}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
export * from './ChainsProvider.ts';
|
|
1
2
|
export * from './lake/index.ts';
|
|
3
|
+
export * from './ListProvider.ts';
|
|
4
|
+
export * from './QueueProvider.ts';
|
|
2
5
|
export * from './viewer/index.ts';
|
|
6
|
+
export * from './WalletProvider.ts';
|
|
7
|
+
export * from './Xyo.ts';
|
|
3
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/provider/v2/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/provider/v2/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,UAAU,CAAA"}
|
|
@@ -4,12 +4,14 @@ import type { SignedHydratedBlock } from '../../../block/index.ts';
|
|
|
4
4
|
import type { NetworkStatus } from '../../../network/index.ts';
|
|
5
5
|
import type { ChainBlockViewer } from './Block.ts';
|
|
6
6
|
import type { ChainAccountViewer } from './ChainAccount.ts';
|
|
7
|
+
import type { ChainPendingTransactionsViewer } from './PendingTransactions.ts';
|
|
7
8
|
import type { Viewer } from './Viewer.ts';
|
|
8
9
|
export interface ChainViewer extends Viewer<Address> {
|
|
9
10
|
id: Address;
|
|
10
11
|
account(address: Address): ChainAccountViewer;
|
|
11
12
|
block(hash: Hash): ChainBlockViewer;
|
|
12
13
|
currentBlock(): Promisable<SignedHydratedBlock>;
|
|
14
|
+
pendingTransactions(): ChainPendingTransactionsViewer;
|
|
13
15
|
status(): NetworkStatus;
|
|
14
16
|
}
|
|
15
17
|
//# sourceMappingURL=Chain.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chain.d.ts","sourceRoot":"","sources":["../../../../../src/provider/v2/viewer/Chain.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,KAAK,EAA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C,mBAAmB,CAAC,CAAA;IAC/C,mBAAmB,IAAI,8BAA8B,CAAA;IACrD,MAAM,IAAI,aAAa,CAAA;CACxB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Address, Hash } from '@xylabs/hex';
|
|
2
|
+
import type { HydratedTransaction } from '../../../transaction/index.ts';
|
|
3
|
+
import type { QueueViewer } from '../QueueProvider.ts';
|
|
4
|
+
import type { Viewer } from './Viewer.ts';
|
|
5
|
+
export interface ChainPendingTransactionsViewer extends Viewer<Address> {
|
|
6
|
+
chain: Address;
|
|
7
|
+
pendingTransactions(): Promise<QueueViewer<Hash, HydratedTransaction>>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=PendingTransactions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PendingTransactions.d.ts","sourceRoot":"","sources":["../../../../../src/provider/v2/viewer/PendingTransactions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAEhD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAA;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEzC,MAAM,WAAW,8BAA+B,SAAQ,MAAM,CAAC,OAAO,CAAC;IACrE,KAAK,EAAE,OAAO,CAAA;IACd,mBAAmB,IAAI,OAAO,CAAC,WAAW,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC,CAAA;CACvE"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@xyo-network/xl1-protocol",
|
|
4
|
-
"version": "1.4.
|
|
4
|
+
"version": "1.4.18",
|
|
5
5
|
"description": "XYO Layer One Protocol",
|
|
6
6
|
"homepage": "https://xylabs.com",
|
|
7
7
|
"bugs": {
|
|
@@ -26,6 +26,11 @@
|
|
|
26
26
|
"source": "./src/index.ts",
|
|
27
27
|
"default": "./dist/neutral/index.mjs"
|
|
28
28
|
},
|
|
29
|
+
"./v2": {
|
|
30
|
+
"types": "./dist/types/provider/v2/index.d.ts",
|
|
31
|
+
"source": "./src/provider/v2/index.ts",
|
|
32
|
+
"default": "./dist/neutral/provider/v2/index.mjs"
|
|
33
|
+
},
|
|
29
34
|
"./package.json": "./package.json"
|
|
30
35
|
},
|
|
31
36
|
"module": "./dist/neutral/index.mjs",
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AsObjectFactory } from '@xylabs/object'
|
|
2
|
+
import type { BoundWitness } from '@xyo-network/boundwitness-model'
|
|
3
|
+
import type { Payload } from '@xyo-network/payload-model'
|
|
4
|
+
import { isPayloadOfSchemaType } from '@xyo-network/payload-model'
|
|
5
|
+
|
|
6
|
+
export const AtomicBoundWitnessSchema = 'network.xyo.boundwitness.atomic' as const
|
|
7
|
+
export type AtomicBoundWitnessSchema = typeof AtomicBoundWitnessSchema
|
|
8
|
+
|
|
9
|
+
export interface AtomicBoundWitnessFields<TBoundWitness extends BoundWitness = BoundWitness> {
|
|
10
|
+
bw: TBoundWitness
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type AtomicBoundWitness = Payload<AtomicBoundWitnessFields, AtomicBoundWitnessSchema>
|
|
14
|
+
|
|
15
|
+
export const isAtomicBoundWitness = isPayloadOfSchemaType<AtomicBoundWitness>(AtomicBoundWitnessSchema)
|
|
16
|
+
|
|
17
|
+
export const asAtomicBoundWitness = AsObjectFactory.create(isAtomicBoundWitness)
|
|
18
|
+
export const asOptionalAtomicBoundWitness = AsObjectFactory.createOptional(isAtomicBoundWitness)
|
package/src/payload/index.ts
CHANGED
package/src/provider/v2/index.ts
CHANGED
|
@@ -5,6 +5,7 @@ import type { SignedHydratedBlock } from '../../../block/index.ts'
|
|
|
5
5
|
import type { NetworkStatus } from '../../../network/index.ts'
|
|
6
6
|
import type { ChainBlockViewer } from './Block.ts'
|
|
7
7
|
import type { ChainAccountViewer } from './ChainAccount.ts'
|
|
8
|
+
import type { ChainPendingTransactionsViewer } from './PendingTransactions.ts'
|
|
8
9
|
import type { Viewer } from './Viewer.ts'
|
|
9
10
|
|
|
10
11
|
export interface ChainViewer extends Viewer<Address> {
|
|
@@ -12,5 +13,6 @@ export interface ChainViewer extends Viewer<Address> {
|
|
|
12
13
|
account(address: Address): ChainAccountViewer
|
|
13
14
|
block(hash: Hash): ChainBlockViewer
|
|
14
15
|
currentBlock(): Promisable<SignedHydratedBlock>
|
|
16
|
+
pendingTransactions(): ChainPendingTransactionsViewer
|
|
15
17
|
status(): NetworkStatus
|
|
16
18
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Address, Hash } from '@xylabs/hex'
|
|
2
|
+
|
|
3
|
+
import type { HydratedTransaction } from '../../../transaction/index.ts'
|
|
4
|
+
import type { QueueViewer } from '../QueueProvider.ts'
|
|
5
|
+
import type { Viewer } from './Viewer.ts'
|
|
6
|
+
|
|
7
|
+
export interface ChainPendingTransactionsViewer extends Viewer<Address> {
|
|
8
|
+
chain: Address
|
|
9
|
+
pendingTransactions(): Promise<QueueViewer<Hash, HydratedTransaction>>
|
|
10
|
+
}
|
package/xy.config.ts
CHANGED
|
@@ -2,8 +2,8 @@ import type { XyTsupConfig } from '@xylabs/ts-scripts-yarn3'
|
|
|
2
2
|
const config: XyTsupConfig = {
|
|
3
3
|
compile: {
|
|
4
4
|
browser: {},
|
|
5
|
-
neutral: { src: { entry: ['src/index.ts', 'src/cli/index.ts'] } },
|
|
6
|
-
node: {
|
|
5
|
+
neutral: { src: { entry: ['src/index.ts', 'src/cli/index.ts', 'src/provider/v2/index.ts'] } },
|
|
6
|
+
node: {},
|
|
7
7
|
},
|
|
8
8
|
}
|
|
9
9
|
|
package/dist/node/index.mjs
DELETED
|
@@ -1,292 +0,0 @@
|
|
|
1
|
-
// src/block/AllowedBlockPayload.ts
|
|
2
|
-
import { BoundWitnessSchema } from "@xyo-network/boundwitness-model";
|
|
3
|
-
import { isHashStorageMeta, isSchema } from "@xyo-network/payload-model";
|
|
4
|
-
import { isSchemaPayload, SchemaSchema } from "@xyo-network/schema-payload-plugin";
|
|
5
|
-
|
|
6
|
-
// src/payload/elevatable/ChainStakeIntent.ts
|
|
7
|
-
import { AsObjectFactory } from "@xylabs/object";
|
|
8
|
-
import { isPayloadOfSchemaType } from "@xyo-network/payload-model";
|
|
9
|
-
var ChainStakeIntentSchema = "network.xyo.chain.stake.intent";
|
|
10
|
-
var isChainStakeIntent = (x) => {
|
|
11
|
-
return isPayloadOfSchemaType(ChainStakeIntentSchema)(x) && asNonNegativeInteger(x.nbf) !== void 0 && asNonNegativeInteger(x.exp) !== void 0;
|
|
12
|
-
};
|
|
13
|
-
var asChainStakeIntent = AsObjectFactory.create(isChainStakeIntent);
|
|
14
|
-
var asOptionalChainStakeIntent = AsObjectFactory.createOptional(isChainStakeIntent);
|
|
15
|
-
var asNonNegativeInteger = (num) => {
|
|
16
|
-
return Number.isInteger(num) && num >= 0 ? num : void 0;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
// src/payload/elevatable/Executable.ts
|
|
20
|
-
import { isAnyPayload } from "@xyo-network/payload-model";
|
|
21
|
-
var hasFrom = (value) => {
|
|
22
|
-
return value.from !== void 0;
|
|
23
|
-
};
|
|
24
|
-
var isExecutable = (value) => {
|
|
25
|
-
return isAnyPayload(value) && Array.isArray(value.script);
|
|
26
|
-
};
|
|
27
|
-
var asExecutable = (value) => {
|
|
28
|
-
return isExecutable(value) ? value : void 0;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
// src/payload/elevatable/Hash.ts
|
|
32
|
-
import { AsObjectFactory as AsObjectFactory2 } from "@xylabs/object";
|
|
33
|
-
import { isPayloadOfSchemaType as isPayloadOfSchemaType2 } from "@xyo-network/payload-model";
|
|
34
|
-
var HashSchema = "network.xyo.hash";
|
|
35
|
-
var isHashPayload = isPayloadOfSchemaType2(HashSchema);
|
|
36
|
-
var asHashPayload = AsObjectFactory2.create(isHashPayload);
|
|
37
|
-
var asHashPayloadWithStorageMeta = AsObjectFactory2.create(isHashPayload);
|
|
38
|
-
var asOptionalHashPayload = AsObjectFactory2.createOptional(isHashPayload);
|
|
39
|
-
|
|
40
|
-
// src/payload/elevatable/TransferPayload.ts
|
|
41
|
-
import { AsObjectFactory as AsObjectFactory3 } from "@xylabs/object";
|
|
42
|
-
import { isPayloadOfSchemaType as isPayloadOfSchemaType3 } from "@xyo-network/payload-model";
|
|
43
|
-
var TransferSchema = "network.xyo.transfer";
|
|
44
|
-
var isTransfer = isPayloadOfSchemaType3(TransferSchema);
|
|
45
|
-
var asTransfer = AsObjectFactory3.create(isTransfer);
|
|
46
|
-
var asOptionalTransfer = AsObjectFactory3.createOptional(isTransfer);
|
|
47
|
-
|
|
48
|
-
// src/transaction/HydratedBoundWitnessPayload.ts
|
|
49
|
-
import { AsObjectFactory as AsObjectFactory4 } from "@xylabs/object";
|
|
50
|
-
import { isPayloadOfSchemaType as isPayloadOfSchemaType4 } from "@xyo-network/payload-model";
|
|
51
|
-
var HydratedBoundWitnessSchema = "network.xyo.boundwitness.hydrated";
|
|
52
|
-
var isHydratedBoundWitnessPayload = isPayloadOfSchemaType4(HydratedBoundWitnessSchema);
|
|
53
|
-
var asHydratedBoundWitnessPayload = AsObjectFactory4.createOptional(isHydratedBoundWitnessPayload);
|
|
54
|
-
|
|
55
|
-
// src/transaction/TransactionBoundWitness.ts
|
|
56
|
-
import { AsObjectFactory as AsObjectFactory5 } from "@xylabs/object";
|
|
57
|
-
import { isBoundWitness } from "@xyo-network/boundwitness-model";
|
|
58
|
-
import { isStorageMeta } from "@xyo-network/payload-model";
|
|
59
|
-
var isTransactionBoundWitness = (value) => {
|
|
60
|
-
const typedObj = value;
|
|
61
|
-
return isBoundWitness(value) && typedObj.chain !== void 0 && typedObj.fees !== void 0 && typedObj.exp !== void 0 && typedObj.nbf !== void 0;
|
|
62
|
-
};
|
|
63
|
-
var isSignedTransactionBoundWitness = (value) => {
|
|
64
|
-
return isTransactionBoundWitness(value) && isSigned(value);
|
|
65
|
-
};
|
|
66
|
-
var isSigned = (value) => isBoundWitness(value) && value.$signatures.length === value.addresses.length && value.addresses.length > 0;
|
|
67
|
-
var isTransactionBoundWitnessWithStorageMeta = (value) => isTransactionBoundWitness(value) && isStorageMeta(value);
|
|
68
|
-
var isSignedTransactionBoundWitnessWithStorageMeta = (value) => isSignedTransactionBoundWitness(value) && isStorageMeta(value);
|
|
69
|
-
var asTransactionBoundWitness = AsObjectFactory5.create(isTransactionBoundWitness);
|
|
70
|
-
var asOptionalTransactionBoundWitness = AsObjectFactory5.createOptional(isTransactionBoundWitness);
|
|
71
|
-
var asTransactionBoundWitnessWithStorageMeta = AsObjectFactory5.create(isTransactionBoundWitnessWithStorageMeta);
|
|
72
|
-
var asOptionalTransactionBoundWitnessWithStorageMeta = AsObjectFactory5.createOptional(isTransactionBoundWitnessWithStorageMeta);
|
|
73
|
-
|
|
74
|
-
// src/block/AllowedBlockPayload.ts
|
|
75
|
-
var AllowedBlockPayloadSchemas = [TransferSchema, ChainStakeIntentSchema, SchemaSchema, BoundWitnessSchema, HashSchema];
|
|
76
|
-
var isAllowedBlockPayloadSchema = (value) => {
|
|
77
|
-
return isSchema(value) && AllowedBlockPayloadSchemas.includes(value);
|
|
78
|
-
};
|
|
79
|
-
var isAllowedBlockPayload = (value) => {
|
|
80
|
-
return isTransfer(value) || isChainStakeIntent(value) || isSchemaPayload(value) || isTransactionBoundWitness(value) || isHashPayload(value);
|
|
81
|
-
};
|
|
82
|
-
var isAllowedBlockPayloadWithHashStorageMeta = (value) => {
|
|
83
|
-
return isAllowedBlockPayload(value) && isHashStorageMeta(value);
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
// src/block/BlockBoundWitness.ts
|
|
87
|
-
import { isHex } from "@xylabs/hex";
|
|
88
|
-
import { AsObjectFactory as AsObjectFactory6 } from "@xylabs/object";
|
|
89
|
-
import { isBoundWitness as isBoundWitness2 } from "@xyo-network/boundwitness-model";
|
|
90
|
-
import { isStorageMeta as isStorageMeta2 } from "@xyo-network/payload-model";
|
|
91
|
-
var isBlockBoundWitness = (value) => {
|
|
92
|
-
const typedObj = value;
|
|
93
|
-
return isBoundWitness2(value) && Number.isInteger(typedObj.block) && isHex(typedObj.chain);
|
|
94
|
-
};
|
|
95
|
-
var isBlockBoundWitnessWithStorageMeta = (value) => {
|
|
96
|
-
return isBlockBoundWitness(value) && isStorageMeta2(value);
|
|
97
|
-
};
|
|
98
|
-
var asBlockBoundWitness = AsObjectFactory6.create(isBlockBoundWitness);
|
|
99
|
-
var asOptionalBlockBoundWitness = AsObjectFactory6.createOptional(isBlockBoundWitness);
|
|
100
|
-
var asBlockBoundWitnessWithStorageMeta = AsObjectFactory6.create(isBlockBoundWitnessWithStorageMeta);
|
|
101
|
-
var asOptionalBlockBoundWitnessWithStorageMeta = AsObjectFactory6.createOptional(isBlockBoundWitnessWithStorageMeta);
|
|
102
|
-
|
|
103
|
-
// src/xl1/XL1.ts
|
|
104
|
-
var XL1 = (value) => value;
|
|
105
|
-
var MilliXL1 = (value) => value;
|
|
106
|
-
var MicroXL1 = (value) => value;
|
|
107
|
-
var NanoXL1 = (value) => value;
|
|
108
|
-
var PicoXL1 = (value) => value;
|
|
109
|
-
var FemtoXL1 = (value) => value;
|
|
110
|
-
var AttoXL1 = (value) => value;
|
|
111
|
-
var XL1ConvertDict = {
|
|
112
|
-
xl1: 18,
|
|
113
|
-
milli: 15,
|
|
114
|
-
micro: 12,
|
|
115
|
-
nano: 9,
|
|
116
|
-
pico: 6,
|
|
117
|
-
femto: 3,
|
|
118
|
-
atto: 0
|
|
119
|
-
};
|
|
120
|
-
var XL1Places = {
|
|
121
|
-
xl1: 18n,
|
|
122
|
-
milli: 15n,
|
|
123
|
-
micro: 12n,
|
|
124
|
-
nano: 9n,
|
|
125
|
-
pico: 6n,
|
|
126
|
-
femto: 3n,
|
|
127
|
-
atto: 0n
|
|
128
|
-
};
|
|
129
|
-
var AttoXL1ConvertFactor = {
|
|
130
|
-
xl1: 10n ** XL1Places.xl1,
|
|
131
|
-
milli: 10n ** XL1Places.milli,
|
|
132
|
-
micro: 10n ** XL1Places.micro,
|
|
133
|
-
nano: 10n ** XL1Places.nano,
|
|
134
|
-
pico: 10n ** XL1Places.pico,
|
|
135
|
-
femto: 10n ** XL1Places.femto,
|
|
136
|
-
atto: 10n ** XL1Places.atto
|
|
137
|
-
};
|
|
138
|
-
function xl1ConvertFactor(unit) {
|
|
139
|
-
return 10n ** XL1Places[unit];
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
// src/constants/minTransactionFees.ts
|
|
143
|
-
var minTransactionFees = {
|
|
144
|
-
base: AttoXL1(1000n * AttoXL1ConvertFactor.micro),
|
|
145
|
-
gasPrice: AttoXL1(10n * AttoXL1ConvertFactor.micro),
|
|
146
|
-
gasLimit: AttoXL1(1000000n * AttoXL1ConvertFactor.micro),
|
|
147
|
-
priority: AttoXL1(0n * AttoXL1ConvertFactor.micro)
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
// src/constants/defaultTransactionFees.ts
|
|
151
|
-
var defaultTransactionFees = {
|
|
152
|
-
base: minTransactionFees.base,
|
|
153
|
-
gasPrice: AttoXL1(10n * AttoXL1ConvertFactor.micro),
|
|
154
|
-
gasLimit: AttoXL1(1000000n * AttoXL1ConvertFactor.micro),
|
|
155
|
-
priority: minTransactionFees.priority
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
// src/constants/StepSizes.ts
|
|
159
|
-
var StepSizes = [10, 105, 1103, 11576, 121551, 1276282, 13400956];
|
|
160
|
-
|
|
161
|
-
// src/constants/TransactionGasCosts.ts
|
|
162
|
-
var TransactionGasCosts = {
|
|
163
|
-
/**
|
|
164
|
-
* The cost of storing each character that is added to the chain
|
|
165
|
-
* This includes the transaction JSON and all the elevated payloads' JSON
|
|
166
|
-
*/
|
|
167
|
-
characterStorage: 10n,
|
|
168
|
-
/** The cost of static validating every payload that will be included in the chain */
|
|
169
|
-
payloadValidation: 1000n,
|
|
170
|
-
/** The cost of validating each signature that will be included in the chain */
|
|
171
|
-
signatureValidation: 1000n,
|
|
172
|
-
/** The cost of validating each hash that will be included in the chain */
|
|
173
|
-
hashValidation: 100n,
|
|
174
|
-
/** The cost of validating a balance state, triggered by a Transfer payload or gas collection */
|
|
175
|
-
balanceValidation: 100n
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
// src/fields/BlockNumber.ts
|
|
179
|
-
import { AsObjectFactory as AsObjectFactory7 } from "@xylabs/object";
|
|
180
|
-
import {
|
|
181
|
-
isPayloadOfSchemaType as isPayloadOfSchemaType5,
|
|
182
|
-
isPayloadOfSchemaTypeWithSources
|
|
183
|
-
} from "@xyo-network/payload-model";
|
|
184
|
-
var BlockNumberSchema = "network.xyo.chain.block.number";
|
|
185
|
-
var isBlockNumber = isPayloadOfSchemaType5(BlockNumberSchema);
|
|
186
|
-
var asBlockNumber = AsObjectFactory7.create(isBlockNumber);
|
|
187
|
-
var asOptionalBlockNumber = AsObjectFactory7.createOptional(isBlockNumber);
|
|
188
|
-
var isBlockNumberWithSources = isPayloadOfSchemaTypeWithSources(BlockNumberSchema);
|
|
189
|
-
var asBlockNumberWithSources = AsObjectFactory7.create(isBlockNumberWithSources);
|
|
190
|
-
var asOptionalBlockNumberWithSources = AsObjectFactory7.createOptional(isBlockNumberWithSources);
|
|
191
|
-
|
|
192
|
-
// src/network/Status.ts
|
|
193
|
-
import { isPayloadOfSchemaType as isPayloadOfSchemaType6 } from "@xyo-network/payload-model";
|
|
194
|
-
var NetworkStatusSchema = "network.xyo.chain.status";
|
|
195
|
-
var isNetworkStatus = isPayloadOfSchemaType6(NetworkStatusSchema);
|
|
196
|
-
|
|
197
|
-
// src/services/Chain/ChainIdentification.ts
|
|
198
|
-
import { isPayloadOfSchemaType as isPayloadOfSchemaType7 } from "@xyo-network/payload-model";
|
|
199
|
-
var ChainIdentificationPayloadSchema = "network.xyo.chain.identification";
|
|
200
|
-
var isChainIdentificationPayload = isPayloadOfSchemaType7(ChainIdentificationPayloadSchema);
|
|
201
|
-
|
|
202
|
-
// src/services/Chain/ChainInformation.ts
|
|
203
|
-
import { isPayloadOfSchemaType as isPayloadOfSchemaType8 } from "@xyo-network/payload-model";
|
|
204
|
-
var ChainInformationPayloadSchema = "network.xyo.chain.information";
|
|
205
|
-
var isChainInformationPayload = isPayloadOfSchemaType8(ChainInformationPayloadSchema);
|
|
206
|
-
|
|
207
|
-
// src/services/stakeIntent/ChainIndexingServiceStateSchema.ts
|
|
208
|
-
import { AsObjectFactory as AsObjectFactory8 } from "@xylabs/object";
|
|
209
|
-
import { isPayloadOfSchemaType as isPayloadOfSchemaType9, isStorageMeta as isStorageMeta3 } from "@xyo-network/payload-model";
|
|
210
|
-
var ChainIndexingServiceStateSchema = "network.xyo.chain.indexing.service.state";
|
|
211
|
-
var isChainIndexingServiceState = (payload) => {
|
|
212
|
-
return isPayloadOfSchemaType9(ChainIndexingServiceStateSchema)(payload);
|
|
213
|
-
};
|
|
214
|
-
var asChainIndexingServiceState = AsObjectFactory8.create(isChainIndexingServiceState);
|
|
215
|
-
var isChainIndexingServiceStateWithStorageMeta = (value) => isChainIndexingServiceState(value) && isStorageMeta3(value);
|
|
216
|
-
var asChainIndexingServiceStateWithStorageMeta = AsObjectFactory8.create(isChainIndexingServiceStateWithStorageMeta);
|
|
217
|
-
var asOptionalChainIndexingServiceStateWithStorageMeta = AsObjectFactory8.createOptional(isChainIndexingServiceStateWithStorageMeta);
|
|
218
|
-
export {
|
|
219
|
-
AllowedBlockPayloadSchemas,
|
|
220
|
-
AttoXL1,
|
|
221
|
-
AttoXL1ConvertFactor,
|
|
222
|
-
BlockNumberSchema,
|
|
223
|
-
ChainIdentificationPayloadSchema,
|
|
224
|
-
ChainIndexingServiceStateSchema,
|
|
225
|
-
ChainInformationPayloadSchema,
|
|
226
|
-
ChainStakeIntentSchema,
|
|
227
|
-
FemtoXL1,
|
|
228
|
-
HashSchema,
|
|
229
|
-
HydratedBoundWitnessSchema,
|
|
230
|
-
MicroXL1,
|
|
231
|
-
MilliXL1,
|
|
232
|
-
NanoXL1,
|
|
233
|
-
NetworkStatusSchema,
|
|
234
|
-
PicoXL1,
|
|
235
|
-
StepSizes,
|
|
236
|
-
TransactionGasCosts,
|
|
237
|
-
TransferSchema,
|
|
238
|
-
XL1,
|
|
239
|
-
XL1ConvertDict,
|
|
240
|
-
XL1Places,
|
|
241
|
-
asBlockBoundWitness,
|
|
242
|
-
asBlockBoundWitnessWithStorageMeta,
|
|
243
|
-
asBlockNumber,
|
|
244
|
-
asBlockNumberWithSources,
|
|
245
|
-
asChainIndexingServiceState,
|
|
246
|
-
asChainIndexingServiceStateWithStorageMeta,
|
|
247
|
-
asChainStakeIntent,
|
|
248
|
-
asExecutable,
|
|
249
|
-
asHashPayload,
|
|
250
|
-
asHashPayloadWithStorageMeta,
|
|
251
|
-
asHydratedBoundWitnessPayload,
|
|
252
|
-
asOptionalBlockBoundWitness,
|
|
253
|
-
asOptionalBlockBoundWitnessWithStorageMeta,
|
|
254
|
-
asOptionalBlockNumber,
|
|
255
|
-
asOptionalBlockNumberWithSources,
|
|
256
|
-
asOptionalChainIndexingServiceStateWithStorageMeta,
|
|
257
|
-
asOptionalChainStakeIntent,
|
|
258
|
-
asOptionalHashPayload,
|
|
259
|
-
asOptionalTransactionBoundWitness,
|
|
260
|
-
asOptionalTransactionBoundWitnessWithStorageMeta,
|
|
261
|
-
asOptionalTransfer,
|
|
262
|
-
asTransactionBoundWitness,
|
|
263
|
-
asTransactionBoundWitnessWithStorageMeta,
|
|
264
|
-
asTransfer,
|
|
265
|
-
defaultTransactionFees,
|
|
266
|
-
hasFrom,
|
|
267
|
-
isAllowedBlockPayload,
|
|
268
|
-
isAllowedBlockPayloadSchema,
|
|
269
|
-
isAllowedBlockPayloadWithHashStorageMeta,
|
|
270
|
-
isBlockBoundWitness,
|
|
271
|
-
isBlockBoundWitnessWithStorageMeta,
|
|
272
|
-
isBlockNumber,
|
|
273
|
-
isBlockNumberWithSources,
|
|
274
|
-
isChainIdentificationPayload,
|
|
275
|
-
isChainIndexingServiceState,
|
|
276
|
-
isChainIndexingServiceStateWithStorageMeta,
|
|
277
|
-
isChainInformationPayload,
|
|
278
|
-
isChainStakeIntent,
|
|
279
|
-
isExecutable,
|
|
280
|
-
isHashPayload,
|
|
281
|
-
isHydratedBoundWitnessPayload,
|
|
282
|
-
isNetworkStatus,
|
|
283
|
-
isSigned,
|
|
284
|
-
isSignedTransactionBoundWitness,
|
|
285
|
-
isSignedTransactionBoundWitnessWithStorageMeta,
|
|
286
|
-
isTransactionBoundWitness,
|
|
287
|
-
isTransactionBoundWitnessWithStorageMeta,
|
|
288
|
-
isTransfer,
|
|
289
|
-
minTransactionFees,
|
|
290
|
-
xl1ConvertFactor
|
|
291
|
-
};
|
|
292
|
-
//# sourceMappingURL=index.mjs.map
|
package/dist/node/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/block/AllowedBlockPayload.ts","../../src/payload/elevatable/ChainStakeIntent.ts","../../src/payload/elevatable/Executable.ts","../../src/payload/elevatable/Hash.ts","../../src/payload/elevatable/TransferPayload.ts","../../src/transaction/HydratedBoundWitnessPayload.ts","../../src/transaction/TransactionBoundWitness.ts","../../src/block/BlockBoundWitness.ts","../../src/xl1/XL1.ts","../../src/constants/minTransactionFees.ts","../../src/constants/defaultTransactionFees.ts","../../src/constants/StepSizes.ts","../../src/constants/TransactionGasCosts.ts","../../src/fields/BlockNumber.ts","../../src/network/Status.ts","../../src/services/Chain/ChainIdentification.ts","../../src/services/Chain/ChainInformation.ts","../../src/services/stakeIntent/ChainIndexingServiceStateSchema.ts"],"sourcesContent":["import { BoundWitnessSchema } from '@xyo-network/boundwitness-model'\nimport type { Schema, WithStorageMeta } from '@xyo-network/payload-model'\nimport { isHashStorageMeta, isSchema } from '@xyo-network/payload-model'\nimport type { SchemaPayload } from '@xyo-network/schema-payload-plugin'\nimport { isSchemaPayload, SchemaSchema } from '@xyo-network/schema-payload-plugin'\n\nimport type {\n ChainStakeIntent, HashPayload, Transfer,\n} from '../payload/index.ts'\nimport {\n ChainStakeIntentSchema, HashSchema, isChainStakeIntent, isHashPayload, isTransfer, TransferSchema,\n} from '../payload/index.ts'\nimport { isTransactionBoundWitness, type TransactionBoundWitness } from '../transaction/index.ts'\n\nexport type AllowedBlockPayload = Transfer | ChainStakeIntent | SchemaPayload | TransactionBoundWitness | HashPayload\nexport const AllowedBlockPayloadSchemas: Schema[] = [TransferSchema, ChainStakeIntentSchema, SchemaSchema, BoundWitnessSchema, HashSchema]\nexport type AllowedBlockPayloadSchema = typeof AllowedBlockPayloadSchemas[number]\n\nexport const isAllowedBlockPayloadSchema = (value: unknown): value is AllowedBlockPayloadSchema => {\n return isSchema(value) && AllowedBlockPayloadSchemas.includes(value)\n}\n\nexport const isAllowedBlockPayload = (value: unknown): value is AllowedBlockPayload => {\n return isTransfer(value) || isChainStakeIntent(value) || isSchemaPayload(value) || isTransactionBoundWitness(value) || isHashPayload(value)\n}\n\nexport const isAllowedBlockPayloadWithHashStorageMeta = (value: unknown): value is WithStorageMeta<AllowedBlockPayload> => {\n return isAllowedBlockPayload(value) && isHashStorageMeta(value)\n}\n","import { AsObjectFactory } from '@xylabs/object'\nimport type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\n\nimport type { BlockDuration } from '../../fields/index.ts'\nimport type { FromFields } from './Executable.ts'\n\nexport const ChainStakeIntentSchema = 'network.xyo.chain.stake.intent' as const\nexport type ChainStakeIntentSchema = typeof ChainStakeIntentSchema\n\nexport type Intent = 'producer' // | 'bank'\n\nexport interface ChainStakeIntentFields extends BlockDuration, FromFields {\n /*\n * The intent of the staking\n */\n intent: Intent\n}\n\nexport type ChainStakeIntent = Payload<ChainStakeIntentFields, ChainStakeIntentSchema>\n\nexport const isChainStakeIntent = (x?: unknown | null): x is ChainStakeIntent => {\n return isPayloadOfSchemaType<ChainStakeIntent>(ChainStakeIntentSchema)(x)\n && asNonNegativeInteger(x.nbf) !== undefined\n && asNonNegativeInteger(x.exp) !== undefined\n}\nexport const asChainStakeIntent = AsObjectFactory.create(isChainStakeIntent)\nexport const asOptionalChainStakeIntent = AsObjectFactory.createOptional(isChainStakeIntent)\n\nconst asNonNegativeInteger = (num: number) => {\n return (Number.isInteger(num) && num >= 0) ? num : undefined\n}\n","import type { Address } from '@xylabs/hex'\nimport type { EmptyObject } from '@xylabs/object'\nimport { isAnyPayload } from '@xyo-network/payload-model'\n\nexport interface FromFields {\n // the address that is treated as the source of this action\n from: Address\n}\n\nexport const hasFrom = (value: unknown): value is FromFields => {\n return (value as FromFields).from !== undefined\n}\n\nexport interface ExecutableFields {\n script: string[]\n}\n\nexport type Executable<T extends EmptyObject = EmptyObject> = T & ExecutableFields\nexport type OptionalExecutable<T extends EmptyObject = EmptyObject> = T & Partial<ExecutableFields>\n\nexport const isExecutable = <T extends EmptyObject>(value: T | undefined): value is Executable<T> => {\n return isAnyPayload(value) && Array.isArray((value as unknown as ExecutableFields).script)\n}\n\nexport const asExecutable = <T extends EmptyObject>(value: T | undefined): Executable<T> | undefined => {\n return isExecutable(value)\n ? value as unknown as Executable<T>\n : undefined\n}\n","import type { Hash } from '@xylabs/hex'\nimport { AsObjectFactory } from '@xylabs/object'\nimport type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\n\nexport const HashSchema = 'network.xyo.hash' as const\nexport type HashSchema = typeof HashSchema\n\nexport interface HashFields {\n hash: Hash\n}\n\nexport type HashPayload = Payload<HashFields, HashSchema>\n\nexport const isHashPayload = isPayloadOfSchemaType<HashPayload>(HashSchema)\n\nexport const asHashPayload = AsObjectFactory.create(isHashPayload)\nexport const asHashPayloadWithStorageMeta = AsObjectFactory.create(isHashPayload)\nexport const asOptionalHashPayload = AsObjectFactory.createOptional(isHashPayload)\n","import type {\n Address,\n Hex,\n} from '@xylabs/hex'\nimport { AsObjectFactory } from '@xylabs/object'\nimport type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\n\nimport type { FromFields } from './Executable.ts'\n\nexport const TransferSchema = 'network.xyo.transfer' as const\nexport type TransferSchema = typeof TransferSchema\n\nexport interface TransferFields extends FromFields {\n epoch: number\n // the amount that is being sent to another address\n transfers: Partial<Record<Address, Hex>>\n}\n\n// if this payload is included in a boundwitness, it needs to be available for inspection to be included in block\nexport type Transfer = Payload<TransferFields, TransferSchema>\n\nexport const isTransfer = isPayloadOfSchemaType<Transfer>(TransferSchema)\n\nexport const asTransfer = AsObjectFactory.create(isTransfer)\nexport const asOptionalTransfer = AsObjectFactory.createOptional(isTransfer)\n","import { AsObjectFactory } from '@xylabs/object'\nimport type { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { isPayloadOfSchemaType, type Payload } from '@xyo-network/payload-model'\n\nexport const HydratedBoundWitnessSchema = 'network.xyo.boundwitness.hydrated'\nexport type HydratedBoundWitnessSchema = typeof HydratedBoundWitnessSchema\n\nexport type HydratedBoundWitnessPayload = Payload<{\n bw: BoundWitness\n payloads: Payload[]\n},\n HydratedBoundWitnessSchema>\n\nexport const isHydratedBoundWitnessPayload = isPayloadOfSchemaType<HydratedBoundWitnessPayload>(HydratedBoundWitnessSchema)\nexport const asHydratedBoundWitnessPayload = AsObjectFactory.createOptional<HydratedBoundWitnessPayload>(isHydratedBoundWitnessPayload)\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 { BlockDuration } from '../fields/index.ts'\nimport type { FromFields, OptionalExecutable } from '../payload/index.ts'\nimport type { TransactionFeesFields } from './TransactionFeesFields.ts'\n\nexport interface TransactionBoundWitnessFields extends BlockDuration, TransactionFeesFields {\n chain: Address\n}\n\nexport type TransactionBoundWitness = BoundWitness<TransactionBoundWitnessFields & OptionalExecutable & FromFields>\n\nexport const isTransactionBoundWitness = (value: unknown): value is TransactionBoundWitness => {\n const typedObj = value as TransactionBoundWitness\n return isBoundWitness(value)\n && typedObj.chain !== undefined\n && typedObj.fees !== undefined\n && typedObj.exp !== undefined\n && typedObj.nbf !== undefined\n}\n\nexport const isSignedTransactionBoundWitness = (value: unknown): value is Signed<TransactionBoundWitness> => {\n return isTransactionBoundWitness(value) && isSigned(value)\n}\n\nexport const isSigned = <T extends BoundWitness = BoundWitness>(value: unknown): value is Signed<T> =>\n isBoundWitness(value)\n && value.$signatures.length === value.addresses.length\n && value.addresses.length > 0\n\nexport const isTransactionBoundWitnessWithStorageMeta = (value: unknown): value is WithStorageMeta<TransactionBoundWitness> =>\n isTransactionBoundWitness(value)\n && isStorageMeta(value)\n\nexport const 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","export type XL1 = bigint & { readonly _tag: 'XL1' } // 1e-18\nexport type MilliXL1 = bigint & { readonly _tag: 'MilliXL1' } // 1e-15 [XL1 * 1e3 = milliXL1] [milliXL1 / 1e3 = XL1]\nexport type MicroXL1 = bigint & { readonly _tag: 'MicroXL1' } // 1e-12 [XL1 * 1e6 = microXL1] [microXL1 / 1e6 = XL1]\nexport type NanoXL1 = bigint & { readonly _tag: 'NanoXL1' } // 1e-9 [XL1 * 1e9 = nanoXL1] [nanoXL1 / 1e9 = XL1]\nexport type PicoXL1 = bigint & { readonly _tag: 'PicoXL1' } // 1e-6 [XL1 * 1e12 = picoXL1] [picoXL1 / 1e12 = XL1]\nexport type FemtoXL1 = bigint & { readonly _tag: 'FemtoXL1' } // 1e-3 [XL1 * 1e15 = femtoXL1] [femtoXL1 / 1e15 = XL1]\nexport type AttoXL1 = bigint & { readonly _tag: 'AttoXL1' } // 1e-0 [XL1 * 1e18 = attoXL1] [attoXL1 / 1e18 = XL1]\n\nexport type TypingFunc<T extends bigint> = (value: bigint) => T\n\nexport const XL1: TypingFunc<XL1> = (value: bigint): XL1 => value as XL1\nexport const MilliXL1: TypingFunc<MilliXL1> = (value: bigint): MilliXL1 => value as MilliXL1\nexport const MicroXL1: TypingFunc<MicroXL1> = (value: bigint): MicroXL1 => value as MicroXL1\nexport const NanoXL1: TypingFunc<NanoXL1> = (value: bigint): NanoXL1 => value as NanoXL1\nexport const PicoXL1: TypingFunc<PicoXL1> = (value: bigint): PicoXL1 => value as PicoXL1\nexport const FemtoXL1: TypingFunc<FemtoXL1> = (value: bigint): FemtoXL1 => value as FemtoXL1\nexport const AttoXL1: TypingFunc<AttoXL1> = (value: bigint): AttoXL1 => value as AttoXL1\n\ntype XL1Units = 'xl1' | 'milli' | 'micro' | 'nano' | 'pico' | 'femto' | 'atto'\n\n/** @deprecated use XL1Places and xl1ConvertFactor(unit) instead */\nexport const XL1ConvertDict: Record<XL1Units, number> = {\n xl1: 18,\n milli: 15,\n micro: 12,\n nano: 9,\n pico: 6,\n femto: 3,\n atto: 0,\n} as const\n\nexport const XL1Places: Record<XL1Units, bigint> = {\n xl1: 18n,\n milli: 15n,\n micro: 12n,\n nano: 9n,\n pico: 6n,\n femto: 3n,\n atto: 0n,\n} as const\n\n/**\n * Convert factor by which a respective unit is multiplied to convert it to AttoXL1 or\n * by which AttoXL1 is divided to convert it to respective unit is multiplied.\n */\nexport const AttoXL1ConvertFactor: Record<XL1Units, bigint> = {\n xl1: 10n ** XL1Places.xl1,\n milli: 10n ** XL1Places.milli,\n micro: 10n ** XL1Places.micro,\n nano: 10n ** XL1Places.nano,\n pico: 10n ** XL1Places.pico,\n femto: 10n ** XL1Places.femto,\n atto: 10n ** XL1Places.atto,\n} as const\n\n/** @deprecated use AttoXL1ConvertFactor instead */\nexport function xl1ConvertFactor(unit: XL1Units) {\n return 10n ** XL1Places[unit]\n}\n","import type { TransactionFeesBigInt } from '../transaction/index.ts'\nimport { AttoXL1, AttoXL1ConvertFactor } from '../xl1/index.ts'\n\nexport const minTransactionFees: TransactionFeesBigInt = {\n base: AttoXL1(1000n * AttoXL1ConvertFactor.micro),\n gasPrice: AttoXL1(10n * AttoXL1ConvertFactor.micro),\n gasLimit: AttoXL1(1_000_000n * AttoXL1ConvertFactor.micro),\n priority: AttoXL1(0n * AttoXL1ConvertFactor.micro),\n} as const\n","import type { TransactionFeesBigInt } from '../transaction/index.ts'\nimport { AttoXL1, AttoXL1ConvertFactor } from '../xl1/index.ts'\nimport { minTransactionFees } from './minTransactionFees.ts'\n\nexport const defaultTransactionFees: TransactionFeesBigInt = {\n base: minTransactionFees.base,\n gasPrice: AttoXL1(10n * AttoXL1ConvertFactor.micro),\n gasLimit: AttoXL1(1_000_000n * AttoXL1ConvertFactor.micro),\n priority: minTransactionFees.priority,\n} as const\n","export const StepSizes = [10, 105, 1103, 11_576, 121_551, 1_276_282, 13_400_956] as const\n","export const TransactionGasCosts = {\n /**\n * The cost of storing each character that is added to the chain\n * This includes the transaction JSON and all the elevated payloads' JSON\n */\n characterStorage: 10n,\n\n /** The cost of static validating every payload that will be included in the chain */\n payloadValidation: 1000n,\n\n /** The cost of validating each signature that will be included in the chain */\n signatureValidation: 1000n,\n\n /** The cost of validating each hash that will be included in the chain */\n hashValidation: 100n,\n\n /** The cost of validating a balance state, triggered by a Transfer payload or gas collection */\n balanceValidation: 100n,\n} as const\n\n/** Gas Calculation\n *\n * 1 Million microXL1 (mXL1) = 1 XL1\n *\n * Gas amount is calculated as follows:\n *\n * 1. Each byte in the transaction cost 10 gas\n * 2. Each payload validation in the transaction costs 1000 gas\n * 3. Each signature verification in the transaction costs 1000 gas\n * 4. Each hash validation in the transaction costs 100 gas\n * 5. Each balance validation in the transaction costs 100 gas\n * 6. Processing/Compute/Storage Cost?\n * 7. operation Costs?\n *\n * The total gas cost is calculated by multiplying the gas amount by the gas price.\n *\n * minGasPrice is initially set to 100 mXL1\n * minBase is initially set to 1000 mXL1\n * minPriority is always 0 mXL1, but can be set to increase the priority of the transaction\n *\n */\n","import type { Hex } from '@xylabs/hex'\nimport { AsObjectFactory } from '@xylabs/object'\nimport type { Payload, WithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\n isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nexport const BlockNumberSchema = 'network.xyo.chain.block.number' as const\nexport type BlockNumberSchema = typeof BlockNumberSchema\n\nexport interface BlockNumberFields {\n /**\n * The block number\n */\n block: Hex\n /**\n * The chain id\n */\n chain?: Hex\n}\n/**\n * The number of a block\n */\nexport type BlockNumber = Payload<BlockNumberFields, BlockNumberSchema>\n\n/**\n * Identity function for determining if an object is a BlockNumber\n */\nexport const isBlockNumber = isPayloadOfSchemaType<BlockNumber>(BlockNumberSchema)\nexport const asBlockNumber = AsObjectFactory.create<BlockNumber>(isBlockNumber)\nexport const asOptionalBlockNumber = AsObjectFactory.createOptional<BlockNumber>(isBlockNumber)\n\n/**\n * Identity function for determining if an object is a BlockNumber with sources\n */\nexport const isBlockNumberWithSources = isPayloadOfSchemaTypeWithSources<BlockNumber>(BlockNumberSchema)\nexport const asBlockNumberWithSources = AsObjectFactory.create<WithSources<BlockNumber>>(isBlockNumberWithSources)\nexport const asOptionalBlockNumberWithSources = AsObjectFactory.createOptional<WithSources<BlockNumber>>(isBlockNumberWithSources)\n","import type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\n\nexport const NetworkStatusSchema = 'network.xyo.chain.status' as const\nexport type NetworkStatusSchema = typeof NetworkStatusSchema\n\nexport type NetworkStatusState = 'online' | 'offline' | 'degraded' | 'unknown'\n\nexport type NetworkStatusUpdate = {\n end: number\n start: number\n update: string\n}\n\nexport interface NetworkStatusFields {\n description: string\n state: NetworkStatusState\n updates?: NetworkStatusUpdate[]\n}\n\nexport type NetworkStatus = Payload<NetworkStatusFields, NetworkStatusSchema>\n\nexport const isNetworkStatus = isPayloadOfSchemaType<NetworkStatus>(NetworkStatusSchema)\n","import type { Address } from '@xylabs/hex'\nimport type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\n\nexport const ChainIdentificationPayloadSchema = 'network.xyo.chain.identification' as const\nexport type ChainIdentificationPayloadSchema = typeof ChainIdentificationPayloadSchema\n\n/**\n * Identification required to uniquely identify a chain\n */\nexport interface ChainIdentification {\n /** @field the id of the chain */\n id: Address\n}\n\nexport type ChainIdentificationPayload = Payload<ChainIdentification, ChainIdentificationPayloadSchema>\nexport const isChainIdentificationPayload = isPayloadOfSchemaType<ChainIdentificationPayload>(ChainIdentificationPayloadSchema)\n","import type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\n\nexport const ChainInformationPayloadSchema = 'network.xyo.chain.information' as const\nexport type ChainInformationPayloadSchema = typeof ChainInformationPayloadSchema\n\nimport type { ChainIdentification } from './ChainIdentification.ts'\n\n/**\n * Information required to produce a chain\n */\nexport interface ChainInformation extends ChainIdentification {\n // TODO: Add these fields which are currently promises on the smart contract\n // forkedAtBlockNumber: bigint\n // forkedAtHash: Hash\n // forkedChainId: Address\n}\n\nexport type ChainInformationPayload = Payload<ChainIdentification, ChainInformationPayloadSchema>\nexport const isChainInformationPayload = isPayloadOfSchemaType<ChainInformationPayload>(ChainInformationPayloadSchema)\n","import type { Hash } from '@xylabs/hex'\nimport type { JsonValue } from '@xylabs/object'\nimport { AsObjectFactory } from '@xylabs/object'\nimport type { Payload, WithStorageMeta } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType, isStorageMeta } from '@xyo-network/payload-model'\n\nexport interface ChainIndexingServiceStateFields<T extends JsonValue = JsonValue> {\n /**\n * The hash of the last block that this service has indexing\n */\n endBlockHash: Hash\n /**\n * The hash of the block that the service started indexing. If undefined, the service is\n * assumed to have started indexing from the genesis block\n */\n startBlockHash?: Hash\n /**\n * The indexed state for the range\n */\n state: T\n}\nexport const ChainIndexingServiceStateSchema = 'network.xyo.chain.indexing.service.state' as const\nexport type ChainIndexingServiceStateSchema = typeof ChainIndexingServiceStateSchema\n\n/**\n * The result of a ChainIndexingServiceState\n */\nexport type ChainIndexingServiceState<T extends JsonValue = JsonValue> = Payload<ChainIndexingServiceStateFields<T>, ChainIndexingServiceStateSchema>\n\n/**\n * Identity functions for determining if an object is an ChainIndexingServiceState\n */\nexport const isChainIndexingServiceState = <T extends JsonValue = JsonValue>(payload?: unknown): payload is ChainIndexingServiceState<T> => {\n return isPayloadOfSchemaType<ChainIndexingServiceState<T>>(ChainIndexingServiceStateSchema)(payload)\n}\nexport const asChainIndexingServiceState = AsObjectFactory.create<ChainIndexingServiceState<JsonValue>>(isChainIndexingServiceState)\n\nexport const isChainIndexingServiceStateWithStorageMeta\n= <T extends JsonValue = JsonValue>(value: unknown): value is WithStorageMeta<ChainIndexingServiceState<T>> =>\n isChainIndexingServiceState<T>(value) && isStorageMeta(value)\n\nexport const asChainIndexingServiceStateWithStorageMeta\n= AsObjectFactory.create<WithStorageMeta<ChainIndexingServiceState>>(isChainIndexingServiceStateWithStorageMeta)\n\nexport const asOptionalChainIndexingServiceStateWithStorageMeta\n= AsObjectFactory.createOptional<WithStorageMeta<ChainIndexingServiceState>>(isChainIndexingServiceStateWithStorageMeta)\n"],"mappings":";AAAA,SAAS,0BAA0B;AAEnC,SAAS,mBAAmB,gBAAgB;AAE5C,SAAS,iBAAiB,oBAAoB;;;ACJ9C,SAAS,uBAAuB;AAEhC,SAAS,6BAA6B;AAK/B,IAAM,yBAAyB;AAc/B,IAAM,qBAAqB,CAAC,MAA8C;AAC/E,SAAO,sBAAwC,sBAAsB,EAAE,CAAC,KAC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AAEhC,SAAS,yBAAAC,wBAAuB,iBAAAC,sBAAqB;AAiB9C,IAAM,kCAAkC;AAWxC,IAAM,8BAA8B,CAAkC,YAA+D;AAC1I,SAAOD,uBAAoD,+BAA+B,EAAE,OAAO;AACrG;AACO,IAAM,8BAA8BD,iBAAgB,OAA6C,2BAA2B;AAE5H,IAAM,6CACX,CAAkC,UAClC,4BAA+B,KAAK,KAAKE,eAAc,KAAK;AAEvD,IAAM,6CACXF,iBAAgB,OAAmD,0CAA0C;AAExG,IAAM,qDACXA,iBAAgB,eAA2D,0CAA0C;","names":["AsObjectFactory","isPayloadOfSchemaType","AsObjectFactory","isPayloadOfSchemaType","AsObjectFactory","isPayloadOfSchemaType","AsObjectFactory","AsObjectFactory","isBoundWitness","isStorageMeta","AsObjectFactory","isPayloadOfSchemaType","isPayloadOfSchemaType","isPayloadOfSchemaType","isPayloadOfSchemaType","AsObjectFactory","isPayloadOfSchemaType","isStorageMeta"]}
|