Function useStreamFetchByKeys

  • React Hook to query the ledger. Same as useStreamQueries, but query by contract keys instead.

    Type Parameters

    • T extends object
    • K
    • I extends string

    Parameters

    • template: Template<T, K, I>

      The template of the contracts to match.

    • keyFactory: () => K[]

      A function returning an array of contract keys. Contract keys must be in "output" format as defined in the JSON API docs, i.e., have to match the types generated by the daml-types library.

    • keyDeps: readonly unknown[]

      The dependencies of the fetch-by-key (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 FetchByKeysResult<T, K, I>

    An array of the same length as the given array of keys, where each element is either the currently active contract that matches the corresponding key, or null if no active contract matches the key in the same position.

    T The contract template type of the query.

    K The contract key type of the query.

    I The template id type.