@merkl/api 0.10.162 → 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.
@@ -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"] });
|