Hierarchy

Constructors

  • Creates an instance of Since.

    Parameters

    • relative: "absolute" | "relative"

      Absolute or relative

    • metric: "blockNumber" | "epoch" | "timestamp"

      The metric of since

    • value: bigint

      The value of since

    Returns Since

Properties

relative: "absolute" | "relative"

Absolute or relative

metric: "blockNumber" | "epoch" | "timestamp"

The metric of since

value: bigint

The value of since

byteLength?: number

The bytes length of the entity, if it is fixed, otherwise undefined

Methods

  • Clone a Since.

    Returns Since

    A cloned Since instance.

    const since1 = since0.clone();
    
  • Creates a Since instance from a SinceLike object.

    Parameters

    • since: SinceLike

      A SinceLike object or an instance of Since.

    Returns Since

    A Since instance.

    const since = Since.from("0x1234567812345678");
    
  • Converts the Since instance to num.

    Returns bigint

    A num

    const num = since.toNum();
    
  • Creates a Since instance from a num-like value.

    Parameters

    • numLike: NumLike

      The num-like value to convert.

    Returns Since

    A Since instance.

    const since = Since.fromNum("0x0");
    
  • Encode the entity into bytes

    Parameters

    Returns Uint8Array

    The encoded bytes

    Will throw an error if the entity is not serializable

  • Decode the entity from bytes

    Parameters

    Returns Since

    The decoded entity

    Will throw an error if the entity is not serializable

  • Create an entity from bytes

    Parameters

    Returns Since

    The created entity

    Will throw an error if the entity is not serializable

  • Convert the entity to bytes

    Returns Uint8Array

    The bytes representation of the entity

  • Check if the entity is equal to another entity

    Parameters

    • other: SinceLike

      The other entity to compare with

    Returns boolean

    True if the entities are equal, false otherwise

  • Calculate the hash of the entity

    Returns `0x${string}`

    The hash of the entity