import { Listener } from '@ethersproject/abstract-provider'; import { AlchemyEventType } from '../types/types'; import { EthersEvent } from '../internal/internal-types'; import { CommunityResourcable, WebSocketProvider } from '@ethersproject/providers'; /** * SDK's custom implementation fo the ethers.js's 'AlchemyWebSocketProvider'. * * Do not call this constructor directly. Instead, instantiate an instance of * {@link Alchemy} and call {@link Alchemy.config.getWebSocketProvider()}. * * @public */ export declare class AlchemyWebSocketProvider extends WebSocketProvider implements CommunityResourcable { _events: Array; readonly apiKey: string; /** * Overridden implementation of ethers that includes Alchemy based subscriptions. * * @param eventName Event to subscribe to * @param listener The listener function to call when the event is triggered. * @override * @public */ on(eventName: AlchemyEventType, listener: Listener): this; /** * Overridden implementation of ethers that includes Alchemy based * subscriptions. Adds a listener to the triggered for only the next * {@link eventName} event, after which it will be removed. * * @param eventName Event to subscribe to * @param listener The listener function to call when the event is triggered. * @override * @public */ once(eventName: AlchemyEventType, listener: Listener): this; /** * Removes the provided {@link listener} for the {@link eventName} event. If no * listener is provided, all listeners for the event will be removed. * * @param eventName Event to unlisten to. * @param listener The listener function to remove. * @override * @public */ off(eventName: AlchemyEventType, listener?: Listener): this; /** * Remove all listeners for the provided {@link eventName} event. If no event * is provided, all events and their listeners are removed. * * @param eventName The event to remove all listeners for. * @override * @public */ removeAllListeners(eventName?: AlchemyEventType): this; /** * Returns the number of listeners for the provided {@link eventName} event. If * no event is provided, the total number of listeners for all events is returned. * * @param eventName The event to get the number of listeners for. * @public * @override */ listenerCount(eventName?: AlchemyEventType): number; /** * Returns an array of listeners for the provided {@link eventName} event. If * no event is provided, all listeners will be included. * * @param eventName The event to get the listeners for. * @public * @override */ listeners(eventName?: AlchemyEventType): Array; /** @override */ destroy(): Promise; /** * Overrides the ether's `isCommunityResource()` method. Returns true if the * current api key is the default key. * * @override */ isCommunityResource(): boolean; /** * DO NOT MODIFY. * * Original code copied over from ether.js's `BaseProvider.off()`. * * This method is copied over directly in order to implement Alchemy's unique * subscription types. The only difference is that this method calls * {@link getAlchemyEventTag} instead of the original `getEventTag()` method in * order to parse the Alchemy subscription event. * * @private */ private _off; /** * DO NOT MODIFY. * * Original code copied over from ether.js's `BaseProvider.removeAllListeners()`. * * This method is copied over directly in order to implement Alchemy's unique * subscription types. The only difference is that this method calls * {@link getAlchemyEventTag} instead of the original `getEventTag()` method in * order to parse the Alchemy subscription event. * * @private */ private _removeAllListeners; /** * DO NOT MODIFY. * * Original code copied over from ether.js's `BaseProvider.listenerCount()`. * * This method is copied over directly in order to implement Alchemy's unique * subscription types. The only difference is that this method calls * {@link getAlchemyEventTag} instead of the original `getEventTag()` method in * order to parse the Alchemy subscription event. * * @private */ private _listenerCount; /** * DO NOT MODIFY. * * Original code copied over from ether.js's `BaseProvider.listeners()`. * * This method is copied over directly in order to implement Alchemy's unique * subscription types. The only difference is that this method calls * {@link getAlchemyEventTag} instead of the original `getEventTag()` method in * order to parse the Alchemy subscription event. * * @private */ private _listeners; }