Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "defaultLedgerContext"

Index

Functions

DamlLedger

  • DamlLedger(props: React.PropsWithChildren<LedgerProps>): React.ReactElement | null
  • Within a DamlLedger one can use the hooks provided here.

    Parameters

    • props: React.PropsWithChildren<LedgerProps>

      React props and children for this element.

    Returns React.ReactElement | null

useFetchByKey

  • useFetchByKey<T, K, I>(template: Template<T, K, I>, keyFactory: () => K, keyDeps: keyof unknown[]): FetchResult<T, K, I>
  • React Hook for a lookup by key against the /v1/fetch endpoint of the JSON API.

    Type parameters

    • T: object

      The contract template type of the query.

    • K

      The contract key type of the query.

    • I: string

      The template id type.

    Parameters

    • template: Template<T, K, I>

      The template of the contracts to fetch.

    • keyFactory: () => K

      A function returning the contract key of the contracts to fetch.

        • (): K
        • Returns K

    • keyDeps: keyof unknown[]

      Dependencies of this hook (for which the fetch is reexecuted on change).

    Returns FetchResult<T, K, I>

    The fetched contract.

useLedger

  • useLedger(): Ledger
  • React Hook that returns the Ledger instance to interact with the connected DAML ledger.

    Returns Ledger

useParty

  • useParty(): Party
  • React hook to get the party currently connected to the ledger.

    Returns Party

useQuery

  • useQuery<T, K, I>(template: Template<T, K, I>, queryFactory: () => Query<T>, queryDeps: keyof unknown[]): QueryResult<T, K, I>
  • useQuery<T, K, I>(template: Template<T, K, I>): QueryResult<T, K, I>
  • React Hook for a query against the ledger.

    Type parameters

    • T: object

      The contract template type of the query.

    • K

      The contract key type of the query.

    • I: string

      The template id type.

    Parameters

    • template: Template<T, K, I>

      The contract template to filter for.

    • queryFactory: () => Query<T>

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

        • (): Query<T>
        • Returns Query<T>

    • queryDeps: keyof unknown[]

      The dependencies of the query (which trigger a reload when changed).

    Returns QueryResult<T, K, I>

    The result of the query.

  • Type parameters

    • T: object

    • K

    • I: string

    Parameters

    • template: Template<T, K, I>

    Returns QueryResult<T, K, I>

useReload

  • useReload(): () => void
  • React Hook to reload all active queries.

    Returns () => void

      • (): void
      • Returns void

useStreamFetchByKey

  • useStreamFetchByKey<T, K, I>(template: Template<T, K, I>, keyFactory: () => K, keyDeps: keyof unknown[]): FetchResult<T, K, I>
  • React Hook to query the ledger. Same as useStreamQuery, but query by contract key instead.

    Type parameters

    • T: object

      The contract template type of the query.

    • K

      The contract key type of the query.

    • I: string

      The template id type.

    Parameters

    • template: Template<T, K, I>

      The template of the contracts to match.

    • keyFactory: () => K
        • (): K
        • Returns K

    • keyDeps: keyof unknown[]

    Returns FetchResult<T, K, I>

    The matching (unique) contract.

useStreamQuery

  • useStreamQuery<T, K, I>(template: Template<T, K, I>, queryFactory: () => Query<T>, queryDeps: keyof unknown[]): QueryResult<T, K, I>
  • useStreamQuery<T, K, I>(template: Template<T, K, I>): QueryResult<T, K, I>
  • React Hook to query the ledger, the returned result is updated as the ledger state changes.

    Type parameters

    • T: object

      The contract template type of the query.

    • K

      The contract key type of the query.

    • I: string

      The template id type.

    Parameters

    • template: Template<T, K, I>

      The template of the contracts to match.

    • queryFactory: () => Query<T>

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

        • (): Query<T>
        • Returns Query<T>

    • queryDeps: keyof unknown[]

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

    Returns QueryResult<T, K, I>

    The matching contracts.

  • Type parameters

    • T: object

    • K

    • I: string

    Parameters

    • template: Template<T, K, I>

    Returns QueryResult<T, K, I>

Generated using TypeDoc