@merkl/api 0.10.161 → 0.10.163
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/src/modules/v4/reward/reward.model.d.ts +1 -11
- package/dist/src/modules/v4/reward/reward.repository.js +2 -3
- package/dist/src/routes/v3/campaignsRewardsReport.js +1 -1
- package/dist/src/routes/v3/rewards.d.ts +5 -0
- package/dist/src/routes/v3/rewards.js +4 -10
- package/dist/src/routes/v3/rewardsReport.js +1 -1
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
@@ -178,16 +178,6 @@ export type BreakdownForCampaignsRaw = {
|
|
178
178
|
recipient: string;
|
179
179
|
campaignId: string;
|
180
180
|
reason: string;
|
181
|
-
|
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
|
@@ -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
|
-
|
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"] });
|