UNPKG

@node-dlc/wire

Version:
41 lines (40 loc) 1.29 kB
/// <reference types="node" /> import { ShortChannelId } from '@node-dlc/common'; import { ILogger } from '@node-dlc/logger'; import { ReplyShortChannelIdsEndMessage } from '../messages/ReplyShortChannelIdsEndMessage'; import { IMessageSender } from '../Peer'; export declare enum ChannelsQueryState { Idle = 0, Active = 1, Complete = 2, Failed = 3 } /** * This class manages the state machine for executing query_short_channel_ids * and will resolve as either complete or with an error. This class can accept * an arbitrarily large number of short channel ids and will chunk the requests * appropriately. */ export declare class ChannelsQuery { readonly chainHash: Buffer; readonly peer: IMessageSender; readonly logger: ILogger; chunkSize: number; private _queue; private _state; private _error; private _resolve; private _reject; constructor(chainHash: Buffer, peer: IMessageSender, logger: ILogger); get state(): ChannelsQueryState; get error(): Error; handleReplyShortChannelIdsEnd(msg: ReplyShortChannelIdsEndMessage): void; /** * * @param scids */ query(...scids: ShortChannelId[]): Promise<void>; private _transitionSuccess; private _transitionFailed; private _sendQuery; }