1 | import { Network, Networkish } from "@ethersproject/networks";
|
2 | import { Event } from "./base-provider";
|
3 | import { JsonRpcProvider } from "./json-rpc-provider";
|
4 | export declare type InflightRequest = {
|
5 | callback: (error: Error, result: any) => void;
|
6 | payload: string;
|
7 | };
|
8 | export declare type Subscription = {
|
9 | tag: string;
|
10 | processFunc: (payload: any) => void;
|
11 | };
|
12 | export interface WebSocketLike {
|
13 | onopen: ((...args: Array<any>) => any) | null;
|
14 | onmessage: ((...args: Array<any>) => any) | null;
|
15 | onerror: ((...args: Array<any>) => any) | null;
|
16 | readyState: number;
|
17 | send(payload: any): void;
|
18 | close(code?: number, reason?: string): void;
|
19 | }
|
20 | export declare class WebSocketProvider extends JsonRpcProvider {
|
21 | readonly _websocket: any;
|
22 | readonly _requests: {
|
23 | [name: string]: InflightRequest;
|
24 | };
|
25 | readonly _detectNetwork: Promise<Network>;
|
26 | readonly _subIds: {
|
27 | [tag: string]: Promise<string>;
|
28 | };
|
29 | readonly _subs: {
|
30 | [name: string]: Subscription;
|
31 | };
|
32 | _wsReady: boolean;
|
33 | constructor(url: string | WebSocketLike, network?: Networkish);
|
34 | get websocket(): WebSocketLike;
|
35 | detectNetwork(): Promise<Network>;
|
36 | get pollingInterval(): number;
|
37 | resetEventsBlock(blockNumber: number): void;
|
38 | set pollingInterval(value: number);
|
39 | poll(): Promise<void>;
|
40 | set polling(value: boolean);
|
41 | send(method: string, params?: Array<any>): Promise<any>;
|
42 | static defaultUrl(): string;
|
43 | _subscribe(tag: string, param: Array<any>, processFunc: (result: any) => void): Promise<void>;
|
44 | _startEvent(event: Event): void;
|
45 | _stopEvent(event: Event): void;
|
46 | destroy(): Promise<void>;
|
47 | }
|
48 | //# sourceMappingURL=websocket-provider.d.ts.map |
\ | No newline at end of file |