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

nomics

Package Overview
Dependencies
Maintainers
2
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nomics - npm Package Compare versions

Comparing version 0.2.7 to 0.2.8

11

dist/api/currencies_ticker.d.ts
import { IntervalEnum } from "../constants";
export interface ICurrenciesTickerOptions {
interval?: string[];
ids?: string[];
quoteCurrency?: string;
convert?: string;
includeTransparency?: boolean;
}

@@ -14,3 +17,11 @@ export declare type CurrencyTickerInterval = {

market_cap_change_pct?: string;
volume_transparency: VolumeTransparency[];
volume_transparency_grade: string;
};
export declare type VolumeTransparency = {
grade: string;
volume: string;
volume_change: string;
volume_change_pct: string;
};
export interface IRawCurrencyTicker {

@@ -17,0 +28,0 @@ id: string;

7

dist/api/currencies_ticker.js

@@ -50,8 +50,11 @@ "use strict";

return __awaiter(_this, void 0, void 0, function () {
var interval, quoteCurrency, objParams;
var convert, ids, interval, quoteCurrency, includeTransparency, objParams;
return __generator(this, function (_a) {
interval = options.interval, quoteCurrency = options.quoteCurrency;
convert = options.convert, ids = options.ids, interval = options.interval, quoteCurrency = options.quoteCurrency, includeTransparency = options.includeTransparency;
objParams = {
convert: convert,
ids: ids && ids.join(","),
interval: interval && interval.join(","),
"quote-currency": quoteCurrency,
"include-transparency": includeTransparency,
key: key

@@ -58,0 +61,0 @@ };

{
"name": "nomics",
"version": "0.2.7",
"version": "0.2.8",
"description": "",

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

@@ -63,5 +63,11 @@ # Nomics JavaScript client

/*
Limit the returned currencies to the ones in the following array. If not
specified, **all** will be returned
*/
ids?: ['BTC', 'ETH'],
/*
Specify the currency to quote all returned prices in
*/
quoteCurrency?: "EUR" // defaults to "USD"
quoteCurrency?: "EUR", // [DEPRECATED] use "convert" below instead
convert?: "EUR", // defaults to "USD"
});

@@ -72,12 +78,16 @@ ```

| Name | Type | Description |
| ------------------ | ------ | --------------------------------- |
| symbol | string | The currency symbol |
| price | string | Current price |
| circulating_supply | string | The current circulating supply |
| max_supply | string | The max supply of the currency |
| market_cap | string | Total market cap for the currency |
| rank | string | Rank by market cap |
| high | string | All time high for the currency |
| high_timestamp | string | The date of the all time high |
| Name | Type | Description |
| ------------------ | ------ | ----------------------------------- |
| id | string | The currency's display id |
| symbol | string | The currency's original symbol |
| name | string | The full name |
| logo_url | string | The url for the currency logo image |
| price | string | Current price |
| price_date | string | The date (YYYY-MM-DD) of the price |
| circulating_supply | string | The current circulating supply |
| max_supply | string | The max supply of the currency |
| market_cap | string | Total market cap for the currency |
| rank | string | Rank by market cap |
| high | string | All time high for the currency |
| high_timestamp | string | The date of the all time high |

@@ -84,0 +94,0 @@ Additionally, the returned data will come with interval information corresponding to the interval options passed with the call for each of the currency rows. For each interval string, the response will will have a key of the same name with interval data.

@@ -36,2 +36,27 @@ import currenciesTicker from "./currencies_ticker";

test("passes convert if convert is specified", () => {
currenciesTicker("xyz", { convert: "ETH" });
expect(fetchJSON).toHaveBeenCalledWith(
expect.stringContaining("convert=ETH")
);
});
test("passes ids if ids are specified", () => {
currenciesTicker("xyz", { ids: ["ETH", "BTC"] });
expect(fetchJSON).toHaveBeenCalledWith(
expect.stringContaining(`ids=${encodeURIComponent("ETH,BTC")}`)
);
});
test("passes includeTransparency if specified", () => {
currenciesTicker("xyz", { includeTransparency: true });
expect(fetchJSON).toHaveBeenCalledWith(
expect.stringContaining("include-transparency=true")
);
currenciesTicker("xyz", {});
expect(fetchJSON).toHaveBeenCalledWith(
expect.not.stringContaining("include-transparency")
);
});
test("can change the base url via static property", () => {

@@ -38,0 +63,0 @@ Nomics.NOMICS_API_BASE = "http://test.nomics.com";

@@ -8,3 +8,6 @@ import { IntervalEnum } from "../constants";

interval?: string[];
ids?: string[];
quoteCurrency?: string;
convert?: string;
includeTransparency?: boolean;
}

@@ -20,4 +23,13 @@

market_cap_change_pct?: string;
volume_transparency: VolumeTransparency[];
volume_transparency_grade: string;
};
export type VolumeTransparency = {
grade: string;
volume: string;
volume_change: string;
volume_change_pct: string;
};
export interface IRawCurrencyTicker {

@@ -57,6 +69,15 @@ id: string;

): Promise<IRawCurrencyTicker[]> => {
const { interval, quoteCurrency } = options;
const {
convert,
ids,
interval,
quoteCurrency,
includeTransparency
} = options;
const objParams = {
convert,
ids: ids && ids.join(","),
interval: interval && interval.join(","),
"quote-currency": quoteCurrency,
"include-transparency": includeTransparency,
key

@@ -63,0 +84,0 @@ };

Sorry, the diff of this file is not supported yet

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