ethers.js/packages/providers/lib.esm/base-provider.d.ts

156 lines
7.5 KiB
TypeScript
Raw Permalink Normal View History

2020-03-12 19:14:50 +01:00
/// <reference types="node" />
2019-05-14 18:48:48 -04: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";
2020-06-01 05:04:12 -04:00
import { Deferrable } from "@ethersproject/properties";
2019-05-14 18:48:48 -04:00
import { Transaction } from "@ethersproject/transactions";
import { Formatter } from "./formatter";
2020-03-12 19:14:50 +01:00
export declare class Event {
2019-05-14 18:48:48 -04:00
readonly listener: Listener;
readonly once: boolean;
readonly tag: string;
2022-03-09 14:58:07 -05:00
_lastBlockNumber: number;
_inflight: boolean;
2019-05-14 18:48:48 -04:00
constructor(tag: string, listener: Listener, once: boolean);
2020-04-15 18:28:04 -04:00
get event(): EventType;
get type(): string;
get hash(): string;
get filter(): Filter;
2019-05-14 18:48:48 -04:00
pollable(): boolean;
}
2020-09-04 01:37:14 -04:00
export interface EnsResolver {
readonly name: string;
readonly address: string;
2021-10-16 02:29:27 -04:00
getAddress(coinType?: 60): Promise<null | string>;
getContentHash(): Promise<null | string>;
getText(key: string): Promise<null | string>;
2020-09-04 01:37:14 -04:00
}
export interface EnsProvider {
2021-10-16 02:29:27 -04:00
resolveName(name: string): Promise<null | string>;
lookupAddress(address: string): Promise<null | string>;
getResolver(name: string): Promise<null | EnsResolver>;
2020-09-04 01:37:14 -04:00
}
2021-10-19 00:01:37 -04:00
export interface Avatar {
url: string;
linkage: Array<{
type: string;
content: string;
}>;
}
2020-09-04 01:37:14 -04:00
export declare class Resolver implements EnsResolver {
readonly provider: BaseProvider;
readonly name: string;
readonly address: string;
2021-10-19 00:01:37 -04:00
readonly _resolvedAddress: null | string;
2022-03-09 02:56:08 -05:00
_supportsEip2544: null | Promise<boolean>;
2021-10-19 00:01:37 -04:00
constructor(provider: BaseProvider, address: string, name: string, resolvedAddress?: string);
2022-03-09 02:56:08 -05:00
supportsWildcard(): Promise<boolean>;
_fetch(selector: string, parameters?: string): Promise<null | string>;
2021-10-19 00:01:37 -04:00
_fetchBytes(selector: string, parameters?: string): Promise<null | string>;
2020-09-04 01:37:14 -04:00
_getAddress(coinType: number, hexBytes: string): string;
getAddress(coinType?: number): Promise<string>;
2021-10-19 00:01:37 -04:00
getAvatar(): Promise<null | Avatar>;
2020-09-04 01:37:14 -04:00
getContentHash(): Promise<string>;
getText(key: string): Promise<string>;
}
export declare class BaseProvider extends Provider implements EnsProvider {
2020-05-03 17:53:58 -04:00
_networkPromise: Promise<Network>;
2019-05-14 18:48:48 -04:00
_network: Network;
_events: Array<Event>;
formatter: Formatter;
_emitted: {
[eventName: string]: number | "pending";
};
_pollingInterval: number;
2020-03-12 19:14:50 +01:00
_poller: NodeJS.Timer;
2020-05-04 23:01:04 -04:00
_bootstrapPoll: NodeJS.Timer;
2019-05-14 18:48:48 -04:00
_lastBlockNumber: number;
2022-03-09 02:56:08 -05:00
_maxFilterBlockRange: number;
2019-05-14 18:48:48 -04:00
_fastBlockNumber: number;
_fastBlockNumberPromise: Promise<number>;
_fastQueryDate: number;
2019-11-20 18:57:38 +09:00
_maxInternalBlockNumber: number;
_internalBlockNumber: Promise<{
blockNumber: number;
reqTime: number;
respTime: number;
}>;
2020-06-03 03:47:17 -04:00
readonly anyNetwork: boolean;
2022-03-09 02:56:08 -05:00
disableCcipRead: boolean;
2019-05-14 18:48:48 -04: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.
*
*/
constructor(network: Networkish | Promise<Network>);
2020-05-03 17:53:58 -04:00
_ready(): Promise<Network>;
get ready(): Promise<Network>;
2019-05-14 18:48:48 -04:00
static getFormatter(): Formatter;
2019-07-02 16:13:03 -04:00
static getNetwork(network: Networkish): Network;
2022-03-09 02:56:08 -05:00
ccipReadFetch(tx: Transaction, calldata: string, urls: Array<string>): Promise<null | string>;
2019-11-20 18:57:38 +09:00
_getInternalBlockNumber(maxAge: number): Promise<number>;
poll(): Promise<void>;
2019-05-14 18:48:48 -04:00
resetEventsBlock(blockNumber: number): void;
get network(): Network;
2020-06-03 03:47:17 -04:00
detectNetwork(): Promise<Network>;
2019-05-14 18:48:48 -04:00
getNetwork(): Promise<Network>;
get blockNumber(): number;
get polling(): boolean;
set polling(value: boolean);
get pollingInterval(): number;
set pollingInterval(value: number);
2019-05-14 18:48:48 -04:00
_getFastBlockNumber(): Promise<number>;
_setFastBlockNumber(blockNumber: number): void;
2020-02-04 01:06:47 -05:00
waitForTransaction(transactionHash: string, confirmations?: number, timeout?: number): Promise<TransactionReceipt>;
2021-05-17 16:19:36 -04:00
_waitForTransaction(transactionHash: string, confirmations: number, timeout: number, replaceable: {
data: string;
from: string;
nonce: number;
to: string;
value: BigNumber;
startBlock: number;
}): Promise<TransactionReceipt>;
2019-05-14 18:48:48 -04: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>;
2021-05-17 16:19:36 -04:00
_wrapTransaction(tx: Transaction, hash?: string, startBlock?: number): TransactionResponse;
2019-05-14 18:48:48 -04:00
sendTransaction(signedTransaction: string | Promise<string>): Promise<TransactionResponse>;
2020-06-01 05:04:12 -04:00
_getTransactionRequest(transaction: Deferrable<TransactionRequest>): Promise<Transaction>;
2019-05-14 18:48:48 -04:00
_getFilter(filter: Filter | FilterByBlockHash | Promise<Filter | FilterByBlockHash>): Promise<Filter | FilterByBlockHash>;
2022-03-09 02:56:08 -05:00
_call(transaction: TransactionRequest, blockTag: BlockTag, attempt: number): Promise<string>;
2020-06-01 05:04:12 -04:00
call(transaction: Deferrable<TransactionRequest>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>;
estimateGas(transaction: Deferrable<TransactionRequest>): Promise<BigNumber>;
2019-05-23 19:13:44 -04:00
_getAddress(addressOrName: string | Promise<string>): Promise<string>;
2019-05-14 18:48:48 -04: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 18:57:38 +09:00
getTransaction(transactionHash: string | Promise<string>): Promise<TransactionResponse>;
getTransactionReceipt(transactionHash: string | Promise<string>): Promise<TransactionReceipt>;
2019-05-14 18:48:48 -04:00
getLogs(filter: Filter | FilterByBlockHash | Promise<Filter | FilterByBlockHash>): Promise<Array<Log>>;
getEtherPrice(): Promise<number>;
_getBlockTag(blockTag: BlockTag | Promise<BlockTag>): Promise<BlockTag>;
2021-10-16 02:29:27 -04:00
getResolver(name: string): Promise<null | Resolver>;
2022-03-09 02:56:08 -05:00
_getResolver(name: string, operation?: string): Promise<string>;
2021-10-16 02:29:27 -04:00
resolveName(name: string | Promise<string>): Promise<null | string>;
lookupAddress(address: string | Promise<string>): Promise<null | string>;
2021-10-19 00:01:37 -04:00
getAvatar(nameOrAddress: string): Promise<null | string>;
2019-05-14 18:48:48 -04:00
perform(method: string, params: any): Promise<any>;
2020-03-12 19:14:50 +01:00
_startEvent(event: Event): void;
_stopEvent(event: Event): void;
2019-05-14 18:48:48 -04: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;
}
//# sourceMappingURL=base-provider.d.ts.map