@xyo-network/xl1-protocol-sdk 1.15.28 → 1.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/neutral/ChainServiceCollectionV2.d.ts +1 -1
- package/dist/neutral/ChainServiceCollectionV2.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 +3 -2
- package/dist/neutral/block/primitives/transfers/transfersSummary.d.ts.map +1 -1
- package/dist/neutral/config/Config.d.ts +6 -0
- package/dist/neutral/config/Config.d.ts.map +1 -1
- package/dist/neutral/config/Mempool.d.ts +9 -0
- package/dist/neutral/config/Mempool.d.ts.map +1 -0
- package/dist/neutral/index.d.ts +3 -0
- package/dist/neutral/index.d.ts.map +1 -1
- package/dist/neutral/index.mjs +239 -126
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/interfaces/index.d.ts +2 -0
- package/dist/neutral/interfaces/index.d.ts.map +1 -0
- package/dist/neutral/interfaces/viewers/AccountBalance.d.ts +19 -0
- package/dist/neutral/interfaces/viewers/AccountBalance.d.ts.map +1 -0
- package/dist/neutral/interfaces/viewers/Block.d.ts +12 -0
- package/dist/neutral/interfaces/viewers/Block.d.ts.map +1 -0
- package/dist/neutral/interfaces/viewers/Chain.d.ts +6 -0
- package/dist/neutral/interfaces/viewers/Chain.d.ts.map +1 -0
- package/dist/neutral/interfaces/viewers/ChainContract.d.ts +10 -0
- package/dist/neutral/interfaces/viewers/ChainContract.d.ts.map +1 -0
- package/dist/neutral/interfaces/viewers/Fork.d.ts +8 -0
- package/dist/neutral/interfaces/viewers/Fork.d.ts.map +1 -0
- package/dist/neutral/interfaces/viewers/NetworkStakeStepReward.d.ts +30 -0
- package/dist/neutral/interfaces/viewers/NetworkStakeStepReward.d.ts.map +1 -0
- package/dist/neutral/interfaces/viewers/Stake.d.ts +14 -0
- package/dist/neutral/interfaces/viewers/Stake.d.ts.map +1 -0
- package/dist/neutral/interfaces/viewers/StakeTotalsViewer.d.ts +12 -0
- package/dist/neutral/interfaces/viewers/StakeTotalsViewer.d.ts.map +1 -0
- package/dist/neutral/interfaces/viewers/StakeViewer.d.ts +11 -0
- package/dist/neutral/interfaces/viewers/StakeViewer.d.ts.map +1 -0
- package/dist/neutral/interfaces/viewers/StepStake.d.ts +8 -0
- package/dist/neutral/interfaces/viewers/StepStake.d.ts.map +1 -0
- package/dist/neutral/interfaces/viewers/TimeSync.d.ts +16 -0
- package/dist/neutral/interfaces/viewers/TimeSync.d.ts.map +1 -0
- package/dist/neutral/interfaces/viewers/Transaction.d.ts +9 -0
- package/dist/neutral/interfaces/viewers/Transaction.d.ts.map +1 -0
- package/dist/neutral/interfaces/viewers/TransferBalance.d.ts +23 -0
- package/dist/neutral/interfaces/viewers/TransferBalance.d.ts.map +1 -0
- package/dist/neutral/interfaces/viewers/index.d.ts +14 -0
- package/dist/neutral/interfaces/viewers/index.d.ts.map +1 -0
- package/dist/neutral/model/ChainStake/ChainStakeRead.d.ts +1 -1
- package/dist/neutral/model/ChainStake/ChainStakeRead.d.ts.map +1 -1
- package/dist/neutral/model/RecordKeyType.d.ts +2 -0
- package/dist/neutral/model/RecordKeyType.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/model/summary.d.ts +2 -2
- package/dist/neutral/model/summary.d.ts.map +1 -1
- package/dist/neutral/provider/DataLake.d.ts +11 -0
- package/dist/neutral/provider/DataLake.d.ts.map +1 -0
- package/dist/neutral/provider/TransactionHelper.d.ts +8 -0
- package/dist/neutral/provider/TransactionHelper.d.ts.map +1 -0
- package/dist/neutral/provider/TransactionSubmitter.d.ts +18 -0
- package/dist/neutral/provider/TransactionSubmitter.d.ts.map +1 -0
- package/dist/neutral/provider/XyoClient.d.ts +19 -0
- package/dist/neutral/provider/XyoClient.d.ts.map +1 -0
- package/dist/neutral/provider/XyoConnection.d.ts +34 -0
- package/dist/neutral/provider/XyoConnection.d.ts.map +1 -0
- package/dist/neutral/provider/XyoGateway.d.ts +19 -0
- package/dist/neutral/provider/XyoGateway.d.ts.map +1 -0
- package/dist/neutral/provider/XyoGatewayHelpers.d.ts +16 -0
- package/dist/neutral/provider/XyoGatewayHelpers.d.ts.map +1 -0
- package/dist/neutral/provider/XyoNetwork.d.ts +6 -0
- package/dist/neutral/provider/XyoNetwork.d.ts.map +1 -0
- package/dist/neutral/provider/XyoRunner.d.ts +7 -0
- package/dist/neutral/provider/XyoRunner.d.ts.map +1 -0
- package/dist/neutral/provider/XyoSigner.d.ts +14 -0
- package/dist/neutral/provider/XyoSigner.d.ts.map +1 -0
- package/dist/neutral/provider/XyoWallet.d.ts +15 -0
- package/dist/neutral/provider/XyoWallet.d.ts.map +1 -0
- package/dist/neutral/provider/index.d.ts +13 -0
- package/dist/neutral/provider/index.d.ts.map +1 -0
- package/dist/neutral/provider/permissions/InvokerPermission.d.ts +51 -0
- package/dist/neutral/provider/permissions/InvokerPermission.d.ts.map +1 -0
- package/dist/neutral/provider/permissions/XyoPermissions.d.ts +32 -0
- package/dist/neutral/provider/permissions/XyoPermissions.d.ts.map +1 -0
- package/dist/neutral/provider/permissions/index.d.ts +3 -0
- package/dist/neutral/provider/permissions/index.d.ts.map +1 -0
- package/dist/neutral/provider/viewer/NetworkStake/NetworkStakeViewer.d.ts +10 -0
- package/dist/neutral/provider/viewer/NetworkStake/NetworkStakeViewer.d.ts.map +1 -0
- package/dist/neutral/provider/viewer/NetworkStake/Rewards/ByPositionViewer.d.ts +7 -0
- package/dist/neutral/provider/viewer/NetworkStake/Rewards/ByPositionViewer.d.ts.map +1 -0
- package/dist/neutral/provider/viewer/NetworkStake/Rewards/ByStakerViewer.d.ts +8 -0
- package/dist/neutral/provider/viewer/NetworkStake/Rewards/ByStakerViewer.d.ts.map +1 -0
- package/dist/neutral/provider/viewer/NetworkStake/Rewards/ByStepViewer.d.ts +8 -0
- package/dist/neutral/provider/viewer/NetworkStake/Rewards/ByStepViewer.d.ts.map +1 -0
- package/dist/neutral/provider/viewer/NetworkStake/Rewards/Options.d.ts +15 -0
- package/dist/neutral/provider/viewer/NetworkStake/Rewards/Options.d.ts.map +1 -0
- package/dist/neutral/provider/viewer/NetworkStake/Rewards/TotalViewer.d.ts +8 -0
- package/dist/neutral/provider/viewer/NetworkStake/Rewards/TotalViewer.d.ts.map +1 -0
- package/dist/neutral/provider/viewer/NetworkStake/Rewards/Viewer.d.ts +13 -0
- package/dist/neutral/provider/viewer/NetworkStake/Rewards/Viewer.d.ts.map +1 -0
- package/dist/neutral/provider/viewer/NetworkStake/Rewards/index.d.ts +8 -0
- package/dist/neutral/provider/viewer/NetworkStake/Rewards/index.d.ts.map +1 -0
- package/dist/neutral/provider/viewer/NetworkStake/Rewards/templates/ByIndexMethodsTemplate.d.ts +6 -0
- package/dist/neutral/provider/viewer/NetworkStake/Rewards/templates/ByIndexMethodsTemplate.d.ts.map +1 -0
- package/dist/neutral/provider/viewer/NetworkStake/Rewards/templates/MethodsTemplate.d.ts +9 -0
- package/dist/neutral/provider/viewer/NetworkStake/Rewards/templates/MethodsTemplate.d.ts.map +1 -0
- package/dist/neutral/provider/viewer/NetworkStake/Rewards/templates/index.d.ts +3 -0
- package/dist/neutral/provider/viewer/NetworkStake/Rewards/templates/index.d.ts.map +1 -0
- package/dist/neutral/provider/viewer/NetworkStake/index.d.ts +3 -0
- package/dist/neutral/provider/viewer/NetworkStake/index.d.ts.map +1 -0
- package/dist/neutral/provider/viewer/StepViewer.d.ts +30 -0
- package/dist/neutral/provider/viewer/StepViewer.d.ts.map +1 -0
- package/dist/neutral/provider/viewer/XyoViewer.d.ts +10 -0
- package/dist/neutral/provider/viewer/XyoViewer.d.ts.map +1 -0
- package/dist/neutral/provider/viewer/index.d.ts +4 -0
- package/dist/neutral/provider/viewer/index.d.ts.map +1 -0
- package/dist/neutral/services/AccountBalanceService.d.ts +16 -0
- package/dist/neutral/services/AccountBalanceService.d.ts.map +1 -0
- package/dist/neutral/services/AccountTransfersService.d.ts +11 -0
- package/dist/neutral/services/AccountTransfersService.d.ts.map +1 -0
- package/dist/neutral/services/BlockProducerService.d.ts +6 -0
- package/dist/neutral/services/BlockProducerService.d.ts.map +1 -0
- package/dist/neutral/services/BlockRewardService.d.ts +6 -0
- package/dist/neutral/services/BlockRewardService.d.ts.map +1 -0
- package/dist/neutral/services/BlockRewardServiceV2.d.ts +6 -0
- package/dist/neutral/services/BlockRewardServiceV2.d.ts.map +1 -0
- package/dist/neutral/services/Chain/BaseChainService.d.ts +6 -0
- package/dist/neutral/services/Chain/BaseChainService.d.ts.map +1 -0
- package/dist/neutral/services/Chain/ChainHeadService.d.ts +6 -0
- package/dist/neutral/services/Chain/ChainHeadService.d.ts.map +1 -0
- package/dist/neutral/services/Chain/ChainService.d.ts +5 -0
- package/dist/neutral/services/Chain/ChainService.d.ts.map +1 -0
- package/dist/neutral/services/Chain/index.d.ts +5 -0
- package/dist/neutral/services/Chain/index.d.ts.map +1 -0
- package/dist/neutral/services/Chain/interfaces/ChainContractViewer.d.ts +4 -0
- package/dist/neutral/services/Chain/interfaces/ChainContractViewer.d.ts.map +1 -0
- package/dist/neutral/services/Chain/interfaces/ChainStakeViewer.d.ts +5 -0
- package/dist/neutral/services/Chain/interfaces/ChainStakeViewer.d.ts.map +1 -0
- package/dist/neutral/services/Chain/interfaces/ChainStaker.d.ts +6 -0
- package/dist/neutral/services/Chain/interfaces/ChainStaker.d.ts.map +1 -0
- package/dist/neutral/services/Chain/interfaces/index.d.ts +4 -0
- package/dist/neutral/services/Chain/interfaces/index.d.ts.map +1 -0
- package/dist/neutral/services/ChainIterator/ChainIteratorService.d.ts +23 -0
- package/dist/neutral/services/ChainIterator/ChainIteratorService.d.ts.map +1 -0
- package/dist/neutral/services/ChainIterator/ChainIteratorServiceEventData.d.ts +11 -0
- package/dist/neutral/services/ChainIterator/ChainIteratorServiceEventData.d.ts.map +1 -0
- package/dist/neutral/services/ChainIterator/index.d.ts +3 -0
- package/dist/neutral/services/ChainIterator/index.d.ts.map +1 -0
- package/dist/neutral/services/Election.d.ts +12 -0
- package/dist/neutral/services/Election.d.ts.map +1 -0
- package/dist/neutral/services/NetworkStakeService.d.ts +5 -0
- package/dist/neutral/services/NetworkStakeService.d.ts.map +1 -0
- package/dist/neutral/services/Params.d.ts +9 -0
- package/dist/neutral/services/Params.d.ts.map +1 -0
- package/dist/neutral/services/PendingTransactionsService.d.ts +7 -0
- package/dist/neutral/services/PendingTransactionsService.d.ts.map +1 -0
- package/dist/neutral/services/Service.d.ts +5 -0
- package/dist/neutral/services/Service.d.ts.map +1 -0
- package/dist/neutral/services/StakeIntentService/ChainIndexingServiceStateSchema.d.ts +32 -0
- package/dist/neutral/services/StakeIntentService/ChainIndexingServiceStateSchema.d.ts.map +1 -0
- package/dist/neutral/services/StakeIntentService/StakeIntentService.d.ts +31 -0
- package/dist/neutral/services/StakeIntentService/StakeIntentService.d.ts.map +1 -0
- package/dist/neutral/services/StakeIntentService/index.d.ts +3 -0
- package/dist/neutral/services/StakeIntentService/index.d.ts.map +1 -0
- package/dist/neutral/services/StepStakeService.d.ts +5 -0
- package/dist/neutral/services/StepStakeService.d.ts.map +1 -0
- package/dist/neutral/services/TimeSyncService.d.ts +7 -0
- package/dist/neutral/services/TimeSyncService.d.ts.map +1 -0
- package/dist/neutral/services/index.d.ts +15 -0
- package/dist/neutral/services/index.d.ts.map +1 -0
- package/dist/neutral/transaction/confirmSubmittedTransaction.d.ts +2 -1
- package/dist/neutral/transaction/confirmSubmittedTransaction.d.ts.map +1 -1
- package/dist/neutral/validation/block/BlockValidationFunction.d.ts +5 -0
- package/dist/neutral/validation/block/BlockValidationFunction.d.ts.map +1 -0
- package/dist/neutral/validation/block/HydratedBlockStateValidationFunction.d.ts +18 -0
- package/dist/neutral/validation/block/HydratedBlockStateValidationFunction.d.ts.map +1 -0
- package/dist/neutral/validation/block/HydratedBlockValidationFunction.d.ts +11 -0
- package/dist/neutral/validation/block/HydratedBlockValidationFunction.d.ts.map +1 -0
- package/dist/neutral/validation/block/error.d.ts +15 -0
- package/dist/neutral/validation/block/error.d.ts.map +1 -0
- package/dist/neutral/validation/block/error.spec.d.ts +2 -0
- package/dist/neutral/validation/block/error.spec.d.ts.map +1 -0
- package/dist/neutral/validation/block/index.d.ts +5 -0
- package/dist/neutral/validation/block/index.d.ts.map +1 -0
- package/dist/neutral/validation/index.d.ts +1 -0
- package/dist/neutral/validation/index.d.ts.map +1 -1
- package/package.json +28 -25
- package/src/ChainServiceCollectionV2.ts +4 -3
- package/src/block/primitives/frames/spec/calculateFramesFromRange.spec.ts +1 -1
- package/src/block/primitives/transfers/transfersStepSummaryFromRange.ts +7 -4
- package/src/block/primitives/transfers/transfersSummary.ts +11 -7
- package/src/config/Config.ts +2 -0
- package/src/config/Mempool.ts +42 -0
- package/src/index.ts +3 -0
- package/src/interfaces/index.ts +1 -0
- package/src/interfaces/viewers/AccountBalance.ts +25 -0
- package/src/interfaces/viewers/Block.ts +13 -0
- package/src/interfaces/viewers/Chain.ts +6 -0
- package/src/interfaces/viewers/ChainContract.ts +10 -0
- package/src/interfaces/viewers/Fork.ts +9 -0
- package/src/interfaces/viewers/NetworkStakeStepReward.ts +69 -0
- package/src/interfaces/viewers/Stake.ts +22 -0
- package/src/interfaces/viewers/StakeTotalsViewer.ts +12 -0
- package/src/interfaces/viewers/StakeViewer.ts +13 -0
- package/src/interfaces/viewers/StepStake.ts +19 -0
- package/src/interfaces/viewers/TimeSync.ts +19 -0
- package/src/interfaces/viewers/Transaction.ts +9 -0
- package/src/interfaces/viewers/TransferBalance.ts +29 -0
- package/src/interfaces/viewers/index.ts +13 -0
- package/src/model/ChainStake/ChainStakeRead.ts +2 -1
- package/src/model/RecordKeyType.ts +2 -0
- package/src/model/index.ts +1 -0
- package/src/model/summary.ts +3 -2
- package/src/provider/DataLake.ts +14 -0
- package/src/provider/TransactionHelper.ts +14 -0
- package/src/provider/TransactionSubmitter.ts +26 -0
- package/src/provider/XyoClient.ts +21 -0
- package/src/provider/XyoConnection.ts +54 -0
- package/src/provider/XyoGateway.ts +21 -0
- package/src/provider/XyoGatewayHelpers.ts +30 -0
- package/src/provider/XyoNetwork.ts +6 -0
- package/src/provider/XyoRunner.ts +7 -0
- package/src/provider/XyoSigner.ts +29 -0
- package/src/provider/XyoWallet.ts +15 -0
- package/src/provider/index.ts +12 -0
- package/src/provider/permissions/InvokerPermission.ts +56 -0
- package/src/provider/permissions/XyoPermissions.ts +40 -0
- package/src/provider/permissions/index.ts +2 -0
- package/src/provider/viewer/NetworkStake/NetworkStakeViewer.ts +12 -0
- package/src/provider/viewer/NetworkStake/Rewards/ByPositionViewer.ts +9 -0
- package/src/provider/viewer/NetworkStake/Rewards/ByStakerViewer.ts +10 -0
- package/src/provider/viewer/NetworkStake/Rewards/ByStepViewer.ts +10 -0
- package/src/provider/viewer/NetworkStake/Rewards/Options.ts +18 -0
- package/src/provider/viewer/NetworkStake/Rewards/TotalViewer.ts +9 -0
- package/src/provider/viewer/NetworkStake/Rewards/Viewer.ts +13 -0
- package/src/provider/viewer/NetworkStake/Rewards/index.ts +7 -0
- package/src/provider/viewer/NetworkStake/Rewards/templates/ByIndexMethodsTemplate.ts +7 -0
- package/src/provider/viewer/NetworkStake/Rewards/templates/MethodsTemplate.ts +9 -0
- package/src/provider/viewer/NetworkStake/Rewards/templates/index.ts +2 -0
- package/src/provider/viewer/NetworkStake/index.ts +4 -0
- package/src/provider/viewer/StepViewer.ts +47 -0
- package/src/provider/viewer/XyoViewer.ts +19 -0
- package/src/provider/viewer/index.ts +3 -0
- package/src/services/AccountBalanceService.ts +22 -0
- package/src/services/AccountTransfersService.ts +12 -0
- package/src/services/BlockProducerService.ts +10 -0
- package/src/services/BlockRewardService.ts +8 -0
- package/src/services/BlockRewardServiceV2.ts +8 -0
- package/src/services/Chain/BaseChainService.ts +7 -0
- package/src/services/Chain/ChainHeadService.ts +7 -0
- package/src/services/Chain/ChainService.ts +6 -0
- package/src/services/Chain/index.ts +4 -0
- package/src/services/Chain/interfaces/ChainContractViewer.ts +5 -0
- package/src/services/Chain/interfaces/ChainStakeViewer.ts +6 -0
- package/src/services/Chain/interfaces/ChainStaker.ts +5 -0
- package/src/services/Chain/interfaces/index.ts +3 -0
- package/src/services/ChainIterator/ChainIteratorService.ts +45 -0
- package/src/services/ChainIterator/ChainIteratorServiceEventData.ts +13 -0
- package/src/services/ChainIterator/index.ts +2 -0
- package/src/services/Election.ts +15 -0
- package/src/services/NetworkStakeService.ts +4 -0
- package/src/services/Params.ts +11 -0
- package/src/services/PendingTransactionsService.ts +8 -0
- package/src/services/Service.ts +5 -0
- package/src/services/StakeIntentService/ChainIndexingServiceStateSchema.ts +43 -0
- package/src/services/StakeIntentService/StakeIntentService.ts +36 -0
- package/src/services/StakeIntentService/index.ts +2 -0
- package/src/services/StepStakeService.ts +4 -0
- package/src/services/TimeSyncService.ts +6 -0
- package/src/services/index.ts +14 -0
- package/src/transaction/confirmSubmittedTransaction.ts +3 -3
- package/src/validation/block/BlockValidationFunction.ts +9 -0
- package/src/validation/block/HydratedBlockStateValidationFunction.ts +24 -0
- package/src/validation/block/HydratedBlockValidationFunction.ts +15 -0
- package/src/validation/block/error.spec.ts +20 -0
- package/src/validation/block/error.ts +46 -0
- package/src/validation/block/index.ts +4 -0
- package/src/validation/index.ts +1 -0
package/dist/neutral/index.mjs
CHANGED
|
@@ -476,6 +476,44 @@ var toPositiveBigInt = /* @__PURE__ */ __name((value) => {
|
|
|
476
476
|
throw new Error("Invalid value for positive big int");
|
|
477
477
|
}, "toPositiveBigInt");
|
|
478
478
|
|
|
479
|
+
// src/block/primitives/transfers/transfersSummary.ts
|
|
480
|
+
import { asAddress } from "@xylabs/hex";
|
|
481
|
+
import { spanRootAsync } from "@xylabs/telemetry";
|
|
482
|
+
import { isDefined as isDefined3 } from "@xylabs/typeof";
|
|
483
|
+
import { asBlockBoundWitnessWithStorageMeta as asBlockBoundWitnessWithStorageMeta3, asXL1BlockNumber as asXL1BlockNumber2 } from "@xyo-network/xl1-protocol";
|
|
484
|
+
async function transfersSummary(transferContext) {
|
|
485
|
+
return await spanRootAsync("transferSummary", async () => {
|
|
486
|
+
const [headHash] = await transferContext.head();
|
|
487
|
+
const headResult = await transferContext.store.chainMap.get(headHash);
|
|
488
|
+
const headBoundWitness = asBlockBoundWitnessWithStorageMeta3(headResult, () => `Head block not found for hash: ${transferContext.head}`, {
|
|
489
|
+
required: true
|
|
490
|
+
});
|
|
491
|
+
const rangeStart = asXL1BlockNumber2(isDefined3(transferContext.windowSize) ? Math.max(headBoundWitness.block - transferContext.windowSize + 1, 0) : 0);
|
|
492
|
+
const ranges = deepCalculateFramesFromRange([
|
|
493
|
+
rangeStart,
|
|
494
|
+
asXL1BlockNumber2(headBoundWitness.block)
|
|
495
|
+
]);
|
|
496
|
+
const summaries = await Promise.all(ranges.map((range) => transfersStepSummaryFromRange(transferContext, range)));
|
|
497
|
+
const transfers = {};
|
|
498
|
+
for (let summary of summaries) {
|
|
499
|
+
for (const [from, toMap] of Object.entries(summary.transfers)) {
|
|
500
|
+
const validFrom = asAddress(from, () => `Invalid address: ${from}`);
|
|
501
|
+
transfers[validFrom] = transfers[validFrom] ?? {};
|
|
502
|
+
for (const [to, transfer] of Object.entries(toMap)) {
|
|
503
|
+
const validTo = asAddress(to, () => `Invalid address: ${to}`);
|
|
504
|
+
transfers[validFrom][validTo] = (transfers[validFrom][validTo] ?? 0n) + parseSignedBigInt(transfer);
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
return transfers;
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
__name(transfersSummary, "transfersSummary");
|
|
512
|
+
function transfersSummaryKey(frameHeadHash, frameSize) {
|
|
513
|
+
return `${frameHeadHash}|${frameSize}`;
|
|
514
|
+
}
|
|
515
|
+
__name(transfersSummaryKey, "transfersSummaryKey");
|
|
516
|
+
|
|
479
517
|
// src/block/primitives/transfers/transfersStepSummaryFromRange.ts
|
|
480
518
|
async function transfersStepSummaryFromRange(context, range) {
|
|
481
519
|
const frameHeadHash = await hashFromBlockNumber(context, range[1]);
|
|
@@ -501,7 +539,8 @@ async function transfersStepSummaryFromRange(context, range) {
|
|
|
501
539
|
} else {
|
|
502
540
|
const step = StepSizes3.indexOf(frameSize);
|
|
503
541
|
assertEx4(step !== -1, () => `Invalid step size: ${frameSize}. Must be one of ${StepSizes3.join(", ")}`);
|
|
504
|
-
const
|
|
542
|
+
const key = transfersSummaryKey(frameHeadHash, frameSize);
|
|
543
|
+
const summaryResult = await context.summaryMap.get(key);
|
|
505
544
|
if (isAnyPayload(summaryResult)) {
|
|
506
545
|
result = summaryResult;
|
|
507
546
|
} else {
|
|
@@ -532,7 +571,7 @@ async function transfersStepSummaryFromRange(context, range) {
|
|
|
532
571
|
stepSize: frameSize,
|
|
533
572
|
transfers
|
|
534
573
|
};
|
|
535
|
-
await context.summaryMap.set(
|
|
574
|
+
await context.summaryMap.set(key, result);
|
|
536
575
|
} finally {
|
|
537
576
|
context.stepSemaphores[step].release();
|
|
538
577
|
}
|
|
@@ -543,47 +582,48 @@ async function transfersStepSummaryFromRange(context, range) {
|
|
|
543
582
|
}
|
|
544
583
|
__name(transfersStepSummaryFromRange, "transfersStepSummaryFromRange");
|
|
545
584
|
|
|
546
|
-
// src/block/primitives/transfers/transfersSummary.ts
|
|
547
|
-
import { asAddress } from "@xylabs/hex";
|
|
548
|
-
import { spanRootAsync } from "@xylabs/telemetry";
|
|
549
|
-
import { isDefined as isDefined3 } from "@xylabs/typeof";
|
|
550
|
-
import { asBlockBoundWitnessWithStorageMeta as asBlockBoundWitnessWithStorageMeta3, asXL1BlockNumber as asXL1BlockNumber2 } from "@xyo-network/xl1-protocol";
|
|
551
|
-
async function transfersSummary(context) {
|
|
552
|
-
return await spanRootAsync("transferSummary", async () => {
|
|
553
|
-
const [headHash] = await context.head();
|
|
554
|
-
const headResult = await context.store.chainMap.get(headHash);
|
|
555
|
-
const headBoundWitness = asBlockBoundWitnessWithStorageMeta3(headResult, () => `Head block not found for hash: ${context.head}`, {
|
|
556
|
-
required: true
|
|
557
|
-
});
|
|
558
|
-
const rangeStart = asXL1BlockNumber2(isDefined3(context.windowSize) ? Math.max(headBoundWitness.block - context.windowSize + 1, 0) : 0);
|
|
559
|
-
const ranges = deepCalculateFramesFromRange([
|
|
560
|
-
rangeStart,
|
|
561
|
-
asXL1BlockNumber2(headBoundWitness.block)
|
|
562
|
-
]);
|
|
563
|
-
const summaries = await Promise.all(ranges.map((range) => transfersStepSummaryFromRange(context, range)));
|
|
564
|
-
const transfers = {};
|
|
565
|
-
for (let summary of summaries) {
|
|
566
|
-
for (const [from, toMap] of Object.entries(summary.transfers)) {
|
|
567
|
-
const validFrom = asAddress(from, () => `Invalid address: ${from}`);
|
|
568
|
-
transfers[validFrom] = transfers[validFrom] ?? {};
|
|
569
|
-
for (const [to, transfer] of Object.entries(toMap)) {
|
|
570
|
-
const validTo = asAddress(to, () => `Invalid address: ${to}`);
|
|
571
|
-
transfers[validFrom][validTo] = (transfers[validFrom][validTo] ?? 0n) + parseSignedBigInt(transfer);
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
return transfers;
|
|
576
|
-
});
|
|
577
|
-
}
|
|
578
|
-
__name(transfersSummary, "transfersSummary");
|
|
579
|
-
|
|
580
585
|
// src/config/Config.ts
|
|
581
|
-
import * as
|
|
586
|
+
import * as z15 from "zod";
|
|
582
587
|
|
|
583
588
|
// src/config/Api.ts
|
|
584
589
|
import { globalRegistry } from "zod";
|
|
585
590
|
import * as z2 from "zod";
|
|
586
591
|
|
|
592
|
+
// src/validation/block/error.ts
|
|
593
|
+
import { isValidationError, ValidationError } from "@xyo-network/xl1-protocol";
|
|
594
|
+
var BlockValidationError = class extends ValidationError {
|
|
595
|
+
static {
|
|
596
|
+
__name(this, "BlockValidationError");
|
|
597
|
+
}
|
|
598
|
+
};
|
|
599
|
+
var isBlockValidationError = /* @__PURE__ */ __name((error) => {
|
|
600
|
+
if (!isValidationError(error)) return false;
|
|
601
|
+
return error.name === BlockValidationError.constructor.name;
|
|
602
|
+
}, "isBlockValidationError");
|
|
603
|
+
var HydratedBlockValidationError = class extends ValidationError {
|
|
604
|
+
static {
|
|
605
|
+
__name(this, "HydratedBlockValidationError");
|
|
606
|
+
}
|
|
607
|
+
};
|
|
608
|
+
var isHydratedBlockValidationError = /* @__PURE__ */ __name((error) => {
|
|
609
|
+
if (!isValidationError(error)) return false;
|
|
610
|
+
return error.name === HydratedBlockValidationError.constructor.name;
|
|
611
|
+
}, "isHydratedBlockValidationError");
|
|
612
|
+
var HydratedBlockStateValidationError = class extends ValidationError {
|
|
613
|
+
static {
|
|
614
|
+
__name(this, "HydratedBlockStateValidationError");
|
|
615
|
+
}
|
|
616
|
+
chainId;
|
|
617
|
+
constructor(hash, chainId, value, message, cause) {
|
|
618
|
+
super(hash, value, message, cause);
|
|
619
|
+
this.chainId = chainId;
|
|
620
|
+
}
|
|
621
|
+
};
|
|
622
|
+
var isHydratedBlockStateValidationError = /* @__PURE__ */ __name((error) => {
|
|
623
|
+
if (!isValidationError(error)) return false;
|
|
624
|
+
return error.name === HydratedBlockStateValidationError.constructor.name;
|
|
625
|
+
}, "isHydratedBlockStateValidationError");
|
|
626
|
+
|
|
587
627
|
// src/validation/lib/isLocalhost.ts
|
|
588
628
|
var isLocalhost = /* @__PURE__ */ __name((hostname) => {
|
|
589
629
|
return hostname === "localhost" || hostname === "127.0.0.1" || hostname === "::1" || hostname.endsWith(".localhost");
|
|
@@ -738,57 +778,106 @@ var LogConfigZod = z7.object({
|
|
|
738
778
|
})
|
|
739
779
|
});
|
|
740
780
|
|
|
741
|
-
// src/config/
|
|
742
|
-
import { AddressZod, asAddress as asAddress2 } from "@xylabs/hex";
|
|
781
|
+
// src/config/Mempool.ts
|
|
743
782
|
import { globalRegistry as globalRegistry7 } from "zod";
|
|
744
783
|
import * as z8 from "zod";
|
|
745
|
-
var
|
|
746
|
-
|
|
784
|
+
var MempoolConfigZod = z8.object({
|
|
785
|
+
enabled: z8.string().default("false").transform((val, ctx) => {
|
|
786
|
+
const normalized = val.toLowerCase().trim();
|
|
787
|
+
if ([
|
|
788
|
+
"true",
|
|
789
|
+
"1",
|
|
790
|
+
"yes",
|
|
791
|
+
"on"
|
|
792
|
+
].includes(normalized)) return true;
|
|
793
|
+
if ([
|
|
794
|
+
"false",
|
|
795
|
+
"0",
|
|
796
|
+
"no",
|
|
797
|
+
"off"
|
|
798
|
+
].includes(normalized)) return false;
|
|
799
|
+
ctx.addIssue({
|
|
800
|
+
code: "invalid_type",
|
|
801
|
+
expected: "boolean",
|
|
802
|
+
message: `Invalid boolean value: "${val}". Use true/false, 1/0, yes/no.`
|
|
803
|
+
});
|
|
804
|
+
return z8.NEVER;
|
|
805
|
+
}).register(globalRegistry7, {
|
|
806
|
+
default: "false",
|
|
807
|
+
description: "Enable the Mempool",
|
|
808
|
+
title: "mempool.enabled",
|
|
809
|
+
type: "boolean"
|
|
810
|
+
}),
|
|
811
|
+
host: z8.string().default("localhost").register(globalRegistry7, {
|
|
812
|
+
default: "localhost",
|
|
813
|
+
description: "Host for the Mempool",
|
|
814
|
+
title: "mempool.host",
|
|
815
|
+
type: "string"
|
|
816
|
+
}),
|
|
817
|
+
mnemonic: MnemonicStringZod.optional().register(globalRegistry7, {
|
|
818
|
+
description: "Mnemonic for the Mempool wallet",
|
|
819
|
+
title: "mempool.mnemonic",
|
|
820
|
+
type: "string"
|
|
821
|
+
}),
|
|
822
|
+
port: z8.coerce.number().default(8083).register(globalRegistry7, {
|
|
823
|
+
default: 8083,
|
|
824
|
+
description: "Port for the Mempool",
|
|
825
|
+
title: "mempool.port",
|
|
826
|
+
type: "number"
|
|
827
|
+
})
|
|
828
|
+
});
|
|
829
|
+
|
|
830
|
+
// src/config/Producer.ts
|
|
831
|
+
import { AddressZod, asAddress as asAddress2 } from "@xylabs/hex";
|
|
832
|
+
import { globalRegistry as globalRegistry8 } from "zod";
|
|
833
|
+
import * as z9 from "zod";
|
|
834
|
+
var ProducerConfigZod = z9.object({
|
|
835
|
+
allowlist: z9.preprocess((val) => {
|
|
747
836
|
if (typeof val === "string") {
|
|
748
837
|
return val.split(",").map((s) => asAddress2(s.trim()));
|
|
749
838
|
}
|
|
750
839
|
return val;
|
|
751
|
-
},
|
|
840
|
+
}, z9.array(AddressZod).optional().register(globalRegistry8, {
|
|
752
841
|
description: "List of allowed producer addresses, if undefined anyone can participate",
|
|
753
842
|
title: "allowlist",
|
|
754
843
|
type: "array"
|
|
755
844
|
})),
|
|
756
|
-
disableIntentRedeclaration:
|
|
845
|
+
disableIntentRedeclaration: z9.boolean().optional().register(globalRegistry8, {
|
|
757
846
|
description: "Should the producer skip redeclaring their intent to continue producing blocks",
|
|
758
847
|
title: "producer.disableIntentRedeclaration",
|
|
759
848
|
type: "boolean"
|
|
760
849
|
}),
|
|
761
850
|
// TODO: Port schema
|
|
762
|
-
healthCheckPort:
|
|
851
|
+
healthCheckPort: z9.coerce.number().optional().register(globalRegistry8, {
|
|
763
852
|
description: "Port for the Producer health checks",
|
|
764
853
|
title: "producer.healthCheckPort",
|
|
765
854
|
type: "number"
|
|
766
855
|
}),
|
|
767
|
-
heartbeatInterval:
|
|
856
|
+
heartbeatInterval: z9.coerce.number().default(36e5).register(globalRegistry8, {
|
|
768
857
|
description: "The number of milliseconds between heartbeats if no blocks are produced",
|
|
769
858
|
title: "producer.heartbeatInterval",
|
|
770
859
|
type: "number"
|
|
771
860
|
}),
|
|
772
861
|
// TODO: BigInt schema
|
|
773
|
-
minStake:
|
|
862
|
+
minStake: z9.coerce.number().default(1).register(globalRegistry8, {
|
|
774
863
|
description: "Minimum stake required to be a Producer",
|
|
775
864
|
title: "producer.minStake",
|
|
776
865
|
type: "number"
|
|
777
866
|
}),
|
|
778
|
-
mnemonic: MnemonicStringZod.optional().register(
|
|
867
|
+
mnemonic: MnemonicStringZod.optional().register(globalRegistry8, {
|
|
779
868
|
description: "Mnemonic for the Producer wallet",
|
|
780
869
|
title: "producer.mnemonic",
|
|
781
870
|
type: "string"
|
|
782
871
|
}),
|
|
783
872
|
// TODO: Port schema
|
|
784
|
-
port:
|
|
873
|
+
port: z9.coerce.number().default(8081).register(globalRegistry8, {
|
|
785
874
|
default: 8081,
|
|
786
875
|
description: "Port for the Producer",
|
|
787
876
|
title: "producer.port",
|
|
788
877
|
type: "number"
|
|
789
878
|
}),
|
|
790
879
|
// TODO: Address schema
|
|
791
|
-
rewardAddress:
|
|
880
|
+
rewardAddress: z9.string().optional().register(globalRegistry8, {
|
|
792
881
|
description: "Address to receive block rewards",
|
|
793
882
|
title: "producer.rewardAddress",
|
|
794
883
|
type: "string"
|
|
@@ -796,27 +885,27 @@ var ProducerConfigZod = z8.object({
|
|
|
796
885
|
});
|
|
797
886
|
|
|
798
887
|
// src/config/RewardRedemptionApi.ts
|
|
799
|
-
import { globalRegistry as
|
|
800
|
-
import * as
|
|
801
|
-
var RewardRedemptionApiConfigZod =
|
|
802
|
-
chainRpcApiUrl:
|
|
888
|
+
import { globalRegistry as globalRegistry9 } from "zod";
|
|
889
|
+
import * as z10 from "zod";
|
|
890
|
+
var RewardRedemptionApiConfigZod = z10.object({
|
|
891
|
+
chainRpcApiUrl: z10.string().default("http://localhost:8080/rpc").register(globalRegistry9, {
|
|
803
892
|
default: "http://localhost:8080/rpc",
|
|
804
893
|
description: "URL for the Chain RPC API",
|
|
805
894
|
title: "rewardRedemptionApi.chainRpcApiUrl",
|
|
806
895
|
type: "string"
|
|
807
896
|
}),
|
|
808
|
-
host:
|
|
897
|
+
host: z10.string().default("localhost").register(globalRegistry9, {
|
|
809
898
|
default: "localhost",
|
|
810
899
|
description: "Host for the Redemption API",
|
|
811
900
|
title: "rewardRedemptionApi.host",
|
|
812
901
|
type: "string"
|
|
813
902
|
}),
|
|
814
|
-
mnemonic: MnemonicStringZod.optional().register(
|
|
903
|
+
mnemonic: MnemonicStringZod.optional().register(globalRegistry9, {
|
|
815
904
|
description: "Mnemonic for the Redemption API wallet",
|
|
816
905
|
title: "rewardRedemptionApi.mnemonic",
|
|
817
906
|
type: "string"
|
|
818
907
|
}),
|
|
819
|
-
port:
|
|
908
|
+
port: z10.coerce.number().default(8082).register(globalRegistry9, {
|
|
820
909
|
default: 8082,
|
|
821
910
|
description: "Port for the Redemption API",
|
|
822
911
|
title: "rewardRedemptionApi.port",
|
|
@@ -826,35 +915,35 @@ var RewardRedemptionApiConfigZod = z9.object({
|
|
|
826
915
|
|
|
827
916
|
// src/config/storage/driver/Mongo.ts
|
|
828
917
|
import { isDefined as isDefined4, isUndefined as isUndefined2 } from "@xylabs/typeof";
|
|
829
|
-
import { globalRegistry as
|
|
830
|
-
import * as
|
|
918
|
+
import { globalRegistry as globalRegistry10 } from "zod";
|
|
919
|
+
import * as z11 from "zod";
|
|
831
920
|
var hasMongoConfig = /* @__PURE__ */ __name((config) => {
|
|
832
921
|
if (isUndefined2(config)) return false;
|
|
833
922
|
return isDefined4(config.connectionString) && isDefined4(config.database) && isDefined4(config.domain) && isDefined4(config.password) && isDefined4(config.username);
|
|
834
923
|
}, "hasMongoConfig");
|
|
835
|
-
var MongoConfigZod =
|
|
924
|
+
var MongoConfigZod = z11.object({
|
|
836
925
|
// TODO: Create from other arguments
|
|
837
|
-
connectionString:
|
|
926
|
+
connectionString: z11.string().nonempty().optional().register(globalRegistry10, {
|
|
838
927
|
description: "MongoDB connection string",
|
|
839
928
|
title: "storage.mongo.connectionString",
|
|
840
929
|
type: "string"
|
|
841
930
|
}),
|
|
842
|
-
database:
|
|
931
|
+
database: z11.string().nonempty().optional().register(globalRegistry10, {
|
|
843
932
|
description: "MongoDB database name",
|
|
844
933
|
title: "storage.mongo.database",
|
|
845
934
|
type: "string"
|
|
846
935
|
}),
|
|
847
|
-
domain:
|
|
936
|
+
domain: z11.string().nonempty().optional().register(globalRegistry10, {
|
|
848
937
|
description: "MongoDB domain",
|
|
849
938
|
title: "storage.mongo.domain",
|
|
850
939
|
type: "string"
|
|
851
940
|
}),
|
|
852
|
-
password:
|
|
941
|
+
password: z11.string().nonempty().optional().register(globalRegistry10, {
|
|
853
942
|
description: "MongoDB password",
|
|
854
943
|
title: "storage.mongo.password",
|
|
855
944
|
type: "string"
|
|
856
945
|
}),
|
|
857
|
-
username:
|
|
946
|
+
username: z11.string().nonempty().optional().register(globalRegistry10, {
|
|
858
947
|
description: "MongoDB username",
|
|
859
948
|
title: "storage.mongo.username",
|
|
860
949
|
type: "string"
|
|
@@ -862,11 +951,11 @@ var MongoConfigZod = z10.object({
|
|
|
862
951
|
});
|
|
863
952
|
|
|
864
953
|
// src/config/storage/Storage.ts
|
|
865
|
-
import { globalRegistry as
|
|
866
|
-
import * as
|
|
867
|
-
var StorageConfigZod =
|
|
954
|
+
import { globalRegistry as globalRegistry11 } from "zod";
|
|
955
|
+
import * as z12 from "zod";
|
|
956
|
+
var StorageConfigZod = z12.object({
|
|
868
957
|
mongo: MongoConfigZod.optional().describe("Configuration for the MongoD storage driver"),
|
|
869
|
-
root:
|
|
958
|
+
root: z12.string().optional().register(globalRegistry11, {
|
|
870
959
|
description: "Root directory for local storage",
|
|
871
960
|
title: "storage.root",
|
|
872
961
|
type: "string"
|
|
@@ -874,42 +963,42 @@ var StorageConfigZod = z11.object({
|
|
|
874
963
|
}).describe("Storage configuration options");
|
|
875
964
|
|
|
876
965
|
// src/config/Telemetry.ts
|
|
877
|
-
import { globalRegistry as
|
|
878
|
-
import * as
|
|
879
|
-
var OpenTelemetryConfigZod =
|
|
966
|
+
import { globalRegistry as globalRegistry12 } from "zod";
|
|
967
|
+
import * as z13 from "zod";
|
|
968
|
+
var OpenTelemetryConfigZod = z13.object({
|
|
880
969
|
// OpenTelemetry options
|
|
881
|
-
otlpEndpoint:
|
|
970
|
+
otlpEndpoint: z13.url().optional().register(globalRegistry12, {
|
|
882
971
|
description: "OTLP endpoint for exporting telemetry data",
|
|
883
972
|
title: "telemetry.otel.otlpEndpoint",
|
|
884
973
|
type: "string"
|
|
885
974
|
})
|
|
886
975
|
});
|
|
887
|
-
var TelemetryConfigZod =
|
|
976
|
+
var TelemetryConfigZod = z13.object({
|
|
888
977
|
// OpenTelemetry configuration
|
|
889
978
|
otel: OpenTelemetryConfigZod.optional().describe("OpenTelemetry configuration")
|
|
890
979
|
}).describe("Telemetry configuration options");
|
|
891
980
|
|
|
892
981
|
// src/config/Validation.ts
|
|
893
982
|
import { AddressZod as AddressZod2, asAddress as asAddress3 } from "@xylabs/hex";
|
|
894
|
-
import { globalRegistry as
|
|
895
|
-
import * as
|
|
896
|
-
var ValidationConfigZod =
|
|
897
|
-
allowedRewardRedeemers:
|
|
983
|
+
import { globalRegistry as globalRegistry13 } from "zod";
|
|
984
|
+
import * as z14 from "zod";
|
|
985
|
+
var ValidationConfigZod = z14.object({
|
|
986
|
+
allowedRewardRedeemers: z14.preprocess((val) => {
|
|
898
987
|
if (typeof val === "string") {
|
|
899
988
|
return val.split(",").map((s) => asAddress3(s.trim()));
|
|
900
989
|
}
|
|
901
990
|
return val;
|
|
902
|
-
},
|
|
991
|
+
}, z14.array(AddressZod2).optional().register(globalRegistry13, {
|
|
903
992
|
description: "List of allowed reward redeemer addresses, if undefined anyone can participate",
|
|
904
993
|
title: "allowedRewardRedeemers",
|
|
905
994
|
type: "array"
|
|
906
995
|
})),
|
|
907
|
-
allowedRewardEscrowAccountSigners:
|
|
996
|
+
allowedRewardEscrowAccountSigners: z14.preprocess((val) => {
|
|
908
997
|
if (typeof val === "string") {
|
|
909
998
|
return val.split(",").map((s) => asAddress3(s.trim()));
|
|
910
999
|
}
|
|
911
1000
|
return val;
|
|
912
|
-
},
|
|
1001
|
+
}, z14.array(AddressZod2).optional().register(globalRegistry13, {
|
|
913
1002
|
description: "List of allowed reward escrow account signer addresses, if undefined anyone can participate",
|
|
914
1003
|
title: "allowedRewardEscrowAccountSigners",
|
|
915
1004
|
type: "array"
|
|
@@ -917,16 +1006,17 @@ var ValidationConfigZod = z13.object({
|
|
|
917
1006
|
});
|
|
918
1007
|
|
|
919
1008
|
// src/config/Config.ts
|
|
920
|
-
var Xl1CommonConfigSchema =
|
|
1009
|
+
var Xl1CommonConfigSchema = z15.object({
|
|
921
1010
|
...LogConfigZod.shape
|
|
922
1011
|
}).describe("XL1 common configuration options");
|
|
923
|
-
var ConfigZod =
|
|
1012
|
+
var ConfigZod = z15.object({
|
|
924
1013
|
...Xl1CommonConfigSchema.shape,
|
|
925
1014
|
api: ApiConfigZod.default(ApiConfigZod.parse({})).describe("Configuration for the API node"),
|
|
926
1015
|
app: AppConfigZod.default(AppConfigZod.parse({})).describe("Configuration for the application"),
|
|
927
1016
|
bridge: BridgeConfigZod.default(BridgeConfigZod.parse({})).describe("Configuration for the Bridge node"),
|
|
928
1017
|
chain: ChainConfigZod.default(ChainConfigZod.parse({})).describe("Configuration for the chain"),
|
|
929
1018
|
evm: EvmConfigZod.default(EvmConfigZod.parse({})).describe("Configuration for EVM-backed services"),
|
|
1019
|
+
mempool: MempoolConfigZod.default(MempoolConfigZod.parse({})).describe("Configuration for the mempool"),
|
|
930
1020
|
producer: ProducerConfigZod.default(ProducerConfigZod.parse({})).describe("Configuration for the producer"),
|
|
931
1021
|
rewardRedemptionApi: RewardRedemptionApiConfigZod.default(RewardRedemptionApiConfigZod.parse({})).describe("Configuration for the rewards redemption API"),
|
|
932
1022
|
storage: StorageConfigZod.default(StorageConfigZod.parse({})).describe("Configuration for the storage"),
|
|
@@ -936,35 +1026,35 @@ var ConfigZod = z14.object({
|
|
|
936
1026
|
var getDefaultConfig = /* @__PURE__ */ __name(() => ConfigZod.parse({}), "getDefaultConfig");
|
|
937
1027
|
|
|
938
1028
|
// src/config/UsageMeta.ts
|
|
939
|
-
import * as
|
|
940
|
-
var DescriptionSchema =
|
|
941
|
-
var TitleSchema =
|
|
942
|
-
var JSONSchemaMetaSchema =
|
|
943
|
-
id:
|
|
1029
|
+
import * as z16 from "zod";
|
|
1030
|
+
var DescriptionSchema = z16.string();
|
|
1031
|
+
var TitleSchema = z16.string();
|
|
1032
|
+
var JSONSchemaMetaSchema = z16.object({
|
|
1033
|
+
id: z16.string().optional(),
|
|
944
1034
|
title: TitleSchema.optional(),
|
|
945
1035
|
description: DescriptionSchema.optional(),
|
|
946
|
-
deprecated:
|
|
947
|
-
}).catchall(
|
|
1036
|
+
deprecated: z16.boolean().optional()
|
|
1037
|
+
}).catchall(z16.unknown());
|
|
948
1038
|
var GlobalMetaSchema = JSONSchemaMetaSchema.extend({});
|
|
949
|
-
var ChoicesSchema =
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
1039
|
+
var ChoicesSchema = z16.array(z16.union([
|
|
1040
|
+
z16.string(),
|
|
1041
|
+
z16.number(),
|
|
1042
|
+
z16.literal(true),
|
|
1043
|
+
z16.undefined()
|
|
954
1044
|
])).readonly();
|
|
955
1045
|
var UsageMetaSchema = GlobalMetaSchema.extend({
|
|
956
1046
|
choices: ChoicesSchema.optional(),
|
|
957
|
-
default:
|
|
1047
|
+
default: z16.unknown().optional(),
|
|
958
1048
|
description: DescriptionSchema,
|
|
959
|
-
group:
|
|
960
|
-
hidden:
|
|
1049
|
+
group: z16.string().optional(),
|
|
1050
|
+
hidden: z16.boolean().optional(),
|
|
961
1051
|
title: TitleSchema,
|
|
962
|
-
type:
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
1052
|
+
type: z16.union([
|
|
1053
|
+
z16.literal("array"),
|
|
1054
|
+
z16.literal("count"),
|
|
1055
|
+
z16.literal("boolean"),
|
|
1056
|
+
z16.literal("number"),
|
|
1057
|
+
z16.literal("string")
|
|
968
1058
|
])
|
|
969
1059
|
});
|
|
970
1060
|
function isUsageMeta(v) {
|
|
@@ -979,33 +1069,33 @@ var XL1_NETWORK_STAKING_GENESIS_PERIOD_END_XL1_BLOCK = 107496;
|
|
|
979
1069
|
// src/eip-712/Payloads/EIP712Data.ts
|
|
980
1070
|
import { AsObjectFactory as AsObjectFactory4 } from "@xylabs/object";
|
|
981
1071
|
import { isPayloadOfZodType } from "@xyo-network/payload-model";
|
|
982
|
-
import
|
|
1072
|
+
import z18 from "zod";
|
|
983
1073
|
|
|
984
1074
|
// src/eip-712/Types.ts
|
|
985
|
-
import
|
|
986
|
-
var TypedDataDomainZod =
|
|
987
|
-
name:
|
|
988
|
-
version:
|
|
989
|
-
chainId:
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
1075
|
+
import z17 from "zod";
|
|
1076
|
+
var TypedDataDomainZod = z17.object({
|
|
1077
|
+
name: z17.string().nullable().optional(),
|
|
1078
|
+
version: z17.string().nullable().optional(),
|
|
1079
|
+
chainId: z17.union([
|
|
1080
|
+
z17.string(),
|
|
1081
|
+
z17.number(),
|
|
1082
|
+
z17.bigint()
|
|
993
1083
|
]).nullable().optional(),
|
|
994
|
-
verifyingContract:
|
|
995
|
-
salt:
|
|
996
|
-
|
|
997
|
-
|
|
1084
|
+
verifyingContract: z17.string().nullable().optional(),
|
|
1085
|
+
salt: z17.union([
|
|
1086
|
+
z17.string(),
|
|
1087
|
+
z17.instanceof(Uint8Array)
|
|
998
1088
|
]).nullable().optional()
|
|
999
1089
|
});
|
|
1000
|
-
var TypedDataFieldZod =
|
|
1001
|
-
name:
|
|
1002
|
-
type:
|
|
1090
|
+
var TypedDataFieldZod = z17.object({
|
|
1091
|
+
name: z17.string(),
|
|
1092
|
+
type: z17.string()
|
|
1003
1093
|
});
|
|
1004
|
-
var TypedDataTypesZod =
|
|
1005
|
-
var TypedDataValueZod =
|
|
1094
|
+
var TypedDataTypesZod = z17.record(z17.string(), z17.array(TypedDataFieldZod));
|
|
1095
|
+
var TypedDataValueZod = z17.record(z17.string(), z17.any());
|
|
1006
1096
|
|
|
1007
1097
|
// src/eip-712/Payloads/EIP712Data.ts
|
|
1008
|
-
var EIP712DataPayloadFieldsZod =
|
|
1098
|
+
var EIP712DataPayloadFieldsZod = z18.object({
|
|
1009
1099
|
domain: TypedDataDomainZod,
|
|
1010
1100
|
types: TypedDataTypesZod,
|
|
1011
1101
|
values: TypedDataValueZod
|
|
@@ -1018,11 +1108,11 @@ var asEIP712DataPayload = AsObjectFactory4.create(isEIP712DataPayload);
|
|
|
1018
1108
|
import { HashZod } from "@xylabs/hex";
|
|
1019
1109
|
import { AsObjectFactory as AsObjectFactory5 } from "@xylabs/object";
|
|
1020
1110
|
import { isPayloadOfZodType as isPayloadOfZodType2 } from "@xyo-network/payload-model";
|
|
1021
|
-
import
|
|
1022
|
-
var EIP712SignaturePayloadFieldsZod =
|
|
1023
|
-
address:
|
|
1111
|
+
import z19 from "zod";
|
|
1112
|
+
var EIP712SignaturePayloadFieldsZod = z19.object({
|
|
1113
|
+
address: z19.string(),
|
|
1024
1114
|
hash: HashZod,
|
|
1025
|
-
signature:
|
|
1115
|
+
signature: z19.string()
|
|
1026
1116
|
});
|
|
1027
1117
|
var EIP712SignaturePayloadSchema = "network.xyo.chains.ethereum.eip712.signature";
|
|
1028
1118
|
var isEIP712SignaturePayload = isPayloadOfZodType2(EIP712SignaturePayloadFieldsZod, EIP712SignaturePayloadSchema);
|
|
@@ -1279,6 +1369,17 @@ function elevatedPayloads([tx, payloads]) {
|
|
|
1279
1369
|
}
|
|
1280
1370
|
__name(elevatedPayloads, "elevatedPayloads");
|
|
1281
1371
|
|
|
1372
|
+
// src/services/StakeIntentService/ChainIndexingServiceStateSchema.ts
|
|
1373
|
+
import { AsObjectFactory as AsObjectFactory6 } from "@xylabs/object";
|
|
1374
|
+
import { isPayloadOfSchemaType as isPayloadOfSchemaType4, isStorageMeta as isStorageMeta3 } from "@xyo-network/payload-model";
|
|
1375
|
+
var ChainIndexingServiceStateSchema = "network.xyo.chain.indexing.service.state";
|
|
1376
|
+
var isChainIndexingServiceState = /* @__PURE__ */ __name((payload) => {
|
|
1377
|
+
return isPayloadOfSchemaType4(ChainIndexingServiceStateSchema)(payload);
|
|
1378
|
+
}, "isChainIndexingServiceState");
|
|
1379
|
+
var asChainIndexingServiceState = AsObjectFactory6.create(isChainIndexingServiceState);
|
|
1380
|
+
var isChainIndexingServiceStateWithStorageMeta = /* @__PURE__ */ __name((value) => isChainIndexingServiceState(value) && isStorageMeta3(value), "isChainIndexingServiceStateWithStorageMeta");
|
|
1381
|
+
var asChainIndexingServiceStateWithStorageMeta = AsObjectFactory6.create(isChainIndexingServiceStateWithStorageMeta);
|
|
1382
|
+
|
|
1282
1383
|
// src/time/primitives/xl1BlockNumberToEthBlockNumber.ts
|
|
1283
1384
|
import { assertEx as assertEx7 } from "@xylabs/assert";
|
|
1284
1385
|
import { asTimePayload, TimeSchema } from "@xyo-network/xl1-protocol";
|
|
@@ -1621,8 +1722,10 @@ export {
|
|
|
1621
1722
|
ADDRESS_INDEX,
|
|
1622
1723
|
AddressPairSchema,
|
|
1623
1724
|
BalancesStepSummarySchema,
|
|
1725
|
+
BlockValidationError,
|
|
1624
1726
|
CHANGE_ADDRESS,
|
|
1625
1727
|
COIN_TYPES,
|
|
1728
|
+
ChainIndexingServiceStateSchema,
|
|
1626
1729
|
ConfigZod,
|
|
1627
1730
|
DEFAULT_WALLET_PATH,
|
|
1628
1731
|
EIP712DataPayloadFieldsZod,
|
|
@@ -1630,6 +1733,8 @@ export {
|
|
|
1630
1733
|
EIP712SignaturePayloadFieldsZod,
|
|
1631
1734
|
EIP712SignaturePayloadSchema,
|
|
1632
1735
|
GlobalMetaSchema,
|
|
1736
|
+
HydratedBlockStateValidationError,
|
|
1737
|
+
HydratedBlockValidationError,
|
|
1633
1738
|
JSONSchemaMetaSchema,
|
|
1634
1739
|
LruCacheMap,
|
|
1635
1740
|
MemoryMap,
|
|
@@ -1655,6 +1760,8 @@ export {
|
|
|
1655
1760
|
asAddressPairPayload,
|
|
1656
1761
|
asBalancesStepSummary,
|
|
1657
1762
|
asBalancesStepSummaryWithStorageMeta,
|
|
1763
|
+
asChainIndexingServiceState,
|
|
1764
|
+
asChainIndexingServiceStateWithStorageMeta,
|
|
1658
1765
|
asEIP712DataPayload,
|
|
1659
1766
|
asEIP712SignaturePayload,
|
|
1660
1767
|
asOptionalAddressPairPayload,
|
|
@@ -1692,8 +1799,13 @@ export {
|
|
|
1692
1799
|
isAddressPairPayload,
|
|
1693
1800
|
isBalancesStepSummary,
|
|
1694
1801
|
isBalancesStepSummaryWithStorageMeta,
|
|
1802
|
+
isBlockValidationError,
|
|
1803
|
+
isChainIndexingServiceState,
|
|
1804
|
+
isChainIndexingServiceStateWithStorageMeta,
|
|
1695
1805
|
isEIP712DataPayload,
|
|
1696
1806
|
isEIP712SignaturePayload,
|
|
1807
|
+
isHydratedBlockStateValidationError,
|
|
1808
|
+
isHydratedBlockValidationError,
|
|
1697
1809
|
isLocalhost,
|
|
1698
1810
|
isNegativeBigInt,
|
|
1699
1811
|
isPositiveBigInt,
|
|
@@ -1723,6 +1835,7 @@ export {
|
|
|
1723
1835
|
transactionsFromHydratedBlock,
|
|
1724
1836
|
transfersStepSummaryFromRange,
|
|
1725
1837
|
transfersSummary,
|
|
1838
|
+
transfersSummaryKey,
|
|
1726
1839
|
tryExtractElevatedHashes,
|
|
1727
1840
|
tryExtractElevatedHashesFromScript,
|
|
1728
1841
|
tryHydrateBlock,
|