Typescript SDK Quickstart

The Covalent SDK is the fastest way to integrate the Unified API for working with blockchain data. The SDK works with all supported chains including Mainnets and Testnets.

Don't Have an API Key?

Unlock millions of requests and free archive data on all chains.

1

Install the SDK

You can use yarn or npm to install the @covalenthq/client-sdk package.

Note: Use Node v18 and above for best results.

yarn add @covalenthq/client-sdk
2

Import the client

The CovalentClient class provides a typesafe, easy to use helper functions and classes to use the Unified API.

Some examples of classes include:

import { CovalentClient } from "@covalenthq/client-sdk";
3

Make your first call

  1. First initialize the client with your Covalent API key.

  2. Next call the getTokenBalancesForWalletAddress function in the BalanceService with the two required arguments for the chain name and the address (note that ENS resolution works, so you can try demo.eth).

const ApiServices = async () => {
    // Replace with your Covalent API key
    const client = new CovalentClient("YOUR_API_KEY"); 
    const resp = await client.BalanceService.getTokenBalancesForWalletAddress("eth-mainnet", "WALLET_ADDRESS"); 
    if (!resp.error) {
        console.log(resp.data);
    } else {
        console.log(resp.error_message);
    }
}
4

Use the advanced features

The SDK comes with functionality that dramatically improves the developer experience. For example:

  • Auto pagination using async generators

  • Native use of BigInts

  • Concurrency limiting and exponential back-offs to retry rate-limited requests

  • Debugger mode for response times, URLs called and HTTP status codes

Happy coding!

5

Explore GoldRush

GoldRush is the modular block explorer kit. It comes with two components:

  • GoldRush Templates - out-of-the-box templates for wallet UIs, NFT Galleries, and more.

  • GoldRush Kit - beautifully designed open-source React components for your application.