Socket
Socket
Sign inDemoInstall

@glif/filecoin-number

Package Overview
Dependencies
Maintainers
3
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@glif/filecoin-number - npm Package Compare versions

Comparing version 2.0.0-beta.16 to 2.0.1

27

module/Converter.js

@@ -1,2 +0,1 @@

import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
import _defineProperty from "@babel/runtime/helpers/defineProperty";

@@ -23,8 +22,4 @@ import bent from 'bent';

cacheConversionRate() {
var _this = this;
return _asyncToGenerator(function* () {
_this.rate = new BigNumber(yield _this.convert(1, 'FIL', _this.currency));
})();
async cacheConversionRate() {
this.rate = new BigNumber(await this.convert(1, 'FIL', this.currency));
}

@@ -58,13 +53,9 @@

convert(amount, from, to) {
var _this2 = this;
return _asyncToGenerator(function* () {
const get = bent('GET', 'json', {
'X-CMC_PRO_API_KEY': _this2.apiKey
});
const res = yield get(`${_this2.apiURL}/v1/tools/price-conversion?symbol=${from}&amount=${amount}&convert=${to}`);
if (!res.data || !res.data.quote || !res.data.quote[to]) throw new Error('No conversion price found.');
return res.data.quote[to].price;
})();
async convert(amount, from, to) {
const get = bent('GET', 'json', {
'X-CMC_PRO_API_KEY': this.apiKey
});
const res = await get(`${this.apiURL}/v1/tools/price-conversion?symbol=${from}&amount=${amount}&convert=${to}`);
if (!res.data || !res.data.quote || !res.data.quote[to]) throw new Error('No conversion price found.');
return res.data.quote[to].price;
}

@@ -71,0 +62,0 @@

{
"name": "@glif/filecoin-number",
"version": "2.0.0-beta.16",
"version": "2.0.1",
"description": "a javascript package to handle Filecoin numbers like Fil and AttoFil",

@@ -10,13 +10,14 @@ "main": "./dist/index.js",

"scripts": {
"clean": "../../node_modules/.bin/rimraf dist/ lib/ module/",
"build-browser": "../../node_modules/.bin/cross-env BABEL_ENV=browser ../../node_modules/.bin/babel ./src --out-dir ./lib --extensions \".ts,.tsx\" --source-maps --ignore '**/__tests__'",
"build-module": "../../node_modules/.bin/cross-env BABEL_ENV=module ../../node_modules/.bin/babel ./src --out-dir ./module --extensions \".ts,.tsx\" --source-maps --ignore '**/__tests__'",
"build-node": "../../node_modules/.bin/babel ./src/ --out-dir ./dist/ --extensions \".ts,.tsx\" --source-maps --ignore '**/__tests__'",
"build-types": "../../node_modules/.bin/tsc --emitDeclarationOnly",
"clean": "rimraf dist/ lib/ module/",
"build-browser": "cross-env BABEL_ENV=browser babel ./src --out-dir ./lib --extensions \".ts,.tsx\" --source-maps --ignore '**/__tests__'",
"build-module": "cross-env BABEL_ENV=module babel ./src --out-dir ./module --extensions \".ts,.tsx\" --source-maps --ignore '**/__tests__'",
"build-node": "babel ./src/ --out-dir ./dist/ --extensions \".ts,.tsx\" --source-maps --ignore '**/__tests__'",
"build-types": "tsc --emitDeclarationOnly",
"build": "npm run clean && npm run build-types && npm run build-node && npm run build-browser && npm run build-module",
"prepublishOnly": "npm run build",
"lint": "tslint -p tsconfig.json",
"test": "npm run lint && npm run build && ../../node_modules/.bin/jest",
"lint": "eslint --ext .jsx,.js,.ts,.tsx ./src",
"lint:fix": "eslint --ext .jsx,.js,.ts,.tsx ./src --fix",
"test": "npm run lint && npm run build && jest",
"test:watch": "npm run build && jest --watch",
"type-check": "../../node_modules/.bin/tsc --noEmit",
"type-check": "tsc --noEmit",
"type-check:watch": "npm run type-check -- --watch"

@@ -32,4 +33,8 @@ },

"@types/bent": "^7.3.2",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0"
"@typescript-eslint/eslint-plugin": "^5.35.1",
"@typescript-eslint/parser": "^5.35.1",
"eslint": "^8.22.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.2.1",
"prettier": "^2.7.1"
},

@@ -45,3 +50,3 @@ "files": [

},
"gitHead": "b3ab72a44d12f4780526df9177f5beab502e3100"
"gitHead": "95243ec70564ef3b9e0708327e9b55bdec1555c4"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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