Avalanche SDK Client
    Preparing search index...

    Function createHealthApiClient

    • Creates a Health API Client with a given transport configured for a Chain.

      The Health API Client is an interface to interact with the Health API through Avalanche-specific JSON-RPC API methods.

      Type Parameters

      • transport extends Transport
      • chain extends undefined | Chain = undefined
      • accountOrAddress extends undefined | `0x${string}` | Account = undefined
      • rpcSchema extends undefined | RpcSchema = undefined
      • raw extends boolean = false

      Parameters

      Returns {
          extend: <const client extends { [key: string]: unknown }>(
              fn: (client: { extend: ...; health: ...; liveness: ...; readiness: ... }) => client,
          ) => { [K in (...) | (...) | (...)]: (...)[(...)] };
          health: (args: HealthParameters) => Promise<HealthReturnType>;
          liveness: () => Promise<LivenessReturnType>;
          readiness: (args: ReadinessParameters) => Promise<ReadinessReturnType>;
      }

      A Health API Client. HealthApiClient

      • extend: <const client extends { [key: string]: unknown }>(
            fn: (client: { extend: ...; health: ...; liveness: ...; readiness: ... }) => client,
        ) => { [K in (...) | (...) | (...)]: (...)[(...)] }
      • health: (args: HealthParameters) => Promise<HealthReturnType>

        Returns the last set of health check results for the node. This includes checks for all chains, network, database, and other components.

        import { createAvalancheClient} from '@avalanche-sdk/client'
        import { avalanche } from '@avalanche-sdk/client/chains'

        const client = createAvalancheClient({
        chain: avalanche,
        transport: {
        type: "http",
        },
        })

        const healthStatus = await client.health.health({
        tags: ["11111111111111111111111111111111LpoYY", "29uVeLPJB1eQJkzRemU8g8wZDw5uJRqpab5U2mX9euieVwiEbL"]
        })
      • liveness: () => Promise<LivenessReturnType>

        Returns a simple health check indicating if the node is alive and can handle requests. This is a lightweight check that always returns healthy if the endpoint is available.

        import { createAvalancheClient} from '@avalanche-sdk/client'
        import { avalanche } from '@avalanche-sdk/client/chains'

        const client = createAvalancheClient({
        chain: avalanche,
        transport: {
        type: "http",
        },
        })
      • readiness: (args: ReadinessParameters) => Promise<ReadinessReturnType>

        Returns the last evaluation of the startup health check results. This indicates if the node has finished initializing and is ready to handle requests.

        import { createAvalancheClient} from '@avalanche-sdk/client'
        import { avalanche } from '@avalanche-sdk/client/chains'

        const client = createAvalancheClient({
        chain: avalanche,
        transport: {
        type: "http",
        },
        })

        const readinessStatus = await client.health.readiness({
        tags: ["11111111111111111111111111111111LpoYY"]
        })
      import { createHealthApiClient} from '@avalanche-sdk/client'
      import { avalanche } from '@avalanche-sdk/client/chains'

      const client = createHealthApiClient({
      chain: avalanche,
      transport: {
      type: "http",
      },
      })

      // Get health status
      const health = await client.liveness()