@fairmint/canton-node-sdk
Version:
Canton Node SDK
33 lines • 1.55 kB
TypeScript
import { type Logger } from '../logging';
import { type RequestConfig } from '../types';
/** Handles HTTP requests with authentication, logging, and error handling */
export declare class HttpClient {
private readonly axiosInstance;
private readonly logger;
constructor(logger?: Logger);
makeGetRequest<T>(url: string, config?: RequestConfig, _retryCount?: number): Promise<T>;
makePostRequest<T>(url: string, data: unknown, config?: RequestConfig, _retryCount?: number): Promise<T>;
makeDeleteRequest<T>(url: string, config?: RequestConfig, _retryCount?: number): Promise<T>;
makePatchRequest<T>(url: string, data: unknown, config?: RequestConfig, _retryCount?: number): Promise<T>;
private buildHeaders;
setBearerToken(token: string): void;
clearBearerToken(): void;
private logRequestResponse;
private handleRequestError;
/**
* Determines whether a request error is retryable. Retries on:
*
* - HTTP 5xx server errors
* - Network errors
* - Canton-specific transient errors: UNKNOWN_CONTRACT_SYNCHRONIZERS (400), SEQUENCER_BACKPRESSURE (409), HTTP 503
*/
private isRetryableError;
/** Sleep for the specified number of milliseconds */
private sleep;
/**
* Prepares request data for retry by updating commandId fields to avoid duplicate command rejection. If the data
* contains a commandId field, appends a retry suffix with timestamp to make it unique.
*/
private prepareDataForRetry;
}
//# sourceMappingURL=HttpClient.d.ts.map