@xyo-network/xl1-protocol-sdk 1.17.7 → 1.18.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/CreatableProvider/AbstractCreatableProvider.d.ts +104 -1
- package/dist/neutral/CreatableProvider/AbstractCreatableProvider.d.ts.map +1 -1
- package/dist/neutral/CreatableProvider/CreatableProvider.d.ts +27 -10
- package/dist/neutral/CreatableProvider/CreatableProvider.d.ts.map +1 -1
- package/dist/neutral/CreatableProvider/CreatableProviderRegistry.d.ts.map +1 -1
- package/dist/neutral/CreatableProvider/ProviderFactory.d.ts +11 -3
- package/dist/neutral/CreatableProvider/ProviderFactory.d.ts.map +1 -1
- package/dist/neutral/CreatableProvider/ProviderFactoryLocator.d.ts +19 -13
- package/dist/neutral/CreatableProvider/ProviderFactoryLocator.d.ts.map +1 -1
- package/dist/neutral/CreatableProvider/ProviderFactoryLocatorInstance.d.ts +14 -10
- package/dist/neutral/CreatableProvider/ProviderFactoryLocatorInstance.d.ts.map +1 -1
- package/dist/neutral/config/Bridge.d.ts +3 -0
- package/dist/neutral/config/Bridge.d.ts.map +1 -1
- package/dist/neutral/config/Chain.d.ts +1 -1
- package/dist/neutral/config/Config.d.ts +8 -5
- package/dist/neutral/config/Config.d.ts.map +1 -1
- package/dist/neutral/config/Log.d.ts +1 -1
- package/dist/neutral/config/Services.d.ts +2 -2
- package/dist/neutral/config/Services.d.ts.map +1 -1
- package/dist/neutral/createDeclarationPayload.d.ts +4 -0
- package/dist/neutral/createDeclarationPayload.d.ts.map +1 -0
- package/dist/neutral/createTransferPayload.d.ts +4 -0
- package/dist/neutral/createTransferPayload.d.ts.map +1 -0
- package/dist/neutral/driver/cache/LruCacheMap.d.ts +2 -2
- package/dist/neutral/driver/cache/LruCacheMap.d.ts.map +1 -1
- package/dist/neutral/driver/memory/MemoryMap.d.ts +2 -2
- package/dist/neutral/driver/memory/MemoryMap.d.ts.map +1 -1
- package/dist/neutral/index.d.ts +3 -0
- package/dist/neutral/index.d.ts.map +1 -1
- package/dist/neutral/index.mjs +1887 -632
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/map/MapType.d.ts +3 -2
- package/dist/neutral/map/MapType.d.ts.map +1 -1
- package/dist/neutral/model/ChainContext/ChainContext.d.ts +4 -4
- package/dist/neutral/model/ChainContext/ChainContext.d.ts.map +1 -1
- package/dist/neutral/model/ChainQualification.d.ts +42 -0
- package/dist/neutral/model/ChainQualification.d.ts.map +1 -0
- package/dist/neutral/model/PayloadBundle/bundledPayloadToHydratedTransaction.d.ts +2 -2
- package/dist/neutral/model/PayloadBundle/bundledPayloadToHydratedTransaction.d.ts.map +1 -1
- package/dist/neutral/model/index.d.ts +1 -1
- package/dist/neutral/model/index.d.ts.map +1 -1
- package/dist/neutral/primitives/block/index.d.ts +2 -0
- package/dist/neutral/primitives/block/index.d.ts.map +1 -0
- package/dist/neutral/primitives/block/range/blockRangeSteps.d.ts +3 -0
- package/dist/neutral/primitives/block/range/blockRangeSteps.d.ts.map +1 -0
- package/dist/neutral/primitives/block/range/index.d.ts +2 -0
- package/dist/neutral/primitives/block/range/index.d.ts.map +1 -0
- package/dist/neutral/primitives/chain/getWindowedChain.d.ts +26 -0
- package/dist/neutral/primitives/chain/getWindowedChain.d.ts.map +1 -0
- package/dist/neutral/primitives/chain/index.d.ts +4 -0
- package/dist/neutral/primitives/chain/index.d.ts.map +1 -0
- package/dist/neutral/primitives/chain/step/chainStepRewardAddress.d.ts +5 -0
- package/dist/neutral/primitives/chain/step/chainStepRewardAddress.d.ts.map +1 -0
- package/dist/neutral/primitives/chain/step/index.d.ts +5 -0
- package/dist/neutral/primitives/chain/step/index.d.ts.map +1 -0
- package/dist/neutral/primitives/chain/step/stepRewardBlock.d.ts +4 -0
- package/dist/neutral/primitives/chain/step/stepRewardBlock.d.ts.map +1 -0
- package/dist/neutral/primitives/chain/step/stepRewardTotal.d.ts +4 -0
- package/dist/neutral/primitives/chain/step/stepRewardTotal.d.ts.map +1 -0
- package/dist/neutral/primitives/chain/step/stepsRewardTotal.d.ts +6 -0
- package/dist/neutral/primitives/chain/step/stepsRewardTotal.d.ts.map +1 -0
- package/dist/neutral/primitives/chain/time/externalBlockNumberFromXL1BlockNumber.d.ts +5 -0
- package/dist/neutral/primitives/chain/time/externalBlockNumberFromXL1BlockNumber.d.ts.map +1 -0
- package/dist/neutral/primitives/chain/time/externalBlockRangeFromStep.d.ts +5 -0
- package/dist/neutral/primitives/chain/time/externalBlockRangeFromStep.d.ts.map +1 -0
- package/dist/neutral/primitives/chain/time/externalBlockRangeFromXL1BlockRange.d.ts +5 -0
- package/dist/neutral/primitives/chain/time/externalBlockRangeFromXL1BlockRange.d.ts.map +1 -0
- package/dist/neutral/primitives/chain/time/index.d.ts +4 -0
- package/dist/neutral/primitives/chain/time/index.d.ts.map +1 -0
- package/dist/neutral/primitives/index.d.ts +7 -0
- package/dist/neutral/primitives/index.d.ts.map +1 -1
- package/dist/neutral/primitives/mapToMapType.d.ts +3 -0
- package/dist/neutral/primitives/mapToMapType.d.ts.map +1 -0
- package/dist/neutral/primitives/payload/index.d.ts +2 -0
- package/dist/neutral/primitives/payload/index.d.ts.map +1 -0
- package/dist/neutral/primitives/payload/mergeTransfers.d.ts +4 -0
- package/dist/neutral/primitives/payload/mergeTransfers.d.ts.map +1 -0
- package/dist/neutral/primitives/readPayloadMapFromStore.d.ts +5 -4
- package/dist/neutral/primitives/readPayloadMapFromStore.d.ts.map +1 -1
- package/dist/neutral/primitives/rewards/index.d.ts +2 -0
- package/dist/neutral/primitives/rewards/index.d.ts.map +1 -0
- package/dist/neutral/primitives/rewards/networkStakeStepRewardPositionWeight.d.ts +5 -0
- package/dist/neutral/primitives/rewards/networkStakeStepRewardPositionWeight.d.ts.map +1 -0
- package/dist/neutral/primitives/stake/activeStakeAtTimeByAddress.d.ts +4 -0
- package/dist/neutral/primitives/stake/activeStakeAtTimeByAddress.d.ts.map +1 -0
- package/dist/neutral/primitives/stake/activeStakeAtTimeByPosition.d.ts +3 -0
- package/dist/neutral/primitives/stake/activeStakeAtTimeByPosition.d.ts.map +1 -0
- package/dist/neutral/primitives/stake/allStakersForRange.d.ts +4 -0
- package/dist/neutral/primitives/stake/allStakersForRange.d.ts.map +1 -0
- package/dist/neutral/primitives/stake/allStakersForStep.d.ts +6 -0
- package/dist/neutral/primitives/stake/allStakersForStep.d.ts.map +1 -0
- package/dist/neutral/primitives/stake/index.d.ts +7 -0
- package/dist/neutral/primitives/stake/index.d.ts.map +1 -0
- package/dist/neutral/primitives/stake/mergedAddRemoveStakeEventsByPosition.d.ts +3 -0
- package/dist/neutral/primitives/stake/mergedAddRemoveStakeEventsByPosition.d.ts.map +1 -0
- package/dist/neutral/primitives/stake/mergedAddRemoveStakeEventsByStaker.d.ts +4 -0
- package/dist/neutral/primitives/stake/mergedAddRemoveStakeEventsByStaker.d.ts.map +1 -0
- package/dist/neutral/primitives/stake/weightedStakeForRangeByPosition.d.ts +6 -0
- package/dist/neutral/primitives/stake/weightedStakeForRangeByPosition.d.ts.map +1 -0
- package/dist/neutral/primitives/uncle/findBestUncle.d.ts +24 -0
- package/dist/neutral/primitives/uncle/findBestUncle.d.ts.map +1 -0
- package/dist/neutral/primitives/uncle/findUncles.d.ts +26 -0
- package/dist/neutral/primitives/uncle/findUncles.d.ts.map +1 -0
- package/dist/neutral/primitives/uncle/index.d.ts +4 -0
- package/dist/neutral/primitives/uncle/index.d.ts.map +1 -0
- package/dist/neutral/primitives/uncle/scoreUncle.d.ts +3 -0
- package/dist/neutral/primitives/uncle/scoreUncle.d.ts.map +1 -0
- package/dist/neutral/provider/DataLake.d.ts +10 -9
- package/dist/neutral/provider/DataLake.d.ts.map +1 -1
- package/dist/neutral/provider/XyoConnection.d.ts +4 -1
- package/dist/neutral/provider/XyoConnection.d.ts.map +1 -1
- package/dist/neutral/provider/XyoGatewayRunner.d.ts +3 -3
- package/dist/neutral/provider/XyoGatewayRunner.d.ts.map +1 -1
- package/dist/neutral/provider/XyoRunner.d.ts +5 -2
- package/dist/neutral/provider/XyoRunner.d.ts.map +1 -1
- package/dist/neutral/provider/viewer/XyoViewer.d.ts +16 -13
- package/dist/neutral/provider/viewer/XyoViewer.d.ts.map +1 -1
- package/dist/neutral/runners/Block.d.ts +7 -2
- package/dist/neutral/runners/Block.d.ts.map +1 -1
- package/dist/neutral/runners/Mempool.d.ts +4 -1
- package/dist/neutral/runners/Mempool.d.ts.map +1 -1
- package/dist/neutral/services/Chain/ChainService.d.ts +2 -2
- package/dist/neutral/services/Chain/ChainService.d.ts.map +1 -1
- package/dist/neutral/simple/accountBalance/SimpleAccountBalanceViewer.d.ts +65 -21
- package/dist/neutral/simple/accountBalance/SimpleAccountBalanceViewer.d.ts.map +1 -1
- package/dist/neutral/simple/block/SimpleBlockViewer.d.ts +9 -6
- package/dist/neutral/simple/block/SimpleBlockViewer.d.ts.map +1 -1
- package/dist/neutral/simple/blockValidation/SimpleBlockValidationViewer.d.ts +31 -0
- package/dist/neutral/simple/blockValidation/SimpleBlockValidationViewer.d.ts.map +1 -0
- package/dist/neutral/simple/blockValidation/index.d.ts +2 -0
- package/dist/neutral/simple/blockValidation/index.d.ts.map +1 -0
- package/dist/neutral/simple/chainStake/{SimpleChainStakeViewer.d.ts → SimpleStakeViewer.d.ts} +3 -5
- package/dist/neutral/simple/chainStake/SimpleStakeViewer.d.ts.map +1 -0
- package/dist/neutral/simple/chainStake/index.d.ts +1 -1
- package/dist/neutral/simple/chainStake/index.d.ts.map +1 -1
- package/dist/neutral/simple/datalake/AbstractSimpleDataLake.d.ts +6 -3
- package/dist/neutral/simple/datalake/AbstractSimpleDataLake.d.ts.map +1 -1
- package/dist/neutral/simple/datalake/SimpleDataLakeRunner.d.ts +4 -3
- package/dist/neutral/simple/datalake/SimpleDataLakeRunner.d.ts.map +1 -1
- package/dist/neutral/simple/datalake/SimpleDataLakeViewer.d.ts +0 -3
- package/dist/neutral/simple/datalake/SimpleDataLakeViewer.d.ts.map +1 -1
- package/dist/neutral/simple/index.d.ts +2 -0
- package/dist/neutral/simple/index.d.ts.map +1 -1
- package/dist/neutral/simple/mempool/SimpleMempoolRunner.d.ts +8 -4
- package/dist/neutral/simple/mempool/SimpleMempoolRunner.d.ts.map +1 -1
- package/dist/neutral/simple/mempool/SimpleMempoolViewer.d.ts.map +1 -1
- package/dist/neutral/simple/runner/SimpleXyoRunner.d.ts +24 -6
- package/dist/neutral/simple/runner/SimpleXyoRunner.d.ts.map +1 -1
- package/dist/neutral/simple/{chainStakeEvents/SimpleChainStakeEventsViewer.d.ts → stakeEvents/SimpleStakeEventsViewer.d.ts} +3 -3
- package/dist/neutral/simple/stakeEvents/SimpleStakeEventsViewer.d.ts.map +1 -0
- package/dist/neutral/simple/stakeEvents/index.d.ts +2 -0
- package/dist/neutral/simple/stakeEvents/index.d.ts.map +1 -0
- package/dist/neutral/simple/timesync/SimpleTimeSyncViewer.d.ts +4 -3
- package/dist/neutral/simple/timesync/SimpleTimeSyncViewer.d.ts.map +1 -1
- package/dist/neutral/status/RuntimeStatusMonitor.d.ts +31 -0
- package/dist/neutral/status/RuntimeStatusMonitor.d.ts.map +1 -0
- package/dist/neutral/status/ServiceStatus.d.ts +8 -0
- package/dist/neutral/status/ServiceStatus.d.ts.map +1 -0
- package/dist/neutral/status/index.d.ts +3 -0
- package/dist/neutral/status/index.d.ts.map +1 -0
- package/dist/neutral/summary/model/summary.d.ts +4 -5
- package/dist/neutral/summary/model/summary.d.ts.map +1 -1
- package/dist/neutral/summary/primitives/balances/balancesStepSummaryFromRange.d.ts +1 -1
- package/dist/neutral/summary/primitives/balances/balancesStepSummaryFromRange.d.ts.map +1 -1
- package/dist/neutral/summary/primitives/balances/balancesSummary.d.ts +2 -2
- package/dist/neutral/summary/primitives/balances/balancesSummary.d.ts.map +1 -1
- package/dist/neutral/summary/primitives/schemas/schemasSummary.d.ts +2 -2
- package/dist/neutral/summary/primitives/schemas/schemasSummary.d.ts.map +1 -1
- package/dist/neutral/summary/primitives/transfers/transfersSummary.d.ts +2 -2
- package/dist/neutral/summary/primitives/transfers/transfersSummary.d.ts.map +1 -1
- package/dist/neutral/transaction/TransactionBuilder.d.ts +82 -0
- package/dist/neutral/transaction/TransactionBuilder.d.ts.map +1 -0
- package/dist/neutral/transaction/buildRandomTransaction.d.ts +6 -0
- package/dist/neutral/transaction/buildRandomTransaction.d.ts.map +1 -0
- package/dist/neutral/transaction/index.d.ts +2 -0
- package/dist/neutral/transaction/index.d.ts.map +1 -1
- package/dist/neutral/viewers/AccountBalance.d.ts +35 -15
- package/dist/neutral/viewers/AccountBalance.d.ts.map +1 -1
- package/dist/neutral/viewers/Block.d.ts +4 -1
- package/dist/neutral/viewers/Block.d.ts.map +1 -1
- package/dist/neutral/viewers/BlockValidation.d.ts +54 -0
- package/dist/neutral/viewers/BlockValidation.d.ts.map +1 -0
- package/dist/neutral/viewers/ChainStakeViewer.d.ts +1 -2
- package/dist/neutral/viewers/ChainStakeViewer.d.ts.map +1 -1
- package/dist/neutral/viewers/Fork.d.ts +0 -1
- package/dist/neutral/viewers/Fork.d.ts.map +1 -1
- package/dist/neutral/viewers/Stake.d.ts +0 -1
- package/dist/neutral/viewers/Stake.d.ts.map +1 -1
- package/dist/neutral/viewers/StakeIntent.d.ts +2 -2
- package/dist/neutral/viewers/StakeIntent.d.ts.map +1 -1
- package/dist/neutral/viewers/TransactionValidation.d.ts +35 -0
- package/dist/neutral/viewers/TransactionValidation.d.ts.map +1 -0
- package/dist/neutral/viewers/index.d.ts +2 -1
- package/dist/neutral/viewers/index.d.ts.map +1 -1
- package/package.json +8 -6
- package/src/CreatableProvider/AbstractCreatableProvider.ts +60 -3
- package/src/CreatableProvider/CreatableProvider.ts +38 -11
- package/src/CreatableProvider/CreatableProviderRegistry.ts +10 -5
- package/src/CreatableProvider/ProviderFactory.ts +73 -10
- package/src/CreatableProvider/ProviderFactoryLocator.ts +79 -19
- package/src/CreatableProvider/ProviderFactoryLocatorInstance.ts +33 -10
- package/src/config/Bridge.ts +22 -4
- package/src/config/Chain.ts +2 -2
- package/src/config/Services.ts +4 -2
- package/src/createDeclarationPayload.ts +14 -0
- package/src/createTransferPayload.ts +15 -0
- package/src/driver/cache/LruCacheMap.ts +2 -2
- package/src/driver/memory/MemoryMap.ts +2 -2
- package/src/index.ts +3 -0
- package/src/map/MapType.ts +4 -2
- package/src/model/ChainContext/ChainContext.ts +4 -4
- package/src/model/ChainQualification.ts +33 -0
- package/src/model/PayloadBundle/bundledPayloadToHydratedTransaction.ts +2 -2
- package/src/model/index.ts +1 -1
- package/src/primitives/block/index.ts +1 -0
- package/src/primitives/block/range/blockRangeSteps.ts +22 -0
- package/src/primitives/block/range/index.ts +1 -0
- package/src/primitives/chain/getWindowedChain.ts +23 -0
- package/src/primitives/chain/index.ts +3 -0
- package/src/primitives/chain/step/chainStepRewardAddress.ts +28 -0
- package/src/primitives/chain/step/index.ts +4 -0
- package/src/primitives/chain/step/stepRewardBlock.ts +11 -0
- package/src/primitives/chain/step/stepRewardTotal.ts +45 -0
- package/src/primitives/chain/step/stepsRewardTotal.ts +34 -0
- package/src/primitives/chain/time/externalBlockNumberFromXL1BlockNumber.ts +31 -0
- package/src/primitives/chain/time/externalBlockRangeFromStep.ts +19 -0
- package/src/primitives/chain/time/externalBlockRangeFromXL1BlockRange.ts +16 -0
- package/src/primitives/chain/time/index.ts +3 -0
- package/src/primitives/index.ts +7 -0
- package/src/primitives/mapToMapType.ts +35 -0
- package/src/primitives/payload/index.ts +1 -0
- package/src/primitives/payload/mergeTransfers.ts +15 -0
- package/src/primitives/readPayloadMapFromStore.ts +38 -8
- package/src/primitives/rewards/index.ts +1 -0
- package/src/primitives/rewards/networkStakeStepRewardPositionWeight.ts +21 -0
- package/src/primitives/stake/activeStakeAtTimeByAddress.ts +26 -0
- package/src/primitives/stake/activeStakeAtTimeByPosition.ts +24 -0
- package/src/primitives/stake/allStakersForRange.ts +31 -0
- package/src/primitives/stake/allStakersForStep.ts +22 -0
- package/src/primitives/stake/index.ts +6 -0
- package/src/primitives/stake/mergedAddRemoveStakeEventsByPosition.ts +14 -0
- package/src/primitives/stake/mergedAddRemoveStakeEventsByStaker.ts +17 -0
- package/src/primitives/stake/weightedStakeForRangeByPosition.ts +54 -0
- package/src/primitives/uncle/findBestUncle.ts +8 -0
- package/src/primitives/uncle/findUncles.ts +75 -0
- package/src/primitives/uncle/index.ts +3 -0
- package/src/primitives/uncle/scoreUncle.ts +6 -0
- package/src/provider/DataLake.ts +12 -11
- package/src/provider/XyoConnection.ts +5 -1
- package/src/provider/XyoGatewayRunner.ts +3 -3
- package/src/provider/XyoRunner.ts +6 -2
- package/src/provider/viewer/XyoViewer.ts +16 -15
- package/src/runners/Block.ts +10 -2
- package/src/runners/Mempool.ts +6 -1
- package/src/services/Chain/ChainService.ts +2 -4
- package/src/simple/accountBalance/SimpleAccountBalanceViewer.ts +65 -42
- package/src/simple/block/SimpleBlockViewer.ts +47 -14
- package/src/simple/blockValidation/SimpleBlockValidationViewer.ts +126 -0
- package/src/simple/blockValidation/index.ts +1 -0
- package/src/simple/chainStake/{SimpleChainStakeViewer.ts → SimpleStakeViewer.ts} +11 -16
- package/src/simple/chainStake/index.ts +1 -1
- package/src/simple/datalake/AbstractSimpleDataLake.ts +19 -18
- package/src/simple/datalake/SimpleDataLakeRunner.ts +4 -3
- package/src/simple/datalake/SimpleDataLakeViewer.ts +0 -19
- package/src/simple/index.ts +2 -0
- package/src/simple/mempool/SimpleMempoolRunner.ts +13 -8
- package/src/simple/mempool/SimpleMempoolViewer.ts +6 -1
- package/src/simple/runner/SimpleXyoRunner.ts +41 -16
- package/src/simple/{chainStakeEvents/SimpleChainStakeEventsViewer.ts → stakeEvents/SimpleStakeEventsViewer.ts} +5 -5
- package/src/simple/stakeEvents/index.ts +1 -0
- package/src/simple/timesync/SimpleTimeSyncViewer.ts +27 -6
- package/src/status/RuntimeStatusMonitor.ts +117 -0
- package/src/status/ServiceStatus.ts +20 -0
- package/src/status/index.ts +2 -0
- package/src/summary/model/summary.ts +6 -5
- package/src/summary/primitives/balances/balancesStepSummaryFromRange.ts +2 -3
- package/src/summary/primitives/balances/balancesSummary.ts +12 -12
- package/src/summary/primitives/schemas/schemasSummary.ts +12 -10
- package/src/summary/primitives/transfers/transfersSummary.ts +14 -16
- package/src/transaction/TransactionBuilder.ts +162 -0
- package/src/transaction/buildRandomTransaction.ts +36 -0
- package/src/transaction/hydrateTransaction.ts +1 -1
- package/src/transaction/index.ts +2 -0
- package/src/viewers/AccountBalance.ts +22 -14
- package/src/viewers/Block.ts +6 -1
- package/src/viewers/BlockValidation.ts +47 -0
- package/src/viewers/ChainStakeViewer.ts +1 -2
- package/src/viewers/Fork.ts +0 -1
- package/src/viewers/Stake.ts +0 -1
- package/src/viewers/StakeIntent.ts +2 -2
- package/src/viewers/TransactionValidation.ts +35 -0
- package/src/viewers/index.ts +2 -1
- package/dist/neutral/model/Qualified.d.ts +0 -6
- package/dist/neutral/model/Qualified.d.ts.map +0 -1
- package/dist/neutral/simple/chain/SimpleChainViewer.d.ts +0 -15
- package/dist/neutral/simple/chain/SimpleChainViewer.d.ts.map +0 -1
- package/dist/neutral/simple/chain/index.d.ts +0 -2
- package/dist/neutral/simple/chain/index.d.ts.map +0 -1
- package/dist/neutral/simple/chainStake/SimpleChainStakeViewer.d.ts.map +0 -1
- package/dist/neutral/simple/chainStakeEvents/SimpleChainStakeEventsViewer.d.ts.map +0 -1
- package/dist/neutral/simple/chainStakeEvents/index.d.ts +0 -2
- package/dist/neutral/simple/chainStakeEvents/index.d.ts.map +0 -1
- package/dist/neutral/viewers/Chain.d.ts +0 -11
- package/dist/neutral/viewers/Chain.d.ts.map +0 -1
- package/src/model/Qualified.ts +0 -9
- package/src/simple/chain/SimpleChainViewer.ts +0 -28
- package/src/simple/chain/index.ts +0 -1
- package/src/simple/chainStakeEvents/index.ts +0 -1
- package/src/viewers/Chain.ts +0 -13
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import type { Address } from '@xylabs/sdk-js'
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
} from '@xylabs/sdk-js'
|
|
5
|
-
import {
|
|
6
|
-
asBlockBoundWitnessWithStorageMeta, asXL1BlockNumber, asXL1BlockRange,
|
|
7
|
-
} from '@xyo-network/xl1-protocol'
|
|
2
|
+
import { asAddress, spanRootAsync } from '@xylabs/sdk-js'
|
|
3
|
+
import { asBlockBoundWitnessWithStorageMeta, asXL1BlockRange } from '@xyo-network/xl1-protocol'
|
|
8
4
|
|
|
9
5
|
import { deepCalculateFramesFromRange } from '../../../block/index.ts'
|
|
10
|
-
import
|
|
6
|
+
import {
|
|
7
|
+
type ChainQualified, type ChainQualifiedConfig, isChainQualifiedHeadConfig,
|
|
8
|
+
isChainQualifiedRangeConfig,
|
|
9
|
+
} from '../../../model/index.ts'
|
|
11
10
|
import { parseSignedBigInt } from '../../../SignedBigInt.ts'
|
|
12
11
|
import type { BalanceStepSummaryContext } from '../../model/index.ts'
|
|
13
12
|
import { balancesStepSummaryFromRange } from './balancesStepSummaryFromRange.ts'
|
|
14
13
|
|
|
15
14
|
export async function balancesSummary(
|
|
16
15
|
context: BalanceStepSummaryContext,
|
|
17
|
-
|
|
16
|
+
config?: ChainQualifiedConfig,
|
|
17
|
+
): Promise<ChainQualified<Record<Address, bigint>>> {
|
|
18
18
|
return await spanRootAsync('balancesSummary', async () => {
|
|
19
|
-
const [headHash] = await context.head()
|
|
19
|
+
const [headHash] = isChainQualifiedHeadConfig(config) ? [config.head] : await context.head()
|
|
20
20
|
const headResult = await context.store.chainMap.get(headHash)
|
|
21
21
|
const headBoundWitness = asBlockBoundWitnessWithStorageMeta(headResult, () => `Head block not found for hash: ${headHash}`)
|
|
22
|
-
const
|
|
22
|
+
const range = isChainQualifiedRangeConfig(config) ? config.range : asXL1BlockRange([0, headBoundWitness.block], true)
|
|
23
23
|
const ranges = deepCalculateFramesFromRange(asXL1BlockRange(
|
|
24
|
-
|
|
24
|
+
range,
|
|
25
25
|
{ name: 'balancesSummary' },
|
|
26
26
|
))
|
|
27
27
|
const summaries = await Promise.all(ranges.map(range => balancesStepSummaryFromRange(context, range)))
|
|
@@ -32,6 +32,6 @@ export async function balancesSummary(
|
|
|
32
32
|
balances[validAddress] = (balances[validAddress] ?? 0n) + parseSignedBigInt(balance)
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
return [balances,
|
|
35
|
+
return [balances, { range, head: headHash }]
|
|
36
36
|
})
|
|
37
37
|
}
|
|
@@ -1,24 +1,26 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { spanRootAsync } from '@xylabs/sdk-js'
|
|
2
2
|
import type { Schema } from '@xyo-network/payload-model'
|
|
3
|
-
import {
|
|
4
|
-
asBlockBoundWitnessWithStorageMeta, asXL1BlockNumber, asXL1BlockRange,
|
|
5
|
-
} from '@xyo-network/xl1-protocol'
|
|
3
|
+
import { asBlockBoundWitnessWithStorageMeta, asXL1BlockRange } from '@xyo-network/xl1-protocol'
|
|
6
4
|
|
|
7
5
|
import { deepCalculateFramesFromRange } from '../../../block/index.ts'
|
|
8
|
-
import
|
|
6
|
+
import {
|
|
7
|
+
type ChainQualified, type ChainQualifiedConfig, isChainQualifiedHeadConfig,
|
|
8
|
+
isChainQualifiedRangeConfig,
|
|
9
|
+
} from '../../../model/index.ts'
|
|
9
10
|
import type { SchemasStepSummaryContext } from '../../model/index.ts'
|
|
10
11
|
import { schemasStepSummaryFromRange } from './schemasStepSummaryFromRange.ts'
|
|
11
12
|
|
|
12
13
|
export async function schemasSummary(
|
|
13
14
|
context: SchemasStepSummaryContext,
|
|
14
|
-
|
|
15
|
+
config?: ChainQualifiedConfig,
|
|
16
|
+
): Promise<ChainQualified<Record<Schema, number>>> {
|
|
15
17
|
return await spanRootAsync('schemasSummary', async () => {
|
|
16
|
-
const [headHash] = await context.head()
|
|
18
|
+
const [headHash] = isChainQualifiedHeadConfig(config) ? [config.head] : await context.head()
|
|
17
19
|
const headResult = await context.store.chainMap.get(headHash)
|
|
18
20
|
const headBoundWitness = asBlockBoundWitnessWithStorageMeta(headResult, () => `Head block not found for hash: ${headHash}`)
|
|
19
|
-
const
|
|
21
|
+
const range = isChainQualifiedRangeConfig(config) ? config.range : asXL1BlockRange([0, headBoundWitness.block], true)
|
|
20
22
|
const ranges = deepCalculateFramesFromRange(asXL1BlockRange(
|
|
21
|
-
|
|
23
|
+
range,
|
|
22
24
|
{ name: 'schemasSummary' },
|
|
23
25
|
))
|
|
24
26
|
const summaries = await Promise.all(ranges.map(range => schemasStepSummaryFromRange(context, range)))
|
|
@@ -28,6 +30,6 @@ export async function schemasSummary(
|
|
|
28
30
|
results[schema] = (results[schema] ?? 0) + count
|
|
29
31
|
}
|
|
30
32
|
}
|
|
31
|
-
return [results,
|
|
33
|
+
return [results, { range, head: headHash }]
|
|
32
34
|
})
|
|
33
35
|
}
|
|
@@ -1,31 +1,29 @@
|
|
|
1
1
|
import type { Address, Hash } from '@xylabs/sdk-js'
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
} from '@xylabs/sdk-js'
|
|
5
|
-
import {
|
|
6
|
-
asBlockBoundWitnessWithStorageMeta, asXL1BlockNumber, asXL1BlockRange,
|
|
7
|
-
} from '@xyo-network/xl1-protocol'
|
|
2
|
+
import { asAddress, spanRootAsync } from '@xylabs/sdk-js'
|
|
3
|
+
import { asBlockBoundWitnessWithStorageMeta, asXL1BlockRange } from '@xyo-network/xl1-protocol'
|
|
8
4
|
|
|
9
5
|
import { deepCalculateFramesFromRange } from '../../../block/index.ts'
|
|
10
|
-
import type {
|
|
6
|
+
import type { ChainQualified, ChainQualifiedConfig } from '../../../model/index.ts'
|
|
7
|
+
import { isChainQualifiedHeadConfig, isChainQualifiedRangeConfig } from '../../../model/index.ts'
|
|
11
8
|
import { parseSignedBigInt } from '../../../SignedBigInt.ts'
|
|
12
9
|
import type { TransfersStepSummaryContext } from '../../index.ts'
|
|
13
10
|
import { transfersStepSummaryFromRange } from './transfersStepSummaryFromRange.ts'
|
|
14
11
|
|
|
15
12
|
// the summary of amount of rewards claimed from the step reward pool by addresses
|
|
16
13
|
export async function transfersSummary(
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
context: TransfersStepSummaryContext,
|
|
15
|
+
config?: ChainQualifiedConfig,
|
|
16
|
+
): Promise<ChainQualified<Record<Address, Record<Address, bigint>>>> {
|
|
19
17
|
return await spanRootAsync('transferSummary', async () => {
|
|
20
|
-
const [headHash] = await
|
|
21
|
-
const headResult = await
|
|
22
|
-
const headBoundWitness = asBlockBoundWitnessWithStorageMeta(headResult, () => `Head block not found for hash: ${
|
|
23
|
-
const
|
|
18
|
+
const [headHash] = isChainQualifiedHeadConfig(config) ? [config.head] : await context.head()
|
|
19
|
+
const headResult = await context.store.chainMap.get(headHash)
|
|
20
|
+
const headBoundWitness = asBlockBoundWitnessWithStorageMeta(headResult, () => `Head block not found for hash: ${headHash}`)
|
|
21
|
+
const range = isChainQualifiedRangeConfig(config) ? config.range : asXL1BlockRange([0, headBoundWitness.block], true)
|
|
24
22
|
const ranges = deepCalculateFramesFromRange(asXL1BlockRange(
|
|
25
|
-
|
|
23
|
+
range,
|
|
26
24
|
{ name: 'transfersSummary' },
|
|
27
25
|
))
|
|
28
|
-
const summaries = await Promise.all(ranges.map(range => transfersStepSummaryFromRange(
|
|
26
|
+
const summaries = await Promise.all(ranges.map(range => transfersStepSummaryFromRange(context, range)))
|
|
29
27
|
const transfers: Record<Address, Record<Address, bigint>> = {}
|
|
30
28
|
for (let summary of summaries) {
|
|
31
29
|
for (const [from, toMap] of Object.entries(summary.transfers)) {
|
|
@@ -37,7 +35,7 @@ export async function transfersSummary(
|
|
|
37
35
|
}
|
|
38
36
|
}
|
|
39
37
|
}
|
|
40
|
-
return [transfers,
|
|
38
|
+
return [transfers, { range, head: headHash }]
|
|
41
39
|
})
|
|
42
40
|
}
|
|
43
41
|
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import type { Hex } from '@xylabs/sdk-js'
|
|
2
|
+
import { assertEx, Base } from '@xylabs/sdk-js'
|
|
3
|
+
import type { AccountInstance } from '@xyo-network/account-model'
|
|
4
|
+
import { PayloadBuilder, type PayloadBuilderOptions } from '@xyo-network/payload-builder'
|
|
5
|
+
import type { Payload } from '@xyo-network/payload-model'
|
|
6
|
+
import type {
|
|
7
|
+
AllowedBlockPayload,
|
|
8
|
+
ChainId,
|
|
9
|
+
TransactionFeesBigInt,
|
|
10
|
+
} from '@xyo-network/xl1-protocol'
|
|
11
|
+
import {
|
|
12
|
+
asXL1BlockNumber,
|
|
13
|
+
defaultTransactionFees, isAllowedBlockPayload, minTransactionFees, XYO_ZERO_ADDRESS,
|
|
14
|
+
} from '@xyo-network/xl1-protocol'
|
|
15
|
+
|
|
16
|
+
import { buildTransaction } from './buildTransaction.ts'
|
|
17
|
+
import { transactionRequiredGas } from './primitives/index.ts'
|
|
18
|
+
|
|
19
|
+
export class TransactionBuilder<TPayload extends Payload> extends Base<Omit<PayloadBuilderOptions, 'schema'>> {
|
|
20
|
+
private _blockRange?: [number, number]
|
|
21
|
+
private _chain?: Hex
|
|
22
|
+
private _elevatedPayloads: AllowedBlockPayload[] = []
|
|
23
|
+
private _fees: TransactionFeesBigInt | undefined
|
|
24
|
+
private _payloads: TPayload[] = []
|
|
25
|
+
private _signers: AccountInstance[] = []
|
|
26
|
+
|
|
27
|
+
constructor(options: Omit<PayloadBuilderOptions, 'schema'> = {}) {
|
|
28
|
+
super(options)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async build() {
|
|
32
|
+
const chain = assertEx(this._chain, () => 'Chain must be set before building the transaction')
|
|
33
|
+
const fees = assertEx(this._fees, () => 'Fees must be set before building the transaction')
|
|
34
|
+
const blockRange = assertEx(this._blockRange, () => 'Block range must be set before building the transaction')
|
|
35
|
+
return await buildTransaction(
|
|
36
|
+
chain,
|
|
37
|
+
this._elevatedPayloads,
|
|
38
|
+
this._payloads,
|
|
39
|
+
this._signers,
|
|
40
|
+
asXL1BlockNumber(blockRange[0], true),
|
|
41
|
+
asXL1BlockNumber(blockRange[1], true),
|
|
42
|
+
this._signers[0]?.address,
|
|
43
|
+
fees,
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
chain(chain: ChainId) {
|
|
48
|
+
this._chain = chain
|
|
49
|
+
return this
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async dryRun() {
|
|
53
|
+
return await buildTransaction(
|
|
54
|
+
XYO_ZERO_ADDRESS,
|
|
55
|
+
this._elevatedPayloads,
|
|
56
|
+
this._payloads,
|
|
57
|
+
this._signers,
|
|
58
|
+
asXL1BlockNumber(0, true),
|
|
59
|
+
asXL1BlockNumber(1000, true),
|
|
60
|
+
this._signers[0]?.address,
|
|
61
|
+
defaultTransactionFees,
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
elevatedPayload(payload?: AllowedBlockPayload) {
|
|
66
|
+
const allowedPayload = isAllowedBlockPayload(payload) ? payload : undefined
|
|
67
|
+
const allowPayloadExists = assertEx(allowedPayload, () => 'Payload must be an AllowedBlockPayload')
|
|
68
|
+
this._elevatedPayloads.push(allowPayloadExists)
|
|
69
|
+
return this
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
elevatedPayloads(payloads?: AllowedBlockPayload[]) {
|
|
73
|
+
if (payloads)
|
|
74
|
+
for (const payload of payloads) {
|
|
75
|
+
this.elevatedPayload(payload)
|
|
76
|
+
}
|
|
77
|
+
return this
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
async estimatedMinimumFees(): Promise<TransactionFeesBigInt> {
|
|
81
|
+
const tx = await this.dryRun()
|
|
82
|
+
const requiredGas = transactionRequiredGas(tx)
|
|
83
|
+
return {
|
|
84
|
+
base: minTransactionFees.base,
|
|
85
|
+
// eslint-disable-next-line unicorn/prefer-math-min-max
|
|
86
|
+
gasLimit: requiredGas > minTransactionFees.gasLimit ? requiredGas : minTransactionFees.gasLimit,
|
|
87
|
+
gasPrice: minTransactionFees.gasPrice,
|
|
88
|
+
priority: minTransactionFees.priority,
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
fees(fees: TransactionFeesBigInt) {
|
|
93
|
+
this._fees = fees
|
|
94
|
+
return this
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
payload(payload?: TPayload) {
|
|
98
|
+
this._payloads.push(payload as TPayload)
|
|
99
|
+
return this
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
payloads(payloads?: TPayload[]) {
|
|
103
|
+
if (payloads)
|
|
104
|
+
for (const payload of payloads) {
|
|
105
|
+
if (payload !== null) {
|
|
106
|
+
this.payload(payload)
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return this
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
range(blockRange: [number, number]) {
|
|
113
|
+
if (blockRange.length !== 2) {
|
|
114
|
+
throw new Error('Block range must be an array of two numbers')
|
|
115
|
+
}
|
|
116
|
+
this._blockRange = blockRange
|
|
117
|
+
return this
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
async removeElevatedPayload(payload: AllowedBlockPayload) {
|
|
121
|
+
const hash = await PayloadBuilder.hash(payload)
|
|
122
|
+
const existingHashes = await PayloadBuilder.hashes(this._elevatedPayloads)
|
|
123
|
+
|
|
124
|
+
// no async after this point to prevent changing _elevatedPayloads from other promise
|
|
125
|
+
const existingPayloadIndex = existingHashes.indexOf(hash)
|
|
126
|
+
if (existingPayloadIndex === -1) {
|
|
127
|
+
throw new Error('Payload not found in the transaction')
|
|
128
|
+
}
|
|
129
|
+
this._elevatedPayloads = this._elevatedPayloads.filter((_, index) => index !== existingPayloadIndex)
|
|
130
|
+
return this
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
async removePayload(payload: TPayload) {
|
|
134
|
+
const hash = await PayloadBuilder.hash(payload)
|
|
135
|
+
const existingHashes = await PayloadBuilder.hashes(this._payloads)
|
|
136
|
+
|
|
137
|
+
// no async after this point to prevent changing _payloads from other promise
|
|
138
|
+
const existingPayloadIndex = existingHashes.indexOf(hash)
|
|
139
|
+
if (existingPayloadIndex === -1) {
|
|
140
|
+
throw new Error('Payload not found in the transaction')
|
|
141
|
+
}
|
|
142
|
+
this._payloads = this._payloads.filter((_, index) => index !== existingPayloadIndex)
|
|
143
|
+
return this
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
signer(signer?: AccountInstance) {
|
|
147
|
+
if (signer) {
|
|
148
|
+
this._signers.push(signer)
|
|
149
|
+
}
|
|
150
|
+
return this
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
signers(signers?: (AccountInstance | null)[]) {
|
|
154
|
+
if (signers)
|
|
155
|
+
for (const signer of signers) {
|
|
156
|
+
if (signer !== null) {
|
|
157
|
+
this.signer(signer)
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return this
|
|
161
|
+
}
|
|
162
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Address } from '@xylabs/sdk-js'
|
|
2
|
+
import { Account } from '@xyo-network/account'
|
|
3
|
+
import type { AccountInstance } from '@xyo-network/account-model'
|
|
4
|
+
import type { Payload, Schema } from '@xyo-network/payload-model'
|
|
5
|
+
import type {
|
|
6
|
+
AllowedBlockPayload, ChainId,
|
|
7
|
+
SignedHydratedTransactionWithHashMeta,
|
|
8
|
+
Transfer,
|
|
9
|
+
XL1BlockNumber,
|
|
10
|
+
} from '@xyo-network/xl1-protocol'
|
|
11
|
+
import { asXL1BlockNumber, isAllowedBlockPayload } from '@xyo-network/xl1-protocol'
|
|
12
|
+
|
|
13
|
+
import { createTransferPayload } from '../createTransferPayload.ts'
|
|
14
|
+
import { buildTransaction } from './buildTransaction.ts'
|
|
15
|
+
|
|
16
|
+
export const buildRandomTransaction = async (
|
|
17
|
+
chain: ChainId,
|
|
18
|
+
payloads?: Payload[],
|
|
19
|
+
account?: AccountInstance,
|
|
20
|
+
nbf: XL1BlockNumber = asXL1BlockNumber(0, true),
|
|
21
|
+
exp: XL1BlockNumber = asXL1BlockNumber(nbf + 1000, true),
|
|
22
|
+
privatePayloadSchemas: Schema[] = [],
|
|
23
|
+
receiverAddress?: Address,
|
|
24
|
+
): Promise<SignedHydratedTransactionWithHashMeta> => {
|
|
25
|
+
const elevatedPayloads: AllowedBlockPayload[] = (payloads ?? []).filter(isAllowedBlockPayload)
|
|
26
|
+
const additionalPayloads: Payload[] = (payloads ?? []).filter(payload => !isAllowedBlockPayload(payload))
|
|
27
|
+
const sender = account ?? await Account.random()
|
|
28
|
+
if (elevatedPayloads?.length === 0) {
|
|
29
|
+
const receiver = receiverAddress ?? (await Account.random()).address
|
|
30
|
+
const transferPayload: Transfer = createTransferPayload(sender.address, { [receiver]: 1n })
|
|
31
|
+
elevatedPayloads.push(transferPayload)
|
|
32
|
+
}
|
|
33
|
+
const hydratedTransaction = await buildTransaction(chain, elevatedPayloads, additionalPayloads, sender, nbf, exp)
|
|
34
|
+
// remove private payloads from hydrated
|
|
35
|
+
return [hydratedTransaction[0], hydratedTransaction[1].filter(p => !privatePayloadSchemas.includes(p.schema))]
|
|
36
|
+
}
|
|
@@ -7,7 +7,7 @@ import type {
|
|
|
7
7
|
SignedHydratedTransactionWithStorageMeta, TransactionBoundWitness,
|
|
8
8
|
} from '@xyo-network/xl1-protocol'
|
|
9
9
|
import {
|
|
10
|
-
|
|
10
|
+
asSignedHydratedTransaction, isAllowedBlockPayload, isSignedTransactionBoundWitnessWithStorageMeta,
|
|
11
11
|
} from '@xyo-network/xl1-protocol'
|
|
12
12
|
|
|
13
13
|
import type { ChainStoreRead } from '../model/index.ts'
|
package/src/transaction/index.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from './buildRandomTransaction.ts'
|
|
1
2
|
export * from './buildTransaction.ts'
|
|
2
3
|
export * from './buildUnsignedTransaction.ts'
|
|
3
4
|
export * from './confirmSubmittedTransaction.ts'
|
|
@@ -5,3 +6,4 @@ export * from './hydrateTransaction.ts'
|
|
|
5
6
|
export * from './primitives/index.ts'
|
|
6
7
|
export * from './script.ts'
|
|
7
8
|
export * from './signTransaction.ts'
|
|
9
|
+
export * from './TransactionBuilder.ts'
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import type
|
|
2
|
-
|
|
3
|
-
} from '@xylabs/sdk-js'
|
|
1
|
+
import { type Address, type Promisable } from '@xylabs/sdk-js'
|
|
2
|
+
import { zodIsFactory } from '@xylabs/zod'
|
|
4
3
|
import { WithHashMetaZod } from '@xyo-network/payload-model'
|
|
5
4
|
import {
|
|
6
5
|
type AttoXL1,
|
|
7
6
|
TransferZod,
|
|
8
|
-
type XL1BlockRange,
|
|
9
7
|
} from '@xyo-network/xl1-protocol'
|
|
10
8
|
import { BlockBoundWitnessZod, TransactionBoundWitnessZod } from '@xyo-network/xl1-protocol'
|
|
11
9
|
import z from 'zod'
|
|
12
10
|
|
|
13
|
-
import
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
import {
|
|
12
|
+
ChainQualificationZod,
|
|
13
|
+
type ChainQualified,
|
|
14
|
+
ChainQualifiedConfigZod,
|
|
15
|
+
type Provider,
|
|
16
16
|
} from '../model/index.ts'
|
|
17
17
|
|
|
18
18
|
export const AccountBalanceHistoryItemZod = z.tuple([
|
|
@@ -23,19 +23,27 @@ export const AccountBalanceHistoryItemZod = z.tuple([
|
|
|
23
23
|
|
|
24
24
|
export type AccountBalanceHistoryItem = z.infer<typeof AccountBalanceHistoryItemZod>
|
|
25
25
|
|
|
26
|
+
export const AccountBalanceQualificationZod = ChainQualificationZod
|
|
27
|
+
export type AccountBalanceQualification = z.infer<typeof AccountBalanceQualificationZod>
|
|
28
|
+
export const isAccountBalanceQualification = zodIsFactory(AccountBalanceQualificationZod)
|
|
29
|
+
|
|
30
|
+
export const AccountBalanceConfigZod = ChainQualifiedConfigZod
|
|
31
|
+
export type AccountBalanceConfig = z.infer<typeof AccountBalanceConfigZod>
|
|
32
|
+
export const isAccountBalanceCOnfig = zodIsFactory(AccountBalanceConfigZod)
|
|
33
|
+
|
|
26
34
|
export interface AccountBalanceViewerMethods {
|
|
27
35
|
qualifiedAccountBalanceHistories(
|
|
28
36
|
address: Address[],
|
|
29
|
-
|
|
30
|
-
): Promisable<
|
|
31
|
-
qualifiedAccountBalances(address: Address[],
|
|
37
|
+
config: AccountBalanceConfig
|
|
38
|
+
): Promisable<ChainQualified<Record<Address, AccountBalanceHistoryItem[]>>>
|
|
39
|
+
qualifiedAccountBalances(address: Address[], config: AccountBalanceConfig): Promisable<ChainQualified<Record<Address, AttoXL1>>>
|
|
32
40
|
}
|
|
33
41
|
|
|
34
42
|
export interface AccountBalanceViewer extends AccountBalanceViewerMethods, Provider<AccountBalanceViewerMoniker> {
|
|
35
|
-
accountBalance(address: Address,
|
|
36
|
-
accountBalanceHistories(address: Address[],
|
|
37
|
-
accountBalanceHistory(address: Address,
|
|
38
|
-
accountBalances(address: Address[],
|
|
43
|
+
accountBalance(address: Address, config?: AccountBalanceConfig): Promisable<AttoXL1>
|
|
44
|
+
accountBalanceHistories(address: Address[], config?: AccountBalanceConfig): Promisable<Record<Address, AccountBalanceHistoryItem[]>>
|
|
45
|
+
accountBalanceHistory(address: Address, config?: AccountBalanceConfig): Promisable<AccountBalanceHistoryItem[]>
|
|
46
|
+
accountBalances(address: Address[], config?: AccountBalanceConfig): Promisable<Record<Address, AttoXL1>>
|
|
39
47
|
}
|
|
40
48
|
|
|
41
49
|
export const AccountBalanceViewerMoniker = 'AccountBalanceViewer' as const
|
package/src/viewers/Block.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Hash, Promisable } from '@xylabs/sdk-js'
|
|
2
2
|
import type { Payload, WithHashMeta } from '@xyo-network/payload-model'
|
|
3
|
-
import type {
|
|
3
|
+
import type {
|
|
4
|
+
ChainId, SignedHydratedBlockWithHashMeta, XL1BlockNumber,
|
|
5
|
+
} from '@xyo-network/xl1-protocol'
|
|
4
6
|
|
|
5
7
|
import type { Provider } from '../model/index.ts'
|
|
6
8
|
|
|
@@ -17,6 +19,9 @@ export type BlockViewerMoniker = typeof BlockViewerMoniker
|
|
|
17
19
|
export interface BlockViewer extends BlockViewerMethods, Provider<BlockViewerMoniker> {
|
|
18
20
|
blockByHash(hash: Hash): Promisable<SignedHydratedBlockWithHashMeta | null>
|
|
19
21
|
blockByNumber(block: XL1BlockNumber): Promisable<SignedHydratedBlockWithHashMeta | null>
|
|
22
|
+
chainId(): Promisable<ChainId>
|
|
23
|
+
chainId(blockNumber: XL1BlockNumber): Promisable<ChainId>
|
|
24
|
+
chainId(blockNumber: 'latest'): Promisable<ChainId>
|
|
20
25
|
currentBlockHash(): Promisable<Hash>
|
|
21
26
|
currentBlockNumber(): Promisable<XL1BlockNumber>
|
|
22
27
|
payloadByHash(hash: Hash): Promisable<WithHashMeta<Payload> | null>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type Promisable } from '@xylabs/sdk-js'
|
|
2
|
+
import { zodIsFactory } from '@xylabs/zod'
|
|
3
|
+
import type { HydratedBlock, SignedHydratedBlockWithHashMeta } from '@xyo-network/xl1-protocol'
|
|
4
|
+
import z from 'zod'
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
ChainQualificationZod, ChainQualifiedHeadConfigZod, ChainQualifiedRangeConfigZod, type Provider,
|
|
8
|
+
} from '../model/index.ts'
|
|
9
|
+
import type { HydratedBlockValidationError } from '../validation/index.ts'
|
|
10
|
+
|
|
11
|
+
export const BlockValidationQualificationZod = ChainQualificationZod
|
|
12
|
+
export type BlockValidationQualification = z.infer<typeof BlockValidationQualificationZod>
|
|
13
|
+
export const isBlockValidationQualification = zodIsFactory(BlockValidationQualificationZod)
|
|
14
|
+
|
|
15
|
+
export const BlockValidationConfigFieldsZod = z.object({
|
|
16
|
+
value: z.boolean().optional(),
|
|
17
|
+
state: z.boolean().optional(),
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
export const BlockValidationConfigZod = z.union([
|
|
21
|
+
BlockValidationConfigFieldsZod.extend(ChainQualifiedHeadConfigZod.shape),
|
|
22
|
+
BlockValidationConfigFieldsZod.extend(ChainQualifiedRangeConfigZod.shape),
|
|
23
|
+
BlockValidationConfigFieldsZod,
|
|
24
|
+
z.object({}),
|
|
25
|
+
])
|
|
26
|
+
|
|
27
|
+
export type BlockValidationConfig = z.infer<typeof BlockValidationConfigZod>
|
|
28
|
+
export const isBlockValidationConfig = zodIsFactory(BlockValidationConfigZod)
|
|
29
|
+
|
|
30
|
+
export interface BlockValidationViewerMethods {
|
|
31
|
+
qualifiedValidateBlocks(
|
|
32
|
+
blocks: HydratedBlock[],
|
|
33
|
+
config?: BlockValidationConfig
|
|
34
|
+
): Promisable<[HydratedBlockValidationError[], BlockValidationQualification]>
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const BlockValidationViewerMoniker = 'BlockValidationViewer' as const
|
|
38
|
+
export type BlockValidationViewerMoniker = typeof BlockValidationViewerMoniker
|
|
39
|
+
|
|
40
|
+
export interface BlockValidationViewer extends BlockValidationViewerMethods, Provider<BlockValidationViewerMoniker> {
|
|
41
|
+
qualifiedValidateBlock(
|
|
42
|
+
block: SignedHydratedBlockWithHashMeta,
|
|
43
|
+
config?: BlockValidationConfig
|
|
44
|
+
): Promisable<[HydratedBlockValidationError[], BlockValidationQualification]>
|
|
45
|
+
validateBlock(block: SignedHydratedBlockWithHashMeta, config?: BlockValidationConfig): Promisable<HydratedBlockValidationError[]>
|
|
46
|
+
validateBlocks(blocks: SignedHydratedBlockWithHashMeta[], config?: BlockValidationConfig): Promisable<HydratedBlockValidationError[]>
|
|
47
|
+
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { Provider } from '../model/index.ts'
|
|
2
|
-
import type { ChainViewer } from './Chain.ts'
|
|
3
2
|
import type { ChainContractViewer } from './ChainContract.ts'
|
|
4
3
|
import type { StakeTotalsViewer } from './StakeTotals.ts'
|
|
5
4
|
|
|
@@ -7,6 +6,6 @@ export const ChainStakeViewerMoniker = 'ChainStakeViewer' as const
|
|
|
7
6
|
export type ChainStakeViewerMoniker = typeof ChainStakeViewerMoniker
|
|
8
7
|
|
|
9
8
|
export interface ChainStakeViewer extends Omit<ChainContractViewer, 'moniker'>, Omit<StakeTotalsViewer, 'moniker'>,
|
|
10
|
-
|
|
9
|
+
Provider<ChainStakeViewerMoniker> {
|
|
11
10
|
|
|
12
11
|
}
|
package/src/viewers/Fork.ts
CHANGED
package/src/viewers/Stake.ts
CHANGED
|
@@ -4,7 +4,6 @@ import type { Position, Provider } from '../model/index.ts'
|
|
|
4
4
|
import type { StakeEventsViewer } from './StakeEvents.ts'
|
|
5
5
|
|
|
6
6
|
export interface StakeViewerProperties {
|
|
7
|
-
chainId: Address
|
|
8
7
|
minWithdrawalBlocks: number
|
|
9
8
|
rewardsContract: Address
|
|
10
9
|
stakeEvents: StakeEventsViewer
|
|
@@ -3,10 +3,10 @@ import type {
|
|
|
3
3
|
} from '@xylabs/sdk-js'
|
|
4
4
|
import type { ChainStakeIntent, XL1BlockRange } from '@xyo-network/xl1-protocol'
|
|
5
5
|
|
|
6
|
-
import type {
|
|
6
|
+
import type { ChainQualified, Provider } from '../model/index.ts'
|
|
7
7
|
|
|
8
8
|
export interface StakeIntentViewerMethods {
|
|
9
|
-
qualifiedIntentByAddress(address: Address, headOrRange?: Hash | XL1BlockRange): Promisable<
|
|
9
|
+
qualifiedIntentByAddress(address: Address, headOrRange?: Hash | XL1BlockRange): Promisable<ChainQualified<ChainStakeIntent | null>>
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export const StakeIntentViewerMoniker = 'StakeIntentViewer' as const
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type Promisable } from '@xylabs/sdk-js'
|
|
2
|
+
import { zodIsFactory } from '@xylabs/zod'
|
|
3
|
+
import { type HydratedTransaction, type ValidationError } from '@xyo-network/xl1-protocol'
|
|
4
|
+
import type z from 'zod'
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
ChainQualificationZod, ChainQualifiedConfigZod, type Provider,
|
|
8
|
+
} from '../model/index.ts'
|
|
9
|
+
|
|
10
|
+
export const TransactionValidationQualificationZod = ChainQualificationZod
|
|
11
|
+
export type TransactionValidationQualification = z.infer<typeof TransactionValidationQualificationZod>
|
|
12
|
+
export const isTransactionValidationQualification = zodIsFactory(TransactionValidationQualificationZod)
|
|
13
|
+
|
|
14
|
+
export const TransactionValidationConfigZod = ChainQualifiedConfigZod
|
|
15
|
+
export type TransactionValidationConfig = z.infer<typeof TransactionValidationConfigZod>
|
|
16
|
+
export const isTransactionValidationConfig = zodIsFactory(TransactionValidationConfigZod)
|
|
17
|
+
|
|
18
|
+
export interface TransactionValidationViewerMethods {
|
|
19
|
+
qualifiedValidateTransactions(
|
|
20
|
+
transactions: HydratedTransaction[],
|
|
21
|
+
config?: TransactionValidationConfig
|
|
22
|
+
): Promisable<[ValidationError[][], TransactionValidationQualification]>
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const TransactionValidationViewerMoniker = 'TransactionValidationViewer' as const
|
|
26
|
+
export type TransactionValidationViewerMoniker = typeof TransactionValidationViewerMoniker
|
|
27
|
+
|
|
28
|
+
export interface TransactionValidationViewer extends TransactionValidationViewerMethods, Provider<TransactionValidationViewerMoniker> {
|
|
29
|
+
qualifiedValidateTransaction(
|
|
30
|
+
transaction: HydratedTransaction,
|
|
31
|
+
config?: TransactionValidationConfig
|
|
32
|
+
): Promisable<[ValidationError[], TransactionValidationQualification]>
|
|
33
|
+
validateTransaction(transaction: HydratedTransaction[], config?: TransactionValidationConfig): Promisable<ValidationError[]>
|
|
34
|
+
validateTransactions(transactions: HydratedTransaction[], config?: TransactionValidationConfig): Promisable<ValidationError[][]>
|
|
35
|
+
}
|
package/src/viewers/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from './AccountBalance.ts'
|
|
2
2
|
export * from './Block.ts'
|
|
3
3
|
export * from './BlockReward.ts'
|
|
4
|
-
export * from './
|
|
4
|
+
export * from './BlockValidation.ts'
|
|
5
5
|
export * from './ChainContract.ts'
|
|
6
6
|
export * from './ChainStakeViewer.ts'
|
|
7
7
|
export * from './Fork.ts'
|
|
@@ -14,4 +14,5 @@ export * from './StepStake.ts'
|
|
|
14
14
|
export * from './StepViewer.ts'
|
|
15
15
|
export * from './TimeSync.ts'
|
|
16
16
|
export * from './Transaction.ts'
|
|
17
|
+
export * from './TransactionValidation.ts'
|
|
17
18
|
export * from './TransferBalance.ts'
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { type Hash } from '@xylabs/sdk-js';
|
|
2
|
-
import { type XL1BlockRange } from '@xyo-network/xl1-protocol';
|
|
3
|
-
import z from 'zod';
|
|
4
|
-
export type Qualified<T> = [T, XL1BlockRange, Hash];
|
|
5
|
-
export declare const QualifiedZod: <T>(zodType: z.ZodType<T>) => z.ZodTuple<[z.ZodType<T, unknown, z.z.core.$ZodTypeInternals<T, unknown>>, z.ZodTuple<[z.ZodPipe<z.ZodNumber, z.ZodTransform<import("@xyo-network/xl1-protocol").XL1BlockNumber, number>>, z.ZodPipe<z.ZodNumber, z.ZodTransform<import("@xyo-network/xl1-protocol").XL1BlockNumber, number>>], null>, z.ZodPipe<z.ZodString, z.ZodTransform<Hash, string>>], null>;
|
|
6
|
-
//# sourceMappingURL=Qualified.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Qualified.d.ts","sourceRoot":"","sources":["../../../src/model/Qualified.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAW,MAAM,gBAAgB,CAAA;AACnD,OAAO,EAAE,KAAK,aAAa,EAAoB,MAAM,2BAA2B,CAAA;AAChF,OAAO,CAAC,MAAM,KAAK,CAAA;AAEnB,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,aAAa,EAAE,IAAI,CAAC,CAAA;AAEnD,eAAO,MAAM,YAAY,GAAI,CAAC,EAAE,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,wWAEpD,CAAA"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { type Address, Promisable } from '@xylabs/sdk-js';
|
|
2
|
-
import { ChainId } from '@xyo-network/xl1-protocol';
|
|
3
|
-
import { AbstractCreatableProvider, CreatableProviderParams } from '../../CreatableProvider/index.ts';
|
|
4
|
-
import { ChainViewer } from '../../viewers/index.ts';
|
|
5
|
-
export interface SimpleChainParams extends CreatableProviderParams {
|
|
6
|
-
chainId: Address;
|
|
7
|
-
}
|
|
8
|
-
export declare class SimpleChainViewer extends AbstractCreatableProvider<SimpleChainParams> implements ChainViewer {
|
|
9
|
-
static readonly defaultMoniker: "ChainViewer";
|
|
10
|
-
static readonly monikers: "ChainViewer"[];
|
|
11
|
-
moniker: "ChainViewer";
|
|
12
|
-
static paramsHandler(params?: Partial<SimpleChainParams>): Promise<SimpleChainParams>;
|
|
13
|
-
chainId(): Promisable<ChainId>;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=SimpleChainViewer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SimpleChainViewer.d.ts","sourceRoot":"","sources":["../../../../src/simple/chain/SimpleChainViewer.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EAAS,UAAU,EAChC,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AAEnD,OAAO,EACL,yBAAyB,EAAqB,uBAAuB,EACtE,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAAE,WAAW,EAAsB,MAAM,wBAAwB,CAAA;AAExE,MAAM,WAAW,iBAAkB,SAAQ,uBAAuB;IAChE,OAAO,EAAE,OAAO,CAAA;CACjB;AAED,qBACa,iBAAkB,SAAQ,yBAAyB,CAAC,iBAAiB,CAAE,YAAW,WAAW;IACxG,MAAM,CAAC,QAAQ,CAAC,cAAc,gBAAqB;IACnD,MAAM,CAAC,QAAQ,CAAC,QAAQ,kBAAuB;IAC/C,OAAO,gBAAmC;WAEpB,aAAa,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC;IAIvE,OAAO,IAAI,UAAU,CAAC,OAAO,CAAC;CAG/B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/simple/chain/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SimpleChainStakeViewer.d.ts","sourceRoot":"","sources":["../../../../src/simple/chainStake/SimpleChainStakeViewer.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACb,MAAM,gBAAgB,CAAA;AAIvB,OAAO,EACL,yBAAyB,EAAqB,uBAAuB,EACtE,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,EACL,iBAAiB,EAAE,WAAW,EAC/B,MAAM,wBAAwB,CAAA;AAG/B,MAAM,WAAW,sBAAuB,SAAQ,uBAAuB;IACrE,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,QAAQ,EAAE,UAAU,CAAA;IACpB,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,SAAS,EAAE,QAAQ,EAAE,CAAA;CACtB;AAED,qBACa,sBAAuB,SAAQ,yBAAyB,CAAC,sBAAsB,CAAE,YAAW,WAAW;IAClH,MAAM,CAAC,QAAQ,CAAC,cAAc,gBAAqB;IACnD,MAAM,CAAC,QAAQ,CAAC,QAAQ,kBAAuB;IAC/C,OAAO,gBAAwC;IAE/C,OAAO,CAAC,QAAQ,CAAqB;IACrC,OAAO,CAAC,uBAAuB,CAA+B;IAE9D,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,IAAI,QAAQ,eAEX;IAED,IAAI,mBAAmB,IAAI,MAAM,CAEhC;IAED,IAAI,eAAe,IAAI,OAAO,CAE7B;IAED,IAAI,WAAW,sBAEd;IAED,IAAI,mBAAmB,IAAI,OAAO,CAEjC;IAED,SAAS,KAAK,SAAS,eAEtB;IAED,MAAM,IAAI,MAAM;IAUhB,qBAAqB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM;IAU9C,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM;IAUvC,OAAO,IAAI,MAAM;IAUjB,eAAe,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM;IAUxC,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,QAAQ;IAI/B,aAAa,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,QAAQ;IAItD,cAAc,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,GAAE,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAkB,GAAG,QAAQ,EAAE;IAKjG,cAAc,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,GAAE,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAkB,GAAG,QAAQ,EAAE;IAKjG,SAAS,IAAI,MAAM;IAUnB,iBAAiB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM;cAUjB,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;CAKvD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SimpleChainStakeEventsViewer.d.ts","sourceRoot":"","sources":["../../../../src/simple/chainStakeEvents/SimpleChainStakeEventsViewer.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,yBAAyB,EAAqB,uBAAuB,EACtE,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,EACL,UAAU,EAAE,gBAAgB,EAAE,cAAc,EAAE,iBAAiB,EAEhE,MAAM,wBAAwB,CAAA;AAE/B,MAAM,WAAW,4BAA6B,SAAQ,uBAAuB;IAC3E,SAAS,EAAE,QAAQ,EAAE,CAAA;CACtB;AAED,qBACa,4BAA6B,SAAQ,yBAAyB,CAAC,4BAA4B,CAAE,YAAW,iBAAiB;IACpI,MAAM,CAAC,QAAQ,CAAC,cAAc,sBAA2B;IACzD,MAAM,CAAC,QAAQ,CAAC,QAAQ,wBAA6B;IACrD,OAAO,sBAA8C;IAErD,SAAS,KAAK,SAAS,eAEtB;IAED,aAAa,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,CAAC,GAAG,MAAM;IAIzD,WAAW,CAAC,KAAK,SAAS,cAAc,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,CAAC,EAAE,EAAE,IAAI,EAAE,GAAE,gBAAgB,CAAC,KAAK,CAAM,GAAG,UAAU,CAAC,KAAK,CAAC,EAAE;cASjH,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAItD,OAAO,CAAC,mBAAmB;IAyC3B,OAAO,CAAC,kBAAkB;CAQ3B"}
|