@xyo-network/xl1-protocol 1.25.26 → 1.25.28
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 +7 -0
- package/dist/neutral/BlockNumber/BlockNumber.d.ts.map +1 -1
- package/dist/neutral/BlockNumber/EthBlockNumber.d.ts +7 -0
- package/dist/neutral/BlockNumber/EthBlockNumber.d.ts.map +1 -1
- package/dist/neutral/BlockNumber/Numberish.d.ts +2 -0
- package/dist/neutral/BlockNumber/Numberish.d.ts.map +1 -1
- package/dist/neutral/BlockNumber/XL1BlockNumber.d.ts +7 -0
- package/dist/neutral/BlockNumber/XL1BlockNumber.d.ts.map +1 -1
- package/dist/neutral/Initializable.d.ts +1 -0
- package/dist/neutral/Initializable.d.ts.map +1 -1
- package/dist/neutral/OpenTelemetryProviders.d.ts +1 -0
- package/dist/neutral/OpenTelemetryProviders.d.ts.map +1 -1
- package/dist/neutral/RecordKeyType.d.ts +2 -0
- package/dist/neutral/RecordKeyType.d.ts.map +1 -1
- package/dist/neutral/Step/StepHash.d.ts +2 -0
- package/dist/neutral/Step/StepHash.d.ts.map +1 -1
- package/dist/neutral/Step/StepIdentity.d.ts +4 -0
- package/dist/neutral/Step/StepIdentity.d.ts.map +1 -1
- package/dist/neutral/Step/StepSizes.d.ts +5 -0
- package/dist/neutral/Step/StepSizes.d.ts.map +1 -1
- package/dist/neutral/TransferPayload.d.ts +7 -0
- package/dist/neutral/TransferPayload.d.ts.map +1 -1
- package/dist/neutral/amount/ShiftedBigIntConfig.d.ts +1 -0
- package/dist/neutral/amount/ShiftedBigIntConfig.d.ts.map +1 -1
- 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 +2 -4
- package/dist/neutral/amount/index.d.ts.map +1 -1
- package/dist/neutral/block/AllowedBlockPayload.d.ts +7 -0
- package/dist/neutral/block/AllowedBlockPayload.d.ts.map +1 -1
- package/dist/neutral/block/BlockBoundWitness.d.ts +15 -0
- package/dist/neutral/block/BlockBoundWitness.d.ts.map +1 -1
- package/dist/neutral/block/HydratedBlock.d.ts +37 -0
- package/dist/neutral/block/HydratedBlock.d.ts.map +1 -1
- package/dist/neutral/block/signed/SignedBlockBoundWitness.d.ts +5 -0
- package/dist/neutral/block/signed/SignedBlockBoundWitness.d.ts.map +1 -1
- package/dist/neutral/block/signed/SignedBlockBoundWitnessWithHashMeta.d.ts +7 -0
- package/dist/neutral/block/signed/SignedBlockBoundWitnessWithHashMeta.d.ts.map +1 -1
- package/dist/neutral/block/signed/SignedBlockBoundWitnessWithStorageMeta.d.ts +7 -0
- package/dist/neutral/block/signed/SignedBlockBoundWitnessWithStorageMeta.d.ts.map +1 -1
- package/dist/neutral/block/unsigned/UnsignedBlockBoundWitness.d.ts +5 -0
- package/dist/neutral/block/unsigned/UnsignedBlockBoundWitness.d.ts.map +1 -1
- package/dist/neutral/chain/Chain.d.ts +1 -0
- package/dist/neutral/chain/Chain.d.ts.map +1 -1
- package/dist/neutral/chain/ChainAnalyzer.d.ts +1 -0
- package/dist/neutral/chain/ChainAnalyzer.d.ts.map +1 -1
- package/dist/neutral/chain/ChainId.d.ts +1 -0
- package/dist/neutral/chain/ChainId.d.ts.map +1 -1
- package/dist/neutral/fields/Addressable.d.ts +1 -0
- package/dist/neutral/fields/Addressable.d.ts.map +1 -1
- package/dist/neutral/fields/BlockDuration.d.ts +2 -0
- package/dist/neutral/fields/BlockDuration.d.ts.map +1 -1
- package/dist/neutral/fields/BlockNumber.d.ts +5 -0
- package/dist/neutral/fields/BlockNumber.d.ts.map +1 -1
- package/dist/neutral/index.mjs +152 -319
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/map/AsyncMap.d.ts +6 -0
- package/dist/neutral/map/AsyncMap.d.ts.map +1 -1
- package/dist/neutral/map/MapType.d.ts +7 -0
- package/dist/neutral/map/MapType.d.ts.map +1 -1
- package/dist/neutral/map/SyncMap.d.ts +6 -0
- package/dist/neutral/map/SyncMap.d.ts.map +1 -1
- package/dist/neutral/model/AccountBalance.d.ts +12 -0
- package/dist/neutral/model/AccountBalance.d.ts.map +1 -1
- package/dist/neutral/model/ArrayBuffer.d.ts +2 -0
- package/dist/neutral/model/ArrayBuffer.d.ts.map +1 -1
- package/dist/neutral/model/BlockRange/BlockRange.d.ts +10 -0
- package/dist/neutral/model/BlockRange/BlockRange.d.ts.map +1 -1
- package/dist/neutral/model/BlockRange/EthBlockRange.d.ts +10 -0
- package/dist/neutral/model/BlockRange/EthBlockRange.d.ts.map +1 -1
- package/dist/neutral/model/BlockRange/Numberish.d.ts +1 -0
- package/dist/neutral/model/BlockRange/Numberish.d.ts.map +1 -1
- package/dist/neutral/model/BlockRange/Range.d.ts +5 -0
- package/dist/neutral/model/BlockRange/Range.d.ts.map +1 -1
- package/dist/neutral/model/BlockRange/XL1BlockRange.d.ts +10 -0
- package/dist/neutral/model/BlockRange/XL1BlockRange.d.ts.map +1 -1
- package/dist/neutral/model/BlockRate.d.ts +27 -0
- package/dist/neutral/model/BlockRate.d.ts.map +1 -1
- package/dist/neutral/model/ChainQualification.d.ts +15 -0
- package/dist/neutral/model/ChainQualification.d.ts.map +1 -1
- package/dist/neutral/model/Context/BaseContext.d.ts +1 -0
- package/dist/neutral/model/Context/BaseContext.d.ts.map +1 -1
- package/dist/neutral/model/Context/BaseContext.zod.d.ts +7 -0
- package/dist/neutral/model/Context/BaseContext.zod.d.ts.map +1 -1
- package/dist/neutral/model/Context/BlockContext.d.ts +3 -0
- package/dist/neutral/model/Context/BlockContext.d.ts.map +1 -1
- package/dist/neutral/model/Context/BlockContext.zod.d.ts +3 -0
- package/dist/neutral/model/Context/BlockContext.zod.d.ts.map +1 -1
- package/dist/neutral/model/Context/CachingContext.d.ts +1 -0
- package/dist/neutral/model/Context/CachingContext.d.ts.map +1 -1
- package/dist/neutral/model/Context/CachingContext.zod.d.ts +1 -0
- package/dist/neutral/model/Context/CachingContext.zod.d.ts.map +1 -1
- package/dist/neutral/model/Context/ChainContext.d.ts +3 -0
- package/dist/neutral/model/Context/ChainContext.d.ts.map +1 -1
- package/dist/neutral/model/Context/ChainContext.zod.d.ts +3 -0
- package/dist/neutral/model/Context/ChainContext.zod.d.ts.map +1 -1
- package/dist/neutral/model/Context/HeadContext.d.ts +1 -0
- package/dist/neutral/model/Context/HeadContext.d.ts.map +1 -1
- package/dist/neutral/model/Context/HeadContext.zod.d.ts +2 -0
- package/dist/neutral/model/Context/HeadContext.zod.d.ts.map +1 -1
- package/dist/neutral/model/GatewayName.d.ts +1 -0
- package/dist/neutral/model/GatewayName.d.ts.map +1 -1
- package/dist/neutral/model/HydratedTransaction.d.ts +45 -0
- package/dist/neutral/model/HydratedTransaction.d.ts.map +1 -1
- package/dist/neutral/model/OpCodes.d.ts +1 -0
- package/dist/neutral/model/OpCodes.d.ts.map +1 -1
- package/dist/neutral/model/PayloadMap.d.ts +3 -0
- package/dist/neutral/model/PayloadMap.d.ts.map +1 -1
- package/dist/neutral/model/Permission.d.ts +6 -0
- package/dist/neutral/model/Permission.d.ts.map +1 -1
- package/dist/neutral/model/Position.d.ts +1 -0
- package/dist/neutral/model/Position.d.ts.map +1 -1
- package/dist/neutral/model/PositionId.d.ts +1 -0
- package/dist/neutral/model/PositionId.d.ts.map +1 -1
- package/dist/neutral/model/RangeMultipliers.d.ts +4 -0
- package/dist/neutral/model/RangeMultipliers.d.ts.map +1 -1
- package/dist/neutral/model/RewardShare.d.ts +1 -0
- package/dist/neutral/model/RewardShare.d.ts.map +1 -1
- package/dist/neutral/model/RewardsRangeOptions.d.ts +1 -0
- package/dist/neutral/model/RewardsRangeOptions.d.ts.map +1 -1
- package/dist/neutral/model/Sequence.d.ts +6 -0
- package/dist/neutral/model/Sequence.d.ts.map +1 -1
- package/dist/neutral/model/Stake.d.ts +3 -0
- package/dist/neutral/model/Stake.d.ts.map +1 -1
- package/dist/neutral/model/StakeShare.d.ts +1 -0
- package/dist/neutral/model/StakeShare.d.ts.map +1 -1
- package/dist/neutral/model/TimeDomain.d.ts +1 -0
- package/dist/neutral/model/TimeDomain.d.ts.map +1 -1
- package/dist/neutral/model/TransferPair.d.ts +1 -0
- package/dist/neutral/model/TransferPair.d.ts.map +1 -1
- package/dist/neutral/model/addresses.d.ts +5 -0
- package/dist/neutral/model/addresses.d.ts.map +1 -1
- package/dist/neutral/model/defaultRewardRatio.d.ts +1 -0
- package/dist/neutral/model/defaultRewardRatio.d.ts.map +1 -1
- package/dist/neutral/model/defaultTransactionFees.d.ts +1 -0
- package/dist/neutral/model/defaultTransactionFees.d.ts.map +1 -1
- package/dist/neutral/model/minTransactionFees.d.ts +1 -0
- package/dist/neutral/model/minTransactionFees.d.ts.map +1 -1
- package/dist/neutral/model/rewards.d.ts +7 -0
- package/dist/neutral/model/rewards.d.ts.map +1 -1
- package/dist/neutral/model/version.d.ts +5 -0
- package/dist/neutral/model/version.d.ts.map +1 -1
- package/dist/neutral/network/NetworkId.d.ts +2 -0
- package/dist/neutral/network/NetworkId.d.ts.map +1 -1
- package/dist/neutral/network/Status.d.ts +7 -0
- package/dist/neutral/network/Status.d.ts.map +1 -1
- package/dist/neutral/payload/StepIdentityPayload.d.ts +5 -0
- package/dist/neutral/payload/StepIdentityPayload.d.ts.map +1 -1
- package/dist/neutral/payload/elevatable/Bridge/BridgeDestinationObservation.d.ts +5 -0
- package/dist/neutral/payload/elevatable/Bridge/BridgeDestinationObservation.d.ts.map +1 -1
- package/dist/neutral/payload/elevatable/Bridge/BridgeIntent.d.ts +6 -0
- package/dist/neutral/payload/elevatable/Bridge/BridgeIntent.d.ts.map +1 -1
- package/dist/neutral/payload/elevatable/Bridge/BridgeSourceObservation.d.ts +5 -0
- package/dist/neutral/payload/elevatable/Bridge/BridgeSourceObservation.d.ts.map +1 -1
- package/dist/neutral/payload/elevatable/ChainStakeIntent.d.ts +8 -0
- package/dist/neutral/payload/elevatable/ChainStakeIntent.d.ts.map +1 -1
- package/dist/neutral/payload/elevatable/Executable.d.ts +7 -0
- package/dist/neutral/payload/elevatable/Executable.d.ts.map +1 -1
- package/dist/neutral/payload/elevatable/Hash.d.ts +7 -0
- package/dist/neutral/payload/elevatable/Hash.d.ts.map +1 -1
- package/dist/neutral/payload/elevatable/StepComplete.d.ts +5 -0
- package/dist/neutral/payload/elevatable/StepComplete.d.ts.map +1 -1
- package/dist/neutral/payload/elevatable/Time.d.ts +13 -0
- package/dist/neutral/payload/elevatable/Time.d.ts.map +1 -1
- package/dist/neutral/permissions/InvokerPermission.d.ts +2 -0
- package/dist/neutral/permissions/InvokerPermission.d.ts.map +1 -1
- package/dist/neutral/permissions/XyoPermissions.d.ts +1 -0
- package/dist/neutral/permissions/XyoPermissions.d.ts.map +1 -1
- package/dist/neutral/provider/Provider.d.ts +1 -0
- package/dist/neutral/provider/Provider.d.ts.map +1 -1
- package/dist/neutral/provider/ProviderMoniker.d.ts +4 -0
- package/dist/neutral/provider/ProviderMoniker.d.ts.map +1 -1
- package/dist/neutral/providers/DataLake/Provider.d.ts +2 -0
- package/dist/neutral/providers/DataLake/Provider.d.ts.map +1 -1
- package/dist/neutral/providers/DataLake/Runner.d.ts +4 -0
- package/dist/neutral/providers/DataLake/Runner.d.ts.map +1 -1
- package/dist/neutral/providers/DataLake/Viewer.d.ts +4 -0
- package/dist/neutral/providers/DataLake/Viewer.d.ts.map +1 -1
- package/dist/neutral/providers/TransactionHelper.d.ts +1 -0
- package/dist/neutral/providers/TransactionHelper.d.ts.map +1 -1
- package/dist/neutral/providers/XyoClient.d.ts +1 -0
- package/dist/neutral/providers/XyoClient.d.ts.map +1 -1
- package/dist/neutral/providers/XyoConnection.d.ts +3 -0
- package/dist/neutral/providers/XyoConnection.d.ts.map +1 -1
- package/dist/neutral/providers/XyoGateway.d.ts +5 -0
- package/dist/neutral/providers/XyoGateway.d.ts.map +1 -1
- package/dist/neutral/providers/XyoGatewayRunner.d.ts +6 -0
- package/dist/neutral/providers/XyoGatewayRunner.d.ts.map +1 -1
- package/dist/neutral/providers/XyoNetwork.d.ts +1 -0
- package/dist/neutral/providers/XyoNetwork.d.ts.map +1 -1
- package/dist/neutral/providers/XyoRunner.d.ts +4 -0
- package/dist/neutral/providers/XyoRunner.d.ts.map +1 -1
- package/dist/neutral/providers/signer/XyoSigner.d.ts +5 -0
- package/dist/neutral/providers/signer/XyoSigner.d.ts.map +1 -1
- package/dist/neutral/repository/Repository.d.ts +7 -0
- package/dist/neutral/repository/Repository.d.ts.map +1 -1
- package/dist/neutral/repository/TransactionReadRepository.d.ts +1 -0
- package/dist/neutral/repository/TransactionReadRepository.d.ts.map +1 -1
- package/dist/neutral/repository/TransactionRepository.d.ts +3 -0
- package/dist/neutral/repository/TransactionRepository.d.ts.map +1 -1
- package/dist/neutral/repository/TransactionRepositoryIterator.d.ts +1 -0
- package/dist/neutral/repository/TransactionRepositoryIterator.d.ts.map +1 -1
- package/dist/neutral/repository/TransactionWriteRepository.d.ts +1 -0
- package/dist/neutral/repository/TransactionWriteRepository.d.ts.map +1 -1
- package/dist/neutral/runners/Block.d.ts +4 -0
- package/dist/neutral/runners/Block.d.ts.map +1 -1
- package/dist/neutral/runners/Finalization.d.ts +4 -0
- package/dist/neutral/runners/Finalization.d.ts.map +1 -1
- package/dist/neutral/runners/Mempool.d.ts +6 -0
- package/dist/neutral/runners/Mempool.d.ts.map +1 -1
- package/dist/neutral/transaction/TransactionBoundWitness.d.ts +53 -0
- package/dist/neutral/transaction/TransactionBoundWitness.d.ts.map +1 -1
- package/dist/neutral/transaction/TransactionFees.d.ts +18 -1
- package/dist/neutral/transaction/TransactionFees.d.ts.map +1 -1
- package/dist/neutral/transaction/TransactionGasCosts.d.ts +1 -0
- package/dist/neutral/transaction/TransactionGasCosts.d.ts.map +1 -1
- package/dist/neutral/validation/block/BlockValidationFunction.d.ts +1 -0
- package/dist/neutral/validation/block/BlockValidationFunction.d.ts.map +1 -1
- package/dist/neutral/validation/block/HydratedBlockStateValidationFunction.d.ts +2 -0
- package/dist/neutral/validation/block/HydratedBlockStateValidationFunction.d.ts.map +1 -1
- package/dist/neutral/validation/block/HydratedBlockValidationFunction.d.ts +1 -0
- package/dist/neutral/validation/block/HydratedBlockValidationFunction.d.ts.map +1 -1
- package/dist/neutral/validation/block/error.d.ts +6 -0
- package/dist/neutral/validation/block/error.d.ts.map +1 -1
- package/dist/neutral/validation/boundwitness/BoundWitnessValidationFunction.d.ts +1 -0
- package/dist/neutral/validation/boundwitness/BoundWitnessValidationFunction.d.ts.map +1 -1
- package/dist/neutral/validation/boundwitness/HydratedBoundWitnessValidationFunction.d.ts +2 -0
- package/dist/neutral/validation/boundwitness/HydratedBoundWitnessValidationFunction.d.ts.map +1 -1
- package/dist/neutral/validation/boundwitness/error.d.ts +4 -0
- package/dist/neutral/validation/boundwitness/error.d.ts.map +1 -1
- package/dist/neutral/validation/error.d.ts +2 -0
- package/dist/neutral/validation/error.d.ts.map +1 -1
- package/dist/neutral/validation/payload/InBlockPayloadValidationFunction.d.ts +2 -0
- package/dist/neutral/validation/payload/InBlockPayloadValidationFunction.d.ts.map +1 -1
- package/dist/neutral/validation/payload/error.d.ts +2 -0
- package/dist/neutral/validation/payload/error.d.ts.map +1 -1
- package/dist/neutral/validation/transaction/HydratedTransactionStateValidationFunction.d.ts +1 -0
- package/dist/neutral/validation/transaction/HydratedTransactionStateValidationFunction.d.ts.map +1 -1
- package/dist/neutral/validation/transaction/HydratedTransactionValidationFunction.d.ts +1 -0
- package/dist/neutral/validation/transaction/HydratedTransactionValidationFunction.d.ts.map +1 -1
- package/dist/neutral/validation/transaction/error.d.ts +2 -0
- package/dist/neutral/validation/transaction/error.d.ts.map +1 -1
- package/dist/neutral/viewers/Block.d.ts +4 -0
- package/dist/neutral/viewers/Block.d.ts.map +1 -1
- package/dist/neutral/viewers/BlockInvalidation.d.ts +10 -0
- package/dist/neutral/viewers/BlockInvalidation.d.ts.map +1 -1
- package/dist/neutral/viewers/BlockReward.d.ts +4 -0
- package/dist/neutral/viewers/BlockReward.d.ts.map +1 -1
- package/dist/neutral/viewers/BlockValidation.d.ts +10 -0
- package/dist/neutral/viewers/BlockValidation.d.ts.map +1 -1
- package/dist/neutral/viewers/ChainContract.d.ts +4 -0
- package/dist/neutral/viewers/ChainContract.d.ts.map +1 -1
- package/dist/neutral/viewers/ChainStakeViewer.d.ts +3 -0
- package/dist/neutral/viewers/ChainStakeViewer.d.ts.map +1 -1
- package/dist/neutral/viewers/Finalization.d.ts +4 -0
- package/dist/neutral/viewers/Finalization.d.ts.map +1 -1
- package/dist/neutral/viewers/Fork.d.ts +2 -0
- package/dist/neutral/viewers/Fork.d.ts.map +1 -1
- package/dist/neutral/viewers/Mempool.d.ts +8 -0
- package/dist/neutral/viewers/Mempool.d.ts.map +1 -1
- package/dist/neutral/viewers/NetworkStake/NetworkStakeViewer.d.ts +4 -0
- package/dist/neutral/viewers/NetworkStake/NetworkStakeViewer.d.ts.map +1 -1
- package/dist/neutral/viewers/NetworkStake/Rewards/ByPositionViewer.d.ts +4 -0
- package/dist/neutral/viewers/NetworkStake/Rewards/ByPositionViewer.d.ts.map +1 -1
- package/dist/neutral/viewers/NetworkStake/Rewards/ByStakerViewer.d.ts +4 -0
- package/dist/neutral/viewers/NetworkStake/Rewards/ByStakerViewer.d.ts.map +1 -1
- package/dist/neutral/viewers/NetworkStake/Rewards/ByStepViewer.d.ts +4 -0
- package/dist/neutral/viewers/NetworkStake/Rewards/ByStepViewer.d.ts.map +1 -1
- package/dist/neutral/viewers/NetworkStake/Rewards/Options.d.ts +4 -0
- package/dist/neutral/viewers/NetworkStake/Rewards/Options.d.ts.map +1 -1
- package/dist/neutral/viewers/NetworkStake/Rewards/TotalViewer.d.ts +4 -0
- package/dist/neutral/viewers/NetworkStake/Rewards/TotalViewer.d.ts.map +1 -1
- package/dist/neutral/viewers/NetworkStake/Rewards/Viewer.d.ts +4 -0
- package/dist/neutral/viewers/NetworkStake/Rewards/Viewer.d.ts.map +1 -1
- package/dist/neutral/viewers/NetworkStake/Rewards/templates/ByIndexMethodsTemplate.d.ts +1 -0
- package/dist/neutral/viewers/NetworkStake/Rewards/templates/ByIndexMethodsTemplate.d.ts.map +1 -1
- package/dist/neutral/viewers/NetworkStake/Rewards/templates/MethodsTemplate.d.ts +1 -0
- package/dist/neutral/viewers/NetworkStake/Rewards/templates/MethodsTemplate.d.ts.map +1 -1
- package/dist/neutral/viewers/NetworkStakeStepReward.d.ts +7 -0
- package/dist/neutral/viewers/NetworkStakeStepReward.d.ts.map +1 -1
- package/dist/neutral/viewers/Stake.d.ts +8 -0
- package/dist/neutral/viewers/Stake.d.ts.map +1 -1
- package/dist/neutral/viewers/StakeEvents.d.ts +11 -0
- package/dist/neutral/viewers/StakeEvents.d.ts.map +1 -1
- package/dist/neutral/viewers/StakeIntent.d.ts +4 -0
- package/dist/neutral/viewers/StakeIntent.d.ts.map +1 -1
- package/dist/neutral/viewers/StakeTotals.d.ts +4 -0
- package/dist/neutral/viewers/StakeTotals.d.ts.map +1 -1
- package/dist/neutral/viewers/StepStake.d.ts +3 -0
- package/dist/neutral/viewers/StepStake.d.ts.map +1 -1
- package/dist/neutral/viewers/StepViewer.d.ts +7 -0
- package/dist/neutral/viewers/StepViewer.d.ts.map +1 -1
- package/dist/neutral/viewers/TimeSync.d.ts +4 -0
- package/dist/neutral/viewers/TimeSync.d.ts.map +1 -1
- package/dist/neutral/viewers/Transaction.d.ts +4 -0
- package/dist/neutral/viewers/Transaction.d.ts.map +1 -1
- package/dist/neutral/viewers/TransactionInvalidation.d.ts +10 -0
- package/dist/neutral/viewers/TransactionInvalidation.d.ts.map +1 -1
- package/dist/neutral/viewers/TransactionValidation.d.ts +10 -0
- package/dist/neutral/viewers/TransactionValidation.d.ts.map +1 -1
- package/dist/neutral/viewers/TransferBalance.d.ts +6 -0
- package/dist/neutral/viewers/TransferBalance.d.ts.map +1 -1
- package/dist/neutral/viewers/WindowedBlock.d.ts +4 -0
- package/dist/neutral/viewers/WindowedBlock.d.ts.map +1 -1
- package/dist/neutral/viewers/XyoViewer.d.ts +6 -0
- package/dist/neutral/viewers/XyoViewer.d.ts.map +1 -1
- package/dist/neutral/xl1/AttoXL1.d.ts +6 -0
- package/dist/neutral/xl1/AttoXL1.d.ts.map +1 -1
- package/dist/neutral/xl1/FemtoXL1.d.ts +6 -0
- package/dist/neutral/xl1/FemtoXL1.d.ts.map +1 -1
- package/dist/neutral/xl1/MicroXL1.d.ts +6 -0
- package/dist/neutral/xl1/MicroXL1.d.ts.map +1 -1
- package/dist/neutral/xl1/MilliXL1.d.ts +6 -0
- package/dist/neutral/xl1/MilliXL1.d.ts.map +1 -1
- package/dist/neutral/xl1/NanoXL1.d.ts +6 -0
- package/dist/neutral/xl1/NanoXL1.d.ts.map +1 -1
- package/dist/neutral/xl1/PicoXL1.d.ts +6 -0
- package/dist/neutral/xl1/PicoXL1.d.ts.map +1 -1
- package/dist/neutral/xl1/XL1.d.ts +6 -0
- package/dist/neutral/xl1/XL1.d.ts.map +1 -1
- package/dist/neutral/xl1/XL1Units.d.ts +1 -0
- package/dist/neutral/xl1/XL1Units.d.ts.map +1 -1
- package/dist/neutral/xl1/isXL1Factory.d.ts +5 -0
- package/dist/neutral/xl1/isXL1Factory.d.ts.map +1 -1
- package/dist/neutral/xl1/xl1MaxValue.d.ts +1 -0
- package/dist/neutral/xl1/xl1MaxValue.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/BlockNumber/BlockNumber.ts +7 -0
- package/src/BlockNumber/EthBlockNumber.ts +7 -0
- package/src/BlockNumber/Numberish.ts +2 -0
- package/src/BlockNumber/XL1BlockNumber.ts +7 -0
- package/src/Initializable.ts +2 -1
- package/src/OpenTelemetryProviders.ts +1 -0
- package/src/RecordKeyType.ts +4 -1
- package/src/Step/StepHash.ts +2 -1
- package/src/Step/StepIdentity.ts +4 -1
- package/src/Step/StepSizes.ts +5 -0
- package/src/TransferPayload.ts +7 -0
- package/src/amount/ShiftedBigIntConfig.ts +1 -0
- package/src/amount/XL1AmountInstance.ts +19 -0
- package/src/amount/index.ts +2 -4
- package/src/block/AllowedBlockPayload.ts +7 -0
- package/src/block/BlockBoundWitness.ts +17 -2
- package/src/block/HydratedBlock.ts +37 -0
- package/src/block/signed/SignedBlockBoundWitness.ts +5 -0
- package/src/block/signed/SignedBlockBoundWitnessWithHashMeta.ts +7 -0
- package/src/block/signed/SignedBlockBoundWitnessWithStorageMeta.ts +7 -0
- package/src/block/unsigned/UnsignedBlockBoundWitness.ts +5 -0
- package/src/chain/Chain.ts +1 -0
- package/src/chain/ChainAnalyzer.ts +1 -0
- package/src/chain/ChainId.ts +1 -0
- package/src/fields/Addressable.ts +1 -0
- package/src/fields/BlockDuration.ts +2 -0
- package/src/fields/BlockNumber.ts +5 -0
- package/src/map/AsyncMap.ts +6 -0
- package/src/map/MapType.ts +7 -0
- package/src/map/SyncMap.ts +6 -0
- package/src/model/AccountBalance.ts +12 -0
- package/src/model/ArrayBuffer.ts +2 -0
- package/src/model/BlockRange/BlockRange.ts +11 -0
- package/src/model/BlockRange/EthBlockRange.ts +11 -0
- package/src/model/BlockRange/Numberish.ts +1 -0
- package/src/model/BlockRange/Range.ts +5 -0
- package/src/model/BlockRange/XL1BlockRange.ts +11 -0
- package/src/model/BlockRate.ts +27 -0
- package/src/model/ChainQualification.ts +15 -0
- package/src/model/Context/BaseContext.ts +1 -0
- package/src/model/Context/BaseContext.zod.ts +7 -0
- package/src/model/Context/BlockContext.ts +3 -0
- package/src/model/Context/BlockContext.zod.ts +3 -0
- package/src/model/Context/CachingContext.ts +1 -0
- package/src/model/Context/CachingContext.zod.ts +1 -0
- package/src/model/Context/ChainContext.ts +3 -0
- package/src/model/Context/ChainContext.zod.ts +3 -0
- package/src/model/Context/HeadContext.ts +1 -0
- package/src/model/Context/HeadContext.zod.ts +2 -0
- package/src/model/GatewayName.ts +1 -0
- package/src/model/HydratedTransaction.ts +45 -0
- package/src/model/OpCodes.ts +1 -0
- package/src/model/PayloadMap.ts +3 -0
- package/src/model/Permission.ts +6 -0
- package/src/model/Position.ts +1 -0
- package/src/model/PositionId.ts +1 -0
- package/src/model/RangeMultipliers.ts +4 -0
- package/src/model/RewardShare.ts +1 -0
- package/src/model/RewardsRangeOptions.ts +1 -0
- package/src/model/Sequence.ts +6 -0
- package/src/model/Stake.ts +3 -0
- package/src/model/StakeShare.ts +1 -0
- package/src/model/TimeDomain.ts +1 -0
- package/src/model/TransferPair.ts +1 -0
- package/src/model/addresses.ts +5 -0
- package/src/model/defaultRewardRatio.ts +1 -0
- package/src/model/defaultTransactionFees.ts +1 -0
- package/src/model/minTransactionFees.ts +1 -0
- package/src/model/rewards.ts +7 -0
- package/src/model/version.ts +5 -0
- package/src/network/NetworkId.ts +2 -0
- package/src/network/Status.ts +7 -0
- package/src/payload/StepIdentityPayload.ts +5 -0
- package/src/payload/elevatable/Bridge/BridgeDestinationObservation.ts +5 -0
- package/src/payload/elevatable/Bridge/BridgeIntent.ts +6 -0
- package/src/payload/elevatable/Bridge/BridgeSourceObservation.ts +5 -0
- package/src/payload/elevatable/ChainStakeIntent.ts +8 -0
- package/src/payload/elevatable/Executable.ts +7 -0
- package/src/payload/elevatable/Hash.ts +7 -0
- package/src/payload/elevatable/StepComplete.ts +5 -0
- package/src/payload/elevatable/Time.ts +13 -0
- package/src/permissions/InvokerPermission.ts +2 -0
- package/src/permissions/XyoPermissions.ts +1 -0
- package/src/provider/Provider.ts +1 -0
- package/src/provider/ProviderMoniker.ts +4 -0
- package/src/providers/DataLake/Provider.ts +2 -0
- package/src/providers/DataLake/Runner.ts +4 -0
- package/src/providers/DataLake/Viewer.ts +4 -0
- package/src/providers/TransactionHelper.ts +1 -0
- package/src/providers/XyoClient.ts +1 -0
- package/src/providers/XyoConnection.ts +3 -0
- package/src/providers/XyoGateway.ts +5 -0
- package/src/providers/XyoGatewayRunner.ts +6 -0
- package/src/providers/XyoNetwork.ts +1 -0
- package/src/providers/XyoRunner.ts +4 -0
- package/src/providers/signer/XyoSigner.ts +5 -0
- package/src/repository/Repository.ts +7 -0
- package/src/repository/TransactionReadRepository.ts +1 -0
- package/src/repository/TransactionRepository.ts +3 -0
- package/src/repository/TransactionRepositoryIterator.ts +1 -0
- package/src/repository/TransactionWriteRepository.ts +1 -0
- package/src/runners/Block.ts +4 -0
- package/src/runners/Finalization.ts +4 -0
- package/src/runners/Mempool.ts +6 -0
- package/src/transaction/TransactionBoundWitness.ts +53 -0
- package/src/transaction/TransactionFees.ts +20 -2
- package/src/transaction/TransactionGasCosts.ts +1 -0
- package/src/validation/block/BlockValidationFunction.ts +1 -0
- package/src/validation/block/HydratedBlockStateValidationFunction.ts +2 -0
- package/src/validation/block/HydratedBlockValidationFunction.ts +1 -0
- package/src/validation/block/error.ts +6 -0
- package/src/validation/boundwitness/BoundWitnessValidationFunction.ts +1 -0
- package/src/validation/boundwitness/HydratedBoundWitnessValidationFunction.ts +2 -0
- package/src/validation/boundwitness/error.ts +4 -0
- package/src/validation/error.ts +2 -0
- package/src/validation/payload/InBlockPayloadValidationFunction.ts +2 -0
- package/src/validation/payload/error.ts +2 -0
- package/src/validation/transaction/HydratedTransactionStateValidationFunction.ts +1 -0
- package/src/validation/transaction/HydratedTransactionValidationFunction.ts +1 -0
- package/src/validation/transaction/error.ts +2 -0
- package/src/viewers/Block.ts +4 -0
- package/src/viewers/BlockInvalidation.ts +10 -0
- package/src/viewers/BlockReward.ts +4 -0
- package/src/viewers/BlockValidation.ts +10 -0
- package/src/viewers/ChainContract.ts +4 -0
- package/src/viewers/ChainStakeViewer.ts +3 -0
- package/src/viewers/Finalization.ts +4 -0
- package/src/viewers/Fork.ts +2 -0
- package/src/viewers/Mempool.ts +8 -0
- package/src/viewers/NetworkStake/NetworkStakeViewer.ts +4 -0
- package/src/viewers/NetworkStake/Rewards/ByPositionViewer.ts +4 -0
- package/src/viewers/NetworkStake/Rewards/ByStakerViewer.ts +4 -0
- package/src/viewers/NetworkStake/Rewards/ByStepViewer.ts +4 -0
- package/src/viewers/NetworkStake/Rewards/Options.ts +4 -0
- package/src/viewers/NetworkStake/Rewards/TotalViewer.ts +4 -0
- package/src/viewers/NetworkStake/Rewards/Viewer.ts +4 -0
- package/src/viewers/NetworkStake/Rewards/templates/ByIndexMethodsTemplate.ts +1 -0
- package/src/viewers/NetworkStake/Rewards/templates/MethodsTemplate.ts +1 -0
- package/src/viewers/NetworkStakeStepReward.ts +7 -0
- package/src/viewers/Stake.ts +8 -0
- package/src/viewers/StakeEvents.ts +11 -0
- package/src/viewers/StakeIntent.ts +4 -0
- package/src/viewers/StakeTotals.ts +4 -0
- package/src/viewers/StepStake.ts +3 -0
- package/src/viewers/StepViewer.ts +7 -0
- package/src/viewers/TimeSync.ts +4 -0
- package/src/viewers/Transaction.ts +4 -0
- package/src/viewers/TransactionInvalidation.ts +10 -0
- package/src/viewers/TransactionValidation.ts +10 -0
- package/src/viewers/TransferBalance.ts +6 -0
- package/src/viewers/WindowedBlock.ts +4 -0
- package/src/viewers/XyoViewer.ts +6 -0
- package/src/xl1/AttoXL1.ts +6 -0
- package/src/xl1/FemtoXL1.ts +6 -0
- package/src/xl1/MicroXL1.ts +6 -0
- package/src/xl1/MilliXL1.ts +6 -0
- package/src/xl1/NanoXL1.ts +6 -0
- package/src/xl1/PicoXL1.ts +6 -0
- package/src/xl1/XL1.ts +6 -0
- package/src/xl1/XL1Units.ts +1 -0
- package/src/xl1/isXL1Factory.ts +5 -0
- package/src/xl1/xl1MaxValue.ts +1 -0
- package/dist/neutral/amount/ShiftedBigInt.d.ts +0 -16
- package/dist/neutral/amount/ShiftedBigInt.d.ts.map +0 -1
- package/dist/neutral/amount/XL1Amount.d.ts +0 -37
- package/dist/neutral/amount/XL1Amount.d.ts.map +0 -1
- package/dist/neutral/amount/splitOnDecimal.d.ts +0 -2
- package/dist/neutral/amount/splitOnDecimal.d.ts.map +0 -1
- package/dist/neutral/amount/splitOnDecimalToString.d.ts +0 -2
- package/dist/neutral/amount/splitOnDecimalToString.d.ts.map +0 -1
- package/src/amount/ShiftedBigInt.ts +0 -71
- package/src/amount/XL1Amount.ts +0 -124
- package/src/amount/splitOnDecimal.ts +0 -5
- package/src/amount/splitOnDecimalToString.ts +0 -39
|
@@ -6,13 +6,17 @@ import type { BlockViewerMethods } from './Block.ts'
|
|
|
6
6
|
|
|
7
7
|
type ExtendableBlockViewerMethods = Omit<BlockViewerMethods, 'rate' | 'stepSizeRate' | 'timeDurationRate'>
|
|
8
8
|
|
|
9
|
+
/** WindowedBlockViewerMethods interface. */
|
|
9
10
|
export interface WindowedBlockViewerMethods extends ExtendableBlockViewerMethods {
|
|
10
11
|
blocksByTransactionHashes(hashes: Hash[]): Promisable<HydratedBlockWithHashMeta[]>
|
|
11
12
|
}
|
|
12
13
|
|
|
14
|
+
/** Moniker identifier for the WindowedBlockViewer provider. */
|
|
13
15
|
export const WindowedBlockViewerMoniker = 'WindowedBlockViewer' as const
|
|
16
|
+
/** Type literal for the WindowedBlockViewer provider moniker. */
|
|
14
17
|
export type WindowedBlockViewerMoniker = typeof WindowedBlockViewerMoniker
|
|
15
18
|
|
|
19
|
+
/** Viewer interface for reading WindowedBlock data. */
|
|
16
20
|
export interface WindowedBlockViewer<TMoniker extends ProviderMoniker = WindowedBlockViewerMoniker> extends WindowedBlockViewerMethods, Provider<TMoniker> {
|
|
17
21
|
blockByTransactionHash(hash: Hash): Promisable<HydratedBlockWithHashMeta | null>
|
|
18
22
|
}
|
package/src/viewers/XyoViewer.ts
CHANGED
|
@@ -16,6 +16,7 @@ import type { StepViewer } from './StepViewer.ts'
|
|
|
16
16
|
import type { TimeSyncViewer } from './TimeSync.ts'
|
|
17
17
|
import type { TransactionViewer, TransactionViewerMethods } from './Transaction.ts'
|
|
18
18
|
|
|
19
|
+
/** XyoViewerMethods interface. */
|
|
19
20
|
export interface XyoViewerMethods extends
|
|
20
21
|
NetworkStakeStepRewardViewerMethods, BlockViewerMethods,
|
|
21
22
|
Omit<TransactionViewerMethods, 'byHash'>, Omit<
|
|
@@ -28,13 +29,17 @@ export interface XyoViewerMethods extends
|
|
|
28
29
|
accountBalanceHistory(address: Address, config?: ChainQualifiedConfig): Promisable<AccountBalanceHistoryItem[]>
|
|
29
30
|
}
|
|
30
31
|
|
|
32
|
+
/** XyoViewerMethodsV2 interface. */
|
|
31
33
|
export interface XyoViewerMethodsV2 {
|
|
32
34
|
|
|
33
35
|
}
|
|
34
36
|
|
|
37
|
+
/** Moniker identifier for the XyoViewer provider. */
|
|
35
38
|
export const XyoViewerMoniker = 'XyoViewer' as const
|
|
39
|
+
/** Type literal for the XyoViewer provider moniker. */
|
|
36
40
|
export type XyoViewerMoniker = typeof XyoViewerMoniker
|
|
37
41
|
|
|
42
|
+
/** Viewer interface for reading Xyo data. */
|
|
38
43
|
export interface XyoViewer extends Omit<BlockViewer, 'moniker'>, XyoViewerMethods,
|
|
39
44
|
Omit<
|
|
40
45
|
StakeViewerMethods, 'moniker' | 'minWithdrawalBlocks' | 'rewardsContract' | 'stakingTokenAddress' | 'active'
|
|
@@ -53,6 +58,7 @@ export interface XyoViewer extends Omit<BlockViewer, 'moniker'>, XyoViewerMethod
|
|
|
53
58
|
transaction: TransactionViewer
|
|
54
59
|
}
|
|
55
60
|
|
|
61
|
+
/** XyoViewerV2 interface. */
|
|
56
62
|
export interface XyoViewerV2 extends XyoViewerMethodsV2, Provider<XyoViewerMoniker> {
|
|
57
63
|
account: {
|
|
58
64
|
balance: AccountBalanceViewer
|
package/src/xl1/AttoXL1.ts
CHANGED
|
@@ -4,10 +4,16 @@ import {
|
|
|
4
4
|
import { xl1MaxValue } from './xl1MaxValue.ts'
|
|
5
5
|
import { XL1Places } from './XL1Units.ts'
|
|
6
6
|
|
|
7
|
+
/** Maximum value for the AttoXL1 branded type. */
|
|
7
8
|
export const AttoXL1MaxValue = xl1MaxValue(XL1Places.atto)
|
|
9
|
+
/** AttoXL1 type. */
|
|
8
10
|
export type AttoXL1 = bigint & { readonly _tag: 'AttoXL1' }
|
|
11
|
+
/** Type guard that checks if a value is a valid AttoXL1. */
|
|
9
12
|
export const isAttoXL1 = isXL1Factory<AttoXL1>(XL1Places.atto)
|
|
13
|
+
/** Converts a value to AttoXL1, throwing if invalid. */
|
|
10
14
|
export const asAttoXL1 = asXL1Factory<AttoXL1>(XL1Places.atto)
|
|
15
|
+
/** Converts a bigint value to AttoXL1 without validation. */
|
|
11
16
|
export const toAttoXL1 = toXL1Factory<AttoXL1>(XL1Places.atto)
|
|
12
17
|
|
|
18
|
+
/** Shorthand alias for asAttoXL1. */
|
|
13
19
|
export const AttoXL1 = asAttoXL1
|
package/src/xl1/FemtoXL1.ts
CHANGED
|
@@ -4,11 +4,17 @@ import {
|
|
|
4
4
|
import { xl1MaxValue } from './xl1MaxValue.ts'
|
|
5
5
|
import { XL1Places } from './XL1Units.ts'
|
|
6
6
|
|
|
7
|
+
/** Maximum value for the FemtoXL1 branded type. */
|
|
7
8
|
export const FemtoXL1MaxValue = xl1MaxValue(XL1Places.femto)
|
|
9
|
+
/** FemtoXL1 type. */
|
|
8
10
|
export type FemtoXL1 = bigint & { readonly _tag: 'FemtoXL1' }
|
|
11
|
+
/** Type guard that checks if a value is a valid FemtoXL1. */
|
|
9
12
|
export const isFemtoXL1 = isXL1Factory<FemtoXL1>(XL1Places.femto)
|
|
13
|
+
/** Converts a value to FemtoXL1, throwing if invalid. */
|
|
10
14
|
export const asFemtoXL1 = asXL1Factory<FemtoXL1>(XL1Places.femto)
|
|
11
15
|
|
|
16
|
+
/** Converts a bigint value to FemtoXL1 without validation. */
|
|
12
17
|
export const toFemtoXL1 = toXL1Factory<FemtoXL1>(XL1Places.femto)
|
|
13
18
|
|
|
19
|
+
/** Shorthand alias for asFemtoXL1. */
|
|
14
20
|
export const FemtoXL1 = asFemtoXL1
|
package/src/xl1/MicroXL1.ts
CHANGED
|
@@ -4,11 +4,17 @@ import {
|
|
|
4
4
|
import { xl1MaxValue } from './xl1MaxValue.ts'
|
|
5
5
|
import { XL1Places } from './XL1Units.ts'
|
|
6
6
|
|
|
7
|
+
/** Maximum value for the MicroXL1 branded type. */
|
|
7
8
|
export const MicroXL1MaxValue = xl1MaxValue(XL1Places.micro)
|
|
9
|
+
/** MicroXL1 type. */
|
|
8
10
|
export type MicroXL1 = bigint & { readonly _tag: 'MicroXL1' }
|
|
11
|
+
/** Type guard that checks if a value is a valid MicroXL1. */
|
|
9
12
|
export const isMicroXL1 = isXL1Factory<MicroXL1>(XL1Places.micro)
|
|
13
|
+
/** Converts a value to MicroXL1, throwing if invalid. */
|
|
10
14
|
export const asMicroXL1 = asXL1Factory<MicroXL1>(XL1Places.micro)
|
|
11
15
|
|
|
16
|
+
/** Converts a bigint value to MicroXL1 without validation. */
|
|
12
17
|
export const toMicroXL1 = toXL1Factory<MicroXL1>(XL1Places.micro)
|
|
13
18
|
|
|
19
|
+
/** Shorthand alias for asMicroXL1. */
|
|
14
20
|
export const MicroXL1 = asMicroXL1
|
package/src/xl1/MilliXL1.ts
CHANGED
|
@@ -4,11 +4,17 @@ import {
|
|
|
4
4
|
import { xl1MaxValue } from './xl1MaxValue.ts'
|
|
5
5
|
import { XL1Places } from './XL1Units.ts'
|
|
6
6
|
|
|
7
|
+
/** Maximum value for the MilliXL1 branded type. */
|
|
7
8
|
export const MilliXL1MaxValue = xl1MaxValue(XL1Places.milli)
|
|
9
|
+
/** MilliXL1 type. */
|
|
8
10
|
export type MilliXL1 = bigint & { readonly _tag: 'MilliXL1' }
|
|
11
|
+
/** Type guard that checks if a value is a valid MilliXL1. */
|
|
9
12
|
export const isMilliXL1 = isXL1Factory<MilliXL1>(XL1Places.milli)
|
|
13
|
+
/** Converts a value to MilliXL1, throwing if invalid. */
|
|
10
14
|
export const asMilliXL1 = asXL1Factory<MilliXL1>(XL1Places.milli)
|
|
11
15
|
|
|
16
|
+
/** Converts a bigint value to MilliXL1 without validation. */
|
|
12
17
|
export const toMilliXL1 = toXL1Factory<MilliXL1>(XL1Places.milli)
|
|
13
18
|
|
|
19
|
+
/** Shorthand alias for asMilliXL1. */
|
|
14
20
|
export const MilliXL1 = asMilliXL1
|
package/src/xl1/NanoXL1.ts
CHANGED
|
@@ -4,11 +4,17 @@ import {
|
|
|
4
4
|
import { xl1MaxValue } from './xl1MaxValue.ts'
|
|
5
5
|
import { XL1Places } from './XL1Units.ts'
|
|
6
6
|
|
|
7
|
+
/** Maximum value for the NanoXL1 branded type. */
|
|
7
8
|
export const NanoXL1MaxValue = xl1MaxValue(XL1Places.nano)
|
|
9
|
+
/** NanoXL1 type. */
|
|
8
10
|
export type NanoXL1 = bigint & { readonly _tag: 'NanoXL1' }
|
|
11
|
+
/** Type guard that checks if a value is a valid NanoXL1. */
|
|
9
12
|
export const isNanoXL1 = isXL1Factory<NanoXL1>(XL1Places.nano)
|
|
13
|
+
/** Converts a value to NanoXL1, throwing if invalid. */
|
|
10
14
|
export const asNanoXL1 = asXL1Factory<NanoXL1>(XL1Places.nano)
|
|
11
15
|
|
|
16
|
+
/** Converts a bigint value to NanoXL1 without validation. */
|
|
12
17
|
export const toNanoXL1 = toXL1Factory<NanoXL1>(XL1Places.nano)
|
|
13
18
|
|
|
19
|
+
/** Shorthand alias for asNanoXL1. */
|
|
14
20
|
export const NanoXL1 = asNanoXL1
|
package/src/xl1/PicoXL1.ts
CHANGED
|
@@ -4,11 +4,17 @@ import {
|
|
|
4
4
|
import { xl1MaxValue } from './xl1MaxValue.ts'
|
|
5
5
|
import { XL1Places } from './XL1Units.ts'
|
|
6
6
|
|
|
7
|
+
/** PicoXL1MaxValue constant. */
|
|
7
8
|
export const PicoXL1MaxValue = xl1MaxValue(XL1Places.pico)
|
|
9
|
+
/** PicoXL1 type. */
|
|
8
10
|
export type PicoXL1 = bigint & { readonly _tag: 'PicoXL1' }
|
|
11
|
+
/** Type guard that checks if a value is a valid PicoXL1. */
|
|
9
12
|
export const isPicoXL1 = isXL1Factory<PicoXL1>(XL1Places.pico)
|
|
13
|
+
/** Converts a value to PicoXL1, throwing if invalid. */
|
|
10
14
|
export const asPicoXL1 = asXL1Factory<PicoXL1>(XL1Places.pico)
|
|
11
15
|
|
|
16
|
+
/** toPicoXL1 constant. */
|
|
12
17
|
export const toPicoXL1 = toXL1Factory<PicoXL1>(XL1Places.pico)
|
|
13
18
|
|
|
19
|
+
/** PicoXL1 constant. */
|
|
14
20
|
export const PicoXL1 = asPicoXL1
|
package/src/xl1/XL1.ts
CHANGED
|
@@ -4,11 +4,17 @@ import {
|
|
|
4
4
|
import { xl1MaxValue } from './xl1MaxValue.ts'
|
|
5
5
|
import { XL1Places } from './XL1Units.ts'
|
|
6
6
|
|
|
7
|
+
/** XL1MaxValue constant. */
|
|
7
8
|
export const XL1MaxValue = xl1MaxValue(XL1Places.xl1)
|
|
9
|
+
/** XL1 type. */
|
|
8
10
|
export type XL1 = bigint & { readonly _tag: 'XL1' }
|
|
11
|
+
/** Type guard that checks if a value is a valid XL1. */
|
|
9
12
|
export const isXL1 = isXL1Factory<XL1>(XL1Places.xl1)
|
|
13
|
+
/** Converts a value to XL1, throwing if invalid. */
|
|
10
14
|
export const asXL1 = asXL1Factory<XL1>(XL1Places.xl1)
|
|
11
15
|
|
|
16
|
+
/** toXL1 constant. */
|
|
12
17
|
export const toXL1 = toXL1Factory<XL1>(XL1Places.xl1)
|
|
13
18
|
|
|
19
|
+
/** XL1 constant. */
|
|
14
20
|
export const XL1 = asXL1
|
package/src/xl1/XL1Units.ts
CHANGED
package/src/xl1/isXL1Factory.ts
CHANGED
|
@@ -2,11 +2,13 @@ import { z } from 'zod'
|
|
|
2
2
|
|
|
3
3
|
import { xl1MaxValue } from './xl1MaxValue.ts'
|
|
4
4
|
|
|
5
|
+
/** Type guard that checks if a value is a valid XL1Factory. */
|
|
5
6
|
export const isXL1Factory = <T extends bigint>(places: bigint) => (val: unknown): val is T => {
|
|
6
7
|
if (typeof val !== 'bigint') return false
|
|
7
8
|
return val >= 0n && val <= xl1MaxValue(places)
|
|
8
9
|
}
|
|
9
10
|
|
|
11
|
+
/** Creates a Zod schema factory for XL1 branded bigint types. */
|
|
10
12
|
export const XL1ZodFactory = <T extends bigint>(places: bigint, name: string) => {
|
|
11
13
|
const is = isXL1Factory<T>(places)
|
|
12
14
|
const message = `Invalid value for ${name}, must be between 0 and ${xl1MaxValue(places)}`
|
|
@@ -19,6 +21,7 @@ export const XL1ZodFactory = <T extends bigint>(places: bigint, name: string) =>
|
|
|
19
21
|
)
|
|
20
22
|
}
|
|
21
23
|
|
|
24
|
+
/** Creates a Zod transform factory that converts values between XL1 unit types. */
|
|
22
25
|
export const XL1TransformZodFactory = <T extends bigint>(places: bigint, name: string) => {
|
|
23
26
|
const is = isXL1Factory<T>(places)
|
|
24
27
|
const message = `Invalid value for ${name}, must be between 0 and ${xl1MaxValue(places)}`
|
|
@@ -31,6 +34,7 @@ export const XL1TransformZodFactory = <T extends bigint>(places: bigint, name: s
|
|
|
31
34
|
)
|
|
32
35
|
}
|
|
33
36
|
|
|
37
|
+
/** Converts a value to XL1Factory, throwing if invalid. */
|
|
34
38
|
export const asXL1Factory = <T extends bigint>(places: bigint) => {
|
|
35
39
|
const zod = XL1ZodFactory<T>(places, 'local')
|
|
36
40
|
return (val: unknown): T => {
|
|
@@ -42,6 +46,7 @@ export const asXL1Factory = <T extends bigint>(places: bigint) => {
|
|
|
42
46
|
}
|
|
43
47
|
}
|
|
44
48
|
|
|
49
|
+
/** Creates a factory function that converts bigint values to a specific XL1 branded type. */
|
|
45
50
|
export const toXL1Factory = <T extends bigint>(places: bigint) => {
|
|
46
51
|
const zod = XL1TransformZodFactory<T>(places, 'local')
|
|
47
52
|
return (val: unknown): T | undefined => {
|
package/src/xl1/xl1MaxValue.ts
CHANGED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { ShiftedBigIntConfig } from './ShiftedBigIntConfig.ts';
|
|
2
|
-
export declare class ShiftedBigInt {
|
|
3
|
-
static readonly defaultConfig: ShiftedBigIntConfig;
|
|
4
|
-
config: ShiftedBigIntConfig;
|
|
5
|
-
value: bigint;
|
|
6
|
-
constructor(value: bigint | ShiftedBigInt, config?: Partial<ShiftedBigIntConfig>);
|
|
7
|
-
get locale(): Intl.LocalesArgument;
|
|
8
|
-
get maxCharacters(): number;
|
|
9
|
-
get maxDecimal(): number;
|
|
10
|
-
get minDecimals(): number;
|
|
11
|
-
get places(): number;
|
|
12
|
-
toFullString(): string;
|
|
13
|
-
toShortString(): string;
|
|
14
|
-
toString(): string;
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=ShiftedBigInt.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ShiftedBigInt.d.ts","sourceRoot":"","sources":["../../../src/amount/ShiftedBigInt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAGnE,qBAAa,aAAa;IACxB,MAAM,CAAC,QAAQ,CAAC,aAAa,EAAE,mBAAmB,CAMjD;IAED,MAAM,EAAE,mBAAmB,CAAA;IAC3B,KAAK,EAAE,MAAM,CAAA;gBAGX,KAAK,EAAE,MAAM,GAAG,aAAa,EAC7B,MAAM,GAAE,OAAO,CAAC,mBAAmB,CAAM;IAQ3C,IAAI,MAAM,IAAI,IAAI,CAAC,eAAe,CAEjC;IAED,IAAI,aAAa,IAAI,MAAM,CAE1B;IAED,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED,IAAI,WAAW,IAAI,MAAM,CAExB;IAED,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,YAAY,IAAI,MAAM;IAWtB,aAAa,IAAI,MAAM;IAWvB,QAAQ,IAAI,MAAM;CAGnB"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { AttoXL1, FemtoXL1, MicroXL1, MilliXL1, NanoXL1, PicoXL1, XL1 } from '../xl1/index.ts';
|
|
2
|
-
import type { ShiftedBigIntConfig } from './ShiftedBigIntConfig.ts';
|
|
3
|
-
export interface XL1AmountInstance {
|
|
4
|
-
value: AttoXL1;
|
|
5
|
-
to(places: bigint | number): bigint;
|
|
6
|
-
milli: MilliXL1;
|
|
7
|
-
micro: MicroXL1;
|
|
8
|
-
nano: NanoXL1;
|
|
9
|
-
pico: PicoXL1;
|
|
10
|
-
femto: FemtoXL1;
|
|
11
|
-
atto: AttoXL1;
|
|
12
|
-
xl1: XL1;
|
|
13
|
-
toString(places: number, config: Partial<ShiftedBigIntConfig>): string;
|
|
14
|
-
}
|
|
15
|
-
export declare class XL1Amount implements XL1AmountInstance {
|
|
16
|
-
value: AttoXL1;
|
|
17
|
-
private locale;
|
|
18
|
-
constructor(value: bigint, locale?: Intl.LocalesArgument);
|
|
19
|
-
static from(value: bigint, places?: bigint): XL1Amount;
|
|
20
|
-
static fromMilli(value: MilliXL1): XL1Amount;
|
|
21
|
-
static fromMicro(value: MicroXL1): XL1Amount;
|
|
22
|
-
static fromNano(value: NanoXL1): XL1Amount;
|
|
23
|
-
static fromPico(value: PicoXL1): XL1Amount;
|
|
24
|
-
static fromFemto(value: FemtoXL1): XL1Amount;
|
|
25
|
-
static fromAtto(value: AttoXL1): XL1Amount;
|
|
26
|
-
static fromXL1(value: XL1): XL1Amount;
|
|
27
|
-
to(places?: number | bigint): bigint;
|
|
28
|
-
get milli(): MilliXL1;
|
|
29
|
-
get micro(): MicroXL1;
|
|
30
|
-
get nano(): NanoXL1;
|
|
31
|
-
get pico(): PicoXL1;
|
|
32
|
-
get femto(): FemtoXL1;
|
|
33
|
-
get atto(): AttoXL1;
|
|
34
|
-
get xl1(): XL1;
|
|
35
|
-
toString(places?: number, config?: Partial<ShiftedBigIntConfig>): string;
|
|
36
|
-
}
|
|
37
|
-
//# sourceMappingURL=XL1Amount.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"XL1Amount.d.ts","sourceRoot":"","sources":["../../../src/amount/XL1Amount.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAE7D,MAAM,iBAAiB,CAAA;AAExB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAKnE,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,OAAO,CAAA;IAEd,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAA;IAEnC,KAAK,EAAE,QAAQ,CAAA;IAEf,KAAK,EAAE,QAAQ,CAAA;IAEf,IAAI,EAAE,OAAO,CAAA;IAEb,IAAI,EAAE,OAAO,CAAA;IAEb,KAAK,EAAE,QAAQ,CAAA;IAEf,IAAI,EAAE,OAAO,CAAA;IAEb,GAAG,EAAE,GAAG,CAAA;IAER,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,mBAAmB,CAAC,GAAG,MAAM,CAAA;CACvE;AAED,qBAAa,SAAU,YAAW,iBAAiB;IACjD,KAAK,EAAE,OAAO,CAAA;IACd,OAAO,CAAC,MAAM,CAAsB;gBAExB,KAAK,EAAE,MAAM,EAAE,MAAM,GAAE,IAAI,CAAC,eAAyB;IAKjE,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,GAAE,MAAuB;IAK1D,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,QAAQ;IAIhC,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,QAAQ;IAIhC,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO;IAI9B,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO;IAI9B,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,QAAQ;IAIhC,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO;IAI9B,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG;IAIzB,EAAE,CAAC,MAAM,GAAE,MAAM,GAAG,MAAuB;IAI3C,IAAI,KAAK,aAER;IAED,IAAI,KAAK,aAER;IAED,IAAI,IAAI,YAEP;IAED,IAAI,IAAI,YAEP;IAED,IAAI,KAAK,aAER;IAED,IAAI,IAAI,YAEP;IAED,IAAI,GAAG,QAEN;IAED,QAAQ,CAAC,MAAM,GAAE,MAA+B,EAAE,MAAM,GAAE,OAAO,CAAC,mBAAmB,CAAM,GAAG,MAAM;CAcrG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"splitOnDecimal.d.ts","sourceRoot":"","sources":["../../../src/amount/splitOnDecimal.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,GAAI,OAAO,MAAM,EAAE,eAAW,KAAG,CAAC,MAAM,EAAE,MAAM,CAI1E,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"splitOnDecimalToString.d.ts","sourceRoot":"","sources":["../../../src/amount/splitOnDecimalToString.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,sBAAsB,GACjC,OAAO,MAAM,EACb,eAAW,EACX,mBAAmB,EACnB,sBAAiB,EACjB,oBAAe,EACf,SAAQ,IAAI,CAAC,eAAyB,KACrC,MA6BF,CAAA"}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import type { ShiftedBigIntConfig } from './ShiftedBigIntConfig.ts'
|
|
2
|
-
import { splitOnDecimalToString } from './splitOnDecimalToString.ts'
|
|
3
|
-
|
|
4
|
-
export class ShiftedBigInt {
|
|
5
|
-
static readonly defaultConfig: ShiftedBigIntConfig = {
|
|
6
|
-
places: 18,
|
|
7
|
-
maxDecimal: 18,
|
|
8
|
-
maxCharacters: 9,
|
|
9
|
-
minDecimals: 1,
|
|
10
|
-
locale: 'en-US',
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
config: ShiftedBigIntConfig
|
|
14
|
-
value: bigint
|
|
15
|
-
|
|
16
|
-
constructor(
|
|
17
|
-
value: bigint | ShiftedBigInt,
|
|
18
|
-
config: Partial<ShiftedBigIntConfig> = {},
|
|
19
|
-
) {
|
|
20
|
-
this.value = typeof value === 'bigint' ? value : value.value
|
|
21
|
-
this.config = {
|
|
22
|
-
...ShiftedBigInt.defaultConfig, ...(typeof value === 'bigint' ? {} : value.config), ...config,
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
get locale(): Intl.LocalesArgument {
|
|
27
|
-
return this.config.locale ?? 'en-US'
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
get maxCharacters(): number {
|
|
31
|
-
return this.config.maxCharacters ?? 9
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
get maxDecimal(): number {
|
|
35
|
-
return this.config.maxDecimal ?? this.places
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
get minDecimals(): number {
|
|
39
|
-
return this.config.minDecimals ?? 1
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
get places(): number {
|
|
43
|
-
return this.config.places ?? 18
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
toFullString(): string {
|
|
47
|
-
return splitOnDecimalToString(
|
|
48
|
-
this.value,
|
|
49
|
-
this.places,
|
|
50
|
-
this.places,
|
|
51
|
-
Infinity,
|
|
52
|
-
this.places,
|
|
53
|
-
this.locale,
|
|
54
|
-
)
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
toShortString(): string {
|
|
58
|
-
return splitOnDecimalToString(
|
|
59
|
-
this.value,
|
|
60
|
-
this.places,
|
|
61
|
-
this.maxDecimal,
|
|
62
|
-
this.maxCharacters,
|
|
63
|
-
this.minDecimals,
|
|
64
|
-
this.locale,
|
|
65
|
-
)
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
toString(): string {
|
|
69
|
-
return this.toFullString()
|
|
70
|
-
}
|
|
71
|
-
}
|
package/src/amount/XL1Amount.ts
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/member-ordering */
|
|
2
|
-
import { assertEx } from '@xylabs/sdk-js'
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
AttoXL1, FemtoXL1, MicroXL1, MilliXL1, NanoXL1, PicoXL1, XL1,
|
|
6
|
-
XL1Places,
|
|
7
|
-
} from '../xl1/index.ts'
|
|
8
|
-
import { ShiftedBigInt } from './ShiftedBigInt.ts'
|
|
9
|
-
import type { ShiftedBigIntConfig } from './ShiftedBigIntConfig.ts'
|
|
10
|
-
|
|
11
|
-
const MAX_XL1_AMOUNT = 2n ** 256n - 1n
|
|
12
|
-
const allowedPlaces = Object.values(XL1Places)
|
|
13
|
-
|
|
14
|
-
export interface XL1AmountInstance {
|
|
15
|
-
value: AttoXL1
|
|
16
|
-
|
|
17
|
-
to(places: bigint | number): bigint
|
|
18
|
-
|
|
19
|
-
milli: MilliXL1
|
|
20
|
-
|
|
21
|
-
micro: MicroXL1
|
|
22
|
-
|
|
23
|
-
nano: NanoXL1
|
|
24
|
-
|
|
25
|
-
pico: PicoXL1
|
|
26
|
-
|
|
27
|
-
femto: FemtoXL1
|
|
28
|
-
|
|
29
|
-
atto: AttoXL1
|
|
30
|
-
|
|
31
|
-
xl1: XL1
|
|
32
|
-
|
|
33
|
-
toString(places: number, config: Partial<ShiftedBigIntConfig>): string
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export class XL1Amount implements XL1AmountInstance {
|
|
37
|
-
value: AttoXL1
|
|
38
|
-
private locale: Intl.LocalesArgument
|
|
39
|
-
|
|
40
|
-
constructor(value: bigint, locale: Intl.LocalesArgument = 'en-US') {
|
|
41
|
-
this.locale = locale
|
|
42
|
-
this.value = AttoXL1(value > MAX_XL1_AMOUNT ? MAX_XL1_AMOUNT : value < 0n ? 0n : value)
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
static from(value: bigint, places: bigint = XL1Places.atto) {
|
|
46
|
-
assertEx(allowedPlaces.includes(places), () => `Invalid conversion places (${places} not in ${allowedPlaces})`)
|
|
47
|
-
return new XL1Amount(value * 10n ** BigInt(places))
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
static fromMilli(value: MilliXL1) {
|
|
51
|
-
return this.from(value, XL1Places.milli)
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
static fromMicro(value: MicroXL1) {
|
|
55
|
-
return this.from(value, XL1Places.micro)
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
static fromNano(value: NanoXL1) {
|
|
59
|
-
return this.from(value, XL1Places.nano)
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
static fromPico(value: PicoXL1) {
|
|
63
|
-
return this.from(value, XL1Places.pico)
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
static fromFemto(value: FemtoXL1) {
|
|
67
|
-
return this.from(value, XL1Places.femto)
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
static fromAtto(value: AttoXL1) {
|
|
71
|
-
return this.from(value, XL1Places.atto)
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
static fromXL1(value: XL1) {
|
|
75
|
-
return this.from(value, XL1Places.xl1)
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
to(places: number | bigint = XL1Places.atto) {
|
|
79
|
-
return this.value / 10n ** BigInt(places)
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
get milli() {
|
|
83
|
-
return MilliXL1(this.to(XL1Places.milli))
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
get micro() {
|
|
87
|
-
return MicroXL1(this.to(XL1Places.micro))
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
get nano() {
|
|
91
|
-
return NanoXL1(this.to(XL1Places.nano))
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
get pico() {
|
|
95
|
-
return PicoXL1(this.to(XL1Places.pico))
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
get femto() {
|
|
99
|
-
return FemtoXL1(this.to(XL1Places.femto))
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
get atto() {
|
|
103
|
-
return AttoXL1(this.to(XL1Places.atto))
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
get xl1() {
|
|
107
|
-
return XL1(this.to(XL1Places.xl1))
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
toString(places: number = Number(XL1Places.atto), config: Partial<ShiftedBigIntConfig> = {}): string {
|
|
111
|
-
assertEx(allowedPlaces.includes(BigInt(places)), () => `Invalid conversion places (${places} not in ${allowedPlaces})`)
|
|
112
|
-
return new ShiftedBigInt(
|
|
113
|
-
this.value,
|
|
114
|
-
{
|
|
115
|
-
places,
|
|
116
|
-
locale: this.locale,
|
|
117
|
-
maxDecimal: places,
|
|
118
|
-
minDecimals: 0,
|
|
119
|
-
maxCharacters: places,
|
|
120
|
-
...config,
|
|
121
|
-
},
|
|
122
|
-
).toShortString()
|
|
123
|
-
}
|
|
124
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { splitOnDecimal } from './splitOnDecimal.ts'
|
|
2
|
-
|
|
3
|
-
export const splitOnDecimalToString = (
|
|
4
|
-
value: bigint,
|
|
5
|
-
places = 18,
|
|
6
|
-
maxDecimal = places,
|
|
7
|
-
maxCharacters = 9,
|
|
8
|
-
minDecimals = 1,
|
|
9
|
-
locale: Intl.LocalesArgument = 'en-US',
|
|
10
|
-
): string => {
|
|
11
|
-
const [whole, decimal] = splitOnDecimal(value, places)
|
|
12
|
-
const remainderLength = decimal.toString().length
|
|
13
|
-
const precedingZerosInDecimal = places - remainderLength
|
|
14
|
-
if (whole === 0n && precedingZerosInDecimal >= maxDecimal && decimal !== 0n) return '< 0.'.padEnd(maxDecimal + 5, '0') + '1'
|
|
15
|
-
|
|
16
|
-
const wholeCharacters = whole.toString(10).length
|
|
17
|
-
const calcMaxDecimalCharacters = maxCharacters === -1 ? places : wholeCharacters > maxCharacters ? 0 : maxCharacters - wholeCharacters
|
|
18
|
-
const maxDecimalCharacters = Math.min(maxDecimal, calcMaxDecimalCharacters)
|
|
19
|
-
|
|
20
|
-
// Format whole number with thousand separators according to locale
|
|
21
|
-
const formattedWhole = new Intl.NumberFormat(locale, {
|
|
22
|
-
maximumFractionDigits: 0,
|
|
23
|
-
useGrouping: true,
|
|
24
|
-
}).format(whole)
|
|
25
|
-
|
|
26
|
-
// Get decimal separator for the locale
|
|
27
|
-
const decimalSeparator = new Intl.NumberFormat(locale)
|
|
28
|
-
.formatToParts(1.1)
|
|
29
|
-
.find(part => part.type === 'decimal')?.value ?? '.'
|
|
30
|
-
|
|
31
|
-
// Pad decimal part to correct number of places
|
|
32
|
-
let paddedDecimal = decimal.toString().padStart(places, '0').slice(0, maxDecimalCharacters)
|
|
33
|
-
// remove unneeded trailing zeros (honoring minDecimals)
|
|
34
|
-
while (paddedDecimal.length > minDecimals && paddedDecimal.endsWith('0')) {
|
|
35
|
-
paddedDecimal = paddedDecimal.slice(0, -1)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return `${formattedWhole}${paddedDecimal.length > 0 ? decimalSeparator : ''}${paddedDecimal}`
|
|
39
|
-
}
|