@merkl/api 0.20.126 → 0.20.127

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.
@@ -300,12 +300,12 @@ export class TokenService {
300
300
  }));
301
301
  }
302
302
  static async getAllValidRewardTokens(query) {
303
- return await CacheService.wrap(TTLPresets.MIN_5, async () => {
304
- let chainIds = !!query.chainId
305
- ? query.chainId?.split(",").map(n => Number.parseInt(n))
306
- : (await ChainService.findMany({
307
- test: true,
308
- })).map(chain => chain.id);
303
+ const chainIds = !!query.chainId
304
+ ? query.chainId?.split(",").map(n => Number.parseInt(n))
305
+ : (await ChainService.findMany({
306
+ test: true,
307
+ })).map(chain => chain.id);
308
+ return await CacheService.wrap(TTLPresets.MIN_5, async (chainIds) => {
309
309
  /** Fetch current Merkle Roots */
310
310
  const promises = await Promise.allSettled(chainIds.map(chainId => withTimeout(TokenService.getValidRewardTokens(chainId), 5_000)));
311
311
  /** Filter out unsuccessful chainIds */
@@ -316,7 +316,7 @@ export class TokenService {
316
316
  acc[chainIds[index]] = promise.value;
317
317
  return acc;
318
318
  }, {});
319
- });
319
+ }, chainIds);
320
320
  }
321
321
  static async getValidRewardTokens(chainId) {
322
322
  const validRewardTokens = await DistributionCreatorService(chainId).validRewardTokens();