UnitInterval.ts
UnitInterval overview
Table of contents
arbitrary
arbitrary
FastCheck arbitrary for generating random UnitInterval instances.
Signature
export declare const arbitrary: FastCheck.Arbitrary<UnitInterval>Added in v2.0.0
constructors
fromBigDecimal
Create UnitInterval from BigDecimal value.
Signature
export declare const fromBigDecimal: (value: BigDecimal.BigDecimal) => UnitIntervalAdded in v2.0.0
model
UnitInterval (class)
Schema for UnitInterval representing a fractional value between 0 and 1.
CDDL: unit_interval = #6.30([uint, uint])A unit interval is a number in the range between 0 and 1, which means there are two extra constraints:
1. numerator ≤ denominator
2. denominator > 0Signature
export declare class UnitIntervalAdded in v2.0.0
toJSON (method)
Convert to JSON representation.
Signature
toJSON()Added in v2.0.0
toString (method)
Convert to string representation.
Signature
toString(): stringAdded in v2.0.0
[Inspectable.NodeInspectSymbol] (method)
Custom inspect for Node.js REPL.
Signature
[Inspectable.NodeInspectSymbol](): unknownAdded in v2.0.0
[Equal.symbol] (method)
Structural equality check.
Signature
[Equal.symbol](that: unknown): booleanAdded in v2.0.0
[Hash.symbol] (method)
Hash code generation.
Signature
[Hash.symbol](): numberAdded in v2.0.0
schemas
FromCBORBytes
CBOR bytes transformation schema for UnitInterval. Transforms between Uint8Array and UnitInterval using CBOR encoding.
Signature
export declare const FromCBORBytes: (
options?: CBOR.CodecOptions
) => Schema.transform<
Schema.transformOrFail<
typeof Schema.Uint8ArrayFromSelf,
Schema.declare<CBOR.CBOR, CBOR.CBOR, readonly [], never>,
never
>,
Schema.transformOrFail<
Schema.TaggedStruct<
"Tag",
{ tag: Schema.Literal<[30]>; value: Schema.Tuple2<typeof Schema.BigIntFromSelf, typeof Schema.BigIntFromSelf> }
>,
Schema.SchemaClass<UnitInterval, UnitInterval, never>,
never
>
>Added in v2.0.0
FromCBORHex
CBOR hex transformation schema for UnitInterval. Transforms between hex string and UnitInterval using CBOR encoding.
Signature
export declare const FromCBORHex: (
options?: CBOR.CodecOptions
) => Schema.transform<
Schema.Schema<Uint8Array, string, never>,
Schema.transform<
Schema.transformOrFail<
typeof Schema.Uint8ArrayFromSelf,
Schema.declare<CBOR.CBOR, CBOR.CBOR, readonly [], never>,
never
>,
Schema.transformOrFail<
Schema.TaggedStruct<
"Tag",
{ tag: Schema.Literal<[30]>; value: Schema.Tuple2<typeof Schema.BigIntFromSelf, typeof Schema.BigIntFromSelf> }
>,
Schema.SchemaClass<UnitInterval, UnitInterval, never>,
never
>
>
>Added in v2.0.0
FromCDDL
CDDL schema for UnitInterval following the Conway specification.
unit_interval = #6.30([uint, uint])Transforms between CBOR tag 30 structure and UnitInterval model.
Signature
export declare const FromCDDL: Schema.transformOrFail<
Schema.TaggedStruct<
"Tag",
{ tag: Schema.Literal<[30]>; value: Schema.Tuple2<typeof Schema.BigIntFromSelf, typeof Schema.BigIntFromSelf> }
>,
Schema.SchemaClass<UnitInterval, UnitInterval, never>,
never
>Added in v2.0.0
transformation
toBigDecimal
Convert UnitInterval to BigDecimal value.
Signature
export declare const toBigDecimal: (interval: UnitInterval) => BigDecimal.BigDecimalAdded in v2.0.0
utils
CDDLSchema
Signature
export declare const CDDLSchema: Schema.TaggedStruct<
"Tag",
{ tag: Schema.Literal<[30]>; value: Schema.Tuple2<typeof Schema.BigIntFromSelf, typeof Schema.BigIntFromSelf> }
>