UNPKG

@digitalasset/daml-ledger

Version:
62 lines (61 loc) 1.65 kB
/** * Uses the `offsetType` string type tag to differentiate between types in the union. */ export declare type LedgerOffset = LedgerOffsetBoundary | LedgerOffsetAbsolute; export declare enum LedgerOffsetBoundaryValue { /** * Refers to the first transaction. */ BEGIN = 0, /** * Refers to the currently last transaction, which is a moving target. */ END = 1 } /** * Example: * * ``` * { * offsetType: 'boundary', * boundary: LedgerOffsetBoundaryValue.BEGIN * } * ``` * * To express values in a more concise way, you can have a look at the {@link ValueHelpers}. * * @see LedgerOffsetBoundaryValue */ export interface LedgerOffsetBoundary { /** * A fixed type tag to denote this object as a boundary offset */ offsetType: 'boundary'; boundary: LedgerOffsetBoundaryValue; } /** * Example: * * ``` * { * offsetType: 'absolute', * absolute: '42' * } * ``` * * To express values in a more concise way, you can have a look at the {@link ValueHelpers}. */ export interface LedgerOffsetAbsolute { /** * A fixed type tag to denote this object as an absolute offset */ offsetType: 'absolute'; /** * Absolute values are acquired by reading the transactions in the stream. * The offsets can be compared. The format may vary between implementations. * It is either a string representing an ever-increasing integer, or * a composite string containing ``<block-hash>-<block-height>-<event-id>``; ordering * requires comparing numerical values of the second, then the third element. */ absolute: string; }