opnet
Version:
The perfect library for building Bitcoin-based applications.
33 lines (32 loc) • 1.1 kB
TypeScript
import { WebSocketRequestOpcode, WebSocketResponseOpcode } from './WebSocketOpcodes.js';
export declare enum WebSocketClientEvent {
CONNECTED = "connected",
DISCONNECTED = "disconnected",
ERROR = "error",
BLOCK = "block",
EPOCH = "epoch"
}
export type EventHandler<T = unknown> = (data: T) => void;
export type SubscriptionHandler<T = unknown> = (data: T) => void;
export interface BlockNotification {
readonly blockNumber: bigint;
readonly blockHash: string;
readonly previousBlockHash: string;
readonly timestamp: bigint;
}
export interface EpochNotification {
readonly epochNumber: bigint;
readonly epochHash: string;
readonly timestamp: bigint;
}
export interface InternalPendingRequest {
readonly resolve: (value: Uint8Array) => void;
readonly reject: (error: Error) => void;
readonly timeout: ReturnType<typeof setTimeout>;
}
export interface MethodMapping {
readonly requestOpcode: WebSocketRequestOpcode;
readonly responseOpcode: WebSocketResponseOpcode;
readonly requestType: string;
readonly responseType: string;
}