@icgio/icg-utils 1.9.28 → 1.9.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/forex-rate.js CHANGED
@@ -1,13 +1,13 @@
1
1
  const needle = require('needle')
2
2
  const utils = require('./utils.js')
3
3
 
4
- let get_forex_rate = function (pair, cb) {
4
+ let get_forex_rate_usd = function (pair, cb) {
5
5
  let [cur, quote_cur] = utils.parse_pair(pair)
6
- needle.get(`https://api.exchangerate.host/latest?base=USD`, (err, res, body) => {
7
- if (body.rates) {
8
- cb(body.rates[quote_cur])
6
+ needle.get(`https://cdn.jsdelivr.net/npm/@fawazahmed0/currency-api@latest/v1/currencies/usd.json`, (err, res, body) => {
7
+ if (body && body.usd) {
8
+ cb(body.usd[quote_cur.toLowerCase()])
9
9
  }
10
10
  })
11
11
  }
12
12
 
13
- module.exports.get_forex_rate = get_forex_rate
13
+ module.exports.get_forex_rate = get_forex_rate_usd
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icgio/icg-utils",
3
- "version": "1.9.28",
3
+ "version": "1.9.30",
4
4
  "description": "Utils package.",
5
5
  "main": "index.js",
6
6
  "directories": {