Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.canton.network/llms.txt

Use this file to discover all available pages before exploring further.

Generated from published @daml/types TypeDoc snapshots.

Table of Contents

NameKindSummaryIntroducedChangedDeprecatedRemoved
ChoiceInterfaceInterface for objects representing Daml choices.3.4.8---
ChoiceFromInterfaceThe origin companion that contained a [[Choice]].3.4.8---
ContractTypeCompanionInterfaceCompanion objects for templates and interfaces, containing their choices.3.4.83.4.9: members added: templateIdWithPackageId--
FromTemplateInterfaceA mixin for [[InterfaceCompanion]]. This supplies the basis
for the methods of [[ToInterface]].

Even interfaces that retroactively implement for no templates implement this,
because forward implementations still require this marker to work.
3.4.8---
MapInterfaceThe counterpart of Daml’s DA.Map.Map K V type.

This is an immutable map which compares keys via deep equality. The order of
iteration is unspecified; the only guarantee is that the order in keys and
values match, i.e. m.get(k) is (deep-, value-based) equal to
[...m.values()][[...m.keys()].findIndex((l) => _.isEqual(k, l))]
3.4.8---
SerializableInterfaceInterface for companion objects of serializable types. Its main purpose is
to serialize and deserialize values between raw JSON and typed values.
3.4.8---
TemplateInterfaceInterface for objects representing Daml templates. It is similar to the
Template type class in Daml.
3.4.83.4.9: members added: templateIdWithPackageId--
ToInterfaceInterfaceA mixin for [[Template]] that provides the toInterface and
unsafeFromInterface contract ID conversion functions.

Even templates that directly implement no interfaces implement this, because
this also permits conversion with interfaces that supply retroactive
implementations to this template.
3.4.8---
UnitInterfaceThe counterpart of Daml’s () type.3.4.8---
BoolType AliasThe counterpart of Daml’s Bool type.3.4.8---
ContractIdType AliasThe counterpart of Daml’s ContractId T type.

We represent ContractIds as strings. Their exact format of these strings depends on the ledger
the Daml application is running on.

The purpose of the intersection with { [ContractIdBrand]: T } is to
prevent accidental use of a ContractId<T> when a ContractId<U> is
needed (unless T is a subtype of U). This technique is known as
”branding” in the TypeScript community.
3.4.8---
DateType AliasThe counterpart of Daml’s Date type.

We represent Dates as strings with format YYYY-MM-DD.
3.4.8---
DecimalType AliasThe counterpart of Daml’s Decimal type.

In Daml, Decimal’s are the same as Numeric with precision 10.
3.4.8---
DisclosedContractType AliasA disclosed contract that can be passed on a command submission.3.4.8---
IntType AliasThe counterpart of Daml’s Int type.

We represent Ints as string in order to avoid a loss of precision.
3.4.8---
InterfaceType AliasAn interface type, for use with contract IDs.3.4.8---
InterfaceCompanionType AliasInterface for objects representing Daml interfaces.3.4.8---
ListType AliasThe counterpart of Daml’s [T] list type.

We represent lists using arrays.
3.4.8---
NumericType AliasThe counterpart of Daml’s Numeric type.

We represent Numerics as string in order to avoid a loss of precision. The string must match
the regular expression -?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?.
3.4.8---
OptionalType AliasThe counterpart of Daml’s Optional T type.3.4.8---
PartyType AliasThe counterpart of Daml’s Party type.

We represent Partys as strings matching the regular expression [A-Za-z0-9:_\- ]+.
3.4.8---
TemplateOrInterfaceType Alias-3.4.83.4.9: signature updated; type parameter renamed: I -> Id--
TextType AliasThe counterpart of Daml’s Text type.3.4.8---
TextMapType AliasThe counterpart of Daml’s TextMap T type.

We represent TextMaps as dictionaries.
3.4.8---
TimeType AliasThe counterpart of Daml’s Time type.

We represent Timess as strings with format YYYY-MM-DDThh:mm:ss[.ssssss]Z.
3.4.8---
BoolVariableCompanion object of the [[Bool]] type.3.4.8---
DateVariableCompanion object of the [[Date]] type.3.4.8---
DecimalVariableCompanion object of the [[Decimal]] type.3.4.8---
IntVariableCompanion object of the [[Int]] type.3.4.8---
PartyVariableCompanion object of the [[Party]] type.3.4.8---
TextVariableCompanion object of the [[Text]] type.3.4.8---
TimeVariableCompanion object of the [[Time]] type.3.4.8---
UnitVariableCompanion object of the [[Unit]] type.3.4.8---
ContractIdFunctionCompanion object of the [[ContractId]] type.3.4.8---
emptyMapFunction-3.4.8---
ListFunctionCompanion object of the [[List]] type.3.4.8---
MapFunctionCompanion function of the [[GenMap]] type.3.4.8---
NumericFunctionCompanion function of the [[Numeric]] type.3.4.8---
OptionalFunctionCompanion function of the [[Optional]] type.3.4.8---
TextMapFunctionCompanion object of the [[TextMap]] type.3.4.8---

Version Change Summary

VersionAddedChangedRemoved
3.4.840--
3.4.9-3-
3.4.10---
3.4.11---

Reference

Interfaces

Choice

  • Kind: Interface
  • Introduced: 3.4.8
  • Source: index.d.ts:113
Signature
interface Choice<T extends object = void, C extends void = void, R extends void = void, K extends void = unknown> extends ChoiceFrom<TemplateOrInterface<T, K>>
Interface for objects representing Daml choices. Type Parameters
NameConstraintDefaultDescription
Tobject-The template type.
C--The choice type.
R--The choice return type.
K-unknownThe contract key type.
Members
MemberTypeDescription
choiceNamestringThe choice name.
template() => TemplateOrInterfaceReturns the template to which this choice belongs.

ChoiceFrom

  • Kind: Interface
  • Introduced: 3.4.8
  • Source: index.d.ts:140
Signature
interface ChoiceFrom<O extends void = void>
The origin companion that contained a [[Choice]]. Type Parameters
NameConstraintDefaultDescription
O--The type of the template or interface of which
this [[Choice]] is a member.
Members
MemberTypeDescription
template() => OReturns the template to which this choice belongs.

ContractTypeCompanion

  • Kind: Interface
  • Introduced: 3.4.8
  • Changed in: 3.4.9
  • Source: index.d.ts:25
Version Changes
VersionChanges
3.4.9members added: templateIdWithPackageId
Signature
interface ContractTypeCompanion<T extends object = void, K extends void = void, I extends string = void>
Companion objects for templates and interfaces, containing their choices. Type Parameters
NameConstraintDefaultDescription
Tobject-The template payload format or interface view.
K--The contract key type.
Istring-The template or interface id.
Members
MemberTypeDescription
templateIdI-
templateIdWithPackageIdstring-

FromTemplate

  • Kind: Interface
  • Introduced: 3.4.8
  • Source: index.d.ts:101
Signature
interface FromTemplate<If extends void = void, TX extends void = void>
A mixin for [[InterfaceCompanion]]. This supplies the basis for the methods of [[ToInterface]]. Even interfaces that retroactively implement for no templates implement this, because forward implementations still require this marker to work. Type Parameters
NameConstraintDefaultDescription
If--The interface type.
TX--The intersection of template types this interface retroactively
implements, or unknown if there are none.
Members
MemberTypeDescription
[FromTemplateBrand][If, TX]-

Map

  • Kind: Interface
  • Introduced: 3.4.8
  • Source: index.d.ts:340
Signature
interface Map<K extends void = void, V extends void = void>
The counterpart of Daml’s DA.Map.Map K V type. This is an immutable map which compares keys via deep equality. The order of iteration is unspecified; the only guarantee is that the order in keys and values match, i.e. m.get(k) is (deep-, value-based) equal to [...m.values()][[...m.keys()].findIndex((l) => _.isEqual(k, l))] Type Parameters
NameConstraintDefaultDescription
K--The type of the map keys.
V--The type of the map values.
Members
MemberTypeDescription
delete(k: K) => Map<K, V>-
entries() => Iterator<[K, V], undefined, undefined>-
entriesArray() => [K, V][]-
forEach(f: (value: V, key: K, map: Map<K, V>) => T, u?: U) => void-
get(k: K) => undefined | V-
has(k: K) => boolean-
keys() => Iterator<K, undefined, undefined>-
set(k: K, v: V) => Map<K, V>-
values() => Iterator<V, undefined, undefined>-

Serializable

  • Kind: Interface
  • Introduced: 3.4.8
  • Source: index.d.ts:8
Signature
interface Serializable<T extends void = void>
Interface for companion objects of serializable types. Its main purpose is to serialize and deserialize values between raw JSON and typed values. Type Parameters
NameConstraintDefaultDescription
T--The template type.

Template

  • Kind: Interface
  • Introduced: 3.4.8
  • Changed in: 3.4.9
  • Source: index.d.ts:50
Version Changes
VersionChanges
3.4.9members added: templateIdWithPackageId
Signature
interface Template<T extends object = void, K extends void = unknown, I extends string = string> extends ContractTypeCompanion<T, K, I>, Serializable<T>
Interface for objects representing Daml templates. It is similar to the Template type class in Daml. Type Parameters
NameConstraintDefaultDescription
Tobject-The template type.
K-unknownThe contract key type.
IstringstringThe template id type.
Members
MemberTypeDescription
ArchiveChoice<T, {}, {}, K> & ChoiceFrom<Template<T, K, I>>-
templateIdI-
templateIdWithPackageIdstring-

ToInterface

  • Kind: Interface
  • Introduced: 3.4.8
  • Source: index.d.ts:69
Signature
interface ToInterface<T extends object = void, IfU extends void = void>
A mixin for [[Template]] that provides the toInterface and unsafeFromInterface contract ID conversion functions. Even templates that directly implement no interfaces implement this, because this also permits conversion with interfaces that supply retroactive implementations to this template. Type Parameters
NameConstraintDefaultDescription
Tobject-The template type.
IfU--The union of implemented interfaces, or never for templates
that directly implement no interface.
Members
MemberTypeDescription
toInterfacevoid-
unsafeFromInterfacevoid-

Unit

  • Kind: Interface
  • Introduced: 3.4.8
  • Source: index.d.ts:181
Signature
interface Unit
The counterpart of Daml’s () type.

Type Aliases

Bool

  • Kind: Type Alias
  • Introduced: 3.4.8
  • Source: index.d.ts:190
Signature
type Bool = boolean
The counterpart of Daml’s Bool type.

ContractId

  • Kind: Type Alias
  • Introduced: 3.4.8
  • Source: index.d.ts:294
Signature
type ContractId<T extends void = void> = string & { [ContractIdBrand]: T }
The counterpart of Daml’s ContractId T type. We represent ContractIds as strings. Their exact format of these strings depends on the ledger the Daml application is running on. The purpose of the intersection with { [ContractIdBrand]: T } is to prevent accidental use of a ContractId<T> when a ContractId<U> is needed (unless T is a subtype of U). This technique is known as “branding” in the TypeScript community. Type Parameters
NameConstraintDefaultDescription
T--The contract template.

Date

  • Kind: Type Alias
  • Introduced: 3.4.8
  • Source: index.d.ts:272
Signature
type Date = string
The counterpart of Daml’s Date type. We represent Dates as strings with format YYYY-MM-DD.

Decimal

  • Kind: Type Alias
  • Introduced: 3.4.8
  • Source: index.d.ts:218
Signature
type Decimal = Numeric
The counterpart of Daml’s Decimal type. In Daml, Decimal’s are the same as Numeric with precision 10.

DisclosedContract

  • Kind: Type Alias
  • Introduced: 3.4.8
  • Source: index.d.ts:362
Signature
type DisclosedContract = { contractId: ContractId<unknown>; createdEventBlob: string; templateId: string }
A disclosed contract that can be passed on a command submission.

Int

  • Kind: Type Alias
  • Introduced: 3.4.8
  • Source: index.d.ts:200
Signature
type Int = string
The counterpart of Daml’s Int type. We represent Ints as string in order to avoid a loss of precision.

Interface

  • Kind: Type Alias
  • Introduced: 3.4.8
  • Source: index.d.ts:81
Signature
type Interface<IfId extends void = void> = { readonly [InterfaceBrand]: IfId }
An interface type, for use with contract IDs. Type Parameters
NameConstraintDefaultDescription
IfId--The interface ID as a constant string.

InterfaceCompanion

  • Kind: Type Alias
  • Introduced: 3.4.8
  • Source: index.d.ts:87
Signature
type InterfaceCompanion<T extends object = void, K extends void = void, I extends string = string> = ContractTypeCompanion<T, K, I>
Interface for objects representing Daml interfaces. Type Parameters
NameConstraintDefaultDescription
Tobject--
K---
Istringstring-

List

  • Kind: Type Alias
  • Introduced: 3.4.8
  • Source: index.d.ts:262
Signature
type List<T extends void = void> = T[]
The counterpart of Daml’s [T] list type. We represent lists using arrays. Type Parameters
NameConstraintDefaultDescription
T--The type of the list values.

Numeric

  • Kind: Type Alias
  • Introduced: 3.4.8
  • Source: index.d.ts:211
Signature
type Numeric = string
The counterpart of Daml’s Numeric type. We represent Numerics as string in order to avoid a loss of precision. The string must match the regular expression -?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?.

Optional

  • Kind: Type Alias
  • Introduced: 3.4.8
  • Source: index.d.ts:306
Signature
type Optional<T extends void = void> = null | OptionalInner<T>
The counterpart of Daml’s Optional T type. Type Parameters
NameConstraintDefaultDescription
T--The type of the optionally present value.

Party

  • Kind: Type Alias
  • Introduced: 3.4.8
  • Source: index.d.ts:250
Signature
type Party = string
The counterpart of Daml’s Party type. We represent Partys as strings matching the regular expression [A-Za-z0-9:_\- ]+.

TemplateOrInterface

  • Kind: Type Alias
  • Introduced: 3.4.8
  • Changed in: 3.4.9
  • Source: index.d.ts:88
Version Changes
VersionChanges
3.4.9signature updated; type parameter renamed: I -> Id
Signature
type TemplateOrInterface<T extends object = void, K extends void = unknown, Id extends string = string> = Template<T, K, Id> | InterfaceCompanion<T, K, Id>
Type Parameters
NameConstraintDefaultDescription
Tobject--
K-unknown-
Idstringstring-

Text

  • Kind: Type Alias
  • Introduced: 3.4.8
  • Source: index.d.ts:230
Signature
type Text = string
The counterpart of Daml’s Text type.

TextMap

  • Kind: Type Alias
  • Introduced: 3.4.8
  • Source: index.d.ts:322
Signature
type TextMap<T extends void = void> = {}
The counterpart of Daml’s TextMap T type. We represent TextMaps as dictionaries. Type Parameters
NameConstraintDefaultDescription
T--The type of the map values.

Time

  • Kind: Type Alias
  • Introduced: 3.4.8
  • Source: index.d.ts:240
Signature
type Time = string
The counterpart of Daml’s Time type. We represent Timess as strings with format YYYY-MM-DDThh:mm:ss[.ssssss]Z.

Variables

Bool

  • Kind: Variable
  • Introduced: 3.4.8
  • Source: index.d.ts:190
Signature
const Bool: Serializable<boolean>
Companion object of the [[Bool]] type.

Date

  • Kind: Variable
  • Introduced: 3.4.8
  • Source: index.d.ts:272
Signature
const Date: Serializable<string>
Companion object of the [[Date]] type.

Decimal

  • Kind: Variable
  • Introduced: 3.4.8
  • Source: index.d.ts:218
Signature
const Decimal: Serializable<string>
Companion object of the [[Decimal]] type.

Int

  • Kind: Variable
  • Introduced: 3.4.8
  • Source: index.d.ts:200
Signature
const Int: Serializable<string>
Companion object of the [[Int]] type.

Party

  • Kind: Variable
  • Introduced: 3.4.8
  • Source: index.d.ts:250
Signature
const Party: Serializable<string>
Companion object of the [[Party]] type.

Text

  • Kind: Variable
  • Introduced: 3.4.8
  • Source: index.d.ts:230
Signature
const Text: Serializable<string>
Companion object of the [[Text]] type.

Time

  • Kind: Variable
  • Introduced: 3.4.8
  • Source: index.d.ts:240
Signature
const Time: Serializable<string>
Companion object of the [[Time]] type.

Unit

  • Kind: Variable
  • Introduced: 3.4.8
  • Source: index.d.ts:181
Signature
const Unit: Serializable<Unit>
Companion object of the [[Unit]] type.

Functions

ContractId

  • Kind: Function
  • Introduced: 3.4.8
  • Source: index.d.ts:294
Signature
ContractId<T extends void = void>(_t: Serializable<T> | TemplateOrInterface<T & object, unknown, string>): Serializable<ContractId<T>>
Companion object of the [[ContractId]] type. Call Signatures
ContractId<T extends void = void>(_t: Serializable<T> | TemplateOrInterface<T & object, unknown, string>): Serializable<ContractId<T>>
Type ParameterConstraintDefaultDescription
T---
ParameterTypeRequiredDescription
_tSerializable<T> | TemplateOrInterface<T & object, unknown, string>yes-
Returns: Serializable<ContractId<T>>

emptyMap

  • Kind: Function
  • Introduced: 3.4.8
  • Source: index.d.ts:351
Signature
emptyMap<K extends void = void, V extends void = void>(): Map<K, V>
Call Signatures
emptyMap<K extends void = void, V extends void = void>(): Map<K, V>
Type ParameterConstraintDefaultDescription
K---
V---
Returns: Map<K, V>

List

  • Kind: Function
  • Introduced: 3.4.8
  • Source: index.d.ts:262
Signature
List<T extends void = void>(t: Serializable<T>): Serializable<T[]>
Companion object of the [[List]] type. Call Signatures
List<T extends void = void>(t: Serializable<T>): Serializable<T[]>
Type ParameterConstraintDefaultDescription
T---
ParameterTypeRequiredDescription
tSerializable<T>yes-
Returns: Serializable<T[]>

Map

  • Kind: Function
  • Introduced: 3.4.8
  • Source: index.d.ts:340
Signature
Map<K extends void = void, V extends void = void>(kd: Serializable<K>, vd: Serializable<V>): Serializable<Map<K, V>>
Companion function of the [[GenMap]] type. Call Signatures
Map<K extends void = void, V extends void = void>(kd: Serializable<K>, vd: Serializable<V>): Serializable<Map<K, V>>
Type ParameterConstraintDefaultDescription
K---
V---
ParameterTypeRequiredDescription
kdSerializable<K>yes-
vdSerializable<V>yes-
Returns: Serializable<Map<K, V>>

Numeric

  • Kind: Function
  • Introduced: 3.4.8
  • Source: index.d.ts:211
Signature
Numeric(_: number): Serializable<string>
Companion function of the [[Numeric]] type. Call Signatures
Numeric(_: number): Serializable<string>
ParameterTypeRequiredDescription
_numberyes-
Returns: Serializable<string>

Optional

  • Kind: Function
  • Introduced: 3.4.8
  • Source: index.d.ts:306
Signature
Optional<T extends void = void>(t: Serializable<T>): Serializable<Optional<T>>
Companion function of the [[Optional]] type. Call Signatures
Optional<T extends void = void>(t: Serializable<T>): Serializable<Optional<T>>
Type ParameterConstraintDefaultDescription
T---
ParameterTypeRequiredDescription
tSerializable<T>yes-
Returns: Serializable<Optional<T>>

TextMap

  • Kind: Function
  • Introduced: 3.4.8
  • Source: index.d.ts:322
Signature
TextMap<T extends void = void>(t: Serializable<T>): Serializable<TextMap<T>>
Companion object of the [[TextMap]] type. Call Signatures
TextMap<T extends void = void>(t: Serializable<T>): Serializable<TextMap<T>>
Type ParameterConstraintDefaultDescription
T---
ParameterTypeRequiredDescription
tSerializable<T>yes-
Returns: Serializable<TextMap<T>>