///
import { Deferrable } from '@ethersproject/properties';
import { EventType, Listener, Provider } from '../abstract-provider';
import { Network, Networkish } from '../networks';
import { Formatter } from './formatter';
import { ModuleId, AccountAddress, BlockNumber, MoveStruct, MoveValue, TransactionEventView, BlockTag, BlockWithTransactions, CallRequest, Filter, TransactionInfoView, TransactionOutput, TransactionRequest, TransactionResponse, U64, SignedUserTransactionView, HashValue } from '../types';
/**
* EventType
* - "block"
* - "poll"
* - "didPoll"
* - "pending"
* - "error"
* - "network"
* - filter
* - topics array
* - transaction hash
*/
export declare const CONSTANTS: {
pending: string;
block: string;
network: string;
poll: string;
filter: string;
tx: string;
};
export declare class Event {
readonly listener: Listener;
readonly once: boolean;
readonly tag: string;
constructor(tag: string, listener: Listener, once: boolean);
get event(): EventType;
get type(): string;
get hash(): string;
get filter(): Filter;
pollable(): boolean;
}
export declare const RPC_ACTION: {
getChainInfo: string;
getNodeInfo: string;
sendTransaction: string;
getBlock: string;
getTransactionByHash: string;
getTransactionInfo: string;
getEventsOfTransaction: string;
getEvents: string;
call: string;
callV2: string;
getCode: string;
getResource: string;
getAccountState: string;
getGasPrice: string;
dryRun: string;
dryRunRaw: string;
};
export declare abstract class BaseProvider extends Provider {
_networkPromise: Promise;
_network: Network;
_events: Array;
formatter: Formatter;
_emitted: {
[eventName: string]: number | 'pending';
};
_pollingInterval: number;
_poller: NodeJS.Timer;
_bootstrapPoll: NodeJS.Timer;
_lastBlockNumber: number;
_fastBlockNumber: number;
_fastBlockNumberPromise: Promise;
_fastQueryDate: number;
_maxInternalBlockNumber: number;
_internalBlockNumber: Promise<{
blockNumber: number;
reqTime: number;
respTime: number;
}>;
readonly anyNetwork: boolean;
/**
* ready
*
* A Promise 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);
_ready(): Promise;
get ready(): Promise;
static getFormatter(): Formatter;
private _getInternalBlockNumber;
protected poll(): Promise;
get network(): Network;
abstract detectNetwork(): Promise;
getNetwork(): Promise;
get blockNumber(): number;
get polling(): boolean;
set polling(value: boolean);
get pollingInterval(): number;
set pollingInterval(value: number);
_getFastBlockNumber(): Promise;
_setFastBlockNumber(blockNumber: number): void;
waitForTransaction(transactionHash: string, confirmations?: number, timeout?: number): Promise;
getBlockNumber(): Promise;
getGasPrice(): Promise;
getCode(moduleId: ModuleId | Promise, blockTag?: BlockTag | Promise): Promise;
getResource(address: AccountAddress | Promise, resource_struct_tag: string | Promise, blockTag?: BlockTag | Promise): Promise;
getResources(address: AccountAddress | Promise, blockTag?: BlockTag | Promise): Promise<{
[k: string]: MoveStruct;
} | undefined>;
protected _wrapTransaction(tx: SignedUserTransactionView, hash?: string): TransactionResponse;
sendTransaction(signedTransaction: string | Promise): Promise;
private static getModuleId;
private _getFilter;
call(request: CallRequest | Promise, blockTag?: BlockTag | Promise): Promise>;
callV2(request: CallRequest | Promise, blockTag?: BlockTag | Promise): Promise>;
dryRun(transaction: Deferrable): Promise;
dryRunRaw(rawUserTransactionHex: string, publicKeyHex: string): Promise;
private _getBlock;
getBlock(blockTag: number | string | Promise): Promise;
getTransaction(transactionHash: string | Promise): Promise;
getTransactionInfo(transactionHash: string | Promise): Promise;
getEventsOfTransaction(transactionHash: HashValue): Promise;
getTransactionEvents(filter: Filter | Promise): Promise>;
_getBlockTag(blockTag: number | Promise): Promise;
abstract perform(method: string, params: any): Promise;
_startEvent(event: Event): void;
_stopEvent(event: Event): void;
_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): boolean;
listenerCount(eventName?: EventType): number;
listeners(eventName?: EventType): Array;
off(eventName: EventType, listener?: Listener): this;
removeAllListeners(eventName?: EventType): this;
}