ethers.js/packages/web/lib/index.d.ts
2020-05-21 00:07:41 -04:00

35 lines
1.0 KiB
TypeScript

export declare type ConnectionInfo = {
url: string;
user?: string;
password?: string;
allowInsecureAuthentication?: boolean;
throttleLimit?: number;
timeout?: number;
headers?: {
[key: string]: string | number;
};
};
export interface OnceBlockable {
once(eventName: "block", handler: () => void): void;
}
export interface OncePollable {
once(eventName: "poll", handler: () => void): void;
}
export declare type PollOptions = {
timeout?: number;
floor?: number;
ceiling?: number;
interval?: number;
retryLimit?: number;
onceBlock?: OnceBlockable;
oncePoll?: OncePollable;
};
export declare type FetchJsonResponse = {
statusCode: number;
headers: {
[header: string]: string;
};
};
export declare function fetchJson(connection: string | ConnectionInfo, json?: string, processFunc?: (value: any, response: FetchJsonResponse) => any): Promise<any>;
export declare function poll<T>(func: () => Promise<T>, options?: PollOptions): Promise<T>;