Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

coingecko-api-v3

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

coingecko-api-v3 - npm Package Compare versions

Comparing version 0.0.20 to 0.0.21

7

CHANGELOG.md

@@ -5,2 +5,9 @@ # Changelog

### 0.0.21 (2023-03-02)
### Features
* pro api support ([#31](https://github.com/samuraitruong/coingecko-api-v3/issues/31)) ([c8a53e5](https://github.com/samuraitruong/coingecko-api-v3/commit/c8a53e53ddb6e49d1d6e5fb53491ea778a682216))
### 0.0.20 (2023-02-09)

@@ -7,0 +14,0 @@

7

dist/CoinGeckoClient.d.ts

@@ -7,4 +7,7 @@ import { PLATFORMS } from "./Enum";

export declare class CoinGeckoClient {
apiV3Url: string;
private static readonly API_V3_URL;
private static readonly PRO_API_V3_URL;
options: Options;
baseURL: string;
apiKey?: string;
/**

@@ -14,3 +17,3 @@ * Constructor

*/
constructor(options?: Options);
constructor(options?: Options, apiKey?: string);
private withPathParams;

@@ -17,0 +20,0 @@ /**

@@ -27,4 +27,3 @@ "use strict";

*/
constructor(options) {
this.apiV3Url = "https://api.coingecko.com/api/v3";
constructor(options, apiKey) {
this.options = {

@@ -35,2 +34,9 @@ timeout: 30000,

this.options = Object.assign(Object.assign({}, this.options), options);
if (!apiKey) {
this.baseURL = CoinGeckoClient.API_V3_URL;
}
else {
this.baseURL = CoinGeckoClient.PRO_API_V3_URL;
this.apiKey = apiKey;
}
}

@@ -112,6 +118,9 @@ withPathParams(path, replacements = {}) {

return __awaiter(this, void 0, void 0, function* () {
if (this.apiKey) {
params.x_cg_pro_api_key = this.apiKey;
}
const qs = Object.entries(params)
.map(([key, value]) => `${key}=${value}`)
.join("&");
const requestUrl = `${this.apiV3Url + this.withPathParams(action, params)}?${qs}`;
const requestUrl = `${this.baseURL + this.withPathParams(action, params)}?${qs}`;
const res = yield this.httpGet(requestUrl); // await this.http.get<T>(requestUrl);

@@ -681,1 +690,3 @@ if (res.statusCode === 429 && this.options.autoRetry) {

exports.CoinGeckoClient = CoinGeckoClient;
CoinGeckoClient.API_V3_URL = "https://api.coingecko.com/api/v3";
CoinGeckoClient.PRO_API_V3_URL = "https://pro-api.coingecko.com/api/v3";
{
"name": "coingecko-api-v3",
"version": "0.0.20",
"version": "0.0.21",
"description": "The nodejs api library for accessing coingecko api v3 , develop with typescript",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc