Function useStreamQuery

  • React Hook to query the ledger, the returned result is updated as the ledger state changes.

    Type Parameters

    • T extends object
    • K
    • I extends string

    Parameters

    • template: TemplateOrInterface<T, K, I>

      The template of the contracts to match.

    • OptionalqueryFactory: () => Query<T>

      A function returning a query. If the query is omitted, all visible contracts of the given template are returned.

    • OptionalqueryDeps: readonly unknown[]

      The dependencies of the query (for which a change triggers an update of the result).

    • OptionalcloseHandler: (e: StreamCloseEvent) => void

      A callback that will be called if the underlying WebSocket connection fails in an unrecoverable way.

    Returns QueryResult<T, K, I>

    The matching contracts.

    prefer useStreamQueries

    T The contract template type of the query.

    K The contract key type of the query.

    I The template id type.