import { AxiosResponse } from 'axios'; import { WsEndpoint } from './ChronikClient'; /** A pair of Chronik HTTP and WebSocket endpoint urls */ interface Endpoint { /** URL for Chronik's HTTP interface */ url: string; /** URL for Chronik's WebSocket interface */ wsUrl: string; } export declare function appendWsUrls(urls: string[]): Endpoint[]; /** * Handles the networking to Chronik `Endpoint`s, including cycling * through both types of endpoints. */ export declare class FailoverProxy { private _endpointArray; private _workingIndex; constructor(urls: string | string[]); getEndpointArray(): Endpoint[]; deriveEndpointIndex(loopIndex: number): number; setWorkingIndex(newIndex: number): void; post(path: string, data: Uint8Array): Promise; get(path: string): Promise; /** * Returns a Get or POST axios response from the Chronik indexer * * @param {string} path the path to the Chronik API endpoint * @param {string} requestType the flag indicating whether this is a get or post request * @param {string} data the optional axios request data specific to post requests * @returns {Uint8Array} returns the axios response data from Chronik * @throws {error} throws error on non-responsive server or valid error responses */ _request(path: string, requestType: 'GET' | 'POST', data?: Uint8Array): Promise; /** * Calls axios for a GET or POST response * * @param {string} url the singular chronik url * @param {string} path the path to the Chronik API endpoint * @param {string} requestType the flag indicating whether this is a get or post request * @param {string} data the optional axios request data for post requests * @returns {Uint8Array} returns the axios response data from Chronik * @throws {error} throws error on non-responsive server or valid error responses */ _callAxios(url: string, path: string, requestType: 'GET' | 'POST', data?: Uint8Array): Promise>; ensureResponseErrorThrown(response: AxiosResponse, path: string): void; /** * Check if a given websocket URL connects * Note: As of 20231110 there is no msg from chronik server confirming a connection to chronik * We would have to wait for a block or a transaction, which is impractical here * So, this is only testing whether or not a given URL is a live websocket or not * @param {string} wsUrl * @returns {bool} */ private _websocketUrlConnects; connectWs(wsEndpoint: WsEndpoint): Promise; } export {}; //# sourceMappingURL=failoverProxy.d.ts.map