Whole number portion of the epoch.
Fractional numerator.
Fractional denominator (must be > 0).
Readonly
integerWhole number portion of the epoch.
Readonly
numeratorFractional numerator.
Readonly
denominatorFractional denominator (must be > 0).
Static
Optional
byteThe bytes length of the entity, if it is fixed, otherwise undefined
Static
fromCreate an Epoch from an EpochLike value.
Accepts:
All returned fields are converted to Num
using numFrom
.
Value to convert into an Epoch.
A new or existing Epoch instance.
Static
zeroReturn an epoch representing zero (0 + 0/1).
Static
oneReturn an epoch representing one cycle (180 + 0/1).
This is a NervosDAO convenience constant.
Compare this epoch to another EpochLike.
Comparison is performed by converting both epochs to a common integer representation: (integer * denominator + numerator) scaled by the other's denominator.
EpochLike value to compare against.
1 if this > other, 0 if equal, -1 if this < other.
Check equality with another EpochLike.
EpochLike to test equality against.
true if both epochs represent the same value.
Return a normalized epoch:
integer
if needed.integer
.A new, normalized Epoch instance.
Convert this epoch to an estimated Unix timestamp in milliseconds using as reference the block header.
ClientBlockHeader providing a reference epoch and timestamp.
Unix timestamp in milliseconds as bigint.
Static
encodeStatic
decodeStatic
fromCalculate the hash of the entity
The hash of the entity
Convert the entity to Hex
The hexadecimal representation of the entity
Construct a new Epoch.
The constructor enforces a positive
denominator
. Ifdenominator
is non-positive an Error is thrown.