@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
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Address } from '@xylabs/hex'
|
|
2
|
+
import type { PositionId } from '@xyo-network/xl1-protocol'
|
|
3
|
+
|
|
4
|
+
export type Position = {
|
|
5
|
+
// the block number when the stake was added
|
|
6
|
+
addBlock: number
|
|
7
|
+
// the amount that is staked
|
|
8
|
+
amount: bigint
|
|
9
|
+
// the unique id for the stake item
|
|
10
|
+
id: PositionId
|
|
11
|
+
// the block number when the stake was removed (set to 0 if not removed)
|
|
12
|
+
removeBlock: number
|
|
13
|
+
// the address that is being staked
|
|
14
|
+
staked: Address
|
|
15
|
+
// the address that owns the stake
|
|
16
|
+
staker: Address
|
|
17
|
+
// the block number when the stake was withdrawn (set to 0 if not withdrawn)
|
|
18
|
+
withdrawBlock: number
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** @deprecated - use Position instead */
|
|
22
|
+
export type Stake = Position
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Address } from '@xylabs/hex'
|
|
2
|
+
import type { Promisable } from '@xylabs/promise'
|
|
3
|
+
|
|
4
|
+
export interface StakeTotalsViewer {
|
|
5
|
+
active(): Promisable<bigint>
|
|
6
|
+
activeByStaked(staked: Address): Promisable<bigint>
|
|
7
|
+
activeByStaker(address: Address): Promisable<bigint>
|
|
8
|
+
pending(): Promisable<bigint>
|
|
9
|
+
pendingByStaker(staker: Address): Promisable<bigint>
|
|
10
|
+
withdrawn(): Promisable<bigint>
|
|
11
|
+
withdrawnByStaker(staker: Address): Promisable<bigint>
|
|
12
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Address } from '@xylabs/hex'
|
|
2
|
+
import type { Promisable } from '@xylabs/promise'
|
|
3
|
+
|
|
4
|
+
import type { Position } from './Stake.ts'
|
|
5
|
+
|
|
6
|
+
export interface StakeViewer {
|
|
7
|
+
stakeById(id: number): Promisable<Position>
|
|
8
|
+
stakeByStaker(staker: Address, slot: number): Promisable<Position>
|
|
9
|
+
/* @deprecated use stakesByStaker */
|
|
10
|
+
stakedByStaker(staker: Address): Promisable<Address[]>
|
|
11
|
+
stakesByStaked(staked: Address): Promisable<Position[]>
|
|
12
|
+
stakesByStaker(staker: Address): Promisable<Position[]>
|
|
13
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Address } from '@xylabs/hex'
|
|
2
|
+
import type { Promisable } from '@xylabs/promise'
|
|
3
|
+
import type { StepIdentity } from '@xyo-network/xl1-protocol'
|
|
4
|
+
|
|
5
|
+
export interface StepStakeViewInterface {
|
|
6
|
+
// this is the prorated stake for all addresses in the step
|
|
7
|
+
stepStake: (step: StepIdentity) => Promisable<Record<Address, bigint>>
|
|
8
|
+
|
|
9
|
+
// this is the prorated stake for a specific address in the step
|
|
10
|
+
stepStakeForAddress: (address: Address, step: StepIdentity) => Promisable<bigint>
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/* Prorated stake is the amount of stake that is allocated to a specific step
|
|
14
|
+
based on the total stake and the number of steps. This is used to ensure
|
|
15
|
+
that the stake is distributed fairly among all steps.
|
|
16
|
+
|
|
17
|
+
The simplest way to calculate it is to enumerate every XL1 block in the step add the current stake at that point to a counter.
|
|
18
|
+
For example, if an Address had a stake of 100 for the entire time, then the prorated stake would be 100 * number of blocks in the step.
|
|
19
|
+
*/
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Hash } from '@xylabs/hex'
|
|
2
|
+
import type { Promisable } from '@xylabs/promise'
|
|
3
|
+
import type { TimeDomain, TimePayload } from '@xyo-network/xl1-protocol'
|
|
4
|
+
|
|
5
|
+
export interface TimeSyncViewInterface {
|
|
6
|
+
/** Convert time between different domains */
|
|
7
|
+
convertTime(fromDomain: TimeDomain, toDomain: TimeDomain, from: number): Promisable<number>
|
|
8
|
+
|
|
9
|
+
/** Get the current time for a given domain */
|
|
10
|
+
currentTime(domain: TimeDomain): Promisable<[string, number]>
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface TimeSyncViewInterfaceV2 extends TimeSyncViewInterface {
|
|
14
|
+
/** Get the current time for a given domain */
|
|
15
|
+
currentTimeAndHash(domain: TimeDomain): Promisable<[number, Hash | null]>
|
|
16
|
+
|
|
17
|
+
/** Create a TimePayload with the current time from all configured domains */
|
|
18
|
+
currentTimePayload(): Promisable<TimePayload>
|
|
19
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Hash } from '@xylabs/hex'
|
|
2
|
+
import type { Promisable } from '@xylabs/promise'
|
|
3
|
+
import type { SignedHydratedTransaction } from '@xyo-network/xl1-protocol'
|
|
4
|
+
|
|
5
|
+
export interface TransactionViewInterface {
|
|
6
|
+
transactionByBlockHashAndIndex(blockHash: Hash, transactionIndex: number): Promisable<SignedHydratedTransaction | null>
|
|
7
|
+
transactionByBlockNumberAndIndex(blockNumber: number, transactionIndex: number): Promisable<SignedHydratedTransaction | null>
|
|
8
|
+
transactionByHash(transactionHash: Hash): Promisable<SignedHydratedTransaction | null>
|
|
9
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Address } from '@xylabs/hex'
|
|
2
|
+
import type { Promisable } from '@xylabs/promise'
|
|
3
|
+
import type { Signed } from '@xyo-network/boundwitness-model'
|
|
4
|
+
import type {
|
|
5
|
+
AttoXL1,
|
|
6
|
+
BlockBoundWitness, TransactionBoundWitness, Transfer,
|
|
7
|
+
XL1BlockRange,
|
|
8
|
+
} from '@xyo-network/xl1-protocol'
|
|
9
|
+
|
|
10
|
+
export type TransferBalanceHistoryItem = [
|
|
11
|
+
Signed<BlockBoundWitness> /* block */,
|
|
12
|
+
Signed<TransactionBoundWitness> | null,
|
|
13
|
+
Transfer, /* the actual transfer payload */
|
|
14
|
+
]
|
|
15
|
+
export type TransferPair = [/* from */ Address, /* to */Address]
|
|
16
|
+
|
|
17
|
+
export interface TransferBalancesViewInterface {
|
|
18
|
+
transferBalances(address: Address[]): Promisable<Partial<Record<Address, Record<Address, AttoXL1>>>>
|
|
19
|
+
transferBalancesHistories(address: Address[]): Promisable<Partial<Record<Address, Record<Address, TransferBalanceHistoryItem[]>>>>
|
|
20
|
+
transferPairBalances(address: TransferPair[]): Promisable<Partial<Record<Address, Record<Address, AttoXL1>>>>
|
|
21
|
+
transferPairBalancesHistories(address: TransferPair[]): Promisable<Partial<Record<Address, Record<Address, TransferBalanceHistoryItem[]>>>>
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface TransferBalanceViewInterface {
|
|
25
|
+
transferBalance(address: Address): Promisable<AttoXL1>
|
|
26
|
+
transferBalanceHistory(address: Address, range?: XL1BlockRange): Promisable<TransferBalanceHistoryItem[]>
|
|
27
|
+
transferPairBalance(address: TransferPair): Promisable<AttoXL1>
|
|
28
|
+
transferPairBalanceHistory(address: TransferPair): Promisable<TransferBalanceHistoryItem[]>
|
|
29
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from './AccountBalance.ts'
|
|
2
|
+
export * from './Block.ts'
|
|
3
|
+
export * from './Chain.ts'
|
|
4
|
+
export * from './ChainContract.ts'
|
|
5
|
+
export * from './Fork.ts'
|
|
6
|
+
export * from './NetworkStakeStepReward.ts'
|
|
7
|
+
export * from './NetworkStakeViewer/index.ts'
|
|
8
|
+
export * from './Stake.ts'
|
|
9
|
+
export * from './StakeTotalsViewer.ts'
|
|
10
|
+
export * from './StakeViewer.ts'
|
|
11
|
+
export * from './StepStake.ts'
|
|
12
|
+
export * from './TimeSync.ts'
|
|
13
|
+
export * from './Transaction.ts'
|
|
14
|
+
export * from './TransferBalance.ts'
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import type { Logger } from '@xylabs/logger'
|
|
2
|
+
import { isDefined, isUndefined } from '@xylabs/typeof'
|
|
3
|
+
|
|
4
|
+
import { LruCacheMap, MemoryMap } from '../../driver/index.ts'
|
|
5
|
+
import type { MapType } from '../../map/index.ts'
|
|
1
6
|
import type { ChainIdentity } from '../ChainIdentity.ts'
|
|
2
7
|
import type {
|
|
3
8
|
ChainStakeContext, ChainStakeContextRead, ChainStakeContextWrite,
|
|
@@ -7,13 +12,53 @@ import type {
|
|
|
7
12
|
ChainStoreContext, ChainStoreContextRead, ChainStoreContextWrite,
|
|
8
13
|
} from './ChainStoreContext.ts'
|
|
9
14
|
|
|
10
|
-
export interface
|
|
15
|
+
export interface BaseContext<TCacheValue = string | object | number | bigint> {
|
|
16
|
+
caches?: Record<string, MapType<string, TCacheValue>>
|
|
17
|
+
logger?: Logger
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function contextCache<TCacheValue>(
|
|
21
|
+
context: BaseContext<TCacheValue | unknown>,
|
|
22
|
+
name: string,
|
|
23
|
+
create?: () => MapType<string, TCacheValue>,
|
|
24
|
+
): MapType<string, TCacheValue> {
|
|
25
|
+
if (!context.caches) {
|
|
26
|
+
context.caches = {}
|
|
27
|
+
}
|
|
28
|
+
if (isUndefined(context.caches[name])) {
|
|
29
|
+
context.caches[name] = create?.() ?? new MemoryMap<string, TCacheValue>()
|
|
30
|
+
}
|
|
31
|
+
return context.caches[name] as MapType<string, TCacheValue>
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export async function withContextCacheResponse<T extends {} | string | number | bigint>(
|
|
35
|
+
context: BaseContext,
|
|
36
|
+
name: string,
|
|
37
|
+
key: string,
|
|
38
|
+
func: () => Promise<T extends {} | string | number | bigint ? T : never>,
|
|
39
|
+
options?: { max?: number },
|
|
40
|
+
): Promise<T> {
|
|
41
|
+
const cache = contextCache<T>(
|
|
42
|
+
context,
|
|
43
|
+
name,
|
|
44
|
+
() => new LruCacheMap<string, T>({ max: options?.max ?? 10_000 }),
|
|
45
|
+
)
|
|
46
|
+
const cacheResult = await cache.get(key)
|
|
47
|
+
if (isDefined(cacheResult)) {
|
|
48
|
+
return cacheResult
|
|
49
|
+
}
|
|
50
|
+
const result = await func()
|
|
51
|
+
await cache.set(key, result)
|
|
52
|
+
return result
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface ChainContextWrite extends BaseContext, ChainIdentity, ChainStateContextWrite, ChainStoreContextWrite {}
|
|
11
56
|
|
|
12
|
-
export interface StakedChainContextWrite extends ChainContextWrite, ChainStakeContextWrite {}
|
|
57
|
+
export interface StakedChainContextWrite extends BaseContext, ChainContextWrite, ChainStakeContextWrite {}
|
|
13
58
|
|
|
14
|
-
export interface ChainContextRead extends ChainIdentity, ChainStateContextRead, ChainStoreContextRead {}
|
|
59
|
+
export interface ChainContextRead extends BaseContext, ChainIdentity, ChainStateContextRead, ChainStoreContextRead {}
|
|
15
60
|
|
|
16
|
-
export interface StakedChainContextRead extends ChainContextRead, ChainStakeContextRead {}
|
|
61
|
+
export interface StakedChainContextRead extends BaseContext, ChainContextRead, ChainStakeContextRead {}
|
|
17
62
|
|
|
18
63
|
export type ChainContext = ChainIdentity & ChainContextRead & ChainContextWrite & ChainStoreContext
|
|
19
64
|
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import type { Address } from '@xylabs/hex'
|
|
2
2
|
import type { Promisable } from '@xylabs/promise'
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
import type { Position } from '../../interfaces/index.ts'
|
|
4
5
|
|
|
5
6
|
export interface ChainStakeRead {
|
|
6
|
-
active(): Promisable<bigint>
|
|
7
|
-
activeByAddressStaked(address: string): Promisable<bigint>
|
|
8
|
-
activeByStaker(address: string): Promisable<bigint>
|
|
9
|
-
pending(): Promisable<bigint>
|
|
10
|
-
pendingByStaker(staker: string): Promisable<bigint>
|
|
11
|
-
stakeById(id: number): Promisable<
|
|
12
|
-
stakeByStaker(staker: Address, slot: number): Promisable<
|
|
13
|
-
stakesByStaked(staked: Address, range?: [number, number |
|
|
14
|
-
stakesByStaker(staker: Address, range?: [number, number |
|
|
15
|
-
withdrawn(): Promisable<bigint>
|
|
16
|
-
withdrawnByStaker(staker: string): Promisable<bigint>
|
|
7
|
+
active(time?: number): Promisable<bigint>
|
|
8
|
+
activeByAddressStaked(address: string, time?: number): Promisable<bigint>
|
|
9
|
+
activeByStaker(address: string, time?: number): Promisable<bigint>
|
|
10
|
+
pending(time?: number): Promisable<bigint>
|
|
11
|
+
pendingByStaker(staker: string, time?: number): Promisable<bigint>
|
|
12
|
+
stakeById(id: number, time?: number): Promisable<Position>
|
|
13
|
+
stakeByStaker(staker: Address, slot: number, time?: number): Promisable<Position>
|
|
14
|
+
stakesByStaked(staked: Address, range?: [number, number | undefined]): Promisable<Position[]>
|
|
15
|
+
stakesByStaker(staker: Address, range?: [number, number | undefined]): Promisable<Position[]>
|
|
16
|
+
withdrawn(time?: number): Promisable<bigint>
|
|
17
|
+
withdrawnByStaker(staker: string, time?: number): Promisable<bigint>
|
|
17
18
|
}
|
package/src/model/StakeEvents.ts
CHANGED
|
@@ -34,5 +34,6 @@ export interface StakeEvent<TName extends StakeEventName = StakeEventName> exten
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
export interface StakeEventsRead {
|
|
37
|
+
positionCount(range: [number, number | 'latest']): Promisable<number>
|
|
37
38
|
stakeEvents<TName extends StakeEventName>(range: [number, number | 'latest'], filter?: StakeEventFilter<TName>): Promisable<StakeEvent<TName>[]>
|
|
38
39
|
}
|
package/src/model/summary.ts
CHANGED
|
@@ -3,9 +3,10 @@ import type { Semaphore } from 'async-mutex'
|
|
|
3
3
|
|
|
4
4
|
import type { MapTypeRead, MapTypeWrite } from '../map/index.ts'
|
|
5
5
|
import type { BalancesStepSummary, TransfersStepSummary } from '../payloads/summary/index.ts'
|
|
6
|
-
import type { ChainContextRead } from './index.ts'
|
|
6
|
+
import type { BaseContext, ChainContextRead } from './index.ts'
|
|
7
7
|
|
|
8
|
-
export interface ChainSummaryContextBase<TPayload extends Payload,
|
|
8
|
+
export interface ChainSummaryContextBase<TPayload extends Payload,
|
|
9
|
+
T extends (MapTypeRead<string, TPayload> | MapTypeWrite<string, TPayload>)> extends BaseContext {
|
|
9
10
|
stepSemaphores: Semaphore[]
|
|
10
11
|
summaryMap: T
|
|
11
12
|
windowSize?: number
|
package/src/primitives/index.ts
CHANGED
|
@@ -25,7 +25,7 @@ export async function balancesStepSummaryFromRange(
|
|
|
25
25
|
// console.log(`balanceStepSummaryFromRange: head=${head}, range=${range[0]}-${range[1]}`)
|
|
26
26
|
const frameHeadHash = await hashFromBlockNumber(context, range[1])
|
|
27
27
|
const frameSize = range[1] - range[0] + 1
|
|
28
|
-
const
|
|
28
|
+
const [headHash] = await context.head()
|
|
29
29
|
|
|
30
30
|
let result: BalancesStepSummary | undefined = undefined
|
|
31
31
|
|
|
@@ -37,7 +37,7 @@ export async function balancesStepSummaryFromRange(
|
|
|
37
37
|
balances[address as Address] = toSignedBigInt(balance)
|
|
38
38
|
}
|
|
39
39
|
result = {
|
|
40
|
-
schema: BalancesStepSummarySchema, hash:
|
|
40
|
+
schema: BalancesStepSummarySchema, hash: headHash, stepSize: -1, balances,
|
|
41
41
|
}
|
|
42
42
|
} else {
|
|
43
43
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -13,9 +13,9 @@ export async function balancesSummary(
|
|
|
13
13
|
context: BalanceStepSummaryContext,
|
|
14
14
|
): Promise<Partial<Record<Address, bigint>>> {
|
|
15
15
|
return await spanRootAsync('balanceSummary', async () => {
|
|
16
|
-
const
|
|
17
|
-
const headResult = await context.store.chainMap.get(
|
|
18
|
-
const headBoundWitness = asBlockBoundWitnessWithStorageMeta(headResult, () => `Head block not found for hash: ${
|
|
16
|
+
const [headHash] = await context.head()
|
|
17
|
+
const headResult = await context.store.chainMap.get(headHash)
|
|
18
|
+
const headBoundWitness = asBlockBoundWitnessWithStorageMeta(headResult, () => `Head block not found for hash: ${headHash}`, { required: true })
|
|
19
19
|
const rangeStart = asXL1BlockNumber(isDefined(context.windowSize) ? Math.max(headBoundWitness.block - context.windowSize + 1, 0) : 0)
|
|
20
20
|
const ranges = deepCalculateFramesFromRange([rangeStart, asXL1BlockNumber(headBoundWitness.block)])
|
|
21
21
|
const summaries = await Promise.all(ranges.map(range => balancesStepSummaryFromRange(context, range)))
|
|
@@ -25,7 +25,7 @@ export async function transfersStepSummaryFromRange(
|
|
|
25
25
|
// console.log(`transfersStepSummaryFromRange: head=${head}, range=${range[0]}-${range[1]}`)
|
|
26
26
|
const frameHeadHash = await hashFromBlockNumber(context, range[1])
|
|
27
27
|
const frameSize = range[1] - range[0] + 1
|
|
28
|
-
const
|
|
28
|
+
const [headHash] = await context.head()
|
|
29
29
|
|
|
30
30
|
let result: TransfersStepSummary | undefined = undefined
|
|
31
31
|
|
|
@@ -40,7 +40,7 @@ export async function transfersStepSummaryFromRange(
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
result = {
|
|
43
|
-
schema: TransfersStepSummarySchema, hash:
|
|
43
|
+
schema: TransfersStepSummarySchema, hash: headHash, stepSize: -1, transfers,
|
|
44
44
|
}
|
|
45
45
|
} else {
|
|
46
46
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -14,9 +14,9 @@ export async function transfersSummary(
|
|
|
14
14
|
context: TransfersStepSummaryContext,
|
|
15
15
|
): Promise<Partial<Record<Address, Partial<Record<Address, bigint>>>>> {
|
|
16
16
|
return await spanRootAsync('transferSummary', async () => {
|
|
17
|
-
const
|
|
18
|
-
const headResult = await context.store.chainMap.get(
|
|
19
|
-
const headBoundWitness = asBlockBoundWitnessWithStorageMeta(headResult, () => `Head block not found for hash: ${
|
|
17
|
+
const [headHash] = await context.head()
|
|
18
|
+
const headResult = await context.store.chainMap.get(headHash)
|
|
19
|
+
const headBoundWitness = asBlockBoundWitnessWithStorageMeta(headResult, () => `Head block not found for hash: ${headHash}`, { required: true })
|
|
20
20
|
const rangeStart = asXL1BlockNumber(isDefined(context.windowSize) ? Math.max(headBoundWitness.block - context.windowSize + 1, 0) : 0)
|
|
21
21
|
const ranges = deepCalculateFramesFromRange([rangeStart, asXL1BlockNumber(headBoundWitness.block)])
|
|
22
22
|
const summaries = await Promise.all(ranges.map(range => transfersStepSummaryFromRange(context, range)))
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Logger } from '@xylabs/logger'
|
|
2
|
+
|
|
3
|
+
export async function timeBudget<TResult>(name: string, logger: Logger | undefined, func: () => Promise<TResult>, budget: number): Promise<TResult> {
|
|
4
|
+
const start = Date.now()
|
|
5
|
+
const result = await func()
|
|
6
|
+
const duration = Date.now() - start
|
|
7
|
+
if (duration > budget) {
|
|
8
|
+
logger?.warn(`Function [${name}] execution exceeded budget: ${duration}ms > ${budget}ms`)
|
|
9
|
+
}
|
|
10
|
+
return result
|
|
11
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/member-ordering */
|
|
2
|
+
import type { Payload } from '@xyo-network/payload-model'
|
|
3
|
+
import type { UnsignedHydratedTransaction } from '@xyo-network/xl1-protocol'
|
|
4
|
+
|
|
5
|
+
export interface TransactionHelper {
|
|
6
|
+
// build tx, sign tx, send tx
|
|
7
|
+
addPayloadsToChain(onChain: Payload[], offChain: Payload[]): void
|
|
8
|
+
|
|
9
|
+
// sign tx, send tx
|
|
10
|
+
addUnsignedTransactionToChain(tx: UnsignedHydratedTransaction): void
|
|
11
|
+
|
|
12
|
+
// send tx (primitive)
|
|
13
|
+
addSignedTransactionToChain(tx: UnsignedHydratedTransaction): void
|
|
14
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Address, Hex } from '@xylabs/hex'
|
|
2
|
+
import type { Promisable } from '@xylabs/promise'
|
|
3
|
+
import type { Payload } from '@xyo-network/payload-model'
|
|
4
|
+
import type {
|
|
5
|
+
AllowedBlockPayload, SignedHydratedTransaction, TransactionFeesBigInt,
|
|
6
|
+
} from '@xyo-network/xl1-protocol'
|
|
7
|
+
|
|
8
|
+
/** @deprecated use TransactionOptions instead */
|
|
9
|
+
export interface TransactionSubmitterOptions {
|
|
10
|
+
chain?: Hex
|
|
11
|
+
exp?: number
|
|
12
|
+
fees?: TransactionFeesBigInt
|
|
13
|
+
from?: Address
|
|
14
|
+
nbf?: number
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** @deprecated use XyoGatewayHelpers instead */
|
|
18
|
+
export interface TransactionSubmitter {
|
|
19
|
+
/** @deprecated use runner.broadcastTransaction */
|
|
20
|
+
submitTransaction(
|
|
21
|
+
elevatedPayloads: AllowedBlockPayload[],
|
|
22
|
+
additionalPayloads: Payload[],
|
|
23
|
+
// eslint-disable-next-line sonarjs/deprecation
|
|
24
|
+
options?: TransactionSubmitterOptions
|
|
25
|
+
): Promisable<SignedHydratedTransaction>
|
|
26
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { XyoPermissions } from './permissions/index.ts'
|
|
2
|
+
import type { XyoGatewayProvider } from './XyoGateway.ts'
|
|
3
|
+
|
|
4
|
+
export type GatewayName = string & { __gatewayName: true }
|
|
5
|
+
|
|
6
|
+
export interface XyoGatewayConfig {
|
|
7
|
+
name: GatewayName
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface XyoRpcGatewayConfig extends XyoGatewayConfig {
|
|
11
|
+
dataLakeEndpoint: string
|
|
12
|
+
networkEndpoint: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface XyoClient {
|
|
16
|
+
gateways: Readonly<Record<GatewayName, XyoGatewayProvider>>
|
|
17
|
+
permissions: XyoPermissions
|
|
18
|
+
|
|
19
|
+
addGateway?(providerOrConfig: XyoGatewayConfig | XyoRpcGatewayConfig | XyoGatewayProvider): Promise<XyoGatewayProvider>
|
|
20
|
+
removeGateway?(name: GatewayName): Promise<void>
|
|
21
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { Address, Hex } from '@xylabs/hex'
|
|
2
|
+
import type { Signed } from '@xyo-network/boundwitness-model'
|
|
3
|
+
import type { Payload } from '@xyo-network/payload-model'
|
|
4
|
+
import type {
|
|
5
|
+
AllowedBlockPayload, TransactionBoundWitness, TransactionFeesBigInt,
|
|
6
|
+
} from '@xyo-network/xl1-protocol'
|
|
7
|
+
|
|
8
|
+
import type { NetworkStakeViewer } from '../interfaces/index.ts'
|
|
9
|
+
// eslint-disable-next-line sonarjs/deprecation
|
|
10
|
+
import type { TransactionSubmitter } from './TransactionSubmitter.ts'
|
|
11
|
+
import type { XyoDataLake, XyoDataLakeViewer } from './XyoDataLake.ts'
|
|
12
|
+
import type { XyoNetwork } from './XyoNetwork.ts'
|
|
13
|
+
import type { XyoRunner } from './XyoRunner.ts'
|
|
14
|
+
import type { XyoSigner } from './XyoSigner.ts'
|
|
15
|
+
import type { XyoViewer } from './XyoViewer.ts'
|
|
16
|
+
// eslint-disable-next-line sonarjs/deprecation
|
|
17
|
+
import type { XyoWallet } from './XyoWallet.ts'
|
|
18
|
+
|
|
19
|
+
/** @deprecated use XyoConnectionProvider instead */
|
|
20
|
+
// eslint-disable-next-line sonarjs/deprecation
|
|
21
|
+
export interface XyoConnectionProviderDeprecated extends TransactionSubmitter {
|
|
22
|
+
|
|
23
|
+
/** @deprecated - use from gateway instead */
|
|
24
|
+
signer: XyoSigner
|
|
25
|
+
|
|
26
|
+
/** @deprecated - use host instead */
|
|
27
|
+
// eslint-disable-next-line sonarjs/deprecation
|
|
28
|
+
wallet: XyoWallet
|
|
29
|
+
|
|
30
|
+
/** @deprecated - use submitTransaction instead */
|
|
31
|
+
send(
|
|
32
|
+
elevatedPayloads: AllowedBlockPayload[],
|
|
33
|
+
additionalPayloads: Payload[],
|
|
34
|
+
chain?: Hex,
|
|
35
|
+
nbf?: number,
|
|
36
|
+
exp?: number,
|
|
37
|
+
from?: Address,
|
|
38
|
+
fees?: TransactionFeesBigInt,
|
|
39
|
+
): Promise<Signed<TransactionBoundWitness>>
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// eslint-disable-next-line sonarjs/deprecation
|
|
43
|
+
export interface XyoConnection extends Partial<XyoConnectionProviderDeprecated> {
|
|
44
|
+
network?: XyoNetwork
|
|
45
|
+
networkStake?: NetworkStakeViewer
|
|
46
|
+
runner?: XyoRunner
|
|
47
|
+
storage?: XyoDataLake | XyoDataLakeViewer
|
|
48
|
+
viewer?: XyoViewer
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** @deprecated use XyoConnectionProvider */
|
|
52
|
+
export interface XyoConnectionProvider extends XyoConnection {}
|
|
53
|
+
|
|
54
|
+
/** @deprecated use XyoConnectionProvider */
|
|
55
|
+
export interface XyoProvider extends XyoConnection {}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Hash } from '@xylabs/hex'
|
|
2
|
+
import type { Promisable } from '@xylabs/promise'
|
|
3
|
+
import type { Payload } from '@xyo-network/payload-model'
|
|
4
|
+
|
|
5
|
+
export type DataLakeData = Payload | ArrayBuffer
|
|
6
|
+
|
|
7
|
+
export interface XyoDataLakeViewer {
|
|
8
|
+
// if resolves to hash payload, keep going until hitting a non-payload or maxDepth, or unable to find
|
|
9
|
+
fetch(hashes: Hash[], maxDepth?: number): Promisable<DataLakeData[]>
|
|
10
|
+
// same as fetch but never follows hash payloads
|
|
11
|
+
get(hashes: Hash[]): Promisable<DataLakeData[]>
|
|
12
|
+
// same as fetch, except returns each step in tuple containing the result and the steps
|
|
13
|
+
trace(hash: Hash): Promisable<[DataLakeData | undefined, Payload[]]>
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface XyoDataLake extends XyoDataLakeViewer {
|
|
17
|
+
add(items: DataLakeData[]): Promisable<DataLakeData[]>
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** @deprecated use XyoDataLake instead */
|
|
21
|
+
export interface XyoDataLakeProvider extends XyoDataLake {
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const isDataLakeViewer = (value: unknown): value is XyoDataLakeViewer => {
|
|
25
|
+
return (
|
|
26
|
+
typeof value === 'object'
|
|
27
|
+
&& value !== null
|
|
28
|
+
&& 'fetch' in value
|
|
29
|
+
&& typeof (value as XyoDataLakeViewer).fetch === 'function'
|
|
30
|
+
&& 'get' in value
|
|
31
|
+
&& typeof (value as XyoDataLakeViewer).get === 'function'
|
|
32
|
+
&& 'trace' in value
|
|
33
|
+
&& typeof (value as XyoDataLakeViewer).trace === 'function'
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const isDataLakeProvider = (value: unknown): value is XyoDataLake => {
|
|
38
|
+
return (
|
|
39
|
+
isDataLakeViewer(value)
|
|
40
|
+
&& 'add' in value
|
|
41
|
+
&& typeof (value as XyoDataLake).add === 'function'
|
|
42
|
+
)
|
|
43
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Promisable } from '@xylabs/promise'
|
|
2
|
+
|
|
3
|
+
import type { XyoConnection } from './XyoConnection.ts'
|
|
4
|
+
import type { XyoGatewayHelpers } from './XyoGatewayHelpers.ts'
|
|
5
|
+
import type { XyoSigner } from './XyoSigner.ts'
|
|
6
|
+
|
|
7
|
+
/** @deprecated use XyoConnectionConfig instead */
|
|
8
|
+
export interface XyoConnectionConfigDeprecated {
|
|
9
|
+
name: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface XyoGatewayProvider extends Partial<XyoGatewayHelpers> {
|
|
13
|
+
/**
|
|
14
|
+
* Returns the connection provider for this gateway.
|
|
15
|
+
*/
|
|
16
|
+
connection(): Promisable<XyoConnection>
|
|
17
|
+
/**
|
|
18
|
+
* Returns the signer for this gateway.
|
|
19
|
+
*/
|
|
20
|
+
signer(): Promisable<XyoSigner>
|
|
21
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
Address, Hash, Hex,
|
|
3
|
+
} from '@xylabs/hex'
|
|
4
|
+
import type { Promisable } from '@xylabs/promise'
|
|
5
|
+
import type { Payload } from '@xyo-network/payload-model'
|
|
6
|
+
import type {
|
|
7
|
+
AllowedBlockPayload, TransactionBoundWitness, TransactionFeesBigInt,
|
|
8
|
+
} from '@xyo-network/xl1-protocol'
|
|
9
|
+
|
|
10
|
+
export interface TransactionOptions {
|
|
11
|
+
chain?: Hex
|
|
12
|
+
exp?: number
|
|
13
|
+
fees?: TransactionFeesBigInt
|
|
14
|
+
from?: Address
|
|
15
|
+
nbf?: number
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface XyoGatewayHelpers {
|
|
19
|
+
|
|
20
|
+
addPayloadsToChain(
|
|
21
|
+
onChain: AllowedBlockPayload[],
|
|
22
|
+
offChain: Payload[],
|
|
23
|
+
options?: TransactionOptions
|
|
24
|
+
): Promisable<[Hash, [TransactionBoundWitness, Payload[]]]>
|
|
25
|
+
|
|
26
|
+
addTransactionToChain(
|
|
27
|
+
tx: [TransactionBoundWitness, Payload[]],
|
|
28
|
+
): Promisable<Hash>
|
|
29
|
+
|
|
30
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Hash } from '@xylabs/hex'
|
|
2
|
+
import type { Promisable } from '@xylabs/promise'
|
|
3
|
+
import type { SignedHydratedTransaction } from '@xyo-network/xl1-protocol'
|
|
4
|
+
|
|
5
|
+
export interface XyoRunner {
|
|
6
|
+
broadcastTransaction(transaction: SignedHydratedTransaction): Promisable<Hash>
|
|
7
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Address } from '@xylabs/hex'
|
|
2
|
+
import type { Promisable } from '@xylabs/promise'
|
|
3
|
+
import type { Signed, UnsignedBoundWitness } from '@xyo-network/boundwitness-model'
|
|
4
|
+
import type { Payload } from '@xyo-network/payload-model'
|
|
5
|
+
import type {
|
|
6
|
+
AllowedBlockPayload, ChainId, TransactionBoundWitness,
|
|
7
|
+
TransactionFeesBigInt,
|
|
8
|
+
} from '@xyo-network/xl1-protocol'
|
|
9
|
+
|
|
10
|
+
export interface XyoSigner {
|
|
11
|
+
address(): Promisable<Address>
|
|
12
|
+
// The tx passed in must have all the payloads (on and off chain) in the payloads array
|
|
13
|
+
// Returns the signed transaction and the payloads array excluding the off-chain payloads.
|
|
14
|
+
// The return value is ready to be broadcast to block producers
|
|
15
|
+
signTransaction(tx: [UnsignedBoundWitness<TransactionBoundWitness>, Payload[]]): Promisable<[Signed<TransactionBoundWitness>, Payload[]]>
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface XyoSignerDeprecated {
|
|
19
|
+
/** @deprecated use signTransaction instead */
|
|
20
|
+
createSignedTransaction(
|
|
21
|
+
chain: ChainId,
|
|
22
|
+
elevatedPayloads: AllowedBlockPayload[],
|
|
23
|
+
additionalPayloads: Payload[],
|
|
24
|
+
nbf: number,
|
|
25
|
+
exp: number,
|
|
26
|
+
fees: TransactionFeesBigInt,
|
|
27
|
+
from?: Address,
|
|
28
|
+
): Promisable<Signed<TransactionBoundWitness>>
|
|
29
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AccountBalanceViewInterface, BlockViewInterface, ChainViewInterface,
|
|
3
|
+
ForkViewer,
|
|
4
|
+
NetworkStakeStepRewardViewInterface,
|
|
5
|
+
NetworkStakeViewer,
|
|
6
|
+
StakeViewer,
|
|
7
|
+
TransactionViewInterface, TransferBalanceViewInterface,
|
|
8
|
+
} from '../interfaces/index.ts'
|
|
9
|
+
|
|
10
|
+
export interface XyoViewerMethods extends AccountBalanceViewInterface, TransferBalanceViewInterface,
|
|
11
|
+
NetworkStakeStepRewardViewInterface,
|
|
12
|
+
ChainViewInterface, BlockViewInterface, TransactionViewInterface, StakeViewer, ForkViewer {
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface XyoViewer extends XyoViewerMethods {
|
|
16
|
+
networkStakeViewer?: NetworkStakeViewer
|
|
17
|
+
}
|