@merkl/api 0.10.226 → 0.10.228
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/src/index.js +5 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20DynamicData.js +1 -0
- package/dist/src/modules/v4/campaign/campaign.controller.js +8 -2
- package/dist/src/modules/v4/protocol/protocol.repository.js +1 -1
- package/dist/src/modules/v4/reward/reward.controller.js +12 -1
- package/dist/src/modules/v4/reward/reward.model.js +17 -6
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
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)
|
@@ -29,6 +29,7 @@ export async function ERC20DynamicData(chainId, campaigns) {
|
|
29
29
|
if ([
|
30
30
|
"0x2d3ae0a97c6f73ad37c1a9cc5e360f72b206ee61d96952fe772b3ab02f8a5713",
|
31
31
|
"0x653ec2bd4aa79b74a2d6c3240ebe3bc4afb679ea6963c2c8afceef69c7c914f9",
|
32
|
+
"0x6cddb42d99fe4df7d3783f7eb25044bf141084ff99882a2dde931880efc7793d",
|
32
33
|
].includes(campaign.campaignId)) {
|
33
34
|
campaign.campaignParameters.url =
|
34
35
|
"https://app.zerolend.xyz/reserve-overview/?underlyingAsset=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48&marketName=proto_mainnet_rwa_v3&utm_source=Merkle&utm_medium=Website&utm_campaign=MerklMagic30";
|
@@ -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:
|
21
|
-
|
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
|
@@ -24,7 +24,7 @@ export class ProtocolRepository {
|
|
24
24
|
where: {
|
25
25
|
id: query.id ? { contains: query.id, mode: "insensitive" } : undefined,
|
26
26
|
tags: query.tags ? { hasEvery: query.tags } : undefined,
|
27
|
-
|
27
|
+
MainOpportunities: query.opportunityTag
|
28
28
|
? {
|
29
29
|
some: {
|
30
30
|
tags: {
|
@@ -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"]
|
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([
|
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
|
-
|
102
|
-
|
103
|
-
|
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(),
|