@xyo-network/xl1-protocol-sdk 1.15.27 → 1.16.0
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/blockFromBlockNumber.d.ts +1 -1
- package/dist/neutral/block/primitives/blockFromBlockNumber.d.ts.map +1 -1
- package/dist/neutral/block/primitives/index.d.ts +1 -0
- package/dist/neutral/block/primitives/index.d.ts.map +1 -1
- package/dist/neutral/block/primitives/toStepIdentityString.d.ts +3 -0
- package/dist/neutral/block/primitives/toStepIdentityString.d.ts.map +1 -0
- 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 +8 -2
- package/dist/neutral/config/Config.d.ts.map +1 -1
- package/dist/neutral/config/Log.d.ts +1 -1
- package/dist/neutral/config/Mempool.d.ts +9 -0
- package/dist/neutral/config/Mempool.d.ts.map +1 -0
- package/dist/neutral/driver/cache/LruCacheMap.d.ts +13 -0
- package/dist/neutral/driver/cache/LruCacheMap.d.ts.map +1 -0
- package/dist/neutral/driver/cache/index.d.ts +2 -0
- package/dist/neutral/driver/cache/index.d.ts.map +1 -0
- package/dist/neutral/driver/index.d.ts +3 -0
- package/dist/neutral/driver/index.d.ts.map +1 -0
- package/dist/neutral/driver/memory/MemoryMap.d.ts +12 -0
- package/dist/neutral/driver/memory/MemoryMap.d.ts.map +1 -0
- package/dist/neutral/driver/memory/index.d.ts +2 -0
- package/dist/neutral/driver/memory/index.d.ts.map +1 -0
- package/dist/neutral/eip-712/Payloads/EIP712Data.d.ts +0 -16
- package/dist/neutral/eip-712/Payloads/EIP712Data.d.ts.map +1 -1
- package/dist/neutral/index.d.ts +4 -2
- package/dist/neutral/index.d.ts.map +1 -1
- package/dist/neutral/index.mjs +438 -184
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/instances/index.d.ts +0 -2
- package/dist/neutral/instances/index.d.ts.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/NetworkStakeViewer/NetworkStakeViewer.d.ts +10 -0
- package/dist/neutral/interfaces/viewers/NetworkStakeViewer/NetworkStakeViewer.d.ts.map +1 -0
- package/dist/neutral/interfaces/viewers/NetworkStakeViewer/RecordKeyType.d.ts +2 -0
- package/dist/neutral/interfaces/viewers/NetworkStakeViewer/RecordKeyType.d.ts.map +1 -0
- package/dist/neutral/interfaces/viewers/NetworkStakeViewer/RewardsByIndexViewerMethodsTemplate.d.ts +6 -0
- package/dist/neutral/interfaces/viewers/NetworkStakeViewer/RewardsByIndexViewerMethodsTemplate.d.ts.map +1 -0
- package/dist/neutral/interfaces/viewers/NetworkStakeViewer/RewardsByPositionViewer.d.ts +7 -0
- package/dist/neutral/interfaces/viewers/NetworkStakeViewer/RewardsByPositionViewer.d.ts.map +1 -0
- package/dist/neutral/interfaces/viewers/NetworkStakeViewer/RewardsByStakerViewer.d.ts +8 -0
- package/dist/neutral/interfaces/viewers/NetworkStakeViewer/RewardsByStakerViewer.d.ts.map +1 -0
- package/dist/neutral/interfaces/viewers/NetworkStakeViewer/RewardsByStepViewer.d.ts +8 -0
- package/dist/neutral/interfaces/viewers/NetworkStakeViewer/RewardsByStepViewer.d.ts.map +1 -0
- package/dist/neutral/interfaces/viewers/NetworkStakeViewer/RewardsTotalViewer.d.ts +8 -0
- package/dist/neutral/interfaces/viewers/NetworkStakeViewer/RewardsTotalViewer.d.ts.map +1 -0
- package/dist/neutral/interfaces/viewers/NetworkStakeViewer/RewardsViewerMethodsTemplate.d.ts +9 -0
- package/dist/neutral/interfaces/viewers/NetworkStakeViewer/RewardsViewerMethodsTemplate.d.ts.map +1 -0
- package/dist/neutral/interfaces/viewers/NetworkStakeViewer/RewardsViewerOptions.d.ts +15 -0
- package/dist/neutral/interfaces/viewers/NetworkStakeViewer/RewardsViewerOptions.d.ts.map +1 -0
- package/dist/neutral/interfaces/viewers/NetworkStakeViewer/StepRewardsViewer.d.ts +13 -0
- package/dist/neutral/interfaces/viewers/NetworkStakeViewer/StepRewardsViewer.d.ts.map +1 -0
- package/dist/neutral/interfaces/viewers/NetworkStakeViewer/StepViewer.d.ts +26 -0
- package/dist/neutral/interfaces/viewers/NetworkStakeViewer/StepViewer.d.ts.map +1 -0
- package/dist/neutral/interfaces/viewers/NetworkStakeViewer/index.d.ts +12 -0
- package/dist/neutral/interfaces/viewers/NetworkStakeViewer/index.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 +15 -0
- package/dist/neutral/interfaces/viewers/index.d.ts.map +1 -0
- package/dist/neutral/model/ChainContext/ChainContext.d.ts +14 -4
- package/dist/neutral/model/ChainContext/ChainContext.d.ts.map +1 -1
- package/dist/neutral/model/ChainContext/ChainStateContext.d.ts +1 -1
- package/dist/neutral/model/ChainContext/ChainStateContext.d.ts.map +1 -1
- package/dist/neutral/model/ChainStake/ChainStakeRead.d.ts +12 -12
- package/dist/neutral/model/ChainStake/ChainStakeRead.d.ts.map +1 -1
- package/dist/neutral/model/StakeEvents.d.ts +1 -0
- package/dist/neutral/model/StakeEvents.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/primitives/index.d.ts +1 -0
- package/dist/neutral/primitives/index.d.ts.map +1 -1
- package/dist/neutral/primitives/timeBudget.d.ts +3 -0
- package/dist/neutral/primitives/timeBudget.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 +35 -0
- package/dist/neutral/provider/XyoConnection.d.ts.map +1 -0
- package/dist/neutral/provider/XyoDataLake.d.ts +18 -0
- package/dist/neutral/provider/XyoDataLake.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/XyoViewer.d.ts +7 -0
- package/dist/neutral/provider/XyoViewer.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/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/buildUnsignedTransaction.d.ts +2 -2
- package/dist/neutral/transaction/buildUnsignedTransaction.d.ts.map +1 -1
- package/dist/neutral/transaction/confirmSubmittedTransaction.d.ts +2 -1
- package/dist/neutral/transaction/confirmSubmittedTransaction.d.ts.map +1 -1
- package/dist/neutral/transaction/primitives/transactionElevatedPayloads.d.ts +2 -2
- package/dist/neutral/transaction/primitives/transactionElevatedPayloads.d.ts.map +1 -1
- package/dist/neutral/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 +31 -27
- package/src/ChainServiceCollectionV2.ts +4 -3
- package/src/block/primitives/blockFromBlockNumber.ts +30 -27
- package/src/block/primitives/frames/spec/calculateFramesFromRange.spec.ts +1 -1
- package/src/block/primitives/index.ts +1 -0
- package/src/block/primitives/toStepIdentityString.ts +5 -0
- package/src/block/primitives/transfers/transfersStepSummaryFromRange.ts +9 -6
- 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/driver/cache/LruCacheMap.ts +42 -0
- package/src/driver/cache/index.ts +1 -0
- package/src/driver/index.ts +2 -0
- package/src/driver/memory/MemoryMap.ts +42 -0
- package/src/driver/memory/index.ts +1 -0
- package/src/eip-712/Payloads/EIP712Data.ts +0 -19
- package/src/index.ts +4 -2
- package/src/instances/index.ts +0 -2
- 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/NetworkStakeViewer/NetworkStakeViewer.ts +12 -0
- package/src/interfaces/viewers/NetworkStakeViewer/RecordKeyType.ts +2 -0
- package/src/interfaces/viewers/NetworkStakeViewer/RewardsByIndexViewerMethodsTemplate.ts +7 -0
- package/src/interfaces/viewers/NetworkStakeViewer/RewardsByPositionViewer.ts +7 -0
- package/src/interfaces/viewers/NetworkStakeViewer/RewardsByStakerViewer.ts +9 -0
- package/src/interfaces/viewers/NetworkStakeViewer/RewardsByStepViewer.ts +9 -0
- package/src/interfaces/viewers/NetworkStakeViewer/RewardsTotalViewer.ts +9 -0
- package/src/interfaces/viewers/NetworkStakeViewer/RewardsViewerMethodsTemplate.ts +9 -0
- package/src/interfaces/viewers/NetworkStakeViewer/RewardsViewerOptions.ts +18 -0
- package/src/interfaces/viewers/NetworkStakeViewer/StepRewardsViewer.ts +13 -0
- package/src/interfaces/viewers/NetworkStakeViewer/StepViewer.ts +42 -0
- package/src/interfaces/viewers/NetworkStakeViewer/index.ts +13 -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 +14 -0
- package/src/model/ChainContext/ChainContext.ts +49 -4
- package/src/model/ChainContext/ChainStateContext.ts +1 -1
- package/src/model/ChainStake/ChainStakeRead.ts +13 -12
- package/src/model/StakeEvents.ts +1 -0
- package/src/model/summary.ts +3 -2
- package/src/primitives/index.ts +1 -0
- package/src/primitives/summary/balances/balancesStepSummaryFromRange.ts +2 -2
- package/src/primitives/summary/balances/balancesSummary.ts +3 -3
- package/src/primitives/summary/transfers/transfersStepSummaryFromRange.ts +2 -2
- package/src/primitives/summary/transfers/transfersSummary.ts +3 -3
- package/src/primitives/timeBudget.ts +11 -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 +55 -0
- package/src/provider/XyoDataLake.ts +43 -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/XyoViewer.ts +17 -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/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/buildUnsignedTransaction.ts +4 -8
- package/src/transaction/confirmSubmittedTransaction.ts +3 -3
- package/src/transaction/primitives/transactionElevatedPayloads.ts +2 -2
- package/src/transaction/script.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/ChainServiceCollection.d.ts +0 -61
- package/dist/neutral/ChainServiceCollection.d.ts.map +0 -1
- package/dist/neutral/instances/ShiftedBigIntConfig.d.ts +0 -9
- package/dist/neutral/instances/ShiftedBigIntConfig.d.ts.map +0 -1
- package/dist/neutral/instances/XL1Amount.d.ts +0 -15
- package/dist/neutral/instances/XL1Amount.d.ts.map +0 -1
- package/src/ChainServiceCollection.ts +0 -66
- package/src/instances/ShiftedBigIntConfig.ts +0 -8
- package/src/instances/XL1Amount.ts +0 -29
package/dist/neutral/index.mjs
CHANGED
|
@@ -112,37 +112,153 @@ var tryHydrateBlock = /* @__PURE__ */ __name(async (archivist, hash, maxDepth =
|
|
|
112
112
|
import { asHash } from "@xylabs/hex";
|
|
113
113
|
import { toSafeJsonString } from "@xylabs/object";
|
|
114
114
|
import { asBlockBoundWitnessWithStorageMeta as asBlockBoundWitnessWithStorageMeta2, StepSizes } from "@xyo-network/xl1-protocol";
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
115
|
+
|
|
116
|
+
// src/model/ChainContext/ChainContext.ts
|
|
117
|
+
import { isDefined as isDefined2, isUndefined } from "@xylabs/typeof";
|
|
118
|
+
|
|
119
|
+
// src/driver/cache/LruCacheMap.ts
|
|
120
|
+
import { LRUCache } from "lru-cache";
|
|
121
|
+
var LruCacheMap = class {
|
|
122
|
+
static {
|
|
123
|
+
__name(this, "LruCacheMap");
|
|
124
|
+
}
|
|
125
|
+
lruCache;
|
|
126
|
+
constructor(options) {
|
|
127
|
+
this.lruCache = new LRUCache(options ?? {
|
|
128
|
+
max: 5e3
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
clear() {
|
|
132
|
+
this.lruCache.clear();
|
|
133
|
+
}
|
|
134
|
+
delete(id) {
|
|
135
|
+
return this.lruCache.delete(id);
|
|
136
|
+
}
|
|
137
|
+
get(id) {
|
|
138
|
+
return this.lruCache.get(id);
|
|
139
|
+
}
|
|
140
|
+
getMany(id) {
|
|
141
|
+
const results = [];
|
|
142
|
+
for (const key of id) {
|
|
143
|
+
const value = this.lruCache.get(key);
|
|
144
|
+
if (value !== void 0) {
|
|
145
|
+
results.push(value);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return results;
|
|
149
|
+
}
|
|
150
|
+
has(id) {
|
|
151
|
+
return this.lruCache.has(id);
|
|
152
|
+
}
|
|
153
|
+
set(id, data) {
|
|
154
|
+
this.lruCache.set(id, data);
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
// src/driver/memory/MemoryMap.ts
|
|
159
|
+
import { isDefined } from "@xylabs/typeof";
|
|
160
|
+
var MemoryMap = class {
|
|
161
|
+
static {
|
|
162
|
+
__name(this, "MemoryMap");
|
|
163
|
+
}
|
|
164
|
+
map;
|
|
165
|
+
constructor() {
|
|
166
|
+
this.map = /* @__PURE__ */ new Map();
|
|
167
|
+
}
|
|
168
|
+
clear() {
|
|
169
|
+
this.map.clear();
|
|
170
|
+
}
|
|
171
|
+
delete(id) {
|
|
172
|
+
return this.map.delete(id);
|
|
173
|
+
}
|
|
174
|
+
get(id) {
|
|
175
|
+
return this.map.get(id);
|
|
123
176
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
jumpBlockNumber = possibleJumpBlockNumber;
|
|
131
|
-
jumpHash = asHash(currentBlock.step_hashes.at(step), () => `Step hash not found for step ${step} in block ${currentBlock.block}`);
|
|
177
|
+
getMany(ids) {
|
|
178
|
+
const results = [];
|
|
179
|
+
for (const id of ids) {
|
|
180
|
+
const data = this.map.get(id);
|
|
181
|
+
if (isDefined(data)) {
|
|
182
|
+
results.push(data);
|
|
132
183
|
}
|
|
133
184
|
}
|
|
134
|
-
|
|
135
|
-
|
|
185
|
+
return results;
|
|
186
|
+
}
|
|
187
|
+
has(id) {
|
|
188
|
+
return this.map.has(id);
|
|
189
|
+
}
|
|
190
|
+
set(id, data) {
|
|
191
|
+
this.map.set(id, data);
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
// src/model/ChainContext/ChainContext.ts
|
|
196
|
+
function contextCache(context, name, create) {
|
|
197
|
+
if (!context.caches) {
|
|
198
|
+
context.caches = {};
|
|
199
|
+
}
|
|
200
|
+
if (isUndefined(context.caches[name])) {
|
|
201
|
+
context.caches[name] = create?.() ?? new MemoryMap();
|
|
202
|
+
}
|
|
203
|
+
return context.caches[name];
|
|
204
|
+
}
|
|
205
|
+
__name(contextCache, "contextCache");
|
|
206
|
+
async function withContextCacheResponse(context, name, key, func, options) {
|
|
207
|
+
const cache = contextCache(context, name, () => new LruCacheMap({
|
|
208
|
+
max: options?.max ?? 1e4
|
|
209
|
+
}));
|
|
210
|
+
const cacheResult = await cache.get(key);
|
|
211
|
+
if (isDefined2(cacheResult)) {
|
|
212
|
+
return cacheResult;
|
|
213
|
+
}
|
|
214
|
+
const result = await func();
|
|
215
|
+
await cache.set(key, result);
|
|
216
|
+
return result;
|
|
217
|
+
}
|
|
218
|
+
__name(withContextCacheResponse, "withContextCacheResponse");
|
|
219
|
+
|
|
220
|
+
// src/model/StakeEvents.ts
|
|
221
|
+
var StakeEventNames = [
|
|
222
|
+
"StakeAdded",
|
|
223
|
+
"StakeRemoved",
|
|
224
|
+
"StakeWithdrawn"
|
|
225
|
+
];
|
|
226
|
+
|
|
227
|
+
// src/block/primitives/blockFromBlockNumber.ts
|
|
228
|
+
async function blockFromBlockNumber(context, blockNumber) {
|
|
229
|
+
const cacheKey = `${blockNumber}`;
|
|
230
|
+
return await withContextCacheResponse(context, "blockFromBlockNumber", cacheKey, async () => {
|
|
231
|
+
const [headHash] = await context.head();
|
|
232
|
+
const result = await context.store.chainMap.get(headHash);
|
|
233
|
+
let currentBlock = asBlockBoundWitnessWithStorageMeta2(result, () => `Head block not found for hash: ${headHash}`, {
|
|
136
234
|
required: true
|
|
137
235
|
});
|
|
138
|
-
if (currentBlock.block === blockNumber) {
|
|
139
|
-
break;
|
|
140
|
-
}
|
|
141
236
|
if (currentBlock.block < blockNumber) {
|
|
142
|
-
throw new Error(`Block number ${blockNumber} is
|
|
237
|
+
throw new Error(`Error: Block number ${blockNumber} is greater than head ${currentBlock.block}.`);
|
|
143
238
|
}
|
|
144
|
-
|
|
145
|
-
|
|
239
|
+
while (currentBlock.block > blockNumber) {
|
|
240
|
+
let jumpHash = currentBlock.previous;
|
|
241
|
+
let jumpBlockNumber = currentBlock.block - 1;
|
|
242
|
+
for (const [step, stepSize2] of StepSizes.entries()) {
|
|
243
|
+
const possibleJumpBlockNumber = currentBlock.block - currentBlock.block % stepSize2 - 1;
|
|
244
|
+
if (possibleJumpBlockNumber >= blockNumber && possibleJumpBlockNumber <= jumpBlockNumber) {
|
|
245
|
+
jumpBlockNumber = possibleJumpBlockNumber;
|
|
246
|
+
jumpHash = asHash(currentBlock.step_hashes.at(step), () => `Step hash not found for step ${step} in block ${currentBlock.block}`);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
const newBlock = await context.store.chainMap.get(asHash(jumpHash, () => `Jump hash not found for block number [${blockNumber}]: ${jumpBlockNumber} ${toSafeJsonString(currentBlock, 10)}`));
|
|
250
|
+
currentBlock = asBlockBoundWitnessWithStorageMeta2(newBlock, () => `Block not found for hash: ${jumpHash}`, {
|
|
251
|
+
required: true
|
|
252
|
+
});
|
|
253
|
+
if (currentBlock.block === blockNumber) {
|
|
254
|
+
break;
|
|
255
|
+
}
|
|
256
|
+
if (currentBlock.block < blockNumber) {
|
|
257
|
+
throw new Error(`Block number ${blockNumber} is not a valid step block number for block ${headHash}.`);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
return currentBlock;
|
|
261
|
+
});
|
|
146
262
|
}
|
|
147
263
|
__name(blockFromBlockNumber, "blockFromBlockNumber");
|
|
148
264
|
|
|
@@ -228,6 +344,12 @@ function isReadWriteArchivist(value) {
|
|
|
228
344
|
}
|
|
229
345
|
__name(isReadWriteArchivist, "isReadWriteArchivist");
|
|
230
346
|
|
|
347
|
+
// src/block/primitives/toStepIdentityString.ts
|
|
348
|
+
function toStepIdentityString({ block, step }) {
|
|
349
|
+
return `${block}|${step}`;
|
|
350
|
+
}
|
|
351
|
+
__name(toStepIdentityString, "toStepIdentityString");
|
|
352
|
+
|
|
231
353
|
// src/block/primitives/transfers/transfersStepSummaryFromRange.ts
|
|
232
354
|
import { assertEx as assertEx4 } from "@xylabs/assert";
|
|
233
355
|
import { PayloadBuilder } from "@xyo-network/payload-builder";
|
|
@@ -354,11 +476,49 @@ var toPositiveBigInt = /* @__PURE__ */ __name((value) => {
|
|
|
354
476
|
throw new Error("Invalid value for positive big int");
|
|
355
477
|
}, "toPositiveBigInt");
|
|
356
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
|
+
|
|
357
517
|
// src/block/primitives/transfers/transfersStepSummaryFromRange.ts
|
|
358
518
|
async function transfersStepSummaryFromRange(context, range) {
|
|
359
519
|
const frameHeadHash = await hashFromBlockNumber(context, range[1]);
|
|
360
520
|
const frameSize = range[1] - range[0] + 1;
|
|
361
|
-
const
|
|
521
|
+
const [headHash] = await context.head();
|
|
362
522
|
let result = void 0;
|
|
363
523
|
if (frameSize === 1) {
|
|
364
524
|
const hash = await hashFromBlockNumber(context, range[0]);
|
|
@@ -372,14 +532,15 @@ async function transfersStepSummaryFromRange(context, range) {
|
|
|
372
532
|
}
|
|
373
533
|
result = {
|
|
374
534
|
schema: TransfersStepSummarySchema,
|
|
375
|
-
hash:
|
|
535
|
+
hash: headHash,
|
|
376
536
|
stepSize: -1,
|
|
377
537
|
transfers
|
|
378
538
|
};
|
|
379
539
|
} else {
|
|
380
540
|
const step = StepSizes3.indexOf(frameSize);
|
|
381
541
|
assertEx4(step !== -1, () => `Invalid step size: ${frameSize}. Must be one of ${StepSizes3.join(", ")}`);
|
|
382
|
-
const
|
|
542
|
+
const key = transfersSummaryKey(frameHeadHash, frameSize);
|
|
543
|
+
const summaryResult = await context.summaryMap.get(key);
|
|
383
544
|
if (isAnyPayload(summaryResult)) {
|
|
384
545
|
result = summaryResult;
|
|
385
546
|
} else {
|
|
@@ -410,7 +571,7 @@ async function transfersStepSummaryFromRange(context, range) {
|
|
|
410
571
|
stepSize: frameSize,
|
|
411
572
|
transfers
|
|
412
573
|
};
|
|
413
|
-
await context.summaryMap.set(
|
|
574
|
+
await context.summaryMap.set(key, result);
|
|
414
575
|
} finally {
|
|
415
576
|
context.stepSemaphores[step].release();
|
|
416
577
|
}
|
|
@@ -421,47 +582,48 @@ async function transfersStepSummaryFromRange(context, range) {
|
|
|
421
582
|
}
|
|
422
583
|
__name(transfersStepSummaryFromRange, "transfersStepSummaryFromRange");
|
|
423
584
|
|
|
424
|
-
// src/block/primitives/transfers/transfersSummary.ts
|
|
425
|
-
import { asAddress } from "@xylabs/hex";
|
|
426
|
-
import { spanRootAsync } from "@xylabs/telemetry";
|
|
427
|
-
import { isDefined } from "@xylabs/typeof";
|
|
428
|
-
import { asBlockBoundWitnessWithStorageMeta as asBlockBoundWitnessWithStorageMeta3, asXL1BlockNumber as asXL1BlockNumber2 } from "@xyo-network/xl1-protocol";
|
|
429
|
-
async function transfersSummary(context) {
|
|
430
|
-
return await spanRootAsync("transferSummary", async () => {
|
|
431
|
-
const head = await context.head();
|
|
432
|
-
const headResult = await context.store.chainMap.get(head);
|
|
433
|
-
const headBoundWitness = asBlockBoundWitnessWithStorageMeta3(headResult, () => `Head block not found for hash: ${context.head}`, {
|
|
434
|
-
required: true
|
|
435
|
-
});
|
|
436
|
-
const rangeStart = asXL1BlockNumber2(isDefined(context.windowSize) ? Math.max(headBoundWitness.block - context.windowSize + 1, 0) : 0);
|
|
437
|
-
const ranges = deepCalculateFramesFromRange([
|
|
438
|
-
rangeStart,
|
|
439
|
-
asXL1BlockNumber2(headBoundWitness.block)
|
|
440
|
-
]);
|
|
441
|
-
const summaries = await Promise.all(ranges.map((range) => transfersStepSummaryFromRange(context, range)));
|
|
442
|
-
const transfers = {};
|
|
443
|
-
for (let summary of summaries) {
|
|
444
|
-
for (const [from, toMap] of Object.entries(summary.transfers)) {
|
|
445
|
-
const validFrom = asAddress(from, () => `Invalid address: ${from}`);
|
|
446
|
-
transfers[validFrom] = transfers[validFrom] ?? {};
|
|
447
|
-
for (const [to, transfer] of Object.entries(toMap)) {
|
|
448
|
-
const validTo = asAddress(to, () => `Invalid address: ${to}`);
|
|
449
|
-
transfers[validFrom][validTo] = (transfers[validFrom][validTo] ?? 0n) + parseSignedBigInt(transfer);
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
return transfers;
|
|
454
|
-
});
|
|
455
|
-
}
|
|
456
|
-
__name(transfersSummary, "transfersSummary");
|
|
457
|
-
|
|
458
585
|
// src/config/Config.ts
|
|
459
|
-
import * as
|
|
586
|
+
import * as z15 from "zod";
|
|
460
587
|
|
|
461
588
|
// src/config/Api.ts
|
|
462
589
|
import { globalRegistry } from "zod";
|
|
463
590
|
import * as z2 from "zod";
|
|
464
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
|
+
|
|
465
627
|
// src/validation/lib/isLocalhost.ts
|
|
466
628
|
var isLocalhost = /* @__PURE__ */ __name((hostname) => {
|
|
467
629
|
return hostname === "localhost" || hostname === "127.0.0.1" || hostname === "::1" || hostname.endsWith(".localhost");
|
|
@@ -616,57 +778,106 @@ var LogConfigZod = z7.object({
|
|
|
616
778
|
})
|
|
617
779
|
});
|
|
618
780
|
|
|
619
|
-
// src/config/
|
|
620
|
-
import { AddressZod, asAddress as asAddress2 } from "@xylabs/hex";
|
|
781
|
+
// src/config/Mempool.ts
|
|
621
782
|
import { globalRegistry as globalRegistry7 } from "zod";
|
|
622
783
|
import * as z8 from "zod";
|
|
623
|
-
var
|
|
624
|
-
|
|
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) => {
|
|
625
836
|
if (typeof val === "string") {
|
|
626
837
|
return val.split(",").map((s) => asAddress2(s.trim()));
|
|
627
838
|
}
|
|
628
839
|
return val;
|
|
629
|
-
},
|
|
840
|
+
}, z9.array(AddressZod).optional().register(globalRegistry8, {
|
|
630
841
|
description: "List of allowed producer addresses, if undefined anyone can participate",
|
|
631
842
|
title: "allowlist",
|
|
632
843
|
type: "array"
|
|
633
844
|
})),
|
|
634
|
-
disableIntentRedeclaration:
|
|
845
|
+
disableIntentRedeclaration: z9.boolean().optional().register(globalRegistry8, {
|
|
635
846
|
description: "Should the producer skip redeclaring their intent to continue producing blocks",
|
|
636
847
|
title: "producer.disableIntentRedeclaration",
|
|
637
848
|
type: "boolean"
|
|
638
849
|
}),
|
|
639
850
|
// TODO: Port schema
|
|
640
|
-
healthCheckPort:
|
|
851
|
+
healthCheckPort: z9.coerce.number().optional().register(globalRegistry8, {
|
|
641
852
|
description: "Port for the Producer health checks",
|
|
642
853
|
title: "producer.healthCheckPort",
|
|
643
854
|
type: "number"
|
|
644
855
|
}),
|
|
645
|
-
heartbeatInterval:
|
|
856
|
+
heartbeatInterval: z9.coerce.number().default(36e5).register(globalRegistry8, {
|
|
646
857
|
description: "The number of milliseconds between heartbeats if no blocks are produced",
|
|
647
858
|
title: "producer.heartbeatInterval",
|
|
648
859
|
type: "number"
|
|
649
860
|
}),
|
|
650
861
|
// TODO: BigInt schema
|
|
651
|
-
minStake:
|
|
862
|
+
minStake: z9.coerce.number().default(1).register(globalRegistry8, {
|
|
652
863
|
description: "Minimum stake required to be a Producer",
|
|
653
864
|
title: "producer.minStake",
|
|
654
865
|
type: "number"
|
|
655
866
|
}),
|
|
656
|
-
mnemonic: MnemonicStringZod.optional().register(
|
|
867
|
+
mnemonic: MnemonicStringZod.optional().register(globalRegistry8, {
|
|
657
868
|
description: "Mnemonic for the Producer wallet",
|
|
658
869
|
title: "producer.mnemonic",
|
|
659
870
|
type: "string"
|
|
660
871
|
}),
|
|
661
872
|
// TODO: Port schema
|
|
662
|
-
port:
|
|
873
|
+
port: z9.coerce.number().default(8081).register(globalRegistry8, {
|
|
663
874
|
default: 8081,
|
|
664
875
|
description: "Port for the Producer",
|
|
665
876
|
title: "producer.port",
|
|
666
877
|
type: "number"
|
|
667
878
|
}),
|
|
668
879
|
// TODO: Address schema
|
|
669
|
-
rewardAddress:
|
|
880
|
+
rewardAddress: z9.string().optional().register(globalRegistry8, {
|
|
670
881
|
description: "Address to receive block rewards",
|
|
671
882
|
title: "producer.rewardAddress",
|
|
672
883
|
type: "string"
|
|
@@ -674,27 +885,27 @@ var ProducerConfigZod = z8.object({
|
|
|
674
885
|
});
|
|
675
886
|
|
|
676
887
|
// src/config/RewardRedemptionApi.ts
|
|
677
|
-
import { globalRegistry as
|
|
678
|
-
import * as
|
|
679
|
-
var RewardRedemptionApiConfigZod =
|
|
680
|
-
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, {
|
|
681
892
|
default: "http://localhost:8080/rpc",
|
|
682
893
|
description: "URL for the Chain RPC API",
|
|
683
894
|
title: "rewardRedemptionApi.chainRpcApiUrl",
|
|
684
895
|
type: "string"
|
|
685
896
|
}),
|
|
686
|
-
host:
|
|
897
|
+
host: z10.string().default("localhost").register(globalRegistry9, {
|
|
687
898
|
default: "localhost",
|
|
688
899
|
description: "Host for the Redemption API",
|
|
689
900
|
title: "rewardRedemptionApi.host",
|
|
690
901
|
type: "string"
|
|
691
902
|
}),
|
|
692
|
-
mnemonic: MnemonicStringZod.optional().register(
|
|
903
|
+
mnemonic: MnemonicStringZod.optional().register(globalRegistry9, {
|
|
693
904
|
description: "Mnemonic for the Redemption API wallet",
|
|
694
905
|
title: "rewardRedemptionApi.mnemonic",
|
|
695
906
|
type: "string"
|
|
696
907
|
}),
|
|
697
|
-
port:
|
|
908
|
+
port: z10.coerce.number().default(8082).register(globalRegistry9, {
|
|
698
909
|
default: 8082,
|
|
699
910
|
description: "Port for the Redemption API",
|
|
700
911
|
title: "rewardRedemptionApi.port",
|
|
@@ -703,36 +914,36 @@ var RewardRedemptionApiConfigZod = z9.object({
|
|
|
703
914
|
});
|
|
704
915
|
|
|
705
916
|
// src/config/storage/driver/Mongo.ts
|
|
706
|
-
import { isDefined as
|
|
707
|
-
import { globalRegistry as
|
|
708
|
-
import * as
|
|
917
|
+
import { isDefined as isDefined4, isUndefined as isUndefined2 } from "@xylabs/typeof";
|
|
918
|
+
import { globalRegistry as globalRegistry10 } from "zod";
|
|
919
|
+
import * as z11 from "zod";
|
|
709
920
|
var hasMongoConfig = /* @__PURE__ */ __name((config) => {
|
|
710
|
-
if (
|
|
711
|
-
return
|
|
921
|
+
if (isUndefined2(config)) return false;
|
|
922
|
+
return isDefined4(config.connectionString) && isDefined4(config.database) && isDefined4(config.domain) && isDefined4(config.password) && isDefined4(config.username);
|
|
712
923
|
}, "hasMongoConfig");
|
|
713
|
-
var MongoConfigZod =
|
|
924
|
+
var MongoConfigZod = z11.object({
|
|
714
925
|
// TODO: Create from other arguments
|
|
715
|
-
connectionString:
|
|
926
|
+
connectionString: z11.string().nonempty().optional().register(globalRegistry10, {
|
|
716
927
|
description: "MongoDB connection string",
|
|
717
928
|
title: "storage.mongo.connectionString",
|
|
718
929
|
type: "string"
|
|
719
930
|
}),
|
|
720
|
-
database:
|
|
931
|
+
database: z11.string().nonempty().optional().register(globalRegistry10, {
|
|
721
932
|
description: "MongoDB database name",
|
|
722
933
|
title: "storage.mongo.database",
|
|
723
934
|
type: "string"
|
|
724
935
|
}),
|
|
725
|
-
domain:
|
|
936
|
+
domain: z11.string().nonempty().optional().register(globalRegistry10, {
|
|
726
937
|
description: "MongoDB domain",
|
|
727
938
|
title: "storage.mongo.domain",
|
|
728
939
|
type: "string"
|
|
729
940
|
}),
|
|
730
|
-
password:
|
|
941
|
+
password: z11.string().nonempty().optional().register(globalRegistry10, {
|
|
731
942
|
description: "MongoDB password",
|
|
732
943
|
title: "storage.mongo.password",
|
|
733
944
|
type: "string"
|
|
734
945
|
}),
|
|
735
|
-
username:
|
|
946
|
+
username: z11.string().nonempty().optional().register(globalRegistry10, {
|
|
736
947
|
description: "MongoDB username",
|
|
737
948
|
title: "storage.mongo.username",
|
|
738
949
|
type: "string"
|
|
@@ -740,11 +951,11 @@ var MongoConfigZod = z10.object({
|
|
|
740
951
|
});
|
|
741
952
|
|
|
742
953
|
// src/config/storage/Storage.ts
|
|
743
|
-
import { globalRegistry as
|
|
744
|
-
import * as
|
|
745
|
-
var StorageConfigZod =
|
|
954
|
+
import { globalRegistry as globalRegistry11 } from "zod";
|
|
955
|
+
import * as z12 from "zod";
|
|
956
|
+
var StorageConfigZod = z12.object({
|
|
746
957
|
mongo: MongoConfigZod.optional().describe("Configuration for the MongoD storage driver"),
|
|
747
|
-
root:
|
|
958
|
+
root: z12.string().optional().register(globalRegistry11, {
|
|
748
959
|
description: "Root directory for local storage",
|
|
749
960
|
title: "storage.root",
|
|
750
961
|
type: "string"
|
|
@@ -752,42 +963,42 @@ var StorageConfigZod = z11.object({
|
|
|
752
963
|
}).describe("Storage configuration options");
|
|
753
964
|
|
|
754
965
|
// src/config/Telemetry.ts
|
|
755
|
-
import { globalRegistry as
|
|
756
|
-
import * as
|
|
757
|
-
var OpenTelemetryConfigZod =
|
|
966
|
+
import { globalRegistry as globalRegistry12 } from "zod";
|
|
967
|
+
import * as z13 from "zod";
|
|
968
|
+
var OpenTelemetryConfigZod = z13.object({
|
|
758
969
|
// OpenTelemetry options
|
|
759
|
-
otlpEndpoint:
|
|
970
|
+
otlpEndpoint: z13.url().optional().register(globalRegistry12, {
|
|
760
971
|
description: "OTLP endpoint for exporting telemetry data",
|
|
761
972
|
title: "telemetry.otel.otlpEndpoint",
|
|
762
973
|
type: "string"
|
|
763
974
|
})
|
|
764
975
|
});
|
|
765
|
-
var TelemetryConfigZod =
|
|
976
|
+
var TelemetryConfigZod = z13.object({
|
|
766
977
|
// OpenTelemetry configuration
|
|
767
978
|
otel: OpenTelemetryConfigZod.optional().describe("OpenTelemetry configuration")
|
|
768
979
|
}).describe("Telemetry configuration options");
|
|
769
980
|
|
|
770
981
|
// src/config/Validation.ts
|
|
771
982
|
import { AddressZod as AddressZod2, asAddress as asAddress3 } from "@xylabs/hex";
|
|
772
|
-
import { globalRegistry as
|
|
773
|
-
import * as
|
|
774
|
-
var ValidationConfigZod =
|
|
775
|
-
allowedRewardRedeemers:
|
|
983
|
+
import { globalRegistry as globalRegistry13 } from "zod";
|
|
984
|
+
import * as z14 from "zod";
|
|
985
|
+
var ValidationConfigZod = z14.object({
|
|
986
|
+
allowedRewardRedeemers: z14.preprocess((val) => {
|
|
776
987
|
if (typeof val === "string") {
|
|
777
988
|
return val.split(",").map((s) => asAddress3(s.trim()));
|
|
778
989
|
}
|
|
779
990
|
return val;
|
|
780
|
-
},
|
|
991
|
+
}, z14.array(AddressZod2).optional().register(globalRegistry13, {
|
|
781
992
|
description: "List of allowed reward redeemer addresses, if undefined anyone can participate",
|
|
782
993
|
title: "allowedRewardRedeemers",
|
|
783
994
|
type: "array"
|
|
784
995
|
})),
|
|
785
|
-
allowedRewardEscrowAccountSigners:
|
|
996
|
+
allowedRewardEscrowAccountSigners: z14.preprocess((val) => {
|
|
786
997
|
if (typeof val === "string") {
|
|
787
998
|
return val.split(",").map((s) => asAddress3(s.trim()));
|
|
788
999
|
}
|
|
789
1000
|
return val;
|
|
790
|
-
},
|
|
1001
|
+
}, z14.array(AddressZod2).optional().register(globalRegistry13, {
|
|
791
1002
|
description: "List of allowed reward escrow account signer addresses, if undefined anyone can participate",
|
|
792
1003
|
title: "allowedRewardEscrowAccountSigners",
|
|
793
1004
|
type: "array"
|
|
@@ -795,16 +1006,17 @@ var ValidationConfigZod = z13.object({
|
|
|
795
1006
|
});
|
|
796
1007
|
|
|
797
1008
|
// src/config/Config.ts
|
|
798
|
-
var Xl1CommonConfigSchema =
|
|
1009
|
+
var Xl1CommonConfigSchema = z15.object({
|
|
799
1010
|
...LogConfigZod.shape
|
|
800
1011
|
}).describe("XL1 common configuration options");
|
|
801
|
-
var ConfigZod =
|
|
1012
|
+
var ConfigZod = z15.object({
|
|
802
1013
|
...Xl1CommonConfigSchema.shape,
|
|
803
1014
|
api: ApiConfigZod.default(ApiConfigZod.parse({})).describe("Configuration for the API node"),
|
|
804
1015
|
app: AppConfigZod.default(AppConfigZod.parse({})).describe("Configuration for the application"),
|
|
805
1016
|
bridge: BridgeConfigZod.default(BridgeConfigZod.parse({})).describe("Configuration for the Bridge node"),
|
|
806
1017
|
chain: ChainConfigZod.default(ChainConfigZod.parse({})).describe("Configuration for the chain"),
|
|
807
1018
|
evm: EvmConfigZod.default(EvmConfigZod.parse({})).describe("Configuration for EVM-backed services"),
|
|
1019
|
+
mempool: MempoolConfigZod.default(MempoolConfigZod.parse({})).describe("Configuration for the mempool"),
|
|
808
1020
|
producer: ProducerConfigZod.default(ProducerConfigZod.parse({})).describe("Configuration for the producer"),
|
|
809
1021
|
rewardRedemptionApi: RewardRedemptionApiConfigZod.default(RewardRedemptionApiConfigZod.parse({})).describe("Configuration for the rewards redemption API"),
|
|
810
1022
|
storage: StorageConfigZod.default(StorageConfigZod.parse({})).describe("Configuration for the storage"),
|
|
@@ -814,35 +1026,35 @@ var ConfigZod = z14.object({
|
|
|
814
1026
|
var getDefaultConfig = /* @__PURE__ */ __name(() => ConfigZod.parse({}), "getDefaultConfig");
|
|
815
1027
|
|
|
816
1028
|
// src/config/UsageMeta.ts
|
|
817
|
-
import * as
|
|
818
|
-
var DescriptionSchema =
|
|
819
|
-
var TitleSchema =
|
|
820
|
-
var JSONSchemaMetaSchema =
|
|
821
|
-
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(),
|
|
822
1034
|
title: TitleSchema.optional(),
|
|
823
1035
|
description: DescriptionSchema.optional(),
|
|
824
|
-
deprecated:
|
|
825
|
-
}).catchall(
|
|
1036
|
+
deprecated: z16.boolean().optional()
|
|
1037
|
+
}).catchall(z16.unknown());
|
|
826
1038
|
var GlobalMetaSchema = JSONSchemaMetaSchema.extend({});
|
|
827
|
-
var ChoicesSchema =
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
1039
|
+
var ChoicesSchema = z16.array(z16.union([
|
|
1040
|
+
z16.string(),
|
|
1041
|
+
z16.number(),
|
|
1042
|
+
z16.literal(true),
|
|
1043
|
+
z16.undefined()
|
|
832
1044
|
])).readonly();
|
|
833
1045
|
var UsageMetaSchema = GlobalMetaSchema.extend({
|
|
834
1046
|
choices: ChoicesSchema.optional(),
|
|
835
|
-
default:
|
|
1047
|
+
default: z16.unknown().optional(),
|
|
836
1048
|
description: DescriptionSchema,
|
|
837
|
-
group:
|
|
838
|
-
hidden:
|
|
1049
|
+
group: z16.string().optional(),
|
|
1050
|
+
hidden: z16.boolean().optional(),
|
|
839
1051
|
title: TitleSchema,
|
|
840
|
-
type:
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
1052
|
+
type: z16.union([
|
|
1053
|
+
z16.literal("array"),
|
|
1054
|
+
z16.literal("count"),
|
|
1055
|
+
z16.literal("boolean"),
|
|
1056
|
+
z16.literal("number"),
|
|
1057
|
+
z16.literal("string")
|
|
846
1058
|
])
|
|
847
1059
|
});
|
|
848
1060
|
function isUsageMeta(v) {
|
|
@@ -857,39 +1069,38 @@ var XL1_NETWORK_STAKING_GENESIS_PERIOD_END_XL1_BLOCK = 107496;
|
|
|
857
1069
|
// src/eip-712/Payloads/EIP712Data.ts
|
|
858
1070
|
import { AsObjectFactory as AsObjectFactory4 } from "@xylabs/object";
|
|
859
1071
|
import { isPayloadOfZodType } from "@xyo-network/payload-model";
|
|
860
|
-
import
|
|
1072
|
+
import z18 from "zod";
|
|
861
1073
|
|
|
862
1074
|
// src/eip-712/Types.ts
|
|
863
|
-
import
|
|
864
|
-
var TypedDataDomainZod =
|
|
865
|
-
name:
|
|
866
|
-
version:
|
|
867
|
-
chainId:
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
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()
|
|
871
1083
|
]).nullable().optional(),
|
|
872
|
-
verifyingContract:
|
|
873
|
-
salt:
|
|
874
|
-
|
|
875
|
-
|
|
1084
|
+
verifyingContract: z17.string().nullable().optional(),
|
|
1085
|
+
salt: z17.union([
|
|
1086
|
+
z17.string(),
|
|
1087
|
+
z17.instanceof(Uint8Array)
|
|
876
1088
|
]).nullable().optional()
|
|
877
1089
|
});
|
|
878
|
-
var TypedDataFieldZod =
|
|
879
|
-
name:
|
|
880
|
-
type:
|
|
1090
|
+
var TypedDataFieldZod = z17.object({
|
|
1091
|
+
name: z17.string(),
|
|
1092
|
+
type: z17.string()
|
|
881
1093
|
});
|
|
882
|
-
var TypedDataTypesZod =
|
|
883
|
-
var TypedDataValueZod =
|
|
1094
|
+
var TypedDataTypesZod = z17.record(z17.string(), z17.array(TypedDataFieldZod));
|
|
1095
|
+
var TypedDataValueZod = z17.record(z17.string(), z17.any());
|
|
884
1096
|
|
|
885
1097
|
// src/eip-712/Payloads/EIP712Data.ts
|
|
886
|
-
var EIP712DataPayloadFieldsZod =
|
|
1098
|
+
var EIP712DataPayloadFieldsZod = z18.object({
|
|
887
1099
|
domain: TypedDataDomainZod,
|
|
888
1100
|
types: TypedDataTypesZod,
|
|
889
1101
|
values: TypedDataValueZod
|
|
890
1102
|
});
|
|
891
1103
|
var EIP712DataPayloadSchema = "network.xyo.chains.ethereum.eip712.data";
|
|
892
|
-
var EIP712PayloadSchema = EIP712DataPayloadSchema;
|
|
893
1104
|
var isEIP712DataPayload = isPayloadOfZodType(EIP712DataPayloadFieldsZod, EIP712DataPayloadSchema);
|
|
894
1105
|
var asEIP712DataPayload = AsObjectFactory4.create(isEIP712DataPayload);
|
|
895
1106
|
|
|
@@ -897,11 +1108,11 @@ var asEIP712DataPayload = AsObjectFactory4.create(isEIP712DataPayload);
|
|
|
897
1108
|
import { HashZod } from "@xylabs/hex";
|
|
898
1109
|
import { AsObjectFactory as AsObjectFactory5 } from "@xylabs/object";
|
|
899
1110
|
import { isPayloadOfZodType as isPayloadOfZodType2 } from "@xyo-network/payload-model";
|
|
900
|
-
import
|
|
901
|
-
var EIP712SignaturePayloadFieldsZod =
|
|
902
|
-
address:
|
|
1111
|
+
import z19 from "zod";
|
|
1112
|
+
var EIP712SignaturePayloadFieldsZod = z19.object({
|
|
1113
|
+
address: z19.string(),
|
|
903
1114
|
hash: HashZod,
|
|
904
|
-
signature:
|
|
1115
|
+
signature: z19.string()
|
|
905
1116
|
});
|
|
906
1117
|
var EIP712SignaturePayloadSchema = "network.xyo.chains.ethereum.eip712.signature";
|
|
907
1118
|
var isEIP712SignaturePayload = isPayloadOfZodType2(EIP712SignaturePayloadFieldsZod, EIP712SignaturePayloadSchema);
|
|
@@ -924,25 +1135,18 @@ var signEIP712Message = /* @__PURE__ */ __name(async (signer, data) => {
|
|
|
924
1135
|
|
|
925
1136
|
// src/eip-712/verify.ts
|
|
926
1137
|
import { asHash as asHash2 } from "@xylabs/hex";
|
|
927
|
-
import { isUndefined as
|
|
1138
|
+
import { isUndefined as isUndefined3 } from "@xylabs/typeof";
|
|
928
1139
|
import { PayloadBuilder as PayloadBuilder3 } from "@xyo-network/payload-builder";
|
|
929
1140
|
import { verifyTypedData } from "ethers/hash";
|
|
930
1141
|
var verifyEIP712Message = /* @__PURE__ */ __name(async (data, sig) => {
|
|
931
1142
|
const { address, signature, hash } = sig;
|
|
932
1143
|
const { schema, ...fields } = data;
|
|
933
1144
|
const signedHash = asHash2(hash);
|
|
934
|
-
if (
|
|
1145
|
+
if (isUndefined3(signedHash) || signedHash !== await PayloadBuilder3.hash(data)) return false;
|
|
935
1146
|
const recoveredAddress = verifyTypedData(fields.domain, fields.types, fields.values, signature);
|
|
936
1147
|
return recoveredAddress.toLowerCase() === address.toLowerCase();
|
|
937
1148
|
}, "verifyEIP712Message");
|
|
938
1149
|
|
|
939
|
-
// src/model/StakeEvents.ts
|
|
940
|
-
var StakeEventNames = [
|
|
941
|
-
"StakeAdded",
|
|
942
|
-
"StakeRemoved",
|
|
943
|
-
"StakeWithdrawn"
|
|
944
|
-
];
|
|
945
|
-
|
|
946
1150
|
// src/multipliers.ts
|
|
947
1151
|
import { asAttoXL1 } from "@xyo-network/xl1-protocol";
|
|
948
1152
|
var XL1_NETWORK_STAKING_GENESIS_PERIOD_TOTAL_EARNED_REWARDS = asAttoXL1(1343884111859145740576652n);
|
|
@@ -956,7 +1160,7 @@ var RewardMultipliers = {
|
|
|
956
1160
|
};
|
|
957
1161
|
|
|
958
1162
|
// src/primitives/readPayloadMapFromStore.ts
|
|
959
|
-
import { isDefined as
|
|
1163
|
+
import { isDefined as isDefined5 } from "@xylabs/typeof";
|
|
960
1164
|
function readPayloadMapFromStore(store) {
|
|
961
1165
|
if (isReadArchivist(store)) {
|
|
962
1166
|
return {
|
|
@@ -969,7 +1173,7 @@ function readPayloadMapFromStore(store) {
|
|
|
969
1173
|
return await store.get(hashes);
|
|
970
1174
|
}, "getMany"),
|
|
971
1175
|
has: /* @__PURE__ */ __name(async (hash) => {
|
|
972
|
-
return
|
|
1176
|
+
return isDefined5((await store.get([
|
|
973
1177
|
hash
|
|
974
1178
|
]))[0]);
|
|
975
1179
|
}, "has")
|
|
@@ -994,10 +1198,10 @@ __name(completedStepRewardAddress, "completedStepRewardAddress");
|
|
|
994
1198
|
|
|
995
1199
|
// src/primitives/step/derivedReceiveAddress.ts
|
|
996
1200
|
import { toAddress as toAddress3 } from "@xylabs/hex";
|
|
997
|
-
import { isDefined as
|
|
1201
|
+
import { isDefined as isDefined6 } from "@xylabs/typeof";
|
|
998
1202
|
import { keccak256 as keccak2562 } from "ethers";
|
|
999
1203
|
function derivedReceiveAddress(address, scope) {
|
|
1000
|
-
const addressKey = new TextEncoder().encode(
|
|
1204
|
+
const addressKey = new TextEncoder().encode(isDefined6(scope) ? `${scope}|${address}` : address);
|
|
1001
1205
|
return toAddress3(keccak2562(addressKey).slice(-40), {
|
|
1002
1206
|
prefix: false
|
|
1003
1207
|
});
|
|
@@ -1047,7 +1251,7 @@ import { StepSizes as StepSizes7 } from "@xyo-network/xl1-protocol";
|
|
|
1047
1251
|
async function balancesStepSummaryFromRange(context, range) {
|
|
1048
1252
|
const frameHeadHash = await hashFromBlockNumber(context, range[1]);
|
|
1049
1253
|
const frameSize = range[1] - range[0] + 1;
|
|
1050
|
-
const
|
|
1254
|
+
const [headHash] = await context.head();
|
|
1051
1255
|
let result = void 0;
|
|
1052
1256
|
if (frameSize === 1) {
|
|
1053
1257
|
const hash = await hashFromBlockNumber(context, range[0]);
|
|
@@ -1058,7 +1262,7 @@ async function balancesStepSummaryFromRange(context, range) {
|
|
|
1058
1262
|
}
|
|
1059
1263
|
result = {
|
|
1060
1264
|
schema: BalancesStepSummarySchema,
|
|
1061
|
-
hash:
|
|
1265
|
+
hash: headHash,
|
|
1062
1266
|
stepSize: -1,
|
|
1063
1267
|
balances
|
|
1064
1268
|
};
|
|
@@ -1104,16 +1308,16 @@ __name(balancesStepSummaryFromRange, "balancesStepSummaryFromRange");
|
|
|
1104
1308
|
// src/primitives/summary/balances/balancesSummary.ts
|
|
1105
1309
|
import { asAddress as asAddress4 } from "@xylabs/hex";
|
|
1106
1310
|
import { spanRootAsync as spanRootAsync2 } from "@xylabs/telemetry";
|
|
1107
|
-
import { isDefined as
|
|
1311
|
+
import { isDefined as isDefined7 } from "@xylabs/typeof";
|
|
1108
1312
|
import { asBlockBoundWitnessWithStorageMeta as asBlockBoundWitnessWithStorageMeta4, asXL1BlockNumber as asXL1BlockNumber3 } from "@xyo-network/xl1-protocol";
|
|
1109
1313
|
async function balancesSummary(context) {
|
|
1110
1314
|
return await spanRootAsync2("balanceSummary", async () => {
|
|
1111
|
-
const
|
|
1112
|
-
const headResult = await context.store.chainMap.get(
|
|
1113
|
-
const headBoundWitness = asBlockBoundWitnessWithStorageMeta4(headResult, () => `Head block not found for hash: ${
|
|
1315
|
+
const [headHash] = await context.head();
|
|
1316
|
+
const headResult = await context.store.chainMap.get(headHash);
|
|
1317
|
+
const headBoundWitness = asBlockBoundWitnessWithStorageMeta4(headResult, () => `Head block not found for hash: ${headHash}`, {
|
|
1114
1318
|
required: true
|
|
1115
1319
|
});
|
|
1116
|
-
const rangeStart = asXL1BlockNumber3(
|
|
1320
|
+
const rangeStart = asXL1BlockNumber3(isDefined7(context.windowSize) ? Math.max(headBoundWitness.block - context.windowSize + 1, 0) : 0);
|
|
1117
1321
|
const ranges = deepCalculateFramesFromRange([
|
|
1118
1322
|
rangeStart,
|
|
1119
1323
|
asXL1BlockNumber3(headBoundWitness.block)
|
|
@@ -1131,6 +1335,18 @@ async function balancesSummary(context) {
|
|
|
1131
1335
|
}
|
|
1132
1336
|
__name(balancesSummary, "balancesSummary");
|
|
1133
1337
|
|
|
1338
|
+
// src/primitives/timeBudget.ts
|
|
1339
|
+
async function timeBudget(name, logger, func, budget) {
|
|
1340
|
+
const start = Date.now();
|
|
1341
|
+
const result = await func();
|
|
1342
|
+
const duration = Date.now() - start;
|
|
1343
|
+
if (duration > budget) {
|
|
1344
|
+
logger?.warn(`Function [${name}] execution exceeded budget: ${duration}ms > ${budget}ms`);
|
|
1345
|
+
}
|
|
1346
|
+
return result;
|
|
1347
|
+
}
|
|
1348
|
+
__name(timeBudget, "timeBudget");
|
|
1349
|
+
|
|
1134
1350
|
// src/primitives/transaction/elevatedPayloads.ts
|
|
1135
1351
|
import { isAllowedBlockPayload } from "@xyo-network/xl1-protocol";
|
|
1136
1352
|
var ELEVATE_OPCODE = "elevate";
|
|
@@ -1153,6 +1369,25 @@ function elevatedPayloads([tx, payloads]) {
|
|
|
1153
1369
|
}
|
|
1154
1370
|
__name(elevatedPayloads, "elevatedPayloads");
|
|
1155
1371
|
|
|
1372
|
+
// src/provider/XyoDataLake.ts
|
|
1373
|
+
var isDataLakeViewer = /* @__PURE__ */ __name((value) => {
|
|
1374
|
+
return typeof value === "object" && value !== null && "fetch" in value && typeof value.fetch === "function" && "get" in value && typeof value.get === "function" && "trace" in value && typeof value.trace === "function";
|
|
1375
|
+
}, "isDataLakeViewer");
|
|
1376
|
+
var isDataLakeProvider = /* @__PURE__ */ __name((value) => {
|
|
1377
|
+
return isDataLakeViewer(value) && "add" in value && typeof value.add === "function";
|
|
1378
|
+
}, "isDataLakeProvider");
|
|
1379
|
+
|
|
1380
|
+
// src/services/StakeIntentService/ChainIndexingServiceStateSchema.ts
|
|
1381
|
+
import { AsObjectFactory as AsObjectFactory6 } from "@xylabs/object";
|
|
1382
|
+
import { isPayloadOfSchemaType as isPayloadOfSchemaType4, isStorageMeta as isStorageMeta3 } from "@xyo-network/payload-model";
|
|
1383
|
+
var ChainIndexingServiceStateSchema = "network.xyo.chain.indexing.service.state";
|
|
1384
|
+
var isChainIndexingServiceState = /* @__PURE__ */ __name((payload) => {
|
|
1385
|
+
return isPayloadOfSchemaType4(ChainIndexingServiceStateSchema)(payload);
|
|
1386
|
+
}, "isChainIndexingServiceState");
|
|
1387
|
+
var asChainIndexingServiceState = AsObjectFactory6.create(isChainIndexingServiceState);
|
|
1388
|
+
var isChainIndexingServiceStateWithStorageMeta = /* @__PURE__ */ __name((value) => isChainIndexingServiceState(value) && isStorageMeta3(value), "isChainIndexingServiceStateWithStorageMeta");
|
|
1389
|
+
var asChainIndexingServiceStateWithStorageMeta = AsObjectFactory6.create(isChainIndexingServiceStateWithStorageMeta);
|
|
1390
|
+
|
|
1156
1391
|
// src/time/primitives/xl1BlockNumberToEthBlockNumber.ts
|
|
1157
1392
|
import { assertEx as assertEx7 } from "@xylabs/assert";
|
|
1158
1393
|
import { asTimePayload, TimeSchema } from "@xyo-network/xl1-protocol";
|
|
@@ -1250,15 +1485,15 @@ async function buildUnsignedTransaction(chain, onChainPayloads, offChainPayloads
|
|
|
1250
1485
|
...offChainPayloads
|
|
1251
1486
|
]).build();
|
|
1252
1487
|
return [
|
|
1253
|
-
|
|
1254
|
-
|
|
1488
|
+
tx,
|
|
1489
|
+
txPayloads
|
|
1255
1490
|
];
|
|
1256
1491
|
}
|
|
1257
1492
|
__name(buildUnsignedTransaction, "buildUnsignedTransaction");
|
|
1258
1493
|
|
|
1259
1494
|
// src/transaction/confirmSubmittedTransaction.ts
|
|
1260
1495
|
import { delay } from "@xylabs/delay";
|
|
1261
|
-
import { isDefined as
|
|
1496
|
+
import { isDefined as isDefined8 } from "@xylabs/typeof";
|
|
1262
1497
|
import { PayloadBuilder as PayloadBuilder7 } from "@xyo-network/payload-builder";
|
|
1263
1498
|
var DEFAULT_CONFIRMATION_ATTEMPTS = 20;
|
|
1264
1499
|
var DEFAULT_DELAY_BETWEEN_ATTEMPTS = 1e3;
|
|
@@ -1269,7 +1504,7 @@ var confirmSubmittedTransaction = /* @__PURE__ */ __name(async (viewer, transact
|
|
|
1269
1504
|
let attempts = 0;
|
|
1270
1505
|
while (true) {
|
|
1271
1506
|
const tx = await viewer.transactionByHash(txBWHash) ?? void 0;
|
|
1272
|
-
if (
|
|
1507
|
+
if (isDefined8(tx)) {
|
|
1273
1508
|
options?.logger?.log("\u2705 Transaction confirmed:", txBWHash, "\n");
|
|
1274
1509
|
return tx;
|
|
1275
1510
|
} else {
|
|
@@ -1413,7 +1648,7 @@ __name(transactionRequiredGas, "transactionRequiredGas");
|
|
|
1413
1648
|
import { filterAs as filterAs2 } from "@xylabs/array";
|
|
1414
1649
|
import { assertEx as assertEx10 } from "@xylabs/assert";
|
|
1415
1650
|
import { asHash as asHash4 } from "@xylabs/hex";
|
|
1416
|
-
import {
|
|
1651
|
+
import { isAllowedBlockPayloadWithHashMeta } from "@xyo-network/xl1-protocol";
|
|
1417
1652
|
var tryExtractElevatedHashesFromScript = /* @__PURE__ */ __name((strings) => {
|
|
1418
1653
|
const hashes = strings.filter((str) => str.startsWith("elevate|")).map((str) => str.split("|")[1]);
|
|
1419
1654
|
return filterAs2(hashes, (h) => asHash4(h));
|
|
@@ -1428,13 +1663,13 @@ var tryExtractElevatedHashes = /* @__PURE__ */ __name((tx) => {
|
|
|
1428
1663
|
const [bw, payloads] = tx;
|
|
1429
1664
|
const { script } = bw;
|
|
1430
1665
|
const hashes = script ? tryExtractElevatedHashesFromScript(script) : [];
|
|
1431
|
-
return payloads.filter((p) => hashes.includes(p._hash)).filter(
|
|
1666
|
+
return payloads.filter((p) => hashes.includes(p._hash)).filter(isAllowedBlockPayloadWithHashMeta);
|
|
1432
1667
|
}, "tryExtractElevatedHashes");
|
|
1433
1668
|
var extractElevatedHashes = /* @__PURE__ */ __name((tx) => {
|
|
1434
1669
|
const [bw, payloads] = tx;
|
|
1435
1670
|
const { script } = bw;
|
|
1436
1671
|
const hashes = script ? tryExtractElevatedHashesFromScript(script) : [];
|
|
1437
|
-
const filtered = payloads.filter((p) => hashes.includes(p._hash)).filter(
|
|
1672
|
+
const filtered = payloads.filter((p) => hashes.includes(p._hash)).filter(isAllowedBlockPayloadWithHashMeta);
|
|
1438
1673
|
assertEx10(filtered.length === hashes.length, () => "Invalid elevated hashes");
|
|
1439
1674
|
return filtered;
|
|
1440
1675
|
}, "extractElevatedHashes");
|
|
@@ -1495,17 +1730,22 @@ export {
|
|
|
1495
1730
|
ADDRESS_INDEX,
|
|
1496
1731
|
AddressPairSchema,
|
|
1497
1732
|
BalancesStepSummarySchema,
|
|
1733
|
+
BlockValidationError,
|
|
1498
1734
|
CHANGE_ADDRESS,
|
|
1499
1735
|
COIN_TYPES,
|
|
1736
|
+
ChainIndexingServiceStateSchema,
|
|
1500
1737
|
ConfigZod,
|
|
1501
1738
|
DEFAULT_WALLET_PATH,
|
|
1502
1739
|
EIP712DataPayloadFieldsZod,
|
|
1503
1740
|
EIP712DataPayloadSchema,
|
|
1504
|
-
EIP712PayloadSchema,
|
|
1505
1741
|
EIP712SignaturePayloadFieldsZod,
|
|
1506
1742
|
EIP712SignaturePayloadSchema,
|
|
1507
1743
|
GlobalMetaSchema,
|
|
1744
|
+
HydratedBlockStateValidationError,
|
|
1745
|
+
HydratedBlockValidationError,
|
|
1508
1746
|
JSONSchemaMetaSchema,
|
|
1747
|
+
LruCacheMap,
|
|
1748
|
+
MemoryMap,
|
|
1509
1749
|
MnemonicStringZod,
|
|
1510
1750
|
RewardMultipliers,
|
|
1511
1751
|
StakeEventNames,
|
|
@@ -1528,6 +1768,8 @@ export {
|
|
|
1528
1768
|
asAddressPairPayload,
|
|
1529
1769
|
asBalancesStepSummary,
|
|
1530
1770
|
asBalancesStepSummaryWithStorageMeta,
|
|
1771
|
+
asChainIndexingServiceState,
|
|
1772
|
+
asChainIndexingServiceStateWithStorageMeta,
|
|
1531
1773
|
asEIP712DataPayload,
|
|
1532
1774
|
asEIP712SignaturePayload,
|
|
1533
1775
|
asOptionalAddressPairPayload,
|
|
@@ -1542,6 +1784,7 @@ export {
|
|
|
1542
1784
|
calculateFramesFromRange,
|
|
1543
1785
|
completedStepRewardAddress,
|
|
1544
1786
|
confirmSubmittedTransaction,
|
|
1787
|
+
contextCache,
|
|
1545
1788
|
crackOperation,
|
|
1546
1789
|
crackOperations,
|
|
1547
1790
|
deepCalculateFramesFromRange,
|
|
@@ -1564,8 +1807,15 @@ export {
|
|
|
1564
1807
|
isAddressPairPayload,
|
|
1565
1808
|
isBalancesStepSummary,
|
|
1566
1809
|
isBalancesStepSummaryWithStorageMeta,
|
|
1810
|
+
isBlockValidationError,
|
|
1811
|
+
isChainIndexingServiceState,
|
|
1812
|
+
isChainIndexingServiceStateWithStorageMeta,
|
|
1813
|
+
isDataLakeProvider,
|
|
1814
|
+
isDataLakeViewer,
|
|
1567
1815
|
isEIP712DataPayload,
|
|
1568
1816
|
isEIP712SignaturePayload,
|
|
1817
|
+
isHydratedBlockStateValidationError,
|
|
1818
|
+
isHydratedBlockValidationError,
|
|
1569
1819
|
isLocalhost,
|
|
1570
1820
|
isNegativeBigInt,
|
|
1571
1821
|
isPositiveBigInt,
|
|
@@ -1583,8 +1833,10 @@ export {
|
|
|
1583
1833
|
signTransaction,
|
|
1584
1834
|
stepBlockRange,
|
|
1585
1835
|
stepTransferIndex,
|
|
1836
|
+
timeBudget,
|
|
1586
1837
|
toPositiveBigInt,
|
|
1587
1838
|
toSignedBigInt,
|
|
1839
|
+
toStepIdentityString,
|
|
1588
1840
|
transactionBlockByteCount,
|
|
1589
1841
|
transactionBytesRequiredGas,
|
|
1590
1842
|
transactionElevatedPayloadHashes,
|
|
@@ -1593,12 +1845,14 @@ export {
|
|
|
1593
1845
|
transactionsFromHydratedBlock,
|
|
1594
1846
|
transfersStepSummaryFromRange,
|
|
1595
1847
|
transfersSummary,
|
|
1848
|
+
transfersSummaryKey,
|
|
1596
1849
|
tryExtractElevatedHashes,
|
|
1597
1850
|
tryExtractElevatedHashesFromScript,
|
|
1598
1851
|
tryHydrateBlock,
|
|
1599
1852
|
tryHydrateElevatedTransaction,
|
|
1600
1853
|
tryHydrateTransaction,
|
|
1601
1854
|
verifyEIP712Message,
|
|
1855
|
+
withContextCacheResponse,
|
|
1602
1856
|
xl1BlockNumberToEthBlockNumber
|
|
1603
1857
|
};
|
|
1604
1858
|
//# sourceMappingURL=index.mjs.map
|