Represents a revision for a Thor transaction or block Revision strings can be one of the following:

  • "best": indicating the best revision
  • "finalized": indicating a finalized revision
  • "next": indicating the next revision
  • "justified": indicating the justified revision
  • A hex string prefixed with "0x" indicating a specific block id
  • A positive number indicating a specific block number

Hierarchy (view full)

Constructors

Properties

BEST: Revision = ...

Return the best revision instance.

FINALIZED: Revision = ...

Return the finalized revision instance.

JUSTIFIED: Revision = ...

Return the justified revision instance.

NEXT: Revision = ...

Return the next revision instance.

Accessors

  • get bi(): bigint
  • Converts the current Txt string to a BigInt.

    Returns bigint

    The BigInt representation of the Txt string.

    If the conversion to BigInt fails because this Txt string doesn't represent an integer.

  • get bytes(): Uint8Array
  • Converts the current Txt string to a buffer of bytes.

    Returns Uint8Array

    The bytes representation of the Txt string.

  • get n(): number
  • Converts the current Txt string to a number.

    Returns number

    The numeric value of the Txt string.

    If the conversion to number fails because this Txt string doesn't represent a decimal number.

Methods

  • Compares the current instance to another instance of Txt.

    Parameters

    • that: Txt

      The instance to compare with.

    Returns number

    • A negative number if the current instance is less than the specified instance, zero if they are equal, or a positive number if the current instance is greater.
  • Checks if the current Txt object is equal to the given Txt object.

    Parameters

    • that: Txt

      The Txt object to compare with.

    Returns boolean

    • True if the objects are equal, false otherwise.
  • Determines if the given value is a valid revision.

    Parameters

    • value:
          | string
          | number
          | bigint
          | Hex

      The value to be validated.

    Returns boolean

    • Returns true if the value is valid, false otherwise.
  • Creates a new Revision object from the given value.

    Parameters

    • value:
          | string
          | number
          | bigint
          | Uint8Array
          | Hex

      The value to create the Revision from:

      • Hex must be positive;
      • Uint8Array is decoded as a string: see Txt.of.

    Returns Txt

    • The created Revision object.

    if the given value is not a valid revision: see isValid.

    The string representation of the revision is always expressed as a number in base 10.