Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Stream<T, K, I, State>

Interface for streams returned by the streaming methods of the Ledger class. Each 'change' event contains accumulated state of type State as well as the ledger events that triggered the current state change.

Type parameters

  • T: object

    The contract template type.

  • K

    The contract key type.

  • I: string

    The contract id type.

  • State

    The accumulated state.

Hierarchy

  • Stream

Implemented by

Index

Methods

Methods

close

  • close(): void
  • Close the Stream and stop receiving events.

    Returns void

off

  • off(type: "live", listener: (state: State) => void): void
  • off(type: "change", listener: (state: State, events: readonly Event<T, K, I>[]) => void): void
  • off(type: "close", listener: (closeEvent: StreamCloseEvent) => void): void
  • Remove the registered callback for the 'live' event.

    Parameters

    • type: "live"

      'live'

    • listener: (state: State) => void

      function to be deregistered.

        • (state: State): void
        • Parameters

          • state: State

          Returns void

    Returns void

  • Remove the registered callback for the 'change' event.

    Parameters

    • type: "change"

      'change'

    • listener: (state: State, events: readonly Event<T, K, I>[]) => void

      function to be deregistered.

        • (state: State, events: readonly Event<T, K, I>[]): void
        • Parameters

          • state: State
          • events: readonly Event<T, K, I>[]

          Returns void

    Returns void

  • Remove the registered callback for the 'close' event.

    Parameters

    Returns void

on

  • on(type: "live", listener: (state: State) => void): void
  • on(type: "change", listener: (state: State, events: readonly Event<T, K, I>[]) => void): void
  • on(type: "close", listener: (closeEvent: StreamCloseEvent) => void): void
  • Register a callback that will be called when the state of the stream has caught up with the Active Contract Set and is now receiving new transactions.

    Parameters

    • type: "live"

      'live'

    • listener: (state: State) => void

      function taking the state of the stream as an argument.

        • (state: State): void
        • Parameters

          • state: State

          Returns void

    Returns void

  • Register a callback that will be called when the state of the stream changes, eg. new contract creates or archives.

    Parameters

    • type: "change"

      'change'

    • listener: (state: State, events: readonly Event<T, K, I>[]) => void

      function taking the state of the stream and new events as arguments.

        • (state: State, events: readonly Event<T, K, I>[]): void
        • Parameters

          • state: State
          • events: readonly Event<T, K, I>[]

          Returns void

    Returns void

  • Register a callback that will be called when the underlying stream is closed.

    Parameters

    Returns void

Generated using TypeDoc