2023-03-03 18:25:07 -07:00
|
|
|
/**
|
2023-06-01 17:52:58 -04:00
|
|
|
* The available providers should suffice for most developers purposes,
|
|
|
|
* but the [[AbstractProvider]] class has many features which enable
|
|
|
|
* sub-classing it for specific purposes.
|
2023-03-03 18:25:07 -07:00
|
|
|
*
|
|
|
|
* @_section: api/providers/abstract-provider: Subclassing Provider [abstract-provider]
|
|
|
|
*/
|
|
|
|
import { FetchRequest } from "../utils/index.js";
|
|
|
|
import { EnsResolver } from "./ens-resolver.js";
|
|
|
|
import { Network } from "./network.js";
|
|
|
|
import { Block, FeeData, Log, TransactionReceipt, TransactionResponse } from "./provider.js";
|
|
|
|
import type { AddressLike } from "../address/index.js";
|
|
|
|
import type { BigNumberish } from "../utils/index.js";
|
|
|
|
import type { Listener } from "../utils/index.js";
|
|
|
|
import type { Networkish } from "./network.js";
|
|
|
|
import type { BlockParams, LogParams, TransactionReceiptParams, TransactionResponseParams } from "./formatting.js";
|
|
|
|
import type { BlockTag, EventFilter, Filter, FilterByBlockHash, OrphanFilter, PreparedTransactionRequest, Provider, ProviderEvent, TransactionRequest } from "./provider.js";
|
2023-06-01 17:52:58 -04:00
|
|
|
/**
|
|
|
|
* The types of additional event values that can be emitted for the
|
|
|
|
* ``"debug"`` event.
|
|
|
|
*/
|
2023-03-03 18:25:07 -07:00
|
|
|
export type DebugEventAbstractProvider = {
|
|
|
|
action: "sendCcipReadFetchRequest";
|
|
|
|
request: FetchRequest;
|
|
|
|
index: number;
|
|
|
|
urls: Array<string>;
|
|
|
|
} | {
|
|
|
|
action: "receiveCcipReadFetchResult";
|
|
|
|
request: FetchRequest;
|
|
|
|
result: any;
|
|
|
|
} | {
|
|
|
|
action: "receiveCcipReadFetchError";
|
|
|
|
request: FetchRequest;
|
|
|
|
result: any;
|
|
|
|
} | {
|
|
|
|
action: "sendCcipReadCall";
|
|
|
|
transaction: {
|
|
|
|
to: string;
|
|
|
|
data: string;
|
|
|
|
};
|
|
|
|
} | {
|
|
|
|
action: "receiveCcipReadCallResult";
|
|
|
|
transaction: {
|
|
|
|
to: string;
|
|
|
|
data: string;
|
|
|
|
};
|
|
|
|
result: string;
|
|
|
|
} | {
|
|
|
|
action: "receiveCcipReadCallError";
|
|
|
|
transaction: {
|
|
|
|
to: string;
|
|
|
|
data: string;
|
|
|
|
};
|
|
|
|
error: Error;
|
|
|
|
};
|
2023-06-01 17:52:58 -04:00
|
|
|
/**
|
|
|
|
* The value passed to the [[AbstractProvider-_getSubscriber]] method.
|
|
|
|
*
|
|
|
|
* Only developers sub-classing [[AbstractProvider[[ will care about this,
|
|
|
|
* if they are modifying a low-level feature of how subscriptions operate.
|
|
|
|
*/
|
2023-03-03 18:25:07 -07:00
|
|
|
export type Subscription = {
|
2023-04-25 20:04:48 +09:00
|
|
|
type: "block" | "close" | "debug" | "error" | "network" | "pending";
|
2023-03-03 18:25:07 -07:00
|
|
|
tag: string;
|
|
|
|
} | {
|
|
|
|
type: "transaction";
|
|
|
|
tag: string;
|
|
|
|
hash: string;
|
|
|
|
} | {
|
|
|
|
type: "event";
|
|
|
|
tag: string;
|
|
|
|
filter: EventFilter;
|
|
|
|
} | {
|
|
|
|
type: "orphan";
|
|
|
|
tag: string;
|
|
|
|
filter: OrphanFilter;
|
|
|
|
};
|
2023-06-01 17:52:58 -04:00
|
|
|
/**
|
|
|
|
* A **Subscriber** manages a subscription.
|
|
|
|
*
|
|
|
|
* Only developers sub-classing [[AbstractProvider[[ will care about this,
|
|
|
|
* if they are modifying a low-level feature of how subscriptions operate.
|
|
|
|
*/
|
2023-03-03 18:25:07 -07:00
|
|
|
export interface Subscriber {
|
2023-06-01 17:52:58 -04:00
|
|
|
/**
|
|
|
|
* Called initially when a subscriber is added the first time.
|
|
|
|
*/
|
2023-03-03 18:25:07 -07:00
|
|
|
start(): void;
|
2023-06-01 17:52:58 -04:00
|
|
|
/**
|
|
|
|
* Called when there are no more subscribers to the event.
|
|
|
|
*/
|
2023-03-03 18:25:07 -07:00
|
|
|
stop(): void;
|
2023-06-01 17:52:58 -04:00
|
|
|
/**
|
|
|
|
* Called when the subscription should pause.
|
|
|
|
*
|
|
|
|
* If %%dropWhilePaused%%, events that occur while paused should not
|
|
|
|
* be emitted [[resume]].
|
|
|
|
*/
|
2023-03-03 18:25:07 -07:00
|
|
|
pause(dropWhilePaused?: boolean): void;
|
2023-06-01 17:52:58 -04:00
|
|
|
/**
|
|
|
|
* Resume a paused subscriber.
|
|
|
|
*/
|
2023-03-03 18:25:07 -07:00
|
|
|
resume(): void;
|
2023-06-01 17:52:58 -04:00
|
|
|
/**
|
|
|
|
* The frequency (in ms) to poll for events, if polling is used by
|
|
|
|
* the subscriber.
|
|
|
|
*
|
|
|
|
* For non-polling subscribers, this must return ``undefined``.
|
|
|
|
*/
|
2023-03-03 18:25:07 -07:00
|
|
|
pollingInterval?: number;
|
|
|
|
}
|
2023-06-01 17:52:58 -04:00
|
|
|
/**
|
|
|
|
* An **UnmanagedSubscriber** is useful for events which do not require
|
|
|
|
* any additional management, such as ``"debug"`` which only requires
|
|
|
|
* emit in synchronous event loop triggered calls.
|
|
|
|
*/
|
2023-03-03 18:25:07 -07:00
|
|
|
export declare class UnmanagedSubscriber implements Subscriber {
|
2023-06-01 17:52:58 -04:00
|
|
|
/**
|
|
|
|
* The name fof the event.
|
|
|
|
*/
|
2023-03-03 18:25:07 -07:00
|
|
|
name: string;
|
2023-06-01 17:52:58 -04:00
|
|
|
/**
|
|
|
|
* Create a new UnmanagedSubscriber with %%name%%.
|
|
|
|
*/
|
2023-03-03 18:25:07 -07:00
|
|
|
constructor(name: string);
|
|
|
|
start(): void;
|
|
|
|
stop(): void;
|
|
|
|
pause(dropWhilePaused?: boolean): void;
|
|
|
|
resume(): void;
|
|
|
|
}
|
2023-06-01 17:52:58 -04:00
|
|
|
/**
|
|
|
|
* An **AbstractPlugin** is used to provide additional internal services
|
|
|
|
* to an [[AbstractProvider]] without adding backwards-incompatible changes
|
|
|
|
* to method signatures or other internal and complex logic.
|
|
|
|
*/
|
2023-03-03 18:25:07 -07:00
|
|
|
export interface AbstractProviderPlugin {
|
2023-06-01 17:52:58 -04:00
|
|
|
/**
|
|
|
|
* The reverse domain notation of the plugin.
|
|
|
|
*/
|
2023-03-03 18:25:07 -07:00
|
|
|
readonly name: string;
|
2023-06-01 17:52:58 -04:00
|
|
|
/**
|
|
|
|
* Creates a new instance of the plugin, connected to %%provider%%.
|
|
|
|
*/
|
2023-03-03 18:25:07 -07:00
|
|
|
connect(provider: AbstractProvider): AbstractProviderPlugin;
|
|
|
|
}
|
2023-06-01 17:52:58 -04:00
|
|
|
/**
|
|
|
|
* A normalized filter used for [[PerformActionRequest]] objects.
|
|
|
|
*/
|
2023-03-03 18:25:07 -07:00
|
|
|
export type PerformActionFilter = {
|
|
|
|
address?: string | Array<string>;
|
|
|
|
topics?: Array<null | string | Array<string>>;
|
|
|
|
fromBlock?: BlockTag;
|
|
|
|
toBlock?: BlockTag;
|
|
|
|
} | {
|
|
|
|
address?: string | Array<string>;
|
|
|
|
topics?: Array<null | string | Array<string>>;
|
|
|
|
blockHash?: string;
|
|
|
|
};
|
2023-06-01 17:52:58 -04:00
|
|
|
/**
|
|
|
|
* A normalized transactions used for [[PerformActionRequest]] objects.
|
|
|
|
*/
|
2023-03-03 18:25:07 -07:00
|
|
|
export interface PerformActionTransaction extends PreparedTransactionRequest {
|
2023-06-01 17:52:58 -04:00
|
|
|
/**
|
|
|
|
* The ``to`` address of the transaction.
|
|
|
|
*/
|
2023-03-03 18:25:07 -07:00
|
|
|
to?: string;
|
2023-06-01 17:52:58 -04:00
|
|
|
/**
|
|
|
|
* The sender of the transaction.
|
|
|
|
*/
|
2023-03-03 18:25:07 -07:00
|
|
|
from?: string;
|
|
|
|
}
|
2023-06-01 17:52:58 -04:00
|
|
|
/**
|
|
|
|
* The [[AbstractProvider]] methods will normalize all values and pass this
|
|
|
|
* type to [[AbstractProvider-_perform]].
|
|
|
|
*/
|
2023-03-03 18:25:07 -07:00
|
|
|
export type PerformActionRequest = {
|
|
|
|
method: "broadcastTransaction";
|
|
|
|
signedTransaction: string;
|
|
|
|
} | {
|
|
|
|
method: "call";
|
|
|
|
transaction: PerformActionTransaction;
|
|
|
|
blockTag: BlockTag;
|
|
|
|
} | {
|
|
|
|
method: "chainId";
|
|
|
|
} | {
|
|
|
|
method: "estimateGas";
|
|
|
|
transaction: PerformActionTransaction;
|
|
|
|
} | {
|
|
|
|
method: "getBalance";
|
|
|
|
address: string;
|
|
|
|
blockTag: BlockTag;
|
|
|
|
} | {
|
|
|
|
method: "getBlock";
|
|
|
|
blockTag: BlockTag;
|
|
|
|
includeTransactions: boolean;
|
|
|
|
} | {
|
|
|
|
method: "getBlock";
|
|
|
|
blockHash: string;
|
|
|
|
includeTransactions: boolean;
|
|
|
|
} | {
|
|
|
|
method: "getBlockNumber";
|
|
|
|
} | {
|
|
|
|
method: "getCode";
|
|
|
|
address: string;
|
|
|
|
blockTag: BlockTag;
|
|
|
|
} | {
|
|
|
|
method: "getGasPrice";
|
|
|
|
} | {
|
|
|
|
method: "getLogs";
|
|
|
|
filter: PerformActionFilter;
|
|
|
|
} | {
|
|
|
|
method: "getStorage";
|
|
|
|
address: string;
|
|
|
|
position: bigint;
|
|
|
|
blockTag: BlockTag;
|
|
|
|
} | {
|
|
|
|
method: "getTransaction";
|
|
|
|
hash: string;
|
|
|
|
} | {
|
|
|
|
method: "getTransactionCount";
|
|
|
|
address: string;
|
|
|
|
blockTag: BlockTag;
|
|
|
|
} | {
|
|
|
|
method: "getTransactionReceipt";
|
|
|
|
hash: string;
|
|
|
|
} | {
|
|
|
|
method: "getTransactionResult";
|
|
|
|
hash: string;
|
|
|
|
};
|
2023-06-13 21:47:44 -04:00
|
|
|
/**
|
|
|
|
* Options for configuring some internal aspects of an [[AbstractProvider]].
|
|
|
|
*
|
|
|
|
* **``cacheTimeout``** - how long to cache a low-level ``_perform``
|
|
|
|
* for, based on input parameters. This reduces the number of calls
|
|
|
|
* to getChainId and getBlockNumber, but may break test chains which
|
|
|
|
* can perform operations (internally) synchronously. Use ``-1`` to
|
|
|
|
* disable, ``0`` will only buffer within the same event loop and
|
|
|
|
* any other value is in ms. (default: ``250``)
|
|
|
|
*/
|
|
|
|
export type AbstractProviderOptions = {
|
|
|
|
cacheTimeout?: number;
|
|
|
|
};
|
2023-06-01 17:52:58 -04:00
|
|
|
/**
|
|
|
|
* An **AbstractProvider** provides a base class for other sub-classes to
|
|
|
|
* implement the [[Provider]] API by normalizing input arguments and
|
|
|
|
* formatting output results as well as tracking events for consistent
|
|
|
|
* behaviour on an eventually-consistent network.
|
|
|
|
*/
|
2023-03-03 18:25:07 -07:00
|
|
|
export declare class AbstractProvider implements Provider {
|
|
|
|
#private;
|
2023-06-01 17:52:58 -04:00
|
|
|
/**
|
|
|
|
* Create a new **AbstractProvider** connected to %%network%%, or
|
|
|
|
* use the various network detection capabilities to discover the
|
|
|
|
* [[Network]] if necessary.
|
|
|
|
*/
|
2023-06-13 21:47:44 -04:00
|
|
|
constructor(_network?: "any" | Networkish, options?: AbstractProviderOptions);
|
2023-06-01 17:52:58 -04:00
|
|
|
/**
|
|
|
|
* Returns ``this``, to allow an **AbstractProvider** to implement
|
|
|
|
* the [[ContractRunner]] interface.
|
|
|
|
*/
|
2023-03-03 18:25:07 -07:00
|
|
|
get provider(): this;
|
2023-06-01 17:52:58 -04:00
|
|
|
/**
|
|
|
|
* Returns all the registered plug-ins.
|
|
|
|
*/
|
2023-03-03 18:25:07 -07:00
|
|
|
get plugins(): Array<AbstractProviderPlugin>;
|
2023-06-01 17:52:58 -04:00
|
|
|
/**
|
|
|
|
* Attach a new plug-in.
|
|
|
|
*/
|
2023-03-03 18:25:07 -07:00
|
|
|
attachPlugin(plugin: AbstractProviderPlugin): this;
|
2023-06-01 17:52:58 -04:00
|
|
|
/**
|
|
|
|
* Get a plugin by name.
|
|
|
|
*/
|
2023-03-03 18:25:07 -07:00
|
|
|
getPlugin<T extends AbstractProviderPlugin = AbstractProviderPlugin>(name: string): null | T;
|
2023-06-01 17:52:58 -04:00
|
|
|
/**
|
|
|
|
* Prevent any CCIP-read operation, regardless of whether requested
|
|
|
|
* in a [[call]] using ``enableCcipRead``.
|
|
|
|
*/
|
2023-03-03 18:25:07 -07:00
|
|
|
get disableCcipRead(): boolean;
|
|
|
|
set disableCcipRead(value: boolean);
|
2023-06-01 17:52:58 -04:00
|
|
|
/**
|
|
|
|
* Resolves to the data for executing the CCIP-read operations.
|
|
|
|
*/
|
2023-03-03 18:25:07 -07:00
|
|
|
ccipReadFetch(tx: PerformActionTransaction, calldata: string, urls: Array<string>): Promise<null | string>;
|
2023-06-01 17:52:58 -04:00
|
|
|
/**
|
|
|
|
* Provides the opportunity for a sub-class to wrap a block before
|
|
|
|
* returning it, to add additional properties or an alternate
|
|
|
|
* sub-class of [[Block]].
|
|
|
|
*/
|
2023-03-03 18:25:07 -07:00
|
|
|
_wrapBlock(value: BlockParams, network: Network): Block;
|
2023-06-01 17:52:58 -04:00
|
|
|
/**
|
|
|
|
* Provides the opportunity for a sub-class to wrap a log before
|
|
|
|
* returning it, to add additional properties or an alternate
|
|
|
|
* sub-class of [[Log]].
|
|
|
|
*/
|
2023-03-03 18:25:07 -07:00
|
|
|
_wrapLog(value: LogParams, network: Network): Log;
|
2023-06-01 17:52:58 -04:00
|
|
|
/**
|
|
|
|
* Provides the opportunity for a sub-class to wrap a transaction
|
|
|
|
* receipt before returning it, to add additional properties or an
|
|
|
|
* alternate sub-class of [[TransactionReceipt]].
|
|
|
|
*/
|
2023-03-03 18:25:07 -07:00
|
|
|
_wrapTransactionReceipt(value: TransactionReceiptParams, network: Network): TransactionReceipt;
|
2023-06-01 17:52:58 -04:00
|
|
|
/**
|
|
|
|
* Provides the opportunity for a sub-class to wrap a transaction
|
|
|
|
* response before returning it, to add additional properties or an
|
|
|
|
* alternate sub-class of [[TransactionResponse]].
|
|
|
|
*/
|
2023-03-03 18:25:07 -07:00
|
|
|
_wrapTransactionResponse(tx: TransactionResponseParams, network: Network): TransactionResponse;
|
2023-06-01 17:52:58 -04:00
|
|
|
/**
|
|
|
|
* Resolves to the Network, forcing a network detection using whatever
|
|
|
|
* technique the sub-class requires.
|
|
|
|
*
|
|
|
|
* Sub-classes **must** override this.
|
|
|
|
*/
|
2023-03-03 18:25:07 -07:00
|
|
|
_detectNetwork(): Promise<Network>;
|
2023-06-01 17:52:58 -04:00
|
|
|
/**
|
|
|
|
* Sub-classes should use this to perform all built-in operations. All
|
|
|
|
* methods sanitizes and normalizes the values passed into this.
|
|
|
|
*
|
|
|
|
* Sub-classes **must** override this.
|
|
|
|
*/
|
2023-03-03 18:25:07 -07:00
|
|
|
_perform<T = any>(req: PerformActionRequest): Promise<T>;
|
|
|
|
getBlockNumber(): Promise<number>;
|
2023-06-01 17:52:58 -04:00
|
|
|
/**
|
|
|
|
* Returns or resolves to the address for %%address%%, resolving ENS
|
|
|
|
* names and [[Addressable]] objects and returning if already an
|
|
|
|
* address.
|
|
|
|
*/
|
2023-03-03 18:25:07 -07:00
|
|
|
_getAddress(address: AddressLike): string | Promise<string>;
|
2023-06-01 17:52:58 -04:00
|
|
|
/**
|
|
|
|
* Returns or resolves to a valid block tag for %%blockTag%%, resolving
|
|
|
|
* negative values and returning if already a valid block tag.
|
|
|
|
*/
|
2023-03-03 18:25:07 -07:00
|
|
|
_getBlockTag(blockTag?: BlockTag): string | Promise<string>;
|
2023-06-01 17:52:58 -04:00
|
|
|
/**
|
|
|
|
* Returns or resolves to a filter for %%filter%%, resolving any ENS
|
|
|
|
* names or [[Addressable]] object and returning if already a valid
|
|
|
|
* filter.
|
|
|
|
*/
|
2023-03-03 18:25:07 -07:00
|
|
|
_getFilter(filter: Filter | FilterByBlockHash): PerformActionFilter | Promise<PerformActionFilter>;
|
2023-06-01 17:52:58 -04:00
|
|
|
/**
|
|
|
|
* Returns or resovles to a transaction for %%request%%, resolving
|
|
|
|
* any ENS names or [[Addressable]] and returning if already a valid
|
|
|
|
* transaction.
|
|
|
|
*/
|
2023-03-03 18:25:07 -07:00
|
|
|
_getTransactionRequest(_request: TransactionRequest): PerformActionTransaction | Promise<PerformActionTransaction>;
|
|
|
|
getNetwork(): Promise<Network>;
|
|
|
|
getFeeData(): Promise<FeeData>;
|
|
|
|
estimateGas(_tx: TransactionRequest): Promise<bigint>;
|
|
|
|
call(_tx: TransactionRequest): Promise<string>;
|
|
|
|
getBalance(address: AddressLike, blockTag?: BlockTag): Promise<bigint>;
|
|
|
|
getTransactionCount(address: AddressLike, blockTag?: BlockTag): Promise<number>;
|
|
|
|
getCode(address: AddressLike, blockTag?: BlockTag): Promise<string>;
|
|
|
|
getStorage(address: AddressLike, _position: BigNumberish, blockTag?: BlockTag): Promise<string>;
|
|
|
|
broadcastTransaction(signedTx: string): Promise<TransactionResponse>;
|
|
|
|
getBlock(block: BlockTag | string, prefetchTxs?: boolean): Promise<null | Block>;
|
|
|
|
getTransaction(hash: string): Promise<null | TransactionResponse>;
|
|
|
|
getTransactionReceipt(hash: string): Promise<null | TransactionReceipt>;
|
|
|
|
getTransactionResult(hash: string): Promise<null | string>;
|
|
|
|
getLogs(_filter: Filter | FilterByBlockHash): Promise<Array<Log>>;
|
|
|
|
_getProvider(chainId: number): AbstractProvider;
|
|
|
|
getResolver(name: string): Promise<null | EnsResolver>;
|
|
|
|
getAvatar(name: string): Promise<null | string>;
|
|
|
|
resolveName(name: string): Promise<null | string>;
|
|
|
|
lookupAddress(address: string): Promise<null | string>;
|
|
|
|
waitForTransaction(hash: string, _confirms?: null | number, timeout?: null | number): Promise<null | TransactionReceipt>;
|
|
|
|
waitForBlock(blockTag?: BlockTag): Promise<Block>;
|
2023-06-01 17:52:58 -04:00
|
|
|
/**
|
|
|
|
* Clear a timer created using the [[_setTimeout]] method.
|
|
|
|
*/
|
2023-03-03 18:25:07 -07:00
|
|
|
_clearTimeout(timerId: number): void;
|
2023-06-01 17:52:58 -04:00
|
|
|
/**
|
|
|
|
* Create a timer that will execute %%func%% after at least %%timeout%%
|
|
|
|
* (in ms). If %%timeout%% is unspecified, then %%func%% will execute
|
|
|
|
* in the next event loop.
|
|
|
|
*
|
|
|
|
* [Pausing](AbstractProvider-paused) the provider will pause any
|
|
|
|
* associated timers.
|
|
|
|
*/
|
2023-03-03 18:25:07 -07:00
|
|
|
_setTimeout(_func: () => void, timeout?: number): number;
|
2023-06-01 17:52:58 -04:00
|
|
|
/**
|
|
|
|
* Perform %%func%% on each subscriber.
|
|
|
|
*/
|
2023-03-03 18:25:07 -07:00
|
|
|
_forEachSubscriber(func: (s: Subscriber) => void): void;
|
2023-06-01 17:52:58 -04:00
|
|
|
/**
|
|
|
|
* Sub-classes may override this to customize subscription
|
|
|
|
* implementations.
|
|
|
|
*/
|
2023-03-03 18:25:07 -07:00
|
|
|
_getSubscriber(sub: Subscription): Subscriber;
|
2023-06-01 17:52:58 -04:00
|
|
|
/**
|
|
|
|
* If a [[Subscriber]] fails and needs to replace itself, this
|
|
|
|
* method may be used.
|
|
|
|
*
|
|
|
|
* For example, this is used for providers when using the
|
|
|
|
* ``eth_getFilterChanges`` method, which can return null if state
|
|
|
|
* filters are not supported by the backend, allowing the Subscriber
|
|
|
|
* to swap in a [[PollingEventSubscriber]].
|
|
|
|
*/
|
2023-03-03 18:25:07 -07:00
|
|
|
_recoverSubscriber(oldSub: Subscriber, newSub: Subscriber): void;
|
|
|
|
on(event: ProviderEvent, listener: Listener): Promise<this>;
|
|
|
|
once(event: ProviderEvent, listener: Listener): Promise<this>;
|
|
|
|
emit(event: ProviderEvent, ...args: Array<any>): Promise<boolean>;
|
|
|
|
listenerCount(event?: ProviderEvent): Promise<number>;
|
|
|
|
listeners(event?: ProviderEvent): Promise<Array<Listener>>;
|
|
|
|
off(event: ProviderEvent, listener?: Listener): Promise<this>;
|
|
|
|
removeAllListeners(event?: ProviderEvent): Promise<this>;
|
|
|
|
addListener(event: ProviderEvent, listener: Listener): Promise<this>;
|
|
|
|
removeListener(event: ProviderEvent, listener: Listener): Promise<this>;
|
2023-06-06 22:42:28 -04:00
|
|
|
/**
|
|
|
|
* If this provider has been destroyed using the [[destroy]] method.
|
|
|
|
*
|
|
|
|
* Once destroyed, all resources are reclaimed, internal event loops
|
|
|
|
* and timers are cleaned up and no further requests may be sent to
|
|
|
|
* the provider.
|
|
|
|
*/
|
|
|
|
get destroyed(): boolean;
|
2023-06-01 17:52:58 -04:00
|
|
|
/**
|
|
|
|
* Sub-classes may use this to shutdown any sockets or release their
|
2023-06-06 22:42:28 -04:00
|
|
|
* resources and reject any pending requests.
|
2023-06-01 17:52:58 -04:00
|
|
|
*
|
|
|
|
* Sub-classes **must** call ``super.destroy()``.
|
|
|
|
*/
|
2023-03-03 18:25:07 -07:00
|
|
|
destroy(): void;
|
2023-06-01 17:52:58 -04:00
|
|
|
/**
|
|
|
|
* Whether the provider is currently paused.
|
|
|
|
*
|
|
|
|
* A paused provider will not emit any events, and generally should
|
|
|
|
* not make any requests to the network, but that is up to sub-classes
|
|
|
|
* to manage.
|
|
|
|
*
|
|
|
|
* Setting ``paused = true`` is identical to calling ``.pause(false)``,
|
|
|
|
* which will buffer any events that occur while paused until the
|
|
|
|
* provider is unpaused.
|
|
|
|
*/
|
2023-03-03 18:25:07 -07:00
|
|
|
get paused(): boolean;
|
|
|
|
set paused(pause: boolean);
|
2023-06-01 17:52:58 -04:00
|
|
|
/**
|
|
|
|
* Pause the provider. If %%dropWhilePaused%%, any events that occur
|
|
|
|
* while paused are dropped, otherwise all events will be emitted once
|
|
|
|
* the provider is unpaused.
|
|
|
|
*/
|
2023-03-03 18:25:07 -07:00
|
|
|
pause(dropWhilePaused?: boolean): void;
|
2023-06-01 17:52:58 -04:00
|
|
|
/**
|
|
|
|
* Resume the provider.
|
|
|
|
*/
|
2023-03-03 18:25:07 -07:00
|
|
|
resume(): void;
|
|
|
|
}
|
2023-04-27 21:19:55 +09:00
|
|
|
//# sourceMappingURL=abstract-provider.d.ts.map
|