2020-03-12 19:14:50 +01:00
|
|
|
import { Networkish } from "@ethersproject/networks";
|
|
|
|
import { Event } from "./base-provider";
|
|
|
|
import { JsonRpcProvider } from "./json-rpc-provider";
|
|
|
|
export declare type InflightRequest = {
|
|
|
|
callback: (error: Error, result: any) => void;
|
|
|
|
payload: string;
|
|
|
|
};
|
|
|
|
export declare type Subscription = {
|
|
|
|
tag: string;
|
|
|
|
processFunc: (payload: any) => void;
|
|
|
|
};
|
|
|
|
export declare class WebSocketProvider extends JsonRpcProvider {
|
|
|
|
readonly _websocket: any;
|
|
|
|
readonly _requests: {
|
|
|
|
[name: string]: InflightRequest;
|
|
|
|
};
|
|
|
|
readonly _subIds: {
|
|
|
|
[tag: string]: Promise<string>;
|
|
|
|
};
|
|
|
|
readonly _subs: {
|
|
|
|
[name: string]: Subscription;
|
|
|
|
};
|
|
|
|
_wsReady: boolean;
|
|
|
|
constructor(url: string, network: Networkish);
|
2020-03-22 14:57:17 -04:00
|
|
|
get pollingInterval(): number;
|
2020-03-12 19:14:50 +01:00
|
|
|
resetEventsBlock(blockNumber: number): void;
|
2020-03-22 14:57:17 -04:00
|
|
|
set pollingInterval(value: number);
|
2020-03-12 19:14:50 +01:00
|
|
|
poll(): Promise<void>;
|
2020-03-22 14:57:17 -04:00
|
|
|
set polling(value: boolean);
|
2020-03-12 19:14:50 +01:00
|
|
|
send(method: string, params?: Array<any>): Promise<any>;
|
|
|
|
static defaultUrl(): string;
|
|
|
|
_subscribe(tag: string, param: Array<any>, processFunc: (result: any) => void): Promise<void>;
|
|
|
|
_startEvent(event: Event): void;
|
|
|
|
_stopEvent(event: Event): void;
|
|
|
|
}
|