import { Channel, ChannelName } from "../models/Channel";
import { Order, Side } from "../models/Order";
import { Orderbook } from "../models/Orderbook";
import { Ticker } from "../models/Ticker";
import { Trade } from "../models/Trade";
import { PriceLevel } from "../models/PriceLevel";
/**
 * The Hydro API provides a websocket connection that can push updates
 * about the exchange to clients. This watcher lets you create a listener
 * function to handle updates, and a subscription function to choose which
 * channels you wish to get updates on.
 *
 * See https://docs.ddex.io/#websocket
 */
export declare class HydroWatcher {
    private static SOCKET_URL;
    private listener;
    private socket?;
    private messageQueue;
    /**
     * Initialize a new watcher with a set of listener functions that will
     * be called when a message of that type is received. The watcher will
     * not connect to the server until you subscribe to at least one channel.
     *
     * @param listener Object containing the functions to handle the updates you care about
     */
    constructor(listener: HydroListener);
    /**
     * Subscribe to a channel and begin receiving updates from the exchange
     * for a set of market ids
     *
     * See https://docs.ddex.io/#subscribe
     *
     * @param channel The name of the channel you want to subscribe to
     * @param marketIds A list of market ids you want updates for
     */
    subscribe(channel: ChannelName, marketIds: string[]): void;
    /**
     * Unsubscribe to stop receiving updates from the exchange for a particular
     * channel/market ids
     *
     * See https://docs.ddex.io/#unsubscribe
     *
     * @param channel The name of the channel you want to unsubscribe from
     * @param marketIds A list of market ids you no longer want updates for
     */
    unsubscribe(channel: ChannelName, marketIds: string[]): void;
    private initIfNeeded();
    private sendMessage(message);
    private receiveMessage(message);
    private generateMessage(type, channel, marketIds);
}
export interface HydroListener {
    /**
     * Received whenever you subscribe or unsubscribe to tell you your
     * current list of channels and market ids you are watching
     */
    subscriptionsUpdate?: (channels: Channel[]) => void;
    /**
     * Received when subscribed to the 'ticker' channel and ticker
     * data is updated
     */
    tickerUpdate?: (ticker: Ticker) => void;
    /**
     * Received when subscribed to the 'orderbook' channel right
     * after you subscribe
     */
    orderbookSnapshot?: (orderbook: Orderbook) => void;
    /**
     * Received when subscribed to the 'orderbook' channel and there
     * are changes to the orderbook
     */
    orderbookUpdate?: (side: Side, priceLevel: PriceLevel) => void;
    /**
     * Received when subscribed to the 'full' channel right after
     * you subscribe
     */
    fullSnapshot?: (orderbook: Orderbook, sequence: number) => void;
    /**
     * Received when subscribed to the 'full' channel and a new order
     * has been created
     */
    orderReceived?: (order: Order, sequence: number, time: Date) => void;
    /**
     * Received when subscribed to the 'full' channel and a new order
     * has been created, but not immediately fulfilled
     */
    orderOpened?: (order: Order, sequence: number, time: Date) => void;
    /**
     * Received when subscribed to the 'full' channel and an order is
     * being taken off the orderbook, either due to being completely
     * fulfilled or because it was cancelled
     */
    orderDone?: (order: Order, sequence: number, time: Date) => void;
    /**
     * Received when subscribed to the 'full' channel and an order is
     * being updated with new data, usually because it was partially
     * fulfilled
     */
    orderChanged?: (order: Order, sequence: number, time: Date) => void;
    /**
     * Received when subscribed to the 'full' channel and two orders
     * have been matched, creating a trade
     */
    tradeBegin?: (trade: Trade, sequence: number, time: Date) => void;
    /**
     * Received when subscribed to the 'full' channel and a trade has
     * been successfully validated on the blockchain
     */
    tradeSuccess?: (trade: Trade, sequence: number, time: Date) => void;
}
