@merkl/api 0.20.125 → 0.20.126

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.
@@ -12,7 +12,7 @@ export default class CoingeckoService {
12
12
  return await this.fetchPrices(filteredTokens);
13
13
  }
14
14
  buildUrl(tokens) {
15
- const tikerParams = tokens
15
+ const tickerParams = tokens
16
16
  .map(token => {
17
17
  const args = token.args;
18
18
  if (!args?.ticker)
@@ -20,7 +20,7 @@ export default class CoingeckoService {
20
20
  return `coingecko:${args.ticker}`;
21
21
  })
22
22
  .join(",");
23
- return this.baseUrl.concat(tikerParams);
23
+ return this.baseUrl.concat(tickerParams);
24
24
  }
25
25
  async fetchPrices(tickers) {
26
26
  const chunkSize = 200;
@@ -28,7 +28,7 @@ export default class CoingeckoService {
28
28
  for (let i = 0; i < tickers.length; i += chunkSize) {
29
29
  chunks.push(tickers.slice(i, Math.min(tickers.length, i + chunkSize)));
30
30
  }
31
- const promises = (await Promise.all(chunks.map(async (chunk) => {
31
+ const promises = (await Promise.allSettled(chunks.map(async (chunk) => {
32
32
  const url = this.buildUrl(chunk);
33
33
  return axios
34
34
  .get(url, { timeout: 10000 })
@@ -37,7 +37,9 @@ export default class CoingeckoService {
37
37
  log.error("❌ CoingeckoService not responding", err);
38
38
  throw "❌ CoingeckoService not responding";
39
39
  });
40
- }))).filter(result => !!result);
40
+ })))
41
+ .filter(result => result.status === "fulfilled")
42
+ .map(result => result.value);
41
43
  return promises.reduce((acc, val) => acc.concat(val), []);
42
44
  }
43
45
  // biome-ignore lint/suspicious/noExplicitAny: <explanation> Need to be typed according to coinguekko answer type