Function useStreamFetchByKey

  • React Hook to query the ledger. Same as useStreamQuery, but query by contract key 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 a contract key. 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 FetchResult<T, K, I>

    The matching (unique) contract, or null.

    prefer useStreamFetchByKeys

    T The contract template type of the query.

    K The contract key type of the query.

    I The template id type.