@merkl/api 0.10.300 → 0.10.302

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.
@@ -313,20 +313,22 @@ export class RewardRepository {
313
313
  const items = _items || 50;
314
314
  const result = await apiDbClient.$queryRawUnsafe(`
315
315
  SELECT
316
+ rb."amount",
317
+ rb."reason",
318
+ rb."claimed",
319
+ rb."pending",
316
320
  r."recipient",
317
- SUM(rb."amount"::numeric)::text AS amount,
318
- SUM(rb."claimed"::numeric)::text AS claimed,
319
- SUM(rb."pending"::numeric)::text AS pending
321
+ t."address" as "rewardTokenAddress"
320
322
  FROM
321
323
  "RewardBreakdown" rb
322
324
  INNER JOIN
323
325
  "Reward" r ON rb."rewardId" = r."id"
326
+ INNER JOIN
327
+ "Token" t ON r."rewardTokenId" = t."id"
324
328
  WHERE
325
329
  r."root" = $1 AND r."rewardTokenId" = $2
326
- GROUP BY
327
- r."recipient"
328
330
  ORDER BY
329
- (SUM(rb."amount"::numeric) + SUM(rb."pending"::numeric)) DESC
331
+ (rb."amount"::numeric + rb."pending"::numeric) DESC
330
332
  LIMIT $3
331
333
  OFFSET $4
332
334
  `, root, id, items, items * page);
@@ -248,7 +248,7 @@ export class RewardService {
248
248
  const toUpdate = [];
249
249
  const toCreate = [];
250
250
  const exists = await RewardRepository.findManyBreakdownUniques(uniques.slice(i, Math.min(i + 1000, uniques.length)));
251
- for (const [pointIndex, point] of data.data.entries()) {
251
+ for (const [pointIndex, point] of data.data.slice(i, Math.min(i + 1000, uniques.length)).entries()) {
252
252
  if (!!exists[pointIndex]) {
253
253
  toUpdate.push(point);
254
254
  }