Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Ledger

An object of type Ledger represents a handle to a DAML ledger.

Hierarchy

  • Ledger

Index

Constructors

constructor

  • new Ledger(__namedParameters: { httpBaseUrl: string; token: string; wsBaseUrl: string }): Ledger
  • Construct a new Ledger object. See LedgerOptions for the constructor arguments.

    Parameters

    • __namedParameters: { httpBaseUrl: string; token: string; wsBaseUrl: string }
      • httpBaseUrl: string
      • token: string
      • wsBaseUrl: string

    Returns Ledger

Properties

Private httpBaseUrl

httpBaseUrl: string

Private token

token: string

Private wsBaseUrl

wsBaseUrl: string

Methods

archive

  • archive<T, K, I>(template: Template<T, K, I>, contractId: ContractId<T>): Promise<ArchiveEvent<T, I>>
  • Archive a contract identified by its contract ID.

    Type parameters

    • T: object

      The contract template type.

    • K

      The contract key type.

    • I: string

      The contract id type.

    Parameters

    • template: Template<T, K, I>

      The template of the contract to archive.

    • contractId: ContractId<T>

      The contract id of the contract to archive.

    Returns Promise<ArchiveEvent<T, I>>

archiveByKey

  • archiveByKey<T, K, I>(template: Template<T, K, I>, key: K): Promise<ArchiveEvent<T, I>>
  • Archive a contract identified by its contract key. Same as archive, but the contract to be archived is identified by its contract key.

    Type parameters

    • T: object

      The contract template type.

    • K

      The contract key type.

    • I: string

      The contract id type.

    Parameters

    • template: Template<T, K, I>

      The template of the contract to be archived.

    • key: K

      The contract key of the contract to be archived.

    Returns Promise<ArchiveEvent<T, I>>

create

  • create<T, K, I>(template: Template<T, K, I>, payload: T): Promise<CreateEvent<T, K, I>>
  • Create a contract for a given template.

    Type parameters

    • T: object

      The contract template type.

    • K

      The contract key type.

    • I: string

      The contract id type.

    Parameters

    • template: Template<T, K, I>

      The template of the contract to be created.

    • payload: T

      The template arguments for the contract to be created.

    Returns Promise<CreateEvent<T, K, I>>

exercise

  • exercise<T, C, R>(choice: Choice<T, C, R>, contractId: ContractId<T>, argument: C): Promise<[R, Event<object>[]]>
  • Exercise a choice on a contract identified by its contract ID.

    Type parameters

    • T: object

      The contract template type.

    • C

      The type of the contract choice.

    • R

      The return type of the choice.

    Parameters

    • choice: Choice<T, C, R>

      The choice to exercise.

    • contractId: ContractId<T>

      The contract id of the contract to exercise.

    • argument: C

      The choice arguments.

    Returns Promise<[R, Event<object>[]]>

    The return value of the choice together with a list of [[event]]'s that where created as a result of exercising the choice.

exerciseByKey

  • exerciseByKey<T, C, R, K>(choice: Choice<T, C, R, K>, key: K, argument: C): Promise<[R, Event<object>[]]>
  • Exercise a choice on a contract identified by its contract key.

    Same as exercise, but the contract is identified by its contract key instead of its contract id.

    Type parameters

    • T: object

      The contract template type.

    • C

      The type of the contract choice.

    • R

      The return type of the choice.

    • K

      The type of the contract key.

    Parameters

    • choice: Choice<T, C, R, K>

      The choice to exercise.

    • key: K
    • argument: C

      The choice arguments.

    Returns Promise<[R, Event<object>[]]>

    The return value of the choice together with a list of [[event]]'s that where created as a result of exercising the choice.

fetch

  • fetch<T, K, I>(template: Template<T, K, I>, contractId: ContractId<T>): Promise<CreateEvent<T, K, I> | null>
  • Fetch a contract identified by its contract ID.

    Type parameters

    • T: object

      The contract template type.

    • K

      The contract key type.

    • I: string

      The contract id type.

    Parameters

    • template: Template<T, K, I>

      The template of the contract to be fetched.

    • contractId: ContractId<T>

      The contract id of the contract to be fetched.

    Returns Promise<CreateEvent<T, K, I> | null>

fetchByKey

  • fetchByKey<T, K, I>(template: Template<T, K, I>, key: K): Promise<CreateEvent<T, K, I> | null>
  • Fetch a contract identified by its contract key.

    Same as fetch, but the contract to be fetched is identified by its contract key instead of its contract id.

    Type parameters

    • T: object

      The contract template type.

    • K

      The contract key type.

    • I: string

      The contract id type.

    Parameters

    • template: Template<T, K, I>

      The template of the contract to be fetched.

    • key: K

      The contract key of the contract to be fetched.

    Returns Promise<CreateEvent<T, K, I> | null>

query

  • query<T, K, I>(template: Template<T, K, I>, query?: Query<T>): Promise<CreateEvent<T, K, I>[]>
  • Retrieve contracts for a given template.

    When no query argument is given, all contracts visible to the submitting party are returned. When a query argument is given, only those contracts matching the query are returned. See https://docs.daml.com/json-api/search-query-language.html for a description of the query language.

    Type parameters

    • T: object

      The contract template type.

    • K

      The contract key type.

    • I: string

      The contract id type.

    Parameters

    • template: Template<T, K, I>

      The contract template of the contracts to be matched against.

    • Optional query: Query<T>

      The contract query for the contracts to be matched against.

    Returns Promise<CreateEvent<T, K, I>[]>

streamFetchByKey

  • streamFetchByKey<T, K, I>(template: Template<T, K, I>, key: K): Stream<T, K, I, CreateEvent<T, K, I> | null>
  • Retrieve a consolidated stream of events for a given template and contract key.

    Same as streamQuery, but instead of a query, match contracts by contract key.

    Type parameters

    • T: object

      The contract template type.

    • K

      The contract key type.

    • I: string

      The contract id type.

    Parameters

    • template: Template<T, K, I>
    • key: K

    Returns Stream<T, K, I, CreateEvent<T, K, I> | null>

streamQuery

  • streamQuery<T, K, I>(template: Template<T, K, I>, query?: Query<T>): Stream<T, K, I, keyof CreateEvent<T, K, I>[]>
  • Retrieve a consolidated stream of events for a given template and query.

    The accumulated state is the current set of active contracts matching the query. When no query argument is given, all events visible to the submitting party are returned. When a query argument is given, only those create events matching the query are returned. See https://docs.daml.com/json-api/search-query-language.html for a description of the query language.

    Type parameters

    • T: object

      The contract template type.

    • K

      The contract key type.

    • I: string

      The contract id type.

    Parameters

    • template: Template<T, K, I>

      The contract template to match contracts against.

    • Optional query: Query<T>

      The query to match contracts agains.

    Returns Stream<T, K, I, keyof CreateEvent<T, K, I>[]>

Generated using TypeDoc