@node-dlc/messaging
Version:
DLC Messaging Protocol
53 lines (52 loc) • 1.54 kB
TypeScript
/// <reference types="node" />
import { MessageType } from '../MessageType';
import { IDlcMessage } from './DlcMessage';
/**
* RoundingIntervals defines rounding intervals for numeric outcome contracts.
* Updated to match dlcspecs format (no longer uses TLV).
*/
export declare class RoundingIntervals implements IDlcMessage {
static type: MessageType;
/**
* Creates a RoundingIntervals from JSON data
* @param json JSON object representing rounding intervals
*/
static fromJSON(json: any): RoundingIntervals;
/**
* Deserializes a rounding_intervals message
* @param buf
*/
static deserialize(buf: Buffer): RoundingIntervals;
/**
* The type for rounding_intervals message. rounding_intervals = 42788
*/
type: MessageType;
intervals: IInterval[];
/**
* Validates correctness of all fields in the message
* https://github.com/discreetlogcontracts/dlcspecs/blob/master/NumericOutcome.md#requirements
* @throws Will throw an error if validation fails
*/
validate(): void;
/**
* Converts rounding_intervals to JSON
*/
toJSON(): IRoundingIntervalsJSON;
/**
* Serializes the rounding_intervals message into a Buffer
*/
serialize(): Buffer;
}
interface IInterval {
beginInterval: bigint;
roundingMod: bigint;
}
interface IIntervalJSON {
beginInterval: number;
roundingMod: number;
}
export interface IRoundingIntervalsJSON {
type?: number;
intervals: IIntervalJSON[];
}
export {};