@xyo-network/xl1-protocol-model 1.26.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/neutral/BlockNumber/BlockNumber.d.ts +35 -0
- package/dist/neutral/BlockNumber/BlockNumber.d.ts.map +1 -0
- package/dist/neutral/BlockNumber/EthBlockNumber.d.ts +46 -0
- package/dist/neutral/BlockNumber/EthBlockNumber.d.ts.map +1 -0
- package/dist/neutral/BlockNumber/Numberish.d.ts +6 -0
- package/dist/neutral/BlockNumber/Numberish.d.ts.map +1 -0
- package/dist/neutral/BlockNumber/XL1BlockNumber.d.ts +46 -0
- package/dist/neutral/BlockNumber/XL1BlockNumber.d.ts.map +1 -0
- package/dist/neutral/BlockNumber/index.d.ts +5 -0
- package/dist/neutral/BlockNumber/index.d.ts.map +1 -0
- package/dist/neutral/Initializable.d.ts +9 -0
- package/dist/neutral/Initializable.d.ts.map +1 -0
- package/dist/neutral/RecordKeyType.d.ts +4 -0
- package/dist/neutral/RecordKeyType.d.ts.map +1 -0
- package/dist/neutral/Step/StepHash.d.ts +11 -0
- package/dist/neutral/Step/StepHash.d.ts.map +1 -0
- package/dist/neutral/Step/StepIdentity.d.ts +19 -0
- package/dist/neutral/Step/StepIdentity.d.ts.map +1 -0
- package/dist/neutral/Step/StepSizes.d.ts +12 -0
- package/dist/neutral/Step/StepSizes.d.ts.map +1 -0
- package/dist/neutral/Step/index.d.ts +4 -0
- package/dist/neutral/Step/index.d.ts.map +1 -0
- package/dist/neutral/TransferPayload.d.ts +79 -0
- package/dist/neutral/TransferPayload.d.ts.map +1 -0
- package/dist/neutral/amount/ShiftedBigIntConfig.d.ts +9 -0
- package/dist/neutral/amount/ShiftedBigIntConfig.d.ts.map +1 -0
- package/dist/neutral/amount/XL1AmountInstance.d.ts +16 -0
- package/dist/neutral/amount/XL1AmountInstance.d.ts.map +1 -0
- package/dist/neutral/amount/index.d.ts +3 -0
- package/dist/neutral/amount/index.d.ts.map +1 -0
- package/dist/neutral/block/AllowedBlockPayload.d.ts +40 -0
- package/dist/neutral/block/AllowedBlockPayload.d.ts.map +1 -0
- package/dist/neutral/block/BlockBoundWitness.d.ts +544 -0
- package/dist/neutral/block/BlockBoundWitness.d.ts.map +1 -0
- package/dist/neutral/block/HydratedBlock.d.ts +1466 -0
- package/dist/neutral/block/HydratedBlock.d.ts.map +1 -0
- package/dist/neutral/block/index.d.ts +6 -0
- package/dist/neutral/block/index.d.ts.map +1 -0
- package/dist/neutral/block/signed/SignedBlockBoundWitness.d.ts +168 -0
- package/dist/neutral/block/signed/SignedBlockBoundWitness.d.ts.map +1 -0
- package/dist/neutral/block/signed/SignedBlockBoundWitnessWithHashMeta.d.ts +286 -0
- package/dist/neutral/block/signed/SignedBlockBoundWitnessWithHashMeta.d.ts.map +1 -0
- package/dist/neutral/block/signed/SignedBlockBoundWitnessWithStorageMeta.d.ts +343 -0
- package/dist/neutral/block/signed/SignedBlockBoundWitnessWithStorageMeta.d.ts.map +1 -0
- package/dist/neutral/block/signed/index.d.ts +4 -0
- package/dist/neutral/block/signed/index.d.ts.map +1 -0
- package/dist/neutral/block/unsigned/UnsignedBlockBoundWitness.d.ts +168 -0
- package/dist/neutral/block/unsigned/UnsignedBlockBoundWitness.d.ts.map +1 -0
- package/dist/neutral/block/unsigned/index.d.ts +2 -0
- package/dist/neutral/block/unsigned/index.d.ts.map +1 -0
- package/dist/neutral/chain/Chain.d.ts +4 -0
- package/dist/neutral/chain/Chain.d.ts.map +1 -0
- package/dist/neutral/chain/ChainAnalyzer.d.ts +10 -0
- package/dist/neutral/chain/ChainAnalyzer.d.ts.map +1 -0
- package/dist/neutral/chain/ChainId.d.ts +4 -0
- package/dist/neutral/chain/ChainId.d.ts.map +1 -0
- package/dist/neutral/chain/index.d.ts +4 -0
- package/dist/neutral/chain/index.d.ts.map +1 -0
- package/dist/neutral/fields/Addressable.d.ts +6 -0
- package/dist/neutral/fields/Addressable.d.ts.map +1 -0
- package/dist/neutral/fields/BlockDuration.d.ts +25 -0
- package/dist/neutral/fields/BlockDuration.d.ts.map +1 -0
- package/dist/neutral/fields/BlockNumber.d.ts +32 -0
- package/dist/neutral/fields/BlockNumber.d.ts.map +1 -0
- package/dist/neutral/fields/ChainReference.d.ts +11 -0
- package/dist/neutral/fields/ChainReference.d.ts.map +1 -0
- package/dist/neutral/fields/index.d.ts +5 -0
- package/dist/neutral/fields/index.d.ts.map +1 -0
- package/dist/neutral/index.d.ts +15 -0
- package/dist/neutral/index.d.ts.map +1 -0
- package/dist/neutral/index.mjs +1699 -0
- package/dist/neutral/index.mjs.map +1 -0
- package/dist/neutral/map/AsyncMap.d.ts +42 -0
- package/dist/neutral/map/AsyncMap.d.ts.map +1 -0
- package/dist/neutral/map/MapType.d.ts +17 -0
- package/dist/neutral/map/MapType.d.ts.map +1 -0
- package/dist/neutral/map/SyncMap.d.ts +41 -0
- package/dist/neutral/map/SyncMap.d.ts.map +1 -0
- package/dist/neutral/map/index.d.ts +4 -0
- package/dist/neutral/map/index.d.ts.map +1 -0
- package/dist/neutral/model/AccountBalance.d.ts +133 -0
- package/dist/neutral/model/AccountBalance.d.ts.map +1 -0
- package/dist/neutral/model/ArrayBuffer.d.ts +6 -0
- package/dist/neutral/model/ArrayBuffer.d.ts.map +1 -0
- package/dist/neutral/model/BlockRange/BlockRange.d.ts +32 -0
- package/dist/neutral/model/BlockRange/BlockRange.d.ts.map +1 -0
- package/dist/neutral/model/BlockRange/EthBlockRange.d.ts +32 -0
- package/dist/neutral/model/BlockRange/EthBlockRange.d.ts.map +1 -0
- package/dist/neutral/model/BlockRange/Numberish.d.ts +4 -0
- package/dist/neutral/model/BlockRange/Numberish.d.ts.map +1 -0
- package/dist/neutral/model/BlockRange/Range.d.ts +18 -0
- package/dist/neutral/model/BlockRange/Range.d.ts.map +1 -0
- package/dist/neutral/model/BlockRange/XL1BlockRange.d.ts +32 -0
- package/dist/neutral/model/BlockRange/XL1BlockRange.d.ts.map +1 -0
- package/dist/neutral/model/BlockRange/index.d.ts +5 -0
- package/dist/neutral/model/BlockRange/index.d.ts.map +1 -0
- package/dist/neutral/model/BlockRate.d.ts +290 -0
- package/dist/neutral/model/BlockRate.d.ts.map +1 -0
- package/dist/neutral/model/ChainQualification.d.ts +57 -0
- package/dist/neutral/model/ChainQualification.d.ts.map +1 -0
- package/dist/neutral/model/Context/BaseContext.d.ts +5 -0
- package/dist/neutral/model/Context/BaseContext.d.ts.map +1 -0
- package/dist/neutral/model/Context/BaseContext.zod.d.ts +26 -0
- package/dist/neutral/model/Context/BaseContext.zod.d.ts.map +1 -0
- package/dist/neutral/model/Context/BlockContext.d.ts +9 -0
- package/dist/neutral/model/Context/BlockContext.d.ts.map +1 -0
- package/dist/neutral/model/Context/BlockContext.zod.d.ts +33 -0
- package/dist/neutral/model/Context/BlockContext.zod.d.ts.map +1 -0
- package/dist/neutral/model/Context/CachingContext.d.ts +5 -0
- package/dist/neutral/model/Context/CachingContext.d.ts.map +1 -0
- package/dist/neutral/model/Context/CachingContext.zod.d.ts +10 -0
- package/dist/neutral/model/Context/CachingContext.zod.d.ts.map +1 -0
- package/dist/neutral/model/Context/ChainContext.d.ts +9 -0
- package/dist/neutral/model/Context/ChainContext.d.ts.map +1 -0
- package/dist/neutral/model/Context/ChainContext.zod.d.ts +115 -0
- package/dist/neutral/model/Context/ChainContext.zod.d.ts.map +1 -0
- package/dist/neutral/model/Context/HeadContext.d.ts +5 -0
- package/dist/neutral/model/Context/HeadContext.d.ts.map +1 -0
- package/dist/neutral/model/Context/HeadContext.zod.d.ts +70 -0
- package/dist/neutral/model/Context/HeadContext.zod.d.ts.map +1 -0
- package/dist/neutral/model/Context/index.d.ts +11 -0
- package/dist/neutral/model/Context/index.d.ts.map +1 -0
- package/dist/neutral/model/GatewayName.d.ts +6 -0
- package/dist/neutral/model/GatewayName.d.ts.map +1 -0
- package/dist/neutral/model/HydratedTransaction.d.ts +2300 -0
- package/dist/neutral/model/HydratedTransaction.d.ts.map +1 -0
- package/dist/neutral/model/OpCodes.d.ts +3 -0
- package/dist/neutral/model/OpCodes.d.ts.map +1 -0
- package/dist/neutral/model/PayloadMap.d.ts +10 -0
- package/dist/neutral/model/PayloadMap.d.ts.map +1 -0
- package/dist/neutral/model/Permission.d.ts +59 -0
- package/dist/neutral/model/Permission.d.ts.map +1 -0
- package/dist/neutral/model/Position.d.ts +13 -0
- package/dist/neutral/model/Position.d.ts.map +1 -0
- package/dist/neutral/model/PositionId.d.ts +6 -0
- package/dist/neutral/model/PositionId.d.ts.map +1 -0
- package/dist/neutral/model/RangeMultipliers.d.ts +10 -0
- package/dist/neutral/model/RangeMultipliers.d.ts.map +1 -0
- package/dist/neutral/model/RewardShare.d.ts +3 -0
- package/dist/neutral/model/RewardShare.d.ts.map +1 -0
- package/dist/neutral/model/RewardsRangeOptions.d.ts +16 -0
- package/dist/neutral/model/RewardsRangeOptions.d.ts.map +1 -0
- package/dist/neutral/model/Sequence.d.ts +15 -0
- package/dist/neutral/model/Sequence.d.ts.map +1 -0
- package/dist/neutral/model/Stake.d.ts +121 -0
- package/dist/neutral/model/Stake.d.ts.map +1 -0
- package/dist/neutral/model/StakeShare.d.ts +3 -0
- package/dist/neutral/model/StakeShare.d.ts.map +1 -0
- package/dist/neutral/model/TimeDomain.d.ts +4 -0
- package/dist/neutral/model/TimeDomain.d.ts.map +1 -0
- package/dist/neutral/model/TransferPair.d.ts +12 -0
- package/dist/neutral/model/TransferPair.d.ts.map +1 -0
- package/dist/neutral/model/addresses.d.ts +28 -0
- package/dist/neutral/model/addresses.d.ts.map +1 -0
- package/dist/neutral/model/defaultRewardRatio.d.ts +3 -0
- package/dist/neutral/model/defaultRewardRatio.d.ts.map +1 -0
- package/dist/neutral/model/defaultTransactionFees.d.ts +4 -0
- package/dist/neutral/model/defaultTransactionFees.d.ts.map +1 -0
- package/dist/neutral/model/index.d.ts +28 -0
- package/dist/neutral/model/index.d.ts.map +1 -0
- package/dist/neutral/model/minTransactionFees.d.ts +4 -0
- package/dist/neutral/model/minTransactionFees.d.ts.map +1 -0
- package/dist/neutral/model/rewards.d.ts +15 -0
- package/dist/neutral/model/rewards.d.ts.map +1 -0
- package/dist/neutral/model/version.d.ts +11 -0
- package/dist/neutral/model/version.d.ts.map +1 -0
- package/dist/neutral/payload/StepIdentityPayload.d.ts +20 -0
- package/dist/neutral/payload/StepIdentityPayload.d.ts.map +1 -0
- package/dist/neutral/payload/elevatable/Bridge/BridgeCompletion.d.ts +23 -0
- package/dist/neutral/payload/elevatable/Bridge/BridgeCompletion.d.ts.map +1 -0
- package/dist/neutral/payload/elevatable/Bridge/BridgeDestinationObservation.d.ts +33 -0
- package/dist/neutral/payload/elevatable/Bridge/BridgeDestinationObservation.d.ts.map +1 -0
- package/dist/neutral/payload/elevatable/Bridge/BridgeDetails.d.ts +45 -0
- package/dist/neutral/payload/elevatable/Bridge/BridgeDetails.d.ts.map +1 -0
- package/dist/neutral/payload/elevatable/Bridge/BridgeIntent.d.ts +31 -0
- package/dist/neutral/payload/elevatable/Bridge/BridgeIntent.d.ts.map +1 -0
- package/dist/neutral/payload/elevatable/Bridge/BridgeSourceObservation.d.ts +33 -0
- package/dist/neutral/payload/elevatable/Bridge/BridgeSourceObservation.d.ts.map +1 -0
- package/dist/neutral/payload/elevatable/Bridge/index.d.ts +6 -0
- package/dist/neutral/payload/elevatable/Bridge/index.d.ts.map +1 -0
- package/dist/neutral/payload/elevatable/ChainStakeIntent.d.ts +24 -0
- package/dist/neutral/payload/elevatable/ChainStakeIntent.d.ts.map +1 -0
- package/dist/neutral/payload/elevatable/Executable.d.ts +20 -0
- package/dist/neutral/payload/elevatable/Executable.d.ts.map +1 -0
- package/dist/neutral/payload/elevatable/Hash.d.ts +21 -0
- package/dist/neutral/payload/elevatable/Hash.d.ts.map +1 -0
- package/dist/neutral/payload/elevatable/StepComplete.d.ts +22 -0
- package/dist/neutral/payload/elevatable/StepComplete.d.ts.map +1 -0
- package/dist/neutral/payload/elevatable/Time.d.ts +71 -0
- package/dist/neutral/payload/elevatable/Time.d.ts.map +1 -0
- package/dist/neutral/payload/elevatable/index.d.ts +7 -0
- package/dist/neutral/payload/elevatable/index.d.ts.map +1 -0
- package/dist/neutral/payload/index.d.ts +3 -0
- package/dist/neutral/payload/index.d.ts.map +1 -0
- package/dist/neutral/provider/Provider.d.ts +6 -0
- package/dist/neutral/provider/Provider.d.ts.map +1 -0
- package/dist/neutral/provider/ProviderMoniker.d.ts +9 -0
- package/dist/neutral/provider/ProviderMoniker.d.ts.map +1 -0
- package/dist/neutral/provider/index.d.ts +3 -0
- package/dist/neutral/provider/index.d.ts.map +1 -0
- package/dist/neutral/transaction/TransactionBoundWitness.d.ts +2127 -0
- package/dist/neutral/transaction/TransactionBoundWitness.d.ts.map +1 -0
- package/dist/neutral/transaction/TransactionFees.d.ts +138 -0
- package/dist/neutral/transaction/TransactionFees.d.ts.map +1 -0
- package/dist/neutral/transaction/TransactionGasCosts.d.ts +38 -0
- package/dist/neutral/transaction/TransactionGasCosts.d.ts.map +1 -0
- package/dist/neutral/transaction/index.d.ts +4 -0
- package/dist/neutral/transaction/index.d.ts.map +1 -0
- package/dist/neutral/xl1/AttoXL1.d.ts +15 -0
- package/dist/neutral/xl1/AttoXL1.d.ts.map +1 -0
- package/dist/neutral/xl1/FemtoXL1.d.ts +15 -0
- package/dist/neutral/xl1/FemtoXL1.d.ts.map +1 -0
- package/dist/neutral/xl1/MicroXL1.d.ts +15 -0
- package/dist/neutral/xl1/MicroXL1.d.ts.map +1 -0
- package/dist/neutral/xl1/MilliXL1.d.ts +15 -0
- package/dist/neutral/xl1/MilliXL1.d.ts.map +1 -0
- package/dist/neutral/xl1/NanoXL1.d.ts +15 -0
- package/dist/neutral/xl1/NanoXL1.d.ts.map +1 -0
- package/dist/neutral/xl1/PicoXL1.d.ts +15 -0
- package/dist/neutral/xl1/PicoXL1.d.ts.map +1 -0
- package/dist/neutral/xl1/XL1.d.ts +15 -0
- package/dist/neutral/xl1/XL1.d.ts.map +1 -0
- package/dist/neutral/xl1/XL1Units.d.ts +10 -0
- package/dist/neutral/xl1/XL1Units.d.ts.map +1 -0
- package/dist/neutral/xl1/index.d.ts +9 -0
- package/dist/neutral/xl1/index.d.ts.map +1 -0
- package/dist/neutral/xl1/isXL1Factory.d.ts +12 -0
- package/dist/neutral/xl1/isXL1Factory.d.ts.map +1 -0
- package/dist/neutral/xl1/xl1MaxValue.d.ts +3 -0
- package/dist/neutral/xl1/xl1MaxValue.d.ts.map +1 -0
- package/package.json +65 -0
- package/src/BlockNumber/BlockNumber.ts +24 -0
- package/src/BlockNumber/EthBlockNumber.ts +25 -0
- package/src/BlockNumber/Numberish.ts +9 -0
- package/src/BlockNumber/XL1BlockNumber.ts +25 -0
- package/src/BlockNumber/index.ts +4 -0
- package/src/RecordKeyType.ts +5 -0
- package/src/Step/StepHash.ts +10 -0
- package/src/Step/StepIdentity.ts +46 -0
- package/src/Step/StepSizes.ts +47 -0
- package/src/Step/index.ts +3 -0
- package/src/TransferPayload.ts +35 -0
- package/src/amount/ShiftedBigIntConfig.ts +8 -0
- package/src/amount/XL1AmountInstance.ts +19 -0
- package/src/amount/index.ts +2 -0
- package/src/block/AllowedBlockPayload.ts +73 -0
- package/src/block/BlockBoundWitness.ts +72 -0
- package/src/block/HydratedBlock.ts +135 -0
- package/src/block/index.ts +5 -0
- package/src/block/signed/SignedBlockBoundWitness.ts +22 -0
- package/src/block/signed/SignedBlockBoundWitnessWithHashMeta.ts +35 -0
- package/src/block/signed/SignedBlockBoundWitnessWithStorageMeta.ts +41 -0
- package/src/block/signed/index.ts +3 -0
- package/src/block/unsigned/UnsignedBlockBoundWitness.ts +22 -0
- package/src/block/unsigned/index.ts +1 -0
- package/src/chain/Chain.ts +7 -0
- package/src/chain/ChainAnalyzer.ts +11 -0
- package/src/chain/ChainId.ts +4 -0
- package/src/chain/index.ts +3 -0
- package/src/fields/Addressable.ts +7 -0
- package/src/fields/BlockDuration.ts +25 -0
- package/src/fields/BlockNumber.ts +40 -0
- package/src/fields/ChainReference.ts +11 -0
- package/src/fields/index.ts +4 -0
- package/src/index.ts +14 -0
- package/src/map/AsyncMap.ts +38 -0
- package/src/map/MapType.ts +27 -0
- package/src/map/SyncMap.ts +38 -0
- package/src/map/index.ts +3 -0
- package/src/model/AccountBalance.ts +58 -0
- package/src/model/ArrayBuffer.ts +44 -0
- package/src/model/BlockRange/BlockRange.ts +43 -0
- package/src/model/BlockRange/EthBlockRange.ts +43 -0
- package/src/model/BlockRange/Numberish.ts +6 -0
- package/src/model/BlockRange/Range.ts +17 -0
- package/src/model/BlockRange/XL1BlockRange.ts +43 -0
- package/src/model/BlockRange/index.ts +4 -0
- package/src/model/BlockRate.ts +108 -0
- package/src/model/ChainQualification.ts +48 -0
- package/src/model/Context/BaseContext.ts +6 -0
- package/src/model/Context/BaseContext.zod.ts +36 -0
- package/src/model/Context/BlockContext.ts +12 -0
- package/src/model/Context/BlockContext.zod.ts +20 -0
- package/src/model/Context/CachingContext.ts +6 -0
- package/src/model/Context/CachingContext.zod.ts +4 -0
- package/src/model/Context/ChainContext.ts +12 -0
- package/src/model/Context/ChainContext.zod.ts +17 -0
- package/src/model/Context/HeadContext.ts +6 -0
- package/src/model/Context/HeadContext.zod.ts +13 -0
- package/src/model/Context/index.ts +10 -0
- package/src/model/GatewayName.ts +4 -0
- package/src/model/HydratedTransaction.ts +169 -0
- package/src/model/OpCodes.ts +2 -0
- package/src/model/PayloadMap.ts +13 -0
- package/src/model/Permission.ts +29 -0
- package/src/model/Position.ts +21 -0
- package/src/model/PositionId.ts +4 -0
- package/src/model/RangeMultipliers.ts +13 -0
- package/src/model/RewardShare.ts +2 -0
- package/src/model/RewardsRangeOptions.ts +13 -0
- package/src/model/Sequence.ts +21 -0
- package/src/model/Stake.ts +47 -0
- package/src/model/StakeShare.ts +2 -0
- package/src/model/TimeDomain.ts +8 -0
- package/src/model/TransferPair.ts +7 -0
- package/src/model/addresses.ts +36 -0
- package/src/model/defaultRewardRatio.ts +3 -0
- package/src/model/defaultTransactionFees.ts +11 -0
- package/src/model/index.ts +27 -0
- package/src/model/minTransactionFees.ts +10 -0
- package/src/model/rewards.ts +18 -0
- package/src/model/spec/fixtures/index.ts +2 -0
- package/src/model/spec/fixtures/signedHydratedTransaction.ts +58 -0
- package/src/model/spec/fixtures/unsignedHydratedTransaction.ts +62 -0
- package/src/model/version.ts +10 -0
- package/src/payload/StepIdentityPayload.ts +25 -0
- package/src/payload/elevatable/Bridge/BridgeCompletion.ts +28 -0
- package/src/payload/elevatable/Bridge/BridgeDestinationObservation.ts +38 -0
- package/src/payload/elevatable/Bridge/BridgeDetails.ts +69 -0
- package/src/payload/elevatable/Bridge/BridgeIntent.ts +36 -0
- package/src/payload/elevatable/Bridge/BridgeSourceObservation.ts +37 -0
- package/src/payload/elevatable/Bridge/index.ts +5 -0
- package/src/payload/elevatable/ChainStakeIntent.ts +45 -0
- package/src/payload/elevatable/Executable.ts +35 -0
- package/src/payload/elevatable/Hash.ts +25 -0
- package/src/payload/elevatable/StepComplete.ts +31 -0
- package/src/payload/elevatable/Time.ts +61 -0
- package/src/payload/elevatable/index.ts +6 -0
- package/src/payload/index.ts +2 -0
- package/src/provider/Provider.ts +6 -0
- package/src/provider/ProviderMoniker.ts +15 -0
- package/src/provider/index.ts +2 -0
- package/src/transaction/TransactionBoundWitness.ts +187 -0
- package/src/transaction/TransactionFees.ts +73 -0
- package/src/transaction/TransactionGasCosts.ts +42 -0
- package/src/transaction/index.ts +3 -0
- package/src/xl1/AttoXL1.ts +19 -0
- package/src/xl1/FemtoXL1.ts +20 -0
- package/src/xl1/MicroXL1.ts +20 -0
- package/src/xl1/MilliXL1.ts +20 -0
- package/src/xl1/NanoXL1.ts +20 -0
- package/src/xl1/PicoXL1.ts +20 -0
- package/src/xl1/XL1.ts +20 -0
- package/src/xl1/XL1Units.ts +26 -0
- package/src/xl1/index.ts +8 -0
- package/src/xl1/isXL1Factory.ts +56 -0
- package/src/xl1/xl1MaxValue.ts +2 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { type Brand, isUndefined } from '@xylabs/sdk-js'
|
|
2
|
+
import { z } from 'zod'
|
|
3
|
+
|
|
4
|
+
import { toXL1BlockNumber, XL1BlockNumberZod } from '../BlockNumber/index.ts'
|
|
5
|
+
|
|
6
|
+
/** Zod schema for a step identity combining a block number and step index */
|
|
7
|
+
export const StepIdentityZod = z.object({
|
|
8
|
+
block: XL1BlockNumberZod.describe('The block number at which the step occurs'),
|
|
9
|
+
step: z.number().int().nonnegative().describe('The index of the step into the StepSize array'),
|
|
10
|
+
})
|
|
11
|
+
/** Identifies a specific step by its block number and step index */
|
|
12
|
+
export type StepIdentity = z.infer<typeof StepIdentityZod>
|
|
13
|
+
|
|
14
|
+
/** @deprecated use StepIdentity instead */
|
|
15
|
+
export interface StepContext extends StepIdentity {}
|
|
16
|
+
|
|
17
|
+
/** Branded string representing a block number and step index separated by a pipe character */
|
|
18
|
+
export type StepIdentityString = Brand<string, { readonly __stepIdentityString: true }>
|
|
19
|
+
|
|
20
|
+
function tryParseInt(value: string): number | undefined {
|
|
21
|
+
// Prevent coercion of empty strings to 0
|
|
22
|
+
if (value === '') return undefined
|
|
23
|
+
// Parse number
|
|
24
|
+
const num = Number(value)
|
|
25
|
+
// Check if integer
|
|
26
|
+
return Number.isInteger(num) ? num : undefined
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** Parses a pipe-separated string into a StepIdentity, returning undefined if invalid */
|
|
30
|
+
export const asStepIdentity = (stepIdentityString: string): StepIdentity | undefined => {
|
|
31
|
+
try {
|
|
32
|
+
const [blockNumberString, stepString] = stepIdentityString.split('|')
|
|
33
|
+
if (isUndefined(blockNumberString) || isUndefined(stepString)) {
|
|
34
|
+
return undefined
|
|
35
|
+
}
|
|
36
|
+
const step = tryParseInt(stepString)
|
|
37
|
+
const block = toXL1BlockNumber(blockNumberString)
|
|
38
|
+
if (isUndefined(block) || isUndefined(step)) {
|
|
39
|
+
return undefined
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return { block, step }
|
|
43
|
+
} catch {
|
|
44
|
+
return undefined
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { AsTypeFactory } from '@xylabs/sdk-js'
|
|
2
|
+
|
|
3
|
+
import { asXL1BlockNumber, type XL1BlockNumber } from '../BlockNumber/index.ts'
|
|
4
|
+
|
|
5
|
+
// StepsV2 are primorial(n+2) + 1, where n is the index of the step size
|
|
6
|
+
// primorial(n+2) = 2 → 2×3=6 → 6×5=30 → 30×7=210 → 210×11=2310
|
|
7
|
+
|
|
8
|
+
/** Array of step sizes based on primorial(n+2) + 1, defining the block intervals for each step level */
|
|
9
|
+
export const StepSizes: XL1BlockNumber[] = [
|
|
10
|
+
asXL1BlockNumber(7, true),
|
|
11
|
+
asXL1BlockNumber(31, true),
|
|
12
|
+
asXL1BlockNumber(211, true),
|
|
13
|
+
asXL1BlockNumber(2311, true),
|
|
14
|
+
asXL1BlockNumber(30_031, true),
|
|
15
|
+
asXL1BlockNumber(510_511, true),
|
|
16
|
+
asXL1BlockNumber(9_699_691, true),
|
|
17
|
+
asXL1BlockNumber(223_092_871, true),
|
|
18
|
+
asXL1BlockNumber(6_469_693_231, true),
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
/** Type guard that checks if a value is a valid step index within the StepSizes array */
|
|
22
|
+
export function isValidStep(step: unknown): step is number {
|
|
23
|
+
if (typeof step === 'number' && Number.isInteger(step)) {
|
|
24
|
+
return ((step >= 0) && (step < StepSizes.length))
|
|
25
|
+
}
|
|
26
|
+
return false
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** Casts a value to a valid step index, returning undefined if invalid */
|
|
30
|
+
export const asValidStep = AsTypeFactory.create<number>(isValidStep)
|
|
31
|
+
|
|
32
|
+
/** Returns the block interval size for a given step index */
|
|
33
|
+
export function stepSize(step: number): number {
|
|
34
|
+
const validatedStep = asValidStep(step, () => `Invalid step (${step}), must be an integer between 0 and ${StepSizes.length - 1}`, { required: true })
|
|
35
|
+
return StepSizes[validatedStep]
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** Fraction of block rewards allocated at each step level, expressed as [numerator, denominator] pairs */
|
|
39
|
+
export const StepRewardFractions = [
|
|
40
|
+
[0n, 1n], // 0%
|
|
41
|
+
[0n, 1n], // 0%
|
|
42
|
+
[0n, 1n], // 0%
|
|
43
|
+
[1n, 10_000n], // 0.01%
|
|
44
|
+
[2n, 1000n], // 0.2%
|
|
45
|
+
[3n, 100n], // 3%
|
|
46
|
+
[45n, 100n], // 45%
|
|
47
|
+
] as const
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AddressZod,
|
|
3
|
+
AsObjectFactory, HexZod, JsonObjectZod,
|
|
4
|
+
} from '@xylabs/sdk-js'
|
|
5
|
+
import {
|
|
6
|
+
asSchema, isPayloadOfSchemaType, PayloadZodOfSchema,
|
|
7
|
+
} from '@xyo-network/sdk-js'
|
|
8
|
+
import { z } from 'zod'
|
|
9
|
+
|
|
10
|
+
/** Schema identifier for XYO transfer payloads */
|
|
11
|
+
export const TransferSchema = asSchema('network.xyo.transfer', true)
|
|
12
|
+
/** The literal type of the transfer schema string */
|
|
13
|
+
export type TransferSchema = typeof TransferSchema
|
|
14
|
+
|
|
15
|
+
/** Zod schema for the fields specific to a transfer payload */
|
|
16
|
+
export const TransferFieldsZod = z.object({
|
|
17
|
+
// Removed as only transaction have opCodes
|
|
18
|
+
// $opCodes: z.array(z.string()).optional(),
|
|
19
|
+
context: JsonObjectZod.optional(),
|
|
20
|
+
epoch: z.number(),
|
|
21
|
+
from: AddressZod,
|
|
22
|
+
transfers: z.record(AddressZod, HexZod),
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
/** Zod schema for a complete transfer payload including schema and fields */
|
|
26
|
+
export const TransferZod = PayloadZodOfSchema(TransferSchema).extend(TransferFieldsZod.shape)
|
|
27
|
+
|
|
28
|
+
/** A transfer payload representing the movement of XL1 tokens between addresses */
|
|
29
|
+
export type Transfer = z.infer<typeof TransferZod>
|
|
30
|
+
|
|
31
|
+
/** Type guard that checks if a value is a Transfer payload */
|
|
32
|
+
export const isTransfer = isPayloadOfSchemaType<Transfer>(TransferSchema)
|
|
33
|
+
|
|
34
|
+
/** Casts a value to Transfer or returns undefined if invalid */
|
|
35
|
+
export const asTransfer = AsObjectFactory.create(isTransfer)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AttoXL1, FemtoXL1, MicroXL1, MilliXL1, NanoXL1, PicoXL1, XL1,
|
|
3
|
+
} from '../xl1/index.ts'
|
|
4
|
+
import type { ShiftedBigIntConfig } from './ShiftedBigIntConfig.ts'
|
|
5
|
+
|
|
6
|
+
/** Interface for an XL1 token amount with conversion accessors for various denominations */
|
|
7
|
+
export interface XL1AmountInstance {
|
|
8
|
+
atto: AttoXL1
|
|
9
|
+
femto: FemtoXL1
|
|
10
|
+
micro: MicroXL1
|
|
11
|
+
milli: MilliXL1
|
|
12
|
+
nano: NanoXL1
|
|
13
|
+
pico: PicoXL1
|
|
14
|
+
value: AttoXL1
|
|
15
|
+
xl1: XL1
|
|
16
|
+
|
|
17
|
+
to(places: bigint | number): bigint
|
|
18
|
+
toString(places: number, config: Partial<ShiftedBigIntConfig>): string
|
|
19
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { zodIsFactory } from '@xylabs/sdk-js'
|
|
2
|
+
import type {
|
|
3
|
+
Schema, SchemaPayload, WithStorageMeta,
|
|
4
|
+
} from '@xyo-network/sdk-js'
|
|
5
|
+
import {
|
|
6
|
+
BoundWitnessSchema, isHashMeta, isSchemaPayload, SchemaSchema,
|
|
7
|
+
} from '@xyo-network/sdk-js'
|
|
8
|
+
import { z } from 'zod'
|
|
9
|
+
|
|
10
|
+
import type {
|
|
11
|
+
BridgeDestinationObservation, BridgeIntent, BridgeSourceObservation, ChainStakeIntent, HashPayload, StepComplete, TimePayload,
|
|
12
|
+
} from '../payload/index.ts'
|
|
13
|
+
import {
|
|
14
|
+
BridgeDestinationObservationSchema, BridgeIntentSchema, BridgeSourceObservationSchema, ChainStakeIntentSchema, HashSchema,
|
|
15
|
+
isBridgeDestinationObservation, isBridgeIntent, isBridgeSourceObservation, isChainStakeIntent, isHashPayload, isTimePayload, StepCompleteSchema,
|
|
16
|
+
TimeSchema,
|
|
17
|
+
} from '../payload/index.ts'
|
|
18
|
+
import { isTransactionBoundWitness, type TransactionBoundWitness } from '../transaction/index.ts'
|
|
19
|
+
import {
|
|
20
|
+
isTransfer, type Transfer, TransferSchema,
|
|
21
|
+
} from '../TransferPayload.ts'
|
|
22
|
+
|
|
23
|
+
/** AllowedBlockPayload type. */
|
|
24
|
+
export type AllowedBlockPayload
|
|
25
|
+
= | BridgeDestinationObservation
|
|
26
|
+
| BridgeIntent
|
|
27
|
+
| BridgeSourceObservation
|
|
28
|
+
| ChainStakeIntent
|
|
29
|
+
| HashPayload
|
|
30
|
+
| SchemaPayload
|
|
31
|
+
| StepComplete
|
|
32
|
+
| TimePayload
|
|
33
|
+
| TransactionBoundWitness
|
|
34
|
+
| Transfer
|
|
35
|
+
|
|
36
|
+
/** AllowedBlockPayloadSchemas constant. */
|
|
37
|
+
export const AllowedBlockPayloadSchemas = [
|
|
38
|
+
BoundWitnessSchema,
|
|
39
|
+
BridgeDestinationObservationSchema,
|
|
40
|
+
BridgeIntentSchema,
|
|
41
|
+
BridgeSourceObservationSchema,
|
|
42
|
+
ChainStakeIntentSchema,
|
|
43
|
+
HashSchema,
|
|
44
|
+
SchemaSchema,
|
|
45
|
+
StepCompleteSchema,
|
|
46
|
+
TimeSchema,
|
|
47
|
+
TransferSchema,
|
|
48
|
+
] satisfies Schema[]
|
|
49
|
+
|
|
50
|
+
/** AllowedBlockPayloadSchemaZod constant. */
|
|
51
|
+
export const AllowedBlockPayloadSchemaZod = z.enum(AllowedBlockPayloadSchemas)
|
|
52
|
+
/** Schema type for AllowedBlockPayload payloads. */
|
|
53
|
+
export type AllowedBlockPayloadSchema = z.infer<typeof AllowedBlockPayloadSchemaZod>
|
|
54
|
+
/** Schema identifier for isAllowedBlockPayload payloads. */
|
|
55
|
+
export const isAllowedBlockPayloadSchema = zodIsFactory(AllowedBlockPayloadSchemaZod)
|
|
56
|
+
|
|
57
|
+
/** Type guard that checks if a value is a valid AllowedBlockPayload. */
|
|
58
|
+
export const isAllowedBlockPayload = <T>(value: T): value is AllowedBlockPayload & T => {
|
|
59
|
+
return isTransfer(value)
|
|
60
|
+
|| isBridgeDestinationObservation(value)
|
|
61
|
+
|| isBridgeIntent(value)
|
|
62
|
+
|| isBridgeSourceObservation(value)
|
|
63
|
+
|| isChainStakeIntent(value)
|
|
64
|
+
|| isHashPayload(value)
|
|
65
|
+
|| isSchemaPayload(value)
|
|
66
|
+
|| isTimePayload(value)
|
|
67
|
+
|| isTransactionBoundWitness(value)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** Type guard that checks if a value is a valid AllowedBlockPayloadWithHashMeta. */
|
|
71
|
+
export const isAllowedBlockPayloadWithHashMeta = <T>(value: T): value is WithStorageMeta<AllowedBlockPayload & T> => {
|
|
72
|
+
return isAllowedBlockPayload(value) && isHashMeta(value)
|
|
73
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import {
|
|
2
|
+
HashZod,
|
|
3
|
+
zodAsFactory, zodIsFactory, zodToFactory,
|
|
4
|
+
} from '@xylabs/sdk-js'
|
|
5
|
+
import {
|
|
6
|
+
BoundWitnessZod,
|
|
7
|
+
WithHashMetaZod,
|
|
8
|
+
WithStorageMetaZod,
|
|
9
|
+
} from '@xyo-network/sdk-js'
|
|
10
|
+
import { z } from 'zod'
|
|
11
|
+
|
|
12
|
+
import { XL1BlockNumberZod } from '../BlockNumber/index.ts'
|
|
13
|
+
import { ChainZod } from '../chain/index.ts'
|
|
14
|
+
|
|
15
|
+
/** BlockBoundWitnessFieldsZod constant. */
|
|
16
|
+
export const BlockBoundWitnessFieldsZod = z.object({
|
|
17
|
+
block: XL1BlockNumberZod,
|
|
18
|
+
chain: ChainZod,
|
|
19
|
+
previous: HashZod.nullable(),
|
|
20
|
+
protocol: z.number().optional(),
|
|
21
|
+
step_hashes: z.array(HashZod).optional(),
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
/** BlockBoundWitnessMetaZod constant. */
|
|
25
|
+
export const BlockBoundWitnessMetaZod = z.object({ $epoch: z.number() })
|
|
26
|
+
|
|
27
|
+
/** BlockBoundWitnessZod constant. */
|
|
28
|
+
export const BlockBoundWitnessZod = z.object({
|
|
29
|
+
...BoundWitnessZod.shape,
|
|
30
|
+
...BlockBoundWitnessFieldsZod.shape,
|
|
31
|
+
...BlockBoundWitnessMetaZod.shape,
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
/** BlockBoundWitness type. */
|
|
35
|
+
export type BlockBoundWitness = z.infer<typeof BlockBoundWitnessZod>
|
|
36
|
+
|
|
37
|
+
/** Type guard that checks if a value is a valid BlockBoundWitness. */
|
|
38
|
+
export const isBlockBoundWitness = zodIsFactory(BlockBoundWitnessZod)
|
|
39
|
+
/** Converts a value to BlockBoundWitness, throwing if invalid. */
|
|
40
|
+
export const asBlockBoundWitness = zodAsFactory(BlockBoundWitnessZod, 'asBlockBoundWitness')
|
|
41
|
+
/** toBlockBoundWitness constant. */
|
|
42
|
+
export const toBlockBoundWitness = zodToFactory(BlockBoundWitnessZod, 'toBlockBoundWitness')
|
|
43
|
+
|
|
44
|
+
/** @deprecated use WithHashMetaZod(BlockBoundWitnessZod) instead */
|
|
45
|
+
export const BlockBoundWitnessWithHashMetaZod = WithHashMetaZod(BlockBoundWitnessZod)
|
|
46
|
+
|
|
47
|
+
/** @deprecated use WithHashMeta(BlockBoundWitness) instead */
|
|
48
|
+
|
|
49
|
+
/** BlockBoundWitnessWithHashMeta type. */
|
|
50
|
+
export type BlockBoundWitnessWithHashMeta = z.infer<typeof BlockBoundWitnessWithHashMetaZod>
|
|
51
|
+
|
|
52
|
+
/** Type guard that checks if a value is a valid BlockBoundWitnessWithHashMeta. */
|
|
53
|
+
export const isBlockBoundWitnessWithHashMeta = zodIsFactory(WithHashMetaZod(BlockBoundWitnessZod))
|
|
54
|
+
/** Converts a value to BlockBoundWitnessWithHashMeta, throwing if invalid. */
|
|
55
|
+
export const asBlockBoundWitnessWithHashMeta = zodAsFactory(WithHashMetaZod(BlockBoundWitnessZod), 'asBlockBoundWitnessWithHashMeta')
|
|
56
|
+
/** toBlockBoundWitnessWithHashMeta constant. */
|
|
57
|
+
export const toBlockBoundWitnessWithHashMeta = zodToFactory(WithHashMetaZod(BlockBoundWitnessZod), 'toBlockBoundWitnessWithHashMeta')
|
|
58
|
+
|
|
59
|
+
/** @deprecated use WithStorageMetaZod(BlockBoundWitnessZod) instead */
|
|
60
|
+
export const BlockBoundWitnessWithStorageMetaZod = WithStorageMetaZod(BlockBoundWitnessZod)
|
|
61
|
+
|
|
62
|
+
/** @deprecated use WithStorageMeta(BlockBoundWitness) instead */
|
|
63
|
+
|
|
64
|
+
/** BlockBoundWitnessWithStorageMeta type. */
|
|
65
|
+
export type BlockBoundWitnessWithStorageMeta = z.infer<typeof BlockBoundWitnessWithStorageMetaZod>
|
|
66
|
+
|
|
67
|
+
/** Type guard that checks if a value is a valid BlockBoundWitnessWithStorageMeta. */
|
|
68
|
+
export const isBlockBoundWitnessWithStorageMeta = zodIsFactory(WithStorageMetaZod(BlockBoundWitnessZod))
|
|
69
|
+
/** Converts a value to BlockBoundWitnessWithStorageMeta, throwing if invalid. */
|
|
70
|
+
export const asBlockBoundWitnessWithStorageMeta = zodAsFactory(WithStorageMetaZod(BlockBoundWitnessZod), 'asBlockBoundWitnessWithStorageMeta')
|
|
71
|
+
/** toBlockBoundWitnessWithStorageMeta constant. */
|
|
72
|
+
export const toBlockBoundWitnessWithStorageMeta = zodToFactory(WithStorageMetaZod(BlockBoundWitnessZod), 'toBlockBoundWitnessWithStorageMeta')
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import {
|
|
2
|
+
zodAsFactory, zodIsFactory, zodToFactory,
|
|
3
|
+
} from '@xylabs/sdk-js'
|
|
4
|
+
import {
|
|
5
|
+
PayloadZod,
|
|
6
|
+
PayloadZodLoose, WithHashMetaZod, WithStorageMetaZod,
|
|
7
|
+
} from '@xyo-network/sdk-js'
|
|
8
|
+
import { z } from 'zod'
|
|
9
|
+
|
|
10
|
+
import { BlockBoundWitnessZod } from './BlockBoundWitness.ts'
|
|
11
|
+
import { SignedBlockBoundWitnessZod } from './signed/index.ts'
|
|
12
|
+
|
|
13
|
+
/** HydratedBlockZod constant. */
|
|
14
|
+
export const HydratedBlockZod = z.tuple([
|
|
15
|
+
BlockBoundWitnessZod,
|
|
16
|
+
z.array(PayloadZodLoose),
|
|
17
|
+
])
|
|
18
|
+
|
|
19
|
+
/** Type representing a hydrated Block with resolved payloads. */
|
|
20
|
+
export type HydratedBlock = z.infer<typeof HydratedBlockZod>
|
|
21
|
+
|
|
22
|
+
/** Type guard that checks if a value is a valid HydratedBlock. */
|
|
23
|
+
export const isHydratedBlock = zodIsFactory(HydratedBlockZod)
|
|
24
|
+
/** Converts a value to HydratedBlock, throwing if invalid. */
|
|
25
|
+
export const asHydratedBlock = zodAsFactory(HydratedBlockZod, 'asHydratedBlock')
|
|
26
|
+
/** toHydratedBlock constant. */
|
|
27
|
+
export const toHydratedBlock = zodToFactory(HydratedBlockZod, 'toHydratedBlock')
|
|
28
|
+
|
|
29
|
+
/** HydratedBlockWithHashMetaZod constant. */
|
|
30
|
+
export const HydratedBlockWithHashMetaZod = z.tuple([
|
|
31
|
+
WithHashMetaZod(BlockBoundWitnessZod),
|
|
32
|
+
z.array(WithHashMetaZod(PayloadZod).loose()),
|
|
33
|
+
])
|
|
34
|
+
|
|
35
|
+
/** Type representing a hydrated BlockWithHashMeta with resolved payloads. */
|
|
36
|
+
export type HydratedBlockWithHashMeta = z.infer<typeof HydratedBlockWithHashMetaZod>
|
|
37
|
+
|
|
38
|
+
/** Type guard that checks if a value is a valid HydratedBlockWithHashMeta. */
|
|
39
|
+
export const isHydratedBlockWithHashMeta = zodIsFactory(HydratedBlockWithHashMetaZod)
|
|
40
|
+
/** Converts a value to HydratedBlockWithHashMeta, throwing if invalid. */
|
|
41
|
+
export const asHydratedBlockWithHashMeta = zodAsFactory(HydratedBlockWithHashMetaZod, 'asHydratedBlockWithHashMeta')
|
|
42
|
+
/** toHydratedBlockWithHashMeta constant. */
|
|
43
|
+
export const toHydratedBlockWithHashMeta = zodToFactory(HydratedBlockWithHashMetaZod, 'toHydratedBlockWithHashMeta')
|
|
44
|
+
|
|
45
|
+
/** HydratedBlockWithStorageMetaZod constant. */
|
|
46
|
+
export const HydratedBlockWithStorageMetaZod = z.tuple([
|
|
47
|
+
WithStorageMetaZod(BlockBoundWitnessZod),
|
|
48
|
+
z.array(WithStorageMetaZod(PayloadZod).loose()),
|
|
49
|
+
])
|
|
50
|
+
|
|
51
|
+
/** Type representing a hydrated BlockWithStorageMeta with resolved payloads. */
|
|
52
|
+
export type HydratedBlockWithStorageMeta = z.infer<typeof HydratedBlockWithStorageMetaZod>
|
|
53
|
+
|
|
54
|
+
/** Type guard that checks if a value is a valid HydratedBlockWithStorageMeta. */
|
|
55
|
+
export const isHydratedBlockWithStorageMeta = zodIsFactory(HydratedBlockWithStorageMetaZod)
|
|
56
|
+
/** Converts a value to HydratedBlockWithStorageMeta, throwing if invalid. */
|
|
57
|
+
export const asHydratedBlockWithStorageMeta = zodAsFactory(HydratedBlockWithStorageMetaZod, 'asHydratedBlockWithStorageMeta')
|
|
58
|
+
/** toHydratedBlockWithStorageMeta constant. */
|
|
59
|
+
export const toHydratedBlockWithStorageMeta = zodToFactory(HydratedBlockWithStorageMetaZod, 'toHydratedBlockWithStorageMeta')
|
|
60
|
+
|
|
61
|
+
/** SignedHydratedBlockZod constant. */
|
|
62
|
+
export const SignedHydratedBlockZod = z.tuple([
|
|
63
|
+
SignedBlockBoundWitnessZod,
|
|
64
|
+
z.array(PayloadZod.loose()),
|
|
65
|
+
])
|
|
66
|
+
|
|
67
|
+
/** Type representing a hydrated SignedBlock with resolved payloads. */
|
|
68
|
+
export type SignedHydratedBlock = z.infer<typeof SignedHydratedBlockZod>
|
|
69
|
+
|
|
70
|
+
/** Type guard that checks if a value is a valid SignedHydratedBlock. */
|
|
71
|
+
export const isSignedHydratedBlock = zodIsFactory(SignedHydratedBlockZod)
|
|
72
|
+
/** Converts a value to SignedHydratedBlock, throwing if invalid. */
|
|
73
|
+
export const asSignedHydratedBlock = zodAsFactory(SignedHydratedBlockZod, 'asSignedHydratedBlock')
|
|
74
|
+
/** toSignedHydratedBlock constant. */
|
|
75
|
+
export const toSignedHydratedBlock = zodToFactory(SignedHydratedBlockZod, 'toSignedHydratedBlock')
|
|
76
|
+
|
|
77
|
+
/** SignedHydratedBlockToJsonZod constant. */
|
|
78
|
+
export const SignedHydratedBlockToJsonZod = z.tuple([
|
|
79
|
+
SignedBlockBoundWitnessZod,
|
|
80
|
+
z.array(PayloadZod.loose()),
|
|
81
|
+
])
|
|
82
|
+
|
|
83
|
+
/** Type representing a hydrated SignedBlockToJson with resolved payloads. */
|
|
84
|
+
export type SignedHydratedBlockToJson = z.infer<typeof SignedHydratedBlockToJsonZod>
|
|
85
|
+
|
|
86
|
+
/** Type guard that checks if a value is a valid SignedHydratedBlockToJson. */
|
|
87
|
+
export const isSignedHydratedBlockToJson = zodIsFactory(SignedHydratedBlockToJsonZod)
|
|
88
|
+
/** Converts a value to SignedHydratedBlockToJson, throwing if invalid. */
|
|
89
|
+
export const asSignedHydratedBlockToJson = zodAsFactory(SignedHydratedBlockToJsonZod, 'asSignedHydratedBlockToJson')
|
|
90
|
+
/** toSignedHydratedBlockToJson constant. */
|
|
91
|
+
export const toSignedHydratedBlockToJson = zodToFactory(SignedHydratedBlockToJsonZod, 'toSignedHydratedBlockToJson')
|
|
92
|
+
|
|
93
|
+
/** SignedHydratedBlockWithHashMetaZod constant. */
|
|
94
|
+
export const SignedHydratedBlockWithHashMetaZod = z.tuple([
|
|
95
|
+
WithHashMetaZod(SignedBlockBoundWitnessZod),
|
|
96
|
+
z.array(WithHashMetaZod(PayloadZod).loose()),
|
|
97
|
+
])
|
|
98
|
+
|
|
99
|
+
/** Type representing a hydrated SignedBlockWithHashMeta with resolved payloads. */
|
|
100
|
+
export type SignedHydratedBlockWithHashMeta = z.infer<typeof SignedHydratedBlockWithHashMetaZod>
|
|
101
|
+
|
|
102
|
+
/** SignedHydratedBlockWithHashMetaishZod constant. */
|
|
103
|
+
export const SignedHydratedBlockWithHashMetaishZod = z.tuple([
|
|
104
|
+
z.union([WithHashMetaZod(SignedBlockBoundWitnessZod)]),
|
|
105
|
+
z.array(WithHashMetaZod(PayloadZod).loose()),
|
|
106
|
+
])
|
|
107
|
+
|
|
108
|
+
/** Type guard that checks if a value is a valid SignedHydratedBlockWithHashMeta. */
|
|
109
|
+
export const isSignedHydratedBlockWithHashMeta = zodIsFactory(SignedHydratedBlockWithHashMetaZod)
|
|
110
|
+
/** Converts a value to SignedHydratedBlockWithHashMeta, throwing if invalid. */
|
|
111
|
+
export const asSignedHydratedBlockWithHashMeta = zodAsFactory(SignedHydratedBlockWithHashMetaZod, 'asSignedHydratedBlockWithHashMeta')
|
|
112
|
+
|
|
113
|
+
/** toSignedHydratedBlockWithHashMeta constant. */
|
|
114
|
+
export const toSignedHydratedBlockWithHashMeta = zodToFactory(SignedHydratedBlockWithHashMetaZod, 'toSignedHydratedBlockWithHashMeta')
|
|
115
|
+
|
|
116
|
+
/** SignedHydratedBlockWithStorageMetaZod constant. */
|
|
117
|
+
export const SignedHydratedBlockWithStorageMetaZod = z.tuple([
|
|
118
|
+
WithStorageMetaZod(SignedBlockBoundWitnessZod),
|
|
119
|
+
z.array(WithStorageMetaZod(PayloadZod).loose()),
|
|
120
|
+
])
|
|
121
|
+
/** Type representing a hydrated SignedBlockWithStorageMeta with resolved payloads. */
|
|
122
|
+
export type SignedHydratedBlockWithStorageMeta = z.infer<typeof SignedHydratedBlockWithStorageMetaZod>
|
|
123
|
+
|
|
124
|
+
/** Type guard that checks if a value is a valid SignedHydratedBlockWithStorageMeta. */
|
|
125
|
+
export const isSignedHydratedBlockWithStorageMeta = zodIsFactory(SignedHydratedBlockWithStorageMetaZod)
|
|
126
|
+
/** Converts a value to SignedHydratedBlockWithStorageMeta, throwing if invalid. */
|
|
127
|
+
export const asSignedHydratedBlockWithStorageMeta = zodAsFactory(SignedHydratedBlockWithStorageMetaZod, 'asSignedHydratedBlockWithStorageMeta')
|
|
128
|
+
/** toSignedHydratedBlockWithStorageMeta constant. */
|
|
129
|
+
export const toSignedHydratedBlockWithStorageMeta = zodToFactory(SignedHydratedBlockWithStorageMetaZod, 'toSignedHydratedBlockWithStorageMeta')
|
|
130
|
+
|
|
131
|
+
/** SignedHydratedBlockWithStorageMetaishZod constant. */
|
|
132
|
+
export const SignedHydratedBlockWithStorageMetaishZod = z.tuple([
|
|
133
|
+
z.union([WithStorageMetaZod(SignedBlockBoundWitnessZod)]),
|
|
134
|
+
z.array(WithStorageMetaZod(PayloadZod).loose()),
|
|
135
|
+
])
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
zodAsFactory, zodIsFactory, zodToFactory,
|
|
3
|
+
} from '@xylabs/sdk-js'
|
|
4
|
+
import { SignedBoundWitnessZod } from '@xyo-network/sdk-js'
|
|
5
|
+
import type { z } from 'zod'
|
|
6
|
+
|
|
7
|
+
import { BlockBoundWitnessFieldsZod, BlockBoundWitnessMetaZod } from '../BlockBoundWitness.ts'
|
|
8
|
+
|
|
9
|
+
/** SignedBlockBoundWitnessZod constant. */
|
|
10
|
+
export const SignedBlockBoundWitnessZod = SignedBoundWitnessZod
|
|
11
|
+
.safeExtend(BlockBoundWitnessFieldsZod.shape)
|
|
12
|
+
.safeExtend(BlockBoundWitnessMetaZod.shape)
|
|
13
|
+
|
|
14
|
+
/** SignedBlockBoundWitness type. */
|
|
15
|
+
export type SignedBlockBoundWitness = z.infer<typeof SignedBlockBoundWitnessZod>
|
|
16
|
+
|
|
17
|
+
/** Type guard that checks if a value is a valid SignedBlockBoundWitness. */
|
|
18
|
+
export const isSignedBlockBoundWitness = zodIsFactory(SignedBlockBoundWitnessZod)
|
|
19
|
+
/** Converts a value to SignedBlockBoundWitness, throwing if invalid. */
|
|
20
|
+
export const asSignedBlockBoundWitness = zodAsFactory(SignedBlockBoundWitnessZod, 'asSignedBlockBoundWitness')
|
|
21
|
+
/** toSignedBlockBoundWitness constant. */
|
|
22
|
+
export const toSignedBlockBoundWitness = zodToFactory(SignedBlockBoundWitnessZod, 'toSignedBlockBoundWitness')
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {
|
|
2
|
+
zodAsFactory, zodIsFactory, zodToFactory,
|
|
3
|
+
} from '@xylabs/sdk-js'
|
|
4
|
+
import { PayloadBuilder, WithHashMetaZod } from '@xyo-network/sdk-js'
|
|
5
|
+
import type { z } from 'zod'
|
|
6
|
+
|
|
7
|
+
import { isSignedBlockBoundWitness, SignedBlockBoundWitnessZod } from './SignedBlockBoundWitness.ts'
|
|
8
|
+
|
|
9
|
+
/** SignedBlockBoundWitnessWithHashMetaZod constant. */
|
|
10
|
+
export const SignedBlockBoundWitnessWithHashMetaZod = WithHashMetaZod(SignedBlockBoundWitnessZod)
|
|
11
|
+
|
|
12
|
+
/** SignedBlockBoundWitnessWithHashMeta type. */
|
|
13
|
+
export type SignedBlockBoundWitnessWithHashMeta = z.infer<typeof SignedBlockBoundWitnessWithHashMetaZod>
|
|
14
|
+
|
|
15
|
+
/** Type guard that checks if a value is a valid SignedBlockBoundWitnessWithHashMeta. */
|
|
16
|
+
export const isSignedBlockBoundWitnessWithHashMeta = zodIsFactory(SignedBlockBoundWitnessWithHashMetaZod)
|
|
17
|
+
/** Converts a value to SignedBlockBoundWitnessWithHashMeta, throwing if invalid. */
|
|
18
|
+
export const asSignedBlockBoundWitnessWithHashMeta = zodAsFactory(SignedBlockBoundWitnessWithHashMetaZod, 'asSignedBlockBoundWitnessWithHashMeta')
|
|
19
|
+
|
|
20
|
+
/** SignedBlockBoundWitnessWithHashMetaishZod constant. */
|
|
21
|
+
export const SignedBlockBoundWitnessWithHashMetaishZod = SignedBlockBoundWitnessZod.transform(async (data) => {
|
|
22
|
+
if (isSignedBlockBoundWitnessWithHashMeta(data)) {
|
|
23
|
+
return data
|
|
24
|
+
}
|
|
25
|
+
if (isSignedBlockBoundWitness(data)) {
|
|
26
|
+
return await PayloadBuilder.addHashMeta(data)
|
|
27
|
+
}
|
|
28
|
+
throw new Error('Invalid SignedBlockBoundWitnessWithHashMetaish format')
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
/** SignedBlockBoundWitnessWithHashMetaish type. */
|
|
32
|
+
export type SignedBlockBoundWitnessWithHashMetaish = z.input<typeof SignedBlockBoundWitnessWithHashMetaishZod>
|
|
33
|
+
|
|
34
|
+
/** toSignedBlockBoundWitnessWithHashMeta constant. */
|
|
35
|
+
export const toSignedBlockBoundWitnessWithHashMeta = zodToFactory(SignedBlockBoundWitnessWithHashMetaZod, 'toSignedBlockBoundWitnessWithHashMeta')
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import {
|
|
2
|
+
zodAsFactory, zodIsFactory, zodToFactory,
|
|
3
|
+
} from '@xylabs/sdk-js'
|
|
4
|
+
import { PayloadBuilder, WithStorageMetaZod } from '@xyo-network/sdk-js'
|
|
5
|
+
import type { z } from 'zod'
|
|
6
|
+
|
|
7
|
+
import { isSignedBlockBoundWitness, SignedBlockBoundWitnessZod } from './SignedBlockBoundWitness.ts'
|
|
8
|
+
|
|
9
|
+
/** SignedBlockBoundWitnessWithStorageMetaZod constant. */
|
|
10
|
+
export const SignedBlockBoundWitnessWithStorageMetaZod = WithStorageMetaZod(SignedBlockBoundWitnessZod)
|
|
11
|
+
|
|
12
|
+
/** SignedBlockBoundWitnessWithStorageMeta type. */
|
|
13
|
+
export type SignedBlockBoundWitnessWithStorageMeta = z.infer<typeof SignedBlockBoundWitnessWithStorageMetaZod>
|
|
14
|
+
|
|
15
|
+
/** Type guard that checks if a value is a valid SignedBlockBoundWitnessWithStorageMeta. */
|
|
16
|
+
export const isSignedBlockBoundWitnessWithStorageMeta = zodIsFactory(SignedBlockBoundWitnessWithStorageMetaZod)
|
|
17
|
+
/** Converts a value to SignedBlockBoundWitnessWithStorageMeta, throwing if invalid. */
|
|
18
|
+
export const asSignedBlockBoundWitnessWithStorageMeta = zodAsFactory(
|
|
19
|
+
SignedBlockBoundWitnessWithStorageMetaZod,
|
|
20
|
+
'asSignedBlockBoundWitnessWithStorageMeta',
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
/** SignedBlockBoundWitnessWithStorageMetaishZod constant. */
|
|
24
|
+
export const SignedBlockBoundWitnessWithStorageMetaishZod = SignedBlockBoundWitnessZod.transform(async (data) => {
|
|
25
|
+
if (isSignedBlockBoundWitnessWithStorageMeta(data)) {
|
|
26
|
+
return data
|
|
27
|
+
}
|
|
28
|
+
if (isSignedBlockBoundWitness(data)) {
|
|
29
|
+
return await PayloadBuilder.addStorageMeta(data)
|
|
30
|
+
}
|
|
31
|
+
throw new Error('Invalid SignedBlockBoundWitnessWithStorageMetaish format')
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
/** SignedBlockBoundWitnessWithStorageMetaish type. */
|
|
35
|
+
export type SignedBlockBoundWitnessWithStorageMetaish = z.input<typeof SignedBlockBoundWitnessWithStorageMetaishZod>
|
|
36
|
+
|
|
37
|
+
/** toSignedBlockBoundWitnessWithStorageMeta constant. */
|
|
38
|
+
export const toSignedBlockBoundWitnessWithStorageMeta = zodToFactory(
|
|
39
|
+
SignedBlockBoundWitnessWithStorageMetaishZod,
|
|
40
|
+
'toSignedBlockBoundWitnessWithStorageMeta',
|
|
41
|
+
)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
zodAsFactory, zodIsFactory, zodToFactory,
|
|
3
|
+
} from '@xylabs/sdk-js'
|
|
4
|
+
import { UnsignedBoundWitnessZod } from '@xyo-network/sdk-js'
|
|
5
|
+
import type { z } from 'zod'
|
|
6
|
+
|
|
7
|
+
import { BlockBoundWitnessFieldsZod, BlockBoundWitnessMetaZod } from '../BlockBoundWitness.ts'
|
|
8
|
+
|
|
9
|
+
/** UnsignedBlockBoundWitnessZod constant. */
|
|
10
|
+
export const UnsignedBlockBoundWitnessZod = UnsignedBoundWitnessZod
|
|
11
|
+
.safeExtend(BlockBoundWitnessFieldsZod.shape)
|
|
12
|
+
.safeExtend(BlockBoundWitnessMetaZod.shape)
|
|
13
|
+
|
|
14
|
+
/** UnsignedBlockBoundWitness type. */
|
|
15
|
+
export type UnsignedBlockBoundWitness = z.infer<typeof UnsignedBlockBoundWitnessZod>
|
|
16
|
+
|
|
17
|
+
/** Type guard that checks if a value is a valid UnsignedBlockBoundWitness. */
|
|
18
|
+
export const isUnsignedBlockBoundWitness = zodIsFactory(UnsignedBlockBoundWitnessZod)
|
|
19
|
+
/** Converts a value to UnsignedBlockBoundWitness, throwing if invalid. */
|
|
20
|
+
export const asUnsignedBlockBoundWitness = zodAsFactory(UnsignedBlockBoundWitnessZod, 'asUnsignedBlockBoundWitness')
|
|
21
|
+
/** toUnsignedBlockBoundWitness constant. */
|
|
22
|
+
export const toUnsignedBlockBoundWitness = zodToFactory(UnsignedBlockBoundWitnessZod, 'toUnsignedBlockBoundWitness')
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './UnsignedBlockBoundWitness.ts'
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AddressRegEx, toAddress } from '@xylabs/sdk-js'
|
|
2
|
+
import { z } from 'zod'
|
|
3
|
+
|
|
4
|
+
import type { ChainId } from './ChainId.ts'
|
|
5
|
+
|
|
6
|
+
/** ChainZod constant. */
|
|
7
|
+
export const ChainZod = z.string().toLowerCase().regex(AddressRegEx).transform<ChainId>(v => toAddress(v) as ChainId)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Promisable } from '@xylabs/sdk-js'
|
|
2
|
+
import type { Payload } from '@xyo-network/sdk-js'
|
|
3
|
+
|
|
4
|
+
import type { HydratedBlock } from '../block/index.ts'
|
|
5
|
+
|
|
6
|
+
/** ChainAnalyzer interface. */
|
|
7
|
+
export interface ChainAnalyzer<T extends Payload = Payload> {
|
|
8
|
+
onBlock(block: HydratedBlock): Promisable<boolean>
|
|
9
|
+
result(): T
|
|
10
|
+
shouldContinue(): boolean
|
|
11
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** BlockStart interface. */
|
|
2
|
+
export interface BlockStart {
|
|
3
|
+
/**
|
|
4
|
+
* The block at which the duration starts
|
|
5
|
+
*/
|
|
6
|
+
nbf: number
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/** BlockEnd interface. */
|
|
10
|
+
export interface BlockEnd {
|
|
11
|
+
/**
|
|
12
|
+
* The block at which the duration ends
|
|
13
|
+
*/
|
|
14
|
+
exp: number
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* A optional duration referenced to block numbers
|
|
19
|
+
*/
|
|
20
|
+
export interface OptionalBlockDuration extends Partial<BlockStart>, Partial<BlockEnd> {}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* A duration referenced to block numbers
|
|
24
|
+
*/
|
|
25
|
+
export interface BlockDuration extends BlockStart, BlockEnd {}
|