@merkl/api 0.10.183 → 0.10.185

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -118,6 +118,21 @@ export class RewardRepository {
118
118
  _count: { _all: true },
119
119
  });
120
120
  }
121
+ static async updateClaimed(recipient, rewardTokenId, campaignId, reason, amount) {
122
+ return await apiDbClient.rewardBreakdown.updateMany({
123
+ where: {
124
+ campaignId,
125
+ reason,
126
+ Reward: {
127
+ recipient,
128
+ rewardTokenId,
129
+ },
130
+ },
131
+ data: {
132
+ claimed: amount,
133
+ },
134
+ });
135
+ }
121
136
  static async updatePendings(rewardTokenId, root, campaignId, toUpdate) {
122
137
  return await apiDbClient.$transaction(toUpdate.map(x => {
123
138
  return apiDbClient.rewardBreakdown.update({
@@ -2,7 +2,7 @@ import type { CacheKeys } from "../../../cache/keys";
2
2
  import type { Chain } from "../../../../database/api/.generated";
3
3
  import { Campaign, type CampaignDynamicData, type ChainId } from "@sdk";
4
4
  import { type LightOpportunityFromDB, type Opportunity } from "../opportunity";
5
- import type { CampaignIdModel, CampaignIdWithoutPageModel, CreateManyBreakdownModel, CreateManyRewardModel, DailyRewardsRecord, RewardBreakdown, UpdatePendingModel } from "./reward.model";
5
+ import type { CampaignIdModel, CampaignIdWithoutPageModel, CreateManyBreakdownModel, CreateManyRewardModel, DailyRewardsRecord, RegisterClaimsModel, RewardBreakdown, UpdatePendingModel } from "./reward.model";
6
6
  import { RewardRepository } from "./reward.repository";
7
7
  export declare abstract class RewardService {
8
8
  static hashId(root: string, recipient: string, rewardTokenId: string): string;
@@ -541,6 +541,7 @@ export declare abstract class RewardService {
541
541
  chain: Chain;
542
542
  rewards: Awaited<ReturnType<(typeof RewardService)["format"]>>;
543
543
  }[]>;
544
+ static registerClaims(claims: RegisterClaimsModel): Promise<void>;
544
545
  static updatePendings(data: UpdatePendingModel): Promise<boolean>;
545
546
  static countAllchains(): Promise<Record<string, {
546
547
  breakdown: number;
@@ -205,6 +205,20 @@ export class RewardService {
205
205
  }
206
206
  return res;
207
207
  }
208
+ static async registerClaims(claims) {
209
+ for (const claim of claims) {
210
+ const tokenId = TokenService.hashId({
211
+ chainId: claim.chainId,
212
+ address: claim.token,
213
+ });
214
+ const rewards = await RewardRepository.getByChainRecipientToken(claim.recipient, claim.root, tokenId);
215
+ if (!rewards)
216
+ continue;
217
+ for (const breakdown of rewards.Breakdown) {
218
+ await RewardRepository.updateClaimed(claim.recipient, tokenId, breakdown.campaignId, breakdown.reason, breakdown.amount);
219
+ }
220
+ }
221
+ }
208
222
  static async updatePendings(data) {
209
223
  const rewardTokenId = await TokenService.hashId({ address: data.rewardToken, chainId: data.distributionChainId });
210
224
  const campaignId = await CampaignService.hashId({
@@ -146,7 +146,7 @@ export declare const v4: Elysia<"/v4", false, {
146
146
  tvl: number;
147
147
  apr: number;
148
148
  dailyRewards: number;
149
- } | null | undefined;
149
+ } | undefined;
150
150
  };
151
151
  };
152
152
  };
@@ -324,7 +324,7 @@ export declare const v4: Elysia<"/v4", false, {
324
324
  };
325
325
  headers: unknown;
326
326
  response: {
327
- 200: ({
327
+ 200: {
328
328
  aprRecord: {
329
329
  cumulated: number;
330
330
  timestamp: bigint;
@@ -410,7 +410,7 @@ export declare const v4: Elysia<"/v4", false, {
410
410
  tvl: number;
411
411
  apr: number;
412
412
  dailyRewards: number;
413
- } | null)[];
413
+ }[];
414
414
  };
415
415
  };
416
416
  };
@@ -1050,6 +1050,27 @@ export declare const v4: Elysia<"/v4", false, {
1050
1050
  };
1051
1051
  };
1052
1052
  };
1053
+ } & {
1054
+ engine: {
1055
+ claims: {
1056
+ post: {
1057
+ body: {
1058
+ token: string;
1059
+ chainId: number;
1060
+ recipient: string;
1061
+ root: string;
1062
+ }[];
1063
+ params: {};
1064
+ query: unknown;
1065
+ headers: {
1066
+ authorization: string;
1067
+ };
1068
+ response: {
1069
+ 200: void;
1070
+ };
1071
+ };
1072
+ };
1073
+ };
1053
1074
  } & {
1054
1075
  engine: {
1055
1076
  pendings: {
@@ -1920,6 +1941,32 @@ export declare const v4: Elysia<"/v4", false, {
1920
1941
  };
1921
1942
  };
1922
1943
  };
1944
+ } & {
1945
+ roots: {
1946
+ index: {
1947
+ post: {
1948
+ body: {
1949
+ timestamp: number;
1950
+ chainId: number;
1951
+ root: string;
1952
+ epoch: number;
1953
+ };
1954
+ params: {};
1955
+ query: unknown;
1956
+ headers: {
1957
+ authorization: string;
1958
+ };
1959
+ response: {
1960
+ 200: {
1961
+ timestamp: bigint;
1962
+ chainId: number;
1963
+ root: string;
1964
+ epoch: number;
1965
+ };
1966
+ };
1967
+ };
1968
+ };
1969
+ };
1923
1970
  };
1924
1971
  } & {
1925
1972
  v4: {
@@ -34,8 +34,12 @@ export class TokenRepository {
34
34
  static #transformQueryToPrismaFilters(query) {
35
35
  return {
36
36
  where: {
37
- symbol: query.symbol ? { equals: query.symbol, mode: "insensitive" } : undefined,
38
- displaySymbol: query.symbol ? { equals: query.symbol, mode: "insensitive" } : undefined,
37
+ OR: query.symbol
38
+ ? [
39
+ { symbol: { equals: query.symbol, mode: "insensitive" } },
40
+ { displaySymbol: { equals: query.symbol, mode: "insensitive" } },
41
+ ]
42
+ : undefined,
39
43
  address: query.address ? { equals: query.address, mode: "insensitive" } : undefined,
40
44
  chainId: query.chainId ? { equals: query.chainId } : undefined,
41
45
  name: query.name ? { contains: query.name, mode: "insensitive" } : undefined,
@@ -170,7 +170,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
170
170
  tvl: number;
171
171
  apr: number;
172
172
  dailyRewards: number;
173
- } | null | undefined;
173
+ } | undefined;
174
174
  };
175
175
  };
176
176
  };
@@ -348,7 +348,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
348
348
  };
349
349
  headers: unknown;
350
350
  response: {
351
- 200: ({
351
+ 200: {
352
352
  aprRecord: {
353
353
  cumulated: number;
354
354
  timestamp: bigint;
@@ -434,7 +434,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
434
434
  tvl: number;
435
435
  apr: number;
436
436
  dailyRewards: number;
437
- } | null)[];
437
+ }[];
438
438
  };
439
439
  };
440
440
  };
@@ -1074,6 +1074,27 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
1074
1074
  };
1075
1075
  };
1076
1076
  };
1077
+ } & {
1078
+ engine: {
1079
+ claims: {
1080
+ post: {
1081
+ body: {
1082
+ token: string;
1083
+ chainId: number;
1084
+ recipient: string;
1085
+ root: string;
1086
+ }[];
1087
+ params: {};
1088
+ query: unknown;
1089
+ headers: {
1090
+ authorization: string;
1091
+ };
1092
+ response: {
1093
+ 200: void;
1094
+ };
1095
+ };
1096
+ };
1097
+ };
1077
1098
  } & {
1078
1099
  engine: {
1079
1100
  pendings: {
@@ -1944,6 +1965,32 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
1944
1965
  };
1945
1966
  };
1946
1967
  };
1968
+ } & {
1969
+ roots: {
1970
+ index: {
1971
+ post: {
1972
+ body: {
1973
+ timestamp: number;
1974
+ chainId: number;
1975
+ root: string;
1976
+ epoch: number;
1977
+ };
1978
+ params: {};
1979
+ query: unknown;
1980
+ headers: {
1981
+ authorization: string;
1982
+ };
1983
+ response: {
1984
+ 200: {
1985
+ timestamp: bigint;
1986
+ chainId: number;
1987
+ root: string;
1988
+ epoch: number;
1989
+ };
1990
+ };
1991
+ };
1992
+ };
1993
+ };
1947
1994
  };
1948
1995
  } & {
1949
1996
  v4: {
@@ -173,7 +173,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
173
173
  tvl: number;
174
174
  apr: number;
175
175
  dailyRewards: number;
176
- } | null | undefined;
176
+ } | undefined;
177
177
  };
178
178
  };
179
179
  };
@@ -351,7 +351,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
351
351
  };
352
352
  headers: unknown;
353
353
  response: {
354
- 200: ({
354
+ 200: {
355
355
  aprRecord: {
356
356
  cumulated: number;
357
357
  timestamp: bigint;
@@ -437,7 +437,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
437
437
  tvl: number;
438
438
  apr: number;
439
439
  dailyRewards: number;
440
- } | null)[];
440
+ }[];
441
441
  };
442
442
  };
443
443
  };
@@ -1077,6 +1077,27 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
1077
1077
  };
1078
1078
  };
1079
1079
  };
1080
+ } & {
1081
+ engine: {
1082
+ claims: {
1083
+ post: {
1084
+ body: {
1085
+ token: string;
1086
+ chainId: number;
1087
+ recipient: string;
1088
+ root: string;
1089
+ }[];
1090
+ params: {};
1091
+ query: unknown;
1092
+ headers: {
1093
+ authorization: string;
1094
+ };
1095
+ response: {
1096
+ 200: void;
1097
+ };
1098
+ };
1099
+ };
1100
+ };
1080
1101
  } & {
1081
1102
  engine: {
1082
1103
  pendings: {
@@ -1947,6 +1968,32 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
1947
1968
  };
1948
1969
  };
1949
1970
  };
1971
+ } & {
1972
+ roots: {
1973
+ index: {
1974
+ post: {
1975
+ body: {
1976
+ timestamp: number;
1977
+ chainId: number;
1978
+ root: string;
1979
+ epoch: number;
1980
+ };
1981
+ params: {};
1982
+ query: unknown;
1983
+ headers: {
1984
+ authorization: string;
1985
+ };
1986
+ response: {
1987
+ 200: {
1988
+ timestamp: bigint;
1989
+ chainId: number;
1990
+ root: string;
1991
+ epoch: number;
1992
+ };
1993
+ };
1994
+ };
1995
+ };
1996
+ };
1950
1997
  };
1951
1998
  } & {
1952
1999
  v4: {
@@ -164,7 +164,7 @@ declare const _default: (app: App) => import("elysia").default<"", 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 _default: (app: App) => import("elysia").default<"", 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 _default: (app: App) => import("elysia").default<"", 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 _default: (app: App) => import("elysia").default<"", 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 _default: (app: App) => import("elysia").default<"", 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: {
@@ -169,7 +169,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
169
169
  tvl: number;
170
170
  apr: number;
171
171
  dailyRewards: number;
172
- } | null | undefined;
172
+ } | undefined;
173
173
  };
174
174
  };
175
175
  };
@@ -347,7 +347,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
347
347
  };
348
348
  headers: unknown;
349
349
  response: {
350
- 200: ({
350
+ 200: {
351
351
  aprRecord: {
352
352
  cumulated: number;
353
353
  timestamp: bigint;
@@ -433,7 +433,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
433
433
  tvl: number;
434
434
  apr: number;
435
435
  dailyRewards: number;
436
- } | null)[];
436
+ }[];
437
437
  };
438
438
  };
439
439
  };
@@ -1073,6 +1073,27 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
1073
1073
  };
1074
1074
  };
1075
1075
  };
1076
+ } & {
1077
+ engine: {
1078
+ claims: {
1079
+ post: {
1080
+ body: {
1081
+ token: string;
1082
+ chainId: number;
1083
+ recipient: string;
1084
+ root: string;
1085
+ }[];
1086
+ params: {};
1087
+ query: unknown;
1088
+ headers: {
1089
+ authorization: string;
1090
+ };
1091
+ response: {
1092
+ 200: void;
1093
+ };
1094
+ };
1095
+ };
1096
+ };
1076
1097
  } & {
1077
1098
  engine: {
1078
1099
  pendings: {
@@ -1943,6 +1964,32 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
1943
1964
  };
1944
1965
  };
1945
1966
  };
1967
+ } & {
1968
+ roots: {
1969
+ index: {
1970
+ post: {
1971
+ body: {
1972
+ timestamp: number;
1973
+ chainId: number;
1974
+ root: string;
1975
+ epoch: number;
1976
+ };
1977
+ params: {};
1978
+ query: unknown;
1979
+ headers: {
1980
+ authorization: string;
1981
+ };
1982
+ response: {
1983
+ 200: {
1984
+ timestamp: bigint;
1985
+ chainId: number;
1986
+ root: string;
1987
+ epoch: number;
1988
+ };
1989
+ };
1990
+ };
1991
+ };
1992
+ };
1946
1993
  };
1947
1994
  } & {
1948
1995
  v4: {
@@ -187,7 +187,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
187
187
  tvl: number;
188
188
  apr: number;
189
189
  dailyRewards: number;
190
- } | null | undefined;
190
+ } | undefined;
191
191
  };
192
192
  };
193
193
  };
@@ -365,7 +365,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
365
365
  };
366
366
  headers: unknown;
367
367
  response: {
368
- 200: ({
368
+ 200: {
369
369
  aprRecord: {
370
370
  cumulated: number;
371
371
  timestamp: bigint;
@@ -451,7 +451,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
451
451
  tvl: number;
452
452
  apr: number;
453
453
  dailyRewards: number;
454
- } | null)[];
454
+ }[];
455
455
  };
456
456
  };
457
457
  };
@@ -1091,6 +1091,27 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
1091
1091
  };
1092
1092
  };
1093
1093
  };
1094
+ } & {
1095
+ engine: {
1096
+ claims: {
1097
+ post: {
1098
+ body: {
1099
+ token: string;
1100
+ chainId: number;
1101
+ recipient: string;
1102
+ root: string;
1103
+ }[];
1104
+ params: {};
1105
+ query: unknown;
1106
+ headers: {
1107
+ authorization: string;
1108
+ };
1109
+ response: {
1110
+ 200: void;
1111
+ };
1112
+ };
1113
+ };
1114
+ };
1094
1115
  } & {
1095
1116
  engine: {
1096
1117
  pendings: {
@@ -1961,6 +1982,32 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
1961
1982
  };
1962
1983
  };
1963
1984
  };
1985
+ } & {
1986
+ roots: {
1987
+ index: {
1988
+ post: {
1989
+ body: {
1990
+ timestamp: number;
1991
+ chainId: number;
1992
+ root: string;
1993
+ epoch: number;
1994
+ };
1995
+ params: {};
1996
+ query: unknown;
1997
+ headers: {
1998
+ authorization: string;
1999
+ };
2000
+ response: {
2001
+ 200: {
2002
+ timestamp: bigint;
2003
+ chainId: number;
2004
+ root: string;
2005
+ epoch: number;
2006
+ };
2007
+ };
2008
+ };
2009
+ };
2010
+ };
1964
2011
  };
1965
2012
  } & {
1966
2013
  v4: {
@@ -188,7 +188,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
188
188
  tvl: number;
189
189
  apr: number;
190
190
  dailyRewards: number;
191
- } | null | undefined;
191
+ } | undefined;
192
192
  };
193
193
  };
194
194
  };
@@ -366,7 +366,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
366
366
  };
367
367
  headers: unknown;
368
368
  response: {
369
- 200: ({
369
+ 200: {
370
370
  aprRecord: {
371
371
  cumulated: number;
372
372
  timestamp: bigint;
@@ -452,7 +452,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
452
452
  tvl: number;
453
453
  apr: number;
454
454
  dailyRewards: number;
455
- } | null)[];
455
+ }[];
456
456
  };
457
457
  };
458
458
  };
@@ -1092,6 +1092,27 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
1092
1092
  };
1093
1093
  };
1094
1094
  };
1095
+ } & {
1096
+ engine: {
1097
+ claims: {
1098
+ post: {
1099
+ body: {
1100
+ token: string;
1101
+ chainId: number;
1102
+ recipient: string;
1103
+ root: string;
1104
+ }[];
1105
+ params: {};
1106
+ query: unknown;
1107
+ headers: {
1108
+ authorization: string;
1109
+ };
1110
+ response: {
1111
+ 200: void;
1112
+ };
1113
+ };
1114
+ };
1115
+ };
1095
1116
  } & {
1096
1117
  engine: {
1097
1118
  pendings: {
@@ -1962,6 +1983,32 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
1962
1983
  };
1963
1984
  };
1964
1985
  };
1986
+ } & {
1987
+ roots: {
1988
+ index: {
1989
+ post: {
1990
+ body: {
1991
+ timestamp: number;
1992
+ chainId: number;
1993
+ root: string;
1994
+ epoch: number;
1995
+ };
1996
+ params: {};
1997
+ query: unknown;
1998
+ headers: {
1999
+ authorization: string;
2000
+ };
2001
+ response: {
2002
+ 200: {
2003
+ timestamp: bigint;
2004
+ chainId: number;
2005
+ root: string;
2006
+ epoch: number;
2007
+ };
2008
+ };
2009
+ };
2010
+ };
2011
+ };
1965
2012
  };
1966
2013
  } & {
1967
2014
  v4: {