@xyo-network/xl1-protocol-sdk 1.16.21 → 1.16.23
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/ChainServiceCollectionV2.d.ts +3 -3
- package/dist/neutral/ChainServiceCollectionV2.d.ts.map +1 -1
- package/dist/neutral/block/primitives/index.d.ts +0 -1
- package/dist/neutral/block/primitives/index.d.ts.map +1 -1
- package/dist/neutral/config/Chain.d.ts +1 -0
- package/dist/neutral/config/Chain.d.ts.map +1 -1
- package/dist/neutral/config/Config.d.ts +2 -0
- package/dist/neutral/config/Config.d.ts.map +1 -1
- package/dist/neutral/config/Producer.d.ts +1 -0
- package/dist/neutral/config/Producer.d.ts.map +1 -1
- package/dist/neutral/index.d.ts +2 -0
- package/dist/neutral/index.d.ts.map +1 -1
- package/dist/neutral/index.mjs +794 -240
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/model/summary.d.ts +5 -0
- package/dist/neutral/model/summary.d.ts.map +1 -1
- package/dist/neutral/payloads/index.d.ts +1 -0
- package/dist/neutral/payloads/index.d.ts.map +1 -1
- package/dist/neutral/payloads/netSchemasForPayloads.d.ts +4 -0
- package/dist/neutral/payloads/netSchemasForPayloads.d.ts.map +1 -0
- package/dist/neutral/payloads/summary/SchemasStepSummary.d.ts +18 -0
- package/dist/neutral/payloads/summary/SchemasStepSummary.d.ts.map +1 -0
- package/dist/neutral/payloads/summary/index.d.ts +1 -0
- package/dist/neutral/payloads/summary/index.d.ts.map +1 -1
- package/dist/neutral/primitives/summary/index.d.ts +2 -1
- package/dist/neutral/primitives/summary/index.d.ts.map +1 -1
- package/dist/neutral/primitives/summary/schemas/index.d.ts +3 -0
- package/dist/neutral/primitives/summary/schemas/index.d.ts.map +1 -0
- package/dist/neutral/primitives/summary/schemas/schemasStepSummaryFromRange.d.ts +6 -0
- package/dist/neutral/primitives/summary/schemas/schemasStepSummaryFromRange.d.ts.map +1 -0
- package/dist/neutral/primitives/summary/schemas/schemasSummary.d.ts +4 -0
- package/dist/neutral/primitives/summary/schemas/schemasSummary.d.ts.map +1 -0
- package/dist/neutral/primitives/summary/transfers/transfersStepSummaryFromRange.d.ts.map +1 -1
- package/dist/neutral/primitives/summary/transfers/transfersSummary.d.ts +3 -2
- package/dist/neutral/primitives/summary/transfers/transfersSummary.d.ts.map +1 -1
- package/dist/neutral/primitives/timeBudget.d.ts +1 -1
- package/dist/neutral/primitives/timeBudget.d.ts.map +1 -1
- package/dist/neutral/services/SchemasService.d.ts +9 -0
- package/dist/neutral/services/SchemasService.d.ts.map +1 -0
- package/dist/neutral/services/StakeIntentService/ChainIndexingServiceStateSchema.d.ts +2 -2
- package/dist/neutral/services/StakeIntentService/ChainIndexingServiceStateSchema.d.ts.map +1 -1
- package/dist/neutral/services/index.d.ts +1 -1
- package/dist/neutral/services/index.d.ts.map +1 -1
- package/dist/neutral/simple/accountBalance/SimpleAccountBalanceViewer.d.ts +2 -2
- package/dist/neutral/simple/accountBalance/SimpleAccountBalanceViewer.d.ts.map +1 -1
- package/dist/neutral/utils/index.d.ts +2 -0
- package/dist/neutral/utils/index.d.ts.map +1 -0
- package/dist/neutral/utils/isZodError.d.ts +4 -0
- package/dist/neutral/utils/isZodError.d.ts.map +1 -0
- package/dist/neutral/validation/block/HydratedBlockStateValidationFunction.d.ts +2 -2
- package/dist/neutral/validation/block/HydratedBlockStateValidationFunction.d.ts.map +1 -1
- package/dist/neutral/viewers/AccountBalance.d.ts +60 -12
- package/dist/neutral/viewers/AccountBalance.d.ts.map +1 -1
- package/dist/neutral/zod/ArrayBuffer.d.ts +4 -0
- package/dist/neutral/zod/ArrayBuffer.d.ts.map +1 -0
- package/dist/neutral/zod/BlockBoundWitness.d.ts +44 -0
- package/dist/neutral/zod/BlockBoundWitness.d.ts.map +1 -0
- package/dist/neutral/zod/BoundWitness.d.ts +123 -0
- package/dist/neutral/zod/BoundWitness.d.ts.map +1 -0
- package/dist/neutral/zod/Chain.d.ts +4 -0
- package/dist/neutral/zod/Chain.d.ts.map +1 -0
- package/dist/neutral/zod/HydratedBlock.d.ts +133 -0
- package/dist/neutral/zod/HydratedBlock.d.ts.map +1 -0
- package/dist/neutral/zod/HydratedTransaction.d.ts +210 -0
- package/dist/neutral/zod/HydratedTransaction.d.ts.map +1 -0
- package/dist/neutral/zod/Permission.d.ts +53 -0
- package/dist/neutral/zod/Permission.d.ts.map +1 -0
- package/dist/neutral/zod/RewardsRangeOptions.d.ts +11 -0
- package/dist/neutral/zod/RewardsRangeOptions.d.ts.map +1 -0
- package/dist/neutral/zod/Sequence.d.ts +9 -0
- package/dist/neutral/zod/Sequence.d.ts.map +1 -0
- package/dist/neutral/zod/Stake.d.ts +62 -0
- package/dist/neutral/zod/Stake.d.ts.map +1 -0
- package/dist/neutral/zod/TimeDomain.d.ts +3 -0
- package/dist/neutral/zod/TimeDomain.d.ts.map +1 -0
- package/dist/neutral/zod/TransactionBoundWitness.d.ts +75 -0
- package/dist/neutral/zod/TransactionBoundWitness.d.ts.map +1 -0
- package/dist/neutral/zod/TransactionFees.d.ts +53 -0
- package/dist/neutral/zod/TransactionFees.d.ts.map +1 -0
- package/dist/neutral/zod/TransferPair.d.ts +3 -0
- package/dist/neutral/zod/TransferPair.d.ts.map +1 -0
- package/dist/neutral/zod/index.d.ts +15 -0
- package/dist/neutral/zod/index.d.ts.map +1 -0
- package/package.json +4 -4
- package/src/ChainServiceCollectionV2.ts +3 -3
- package/src/block/primitives/index.ts +0 -1
- package/src/config/Chain.ts +8 -0
- package/src/config/Producer.ts +6 -0
- package/src/index.ts +2 -0
- package/src/model/summary.ts +5 -0
- package/src/payloads/index.ts +1 -0
- package/src/payloads/netSchemasForPayloads.ts +22 -0
- package/src/payloads/summary/SchemasStepSummary.ts +26 -0
- package/src/payloads/summary/index.ts +1 -0
- package/src/primitives/summary/balances/balancesSummary.ts +1 -1
- package/src/primitives/summary/index.ts +2 -1
- package/src/primitives/summary/schemas/index.ts +2 -0
- package/src/primitives/summary/schemas/schemasStepSummaryFromRange.ts +83 -0
- package/src/primitives/summary/schemas/schemasSummary.ts +33 -0
- package/src/primitives/summary/transfers/transfersStepSummaryFromRange.ts +8 -6
- package/src/primitives/summary/transfers/transfersSummary.ts +11 -7
- package/src/primitives/timeBudget.ts +21 -2
- package/src/services/SchemasService.ts +9 -0
- package/src/services/index.ts +1 -1
- package/src/simple/accountBalance/SimpleAccountBalanceViewer.ts +5 -5
- package/src/simple/chainStake/SimpleChainStakeViewer.ts +1 -1
- package/src/utils/index.ts +1 -0
- package/src/utils/isZodError.ts +9 -0
- package/src/validation/block/HydratedBlockStateValidationFunction.ts +2 -2
- package/src/viewers/AccountBalance.ts +17 -15
- package/src/zod/ArrayBuffer.ts +42 -0
- package/src/zod/BlockBoundWitness.ts +36 -0
- package/src/zod/BoundWitness.ts +56 -0
- package/src/zod/Chain.ts +5 -0
- package/src/zod/HydratedBlock.ts +32 -0
- package/src/zod/HydratedTransaction.ts +37 -0
- package/src/zod/Permission.ts +23 -0
- package/src/zod/RewardsRangeOptions.ts +10 -0
- package/src/zod/Sequence.ts +15 -0
- package/src/zod/Stake.ts +43 -0
- package/src/zod/TimeDomain.ts +7 -0
- package/src/zod/TransactionBoundWitness.ts +42 -0
- package/src/zod/TransactionFees.ts +45 -0
- package/src/zod/TransferPair.ts +6 -0
- package/src/zod/index.ts +14 -0
- package/dist/neutral/block/primitives/transfers/index.d.ts +0 -3
- package/dist/neutral/block/primitives/transfers/index.d.ts.map +0 -1
- package/dist/neutral/block/primitives/transfers/transfersStepSummaryFromRange.d.ts +0 -6
- package/dist/neutral/block/primitives/transfers/transfersStepSummaryFromRange.d.ts.map +0 -1
- package/dist/neutral/block/primitives/transfers/transfersSummary.d.ts +0 -5
- package/dist/neutral/block/primitives/transfers/transfersSummary.d.ts.map +0 -1
- package/dist/neutral/services/AccountBalanceService.d.ts +0 -4
- package/dist/neutral/services/AccountBalanceService.d.ts.map +0 -1
- package/src/block/primitives/transfers/index.ts +0 -2
- package/src/block/primitives/transfers/transfersStepSummaryFromRange.ts +0 -98
- package/src/block/primitives/transfers/transfersSummary.ts +0 -44
- package/src/services/AccountBalanceService.ts +0 -4
package/dist/neutral/index.mjs
CHANGED
|
@@ -111,10 +111,10 @@ var tryHydrateBlock = /* @__PURE__ */ __name(async (archivist, hash, maxDepth =
|
|
|
111
111
|
// src/block/primitives/blockFromBlockNumber.ts
|
|
112
112
|
import { asHash } from "@xylabs/sdk-js";
|
|
113
113
|
import { toSafeJsonString } from "@xylabs/sdk-js";
|
|
114
|
-
import { asBlockBoundWitnessWithStorageMeta as
|
|
114
|
+
import { asBlockBoundWitnessWithStorageMeta as asBlockBoundWitnessWithStorageMeta5, StepSizes as StepSizes7 } from "@xyo-network/xl1-protocol";
|
|
115
115
|
|
|
116
116
|
// src/model/ChainContext/ChainContext.ts
|
|
117
|
-
import { isDefined as
|
|
117
|
+
import { isDefined as isDefined7, isUndefined } from "@xylabs/sdk-js";
|
|
118
118
|
|
|
119
119
|
// src/driver/cache/LruCacheMap.ts
|
|
120
120
|
import { LRUCache } from "lru-cache";
|
|
@@ -322,21 +322,41 @@ var netBalancesForPayloads = /* @__PURE__ */ __name((payloads) => {
|
|
|
322
322
|
});
|
|
323
323
|
}, "netBalancesForPayloads");
|
|
324
324
|
|
|
325
|
-
// src/payloads/
|
|
326
|
-
import { hexToBigInt as hexToBigInt2 } from "@xylabs/sdk-js";
|
|
325
|
+
// src/payloads/netSchemasForPayloads.ts
|
|
326
|
+
import { hexToBigInt as hexToBigInt2, toAddress as toAddress4 } from "@xylabs/sdk-js";
|
|
327
327
|
import { span as span2 } from "@xylabs/telemetry";
|
|
328
328
|
import { isTransfer as isTransfer2 } from "@xyo-network/xl1-protocol";
|
|
329
|
+
var netSchemasForPayloads = /* @__PURE__ */ __name((payloads) => {
|
|
330
|
+
return span2("netSchemasForPayloads", () => {
|
|
331
|
+
const balances = {};
|
|
332
|
+
for (const payload of payloads) {
|
|
333
|
+
if (isTransfer2(payload)) {
|
|
334
|
+
const { from } = payload;
|
|
335
|
+
for (let [address, amount] of Object.entries(payload.transfers)) {
|
|
336
|
+
balances[toAddress4(address)] = (balances[toAddress4(address)] ?? 0n) + hexToBigInt2(amount);
|
|
337
|
+
balances[toAddress4(from)] = (balances[toAddress4(from)] ?? 0n) - hexToBigInt2(amount);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
return balances;
|
|
342
|
+
});
|
|
343
|
+
}, "netSchemasForPayloads");
|
|
344
|
+
|
|
345
|
+
// src/payloads/netTransfersForPayloads.ts
|
|
346
|
+
import { hexToBigInt as hexToBigInt3 } from "@xylabs/sdk-js";
|
|
347
|
+
import { span as span3 } from "@xylabs/telemetry";
|
|
348
|
+
import { isTransfer as isTransfer3 } from "@xyo-network/xl1-protocol";
|
|
329
349
|
function netTransfersForPayloads(payloads) {
|
|
330
|
-
return
|
|
350
|
+
return span3("netTransfersForPayloads", () => {
|
|
331
351
|
const transfers = {};
|
|
332
352
|
for (const payload of payloads) {
|
|
333
|
-
if (
|
|
353
|
+
if (isTransfer3(payload)) {
|
|
334
354
|
const { from } = payload;
|
|
335
355
|
transfers[from] = transfers[from] ?? {};
|
|
336
356
|
for (let [to, amount] of Object.entries(payload.transfers)) {
|
|
337
357
|
transfers[to] = transfers[to] ?? {};
|
|
338
|
-
transfers[to][from] = (transfers[to][from] ?? 0n) +
|
|
339
|
-
transfers[from][to] = (transfers[from][to] ?? 0n) -
|
|
358
|
+
transfers[to][from] = (transfers[to][from] ?? 0n) + hexToBigInt3(amount);
|
|
359
|
+
transfers[from][to] = (transfers[from][to] ?? 0n) - hexToBigInt3(amount);
|
|
340
360
|
}
|
|
341
361
|
}
|
|
342
362
|
}
|
|
@@ -356,22 +376,33 @@ var isBalancesStepSummaryWithStorageMeta = /* @__PURE__ */ __name((value) => {
|
|
|
356
376
|
}, "isBalancesStepSummaryWithStorageMeta");
|
|
357
377
|
var asBalancesStepSummaryWithStorageMeta = AsObjectFactory2.create(isBalancesStepSummaryWithStorageMeta);
|
|
358
378
|
|
|
379
|
+
// src/payloads/summary/SchemasStepSummary.ts
|
|
380
|
+
import { AsObjectFactory as AsObjectFactory3 } from "@xylabs/sdk-js";
|
|
381
|
+
import { isPayloadOfSchemaType as isPayloadOfSchemaType3, isStorageMeta as isStorageMeta2 } from "@xyo-network/payload-model";
|
|
382
|
+
var SchemasStepSummarySchema = "network.xyo.step.summary.schemas";
|
|
383
|
+
var isSchemasStepSummary = isPayloadOfSchemaType3(SchemasStepSummarySchema);
|
|
384
|
+
var asSchemasStepSummary = AsObjectFactory3.create(isSchemasStepSummary);
|
|
385
|
+
var isSchemasStepSummaryWithStorageMeta = /* @__PURE__ */ __name((value) => {
|
|
386
|
+
return isSchemasStepSummary(value) && isStorageMeta2(value);
|
|
387
|
+
}, "isSchemasStepSummaryWithStorageMeta");
|
|
388
|
+
var asSchemasStepSummaryWithStorageMeta = AsObjectFactory3.create(isSchemasStepSummaryWithStorageMeta);
|
|
389
|
+
|
|
359
390
|
// src/payloads/summary/StepSummary.ts
|
|
360
391
|
var StepSummarySchema = "network.xyo.step.summary";
|
|
361
392
|
|
|
362
393
|
// src/payloads/summary/TransfersSummary.ts
|
|
363
|
-
import { AsObjectFactory as
|
|
364
|
-
import { isPayloadOfSchemaType as
|
|
394
|
+
import { AsObjectFactory as AsObjectFactory4 } from "@xylabs/sdk-js";
|
|
395
|
+
import { isPayloadOfSchemaType as isPayloadOfSchemaType4, isStorageMeta as isStorageMeta3 } from "@xyo-network/payload-model";
|
|
365
396
|
var TransfersStepSummarySchema = "network.xyo.step.summary.transfer";
|
|
366
|
-
var isTransfersStepSummary =
|
|
367
|
-
var asTransfersStepSummary =
|
|
397
|
+
var isTransfersStepSummary = isPayloadOfSchemaType4(TransfersStepSummarySchema);
|
|
398
|
+
var asTransfersStepSummary = AsObjectFactory4.create(isTransfersStepSummary);
|
|
368
399
|
var isTransfersStepSummaryWithStorageMeta = /* @__PURE__ */ __name((value) => {
|
|
369
|
-
return isTransfersStepSummary(value) &&
|
|
400
|
+
return isTransfersStepSummary(value) && isStorageMeta3(value);
|
|
370
401
|
}, "isTransfersStepSummaryWithStorageMeta");
|
|
371
|
-
var asTransfersStepSummaryWithStorageMeta =
|
|
402
|
+
var asTransfersStepSummaryWithStorageMeta = AsObjectFactory4.create(isTransfersStepSummaryWithStorageMeta);
|
|
372
403
|
|
|
373
404
|
// src/SignedBigInt.ts
|
|
374
|
-
import { hexToBigInt as
|
|
405
|
+
import { hexToBigInt as hexToBigInt4, toHex } from "@xylabs/sdk-js";
|
|
375
406
|
import { isObject } from "@xylabs/sdk-js";
|
|
376
407
|
var isNegativeBigInt = /* @__PURE__ */ __name((value) => {
|
|
377
408
|
return isObject(value) && "negative" in value && typeof value.negative === "string";
|
|
@@ -381,9 +412,9 @@ var isPositiveBigInt = /* @__PURE__ */ __name((value) => {
|
|
|
381
412
|
}, "isPositiveBigInt");
|
|
382
413
|
var parseSignedBigInt = /* @__PURE__ */ __name((value) => {
|
|
383
414
|
if (isNegativeBigInt(value)) {
|
|
384
|
-
return -
|
|
415
|
+
return -hexToBigInt4(value.negative);
|
|
385
416
|
} else if (isPositiveBigInt(value)) {
|
|
386
|
-
return
|
|
417
|
+
return hexToBigInt4(value.positive);
|
|
387
418
|
} else {
|
|
388
419
|
throw new Error("Invalid balance type");
|
|
389
420
|
}
|
|
@@ -477,7 +508,7 @@ import { asAddress, isDefined as isDefined4 } from "@xylabs/sdk-js";
|
|
|
477
508
|
import { spanRootAsync } from "@xylabs/telemetry";
|
|
478
509
|
import { asBlockBoundWitnessWithStorageMeta as asBlockBoundWitnessWithStorageMeta2, asXL1BlockNumber, asXL1BlockRange as asXL1BlockRange2 } from "@xyo-network/xl1-protocol";
|
|
479
510
|
async function balancesSummary(context) {
|
|
480
|
-
return await spanRootAsync("
|
|
511
|
+
return await spanRootAsync("balancesSummary", async () => {
|
|
481
512
|
const [headHash] = await context.head();
|
|
482
513
|
const headResult = await context.store.chainMap.get(headHash);
|
|
483
514
|
const headBoundWitness = asBlockBoundWitnessWithStorageMeta2(headResult, () => `Head block not found for hash: ${headHash}`, {
|
|
@@ -503,14 +534,232 @@ async function balancesSummary(context) {
|
|
|
503
534
|
}
|
|
504
535
|
__name(balancesSummary, "balancesSummary");
|
|
505
536
|
|
|
537
|
+
// src/primitives/summary/schemas/schemasStepSummaryFromRange.ts
|
|
538
|
+
import { assertEx as assertEx6 } from "@xylabs/sdk-js";
|
|
539
|
+
import { isBoundWitnessWithStorageMeta } from "@xyo-network/boundwitness-model";
|
|
540
|
+
import { PayloadBuilder as PayloadBuilder2 } from "@xyo-network/payload-builder";
|
|
541
|
+
import { isAnyPayload as isAnyPayload2 } from "@xyo-network/payload-model";
|
|
542
|
+
import { StepSizes as StepSizes5 } from "@xyo-network/xl1-protocol";
|
|
543
|
+
async function schemasStepSummaryFromRange(context, range) {
|
|
544
|
+
const frameHeadHash = await hashFromBlockNumber(context, range[1]);
|
|
545
|
+
const frameSize = range[1] - range[0] + 1;
|
|
546
|
+
const [headHash] = await context.head();
|
|
547
|
+
let result = void 0;
|
|
548
|
+
if (frameSize === 1) {
|
|
549
|
+
const hash = await hashFromBlockNumber(context, range[0]);
|
|
550
|
+
const [block, payloads] = await hydrateBlock(context.store, hash);
|
|
551
|
+
const boundWitnesses = [
|
|
552
|
+
block,
|
|
553
|
+
...payloads.filter(isBoundWitnessWithStorageMeta)
|
|
554
|
+
];
|
|
555
|
+
const schemas = {};
|
|
556
|
+
for (const bw of boundWitnesses) {
|
|
557
|
+
schemas[bw.schema] = (schemas[bw.schema] ?? 0) + 1;
|
|
558
|
+
for (const schema of bw.payload_schemas) {
|
|
559
|
+
schemas[schema] = (schemas[schema] ?? 0) + 1;
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
result = {
|
|
563
|
+
schema: SchemasStepSummarySchema,
|
|
564
|
+
hash: headHash,
|
|
565
|
+
stepSize: -1,
|
|
566
|
+
schemas
|
|
567
|
+
};
|
|
568
|
+
} else {
|
|
569
|
+
const step = StepSizes5.indexOf(frameSize);
|
|
570
|
+
assertEx6(step !== -1, () => `Invalid step size: ${frameSize}. Must be one of ${StepSizes5.join(", ")}`);
|
|
571
|
+
const summaryResult = await context.summaryMap.get(`${frameHeadHash}|${frameSize}`);
|
|
572
|
+
if (isAnyPayload2(summaryResult)) {
|
|
573
|
+
result = summaryResult;
|
|
574
|
+
} else {
|
|
575
|
+
await context.stepSemaphores[step].acquire();
|
|
576
|
+
try {
|
|
577
|
+
const subRanges = deepCalculateFramesFromRange(range, step - 1);
|
|
578
|
+
const promises = subRanges.map((subRange) => schemasStepSummaryFromRange(context, subRange));
|
|
579
|
+
const subResults = await Promise.all(promises);
|
|
580
|
+
const schemas = {};
|
|
581
|
+
for (const subResult of subResults) {
|
|
582
|
+
for (const [schema, count] of Object.entries(subResult.schemas)) {
|
|
583
|
+
schemas[schema] = (schemas[schema] ?? 0) + count;
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
result = {
|
|
587
|
+
schema: SchemasStepSummarySchema,
|
|
588
|
+
hash: frameHeadHash,
|
|
589
|
+
stepSize: frameSize,
|
|
590
|
+
schemas
|
|
591
|
+
};
|
|
592
|
+
await context.summaryMap.set(`${frameHeadHash}|${frameSize}`, result);
|
|
593
|
+
} finally {
|
|
594
|
+
context.stepSemaphores[step].release();
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
const finalResult = await PayloadBuilder2.addStorageMeta(result);
|
|
599
|
+
return finalResult;
|
|
600
|
+
}
|
|
601
|
+
__name(schemasStepSummaryFromRange, "schemasStepSummaryFromRange");
|
|
602
|
+
|
|
603
|
+
// src/primitives/summary/schemas/schemasSummary.ts
|
|
604
|
+
import { isDefined as isDefined5 } from "@xylabs/sdk-js";
|
|
605
|
+
import { spanRootAsync as spanRootAsync2 } from "@xylabs/telemetry";
|
|
606
|
+
import { asBlockBoundWitnessWithStorageMeta as asBlockBoundWitnessWithStorageMeta3, asXL1BlockNumber as asXL1BlockNumber2, asXL1BlockRange as asXL1BlockRange3 } from "@xyo-network/xl1-protocol";
|
|
607
|
+
async function schemasSummary(context) {
|
|
608
|
+
return await spanRootAsync2("schemasSummary", async () => {
|
|
609
|
+
const [headHash] = await context.head();
|
|
610
|
+
const headResult = await context.store.chainMap.get(headHash);
|
|
611
|
+
const headBoundWitness = asBlockBoundWitnessWithStorageMeta3(headResult, () => `Head block not found for hash: ${headHash}`, {
|
|
612
|
+
required: true
|
|
613
|
+
});
|
|
614
|
+
const rangeStart = asXL1BlockNumber2(isDefined5(context.windowSize) ? Math.max(headBoundWitness.block - context.windowSize + 1, 0) : 0);
|
|
615
|
+
const ranges = deepCalculateFramesFromRange(asXL1BlockRange3([
|
|
616
|
+
rangeStart,
|
|
617
|
+
headBoundWitness.block
|
|
618
|
+
], {
|
|
619
|
+
name: "schemasSummary"
|
|
620
|
+
}));
|
|
621
|
+
const summaries = await Promise.all(ranges.map((range) => schemasStepSummaryFromRange(context, range)));
|
|
622
|
+
const schemas = {};
|
|
623
|
+
for (let summary of summaries) {
|
|
624
|
+
for (const [schema, count] of Object.entries(summary.schemas)) {
|
|
625
|
+
schemas[schema] = (schemas[schema] ?? 0) + count;
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
return schemas;
|
|
629
|
+
});
|
|
630
|
+
}
|
|
631
|
+
__name(schemasSummary, "schemasSummary");
|
|
632
|
+
|
|
633
|
+
// src/primitives/summary/transfers/transfersStepSummaryFromRange.ts
|
|
634
|
+
import { assertEx as assertEx7 } from "@xylabs/sdk-js";
|
|
635
|
+
import { PayloadBuilder as PayloadBuilder3 } from "@xyo-network/payload-builder";
|
|
636
|
+
import { isAnyPayload as isAnyPayload3 } from "@xyo-network/payload-model";
|
|
637
|
+
import { StepSizes as StepSizes6 } from "@xyo-network/xl1-protocol";
|
|
638
|
+
|
|
639
|
+
// src/primitives/summary/transfers/transfersSummary.ts
|
|
640
|
+
import { asAddress as asAddress2, isDefined as isDefined6 } from "@xylabs/sdk-js";
|
|
641
|
+
import { spanRootAsync as spanRootAsync3 } from "@xylabs/telemetry";
|
|
642
|
+
import { asBlockBoundWitnessWithStorageMeta as asBlockBoundWitnessWithStorageMeta4, asXL1BlockNumber as asXL1BlockNumber3, asXL1BlockRange as asXL1BlockRange4 } from "@xyo-network/xl1-protocol";
|
|
643
|
+
async function transfersSummary(transferContext) {
|
|
644
|
+
return await spanRootAsync3("transferSummary", async () => {
|
|
645
|
+
const [headHash] = await transferContext.head();
|
|
646
|
+
const headResult = await transferContext.store.chainMap.get(headHash);
|
|
647
|
+
const headBoundWitness = asBlockBoundWitnessWithStorageMeta4(headResult, () => `Head block not found for hash: ${transferContext.head}`, {
|
|
648
|
+
required: true
|
|
649
|
+
});
|
|
650
|
+
const rangeStart = asXL1BlockNumber3(isDefined6(transferContext.windowSize) ? Math.max(headBoundWitness.block - transferContext.windowSize + 1, 0) : 0);
|
|
651
|
+
const ranges = deepCalculateFramesFromRange(asXL1BlockRange4([
|
|
652
|
+
rangeStart,
|
|
653
|
+
headBoundWitness.block
|
|
654
|
+
], {
|
|
655
|
+
name: "transfersSummary"
|
|
656
|
+
}));
|
|
657
|
+
const summaries = await Promise.all(ranges.map((range) => transfersStepSummaryFromRange(transferContext, range)));
|
|
658
|
+
const transfers = {};
|
|
659
|
+
for (let summary of summaries) {
|
|
660
|
+
for (const [from, toMap] of Object.entries(summary.transfers)) {
|
|
661
|
+
const validFrom = asAddress2(from, () => `Invalid address: ${from}`);
|
|
662
|
+
transfers[validFrom] = transfers[validFrom] ?? {};
|
|
663
|
+
for (const [to, transfer] of Object.entries(toMap)) {
|
|
664
|
+
const validTo = asAddress2(to, () => `Invalid address: ${to}`);
|
|
665
|
+
transfers[validFrom][validTo] = (transfers[validFrom][validTo] ?? 0n) + parseSignedBigInt(transfer);
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
return transfers;
|
|
670
|
+
});
|
|
671
|
+
}
|
|
672
|
+
__name(transfersSummary, "transfersSummary");
|
|
673
|
+
function transfersSummaryKey(frameHeadHash, frameSize) {
|
|
674
|
+
return `${frameHeadHash}|${frameSize}`;
|
|
675
|
+
}
|
|
676
|
+
__name(transfersSummaryKey, "transfersSummaryKey");
|
|
677
|
+
|
|
678
|
+
// src/primitives/summary/transfers/transfersStepSummaryFromRange.ts
|
|
679
|
+
async function transfersStepSummaryFromRange(context, range) {
|
|
680
|
+
const frameHeadHash = await hashFromBlockNumber(context, range[1]);
|
|
681
|
+
const frameSize = range[1] - range[0] + 1;
|
|
682
|
+
const [headHash] = await context.head();
|
|
683
|
+
let result = void 0;
|
|
684
|
+
if (frameSize === 1) {
|
|
685
|
+
const hash = await hashFromBlockNumber(context, range[0]);
|
|
686
|
+
const [, payloads] = await hydrateBlock(context.store, hash);
|
|
687
|
+
const transfers = {};
|
|
688
|
+
for (const [from, toMap] of Object.entries(netTransfersForPayloads(payloads))) {
|
|
689
|
+
transfers[from] = transfers[from] ?? {};
|
|
690
|
+
for (const [to, amount] of Object.entries(toMap)) {
|
|
691
|
+
transfers[from][to] = toSignedBigInt(amount);
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
result = {
|
|
695
|
+
schema: TransfersStepSummarySchema,
|
|
696
|
+
hash: headHash,
|
|
697
|
+
stepSize: -1,
|
|
698
|
+
transfers
|
|
699
|
+
};
|
|
700
|
+
} else {
|
|
701
|
+
const step = StepSizes6.indexOf(frameSize);
|
|
702
|
+
assertEx7(step !== -1, () => `Invalid step size: ${frameSize}. Must be one of ${StepSizes6.join(", ")}`);
|
|
703
|
+
const key = transfersSummaryKey(frameHeadHash, frameSize);
|
|
704
|
+
const summaryResult = await context.summaryMap.get(key);
|
|
705
|
+
if (isAnyPayload3(summaryResult)) {
|
|
706
|
+
result = summaryResult;
|
|
707
|
+
} else {
|
|
708
|
+
await context.stepSemaphores[step].acquire();
|
|
709
|
+
try {
|
|
710
|
+
const subRanges = deepCalculateFramesFromRange(range, step - 1);
|
|
711
|
+
const promises = subRanges.map((subRange) => transfersStepSummaryFromRange(context, subRange));
|
|
712
|
+
const subResults = await Promise.all(promises);
|
|
713
|
+
const bigIntBalances = {};
|
|
714
|
+
for (const subResult of subResults) {
|
|
715
|
+
for (const [from, toMap] of Object.entries(subResult.transfers)) {
|
|
716
|
+
bigIntBalances[from] = bigIntBalances[from] ?? {};
|
|
717
|
+
for (const [to, transfer] of Object.entries(toMap)) {
|
|
718
|
+
bigIntBalances[from][to] = (bigIntBalances[from][to] ?? 0n) + parseSignedBigInt(transfer);
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
const transfers = {};
|
|
723
|
+
for (const [from, toMap] of Object.entries(bigIntBalances)) {
|
|
724
|
+
transfers[from] = transfers[from] ?? {};
|
|
725
|
+
for (const [to, transfer] of Object.entries(toMap)) {
|
|
726
|
+
transfers[from][to] = toSignedBigInt(transfer);
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
result = {
|
|
730
|
+
schema: TransfersStepSummarySchema,
|
|
731
|
+
hash: frameHeadHash,
|
|
732
|
+
stepSize: frameSize,
|
|
733
|
+
transfers
|
|
734
|
+
};
|
|
735
|
+
await context.summaryMap.set(key, result);
|
|
736
|
+
} finally {
|
|
737
|
+
context.stepSemaphores[step].release();
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
const finalResult = await PayloadBuilder3.addStorageMeta(result);
|
|
742
|
+
return finalResult;
|
|
743
|
+
}
|
|
744
|
+
__name(transfersStepSummaryFromRange, "transfersStepSummaryFromRange");
|
|
745
|
+
|
|
506
746
|
// src/primitives/timeBudget.ts
|
|
507
|
-
async function timeBudget(name, logger, func, budget) {
|
|
747
|
+
async function timeBudget(name, logger, func, budget, status = false) {
|
|
508
748
|
const start = Date.now();
|
|
749
|
+
const timer = status ? setInterval(() => {
|
|
750
|
+
const duration2 = Date.now() - start;
|
|
751
|
+
if (budget > 0 && duration2 > budget) {
|
|
752
|
+
logger?.warn(`Function [${name}] execution is exceeding budget: ${duration2}ms > ${budget}ms`);
|
|
753
|
+
}
|
|
754
|
+
}, Math.max(100, budget)) : void 0;
|
|
509
755
|
const result = await func();
|
|
510
756
|
const duration = Date.now() - start;
|
|
511
|
-
if (budget > 0 && duration > budget) {
|
|
757
|
+
if (!timer && budget > 0 && duration > budget) {
|
|
512
758
|
logger?.warn(`Function [${name}] execution exceeded budget: ${duration}ms > ${budget}ms`);
|
|
513
759
|
}
|
|
760
|
+
if (timer) {
|
|
761
|
+
clearInterval(timer);
|
|
762
|
+
}
|
|
514
763
|
return result;
|
|
515
764
|
}
|
|
516
765
|
__name(timeBudget, "timeBudget");
|
|
@@ -553,7 +802,7 @@ async function withContextCacheResponse(context, name, key, func, { max = 1e4, t
|
|
|
553
802
|
max
|
|
554
803
|
}));
|
|
555
804
|
const cacheResult = await cache.get(key);
|
|
556
|
-
if (
|
|
805
|
+
if (isDefined7(cacheResult)) {
|
|
557
806
|
return cacheResult;
|
|
558
807
|
}
|
|
559
808
|
const result = timeBudgetMs > 0 ? await timeBudget(name, context.logger, func, timeBudgetMs) : await func();
|
|
@@ -568,7 +817,7 @@ async function blockFromBlockNumber(context, blockNumber) {
|
|
|
568
817
|
return await withContextCacheResponse(context, "blockFromBlockNumber", cacheKey, async () => {
|
|
569
818
|
const [headHash] = await context.head();
|
|
570
819
|
const result = await context.store.chainMap.get(headHash);
|
|
571
|
-
let currentBlock =
|
|
820
|
+
let currentBlock = asBlockBoundWitnessWithStorageMeta5(result, () => `Head block not found for hash: ${headHash}`, {
|
|
572
821
|
required: true
|
|
573
822
|
});
|
|
574
823
|
if (currentBlock.block < blockNumber) {
|
|
@@ -577,7 +826,7 @@ async function blockFromBlockNumber(context, blockNumber) {
|
|
|
577
826
|
while (currentBlock.block > blockNumber) {
|
|
578
827
|
let jumpHash = currentBlock.previous;
|
|
579
828
|
let jumpBlockNumber = currentBlock.block - 1;
|
|
580
|
-
for (const [step, stepSize2] of
|
|
829
|
+
for (const [step, stepSize2] of StepSizes7.entries()) {
|
|
581
830
|
const possibleJumpBlockNumber = currentBlock.block - currentBlock.block % stepSize2 - 1;
|
|
582
831
|
if (possibleJumpBlockNumber >= blockNumber && possibleJumpBlockNumber <= jumpBlockNumber) {
|
|
583
832
|
jumpBlockNumber = possibleJumpBlockNumber;
|
|
@@ -585,7 +834,7 @@ async function blockFromBlockNumber(context, blockNumber) {
|
|
|
585
834
|
}
|
|
586
835
|
}
|
|
587
836
|
const newBlock = await context.store.chainMap.get(asHash(jumpHash, () => `Jump hash not found for block number [${blockNumber}]: ${jumpBlockNumber} ${toSafeJsonString(currentBlock, 10)}`));
|
|
588
|
-
currentBlock =
|
|
837
|
+
currentBlock = asBlockBoundWitnessWithStorageMeta5(newBlock, () => `Block not found for hash: ${jumpHash}`, {
|
|
589
838
|
required: true
|
|
590
839
|
});
|
|
591
840
|
if (currentBlock.block === blockNumber) {
|
|
@@ -601,7 +850,7 @@ async function blockFromBlockNumber(context, blockNumber) {
|
|
|
601
850
|
__name(blockFromBlockNumber, "blockFromBlockNumber");
|
|
602
851
|
|
|
603
852
|
// src/block/primitives/frames/calculateFramesFromRange.ts
|
|
604
|
-
import { asXL1BlockNumber as
|
|
853
|
+
import { asXL1BlockNumber as asXL1BlockNumber4, stepSize } from "@xyo-network/xl1-protocol";
|
|
605
854
|
function calculateFramesFromRange(range, step) {
|
|
606
855
|
const size = stepSize(step);
|
|
607
856
|
let start = Math.trunc(range[0] / size) * size;
|
|
@@ -611,22 +860,22 @@ function calculateFramesFromRange(range, step) {
|
|
|
611
860
|
start += size;
|
|
612
861
|
remaining.push([
|
|
613
862
|
range[0],
|
|
614
|
-
|
|
863
|
+
asXL1BlockNumber4(Math.min(start - 1, range[1]), true)
|
|
615
864
|
]);
|
|
616
865
|
}
|
|
617
866
|
for (let i = start; i <= range[1]; i += size) {
|
|
618
867
|
if (i + size - 1 <= range[1]) {
|
|
619
868
|
fitted.push([
|
|
620
|
-
|
|
869
|
+
asXL1BlockNumber4(i, {
|
|
621
870
|
name: "calculateFramesFromRange A"
|
|
622
871
|
}),
|
|
623
|
-
|
|
872
|
+
asXL1BlockNumber4(Math.min(i + size - 1, range[1]), {
|
|
624
873
|
name: "calculateFramesFromRange B"
|
|
625
874
|
})
|
|
626
875
|
]);
|
|
627
876
|
} else {
|
|
628
877
|
remaining.push([
|
|
629
|
-
|
|
878
|
+
asXL1BlockNumber4(i, {
|
|
630
879
|
name: "calculateFramesFromRange C"
|
|
631
880
|
}),
|
|
632
881
|
range[1]
|
|
@@ -641,8 +890,8 @@ function calculateFramesFromRange(range, step) {
|
|
|
641
890
|
__name(calculateFramesFromRange, "calculateFramesFromRange");
|
|
642
891
|
|
|
643
892
|
// src/block/primitives/frames/deepCalculateFramesFromRange.ts
|
|
644
|
-
import { StepSizes as
|
|
645
|
-
function deepCalculateFramesFromRange(range, startingStep =
|
|
893
|
+
import { StepSizes as StepSizes8 } from "@xyo-network/xl1-protocol";
|
|
894
|
+
function deepCalculateFramesFromRange(range, startingStep = StepSizes8.length - 1) {
|
|
646
895
|
const fitted = [];
|
|
647
896
|
let remaining = [
|
|
648
897
|
range
|
|
@@ -694,119 +943,6 @@ function toStepIdentityString({ block, step }) {
|
|
|
694
943
|
}
|
|
695
944
|
__name(toStepIdentityString, "toStepIdentityString");
|
|
696
945
|
|
|
697
|
-
// src/block/primitives/transfers/transfersStepSummaryFromRange.ts
|
|
698
|
-
import { assertEx as assertEx6 } from "@xylabs/sdk-js";
|
|
699
|
-
import { PayloadBuilder as PayloadBuilder2 } from "@xyo-network/payload-builder";
|
|
700
|
-
import { isAnyPayload as isAnyPayload2 } from "@xyo-network/payload-model";
|
|
701
|
-
import { StepSizes as StepSizes7 } from "@xyo-network/xl1-protocol";
|
|
702
|
-
|
|
703
|
-
// src/block/primitives/transfers/transfersSummary.ts
|
|
704
|
-
import { asAddress as asAddress2, isDefined as isDefined6 } from "@xylabs/sdk-js";
|
|
705
|
-
import { spanRootAsync as spanRootAsync2 } from "@xylabs/telemetry";
|
|
706
|
-
import { asBlockBoundWitnessWithStorageMeta as asBlockBoundWitnessWithStorageMeta4, asXL1BlockNumber as asXL1BlockNumber3, asXL1BlockRange as asXL1BlockRange3 } from "@xyo-network/xl1-protocol";
|
|
707
|
-
async function transfersSummary(transferContext) {
|
|
708
|
-
return await spanRootAsync2("transferSummary", async () => {
|
|
709
|
-
const [headHash] = await transferContext.head();
|
|
710
|
-
const headResult = await transferContext.store.chainMap.get(headHash);
|
|
711
|
-
const headBoundWitness = asBlockBoundWitnessWithStorageMeta4(headResult, () => `Head block not found for hash: ${transferContext.head}`, {
|
|
712
|
-
required: true
|
|
713
|
-
});
|
|
714
|
-
const rangeStart = asXL1BlockNumber3(isDefined6(transferContext.windowSize) ? Math.max(headBoundWitness.block - transferContext.windowSize + 1, 0) : 0);
|
|
715
|
-
const ranges = deepCalculateFramesFromRange(asXL1BlockRange3([
|
|
716
|
-
rangeStart,
|
|
717
|
-
headBoundWitness.block
|
|
718
|
-
], {
|
|
719
|
-
name: "transfersSummary"
|
|
720
|
-
}));
|
|
721
|
-
const summaries = await Promise.all(ranges.map((range) => transfersStepSummaryFromRange(transferContext, range)));
|
|
722
|
-
const transfers = {};
|
|
723
|
-
for (let summary of summaries) {
|
|
724
|
-
for (const [from, toMap] of Object.entries(summary.transfers)) {
|
|
725
|
-
const validFrom = asAddress2(from, () => `Invalid address: ${from}`);
|
|
726
|
-
transfers[validFrom] = transfers[validFrom] ?? {};
|
|
727
|
-
for (const [to, transfer] of Object.entries(toMap)) {
|
|
728
|
-
const validTo = asAddress2(to, () => `Invalid address: ${to}`);
|
|
729
|
-
transfers[validFrom][validTo] = (transfers[validFrom][validTo] ?? 0n) + parseSignedBigInt(transfer);
|
|
730
|
-
}
|
|
731
|
-
}
|
|
732
|
-
}
|
|
733
|
-
return transfers;
|
|
734
|
-
});
|
|
735
|
-
}
|
|
736
|
-
__name(transfersSummary, "transfersSummary");
|
|
737
|
-
function transfersSummaryKey(frameHeadHash, frameSize) {
|
|
738
|
-
return `${frameHeadHash}|${frameSize}`;
|
|
739
|
-
}
|
|
740
|
-
__name(transfersSummaryKey, "transfersSummaryKey");
|
|
741
|
-
|
|
742
|
-
// src/block/primitives/transfers/transfersStepSummaryFromRange.ts
|
|
743
|
-
async function transfersStepSummaryFromRange(context, range) {
|
|
744
|
-
const frameHeadHash = await hashFromBlockNumber(context, range[1]);
|
|
745
|
-
const frameSize = range[1] - range[0] + 1;
|
|
746
|
-
const [headHash] = await context.head();
|
|
747
|
-
let result = void 0;
|
|
748
|
-
if (frameSize === 1) {
|
|
749
|
-
const hash = await hashFromBlockNumber(context, range[0]);
|
|
750
|
-
const [, payloads] = await hydrateBlock(context.store, hash);
|
|
751
|
-
const transfers = {};
|
|
752
|
-
for (const [from, toMap] of Object.entries(netTransfersForPayloads(payloads))) {
|
|
753
|
-
transfers[from] = transfers[from] ?? {};
|
|
754
|
-
for (const [to, amount] of Object.entries(toMap)) {
|
|
755
|
-
transfers[from][to] = toSignedBigInt(amount);
|
|
756
|
-
}
|
|
757
|
-
}
|
|
758
|
-
result = {
|
|
759
|
-
schema: TransfersStepSummarySchema,
|
|
760
|
-
hash: headHash,
|
|
761
|
-
stepSize: -1,
|
|
762
|
-
transfers
|
|
763
|
-
};
|
|
764
|
-
} else {
|
|
765
|
-
const step = StepSizes7.indexOf(frameSize);
|
|
766
|
-
assertEx6(step !== -1, () => `Invalid step size: ${frameSize}. Must be one of ${StepSizes7.join(", ")}`);
|
|
767
|
-
const key = transfersSummaryKey(frameHeadHash, frameSize);
|
|
768
|
-
const summaryResult = await context.summaryMap.get(key);
|
|
769
|
-
if (isAnyPayload2(summaryResult)) {
|
|
770
|
-
result = summaryResult;
|
|
771
|
-
} else {
|
|
772
|
-
await context.stepSemaphores[step].acquire();
|
|
773
|
-
try {
|
|
774
|
-
const subRanges = deepCalculateFramesFromRange(range, step - 1);
|
|
775
|
-
const promises = subRanges.map((subRange) => transfersStepSummaryFromRange(context, subRange));
|
|
776
|
-
const subResults = await Promise.all(promises);
|
|
777
|
-
const bigIntBalances = {};
|
|
778
|
-
for (const subResult of subResults) {
|
|
779
|
-
for (const [from, toMap] of Object.entries(subResult.transfers)) {
|
|
780
|
-
bigIntBalances[from] = bigIntBalances[from] ?? {};
|
|
781
|
-
for (const [to, transfer] of Object.entries(toMap)) {
|
|
782
|
-
bigIntBalances[from][to] = (bigIntBalances[from][to] ?? 0n) + parseSignedBigInt(transfer);
|
|
783
|
-
}
|
|
784
|
-
}
|
|
785
|
-
}
|
|
786
|
-
const transfers = {};
|
|
787
|
-
for (const [from, toMap] of Object.entries(bigIntBalances)) {
|
|
788
|
-
transfers[from] = transfers[from] ?? {};
|
|
789
|
-
for (const [to, transfer] of Object.entries(toMap)) {
|
|
790
|
-
transfers[from][to] = toSignedBigInt(transfer);
|
|
791
|
-
}
|
|
792
|
-
}
|
|
793
|
-
result = {
|
|
794
|
-
schema: TransfersStepSummarySchema,
|
|
795
|
-
hash: frameHeadHash,
|
|
796
|
-
stepSize: frameSize,
|
|
797
|
-
transfers
|
|
798
|
-
};
|
|
799
|
-
await context.summaryMap.set(key, result);
|
|
800
|
-
} finally {
|
|
801
|
-
context.stepSemaphores[step].release();
|
|
802
|
-
}
|
|
803
|
-
}
|
|
804
|
-
}
|
|
805
|
-
const finalResult = await PayloadBuilder2.addStorageMeta(result);
|
|
806
|
-
return finalResult;
|
|
807
|
-
}
|
|
808
|
-
__name(transfersStepSummaryFromRange, "transfersStepSummaryFromRange");
|
|
809
|
-
|
|
810
946
|
// src/config/Config.ts
|
|
811
947
|
import * as z15 from "zod";
|
|
812
948
|
|
|
@@ -940,6 +1076,7 @@ var BridgeConfigZod = z4.object({
|
|
|
940
1076
|
});
|
|
941
1077
|
|
|
942
1078
|
// src/config/Chain.ts
|
|
1079
|
+
import { AddressZod } from "@xylabs/sdk-js";
|
|
943
1080
|
import { globalRegistry as globalRegistry4 } from "zod";
|
|
944
1081
|
import * as z5 from "zod";
|
|
945
1082
|
var ChainConfigZod = z5.object({
|
|
@@ -947,6 +1084,11 @@ var ChainConfigZod = z5.object({
|
|
|
947
1084
|
description: "The unique identifier for the chain. Should be the staking contract address for contract-backed chains.",
|
|
948
1085
|
title: "chain.id",
|
|
949
1086
|
type: "string"
|
|
1087
|
+
}),
|
|
1088
|
+
genesisRewardAddress: AddressZod.optional().register(globalRegistry4, {
|
|
1089
|
+
description: "Address to send the initial genesis rewards to, if a new chain is being created.",
|
|
1090
|
+
title: "chain.genesisRewardAddress",
|
|
1091
|
+
type: "Address"
|
|
950
1092
|
})
|
|
951
1093
|
});
|
|
952
1094
|
|
|
@@ -1053,7 +1195,7 @@ var MempoolConfigZod = z8.object({
|
|
|
1053
1195
|
});
|
|
1054
1196
|
|
|
1055
1197
|
// src/config/Producer.ts
|
|
1056
|
-
import { AddressZod, asAddress as asAddress3 } from "@xylabs/sdk-js";
|
|
1198
|
+
import { AddressZod as AddressZod2, asAddress as asAddress3 } from "@xylabs/sdk-js";
|
|
1057
1199
|
import { globalRegistry as globalRegistry8 } from "zod";
|
|
1058
1200
|
import * as z9 from "zod";
|
|
1059
1201
|
var ProducerConfigZod = z9.object({
|
|
@@ -1062,11 +1204,16 @@ var ProducerConfigZod = z9.object({
|
|
|
1062
1204
|
return val.split(",").map((s) => asAddress3(s.trim()));
|
|
1063
1205
|
}
|
|
1064
1206
|
return val;
|
|
1065
|
-
}, z9.array(
|
|
1207
|
+
}, z9.array(AddressZod2).optional().register(globalRegistry8, {
|
|
1066
1208
|
description: "List of allowed producer addresses, if undefined anyone can participate",
|
|
1067
1209
|
title: "allowlist",
|
|
1068
1210
|
type: "array"
|
|
1069
1211
|
})),
|
|
1212
|
+
apiEndpoint: z9.string().optional().register(globalRegistry8, {
|
|
1213
|
+
description: "Endpoint of the API to use for chain data",
|
|
1214
|
+
title: "producer.apiEndpoint",
|
|
1215
|
+
type: "string"
|
|
1216
|
+
}),
|
|
1070
1217
|
disableIntentRedeclaration: z9.boolean().optional().register(globalRegistry8, {
|
|
1071
1218
|
description: "Should the producer skip redeclaring their intent to continue producing blocks",
|
|
1072
1219
|
title: "producer.disableIntentRedeclaration",
|
|
@@ -1139,12 +1286,12 @@ var RewardRedemptionApiConfigZod = z10.object({
|
|
|
1139
1286
|
});
|
|
1140
1287
|
|
|
1141
1288
|
// src/config/storage/driver/Mongo.ts
|
|
1142
|
-
import { isDefined as
|
|
1289
|
+
import { isDefined as isDefined8, isUndefined as isUndefined2 } from "@xylabs/sdk-js";
|
|
1143
1290
|
import { globalRegistry as globalRegistry10 } from "zod";
|
|
1144
1291
|
import * as z11 from "zod";
|
|
1145
1292
|
var hasMongoConfig = /* @__PURE__ */ __name((config) => {
|
|
1146
1293
|
if (isUndefined2(config)) return false;
|
|
1147
|
-
return
|
|
1294
|
+
return isDefined8(config.connectionString) && isDefined8(config.database) && isDefined8(config.domain) && isDefined8(config.password) && isDefined8(config.username);
|
|
1148
1295
|
}, "hasMongoConfig");
|
|
1149
1296
|
var MongoConfigZod = z11.object({
|
|
1150
1297
|
// TODO: Create from other arguments
|
|
@@ -1204,7 +1351,7 @@ var TelemetryConfigZod = z13.object({
|
|
|
1204
1351
|
}).describe("Telemetry configuration options");
|
|
1205
1352
|
|
|
1206
1353
|
// src/config/Validation.ts
|
|
1207
|
-
import { AddressZod as
|
|
1354
|
+
import { AddressZod as AddressZod3, asAddress as asAddress4 } from "@xylabs/sdk-js";
|
|
1208
1355
|
import { globalRegistry as globalRegistry13 } from "zod";
|
|
1209
1356
|
import * as z14 from "zod";
|
|
1210
1357
|
var ValidationConfigZod = z14.object({
|
|
@@ -1213,7 +1360,7 @@ var ValidationConfigZod = z14.object({
|
|
|
1213
1360
|
return val.split(",").map((s) => asAddress4(s.trim()));
|
|
1214
1361
|
}
|
|
1215
1362
|
return val;
|
|
1216
|
-
}, z14.array(
|
|
1363
|
+
}, z14.array(AddressZod3).optional().register(globalRegistry13, {
|
|
1217
1364
|
description: "List of allowed reward redeemer addresses, if undefined anyone can participate",
|
|
1218
1365
|
title: "allowedRewardRedeemers",
|
|
1219
1366
|
type: "array"
|
|
@@ -1223,7 +1370,7 @@ var ValidationConfigZod = z14.object({
|
|
|
1223
1370
|
return val.split(",").map((s) => asAddress4(s.trim()));
|
|
1224
1371
|
}
|
|
1225
1372
|
return val;
|
|
1226
|
-
}, z14.array(
|
|
1373
|
+
}, z14.array(AddressZod3).optional().register(globalRegistry13, {
|
|
1227
1374
|
description: "List of allowed reward escrow account signer addresses, if undefined anyone can participate",
|
|
1228
1375
|
title: "allowedRewardEscrowAccountSigners",
|
|
1229
1376
|
type: "array"
|
|
@@ -1292,7 +1439,7 @@ var XL1_NETWORK_STAKING_GENESIS_PERIOD_END_EPOCH = 1760572800;
|
|
|
1292
1439
|
var XL1_NETWORK_STAKING_GENESIS_PERIOD_END_XL1_BLOCK = 107496;
|
|
1293
1440
|
|
|
1294
1441
|
// src/eip-712/Payloads/EIP712Data.ts
|
|
1295
|
-
import { AsObjectFactory as
|
|
1442
|
+
import { AsObjectFactory as AsObjectFactory5 } from "@xylabs/sdk-js";
|
|
1296
1443
|
import { isPayloadOfZodType } from "@xyo-network/payload-model";
|
|
1297
1444
|
import z18 from "zod";
|
|
1298
1445
|
|
|
@@ -1327,10 +1474,10 @@ var EIP712DataPayloadFieldsZod = z18.object({
|
|
|
1327
1474
|
});
|
|
1328
1475
|
var EIP712DataPayloadSchema = "network.xyo.chains.ethereum.eip712.data";
|
|
1329
1476
|
var isEIP712DataPayload = isPayloadOfZodType(EIP712DataPayloadFieldsZod, EIP712DataPayloadSchema);
|
|
1330
|
-
var asEIP712DataPayload =
|
|
1477
|
+
var asEIP712DataPayload = AsObjectFactory5.create(isEIP712DataPayload);
|
|
1331
1478
|
|
|
1332
1479
|
// src/eip-712/Payloads/EIP712Signature.ts
|
|
1333
|
-
import { AsObjectFactory as
|
|
1480
|
+
import { AsObjectFactory as AsObjectFactory6, HashZod } from "@xylabs/sdk-js";
|
|
1334
1481
|
import { isPayloadOfZodType as isPayloadOfZodType2 } from "@xyo-network/payload-model";
|
|
1335
1482
|
import z19 from "zod";
|
|
1336
1483
|
var EIP712SignaturePayloadFieldsZod = z19.object({
|
|
@@ -1340,14 +1487,14 @@ var EIP712SignaturePayloadFieldsZod = z19.object({
|
|
|
1340
1487
|
});
|
|
1341
1488
|
var EIP712SignaturePayloadSchema = "network.xyo.chains.ethereum.eip712.signature";
|
|
1342
1489
|
var isEIP712SignaturePayload = isPayloadOfZodType2(EIP712SignaturePayloadFieldsZod, EIP712SignaturePayloadSchema);
|
|
1343
|
-
var asEIP712SignaturePayload =
|
|
1490
|
+
var asEIP712SignaturePayload = AsObjectFactory6.create(isEIP712SignaturePayload);
|
|
1344
1491
|
|
|
1345
1492
|
// src/eip-712/sign.ts
|
|
1346
|
-
import { PayloadBuilder as
|
|
1493
|
+
import { PayloadBuilder as PayloadBuilder4 } from "@xyo-network/payload-builder";
|
|
1347
1494
|
var signEIP712Message = /* @__PURE__ */ __name(async (signer, data) => {
|
|
1348
1495
|
const { domain, types, values } = data;
|
|
1349
1496
|
const signature = await signer.signTypedData(domain, types, values);
|
|
1350
|
-
const hash = await
|
|
1497
|
+
const hash = await PayloadBuilder4.hash(data);
|
|
1351
1498
|
const address = await signer.getAddress();
|
|
1352
1499
|
return {
|
|
1353
1500
|
address,
|
|
@@ -1359,13 +1506,13 @@ var signEIP712Message = /* @__PURE__ */ __name(async (signer, data) => {
|
|
|
1359
1506
|
|
|
1360
1507
|
// src/eip-712/verify.ts
|
|
1361
1508
|
import { asHash as asHash2, isUndefined as isUndefined3 } from "@xylabs/sdk-js";
|
|
1362
|
-
import { PayloadBuilder as
|
|
1509
|
+
import { PayloadBuilder as PayloadBuilder5 } from "@xyo-network/payload-builder";
|
|
1363
1510
|
import { verifyTypedData } from "ethers/hash";
|
|
1364
1511
|
var verifyEIP712Message = /* @__PURE__ */ __name(async (data, sig) => {
|
|
1365
1512
|
const { address, signature, hash } = sig;
|
|
1366
1513
|
const { schema, ...fields } = data;
|
|
1367
1514
|
const signedHash = asHash2(hash);
|
|
1368
|
-
if (isUndefined3(signedHash) || signedHash !== await
|
|
1515
|
+
if (isUndefined3(signedHash) || signedHash !== await PayloadBuilder5.hash(data)) return false;
|
|
1369
1516
|
const recoveredAddress = verifyTypedData(fields.domain, fields.types, fields.values, signature);
|
|
1370
1517
|
return recoveredAddress.toLowerCase() === address.toLowerCase();
|
|
1371
1518
|
}, "verifyEIP712Message");
|
|
@@ -1383,20 +1530,20 @@ var RewardMultipliers = {
|
|
|
1383
1530
|
};
|
|
1384
1531
|
|
|
1385
1532
|
// src/services/StakeIntentService/ChainIndexingServiceStateSchema.ts
|
|
1386
|
-
import { AsObjectFactory as
|
|
1387
|
-
import { isPayloadOfSchemaType as
|
|
1533
|
+
import { AsObjectFactory as AsObjectFactory7 } from "@xylabs/sdk-js";
|
|
1534
|
+
import { isPayloadOfSchemaType as isPayloadOfSchemaType5, isStorageMeta as isStorageMeta4 } from "@xyo-network/payload-model";
|
|
1388
1535
|
var ChainIndexingServiceStateSchema = "network.xyo.chain.indexing.service.state";
|
|
1389
1536
|
var isChainIndexingServiceState = /* @__PURE__ */ __name((payload) => {
|
|
1390
|
-
return
|
|
1537
|
+
return isPayloadOfSchemaType5(ChainIndexingServiceStateSchema)(payload);
|
|
1391
1538
|
}, "isChainIndexingServiceState");
|
|
1392
|
-
var asChainIndexingServiceState =
|
|
1393
|
-
var isChainIndexingServiceStateWithStorageMeta = /* @__PURE__ */ __name((value) => isChainIndexingServiceState(value) &&
|
|
1394
|
-
var asChainIndexingServiceStateWithStorageMeta =
|
|
1539
|
+
var asChainIndexingServiceState = AsObjectFactory7.create(isChainIndexingServiceState);
|
|
1540
|
+
var isChainIndexingServiceStateWithStorageMeta = /* @__PURE__ */ __name((value) => isChainIndexingServiceState(value) && isStorageMeta4(value), "isChainIndexingServiceStateWithStorageMeta");
|
|
1541
|
+
var asChainIndexingServiceStateWithStorageMeta = AsObjectFactory7.create(isChainIndexingServiceStateWithStorageMeta);
|
|
1395
1542
|
|
|
1396
1543
|
// src/simple/accountBalance/SimpleAccountBalanceViewer.ts
|
|
1397
|
-
import { assertEx as
|
|
1398
|
-
import { spanRootAsync as
|
|
1399
|
-
import { asRange, asXL1BlockNumber as
|
|
1544
|
+
import { assertEx as assertEx8, exists, isDefined as isDefined9 } from "@xylabs/sdk-js";
|
|
1545
|
+
import { spanRootAsync as spanRootAsync4 } from "@xylabs/telemetry";
|
|
1546
|
+
import { asRange, asXL1BlockNumber as asXL1BlockNumber5, asXL1BlockRange as asXL1BlockRange5, AttoXL1, StepSizes as StepSizes9, TransferSchema } from "@xyo-network/xl1-protocol";
|
|
1400
1547
|
var SimpleAccountBalanceViewer = class {
|
|
1401
1548
|
static {
|
|
1402
1549
|
__name(this, "SimpleAccountBalanceViewer");
|
|
@@ -1410,14 +1557,14 @@ var SimpleAccountBalanceViewer = class {
|
|
|
1410
1557
|
this.blockViewer = blockViewer;
|
|
1411
1558
|
}
|
|
1412
1559
|
async accountBalance(address, headOrRange) {
|
|
1413
|
-
const balances = await this.
|
|
1560
|
+
const balances = await this.accountsBalances([
|
|
1414
1561
|
address
|
|
1415
1562
|
], headOrRange);
|
|
1416
1563
|
return balances[address] ?? AttoXL1(0n);
|
|
1417
1564
|
}
|
|
1418
1565
|
async accountBalanceHistory(address, headOrRange) {
|
|
1419
1566
|
const range = asRange(headOrRange);
|
|
1420
|
-
const startingRange =
|
|
1567
|
+
const startingRange = asXL1BlockRange5(range ?? [
|
|
1421
1568
|
0,
|
|
1422
1569
|
await this.blockViewer.currentBlockNumber()
|
|
1423
1570
|
], true);
|
|
@@ -1428,8 +1575,8 @@ var SimpleAccountBalanceViewer = class {
|
|
|
1428
1575
|
const transferIndexes = block[0].payload_schemas.map((schema, index) => schema === TransferSchema ? index : void 0).filter(exists);
|
|
1429
1576
|
const transfers = transferIndexes.map((index) => {
|
|
1430
1577
|
const hash = block[0].payload_hashes[index];
|
|
1431
|
-
return
|
|
1432
|
-
}).filter(exists).filter((t) => t.from === address ||
|
|
1578
|
+
return assertEx8(block[1].find((p) => p._hash === hash), () => `Error: Could not find Transfer with hash ${hash} in block ${block[0]._hash}`);
|
|
1579
|
+
}).filter(exists).filter((t) => t.from === address || isDefined9(t.transfers[address]));
|
|
1433
1580
|
if (transfers.length === 0) {
|
|
1434
1581
|
continue;
|
|
1435
1582
|
}
|
|
@@ -1447,8 +1594,8 @@ var SimpleAccountBalanceViewer = class {
|
|
|
1447
1594
|
}
|
|
1448
1595
|
return result;
|
|
1449
1596
|
}
|
|
1450
|
-
async
|
|
1451
|
-
return await
|
|
1597
|
+
async accountsBalances(address, _headOrRange) {
|
|
1598
|
+
return await spanRootAsync4("balances", async () => {
|
|
1452
1599
|
const summary = await balancesSummary(this.context);
|
|
1453
1600
|
const result = {};
|
|
1454
1601
|
for (const addr of address) {
|
|
@@ -1458,16 +1605,16 @@ var SimpleAccountBalanceViewer = class {
|
|
|
1458
1605
|
return result;
|
|
1459
1606
|
});
|
|
1460
1607
|
}
|
|
1461
|
-
|
|
1608
|
+
accountsBalancesHistory(_addresses, _rangeOrHash) {
|
|
1462
1609
|
throw new Error("Method not implemented.");
|
|
1463
1610
|
}
|
|
1464
1611
|
async distillTransferHistory(address, range, max = 50) {
|
|
1465
|
-
if (range[1] - range[0] <=
|
|
1612
|
+
if (range[1] - range[0] <= StepSizes9[0] || max <= 1) {
|
|
1466
1613
|
return Array.from({
|
|
1467
1614
|
length: range[1] - range[0] + 1
|
|
1468
|
-
}, (_, i) => range[1] - i).slice(0, max).map((n) =>
|
|
1615
|
+
}, (_, i) => range[1] - i).slice(0, max).map((n) => asXL1BlockNumber5(n, true));
|
|
1469
1616
|
}
|
|
1470
|
-
const frames = deepCalculateFramesFromRange(
|
|
1617
|
+
const frames = deepCalculateFramesFromRange(asXL1BlockRange5(range, true));
|
|
1471
1618
|
const transferSummaryPairs = await Promise.all(frames.map(async (frame) => {
|
|
1472
1619
|
return [
|
|
1473
1620
|
frame,
|
|
@@ -1480,8 +1627,8 @@ var SimpleAccountBalanceViewer = class {
|
|
|
1480
1627
|
});
|
|
1481
1628
|
const resultBlockNumbers = /* @__PURE__ */ new Set();
|
|
1482
1629
|
for (const [frame] of sortedTransferSummaryPairs) {
|
|
1483
|
-
if (frame[1] - frame[0] + 1 >
|
|
1484
|
-
const values = await this.distillTransferHistory(address,
|
|
1630
|
+
if (frame[1] - frame[0] + 1 > StepSizes9[0]) {
|
|
1631
|
+
const values = await this.distillTransferHistory(address, asXL1BlockRange5([
|
|
1485
1632
|
frame[0],
|
|
1486
1633
|
frame[1] - 1
|
|
1487
1634
|
], true), max - resultBlockNumbers.size);
|
|
@@ -1505,12 +1652,12 @@ var SimpleAccountBalanceViewer = class {
|
|
|
1505
1652
|
};
|
|
1506
1653
|
|
|
1507
1654
|
// src/simple/chainStake/SimpleChainStakeViewer.ts
|
|
1508
|
-
import { asAddress as asAddress5, toAddress as
|
|
1509
|
-
import { AbstractCreatable as AbstractCreatable2, assertEx as
|
|
1655
|
+
import { asAddress as asAddress5, toAddress as toAddress5 } from "@xylabs/sdk-js";
|
|
1656
|
+
import { AbstractCreatable as AbstractCreatable2, assertEx as assertEx9, creatable as creatable2 } from "@xylabs/sdk-js";
|
|
1510
1657
|
import { Account } from "@xyo-network/account";
|
|
1511
1658
|
|
|
1512
1659
|
// src/simple/chainStakeEvents/SimpleChainStakeEventsViewer.ts
|
|
1513
|
-
import { AbstractCreatable, creatable, isDefined as
|
|
1660
|
+
import { AbstractCreatable, creatable, isDefined as isDefined10 } from "@xylabs/sdk-js";
|
|
1514
1661
|
function _ts_decorate(decorators, target, key, desc) {
|
|
1515
1662
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1516
1663
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1531,7 +1678,7 @@ var SimpleChainStakeEventsViewer = class extends AbstractCreatable {
|
|
|
1531
1678
|
stakeEvents(range, { name } = {}) {
|
|
1532
1679
|
const positions = this.positionsFromRange(range);
|
|
1533
1680
|
const events = this.eventsFromPositions(positions);
|
|
1534
|
-
if (
|
|
1681
|
+
if (isDefined10(name)) {
|
|
1535
1682
|
return events.filter((event) => event.name === name);
|
|
1536
1683
|
}
|
|
1537
1684
|
return events;
|
|
@@ -1609,7 +1756,7 @@ var SimpleChainStakeViewer = class extends AbstractCreatable2 {
|
|
|
1609
1756
|
_chainId;
|
|
1610
1757
|
_chainStakeEventsViewer;
|
|
1611
1758
|
get chainId() {
|
|
1612
|
-
return
|
|
1759
|
+
return assertEx9(this._chainId, () => "Chain ID not set");
|
|
1613
1760
|
}
|
|
1614
1761
|
get chainMap() {
|
|
1615
1762
|
return this.params.chainMap;
|
|
@@ -1618,13 +1765,13 @@ var SimpleChainStakeViewer = class extends AbstractCreatable2 {
|
|
|
1618
1765
|
return this.params.minWithdrawalBlocks ?? 10;
|
|
1619
1766
|
}
|
|
1620
1767
|
get rewardsContract() {
|
|
1621
|
-
return
|
|
1768
|
+
return toAddress5(toAddress5(1n));
|
|
1622
1769
|
}
|
|
1623
1770
|
get stakeEvents() {
|
|
1624
|
-
return
|
|
1771
|
+
return assertEx9(this._chainStakeEventsViewer, () => "Stake events viewer not set");
|
|
1625
1772
|
}
|
|
1626
1773
|
get stakingTokenAddress() {
|
|
1627
|
-
return
|
|
1774
|
+
return toAddress5("0x000000000000000000000000000011");
|
|
1628
1775
|
}
|
|
1629
1776
|
get positions() {
|
|
1630
1777
|
return this.params.positions;
|
|
@@ -1675,7 +1822,7 @@ var SimpleChainStakeViewer = class extends AbstractCreatable2 {
|
|
|
1675
1822
|
return pending;
|
|
1676
1823
|
}
|
|
1677
1824
|
stakeById(id) {
|
|
1678
|
-
return
|
|
1825
|
+
return assertEx9(this.positions[id], () => new Error(`Stake with id ${id} not found`));
|
|
1679
1826
|
}
|
|
1680
1827
|
stakeByStaker(staker, slot) {
|
|
1681
1828
|
return this.positions.filter((s) => asAddress5(s.staker) === asAddress5(staker))[slot];
|
|
@@ -1738,7 +1885,7 @@ var SimpleXyoClient = class {
|
|
|
1738
1885
|
};
|
|
1739
1886
|
|
|
1740
1887
|
// src/simple/datalake/SimpleDataLakeViewer.ts
|
|
1741
|
-
import { isAnyPayload as
|
|
1888
|
+
import { isAnyPayload as isAnyPayload4 } from "@xyo-network/payload-model";
|
|
1742
1889
|
var SimpleDataLakeViewer = class {
|
|
1743
1890
|
static {
|
|
1744
1891
|
__name(this, "SimpleDataLakeViewer");
|
|
@@ -1769,13 +1916,13 @@ var SimpleDataLakeViewer = class {
|
|
|
1769
1916
|
}
|
|
1770
1917
|
async has(hash) {
|
|
1771
1918
|
const value = await this.get(hash);
|
|
1772
|
-
if (
|
|
1919
|
+
if (isAnyPayload4(value)) {
|
|
1773
1920
|
return this.isAllowed(value);
|
|
1774
1921
|
}
|
|
1775
1922
|
return value !== void 0;
|
|
1776
1923
|
}
|
|
1777
1924
|
isAllowed(value) {
|
|
1778
|
-
if (
|
|
1925
|
+
if (isAnyPayload4(value)) {
|
|
1779
1926
|
return this.isAllowedSchema(value.schema);
|
|
1780
1927
|
}
|
|
1781
1928
|
return true;
|
|
@@ -1842,14 +1989,14 @@ var SimpleXyoGateway = class {
|
|
|
1842
1989
|
};
|
|
1843
1990
|
|
|
1844
1991
|
// src/simple/gateway/SimpleXyoGatewayRunner.ts
|
|
1845
|
-
import { assertEx as
|
|
1846
|
-
import { PayloadBuilder as
|
|
1992
|
+
import { assertEx as assertEx14, BigIntToJsonZod, isDefined as isDefined12 } from "@xylabs/sdk-js";
|
|
1993
|
+
import { PayloadBuilder as PayloadBuilder10 } from "@xyo-network/payload-builder";
|
|
1847
1994
|
import { TransferSchema as TransferSchema2 } from "@xyo-network/xl1-protocol";
|
|
1848
1995
|
|
|
1849
1996
|
// src/transaction/buildTransaction.ts
|
|
1850
|
-
import { assertEx as
|
|
1997
|
+
import { assertEx as assertEx10, toHex as toHex2 } from "@xylabs/sdk-js";
|
|
1851
1998
|
import { BoundWitnessBuilder } from "@xyo-network/boundwitness-builder";
|
|
1852
|
-
import { PayloadBuilder as
|
|
1999
|
+
import { PayloadBuilder as PayloadBuilder6 } from "@xyo-network/payload-builder";
|
|
1853
2000
|
import { defaultTransactionFees } from "@xyo-network/xl1-protocol";
|
|
1854
2001
|
async function buildTransaction(chain, onChainPayloads, offChainPayloads, signer, nbf, exp, from, fees = defaultTransactionFees) {
|
|
1855
2002
|
if (from === void 0 && Array.isArray(signer)) {
|
|
@@ -1866,14 +2013,14 @@ async function buildTransaction(chain, onChainPayloads, offChainPayloads, signer
|
|
|
1866
2013
|
nbf,
|
|
1867
2014
|
exp
|
|
1868
2015
|
};
|
|
1869
|
-
const elevatedHashes = await
|
|
2016
|
+
const elevatedHashes = await PayloadBuilder6.hashes(onChainPayloads);
|
|
1870
2017
|
const script = [];
|
|
1871
2018
|
for (const elevatedHash of elevatedHashes) {
|
|
1872
2019
|
script.push(`elevate|${elevatedHash}`);
|
|
1873
2020
|
}
|
|
1874
2021
|
const fields = {
|
|
1875
2022
|
...txBoundWitnessFields,
|
|
1876
|
-
from: from ?? (Array.isArray(signer) ?
|
|
2023
|
+
from: from ?? (Array.isArray(signer) ? assertEx10(signer.at(0)?.address) : signer.address)
|
|
1877
2024
|
};
|
|
1878
2025
|
if (script.length > 0) {
|
|
1879
2026
|
fields.script = script;
|
|
@@ -1887,8 +2034,8 @@ async function buildTransaction(chain, onChainPayloads, offChainPayloads, signer
|
|
|
1887
2034
|
signer
|
|
1888
2035
|
]).build();
|
|
1889
2036
|
return [
|
|
1890
|
-
await
|
|
1891
|
-
await
|
|
2037
|
+
await PayloadBuilder6.addStorageMeta(tx),
|
|
2038
|
+
await PayloadBuilder6.addStorageMeta(txPayloads)
|
|
1892
2039
|
];
|
|
1893
2040
|
}
|
|
1894
2041
|
__name(buildTransaction, "buildTransaction");
|
|
@@ -1896,7 +2043,7 @@ __name(buildTransaction, "buildTransaction");
|
|
|
1896
2043
|
// src/transaction/buildUnsignedTransaction.ts
|
|
1897
2044
|
import { toHex as toHex3 } from "@xylabs/sdk-js";
|
|
1898
2045
|
import { BoundWitnessBuilder as BoundWitnessBuilder2 } from "@xyo-network/boundwitness-builder";
|
|
1899
|
-
import { PayloadBuilder as
|
|
2046
|
+
import { PayloadBuilder as PayloadBuilder7 } from "@xyo-network/payload-builder";
|
|
1900
2047
|
import { defaultTransactionFees as defaultTransactionFees2 } from "@xyo-network/xl1-protocol";
|
|
1901
2048
|
async function buildUnsignedTransaction(chain, onChainPayloads, offChainPayloads, nbf, exp, from, fees = defaultTransactionFees2) {
|
|
1902
2049
|
const txBoundWitnessFields = {
|
|
@@ -1910,7 +2057,7 @@ async function buildUnsignedTransaction(chain, onChainPayloads, offChainPayloads
|
|
|
1910
2057
|
nbf,
|
|
1911
2058
|
exp
|
|
1912
2059
|
};
|
|
1913
|
-
const elevatedHashes = await
|
|
2060
|
+
const elevatedHashes = await PayloadBuilder7.hashes(onChainPayloads);
|
|
1914
2061
|
const script = [];
|
|
1915
2062
|
for (const elevatedHash of elevatedHashes) {
|
|
1916
2063
|
script.push(`elevate|${elevatedHash}`);
|
|
@@ -1936,7 +2083,7 @@ async function buildUnsignedTransaction(chain, onChainPayloads, offChainPayloads
|
|
|
1936
2083
|
__name(buildUnsignedTransaction, "buildUnsignedTransaction");
|
|
1937
2084
|
|
|
1938
2085
|
// src/transaction/confirmSubmittedTransaction.ts
|
|
1939
|
-
import { delay, isDefined as
|
|
2086
|
+
import { delay, isDefined as isDefined11 } from "@xylabs/sdk-js";
|
|
1940
2087
|
var DEFAULT_CONFIRMATION_ATTEMPTS = 20;
|
|
1941
2088
|
var DEFAULT_DELAY_BETWEEN_ATTEMPTS = 1e3;
|
|
1942
2089
|
var confirmSubmittedTransaction = /* @__PURE__ */ __name(async (viewer, txHash, options) => {
|
|
@@ -1945,7 +2092,7 @@ var confirmSubmittedTransaction = /* @__PURE__ */ __name(async (viewer, txHash,
|
|
|
1945
2092
|
let attempts = 0;
|
|
1946
2093
|
while (true) {
|
|
1947
2094
|
const tx = await viewer.transactionByHash(txHash) ?? void 0;
|
|
1948
|
-
if (
|
|
2095
|
+
if (isDefined11(tx)) {
|
|
1949
2096
|
options?.logger?.log("\u2705 Transaction confirmed:", txHash, "\n");
|
|
1950
2097
|
return tx;
|
|
1951
2098
|
} else {
|
|
@@ -1962,7 +2109,7 @@ var confirmSubmittedTransaction = /* @__PURE__ */ __name(async (viewer, txHash,
|
|
|
1962
2109
|
}, "confirmSubmittedTransaction");
|
|
1963
2110
|
|
|
1964
2111
|
// src/transaction/hydrateTransaction.ts
|
|
1965
|
-
import { assertEx as
|
|
2112
|
+
import { assertEx as assertEx11 } from "@xylabs/sdk-js";
|
|
1966
2113
|
import { hydrateTypedBoundWitness, tryHydrateTypedBoundWitness } from "@xyo-network/archivist-model";
|
|
1967
2114
|
import { isAllowedBlockPayload as isAllowedBlockPayload2, isSignedTransactionBoundWitnessWithStorageMeta } from "@xyo-network/xl1-protocol";
|
|
1968
2115
|
var tryHydrateTransaction = /* @__PURE__ */ __name(async ({ chainMap }, hash) => {
|
|
@@ -2021,15 +2168,15 @@ var tryHydrateElevatedTransaction = /* @__PURE__ */ __name(async ({ chainMap },
|
|
|
2021
2168
|
return void 0;
|
|
2022
2169
|
}, "tryHydrateElevatedTransaction");
|
|
2023
2170
|
var hydrateElevatedTransaction = /* @__PURE__ */ __name(async (context, hash) => {
|
|
2024
|
-
return
|
|
2171
|
+
return assertEx11(await tryHydrateElevatedTransaction(context, hash), () => "Hydration failed");
|
|
2025
2172
|
}, "hydrateElevatedTransaction");
|
|
2026
2173
|
|
|
2027
2174
|
// src/transaction/primitives/transactionBlockByteCount.ts
|
|
2028
|
-
import { PayloadBuilder as
|
|
2175
|
+
import { PayloadBuilder as PayloadBuilder8 } from "@xyo-network/payload-builder";
|
|
2029
2176
|
function transactionBlockByteCount([transaction, payloads]) {
|
|
2030
|
-
const cleanTransaction =
|
|
2177
|
+
const cleanTransaction = PayloadBuilder8.omitStorageMeta(transaction);
|
|
2031
2178
|
const transactionBytes = JSON.stringify(cleanTransaction).length;
|
|
2032
|
-
const cleanPayloads =
|
|
2179
|
+
const cleanPayloads = PayloadBuilder8.omitStorageMeta(payloads);
|
|
2033
2180
|
return cleanPayloads.reduce((acc, payload) => acc + JSON.stringify(payload).length, 0) + transactionBytes;
|
|
2034
2181
|
}
|
|
2035
2182
|
__name(transactionBlockByteCount, "transactionBlockByteCount");
|
|
@@ -2087,7 +2234,7 @@ __name(transactionRequiredGas, "transactionRequiredGas");
|
|
|
2087
2234
|
|
|
2088
2235
|
// src/transaction/script.ts
|
|
2089
2236
|
import { asHash as asHash4 } from "@xylabs/sdk-js";
|
|
2090
|
-
import { assertEx as
|
|
2237
|
+
import { assertEx as assertEx12, filterAs as filterAs2 } from "@xylabs/sdk-js";
|
|
2091
2238
|
import { isAllowedBlockPayloadWithHashMeta } from "@xyo-network/xl1-protocol";
|
|
2092
2239
|
var tryExtractElevatedHashesFromScript = /* @__PURE__ */ __name((strings) => {
|
|
2093
2240
|
const hashes = strings.filter((str) => str.startsWith("elevate|")).map((str) => str.split("|")[1]);
|
|
@@ -2096,7 +2243,7 @@ var tryExtractElevatedHashesFromScript = /* @__PURE__ */ __name((strings) => {
|
|
|
2096
2243
|
var extractElevatedHashesFromScript = /* @__PURE__ */ __name((strings) => {
|
|
2097
2244
|
const hashes = strings.filter((str) => str.startsWith("elevate|")).map((str) => str.split("|")[1]);
|
|
2098
2245
|
const filtered = filterAs2(hashes, (h) => asHash4(h));
|
|
2099
|
-
|
|
2246
|
+
assertEx12(filtered.length === hashes.length, () => "Invalid elevated hashes");
|
|
2100
2247
|
return filtered;
|
|
2101
2248
|
}, "extractElevatedHashesFromScript");
|
|
2102
2249
|
var tryExtractElevatedHashes = /* @__PURE__ */ __name((tx) => {
|
|
@@ -2110,15 +2257,15 @@ var extractElevatedHashes = /* @__PURE__ */ __name((tx) => {
|
|
|
2110
2257
|
const { script } = bw;
|
|
2111
2258
|
const hashes = script ? tryExtractElevatedHashesFromScript(script) : [];
|
|
2112
2259
|
const filtered = payloads.filter((p) => hashes.includes(p._hash)).filter(isAllowedBlockPayloadWithHashMeta);
|
|
2113
|
-
|
|
2260
|
+
assertEx12(filtered.length === hashes.length, () => "Invalid elevated hashes");
|
|
2114
2261
|
return filtered;
|
|
2115
2262
|
}, "extractElevatedHashes");
|
|
2116
2263
|
|
|
2117
2264
|
// src/transaction/signTransaction.ts
|
|
2118
|
-
import { assertEx as
|
|
2119
|
-
import { PayloadBuilder as
|
|
2265
|
+
import { assertEx as assertEx13, hexFromArrayBuffer, toArrayBuffer } from "@xylabs/sdk-js";
|
|
2266
|
+
import { PayloadBuilder as PayloadBuilder9 } from "@xyo-network/payload-builder";
|
|
2120
2267
|
async function signTransaction(tx, account) {
|
|
2121
|
-
|
|
2268
|
+
assertEx13(tx.from === account.address, () => "Signer address does not match transaction from address");
|
|
2122
2269
|
const signedTx = structuredClone(tx);
|
|
2123
2270
|
signedTx.addresses = [
|
|
2124
2271
|
account.address
|
|
@@ -2126,7 +2273,7 @@ async function signTransaction(tx, account) {
|
|
|
2126
2273
|
signedTx.previous_hashes = [
|
|
2127
2274
|
account.previousHash ?? null
|
|
2128
2275
|
];
|
|
2129
|
-
const hash = await
|
|
2276
|
+
const hash = await PayloadBuilder9.dataHash(signedTx);
|
|
2130
2277
|
const hashBytes = toArrayBuffer(hash);
|
|
2131
2278
|
const [signature] = await account.sign(hashBytes);
|
|
2132
2279
|
signedTx.$signatures = [
|
|
@@ -2165,18 +2312,18 @@ var SimpleXyoGatewayRunner = class {
|
|
|
2165
2312
|
return this._dataLakes.length - 1;
|
|
2166
2313
|
}
|
|
2167
2314
|
async addPayloadsToChain(onChain, offChain, options) {
|
|
2168
|
-
const viewer =
|
|
2315
|
+
const viewer = assertEx14(this.connectionInstance.viewer, () => "No viewer available on connection");
|
|
2169
2316
|
const { nbf, exp, chain, fees } = options ?? {};
|
|
2170
|
-
const resolvedChainId =
|
|
2171
|
-
const resolvedNbf =
|
|
2172
|
-
const resolvedExp =
|
|
2317
|
+
const resolvedChainId = isDefined12(chain) ? chain : await viewer.chainId();
|
|
2318
|
+
const resolvedNbf = isDefined12(nbf) ? nbf : await viewer?.currentBlockNumber();
|
|
2319
|
+
const resolvedExp = isDefined12(exp) ? exp : resolvedNbf + 10;
|
|
2173
2320
|
const tx = await buildUnsignedTransaction(resolvedChainId, onChain, offChain, resolvedNbf, resolvedExp, await (await this.signer()).address(), fees);
|
|
2174
2321
|
return await this.addTransactionToChain(tx);
|
|
2175
2322
|
}
|
|
2176
2323
|
async addTransactionToChain(tx) {
|
|
2177
2324
|
const connection = this.connectionInstance;
|
|
2178
2325
|
const signer = this.signerInstance;
|
|
2179
|
-
const runner =
|
|
2326
|
+
const runner = assertEx14(connection.runner, () => "No runner available on connection");
|
|
2180
2327
|
const signedTx = await signer.signTransaction(tx);
|
|
2181
2328
|
await this.addPayloadsToDataLakes(signedTx[1]);
|
|
2182
2329
|
return [
|
|
@@ -2188,7 +2335,7 @@ var SimpleXyoGatewayRunner = class {
|
|
|
2188
2335
|
];
|
|
2189
2336
|
}
|
|
2190
2337
|
async confirmSubmittedTransaction(txHash, options) {
|
|
2191
|
-
return await confirmSubmittedTransaction(
|
|
2338
|
+
return await confirmSubmittedTransaction(assertEx14(this.connectionInstance.viewer, () => "Connection viewer is undefined"), txHash, options);
|
|
2192
2339
|
}
|
|
2193
2340
|
/** @deprecated use connectionInstance instead */
|
|
2194
2341
|
connection() {
|
|
@@ -2208,7 +2355,7 @@ var SimpleXyoGatewayRunner = class {
|
|
|
2208
2355
|
address,
|
|
2209
2356
|
BigIntToJsonZod.parse(amount)
|
|
2210
2357
|
]));
|
|
2211
|
-
const transfer = new
|
|
2358
|
+
const transfer = new PayloadBuilder10({
|
|
2212
2359
|
schema: TransferSchema2
|
|
2213
2360
|
}).fields({
|
|
2214
2361
|
from,
|
|
@@ -2306,7 +2453,7 @@ var SimpleXyoNetwork = class {
|
|
|
2306
2453
|
};
|
|
2307
2454
|
|
|
2308
2455
|
// src/simple/permissions/SimpleXyoPermissions.ts
|
|
2309
|
-
import { assertEx as
|
|
2456
|
+
import { assertEx as assertEx15 } from "@xylabs/sdk-js";
|
|
2310
2457
|
var SimpleXyoPermissions = class {
|
|
2311
2458
|
static {
|
|
2312
2459
|
__name(this, "SimpleXyoPermissions");
|
|
@@ -2318,7 +2465,7 @@ var SimpleXyoPermissions = class {
|
|
|
2318
2465
|
this.invoker = store.invoker;
|
|
2319
2466
|
}
|
|
2320
2467
|
get store() {
|
|
2321
|
-
return
|
|
2468
|
+
return assertEx15(this._store, () => "Store must be defined to get permissions");
|
|
2322
2469
|
}
|
|
2323
2470
|
async getPermissions() {
|
|
2324
2471
|
return await this.store.getPermissions();
|
|
@@ -2376,7 +2523,7 @@ var SimpleXyoPermissions = class {
|
|
|
2376
2523
|
};
|
|
2377
2524
|
|
|
2378
2525
|
// src/simple/permissions/store/MemoryPermissions.ts
|
|
2379
|
-
import { assertEx as
|
|
2526
|
+
import { assertEx as assertEx16 } from "@xylabs/sdk-js";
|
|
2380
2527
|
var MemoryPermissionsStore = class {
|
|
2381
2528
|
static {
|
|
2382
2529
|
__name(this, "MemoryPermissionsStore");
|
|
@@ -2387,7 +2534,7 @@ var MemoryPermissionsStore = class {
|
|
|
2387
2534
|
this._invoker = invoker;
|
|
2388
2535
|
}
|
|
2389
2536
|
get invoker() {
|
|
2390
|
-
return
|
|
2537
|
+
return assertEx16(this._invoker, () => "Invoker must be defined to get permissions");
|
|
2391
2538
|
}
|
|
2392
2539
|
async getPermissions() {
|
|
2393
2540
|
await Promise.resolve();
|
|
@@ -2401,7 +2548,7 @@ var MemoryPermissionsStore = class {
|
|
|
2401
2548
|
|
|
2402
2549
|
// src/simple/runner/SimpleXyoRunner.ts
|
|
2403
2550
|
import { MemoryArchivist } from "@xyo-network/archivist-memory";
|
|
2404
|
-
import { PayloadBuilder as
|
|
2551
|
+
import { PayloadBuilder as PayloadBuilder11 } from "@xyo-network/payload-builder";
|
|
2405
2552
|
var SimpleXyoRunner = class {
|
|
2406
2553
|
static {
|
|
2407
2554
|
__name(this, "SimpleXyoRunner");
|
|
@@ -2413,7 +2560,7 @@ var SimpleXyoRunner = class {
|
|
|
2413
2560
|
async broadcastTransaction(transaction) {
|
|
2414
2561
|
const archivist = await this.getMempoolArchivist();
|
|
2415
2562
|
await archivist.insert(flattenHydratedTransaction(transaction));
|
|
2416
|
-
return await
|
|
2563
|
+
return await PayloadBuilder11.hash(transaction[0]);
|
|
2417
2564
|
}
|
|
2418
2565
|
async getMempoolArchivist() {
|
|
2419
2566
|
if (!this._mempoolArchivist) {
|
|
@@ -2426,7 +2573,7 @@ var SimpleXyoRunner = class {
|
|
|
2426
2573
|
};
|
|
2427
2574
|
|
|
2428
2575
|
// src/simple/signer/SimpleXyoSigner.ts
|
|
2429
|
-
import { PayloadBuilder as
|
|
2576
|
+
import { PayloadBuilder as PayloadBuilder12 } from "@xyo-network/payload-builder";
|
|
2430
2577
|
var SimpleXyoSigner = class {
|
|
2431
2578
|
static {
|
|
2432
2579
|
__name(this, "SimpleXyoSigner");
|
|
@@ -2446,15 +2593,15 @@ var SimpleXyoSigner = class {
|
|
|
2446
2593
|
async signTransaction(tx) {
|
|
2447
2594
|
const txBW = await signTransaction(tx[0], this._account);
|
|
2448
2595
|
return [
|
|
2449
|
-
await
|
|
2450
|
-
await
|
|
2596
|
+
await PayloadBuilder12.addStorageMeta(txBW),
|
|
2597
|
+
await PayloadBuilder12.addStorageMeta(tx[1])
|
|
2451
2598
|
];
|
|
2452
2599
|
}
|
|
2453
2600
|
};
|
|
2454
2601
|
|
|
2455
2602
|
// src/simple/timesync/SimpleTimeSyncViewer.ts
|
|
2456
|
-
import { asHash as asHash5, assertEx as
|
|
2457
|
-
import { asTimePayload, asXL1BlockNumber as
|
|
2603
|
+
import { asHash as asHash5, assertEx as assertEx17, isDefined as isDefined13 } from "@xylabs/sdk-js";
|
|
2604
|
+
import { asTimePayload, asXL1BlockNumber as asXL1BlockNumber6, TimeSchema } from "@xyo-network/xl1-protocol";
|
|
2458
2605
|
var SimpleTimeSyncViewer = class {
|
|
2459
2606
|
static {
|
|
2460
2607
|
__name(this, "SimpleTimeSyncViewer");
|
|
@@ -2468,10 +2615,10 @@ var SimpleTimeSyncViewer = class {
|
|
|
2468
2615
|
async convertTime(fromDomain, toDomain, from) {
|
|
2469
2616
|
switch (fromDomain) {
|
|
2470
2617
|
case "xl1": {
|
|
2471
|
-
const [block, payloads] =
|
|
2618
|
+
const [block, payloads] = assertEx17(await this.blockViewer.blockByNumber(asXL1BlockNumber6(from, true)), () => "Block not found");
|
|
2472
2619
|
const timeSchemaIndex = block.payload_schemas.indexOf(TimeSchema);
|
|
2473
2620
|
const hash = timeSchemaIndex === -1 ? void 0 : block.payload_hashes[timeSchemaIndex];
|
|
2474
|
-
const timePayload = asTimePayload(
|
|
2621
|
+
const timePayload = asTimePayload(isDefined13(hash) ? payloads.find((p) => p._hash === hash) : void 0);
|
|
2475
2622
|
if (timePayload === void 0) return 0;
|
|
2476
2623
|
switch (toDomain) {
|
|
2477
2624
|
case "xl1": {
|
|
@@ -2534,10 +2681,10 @@ var SimpleTimeSyncViewer = class {
|
|
|
2534
2681
|
];
|
|
2535
2682
|
}
|
|
2536
2683
|
case "ethereum": {
|
|
2537
|
-
const provider =
|
|
2684
|
+
const provider = assertEx17(this.ethProvider, () => "Ethereum provider not configured");
|
|
2538
2685
|
const blockNumber = await provider.getBlockNumber() ?? 0;
|
|
2539
2686
|
const block = await provider.getBlock(blockNumber);
|
|
2540
|
-
const blockHash = asHash5(
|
|
2687
|
+
const blockHash = asHash5(assertEx17(block?.hash, () => "Block hash not found"), true);
|
|
2541
2688
|
return [
|
|
2542
2689
|
blockNumber,
|
|
2543
2690
|
blockHash
|
|
@@ -2554,7 +2701,7 @@ var SimpleTimeSyncViewer = class {
|
|
|
2554
2701
|
};
|
|
2555
2702
|
|
|
2556
2703
|
// src/time/primitives/xl1BlockNumberToEthBlockNumber.ts
|
|
2557
|
-
import { assertEx as
|
|
2704
|
+
import { assertEx as assertEx18 } from "@xylabs/sdk-js";
|
|
2558
2705
|
import { asTimePayload as asTimePayload2, TimeSchema as TimeSchema2 } from "@xyo-network/xl1-protocol";
|
|
2559
2706
|
async function xl1BlockNumberToEthBlockNumber(context, xl1BlockNumber) {
|
|
2560
2707
|
const blockHash = await hashFromBlockNumber(context, xl1BlockNumber);
|
|
@@ -2562,10 +2709,350 @@ async function xl1BlockNumberToEthBlockNumber(context, xl1BlockNumber) {
|
|
|
2562
2709
|
const timePayload = asTimePayload2(hydratedBlock[1].find((p) => p.schema === TimeSchema2), {
|
|
2563
2710
|
required: true
|
|
2564
2711
|
});
|
|
2565
|
-
return
|
|
2712
|
+
return assertEx18(timePayload.ethereum, () => "No ethereum timestamp found on block");
|
|
2566
2713
|
}
|
|
2567
2714
|
__name(xl1BlockNumberToEthBlockNumber, "xl1BlockNumberToEthBlockNumber");
|
|
2568
2715
|
|
|
2716
|
+
// src/utils/isZodError.ts
|
|
2717
|
+
import * as z20 from "zod";
|
|
2718
|
+
var isZodError = /* @__PURE__ */ __name((error) => {
|
|
2719
|
+
return error instanceof z20.ZodError;
|
|
2720
|
+
}, "isZodError");
|
|
2721
|
+
var prettifyZodError = /* @__PURE__ */ __name((error) => {
|
|
2722
|
+
return z20.prettifyError(error);
|
|
2723
|
+
}, "prettifyZodError");
|
|
2724
|
+
|
|
2725
|
+
// src/viewers/AccountBalance.ts
|
|
2726
|
+
import { WithHashMetaZod } from "@xyo-network/payload-model";
|
|
2727
|
+
import { TransferZod } from "@xyo-network/xl1-protocol";
|
|
2728
|
+
import z35 from "zod";
|
|
2729
|
+
|
|
2730
|
+
// src/zod/ArrayBuffer.ts
|
|
2731
|
+
import * as z21 from "zod";
|
|
2732
|
+
function base64Encode(u8) {
|
|
2733
|
+
if (typeof Buffer !== "undefined" && typeof Buffer.from === "function") {
|
|
2734
|
+
return Buffer.from(u8).toString("base64");
|
|
2735
|
+
}
|
|
2736
|
+
let binary = "";
|
|
2737
|
+
const chunk = 32768;
|
|
2738
|
+
for (let i = 0; i < u8.length; i += chunk) {
|
|
2739
|
+
binary += String.fromCharCode(...u8.subarray(i, i + chunk));
|
|
2740
|
+
}
|
|
2741
|
+
return btoa(binary);
|
|
2742
|
+
}
|
|
2743
|
+
__name(base64Encode, "base64Encode");
|
|
2744
|
+
function base64Decode(b64) {
|
|
2745
|
+
if (typeof Buffer !== "undefined" && typeof Buffer.from === "function") {
|
|
2746
|
+
return new Uint8Array(Buffer.from(b64, "base64"));
|
|
2747
|
+
}
|
|
2748
|
+
const binary = atob(b64);
|
|
2749
|
+
const u8 = new Uint8Array(binary.length);
|
|
2750
|
+
for (let i = 0; i < binary.length; i++) u8[i] = binary.charCodeAt(i);
|
|
2751
|
+
return u8;
|
|
2752
|
+
}
|
|
2753
|
+
__name(base64Decode, "base64Decode");
|
|
2754
|
+
var ArrayBufferToJsonZod = z21.instanceof(ArrayBuffer).transform((x) => {
|
|
2755
|
+
const u8 = new Uint8Array(x);
|
|
2756
|
+
return base64Encode(u8);
|
|
2757
|
+
});
|
|
2758
|
+
var JsonToArrayBufferZod = z21.string().transform((x) => {
|
|
2759
|
+
const u8 = base64Decode(x);
|
|
2760
|
+
return u8.buffer;
|
|
2761
|
+
});
|
|
2762
|
+
|
|
2763
|
+
// src/zod/BlockBoundWitness.ts
|
|
2764
|
+
import { HashZod as HashZod3 } from "@xylabs/sdk-js";
|
|
2765
|
+
import { StorageMetaZod as StorageMetaZod2 } from "@xyo-network/payload-model";
|
|
2766
|
+
import { XL1BlockNumberZod } from "@xyo-network/xl1-protocol";
|
|
2767
|
+
import * as z24 from "zod";
|
|
2768
|
+
|
|
2769
|
+
// src/zod/BoundWitness.ts
|
|
2770
|
+
import { AddressZod as AddressZod4, HashZod as HashZod2, HexZod } from "@xylabs/sdk-js";
|
|
2771
|
+
import { BoundWitnessSchema } from "@xyo-network/boundwitness-model";
|
|
2772
|
+
import { PayloadZod, SchemaZod, StorageMetaZod } from "@xyo-network/payload-model";
|
|
2773
|
+
import * as z22 from "zod";
|
|
2774
|
+
var BoundWitnessRequiredFieldsZod = z22.object({
|
|
2775
|
+
addresses: z22.array(AddressZod4),
|
|
2776
|
+
payload_hashes: z22.array(HashZod2),
|
|
2777
|
+
payload_schemas: z22.array(SchemaZod),
|
|
2778
|
+
previous_hashes: z22.array(HashZod2.nullable())
|
|
2779
|
+
});
|
|
2780
|
+
var BoundWitnessMetaZod = z22.object({
|
|
2781
|
+
$destination: AddressZod4.optional(),
|
|
2782
|
+
$sourceQuery: HashZod2.optional(),
|
|
2783
|
+
$signatures: z22.array(z22.union([
|
|
2784
|
+
HexZod,
|
|
2785
|
+
z22.null()
|
|
2786
|
+
]))
|
|
2787
|
+
});
|
|
2788
|
+
var BoundWitnessZod = PayloadZod.extend({
|
|
2789
|
+
schema: z22.literal(BoundWitnessSchema)
|
|
2790
|
+
}).extend(BoundWitnessRequiredFieldsZod.shape).extend(BoundWitnessMetaZod.shape).refine((data) => data.$signatures.length === data.addresses.length, {
|
|
2791
|
+
message: "$signatures length must equal addresses length"
|
|
2792
|
+
});
|
|
2793
|
+
var AnyBoundWitnessZod = BoundWitnessZod.catchall(z22.any());
|
|
2794
|
+
var UnsignedBoundWitnessZod = BoundWitnessZod.refine((data) => data.$signatures.includes(null), {
|
|
2795
|
+
message: "all $signatures must be null"
|
|
2796
|
+
});
|
|
2797
|
+
var AnyUnsignedBoundWitnessZod = UnsignedBoundWitnessZod.catchall(z22.any());
|
|
2798
|
+
var UnsignedBoundWitnessWithStorageMetaZod = UnsignedBoundWitnessZod.safeExtend(BoundWitnessRequiredFieldsZod.shape).safeExtend(BoundWitnessMetaZod.shape).safeExtend(StorageMetaZod.shape);
|
|
2799
|
+
var SignedBoundWitnessZod = BoundWitnessZod.refine((data) => !data.$signatures.includes(null), {
|
|
2800
|
+
message: "all $signatures must not be null"
|
|
2801
|
+
});
|
|
2802
|
+
var SignedBoundWitnessWithStorageMetaZod = UnsignedBoundWitnessWithStorageMetaZod;
|
|
2803
|
+
var AnySignedBoundWitnessZod = UnsignedBoundWitnessZod.catchall(z22.any());
|
|
2804
|
+
var AnySignedBoundWitnessWithStorageMetaZod = UnsignedBoundWitnessWithStorageMetaZod.catchall(z22.any());
|
|
2805
|
+
|
|
2806
|
+
// src/zod/Chain.ts
|
|
2807
|
+
import { AddressRegEx, toAddress as toAddress6 } from "@xylabs/sdk-js";
|
|
2808
|
+
import * as z23 from "zod";
|
|
2809
|
+
var ChainZod = z23.string().toLowerCase().regex(AddressRegEx).transform((v) => toAddress6(v));
|
|
2810
|
+
|
|
2811
|
+
// src/zod/BlockBoundWitness.ts
|
|
2812
|
+
var BlockBoundWitnessFieldsZod = z24.object({
|
|
2813
|
+
block: XL1BlockNumberZod,
|
|
2814
|
+
chain: ChainZod,
|
|
2815
|
+
previous: HashZod3.nullable(),
|
|
2816
|
+
protocol: z24.number(),
|
|
2817
|
+
step_hashes: z24.array(HashZod3).optional()
|
|
2818
|
+
});
|
|
2819
|
+
var BlockBoundWitnessMetaZod = z24.object({
|
|
2820
|
+
$epoch: z24.number()
|
|
2821
|
+
});
|
|
2822
|
+
var BlockBoundWitnessZod = UnsignedBoundWitnessZod.merge(StorageMetaZod2.partial()).merge(BlockBoundWitnessFieldsZod).merge(BlockBoundWitnessMetaZod);
|
|
2823
|
+
var SignedBlockBoundWitnessZod = SignedBoundWitnessZod.merge(StorageMetaZod2.partial()).merge(BlockBoundWitnessFieldsZod).merge(BlockBoundWitnessMetaZod);
|
|
2824
|
+
|
|
2825
|
+
// src/zod/HydratedBlock.ts
|
|
2826
|
+
import { PayloadZodLoose, WithStorageMetaZod } from "@xyo-network/payload-model";
|
|
2827
|
+
import * as z25 from "zod";
|
|
2828
|
+
var HydratedBlockZod = z25.tuple([
|
|
2829
|
+
BlockBoundWitnessZod,
|
|
2830
|
+
z25.array(PayloadZodLoose)
|
|
2831
|
+
]);
|
|
2832
|
+
var HydratedBlockWithStorageMetaZod = z25.tuple([
|
|
2833
|
+
WithStorageMetaZod(BlockBoundWitnessZod),
|
|
2834
|
+
z25.array(WithStorageMetaZod(PayloadZodLoose))
|
|
2835
|
+
]);
|
|
2836
|
+
var SignedHydratedBlockZod = z25.tuple([
|
|
2837
|
+
SignedBlockBoundWitnessZod,
|
|
2838
|
+
z25.array(PayloadZodLoose)
|
|
2839
|
+
]);
|
|
2840
|
+
var SignedHydratedBlockToJsonZod = z25.tuple([
|
|
2841
|
+
SignedBlockBoundWitnessZod,
|
|
2842
|
+
z25.array(PayloadZodLoose)
|
|
2843
|
+
]);
|
|
2844
|
+
var SignedHydratedBlockWithStorageMetaZod = z25.tuple([
|
|
2845
|
+
WithStorageMetaZod(SignedBlockBoundWitnessZod),
|
|
2846
|
+
z25.array(WithStorageMetaZod(PayloadZodLoose))
|
|
2847
|
+
]);
|
|
2848
|
+
|
|
2849
|
+
// src/zod/HydratedTransaction.ts
|
|
2850
|
+
import { asAnyPayload, PayloadZodLoose as PayloadZodLoose2 } from "@xyo-network/payload-model";
|
|
2851
|
+
import { asSignedHydratedTransaction } from "@xyo-network/xl1-protocol";
|
|
2852
|
+
import * as z28 from "zod";
|
|
2853
|
+
|
|
2854
|
+
// src/zod/TransactionBoundWitness.ts
|
|
2855
|
+
import { StorageMetaZod as StorageMetaZod3 } from "@xyo-network/payload-model";
|
|
2856
|
+
import { BlockNumberZod } from "@xyo-network/xl1-protocol";
|
|
2857
|
+
import * as z27 from "zod";
|
|
2858
|
+
|
|
2859
|
+
// src/zod/TransactionFees.ts
|
|
2860
|
+
import { BigIntToJsonZod as BigIntToJsonZod2, HexZod as HexZod2, JsonToBigIntZod } from "@xylabs/sdk-js";
|
|
2861
|
+
import { asAttoXL1 as asAttoXL12 } from "@xyo-network/xl1-protocol";
|
|
2862
|
+
import * as z26 from "zod";
|
|
2863
|
+
var AttoZod = z26.bigint();
|
|
2864
|
+
var JsonToAttoZod = JsonToBigIntZod.transform((v) => asAttoXL12(v));
|
|
2865
|
+
var AttoToJsonZod = BigIntToJsonZod2;
|
|
2866
|
+
var TransactionFeesHexZod = z26.object({
|
|
2867
|
+
base: HexZod2,
|
|
2868
|
+
gasLimit: HexZod2,
|
|
2869
|
+
gasPrice: HexZod2,
|
|
2870
|
+
priority: HexZod2
|
|
2871
|
+
});
|
|
2872
|
+
var TransactionFeesBigIntZod = z26.object({
|
|
2873
|
+
base: AttoZod,
|
|
2874
|
+
gasLimit: AttoZod,
|
|
2875
|
+
gasPrice: AttoZod,
|
|
2876
|
+
priority: AttoZod
|
|
2877
|
+
});
|
|
2878
|
+
var TransactionFeesJsonToBigIntZod = TransactionFeesHexZod.transform((val) => ({
|
|
2879
|
+
base: JsonToBigIntZod.parse(val.base),
|
|
2880
|
+
gasLimit: JsonToBigIntZod.parse(val.gasLimit),
|
|
2881
|
+
gasPrice: JsonToBigIntZod.parse(val.gasPrice),
|
|
2882
|
+
priority: JsonToBigIntZod.parse(val.priority)
|
|
2883
|
+
}));
|
|
2884
|
+
var TransactionFeesBigIntToJsonZod = TransactionFeesBigIntZod.transform((val) => ({
|
|
2885
|
+
base: BigIntToJsonZod2.parse(val.base),
|
|
2886
|
+
gasLimit: BigIntToJsonZod2.parse(val.gasLimit),
|
|
2887
|
+
gasPrice: BigIntToJsonZod2.parse(val.gasPrice),
|
|
2888
|
+
priority: BigIntToJsonZod2.parse(val.priority)
|
|
2889
|
+
}));
|
|
2890
|
+
|
|
2891
|
+
// src/zod/TransactionBoundWitness.ts
|
|
2892
|
+
var BlockStartZod = z27.object({
|
|
2893
|
+
nbf: BlockNumberZod
|
|
2894
|
+
});
|
|
2895
|
+
var BlockEndZod = z27.object({
|
|
2896
|
+
exp: BlockNumberZod
|
|
2897
|
+
});
|
|
2898
|
+
var BlockDurationZod = z27.object({
|
|
2899
|
+
nbf: BlockNumberZod,
|
|
2900
|
+
exp: BlockNumberZod
|
|
2901
|
+
});
|
|
2902
|
+
var BlockScriptsZod = z27.object({
|
|
2903
|
+
script: z27.array(z27.string()).optional()
|
|
2904
|
+
});
|
|
2905
|
+
var WithTransactionFeesZod = z27.object({
|
|
2906
|
+
fees: TransactionFeesHexZod
|
|
2907
|
+
});
|
|
2908
|
+
var TransactionBoundWitnessFields = z27.object({
|
|
2909
|
+
chain: ChainZod,
|
|
2910
|
+
from: ChainZod
|
|
2911
|
+
});
|
|
2912
|
+
var TransactionBoundWitnessZod = UnsignedBoundWitnessZod.merge(StorageMetaZod3.partial()).merge(BlockDurationZod).merge(WithTransactionFeesZod).merge(TransactionBoundWitnessFields).merge(BlockScriptsZod);
|
|
2913
|
+
var SignedTransactionBoundWitnessZod = SignedBoundWitnessZod.merge(StorageMetaZod3.partial()).merge(BlockDurationZod).merge(WithTransactionFeesZod).merge(TransactionBoundWitnessFields).merge(BlockScriptsZod.partial());
|
|
2914
|
+
|
|
2915
|
+
// src/zod/HydratedTransaction.ts
|
|
2916
|
+
var HydratedTransactionZod = z28.tuple([
|
|
2917
|
+
TransactionBoundWitnessZod,
|
|
2918
|
+
z28.array(PayloadZodLoose2)
|
|
2919
|
+
]);
|
|
2920
|
+
var UnsignedHydratedTransactionZod = z28.tuple([
|
|
2921
|
+
TransactionBoundWitnessZod,
|
|
2922
|
+
z28.array(PayloadZodLoose2)
|
|
2923
|
+
]);
|
|
2924
|
+
var SignedHydratedTransactionZod = z28.tuple([
|
|
2925
|
+
SignedTransactionBoundWitnessZod,
|
|
2926
|
+
z28.array(PayloadZodLoose2)
|
|
2927
|
+
]);
|
|
2928
|
+
var SignedHydratedTransactionToJsonZod = SignedHydratedTransactionZod.transform(([tx, payloads]) => asSignedHydratedTransaction([
|
|
2929
|
+
tx,
|
|
2930
|
+
payloads.map((payload) => payload)
|
|
2931
|
+
]));
|
|
2932
|
+
var JsonToSignedHydratedTransactionZod = SignedHydratedTransactionZod.transform(([tx, payloads]) => [
|
|
2933
|
+
asSignedHydratedTransaction(tx),
|
|
2934
|
+
payloads.map((p) => asAnyPayload(p))
|
|
2935
|
+
]);
|
|
2936
|
+
|
|
2937
|
+
// src/zod/Permission.ts
|
|
2938
|
+
import { z as z29 } from "zod";
|
|
2939
|
+
var CaveatTypesZod = z29.enum([
|
|
2940
|
+
"chain",
|
|
2941
|
+
"expiration",
|
|
2942
|
+
"filteredResponse",
|
|
2943
|
+
"rateLimit",
|
|
2944
|
+
"restrictReturnedAccounts"
|
|
2945
|
+
]);
|
|
2946
|
+
var CaveatsZod = z29.object({
|
|
2947
|
+
type: CaveatTypesZod,
|
|
2948
|
+
value: z29.json()
|
|
2949
|
+
});
|
|
2950
|
+
var PermissionZod = z29.object({
|
|
2951
|
+
parentCapability: z29.string(),
|
|
2952
|
+
caveats: CaveatsZod.array().optional(),
|
|
2953
|
+
invoker: z29.string()
|
|
2954
|
+
});
|
|
2955
|
+
var InvokerPermissionZod = PermissionZod.extend({
|
|
2956
|
+
date: z29.number().optional()
|
|
2957
|
+
});
|
|
2958
|
+
var PermissionRequestZod = z29.record(z29.string(), z29.record(z29.string(), z29.any()));
|
|
2959
|
+
var RequestedPermissionZod = z29.object({
|
|
2960
|
+
parentCapability: z29.string(),
|
|
2961
|
+
date: z29.number().optional()
|
|
2962
|
+
});
|
|
2963
|
+
|
|
2964
|
+
// src/zod/RewardsRangeOptions.ts
|
|
2965
|
+
import { AddressZod as AddressZod5 } from "@xylabs/sdk-js";
|
|
2966
|
+
import { BlockRangeZod, StepIdentityZod } from "@xyo-network/xl1-protocol";
|
|
2967
|
+
import { z as z30 } from "zod";
|
|
2968
|
+
var RewardsRangeOptionsZod = z30.object({
|
|
2969
|
+
positions: z30.array(z30.number()).optional(),
|
|
2970
|
+
range: BlockRangeZod.optional(),
|
|
2971
|
+
steps: z30.array(StepIdentityZod).optional(),
|
|
2972
|
+
stakers: z30.array(AddressZod5).optional()
|
|
2973
|
+
});
|
|
2974
|
+
|
|
2975
|
+
// src/zod/Sequence.ts
|
|
2976
|
+
import { HexRegExMinMax, toHex as toHex4 } from "@xylabs/sdk-js";
|
|
2977
|
+
import { SequenceConstants } from "@xyo-network/payload-model";
|
|
2978
|
+
import * as z31 from "zod";
|
|
2979
|
+
var LocalSequenceRegex = new RegExp(HexRegExMinMax(SequenceConstants.localSequenceBytes, SequenceConstants.localSequenceBytes));
|
|
2980
|
+
var LocalSequenceToStringZod = z31.string().regex(LocalSequenceRegex);
|
|
2981
|
+
var LocalSequenceFromStringZod = z31.string().regex(LocalSequenceRegex).transform((v) => toHex4(v));
|
|
2982
|
+
var QualifiedSequenceRegex = new RegExp(HexRegExMinMax(SequenceConstants.qualifiedSequenceBytes, SequenceConstants.qualifiedSequenceBytes));
|
|
2983
|
+
var QualifiedSequenceToStringZod = z31.string().regex(QualifiedSequenceRegex);
|
|
2984
|
+
var QualifiedSequenceFromStringZod = z31.string().regex(QualifiedSequenceRegex).transform((v) => toHex4(v));
|
|
2985
|
+
var SequenceToStringZod = z31.union([
|
|
2986
|
+
LocalSequenceToStringZod,
|
|
2987
|
+
QualifiedSequenceToStringZod
|
|
2988
|
+
]);
|
|
2989
|
+
var SequenceFromStringZod = z31.union([
|
|
2990
|
+
LocalSequenceFromStringZod,
|
|
2991
|
+
QualifiedSequenceFromStringZod
|
|
2992
|
+
]);
|
|
2993
|
+
|
|
2994
|
+
// src/zod/Stake.ts
|
|
2995
|
+
import { AddressZod as AddressZod6, HexZod as HexZod3 } from "@xylabs/sdk-js";
|
|
2996
|
+
import * as z32 from "zod";
|
|
2997
|
+
var StakeZod = z32.object({
|
|
2998
|
+
amount: AttoZod,
|
|
2999
|
+
// the block number when the stake was added
|
|
3000
|
+
addBlock: z32.number(),
|
|
3001
|
+
// the unique id for the stake item
|
|
3002
|
+
id: z32.number(),
|
|
3003
|
+
// the block number when the stake was removed (set to 0 if not removed)
|
|
3004
|
+
removeBlock: z32.number(),
|
|
3005
|
+
// the address that is being staked
|
|
3006
|
+
staked: AddressZod6,
|
|
3007
|
+
// the address that owns the stake
|
|
3008
|
+
staker: AddressZod6,
|
|
3009
|
+
// the block number when the stake was withdrawn (set to 0 if not withdrawn)
|
|
3010
|
+
withdrawBlock: z32.number()
|
|
3011
|
+
});
|
|
3012
|
+
var StakeToJsonZod = StakeZod.transform((val) => ({
|
|
3013
|
+
addBlock: val.addBlock,
|
|
3014
|
+
amount: AttoToJsonZod.parse(val.amount),
|
|
3015
|
+
id: val.id,
|
|
3016
|
+
removeBlock: val.removeBlock,
|
|
3017
|
+
staked: AddressZod6.parse(val.staked),
|
|
3018
|
+
staker: AddressZod6.parse(val.staker),
|
|
3019
|
+
withdrawBlock: val.withdrawBlock
|
|
3020
|
+
}));
|
|
3021
|
+
var JsonToStakeZod = StakeZod.extend({
|
|
3022
|
+
amount: HexZod3
|
|
3023
|
+
}).transform((val) => ({
|
|
3024
|
+
addBlock: val.addBlock,
|
|
3025
|
+
amount: JsonToAttoZod.parse(val.amount),
|
|
3026
|
+
id: val.id,
|
|
3027
|
+
removeBlock: val.removeBlock,
|
|
3028
|
+
staked: val.staked,
|
|
3029
|
+
staker: val.staker,
|
|
3030
|
+
withdrawBlock: val.withdrawBlock
|
|
3031
|
+
}));
|
|
3032
|
+
|
|
3033
|
+
// src/zod/TimeDomain.ts
|
|
3034
|
+
import * as z33 from "zod";
|
|
3035
|
+
var TimeDomainZod = z33.union([
|
|
3036
|
+
z33.literal("xl1"),
|
|
3037
|
+
z33.literal("epoch"),
|
|
3038
|
+
z33.literal("ethereum")
|
|
3039
|
+
]);
|
|
3040
|
+
|
|
3041
|
+
// src/zod/TransferPair.ts
|
|
3042
|
+
import { AddressZod as AddressZod7 } from "@xylabs/sdk-js";
|
|
3043
|
+
import z34 from "zod";
|
|
3044
|
+
var TransferPairZod = z34.tuple([
|
|
3045
|
+
AddressZod7,
|
|
3046
|
+
AddressZod7
|
|
3047
|
+
]);
|
|
3048
|
+
|
|
3049
|
+
// src/viewers/AccountBalance.ts
|
|
3050
|
+
var AccountBalanceHistoryItemZod = z35.tuple([
|
|
3051
|
+
WithHashMetaZod(BlockBoundWitnessZod),
|
|
3052
|
+
WithHashMetaZod(TransactionBoundWitnessZod).nullable(),
|
|
3053
|
+
WithHashMetaZod(TransferZod)
|
|
3054
|
+
]);
|
|
3055
|
+
|
|
2569
3056
|
// src/viewers/StakeEvents.ts
|
|
2570
3057
|
var StakeEventNames = [
|
|
2571
3058
|
"StakeAdded",
|
|
@@ -2603,12 +3090,29 @@ var generateXyoBaseWalletFromPhrase = /* @__PURE__ */ __name((walletPhrase) => {
|
|
|
2603
3090
|
export {
|
|
2604
3091
|
ACCOUNT_TYPE,
|
|
2605
3092
|
ADDRESS_INDEX,
|
|
3093
|
+
AccountBalanceHistoryItemZod,
|
|
2606
3094
|
AddressPairSchema,
|
|
3095
|
+
AnyBoundWitnessZod,
|
|
3096
|
+
AnySignedBoundWitnessWithStorageMetaZod,
|
|
3097
|
+
AnySignedBoundWitnessZod,
|
|
3098
|
+
AnyUnsignedBoundWitnessZod,
|
|
3099
|
+
ArrayBufferToJsonZod,
|
|
3100
|
+
AttoToJsonZod,
|
|
3101
|
+
AttoZod,
|
|
2607
3102
|
BalancesStepSummarySchema,
|
|
3103
|
+
BlockBoundWitnessZod,
|
|
3104
|
+
BlockDurationZod,
|
|
3105
|
+
BlockEndZod,
|
|
3106
|
+
BlockScriptsZod,
|
|
3107
|
+
BlockStartZod,
|
|
2608
3108
|
BlockValidationError,
|
|
3109
|
+
BoundWitnessZod,
|
|
2609
3110
|
CHANGE_ADDRESS,
|
|
2610
3111
|
COIN_TYPES,
|
|
3112
|
+
CaveatTypesZod,
|
|
3113
|
+
CaveatsZod,
|
|
2611
3114
|
ChainIndexingServiceStateSchema,
|
|
3115
|
+
ChainZod,
|
|
2612
3116
|
ConfigZod,
|
|
2613
3117
|
DEFAULT_WALLET_PATH,
|
|
2614
3118
|
EIP712DataPayloadFieldsZod,
|
|
@@ -2618,12 +3122,40 @@ export {
|
|
|
2618
3122
|
GlobalMetaSchema,
|
|
2619
3123
|
HydratedBlockStateValidationError,
|
|
2620
3124
|
HydratedBlockValidationError,
|
|
3125
|
+
HydratedBlockWithStorageMetaZod,
|
|
3126
|
+
HydratedBlockZod,
|
|
3127
|
+
HydratedTransactionZod,
|
|
3128
|
+
InvokerPermissionZod,
|
|
2621
3129
|
JSONSchemaMetaSchema,
|
|
3130
|
+
JsonToArrayBufferZod,
|
|
3131
|
+
JsonToAttoZod,
|
|
3132
|
+
JsonToSignedHydratedTransactionZod,
|
|
3133
|
+
JsonToStakeZod,
|
|
3134
|
+
LocalSequenceFromStringZod,
|
|
3135
|
+
LocalSequenceToStringZod,
|
|
2622
3136
|
LruCacheMap,
|
|
2623
3137
|
MemoryMap,
|
|
2624
3138
|
MemoryPermissionsStore,
|
|
2625
3139
|
MnemonicStringZod,
|
|
3140
|
+
PermissionRequestZod,
|
|
3141
|
+
PermissionZod,
|
|
3142
|
+
QualifiedSequenceFromStringZod,
|
|
3143
|
+
QualifiedSequenceToStringZod,
|
|
3144
|
+
RequestedPermissionZod,
|
|
2626
3145
|
RewardMultipliers,
|
|
3146
|
+
RewardsRangeOptionsZod,
|
|
3147
|
+
SchemasStepSummarySchema,
|
|
3148
|
+
SequenceFromStringZod,
|
|
3149
|
+
SequenceToStringZod,
|
|
3150
|
+
SignedBlockBoundWitnessZod,
|
|
3151
|
+
SignedBoundWitnessWithStorageMetaZod,
|
|
3152
|
+
SignedBoundWitnessZod,
|
|
3153
|
+
SignedHydratedBlockToJsonZod,
|
|
3154
|
+
SignedHydratedBlockWithStorageMetaZod,
|
|
3155
|
+
SignedHydratedBlockZod,
|
|
3156
|
+
SignedHydratedTransactionToJsonZod,
|
|
3157
|
+
SignedHydratedTransactionZod,
|
|
3158
|
+
SignedTransactionBoundWitnessZod,
|
|
2627
3159
|
SimpleAccountBalanceViewer,
|
|
2628
3160
|
SimpleChainStakeViewer,
|
|
2629
3161
|
SimpleDataLakeRunner,
|
|
@@ -2637,15 +3169,28 @@ export {
|
|
|
2637
3169
|
SimpleXyoRunner,
|
|
2638
3170
|
SimpleXyoSigner,
|
|
2639
3171
|
StakeEventNames,
|
|
3172
|
+
StakeToJsonZod,
|
|
3173
|
+
StakeZod,
|
|
2640
3174
|
StepSummarySchema,
|
|
2641
3175
|
TODO,
|
|
3176
|
+
TimeDomainZod,
|
|
3177
|
+
TransactionBoundWitnessZod,
|
|
3178
|
+
TransactionFeesBigIntToJsonZod,
|
|
3179
|
+
TransactionFeesBigIntZod,
|
|
3180
|
+
TransactionFeesHexZod,
|
|
3181
|
+
TransactionFeesJsonToBigIntZod,
|
|
3182
|
+
TransferPairZod,
|
|
2642
3183
|
TransfersStepSummarySchema,
|
|
2643
3184
|
TypedDataDomainZod,
|
|
2644
3185
|
TypedDataFieldZod,
|
|
2645
3186
|
TypedDataTypesZod,
|
|
2646
3187
|
TypedDataValueZod,
|
|
3188
|
+
UnsignedBoundWitnessWithStorageMetaZod,
|
|
3189
|
+
UnsignedBoundWitnessZod,
|
|
3190
|
+
UnsignedHydratedTransactionZod,
|
|
2647
3191
|
UsageMetaSchema,
|
|
2648
3192
|
WALLET_COMPLIANCE,
|
|
3193
|
+
WithTransactionFeesZod,
|
|
2649
3194
|
XL1_NETWORK_STAKING_GENESIS_PERIOD_END_EPOCH,
|
|
2650
3195
|
XL1_NETWORK_STAKING_GENESIS_PERIOD_END_XL1_BLOCK,
|
|
2651
3196
|
XL1_NETWORK_STAKING_GENESIS_PERIOD_TOTAL_BONUS_REWARDS,
|
|
@@ -2661,6 +3206,8 @@ export {
|
|
|
2661
3206
|
asEIP712DataPayload,
|
|
2662
3207
|
asEIP712SignaturePayload,
|
|
2663
3208
|
asOptionalAddressPairPayload,
|
|
3209
|
+
asSchemasStepSummary,
|
|
3210
|
+
asSchemasStepSummaryWithStorageMeta,
|
|
2664
3211
|
asTransfersStepSummary,
|
|
2665
3212
|
asTransfersStepSummaryWithStorageMeta,
|
|
2666
3213
|
balancesStepSummaryFromRange,
|
|
@@ -2707,14 +3254,21 @@ export {
|
|
|
2707
3254
|
isPositiveBigInt,
|
|
2708
3255
|
isReadArchivist,
|
|
2709
3256
|
isReadWriteArchivist,
|
|
3257
|
+
isSchemasStepSummary,
|
|
3258
|
+
isSchemasStepSummaryWithStorageMeta,
|
|
2710
3259
|
isTransfersStepSummary,
|
|
2711
3260
|
isTransfersStepSummaryWithStorageMeta,
|
|
2712
3261
|
isUsageMeta,
|
|
2713
3262
|
isWriteArchivist,
|
|
3263
|
+
isZodError,
|
|
2714
3264
|
netBalancesForPayloads,
|
|
3265
|
+
netSchemasForPayloads,
|
|
2715
3266
|
netTransfersForPayloads,
|
|
2716
3267
|
parseSignedBigInt,
|
|
3268
|
+
prettifyZodError,
|
|
2717
3269
|
readPayloadMapFromStore,
|
|
3270
|
+
schemasStepSummaryFromRange,
|
|
3271
|
+
schemasSummary,
|
|
2718
3272
|
signEIP712Message,
|
|
2719
3273
|
signTransaction,
|
|
2720
3274
|
stepBlockRange,
|