import { JsonRpcPayload } from 'web3-providers'; import { ISendAsyncPayload } from '../base/models/isend-async-payload'; import { TerminalBaseProvider } from '../base/terminal-base-provider'; import { ITerminalWebsocketProvider } from './iterminal-websockets-provider'; import { ITerminalCustomWebSocketProviderOptions } from './models/iterminal-custom-websocket-provider-options'; import { ITerminalWebsocketProviderOptions } from './models/iterminal-websocket-provider-options'; export declare class TerminalWebsocketProvider extends TerminalBaseProvider implements ITerminalWebsocketProvider { connection: { close: () => void; }; private _lastNodeSavedResult; constructor(options: ITerminalCustomWebSocketProviderOptions | ITerminalWebsocketProviderOptions); /** * Send jsonrpc method interceptor * @param method The jsonrpc method (in some old cases it may send the `ISendAsyncPayload` interface) * @param parameters The parameters * @param _fromSendAsync This tells us if send async did the call which means `saveJsonRpcLog` * has already been called. web3 have different behaviour between 1.0 * and 2.0 so have to handle some edge cases here. */ send(method: string | ISendAsyncPayload, parameters?: any[], _fromSendAsync?: boolean): Promise; /** * If it supports subscriptions */ supportsSubscriptions(): boolean; /** * Register event listeners */ registerEventListeners(): void; /** * Send payload * @param payload The payload */ sendPayload(payload: JsonRpcPayload): Promise; /** * If the websocket connecting is connected */ isConnecting(): boolean; /** * Subscribe * @param subscribeMethod The subscribe method * @param subscriptionMethod The subscription method * @param parameters The parameters */ subscribe(subscribeMethod: string, subscriptionMethod: string, parameters: any[]): Promise; /** * On provider event * @param event The subscription id * @param callback The callback */ on(event: string, callback: (result: any) => void): void; /** * Unsubscribe from a method * @param subscriptionId The subscription id * @param unsubscribeMethod The unsubscribe method */ unsubscribe(subscriptionId: string, unsubscribeMethod: string): Promise; /** * Clear subscriptions * @param unsubscribeMethod The unsubscribe method */ clearSubscriptions(unsubscribeMethod: string): Promise; /** * Remove listener * @param type The listener type * @param callback The callback */ removeListener(type: string, callback: () => void): void; /** * Remove all listeners * @param type The listener type */ removeAllListeners(type: string): void; /** * Reset the websocket */ reset(): void; /** * Reconnect to the websocket connection */ reconnect(): void; /** * Disconnect from the websocket connection * @param code The code * @param reason The reason */ disconnect(code: number, reason: string): void; /** * Gets the provider and makes sure it comes back as `WebsocketProvider` type */ private get websocketProvider(); }