ethers.js/packages/web/lib.esm/index.d.ts

38 lines
1.3 KiB
TypeScript
Raw Permalink Normal View History

2019-05-14 18:48:48 -04:00
export declare type ConnectionInfo = {
url: string;
2020-07-14 02:33:30 -04:00
headers?: {
[key: string]: string | number;
};
2019-05-14 18:48:48 -04:00
user?: string;
password?: string;
2019-06-12 01:01:04 -04:00
allowInsecureAuthentication?: boolean;
throttleLimit?: number;
2020-07-15 14:00:36 -04:00
throttleSlotInterval?: number;
2020-07-14 02:33:30 -04:00
throttleCallback?: (attempt: number, url: string) => Promise<boolean>;
2019-05-14 18:48:48 -04:00
timeout?: number;
};
export interface OnceBlockable {
once(eventName: "block", handler: () => void): void;
}
2020-05-04 23:01:04 -04:00
export interface OncePollable {
once(eventName: "poll", handler: () => void): void;
}
2019-05-14 18:48:48 -04:00
export declare type PollOptions = {
timeout?: number;
floor?: number;
ceiling?: number;
interval?: number;
retryLimit?: number;
onceBlock?: OnceBlockable;
2020-05-04 23:01:04 -04:00
oncePoll?: OncePollable;
2019-05-14 18:48:48 -04:00
};
2019-09-28 02:36:19 -04:00
export declare type FetchJsonResponse = {
statusCode: number;
headers: {
[header: string]: string;
};
};
2020-07-30 17:04:53 -04:00
export declare function fetchData<T = Uint8Array>(connection: string | ConnectionInfo, body?: Uint8Array, processFunc?: (value: Uint8Array, response: FetchJsonResponse) => T): Promise<T>;
2019-09-28 02:36:19 -04:00
export declare function fetchJson(connection: string | ConnectionInfo, json?: string, processFunc?: (value: any, response: FetchJsonResponse) => any): Promise<any>;
2020-05-21 00:07:41 -04:00
export declare function poll<T>(func: () => Promise<T>, options?: PollOptions): Promise<T>;