@xyo-network/xl1-protocol-sdk 1.15.2 → 1.15.4
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/README.md +1507 -388
- package/dist/neutral/block/hydrate/hydrateBlock.d.ts +5 -2
- package/dist/neutral/block/hydrate/hydrateBlock.d.ts.map +1 -1
- package/dist/neutral/block/primitives/balances/balancesStepSummaryFromRange.d.ts.map +1 -1
- package/dist/neutral/block/primitives/balances/balancesSummary.d.ts.map +1 -1
- package/dist/neutral/block/primitives/blockFromBlockNumber.d.ts +2 -2
- package/dist/neutral/block/primitives/blockFromBlockNumber.d.ts.map +1 -1
- package/dist/neutral/block/primitives/hashFromBlockNumber.d.ts +2 -2
- package/dist/neutral/block/primitives/hashFromBlockNumber.d.ts.map +1 -1
- package/dist/neutral/block/primitives/model.d.ts +10 -8
- package/dist/neutral/block/primitives/model.d.ts.map +1 -1
- package/dist/neutral/block/primitives/payloads/StepSummary.d.ts.map +1 -1
- package/dist/neutral/block/primitives/payloads/TransfersSummary.d.ts +1 -2
- package/dist/neutral/block/primitives/payloads/TransfersSummary.d.ts.map +1 -1
- package/dist/neutral/block/primitives/transfers/transfersStepSummaryFromRange.d.ts.map +1 -1
- package/dist/neutral/block/primitives/transfers/transfersSummary.d.ts +1 -1
- package/dist/neutral/block/primitives/transfers/transfersSummary.d.ts.map +1 -1
- package/dist/neutral/config/Bridge.d.ts +8 -0
- package/dist/neutral/config/Bridge.d.ts.map +1 -0
- package/dist/neutral/config/Config.d.ts +5 -0
- package/dist/neutral/config/Config.d.ts.map +1 -1
- package/dist/neutral/index.d.ts +2 -0
- package/dist/neutral/index.d.ts.map +1 -1
- package/dist/neutral/index.mjs +335 -327
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/instances/ShiftedBigIntConfig.d.ts +1 -1
- package/dist/neutral/instances/ShiftedBigIntConfig.d.ts.map +1 -1
- package/dist/neutral/instances/XL1Amount.d.ts +1 -1
- package/dist/neutral/instances/XL1Amount.d.ts.map +1 -1
- package/dist/neutral/map/AsynchronousMap.d.ts +14 -0
- package/dist/neutral/map/AsynchronousMap.d.ts.map +1 -0
- package/dist/neutral/map/MapType.d.ts +6 -0
- package/dist/neutral/map/MapType.d.ts.map +1 -0
- package/dist/neutral/map/SynchronousMap.d.ts +13 -0
- package/dist/neutral/map/SynchronousMap.d.ts.map +1 -0
- package/dist/neutral/map/index.d.ts +4 -0
- package/dist/neutral/map/index.d.ts.map +1 -0
- package/dist/neutral/model/ChainContext/ChainContext.d.ts +15 -0
- package/dist/neutral/model/ChainContext/ChainContext.d.ts.map +1 -0
- package/dist/neutral/model/ChainContext/ChainStakeContext.d.ts +10 -0
- package/dist/neutral/model/ChainContext/ChainStakeContext.d.ts.map +1 -0
- package/dist/neutral/model/ChainContext/ChainStateContext.d.ts +9 -0
- package/dist/neutral/model/ChainContext/ChainStateContext.d.ts.map +1 -0
- package/dist/neutral/model/ChainContext/ChainStoreContext.d.ts +10 -0
- package/dist/neutral/model/ChainContext/ChainStoreContext.d.ts.map +1 -0
- package/dist/neutral/model/ChainContext/index.d.ts +5 -0
- package/dist/neutral/model/ChainContext/index.d.ts.map +1 -0
- package/dist/neutral/model/ChainFork/ChainForkStatic.d.ts +8 -0
- package/dist/neutral/model/ChainFork/ChainForkStatic.d.ts.map +1 -0
- package/dist/neutral/model/ChainFork/index.d.ts +2 -0
- package/dist/neutral/model/ChainFork/index.d.ts.map +1 -0
- package/dist/neutral/model/ChainIdentity.d.ts +5 -0
- package/dist/neutral/model/ChainIdentity.d.ts.map +1 -0
- package/dist/neutral/model/ChainStake/ChainStakeRead.d.ts +17 -0
- package/dist/neutral/model/ChainStake/ChainStakeRead.d.ts.map +1 -0
- package/dist/neutral/model/ChainStake/ChainStakeStatic.d.ts +7 -0
- package/dist/neutral/model/ChainStake/ChainStakeStatic.d.ts.map +1 -0
- package/dist/neutral/model/ChainStake/ChainStakeWrite.d.ts +6 -0
- package/dist/neutral/model/ChainStake/ChainStakeWrite.d.ts.map +1 -0
- package/dist/neutral/model/ChainStake/index.d.ts +4 -0
- package/dist/neutral/model/ChainStake/index.d.ts.map +1 -0
- package/dist/neutral/model/ChainStore.d.ts +10 -0
- package/dist/neutral/model/ChainStore.d.ts.map +1 -0
- package/dist/neutral/model/PayloadMap.d.ts +7 -0
- package/dist/neutral/model/PayloadMap.d.ts.map +1 -0
- package/dist/neutral/model/StakeEvents.d.ts +31 -0
- package/dist/neutral/model/StakeEvents.d.ts.map +1 -0
- package/dist/neutral/model/index.d.ts +8 -0
- package/dist/neutral/model/index.d.ts.map +1 -0
- package/dist/neutral/payload/netTransfersForPayloads.d.ts +1 -1
- package/dist/neutral/payload/netTransfersForPayloads.d.ts.map +1 -1
- package/dist/neutral/steps/primitives/index.d.ts +0 -10
- package/dist/neutral/steps/primitives/index.d.ts.map +1 -1
- package/dist/neutral/time/primitives/xl1BlockNumberToEthBlockNumber.d.ts +2 -2
- package/dist/neutral/time/primitives/xl1BlockNumberToEthBlockNumber.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 +5 -5
- package/dist/neutral/transaction/hydrateTransaction.d.ts.map +1 -1
- package/package.json +30 -29
- package/src/block/hydrate/hydrateBlock.ts +32 -10
- package/src/block/primitives/balances/balancesStepSummaryFromRange.ts +30 -23
- package/src/block/primitives/balances/balancesSummary.ts +3 -2
- package/src/block/primitives/blockFromBlockNumber.ts +8 -6
- package/src/block/primitives/hashFromBlockNumber.ts +2 -2
- package/src/block/primitives/model.ts +15 -11
- package/src/block/primitives/payloads/StepSummary.ts +1 -1
- package/src/block/primitives/payloads/TransfersSummary.ts +1 -2
- package/src/block/primitives/transfers/transfersStepSummaryFromRange.ts +43 -28
- package/src/block/primitives/transfers/transfersSummary.ts +12 -7
- package/src/config/Bridge.ts +26 -0
- package/src/config/Config.ts +2 -0
- package/src/index.ts +2 -0
- package/src/instances/ShiftedBigIntConfig.ts +1 -1
- package/src/instances/XL1Amount.ts +1 -1
- package/src/map/AsynchronousMap.ts +15 -0
- package/src/map/MapType.ts +8 -0
- package/src/map/SynchronousMap.ts +13 -0
- package/src/map/index.ts +3 -0
- package/src/model/ChainContext/ChainContext.ts +20 -0
- package/src/model/ChainContext/ChainStakeContext.ts +12 -0
- package/src/model/ChainContext/ChainStateContext.ts +10 -0
- package/src/model/ChainContext/ChainStoreContext.ts +12 -0
- package/src/model/ChainContext/index.ts +4 -0
- package/src/model/ChainFork/ChainForkStatic.ts +8 -0
- package/src/model/ChainFork/index.ts +1 -0
- package/src/model/ChainIdentity.ts +5 -0
- package/src/model/ChainStake/ChainStakeRead.ts +17 -0
- package/src/model/ChainStake/ChainStakeStatic.ts +7 -0
- package/src/model/ChainStake/ChainStakeWrite.ts +5 -0
- package/src/model/ChainStake/index.ts +3 -0
- package/src/model/ChainStore.ts +13 -0
- package/src/model/PayloadMap.ts +10 -0
- package/src/model/StakeEvents.ts +38 -0
- package/src/model/index.ts +7 -0
- package/src/payload/netTransfersForPayloads.ts +7 -12
- package/src/steps/primitives/index.ts +0 -10
- package/src/time/primitives/xl1BlockNumberToEthBlockNumber.ts +4 -5
- package/src/transaction/buildTransaction.ts +2 -2
- package/src/transaction/buildUnsignedTransaction.ts +2 -2
- package/src/transaction/hydrateTransaction.ts +24 -9
- package/dist/neutral/steps/primitives/networkStakeStepAddressReward.d.ts +0 -4
- package/dist/neutral/steps/primitives/networkStakeStepAddressReward.d.ts.map +0 -1
- package/dist/neutral/steps/primitives/networkStakeStepPoolRewardShares.d.ts +0 -4
- package/dist/neutral/steps/primitives/networkStakeStepPoolRewardShares.d.ts.map +0 -1
- package/dist/neutral/steps/primitives/networkStakeStepPoolRewards.d.ts +0 -4
- package/dist/neutral/steps/primitives/networkStakeStepPoolRewards.d.ts.map +0 -1
- package/dist/neutral/steps/primitives/networkStakeStepRewardAddressHistory.d.ts +0 -4
- package/dist/neutral/steps/primitives/networkStakeStepRewardAddressHistory.d.ts.map +0 -1
- package/dist/neutral/steps/primitives/networkStakeStepRewardAddressShare.d.ts +0 -4
- package/dist/neutral/steps/primitives/networkStakeStepRewardAddressShare.d.ts.map +0 -1
- package/dist/neutral/steps/primitives/networkStakeStepRewardForStep.d.ts +0 -3
- package/dist/neutral/steps/primitives/networkStakeStepRewardForStep.d.ts.map +0 -1
- package/dist/neutral/steps/primitives/networkStakeStepRewardPositionWeight.d.ts +0 -3
- package/dist/neutral/steps/primitives/networkStakeStepRewardPositionWeight.d.ts.map +0 -1
- package/dist/neutral/steps/primitives/networkStakeStepRewardPotentialPositionLoss.d.ts +0 -3
- package/dist/neutral/steps/primitives/networkStakeStepRewardPotentialPositionLoss.d.ts.map +0 -1
- package/dist/neutral/steps/primitives/networkStakeStepRewardRandomizer.d.ts +0 -3
- package/dist/neutral/steps/primitives/networkStakeStepRewardRandomizer.d.ts.map +0 -1
- package/dist/neutral/steps/primitives/networkStakeStepRewardWeightForAddress.d.ts +0 -4
- package/dist/neutral/steps/primitives/networkStakeStepRewardWeightForAddress.d.ts.map +0 -1
- package/src/steps/primitives/networkStakeStepAddressReward.ts +0 -6
- package/src/steps/primitives/networkStakeStepPoolRewardShares.ts +0 -6
- package/src/steps/primitives/networkStakeStepPoolRewards.ts +0 -6
- package/src/steps/primitives/networkStakeStepRewardAddressHistory.ts +0 -6
- package/src/steps/primitives/networkStakeStepRewardAddressShare.ts +0 -6
- package/src/steps/primitives/networkStakeStepRewardForStep.ts +0 -5
- package/src/steps/primitives/networkStakeStepRewardPositionWeight.ts +0 -5
- package/src/steps/primitives/networkStakeStepRewardPotentialPositionLoss.ts +0 -5
- package/src/steps/primitives/networkStakeStepRewardRandomizer.ts +0 -5
- package/src/steps/primitives/networkStakeStepRewardWeightForAddress.ts +0 -6
package/dist/neutral/index.mjs
CHANGED
|
@@ -28,90 +28,12 @@ var flattenHydratedBlock = /* @__PURE__ */ __name((hydratedBlock) => {
|
|
|
28
28
|
var flattenHydratedBlocks = /* @__PURE__ */ __name((hydratedBlocks) => hydratedBlocks.flatMap((blk) => flattenHydratedBlock(blk)), "flattenHydratedBlocks");
|
|
29
29
|
|
|
30
30
|
// src/block/hydrate/hydrateBlock.ts
|
|
31
|
-
import { assertEx as
|
|
32
|
-
import {
|
|
33
|
-
|
|
34
|
-
assertEx2(maxDepth >= 0, () => "maxDepth must be greater than or equal to 0");
|
|
35
|
-
assertEx2(minDepth >= 0, () => "minDepth must be greater than or equal to 0");
|
|
36
|
-
assertEx2(maxDepth >= minDepth, () => "maxDepth must be greater than or equal to minDepth");
|
|
37
|
-
const bw = assertEx2((await archivist.get([
|
|
38
|
-
hash
|
|
39
|
-
])).find(isBlockBoundWitnessWithStorageMeta), () => `block ${hash} not found`);
|
|
40
|
-
if (maxDepth === 0) return [
|
|
41
|
-
bw,
|
|
42
|
-
[]
|
|
43
|
-
];
|
|
44
|
-
const blkPayloads = await archivist.get(bw.payload_hashes);
|
|
45
|
-
if (minDepth === 1) assertEx2(allHashesPresent(bw.payload_hashes, blkPayloads), () => `Unable to find all payloads for block ${hash}`);
|
|
46
|
-
if (maxDepth === 1) return [
|
|
47
|
-
bw,
|
|
48
|
-
blkPayloads
|
|
49
|
-
];
|
|
50
|
-
const transactions = blkPayloads.filter(isTransactionBoundWitnessWithStorageMeta2);
|
|
51
|
-
const transactionsPayloadHashes = transactions.flatMap((tx) => tx.payload_hashes);
|
|
52
|
-
const transactionsPayloads = await archivist.get(transactionsPayloadHashes);
|
|
53
|
-
assertEx2(allHashesPresent(transactionsPayloadHashes, transactionsPayloads), () => `Unable to find all payloads for transactions in block ${hash}`);
|
|
54
|
-
const allPayloadsHashes = new Set([
|
|
55
|
-
...blkPayloads,
|
|
56
|
-
...transactionsPayloads
|
|
57
|
-
].flatMap((p) => p._hash));
|
|
58
|
-
const allPayloads = await archivist.get([
|
|
59
|
-
...allPayloadsHashes
|
|
60
|
-
]);
|
|
61
|
-
const allPayloadsFiltered = allPayloads.filter((p) => allPayloadsHashes.has(p._hash));
|
|
62
|
-
if (maxDepth === 2) assertEx2(allHashesPresent([
|
|
63
|
-
...allPayloadsHashes
|
|
64
|
-
], allPayloadsFiltered), () => `Unable to find all payloads for transactions in block ${hash}`);
|
|
65
|
-
return [
|
|
66
|
-
bw,
|
|
67
|
-
allPayloadsFiltered
|
|
68
|
-
];
|
|
69
|
-
}, "hydrateBlock");
|
|
70
|
-
|
|
71
|
-
// src/block/hydrate/transactionsFromHydratedBlock.ts
|
|
72
|
-
import { filterAs } from "@xylabs/array";
|
|
73
|
-
import { asTransactionBoundWitnessWithStorageMeta } from "@xyo-network/xl1-protocol";
|
|
74
|
-
var transactionsFromHydratedBlock = /* @__PURE__ */ __name((block) => {
|
|
75
|
-
return filterAs(block[1], asTransactionBoundWitnessWithStorageMeta);
|
|
76
|
-
}, "transactionsFromHydratedBlock");
|
|
77
|
-
|
|
78
|
-
// src/block/hydrate/tryHydrateBlock.ts
|
|
79
|
-
import { assertEx as assertEx3 } from "@xylabs/assert";
|
|
80
|
-
import { isBlockBoundWitnessWithStorageMeta as isBlockBoundWitnessWithStorageMeta2, isTransactionBoundWitnessWithStorageMeta as isTransactionBoundWitnessWithStorageMeta3 } from "@xyo-network/xl1-protocol";
|
|
81
|
-
var tryHydrateBlock = /* @__PURE__ */ __name(async (archivist, hash, maxDepth = 1) => {
|
|
82
|
-
assertEx3(maxDepth >= 0, () => "maxDepth must be greater than or equal to 0");
|
|
83
|
-
const bw = (await archivist.get([
|
|
84
|
-
hash
|
|
85
|
-
])).find(isBlockBoundWitnessWithStorageMeta2);
|
|
86
|
-
if (!bw) return void 0;
|
|
87
|
-
if (maxDepth === 0) return [
|
|
88
|
-
bw,
|
|
89
|
-
[]
|
|
90
|
-
];
|
|
91
|
-
const blkPayloads = await archivist.get(bw.payload_hashes);
|
|
92
|
-
if (maxDepth === 1) return [
|
|
93
|
-
bw,
|
|
94
|
-
blkPayloads
|
|
95
|
-
];
|
|
96
|
-
const transactions = blkPayloads.filter(isTransactionBoundWitnessWithStorageMeta3);
|
|
97
|
-
const transactionsPayloadHashes = transactions.flatMap((tx) => tx.payload_hashes);
|
|
98
|
-
const transactionsPayloads = await archivist.get(transactionsPayloadHashes);
|
|
99
|
-
const allPayloadsHashes = new Set([
|
|
100
|
-
...blkPayloads,
|
|
101
|
-
...transactionsPayloads
|
|
102
|
-
].flatMap((p) => p._hash));
|
|
103
|
-
const allPayloads = await archivist.get([
|
|
104
|
-
...allPayloadsHashes
|
|
105
|
-
]);
|
|
106
|
-
const allPayloadsFiltered = allPayloads.filter((p) => allPayloadsHashes.has(p._hash));
|
|
107
|
-
return [
|
|
108
|
-
bw,
|
|
109
|
-
allPayloadsFiltered
|
|
110
|
-
];
|
|
111
|
-
}, "tryHydrateBlock");
|
|
31
|
+
import { assertEx as assertEx4 } from "@xylabs/assert";
|
|
32
|
+
import { isDefined as isDefined3 } from "@xylabs/typeof";
|
|
33
|
+
import { asBlockBoundWitnessWithStorageMeta as asBlockBoundWitnessWithStorageMeta4, isTransactionBoundWitnessWithStorageMeta as isTransactionBoundWitnessWithStorageMeta2 } from "@xyo-network/xl1-protocol";
|
|
112
34
|
|
|
113
35
|
// src/block/primitives/balances/balancesStepSummaryFromRange.ts
|
|
114
|
-
import { assertEx as
|
|
36
|
+
import { assertEx as assertEx2 } from "@xylabs/assert";
|
|
115
37
|
import { PayloadBuilder } from "@xyo-network/payload-builder";
|
|
116
38
|
import { isAnyPayload } from "@xyo-network/payload-model";
|
|
117
39
|
import { StepSizes as StepSizes3 } from "@xyo-network/xl1-protocol";
|
|
@@ -140,22 +62,17 @@ var netBalancesForPayloads = /* @__PURE__ */ __name((payloads) => {
|
|
|
140
62
|
import { hexToBigInt as hexToBigInt2 } from "@xylabs/hex";
|
|
141
63
|
import { span as span2 } from "@xylabs/telemetry";
|
|
142
64
|
import { isTransfer as isTransfer2 } from "@xyo-network/xl1-protocol";
|
|
143
|
-
function netTransfersForPayloads(payloads
|
|
65
|
+
function netTransfersForPayloads(payloads) {
|
|
144
66
|
return span2("netTransfersForPayloads", () => {
|
|
145
67
|
const transfers = {};
|
|
146
68
|
for (const payload of payloads) {
|
|
147
69
|
if (isTransfer2(payload)) {
|
|
148
70
|
const { from } = payload;
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
} else {
|
|
155
|
-
if (account === address) {
|
|
156
|
-
transfers[from] = (transfers[from] ?? 0n) - hexToBigInt2(amount);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
71
|
+
transfers[from] = transfers[from] ?? {};
|
|
72
|
+
for (let [to, amount] of Object.entries(payload.transfers)) {
|
|
73
|
+
transfers[to] = transfers[to] ?? {};
|
|
74
|
+
transfers[to][from] = (transfers[to][from] ?? 0n) + hexToBigInt2(amount);
|
|
75
|
+
transfers[from][to] = (transfers[from][to] ?? 0n) - hexToBigInt2(amount);
|
|
159
76
|
}
|
|
160
77
|
}
|
|
161
78
|
}
|
|
@@ -275,10 +192,9 @@ import { asHash } from "@xylabs/hex";
|
|
|
275
192
|
import { toSafeJsonString } from "@xylabs/object";
|
|
276
193
|
import { asBlockBoundWitnessWithStorageMeta, StepSizes as StepSizes2 } from "@xyo-network/xl1-protocol";
|
|
277
194
|
async function blockFromBlockNumber(context, blockNumber) {
|
|
278
|
-
const
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
let currentBlock = asBlockBoundWitnessWithStorageMeta(result.at(0), () => `Head block not found for hash: ${context.head}`, {
|
|
195
|
+
const head = await context.head();
|
|
196
|
+
const result = await context.store.chainMap.get(head);
|
|
197
|
+
let currentBlock = asBlockBoundWitnessWithStorageMeta(result, () => `Head block not found for hash: ${head}`, {
|
|
282
198
|
required: true
|
|
283
199
|
});
|
|
284
200
|
while (currentBlock.block > blockNumber) {
|
|
@@ -291,9 +207,7 @@ async function blockFromBlockNumber(context, blockNumber) {
|
|
|
291
207
|
jumpHash = asHash(currentBlock.step_hashes.at(step), () => `Step hash not found for step ${step} in block ${currentBlock.block}`);
|
|
292
208
|
}
|
|
293
209
|
}
|
|
294
|
-
const
|
|
295
|
-
asHash(jumpHash, () => `Jump hash not found for block number [${blockNumber}]: ${jumpBlockNumber} ${toSafeJsonString(currentBlock, 10)}`)
|
|
296
|
-
]);
|
|
210
|
+
const newBlock = await context.store.chainMap.get(asHash(jumpHash, () => `Jump hash not found for block number [${blockNumber}]: ${jumpBlockNumber} ${toSafeJsonString(currentBlock, 10)}`));
|
|
297
211
|
currentBlock = asBlockBoundWitnessWithStorageMeta(newBlock, () => `Block not found for hash: ${jumpHash}`, {
|
|
298
212
|
required: true
|
|
299
213
|
});
|
|
@@ -343,51 +257,53 @@ var asTransfersStepSummaryWithStorageMeta = AsObjectFactory2.create(isTransfersS
|
|
|
343
257
|
async function balancesStepSummaryFromRange(context, range) {
|
|
344
258
|
const frameHeadHash = await hashFromBlockNumber(context, range[1]);
|
|
345
259
|
const frameSize = range[1] - range[0] + 1;
|
|
260
|
+
const head = await context.head();
|
|
346
261
|
let result = void 0;
|
|
347
262
|
if (frameSize === 1) {
|
|
348
263
|
const hash = await hashFromBlockNumber(context, range[0]);
|
|
349
|
-
const [, payloads] = await hydrateBlock(context.
|
|
264
|
+
const [, payloads] = await hydrateBlock(context.store, hash);
|
|
350
265
|
const balances = {};
|
|
351
266
|
for (const [address, balance] of Object.entries(netBalancesForPayloads(payloads))) {
|
|
352
267
|
balances[address] = toSignedBigInt(balance);
|
|
353
268
|
}
|
|
354
269
|
result = {
|
|
355
270
|
schema: BalancesStepSummarySchema,
|
|
356
|
-
hash:
|
|
271
|
+
hash: head,
|
|
357
272
|
stepSize: -1,
|
|
358
273
|
balances
|
|
359
274
|
};
|
|
360
275
|
} else {
|
|
361
276
|
const step = StepSizes3.indexOf(frameSize);
|
|
362
|
-
|
|
363
|
-
const
|
|
364
|
-
frameHeadHash
|
|
365
|
-
]);
|
|
277
|
+
assertEx2(step !== -1, () => `Invalid step size: ${frameSize}. Must be one of ${StepSizes3.join(", ")}`);
|
|
278
|
+
const summaryResult = await context.summaryMap.get(`${frameHeadHash}|${frameSize}`);
|
|
366
279
|
if (isAnyPayload(summaryResult)) {
|
|
367
280
|
result = summaryResult;
|
|
368
281
|
} else {
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
282
|
+
await context.stepSemaphores[step].acquire();
|
|
283
|
+
try {
|
|
284
|
+
const subRanges = deepCalculateFramesFromRange(range, step - 1);
|
|
285
|
+
const promises = subRanges.map((subRange) => balancesStepSummaryFromRange(context, subRange));
|
|
286
|
+
const subResults = await Promise.all(promises);
|
|
287
|
+
const bigIntBalances = {};
|
|
288
|
+
for (const subResult of subResults) {
|
|
289
|
+
for (const [address, balance] of Object.entries(subResult.balances)) {
|
|
290
|
+
bigIntBalances[address] = (bigIntBalances[address] ?? 0n) + parseSignedBigInt(balance);
|
|
291
|
+
}
|
|
376
292
|
}
|
|
293
|
+
const balances = {};
|
|
294
|
+
for (const [address, balance] of Object.entries(bigIntBalances)) {
|
|
295
|
+
balances[address] = toSignedBigInt(balance);
|
|
296
|
+
}
|
|
297
|
+
result = {
|
|
298
|
+
schema: BalancesStepSummarySchema,
|
|
299
|
+
hash: frameHeadHash,
|
|
300
|
+
stepSize: frameSize,
|
|
301
|
+
balances
|
|
302
|
+
};
|
|
303
|
+
await context.summaryMap.set(`${frameHeadHash}|${frameSize}`, result);
|
|
304
|
+
} finally {
|
|
305
|
+
context.stepSemaphores[step].release();
|
|
377
306
|
}
|
|
378
|
-
const balances = {};
|
|
379
|
-
for (const [address, balance] of Object.entries(bigIntBalances)) {
|
|
380
|
-
balances[address] = toSignedBigInt(balance);
|
|
381
|
-
}
|
|
382
|
-
result = {
|
|
383
|
-
schema: BalancesStepSummarySchema,
|
|
384
|
-
hash: frameHeadHash,
|
|
385
|
-
stepSize: frameSize,
|
|
386
|
-
balances
|
|
387
|
-
};
|
|
388
|
-
await context.summaryRepository.insert([
|
|
389
|
-
result
|
|
390
|
-
]);
|
|
391
307
|
}
|
|
392
308
|
}
|
|
393
309
|
const finalResult = await PayloadBuilder.addStorageMeta(result);
|
|
@@ -402,10 +318,9 @@ import { isDefined } from "@xylabs/typeof";
|
|
|
402
318
|
import { asBlockBoundWitnessWithStorageMeta as asBlockBoundWitnessWithStorageMeta2 } from "@xyo-network/xl1-protocol";
|
|
403
319
|
async function balancesSummary(context) {
|
|
404
320
|
return await spanRootAsync("balanceSummary", async () => {
|
|
405
|
-
const
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
const headBoundWitness = asBlockBoundWitnessWithStorageMeta2(headResult.at(0), () => `Head block not found for hash: ${context.head}`, {
|
|
321
|
+
const head = await context.head();
|
|
322
|
+
const headResult = await context.store.chainMap.get(head);
|
|
323
|
+
const headBoundWitness = asBlockBoundWitnessWithStorageMeta2(headResult, () => `Head block not found for hash: ${context.head}`, {
|
|
409
324
|
required: true
|
|
410
325
|
});
|
|
411
326
|
const rangeStart = isDefined(context.windowSize) ? Math.max(headBoundWitness.block - context.windowSize + 1, 0) : 0;
|
|
@@ -426,62 +341,76 @@ async function balancesSummary(context) {
|
|
|
426
341
|
}
|
|
427
342
|
__name(balancesSummary, "balancesSummary");
|
|
428
343
|
|
|
344
|
+
// src/block/primitives/model.ts
|
|
345
|
+
function isReadArchivist(obj) {
|
|
346
|
+
return obj.get !== void 0 && obj.next !== void 0;
|
|
347
|
+
}
|
|
348
|
+
__name(isReadArchivist, "isReadArchivist");
|
|
349
|
+
|
|
429
350
|
// src/block/primitives/transfers/transfersStepSummaryFromRange.ts
|
|
430
|
-
import { assertEx as
|
|
351
|
+
import { assertEx as assertEx3 } from "@xylabs/assert";
|
|
431
352
|
import { PayloadBuilder as PayloadBuilder2 } from "@xyo-network/payload-builder";
|
|
432
353
|
import { isAnyPayload as isAnyPayload2 } from "@xyo-network/payload-model";
|
|
433
354
|
import { StepSizes as StepSizes4 } from "@xyo-network/xl1-protocol";
|
|
434
355
|
async function transfersStepSummaryFromRange(context, range) {
|
|
435
356
|
const frameHeadHash = await hashFromBlockNumber(context, range[1]);
|
|
436
357
|
const frameSize = range[1] - range[0] + 1;
|
|
437
|
-
const
|
|
358
|
+
const head = await context.head();
|
|
438
359
|
let result = void 0;
|
|
439
360
|
if (frameSize === 1) {
|
|
440
361
|
const hash = await hashFromBlockNumber(context, range[0]);
|
|
441
|
-
const [, payloads] = await hydrateBlock(context.
|
|
362
|
+
const [, payloads] = await hydrateBlock(context.store, hash);
|
|
442
363
|
const transfers = {};
|
|
443
|
-
for (const [
|
|
444
|
-
transfers[
|
|
364
|
+
for (const [from, toMap] of Object.entries(netTransfersForPayloads(payloads))) {
|
|
365
|
+
transfers[from] = transfers[from] ?? {};
|
|
366
|
+
for (const [to, amount] of Object.entries(toMap)) {
|
|
367
|
+
transfers[from][to] = toSignedBigInt(amount);
|
|
368
|
+
}
|
|
445
369
|
}
|
|
446
370
|
result = {
|
|
447
371
|
schema: TransfersStepSummarySchema,
|
|
448
|
-
hash:
|
|
372
|
+
hash: head,
|
|
449
373
|
stepSize: -1,
|
|
450
|
-
transfers
|
|
451
|
-
account
|
|
374
|
+
transfers
|
|
452
375
|
};
|
|
453
376
|
} else {
|
|
454
377
|
const step = StepSizes4.indexOf(frameSize);
|
|
455
|
-
|
|
456
|
-
const
|
|
457
|
-
frameHeadHash
|
|
458
|
-
]);
|
|
378
|
+
assertEx3(step !== -1, () => `Invalid step size: ${frameSize}. Must be one of ${StepSizes4.join(", ")}`);
|
|
379
|
+
const summaryResult = await context.summaryMap.get(`${frameHeadHash}|${frameSize}`);
|
|
459
380
|
if (isAnyPayload2(summaryResult)) {
|
|
460
381
|
result = summaryResult;
|
|
461
382
|
} else {
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
383
|
+
await context.stepSemaphores[step].acquire();
|
|
384
|
+
try {
|
|
385
|
+
const subRanges = deepCalculateFramesFromRange(range, step - 1);
|
|
386
|
+
const promises = subRanges.map((subRange) => transfersStepSummaryFromRange(context, subRange));
|
|
387
|
+
const subResults = await Promise.all(promises);
|
|
388
|
+
const bigIntBalances = {};
|
|
389
|
+
for (const subResult of subResults) {
|
|
390
|
+
for (const [from, toMap] of Object.entries(subResult.transfers)) {
|
|
391
|
+
bigIntBalances[from] = bigIntBalances[from] ?? {};
|
|
392
|
+
for (const [to, transfer] of Object.entries(toMap)) {
|
|
393
|
+
bigIntBalances[from][to] = (bigIntBalances[from][to] ?? 0n) + parseSignedBigInt(transfer);
|
|
394
|
+
}
|
|
395
|
+
}
|
|
469
396
|
}
|
|
397
|
+
const transfers = {};
|
|
398
|
+
for (const [from, toMap] of Object.entries(bigIntBalances)) {
|
|
399
|
+
transfers[from] = transfers[from] ?? {};
|
|
400
|
+
for (const [to, transfer] of Object.entries(toMap)) {
|
|
401
|
+
transfers[from][to] = toSignedBigInt(transfer);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
result = {
|
|
405
|
+
schema: TransfersStepSummarySchema,
|
|
406
|
+
hash: frameHeadHash,
|
|
407
|
+
stepSize: frameSize,
|
|
408
|
+
transfers
|
|
409
|
+
};
|
|
410
|
+
await context.summaryMap.set(`${frameHeadHash}|${frameSize}`, result);
|
|
411
|
+
} finally {
|
|
412
|
+
context.stepSemaphores[step].release();
|
|
470
413
|
}
|
|
471
|
-
const transfers = {};
|
|
472
|
-
for (const [address, transfer] of Object.entries(bigIntBalances)) {
|
|
473
|
-
transfers[address] = toSignedBigInt(transfer);
|
|
474
|
-
}
|
|
475
|
-
result = {
|
|
476
|
-
schema: TransfersStepSummarySchema,
|
|
477
|
-
hash: frameHeadHash,
|
|
478
|
-
stepSize: frameSize,
|
|
479
|
-
transfers,
|
|
480
|
-
account
|
|
481
|
-
};
|
|
482
|
-
await context.summaryRepository.insert([
|
|
483
|
-
result
|
|
484
|
-
]);
|
|
485
414
|
}
|
|
486
415
|
}
|
|
487
416
|
const finalResult = await PayloadBuilder2.addStorageMeta(result);
|
|
@@ -496,10 +425,9 @@ import { isDefined as isDefined2 } from "@xylabs/typeof";
|
|
|
496
425
|
import { asBlockBoundWitnessWithStorageMeta as asBlockBoundWitnessWithStorageMeta3 } from "@xyo-network/xl1-protocol";
|
|
497
426
|
async function transfersSummary(context) {
|
|
498
427
|
return await spanRootAsync2("transferSummary", async () => {
|
|
499
|
-
const
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
const headBoundWitness = asBlockBoundWitnessWithStorageMeta3(headResult.at(0), () => `Head block not found for hash: ${context.head}`, {
|
|
428
|
+
const head = await context.head();
|
|
429
|
+
const headResult = await context.store.chainMap.get(head);
|
|
430
|
+
const headBoundWitness = asBlockBoundWitnessWithStorageMeta3(headResult, () => `Head block not found for hash: ${context.head}`, {
|
|
503
431
|
required: true
|
|
504
432
|
});
|
|
505
433
|
const rangeStart = isDefined2(context.windowSize) ? Math.max(headBoundWitness.block - context.windowSize + 1, 0) : 0;
|
|
@@ -510,9 +438,13 @@ async function transfersSummary(context) {
|
|
|
510
438
|
const summaries = await Promise.all(ranges.map((range) => transfersStepSummaryFromRange(context, range)));
|
|
511
439
|
const transfers = {};
|
|
512
440
|
for (let summary of summaries) {
|
|
513
|
-
for (const [
|
|
514
|
-
const
|
|
515
|
-
transfers[
|
|
441
|
+
for (const [from, toMap] of Object.entries(summary.transfers)) {
|
|
442
|
+
const validFrom = asAddress2(from, () => `Invalid address: ${from}`);
|
|
443
|
+
transfers[validFrom] = transfers[validFrom] ?? {};
|
|
444
|
+
for (const [to, transfer] of Object.entries(toMap)) {
|
|
445
|
+
const validTo = asAddress2(to, () => `Invalid address: ${to}`);
|
|
446
|
+
transfers[validFrom][validTo] = (transfers[validFrom][validTo] ?? 0n) + parseSignedBigInt(transfer);
|
|
447
|
+
}
|
|
516
448
|
}
|
|
517
449
|
}
|
|
518
450
|
return transfers;
|
|
@@ -520,8 +452,108 @@ async function transfersSummary(context) {
|
|
|
520
452
|
}
|
|
521
453
|
__name(transfersSummary, "transfersSummary");
|
|
522
454
|
|
|
455
|
+
// src/block/hydrate/hydrateBlock.ts
|
|
456
|
+
function readPayloadMapFromStore(store) {
|
|
457
|
+
if (isReadArchivist(store)) {
|
|
458
|
+
return {
|
|
459
|
+
get: /* @__PURE__ */ __name(async (hash) => {
|
|
460
|
+
return (await store.get([
|
|
461
|
+
hash
|
|
462
|
+
]))[0];
|
|
463
|
+
}, "get"),
|
|
464
|
+
getMany: /* @__PURE__ */ __name(async (hashes) => {
|
|
465
|
+
return await store.get(hashes);
|
|
466
|
+
}, "getMany"),
|
|
467
|
+
has: /* @__PURE__ */ __name(async (hash) => {
|
|
468
|
+
return isDefined3((await store.get([
|
|
469
|
+
hash
|
|
470
|
+
]))[0]);
|
|
471
|
+
}, "has")
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
return store;
|
|
475
|
+
}
|
|
476
|
+
__name(readPayloadMapFromStore, "readPayloadMapFromStore");
|
|
477
|
+
var hydrateBlock = /* @__PURE__ */ __name(async ({ chainMap }, hash, maxDepth = 1, minDepth = maxDepth) => {
|
|
478
|
+
assertEx4(maxDepth >= 0, () => "maxDepth must be greater than or equal to 0");
|
|
479
|
+
assertEx4(minDepth >= 0, () => "minDepth must be greater than or equal to 0");
|
|
480
|
+
assertEx4(maxDepth >= minDepth, () => "maxDepth must be greater than or equal to minDepth");
|
|
481
|
+
const bw = assertEx4(asBlockBoundWitnessWithStorageMeta4(assertEx4(await chainMap.get(hash), () => `block ${hash} not found`)), () => `hash ${hash} is not a BlockBoundWitness`);
|
|
482
|
+
if (maxDepth === 0) return [
|
|
483
|
+
bw,
|
|
484
|
+
[]
|
|
485
|
+
];
|
|
486
|
+
const blkPayloads = await chainMap.getMany(bw.payload_hashes);
|
|
487
|
+
if (minDepth === 1) assertEx4(allHashesPresent(bw.payload_hashes, blkPayloads), () => `Unable to find all payloads for block ${hash}`);
|
|
488
|
+
if (maxDepth === 1) return [
|
|
489
|
+
bw,
|
|
490
|
+
blkPayloads
|
|
491
|
+
];
|
|
492
|
+
const transactions = blkPayloads.filter(isTransactionBoundWitnessWithStorageMeta2);
|
|
493
|
+
const transactionsPayloadHashes = transactions.flatMap((tx) => tx.payload_hashes);
|
|
494
|
+
const transactionsPayloads = await chainMap.getMany(transactionsPayloadHashes);
|
|
495
|
+
assertEx4(allHashesPresent(transactionsPayloadHashes, transactionsPayloads), () => `Unable to find all payloads for transactions in block ${hash}`);
|
|
496
|
+
const allPayloadsHashes = new Set([
|
|
497
|
+
...blkPayloads,
|
|
498
|
+
...transactionsPayloads
|
|
499
|
+
].flatMap((p) => p._hash));
|
|
500
|
+
const allPayloads = await chainMap.getMany([
|
|
501
|
+
...allPayloadsHashes
|
|
502
|
+
]);
|
|
503
|
+
const allPayloadsFiltered = allPayloads.filter((p) => allPayloadsHashes.has(p._hash));
|
|
504
|
+
if (maxDepth === 2) assertEx4(allHashesPresent([
|
|
505
|
+
...allPayloadsHashes
|
|
506
|
+
], allPayloadsFiltered), () => `Unable to find all payloads for transactions in block ${hash}`);
|
|
507
|
+
return [
|
|
508
|
+
bw,
|
|
509
|
+
allPayloadsFiltered
|
|
510
|
+
];
|
|
511
|
+
}, "hydrateBlock");
|
|
512
|
+
|
|
513
|
+
// src/block/hydrate/transactionsFromHydratedBlock.ts
|
|
514
|
+
import { filterAs } from "@xylabs/array";
|
|
515
|
+
import { asTransactionBoundWitnessWithStorageMeta } from "@xyo-network/xl1-protocol";
|
|
516
|
+
var transactionsFromHydratedBlock = /* @__PURE__ */ __name((block) => {
|
|
517
|
+
return filterAs(block[1], asTransactionBoundWitnessWithStorageMeta);
|
|
518
|
+
}, "transactionsFromHydratedBlock");
|
|
519
|
+
|
|
520
|
+
// src/block/hydrate/tryHydrateBlock.ts
|
|
521
|
+
import { assertEx as assertEx5 } from "@xylabs/assert";
|
|
522
|
+
import { isBlockBoundWitnessWithStorageMeta, isTransactionBoundWitnessWithStorageMeta as isTransactionBoundWitnessWithStorageMeta3 } from "@xyo-network/xl1-protocol";
|
|
523
|
+
var tryHydrateBlock = /* @__PURE__ */ __name(async (archivist, hash, maxDepth = 1) => {
|
|
524
|
+
assertEx5(maxDepth >= 0, () => "maxDepth must be greater than or equal to 0");
|
|
525
|
+
const bw = (await archivist.get([
|
|
526
|
+
hash
|
|
527
|
+
])).find(isBlockBoundWitnessWithStorageMeta);
|
|
528
|
+
if (!bw) return void 0;
|
|
529
|
+
if (maxDepth === 0) return [
|
|
530
|
+
bw,
|
|
531
|
+
[]
|
|
532
|
+
];
|
|
533
|
+
const blkPayloads = await archivist.get(bw.payload_hashes);
|
|
534
|
+
if (maxDepth === 1) return [
|
|
535
|
+
bw,
|
|
536
|
+
blkPayloads
|
|
537
|
+
];
|
|
538
|
+
const transactions = blkPayloads.filter(isTransactionBoundWitnessWithStorageMeta3);
|
|
539
|
+
const transactionsPayloadHashes = transactions.flatMap((tx) => tx.payload_hashes);
|
|
540
|
+
const transactionsPayloads = await archivist.get(transactionsPayloadHashes);
|
|
541
|
+
const allPayloadsHashes = new Set([
|
|
542
|
+
...blkPayloads,
|
|
543
|
+
...transactionsPayloads
|
|
544
|
+
].flatMap((p) => p._hash));
|
|
545
|
+
const allPayloads = await archivist.get([
|
|
546
|
+
...allPayloadsHashes
|
|
547
|
+
]);
|
|
548
|
+
const allPayloadsFiltered = allPayloads.filter((p) => allPayloadsHashes.has(p._hash));
|
|
549
|
+
return [
|
|
550
|
+
bw,
|
|
551
|
+
allPayloadsFiltered
|
|
552
|
+
];
|
|
553
|
+
}, "tryHydrateBlock");
|
|
554
|
+
|
|
523
555
|
// src/config/Config.ts
|
|
524
|
-
import * as
|
|
556
|
+
import * as z12 from "zod";
|
|
525
557
|
|
|
526
558
|
// src/config/Api.ts
|
|
527
559
|
import { globalRegistry } from "zod";
|
|
@@ -586,11 +618,34 @@ var AppConfigZod = z3.object({
|
|
|
586
618
|
})
|
|
587
619
|
});
|
|
588
620
|
|
|
589
|
-
// src/config/
|
|
621
|
+
// src/config/Bridge.ts
|
|
590
622
|
import { globalRegistry as globalRegistry3 } from "zod";
|
|
591
623
|
import * as z4 from "zod";
|
|
592
|
-
var
|
|
593
|
-
|
|
624
|
+
var BridgeConfigZod = z4.object({
|
|
625
|
+
host: z4.string().default("localhost").register(globalRegistry3, {
|
|
626
|
+
default: "localhost",
|
|
627
|
+
description: "Host for the Bridge",
|
|
628
|
+
title: "api.host",
|
|
629
|
+
type: "string"
|
|
630
|
+
}),
|
|
631
|
+
mnemonic: MnemonicStringZod.optional().register(globalRegistry3, {
|
|
632
|
+
description: "Mnemonic for the Bridge wallet",
|
|
633
|
+
title: "api.mnemonic",
|
|
634
|
+
type: "string"
|
|
635
|
+
}),
|
|
636
|
+
port: z4.coerce.number().default(8081).register(globalRegistry3, {
|
|
637
|
+
default: 8081,
|
|
638
|
+
description: "Port for the Bridge",
|
|
639
|
+
title: "api.port",
|
|
640
|
+
type: "number"
|
|
641
|
+
})
|
|
642
|
+
});
|
|
643
|
+
|
|
644
|
+
// src/config/Chain.ts
|
|
645
|
+
import { globalRegistry as globalRegistry4 } from "zod";
|
|
646
|
+
import * as z5 from "zod";
|
|
647
|
+
var ChainConfigZod = z5.object({
|
|
648
|
+
id: z5.string().optional().register(globalRegistry4, {
|
|
594
649
|
description: "The unique identifier for the chain. Should be the staking contract address for contract-backed chains.",
|
|
595
650
|
title: "chain.id",
|
|
596
651
|
type: "string"
|
|
@@ -598,29 +653,29 @@ var ChainConfigZod = z4.object({
|
|
|
598
653
|
});
|
|
599
654
|
|
|
600
655
|
// src/config/Evm.ts
|
|
601
|
-
import { globalRegistry as
|
|
602
|
-
import * as
|
|
603
|
-
var EvmInfuraConfigZod =
|
|
604
|
-
projectId:
|
|
656
|
+
import { globalRegistry as globalRegistry5 } from "zod";
|
|
657
|
+
import * as z6 from "zod";
|
|
658
|
+
var EvmInfuraConfigZod = z6.object({
|
|
659
|
+
projectId: z6.string().optional().register(globalRegistry5, {
|
|
605
660
|
description: "Infura project ID",
|
|
606
661
|
title: "evm.infura.projectId",
|
|
607
662
|
type: "string"
|
|
608
663
|
}),
|
|
609
|
-
projectSecret:
|
|
664
|
+
projectSecret: z6.string().optional().register(globalRegistry5, {
|
|
610
665
|
description: "Infura project secret",
|
|
611
666
|
title: "evm.infura.projectSecret",
|
|
612
667
|
type: "string"
|
|
613
668
|
})
|
|
614
669
|
});
|
|
615
|
-
var EvmJsonRpcConfigZod =
|
|
616
|
-
url:
|
|
670
|
+
var EvmJsonRpcConfigZod = z6.object({
|
|
671
|
+
url: z6.url().optional().register(globalRegistry5, {
|
|
617
672
|
description: "JSON-RPC URL",
|
|
618
673
|
title: "evm.jsonRpc.url",
|
|
619
674
|
type: "string"
|
|
620
675
|
})
|
|
621
676
|
});
|
|
622
|
-
var EvmConfigZod =
|
|
623
|
-
chainId:
|
|
677
|
+
var EvmConfigZod = z6.object({
|
|
678
|
+
chainId: z6.string().optional().register(globalRegistry5, {
|
|
624
679
|
description: "EVM chain ID",
|
|
625
680
|
title: "evm.chainId",
|
|
626
681
|
type: "string"
|
|
@@ -631,18 +686,18 @@ var EvmConfigZod = z5.object({
|
|
|
631
686
|
|
|
632
687
|
// src/config/Log.ts
|
|
633
688
|
import { LogLevel } from "@xylabs/logger";
|
|
634
|
-
import { globalRegistry as
|
|
635
|
-
import * as
|
|
689
|
+
import { globalRegistry as globalRegistry6 } from "zod";
|
|
690
|
+
import * as z7 from "zod";
|
|
636
691
|
var LogLevels = Object.keys(LogLevel);
|
|
637
|
-
var LogConfigZod =
|
|
638
|
-
logLevel:
|
|
692
|
+
var LogConfigZod = z7.object({
|
|
693
|
+
logLevel: z7.enum(LogLevels).default("info").register(globalRegistry6, {
|
|
639
694
|
choices: LogLevels,
|
|
640
695
|
default: "info",
|
|
641
696
|
description: "Desired process verbosity",
|
|
642
697
|
title: "logLevel",
|
|
643
698
|
type: "string"
|
|
644
699
|
}),
|
|
645
|
-
silent:
|
|
700
|
+
silent: z7.boolean().default(false).register(globalRegistry6, {
|
|
646
701
|
default: false,
|
|
647
702
|
description: "Whether to run in silent mode",
|
|
648
703
|
title: "silent",
|
|
@@ -652,55 +707,55 @@ var LogConfigZod = z6.object({
|
|
|
652
707
|
|
|
653
708
|
// src/config/Producer.ts
|
|
654
709
|
import { AddressZod, asAddress as asAddress3 } from "@xylabs/hex";
|
|
655
|
-
import { globalRegistry as
|
|
656
|
-
import * as
|
|
657
|
-
var ProducerConfigZod =
|
|
658
|
-
allowlist:
|
|
710
|
+
import { globalRegistry as globalRegistry7 } from "zod";
|
|
711
|
+
import * as z8 from "zod";
|
|
712
|
+
var ProducerConfigZod = z8.object({
|
|
713
|
+
allowlist: z8.preprocess((val) => {
|
|
659
714
|
if (typeof val === "string") {
|
|
660
715
|
return val.split(",").map((s) => asAddress3(s.trim()));
|
|
661
716
|
}
|
|
662
717
|
return val;
|
|
663
|
-
},
|
|
718
|
+
}, z8.array(AddressZod).optional().register(globalRegistry7, {
|
|
664
719
|
description: "List of allowed producer addresses, if undefined anyone can participate",
|
|
665
720
|
title: "allowlist",
|
|
666
721
|
type: "array"
|
|
667
722
|
})),
|
|
668
|
-
disableIntentRedeclaration:
|
|
723
|
+
disableIntentRedeclaration: z8.boolean().optional().register(globalRegistry7, {
|
|
669
724
|
description: "Should the producer skip redeclaring their intent to continue producing blocks",
|
|
670
725
|
title: "producer.disableIntentRedeclaration",
|
|
671
726
|
type: "boolean"
|
|
672
727
|
}),
|
|
673
728
|
// TODO: Port schema
|
|
674
|
-
healthCheckPort:
|
|
729
|
+
healthCheckPort: z8.coerce.number().optional().register(globalRegistry7, {
|
|
675
730
|
description: "Port for the Producer health checks",
|
|
676
731
|
title: "producer.healthCheckPort",
|
|
677
732
|
type: "number"
|
|
678
733
|
}),
|
|
679
|
-
heartbeatInterval:
|
|
734
|
+
heartbeatInterval: z8.coerce.number().default(36e5).register(globalRegistry7, {
|
|
680
735
|
description: "The number of milliseconds between heartbeats if no blocks are produced",
|
|
681
736
|
title: "producer.heartbeatInterval",
|
|
682
737
|
type: "number"
|
|
683
738
|
}),
|
|
684
739
|
// TODO: BigInt schema
|
|
685
|
-
minStake:
|
|
740
|
+
minStake: z8.coerce.number().default(1).register(globalRegistry7, {
|
|
686
741
|
description: "Minimum stake required to be a Producer",
|
|
687
742
|
title: "producer.minStake",
|
|
688
743
|
type: "number"
|
|
689
744
|
}),
|
|
690
|
-
mnemonic: MnemonicStringZod.optional().register(
|
|
745
|
+
mnemonic: MnemonicStringZod.optional().register(globalRegistry7, {
|
|
691
746
|
description: "Mnemonic for the Producer wallet",
|
|
692
747
|
title: "producer.mnemonic",
|
|
693
748
|
type: "string"
|
|
694
749
|
}),
|
|
695
750
|
// TODO: Port schema
|
|
696
|
-
port:
|
|
751
|
+
port: z8.coerce.number().default(8081).register(globalRegistry7, {
|
|
697
752
|
default: 8081,
|
|
698
753
|
description: "Port for the Producer",
|
|
699
754
|
title: "producer.port",
|
|
700
755
|
type: "number"
|
|
701
756
|
}),
|
|
702
757
|
// TODO: Address schema
|
|
703
|
-
rewardAddress:
|
|
758
|
+
rewardAddress: z8.string().optional().register(globalRegistry7, {
|
|
704
759
|
description: "Address to receive block rewards",
|
|
705
760
|
title: "producer.rewardAddress",
|
|
706
761
|
type: "string"
|
|
@@ -708,36 +763,36 @@ var ProducerConfigZod = z7.object({
|
|
|
708
763
|
});
|
|
709
764
|
|
|
710
765
|
// src/config/storage/driver/Mongo.ts
|
|
711
|
-
import { isDefined as
|
|
712
|
-
import { globalRegistry as
|
|
713
|
-
import * as
|
|
766
|
+
import { isDefined as isDefined4, isUndefined } from "@xylabs/typeof";
|
|
767
|
+
import { globalRegistry as globalRegistry8 } from "zod";
|
|
768
|
+
import * as z9 from "zod";
|
|
714
769
|
var hasMongoConfig = /* @__PURE__ */ __name((config) => {
|
|
715
770
|
if (isUndefined(config)) return false;
|
|
716
|
-
return
|
|
771
|
+
return isDefined4(config.connectionString) && isDefined4(config.database) && isDefined4(config.domain) && isDefined4(config.password) && isDefined4(config.username);
|
|
717
772
|
}, "hasMongoConfig");
|
|
718
|
-
var MongoConfigZod =
|
|
773
|
+
var MongoConfigZod = z9.object({
|
|
719
774
|
// TODO: Create from other arguments
|
|
720
|
-
connectionString:
|
|
775
|
+
connectionString: z9.string().min(1).optional().register(globalRegistry8, {
|
|
721
776
|
description: "MongoDB connection string",
|
|
722
777
|
title: "storage.mongo.connectionString",
|
|
723
778
|
type: "string"
|
|
724
779
|
}),
|
|
725
|
-
database:
|
|
780
|
+
database: z9.string().min(1).optional().register(globalRegistry8, {
|
|
726
781
|
description: "MongoDB database name",
|
|
727
782
|
title: "storage.mongo.database",
|
|
728
783
|
type: "string"
|
|
729
784
|
}),
|
|
730
|
-
domain:
|
|
785
|
+
domain: z9.string().min(1).optional().register(globalRegistry8, {
|
|
731
786
|
description: "MongoDB domain",
|
|
732
787
|
title: "storage.mongo.domain",
|
|
733
788
|
type: "string"
|
|
734
789
|
}),
|
|
735
|
-
password:
|
|
790
|
+
password: z9.string().min(1).optional().register(globalRegistry8, {
|
|
736
791
|
description: "MongoDB password",
|
|
737
792
|
title: "storage.mongo.password",
|
|
738
793
|
type: "string"
|
|
739
794
|
}),
|
|
740
|
-
username:
|
|
795
|
+
username: z9.string().min(1).optional().register(globalRegistry8, {
|
|
741
796
|
description: "MongoDB username",
|
|
742
797
|
title: "storage.mongo.username",
|
|
743
798
|
type: "string"
|
|
@@ -745,11 +800,11 @@ var MongoConfigZod = z8.object({
|
|
|
745
800
|
});
|
|
746
801
|
|
|
747
802
|
// src/config/storage/Storage.ts
|
|
748
|
-
import { globalRegistry as
|
|
749
|
-
import * as
|
|
750
|
-
var StorageConfigZod =
|
|
803
|
+
import { globalRegistry as globalRegistry9 } from "zod";
|
|
804
|
+
import * as z10 from "zod";
|
|
805
|
+
var StorageConfigZod = z10.object({
|
|
751
806
|
mongo: MongoConfigZod.optional().describe("Configuration for the MongoD storage driver"),
|
|
752
|
-
root:
|
|
807
|
+
root: z10.string().optional().register(globalRegistry9, {
|
|
753
808
|
description: "Root directory for local storage",
|
|
754
809
|
title: "storage.root",
|
|
755
810
|
type: "string"
|
|
@@ -757,29 +812,30 @@ var StorageConfigZod = z9.object({
|
|
|
757
812
|
}).describe("Storage configuration options");
|
|
758
813
|
|
|
759
814
|
// src/config/Telemetry.ts
|
|
760
|
-
import { globalRegistry as
|
|
761
|
-
import * as
|
|
762
|
-
var OpenTelemetryConfigZod =
|
|
815
|
+
import { globalRegistry as globalRegistry10 } from "zod";
|
|
816
|
+
import * as z11 from "zod";
|
|
817
|
+
var OpenTelemetryConfigZod = z11.object({
|
|
763
818
|
// OpenTelemetry options
|
|
764
|
-
otlpEndpoint:
|
|
819
|
+
otlpEndpoint: z11.url().optional().register(globalRegistry10, {
|
|
765
820
|
description: "OTLP endpoint for exporting telemetry data",
|
|
766
821
|
title: "telemetry.otel.otlpEndpoint",
|
|
767
822
|
type: "string"
|
|
768
823
|
})
|
|
769
824
|
});
|
|
770
|
-
var TelemetryConfigZod =
|
|
825
|
+
var TelemetryConfigZod = z11.object({
|
|
771
826
|
// OpenTelemetry configuration
|
|
772
827
|
otel: OpenTelemetryConfigZod.optional().describe("OpenTelemetry configuration")
|
|
773
828
|
}).describe("Telemetry configuration options");
|
|
774
829
|
|
|
775
830
|
// src/config/Config.ts
|
|
776
|
-
var Xl1CommonConfigSchema =
|
|
831
|
+
var Xl1CommonConfigSchema = z12.object({
|
|
777
832
|
...LogConfigZod.shape
|
|
778
833
|
}).describe("XL1 common configuration options");
|
|
779
|
-
var ConfigZod =
|
|
834
|
+
var ConfigZod = z12.object({
|
|
780
835
|
...Xl1CommonConfigSchema.shape,
|
|
781
836
|
api: ApiConfigZod.default(ApiConfigZod.parse({})).describe("Configuration for the API node"),
|
|
782
837
|
app: AppConfigZod.default(AppConfigZod.parse({})).describe("Configuration for the application"),
|
|
838
|
+
bridge: BridgeConfigZod.default(BridgeConfigZod.parse({})).describe("Configuration for the Bridge node"),
|
|
783
839
|
chain: ChainConfigZod.default(ChainConfigZod.parse({})).describe("Configuration for the chain"),
|
|
784
840
|
evm: EvmConfigZod.default(EvmConfigZod.parse({})).describe("Configuration for EVM-backed services"),
|
|
785
841
|
producer: ProducerConfigZod.default(ProducerConfigZod.parse({})).describe("Configuration for the producer"),
|
|
@@ -789,35 +845,35 @@ var ConfigZod = z11.object({
|
|
|
789
845
|
var getDefaultConfig = /* @__PURE__ */ __name(() => ConfigZod.parse({}), "getDefaultConfig");
|
|
790
846
|
|
|
791
847
|
// src/config/UsageMeta.ts
|
|
792
|
-
import * as
|
|
793
|
-
var DescriptionSchema =
|
|
794
|
-
var TitleSchema =
|
|
795
|
-
var JSONSchemaMetaSchema =
|
|
796
|
-
id:
|
|
848
|
+
import * as z13 from "zod";
|
|
849
|
+
var DescriptionSchema = z13.string();
|
|
850
|
+
var TitleSchema = z13.string();
|
|
851
|
+
var JSONSchemaMetaSchema = z13.object({
|
|
852
|
+
id: z13.string().optional(),
|
|
797
853
|
title: TitleSchema.optional(),
|
|
798
854
|
description: DescriptionSchema.optional(),
|
|
799
|
-
deprecated:
|
|
800
|
-
}).catchall(
|
|
855
|
+
deprecated: z13.boolean().optional()
|
|
856
|
+
}).catchall(z13.unknown());
|
|
801
857
|
var GlobalMetaSchema = JSONSchemaMetaSchema.extend({});
|
|
802
|
-
var ChoicesSchema =
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
858
|
+
var ChoicesSchema = z13.array(z13.union([
|
|
859
|
+
z13.string(),
|
|
860
|
+
z13.number(),
|
|
861
|
+
z13.literal(true),
|
|
862
|
+
z13.undefined()
|
|
807
863
|
])).readonly();
|
|
808
864
|
var UsageMetaSchema = GlobalMetaSchema.extend({
|
|
809
865
|
choices: ChoicesSchema.optional(),
|
|
810
|
-
default:
|
|
866
|
+
default: z13.unknown().optional(),
|
|
811
867
|
description: DescriptionSchema,
|
|
812
|
-
group:
|
|
813
|
-
hidden:
|
|
868
|
+
group: z13.string().optional(),
|
|
869
|
+
hidden: z13.boolean().optional(),
|
|
814
870
|
title: TitleSchema,
|
|
815
|
-
type:
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
871
|
+
type: z13.union([
|
|
872
|
+
z13.literal("array"),
|
|
873
|
+
z13.literal("count"),
|
|
874
|
+
z13.literal("boolean"),
|
|
875
|
+
z13.literal("number"),
|
|
876
|
+
z13.literal("string")
|
|
821
877
|
])
|
|
822
878
|
});
|
|
823
879
|
function isUsageMeta(v) {
|
|
@@ -825,6 +881,13 @@ function isUsageMeta(v) {
|
|
|
825
881
|
}
|
|
826
882
|
__name(isUsageMeta, "isUsageMeta");
|
|
827
883
|
|
|
884
|
+
// src/model/StakeEvents.ts
|
|
885
|
+
var StakeEventNames = [
|
|
886
|
+
"StakeAdded",
|
|
887
|
+
"StakeRemoved",
|
|
888
|
+
"StakeWithdrawn"
|
|
889
|
+
];
|
|
890
|
+
|
|
828
891
|
// src/steps/primitives/addressStakeWeight.ts
|
|
829
892
|
import { toAddress as toAddress2 } from "@xylabs/hex";
|
|
830
893
|
import { XYO_NETWORK_STAKING_ADDRESS } from "@xyo-network/xl1-protocol";
|
|
@@ -879,70 +942,6 @@ function claimedRewards(_address) {
|
|
|
879
942
|
}
|
|
880
943
|
__name(claimedRewards, "claimedRewards");
|
|
881
944
|
|
|
882
|
-
// src/steps/primitives/networkStakeStepAddressReward.ts
|
|
883
|
-
function networkStakeStepAddressReward(address, _step, _block) {
|
|
884
|
-
return {
|
|
885
|
-
[address]: 0n
|
|
886
|
-
};
|
|
887
|
-
}
|
|
888
|
-
__name(networkStakeStepAddressReward, "networkStakeStepAddressReward");
|
|
889
|
-
|
|
890
|
-
// src/steps/primitives/networkStakeStepPoolRewards.ts
|
|
891
|
-
function networkStakeStepPoolRewards(_step, _block) {
|
|
892
|
-
return {};
|
|
893
|
-
}
|
|
894
|
-
__name(networkStakeStepPoolRewards, "networkStakeStepPoolRewards");
|
|
895
|
-
|
|
896
|
-
// src/steps/primitives/networkStakeStepPoolRewardShares.ts
|
|
897
|
-
function networkStakeStepPoolRewardShares(_step, _block) {
|
|
898
|
-
return {};
|
|
899
|
-
}
|
|
900
|
-
__name(networkStakeStepPoolRewardShares, "networkStakeStepPoolRewardShares");
|
|
901
|
-
|
|
902
|
-
// src/steps/primitives/networkStakeStepRewardAddressHistory.ts
|
|
903
|
-
function networkStakeStepRewardAddressHistory(address) {
|
|
904
|
-
return {
|
|
905
|
-
[address]: 0n
|
|
906
|
-
};
|
|
907
|
-
}
|
|
908
|
-
__name(networkStakeStepRewardAddressHistory, "networkStakeStepRewardAddressHistory");
|
|
909
|
-
|
|
910
|
-
// src/steps/primitives/networkStakeStepRewardAddressShare.ts
|
|
911
|
-
function networkStakeStepRewardAddressShare(_address, _step, _block) {
|
|
912
|
-
throw new Error("Method not implemented.");
|
|
913
|
-
}
|
|
914
|
-
__name(networkStakeStepRewardAddressShare, "networkStakeStepRewardAddressShare");
|
|
915
|
-
|
|
916
|
-
// src/steps/primitives/networkStakeStepRewardForStep.ts
|
|
917
|
-
function networkStakeStepRewardForStep(_step) {
|
|
918
|
-
return 0n;
|
|
919
|
-
}
|
|
920
|
-
__name(networkStakeStepRewardForStep, "networkStakeStepRewardForStep");
|
|
921
|
-
|
|
922
|
-
// src/steps/primitives/networkStakeStepRewardPositionWeight.ts
|
|
923
|
-
function networkStakeStepRewardPositionWeight(_position, _step) {
|
|
924
|
-
throw new Error("Method not implemented.");
|
|
925
|
-
}
|
|
926
|
-
__name(networkStakeStepRewardPositionWeight, "networkStakeStepRewardPositionWeight");
|
|
927
|
-
|
|
928
|
-
// src/steps/primitives/networkStakeStepRewardPotentialPositionLoss.ts
|
|
929
|
-
function networkStakeStepRewardPotentialPositionLoss(_position, _step) {
|
|
930
|
-
throw new Error("Method not implemented.");
|
|
931
|
-
}
|
|
932
|
-
__name(networkStakeStepRewardPotentialPositionLoss, "networkStakeStepRewardPotentialPositionLoss");
|
|
933
|
-
|
|
934
|
-
// src/steps/primitives/networkStakeStepRewardRandomizer.ts
|
|
935
|
-
function networkStakeStepRewardRandomizer(_step, _block) {
|
|
936
|
-
throw new Error("Method not implemented.");
|
|
937
|
-
}
|
|
938
|
-
__name(networkStakeStepRewardRandomizer, "networkStakeStepRewardRandomizer");
|
|
939
|
-
|
|
940
|
-
// src/steps/primitives/networkStakeStepRewardWeightForAddress.ts
|
|
941
|
-
function networkStakeStepRewardWeightForAddress(_address, _step) {
|
|
942
|
-
throw new Error("Method not implemented.");
|
|
943
|
-
}
|
|
944
|
-
__name(networkStakeStepRewardWeightForAddress, "networkStakeStepRewardWeightForAddress");
|
|
945
|
-
|
|
946
945
|
// src/steps/primitives/stakersAsOfBlock.ts
|
|
947
946
|
import { toAddress as toAddress4 } from "@xylabs/hex";
|
|
948
947
|
|
|
@@ -1038,7 +1037,7 @@ import { assertEx as assertEx6 } from "@xylabs/assert";
|
|
|
1038
1037
|
import { asTimePayload, TimeSchema } from "@xyo-network/xl1-protocol";
|
|
1039
1038
|
async function xl1BlockNumberToEthBlockNumber(context, xl1BlockNumber) {
|
|
1040
1039
|
const blockHash = await hashFromBlockNumber(context, xl1BlockNumber);
|
|
1041
|
-
const hydratedBlock = await hydrateBlock(context.
|
|
1040
|
+
const hydratedBlock = await hydrateBlock(context.store, blockHash);
|
|
1042
1041
|
const timePayload = asTimePayload(hydratedBlock[1].find((p) => p.schema === TimeSchema), {
|
|
1043
1042
|
required: true
|
|
1044
1043
|
});
|
|
@@ -1138,7 +1137,7 @@ __name(buildUnsignedTransaction, "buildUnsignedTransaction");
|
|
|
1138
1137
|
|
|
1139
1138
|
// src/transaction/confirmSubmittedTransaction.ts
|
|
1140
1139
|
import { delay } from "@xylabs/delay";
|
|
1141
|
-
import { isDefined as
|
|
1140
|
+
import { isDefined as isDefined5 } from "@xylabs/typeof";
|
|
1142
1141
|
import { PayloadBuilder as PayloadBuilder5 } from "@xyo-network/payload-builder";
|
|
1143
1142
|
var DEFAULT_CONFIRMATION_ATTEMPTS = 20;
|
|
1144
1143
|
var DEFAULT_DELAY_BETWEEN_ATTEMPTS = 1e3;
|
|
@@ -1149,7 +1148,7 @@ var confirmSubmittedTransaction = /* @__PURE__ */ __name(async (viewer, transact
|
|
|
1149
1148
|
let attempts = 0;
|
|
1150
1149
|
while (true) {
|
|
1151
1150
|
const tx = await viewer.transactionByHash(txBWHash) ?? void 0;
|
|
1152
|
-
if (
|
|
1151
|
+
if (isDefined5(tx)) {
|
|
1153
1152
|
options?.logger?.log("\u2705 Transaction confirmed:", txBWHash, "\n");
|
|
1154
1153
|
return tx;
|
|
1155
1154
|
} else {
|
|
@@ -1169,11 +1168,25 @@ var confirmSubmittedTransaction = /* @__PURE__ */ __name(async (viewer, transact
|
|
|
1169
1168
|
import { assertEx as assertEx8 } from "@xylabs/assert";
|
|
1170
1169
|
import { hydrateTypedBoundWitness, tryHydrateTypedBoundWitness } from "@xyo-network/archivist-model";
|
|
1171
1170
|
import { isAllowedBlockPayload, isSignedTransactionBoundWitnessWithStorageMeta } from "@xyo-network/xl1-protocol";
|
|
1172
|
-
var tryHydrateTransaction = /* @__PURE__ */ __name(async (
|
|
1173
|
-
return await tryHydrateTypedBoundWitness(
|
|
1171
|
+
var tryHydrateTransaction = /* @__PURE__ */ __name(async ({ chainMap }, hash) => {
|
|
1172
|
+
return await tryHydrateTypedBoundWitness({
|
|
1173
|
+
get(hashes) {
|
|
1174
|
+
return chainMap.getMany(hashes);
|
|
1175
|
+
},
|
|
1176
|
+
next() {
|
|
1177
|
+
throw new Error("Not implemented");
|
|
1178
|
+
}
|
|
1179
|
+
}, hash, isSignedTransactionBoundWitnessWithStorageMeta);
|
|
1174
1180
|
}, "tryHydrateTransaction");
|
|
1175
|
-
var hydrateTransaction = /* @__PURE__ */ __name(async (
|
|
1176
|
-
return await hydrateTypedBoundWitness(
|
|
1181
|
+
var hydrateTransaction = /* @__PURE__ */ __name(async ({ chainMap }, hash) => {
|
|
1182
|
+
return await hydrateTypedBoundWitness({
|
|
1183
|
+
get(hashes) {
|
|
1184
|
+
return chainMap.getMany(hashes);
|
|
1185
|
+
},
|
|
1186
|
+
next() {
|
|
1187
|
+
throw new Error("Not implemented");
|
|
1188
|
+
}
|
|
1189
|
+
}, hash, isSignedTransactionBoundWitnessWithStorageMeta);
|
|
1177
1190
|
}, "hydrateTransaction");
|
|
1178
1191
|
var flattenHydratedTransaction = /* @__PURE__ */ __name((hydratedTransaction) => {
|
|
1179
1192
|
const [tx, txPayloads] = hydratedTransaction;
|
|
@@ -1183,8 +1196,10 @@ var flattenHydratedTransaction = /* @__PURE__ */ __name((hydratedTransaction) =>
|
|
|
1183
1196
|
];
|
|
1184
1197
|
}, "flattenHydratedTransaction");
|
|
1185
1198
|
var flattenHydratedTransactions = /* @__PURE__ */ __name((hydratedTransactions) => hydratedTransactions.flatMap((tx) => flattenHydratedTransaction(tx)), "flattenHydratedTransactions");
|
|
1186
|
-
var tryHydrateElevatedTransaction = /* @__PURE__ */ __name(async (
|
|
1187
|
-
const hydratedTransaction = await tryHydrateTransaction(
|
|
1199
|
+
var tryHydrateElevatedTransaction = /* @__PURE__ */ __name(async ({ chainMap }, hash) => {
|
|
1200
|
+
const hydratedTransaction = await tryHydrateTransaction({
|
|
1201
|
+
chainMap
|
|
1202
|
+
}, hash);
|
|
1188
1203
|
if (!hydratedTransaction) {
|
|
1189
1204
|
return void 0;
|
|
1190
1205
|
}
|
|
@@ -1208,8 +1223,8 @@ var tryHydrateElevatedTransaction = /* @__PURE__ */ __name(async (archivist, has
|
|
|
1208
1223
|
}
|
|
1209
1224
|
return void 0;
|
|
1210
1225
|
}, "tryHydrateElevatedTransaction");
|
|
1211
|
-
var hydrateElevatedTransaction = /* @__PURE__ */ __name(async (
|
|
1212
|
-
return assertEx8(await tryHydrateElevatedTransaction(
|
|
1226
|
+
var hydrateElevatedTransaction = /* @__PURE__ */ __name(async (context, hash) => {
|
|
1227
|
+
return assertEx8(await tryHydrateElevatedTransaction(context, hash), () => "Hydration failed");
|
|
1213
1228
|
}, "hydrateElevatedTransaction");
|
|
1214
1229
|
|
|
1215
1230
|
// src/transaction/primitives/transactionBlockByteCount.ts
|
|
@@ -1365,6 +1380,7 @@ export {
|
|
|
1365
1380
|
GlobalMetaSchema,
|
|
1366
1381
|
JSONSchemaMetaSchema,
|
|
1367
1382
|
MnemonicStringZod,
|
|
1383
|
+
StakeEventNames,
|
|
1368
1384
|
StepSummarySchema,
|
|
1369
1385
|
TODO,
|
|
1370
1386
|
TransfersStepSummarySchema,
|
|
@@ -1408,22 +1424,14 @@ export {
|
|
|
1408
1424
|
isLocalhost,
|
|
1409
1425
|
isNegativeBigInt,
|
|
1410
1426
|
isPositiveBigInt,
|
|
1427
|
+
isReadArchivist,
|
|
1411
1428
|
isTransfersStepSummary,
|
|
1412
1429
|
isTransfersStepSummaryWithStorageMeta,
|
|
1413
1430
|
isUsageMeta,
|
|
1414
1431
|
netBalancesForPayloads,
|
|
1415
1432
|
netTransfersForPayloads,
|
|
1416
|
-
networkStakeStepAddressReward,
|
|
1417
|
-
networkStakeStepPoolRewardShares,
|
|
1418
|
-
networkStakeStepPoolRewards,
|
|
1419
|
-
networkStakeStepRewardAddressHistory,
|
|
1420
|
-
networkStakeStepRewardAddressShare,
|
|
1421
|
-
networkStakeStepRewardForStep,
|
|
1422
|
-
networkStakeStepRewardPositionWeight,
|
|
1423
|
-
networkStakeStepRewardPotentialPositionLoss,
|
|
1424
|
-
networkStakeStepRewardRandomizer,
|
|
1425
|
-
networkStakeStepRewardWeightForAddress,
|
|
1426
1433
|
parseSignedBigInt,
|
|
1434
|
+
readPayloadMapFromStore,
|
|
1427
1435
|
signTransaction,
|
|
1428
1436
|
stakersAsOfBlock,
|
|
1429
1437
|
startingStakes,
|