@xyo-network/xl1-protocol-sdk 1.16.23 → 1.16.25
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/block/hydrate/blockPayloadsFromHydratedBlock.d.ts +3 -3
- package/dist/neutral/block/hydrate/blockPayloadsFromHydratedBlock.d.ts.map +1 -1
- package/dist/neutral/block/hydrate/flattenHydratedBlock.d.ts +3 -3
- package/dist/neutral/block/hydrate/flattenHydratedBlock.d.ts.map +1 -1
- package/dist/neutral/block/hydrate/flattenHydratedBlocks.d.ts +3 -3
- package/dist/neutral/block/hydrate/flattenHydratedBlocks.d.ts.map +1 -1
- package/dist/neutral/block/hydrate/hydrateBlock.d.ts +2 -2
- package/dist/neutral/block/hydrate/hydrateBlock.d.ts.map +1 -1
- package/dist/neutral/block/hydrate/transactionsFromHydratedBlock.d.ts +2 -3
- package/dist/neutral/block/hydrate/transactionsFromHydratedBlock.d.ts.map +1 -1
- package/dist/neutral/block/primitives/blockFromBlockNumber.d.ts +3 -2
- package/dist/neutral/block/primitives/blockFromBlockNumber.d.ts.map +1 -1
- package/dist/neutral/config/Config.d.ts +10 -4
- package/dist/neutral/config/Config.d.ts.map +1 -1
- package/dist/neutral/config/Producer.d.ts +0 -1
- package/dist/neutral/config/Producer.d.ts.map +1 -1
- package/dist/neutral/config/Services.d.ts +7 -0
- package/dist/neutral/config/Services.d.ts.map +1 -0
- package/dist/neutral/config/Telemetry.d.ts +16 -0
- package/dist/neutral/config/Telemetry.d.ts.map +1 -1
- package/dist/neutral/index.d.ts +0 -1
- package/dist/neutral/index.d.ts.map +1 -1
- package/dist/neutral/index.mjs +607 -911
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/instances/transaction/HydratedTransaction.d.ts +2 -3
- package/dist/neutral/instances/transaction/HydratedTransaction.d.ts.map +1 -1
- package/dist/neutral/instances/transaction/TransactionFields.d.ts +3 -2
- package/dist/neutral/instances/transaction/TransactionFields.d.ts.map +1 -1
- package/dist/neutral/model/PayloadBundle/bundledPayloadToHydratedTransaction.d.ts +4 -0
- package/dist/neutral/model/PayloadBundle/bundledPayloadToHydratedTransaction.d.ts.map +1 -0
- package/dist/neutral/model/PayloadBundle/hydratedTransactionToPayloadBundle.d.ts +4 -0
- package/dist/neutral/model/PayloadBundle/hydratedTransactionToPayloadBundle.d.ts.map +1 -0
- package/dist/neutral/model/PayloadBundle/index.d.ts +3 -0
- package/dist/neutral/model/PayloadBundle/index.d.ts.map +1 -0
- package/dist/neutral/model/index.d.ts +1 -0
- package/dist/neutral/model/index.d.ts.map +1 -1
- package/dist/neutral/primitives/summary/schemas/schemasStepSummaryFromRange.d.ts +2 -2
- package/dist/neutral/primitives/summary/schemas/schemasStepSummaryFromRange.d.ts.map +1 -1
- package/dist/neutral/primitives/transaction/elevatedPayloads.d.ts +3 -3
- package/dist/neutral/primitives/transaction/elevatedPayloads.d.ts.map +1 -1
- package/dist/neutral/provider/TransactionSubmitter.d.ts +3 -3
- package/dist/neutral/provider/TransactionSubmitter.d.ts.map +1 -1
- package/dist/neutral/provider/XyoGatewayRunner.d.ts +3 -3
- package/dist/neutral/provider/XyoGatewayRunner.d.ts.map +1 -1
- package/dist/neutral/provider/signer/XyoSigner.d.ts +2 -2
- package/dist/neutral/provider/signer/XyoSigner.d.ts.map +1 -1
- package/dist/neutral/provider/viewer/XyoViewer.d.ts +5 -2
- package/dist/neutral/provider/viewer/XyoViewer.d.ts.map +1 -1
- package/dist/neutral/services/BlockProducerService.d.ts +2 -2
- package/dist/neutral/services/BlockProducerService.d.ts.map +1 -1
- package/dist/neutral/simple/accountBalance/SimpleAccountBalanceViewer.d.ts +18 -6
- package/dist/neutral/simple/accountBalance/SimpleAccountBalanceViewer.d.ts.map +1 -1
- package/dist/neutral/simple/gateway/SimpleXyoGatewayRunner.d.ts +2 -2
- package/dist/neutral/simple/gateway/SimpleXyoGatewayRunner.d.ts.map +1 -1
- package/dist/neutral/simple/mempool/SimpleMempoolViewer.d.ts +9 -0
- package/dist/neutral/simple/mempool/SimpleMempoolViewer.d.ts.map +1 -0
- package/dist/neutral/simple/mempool/index.d.ts +2 -0
- package/dist/neutral/simple/mempool/index.d.ts.map +1 -0
- package/dist/neutral/simple/signer/SimpleXyoSigner.d.ts +3 -4
- package/dist/neutral/simple/signer/SimpleXyoSigner.d.ts.map +1 -1
- package/dist/neutral/transaction/buildTransaction.d.ts +2 -2
- package/dist/neutral/transaction/buildTransaction.d.ts.map +1 -1
- package/dist/neutral/transaction/buildUnsignedTransaction.d.ts +2 -2
- package/dist/neutral/transaction/buildUnsignedTransaction.d.ts.map +1 -1
- package/dist/neutral/transaction/hydrateTransaction.d.ts.map +1 -1
- package/dist/neutral/transaction/primitives/transactionBlockByteCount.d.ts +2 -2
- package/dist/neutral/transaction/primitives/transactionBlockByteCount.d.ts.map +1 -1
- package/dist/neutral/transaction/primitives/transactionElevatedPayloads.d.ts +2 -2
- package/dist/neutral/transaction/primitives/transactionElevatedPayloads.d.ts.map +1 -1
- package/dist/neutral/transaction/primitives/transactionRequiredGas.d.ts +3 -3
- package/dist/neutral/transaction/primitives/transactionRequiredGas.d.ts.map +1 -1
- package/dist/neutral/transaction/script.d.ts +3 -3
- package/dist/neutral/transaction/script.d.ts.map +1 -1
- package/dist/neutral/transaction/signTransaction.d.ts +23 -3
- package/dist/neutral/transaction/signTransaction.d.ts.map +1 -1
- package/dist/neutral/validation/block/HydratedBlockStateValidationFunction.d.ts +2 -2
- package/dist/neutral/validation/block/HydratedBlockStateValidationFunction.d.ts.map +1 -1
- package/dist/neutral/validation/block/HydratedBlockValidationFunction.d.ts +2 -2
- package/dist/neutral/validation/block/HydratedBlockValidationFunction.d.ts.map +1 -1
- package/dist/neutral/viewers/AccountBalance.d.ts +22 -28
- package/dist/neutral/viewers/AccountBalance.d.ts.map +1 -1
- package/dist/neutral/viewers/Block.d.ts +5 -5
- package/dist/neutral/viewers/Block.d.ts.map +1 -1
- package/dist/neutral/viewers/Mempool.d.ts +14 -0
- package/dist/neutral/viewers/Mempool.d.ts.map +1 -0
- package/dist/neutral/viewers/index.d.ts +1 -0
- package/dist/neutral/viewers/index.d.ts.map +1 -1
- package/package.json +17 -17
- package/src/block/hydrate/blockPayloadsFromHydratedBlock.ts +5 -5
- package/src/block/hydrate/flattenHydratedBlock.ts +3 -3
- package/src/block/hydrate/flattenHydratedBlocks.ts +3 -3
- package/src/block/hydrate/hydrateBlock.ts +2 -2
- package/src/block/hydrate/transactionsFromHydratedBlock.ts +4 -6
- package/src/block/primitives/blockFromBlockNumber.ts +27 -7
- package/src/config/Config.ts +2 -2
- package/src/config/Producer.ts +0 -6
- package/src/config/Services.ts +17 -0
- package/src/config/Telemetry.ts +19 -0
- package/src/index.ts +1 -1
- package/src/instances/transaction/HydratedTransaction.ts +3 -5
- package/src/instances/transaction/TransactionFields.ts +4 -4
- package/src/model/PayloadBundle/bundledPayloadToHydratedTransaction.ts +14 -0
- package/src/model/PayloadBundle/hydratedTransactionToPayloadBundle.ts +18 -0
- package/src/model/PayloadBundle/index.ts +2 -0
- package/src/model/index.ts +1 -0
- package/src/primitives/summary/balances/balancesSummary.ts +1 -1
- package/src/primitives/summary/schemas/schemasStepSummaryFromRange.ts +8 -8
- package/src/primitives/summary/schemas/schemasSummary.ts +1 -1
- package/src/primitives/summary/transfers/transfersSummary.ts +1 -1
- package/src/primitives/transaction/elevatedPayloads.ts +4 -4
- package/src/provider/TransactionSubmitter.ts +3 -2
- package/src/provider/XyoGatewayRunner.ts +3 -2
- package/src/provider/signer/XyoSigner.ts +4 -3
- package/src/provider/viewer/XyoViewer.ts +5 -1
- package/src/services/BlockProducerService.ts +2 -2
- package/src/simple/accountBalance/SimpleAccountBalanceViewer.ts +31 -13
- package/src/simple/gateway/SimpleXyoGatewayRunner.ts +11 -8
- package/src/simple/mempool/SimpleMempoolViewer.ts +37 -0
- package/src/simple/mempool/index.ts +1 -0
- package/src/simple/signer/SimpleXyoSigner.ts +10 -7
- package/src/transaction/buildTransaction.ts +8 -6
- package/src/transaction/buildUnsignedTransaction.ts +5 -4
- package/src/transaction/hydrateTransaction.ts +2 -2
- package/src/transaction/primitives/transactionBlockByteCount.ts +2 -2
- package/src/transaction/primitives/transactionElevatedPayloads.ts +2 -2
- package/src/transaction/primitives/transactionRequiredGas.ts +3 -3
- package/src/transaction/script.ts +3 -3
- package/src/transaction/signTransaction.ts +12 -9
- package/src/validation/block/HydratedBlockStateValidationFunction.ts +2 -2
- package/src/validation/block/HydratedBlockValidationFunction.ts +2 -2
- package/src/viewers/AccountBalance.ts +5 -6
- package/src/viewers/Block.ts +5 -5
- package/src/viewers/Mempool.ts +18 -0
- package/src/viewers/index.ts +1 -0
- package/dist/neutral/config/App.d.ts +0 -6
- package/dist/neutral/config/App.d.ts.map +0 -1
- package/dist/neutral/zod/ArrayBuffer.d.ts +0 -4
- package/dist/neutral/zod/ArrayBuffer.d.ts.map +0 -1
- package/dist/neutral/zod/BlockBoundWitness.d.ts +0 -44
- package/dist/neutral/zod/BlockBoundWitness.d.ts.map +0 -1
- package/dist/neutral/zod/BoundWitness.d.ts +0 -123
- package/dist/neutral/zod/BoundWitness.d.ts.map +0 -1
- package/dist/neutral/zod/Chain.d.ts +0 -4
- package/dist/neutral/zod/Chain.d.ts.map +0 -1
- package/dist/neutral/zod/HydratedBlock.d.ts +0 -133
- package/dist/neutral/zod/HydratedBlock.d.ts.map +0 -1
- package/dist/neutral/zod/HydratedTransaction.d.ts +0 -210
- package/dist/neutral/zod/HydratedTransaction.d.ts.map +0 -1
- package/dist/neutral/zod/Permission.d.ts +0 -53
- package/dist/neutral/zod/Permission.d.ts.map +0 -1
- package/dist/neutral/zod/RewardsRangeOptions.d.ts +0 -11
- package/dist/neutral/zod/RewardsRangeOptions.d.ts.map +0 -1
- package/dist/neutral/zod/Sequence.d.ts +0 -9
- package/dist/neutral/zod/Sequence.d.ts.map +0 -1
- package/dist/neutral/zod/Stake.d.ts +0 -62
- package/dist/neutral/zod/Stake.d.ts.map +0 -1
- package/dist/neutral/zod/TimeDomain.d.ts +0 -3
- package/dist/neutral/zod/TimeDomain.d.ts.map +0 -1
- package/dist/neutral/zod/TransactionBoundWitness.d.ts +0 -75
- package/dist/neutral/zod/TransactionBoundWitness.d.ts.map +0 -1
- package/dist/neutral/zod/TransactionFees.d.ts +0 -53
- package/dist/neutral/zod/TransactionFees.d.ts.map +0 -1
- package/dist/neutral/zod/TransferPair.d.ts +0 -3
- package/dist/neutral/zod/TransferPair.d.ts.map +0 -1
- package/dist/neutral/zod/index.d.ts +0 -15
- package/dist/neutral/zod/index.d.ts.map +0 -1
- package/src/config/App.ts +0 -13
- package/src/zod/ArrayBuffer.ts +0 -42
- package/src/zod/BlockBoundWitness.ts +0 -36
- package/src/zod/BoundWitness.ts +0 -56
- package/src/zod/Chain.ts +0 -5
- package/src/zod/HydratedBlock.ts +0 -32
- package/src/zod/HydratedTransaction.ts +0 -37
- package/src/zod/Permission.ts +0 -23
- package/src/zod/RewardsRangeOptions.ts +0 -10
- package/src/zod/Sequence.ts +0 -15
- package/src/zod/Stake.ts +0 -43
- package/src/zod/TimeDomain.ts +0 -7
- package/src/zod/TransactionBoundWitness.ts +0 -42
- package/src/zod/TransactionFees.ts +0 -45
- package/src/zod/TransferPair.ts +0 -6
- package/src/zod/index.ts +0 -14
package/dist/neutral/index.mjs
CHANGED
|
@@ -10,9 +10,9 @@ __name(allHashesPresent, "allHashesPresent");
|
|
|
10
10
|
|
|
11
11
|
// src/block/hydrate/blockPayloadsFromHydratedBlock.ts
|
|
12
12
|
import { assertEx } from "@xylabs/sdk-js";
|
|
13
|
-
import {
|
|
13
|
+
import { isTransactionBoundWitness } from "@xyo-network/xl1-protocol";
|
|
14
14
|
var blockPayloadsFromHydratedBlock = /* @__PURE__ */ __name((block) => {
|
|
15
|
-
return block[0].payload_hashes.map((hash) => assertEx(block[1].find((p) => p._hash === hash), () => `missing payload ${hash}`)).filter((x) => !
|
|
15
|
+
return block[0].payload_hashes.map((hash) => assertEx(block[1].find((p) => p._hash === hash), () => `missing payload ${hash}`)).filter((x) => !isTransactionBoundWitness(x));
|
|
16
16
|
}, "blockPayloadsFromHydratedBlock");
|
|
17
17
|
|
|
18
18
|
// src/block/hydrate/flattenHydratedBlock.ts
|
|
@@ -29,7 +29,7 @@ var flattenHydratedBlocks = /* @__PURE__ */ __name((hydratedBlocks) => hydratedB
|
|
|
29
29
|
|
|
30
30
|
// src/block/hydrate/hydrateBlock.ts
|
|
31
31
|
import { assertEx as assertEx2 } from "@xylabs/sdk-js";
|
|
32
|
-
import { asBlockBoundWitnessWithStorageMeta, isTransactionBoundWitnessWithStorageMeta
|
|
32
|
+
import { asBlockBoundWitnessWithStorageMeta, isTransactionBoundWitnessWithStorageMeta } from "@xyo-network/xl1-protocol";
|
|
33
33
|
var hydrateBlock = /* @__PURE__ */ __name(async ({ chainMap }, hash, maxDepth = 1, minDepth = maxDepth) => {
|
|
34
34
|
assertEx2(maxDepth >= 0, () => "maxDepth must be greater than or equal to 0");
|
|
35
35
|
assertEx2(minDepth >= 0, () => "minDepth must be greater than or equal to 0");
|
|
@@ -45,7 +45,7 @@ var hydrateBlock = /* @__PURE__ */ __name(async ({ chainMap }, hash, maxDepth =
|
|
|
45
45
|
bw,
|
|
46
46
|
blkPayloads
|
|
47
47
|
];
|
|
48
|
-
const transactions = blkPayloads.filter(
|
|
48
|
+
const transactions = blkPayloads.filter(isTransactionBoundWitnessWithStorageMeta);
|
|
49
49
|
const transactionsPayloadHashes = transactions.flatMap((tx) => tx.payload_hashes);
|
|
50
50
|
const transactionsPayloads = await chainMap.getMany(transactionsPayloadHashes);
|
|
51
51
|
assertEx2(allHashesPresent(transactionsPayloadHashes, transactionsPayloads), () => `Unable to find all payloads for transactions in block ${hash}`);
|
|
@@ -67,10 +67,9 @@ var hydrateBlock = /* @__PURE__ */ __name(async ({ chainMap }, hash, maxDepth =
|
|
|
67
67
|
}, "hydrateBlock");
|
|
68
68
|
|
|
69
69
|
// src/block/hydrate/transactionsFromHydratedBlock.ts
|
|
70
|
-
import {
|
|
71
|
-
import { asTransactionBoundWitnessWithStorageMeta } from "@xyo-network/xl1-protocol";
|
|
70
|
+
import { isTransactionBoundWitnessWithStorageMeta as isTransactionBoundWitnessWithStorageMeta2 } from "@xyo-network/xl1-protocol";
|
|
72
71
|
var transactionsFromHydratedBlock = /* @__PURE__ */ __name((block) => {
|
|
73
|
-
return
|
|
72
|
+
return block[1].filter(isTransactionBoundWitnessWithStorageMeta2);
|
|
74
73
|
}, "transactionsFromHydratedBlock");
|
|
75
74
|
|
|
76
75
|
// src/block/hydrate/tryHydrateBlock.ts
|
|
@@ -109,9 +108,9 @@ var tryHydrateBlock = /* @__PURE__ */ __name(async (archivist, hash, maxDepth =
|
|
|
109
108
|
}, "tryHydrateBlock");
|
|
110
109
|
|
|
111
110
|
// src/block/primitives/blockFromBlockNumber.ts
|
|
112
|
-
import { asHash } from "@xylabs/sdk-js";
|
|
111
|
+
import { asHash as asHash3, isDefined as isDefined9 } from "@xylabs/sdk-js";
|
|
113
112
|
import { toSafeJsonString } from "@xylabs/sdk-js";
|
|
114
|
-
import {
|
|
113
|
+
import { asSignedBlockBoundWitnessWithStorageMeta, SignedBlockBoundWitnessWithHashMetaZod, StepSizes as StepSizes7 } from "@xyo-network/xl1-protocol";
|
|
115
114
|
|
|
116
115
|
// src/model/ChainContext/ChainContext.ts
|
|
117
116
|
import { isDefined as isDefined7, isUndefined } from "@xylabs/sdk-js";
|
|
@@ -511,9 +510,7 @@ async function balancesSummary(context) {
|
|
|
511
510
|
return await spanRootAsync("balancesSummary", async () => {
|
|
512
511
|
const [headHash] = await context.head();
|
|
513
512
|
const headResult = await context.store.chainMap.get(headHash);
|
|
514
|
-
const headBoundWitness = asBlockBoundWitnessWithStorageMeta2(headResult, () => `Head block not found for hash: ${headHash}
|
|
515
|
-
required: true
|
|
516
|
-
});
|
|
513
|
+
const headBoundWitness = asBlockBoundWitnessWithStorageMeta2(headResult, () => `Head block not found for hash: ${headHash}`);
|
|
517
514
|
const rangeStart = asXL1BlockNumber(isDefined4(context.windowSize) ? Math.max(headBoundWitness.block - context.windowSize + 1, 0) : 0);
|
|
518
515
|
const ranges = deepCalculateFramesFromRange(asXL1BlockRange2([
|
|
519
516
|
rangeStart,
|
|
@@ -536,9 +533,9 @@ __name(balancesSummary, "balancesSummary");
|
|
|
536
533
|
|
|
537
534
|
// src/primitives/summary/schemas/schemasStepSummaryFromRange.ts
|
|
538
535
|
import { assertEx as assertEx6 } from "@xylabs/sdk-js";
|
|
539
|
-
import {
|
|
536
|
+
import { isBoundWitness } from "@xyo-network/boundwitness-model";
|
|
540
537
|
import { PayloadBuilder as PayloadBuilder2 } from "@xyo-network/payload-builder";
|
|
541
|
-
import { isAnyPayload as isAnyPayload2 } from "@xyo-network/payload-model";
|
|
538
|
+
import { isAnyPayload as isAnyPayload2, isHashMeta } from "@xyo-network/payload-model";
|
|
542
539
|
import { StepSizes as StepSizes5 } from "@xyo-network/xl1-protocol";
|
|
543
540
|
async function schemasStepSummaryFromRange(context, range) {
|
|
544
541
|
const frameHeadHash = await hashFromBlockNumber(context, range[1]);
|
|
@@ -550,7 +547,7 @@ async function schemasStepSummaryFromRange(context, range) {
|
|
|
550
547
|
const [block, payloads] = await hydrateBlock(context.store, hash);
|
|
551
548
|
const boundWitnesses = [
|
|
552
549
|
block,
|
|
553
|
-
...payloads.filter(
|
|
550
|
+
...payloads.filter((x) => isBoundWitness(x) && isHashMeta(x))
|
|
554
551
|
];
|
|
555
552
|
const schemas = {};
|
|
556
553
|
for (const bw of boundWitnesses) {
|
|
@@ -595,8 +592,7 @@ async function schemasStepSummaryFromRange(context, range) {
|
|
|
595
592
|
}
|
|
596
593
|
}
|
|
597
594
|
}
|
|
598
|
-
|
|
599
|
-
return finalResult;
|
|
595
|
+
return await PayloadBuilder2.addHashMeta(result);
|
|
600
596
|
}
|
|
601
597
|
__name(schemasStepSummaryFromRange, "schemasStepSummaryFromRange");
|
|
602
598
|
|
|
@@ -608,9 +604,7 @@ async function schemasSummary(context) {
|
|
|
608
604
|
return await spanRootAsync2("schemasSummary", async () => {
|
|
609
605
|
const [headHash] = await context.head();
|
|
610
606
|
const headResult = await context.store.chainMap.get(headHash);
|
|
611
|
-
const headBoundWitness = asBlockBoundWitnessWithStorageMeta3(headResult, () => `Head block not found for hash: ${headHash}
|
|
612
|
-
required: true
|
|
613
|
-
});
|
|
607
|
+
const headBoundWitness = asBlockBoundWitnessWithStorageMeta3(headResult, () => `Head block not found for hash: ${headHash}`);
|
|
614
608
|
const rangeStart = asXL1BlockNumber2(isDefined5(context.windowSize) ? Math.max(headBoundWitness.block - context.windowSize + 1, 0) : 0);
|
|
615
609
|
const ranges = deepCalculateFramesFromRange(asXL1BlockRange3([
|
|
616
610
|
rangeStart,
|
|
@@ -644,9 +638,7 @@ async function transfersSummary(transferContext) {
|
|
|
644
638
|
return await spanRootAsync3("transferSummary", async () => {
|
|
645
639
|
const [headHash] = await transferContext.head();
|
|
646
640
|
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
|
-
});
|
|
641
|
+
const headBoundWitness = asBlockBoundWitnessWithStorageMeta4(headResult, () => `Head block not found for hash: ${transferContext.head}`);
|
|
650
642
|
const rangeStart = asXL1BlockNumber3(isDefined6(transferContext.windowSize) ? Math.max(headBoundWitness.block - transferContext.windowSize + 1, 0) : 0);
|
|
651
643
|
const ranges = deepCalculateFramesFromRange(asXL1BlockRange4([
|
|
652
644
|
rangeStart,
|
|
@@ -811,114 +803,445 @@ async function withContextCacheResponse(context, name, key, func, { max = 1e4, t
|
|
|
811
803
|
}
|
|
812
804
|
__name(withContextCacheResponse, "withContextCacheResponse");
|
|
813
805
|
|
|
814
|
-
// src/
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
let jumpHash = currentBlock.previous;
|
|
828
|
-
let jumpBlockNumber = currentBlock.block - 1;
|
|
829
|
-
for (const [step, stepSize2] of StepSizes7.entries()) {
|
|
830
|
-
const possibleJumpBlockNumber = currentBlock.block - currentBlock.block % stepSize2 - 1;
|
|
831
|
-
if (possibleJumpBlockNumber >= blockNumber && possibleJumpBlockNumber <= jumpBlockNumber) {
|
|
832
|
-
jumpBlockNumber = possibleJumpBlockNumber;
|
|
833
|
-
jumpHash = asHash(currentBlock.step_hashes.at(step), () => `Step hash not found for step ${step} in block ${currentBlock.block}`);
|
|
834
|
-
}
|
|
835
|
-
}
|
|
836
|
-
const newBlock = await context.store.chainMap.get(asHash(jumpHash, () => `Jump hash not found for block number [${blockNumber}]: ${jumpBlockNumber} ${toSafeJsonString(currentBlock, 10)}`));
|
|
837
|
-
currentBlock = asBlockBoundWitnessWithStorageMeta5(newBlock, () => `Block not found for hash: ${jumpHash}`, {
|
|
838
|
-
required: true
|
|
839
|
-
});
|
|
840
|
-
if (currentBlock.block === blockNumber) {
|
|
841
|
-
break;
|
|
842
|
-
}
|
|
843
|
-
if (currentBlock.block < blockNumber) {
|
|
844
|
-
throw new Error(`Block number ${blockNumber} is not a valid step block number for block ${headHash}.`);
|
|
845
|
-
}
|
|
846
|
-
}
|
|
847
|
-
return currentBlock;
|
|
848
|
-
});
|
|
849
|
-
}
|
|
850
|
-
__name(blockFromBlockNumber, "blockFromBlockNumber");
|
|
806
|
+
// src/model/PayloadBundle/bundledPayloadToHydratedTransaction.ts
|
|
807
|
+
import { PayloadBuilder as PayloadBuilder4 } from "@xyo-network/payload-builder";
|
|
808
|
+
import { asSignedTransactionBoundWitnessWithHashMeta } from "@xyo-network/xl1-protocol";
|
|
809
|
+
var bundledPayloadToHydratedTransaction = /* @__PURE__ */ __name(async (payload) => {
|
|
810
|
+
const withHashMeta = await PayloadBuilder4.addHashMeta(payload.payloads);
|
|
811
|
+
const tx = asSignedTransactionBoundWitnessWithHashMeta(withHashMeta.find((p) => p._hash === payload.root));
|
|
812
|
+
if (tx) {
|
|
813
|
+
return [
|
|
814
|
+
tx,
|
|
815
|
+
withHashMeta.filter((p) => p._hash !== payload.root)
|
|
816
|
+
];
|
|
817
|
+
}
|
|
818
|
+
}, "bundledPayloadToHydratedTransaction");
|
|
851
819
|
|
|
852
|
-
// src/
|
|
853
|
-
import {
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
]);
|
|
820
|
+
// src/model/PayloadBundle/hydratedTransactionToPayloadBundle.ts
|
|
821
|
+
import { PayloadBuilder as PayloadBuilder9 } from "@xyo-network/payload-builder";
|
|
822
|
+
import { PayloadBundleSchema } from "@xyo-network/payload-model";
|
|
823
|
+
|
|
824
|
+
// src/transaction/buildTransaction.ts
|
|
825
|
+
import { assertEx as assertEx8, toHex as toHex2 } from "@xylabs/sdk-js";
|
|
826
|
+
import { BoundWitnessBuilder } from "@xyo-network/boundwitness-builder";
|
|
827
|
+
import { PayloadBuilder as PayloadBuilder5 } from "@xyo-network/payload-builder";
|
|
828
|
+
import { defaultTransactionFees } from "@xyo-network/xl1-protocol";
|
|
829
|
+
async function buildTransaction(chain, onChainPayloads, offChainPayloads, signer, nbf, exp, from, fees = defaultTransactionFees) {
|
|
830
|
+
if (from === void 0 && Array.isArray(signer)) {
|
|
831
|
+
throw new Error("from is required when signer is an array");
|
|
865
832
|
}
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
833
|
+
const txBoundWitnessFields = {
|
|
834
|
+
chain,
|
|
835
|
+
fees: {
|
|
836
|
+
base: toHex2(fees.base),
|
|
837
|
+
gasLimit: toHex2(fees.gasLimit),
|
|
838
|
+
gasPrice: toHex2(fees.gasPrice),
|
|
839
|
+
priority: toHex2(fees.priority)
|
|
840
|
+
},
|
|
841
|
+
nbf,
|
|
842
|
+
exp
|
|
843
|
+
};
|
|
844
|
+
const elevatedHashes = await PayloadBuilder5.hashes(onChainPayloads);
|
|
845
|
+
const script = [];
|
|
846
|
+
for (const elevatedHash of elevatedHashes) {
|
|
847
|
+
script.push(`elevate|${elevatedHash}`);
|
|
848
|
+
}
|
|
849
|
+
const fields = {
|
|
850
|
+
...txBoundWitnessFields,
|
|
851
|
+
from: from ?? (Array.isArray(signer) ? assertEx8(signer.at(0)?.address) : signer.address)
|
|
852
|
+
};
|
|
853
|
+
if (script.length > 0) {
|
|
854
|
+
fields.script = script;
|
|
884
855
|
}
|
|
856
|
+
const [tx, txPayloads] = await new BoundWitnessBuilder().fields(fields).meta({
|
|
857
|
+
$signatures: []
|
|
858
|
+
}).payloads([
|
|
859
|
+
...onChainPayloads,
|
|
860
|
+
...offChainPayloads
|
|
861
|
+
]).signers(Array.isArray(signer) ? signer : [
|
|
862
|
+
signer
|
|
863
|
+
]).build();
|
|
885
864
|
return [
|
|
886
|
-
|
|
887
|
-
|
|
865
|
+
await PayloadBuilder5.addHashMeta(tx),
|
|
866
|
+
await PayloadBuilder5.addHashMeta(txPayloads)
|
|
888
867
|
];
|
|
889
868
|
}
|
|
890
|
-
__name(
|
|
869
|
+
__name(buildTransaction, "buildTransaction");
|
|
891
870
|
|
|
892
|
-
// src/
|
|
893
|
-
import {
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
871
|
+
// src/transaction/buildUnsignedTransaction.ts
|
|
872
|
+
import { toHex as toHex3 } from "@xylabs/sdk-js";
|
|
873
|
+
import { BoundWitnessBuilder as BoundWitnessBuilder2 } from "@xyo-network/boundwitness-builder";
|
|
874
|
+
import { PayloadBuilder as PayloadBuilder6 } from "@xyo-network/payload-builder";
|
|
875
|
+
import { defaultTransactionFees as defaultTransactionFees2 } from "@xyo-network/xl1-protocol";
|
|
876
|
+
async function buildUnsignedTransaction(chain, onChainPayloads, offChainPayloads, nbf, exp, from, fees = defaultTransactionFees2) {
|
|
877
|
+
const txBoundWitnessFields = {
|
|
878
|
+
chain,
|
|
879
|
+
fees: {
|
|
880
|
+
base: toHex3(fees.base),
|
|
881
|
+
gasLimit: toHex3(fees.gasLimit),
|
|
882
|
+
gasPrice: toHex3(fees.gasPrice),
|
|
883
|
+
priority: toHex3(fees.priority)
|
|
884
|
+
},
|
|
885
|
+
nbf,
|
|
886
|
+
exp
|
|
887
|
+
};
|
|
888
|
+
const elevatedHashes = await PayloadBuilder6.hashes(onChainPayloads);
|
|
889
|
+
const script = [];
|
|
890
|
+
for (const elevatedHash of elevatedHashes) {
|
|
891
|
+
script.push(`elevate|${elevatedHash}`);
|
|
892
|
+
}
|
|
893
|
+
const fields = {
|
|
894
|
+
...txBoundWitnessFields,
|
|
895
|
+
from
|
|
896
|
+
};
|
|
897
|
+
if (script.length > 0) {
|
|
898
|
+
fields.script = script;
|
|
899
|
+
}
|
|
900
|
+
const [tx, txPayloads] = await new BoundWitnessBuilder2().fields(fields).meta({
|
|
901
|
+
$signatures: []
|
|
902
|
+
}).payloads([
|
|
903
|
+
...onChainPayloads,
|
|
904
|
+
...offChainPayloads
|
|
905
|
+
]).build(false);
|
|
906
|
+
return [
|
|
907
|
+
tx,
|
|
908
|
+
txPayloads
|
|
898
909
|
];
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
910
|
+
}
|
|
911
|
+
__name(buildUnsignedTransaction, "buildUnsignedTransaction");
|
|
912
|
+
|
|
913
|
+
// src/transaction/confirmSubmittedTransaction.ts
|
|
914
|
+
import { delay, isDefined as isDefined8 } from "@xylabs/sdk-js";
|
|
915
|
+
var DEFAULT_CONFIRMATION_ATTEMPTS = 20;
|
|
916
|
+
var DEFAULT_DELAY_BETWEEN_ATTEMPTS = 1e3;
|
|
917
|
+
var confirmSubmittedTransaction = /* @__PURE__ */ __name(async (viewer, txHash, options) => {
|
|
918
|
+
const { attempts: maxAttempts = DEFAULT_CONFIRMATION_ATTEMPTS, delay: attemptDelay = DEFAULT_DELAY_BETWEEN_ATTEMPTS } = options ?? {};
|
|
919
|
+
options?.logger?.log("\u{1F680} confirming transaction:", txHash, "\n");
|
|
920
|
+
let attempts = 0;
|
|
921
|
+
while (true) {
|
|
922
|
+
const tx = await viewer.transactionByHash(txHash) ?? void 0;
|
|
923
|
+
if (isDefined8(tx)) {
|
|
924
|
+
options?.logger?.log("\u2705 Transaction confirmed:", txHash, "\n");
|
|
925
|
+
return tx;
|
|
926
|
+
} else {
|
|
927
|
+
attempts++;
|
|
928
|
+
if (attempts > maxAttempts) {
|
|
929
|
+
options?.logger?.error(`\u26A0\uFE0F Transaction not confirmed after ${maxAttempts} attempts`);
|
|
930
|
+
throw new Error(`Transaction ${txHash} not confirmed after ${maxAttempts} attempts`);
|
|
931
|
+
} else {
|
|
932
|
+
options?.logger?.log(`\u{1F504} Transaction not confirmed yet, attempt ${attempts}. Retrying...`, "\n");
|
|
933
|
+
await delay(attemptDelay);
|
|
934
|
+
}
|
|
905
935
|
}
|
|
906
|
-
remaining = newRemaining;
|
|
907
936
|
}
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
937
|
+
}, "confirmSubmittedTransaction");
|
|
938
|
+
|
|
939
|
+
// src/transaction/hydrateTransaction.ts
|
|
940
|
+
import { assertEx as assertEx9 } from "@xylabs/sdk-js";
|
|
941
|
+
import { hydrateTypedBoundWitness, tryHydrateTypedBoundWitness } from "@xyo-network/archivist-model";
|
|
942
|
+
import { isAllowedBlockPayload as isAllowedBlockPayload2, isSignedTransactionBoundWitnessWithStorageMeta } from "@xyo-network/xl1-protocol";
|
|
943
|
+
var tryHydrateTransaction = /* @__PURE__ */ __name(async ({ chainMap }, hash) => {
|
|
944
|
+
return await tryHydrateTypedBoundWitness({
|
|
945
|
+
get(hashes) {
|
|
946
|
+
return chainMap.getMany(hashes);
|
|
947
|
+
},
|
|
948
|
+
next() {
|
|
949
|
+
throw new Error("Not implemented");
|
|
950
|
+
}
|
|
951
|
+
}, hash, isSignedTransactionBoundWitnessWithStorageMeta);
|
|
952
|
+
}, "tryHydrateTransaction");
|
|
953
|
+
var hydrateTransaction = /* @__PURE__ */ __name(async ({ chainMap }, hash) => {
|
|
954
|
+
return await hydrateTypedBoundWitness({
|
|
955
|
+
get(hashes) {
|
|
956
|
+
return chainMap.getMany(hashes);
|
|
957
|
+
},
|
|
958
|
+
next() {
|
|
959
|
+
throw new Error("Not implemented");
|
|
960
|
+
}
|
|
961
|
+
}, hash, isSignedTransactionBoundWitnessWithStorageMeta);
|
|
962
|
+
}, "hydrateTransaction");
|
|
963
|
+
var flattenHydratedTransaction = /* @__PURE__ */ __name((hydratedTransaction) => {
|
|
964
|
+
const [tx, txPayloads] = hydratedTransaction;
|
|
965
|
+
return [
|
|
966
|
+
...txPayloads,
|
|
967
|
+
tx
|
|
968
|
+
];
|
|
969
|
+
}, "flattenHydratedTransaction");
|
|
970
|
+
var flattenHydratedTransactions = /* @__PURE__ */ __name((hydratedTransactions) => hydratedTransactions.flatMap((tx) => flattenHydratedTransaction(tx)), "flattenHydratedTransactions");
|
|
971
|
+
var tryHydrateElevatedTransaction = /* @__PURE__ */ __name(async ({ chainMap }, hash) => {
|
|
972
|
+
const hydratedTransaction = await tryHydrateTransaction({
|
|
973
|
+
chainMap
|
|
974
|
+
}, hash);
|
|
975
|
+
if (!hydratedTransaction) {
|
|
976
|
+
return void 0;
|
|
977
|
+
}
|
|
978
|
+
const [transaction, payloads] = hydratedTransaction;
|
|
979
|
+
const opCodes = (transaction.script ?? []).filter((operation) => operation.startsWith("elevate|"));
|
|
980
|
+
const elevatedPayloads2 = [];
|
|
981
|
+
for (const opCode of opCodes) {
|
|
982
|
+
const [code, hash2] = opCode.split("|");
|
|
983
|
+
if (code === "elevated") {
|
|
984
|
+
const elevatedPayload = payloads.find((payload) => payload._hash === hash2);
|
|
985
|
+
if (isAllowedBlockPayload2(elevatedPayload)) {
|
|
986
|
+
elevatedPayloads2.push(elevatedPayload);
|
|
987
|
+
}
|
|
914
988
|
}
|
|
915
989
|
}
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
990
|
+
if (opCodes.length === elevatedPayloads2.length) {
|
|
991
|
+
return [
|
|
992
|
+
transaction,
|
|
993
|
+
elevatedPayloads2
|
|
994
|
+
];
|
|
995
|
+
}
|
|
996
|
+
return void 0;
|
|
997
|
+
}, "tryHydrateElevatedTransaction");
|
|
998
|
+
var hydrateElevatedTransaction = /* @__PURE__ */ __name(async (context, hash) => {
|
|
999
|
+
return assertEx9(await tryHydrateElevatedTransaction(context, hash), () => "Hydration failed");
|
|
1000
|
+
}, "hydrateElevatedTransaction");
|
|
919
1001
|
|
|
920
|
-
// src/
|
|
921
|
-
|
|
1002
|
+
// src/transaction/primitives/transactionBlockByteCount.ts
|
|
1003
|
+
import { PayloadBuilder as PayloadBuilder7 } from "@xyo-network/payload-builder";
|
|
1004
|
+
function transactionBlockByteCount([transaction, payloads]) {
|
|
1005
|
+
const cleanTransaction = PayloadBuilder7.omitStorageMeta(transaction);
|
|
1006
|
+
const transactionBytes = JSON.stringify(cleanTransaction).length;
|
|
1007
|
+
const cleanPayloads = PayloadBuilder7.omitStorageMeta(payloads);
|
|
1008
|
+
return cleanPayloads.reduce((acc, payload) => acc + JSON.stringify(payload).length, 0) + transactionBytes;
|
|
1009
|
+
}
|
|
1010
|
+
__name(transactionBlockByteCount, "transactionBlockByteCount");
|
|
1011
|
+
|
|
1012
|
+
// src/transaction/primitives/transactionElevatedPayloads.ts
|
|
1013
|
+
import { asHash } from "@xylabs/sdk-js";
|
|
1014
|
+
|
|
1015
|
+
// src/transaction/primitives/transactionOperations.ts
|
|
1016
|
+
function crackOperation(operation) {
|
|
1017
|
+
const parts = operation.split("|");
|
|
1018
|
+
if (parts.length < 2) {
|
|
1019
|
+
throw new Error(`Invalid operation format: ${operation}`);
|
|
1020
|
+
}
|
|
1021
|
+
return [
|
|
1022
|
+
parts[0],
|
|
1023
|
+
parts.slice(1)
|
|
1024
|
+
];
|
|
1025
|
+
}
|
|
1026
|
+
__name(crackOperation, "crackOperation");
|
|
1027
|
+
function crackOperations(operations) {
|
|
1028
|
+
return operations.map((op) => crackOperation(op));
|
|
1029
|
+
}
|
|
1030
|
+
__name(crackOperations, "crackOperations");
|
|
1031
|
+
|
|
1032
|
+
// src/transaction/primitives/transactionElevatedPayloads.ts
|
|
1033
|
+
function transactionElevatedPayloadHashes(transaction) {
|
|
1034
|
+
const elevateOperations = crackOperations(transaction.script ?? []).filter((op) => op[0] === "elevate");
|
|
1035
|
+
return elevateOperations.map((op) => asHash(op[1][0], true));
|
|
1036
|
+
}
|
|
1037
|
+
__name(transactionElevatedPayloadHashes, "transactionElevatedPayloadHashes");
|
|
1038
|
+
function transactionElevatedPayloads([transaction, payloads]) {
|
|
1039
|
+
const hashes = transactionElevatedPayloadHashes(transaction);
|
|
1040
|
+
const elevatedPayloads2 = payloads.filter((payload) => hashes.includes(payload._hash));
|
|
1041
|
+
return elevatedPayloads2;
|
|
1042
|
+
}
|
|
1043
|
+
__name(transactionElevatedPayloads, "transactionElevatedPayloads");
|
|
1044
|
+
|
|
1045
|
+
// src/transaction/primitives/transactionRequiredGas.ts
|
|
1046
|
+
import { AttoXL1, TransactionGasCosts } from "@xyo-network/xl1-protocol";
|
|
1047
|
+
function transactionBytesRequiredGas([transaction, payloads]) {
|
|
1048
|
+
const transactionBlockBytes = transactionBlockByteCount([
|
|
1049
|
+
transaction,
|
|
1050
|
+
payloads
|
|
1051
|
+
]);
|
|
1052
|
+
return AttoXL1(TransactionGasCosts.characterStorage * BigInt(transactionBlockBytes));
|
|
1053
|
+
}
|
|
1054
|
+
__name(transactionBytesRequiredGas, "transactionBytesRequiredGas");
|
|
1055
|
+
function transactionRequiredGas(hydratedTransaction) {
|
|
1056
|
+
const elevatedPayloads2 = transactionElevatedPayloads(hydratedTransaction);
|
|
1057
|
+
const hashes = elevatedPayloads2.length + 1;
|
|
1058
|
+
const signatures = hydratedTransaction[0].addresses.length;
|
|
1059
|
+
return AttoXL1(transactionBytesRequiredGas(hydratedTransaction) + TransactionGasCosts.hashValidation * BigInt(hashes) + TransactionGasCosts.signatureValidation * BigInt(signatures) + TransactionGasCosts.payloadValidation * BigInt(elevatedPayloads2.length));
|
|
1060
|
+
}
|
|
1061
|
+
__name(transactionRequiredGas, "transactionRequiredGas");
|
|
1062
|
+
|
|
1063
|
+
// src/transaction/script.ts
|
|
1064
|
+
import { asHash as asHash2 } from "@xylabs/sdk-js";
|
|
1065
|
+
import { assertEx as assertEx10, filterAs } from "@xylabs/sdk-js";
|
|
1066
|
+
import { isAllowedBlockPayloadWithHashMeta } from "@xyo-network/xl1-protocol";
|
|
1067
|
+
var tryExtractElevatedHashesFromScript = /* @__PURE__ */ __name((strings) => {
|
|
1068
|
+
const hashes = strings.filter((str) => str.startsWith("elevate|")).map((str) => str.split("|")[1]);
|
|
1069
|
+
return filterAs(hashes, (h) => asHash2(h));
|
|
1070
|
+
}, "tryExtractElevatedHashesFromScript");
|
|
1071
|
+
var extractElevatedHashesFromScript = /* @__PURE__ */ __name((strings) => {
|
|
1072
|
+
const hashes = strings.filter((str) => str.startsWith("elevate|")).map((str) => str.split("|")[1]);
|
|
1073
|
+
const filtered = filterAs(hashes, (h) => asHash2(h));
|
|
1074
|
+
assertEx10(filtered.length === hashes.length, () => "Invalid elevated hashes");
|
|
1075
|
+
return filtered;
|
|
1076
|
+
}, "extractElevatedHashesFromScript");
|
|
1077
|
+
var tryExtractElevatedHashes = /* @__PURE__ */ __name((tx) => {
|
|
1078
|
+
const [bw, payloads] = tx;
|
|
1079
|
+
const { script } = bw;
|
|
1080
|
+
const hashes = script ? tryExtractElevatedHashesFromScript(script) : [];
|
|
1081
|
+
return payloads.filter((p) => hashes.includes(p._hash)).filter(isAllowedBlockPayloadWithHashMeta);
|
|
1082
|
+
}, "tryExtractElevatedHashes");
|
|
1083
|
+
var extractElevatedHashes = /* @__PURE__ */ __name((tx) => {
|
|
1084
|
+
const [bw, payloads] = tx;
|
|
1085
|
+
const { script } = bw;
|
|
1086
|
+
const hashes = script ? tryExtractElevatedHashesFromScript(script) : [];
|
|
1087
|
+
const filtered = payloads.filter((p) => hashes.includes(p._hash)).filter(isAllowedBlockPayloadWithHashMeta);
|
|
1088
|
+
assertEx10(filtered.length === hashes.length, () => "Invalid elevated hashes");
|
|
1089
|
+
return filtered;
|
|
1090
|
+
}, "extractElevatedHashes");
|
|
1091
|
+
|
|
1092
|
+
// src/transaction/signTransaction.ts
|
|
1093
|
+
import { assertEx as assertEx11, hexFromArrayBuffer, toArrayBuffer } from "@xylabs/sdk-js";
|
|
1094
|
+
import { PayloadBuilder as PayloadBuilder8 } from "@xyo-network/payload-builder";
|
|
1095
|
+
async function signTransaction(tx, account) {
|
|
1096
|
+
assertEx11(tx.from === account.address, () => "Signer address does not match transaction from address");
|
|
1097
|
+
const unsignedTx = structuredClone(tx);
|
|
1098
|
+
unsignedTx.addresses = [
|
|
1099
|
+
account.address
|
|
1100
|
+
];
|
|
1101
|
+
unsignedTx.previous_hashes = [
|
|
1102
|
+
account.previousHash ?? null
|
|
1103
|
+
];
|
|
1104
|
+
const hash = await PayloadBuilder8.dataHash(unsignedTx);
|
|
1105
|
+
const hashBytes = toArrayBuffer(hash);
|
|
1106
|
+
const [signature] = await account.sign(hashBytes);
|
|
1107
|
+
const result = {
|
|
1108
|
+
...unsignedTx,
|
|
1109
|
+
$signatures: [
|
|
1110
|
+
hexFromArrayBuffer(signature)
|
|
1111
|
+
]
|
|
1112
|
+
};
|
|
1113
|
+
return result;
|
|
1114
|
+
}
|
|
1115
|
+
__name(signTransaction, "signTransaction");
|
|
1116
|
+
|
|
1117
|
+
// src/model/PayloadBundle/hydratedTransactionToPayloadBundle.ts
|
|
1118
|
+
var hydratedTransactionToPayloadBundle = /* @__PURE__ */ __name((transaction) => {
|
|
1119
|
+
const root = transaction[0]._hash;
|
|
1120
|
+
return bundle(root, transaction);
|
|
1121
|
+
}, "hydratedTransactionToPayloadBundle");
|
|
1122
|
+
var bundle = /* @__PURE__ */ __name((root, transaction) => {
|
|
1123
|
+
const payloads = flattenHydratedTransaction(transaction).flatMap((p) => PayloadBuilder9.omitStorageMeta(p));
|
|
1124
|
+
return new PayloadBuilder9({
|
|
1125
|
+
schema: PayloadBundleSchema
|
|
1126
|
+
}).fields({
|
|
1127
|
+
payloads,
|
|
1128
|
+
root
|
|
1129
|
+
}).build();
|
|
1130
|
+
}, "bundle");
|
|
1131
|
+
|
|
1132
|
+
// src/block/primitives/blockFromBlockNumber.ts
|
|
1133
|
+
async function blockFromBlockNumber(context, blockNumber) {
|
|
1134
|
+
const cacheKey = `${blockNumber}`;
|
|
1135
|
+
return await withContextCacheResponse(context, "blockFromBlockNumber", cacheKey, async () => {
|
|
1136
|
+
const [headHash] = await context.head();
|
|
1137
|
+
const result = await context.store.chainMap.get(headHash);
|
|
1138
|
+
if (!isDefined9(result)) {
|
|
1139
|
+
throw new Error(`Head block not found for hash: ${headHash}`);
|
|
1140
|
+
}
|
|
1141
|
+
let currentBlock = asSignedBlockBoundWitnessWithStorageMeta(result, () => `Found Payload is not a Signed<BlockBoundWitness>: ${JSON.stringify(result, null, 2)}`);
|
|
1142
|
+
if (currentBlock.block < blockNumber) {
|
|
1143
|
+
throw new Error(`Block number ${blockNumber} is greater than head ${currentBlock.block}.`);
|
|
1144
|
+
}
|
|
1145
|
+
while (currentBlock.block > blockNumber) {
|
|
1146
|
+
let jumpHash = currentBlock.previous;
|
|
1147
|
+
let jumpBlockNumber = currentBlock.block - 1;
|
|
1148
|
+
for (const [step, stepSize2] of StepSizes7.entries()) {
|
|
1149
|
+
const possibleJumpBlockNumber = currentBlock.block - currentBlock.block % stepSize2 - 1;
|
|
1150
|
+
if (possibleJumpBlockNumber >= blockNumber && possibleJumpBlockNumber <= jumpBlockNumber) {
|
|
1151
|
+
jumpBlockNumber = possibleJumpBlockNumber;
|
|
1152
|
+
jumpHash = asHash3(currentBlock.step_hashes?.at(step), () => `Step hash not found for step ${step} in block ${currentBlock.block}`);
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
const newBlock = await context.store.chainMap.get(asHash3(jumpHash, () => `Jump hash not found for block number [${blockNumber}]: ${jumpBlockNumber} ${toSafeJsonString(currentBlock, 10)}`));
|
|
1156
|
+
if (!isDefined9(newBlock)) {
|
|
1157
|
+
throw new Error(`Block not found for jump hash: ${jumpHash}`);
|
|
1158
|
+
}
|
|
1159
|
+
currentBlock = asSignedBlockBoundWitnessWithStorageMeta(newBlock, () => {
|
|
1160
|
+
const result2 = SignedBlockBoundWitnessWithHashMetaZod.safeParse(newBlock);
|
|
1161
|
+
return `Found Payload [jump hash] is not a Signed<BlockBoundWitness>: ${result2.error}`;
|
|
1162
|
+
});
|
|
1163
|
+
if (currentBlock.block === blockNumber) {
|
|
1164
|
+
break;
|
|
1165
|
+
}
|
|
1166
|
+
if (currentBlock.block < blockNumber) {
|
|
1167
|
+
throw new Error(`Block number ${blockNumber} is not a valid step block number for block ${headHash}.`);
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
return currentBlock;
|
|
1171
|
+
});
|
|
1172
|
+
}
|
|
1173
|
+
__name(blockFromBlockNumber, "blockFromBlockNumber");
|
|
1174
|
+
|
|
1175
|
+
// src/block/primitives/frames/calculateFramesFromRange.ts
|
|
1176
|
+
import { asXL1BlockNumber as asXL1BlockNumber4, stepSize } from "@xyo-network/xl1-protocol";
|
|
1177
|
+
function calculateFramesFromRange(range, step) {
|
|
1178
|
+
const size = stepSize(step);
|
|
1179
|
+
let start = Math.trunc(range[0] / size) * size;
|
|
1180
|
+
const fitted = [];
|
|
1181
|
+
const remaining = [];
|
|
1182
|
+
if (start !== range[0]) {
|
|
1183
|
+
start += size;
|
|
1184
|
+
remaining.push([
|
|
1185
|
+
range[0],
|
|
1186
|
+
asXL1BlockNumber4(Math.min(start - 1, range[1]), true)
|
|
1187
|
+
]);
|
|
1188
|
+
}
|
|
1189
|
+
for (let i = start; i <= range[1]; i += size) {
|
|
1190
|
+
if (i + size - 1 <= range[1]) {
|
|
1191
|
+
fitted.push([
|
|
1192
|
+
asXL1BlockNumber4(i, {
|
|
1193
|
+
name: "calculateFramesFromRange A"
|
|
1194
|
+
}),
|
|
1195
|
+
asXL1BlockNumber4(Math.min(i + size - 1, range[1]), {
|
|
1196
|
+
name: "calculateFramesFromRange B"
|
|
1197
|
+
})
|
|
1198
|
+
]);
|
|
1199
|
+
} else {
|
|
1200
|
+
remaining.push([
|
|
1201
|
+
asXL1BlockNumber4(i, {
|
|
1202
|
+
name: "calculateFramesFromRange C"
|
|
1203
|
+
}),
|
|
1204
|
+
range[1]
|
|
1205
|
+
]);
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
return [
|
|
1209
|
+
fitted,
|
|
1210
|
+
remaining
|
|
1211
|
+
];
|
|
1212
|
+
}
|
|
1213
|
+
__name(calculateFramesFromRange, "calculateFramesFromRange");
|
|
1214
|
+
|
|
1215
|
+
// src/block/primitives/frames/deepCalculateFramesFromRange.ts
|
|
1216
|
+
import { StepSizes as StepSizes8 } from "@xyo-network/xl1-protocol";
|
|
1217
|
+
function deepCalculateFramesFromRange(range, startingStep = StepSizes8.length - 1) {
|
|
1218
|
+
const fitted = [];
|
|
1219
|
+
let remaining = [
|
|
1220
|
+
range
|
|
1221
|
+
];
|
|
1222
|
+
for (let step = startingStep; step >= 0; step--) {
|
|
1223
|
+
const newRemaining = [];
|
|
1224
|
+
for (const range2 of remaining) {
|
|
1225
|
+
const [newFittedFrames, newRemainingFrames] = calculateFramesFromRange(range2, step);
|
|
1226
|
+
fitted.push(...newFittedFrames);
|
|
1227
|
+
newRemaining.push(...newRemainingFrames);
|
|
1228
|
+
}
|
|
1229
|
+
remaining = newRemaining;
|
|
1230
|
+
}
|
|
1231
|
+
for (const range2 of remaining) {
|
|
1232
|
+
for (let i = range2[0]; i <= range2[1]; i++) {
|
|
1233
|
+
fitted.push([
|
|
1234
|
+
i,
|
|
1235
|
+
i
|
|
1236
|
+
]);
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
return fitted.toSorted((a, b) => a[0] - b[0]);
|
|
1240
|
+
}
|
|
1241
|
+
__name(deepCalculateFramesFromRange, "deepCalculateFramesFromRange");
|
|
1242
|
+
|
|
1243
|
+
// src/block/primitives/hashFromBlockNumber.ts
|
|
1244
|
+
async function hashFromBlockNumber(context, blockNumber) {
|
|
922
1245
|
return (await blockFromBlockNumber(context, blockNumber))._hash;
|
|
923
1246
|
}
|
|
924
1247
|
__name(hashFromBlockNumber, "hashFromBlockNumber");
|
|
@@ -1040,34 +1363,22 @@ var ApiConfigZod = z2.object({
|
|
|
1040
1363
|
})
|
|
1041
1364
|
});
|
|
1042
1365
|
|
|
1043
|
-
// src/config/
|
|
1366
|
+
// src/config/Bridge.ts
|
|
1044
1367
|
import { globalRegistry as globalRegistry2 } from "zod";
|
|
1045
1368
|
import * as z3 from "zod";
|
|
1046
|
-
var
|
|
1047
|
-
|
|
1048
|
-
default: 3e3,
|
|
1049
|
-
description: "Port for the application",
|
|
1050
|
-
title: "app.port",
|
|
1051
|
-
type: "number"
|
|
1052
|
-
})
|
|
1053
|
-
});
|
|
1054
|
-
|
|
1055
|
-
// src/config/Bridge.ts
|
|
1056
|
-
import { globalRegistry as globalRegistry3 } from "zod";
|
|
1057
|
-
import * as z4 from "zod";
|
|
1058
|
-
var BridgeConfigZod = z4.object({
|
|
1059
|
-
host: z4.string().default("localhost").register(globalRegistry3, {
|
|
1369
|
+
var BridgeConfigZod = z3.object({
|
|
1370
|
+
host: z3.string().default("localhost").register(globalRegistry2, {
|
|
1060
1371
|
default: "localhost",
|
|
1061
1372
|
description: "Host for the Bridge",
|
|
1062
1373
|
title: "api.host",
|
|
1063
1374
|
type: "string"
|
|
1064
1375
|
}),
|
|
1065
|
-
mnemonic: MnemonicStringZod.optional().register(
|
|
1376
|
+
mnemonic: MnemonicStringZod.optional().register(globalRegistry2, {
|
|
1066
1377
|
description: "Mnemonic for the Bridge wallet",
|
|
1067
1378
|
title: "api.mnemonic",
|
|
1068
1379
|
type: "string"
|
|
1069
1380
|
}),
|
|
1070
|
-
port:
|
|
1381
|
+
port: z3.coerce.number().default(8081).register(globalRegistry2, {
|
|
1071
1382
|
default: 8081,
|
|
1072
1383
|
description: "Port for the Bridge",
|
|
1073
1384
|
title: "api.port",
|
|
@@ -1077,15 +1388,15 @@ var BridgeConfigZod = z4.object({
|
|
|
1077
1388
|
|
|
1078
1389
|
// src/config/Chain.ts
|
|
1079
1390
|
import { AddressZod } from "@xylabs/sdk-js";
|
|
1080
|
-
import { globalRegistry as
|
|
1081
|
-
import * as
|
|
1082
|
-
var ChainConfigZod =
|
|
1083
|
-
id:
|
|
1391
|
+
import { globalRegistry as globalRegistry3 } from "zod";
|
|
1392
|
+
import * as z4 from "zod";
|
|
1393
|
+
var ChainConfigZod = z4.object({
|
|
1394
|
+
id: z4.string().optional().register(globalRegistry3, {
|
|
1084
1395
|
description: "The unique identifier for the chain. Should be the staking contract address for contract-backed chains.",
|
|
1085
1396
|
title: "chain.id",
|
|
1086
1397
|
type: "string"
|
|
1087
1398
|
}),
|
|
1088
|
-
genesisRewardAddress: AddressZod.optional().register(
|
|
1399
|
+
genesisRewardAddress: AddressZod.optional().register(globalRegistry3, {
|
|
1089
1400
|
description: "Address to send the initial genesis rewards to, if a new chain is being created.",
|
|
1090
1401
|
title: "chain.genesisRewardAddress",
|
|
1091
1402
|
type: "Address"
|
|
@@ -1093,29 +1404,29 @@ var ChainConfigZod = z5.object({
|
|
|
1093
1404
|
});
|
|
1094
1405
|
|
|
1095
1406
|
// src/config/Evm.ts
|
|
1096
|
-
import { globalRegistry as
|
|
1097
|
-
import * as
|
|
1098
|
-
var EvmInfuraConfigZod =
|
|
1099
|
-
projectId:
|
|
1407
|
+
import { globalRegistry as globalRegistry4 } from "zod";
|
|
1408
|
+
import * as z5 from "zod";
|
|
1409
|
+
var EvmInfuraConfigZod = z5.object({
|
|
1410
|
+
projectId: z5.string().optional().register(globalRegistry4, {
|
|
1100
1411
|
description: "Infura project ID",
|
|
1101
1412
|
title: "evm.infura.projectId",
|
|
1102
1413
|
type: "string"
|
|
1103
1414
|
}),
|
|
1104
|
-
projectSecret:
|
|
1415
|
+
projectSecret: z5.string().optional().register(globalRegistry4, {
|
|
1105
1416
|
description: "Infura project secret",
|
|
1106
1417
|
title: "evm.infura.projectSecret",
|
|
1107
1418
|
type: "string"
|
|
1108
1419
|
})
|
|
1109
1420
|
});
|
|
1110
|
-
var EvmJsonRpcConfigZod =
|
|
1111
|
-
url:
|
|
1421
|
+
var EvmJsonRpcConfigZod = z5.object({
|
|
1422
|
+
url: z5.url().optional().register(globalRegistry4, {
|
|
1112
1423
|
description: "JSON-RPC URL",
|
|
1113
1424
|
title: "evm.jsonRpc.url",
|
|
1114
1425
|
type: "string"
|
|
1115
1426
|
})
|
|
1116
1427
|
});
|
|
1117
|
-
var EvmConfigZod =
|
|
1118
|
-
chainId:
|
|
1428
|
+
var EvmConfigZod = z5.object({
|
|
1429
|
+
chainId: z5.string().optional().register(globalRegistry4, {
|
|
1119
1430
|
description: "EVM chain ID",
|
|
1120
1431
|
title: "evm.chainId",
|
|
1121
1432
|
type: "string"
|
|
@@ -1126,18 +1437,18 @@ var EvmConfigZod = z6.object({
|
|
|
1126
1437
|
|
|
1127
1438
|
// src/config/Log.ts
|
|
1128
1439
|
import { LogLevel } from "@xylabs/sdk-js";
|
|
1129
|
-
import { globalRegistry as
|
|
1130
|
-
import * as
|
|
1440
|
+
import { globalRegistry as globalRegistry5 } from "zod";
|
|
1441
|
+
import * as z6 from "zod";
|
|
1131
1442
|
var LogLevels = Object.keys(LogLevel);
|
|
1132
|
-
var LogConfigZod =
|
|
1133
|
-
logLevel:
|
|
1443
|
+
var LogConfigZod = z6.object({
|
|
1444
|
+
logLevel: z6.enum(LogLevels).default("info").register(globalRegistry5, {
|
|
1134
1445
|
choices: LogLevels,
|
|
1135
1446
|
default: "info",
|
|
1136
1447
|
description: "Desired process verbosity",
|
|
1137
1448
|
title: "logLevel",
|
|
1138
1449
|
type: "string"
|
|
1139
1450
|
}),
|
|
1140
|
-
silent:
|
|
1451
|
+
silent: z6.boolean().default(false).register(globalRegistry5, {
|
|
1141
1452
|
default: false,
|
|
1142
1453
|
description: "Whether to run in silent mode",
|
|
1143
1454
|
title: "silent",
|
|
@@ -1146,10 +1457,10 @@ var LogConfigZod = z7.object({
|
|
|
1146
1457
|
});
|
|
1147
1458
|
|
|
1148
1459
|
// src/config/Mempool.ts
|
|
1149
|
-
import { globalRegistry as
|
|
1150
|
-
import * as
|
|
1151
|
-
var MempoolConfigZod =
|
|
1152
|
-
enabled:
|
|
1460
|
+
import { globalRegistry as globalRegistry6 } from "zod";
|
|
1461
|
+
import * as z7 from "zod";
|
|
1462
|
+
var MempoolConfigZod = z7.object({
|
|
1463
|
+
enabled: z7.string().default("false").transform((val, ctx) => {
|
|
1153
1464
|
const normalized = val.toLowerCase().trim();
|
|
1154
1465
|
if ([
|
|
1155
1466
|
"true",
|
|
@@ -1168,25 +1479,25 @@ var MempoolConfigZod = z8.object({
|
|
|
1168
1479
|
expected: "boolean",
|
|
1169
1480
|
message: `Invalid boolean value: "${val}". Use true/false, 1/0, yes/no.`
|
|
1170
1481
|
});
|
|
1171
|
-
return
|
|
1172
|
-
}).register(
|
|
1482
|
+
return z7.NEVER;
|
|
1483
|
+
}).register(globalRegistry6, {
|
|
1173
1484
|
default: "false",
|
|
1174
1485
|
description: "Enable the Mempool",
|
|
1175
1486
|
title: "mempool.enabled",
|
|
1176
1487
|
type: "boolean"
|
|
1177
1488
|
}),
|
|
1178
|
-
host:
|
|
1489
|
+
host: z7.string().default("localhost").register(globalRegistry6, {
|
|
1179
1490
|
default: "localhost",
|
|
1180
1491
|
description: "Host for the Mempool",
|
|
1181
1492
|
title: "mempool.host",
|
|
1182
1493
|
type: "string"
|
|
1183
1494
|
}),
|
|
1184
|
-
mnemonic: MnemonicStringZod.optional().register(
|
|
1495
|
+
mnemonic: MnemonicStringZod.optional().register(globalRegistry6, {
|
|
1185
1496
|
description: "Mnemonic for the Mempool wallet",
|
|
1186
1497
|
title: "mempool.mnemonic",
|
|
1187
1498
|
type: "string"
|
|
1188
1499
|
}),
|
|
1189
|
-
port:
|
|
1500
|
+
port: z7.coerce.number().default(8083).register(globalRegistry6, {
|
|
1190
1501
|
default: 8083,
|
|
1191
1502
|
description: "Port for the Mempool",
|
|
1192
1503
|
title: "mempool.port",
|
|
@@ -1196,60 +1507,55 @@ var MempoolConfigZod = z8.object({
|
|
|
1196
1507
|
|
|
1197
1508
|
// src/config/Producer.ts
|
|
1198
1509
|
import { AddressZod as AddressZod2, asAddress as asAddress3 } from "@xylabs/sdk-js";
|
|
1199
|
-
import { globalRegistry as
|
|
1200
|
-
import * as
|
|
1201
|
-
var ProducerConfigZod =
|
|
1202
|
-
allowlist:
|
|
1510
|
+
import { globalRegistry as globalRegistry7 } from "zod";
|
|
1511
|
+
import * as z8 from "zod";
|
|
1512
|
+
var ProducerConfigZod = z8.object({
|
|
1513
|
+
allowlist: z8.preprocess((val) => {
|
|
1203
1514
|
if (typeof val === "string") {
|
|
1204
1515
|
return val.split(",").map((s) => asAddress3(s.trim()));
|
|
1205
1516
|
}
|
|
1206
1517
|
return val;
|
|
1207
|
-
},
|
|
1518
|
+
}, z8.array(AddressZod2).optional().register(globalRegistry7, {
|
|
1208
1519
|
description: "List of allowed producer addresses, if undefined anyone can participate",
|
|
1209
1520
|
title: "allowlist",
|
|
1210
1521
|
type: "array"
|
|
1211
1522
|
})),
|
|
1212
|
-
|
|
1213
|
-
description: "Endpoint of the API to use for chain data",
|
|
1214
|
-
title: "producer.apiEndpoint",
|
|
1215
|
-
type: "string"
|
|
1216
|
-
}),
|
|
1217
|
-
disableIntentRedeclaration: z9.boolean().optional().register(globalRegistry8, {
|
|
1523
|
+
disableIntentRedeclaration: z8.boolean().optional().register(globalRegistry7, {
|
|
1218
1524
|
description: "Should the producer skip redeclaring their intent to continue producing blocks",
|
|
1219
1525
|
title: "producer.disableIntentRedeclaration",
|
|
1220
1526
|
type: "boolean"
|
|
1221
1527
|
}),
|
|
1222
1528
|
// TODO: Port schema
|
|
1223
|
-
healthCheckPort:
|
|
1529
|
+
healthCheckPort: z8.coerce.number().optional().register(globalRegistry7, {
|
|
1224
1530
|
description: "Port for the Producer health checks",
|
|
1225
1531
|
title: "producer.healthCheckPort",
|
|
1226
1532
|
type: "number"
|
|
1227
1533
|
}),
|
|
1228
|
-
heartbeatInterval:
|
|
1534
|
+
heartbeatInterval: z8.coerce.number().default(36e5).register(globalRegistry7, {
|
|
1229
1535
|
description: "The number of milliseconds between heartbeats if no blocks are produced",
|
|
1230
1536
|
title: "producer.heartbeatInterval",
|
|
1231
1537
|
type: "number"
|
|
1232
1538
|
}),
|
|
1233
1539
|
// TODO: BigInt schema
|
|
1234
|
-
minStake:
|
|
1540
|
+
minStake: z8.coerce.number().default(1).register(globalRegistry7, {
|
|
1235
1541
|
description: "Minimum stake required to be a Producer",
|
|
1236
1542
|
title: "producer.minStake",
|
|
1237
1543
|
type: "number"
|
|
1238
1544
|
}),
|
|
1239
|
-
mnemonic: MnemonicStringZod.optional().register(
|
|
1545
|
+
mnemonic: MnemonicStringZod.optional().register(globalRegistry7, {
|
|
1240
1546
|
description: "Mnemonic for the Producer wallet",
|
|
1241
1547
|
title: "producer.mnemonic",
|
|
1242
1548
|
type: "string"
|
|
1243
1549
|
}),
|
|
1244
1550
|
// TODO: Port schema
|
|
1245
|
-
port:
|
|
1551
|
+
port: z8.coerce.number().default(8081).register(globalRegistry7, {
|
|
1246
1552
|
default: 8081,
|
|
1247
1553
|
description: "Port for the Producer",
|
|
1248
1554
|
title: "producer.port",
|
|
1249
1555
|
type: "number"
|
|
1250
1556
|
}),
|
|
1251
1557
|
// TODO: Address schema
|
|
1252
|
-
rewardAddress:
|
|
1558
|
+
rewardAddress: z8.string().optional().register(globalRegistry7, {
|
|
1253
1559
|
description: "Address to receive block rewards",
|
|
1254
1560
|
title: "producer.rewardAddress",
|
|
1255
1561
|
type: "string"
|
|
@@ -1257,27 +1563,27 @@ var ProducerConfigZod = z9.object({
|
|
|
1257
1563
|
});
|
|
1258
1564
|
|
|
1259
1565
|
// src/config/RewardRedemptionApi.ts
|
|
1260
|
-
import { globalRegistry as
|
|
1261
|
-
import * as
|
|
1262
|
-
var RewardRedemptionApiConfigZod =
|
|
1263
|
-
chainRpcApiUrl:
|
|
1566
|
+
import { globalRegistry as globalRegistry8 } from "zod";
|
|
1567
|
+
import * as z9 from "zod";
|
|
1568
|
+
var RewardRedemptionApiConfigZod = z9.object({
|
|
1569
|
+
chainRpcApiUrl: z9.string().default("http://localhost:8080/rpc").register(globalRegistry8, {
|
|
1264
1570
|
default: "http://localhost:8080/rpc",
|
|
1265
1571
|
description: "URL for the Chain RPC API",
|
|
1266
1572
|
title: "rewardRedemptionApi.chainRpcApiUrl",
|
|
1267
1573
|
type: "string"
|
|
1268
1574
|
}),
|
|
1269
|
-
host:
|
|
1575
|
+
host: z9.string().default("localhost").register(globalRegistry8, {
|
|
1270
1576
|
default: "localhost",
|
|
1271
1577
|
description: "Host for the Redemption API",
|
|
1272
1578
|
title: "rewardRedemptionApi.host",
|
|
1273
1579
|
type: "string"
|
|
1274
1580
|
}),
|
|
1275
|
-
mnemonic: MnemonicStringZod.optional().register(
|
|
1581
|
+
mnemonic: MnemonicStringZod.optional().register(globalRegistry8, {
|
|
1276
1582
|
description: "Mnemonic for the Redemption API wallet",
|
|
1277
1583
|
title: "rewardRedemptionApi.mnemonic",
|
|
1278
1584
|
type: "string"
|
|
1279
1585
|
}),
|
|
1280
|
-
port:
|
|
1586
|
+
port: z9.coerce.number().default(8082).register(globalRegistry8, {
|
|
1281
1587
|
default: 8082,
|
|
1282
1588
|
description: "Port for the Redemption API",
|
|
1283
1589
|
title: "rewardRedemptionApi.port",
|
|
@@ -1285,13 +1591,29 @@ var RewardRedemptionApiConfigZod = z10.object({
|
|
|
1285
1591
|
})
|
|
1286
1592
|
});
|
|
1287
1593
|
|
|
1594
|
+
// src/config/Services.ts
|
|
1595
|
+
import { globalRegistry as globalRegistry9 } from "zod";
|
|
1596
|
+
import * as z10 from "zod";
|
|
1597
|
+
var ServicesConfigZod = z10.object({
|
|
1598
|
+
accountBalanceViewerEndpoint: z10.string().optional().register(globalRegistry9, {
|
|
1599
|
+
description: "Endpoint of the API to use for instantiating an external AccountBalanceViewer",
|
|
1600
|
+
title: "services.accountBalanceViewerEndpoint",
|
|
1601
|
+
type: "string"
|
|
1602
|
+
}),
|
|
1603
|
+
apiEndpoint: z10.string().optional().register(globalRegistry9, {
|
|
1604
|
+
description: "Endpoint of the API to use for instantiating an external Viewers",
|
|
1605
|
+
title: "services.apiEndpoint",
|
|
1606
|
+
type: "string"
|
|
1607
|
+
})
|
|
1608
|
+
});
|
|
1609
|
+
|
|
1288
1610
|
// src/config/storage/driver/Mongo.ts
|
|
1289
|
-
import { isDefined as
|
|
1611
|
+
import { isDefined as isDefined10, isUndefined as isUndefined2 } from "@xylabs/sdk-js";
|
|
1290
1612
|
import { globalRegistry as globalRegistry10 } from "zod";
|
|
1291
1613
|
import * as z11 from "zod";
|
|
1292
1614
|
var hasMongoConfig = /* @__PURE__ */ __name((config) => {
|
|
1293
1615
|
if (isUndefined2(config)) return false;
|
|
1294
|
-
return
|
|
1616
|
+
return isDefined10(config.connectionString) && isDefined10(config.database) && isDefined10(config.domain) && isDefined10(config.password) && isDefined10(config.username);
|
|
1295
1617
|
}, "hasMongoConfig");
|
|
1296
1618
|
var MongoConfigZod = z11.object({
|
|
1297
1619
|
// TODO: Create from other arguments
|
|
@@ -1337,6 +1659,23 @@ var StorageConfigZod = z12.object({
|
|
|
1337
1659
|
// src/config/Telemetry.ts
|
|
1338
1660
|
import { globalRegistry as globalRegistry12 } from "zod";
|
|
1339
1661
|
import * as z13 from "zod";
|
|
1662
|
+
var MetricsScrapeConfigZod = z13.object({
|
|
1663
|
+
path: z13.string().default("/metrics").register(globalRegistry12, {
|
|
1664
|
+
default: "/metrics",
|
|
1665
|
+
description: "Path for the metrics scrape endpoint",
|
|
1666
|
+
title: "telemetry.metrics.scrape.path",
|
|
1667
|
+
type: "string"
|
|
1668
|
+
}),
|
|
1669
|
+
port: z13.coerce.number().default(9464).register(globalRegistry12, {
|
|
1670
|
+
default: 9464,
|
|
1671
|
+
description: "Port for the metrics scrape endpoint",
|
|
1672
|
+
title: "telemetry.metrics.scrape.port",
|
|
1673
|
+
type: "number"
|
|
1674
|
+
})
|
|
1675
|
+
}).describe("Metrics scrape configuration");
|
|
1676
|
+
var MetricsConfigZod = z13.object({
|
|
1677
|
+
scrape: MetricsScrapeConfigZod
|
|
1678
|
+
}).describe("Metrics configuration options");
|
|
1340
1679
|
var OpenTelemetryConfigZod = z13.object({
|
|
1341
1680
|
// OpenTelemetry options
|
|
1342
1681
|
otlpEndpoint: z13.url().optional().register(globalRegistry12, {
|
|
@@ -1346,6 +1685,8 @@ var OpenTelemetryConfigZod = z13.object({
|
|
|
1346
1685
|
})
|
|
1347
1686
|
});
|
|
1348
1687
|
var TelemetryConfigZod = z13.object({
|
|
1688
|
+
// Metrics configuration
|
|
1689
|
+
metrics: MetricsConfigZod.optional().describe("Metrics configuration"),
|
|
1349
1690
|
// OpenTelemetry configuration
|
|
1350
1691
|
otel: OpenTelemetryConfigZod.optional().describe("OpenTelemetry configuration")
|
|
1351
1692
|
}).describe("Telemetry configuration options");
|
|
@@ -1384,13 +1725,13 @@ var Xl1CommonConfigSchema = z15.object({
|
|
|
1384
1725
|
var ConfigZod = z15.object({
|
|
1385
1726
|
...Xl1CommonConfigSchema.shape,
|
|
1386
1727
|
api: ApiConfigZod.default(ApiConfigZod.parse({})).describe("Configuration for the API node"),
|
|
1387
|
-
app: AppConfigZod.default(AppConfigZod.parse({})).describe("Configuration for the application"),
|
|
1388
1728
|
bridge: BridgeConfigZod.default(BridgeConfigZod.parse({})).describe("Configuration for the Bridge node"),
|
|
1389
1729
|
chain: ChainConfigZod.default(ChainConfigZod.parse({})).describe("Configuration for the chain"),
|
|
1390
1730
|
evm: EvmConfigZod.default(EvmConfigZod.parse({})).describe("Configuration for EVM-backed services"),
|
|
1391
1731
|
mempool: MempoolConfigZod.default(MempoolConfigZod.parse({})).describe("Configuration for the mempool"),
|
|
1392
1732
|
producer: ProducerConfigZod.default(ProducerConfigZod.parse({})).describe("Configuration for the producer"),
|
|
1393
1733
|
rewardRedemptionApi: RewardRedemptionApiConfigZod.default(RewardRedemptionApiConfigZod.parse({})).describe("Configuration for the rewards redemption API"),
|
|
1734
|
+
services: ServicesConfigZod.default(ServicesConfigZod.parse({})).describe("Configuration for the global services"),
|
|
1394
1735
|
storage: StorageConfigZod.default(StorageConfigZod.parse({})).describe("Configuration for the storage"),
|
|
1395
1736
|
telemetry: TelemetryConfigZod.default(TelemetryConfigZod.parse({})).describe("Configuration for telemetry"),
|
|
1396
1737
|
validation: ValidationConfigZod.default(ValidationConfigZod.parse({})).describe("Configuration for validation")
|
|
@@ -1490,11 +1831,11 @@ var isEIP712SignaturePayload = isPayloadOfZodType2(EIP712SignaturePayloadFieldsZ
|
|
|
1490
1831
|
var asEIP712SignaturePayload = AsObjectFactory6.create(isEIP712SignaturePayload);
|
|
1491
1832
|
|
|
1492
1833
|
// src/eip-712/sign.ts
|
|
1493
|
-
import { PayloadBuilder as
|
|
1834
|
+
import { PayloadBuilder as PayloadBuilder10 } from "@xyo-network/payload-builder";
|
|
1494
1835
|
var signEIP712Message = /* @__PURE__ */ __name(async (signer, data) => {
|
|
1495
1836
|
const { domain, types, values } = data;
|
|
1496
1837
|
const signature = await signer.signTypedData(domain, types, values);
|
|
1497
|
-
const hash = await
|
|
1838
|
+
const hash = await PayloadBuilder10.hash(data);
|
|
1498
1839
|
const address = await signer.getAddress();
|
|
1499
1840
|
return {
|
|
1500
1841
|
address,
|
|
@@ -1505,14 +1846,14 @@ var signEIP712Message = /* @__PURE__ */ __name(async (signer, data) => {
|
|
|
1505
1846
|
}, "signEIP712Message");
|
|
1506
1847
|
|
|
1507
1848
|
// src/eip-712/verify.ts
|
|
1508
|
-
import { asHash as
|
|
1509
|
-
import { PayloadBuilder as
|
|
1849
|
+
import { asHash as asHash4, isUndefined as isUndefined3 } from "@xylabs/sdk-js";
|
|
1850
|
+
import { PayloadBuilder as PayloadBuilder11 } from "@xyo-network/payload-builder";
|
|
1510
1851
|
import { verifyTypedData } from "ethers/hash";
|
|
1511
1852
|
var verifyEIP712Message = /* @__PURE__ */ __name(async (data, sig) => {
|
|
1512
1853
|
const { address, signature, hash } = sig;
|
|
1513
1854
|
const { schema, ...fields } = data;
|
|
1514
|
-
const signedHash =
|
|
1515
|
-
if (isUndefined3(signedHash) || signedHash !== await
|
|
1855
|
+
const signedHash = asHash4(hash);
|
|
1856
|
+
if (isUndefined3(signedHash) || signedHash !== await PayloadBuilder11.hash(data)) return false;
|
|
1516
1857
|
const recoveredAddress = verifyTypedData(fields.domain, fields.types, fields.values, signature);
|
|
1517
1858
|
return recoveredAddress.toLowerCase() === address.toLowerCase();
|
|
1518
1859
|
}, "verifyEIP712Message");
|
|
@@ -1541,26 +1882,35 @@ var isChainIndexingServiceStateWithStorageMeta = /* @__PURE__ */ __name((value)
|
|
|
1541
1882
|
var asChainIndexingServiceStateWithStorageMeta = AsObjectFactory7.create(isChainIndexingServiceStateWithStorageMeta);
|
|
1542
1883
|
|
|
1543
1884
|
// src/simple/accountBalance/SimpleAccountBalanceViewer.ts
|
|
1544
|
-
import { assertEx as
|
|
1885
|
+
import { AbstractCreatable, assertEx as assertEx12, exists, isDefined as isDefined11 } from "@xylabs/sdk-js";
|
|
1545
1886
|
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";
|
|
1547
|
-
var SimpleAccountBalanceViewer = class {
|
|
1887
|
+
import { asRange, asXL1BlockNumber as asXL1BlockNumber5, asXL1BlockRange as asXL1BlockRange5, AttoXL1 as AttoXL12, StepSizes as StepSizes9, TransferSchema } from "@xyo-network/xl1-protocol";
|
|
1888
|
+
var SimpleAccountBalanceViewer = class extends AbstractCreatable {
|
|
1548
1889
|
static {
|
|
1549
1890
|
__name(this, "SimpleAccountBalanceViewer");
|
|
1550
1891
|
}
|
|
1551
|
-
blockViewer
|
|
1552
|
-
|
|
1553
|
-
transferContext;
|
|
1554
|
-
constructor(context, transferContext, blockViewer) {
|
|
1555
|
-
this.context = context;
|
|
1556
|
-
this.transferContext = transferContext;
|
|
1557
|
-
this.blockViewer = blockViewer;
|
|
1892
|
+
get blockViewer() {
|
|
1893
|
+
return this.params.blockViewer;
|
|
1558
1894
|
}
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
return
|
|
1895
|
+
get context() {
|
|
1896
|
+
return this.params.context;
|
|
1897
|
+
}
|
|
1898
|
+
get transferContext() {
|
|
1899
|
+
return this.params.transferContext;
|
|
1900
|
+
}
|
|
1901
|
+
static async paramsHandler(params) {
|
|
1902
|
+
assertEx12(params.blockViewer, () => "blockViewer is required");
|
|
1903
|
+
assertEx12(params.context, () => "context is required");
|
|
1904
|
+
assertEx12(params.transferContext, () => "transferContext is required");
|
|
1905
|
+
return {
|
|
1906
|
+
...await super.paramsHandler(params)
|
|
1907
|
+
};
|
|
1908
|
+
}
|
|
1909
|
+
async accountBalance(address, headOrRange) {
|
|
1910
|
+
const balances = await this.accountsBalances([
|
|
1911
|
+
address
|
|
1912
|
+
], headOrRange);
|
|
1913
|
+
return balances[address] ?? AttoXL12(0n);
|
|
1564
1914
|
}
|
|
1565
1915
|
async accountBalanceHistory(address, headOrRange) {
|
|
1566
1916
|
const range = asRange(headOrRange);
|
|
@@ -1575,8 +1925,8 @@ var SimpleAccountBalanceViewer = class {
|
|
|
1575
1925
|
const transferIndexes = block[0].payload_schemas.map((schema, index) => schema === TransferSchema ? index : void 0).filter(exists);
|
|
1576
1926
|
const transfers = transferIndexes.map((index) => {
|
|
1577
1927
|
const hash = block[0].payload_hashes[index];
|
|
1578
|
-
return
|
|
1579
|
-
}).filter(exists).filter((t) => t.from === address ||
|
|
1928
|
+
return assertEx12(block[1].find((p) => p._hash === hash), () => `Error: Could not find Transfer with hash ${hash} in block ${block[0]._hash}`);
|
|
1929
|
+
}).filter(exists).filter((t) => t.from === address || isDefined11(t.transfers[address]));
|
|
1580
1930
|
if (transfers.length === 0) {
|
|
1581
1931
|
continue;
|
|
1582
1932
|
}
|
|
@@ -1600,7 +1950,7 @@ var SimpleAccountBalanceViewer = class {
|
|
|
1600
1950
|
const result = {};
|
|
1601
1951
|
for (const addr of address) {
|
|
1602
1952
|
const summaryBalance = summary[addr] ?? 0n;
|
|
1603
|
-
result[addr] =
|
|
1953
|
+
result[addr] = AttoXL12(summaryBalance < 0n ? 0n : summaryBalance);
|
|
1604
1954
|
}
|
|
1605
1955
|
return result;
|
|
1606
1956
|
});
|
|
@@ -1653,11 +2003,11 @@ var SimpleAccountBalanceViewer = class {
|
|
|
1653
2003
|
|
|
1654
2004
|
// src/simple/chainStake/SimpleChainStakeViewer.ts
|
|
1655
2005
|
import { asAddress as asAddress5, toAddress as toAddress5 } from "@xylabs/sdk-js";
|
|
1656
|
-
import { AbstractCreatable as
|
|
2006
|
+
import { AbstractCreatable as AbstractCreatable3, assertEx as assertEx13, creatable as creatable2 } from "@xylabs/sdk-js";
|
|
1657
2007
|
import { Account } from "@xyo-network/account";
|
|
1658
2008
|
|
|
1659
2009
|
// src/simple/chainStakeEvents/SimpleChainStakeEventsViewer.ts
|
|
1660
|
-
import { AbstractCreatable, creatable, isDefined as
|
|
2010
|
+
import { AbstractCreatable as AbstractCreatable2, creatable, isDefined as isDefined12 } from "@xylabs/sdk-js";
|
|
1661
2011
|
function _ts_decorate(decorators, target, key, desc) {
|
|
1662
2012
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1663
2013
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1665,7 +2015,7 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
1665
2015
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1666
2016
|
}
|
|
1667
2017
|
__name(_ts_decorate, "_ts_decorate");
|
|
1668
|
-
var SimpleChainStakeEventsViewer = class extends
|
|
2018
|
+
var SimpleChainStakeEventsViewer = class extends AbstractCreatable2 {
|
|
1669
2019
|
static {
|
|
1670
2020
|
__name(this, "SimpleChainStakeEventsViewer");
|
|
1671
2021
|
}
|
|
@@ -1678,7 +2028,7 @@ var SimpleChainStakeEventsViewer = class extends AbstractCreatable {
|
|
|
1678
2028
|
stakeEvents(range, { name } = {}) {
|
|
1679
2029
|
const positions = this.positionsFromRange(range);
|
|
1680
2030
|
const events = this.eventsFromPositions(positions);
|
|
1681
|
-
if (
|
|
2031
|
+
if (isDefined12(name)) {
|
|
1682
2032
|
return events.filter((event) => event.name === name);
|
|
1683
2033
|
}
|
|
1684
2034
|
return events;
|
|
@@ -1749,14 +2099,14 @@ function _ts_decorate2(decorators, target, key, desc) {
|
|
|
1749
2099
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1750
2100
|
}
|
|
1751
2101
|
__name(_ts_decorate2, "_ts_decorate");
|
|
1752
|
-
var SimpleChainStakeViewer = class extends
|
|
2102
|
+
var SimpleChainStakeViewer = class extends AbstractCreatable3 {
|
|
1753
2103
|
static {
|
|
1754
2104
|
__name(this, "SimpleChainStakeViewer");
|
|
1755
2105
|
}
|
|
1756
2106
|
_chainId;
|
|
1757
2107
|
_chainStakeEventsViewer;
|
|
1758
2108
|
get chainId() {
|
|
1759
|
-
return
|
|
2109
|
+
return assertEx13(this._chainId, () => "Chain ID not set");
|
|
1760
2110
|
}
|
|
1761
2111
|
get chainMap() {
|
|
1762
2112
|
return this.params.chainMap;
|
|
@@ -1768,7 +2118,7 @@ var SimpleChainStakeViewer = class extends AbstractCreatable2 {
|
|
|
1768
2118
|
return toAddress5(toAddress5(1n));
|
|
1769
2119
|
}
|
|
1770
2120
|
get stakeEvents() {
|
|
1771
|
-
return
|
|
2121
|
+
return assertEx13(this._chainStakeEventsViewer, () => "Stake events viewer not set");
|
|
1772
2122
|
}
|
|
1773
2123
|
get stakingTokenAddress() {
|
|
1774
2124
|
return toAddress5("0x000000000000000000000000000011");
|
|
@@ -1822,7 +2172,7 @@ var SimpleChainStakeViewer = class extends AbstractCreatable2 {
|
|
|
1822
2172
|
return pending;
|
|
1823
2173
|
}
|
|
1824
2174
|
stakeById(id) {
|
|
1825
|
-
return
|
|
2175
|
+
return assertEx13(this.positions[id], () => new Error(`Stake with id ${id} not found`));
|
|
1826
2176
|
}
|
|
1827
2177
|
stakeByStaker(staker, slot) {
|
|
1828
2178
|
return this.positions.filter((s) => asAddress5(s.staker) === asAddress5(staker))[slot];
|
|
@@ -1989,301 +2339,9 @@ var SimpleXyoGateway = class {
|
|
|
1989
2339
|
};
|
|
1990
2340
|
|
|
1991
2341
|
// src/simple/gateway/SimpleXyoGatewayRunner.ts
|
|
1992
|
-
import { assertEx as assertEx14, BigIntToJsonZod, isDefined as
|
|
1993
|
-
import { PayloadBuilder as
|
|
1994
|
-
import { TransferSchema as TransferSchema2 } from "@xyo-network/xl1-protocol";
|
|
1995
|
-
|
|
1996
|
-
// src/transaction/buildTransaction.ts
|
|
1997
|
-
import { assertEx as assertEx10, toHex as toHex2 } from "@xylabs/sdk-js";
|
|
1998
|
-
import { BoundWitnessBuilder } from "@xyo-network/boundwitness-builder";
|
|
1999
|
-
import { PayloadBuilder as PayloadBuilder6 } from "@xyo-network/payload-builder";
|
|
2000
|
-
import { defaultTransactionFees } from "@xyo-network/xl1-protocol";
|
|
2001
|
-
async function buildTransaction(chain, onChainPayloads, offChainPayloads, signer, nbf, exp, from, fees = defaultTransactionFees) {
|
|
2002
|
-
if (from === void 0 && Array.isArray(signer)) {
|
|
2003
|
-
throw new Error("from is required when signer is an array");
|
|
2004
|
-
}
|
|
2005
|
-
const txBoundWitnessFields = {
|
|
2006
|
-
chain,
|
|
2007
|
-
fees: {
|
|
2008
|
-
base: toHex2(fees.base),
|
|
2009
|
-
gasLimit: toHex2(fees.gasLimit),
|
|
2010
|
-
gasPrice: toHex2(fees.gasPrice),
|
|
2011
|
-
priority: toHex2(fees.priority)
|
|
2012
|
-
},
|
|
2013
|
-
nbf,
|
|
2014
|
-
exp
|
|
2015
|
-
};
|
|
2016
|
-
const elevatedHashes = await PayloadBuilder6.hashes(onChainPayloads);
|
|
2017
|
-
const script = [];
|
|
2018
|
-
for (const elevatedHash of elevatedHashes) {
|
|
2019
|
-
script.push(`elevate|${elevatedHash}`);
|
|
2020
|
-
}
|
|
2021
|
-
const fields = {
|
|
2022
|
-
...txBoundWitnessFields,
|
|
2023
|
-
from: from ?? (Array.isArray(signer) ? assertEx10(signer.at(0)?.address) : signer.address)
|
|
2024
|
-
};
|
|
2025
|
-
if (script.length > 0) {
|
|
2026
|
-
fields.script = script;
|
|
2027
|
-
}
|
|
2028
|
-
const [tx, txPayloads] = await new BoundWitnessBuilder().fields(fields).meta({
|
|
2029
|
-
$signatures: []
|
|
2030
|
-
}).payloads([
|
|
2031
|
-
...onChainPayloads,
|
|
2032
|
-
...offChainPayloads
|
|
2033
|
-
]).signers(Array.isArray(signer) ? signer : [
|
|
2034
|
-
signer
|
|
2035
|
-
]).build();
|
|
2036
|
-
return [
|
|
2037
|
-
await PayloadBuilder6.addStorageMeta(tx),
|
|
2038
|
-
await PayloadBuilder6.addStorageMeta(txPayloads)
|
|
2039
|
-
];
|
|
2040
|
-
}
|
|
2041
|
-
__name(buildTransaction, "buildTransaction");
|
|
2042
|
-
|
|
2043
|
-
// src/transaction/buildUnsignedTransaction.ts
|
|
2044
|
-
import { toHex as toHex3 } from "@xylabs/sdk-js";
|
|
2045
|
-
import { BoundWitnessBuilder as BoundWitnessBuilder2 } from "@xyo-network/boundwitness-builder";
|
|
2046
|
-
import { PayloadBuilder as PayloadBuilder7 } from "@xyo-network/payload-builder";
|
|
2047
|
-
import { defaultTransactionFees as defaultTransactionFees2 } from "@xyo-network/xl1-protocol";
|
|
2048
|
-
async function buildUnsignedTransaction(chain, onChainPayloads, offChainPayloads, nbf, exp, from, fees = defaultTransactionFees2) {
|
|
2049
|
-
const txBoundWitnessFields = {
|
|
2050
|
-
chain,
|
|
2051
|
-
fees: {
|
|
2052
|
-
base: toHex3(fees.base),
|
|
2053
|
-
gasLimit: toHex3(fees.gasLimit),
|
|
2054
|
-
gasPrice: toHex3(fees.gasPrice),
|
|
2055
|
-
priority: toHex3(fees.priority)
|
|
2056
|
-
},
|
|
2057
|
-
nbf,
|
|
2058
|
-
exp
|
|
2059
|
-
};
|
|
2060
|
-
const elevatedHashes = await PayloadBuilder7.hashes(onChainPayloads);
|
|
2061
|
-
const script = [];
|
|
2062
|
-
for (const elevatedHash of elevatedHashes) {
|
|
2063
|
-
script.push(`elevate|${elevatedHash}`);
|
|
2064
|
-
}
|
|
2065
|
-
const fields = {
|
|
2066
|
-
...txBoundWitnessFields,
|
|
2067
|
-
from
|
|
2068
|
-
};
|
|
2069
|
-
if (script.length > 0) {
|
|
2070
|
-
fields.script = script;
|
|
2071
|
-
}
|
|
2072
|
-
const [tx, txPayloads] = await new BoundWitnessBuilder2().fields(fields).meta({
|
|
2073
|
-
$signatures: []
|
|
2074
|
-
}).payloads([
|
|
2075
|
-
...onChainPayloads,
|
|
2076
|
-
...offChainPayloads
|
|
2077
|
-
]).build();
|
|
2078
|
-
return [
|
|
2079
|
-
tx,
|
|
2080
|
-
txPayloads
|
|
2081
|
-
];
|
|
2082
|
-
}
|
|
2083
|
-
__name(buildUnsignedTransaction, "buildUnsignedTransaction");
|
|
2084
|
-
|
|
2085
|
-
// src/transaction/confirmSubmittedTransaction.ts
|
|
2086
|
-
import { delay, isDefined as isDefined11 } from "@xylabs/sdk-js";
|
|
2087
|
-
var DEFAULT_CONFIRMATION_ATTEMPTS = 20;
|
|
2088
|
-
var DEFAULT_DELAY_BETWEEN_ATTEMPTS = 1e3;
|
|
2089
|
-
var confirmSubmittedTransaction = /* @__PURE__ */ __name(async (viewer, txHash, options) => {
|
|
2090
|
-
const { attempts: maxAttempts = DEFAULT_CONFIRMATION_ATTEMPTS, delay: attemptDelay = DEFAULT_DELAY_BETWEEN_ATTEMPTS } = options ?? {};
|
|
2091
|
-
options?.logger?.log("\u{1F680} confirming transaction:", txHash, "\n");
|
|
2092
|
-
let attempts = 0;
|
|
2093
|
-
while (true) {
|
|
2094
|
-
const tx = await viewer.transactionByHash(txHash) ?? void 0;
|
|
2095
|
-
if (isDefined11(tx)) {
|
|
2096
|
-
options?.logger?.log("\u2705 Transaction confirmed:", txHash, "\n");
|
|
2097
|
-
return tx;
|
|
2098
|
-
} else {
|
|
2099
|
-
attempts++;
|
|
2100
|
-
if (attempts > maxAttempts) {
|
|
2101
|
-
options?.logger?.error(`\u26A0\uFE0F Transaction not confirmed after ${maxAttempts} attempts`);
|
|
2102
|
-
throw new Error(`Transaction ${txHash} not confirmed after ${maxAttempts} attempts`);
|
|
2103
|
-
} else {
|
|
2104
|
-
options?.logger?.log(`\u{1F504} Transaction not confirmed yet, attempt ${attempts}. Retrying...`, "\n");
|
|
2105
|
-
await delay(attemptDelay);
|
|
2106
|
-
}
|
|
2107
|
-
}
|
|
2108
|
-
}
|
|
2109
|
-
}, "confirmSubmittedTransaction");
|
|
2110
|
-
|
|
2111
|
-
// src/transaction/hydrateTransaction.ts
|
|
2112
|
-
import { assertEx as assertEx11 } from "@xylabs/sdk-js";
|
|
2113
|
-
import { hydrateTypedBoundWitness, tryHydrateTypedBoundWitness } from "@xyo-network/archivist-model";
|
|
2114
|
-
import { isAllowedBlockPayload as isAllowedBlockPayload2, isSignedTransactionBoundWitnessWithStorageMeta } from "@xyo-network/xl1-protocol";
|
|
2115
|
-
var tryHydrateTransaction = /* @__PURE__ */ __name(async ({ chainMap }, hash) => {
|
|
2116
|
-
return await tryHydrateTypedBoundWitness({
|
|
2117
|
-
get(hashes) {
|
|
2118
|
-
return chainMap.getMany(hashes);
|
|
2119
|
-
},
|
|
2120
|
-
next() {
|
|
2121
|
-
throw new Error("Not implemented");
|
|
2122
|
-
}
|
|
2123
|
-
}, hash, isSignedTransactionBoundWitnessWithStorageMeta);
|
|
2124
|
-
}, "tryHydrateTransaction");
|
|
2125
|
-
var hydrateTransaction = /* @__PURE__ */ __name(async ({ chainMap }, hash) => {
|
|
2126
|
-
return await hydrateTypedBoundWitness({
|
|
2127
|
-
get(hashes) {
|
|
2128
|
-
return chainMap.getMany(hashes);
|
|
2129
|
-
},
|
|
2130
|
-
next() {
|
|
2131
|
-
throw new Error("Not implemented");
|
|
2132
|
-
}
|
|
2133
|
-
}, hash, isSignedTransactionBoundWitnessWithStorageMeta);
|
|
2134
|
-
}, "hydrateTransaction");
|
|
2135
|
-
var flattenHydratedTransaction = /* @__PURE__ */ __name((hydratedTransaction) => {
|
|
2136
|
-
const [tx, txPayloads] = hydratedTransaction;
|
|
2137
|
-
return [
|
|
2138
|
-
...txPayloads,
|
|
2139
|
-
tx
|
|
2140
|
-
];
|
|
2141
|
-
}, "flattenHydratedTransaction");
|
|
2142
|
-
var flattenHydratedTransactions = /* @__PURE__ */ __name((hydratedTransactions) => hydratedTransactions.flatMap((tx) => flattenHydratedTransaction(tx)), "flattenHydratedTransactions");
|
|
2143
|
-
var tryHydrateElevatedTransaction = /* @__PURE__ */ __name(async ({ chainMap }, hash) => {
|
|
2144
|
-
const hydratedTransaction = await tryHydrateTransaction({
|
|
2145
|
-
chainMap
|
|
2146
|
-
}, hash);
|
|
2147
|
-
if (!hydratedTransaction) {
|
|
2148
|
-
return void 0;
|
|
2149
|
-
}
|
|
2150
|
-
const [transaction, payloads] = hydratedTransaction;
|
|
2151
|
-
const opCodes = (transaction.script ?? []).filter((operation) => operation.startsWith("elevate|"));
|
|
2152
|
-
const elevatedPayloads2 = [];
|
|
2153
|
-
for (const opCode of opCodes) {
|
|
2154
|
-
const [code, hash2] = opCode.split("|");
|
|
2155
|
-
if (code === "elevated") {
|
|
2156
|
-
const elevatedPayload = payloads.find((payload) => payload._hash === hash2);
|
|
2157
|
-
if (isAllowedBlockPayload2(elevatedPayload)) {
|
|
2158
|
-
elevatedPayloads2.push(elevatedPayload);
|
|
2159
|
-
}
|
|
2160
|
-
}
|
|
2161
|
-
}
|
|
2162
|
-
if (opCodes.length === elevatedPayloads2.length) {
|
|
2163
|
-
return [
|
|
2164
|
-
transaction,
|
|
2165
|
-
elevatedPayloads2
|
|
2166
|
-
];
|
|
2167
|
-
}
|
|
2168
|
-
return void 0;
|
|
2169
|
-
}, "tryHydrateElevatedTransaction");
|
|
2170
|
-
var hydrateElevatedTransaction = /* @__PURE__ */ __name(async (context, hash) => {
|
|
2171
|
-
return assertEx11(await tryHydrateElevatedTransaction(context, hash), () => "Hydration failed");
|
|
2172
|
-
}, "hydrateElevatedTransaction");
|
|
2173
|
-
|
|
2174
|
-
// src/transaction/primitives/transactionBlockByteCount.ts
|
|
2175
|
-
import { PayloadBuilder as PayloadBuilder8 } from "@xyo-network/payload-builder";
|
|
2176
|
-
function transactionBlockByteCount([transaction, payloads]) {
|
|
2177
|
-
const cleanTransaction = PayloadBuilder8.omitStorageMeta(transaction);
|
|
2178
|
-
const transactionBytes = JSON.stringify(cleanTransaction).length;
|
|
2179
|
-
const cleanPayloads = PayloadBuilder8.omitStorageMeta(payloads);
|
|
2180
|
-
return cleanPayloads.reduce((acc, payload) => acc + JSON.stringify(payload).length, 0) + transactionBytes;
|
|
2181
|
-
}
|
|
2182
|
-
__name(transactionBlockByteCount, "transactionBlockByteCount");
|
|
2183
|
-
|
|
2184
|
-
// src/transaction/primitives/transactionElevatedPayloads.ts
|
|
2185
|
-
import { asHash as asHash3 } from "@xylabs/sdk-js";
|
|
2186
|
-
|
|
2187
|
-
// src/transaction/primitives/transactionOperations.ts
|
|
2188
|
-
function crackOperation(operation) {
|
|
2189
|
-
const parts = operation.split("|");
|
|
2190
|
-
if (parts.length < 2) {
|
|
2191
|
-
throw new Error(`Invalid operation format: ${operation}`);
|
|
2192
|
-
}
|
|
2193
|
-
return [
|
|
2194
|
-
parts[0],
|
|
2195
|
-
parts.slice(1)
|
|
2196
|
-
];
|
|
2197
|
-
}
|
|
2198
|
-
__name(crackOperation, "crackOperation");
|
|
2199
|
-
function crackOperations(operations) {
|
|
2200
|
-
return operations.map((op) => crackOperation(op));
|
|
2201
|
-
}
|
|
2202
|
-
__name(crackOperations, "crackOperations");
|
|
2203
|
-
|
|
2204
|
-
// src/transaction/primitives/transactionElevatedPayloads.ts
|
|
2205
|
-
function transactionElevatedPayloadHashes(transaction) {
|
|
2206
|
-
const elevateOperations = crackOperations(transaction.script ?? []).filter((op) => op[0] === "elevate");
|
|
2207
|
-
return elevateOperations.map((op) => asHash3(op[1][0], true));
|
|
2208
|
-
}
|
|
2209
|
-
__name(transactionElevatedPayloadHashes, "transactionElevatedPayloadHashes");
|
|
2210
|
-
function transactionElevatedPayloads([transaction, payloads]) {
|
|
2211
|
-
const hashes = transactionElevatedPayloadHashes(transaction);
|
|
2212
|
-
const elevatedPayloads2 = payloads.filter((payload) => hashes.includes(payload._hash));
|
|
2213
|
-
return elevatedPayloads2;
|
|
2214
|
-
}
|
|
2215
|
-
__name(transactionElevatedPayloads, "transactionElevatedPayloads");
|
|
2216
|
-
|
|
2217
|
-
// src/transaction/primitives/transactionRequiredGas.ts
|
|
2218
|
-
import { AttoXL1 as AttoXL12, TransactionGasCosts } from "@xyo-network/xl1-protocol";
|
|
2219
|
-
function transactionBytesRequiredGas([transaction, payloads]) {
|
|
2220
|
-
const transactionBlockBytes = transactionBlockByteCount([
|
|
2221
|
-
transaction,
|
|
2222
|
-
payloads
|
|
2223
|
-
]);
|
|
2224
|
-
return AttoXL12(TransactionGasCosts.characterStorage * BigInt(transactionBlockBytes));
|
|
2225
|
-
}
|
|
2226
|
-
__name(transactionBytesRequiredGas, "transactionBytesRequiredGas");
|
|
2227
|
-
function transactionRequiredGas(hydratedTransaction) {
|
|
2228
|
-
const elevatedPayloads2 = transactionElevatedPayloads(hydratedTransaction);
|
|
2229
|
-
const hashes = elevatedPayloads2.length + 1;
|
|
2230
|
-
const signatures = hydratedTransaction[0].addresses.length;
|
|
2231
|
-
return AttoXL12(transactionBytesRequiredGas(hydratedTransaction) + TransactionGasCosts.hashValidation * BigInt(hashes) + TransactionGasCosts.signatureValidation * BigInt(signatures) + TransactionGasCosts.payloadValidation * BigInt(elevatedPayloads2.length));
|
|
2232
|
-
}
|
|
2233
|
-
__name(transactionRequiredGas, "transactionRequiredGas");
|
|
2234
|
-
|
|
2235
|
-
// src/transaction/script.ts
|
|
2236
|
-
import { asHash as asHash4 } from "@xylabs/sdk-js";
|
|
2237
|
-
import { assertEx as assertEx12, filterAs as filterAs2 } from "@xylabs/sdk-js";
|
|
2238
|
-
import { isAllowedBlockPayloadWithHashMeta } from "@xyo-network/xl1-protocol";
|
|
2239
|
-
var tryExtractElevatedHashesFromScript = /* @__PURE__ */ __name((strings) => {
|
|
2240
|
-
const hashes = strings.filter((str) => str.startsWith("elevate|")).map((str) => str.split("|")[1]);
|
|
2241
|
-
return filterAs2(hashes, (h) => asHash4(h));
|
|
2242
|
-
}, "tryExtractElevatedHashesFromScript");
|
|
2243
|
-
var extractElevatedHashesFromScript = /* @__PURE__ */ __name((strings) => {
|
|
2244
|
-
const hashes = strings.filter((str) => str.startsWith("elevate|")).map((str) => str.split("|")[1]);
|
|
2245
|
-
const filtered = filterAs2(hashes, (h) => asHash4(h));
|
|
2246
|
-
assertEx12(filtered.length === hashes.length, () => "Invalid elevated hashes");
|
|
2247
|
-
return filtered;
|
|
2248
|
-
}, "extractElevatedHashesFromScript");
|
|
2249
|
-
var tryExtractElevatedHashes = /* @__PURE__ */ __name((tx) => {
|
|
2250
|
-
const [bw, payloads] = tx;
|
|
2251
|
-
const { script } = bw;
|
|
2252
|
-
const hashes = script ? tryExtractElevatedHashesFromScript(script) : [];
|
|
2253
|
-
return payloads.filter((p) => hashes.includes(p._hash)).filter(isAllowedBlockPayloadWithHashMeta);
|
|
2254
|
-
}, "tryExtractElevatedHashes");
|
|
2255
|
-
var extractElevatedHashes = /* @__PURE__ */ __name((tx) => {
|
|
2256
|
-
const [bw, payloads] = tx;
|
|
2257
|
-
const { script } = bw;
|
|
2258
|
-
const hashes = script ? tryExtractElevatedHashesFromScript(script) : [];
|
|
2259
|
-
const filtered = payloads.filter((p) => hashes.includes(p._hash)).filter(isAllowedBlockPayloadWithHashMeta);
|
|
2260
|
-
assertEx12(filtered.length === hashes.length, () => "Invalid elevated hashes");
|
|
2261
|
-
return filtered;
|
|
2262
|
-
}, "extractElevatedHashes");
|
|
2263
|
-
|
|
2264
|
-
// src/transaction/signTransaction.ts
|
|
2265
|
-
import { assertEx as assertEx13, hexFromArrayBuffer, toArrayBuffer } from "@xylabs/sdk-js";
|
|
2266
|
-
import { PayloadBuilder as PayloadBuilder9 } from "@xyo-network/payload-builder";
|
|
2267
|
-
async function signTransaction(tx, account) {
|
|
2268
|
-
assertEx13(tx.from === account.address, () => "Signer address does not match transaction from address");
|
|
2269
|
-
const signedTx = structuredClone(tx);
|
|
2270
|
-
signedTx.addresses = [
|
|
2271
|
-
account.address
|
|
2272
|
-
];
|
|
2273
|
-
signedTx.previous_hashes = [
|
|
2274
|
-
account.previousHash ?? null
|
|
2275
|
-
];
|
|
2276
|
-
const hash = await PayloadBuilder9.dataHash(signedTx);
|
|
2277
|
-
const hashBytes = toArrayBuffer(hash);
|
|
2278
|
-
const [signature] = await account.sign(hashBytes);
|
|
2279
|
-
signedTx.$signatures = [
|
|
2280
|
-
hexFromArrayBuffer(signature)
|
|
2281
|
-
];
|
|
2282
|
-
return signedTx;
|
|
2283
|
-
}
|
|
2284
|
-
__name(signTransaction, "signTransaction");
|
|
2285
|
-
|
|
2286
|
-
// src/simple/gateway/SimpleXyoGatewayRunner.ts
|
|
2342
|
+
import { assertEx as assertEx14, BigIntToJsonZod, isDefined as isDefined13 } from "@xylabs/sdk-js";
|
|
2343
|
+
import { PayloadBuilder as PayloadBuilder12 } from "@xyo-network/payload-builder";
|
|
2344
|
+
import { asXL1BlockNumber as asXL1BlockNumber6, TransferSchema as TransferSchema2 } from "@xyo-network/xl1-protocol";
|
|
2287
2345
|
var SimpleXyoGatewayRunner = class {
|
|
2288
2346
|
static {
|
|
2289
2347
|
__name(this, "SimpleXyoGatewayRunner");
|
|
@@ -2314,9 +2372,9 @@ var SimpleXyoGatewayRunner = class {
|
|
|
2314
2372
|
async addPayloadsToChain(onChain, offChain, options) {
|
|
2315
2373
|
const viewer = assertEx14(this.connectionInstance.viewer, () => "No viewer available on connection");
|
|
2316
2374
|
const { nbf, exp, chain, fees } = options ?? {};
|
|
2317
|
-
const resolvedChainId =
|
|
2318
|
-
const resolvedNbf =
|
|
2319
|
-
const resolvedExp =
|
|
2375
|
+
const resolvedChainId = isDefined13(chain) ? chain : await viewer.chainId();
|
|
2376
|
+
const resolvedNbf = asXL1BlockNumber6(isDefined13(nbf) ? nbf : await viewer.currentBlockNumber(), true);
|
|
2377
|
+
const resolvedExp = asXL1BlockNumber6(isDefined13(exp) ? exp : resolvedNbf + 10, true);
|
|
2320
2378
|
const tx = await buildUnsignedTransaction(resolvedChainId, onChain, offChain, resolvedNbf, resolvedExp, await (await this.signer()).address(), fees);
|
|
2321
2379
|
return await this.addTransactionToChain(tx);
|
|
2322
2380
|
}
|
|
@@ -2355,7 +2413,7 @@ var SimpleXyoGatewayRunner = class {
|
|
|
2355
2413
|
address,
|
|
2356
2414
|
BigIntToJsonZod.parse(amount)
|
|
2357
2415
|
]));
|
|
2358
|
-
const transfer = new
|
|
2416
|
+
const transfer = new PayloadBuilder12({
|
|
2359
2417
|
schema: TransferSchema2
|
|
2360
2418
|
}).fields({
|
|
2361
2419
|
from,
|
|
@@ -2548,7 +2606,7 @@ var MemoryPermissionsStore = class {
|
|
|
2548
2606
|
|
|
2549
2607
|
// src/simple/runner/SimpleXyoRunner.ts
|
|
2550
2608
|
import { MemoryArchivist } from "@xyo-network/archivist-memory";
|
|
2551
|
-
import { PayloadBuilder as
|
|
2609
|
+
import { PayloadBuilder as PayloadBuilder13 } from "@xyo-network/payload-builder";
|
|
2552
2610
|
var SimpleXyoRunner = class {
|
|
2553
2611
|
static {
|
|
2554
2612
|
__name(this, "SimpleXyoRunner");
|
|
@@ -2560,7 +2618,7 @@ var SimpleXyoRunner = class {
|
|
|
2560
2618
|
async broadcastTransaction(transaction) {
|
|
2561
2619
|
const archivist = await this.getMempoolArchivist();
|
|
2562
2620
|
await archivist.insert(flattenHydratedTransaction(transaction));
|
|
2563
|
-
return await
|
|
2621
|
+
return await PayloadBuilder13.hash(transaction[0]);
|
|
2564
2622
|
}
|
|
2565
2623
|
async getMempoolArchivist() {
|
|
2566
2624
|
if (!this._mempoolArchivist) {
|
|
@@ -2573,7 +2631,8 @@ var SimpleXyoRunner = class {
|
|
|
2573
2631
|
};
|
|
2574
2632
|
|
|
2575
2633
|
// src/simple/signer/SimpleXyoSigner.ts
|
|
2576
|
-
import { PayloadBuilder as
|
|
2634
|
+
import { PayloadBuilder as PayloadBuilder14 } from "@xyo-network/payload-builder";
|
|
2635
|
+
import { SignedHydratedTransactionWithHashMetaZod } from "@xyo-network/xl1-protocol";
|
|
2577
2636
|
var SimpleXyoSigner = class {
|
|
2578
2637
|
static {
|
|
2579
2638
|
__name(this, "SimpleXyoSigner");
|
|
@@ -2592,16 +2651,16 @@ var SimpleXyoSigner = class {
|
|
|
2592
2651
|
}
|
|
2593
2652
|
async signTransaction(tx) {
|
|
2594
2653
|
const txBW = await signTransaction(tx[0], this._account);
|
|
2595
|
-
return [
|
|
2596
|
-
await
|
|
2597
|
-
await
|
|
2598
|
-
];
|
|
2654
|
+
return SignedHydratedTransactionWithHashMetaZod.parse([
|
|
2655
|
+
await PayloadBuilder14.addStorageMeta(txBW),
|
|
2656
|
+
await PayloadBuilder14.addStorageMeta(tx[1])
|
|
2657
|
+
]);
|
|
2599
2658
|
}
|
|
2600
2659
|
};
|
|
2601
2660
|
|
|
2602
2661
|
// src/simple/timesync/SimpleTimeSyncViewer.ts
|
|
2603
|
-
import { asHash as asHash5, assertEx as assertEx17, isDefined as
|
|
2604
|
-
import { asTimePayload, asXL1BlockNumber as
|
|
2662
|
+
import { asHash as asHash5, assertEx as assertEx17, isDefined as isDefined14 } from "@xylabs/sdk-js";
|
|
2663
|
+
import { asTimePayload, asXL1BlockNumber as asXL1BlockNumber7, TimeSchema } from "@xyo-network/xl1-protocol";
|
|
2605
2664
|
var SimpleTimeSyncViewer = class {
|
|
2606
2665
|
static {
|
|
2607
2666
|
__name(this, "SimpleTimeSyncViewer");
|
|
@@ -2615,10 +2674,10 @@ var SimpleTimeSyncViewer = class {
|
|
|
2615
2674
|
async convertTime(fromDomain, toDomain, from) {
|
|
2616
2675
|
switch (fromDomain) {
|
|
2617
2676
|
case "xl1": {
|
|
2618
|
-
const [block, payloads] = assertEx17(await this.blockViewer.blockByNumber(
|
|
2677
|
+
const [block, payloads] = assertEx17(await this.blockViewer.blockByNumber(asXL1BlockNumber7(from, true)), () => "Block not found");
|
|
2619
2678
|
const timeSchemaIndex = block.payload_schemas.indexOf(TimeSchema);
|
|
2620
2679
|
const hash = timeSchemaIndex === -1 ? void 0 : block.payload_hashes[timeSchemaIndex];
|
|
2621
|
-
const timePayload = asTimePayload(
|
|
2680
|
+
const timePayload = asTimePayload(isDefined14(hash) ? payloads.find((p) => p._hash === hash) : void 0);
|
|
2622
2681
|
if (timePayload === void 0) return 0;
|
|
2623
2682
|
switch (toDomain) {
|
|
2624
2683
|
case "xl1": {
|
|
@@ -2725,334 +2784,24 @@ var prettifyZodError = /* @__PURE__ */ __name((error) => {
|
|
|
2725
2784
|
// src/viewers/AccountBalance.ts
|
|
2726
2785
|
import { WithHashMetaZod } from "@xyo-network/payload-model";
|
|
2727
2786
|
import { TransferZod } from "@xyo-network/xl1-protocol";
|
|
2728
|
-
import
|
|
2729
|
-
|
|
2730
|
-
|
|
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([
|
|
2787
|
+
import { BlockBoundWitnessZod, TransactionBoundWitnessZod } from "@xyo-network/xl1-protocol";
|
|
2788
|
+
import z21 from "zod";
|
|
2789
|
+
var AccountBalanceHistoryItemZod = z21.tuple([
|
|
3051
2790
|
WithHashMetaZod(BlockBoundWitnessZod),
|
|
3052
2791
|
WithHashMetaZod(TransactionBoundWitnessZod).nullable(),
|
|
3053
2792
|
WithHashMetaZod(TransferZod)
|
|
3054
2793
|
]);
|
|
3055
2794
|
|
|
2795
|
+
// src/viewers/Mempool.ts
|
|
2796
|
+
import { HashZod as HashZod2 } from "@xylabs/sdk-js";
|
|
2797
|
+
import { XL1BlockRangeZod } from "@xyo-network/xl1-protocol";
|
|
2798
|
+
import z22 from "zod";
|
|
2799
|
+
var PendingTransactionsOptionsZod = z22.object({
|
|
2800
|
+
cursor: HashZod2.optional(),
|
|
2801
|
+
limit: z22.number().int().positive().optional(),
|
|
2802
|
+
window: XL1BlockRangeZod.optional()
|
|
2803
|
+
});
|
|
2804
|
+
|
|
3056
2805
|
// src/viewers/StakeEvents.ts
|
|
3057
2806
|
var StakeEventNames = [
|
|
3058
2807
|
"StakeAdded",
|
|
@@ -3092,27 +2841,11 @@ export {
|
|
|
3092
2841
|
ADDRESS_INDEX,
|
|
3093
2842
|
AccountBalanceHistoryItemZod,
|
|
3094
2843
|
AddressPairSchema,
|
|
3095
|
-
AnyBoundWitnessZod,
|
|
3096
|
-
AnySignedBoundWitnessWithStorageMetaZod,
|
|
3097
|
-
AnySignedBoundWitnessZod,
|
|
3098
|
-
AnyUnsignedBoundWitnessZod,
|
|
3099
|
-
ArrayBufferToJsonZod,
|
|
3100
|
-
AttoToJsonZod,
|
|
3101
|
-
AttoZod,
|
|
3102
2844
|
BalancesStepSummarySchema,
|
|
3103
|
-
BlockBoundWitnessZod,
|
|
3104
|
-
BlockDurationZod,
|
|
3105
|
-
BlockEndZod,
|
|
3106
|
-
BlockScriptsZod,
|
|
3107
|
-
BlockStartZod,
|
|
3108
2845
|
BlockValidationError,
|
|
3109
|
-
BoundWitnessZod,
|
|
3110
2846
|
CHANGE_ADDRESS,
|
|
3111
2847
|
COIN_TYPES,
|
|
3112
|
-
CaveatTypesZod,
|
|
3113
|
-
CaveatsZod,
|
|
3114
2848
|
ChainIndexingServiceStateSchema,
|
|
3115
|
-
ChainZod,
|
|
3116
2849
|
ConfigZod,
|
|
3117
2850
|
DEFAULT_WALLET_PATH,
|
|
3118
2851
|
EIP712DataPayloadFieldsZod,
|
|
@@ -3122,40 +2855,14 @@ export {
|
|
|
3122
2855
|
GlobalMetaSchema,
|
|
3123
2856
|
HydratedBlockStateValidationError,
|
|
3124
2857
|
HydratedBlockValidationError,
|
|
3125
|
-
HydratedBlockWithStorageMetaZod,
|
|
3126
|
-
HydratedBlockZod,
|
|
3127
|
-
HydratedTransactionZod,
|
|
3128
|
-
InvokerPermissionZod,
|
|
3129
2858
|
JSONSchemaMetaSchema,
|
|
3130
|
-
JsonToArrayBufferZod,
|
|
3131
|
-
JsonToAttoZod,
|
|
3132
|
-
JsonToSignedHydratedTransactionZod,
|
|
3133
|
-
JsonToStakeZod,
|
|
3134
|
-
LocalSequenceFromStringZod,
|
|
3135
|
-
LocalSequenceToStringZod,
|
|
3136
2859
|
LruCacheMap,
|
|
3137
2860
|
MemoryMap,
|
|
3138
2861
|
MemoryPermissionsStore,
|
|
3139
2862
|
MnemonicStringZod,
|
|
3140
|
-
|
|
3141
|
-
PermissionZod,
|
|
3142
|
-
QualifiedSequenceFromStringZod,
|
|
3143
|
-
QualifiedSequenceToStringZod,
|
|
3144
|
-
RequestedPermissionZod,
|
|
2863
|
+
PendingTransactionsOptionsZod,
|
|
3145
2864
|
RewardMultipliers,
|
|
3146
|
-
RewardsRangeOptionsZod,
|
|
3147
2865
|
SchemasStepSummarySchema,
|
|
3148
|
-
SequenceFromStringZod,
|
|
3149
|
-
SequenceToStringZod,
|
|
3150
|
-
SignedBlockBoundWitnessZod,
|
|
3151
|
-
SignedBoundWitnessWithStorageMetaZod,
|
|
3152
|
-
SignedBoundWitnessZod,
|
|
3153
|
-
SignedHydratedBlockToJsonZod,
|
|
3154
|
-
SignedHydratedBlockWithStorageMetaZod,
|
|
3155
|
-
SignedHydratedBlockZod,
|
|
3156
|
-
SignedHydratedTransactionToJsonZod,
|
|
3157
|
-
SignedHydratedTransactionZod,
|
|
3158
|
-
SignedTransactionBoundWitnessZod,
|
|
3159
2866
|
SimpleAccountBalanceViewer,
|
|
3160
2867
|
SimpleChainStakeViewer,
|
|
3161
2868
|
SimpleDataLakeRunner,
|
|
@@ -3169,28 +2876,15 @@ export {
|
|
|
3169
2876
|
SimpleXyoRunner,
|
|
3170
2877
|
SimpleXyoSigner,
|
|
3171
2878
|
StakeEventNames,
|
|
3172
|
-
StakeToJsonZod,
|
|
3173
|
-
StakeZod,
|
|
3174
2879
|
StepSummarySchema,
|
|
3175
2880
|
TODO,
|
|
3176
|
-
TimeDomainZod,
|
|
3177
|
-
TransactionBoundWitnessZod,
|
|
3178
|
-
TransactionFeesBigIntToJsonZod,
|
|
3179
|
-
TransactionFeesBigIntZod,
|
|
3180
|
-
TransactionFeesHexZod,
|
|
3181
|
-
TransactionFeesJsonToBigIntZod,
|
|
3182
|
-
TransferPairZod,
|
|
3183
2881
|
TransfersStepSummarySchema,
|
|
3184
2882
|
TypedDataDomainZod,
|
|
3185
2883
|
TypedDataFieldZod,
|
|
3186
2884
|
TypedDataTypesZod,
|
|
3187
2885
|
TypedDataValueZod,
|
|
3188
|
-
UnsignedBoundWitnessWithStorageMetaZod,
|
|
3189
|
-
UnsignedBoundWitnessZod,
|
|
3190
|
-
UnsignedHydratedTransactionZod,
|
|
3191
2886
|
UsageMetaSchema,
|
|
3192
2887
|
WALLET_COMPLIANCE,
|
|
3193
|
-
WithTransactionFeesZod,
|
|
3194
2888
|
XL1_NETWORK_STAKING_GENESIS_PERIOD_END_EPOCH,
|
|
3195
2889
|
XL1_NETWORK_STAKING_GENESIS_PERIOD_END_XL1_BLOCK,
|
|
3196
2890
|
XL1_NETWORK_STAKING_GENESIS_PERIOD_TOTAL_BONUS_REWARDS,
|
|
@@ -3216,6 +2910,7 @@ export {
|
|
|
3216
2910
|
blockPayloadsFromHydratedBlock,
|
|
3217
2911
|
buildTransaction,
|
|
3218
2912
|
buildUnsignedTransaction,
|
|
2913
|
+
bundledPayloadToHydratedTransaction,
|
|
3219
2914
|
calculateFramesFromRange,
|
|
3220
2915
|
completedStepRewardAddress,
|
|
3221
2916
|
confirmSubmittedTransaction,
|
|
@@ -3239,6 +2934,7 @@ export {
|
|
|
3239
2934
|
hydrateBlock,
|
|
3240
2935
|
hydrateElevatedTransaction,
|
|
3241
2936
|
hydrateTransaction,
|
|
2937
|
+
hydratedTransactionToPayloadBundle,
|
|
3242
2938
|
isAddressPairPayload,
|
|
3243
2939
|
isBalancesStepSummary,
|
|
3244
2940
|
isBalancesStepSummaryWithStorageMeta,
|