2020-03-12 21:14:50 +03:00
|
|
|
/// <reference types="node" />
|
2019-05-15 01:48:48 +03:00
|
|
|
import { Block, BlockTag, BlockWithTransactions, EventType, Filter, FilterByBlockHash, Listener, Log, Provider, TransactionReceipt, TransactionRequest, TransactionResponse } from "@ethersproject/abstract-provider";
|
|
|
|
import { BigNumber, BigNumberish } from "@ethersproject/bignumber";
|
|
|
|
import { Network, Networkish } from "@ethersproject/networks";
|
|
|
|
import { Transaction } from "@ethersproject/transactions";
|
|
|
|
import { Formatter } from "./formatter";
|
|
|
|
/**
|
|
|
|
* EventType
|
|
|
|
* - "block"
|
|
|
|
* - "pending"
|
|
|
|
* - "error"
|
|
|
|
* - filter
|
|
|
|
* - topics array
|
|
|
|
* - transaction hash
|
|
|
|
*/
|
2020-03-12 21:14:50 +03:00
|
|
|
export declare class Event {
|
2019-05-15 01:48:48 +03:00
|
|
|
readonly listener: Listener;
|
|
|
|
readonly once: boolean;
|
|
|
|
readonly tag: string;
|
|
|
|
constructor(tag: string, listener: Listener, once: boolean);
|
2020-03-22 21:57:17 +03:00
|
|
|
get type(): string;
|
|
|
|
get hash(): string;
|
|
|
|
get filter(): Filter;
|
2019-05-15 01:48:48 +03:00
|
|
|
pollable(): boolean;
|
|
|
|
}
|
|
|
|
export declare class BaseProvider extends Provider {
|
|
|
|
_network: Network;
|
|
|
|
_events: Array<Event>;
|
|
|
|
formatter: Formatter;
|
|
|
|
_emitted: {
|
|
|
|
[eventName: string]: number | "pending";
|
|
|
|
};
|
|
|
|
_pollingInterval: number;
|
2020-03-12 21:14:50 +03:00
|
|
|
_poller: NodeJS.Timer;
|
2019-05-15 01:48:48 +03:00
|
|
|
_lastBlockNumber: number;
|
|
|
|
_fastBlockNumber: number;
|
|
|
|
_fastBlockNumberPromise: Promise<number>;
|
|
|
|
_fastQueryDate: number;
|
2019-11-20 12:57:38 +03:00
|
|
|
_maxInternalBlockNumber: number;
|
|
|
|
_internalBlockNumber: Promise<{
|
|
|
|
blockNumber: number;
|
|
|
|
reqTime: number;
|
|
|
|
respTime: number;
|
|
|
|
}>;
|
2019-05-15 01:48:48 +03:00
|
|
|
/**
|
|
|
|
* ready
|
|
|
|
*
|
|
|
|
* A Promise<Network> that resolves only once the provider is ready.
|
|
|
|
*
|
|
|
|
* Sub-classes that call the super with a network without a chainId
|
|
|
|
* MUST set this. Standard named networks have a known chainId.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
ready: Promise<Network>;
|
|
|
|
constructor(network: Networkish | Promise<Network>);
|
|
|
|
static getFormatter(): Formatter;
|
2019-07-02 23:13:03 +03:00
|
|
|
static getNetwork(network: Networkish): Network;
|
2019-11-20 12:57:38 +03:00
|
|
|
_getInternalBlockNumber(maxAge: number): Promise<number>;
|
|
|
|
poll(): Promise<void>;
|
2019-05-15 01:48:48 +03:00
|
|
|
resetEventsBlock(blockNumber: number): void;
|
2020-03-22 21:57:17 +03:00
|
|
|
get network(): Network;
|
2019-05-15 01:48:48 +03:00
|
|
|
getNetwork(): Promise<Network>;
|
2020-03-22 21:57:17 +03:00
|
|
|
get blockNumber(): number;
|
|
|
|
get polling(): boolean;
|
|
|
|
set polling(value: boolean);
|
|
|
|
get pollingInterval(): number;
|
|
|
|
set pollingInterval(value: number);
|
2019-05-15 01:48:48 +03:00
|
|
|
_getFastBlockNumber(): Promise<number>;
|
|
|
|
_setFastBlockNumber(blockNumber: number): void;
|
2020-02-04 09:06:47 +03:00
|
|
|
waitForTransaction(transactionHash: string, confirmations?: number, timeout?: number): Promise<TransactionReceipt>;
|
2019-05-15 01:48:48 +03:00
|
|
|
getBlockNumber(): Promise<number>;
|
|
|
|
getGasPrice(): Promise<BigNumber>;
|
|
|
|
getBalance(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<BigNumber>;
|
|
|
|
getTransactionCount(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<number>;
|
|
|
|
getCode(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>;
|
|
|
|
getStorageAt(addressOrName: string | Promise<string>, position: BigNumberish | Promise<BigNumberish>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>;
|
|
|
|
_wrapTransaction(tx: Transaction, hash?: string): TransactionResponse;
|
|
|
|
sendTransaction(signedTransaction: string | Promise<string>): Promise<TransactionResponse>;
|
|
|
|
_getTransactionRequest(transaction: TransactionRequest | Promise<TransactionRequest>): Promise<Transaction>;
|
|
|
|
_getFilter(filter: Filter | FilterByBlockHash | Promise<Filter | FilterByBlockHash>): Promise<Filter | FilterByBlockHash>;
|
|
|
|
call(transaction: TransactionRequest | Promise<TransactionRequest>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>;
|
|
|
|
estimateGas(transaction: TransactionRequest | Promise<TransactionRequest>): Promise<BigNumber>;
|
2019-05-24 02:13:44 +03:00
|
|
|
_getAddress(addressOrName: string | Promise<string>): Promise<string>;
|
2019-05-15 01:48:48 +03:00
|
|
|
_getBlock(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>, includeTransactions?: boolean): Promise<Block | BlockWithTransactions>;
|
|
|
|
getBlock(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>): Promise<Block>;
|
|
|
|
getBlockWithTransactions(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>): Promise<BlockWithTransactions>;
|
2019-11-20 12:57:38 +03:00
|
|
|
getTransaction(transactionHash: string | Promise<string>): Promise<TransactionResponse>;
|
|
|
|
getTransactionReceipt(transactionHash: string | Promise<string>): Promise<TransactionReceipt>;
|
2019-05-15 01:48:48 +03:00
|
|
|
getLogs(filter: Filter | FilterByBlockHash | Promise<Filter | FilterByBlockHash>): Promise<Array<Log>>;
|
|
|
|
getEtherPrice(): Promise<number>;
|
|
|
|
_getBlockTag(blockTag: BlockTag | Promise<BlockTag>): Promise<BlockTag>;
|
|
|
|
_getResolver(name: string): Promise<string>;
|
|
|
|
resolveName(name: string | Promise<string>): Promise<string>;
|
|
|
|
lookupAddress(address: string | Promise<string>): Promise<string>;
|
|
|
|
perform(method: string, params: any): Promise<any>;
|
2020-03-12 21:14:50 +03:00
|
|
|
_startEvent(event: Event): void;
|
|
|
|
_stopEvent(event: Event): void;
|
2019-05-15 01:48:48 +03:00
|
|
|
_addEventListener(eventName: EventType, listener: Listener, once: boolean): this;
|
|
|
|
on(eventName: EventType, listener: Listener): this;
|
|
|
|
once(eventName: EventType, listener: Listener): this;
|
|
|
|
emit(eventName: EventType, ...args: Array<any>): boolean;
|
|
|
|
listenerCount(eventName?: EventType): number;
|
|
|
|
listeners(eventName?: EventType): Array<Listener>;
|
|
|
|
off(eventName: EventType, listener?: Listener): this;
|
|
|
|
removeAllListeners(eventName?: EventType): this;
|
|
|
|
}
|