@node-dlc/messaging
Version:
DLC Messaging Protocol
55 lines (54 loc) • 1.95 kB
TypeScript
/// <reference types="node" />
import { MessageType } from '../MessageType';
import { IDlcMessage } from './DlcMessage';
import { EventDescriptor, IDigitDecompositionEventDescriptorV0JSON, IEnumEventDescriptorV0JSON } from './EventDescriptor';
/**
* For users to be able to create DLCs based on a given event, they also
* need to obtain information about the oracle and the time at which it
* plans on releasing a signature over the event outcome. OracleEvent
* mesages contain such information, which includes:
* - the nonce(s) that will be used to sign the event outcome(s)
* - the earliest time (UTC) at which it plans on releasing a signature
* over the event outcome, in epoch seconds
* - the event descriptor
* - the event ID which can be a name or categorization associated with
* the event by the oracle
*/
export declare class OracleEventV0 implements IDlcMessage {
static type: MessageType;
/**
* Deserializes an oracle_event message
* @param buf
*/
static deserialize(buf: Buffer): OracleEventV0;
/**
* The type for oracle_event message. oracle_event = 55330
*/
type: MessageType;
length: bigint;
oracleNonces: Buffer[];
eventMaturityEpoch: number;
eventDescriptor: EventDescriptor;
eventId: string;
/**
* 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 oracle_event to JSON
*/
toJSON(): IOracleEventV0JSON;
/**
* Serializes the oracle_event message into a Buffer
*/
serialize(): Buffer;
}
export interface IOracleEventV0JSON {
type: number;
oracleNonces: string[];
eventMaturityEpoch: number;
eventDescriptor: IEnumEventDescriptorV0JSON | IDigitDecompositionEventDescriptorV0JSON;
eventId: string;
}