@merkl/api 0.10.183 → 0.10.185

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.
Files changed (35) hide show
  1. package/dist/src/eden/index.d.ts +126 -9
  2. package/dist/src/index.d.ts +50 -3
  3. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1RefactoFinal.js +0 -3
  4. package/dist/src/modules/v4/merklRoot/merklRoot.controller.d.ts +26 -0
  5. package/dist/src/modules/v4/merklRoot/merklRoot.controller.js +16 -3
  6. package/dist/src/modules/v4/merklRoot/merklRoot.model.d.ts +7 -0
  7. package/dist/src/modules/v4/merklRoot/merklRoot.model.js +6 -0
  8. package/dist/src/modules/v4/merklRoot/merklRoot.repository.d.ts +7 -1
  9. package/dist/src/modules/v4/merklRoot/merklRoot.repository.js +5 -0
  10. package/dist/src/modules/v4/merklRoot/merklRoot.service.d.ts +7 -1
  11. package/dist/src/modules/v4/merklRoot/merklRoot.service.js +3 -0
  12. package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +3 -3
  13. package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +4 -4
  14. package/dist/src/modules/v4/opportunity/opportunity.service.js +0 -2
  15. package/dist/src/modules/v4/reward/reward.controller.d.ts +21 -0
  16. package/dist/src/modules/v4/reward/reward.controller.js +15 -2
  17. package/dist/src/modules/v4/reward/reward.model.d.ts +7 -0
  18. package/dist/src/modules/v4/reward/reward.model.js +6 -0
  19. package/dist/src/modules/v4/reward/reward.repository.d.ts +1 -0
  20. package/dist/src/modules/v4/reward/reward.repository.js +15 -0
  21. package/dist/src/modules/v4/reward/reward.service.d.ts +2 -1
  22. package/dist/src/modules/v4/reward/reward.service.js +14 -0
  23. package/dist/src/modules/v4/router.d.ts +50 -3
  24. package/dist/src/modules/v4/token/token.repository.js +6 -2
  25. package/dist/src/routes/v3/blacklist.d.ts +50 -3
  26. package/dist/src/routes/v3/campaigns.d.ts +50 -3
  27. package/dist/src/routes/v3/campaignsInfo.d.ts +50 -3
  28. package/dist/src/routes/v3/multiChainPositions.d.ts +50 -3
  29. package/dist/src/routes/v3/opportunity.d.ts +50 -3
  30. package/dist/src/routes/v3/positions.d.ts +50 -3
  31. package/dist/src/routes/v3/rewards.d.ts +50 -3
  32. package/dist/src/routes/v3/updates.d.ts +50 -3
  33. package/dist/src/routes/v3/userRewards.d.ts +50 -3
  34. package/dist/tsconfig.package.tsbuildinfo +1 -1
  35. package/package.json +1 -1
@@ -106,7 +106,7 @@ declare const eden: {
106
106
  tvl: number;
107
107
  apr: number;
108
108
  dailyRewards: number;
109
- } | null | undefined;
109
+ } | undefined;
110
110
  }>>;
111
111
  campaigns: {
112
112
  get: (options?: {
@@ -317,7 +317,7 @@ declare const eden: {
317
317
  };
318
318
  fetch?: RequestInit | undefined;
319
319
  }) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
320
- 200: ({
320
+ 200: {
321
321
  aprRecord: {
322
322
  cumulated: number;
323
323
  timestamp: bigint;
@@ -403,7 +403,7 @@ declare const eden: {
403
403
  tvl: number;
404
404
  apr: number;
405
405
  dailyRewards: number;
406
- } | null)[];
406
+ }[];
407
407
  }>>;
408
408
  };
409
409
  count: {
@@ -898,6 +898,22 @@ declare const eden: {
898
898
  } | undefined;
899
899
  }>>;
900
900
  };
901
+ claims: {
902
+ post: (body: {
903
+ token: string;
904
+ chainId: number;
905
+ recipient: string;
906
+ root: string;
907
+ }[], options: {
908
+ headers: {
909
+ authorization: string;
910
+ };
911
+ query?: Record<string, unknown> | undefined;
912
+ fetch?: RequestInit | undefined;
913
+ }) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
914
+ 200: void;
915
+ }>>;
916
+ };
901
917
  pendings: {
902
918
  post: (body: {
903
919
  distributionChainId: number;
@@ -1564,6 +1580,25 @@ declare const eden: {
1564
1580
  epoch: number;
1565
1581
  }[];
1566
1582
  }>>;
1583
+ post: (body: {
1584
+ timestamp: number;
1585
+ chainId: number;
1586
+ root: string;
1587
+ epoch: number;
1588
+ }, options: {
1589
+ headers: {
1590
+ authorization: string;
1591
+ };
1592
+ query?: Record<string, unknown> | undefined;
1593
+ fetch?: RequestInit | undefined;
1594
+ }) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
1595
+ 200: {
1596
+ timestamp: bigint;
1597
+ chainId: number;
1598
+ root: string;
1599
+ epoch: number;
1600
+ };
1601
+ }>>;
1567
1602
  };
1568
1603
  live: {
1569
1604
  get: (options?: {
@@ -2102,7 +2137,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
2102
2137
  tvl: number;
2103
2138
  apr: number;
2104
2139
  dailyRewards: number;
2105
- } | null | undefined;
2140
+ } | undefined;
2106
2141
  };
2107
2142
  };
2108
2143
  };
@@ -2280,7 +2315,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
2280
2315
  };
2281
2316
  headers: unknown;
2282
2317
  response: {
2283
- 200: ({
2318
+ 200: {
2284
2319
  aprRecord: {
2285
2320
  cumulated: number;
2286
2321
  timestamp: bigint;
@@ -2366,7 +2401,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
2366
2401
  tvl: number;
2367
2402
  apr: number;
2368
2403
  dailyRewards: number;
2369
- } | null)[];
2404
+ }[];
2370
2405
  };
2371
2406
  };
2372
2407
  };
@@ -3006,6 +3041,27 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
3006
3041
  };
3007
3042
  };
3008
3043
  };
3044
+ } & {
3045
+ engine: {
3046
+ claims: {
3047
+ post: {
3048
+ body: {
3049
+ token: string;
3050
+ chainId: number;
3051
+ recipient: string;
3052
+ root: string;
3053
+ }[];
3054
+ params: {};
3055
+ query: unknown;
3056
+ headers: {
3057
+ authorization: string;
3058
+ };
3059
+ response: {
3060
+ 200: void;
3061
+ };
3062
+ };
3063
+ };
3064
+ };
3009
3065
  } & {
3010
3066
  engine: {
3011
3067
  pendings: {
@@ -3876,6 +3932,32 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
3876
3932
  };
3877
3933
  };
3878
3934
  };
3935
+ } & {
3936
+ roots: {
3937
+ index: {
3938
+ post: {
3939
+ body: {
3940
+ timestamp: number;
3941
+ chainId: number;
3942
+ root: string;
3943
+ epoch: number;
3944
+ };
3945
+ params: {};
3946
+ query: unknown;
3947
+ headers: {
3948
+ authorization: string;
3949
+ };
3950
+ response: {
3951
+ 200: {
3952
+ timestamp: bigint;
3953
+ chainId: number;
3954
+ root: string;
3955
+ epoch: number;
3956
+ };
3957
+ };
3958
+ };
3959
+ };
3960
+ };
3879
3961
  };
3880
3962
  } & {
3881
3963
  v4: {
@@ -4456,7 +4538,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
4456
4538
  tvl: number;
4457
4539
  apr: number;
4458
4540
  dailyRewards: number;
4459
- } | null | undefined;
4541
+ } | undefined;
4460
4542
  }>>;
4461
4543
  campaigns: {
4462
4544
  get: (options?: {
@@ -4667,7 +4749,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
4667
4749
  };
4668
4750
  fetch?: RequestInit | undefined;
4669
4751
  }) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
4670
- 200: ({
4752
+ 200: {
4671
4753
  aprRecord: {
4672
4754
  cumulated: number;
4673
4755
  timestamp: bigint;
@@ -4753,7 +4835,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
4753
4835
  tvl: number;
4754
4836
  apr: number;
4755
4837
  dailyRewards: number;
4756
- } | null)[];
4838
+ }[];
4757
4839
  }>>;
4758
4840
  };
4759
4841
  count: {
@@ -5248,6 +5330,22 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
5248
5330
  } | undefined;
5249
5331
  }>>;
5250
5332
  };
5333
+ claims: {
5334
+ post: (body: {
5335
+ token: string;
5336
+ chainId: number;
5337
+ recipient: string;
5338
+ root: string;
5339
+ }[], options: {
5340
+ headers: {
5341
+ authorization: string;
5342
+ };
5343
+ query?: Record<string, unknown> | undefined;
5344
+ fetch?: RequestInit | undefined;
5345
+ }) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
5346
+ 200: void;
5347
+ }>>;
5348
+ };
5251
5349
  pendings: {
5252
5350
  post: (body: {
5253
5351
  distributionChainId: number;
@@ -5914,6 +6012,25 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
5914
6012
  epoch: number;
5915
6013
  }[];
5916
6014
  }>>;
6015
+ post: (body: {
6016
+ timestamp: number;
6017
+ chainId: number;
6018
+ root: string;
6019
+ epoch: number;
6020
+ }, options: {
6021
+ headers: {
6022
+ authorization: string;
6023
+ };
6024
+ query?: Record<string, unknown> | undefined;
6025
+ fetch?: RequestInit | undefined;
6026
+ }) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
6027
+ 200: {
6028
+ timestamp: bigint;
6029
+ chainId: number;
6030
+ root: string;
6031
+ epoch: number;
6032
+ };
6033
+ }>>;
5917
6034
  };
5918
6035
  live: {
5919
6036
  get: (options?: {
@@ -164,7 +164,7 @@ declare const app: Elysia<"", false, {
164
164
  tvl: number;
165
165
  apr: number;
166
166
  dailyRewards: number;
167
- } | null | undefined;
167
+ } | undefined;
168
168
  };
169
169
  };
170
170
  };
@@ -342,7 +342,7 @@ declare const app: Elysia<"", false, {
342
342
  };
343
343
  headers: unknown;
344
344
  response: {
345
- 200: ({
345
+ 200: {
346
346
  aprRecord: {
347
347
  cumulated: number;
348
348
  timestamp: bigint;
@@ -428,7 +428,7 @@ declare const app: Elysia<"", false, {
428
428
  tvl: number;
429
429
  apr: number;
430
430
  dailyRewards: number;
431
- } | null)[];
431
+ }[];
432
432
  };
433
433
  };
434
434
  };
@@ -1068,6 +1068,27 @@ declare const app: Elysia<"", false, {
1068
1068
  };
1069
1069
  };
1070
1070
  };
1071
+ } & {
1072
+ engine: {
1073
+ claims: {
1074
+ post: {
1075
+ body: {
1076
+ token: string;
1077
+ chainId: number;
1078
+ recipient: string;
1079
+ root: string;
1080
+ }[];
1081
+ params: {};
1082
+ query: unknown;
1083
+ headers: {
1084
+ authorization: string;
1085
+ };
1086
+ response: {
1087
+ 200: void;
1088
+ };
1089
+ };
1090
+ };
1091
+ };
1071
1092
  } & {
1072
1093
  engine: {
1073
1094
  pendings: {
@@ -1938,6 +1959,32 @@ declare const app: Elysia<"", false, {
1938
1959
  };
1939
1960
  };
1940
1961
  };
1962
+ } & {
1963
+ roots: {
1964
+ index: {
1965
+ post: {
1966
+ body: {
1967
+ timestamp: number;
1968
+ chainId: number;
1969
+ root: string;
1970
+ epoch: number;
1971
+ };
1972
+ params: {};
1973
+ query: unknown;
1974
+ headers: {
1975
+ authorization: string;
1976
+ };
1977
+ response: {
1978
+ 200: {
1979
+ timestamp: bigint;
1980
+ chainId: number;
1981
+ root: string;
1982
+ epoch: number;
1983
+ };
1984
+ };
1985
+ };
1986
+ };
1987
+ };
1941
1988
  };
1942
1989
  } & {
1943
1990
  v4: {
@@ -182,10 +182,8 @@ function parseForBalancer(calls, index, targetToken, name) {
182
182
  function parseForStaking(campaign, calls, index, targetToken) {
183
183
  try {
184
184
  const whitelist = campaign.campaignParameters.whitelist;
185
- console.log("whitelist", whitelist, whitelist.length);
186
185
  if (whitelist.length === 1) {
187
186
  const forwarders = campaign.campaignParameters.forwarders;
188
- console.log("forwarders", forwarders);
189
187
  if (forwarders.length === 1) {
190
188
  if (forwarders[0].sender === whitelist[0]) {
191
189
  const name = decodeCall(calls, index + 2, "name");
@@ -210,7 +208,6 @@ export function getTokenTypeRound1(calls, targetToken, index, campaign) {
210
208
  result = parseForMetamorpho(returnValueOfCalls, index, targetToken);
211
209
  if (result)
212
210
  return result;
213
- console.log("parsing for staking");
214
211
  result = parseForStaking(campaign, returnValueOfCalls, index, targetToken);
215
212
  if (result)
216
213
  return result;
@@ -52,6 +52,32 @@ export declare const MerklRootController: Elysia<"/roots", false, {
52
52
  };
53
53
  };
54
54
  };
55
+ } & {
56
+ roots: {
57
+ index: {
58
+ post: {
59
+ body: {
60
+ timestamp: number;
61
+ chainId: number;
62
+ root: string;
63
+ epoch: number;
64
+ };
65
+ params: {};
66
+ query: unknown;
67
+ headers: {
68
+ authorization: string;
69
+ };
70
+ response: {
71
+ 200: {
72
+ timestamp: bigint;
73
+ chainId: number;
74
+ root: string;
75
+ epoch: number;
76
+ };
77
+ };
78
+ };
79
+ };
80
+ };
55
81
  }, {
56
82
  derive: {};
57
83
  resolve: {};
@@ -1,8 +1,9 @@
1
+ import { AuthorizationHeadersDto, EngineGuard } from "../../../guards/Engine.guard";
1
2
  import { throwOnUnsupportedChainId } from "../../../utils/throw";
2
3
  import Elysia from "elysia";
3
- import { RootByTimestampsDto } from "./merklRoot.model";
4
+ import { CreateRootDto, RootByTimestampsDto } from "./merklRoot.model";
4
5
  import { MerklRootService } from "./merklRoot.service";
5
- // ─── Merkl Roots Controller ──────────────────────────────────────────────────
6
+ // ─── Merkl Roots Controller ─────────────────────────────────────────────
6
7
  export const MerklRootController = new Elysia({ prefix: "/roots", detail: { tags: ["Roots"] } })
7
8
  // ─── Get Merkl Root By Timestamp ─────────────────────────────────────
8
9
  .get("/", async ({ query }) => await MerklRootService.rootForTimestamp(query), {
@@ -12,4 +13,16 @@ export const MerklRootController = new Elysia({ prefix: "/roots", detail: { tags
12
13
  },
13
14
  })
14
15
  // ─── Get all live Merkl Roots ─────────────────────────────────────────
15
- .get("/live", async () => await MerklRootService.fetchAll());
16
+ .get("/live", async () => await MerklRootService.fetchAll())
17
+ // ─── Create a Merkl Root Entry ────────────────────────────────────────
18
+ .post("/", async ({ body }) => {
19
+ return await MerklRootService.create(body);
20
+ }, {
21
+ headers: AuthorizationHeadersDto,
22
+ body: CreateRootDto,
23
+ beforeHandle: ({ headers, body }) => {
24
+ EngineGuard({ headers });
25
+ throwOnUnsupportedChainId(body.chainId);
26
+ },
27
+ detail: { hide: true },
28
+ });
@@ -3,4 +3,11 @@ export declare const RootByTimestampsDto: import("@sinclair/typebox").TObject<{
3
3
  fromTimestamp: import("@sinclair/typebox").TString;
4
4
  toTimestamp: import("@sinclair/typebox").TString;
5
5
  }>;
6
+ export declare const CreateRootDto: import("@sinclair/typebox").TObject<{
7
+ chainId: import("@sinclair/typebox").TNumber;
8
+ root: import("@sinclair/typebox").TString;
9
+ timestamp: import("@sinclair/typebox").TNumber;
10
+ epoch: import("@sinclair/typebox").TNumber;
11
+ }>;
6
12
  export type RootByTimestampModel = typeof RootByTimestampsDto.static;
13
+ export type CreateRootModel = typeof CreateRootDto.static;
@@ -4,3 +4,9 @@ export const RootByTimestampsDto = t.Object({
4
4
  fromTimestamp: t.String(),
5
5
  toTimestamp: t.String(),
6
6
  });
7
+ export const CreateRootDto = t.Object({
8
+ chainId: t.Numeric(),
9
+ root: t.String(),
10
+ timestamp: t.Numeric(),
11
+ epoch: t.Numeric(),
12
+ });
@@ -1,5 +1,5 @@
1
1
  import { type ChainId } from "@sdk";
2
- import type { RootByTimestampModel } from "./merklRoot.model";
2
+ import type { CreateRootModel, RootByTimestampModel } from "./merklRoot.model";
3
3
  export declare class MerklRootRepository {
4
4
  static firstRoot(chainId: ChainId): Promise<{
5
5
  timestamp: bigint;
@@ -18,4 +18,10 @@ export declare class MerklRootRepository {
18
18
  tree: any;
19
19
  lastTree: any;
20
20
  }>;
21
+ static create(x: CreateRootModel): Promise<{
22
+ timestamp: bigint;
23
+ chainId: number;
24
+ root: string;
25
+ epoch: number;
26
+ }>;
21
27
  }
@@ -28,4 +28,9 @@ export class MerklRootRepository {
28
28
  const [tree, lastTree] = await DistributorService(chainId).fetchTreeAndLastTreeMerklRoots();
29
29
  return { live, tree, lastTree };
30
30
  }
31
+ static async create(x) {
32
+ return await apiDbClient.merklRoot.create({
33
+ data: x,
34
+ });
35
+ }
31
36
  }
@@ -1,6 +1,6 @@
1
1
  import type { CacheKeys } from "../../../cache/keys";
2
2
  import type { ChainId } from "@sdk";
3
- import type { RootByTimestampModel } from "./merklRoot.model";
3
+ import type { CreateRootModel, RootByTimestampModel } from "./merklRoot.model";
4
4
  export declare class MerklRootService {
5
5
  static firstRoot(chainId: ChainId): Promise<{
6
6
  timestamp: bigint;
@@ -30,4 +30,10 @@ export declare class MerklRootService {
30
30
  tree: string;
31
31
  lastTree: string;
32
32
  }[]>;
33
+ static create(x: CreateRootModel): Promise<{
34
+ timestamp: bigint;
35
+ chainId: number;
36
+ root: string;
37
+ epoch: number;
38
+ }>;
33
39
  }
@@ -35,4 +35,7 @@ export class MerklRootService {
35
35
  return roots;
36
36
  });
37
37
  }
38
+ static async create(x) {
39
+ return await MerklRootRepository.create(x);
40
+ }
38
41
  }
@@ -137,7 +137,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
137
137
  tvl: number;
138
138
  apr: number;
139
139
  dailyRewards: number;
140
- } | null | undefined;
140
+ } | undefined;
141
141
  };
142
142
  };
143
143
  };
@@ -315,7 +315,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
315
315
  };
316
316
  headers: unknown;
317
317
  response: {
318
- 200: ({
318
+ 200: {
319
319
  aprRecord: {
320
320
  cumulated: number;
321
321
  timestamp: bigint;
@@ -401,7 +401,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
401
401
  tvl: number;
402
402
  apr: number;
403
403
  dailyRewards: number;
404
- } | null)[];
404
+ }[];
405
405
  };
406
406
  };
407
407
  };
@@ -239,13 +239,13 @@ export declare abstract class OpportunityService {
239
239
  tvl: number;
240
240
  apr: number;
241
241
  dailyRewards: number;
242
- } | null>;
242
+ }>;
243
243
  /**
244
244
  * Get the list of opportunities satisfying the query
245
245
  * @param query
246
246
  * @returns A list of opportunities
247
247
  */
248
- static getMany(query: GetOpportunitiesQueryModel): Promise<({
248
+ static getMany(query: GetOpportunitiesQueryModel): Promise<{
249
249
  aprRecord: {
250
250
  cumulated: number;
251
251
  timestamp: bigint;
@@ -331,7 +331,7 @@ export declare abstract class OpportunityService {
331
331
  tvl: number;
332
332
  apr: number;
333
333
  dailyRewards: number;
334
- } | null)[]>;
334
+ }[]>;
335
335
  static findLiveWithFirstCampaign(chainId: MerklChainId): Promise<({
336
336
  aprRecord: {
337
337
  cumulated: number;
@@ -562,7 +562,7 @@ export declare abstract class OpportunityService {
562
562
  tvl: number;
563
563
  apr: number;
564
564
  dailyRewards: number;
565
- } | null;
565
+ };
566
566
  static formatResponseBase(opportunity: LightOpportunityFromDB): {
567
567
  id: string;
568
568
  tokens: ({
@@ -175,8 +175,6 @@ export class OpportunityService {
175
175
  return await OpportunityRepository.countMany(query);
176
176
  }
177
177
  static formatResponse(opportunity) {
178
- if (opportunity === null)
179
- return null;
180
178
  const { DailyRewardsRecords, AprRecords, TvlRecords, ...opp } = opportunity;
181
179
  return {
182
180
  ...OpportunityService.formatResponseBase(opp),
@@ -104,6 +104,27 @@ export declare const RewardController: Elysia<"/rewards", false, {
104
104
  };
105
105
  };
106
106
  };
107
+ } & {
108
+ engine: {
109
+ claims: {
110
+ post: {
111
+ body: {
112
+ token: string;
113
+ chainId: number;
114
+ recipient: string;
115
+ root: string;
116
+ }[];
117
+ params: {};
118
+ query: unknown;
119
+ headers: {
120
+ authorization: string;
121
+ };
122
+ response: {
123
+ 200: void;
124
+ };
125
+ };
126
+ };
127
+ };
107
128
  } & {
108
129
  engine: {
109
130
  pendings: {
@@ -1,8 +1,8 @@
1
1
  import { BackOfficeGuard } from "../../../guards/BackOffice.guard";
2
2
  import { AuthorizationHeadersDto, EngineGuard } from "../../../guards/Engine.guard";
3
- import { throwOnUnsupportedChainId } from "../../../utils/throw";
3
+ import { throwOnInvalidRequiredAddress, throwOnUnsupportedChainId } from "../../../utils/throw";
4
4
  import Elysia from "elysia";
5
- import { CampaignIdDto, CampaignIdWithoutPageDto, CreateManyBreakdownDto, CreateManyRewardDto, UpdatePendingDto, } from "./reward.model";
5
+ import { CampaignIdDto, CampaignIdWithoutPageDto, CreateManyBreakdownDto, CreateManyRewardDto, RegisterClaimsDto, UpdatePendingDto, } from "./reward.model";
6
6
  import { RewardService } from "./reward.service";
7
7
  // ─── Rewards Controller ──────────────────────────────────────────────────────
8
8
  export const RewardController = new Elysia({ prefix: "/rewards", detail: { tags: ["Rewards"] } })
@@ -31,6 +31,19 @@ export const RewardController = new Elysia({ prefix: "/rewards", detail: { tags:
31
31
  headers: AuthorizationHeadersDto,
32
32
  body: CreateManyBreakdownDto,
33
33
  beforeHandle: EngineGuard,
34
+ })
35
+ // ─── Register new claims ──────────────────────────────────────────────
36
+ .post("/engine/claims", async ({ body }) => await RewardService.registerClaims(body), {
37
+ headers: AuthorizationHeadersDto,
38
+ body: RegisterClaimsDto,
39
+ beforeHandle: ({ headers, body }) => {
40
+ EngineGuard({ headers });
41
+ for (const claim of body) {
42
+ throwOnUnsupportedChainId(claim.chainId);
43
+ claim.token = throwOnInvalidRequiredAddress(claim.token);
44
+ claim.recipient = throwOnInvalidRequiredAddress(claim.recipient);
45
+ }
46
+ },
34
47
  })
35
48
  // ─── Create Many Pending Rewards ─────────────────────────────────────
36
49
  .post("/engine/pendings", async ({ body }) => await RewardService.updatePendings(body), {
@@ -65,6 +65,12 @@ export declare const CreateManyRewardDto: import("@sinclair/typebox").TArray<imp
65
65
  rewardToken: import("@sinclair/typebox").TString;
66
66
  proofs: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
67
67
  }>>;
68
+ export declare const RegisterClaimsDto: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
69
+ chainId: import("@sinclair/typebox").TNumber;
70
+ recipient: import("@sinclair/typebox").TString;
71
+ token: import("@sinclair/typebox").TString;
72
+ root: import("@sinclair/typebox").TString;
73
+ }>>;
68
74
  declare const PendingDto: import("@sinclair/typebox").TObject<{
69
75
  recipient: import("@sinclair/typebox").TString;
70
76
  reason: import("@sinclair/typebox").TString;
@@ -163,6 +169,7 @@ export type CreateManyRewardModel = typeof CreateManyRewardDto.static;
163
169
  export type CreateManyBreakdownModel = typeof CreateManyBreakdownDto.static;
164
170
  export type RewardEntity = typeof RewardDto.static;
165
171
  export type RewardPerChainModel = typeof RewardsPerChainDto.static;
172
+ export type RegisterClaimsModel = typeof RegisterClaimsDto.static;
166
173
  export type UpdatePendingModel = typeof UpdatePendingDto.static;
167
174
  export type PendingEntity = typeof PendingDto.static;
168
175
  export type CampaignIdWithoutPageModel = {
@@ -25,6 +25,12 @@ const RewardDto = t.Object({
25
25
  proofs: t.Array(t.String()),
26
26
  });
27
27
  export const CreateManyRewardDto = t.Array(RewardDto);
28
+ export const RegisterClaimsDto = t.Array(t.Object({
29
+ chainId: t.Numeric(),
30
+ recipient: t.String(),
31
+ token: t.String(),
32
+ root: t.String(),
33
+ }));
28
34
  const PendingDto = t.Object({
29
35
  recipient: t.String(),
30
36
  reason: t.String(),
@@ -123,6 +123,7 @@ export declare abstract class RewardRepository {
123
123
  _all: number;
124
124
  };
125
125
  })[]>;
126
+ static updateClaimed(recipient: string, rewardTokenId: string, campaignId: string, reason: string, amount: string): Promise<Prisma.BatchPayload>;
126
127
  static updatePendings(rewardTokenId: string, root: string, campaignId: string, toUpdate: PendingEntity[]): Promise<{
127
128
  reason: string;
128
129
  pending: string;