UNPKG

@node-dlc/messaging

Version:
87 lines (86 loc) 3.11 kB
/// <reference types="node" /> import { RoundingIntervals } from './RoundingIntervals'; import { IRoundingIntervalsJSON } from './RoundingIntervals'; /** * Negotiation fields for DLC contract negotiation. * Follows the Rust enum pattern with Single and Disjoint variants. */ export declare abstract class NegotiationFields { static deserialize(buf: Buffer): NegotiationFields; /** * Creates a NegotiationFields from JSON data * @param json JSON object representing negotiation fields */ static fromJSON(json: any): NegotiationFields; abstract variant: 'Single' | 'Disjoint'; abstract discriminator: number; abstract serialize(): Buffer; abstract toJSON(): INegotiationFieldsJSON; } /** * Negotiation fields for contract based on a single event. */ export declare class SingleNegotiationFields extends NegotiationFields { /** * Creates a SingleNegotiationFields from JSON data * @param json JSON object representing single negotiation fields */ static fromJSON(json: any): SingleNegotiationFields; /** * Deserializes single negotiation fields * @param buf */ static deserialize(buf: Buffer): SingleNegotiationFields; variant: "Single"; discriminator: number; roundingIntervals: RoundingIntervals; /** * Converts single negotiation fields to JSON */ toJSON(): ISingleNegotiationFieldsJSON; /** * Serializes the single negotiation fields into a Buffer */ serialize(): Buffer; } /** * Negotiation fields for contract based on multiple events. */ export declare class DisjointNegotiationFields extends NegotiationFields { /** * Creates a DisjointNegotiationFields from JSON data * @param json JSON object representing disjoint negotiation fields */ static fromJSON(json: any): DisjointNegotiationFields; /** * Deserializes disjoint negotiation fields * @param buf */ static deserialize(buf: Buffer): DisjointNegotiationFields; variant: "Disjoint"; discriminator: number; negotiationFields: NegotiationFields[]; /** * Converts disjoint negotiation fields to JSON */ toJSON(): IDisjointNegotiationFieldsJSON; /** * Serializes the disjoint negotiation fields into a Buffer */ serialize(): Buffer; } export type INegotiationFieldsJSON = ISingleNegotiationFieldsJSON | IDisjointNegotiationFieldsJSON; export interface ISingleNegotiationFieldsJSON { variant: 'Single'; roundingIntervals: IRoundingIntervalsJSON; } export interface IDisjointNegotiationFieldsJSON { variant: 'Disjoint'; negotiationFields: INegotiationFieldsJSON[]; } export declare const NegotiationFieldsV0: typeof SingleNegotiationFields; export declare const NegotiationFieldsV1: typeof SingleNegotiationFields; export declare const NegotiationFieldsV2: typeof DisjointNegotiationFields; export type INegotiationFieldsV0JSON = ISingleNegotiationFieldsJSON; export type INegotiationFieldsV1JSON = ISingleNegotiationFieldsJSON; export type INegotiationFieldsV2JSON = IDisjointNegotiationFieldsJSON;