@merkl/api 0.10.161 → 0.10.163

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.
@@ -178,16 +178,6 @@ export type BreakdownForCampaignsRaw = {
178
178
  recipient: string;
179
179
  campaignId: string;
180
180
  reason: string;
181
- Token: {
182
- id: string;
183
- name: string;
184
- chainId: number;
185
- address: string;
186
- decimals: number;
187
- symbol: string;
188
- icon: string;
189
- verified: boolean;
190
- price: number;
191
- };
181
+ rewardTokenAddress: string;
192
182
  };
193
183
  export {};
@@ -186,13 +186,12 @@ export class RewardRepository {
186
186
  SELECT
187
187
  rb."amount",
188
188
  rb."reason",
189
- r."recipient"
189
+ r."recipient",
190
+ t."address" as "rewardTokenAddress"
190
191
  FROM
191
192
  "RewardBreakdown" rb
192
193
  INNER JOIN
193
194
  "Reward" r ON rb."rewardId" = r."id"
194
- INNER JOIN
195
- "Campaign" c ON rb."campaignId" = c."id"
196
195
  INNER JOIN
197
196
  "Token" t ON r."rewardTokenId" = t."id"
198
197
  WHERE
@@ -30,7 +30,7 @@ export default (app) => app.get("", async ({ query: { chain_campaignIds } }) =>
30
30
  return {
31
31
  recipient: x.recipient,
32
32
  reason: x.reason,
33
- rewardToken: x.Token.address,
33
+ rewardToken: x.rewardTokenAddress,
34
34
  amount: x.amount,
35
35
  };
36
36
  }));
@@ -1,5 +1,10 @@
1
1
  import type { App } from "../../index";
2
2
  import { RewardService } from "../../modules/v4/reward";
3
+ export declare const query: import("@sinclair/typebox").TObject<{
4
+ chainIds: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>]>>;
5
+ user: import("@sinclair/typebox").TString;
6
+ creatorTag: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
7
+ }>;
3
8
  declare const _default: (app: App) => import("elysia").default<"", false, {
4
9
  decorator: {};
5
10
  store: {};
@@ -1,14 +1,14 @@
1
1
  import { RewardService } from "../../modules/v4/reward";
2
2
  import { RewardConvertorService } from "../../modules/v4/reward/subservices/converter";
3
- import { throwOnInvalidRequiredAddress } from "../../utils/throw";
4
3
  import { ChainId, isSupportedChain } from "@sdk";
5
4
  import { t } from "elysia";
6
- const QueryDto = t.Object({
5
+ import checkQueryAddressValidity from "../../hooks/checkQueryAddressValidity";
6
+ export const query = t.Object({
7
7
  chainIds: t.Optional(t.Union([t.String(), t.Array(t.String())])),
8
8
  user: t.String(),
9
9
  creatorTag: t.Optional(t.String()),
10
10
  });
11
- export default (app) => app.get("", async ({ query }) => {
11
+ export default (app) => app.use(checkQueryAddressValidity()).get("", async ({ query }) => {
12
12
  let rawChainIds = query.chainIds;
13
13
  if (typeof rawChainIds === "string" && rawChainIds.includes(",")) {
14
14
  rawChainIds = rawChainIds.split(",");
@@ -30,10 +30,4 @@ export default (app) => app.get("", async ({ query }) => {
30
30
  const v4Res = await RewardService.getUserRewardsByChain(user, false, chainIds);
31
31
  const v3Res = RewardConvertorService.convertV4toRewardV3(v4Res);
32
32
  return v3Res;
33
- }, {
34
- query: QueryDto,
35
- tags: ["Rewards"],
36
- beforeHandle: ({ query }) => {
37
- throwOnInvalidRequiredAddress(query.user);
38
- },
39
- });
33
+ }, { query, tags: ["Rewards"] });
@@ -27,7 +27,7 @@ export default (app) => app.use(checkQueryChainIdValidity()).get("", async ({ qu
27
27
  return {
28
28
  recipient: x.recipient,
29
29
  reason: x.reason,
30
- rewardToken: x.Token.address,
30
+ rewardToken: x.rewardTokenAddress,
31
31
  amount: x.amount,
32
32
  };
33
33
  });