UNPKG

@node-dlc/messaging

Version:
75 lines (74 loc) 2.42 kB
/// <reference types="node" /> import { MessageType } from '../MessageType'; import { BatchFundingGroup, IBatchFundingGroupJSON } from './BatchFundingGroup'; import { CetAdaptorSignaturesV0, ICetAdaptorSignaturesV0JSON } from './CetAdaptorSignaturesV0'; import { IDlcMessage } from './DlcMessage'; import { FundingSignaturesV0, IFundingSignaturesV0JSON } from './FundingSignaturesV0'; export declare abstract class DlcSign { static deserialize(buf: Buffer): DlcSignV0; abstract type: number; abstract toJSON(): IDlcSignV0JSON; abstract serialize(): Buffer; } /** * DlcSign gives all of the initiator's signatures, which allows the * receiver to broadcast the funding transaction with both parties being * fully committed to all closing transactions. */ export declare class DlcSignV0 extends DlcSign implements IDlcMessage { static type: MessageType; /** * Deserializes an sign_dlc_v0 message * @param buf */ static deserialize(buf: Buffer): DlcSignV0; /** * The type for sign_dlc_v0 message. sign_dlc_v0 = 42782 */ type: MessageType; contractId: Buffer; cetSignatures: CetAdaptorSignaturesV0; refundSignature: Buffer; fundingSignatures: FundingSignaturesV0; batchFundingGroups?: BatchFundingGroup[]; /** * Converts sign_dlc_v0 to JSON */ toJSON(): IDlcSignV0JSON; /** * Serializes the sign_dlc_v0 message into a Buffer */ serialize(): Buffer; } export interface IDlcSignV0JSON { type: number; contractId: string; cetSignatures: ICetAdaptorSignaturesV0JSON; refundSignature: string; fundingSignatures: IFundingSignaturesV0JSON; tlvs: IBatchFundingGroupJSON[]; } export declare class DlcSignContainer { private signs; /** * Adds a DlcSign to the container. * @param sign The DlcSign to add. */ addSign(sign: DlcSign): void; /** * Returns all DlcSigns in the container. * @returns An array of DlcSign instances. */ getSigns(): DlcSign[]; /** * Serializes all DlcSigns in the container to a Buffer. * @returns A Buffer containing the serialized DlcSigns. */ serialize(): Buffer; /** * Deserializes a Buffer into a DlcSignContainer with DlcSigns. * @param buf The Buffer to deserialize. * @returns A DlcSignContainer instance. */ static deserialize(buf: Buffer): DlcSignContainer; }