@merkl/api 0.10.226 → 0.10.227

Sign up to get free protection for your applications and to get access to all the features.
package/dist/src/index.js CHANGED
@@ -85,7 +85,11 @@ const app = new Elysia({
85
85
  exclude: [/engine\/*/, /v1\/.*/, /v2\/.*/, /v3\/.*/, /swagger\/*/],
86
86
  }))
87
87
  .use(cors())
88
- .get("/", () => "Merkl API: docs available at /docs")
88
+ .get("/", () => "Merkl API: docs available at /docs", {
89
+ detail: {
90
+ hide: true,
91
+ },
92
+ })
89
93
  .use(v1)
90
94
  .use(v2)
91
95
  .use(v4)
@@ -17,13 +17,19 @@ export const CampaignController = new Elysia({ prefix: "/campaigns", detail: { t
17
17
  .get("/", async ({ query }) => await CampaignService.findMany(query), {
18
18
  query: GetCampaignQueryDto,
19
19
  response: t.Array(CampaignResourceDto),
20
- detail: `**Retrieve Multiple Campaigns**
21
- <p>This endpoint enables you to search for opportunities by providing specific criteria through query parameters.</p>`,
20
+ detail: {
21
+ description: `**Retrieve Multiple Campaigns**
22
+ <p>This endpoint enables you to search for campaigns by providing specific criteria through query parameters.</p>`,
23
+ },
22
24
  })
23
25
  // ─── Get Total Campaigns Count ───────────────────────────────────────
24
26
  .get("/count", async ({ query }) => await CampaignService.countMany(query), {
25
27
  query: GetCampaignQueryDto,
26
28
  response: t.Number(),
29
+ detail: {
30
+ description: `**Count Campaigns**
31
+ <p>This endpoint enables you to count campaigns corresponding to filters specified in the query params.</p>`,
32
+ },
27
33
  })
28
34
  .group("/campaigns-to-process", app => {
29
35
  return (app
@@ -5,13 +5,16 @@ import Elysia from "elysia";
5
5
  import { CampaignIdDto, CampaignIdWithoutPageDto, CreateManyBreakdownDto, CreateManyRewardDto, RegisterClaimsDto, UpdatePendingDto, } from "./reward.model";
6
6
  import { RewardService } from "./reward.service";
7
7
  // ─── Rewards Controller ──────────────────────────────────────────────────────
8
- export const RewardController = new Elysia({ prefix: "/rewards", detail: { tags: ["Rewards"], hide: true } })
8
+ export const RewardController = new Elysia({ prefix: "/rewards", detail: { tags: ["Rewards"] } })
9
9
  // ─── Get Reward Breakdowns For Campaign Ids ──────────────────────────
10
10
  .get("/", async ({ query }) => await RewardService.breakdownForCampaign(query), {
11
11
  query: CampaignIdDto,
12
12
  beforeHandle: ({ query }) => {
13
13
  throwOnUnsupportedChainId(query.chainId);
14
14
  },
15
+ detail: {
16
+ description: "Returns the all the address that received rewards for a given campaign, sorted by descending amounts",
17
+ },
15
18
  })
16
19
  // ─── Get Total Amount Rewarded For Campaign Id ──────────────────────
17
20
  .get("/total", async ({ query }) => await RewardService.total(query), {
@@ -19,18 +22,21 @@ export const RewardController = new Elysia({ prefix: "/rewards", detail: { tags:
19
22
  beforeHandle: ({ query }) => {
20
23
  throwOnUnsupportedChainId(query.chainId);
21
24
  },
25
+ detail: { description: "Returns the total amount distributed for a given campaign" },
22
26
  })
23
27
  // ─── Create Many Rewards ─────────────────────────────────────────────
24
28
  .post("/engine", async ({ body }) => await RewardService.createManyReward(body), {
25
29
  headers: AuthorizationHeadersDto,
26
30
  body: CreateManyRewardDto,
27
31
  beforeHandle: EngineGuard,
32
+ detail: { hide: true },
28
33
  })
29
34
  // ─── Create Many Reward Breakdowns ───────────────────────────────────
30
35
  .post("/engine/breakdowns", async ({ body }) => await RewardService.createManyBreakdown(body), {
31
36
  headers: AuthorizationHeadersDto,
32
37
  body: CreateManyBreakdownDto,
33
38
  beforeHandle: EngineGuard,
39
+ detail: { hide: true },
34
40
  })
35
41
  // ─── Register new claims ──────────────────────────────────────────────
36
42
  .post("/engine/claims", async ({ body }) => await RewardService.registerClaims(body), {
@@ -44,12 +50,14 @@ export const RewardController = new Elysia({ prefix: "/rewards", detail: { tags:
44
50
  claim.recipient = throwOnInvalidRequiredAddress(claim.recipient);
45
51
  }
46
52
  },
53
+ detail: { hide: true },
47
54
  })
48
55
  // ─── Create Many Pending Rewards ─────────────────────────────────────
49
56
  .post("/engine/pendings", async ({ body }) => await RewardService.updatePendings(body), {
50
57
  headers: AuthorizationHeadersDto,
51
58
  body: UpdatePendingDto,
52
59
  beforeHandle: EngineGuard,
60
+ detail: { hide: true },
53
61
  })
54
62
  // ─── Get Reward Count By Chain And Root ──────────────────────────────
55
63
  .get("/count", async ({ query }) => await RewardService.count(query), {
@@ -57,11 +65,13 @@ export const RewardController = new Elysia({ prefix: "/rewards", detail: { tags:
57
65
  beforeHandle: ({ query }) => {
58
66
  throwOnUnsupportedChainId(query.chainId);
59
67
  },
68
+ detail: { hide: true },
60
69
  })
61
70
  // ─── Get Reward Count By Chain And Root ──────────────────────────────
62
71
  .get("/count/chains", async () => await RewardService.countAllchains(), {
63
72
  headers: AuthorizationHeadersDto,
64
73
  beforeHandle: BackOfficeGuard,
74
+ detail: { hide: true },
65
75
  })
66
76
  // ─── Unclaimed Data routes ───────────────────────────────────────────
67
77
  .group("/unclaim", app => {
@@ -70,5 +80,6 @@ export const RewardController = new Elysia({ prefix: "/rewards", detail: { tags:
70
80
  beforeHandle: ({ query }) => {
71
81
  throwOnUnsupportedChainId(query.chainId);
72
82
  },
83
+ detail: { description: "Returns the total of unclaimed rewards for given campaigns" },
73
84
  });
74
85
  });
@@ -79,9 +79,16 @@ export const RewardsPerChainDto = t.Object({
79
79
  chainId: t.Numeric(),
80
80
  });
81
81
  export const CampaignIdWithoutPageDto = t.Object({
82
- chainId: t.Numeric(),
82
+ chainId: t.Numeric({
83
+ description: "Chain ID",
84
+ }),
83
85
  campaignIds: t
84
- .Transform(t.Union([t.String(), t.Array(t.String())]))
86
+ .Transform(t.Union([
87
+ t.String({
88
+ description: "Comma-separated campaign IDs",
89
+ }),
90
+ t.Array(t.String()),
91
+ ]))
85
92
  .Decode(value => {
86
93
  return typeof value === "string" ? value.split(",") : value;
87
94
  })
@@ -97,10 +104,14 @@ export const CampaignIdListDto = t.Object({
97
104
  items: t.Optional(t.Numeric()), // items per page
98
105
  });
99
106
  export const CampaignIdDto = t.Object({
100
- chainId: t.Numeric(),
101
- campaignId: t.String(),
102
- page: t.Optional(t.Numeric()), // 0-indexed
103
- items: t.Optional(t.Numeric()), // items per page
107
+ chainId: t.Numeric({
108
+ description: "Chain ID",
109
+ }),
110
+ campaignId: t.String({
111
+ description: "Campaign ID",
112
+ }),
113
+ page: t.Optional(t.Numeric({ description: "Page number", default: 0 })), // 0-indexed
114
+ items: t.Optional(t.Numeric({ description: "Number of returned rows", default: 20 })), // items per page
104
115
  });
105
116
  export const UserRewardV3Dto = t.Record(t.String({ title: "TokenAddress" }), t.Object({
106
117
  symbol: t.String(),