UNPKG

@node-dlc/messaging

Version:
74 lines (73 loc) 1.98 kB
/// <reference types="node" /> import { Tx } from '@node-dlc/bitcoin'; import { MessageType } from '../MessageType'; import { IDlcMessage } from './DlcMessage'; export declare abstract class DlcTransactions { static deserialize(buf: Buffer, parseCets?: boolean): DlcTransactionsV0; abstract type: number; abstract toJSON(): IDlcTransactionsV0JSON; abstract serialize(): Buffer; } /** * DlcTransactions message contains information about state of DLC * contract such as fundtx and closetx */ export declare class DlcTransactionsV0 extends DlcTransactions implements IDlcMessage { static type: MessageType; /** * Deserializes an offer_dlc_v0 message * @param buf */ static deserialize(buf: Buffer, parseCets?: boolean): DlcTransactionsV0; /** * The type for offer_dlc_v0 message. offer_dlc_v0 = 42778 */ type: MessageType; contractId: Buffer; fundTx: Tx; fundTxVout: number; fundEpoch: BlockEpoch; fundBroadcastHeight: number; refundTx: Tx; cets: Tx[]; closeEpoch: BlockEpoch; closeTxHash: Buffer; closeType: CloseType; closeBroadcastHeight: number; /** * Converts dlc_transactions_v0 to JSON */ toJSON(): IDlcTransactionsV0JSON; /** * Serializes the dlc_transactions_v0 message into a Buffer */ serialize(): Buffer; } export interface IDlcTransactionsV0JSON { type: number; contractId: string; fundTx: string; fundTxVout: number; fundEpoch: IBlockEpochJSON; fundBroadcastHeight: number; refundTx: string; cets: string[]; closeEpoch: IBlockEpochJSON; closeTxHash: string; closeType: string; closeBroadcastHeight: number; } export interface IBlockEpochJSON { hash: string; height: number; } export interface BlockEpoch { hash: Buffer; height: number; } export declare enum CloseType { NotClosed = 0, ExecuteClose = 1, RefundClose = 2, CooperativeClose = 3 }