Base API class for making HTTP requests to the Conflux Core API. Provides common functionality for API endpoints including request handling and error management.

CoreApi

Hierarchy (View Summary)

Constructors

Properties

baseUrl: string

Base URL for the API endpoints

apiKey?: string

Optional API key for authenticated requests

logger: Logger<never> = ...

Logger instance for debugging and error tracking

Methods

  • Protected

    Makes an API request with the given parameters. Handles parameter sanitization, API key inclusion, and error handling.

    Type Parameters

    • T

      Type of the expected response data

    Parameters

    • endpoint: string

      API endpoint to call

    • params: Record<string, undefined | null | string | number | boolean> = {}

      Query parameters

    Returns Promise<ApiResponse<T>>

    Promise resolving to the API response

    When the API request fails or returns an error status