Skip to content

Latest commit

 

History

History
114 lines (90 loc) · 14.1 KB

File metadata and controls

114 lines (90 loc) · 14.1 KB
layout
editorial

Covalent

Introduction

Covalent provides a unified API to bring full transparency and visibility to assets across all blockchain networks including Cronos.

To get started, sign up for an API Key.

API Features

The Covalent API is RESTful and offers the following out-of-the-box for Cronos:

Covalent API
Response formats JSON and CSV
Real time response 2 blocks
Batch response 30 minutes
Request volume limit None
Request rate limit 5 requests per second
Base URL https://api.covalenthq.com/v1/
Networks & chain_id Mainnet - 25
Supported Endpoints

Class A
- Balances
- Transactions
- Transfers
- Token Holders
- Log Events (Contract Address)
- Log Events (Topic Hash)

Try the supported endpoints directly in your browser from our API Reference or use the following code examples. The JSON response format is the same for all endpoints:


    "data": ..., 
    "error": false,
    "error_message": null,
    "error_code": null

{% tabs %} {% tab title="Curl" %}

curl -X GET "https://api.covalenthq.com/v1/25/address/0xFEC4f9D5B322Aa834056E85946A32c35A3f5aDD8/balances_v2/?key={YOUR API KEY}" -H "Accept: application/json"

{% endtab %}

{% tab title="JavaScript" %}

const APIKEY = 'YOUR API KEY';
const baseURL = 'https://api.covalenthq.com/v1'
const blockchainId = 25
const demoAddress = '0xFEC4f9D5B322Aa834056E85946A32c35A3f5aDD8'

async function getWalletBalance(chainId, address) {
    const url = new URL(`${baseURL}/${chainId}/address/${address}/balances_v2/?key=${APIKEY}`);
    const response = await fetch(url);
    const result = await response.json();
    const data = result.data;
    console.log(data)
    return data;
}

// Example address request
getWalletBalance(blockchainId, demoAddress);

{% endtab %}

{% tab title="Python" %}

import requests
API_KEY = 'YOUR API KEY'
base_url = 'https://api.covalenthq.com/v1'
blockchain_id = 25
demo_address = '0xFEC4f9D5B322Aa834056E85946A32c35A3f5aDD8'

def get_wallet_balance(chain_id, address):
    endpoint = f'/{chain_id}/address/{address}/balances_v2/?key={API_KEY}'
    url = base_url + endpoint
    result = requests.get(url).json()
    data = result["data"]
    print(data)
    return(data)


# Example address request
get_wallet_balance(blockchain_id, demo_address)

{% endtab %} {% endtabs %}

Use Cases

The Covalent API supports a broad range of Web3 data use cases including:

  • Gaming
  • Defi Taxes
  • KYC
  • NFTs
  • Wallets
  • Dashboards
  • Dao Data
  • Dex & Trading
  • and many more

Check out Covalent's collection of ready-to-ship Code Templates that you can use to build your Web3 data-powered dApps.

Resources

Here are some additional resources to help you get started with the Covalent API: