Class TransactionHash

Represents a transaction hash, which can either be associated with a Deploy or a TransactionV1.

Hierarchy

  • Hash
    • TransactionHash

Constructors

Properties

deploy?: Hash

The hash associated with the deploy transaction, if applicable. This will contain the hash of the Deploy transaction.

transactionV1?: Hash

The hash associated with the version 1 transaction, if applicable. This will contain the hash of the TransactionV1.

ByteHashLen: number = 32

The fixed length of the hash in bytes.

StringHashLen: number = 64

The fixed length of the hash string representation in hexadecimal characters.

Methods

  • Checks if the current transaction hash is equal to another hash.

    Returns

    True if the hashes are equal, otherwise false.

    Parameters

    • other: Hash

      The hash to compare with.

    Returns boolean

  • Returns the hash (either deploy or transactionV1). This method is useful when you want to get the hash regardless of type.

    Returns undefined | Hash

  • Converts the TransactionHash to a byte array representation.

    Returns

    The byte array of the deploy or transactionV1 hash, or an empty byte array if neither is available.

    Returns Uint8Array

  • Converts the TransactionHash to a hexadecimal string representation.

    Returns

    The hexadecimal string of the deploy or transactionV1 hash, or an empty string if neither is available.

    Returns string

  • Converts the TransactionHash to a JSON string (hex format).

    Returns

    The hexadecimal string representation of the hash.

    Returns string

  • Creates an array of Hash instances from a byte array.

    Returns

    An array of Hash instances created from the byte array.

    Throws

    Error if the byte array length is not a multiple of the hash length.

    Parameters

    • byteArray: Uint8Array

      The byte array containing multiple hash values.

    Returns Hash[]

  • Creates a Hash instance from a Buffer.

    Returns

    A new Hash instance.

    Throws

    Error if the buffer length is less than the required hash length.

    Parameters

    • buffer: Buffer

      The Buffer containing the hash bytes.

    Returns Hash

  • Creates a Hash instance from a byte array.

    Returns

    A result object containing the new Hash instance and the remaining bytes.

    Throws

    Error if the byte array length does not match the expected hash length.

    Parameters

    • source: Uint8Array

      The byte array representing the hash.

    Returns IResultWithBytes<Hash>

  • Creates a Hash instance from a hexadecimal string.

    Returns

    A new Hash instance.

    Throws

    Error if the string length does not match the expected hash length.

    Parameters

    • source: string

      The hexadecimal string representation of the hash.

    Returns Hash

  • Creates a Hash instance from its JSON representation.

    Returns

    A new Hash instance.

    Parameters

    • json: string

      The JSON string representation of the hash.

    Returns Hash

Generated using TypeDoc