cmc-api
Version:
CoinMarketCap RESTful API Wrapper. Supports endpoints cryptocurrency, exchanges (CEX), decentralized exchange (DEX), global metrics, community content and trends, tools and others.
82 lines (81 loc) • 3.13 kB
TypeScript
import { CexRepository } from "../repositories/cex.repository";
import { CommunityRepository } from "../repositories/community.repository";
import { CryptoRepository } from "../repositories/crypto.repository";
import { DexRepository } from "../repositories/dex.repository";
import { MetricRepository } from "../repositories/metric.repository";
import { MiscRepository } from "../repositories/misc.repository";
import { Client } from "./client";
/**
* The CoinMarketCap API.
*
* **Quick Start Guide**
* 1. Sign up for a free API key at [CoinMarketCap](https://pro.coinmarketcap.com/signup).
* 2. Copy your API Key. Once you sign up you'll land on your Developer Portal account dashboard. Copy your API from the API Key box in the top left panel.
* 3. Install the [cmc-api](https://www.npmjs.com/package/cmc-api) package using npm or yarn.
* 4. Create a new instance of the CoinMarketCapApi class and pass your API key as an argument.
* 5. Start making API calls!
*
* @remarks
* The **[cmc-api](https://www.npmjs.com/package/cmc-api)** is an generic api wrapper for [CoinMarketCap](https://coinmarketcap.com).
* The [CoinMarketCap API](https://pro.coinmarketcap.com/api/v1) is a suite of high-performance RESTful JSON endpoints that are specifically designed to meet the mission-critical demands of application developers, data scientists, and enterprise business platforms.
* It provides access to high-frequency cryptocurrency market data such as price, volume, and market cap.
*
* @example using an production API key
* ```typescript
* import { CoinMarketCapApi } from "cmc-api";
*
* const apikey = process.env.COINMARKETCAP_APIKEY;
* const cmc = new CoinMarketCapApi(apikey);
* ```
*
* @example using sandbox
* ```typescript
* import { CoinMarketCapApi } from "cmc-api";
* const cmc = CoinMarketCapApi.sandbox(); // or (new CoinMarketCapApi()).sandbox();
* ```
*/
export declare class CoinMarketCapApi {
/**
* The client instance used to make API requests.
*/
client: Client;
/**
* Repository for cryptocurrency-related operations.
*/
crypto: CryptoRepository;
/**
* Repository for decentralized exchange-related operations.
*/
dex: DexRepository;
/**
* Repository for centralized exchange-related operations.
*/
cex: CexRepository;
/**
* Repository for metric-related operations.
*/
metric: MetricRepository;
/**
* Repository for community-related operations.
*/
community: CommunityRepository;
/**
* Repository for miscellaneous operations.
*/
misc: MiscRepository;
/**
* Creates an instance of CoinMarketCapApi.
* @param apikey - Optional API key for authentication.
*/
constructor(apikey?: string);
/**
* Switches the client to sandbox mode.
* @returns The CoinMarketCapApi instance in sandbox mode.
*/
sandbox(): CoinMarketCapApi;
/**
* Creates a new CoinMarketCapApi instance in sandbox mode.
* @returns A new CoinMarketCapApi instance in sandbox mode.
*/
static sandbox(): CoinMarketCapApi;
}