UNPKG

@node-dlc/messaging

Version:
58 lines (57 loc) 1.78 kB
/// <reference types="node" /> import { MessageType } from '../MessageType'; import { IDlcMessage } from './DlcMessage'; import { FundingInputV0, IFundingInputV0JSON } from './FundingInput'; import { FundingSignaturesV0, IFundingSignaturesV0JSON } from './FundingSignaturesV0'; export declare abstract class DlcClose { static deserialize(buf: Buffer): DlcCloseV0; abstract type: number; abstract toJSON(): IDlcCloseV0JSON; abstract serialize(): Buffer; } /** * DlcClose message contains information about a node and indicates its * desire to close an existing contract. */ export declare class DlcCloseV0 extends DlcClose implements IDlcMessage { static type: MessageType; /** * Deserializes an close_dlc_v0 message * @param buf */ static deserialize(buf: Buffer): DlcCloseV0; /** * The type for close_dlc_v0 message. close_dlc_v0 = 52170 // TODO */ type: MessageType; contractId: Buffer; closeSignature: Buffer; offerPayoutSatoshis: bigint; acceptPayoutSatoshis: bigint; fundInputSerialId: bigint; fundingInputs: FundingInputV0[]; fundingSignatures: FundingSignaturesV0; /** * Serializes the close_dlc_v0 message into a Buffer */ serialize(): Buffer; /** * Validates correctness of all fields * @throws Will throw an error if validation fails */ validate(): void; /** * Converts dlc_close_v0 to JSON */ toJSON(): IDlcCloseV0JSON; } export interface IDlcCloseV0JSON { type: number; contractId: string; closeSignature: string; offerPayoutSatoshis: number; acceptPayoutSatoshis: number; fundInputSerialId: number; fundingInputs: IFundingInputV0JSON[]; fundingSignatures: IFundingSignaturesV0JSON; }