@icgio/icg-utils 1.7.15 → 1.7.16

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.
Files changed (2) hide show
  1. package/lib/coingecko.js +5 -5
  2. package/package.json +1 -1
package/lib/coingecko.js CHANGED
@@ -22,7 +22,7 @@ const options = {
22
22
 
23
23
  let coins_map = {}
24
24
  let get_coins_map = (cb) => {
25
- needle.get('https://api.coingecko.com/api/v3/coins/list', (err, res, body) => {
25
+ cmc_limiter.process(needle.get, 'https://api.coingecko.com/api/v3/coins/list', (err, res, body) => {
26
26
  if (body && Array.isArray(body)) {
27
27
  let result = {}
28
28
  for (let line of body) {
@@ -51,7 +51,7 @@ let get_coingecko_rates = (cb, pair_or_pairs_or_cur_curs, type) => {
51
51
  let [cur, base_cur] = parse_pair(pair)
52
52
  let cur_id = coins_map[cur],
53
53
  vs_cur = stablecoins.indexOf(base_cur) > -1 ? 'usd' : base_cur.toLowerCase()
54
- needle.get(`https://api.coingecko.com/api/v3/simple/price?ids=${cur_id}&vs_currencies=${vs_cur}`, (err, res, body) => {
54
+ cmc_limiter.process(needle.get, `https://api.coingecko.com/api/v3/simple/price?ids=${cur_id}&vs_currencies=${vs_cur}`, (err, res, body) => {
55
55
  lock = false
56
56
  if (err) {
57
57
  console.error(pair, err)
@@ -69,7 +69,7 @@ let get_coingecko_rates = (cb, pair_or_pairs_or_cur_curs, type) => {
69
69
  })
70
70
  )
71
71
  let url = `https://api.coingecko.com/api/v3/simple/price?ids=${String(_.keys(cur_id_map))}&vs_currencies=usd`
72
- needle.get(url, (err, res, body) => {
72
+ cmc_limiter.process(needle.get, url, (err, res, body) => {
73
73
  lock = false
74
74
  if (err) {
75
75
  console.error(err)
@@ -94,7 +94,7 @@ let get_coingecko_rates = (cb, pair_or_pairs_or_cur_curs, type) => {
94
94
  } else if (type === 'cur') {
95
95
  let cur = pair_or_pairs_or_cur_curs,
96
96
  cur_id = coins_map[cur]
97
- needle.get(`https://api.coingecko.com/api/v3/simple/price?ids=${cur_id}&vs_currencies=usd`, (err, res, body) => {
97
+ cmc_limiter.process(needle.get, `https://api.coingecko.com/api/v3/simple/price?ids=${cur_id}&vs_currencies=usd`, (err, res, body) => {
98
98
  lock = false
99
99
  if (err) {
100
100
  console.error(cur, err)
@@ -112,7 +112,7 @@ let get_coingecko_rates = (cb, pair_or_pairs_or_cur_curs, type) => {
112
112
  })
113
113
  )
114
114
  let url = `https://api.coingecko.com/api/v3/simple/price?ids=${String(_.keys(cur_id_map))}&vs_currencies=usd`
115
- needle.get(url, (err, res, body) => {
115
+ cmc_limiter.process(needle.get, url, (err, res, body) => {
116
116
  lock = false
117
117
  if (err) {
118
118
  console.error(err)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icgio/icg-utils",
3
- "version": "1.7.15",
3
+ "version": "1.7.16",
4
4
  "description": "Utils package.",
5
5
  "main": "index.js",
6
6
  "directories": {