///
import type { AxiosError, AxiosResponse } from "axios";
import type { ApiConfig, ApiRequestConfig } from "./api";
import Api from "./api";
type FallbackApiRequestConfig = {
fallback?: {
maxAttempts?: number;
onFallback?: (err: AxiosError, host: Api) => Promise | void;
randomlySelect?: boolean;
};
gatewayOnly?: boolean;
} & ApiRequestConfig;
export declare class FallbackApi {
minerInstances: Api[];
globalConfig: Omit;
gatewayInstances: Api[];
constructor({ gateways, miners, opts, }: {
gateways?: ApiConfig[] | URL[] | string[];
miners?: ApiConfig[] | URL[] | string[];
opts?: {
globalConfig?: Omit;
};
});
addPeersFrom(url: string | URL, options?: {
limit?: number;
}): Promise;
addMiners(hosts: (URL | string | ApiConfig)[]): void;
addGateways(hosts: (URL | string | ApiConfig)[]): void;
get(path: string, config?: FallbackApiRequestConfig): Promise>;
post(path: string, body: Buffer | string | object | null, config?: FallbackApiRequestConfig): Promise>;
request(path: string, config?: FallbackApiRequestConfig): Promise>;
}
export default FallbackApi;