Skip to main content

Documentation Index

Fetch the complete documentation index at: https://developers.avacloud.io/llms.txt

Use this file to discover all available pages before exploring further.

Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK. To change the default retry strategy for a single API call, simply provide a retryConfig object to the call:
import { Avalanche } from "@avalanche-sdk/chainkit";

const avalancheSDK = new Avalanche({
  apiKey: "<YOUR_API_KEY_HERE>",
  chainId: "43114",
  network: "mainnet",
});

async function run() {
  const result = await avalancheSDK.metrics.healthCheck({
    retries: {
      strategy: "backoff",
      backoff: {
        initialInterval: 1,
        maxInterval: 50,
        exponent: 1.1,
        maxElapsedTime: 100,
      },
      retryConnectionErrors: false,
    },
  });

  // Handle the result
  console.log(result);
}

run();
If you’d like to override the default retry strategy for all operations that support retries, you can provide a retryConfig at SDK initialization:
import { Avalanche } from "@avalanche-sdk/chainkit";

const avalancheSDK = new Avalanche({
  retryConfig: {
    strategy: "backoff",
    backoff: {
      initialInterval: 1,
      maxInterval: 50,
      exponent: 1.1,
      maxElapsedTime: 100,
    },
    retryConnectionErrors: false,
  },
  apiKey: "<YOUR_API_KEY_HERE>",
  chainId: "43114",
  network: "mainnet",
});

async function run() {
  const result = await avalancheSDK.metrics.healthCheck();

  // Handle the result
  console.log(result);
}

run();