@merkl/api 0.10.225 → 0.10.227
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/src/eden/index.d.ts +3 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +5 -1
- package/dist/src/modules/v4/campaign/campaign.controller.js +8 -2
- package/dist/src/modules/v4/protocol/protocol.controller.d.ts +1 -0
- package/dist/src/modules/v4/protocol/protocol.model.d.ts +2 -1
- package/dist/src/modules/v4/protocol/protocol.model.js +3 -0
- package/dist/src/modules/v4/protocol/protocol.repository.js +9 -0
- package/dist/src/modules/v4/protocol/protocol.service.js +2 -0
- package/dist/src/modules/v4/reward/reward.controller.js +12 -1
- package/dist/src/modules/v4/reward/reward.model.js +17 -6
- package/dist/src/modules/v4/router.d.ts +1 -0
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/src/eden/index.d.ts
CHANGED
@@ -771,6 +771,7 @@ declare const eden: {
|
|
771
771
|
items?: number | undefined;
|
772
772
|
tags?: ("AMM" | "ALM" | "DEX" | "LENDING" | "PERPETUAL")[] | undefined;
|
773
773
|
page?: number | undefined;
|
774
|
+
opportunityTag?: string | undefined;
|
774
775
|
};
|
775
776
|
fetch?: RequestInit | undefined;
|
776
777
|
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
@@ -3598,6 +3599,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
3598
3599
|
items?: number | undefined;
|
3599
3600
|
tags?: ("AMM" | "ALM" | "DEX" | "LENDING" | "PERPETUAL")[] | undefined;
|
3600
3601
|
page?: number | undefined;
|
3602
|
+
opportunityTag?: string | undefined;
|
3601
3603
|
};
|
3602
3604
|
headers: unknown;
|
3603
3605
|
response: {
|
@@ -6957,6 +6959,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
6957
6959
|
items?: number | undefined;
|
6958
6960
|
tags?: ("AMM" | "ALM" | "DEX" | "LENDING" | "PERPETUAL")[] | undefined;
|
6959
6961
|
page?: number | undefined;
|
6962
|
+
opportunityTag?: string | undefined;
|
6960
6963
|
};
|
6961
6964
|
fetch?: RequestInit | undefined;
|
6962
6965
|
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
package/dist/src/index.d.ts
CHANGED
@@ -858,6 +858,7 @@ declare const app: Elysia<"", false, {
|
|
858
858
|
items?: number | undefined;
|
859
859
|
tags?: ("AMM" | "ALM" | "DEX" | "LENDING" | "PERPETUAL")[] | undefined;
|
860
860
|
page?: number | undefined;
|
861
|
+
opportunityTag?: string | undefined;
|
861
862
|
};
|
862
863
|
headers: unknown;
|
863
864
|
response: {
|
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:
|
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
|
@@ -22,6 +22,7 @@ export declare const ProtocolController: Elysia<"/protocols", false, {
|
|
22
22
|
items?: number | undefined;
|
23
23
|
tags?: ("AMM" | "ALM" | "DEX" | "LENDING" | "PERPETUAL")[] | undefined;
|
24
24
|
page?: number | undefined;
|
25
|
+
opportunityTag?: string | undefined;
|
25
26
|
};
|
26
27
|
headers: unknown;
|
27
28
|
response: {
|
@@ -5,7 +5,7 @@ import type { Resource } from "../prisma";
|
|
5
5
|
* @see {@link Resource}
|
6
6
|
*/
|
7
7
|
export type Protocol = Resource<"Protocol">;
|
8
|
-
declare const protocolTypes: readonly ["arthswap", "baseswap", "camelot", "crust", "fenix", "horiza", "izumi", "kim", "pancakeswap-v3", "quickswap-algebra", "quickswap-uni", "ramses", "retro", "stryke", "stryke-pcs", "stryke-sushi", "sushiswap-v3", "swapr", "thruster", "uniswap-v3", "voltage", "zero", "koi", "supswap-v3", "zkswap", "thirdtrade", "uniswap-v2", "velodrome", "aerodrome", "balancer", "curve", "aura", "akron", "beefy", "dragonswap", "poolside", "koi", "radiant", "aave", "euler", "gearbox", "compound", "sturdy", "frax", "ionic", "moonwell", "fluid", "silo", "morpho", "coumpound", "dolomite", "badger", "ajna", "layerbank", "ion", "eigenlayer"];
|
8
|
+
declare const protocolTypes: readonly ["arthswap", "baseswap", "camelot", "crust", "fenix", "horiza", "izumi", "kim", "pancakeswap-v3", "quickswap-algebra", "quickswap-uni", "ramses", "retro", "stryke", "stryke-pcs", "stryke-sushi", "sushiswap-v3", "swapr", "thruster", "uniswap-v3", "voltage", "zero", "koi", "supswap-v3", "zkswap", "thirdtrade", "uniswap-v2", "velodrome", "aerodrome", "balancer", "curve", "aura", "akron", "beefy", "dragonswap", "poolside", "koi", "radiant", "aave", "euler", "gearbox", "compound", "sturdy", "frax", "ionic", "moonwell", "fluid", "silo", "morpho", "coumpound", "dolomite", "badger", "ajna", "layerbank", "ion", "eigenlayer", "syncswap-v3", "neptune"];
|
9
9
|
export type ProtocolId = (typeof protocolTypes)[number];
|
10
10
|
export declare const ProtocolResourceDto: import("@sinclair/typebox").TObject<{
|
11
11
|
id: import("@sinclair/typebox").TString;
|
@@ -30,6 +30,7 @@ export declare const GetProtocolsQueryDto: import("@sinclair/typebox").TObject<{
|
|
30
30
|
LENDING: "LENDING";
|
31
31
|
PERPETUAL: "PERPETUAL";
|
32
32
|
}>>>;
|
33
|
+
opportunityTag: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
33
34
|
page: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
34
35
|
items: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
35
36
|
}>;
|
@@ -60,6 +60,8 @@ const protocolTypes = [
|
|
60
60
|
"layerbank",
|
61
61
|
"ion",
|
62
62
|
"eigenlayer",
|
63
|
+
"syncswap-v3",
|
64
|
+
"neptune",
|
63
65
|
];
|
64
66
|
// ─── DTOs ────────────────────────────────────────────────────────────────────
|
65
67
|
export const ProtocolResourceDto = t.Object({
|
@@ -73,6 +75,7 @@ export const ProtocolResourceDto = t.Object({
|
|
73
75
|
export const GetProtocolsQueryDto = t.Object({
|
74
76
|
id: t.Optional(t.String({ description: "Filter results by name. Useful for searching a protocol to verify its integration" })),
|
75
77
|
tags: t.Optional(t.Array(t.Enum(ProtocolTag, { description: "Filter by protocol tag" }))),
|
78
|
+
opportunityTag: t.Optional(t.String({ description: "Filter by underlying opportunities' tag" })),
|
76
79
|
page: t.Optional(t.Numeric({ description: "0-indexed page number", default: 0 })),
|
77
80
|
items: t.Optional(t.Numeric({ description: "Number of items returned by page", default: 20 })), // items per page
|
78
81
|
});
|
@@ -24,6 +24,15 @@ 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
|
+
Opportunities: query.opportunityTag
|
28
|
+
? {
|
29
|
+
some: {
|
30
|
+
tags: {
|
31
|
+
has: query.opportunityTag,
|
32
|
+
},
|
33
|
+
},
|
34
|
+
}
|
35
|
+
: undefined,
|
27
36
|
// id: typeof query.id === "string" ? query.id : !!query.id ? { in: query.id } : undefined,
|
28
37
|
},
|
29
38
|
};
|
@@ -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(),
|
@@ -736,6 +736,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
736
736
|
items?: number | undefined;
|
737
737
|
tags?: ("AMM" | "ALM" | "DEX" | "LENDING" | "PERPETUAL")[] | undefined;
|
738
738
|
page?: number | undefined;
|
739
|
+
opportunityTag?: string | undefined;
|
739
740
|
};
|
740
741
|
headers: unknown;
|
741
742
|
response: {
|