@merkl/api 0.16.34 → 0.16.35

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 (75) hide show
  1. package/dist/src/backgroundJobs/index.js +0 -4
  2. package/dist/src/backgroundJobs/jobs/opportunityUpdater.js +3 -0
  3. package/dist/src/eden/index.d.ts +657 -444
  4. package/dist/src/entities/opportunity.d.ts +3 -1
  5. package/dist/src/index.d.ts +136 -117
  6. package/dist/src/jobs/etl/prices.js +9 -2
  7. package/dist/src/libs/deprecated-merklv3/index.js +1 -1
  8. package/dist/src/modules/v4/boost/boost.controller.js +1 -1
  9. package/dist/src/modules/v4/cache/cache.repository.d.ts +1 -0
  10. package/dist/src/modules/v4/cache/cache.repository.js +19 -0
  11. package/dist/src/modules/v4/campaign/campaign.service.d.ts +0 -5
  12. package/dist/src/modules/v4/campaign/campaign.service.js +0 -5
  13. package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +120 -57
  14. package/dist/src/modules/v4/opportunity/opportunity.controller.js +1 -1
  15. package/dist/src/modules/v4/opportunity/opportunity.converter.d.ts +9 -0
  16. package/dist/src/modules/v4/opportunity/opportunity.converter.js +153 -0
  17. package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +3 -1
  18. package/dist/src/modules/v4/opportunity/opportunity.model.js +2 -0
  19. package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +18 -210
  20. package/dist/src/modules/v4/opportunity/opportunity.repository.js +76 -113
  21. package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +219 -64
  22. package/dist/src/modules/v4/opportunity/opportunity.service.js +19 -21
  23. package/dist/src/modules/v4/reward/{subservices/converter.d.ts → reward.converter.d.ts} +3 -3
  24. package/dist/src/modules/v4/reward/{subservices/converter.js → reward.converter.js} +1 -1
  25. package/dist/src/modules/v4/router.d.ts +120 -57
  26. package/dist/src/routes/v3/app.js +1 -0
  27. package/dist/src/routes/v3/blacklist.js +1 -0
  28. package/dist/src/routes/v3/campaign/delay.js +1 -0
  29. package/dist/src/routes/v3/campaignClaims.d.ts +3 -1
  30. package/dist/src/routes/v3/campaignClaims.js +4 -13
  31. package/dist/src/routes/v3/campaignUnclaimed.js +1 -0
  32. package/dist/src/routes/v3/campaignsForMainParameter.d.ts +9 -1
  33. package/dist/src/routes/v3/campaignsForMainParameter.js +17 -7
  34. package/dist/src/routes/v3/campaignsRewardsReport.js +1 -0
  35. package/dist/src/routes/v3/claims.d.ts +3 -1
  36. package/dist/src/routes/v3/claims.js +4 -33
  37. package/dist/src/routes/v3/opportunity.d.ts +7 -7
  38. package/dist/src/routes/v3/opportunity.js +12 -13
  39. package/dist/src/routes/v3/recipients.js +1 -0
  40. package/dist/src/routes/v3/rewards.js +2 -1
  41. package/dist/src/routes/v3/rewardsReport.js +1 -0
  42. package/dist/src/routes/v3/router.d.ts +16 -60
  43. package/dist/src/routes/v3/router.js +0 -6
  44. package/dist/src/routes/v3/userRewards.js +2 -1
  45. package/dist/src/types/returnTypes.d.ts +0 -8
  46. package/dist/src/utils/camelToKebabCase.d.ts +2 -0
  47. package/dist/src/utils/camelToKebabCase.js +9 -0
  48. package/dist/tsconfig.package.tsbuildinfo +1 -1
  49. package/package.json +1 -1
  50. package/dist/src/backgroundJobs/jobs/priceUpdater.d.ts +0 -37
  51. package/dist/src/backgroundJobs/jobs/priceUpdater.js +0 -21
  52. package/dist/src/backgroundJobs/jobs/sync.d.ts +0 -40
  53. package/dist/src/backgroundJobs/jobs/sync.js +0 -33
  54. package/dist/src/routes/v3/campaignReport.d.ts +0 -43
  55. package/dist/src/routes/v3/campaignReport.js +0 -22
  56. package/dist/src/routes/v3/campaignsInfo.d.ts +0 -41
  57. package/dist/src/routes/v3/campaignsInfo.js +0 -54
  58. package/dist/src/routes/v3/exports/campaigns.d.ts +0 -43
  59. package/dist/src/routes/v3/exports/campaigns.js +0 -28
  60. package/dist/src/routes/v3/tokenUnclaimed.d.ts +0 -44
  61. package/dist/src/routes/v3/tokenUnclaimed.js +0 -24
  62. package/dist/src/utils/queries/campaignsForMainParameter.d.ts +0 -2
  63. package/dist/src/utils/queries/campaignsForMainParameter.js +0 -23
  64. package/dist/src/utils/queries/claimsOverTime.d.ts +0 -8
  65. package/dist/src/utils/queries/claimsOverTime.js +0 -111
  66. package/dist/src/utils/queries/endingCampaigns.d.ts +0 -10
  67. package/dist/src/utils/queries/endingCampaigns.js +0 -21
  68. package/dist/src/utils/queries/futureCampaigns.d.ts +0 -3
  69. package/dist/src/utils/queries/futureCampaigns.js +0 -19
  70. package/dist/src/utils/queries/mainParameterCampaigns.d.ts +0 -5
  71. package/dist/src/utils/queries/mainParameterCampaigns.js +0 -11
  72. package/dist/src/utils/queries/rewardsAmount.d.ts +0 -10
  73. package/dist/src/utils/queries/rewardsAmount.js +0 -106
  74. package/dist/src/utils/queries/unclaimed.d.ts +0 -11
  75. package/dist/src/utils/queries/unclaimed.js +0 -81
@@ -128,11 +128,13 @@ export declare const v4: Elysia<"/v4", false, {
128
128
  status?: string | undefined;
129
129
  items?: number | undefined;
130
130
  tags?: string | undefined;
131
+ identifier?: string | undefined;
131
132
  page?: number | undefined;
132
133
  chainId?: string | undefined;
133
134
  action?: string | undefined;
134
135
  creatorAddress?: string | undefined;
135
136
  mainProtocolId?: string | undefined;
137
+ campaigns?: boolean | undefined;
136
138
  order?: string | undefined;
137
139
  test?: boolean | undefined;
138
140
  minimumTvl?: number | undefined;
@@ -189,6 +191,57 @@ export declare const v4: Elysia<"/v4", false, {
189
191
  amount: bigint;
190
192
  }[];
191
193
  };
194
+ campaigns: {
195
+ params: any;
196
+ chain: {
197
+ name: string;
198
+ id: number;
199
+ icon: string;
200
+ };
201
+ rewardToken: {
202
+ symbol: string;
203
+ name: string | null;
204
+ id: string;
205
+ icon: string;
206
+ chainId: number;
207
+ address: string;
208
+ decimals: number;
209
+ verified: boolean;
210
+ isTest: boolean;
211
+ } & {
212
+ price?: number | null | undefined;
213
+ };
214
+ distributionChain: {
215
+ name: string;
216
+ id: number;
217
+ icon: string;
218
+ } | undefined;
219
+ campaignStatus: {
220
+ error: string;
221
+ details: import("database/api/.generated/runtime/library").JsonValue;
222
+ status: import("../../../database/api/.generated").$Enums.RunStatus;
223
+ campaignId: string;
224
+ computedUntil: bigint;
225
+ processingStarted: bigint;
226
+ };
227
+ creatorAddress: string;
228
+ Creator: {
229
+ tags: string[];
230
+ address: string;
231
+ creatorId: string | null;
232
+ };
233
+ type: string;
234
+ id: string;
235
+ subType: number | null;
236
+ startTimestamp: bigint;
237
+ endTimestamp: bigint;
238
+ computeChainId: number;
239
+ distributionChainId: number;
240
+ campaignId: string;
241
+ rewardTokenId: string;
242
+ amount: string;
243
+ opportunityId: string;
244
+ }[];
192
245
  id: string;
193
246
  depositUrl: string | undefined;
194
247
  tokens: ({
@@ -245,11 +298,13 @@ export declare const v4: Elysia<"/v4", false, {
245
298
  status?: string | undefined;
246
299
  items?: number | undefined;
247
300
  tags?: string | undefined;
301
+ identifier?: string | undefined;
248
302
  page?: number | undefined;
249
303
  chainId?: string | undefined;
250
304
  action?: string | undefined;
251
305
  creatorAddress?: string | undefined;
252
306
  mainProtocolId?: string | undefined;
307
+ campaigns?: boolean | undefined;
253
308
  order?: string | undefined;
254
309
  test?: boolean | undefined;
255
310
  minimumTvl?: number | undefined;
@@ -398,45 +453,41 @@ export declare const v4: Elysia<"/v4", false, {
398
453
  };
399
454
  headers: unknown;
400
455
  response: {
401
- 200: ({
402
- protocol?: {
403
- name: string;
404
- url: string;
405
- description: string;
406
- id: string;
407
- tags: string[];
408
- icon: string;
409
- } | null | undefined;
410
- depositUrl?: string | undefined;
411
- aprRecord?: {
412
- timestamp: string | bigint;
456
+ 200: {
457
+ apr: number;
458
+ aprRecord: {
413
459
  cumulated: number;
460
+ timestamp: bigint;
414
461
  breakdowns: {
415
- type: "CAMPAIGN" | "TOKEN" | "PROTOCOL";
462
+ type: import("../../../database/api/.generated").$Enums.AprType;
416
463
  id: number;
417
464
  identifier: string;
418
465
  value: number;
419
466
  aprRecordId: string;
420
467
  }[];
421
- } | undefined;
422
- tvlRecord?: {
468
+ };
469
+ tvlRecord: {
470
+ id: string;
423
471
  total: number;
424
- timestamp: string | bigint;
472
+ timestamp: bigint;
425
473
  breakdowns: {
426
- type: "TOKEN" | "PROTOCOL";
474
+ type: import("../../../database/api/.generated").$Enums.TvlType;
427
475
  id: number;
428
476
  identifier: string;
429
477
  value: number;
430
478
  tvlRecordId: string;
431
479
  }[];
432
- } | undefined;
433
- rewardsRecord?: {
434
- total: number;
480
+ };
481
+ rewardsRecord: {
435
482
  id: string;
436
- timestamp: string | bigint;
483
+ total: number;
484
+ timestamp: bigint;
437
485
  breakdowns: {
486
+ id: number;
487
+ value: number;
488
+ campaignId: string;
489
+ dailyRewardsRecordId: string;
438
490
  token: {
439
- price?: number | null | undefined;
440
491
  symbol: string;
441
492
  name: string | null;
442
493
  id: string;
@@ -444,45 +495,14 @@ export declare const v4: Elysia<"/v4", false, {
444
495
  chainId: number;
445
496
  address: string;
446
497
  decimals: number;
498
+ displaySymbol: string;
447
499
  verified: boolean;
448
500
  isTest: boolean;
501
+ price: number | null;
449
502
  };
450
- id: number;
451
- value: number;
452
- campaignId: string;
453
- amount: string | bigint;
454
- dailyRewardsRecordId: string;
503
+ amount: bigint;
455
504
  }[];
456
- } | undefined;
457
- name: string;
458
- type: string;
459
- tokens: {
460
- price?: number | null | undefined;
461
- symbol: string;
462
- name: string | null;
463
- id: string;
464
- icon: string;
465
- chainId: number;
466
- address: string;
467
- decimals: number;
468
- verified: boolean;
469
- isTest: boolean;
470
- }[];
471
- id: string;
472
- status: string;
473
- tags: string[];
474
- identifier: string;
475
- chain: {
476
- name: string;
477
- id: number;
478
- icon: string;
479
505
  };
480
- chainId: number;
481
- action: string;
482
- tvl: number;
483
- apr: number;
484
- dailyRewards: number;
485
- } & {
486
506
  campaigns: {
487
507
  params: any;
488
508
  chain: {
@@ -534,7 +554,44 @@ export declare const v4: Elysia<"/v4", false, {
534
554
  amount: string;
535
555
  opportunityId: string;
536
556
  }[];
537
- })[];
557
+ id: string;
558
+ depositUrl: string | undefined;
559
+ tokens: ({
560
+ symbol: string;
561
+ name: string | null;
562
+ id: string;
563
+ icon: string;
564
+ chainId: number;
565
+ address: string;
566
+ decimals: number;
567
+ verified: boolean;
568
+ isTest: boolean;
569
+ } & {
570
+ price?: number | null | undefined;
571
+ })[];
572
+ chain: {
573
+ name: string;
574
+ id: number;
575
+ icon: string;
576
+ };
577
+ protocol: {
578
+ name: string;
579
+ url: string;
580
+ description: string;
581
+ id: string;
582
+ tags: string[];
583
+ icon: string;
584
+ } | undefined;
585
+ name: string;
586
+ type: string;
587
+ status: import("../../../database/api/.generated").$Enums.Status;
588
+ tags: string[];
589
+ identifier: string;
590
+ chainId: number;
591
+ action: import("../../../database/api/.generated").$Enums.OpportunityAction;
592
+ tvl: number;
593
+ dailyRewards: number;
594
+ }[];
538
595
  readonly 404: {
539
596
  message: string;
540
597
  name: string;
@@ -723,11 +780,13 @@ export declare const v4: Elysia<"/v4", false, {
723
780
  status?: string | undefined;
724
781
  items?: number | undefined;
725
782
  tags?: string | undefined;
783
+ identifier?: string | undefined;
726
784
  page?: number | undefined;
727
785
  chainId?: string | undefined;
728
786
  action?: string | undefined;
729
787
  creatorAddress?: string | undefined;
730
788
  mainProtocolId?: string | undefined;
789
+ campaigns?: boolean | undefined;
731
790
  order?: string | undefined;
732
791
  test?: boolean | undefined;
733
792
  minimumTvl?: number | undefined;
@@ -760,11 +819,13 @@ export declare const v4: Elysia<"/v4", false, {
760
819
  status?: string | undefined;
761
820
  items?: number | undefined;
762
821
  tags?: string | undefined;
822
+ identifier?: string | undefined;
763
823
  page?: number | undefined;
764
824
  chainId?: string | undefined;
765
825
  action?: string | undefined;
766
826
  creatorAddress?: string | undefined;
767
827
  mainProtocolId?: string | undefined;
828
+ campaigns?: boolean | undefined;
768
829
  order?: string | undefined;
769
830
  test?: boolean | undefined;
770
831
  minimumTvl?: number | undefined;
@@ -798,11 +859,13 @@ export declare const v4: Elysia<"/v4", false, {
798
859
  status?: string | undefined;
799
860
  items?: number | undefined;
800
861
  tags?: string | undefined;
862
+ identifier?: string | undefined;
801
863
  page?: number | undefined;
802
864
  chainId?: string | undefined;
803
865
  action?: string | undefined;
804
866
  creatorAddress?: string | undefined;
805
867
  mainProtocolId?: string | undefined;
868
+ campaigns?: boolean | undefined;
806
869
  order?: string | undefined;
807
870
  test?: boolean | undefined;
808
871
  minimumTvl?: number | undefined;
@@ -1,6 +1,7 @@
1
1
  import { getTokensListWithCache } from "../../libs/getTokensList";
2
2
  import { Pricer } from "../../utils/pricer";
3
3
  import { t } from "elysia";
4
+ // @dev DEPRECATED - can be removed once old apps are not in used anymore
4
5
  export const response = t.Array(t.Object({ rate: t.Number(), token: t.String() }));
5
6
  export default (app) => app.get("/app", async () => {
6
7
  const json = {};
@@ -1,6 +1,7 @@
1
1
  import { BlacklistService } from "../../modules/v4/blacklist";
2
2
  import { t } from "elysia";
3
3
  import checkQueryAddressValidity from "../../hooks/checkQueryAddressValidity";
4
+ // @dev DEPRECATED - conversion to v4 done
4
5
  export const query = t.Object({
5
6
  user: t.String(),
6
7
  });
@@ -4,6 +4,7 @@ import { engineDbClient } from "../../../utils/prisma";
4
4
  import { ChainId, isSupportedChain } from "@sdk";
5
5
  import { t } from "elysia";
6
6
  import moment from "moment";
7
+ // @dev DEPRECATED - to remove in favor of new status page
7
8
  export const query = t.Object({
8
9
  onlyLive: t.Optional(t.Boolean()),
9
10
  });
@@ -28,7 +28,9 @@ declare const _default: (app: Elysia) => Elysia<"", false, {
28
28
  };
29
29
  headers: unknown;
30
30
  response: {
31
- 200: unknown;
31
+ 200: {
32
+ message: string;
33
+ };
32
34
  };
33
35
  };
34
36
  };
@@ -1,23 +1,14 @@
1
1
  import checkQueryChainIdValidity from "../../hooks/checkQueryChainIdValidity";
2
- import { engineDbClient } from "../../utils/prisma";
3
- import { CLAIMS_OVER_TIME, CLAIMS_OVER_TIME_GROUPED } from "../../utils/queries/claimsOverTime";
4
2
  import { t } from "elysia";
5
3
  export const query = t.Object({
6
4
  campaignId: t.String(),
7
5
  chainId: t.Numeric(),
8
6
  byReason: t.Optional(t.BooleanString()),
9
7
  });
10
- export default (app) => app.use(checkQueryChainIdValidity()).get("/campaignClaims", async ({ query }) => {
11
- const campaignId = query.campaignId;
12
- const chainId = query.chainId;
13
- let byReason = true;
14
- if (query.byReason !== undefined) {
15
- byReason = query.byReason;
16
- }
17
- if (!byReason) {
18
- return await engineDbClient.$queryRaw(CLAIMS_OVER_TIME_GROUPED(chainId, campaignId));
19
- }
20
- return await engineDbClient.$queryRaw(CLAIMS_OVER_TIME(chainId, campaignId));
8
+ export default (app) => app.use(checkQueryChainIdValidity()).get("/campaignClaims", async () => {
9
+ return {
10
+ message: "This route is now deprecated removed for performance improvement, please reach out to the team for more information.",
11
+ };
21
12
  }, {
22
13
  query,
23
14
  tags: ["Campaigns"],
@@ -1,6 +1,7 @@
1
1
  import { RewardService } from "../../modules/v4/reward";
2
2
  import { t } from "elysia";
3
3
  import checkQueryChainIdValidity from "../../hooks/checkQueryChainIdValidity";
4
+ // @dev DEPRECATED - conversion to v4 done
4
5
  export const query = t.Object({
5
6
  campaignIds: t.String(),
6
7
  chainId: t.Numeric(),
@@ -1,5 +1,13 @@
1
1
  import { type Elysia } from "elysia";
2
- import type { CampaignsForMainParameterReturnType } from "../../types/returnTypes";
2
+ type CampaignsForMainParameterReturnType = {
3
+ campaignId: string;
4
+ campaignType: number;
5
+ rewardToken: string;
6
+ rewardTokenSymbol: string;
7
+ amountDecimal: number;
8
+ startTimestamp: number;
9
+ endTimestamp: number;
10
+ }[];
3
11
  export declare const query: import("@sinclair/typebox").TObject<{
4
12
  chainId: import("@sinclair/typebox").TNumber;
5
13
  mainParameter: import("@sinclair/typebox").TString;
@@ -1,18 +1,28 @@
1
- import { engineDbClient } from "../../utils/prisma";
1
+ import { OpportunityService } from "../../modules/v4/opportunity";
2
+ import { BN2Number, Campaign as CampaignEnum } from "@sdk";
2
3
  import { t } from "elysia";
3
4
  import checkQueryChainIdValidity from "../../hooks/checkQueryChainIdValidity";
4
- import { OpportunityNotFound } from "../../utils/error";
5
- import { CAMPAIGNS_BY_MAIN_PARAMETER } from "../../utils/queries/campaignsForMainParameter";
6
5
  export const query = t.Object({
7
6
  chainId: t.Numeric(),
8
7
  mainParameter: t.String(),
9
8
  });
10
9
  export default (app) => app.use(checkQueryChainIdValidity()).get("/campaignsForMainParameter", async ({ query }) => {
11
10
  const chainId = query.chainId;
12
- const campaigns = await engineDbClient.$queryRaw(CAMPAIGNS_BY_MAIN_PARAMETER(chainId, query.mainParameter));
13
- if (!campaigns)
14
- throw new OpportunityNotFound(query.mainParameter, chainId);
15
- return campaigns;
11
+ const opportunityId = (await OpportunityService.findMany({
12
+ chainId: chainId.toString(),
13
+ identifier: query.mainParameter,
14
+ }))?.[0]?.id;
15
+ return (await OpportunityService.getUniqueWithCampaignsOrThrow(opportunityId))?.campaigns
16
+ ?.map(c => ({
17
+ campaignId: c.campaignId,
18
+ campaignType: CampaignEnum[c.type],
19
+ rewardToken: c.rewardToken.address,
20
+ rewardTokenSymbol: c.rewardToken.symbol,
21
+ amountDecimal: BN2Number(c.amount, c.rewardToken.decimals),
22
+ startTimestamp: Number(c.startTimestamp),
23
+ endTimestamp: Number(c.endTimestamp),
24
+ }))
25
+ .sort((a, b) => b.endTimestamp - a.endTimestamp);
16
26
  }, {
17
27
  query,
18
28
  tags: ["Campaigns"],
@@ -2,6 +2,7 @@ import { RewardService } from "../../modules/v4/reward";
2
2
  import { t } from "elysia";
3
3
  import { ChainCampaignId } from "../../types/parameters/ChainCampaignId";
4
4
  import { Timestamp } from "../../types/parameters/Timestamp";
5
+ // @dev DEPRECATED - conversion to v4 done
5
6
  export const query = t.Object({
6
7
  chain_campaignIds: t.Array(ChainCampaignId.type, {
7
8
  style: "pipeDelimited",
@@ -30,7 +30,9 @@ declare const _default: (app: Elysia) => Elysia<"", false, {
30
30
  };
31
31
  headers: unknown;
32
32
  response: {
33
- 200: unknown;
33
+ 200: {
34
+ message: string;
35
+ };
34
36
  };
35
37
  };
36
38
  };
@@ -1,44 +1,15 @@
1
- import { engineDbClient } from "../../utils/prisma";
2
- import { ChainId, isSupportedChain } from "@sdk";
3
1
  import { t } from "elysia";
4
2
  import checkQueryAddressValidity from "../../hooks/checkQueryAddressValidity";
5
- import { CLAIMS_FOR_CREATOR_TAG, CLAIMS_FOR_CREATOR_TAG_GROUPED, CLAIMS_FOR_USER, CLAIMS_FOR_USER_GROUPED, } from "../../utils/queries/claimsOverTime";
6
3
  export const query = t.Object({
7
4
  creatorTag: t.Optional(t.String()),
8
5
  chainIds: t.Optional(t.Union([t.String(), t.Array(t.String())])),
9
6
  byReason: t.Optional(t.BooleanString()),
10
7
  user: t.String(),
11
8
  });
12
- export default (app) => app.use(checkQueryAddressValidity()).get("/claims", async ({ query, path, set }) => {
13
- const creatorTag = query.creatorTag;
14
- const rawChainIds = query.chainIds;
15
- const user = query.user;
16
- let chainIds;
17
- if (!rawChainIds) {
18
- chainIds = Object.keys(ChainId)
19
- .map(k => Number.parseInt(k))
20
- .filter(k => isSupportedChain(k, "merkl"));
21
- }
22
- else if (typeof rawChainIds === "string") {
23
- chainIds = [Number.parseInt(rawChainIds)];
24
- }
25
- else {
26
- chainIds = rawChainIds.map(chainId => Number.parseInt(chainId));
27
- }
28
- let byReason = true;
29
- if (query.byReason !== undefined) {
30
- byReason = query.byReason;
31
- }
32
- if (!byReason) {
33
- if (!!creatorTag) {
34
- return await engineDbClient.$queryRaw(CLAIMS_FOR_CREATOR_TAG_GROUPED(chainIds, user, creatorTag));
35
- }
36
- return await engineDbClient.$queryRaw(CLAIMS_FOR_USER_GROUPED(chainIds, user));
37
- }
38
- if (!!creatorTag) {
39
- return await engineDbClient.$queryRaw(CLAIMS_FOR_CREATOR_TAG(chainIds, user, creatorTag));
40
- }
41
- return await engineDbClient.$queryRaw(CLAIMS_FOR_USER(chainIds, user));
9
+ export default (app) => app.use(checkQueryAddressValidity()).get("/claims", async () => {
10
+ return {
11
+ message: "This route is now deprecated removed for performance improvement, please reach out to the team for more information.",
12
+ };
42
13
  }, {
43
14
  query,
44
15
  tags: ["Rewards"],
@@ -3,21 +3,21 @@ export declare const query: import("@sinclair/typebox").TObject<{
3
3
  campaigns: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
4
4
  testTokens: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
5
5
  mainParameter: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
6
- chainId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<import("elysia").TSchema[]>>;
7
- type: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<any>[]>>;
6
+ chainId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
7
+ type: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
8
8
  action: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<import("elysia").TSchema[]>>;
9
9
  tag: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
10
10
  }>;
11
11
  export declare const response: import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TTemplateLiteral<[import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<any>[]>, import("@sinclair/typebox").TLiteral<"_">, import("@sinclair/typebox").TString]>, import("@sinclair/typebox").TObject<{
12
12
  id: import("@sinclair/typebox").TTemplateLiteral<[import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<any>[]>, import("@sinclair/typebox").TLiteral<"_">, import("@sinclair/typebox").TString]>;
13
13
  name: import("@sinclair/typebox").TString;
14
- chainId: import("@sinclair/typebox").TUnion<import("elysia").TSchema[]>;
14
+ chainId: import("@sinclair/typebox").TNumber;
15
15
  action: import("@sinclair/typebox").TString;
16
16
  status: import("@sinclair/typebox").TString;
17
17
  tags: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
18
18
  tokenIcons: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>>>;
19
- rewardTokenIcons: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
20
- dailyRewardTokens: import("@sinclair/typebox").TUnknown;
19
+ rewardTokenIcons: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
20
+ dailyRewardTokens: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnknown>;
21
21
  campaigns: import("@sinclair/typebox").TObject<{
22
22
  type: import("@sinclair/typebox").TNumber;
23
23
  }>;
@@ -40,9 +40,9 @@ declare const _default: (app: Elysia) => Elysia<"", false, {
40
40
  body: unknown;
41
41
  params: {};
42
42
  query: {
43
- type?: undefined;
43
+ type?: number | undefined;
44
44
  tag?: string | undefined;
45
- chainId?: undefined;
45
+ chainId?: number | undefined;
46
46
  action?: undefined;
47
47
  campaigns?: boolean | undefined;
48
48
  mainParameter?: string | undefined;
@@ -1,5 +1,5 @@
1
1
  import { Redis } from "../../cache";
2
- import { OpportunityService } from "../../modules/v4/opportunity";
2
+ import { OpportunityConvertorService } from "../../modules/v4/opportunity/opportunity.converter";
3
3
  import { t } from "elysia";
4
4
  import { fillCampaigns } from "../../entities/opportunity";
5
5
  import param from "../../types/parameters";
@@ -7,28 +7,27 @@ export const query = t.Object({
7
7
  campaigns: t.Optional(t.Boolean()),
8
8
  testTokens: t.Optional(t.Boolean()),
9
9
  mainParameter: t.Optional(param.MainParameter.type),
10
- chainId: t.Optional(param.Chain.type),
11
- type: t.Optional(param.Type.type),
10
+ chainId: t.Optional(t.Numeric()),
11
+ type: t.Optional(t.Numeric()),
12
12
  action: t.Optional(param.Action.type),
13
13
  tag: t.Optional(t.String()),
14
14
  });
15
15
  export const response = t.Record(t.TemplateLiteral([param.Type.type, t.Literal("_"), param.MainParameter.type]), t.Object({
16
16
  id: t.TemplateLiteral([param.Type.type, t.Literal("_"), param.MainParameter.type]),
17
17
  name: t.String(),
18
- chainId: param.Chain.type,
18
+ chainId: t.Numeric(),
19
19
  action: t.String(),
20
20
  status: t.String(),
21
21
  tags: t.Optional(t.Array(t.String())),
22
22
  tokenIcons: t.Optional(t.Array(t.Union([t.String(), t.Null()]))),
23
- rewardTokenIcons: t.Array(t.String()),
24
- dailyRewardTokens: t.Unknown(),
23
+ rewardTokenIcons: t.Optional(t.Array(t.String())),
24
+ dailyRewardTokens: t.Optional(t.Unknown()),
25
25
  campaigns: t.Object({ type: t.Number() }, { additionalProperties: true }),
26
26
  }));
27
27
  export default (app) => {
28
28
  return app.get("/opportunity", async ({ query: { campaigns: showCampaigns, ...filters } }) => {
29
- if (process.env.FF_OPPORTUNITY === "true") {
30
- const opportunities = await OpportunityService.findMany({ items: 10_000 });
31
- return {};
29
+ if (process.env.FF_OPPORTUNITY === "true" || !!filters.testTokens) {
30
+ return await OpportunityConvertorService.wrapV3Opportunities(showCampaigns ?? false, !!filters.testTokens ? filters.testTokens : undefined, !!filters.mainParameter ? filters.mainParameter : undefined, !!filters.chainId ? filters.chainId.toString() : undefined);
32
31
  }
33
32
  const opportunities = await Redis.get(filters?.testTokens ? "OpportunitiesWithTest" : "Opportunities");
34
33
  const returnedOpportunities = {};
@@ -56,10 +55,10 @@ export default (app) => {
56
55
  return await fillCampaigns(returnedOpportunities, !showCampaigns, filters.testTokens);
57
56
  }, {
58
57
  transform({ query }) {
59
- query.chainId = !query.chainId ? undefined : Number.parseInt(query.chainId);
60
- query.type = !query.type ? undefined : Number.parseInt(query.type);
61
- query.campaigns = query.campaigns === "false" ? false : !!query.campaigns;
62
- query.testTokens = query.testTokens === "false" ? false : !!query.testTokens;
58
+ query.chainId = !query.chainId ? undefined : Number.parseInt(query.chainId.toString());
59
+ query.type = !query.type ? undefined : Number.parseInt(query.type.toString());
60
+ query.campaigns = query.campaigns === false ? false : !!query.campaigns;
61
+ query.testTokens = query.testTokens === false ? false : !!query.testTokens;
63
62
  },
64
63
  query,
65
64
  response: { 200: response },
@@ -1,6 +1,7 @@
1
1
  import { RewardService } from "../../modules/v4/reward";
2
2
  import { t } from "elysia";
3
3
  import checkQueryChainIdValidity from "../../hooks/checkQueryChainIdValidity";
4
+ // @dev DEPRECATED - conversion to v4 done
4
5
  export default (app) => app.use(checkQueryChainIdValidity()).get("/recipients", async ({ query }) => {
5
6
  const campaignId = query.campaignId;
6
7
  const chainId = query.chainId;
@@ -1,8 +1,9 @@
1
1
  import { RewardService } from "../../modules/v4/reward";
2
- import { RewardConvertorService } from "../../modules/v4/reward/subservices/converter";
2
+ import { RewardConvertorService } from "../../modules/v4/reward/reward.converter";
3
3
  import { ChainId, isSupportedChain } from "@sdk";
4
4
  import { t } from "elysia";
5
5
  import checkQueryAddressValidity from "../../hooks/checkQueryAddressValidity";
6
+ // @dev DEPRECATED - conversion to v4 done
6
7
  export const query = t.Object({
7
8
  chainIds: t.Optional(t.Union([t.String(), t.Array(t.String())])),
8
9
  user: t.String(),
@@ -2,6 +2,7 @@ import { RewardService } from "../../modules/v4/reward";
2
2
  import { t } from "elysia";
3
3
  import checkQueryChainIdValidity from "../../hooks/checkQueryChainIdValidity";
4
4
  import { InvalidParameter } from "../../utils/error";
5
+ // @dev DEPRECATED - conversion to v4 done
5
6
  export const query = t.Object({
6
7
  campaignId: t.String(),
7
8
  chainId: t.Numeric(),