import ethers, { BigNumber } from 'ethers';
import { BlockTag, Log, BlockWithTransactions, TransactionReceipt, TransactionResponse, Filter, FilterByBlockHash } from '@ethersproject/abstract-provider';
import * as providers from '@ethersproject/providers';
import { RPCProviderCache } from './RPCProviderCache';
export interface RPCConfig {
    chainId: number;
    url: string;
}
declare type LogLevel = 'error' | 'warn' | 'info' | 'debug';
declare type Logger = {
    [method in LogLevel]: (message: string, info?: any) => void;
};
declare type Context = {
    method: string;
    args: Record<string, string>;
};
export declare class RPCProvider extends providers.FallbackProvider {
    protected rpcConfigs: RPCConfig[];
    protected readonly logger?: Logger | undefined;
    readonly retryNumber: number;
    protected providerCache: RPCProviderCache;
    private rpcTimeoutForExecute;
    _nextId: number;
    ctx: Context;
    _eventLoopCache: Record<string, Promise<any>> | undefined;
    get _cache(): Record<string, Promise<any>>;
    /**
     *
     * @param rpcConfigs - prioritized provider configs
     * @param logger - optional logger
     * @param cacheTTL - provider cache time to live (ttl) in seconds
     * @param pollingInterval - interval in seconds between each call to getBlockNumber
     */
    constructor(rpcConfigs: RPCConfig[], logger?: Logger | undefined, cacheTTL?: number, pollingInterval?: number, rpcTimeoutForExecute?: number);
    private setMethodCtx;
    /**
     * Gets the current transaction count.
     *
     * @param addressOrName  - The hexadecimal string address or name
     * @param blockTag (default: "latest") - The block tag to get the transaction count for. Use "latest" mined-only transactions.
     * Use "pending" for transactions that have not been mined yet, but will (supposedly) be mined in the pending
     * block (essentially, transactions included in the mempool, but this behavior is not consistent).
     *
     * @returns Number of transactions sent AKA the current nonce.
     */
    getTransactionCount(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<number>;
    /**
     * The RPC method execute wrapper is used for wrapping and parsing errors, as well as ensuring that
     * providers are ready before any call is made. Also used for executing multiple retries for RPC
     * requests to providers. This is to circumvent any issues related to unreliable internet/network
     * issues, whether locally, or externally (for the provider's network).
     *
     * @param method - The method callback to execute and wrap in retries.
     * @returns The object of the specified generic type.
     * @throws CustomError if the method fails to execute.
     */
    private execute;
    private stopwatch;
    /**
     * Get the current balance for the specified address.
     *
     * @param addressOrName - The hexadecimal string address whose balance we are getting.
     * @param blockTag - string | number of the block.
     * @param assetId - The ID (address) of the asset whose balance we are getting.
     * @param abi (default = ERC20) - The ABI of the token contract to use, if non-native token.
     *
     * @returns A BigNumber representing the current value held by the wallet at the
     * specified address.
     */
    getBalance(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>, assetId?: string, abi?: string[]): Promise<BigNumber>;
    /**
     * Returns the Array of Log matching the filter.
     *
     * @param filter -  Filter | FilterByBlockHash object
     *
     * @returns Array of logs
     */
    getLogs(filter: Filter | FilterByBlockHash | Promise<Filter | FilterByBlockHash>): Promise<Array<Log>>;
    /**
     *
     * Returns the block number (or height) of the most recently mined block.
     *
     * @returns number
     */
    getBlockNumber(): Promise<number>;
    /**
     *
     * Get the block from the network, where the result.transactions is a list of transaction hashes.
     *
     * @param blockHashOrBlockTag - block hash or block tag
     *
     * @returns Block
     */
    getBlock(blockHashOrBlockTag: ethers.ethers.providers.BlockTag | Promise<ethers.ethers.providers.BlockTag>): Promise<ethers.ethers.providers.Block>;
    /**
     *
     * Get gas price.
     *
     * @returns BigNumber
     */
    getGasPrice(): Promise<ethers.ethers.BigNumber>;
    /**
     *
     * Returns an estimate of the amount of gas that would be required
     * to submit transaction to the network.
     *
     * @param transaction - ethers TransactionRequest type
     *
     * @returns BigNumber
     */
    estimateGas(transaction: ethers.ethers.utils.Deferrable<ethers.ethers.providers.TransactionRequest>): Promise<ethers.ethers.BigNumber>;
    /**
     *
     * Get the block from the network, where the result.transactions is an Array
     * of TransactionResponse objects.
     *
     * @param blockHashOrBlockTag - block hash or block tag
     *
     * @returns BlockWithTransactions
     */
    getBlockWithTransactions(blockHashOrBlockTag: ethers.ethers.providers.BlockTag | Promise<ethers.ethers.providers.BlockTag>): Promise<BlockWithTransactions>;
    waitForTransaction(transactionHash: string, confirmations?: number | undefined, timeout?: number | undefined): Promise<ethers.ethers.providers.TransactionReceipt>;
    /**
     *
     * Returns the transaction receipt for hash or null if the transaction has not been mined.
     *
     * @param transactionHash - transaction hash
     *
     * @returns TransactionReceipt
     */
    getTransactionReceipt(transactionHash: string | Promise<string>): Promise<TransactionReceipt>;
    /**
     *
     * Returns the transaction response for hash or null if the transaction has not been mined.
     *
     * @param transactionHash - transaction hash
     *
     * @returns TransactionReceipt
     */
    getTransaction(transactionHash: string | Promise<string>): Promise<TransactionResponse>;
    detectNetwork(): Promise<ethers.ethers.providers.Network>;
    /**
     *
     * Returns the contract code of address as of the blockTag block height.
     * If there is no contract currently deployed, the result is 0x.
     *
     * @param addressOrName - The hexadecimal string address who Code we are getting or name
     * @param blockTag - string or number of the block
     *
     * @returns string
     */
    getCode(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>;
    /**
     * The raw send method allows you to call any method on the RPC provider
     *
     * @param method - The name of the method
     * @param params - The parameters that the method receives
     * @returns
     */
    send(method: string, params: unknown[]): Promise<string>;
    /**
     * sendTransaction allows you to send a signed transaction to the network
     * defined in the constructor.
     *
     * @param signedTransaction - The signed transaction
     * @returns
     */
    sendTransaction(signedTransaction: string | Promise<string>): Promise<ethers.ethers.providers.TransactionResponse>;
}
export {};
