@node-dlc/messaging
Version:
DLC Messaging Protocol
70 lines (69 loc) • 1.84 kB
TypeScript
/// <reference types="node" />
import { Tx } from '@node-dlc/bitcoin';
import { MessageType } from '../MessageType';
import { IDlcMessage } from './DlcMessage';
/**
* DlcTransactions message contains information about state of DLC
* contract such as fundtx and closetx
*/
export declare class DlcTransactions implements IDlcMessage {
static type: MessageType;
/**
* Deserializes a dlc_transactions message
* @param buf
*/
static deserialize(buf: Buffer, parseCets?: boolean): DlcTransactions;
/**
* The type for dlc_transactions message. dlc_transactions = 61230
*/
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 to JSON
*/
toJSON(): IDlcTransactionsJSON;
/**
* Serializes the dlc_transactions message into a Buffer
*/
serialize(): Buffer;
}
export interface IDlcTransactionsJSON {
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
}
export declare const DlcTransactionsV0: typeof DlcTransactions;
export type IDlcTransactionsV0JSON = IDlcTransactionsJSON;