Function useStreamQueries

  • 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 an array of queries. If no queryFactory is given, or if the given factory returns an empty array, all visible contracts of the given template are returned. Otherwise, returns a union of all the contracts that match at least one of the given queries.

    • 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.

    T The contract template type of the query.

    K The contract key type of the query.

    I The template id type.