@xyo-network/xl1-validation 1.26.43 → 1.26.44

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.
@@ -96,8 +96,8 @@ var BoundWitnessReferencesValidator = (allowedSchemas) => ([bw, payloadSet]) =>
96
96
  }
97
97
  }
98
98
  } catch (ex) {
99
- const error = new HydratedBoundWitnessValidationError(bw?._hash ?? ZERO_HASH, [bw, payloadSet], `validation excepted: ${String(ex)}`, ex);
100
- errors.push(error);
99
+ const error2 = new HydratedBoundWitnessValidationError(bw?._hash ?? ZERO_HASH, [bw, payloadSet], `validation excepted: ${String(ex)}`, ex);
100
+ errors.push(error2);
101
101
  }
102
102
  return errors;
103
103
  };
@@ -130,27 +130,51 @@ var BoundWitnessSignaturesValidator = async (bw) => {
130
130
  };
131
131
 
132
132
  // src/transaction/validateTransaction.ts
133
- import { ZERO_HASH as ZERO_HASH9 } from "@xylabs/sdk-js";
134
- import { HydratedTransactionValidationError as HydratedTransactionValidationError8, isTransactionBoundWitness } from "@xyo-network/xl1-protocol-lib";
133
+ import { ZERO_HASH as ZERO_HASH10 } from "@xylabs/sdk-js";
134
+ import { HydratedTransactionValidationError as HydratedTransactionValidationError9, isTransactionBoundWitness } from "@xyo-network/xl1-protocol-lib";
135
135
 
136
- // src/transaction/validators/TransactionDurationValidator.ts
136
+ // src/transaction/validators/TransactionBoundWitnessValidator.ts
137
137
  import { ZERO_HASH as ZERO_HASH3 } from "@xylabs/sdk-js";
138
+ import { BoundWitnessValidator as BoundWitnessValidator2 } from "@xyo-network/sdk-js";
138
139
  import { HydratedTransactionValidationError } from "@xyo-network/xl1-protocol-lib";
140
+ var error = (tx, message) => new HydratedTransactionValidationError(tx?.[0]?._hash ?? ZERO_HASH3, tx, message);
141
+ var checkSignaturesShape = (tx) => {
142
+ const bw = tx[0];
143
+ if (bw.$signatures === void 0) {
144
+ return Array.isArray(bw.signatures) ? [error(tx, "BoundWitness has `signatures` but expected `$signatures` (signatures must be in the meta-prefixed `$signatures` key)")] : [error(tx, "BoundWitness is missing `$signatures`")];
145
+ }
146
+ return [];
147
+ };
148
+ var TransactionBoundWitnessValidator = async (context, tx) => {
149
+ try {
150
+ const shapeErrors = checkSignaturesShape(tx);
151
+ if (shapeErrors.length > 0) return shapeErrors;
152
+ const bwValidator = new BoundWitnessValidator2(tx[0]);
153
+ const bwErrors = await bwValidator.validate();
154
+ return bwErrors.map((e) => error(tx, `BoundWitness validation: ${e.message}`));
155
+ } catch (ex) {
156
+ return [error(tx, `Failed TransactionBoundWitnessValidator: ${String(ex)}`)];
157
+ }
158
+ };
159
+
160
+ // src/transaction/validators/TransactionDurationValidator.ts
161
+ import { ZERO_HASH as ZERO_HASH4 } from "@xylabs/sdk-js";
162
+ import { HydratedTransactionValidationError as HydratedTransactionValidationError2 } from "@xyo-network/xl1-protocol-lib";
139
163
  var TransactionDurationValidator = (context, tx) => {
140
164
  const errors = [];
141
165
  try {
142
166
  const { exp, nbf } = tx[0];
143
- if (nbf < 0) errors.push(new HydratedTransactionValidationError(tx?.[0]?._hash ?? ZERO_HASH3, tx, "Transaction nbf must be positive"));
144
- if (exp < 0) errors.push(new HydratedTransactionValidationError(tx?.[0]?._hash ?? ZERO_HASH3, tx, "Transaction exp must be positive"));
145
- if (exp <= nbf) errors.push(new HydratedTransactionValidationError(tx?.[0]?._hash ?? ZERO_HASH3, tx, "Transaction exp must greater than nbf"));
146
- if (exp - nbf > 1e4) errors.push(new HydratedTransactionValidationError(
147
- tx?.[0]?._hash ?? ZERO_HASH3,
167
+ if (nbf < 0) errors.push(new HydratedTransactionValidationError2(tx?.[0]?._hash ?? ZERO_HASH4, tx, "Transaction nbf must be positive"));
168
+ if (exp < 0) errors.push(new HydratedTransactionValidationError2(tx?.[0]?._hash ?? ZERO_HASH4, tx, "Transaction exp must be positive"));
169
+ if (exp <= nbf) errors.push(new HydratedTransactionValidationError2(tx?.[0]?._hash ?? ZERO_HASH4, tx, "Transaction exp must greater than nbf"));
170
+ if (exp - nbf > 1e4) errors.push(new HydratedTransactionValidationError2(
171
+ tx?.[0]?._hash ?? ZERO_HASH4,
148
172
  tx,
149
173
  "Transaction exp must not be too far in the future"
150
174
  ));
151
175
  } catch (ex) {
152
- errors.push(new HydratedTransactionValidationError(
153
- tx?.[0]?._hash ?? ZERO_HASH3,
176
+ errors.push(new HydratedTransactionValidationError2(
177
+ tx?.[0]?._hash ?? ZERO_HASH4,
154
178
  tx,
155
179
  `Failed TransactionDurationValidator: ${String(ex)}`,
156
180
  ex
@@ -160,19 +184,19 @@ var TransactionDurationValidator = (context, tx) => {
160
184
  };
161
185
 
162
186
  // src/transaction/validators/TransactionElevationValidator.ts
163
- import { ZERO_HASH as ZERO_HASH4 } from "@xylabs/sdk-js";
164
- import { extractElevatedHashes, HydratedTransactionValidationError as HydratedTransactionValidationError2 } from "@xyo-network/xl1-protocol-lib";
187
+ import { ZERO_HASH as ZERO_HASH5 } from "@xylabs/sdk-js";
188
+ import { extractElevatedHashes, HydratedTransactionValidationError as HydratedTransactionValidationError3 } from "@xyo-network/xl1-protocol-lib";
165
189
  var TransactionElevationValidator = (context, tx) => {
166
190
  const errors = [];
167
191
  try {
168
192
  try {
169
193
  extractElevatedHashes(tx);
170
194
  } catch {
171
- errors.push(new HydratedTransactionValidationError2(tx?.[0]?._hash ?? ZERO_HASH4, tx, "Hydrated transaction does not include all script hashes"));
195
+ errors.push(new HydratedTransactionValidationError3(tx?.[0]?._hash ?? ZERO_HASH5, tx, "Hydrated transaction does not include all script hashes"));
172
196
  }
173
197
  } catch (ex) {
174
- errors.push(new HydratedTransactionValidationError2(
175
- tx?.[0]?._hash ?? ZERO_HASH4,
198
+ errors.push(new HydratedTransactionValidationError3(
199
+ tx?.[0]?._hash ?? ZERO_HASH5,
176
200
  tx,
177
201
  `Failed TransactionElevationValidator: ${String(ex)}`,
178
202
  ex
@@ -182,26 +206,26 @@ var TransactionElevationValidator = (context, tx) => {
182
206
  };
183
207
 
184
208
  // src/transaction/validators/TransactionFromValidator.ts
185
- import { asAddress, ZERO_HASH as ZERO_HASH5 } from "@xylabs/sdk-js";
209
+ import { asAddress, ZERO_HASH as ZERO_HASH6 } from "@xylabs/sdk-js";
186
210
  import { addressesContains } from "@xyo-network/sdk-js";
187
- import { HydratedTransactionValidationError as HydratedTransactionValidationError3 } from "@xyo-network/xl1-protocol-lib";
211
+ import { HydratedTransactionValidationError as HydratedTransactionValidationError4 } from "@xyo-network/xl1-protocol-lib";
188
212
  var TransactionFromValidator = (context, tx) => {
189
213
  const errors = [];
190
214
  try {
191
215
  const from = asAddress(tx[0].from);
192
- if (from === void 0) errors.push(new HydratedTransactionValidationError3(
193
- tx?.[0]?._hash ?? ZERO_HASH5,
216
+ if (from === void 0) errors.push(new HydratedTransactionValidationError4(
217
+ tx?.[0]?._hash ?? ZERO_HASH6,
194
218
  tx,
195
219
  "Transaction from is not a valid address"
196
220
  ));
197
- else if (!addressesContains(tx[0], from)) errors.push(new HydratedTransactionValidationError3(
198
- tx?.[0]?._hash ?? ZERO_HASH5,
221
+ else if (!addressesContains(tx[0], from)) errors.push(new HydratedTransactionValidationError4(
222
+ tx?.[0]?._hash ?? ZERO_HASH6,
199
223
  tx,
200
224
  "Transaction from address must be listed in addresses"
201
225
  ));
202
226
  } catch (ex) {
203
- errors.push(new HydratedTransactionValidationError3(
204
- tx?.[0]?._hash ?? ZERO_HASH5,
227
+ errors.push(new HydratedTransactionValidationError4(
228
+ tx?.[0]?._hash ?? ZERO_HASH6,
205
229
  tx,
206
230
  `Failed TransactionFromValidator: ${String(ex)}`,
207
231
  ex
@@ -211,18 +235,18 @@ var TransactionFromValidator = (context, tx) => {
211
235
  };
212
236
 
213
237
  // src/transaction/validators/TransactionGasValidator.ts
214
- import { hexToBigInt as hexToBigInt2, ZERO_HASH as ZERO_HASH6 } from "@xylabs/sdk-js";
238
+ import { hexToBigInt as hexToBigInt2, ZERO_HASH as ZERO_HASH7 } from "@xylabs/sdk-js";
215
239
  import {
216
240
  AttoXL1,
217
- HydratedTransactionValidationError as HydratedTransactionValidationError4,
241
+ HydratedTransactionValidationError as HydratedTransactionValidationError5,
218
242
  minTransactionFees
219
243
  } from "@xyo-network/xl1-protocol-lib";
220
244
  var TransactionGasValidator = (context, tx) => {
221
245
  const errors = [];
222
246
  try {
223
247
  if (tx?.[0].fees === void 0) {
224
- errors.push(new HydratedTransactionValidationError4(
225
- tx?.[0]?._hash ?? ZERO_HASH6,
248
+ errors.push(new HydratedTransactionValidationError5(
249
+ tx?.[0]?._hash ?? ZERO_HASH7,
226
250
  tx,
227
251
  "Missing fees"
228
252
  ));
@@ -233,52 +257,52 @@ var TransactionGasValidator = (context, tx) => {
233
257
  gasPrice,
234
258
  priority
235
259
  } = parseFees(tx[0].fees);
236
- if (base === void 0) errors.push(new HydratedTransactionValidationError4(
237
- tx?.[0]?._hash ?? ZERO_HASH6,
260
+ if (base === void 0) errors.push(new HydratedTransactionValidationError5(
261
+ tx?.[0]?._hash ?? ZERO_HASH7,
238
262
  tx,
239
263
  "fees.base must be defined and a valid number"
240
264
  ));
241
- else if (base < minTransactionFees.base) errors.push(new HydratedTransactionValidationError4(
242
- tx?.[0]?._hash ?? ZERO_HASH6,
265
+ else if (base < minTransactionFees.base) errors.push(new HydratedTransactionValidationError5(
266
+ tx?.[0]?._hash ?? ZERO_HASH7,
243
267
  tx,
244
268
  `fees.base must be >= ${minTransactionFees.base}`
245
269
  ));
246
- if (gasLimit === void 0) errors.push(new HydratedTransactionValidationError4(
247
- tx?.[0]?._hash ?? ZERO_HASH6,
270
+ if (gasLimit === void 0) errors.push(new HydratedTransactionValidationError5(
271
+ tx?.[0]?._hash ?? ZERO_HASH7,
248
272
  tx,
249
273
  "fees.gasLimit must be defined and a valid number"
250
274
  ));
251
- else if (gasLimit < minTransactionFees.gasLimit) errors.push(new HydratedTransactionValidationError4(
252
- tx?.[0]?._hash ?? ZERO_HASH6,
275
+ else if (gasLimit < minTransactionFees.gasLimit) errors.push(new HydratedTransactionValidationError5(
276
+ tx?.[0]?._hash ?? ZERO_HASH7,
253
277
  tx,
254
278
  `fees.gasLimit must be >= ${minTransactionFees.gasLimit}`
255
279
  ));
256
280
  if (gasPrice === void 0) errors.push(
257
- new HydratedTransactionValidationError4(
258
- tx?.[0]?._hash ?? ZERO_HASH6,
281
+ new HydratedTransactionValidationError5(
282
+ tx?.[0]?._hash ?? ZERO_HASH7,
259
283
  tx,
260
284
  "fees.gasPrice must be defined and a valid number"
261
285
  )
262
286
  );
263
- else if (gasPrice < minTransactionFees.gasPrice) errors.push(new HydratedTransactionValidationError4(
264
- tx?.[0]?._hash ?? ZERO_HASH6,
287
+ else if (gasPrice < minTransactionFees.gasPrice) errors.push(new HydratedTransactionValidationError5(
288
+ tx?.[0]?._hash ?? ZERO_HASH7,
265
289
  tx,
266
290
  `fees.gasPrice must be >= ${minTransactionFees.gasPrice}`
267
291
  ));
268
- if (priority === void 0) errors.push(new HydratedTransactionValidationError4(
269
- tx?.[0]?._hash ?? ZERO_HASH6,
292
+ if (priority === void 0) errors.push(new HydratedTransactionValidationError5(
293
+ tx?.[0]?._hash ?? ZERO_HASH7,
270
294
  tx,
271
295
  "fees.priority must be defined and a valid number"
272
296
  ));
273
- else if (priority < minTransactionFees.priority) errors.push(new HydratedTransactionValidationError4(
274
- tx?.[0]?._hash ?? ZERO_HASH6,
297
+ else if (priority < minTransactionFees.priority) errors.push(new HydratedTransactionValidationError5(
298
+ tx?.[0]?._hash ?? ZERO_HASH7,
275
299
  tx,
276
300
  `fees.priority must be >= ${minTransactionFees.priority}`
277
301
  ));
278
302
  }
279
303
  } catch (ex) {
280
- errors.push(new HydratedTransactionValidationError4(
281
- tx?.[0]?._hash ?? ZERO_HASH6,
304
+ errors.push(new HydratedTransactionValidationError5(
305
+ tx?.[0]?._hash ?? ZERO_HASH7,
282
306
  tx,
283
307
  `Failed TransactionGasValidator: ${String(ex)}`,
284
308
  ex
@@ -302,9 +326,9 @@ var parseFees = (fees) => {
302
326
  };
303
327
 
304
328
  // src/transaction/validators/TransactionJsonSchemaValidator.ts
305
- import { ZERO_HASH as ZERO_HASH7 } from "@xylabs/sdk-js";
329
+ import { ZERO_HASH as ZERO_HASH8 } from "@xylabs/sdk-js";
306
330
  import { PayloadBuilder } from "@xyo-network/sdk-js";
307
- import { HydratedTransactionValidationError as HydratedTransactionValidationError5 } from "@xyo-network/xl1-protocol-lib";
331
+ import { HydratedTransactionValidationError as HydratedTransactionValidationError6 } from "@xyo-network/xl1-protocol-lib";
308
332
  import { TransactionBoundWitnessJsonSchema } from "@xyo-network/xl1-schema";
309
333
  import { Ajv } from "ajv";
310
334
  var ajv = new Ajv({ allErrors: true, strict: true });
@@ -314,31 +338,31 @@ var TransactionJsonSchemaValidator = (context, tx) => {
314
338
  try {
315
339
  validate ??= ajv.compile(TransactionBoundWitnessJsonSchema);
316
340
  if (!validate(PayloadBuilder.omitStorageMeta(tx[0]))) {
317
- const error = new HydratedTransactionValidationError5(
318
- tx?.[0]?._hash ?? ZERO_HASH7,
341
+ const error2 = new HydratedTransactionValidationError6(
342
+ tx?.[0]?._hash ?? ZERO_HASH8,
319
343
  tx,
320
344
  `failed JSON schema validation: ${ajv.errorsText(validate.errors, { separator: "\n" })}`,
321
345
  validate.errors
322
346
  );
323
- errors.push(error);
347
+ errors.push(error2);
324
348
  }
325
349
  } catch (ex) {
326
- errors.push(new HydratedTransactionValidationError5(tx?.[0]?._hash ?? ZERO_HASH7, tx, "validation excepted", ex));
350
+ errors.push(new HydratedTransactionValidationError6(tx?.[0]?._hash ?? ZERO_HASH8, tx, "validation excepted", ex));
327
351
  }
328
352
  return errors;
329
353
  };
330
354
 
331
355
  // src/transaction/validators/TransactionProtocolValidator.ts
332
- import { ZERO_HASH as ZERO_HASH8 } from "@xylabs/sdk-js";
333
- import { HydratedTransactionValidationError as HydratedTransactionValidationError6 } from "@xyo-network/xl1-protocol-lib";
356
+ import { ZERO_HASH as ZERO_HASH9 } from "@xylabs/sdk-js";
357
+ import { HydratedTransactionValidationError as HydratedTransactionValidationError7 } from "@xyo-network/xl1-protocol-lib";
334
358
  var TransactionProtocolValidator = async (context, tx) => {
335
359
  const errors = [];
336
360
  try {
337
361
  if (context?.chainId !== void 0 && tx[0].chain !== context.chainId) {
338
- errors.push(new HydratedTransactionValidationError6(tx?.[0]?._hash ?? ZERO_HASH8, tx, `invalid chain id [${context.chainId}, ${tx[0].chain}]`));
362
+ errors.push(new HydratedTransactionValidationError7(tx?.[0]?._hash ?? ZERO_HASH9, tx, `invalid chain id [${context.chainId}, ${tx[0].chain}]`));
339
363
  }
340
364
  } catch (ex) {
341
- errors.push(new HydratedTransactionValidationError6(tx?.[0]?._hash ?? ZERO_HASH8, tx, "validation excepted", ex));
365
+ errors.push(new HydratedTransactionValidationError7(tx?.[0]?._hash ?? ZERO_HASH9, tx, "validation excepted", ex));
342
366
  }
343
367
  return await Promise.resolve(errors);
344
368
  };
@@ -349,7 +373,7 @@ import {
349
373
  completedStepRewardAddress,
350
374
  derivedReceiveAddress,
351
375
  elevatedPayloads,
352
- HydratedTransactionValidationError as HydratedTransactionValidationError7,
376
+ HydratedTransactionValidationError as HydratedTransactionValidationError8,
353
377
  isTransfer as isTransfer2
354
378
  } from "@xyo-network/xl1-protocol-lib";
355
379
  var SelfSignerValidator = (signer, signee) => signer === signee;
@@ -383,7 +407,7 @@ function TransactionTransfersValidatorFactory(signerValidators = [SelfSignerVali
383
407
  const transfers = payloads.filter(isTransfer2);
384
408
  for (const transfer of transfers) {
385
409
  if (isUndefined(signerValidators.find((v) => v(signer, transfer.from, transfer.context)))) {
386
- errors.push(new HydratedTransactionValidationError7(
410
+ errors.push(new HydratedTransactionValidationError8(
387
411
  hydratedTx[0]._hash,
388
412
  hydratedTx,
389
413
  `transfer from address ${transfer.from} is not authorized by signer ${signer}`
@@ -391,7 +415,7 @@ function TransactionTransfersValidatorFactory(signerValidators = [SelfSignerVali
391
415
  }
392
416
  }
393
417
  } catch (ex) {
394
- errors.push(new HydratedTransactionValidationError7(hydratedTx[0]._hash, hydratedTx, "validation excepted", ex));
418
+ errors.push(new HydratedTransactionValidationError8(hydratedTx[0]._hash, hydratedTx, "validation excepted", ex));
395
419
  }
396
420
  return await Promise.resolve(errors);
397
421
  };
@@ -402,8 +426,8 @@ var validateTransaction = async (context, tx, additionalValidators) => {
402
426
  try {
403
427
  if (!isTransactionBoundWitness(tx[0])) {
404
428
  const castTx = tx.at(0);
405
- return [new HydratedTransactionValidationError8(
406
- castTx?._hash ?? ZERO_HASH9,
429
+ return [new HydratedTransactionValidationError9(
430
+ castTx?._hash ?? ZERO_HASH10,
407
431
  tx,
408
432
  "failed isTransactionBoundWitness identity check"
409
433
  )];
@@ -414,13 +438,14 @@ var validateTransaction = async (context, tx, additionalValidators) => {
414
438
  TransactionFromValidator,
415
439
  TransactionGasValidator,
416
440
  TransactionElevationValidator,
441
+ TransactionBoundWitnessValidator,
417
442
  ...additionalValidators ?? []
418
443
  ];
419
444
  return (await Promise.all(validators.map(async (v) => v(context, tx)))).flat();
420
445
  } catch (ex) {
421
446
  const castTx = tx?.[0];
422
- return [new HydratedTransactionValidationError8(
423
- castTx?._hash ?? ZERO_HASH9,
447
+ return [new HydratedTransactionValidationError9(
448
+ castTx?._hash ?? ZERO_HASH10,
424
449
  tx,
425
450
  "Failed TransactionGasValidator: " + ex.message,
426
451
  ex
@@ -434,6 +459,7 @@ export {
434
459
  CompletedStepRewardAddressValidatorFactory,
435
460
  DerivedReceiveAddressValidatorFactory,
436
461
  SelfSignerValidator,
462
+ TransactionBoundWitnessValidator,
437
463
  TransactionDurationValidator,
438
464
  TransactionElevationValidator,
439
465
  TransactionFromValidator,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/block/validators/BlockCumulativeBalanceValidator.ts","../../src/boundwitness/validators/BoundWitnessReferences.ts","../../src/boundwitness/validators/BoundWitnessSignatures.ts","../../src/transaction/validateTransaction.ts","../../src/transaction/validators/TransactionDurationValidator.ts","../../src/transaction/validators/TransactionElevationValidator.ts","../../src/transaction/validators/TransactionFromValidator.ts","../../src/transaction/validators/TransactionGasValidator.ts","../../src/transaction/validators/TransactionJsonSchemaValidator.ts","../../src/transaction/validators/TransactionProtocolValidator.ts","../../src/transaction/validators/TransactionTransfersValidator.ts"],"sourcesContent":["import {\n type Address, type Hex, hexToBigInt,\n} from '@xylabs/sdk-js'\nimport type {\n HydratedBlockStateValidationFunction,\n HydratedBlockWithHashMeta,\n TransactionBoundWitnessWithHashMeta,\n} from '@xyo-network/xl1-protocol-lib'\nimport {\n HydratedBlockStateValidationError,\n isTransactionBoundWitnessWithHashMeta,\n isTransfer,\n XYO_ZERO_ADDRESS,\n} from '@xyo-network/xl1-protocol-lib'\n\n/** Compute the maximum fee commitment for a transaction (base + priority + gasLimit). */\nfunction maxTransactionFeeCost(tx: TransactionBoundWitnessWithHashMeta): bigint {\n const {\n base, gasLimit, priority,\n } = tx.fees\n return hexToBigInt(base) + hexToBigInt(priority) + hexToBigInt(gasLimit)\n}\n\n/** Accumulate outflows per address from fees and transfers in the given transactions. */\nexport function accumulateOutflows(\n transactions: TransactionBoundWitnessWithHashMeta[],\n payloads: HydratedBlockWithHashMeta[1],\n): Record<Address, bigint> {\n const outflows: Record<Address, bigint> = {}\n\n for (const tx of transactions) {\n // Fee cost charged to the transaction sender\n const feeCost = maxTransactionFeeCost(tx)\n const feePayer = tx.from\n outflows[feePayer] = (outflows[feePayer] ?? 0n) + feeCost\n\n // Find transfer payloads belonging to this transaction\n const txPayloadHashes = new Set(tx.payload_hashes)\n for (const payload of payloads) {\n if (!txPayloadHashes.has(payload._hash) || !isTransfer(payload)) continue\n const { from } = payload\n for (const [to, amount] of Object.entries(payload.transfers) as [Address, Hex][]) {\n if (to === from) continue // self-transfers are not outflows\n outflows[from] = (outflows[from] ?? 0n) + hexToBigInt(amount)\n }\n }\n }\n\n return outflows\n}\n\n/** Creates a block state validator that checks cumulative outflows per address do not exceed pre-block balances. */\nexport function BlockCumulativeBalanceValidatorFactory(): HydratedBlockStateValidationFunction {\n return async (context, hydratedBlock) => {\n const [blockBw, payloads] = hydratedBlock\n\n // Find all transactions in the block\n const transactions = payloads.filter(isTransactionBoundWitnessWithHashMeta)\n\n if (transactions.length === 0) return []\n\n const outflows = accumulateOutflows(transactions, payloads)\n\n // Query pre-block balances for all addresses with outflows\n const addresses = Object.keys(outflows) as Address[]\n if (addresses.length === 0) return []\n\n const balances = await context.accountBalance.accountBalances(addresses)\n\n // Check each address\n const chainId = await context.chainIdAtBlockNumber(blockBw.block)\n const errors: HydratedBlockStateValidationError[] = []\n for (const address of addresses) {\n if (address === XYO_ZERO_ADDRESS) continue // Skip zero address as it's used for burn transactions and doesn't have a balance\n // TODO: Add specific validation for block reward transfer\n const balance = balances[address] ?? 0n\n const totalOutflow = outflows[address]\n if (totalOutflow > balance) {\n errors.push(new HydratedBlockStateValidationError(\n blockBw._hash,\n chainId,\n hydratedBlock,\n `Cumulative outflow for address ${address} exceeds available balance: outflow ${totalOutflow} > balance ${balance}`,\n ))\n }\n }\n\n return errors\n }\n}\n","import type { Hash, Promisable } from '@xylabs/sdk-js'\nimport { ZERO_HASH } from '@xylabs/sdk-js'\nimport type {\n BoundWitness,\n Payload,\n Schema,\n WithHashMeta,\n} from '@xyo-network/sdk-js'\nimport { isAnyPayload } from '@xyo-network/sdk-js'\nimport type { HydratedBoundWitnessValidationFunction, HydratedBoundWitnessWithHashMeta } from '@xyo-network/xl1-protocol-lib'\nimport { HydratedBoundWitnessValidationError } from '@xyo-network/xl1-protocol-lib'\n\nfunction getPayloadsFromPayloadArray(payloads: WithHashMeta<Payload>[], hashes: Hash[]): (WithHashMeta<Payload> | undefined)[] {\n return hashes.map(hash => payloads.find(payload => payload._hash === hash || payload._dataHash === hash))\n}\n\n/** Creates a validator that checks all payload references in a BoundWitness are present, have matching schemas, and optionally conform to an allowed schema list. */\nexport const BoundWitnessReferencesValidator\n\n = <T extends BoundWitness = BoundWitness>(allowedSchemas?: Schema[]): HydratedBoundWitnessValidationFunction<T> => (\n [bw, payloadSet]: HydratedBoundWitnessWithHashMeta<T>,\n // eslint-disable-next-line complexity\n ): Promisable<HydratedBoundWitnessValidationError[]> => {\n const errors: HydratedBoundWitnessValidationError[] = []\n try {\n const payloads = getPayloadsFromPayloadArray(payloadSet, bw.payload_hashes)\n if (payloads.length !== bw.payload_hashes.length) {\n errors.push(new HydratedBoundWitnessValidationError(bw?._hash ?? ZERO_HASH, [bw, payloadSet], 'unable to locate payloads'))\n }\n\n // check if payloads are valid and if their schemas match the declared schemas\n for (const payload of payloads) {\n if (isAnyPayload(payload)) {\n const payloadHashIndex = bw.payload_hashes.indexOf(payload._hash)\n const payloadDataHashIndex = bw.payload_hashes.indexOf(payload._dataHash)\n const payloadIndex = Math.max(payloadHashIndex, payloadDataHashIndex)\n if (payloadIndex === -1) {\n errors.push(new HydratedBoundWitnessValidationError(bw?._hash ?? ZERO_HASH, [bw, payloadSet], 'payload hash not found'))\n }\n\n const declaredSchema = bw.payload_schemas[payloadIndex]\n if (declaredSchema !== payload.schema) {\n errors.push(new HydratedBoundWitnessValidationError(bw?._hash ?? ZERO_HASH, [bw, payloadSet], 'mismatched schema'))\n }\n\n if (allowedSchemas && !allowedSchemas.includes(payload.schema)) {\n errors.push(new HydratedBoundWitnessValidationError(bw?._hash ?? ZERO_HASH, [bw, payloadSet], `disallowed schema [${payload.schema}]`))\n }\n } else {\n errors.push(new HydratedBoundWitnessValidationError(bw?._hash ?? ZERO_HASH, [bw, payloadSet], 'invalid payload'))\n }\n }\n } catch (ex) {\n const error = new HydratedBoundWitnessValidationError(bw?._hash ?? ZERO_HASH, [bw, payloadSet], `validation excepted: ${String(ex)}`, ex)\n errors.push(error)\n }\n return errors\n }\n","import { type Address, ZERO_HASH } from '@xylabs/sdk-js'\nimport { toArrayBuffer } from '@xylabs/sdk-js'\nimport type { BoundWitness, WithStorageMeta } from '@xyo-network/sdk-js'\nimport { BoundWitnessBuilder, BoundWitnessValidator } from '@xyo-network/sdk-js'\nimport type { BoundWitnessValidationFunction } from '@xyo-network/xl1-protocol-lib'\nimport { BoundWitnessValidationError } from '@xyo-network/xl1-protocol-lib'\n\n/** Validates that all signatures on a BoundWitness are cryptographically valid for their corresponding addresses. */\nexport const BoundWitnessSignaturesValidator: BoundWitnessValidationFunction = async (\n bw: BoundWitness,\n) => {\n const errors: BoundWitnessValidationError[] = []\n try {\n const dataHash = await BoundWitnessBuilder.dataHash(bw)\n const results: [Address, Error[]][] = await Promise.all(bw.addresses.map(async (address, index) => {\n return [address, await BoundWitnessValidator.validateSignature(\n toArrayBuffer(dataHash),\n toArrayBuffer(address),\n toArrayBuffer(bw.$signatures[index] ?? undefined),\n )]\n }))\n for (const [, bwErrors] of results) {\n for (const bwError of bwErrors) {\n errors.push(new BoundWitnessValidationError((bw as WithStorageMeta<BoundWitness>)?._hash ?? ZERO_HASH, bw, 'validation errors', bwError))\n }\n }\n } catch (ex) {\n errors.push(new BoundWitnessValidationError((bw as WithStorageMeta<BoundWitness>)?._hash ?? ZERO_HASH, bw, 'validation excepted', ex))\n }\n return errors\n}\n","import { ZERO_HASH } from '@xylabs/sdk-js'\nimport type { BoundWitness, WithHashMeta } from '@xyo-network/sdk-js'\nimport type {\n HydratedTransactionValidationFunction,\n HydratedTransactionValidationFunctionContext,\n HydratedTransactionWithHashMeta,\n} from '@xyo-network/xl1-protocol-lib'\nimport { HydratedTransactionValidationError, isTransactionBoundWitness } from '@xyo-network/xl1-protocol-lib'\n\nimport {\n TransactionDurationValidator,\n TransactionElevationValidator, TransactionFromValidator, TransactionGasValidator, TransactionProtocolValidator,\n} from './validators/index.ts'\n\n/** Validates a hydrated transaction using built-in validators plus any additional validators provided. */\nexport const validateTransaction: HydratedTransactionValidationFunction = async (\n context: HydratedTransactionValidationFunctionContext,\n tx: HydratedTransactionWithHashMeta,\n additionalValidators?: HydratedTransactionValidationFunction[],\n): Promise<HydratedTransactionValidationError[]> => {\n try {\n if (!isTransactionBoundWitness(tx[0])) {\n const castTx = tx.at(0) as WithHashMeta<BoundWitness> | undefined\n return [new HydratedTransactionValidationError(\n castTx?._hash ?? ZERO_HASH,\n tx,\n 'failed isTransactionBoundWitness identity check',\n )]\n }\n\n const validators: HydratedTransactionValidationFunction<HydratedTransactionValidationFunctionContext>[] = [\n TransactionProtocolValidator,\n TransactionDurationValidator,\n TransactionFromValidator,\n TransactionGasValidator,\n TransactionElevationValidator,\n ...(additionalValidators ?? []),\n ]\n return (await Promise.all(validators.map(async v => v(context, tx)))).flat()\n } catch (ex) {\n const castTx = tx?.[0] as WithHashMeta<BoundWitness> | undefined\n return [new HydratedTransactionValidationError(\n castTx?._hash ?? ZERO_HASH,\n tx,\n 'Failed TransactionGasValidator: ' + (ex as Error).message,\n ex,\n )]\n }\n}\n","import { ZERO_HASH } from '@xylabs/sdk-js'\nimport type { HydratedTransactionValidationFunction } from '@xyo-network/xl1-protocol-lib'\nimport { HydratedTransactionValidationError } from '@xyo-network/xl1-protocol-lib'\n\n/** Validates that transaction timing fields (nbf and exp) are positive, correctly ordered, and within allowed duration limits. */\nexport const TransactionDurationValidator: HydratedTransactionValidationFunction = (\n context,\n tx,\n// eslint-disable-next-line complexity\n) => {\n const errors: HydratedTransactionValidationError[] = []\n try {\n const { exp, nbf } = tx[0]\n if (nbf < 0) errors.push(new HydratedTransactionValidationError(tx?.[0]?._hash ?? ZERO_HASH, tx, 'Transaction nbf must be positive'))\n\n if (exp < 0) errors.push(new HydratedTransactionValidationError(tx?.[0]?._hash ?? ZERO_HASH, tx, 'Transaction exp must be positive'))\n if (exp <= nbf) errors.push(new HydratedTransactionValidationError(tx?.[0]?._hash ?? ZERO_HASH, tx, 'Transaction exp must greater than nbf'))\n if (exp - nbf > 10_000) errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n 'Transaction exp must not be too far in the future',\n ))\n } catch (ex) {\n errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n `Failed TransactionDurationValidator: ${String(ex)}`,\n ex,\n ))\n }\n\n return errors\n}\n","import { ZERO_HASH } from '@xylabs/sdk-js'\nimport type { HydratedTransactionValidationFunction } from '@xyo-network/xl1-protocol-lib'\nimport { extractElevatedHashes, HydratedTransactionValidationError } from '@xyo-network/xl1-protocol-lib'\n\n/** Validates that a hydrated transaction includes all required elevated script hashes. */\nexport const TransactionElevationValidator: HydratedTransactionValidationFunction = (\n context,\n tx,\n) => {\n const errors: HydratedTransactionValidationError[] = []\n try {\n try {\n extractElevatedHashes(tx)\n } catch {\n errors.push(new HydratedTransactionValidationError(tx?.[0]?._hash ?? ZERO_HASH, tx, 'Hydrated transaction does not include all script hashes'))\n }\n } catch (ex) {\n errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n `Failed TransactionElevationValidator: ${String(ex)}`,\n ex,\n ))\n }\n return errors\n}\n","import { asAddress, ZERO_HASH } from '@xylabs/sdk-js'\nimport { addressesContains } from '@xyo-network/sdk-js'\nimport type { HydratedTransactionValidationFunction } from '@xyo-network/xl1-protocol-lib'\nimport { HydratedTransactionValidationError } from '@xyo-network/xl1-protocol-lib'\n\n/** Validates that the transaction's from field is a valid address and is included in the BoundWitness addresses. */\nexport const TransactionFromValidator: HydratedTransactionValidationFunction = (\n context,\n tx,\n) => {\n const errors: HydratedTransactionValidationError[] = []\n try {\n const from = asAddress(tx[0].from)\n if (from === undefined)errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n 'Transaction from is not a valid address',\n ))\n else if (!addressesContains(tx[0], from)) errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n 'Transaction from address must be listed in addresses',\n ))\n } catch (ex) {\n errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n `Failed TransactionFromValidator: ${String(ex)}`,\n ex,\n ))\n }\n return errors\n}\n","import { hexToBigInt, ZERO_HASH } from '@xylabs/sdk-js'\nimport type {\n HydratedTransactionValidationFunction,\n TransactionFeesBigInt, TransactionFeesHex,\n} from '@xyo-network/xl1-protocol-lib'\nimport {\n AttoXL1,\n HydratedTransactionValidationError,\n minTransactionFees,\n} from '@xyo-network/xl1-protocol-lib'\n\n/** Validates that transaction fee fields (base, gasLimit, gasPrice, priority) are present and meet minimum requirements. */\nexport const TransactionGasValidator: HydratedTransactionValidationFunction = (\n context,\n tx,\n// eslint-disable-next-line complexity\n) => {\n const errors: HydratedTransactionValidationError[] = []\n try {\n if (tx?.[0].fees === undefined) {\n errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n 'Missing fees',\n ))\n } else {\n const {\n base, gasLimit, gasPrice, priority,\n } = parseFees(tx[0].fees)\n\n if (base === undefined) errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n 'fees.base must be defined and a valid number',\n ))\n else if (base < minTransactionFees.base) errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n `fees.base must be >= ${minTransactionFees.base}`,\n ))\n\n if (gasLimit === undefined) errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n 'fees.gasLimit must be defined and a valid number',\n ))\n else if (gasLimit < minTransactionFees.gasLimit) errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n `fees.gasLimit must be >= ${minTransactionFees.gasLimit}`,\n ))\n\n if (gasPrice === undefined) errors.push(\n new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n 'fees.gasPrice must be defined and a valid number',\n ),\n )\n else if (gasPrice < minTransactionFees.gasPrice) errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n `fees.gasPrice must be >= ${minTransactionFees.gasPrice}`,\n ))\n\n if (priority === undefined) errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n 'fees.priority must be defined and a valid number',\n ))\n else if (priority < minTransactionFees.priority) errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n `fees.priority must be >= ${minTransactionFees.priority}`,\n ))\n }\n } catch (ex) {\n errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n `Failed TransactionGasValidator: ${String(ex)}`,\n ex,\n ))\n }\n return errors\n}\n\nconst parseFees = (fees: TransactionFeesHex): Partial<TransactionFeesBigInt> => {\n const ret: Partial<TransactionFeesBigInt> = {}\n const {\n base, gasLimit, gasPrice, priority,\n } = fees\n if (base !== undefined) ret.base = AttoXL1(hexToBigInt(base))\n if (gasLimit !== undefined) ret.gasLimit = AttoXL1(hexToBigInt(gasLimit))\n if (gasPrice !== undefined) ret.gasPrice = AttoXL1(hexToBigInt(gasPrice))\n if (priority !== undefined) ret.priority = AttoXL1(hexToBigInt(priority))\n return ret\n}\n","import { ZERO_HASH } from '@xylabs/sdk-js'\nimport { PayloadBuilder } from '@xyo-network/sdk-js'\nimport type { HydratedTransactionValidationFunction, TransactionBoundWitness } from '@xyo-network/xl1-protocol-lib'\nimport { HydratedTransactionValidationError } from '@xyo-network/xl1-protocol-lib'\nimport { TransactionBoundWitnessJsonSchema } from '@xyo-network/xl1-schema'\nimport type { ValidateFunction } from 'ajv'\nimport { Ajv } from 'ajv'\n\nconst ajv = new Ajv({ allErrors: true, strict: true })\n\nlet validate: ValidateFunction<TransactionBoundWitness> | undefined\n\n/** Validates a transaction against the TransactionBoundWitness JSON schema using AJV. */\nexport const TransactionJsonSchemaValidator: HydratedTransactionValidationFunction = (\n context,\n tx,\n) => {\n const errors: HydratedTransactionValidationError[] = []\n try {\n validate ??= ajv.compile(TransactionBoundWitnessJsonSchema)\n if (!validate(PayloadBuilder.omitStorageMeta(tx[0]))) {\n const error = new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n `failed JSON schema validation: ${ajv.errorsText(validate.errors, { separator: '\\n' })}`,\n validate.errors,\n )\n errors.push(error)\n }\n } catch (ex) {\n errors.push(new HydratedTransactionValidationError(tx?.[0]?._hash ?? ZERO_HASH, tx, 'validation excepted', ex))\n }\n return errors\n}\n","import { ZERO_HASH } from '@xylabs/sdk-js'\nimport type {\n ChainId,\n HydratedTransactionValidationFunction,\n} from '@xyo-network/xl1-protocol-lib'\nimport { HydratedTransactionValidationError } from '@xyo-network/xl1-protocol-lib'\n\n/** Validates that the transaction's chain ID matches the expected chain ID from the validation context. */\nexport const TransactionProtocolValidator: HydratedTransactionValidationFunction = async (\n context: { chainId?: ChainId },\n tx,\n) => {\n const errors: HydratedTransactionValidationError[] = []\n try {\n if (context?.chainId !== undefined && tx[0].chain !== context.chainId) {\n errors.push(new HydratedTransactionValidationError(tx?.[0]?._hash ?? ZERO_HASH, tx, `invalid chain id [${context.chainId}, ${tx[0].chain}]`))\n }\n } catch (ex) {\n errors.push(new HydratedTransactionValidationError(tx?.[0]?._hash ?? ZERO_HASH, tx, 'validation excepted', ex))\n }\n return await Promise.resolve(errors)\n}\n","import type { Address } from '@xylabs/sdk-js'\nimport { isDefined, isUndefined } from '@xylabs/sdk-js'\nimport type {\n HydratedTransactionValidationFunction, StepIdentity,\n Transfer,\n} from '@xyo-network/xl1-protocol-lib'\nimport {\n completedStepRewardAddress,\n derivedReceiveAddress,\n elevatedPayloads,\n HydratedTransactionValidationError,\n isTransfer,\n} from '@xyo-network/xl1-protocol-lib'\n\n/** Function type that checks whether a signer is authorized to sign for a given signee address. */\nexport type SignerValidator = (signer: Address, signee: Address, context?: { address?: Address; scope?: string; step?: StepIdentity }) => boolean\n\n/** Maps addresses to their list of authorized signer addresses. */\nexport type SignerMapping = Map<Address, Address[]>\n\n/** A signer validator that only allows an address to sign for itself. */\nexport const SelfSignerValidator: SignerValidator = (signer: Address, signee: Address) => signer === signee\n\n/** Creates a signer validator that authorizes specified signers to sign for completed step reward addresses. */\nexport const CompletedStepRewardAddressValidatorFactory = (allowedSigners: Address[]): SignerValidator => (\n signer: Address,\n signee: Address,\n context?: { step?: StepIdentity },\n) => {\n const step = context?.step\n if (isDefined(step)) {\n const contextAddress = completedStepRewardAddress(step)\n return allowedSigners.includes(signer) && signee === contextAddress\n } else {\n return false\n }\n}\n\n/** Creates a signer validator that authorizes specified signers to sign for derived receive addresses within a given scope. */\nexport const DerivedReceiveAddressValidatorFactory = (allowedSigners: Address[], allowedScope: string): SignerValidator => (\n signer: Address,\n signee: Address,\n context?: { address?: Address; scope?: string },\n) => {\n const { address, scope } = context ?? {}\n if (scope !== allowedScope) {\n return false\n }\n if (isDefined(address)) {\n const derivedAddress = derivedReceiveAddress(address, scope)\n return allowedSigners.includes(signer) && signee === derivedAddress\n } else {\n return false\n }\n}\n\n/** Creates a transaction validator that checks all transfers are authorized by the transaction signer. */\nexport function TransactionTransfersValidatorFactory(\n signerValidators: SignerValidator[] = [SelfSignerValidator],\n): HydratedTransactionValidationFunction {\n return async (\n context,\n hydratedTx,\n ) => {\n const errors: HydratedTransactionValidationError[] = []\n const signer = hydratedTx[0].from\n try {\n const payloads = elevatedPayloads(hydratedTx)\n const transfers = payloads.filter(isTransfer) as Transfer[]\n for (const transfer of transfers) {\n if (isUndefined(signerValidators.find(v => v(signer, transfer.from, transfer.context)))) {\n errors.push(new HydratedTransactionValidationError(\n hydratedTx[0]._hash,\n hydratedTx,\n `transfer from address ${transfer.from} is not authorized by signer ${signer}`,\n ))\n }\n }\n } catch (ex) {\n errors.push(new HydratedTransactionValidationError(hydratedTx[0]._hash, hydratedTx, 'validation excepted', ex))\n }\n return await Promise.resolve(errors)\n }\n}\n"],"mappings":";AAAA;AAAA,EAC0B;AAAA,OACnB;AAMP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP,SAAS,sBAAsB,IAAiD;AAC9E,QAAM;AAAA,IACJ;AAAA,IAAM;AAAA,IAAU;AAAA,EAClB,IA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AACF;","names":["ZERO_HASH","ZERO_HASH","HydratedTransactionValidationError","ZERO_HASH","ZERO_HASH","HydratedTransactionValidationError","ZERO_HASH","HydratedTransactionValidationError","hexToBigInt","ZERO_HASH","HydratedTransactionValidationError","ZERO_HASH","HydratedTransactionValidationError","ZERO_HASH","HydratedTransactionValidationError","HydratedTransactionValidationError","isTransfer","HydratedTransactionValidationError","ZERO_HASH"]}
1
+ {"version":3,"sources":["../../src/block/validators/BlockCumulativeBalanceValidator.ts","../../src/boundwitness/validators/BoundWitnessReferences.ts","../../src/boundwitness/validators/BoundWitnessSignatures.ts","../../src/transaction/validateTransaction.ts","../../src/transaction/validators/TransactionBoundWitnessValidator.ts","../../src/transaction/validators/TransactionDurationValidator.ts","../../src/transaction/validators/TransactionElevationValidator.ts","../../src/transaction/validators/TransactionFromValidator.ts","../../src/transaction/validators/TransactionGasValidator.ts","../../src/transaction/validators/TransactionJsonSchemaValidator.ts","../../src/transaction/validators/TransactionProtocolValidator.ts","../../src/transaction/validators/TransactionTransfersValidator.ts"],"sourcesContent":["import {\n type Address, type Hex, hexToBigInt,\n} from '@xylabs/sdk-js'\nimport type {\n HydratedBlockStateValidationFunction,\n HydratedBlockWithHashMeta,\n TransactionBoundWitnessWithHashMeta,\n} from '@xyo-network/xl1-protocol-lib'\nimport {\n HydratedBlockStateValidationError,\n isTransactionBoundWitnessWithHashMeta,\n isTransfer,\n XYO_ZERO_ADDRESS,\n} from '@xyo-network/xl1-protocol-lib'\n\n/** Compute the maximum fee commitment for a transaction (base + priority + gasLimit). */\nfunction maxTransactionFeeCost(tx: TransactionBoundWitnessWithHashMeta): bigint {\n const {\n base, gasLimit, priority,\n } = tx.fees\n return hexToBigInt(base) + hexToBigInt(priority) + hexToBigInt(gasLimit)\n}\n\n/** Accumulate outflows per address from fees and transfers in the given transactions. */\nexport function accumulateOutflows(\n transactions: TransactionBoundWitnessWithHashMeta[],\n payloads: HydratedBlockWithHashMeta[1],\n): Record<Address, bigint> {\n const outflows: Record<Address, bigint> = {}\n\n for (const tx of transactions) {\n // Fee cost charged to the transaction sender\n const feeCost = maxTransactionFeeCost(tx)\n const feePayer = tx.from\n outflows[feePayer] = (outflows[feePayer] ?? 0n) + feeCost\n\n // Find transfer payloads belonging to this transaction\n const txPayloadHashes = new Set(tx.payload_hashes)\n for (const payload of payloads) {\n if (!txPayloadHashes.has(payload._hash) || !isTransfer(payload)) continue\n const { from } = payload\n for (const [to, amount] of Object.entries(payload.transfers) as [Address, Hex][]) {\n if (to === from) continue // self-transfers are not outflows\n outflows[from] = (outflows[from] ?? 0n) + hexToBigInt(amount)\n }\n }\n }\n\n return outflows\n}\n\n/** Creates a block state validator that checks cumulative outflows per address do not exceed pre-block balances. */\nexport function BlockCumulativeBalanceValidatorFactory(): HydratedBlockStateValidationFunction {\n return async (context, hydratedBlock) => {\n const [blockBw, payloads] = hydratedBlock\n\n // Find all transactions in the block\n const transactions = payloads.filter(isTransactionBoundWitnessWithHashMeta)\n\n if (transactions.length === 0) return []\n\n const outflows = accumulateOutflows(transactions, payloads)\n\n // Query pre-block balances for all addresses with outflows\n const addresses = Object.keys(outflows) as Address[]\n if (addresses.length === 0) return []\n\n const balances = await context.accountBalance.accountBalances(addresses)\n\n // Check each address\n const chainId = await context.chainIdAtBlockNumber(blockBw.block)\n const errors: HydratedBlockStateValidationError[] = []\n for (const address of addresses) {\n if (address === XYO_ZERO_ADDRESS) continue // Skip zero address as it's used for burn transactions and doesn't have a balance\n // TODO: Add specific validation for block reward transfer\n const balance = balances[address] ?? 0n\n const totalOutflow = outflows[address]\n if (totalOutflow > balance) {\n errors.push(new HydratedBlockStateValidationError(\n blockBw._hash,\n chainId,\n hydratedBlock,\n `Cumulative outflow for address ${address} exceeds available balance: outflow ${totalOutflow} > balance ${balance}`,\n ))\n }\n }\n\n return errors\n }\n}\n","import type { Hash, Promisable } from '@xylabs/sdk-js'\nimport { ZERO_HASH } from '@xylabs/sdk-js'\nimport type {\n BoundWitness,\n Payload,\n Schema,\n WithHashMeta,\n} from '@xyo-network/sdk-js'\nimport { isAnyPayload } from '@xyo-network/sdk-js'\nimport type { HydratedBoundWitnessValidationFunction, HydratedBoundWitnessWithHashMeta } from '@xyo-network/xl1-protocol-lib'\nimport { HydratedBoundWitnessValidationError } from '@xyo-network/xl1-protocol-lib'\n\nfunction getPayloadsFromPayloadArray(payloads: WithHashMeta<Payload>[], hashes: Hash[]): (WithHashMeta<Payload> | undefined)[] {\n return hashes.map(hash => payloads.find(payload => payload._hash === hash || payload._dataHash === hash))\n}\n\n/** Creates a validator that checks all payload references in a BoundWitness are present, have matching schemas, and optionally conform to an allowed schema list. */\nexport const BoundWitnessReferencesValidator\n\n = <T extends BoundWitness = BoundWitness>(allowedSchemas?: Schema[]): HydratedBoundWitnessValidationFunction<T> => (\n [bw, payloadSet]: HydratedBoundWitnessWithHashMeta<T>,\n // eslint-disable-next-line complexity\n ): Promisable<HydratedBoundWitnessValidationError[]> => {\n const errors: HydratedBoundWitnessValidationError[] = []\n try {\n const payloads = getPayloadsFromPayloadArray(payloadSet, bw.payload_hashes)\n if (payloads.length !== bw.payload_hashes.length) {\n errors.push(new HydratedBoundWitnessValidationError(bw?._hash ?? ZERO_HASH, [bw, payloadSet], 'unable to locate payloads'))\n }\n\n // check if payloads are valid and if their schemas match the declared schemas\n for (const payload of payloads) {\n if (isAnyPayload(payload)) {\n const payloadHashIndex = bw.payload_hashes.indexOf(payload._hash)\n const payloadDataHashIndex = bw.payload_hashes.indexOf(payload._dataHash)\n const payloadIndex = Math.max(payloadHashIndex, payloadDataHashIndex)\n if (payloadIndex === -1) {\n errors.push(new HydratedBoundWitnessValidationError(bw?._hash ?? ZERO_HASH, [bw, payloadSet], 'payload hash not found'))\n }\n\n const declaredSchema = bw.payload_schemas[payloadIndex]\n if (declaredSchema !== payload.schema) {\n errors.push(new HydratedBoundWitnessValidationError(bw?._hash ?? ZERO_HASH, [bw, payloadSet], 'mismatched schema'))\n }\n\n if (allowedSchemas && !allowedSchemas.includes(payload.schema)) {\n errors.push(new HydratedBoundWitnessValidationError(bw?._hash ?? ZERO_HASH, [bw, payloadSet], `disallowed schema [${payload.schema}]`))\n }\n } else {\n errors.push(new HydratedBoundWitnessValidationError(bw?._hash ?? ZERO_HASH, [bw, payloadSet], 'invalid payload'))\n }\n }\n } catch (ex) {\n const error = new HydratedBoundWitnessValidationError(bw?._hash ?? ZERO_HASH, [bw, payloadSet], `validation excepted: ${String(ex)}`, ex)\n errors.push(error)\n }\n return errors\n }\n","import { type Address, ZERO_HASH } from '@xylabs/sdk-js'\nimport { toArrayBuffer } from '@xylabs/sdk-js'\nimport type { BoundWitness, WithStorageMeta } from '@xyo-network/sdk-js'\nimport { BoundWitnessBuilder, BoundWitnessValidator } from '@xyo-network/sdk-js'\nimport type { BoundWitnessValidationFunction } from '@xyo-network/xl1-protocol-lib'\nimport { BoundWitnessValidationError } from '@xyo-network/xl1-protocol-lib'\n\n/** Validates that all signatures on a BoundWitness are cryptographically valid for their corresponding addresses. */\nexport const BoundWitnessSignaturesValidator: BoundWitnessValidationFunction = async (\n bw: BoundWitness,\n) => {\n const errors: BoundWitnessValidationError[] = []\n try {\n const dataHash = await BoundWitnessBuilder.dataHash(bw)\n const results: [Address, Error[]][] = await Promise.all(bw.addresses.map(async (address, index) => {\n return [address, await BoundWitnessValidator.validateSignature(\n toArrayBuffer(dataHash),\n toArrayBuffer(address),\n toArrayBuffer(bw.$signatures[index] ?? undefined),\n )]\n }))\n for (const [, bwErrors] of results) {\n for (const bwError of bwErrors) {\n errors.push(new BoundWitnessValidationError((bw as WithStorageMeta<BoundWitness>)?._hash ?? ZERO_HASH, bw, 'validation errors', bwError))\n }\n }\n } catch (ex) {\n errors.push(new BoundWitnessValidationError((bw as WithStorageMeta<BoundWitness>)?._hash ?? ZERO_HASH, bw, 'validation excepted', ex))\n }\n return errors\n}\n","import { ZERO_HASH } from '@xylabs/sdk-js'\nimport type { BoundWitness, WithHashMeta } from '@xyo-network/sdk-js'\nimport type {\n HydratedTransactionValidationFunction,\n HydratedTransactionValidationFunctionContext,\n HydratedTransactionWithHashMeta,\n} from '@xyo-network/xl1-protocol-lib'\nimport { HydratedTransactionValidationError, isTransactionBoundWitness } from '@xyo-network/xl1-protocol-lib'\n\nimport {\n TransactionBoundWitnessValidator,\n TransactionDurationValidator,\n TransactionElevationValidator, TransactionFromValidator, TransactionGasValidator, TransactionProtocolValidator,\n} from './validators/index.ts'\n\n/** Validates a hydrated transaction using built-in validators plus any additional validators provided. */\nexport const validateTransaction: HydratedTransactionValidationFunction = async (\n context: HydratedTransactionValidationFunctionContext,\n tx: HydratedTransactionWithHashMeta,\n additionalValidators?: HydratedTransactionValidationFunction[],\n): Promise<HydratedTransactionValidationError[]> => {\n try {\n if (!isTransactionBoundWitness(tx[0])) {\n const castTx = tx.at(0) as WithHashMeta<BoundWitness> | undefined\n return [new HydratedTransactionValidationError(\n castTx?._hash ?? ZERO_HASH,\n tx,\n 'failed isTransactionBoundWitness identity check',\n )]\n }\n\n const validators: HydratedTransactionValidationFunction<HydratedTransactionValidationFunctionContext>[] = [\n TransactionProtocolValidator,\n TransactionDurationValidator,\n TransactionFromValidator,\n TransactionGasValidator,\n TransactionElevationValidator,\n TransactionBoundWitnessValidator,\n ...(additionalValidators ?? []),\n ]\n return (await Promise.all(validators.map(async v => v(context, tx)))).flat()\n } catch (ex) {\n const castTx = tx?.[0] as WithHashMeta<BoundWitness> | undefined\n return [new HydratedTransactionValidationError(\n castTx?._hash ?? ZERO_HASH,\n tx,\n 'Failed TransactionGasValidator: ' + (ex as Error).message,\n ex,\n )]\n }\n}\n","import { ZERO_HASH } from '@xylabs/sdk-js'\nimport { BoundWitnessValidator } from '@xyo-network/sdk-js'\nimport type { HydratedTransactionValidationFunction, HydratedTransactionWithHashMeta } from '@xyo-network/xl1-protocol-lib'\nimport { HydratedTransactionValidationError } from '@xyo-network/xl1-protocol-lib'\n\nconst error = (tx: HydratedTransactionWithHashMeta, message: string): HydratedTransactionValidationError =>\n new HydratedTransactionValidationError(tx?.[0]?._hash ?? ZERO_HASH, tx, message)\n\n// Friendly pre-check for the wallet bug we want to surface clearly: signatures\n// emitted under `signatures` instead of `$signatures`. The downstream\n// BoundWitnessValidator would also catch the missing/mismatched signatures,\n// but its message (\"Length mismatch: address/signature\", \"Missing signature\n// [<address>]\") doesn't hint at the actual root cause.\nconst checkSignaturesShape = (tx: HydratedTransactionWithHashMeta): HydratedTransactionValidationError[] => {\n const bw = tx[0] as unknown as Record<string, unknown>\n if (bw.$signatures === undefined) {\n return Array.isArray(bw.signatures)\n ? [error(tx, 'BoundWitness has `signatures` but expected `$signatures` (signatures must be in the meta-prefixed `$signatures` key)')]\n : [error(tx, 'BoundWitness is missing `$signatures`')]\n }\n return []\n}\n\n/**\n * Validates the transaction's BoundWitness wholistically by delegating to\n * `BoundWitnessValidator.validate()`. This covers:\n * - signatures: length matches addresses, every signature is cryptographically\n * valid for its corresponding address against the BW data hash\n * - addresses: uniqueness\n * - array length parity: payload_hashes vs payload_schemas\n * - schemas: per-schema name validators\n * - top-level schema check\n * - PayloadValidator.schemaName check\n *\n * Also emits a friendly diagnostic when the common wallet bug of\n * `signatures` vs `$signatures` is detected, so the failure points at the\n * actual root cause instead of buried length/missing-signature errors.\n */\nexport const TransactionBoundWitnessValidator: HydratedTransactionValidationFunction = async (\n context,\n tx,\n) => {\n try {\n const shapeErrors = checkSignaturesShape(tx)\n if (shapeErrors.length > 0) return shapeErrors\n const bwValidator = new BoundWitnessValidator(tx[0])\n const bwErrors = await bwValidator.validate()\n return bwErrors.map(e => error(tx, `BoundWitness validation: ${e.message}`))\n } catch (ex) {\n return [error(tx, `Failed TransactionBoundWitnessValidator: ${String(ex)}`)]\n }\n}\n","import { ZERO_HASH } from '@xylabs/sdk-js'\nimport type { HydratedTransactionValidationFunction } from '@xyo-network/xl1-protocol-lib'\nimport { HydratedTransactionValidationError } from '@xyo-network/xl1-protocol-lib'\n\n/** Validates that transaction timing fields (nbf and exp) are positive, correctly ordered, and within allowed duration limits. */\nexport const TransactionDurationValidator: HydratedTransactionValidationFunction = (\n context,\n tx,\n// eslint-disable-next-line complexity\n) => {\n const errors: HydratedTransactionValidationError[] = []\n try {\n const { exp, nbf } = tx[0]\n if (nbf < 0) errors.push(new HydratedTransactionValidationError(tx?.[0]?._hash ?? ZERO_HASH, tx, 'Transaction nbf must be positive'))\n\n if (exp < 0) errors.push(new HydratedTransactionValidationError(tx?.[0]?._hash ?? ZERO_HASH, tx, 'Transaction exp must be positive'))\n if (exp <= nbf) errors.push(new HydratedTransactionValidationError(tx?.[0]?._hash ?? ZERO_HASH, tx, 'Transaction exp must greater than nbf'))\n if (exp - nbf > 10_000) errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n 'Transaction exp must not be too far in the future',\n ))\n } catch (ex) {\n errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n `Failed TransactionDurationValidator: ${String(ex)}`,\n ex,\n ))\n }\n\n return errors\n}\n","import { ZERO_HASH } from '@xylabs/sdk-js'\nimport type { HydratedTransactionValidationFunction } from '@xyo-network/xl1-protocol-lib'\nimport { extractElevatedHashes, HydratedTransactionValidationError } from '@xyo-network/xl1-protocol-lib'\n\n/** Validates that a hydrated transaction includes all required elevated script hashes. */\nexport const TransactionElevationValidator: HydratedTransactionValidationFunction = (\n context,\n tx,\n) => {\n const errors: HydratedTransactionValidationError[] = []\n try {\n try {\n extractElevatedHashes(tx)\n } catch {\n errors.push(new HydratedTransactionValidationError(tx?.[0]?._hash ?? ZERO_HASH, tx, 'Hydrated transaction does not include all script hashes'))\n }\n } catch (ex) {\n errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n `Failed TransactionElevationValidator: ${String(ex)}`,\n ex,\n ))\n }\n return errors\n}\n","import { asAddress, ZERO_HASH } from '@xylabs/sdk-js'\nimport { addressesContains } from '@xyo-network/sdk-js'\nimport type { HydratedTransactionValidationFunction } from '@xyo-network/xl1-protocol-lib'\nimport { HydratedTransactionValidationError } from '@xyo-network/xl1-protocol-lib'\n\n/** Validates that the transaction's from field is a valid address and is included in the BoundWitness addresses. */\nexport const TransactionFromValidator: HydratedTransactionValidationFunction = (\n context,\n tx,\n) => {\n const errors: HydratedTransactionValidationError[] = []\n try {\n const from = asAddress(tx[0].from)\n if (from === undefined)errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n 'Transaction from is not a valid address',\n ))\n else if (!addressesContains(tx[0], from)) errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n 'Transaction from address must be listed in addresses',\n ))\n } catch (ex) {\n errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n `Failed TransactionFromValidator: ${String(ex)}`,\n ex,\n ))\n }\n return errors\n}\n","import { hexToBigInt, ZERO_HASH } from '@xylabs/sdk-js'\nimport type {\n HydratedTransactionValidationFunction,\n TransactionFeesBigInt, TransactionFeesHex,\n} from '@xyo-network/xl1-protocol-lib'\nimport {\n AttoXL1,\n HydratedTransactionValidationError,\n minTransactionFees,\n} from '@xyo-network/xl1-protocol-lib'\n\n/** Validates that transaction fee fields (base, gasLimit, gasPrice, priority) are present and meet minimum requirements. */\nexport const TransactionGasValidator: HydratedTransactionValidationFunction = (\n context,\n tx,\n// eslint-disable-next-line complexity\n) => {\n const errors: HydratedTransactionValidationError[] = []\n try {\n if (tx?.[0].fees === undefined) {\n errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n 'Missing fees',\n ))\n } else {\n const {\n base, gasLimit, gasPrice, priority,\n } = parseFees(tx[0].fees)\n\n if (base === undefined) errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n 'fees.base must be defined and a valid number',\n ))\n else if (base < minTransactionFees.base) errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n `fees.base must be >= ${minTransactionFees.base}`,\n ))\n\n if (gasLimit === undefined) errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n 'fees.gasLimit must be defined and a valid number',\n ))\n else if (gasLimit < minTransactionFees.gasLimit) errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n `fees.gasLimit must be >= ${minTransactionFees.gasLimit}`,\n ))\n\n if (gasPrice === undefined) errors.push(\n new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n 'fees.gasPrice must be defined and a valid number',\n ),\n )\n else if (gasPrice < minTransactionFees.gasPrice) errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n `fees.gasPrice must be >= ${minTransactionFees.gasPrice}`,\n ))\n\n if (priority === undefined) errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n 'fees.priority must be defined and a valid number',\n ))\n else if (priority < minTransactionFees.priority) errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n `fees.priority must be >= ${minTransactionFees.priority}`,\n ))\n }\n } catch (ex) {\n errors.push(new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n `Failed TransactionGasValidator: ${String(ex)}`,\n ex,\n ))\n }\n return errors\n}\n\nconst parseFees = (fees: TransactionFeesHex): Partial<TransactionFeesBigInt> => {\n const ret: Partial<TransactionFeesBigInt> = {}\n const {\n base, gasLimit, gasPrice, priority,\n } = fees\n if (base !== undefined) ret.base = AttoXL1(hexToBigInt(base))\n if (gasLimit !== undefined) ret.gasLimit = AttoXL1(hexToBigInt(gasLimit))\n if (gasPrice !== undefined) ret.gasPrice = AttoXL1(hexToBigInt(gasPrice))\n if (priority !== undefined) ret.priority = AttoXL1(hexToBigInt(priority))\n return ret\n}\n","import { ZERO_HASH } from '@xylabs/sdk-js'\nimport { PayloadBuilder } from '@xyo-network/sdk-js'\nimport type { HydratedTransactionValidationFunction, TransactionBoundWitness } from '@xyo-network/xl1-protocol-lib'\nimport { HydratedTransactionValidationError } from '@xyo-network/xl1-protocol-lib'\nimport { TransactionBoundWitnessJsonSchema } from '@xyo-network/xl1-schema'\nimport type { ValidateFunction } from 'ajv'\nimport { Ajv } from 'ajv'\n\nconst ajv = new Ajv({ allErrors: true, strict: true })\n\nlet validate: ValidateFunction<TransactionBoundWitness> | undefined\n\n/** Validates a transaction against the TransactionBoundWitness JSON schema using AJV. */\nexport const TransactionJsonSchemaValidator: HydratedTransactionValidationFunction = (\n context,\n tx,\n) => {\n const errors: HydratedTransactionValidationError[] = []\n try {\n validate ??= ajv.compile(TransactionBoundWitnessJsonSchema)\n if (!validate(PayloadBuilder.omitStorageMeta(tx[0]))) {\n const error = new HydratedTransactionValidationError(\n tx?.[0]?._hash ?? ZERO_HASH,\n tx,\n `failed JSON schema validation: ${ajv.errorsText(validate.errors, { separator: '\\n' })}`,\n validate.errors,\n )\n errors.push(error)\n }\n } catch (ex) {\n errors.push(new HydratedTransactionValidationError(tx?.[0]?._hash ?? ZERO_HASH, tx, 'validation excepted', ex))\n }\n return errors\n}\n","import { ZERO_HASH } from '@xylabs/sdk-js'\nimport type {\n ChainId,\n HydratedTransactionValidationFunction,\n} from '@xyo-network/xl1-protocol-lib'\nimport { HydratedTransactionValidationError } from '@xyo-network/xl1-protocol-lib'\n\n/** Validates that the transaction's chain ID matches the expected chain ID from the validation context. */\nexport const TransactionProtocolValidator: HydratedTransactionValidationFunction = async (\n context: { chainId?: ChainId },\n tx,\n) => {\n const errors: HydratedTransactionValidationError[] = []\n try {\n if (context?.chainId !== undefined && tx[0].chain !== context.chainId) {\n errors.push(new HydratedTransactionValidationError(tx?.[0]?._hash ?? ZERO_HASH, tx, `invalid chain id [${context.chainId}, ${tx[0].chain}]`))\n }\n } catch (ex) {\n errors.push(new HydratedTransactionValidationError(tx?.[0]?._hash ?? ZERO_HASH, tx, 'validation excepted', ex))\n }\n return await Promise.resolve(errors)\n}\n","import type { Address } from '@xylabs/sdk-js'\nimport { isDefined, isUndefined } from '@xylabs/sdk-js'\nimport type {\n HydratedTransactionValidationFunction, StepIdentity,\n Transfer,\n} from '@xyo-network/xl1-protocol-lib'\nimport {\n completedStepRewardAddress,\n derivedReceiveAddress,\n elevatedPayloads,\n HydratedTransactionValidationError,\n isTransfer,\n} from '@xyo-network/xl1-protocol-lib'\n\n/** Function type that checks whether a signer is authorized to sign for a given signee address. */\nexport type SignerValidator = (signer: Address, signee: Address, context?: { address?: Address; scope?: string; step?: StepIdentity }) => boolean\n\n/** Maps addresses to their list of authorized signer addresses. */\nexport type SignerMapping = Map<Address, Address[]>\n\n/** A signer validator that only allows an address to sign for itself. */\nexport const SelfSignerValidator: SignerValidator = (signer: Address, signee: Address) => signer === signee\n\n/** Creates a signer validator that authorizes specified signers to sign for completed step reward addresses. */\nexport const CompletedStepRewardAddressValidatorFactory = (allowedSigners: Address[]): SignerValidator => (\n signer: Address,\n signee: Address,\n context?: { step?: StepIdentity },\n) => {\n const step = context?.step\n if (isDefined(step)) {\n const contextAddress = completedStepRewardAddress(step)\n return allowedSigners.includes(signer) && signee === contextAddress\n } else {\n return false\n }\n}\n\n/** Creates a signer validator that authorizes specified signers to sign for derived receive addresses within a given scope. */\nexport const DerivedReceiveAddressValidatorFactory = (allowedSigners: Address[], allowedScope: string): SignerValidator => (\n signer: Address,\n signee: Address,\n context?: { address?: Address; scope?: string },\n) => {\n const { address, scope } = context ?? {}\n if (scope !== allowedScope) {\n return false\n }\n if (isDefined(address)) {\n const derivedAddress = derivedReceiveAddress(address, scope)\n return allowedSigners.includes(signer) && signee === derivedAddress\n } else {\n return false\n }\n}\n\n/** Creates a transaction validator that checks all transfers are authorized by the transaction signer. */\nexport function TransactionTransfersValidatorFactory(\n signerValidators: SignerValidator[] = [SelfSignerValidator],\n): HydratedTransactionValidationFunction {\n return async (\n context,\n hydratedTx,\n ) => {\n const errors: HydratedTransactionValidationError[] = []\n const signer = hydratedTx[0].from\n try {\n const payloads = elevatedPayloads(hydratedTx)\n const transfers = payloads.filter(isTransfer) as Transfer[]\n for (const transfer of transfers) {\n if (isUndefined(signerValidators.find(v => v(signer, transfer.from, transfer.context)))) {\n errors.push(new HydratedTransactionValidationError(\n hydratedTx[0]._hash,\n hydratedTx,\n `transfer from address ${transfer.from} is not authorized by signer ${signer}`,\n ))\n }\n }\n } catch (ex) {\n errors.push(new HydratedTransactionValidationError(hydratedTx[0]._hash, hydratedTx, 'validation excepted', ex))\n }\n return await Promise.resolve(errors)\n }\n}\n"],"mappings":";AAAA;AAAA,EAC0B;AAAA,OACnB;AAMP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP,SAAS,sBAAsB,IAAiD;AAC9E,QAAM;AAAA,IACJ;AAAA,IAAM;AAAA,IAAU;AAAA,EAClB,IAAI,GAAG;AACP,SAAO,YAAY,IAAI,IAAI,YAAY,QAAQ,IAAI,YAAY,QAAQ;AACzE;AAGO,SAAS,mBACd,cACA,UACyB;AACzB,QAAM,WAAoC,CAAC;AAE3C,aAAW,MAAM,cAAc;AAE7B,UAAM,UAAU,sBAAsB,EAAE;AACxC,UAAM,WAAW,GAAG;AACpB,aAAS,QAAQ,KAAK,SAAS,QAAQ,KAAK,MAAM;AAGlD,UAAM,kBAAkB,IAAI,IAAI,GAAG,cAAc;AACjD,eAAW,WAAW,UAAU;AAC9B,UAAI,CAAC,gBAAgB,IAAI,QAAQ,KAAK,KAAK,CAAC,WAAW,OAAO,EAAG;AACjE,YAAM,EAAE,KAAK,IAAI;AACjB,iBAAW,CAAC,IAAI,MAAM,KAAK,OAAO,QAAQ,QAAQ,SAAS,GAAuB;AAChF,YAAI,OAAO,KAAM;AACjB,iBAAS,IAAI,KAAK,SAAS,IAAI,KAAK,MAAM,YAAY,MAAM;AAAA,MAC9D;AAAA,IACF;AA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EAAE,SAAS,EAAE,CAAC,CAAC,GAAG,KAAK;AAAA,EAC7E,SAAS,IAAI;AACX,UAAM,SAAS,KAAK,CAAC;AACrB,WAAO,CAAC,IAAID;AAAA,MACV,QAAQ,SAASC;AAAA,MACjB;AAAA,MACA,qCAAsC,GAAa;AAAA,MACnD;AAAA,IACF,CAAC;AAAA,EACH;AACF;","names":["error","ZERO_HASH","ZERO_HASH","HydratedTransactionValidationError","ZERO_HASH","BoundWitnessValidator","ZERO_HASH","HydratedTransactionValidationError","ZERO_HASH","HydratedTransactionValidationError","ZERO_HASH","HydratedTransactionValidationError","hexToBigInt","ZERO_HASH","HydratedTransactionValidationError","ZERO_HASH","HydratedTransactionValidationError","error","ZERO_HASH","HydratedTransactionValidationError","HydratedTransactionValidationError","isTransfer","HydratedTransactionValidationError","ZERO_HASH"]}
@@ -1 +1 @@
1
- {"version":3,"file":"validateTransaction.d.ts","sourceRoot":"","sources":["../../../src/transaction/validateTransaction.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,qCAAqC,EAGtC,MAAM,+BAA+B,CAAA;AAQtC,0GAA0G;AAC1G,eAAO,MAAM,mBAAmB,EAAE,qCAiCjC,CAAA"}
1
+ {"version":3,"file":"validateTransaction.d.ts","sourceRoot":"","sources":["../../../src/transaction/validateTransaction.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,qCAAqC,EAGtC,MAAM,+BAA+B,CAAA;AAStC,0GAA0G;AAC1G,eAAO,MAAM,mBAAmB,EAAE,qCAkCjC,CAAA"}
@@ -0,0 +1,18 @@
1
+ import type { HydratedTransactionValidationFunction } from '@xyo-network/xl1-protocol-lib';
2
+ /**
3
+ * Validates the transaction's BoundWitness wholistically by delegating to
4
+ * `BoundWitnessValidator.validate()`. This covers:
5
+ * - signatures: length matches addresses, every signature is cryptographically
6
+ * valid for its corresponding address against the BW data hash
7
+ * - addresses: uniqueness
8
+ * - array length parity: payload_hashes vs payload_schemas
9
+ * - schemas: per-schema name validators
10
+ * - top-level schema check
11
+ * - PayloadValidator.schemaName check
12
+ *
13
+ * Also emits a friendly diagnostic when the common wallet bug of
14
+ * `signatures` vs `$signatures` is detected, so the failure points at the
15
+ * actual root cause instead of buried length/missing-signature errors.
16
+ */
17
+ export declare const TransactionBoundWitnessValidator: HydratedTransactionValidationFunction;
18
+ //# sourceMappingURL=TransactionBoundWitnessValidator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TransactionBoundWitnessValidator.d.ts","sourceRoot":"","sources":["../../../../src/transaction/validators/TransactionBoundWitnessValidator.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qCAAqC,EAAmC,MAAM,+BAA+B,CAAA;AAqB3H;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,gCAAgC,EAAE,qCAa9C,CAAA"}
@@ -1,3 +1,4 @@
1
+ export * from './TransactionBoundWitnessValidator.ts';
1
2
  export * from './TransactionDurationValidator.ts';
2
3
  export * from './TransactionElevationValidator.ts';
3
4
  export * from './TransactionFromValidator.ts';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/transaction/validators/index.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAA;AACjD,cAAc,oCAAoC,CAAA;AAClD,cAAc,+BAA+B,CAAA;AAC7C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,qCAAqC,CAAA;AACnD,cAAc,mCAAmC,CAAA;AACjD,cAAc,oCAAoC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/transaction/validators/index.ts"],"names":[],"mappings":"AAAA,cAAc,uCAAuC,CAAA;AACrD,cAAc,mCAAmC,CAAA;AACjD,cAAc,oCAAoC,CAAA;AAClD,cAAc,+BAA+B,CAAA;AAC7C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,qCAAqC,CAAA;AACnD,cAAc,mCAAmC,CAAA;AACjD,cAAc,oCAAoC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/xl1-validation",
3
- "version": "1.26.43",
3
+ "version": "1.26.44",
4
4
  "description": "XYO Layer One SDK Validation",
5
5
  "homepage": "https://xylabs.com",
6
6
  "bugs": {
@@ -34,8 +34,8 @@
34
34
  "README.md"
35
35
  ],
36
36
  "dependencies": {
37
- "@xyo-network/xl1-protocol-lib": "~1.26.43",
38
- "@xyo-network/xl1-schema": "~1.26.43"
37
+ "@xyo-network/xl1-protocol-lib": "~1.26.44",
38
+ "@xyo-network/xl1-schema": "~1.26.44"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@bitauth/libauth": "~3.0.0",