ClassWatcher

Represents a deploy watcher responsible for monitoring transaction events.

This struct allows clients to subscribe to transaction events, start watching for events, or wait for an event and handle the received deploy event data.

Fields

  • events_url - The URL for transaction events.
  • subscriptions - Vector containing deploy subscriptions.
  • active - Reference-counted cell indicating whether the deploy watcher is active.
  • timeout_duration - Duration representing the optional timeout for watching events.

Constructors

  • Creates a new Watcher instance.

    Arguments

    • events_url - The URL for transaction events.
    • timeout_duration - Optional duration in milliseconds for watching events. If not provided, a default timeout of 60,000 milliseconds (1 minute) is used.

    Returns

    A new Watcher instance.

    Parameters

    • events_url: string
    • Optionaltimeout_duration: bigint

    Returns Watcher

Methods

  • Starts watching for transaction events (JavaScript-friendly).

    Returns

    Result containing the serialized transaction events data or an error message.

    Returns Promise<any>

  • Stops watching for transaction events.

    This method sets the deploy watcher as inactive and stops the event listener if it exists.

    Returns void

  • Subscribes to transaction events.

    Arguments

    • subscriptions - Vector of deploy subscriptions to be added.

    Returns

    Result indicating success or an error message.

    Parameters

    Returns void

  • Unsubscribes from transaction events based on the provided transaction hash.

    Arguments

    • transaction_hash - The transaction hash to unsubscribe.

    This method removes the deploy subscription associated with the provided transaction hash.

    Parameters

    • target_hash: string

    Returns void