UNPKG

@node-dlc/messaging

Version:
83 lines (82 loc) 2.63 kB
/// <reference types="node" /> import { MessageType } from '../MessageType'; import { IDlcMessage } from './DlcMessage'; export declare abstract class EventDescriptor { static deserialize(buf: Buffer): EnumEventDescriptorV0 | DigitDecompositionEventDescriptorV0; abstract type: number; abstract length: bigint; abstract toJSON(): IEnumEventDescriptorV0JSON | IDigitDecompositionEventDescriptorV0JSON; abstract serialize(): Buffer; } /** * EnumEventDescriptor V0 is a simple enumeration of outcomes */ export declare class EnumEventDescriptorV0 extends EventDescriptor implements IDlcMessage { static type: MessageType; /** * Deserializes an enum_event_descriptor_v0 message * @param buf */ static deserialize(buf: Buffer): EnumEventDescriptorV0; /** * The type for enum_event_descriptor_v0 message. enum_event_descriptor_v0 = 55302 */ type: MessageType; length: bigint; outcomes: string[]; /** * Converts enum_event_descriptor_v0 to JSON */ toJSON(): IEnumEventDescriptorV0JSON; /** * Serializes the enum_event_descriptor_v0 message into a Buffer */ serialize(): Buffer; } /** * DigitDecompositionEventDescriptorV0 V0 is a simple enumeration of outcomes */ export declare class DigitDecompositionEventDescriptorV0 extends EventDescriptor implements IDlcMessage { static type: MessageType; /** * Deserializes an digit_decomposition_event_descriptor_v0 message * @param buf */ static deserialize(buf: Buffer): DigitDecompositionEventDescriptorV0; /** * The type for digit_decomposition_event_descriptor_v0 message. digit_decomposition_event_descriptor_v0 = 55302 */ type: MessageType; length: bigint; base: number; isSigned: boolean; unit: string; precision: number; nbDigits: number; /** * Validates correctness of all fields in the message * https://github.com/discreetlogcontracts/dlcspecs/blob/master/Oracle.md * @throws Will throw an error if validation fails */ validate(): void; /** * Converts digit_decomposition_event_descriptor_v0 to JSON */ toJSON(): IDigitDecompositionEventDescriptorV0JSON; /** * Serializes the digit_decomposition_event_descriptor_v0 message into a Buffer */ serialize(): Buffer; } export interface IEnumEventDescriptorV0JSON { type: number; outcomes: string[]; } export interface IDigitDecompositionEventDescriptorV0JSON { type: number; base: number; isSigned: boolean; unit: string; precision: number; nbDigits: number; }