@deeeed/hyperliquid-node20
Version:
Unofficial Hyperliquid API SDK for all major JS runtimes, written in TypeScript. Fork with Node.js 20.18.0+ compatibility.
52 lines • 1.93 kB
TypeScript
import { TypedEventTarget } from "typescript-event-target";
import type { BlockDetails, TxDetails } from "../../types/explorer/responses.js";
import type { BaseExchangeResponse } from "../../types/exchange/responses.js";
/** Response to subscribe to or unsubscribe from an event. */
interface SubscriptionResponse {
/** Type of subscription operation. */
method: "subscribe" | "unsubscribe";
/** Original subscription request. */
subscription: unknown;
}
/** Response to post request. */
interface PostResponse {
/** Unique request identifier. */
id: number;
/** Server response. */
response:
/** Response containing requested information. */
{
/** Indicates that this is an informational response. */
type: "info";
/** Contains the information data. */
payload: {
/** Type of information being returned. */
type: string;
/** Information specific data. */
data: unknown;
};
}
/** Response containing action result. */
| {
/** Indicates that this is an action response. */
type: "action";
/** Action result. */
payload: BaseExchangeResponse;
};
}
/** Base system events and dynamic channel events for Hyperliquid WebSocket API. */
interface HyperliquidEventMap {
subscriptionResponse: CustomEvent<SubscriptionResponse>;
post: CustomEvent<PostResponse>;
error: CustomEvent<string>;
pong: CustomEvent<undefined>;
_explorerBlock: CustomEvent<Omit<BlockDetails, "txs">[]>;
_explorerTxs: CustomEvent<TxDetails[]>;
[key: string]: CustomEvent<any>;
}
/** Listens for WebSocket messages and sends them as Hyperliquid typed events. */
export declare class HyperliquidEventTarget extends TypedEventTarget<HyperliquidEventMap> {
constructor(socket: WebSocket);
}
export {};
//# sourceMappingURL=_hyperliquid_event_target.d.ts.map