@merkl/api 0.20.136 → 0.20.138

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.
@@ -667,13 +667,20 @@ declare const eden: {
667
667
  aprRecord: {
668
668
  cumulated: number;
669
669
  timestamp: bigint;
670
- breakdowns: {
670
+ breakdowns: ({
671
671
  id: string;
672
- type: import("@db/api").$Enums.AprType;
672
+ value: number;
673
+ aprRecordId: string;
674
+ distributionType: import("@db/api").$Enums.DistributionType;
673
675
  identifier: string;
676
+ type: "CAMPAIGN";
677
+ } | {
678
+ id: string;
674
679
  value: number;
675
680
  aprRecordId: string;
676
- }[];
681
+ identifier: string;
682
+ type: import("@db/api").$Enums.AprType;
683
+ })[];
677
684
  };
678
685
  tvlRecord: {
679
686
  id: string;
@@ -5712,13 +5719,20 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
5712
5719
  aprRecord: {
5713
5720
  cumulated: number;
5714
5721
  timestamp: bigint;
5715
- breakdowns: {
5722
+ breakdowns: ({
5716
5723
  id: string;
5717
- type: import("@db/api").$Enums.AprType;
5724
+ value: number;
5725
+ aprRecordId: string;
5726
+ distributionType: import("@db/api").$Enums.DistributionType;
5718
5727
  identifier: string;
5728
+ type: "CAMPAIGN";
5729
+ } | {
5730
+ id: string;
5719
5731
  value: number;
5720
5732
  aprRecordId: string;
5721
- }[];
5733
+ identifier: string;
5734
+ type: import("@db/api").$Enums.AprType;
5735
+ })[];
5722
5736
  };
5723
5737
  tvlRecord: {
5724
5738
  id: string;
@@ -12354,13 +12368,20 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
12354
12368
  aprRecord: {
12355
12369
  cumulated: number;
12356
12370
  timestamp: bigint;
12357
- breakdowns: {
12371
+ breakdowns: ({
12358
12372
  id: string;
12359
- type: import("@db/api").$Enums.AprType;
12373
+ value: number;
12374
+ aprRecordId: string;
12375
+ distributionType: import("@db/api").$Enums.DistributionType;
12360
12376
  identifier: string;
12377
+ type: "CAMPAIGN";
12378
+ } | {
12379
+ id: string;
12361
12380
  value: number;
12362
12381
  aprRecordId: string;
12363
- }[];
12382
+ identifier: string;
12383
+ type: import("@db/api").$Enums.AprType;
12384
+ })[];
12364
12385
  };
12365
12386
  tvlRecord: {
12366
12387
  id: string;
@@ -484,13 +484,20 @@ declare const app: Elysia<"", false, {
484
484
  aprRecord: {
485
485
  cumulated: number;
486
486
  timestamp: bigint;
487
- breakdowns: {
487
+ breakdowns: ({
488
488
  id: string;
489
- type: import("@db/api").$Enums.AprType;
489
+ value: number;
490
+ aprRecordId: string;
491
+ distributionType: import("@db/api").$Enums.DistributionType;
490
492
  identifier: string;
493
+ type: "CAMPAIGN";
494
+ } | {
495
+ id: string;
491
496
  value: number;
492
497
  aprRecordId: string;
493
- }[];
498
+ identifier: string;
499
+ type: import("@db/api").$Enums.AprType;
500
+ })[];
494
501
  };
495
502
  tvlRecord: {
496
503
  id: string;
@@ -1,4 +1,5 @@
1
1
  import type { Resource } from "@/modules/v4/prisma";
2
+ import { type DistributionType } from "@db/api";
2
3
  /**
3
4
  * Apr Record
4
5
  * @description Describes one apr snapshot for an opportunity
@@ -12,7 +13,9 @@ export type AprRecord = Resource<"AprRecord", "id" | "opportunityId", {
12
13
  * @description Describes one apr fraction of record
13
14
  * @see {@link Resource}
14
15
  */
15
- export type AprBreakdown = Resource<"AprBreakdown", "id" | "aprRecordId">;
16
+ export type AprBreakdown = Resource<"AprBreakdown", "id" | "aprRecordId", {
17
+ distributionType?: DistributionType;
18
+ }>;
16
19
  export declare const AprBreakdownResourceDto: import("@sinclair/typebox").TObject<{
17
20
  id: import("@sinclair/typebox").TString;
18
21
  type: import("@sinclair/typebox").TEnum<{
@@ -339,13 +339,20 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
339
339
  aprRecord: {
340
340
  cumulated: number;
341
341
  timestamp: bigint;
342
- breakdowns: {
342
+ breakdowns: ({
343
343
  id: string;
344
- type: import("@db/api").$Enums.AprType;
344
+ value: number;
345
+ aprRecordId: string;
346
+ distributionType: import("@db/api").$Enums.DistributionType;
345
347
  identifier: string;
348
+ type: "CAMPAIGN";
349
+ } | {
350
+ id: string;
346
351
  value: number;
347
352
  aprRecordId: string;
348
- }[];
353
+ identifier: string;
354
+ type: import("@db/api").$Enums.AprType;
355
+ })[];
349
356
  };
350
357
  tvlRecord: {
351
358
  id: string;
@@ -156,6 +156,7 @@ export declare abstract class OpportunityRepository {
156
156
  DailyRewardsRecords: ({
157
157
  DailyRewardsBreakdown: ({
158
158
  Campaign: {
159
+ campaignId: string;
159
160
  distributionType: import("@db/api").$Enums.DistributionType;
160
161
  amount: string;
161
162
  startTimestamp: bigint;
@@ -302,6 +303,7 @@ export declare abstract class OpportunityRepository {
302
303
  DailyRewardsRecords: ({
303
304
  DailyRewardsBreakdown: ({
304
305
  Campaign: {
306
+ campaignId: string;
305
307
  distributionType: import("@db/api").$Enums.DistributionType;
306
308
  amount: string;
307
309
  startTimestamp: bigint;
@@ -507,6 +509,7 @@ export declare abstract class OpportunityRepository {
507
509
  DailyRewardsRecords: ({
508
510
  DailyRewardsBreakdown: ({
509
511
  Campaign: {
512
+ campaignId: string;
510
513
  distributionType: import("@db/api").$Enums.DistributionType;
511
514
  amount: string;
512
515
  startTimestamp: bigint;
@@ -660,6 +663,7 @@ export declare abstract class OpportunityRepository {
660
663
  DailyRewardsRecords: ({
661
664
  DailyRewardsBreakdown: ({
662
665
  Campaign: {
666
+ campaignId: string;
663
667
  distributionType: import("@db/api").$Enums.DistributionType;
664
668
  amount: string;
665
669
  startTimestamp: bigint;
@@ -867,6 +871,7 @@ export declare abstract class OpportunityRepository {
867
871
  DailyRewardsRecords: ({
868
872
  DailyRewardsBreakdown: ({
869
873
  Campaign: {
874
+ campaignId: string;
870
875
  distributionType: import("@db/api").$Enums.DistributionType;
871
876
  amount: string;
872
877
  startTimestamp: bigint;
@@ -127,6 +127,7 @@ export class OpportunityRepository {
127
127
  RewardToken: true,
128
128
  CampaignStatus: true,
129
129
  distributionType: true,
130
+ campaignId: true,
130
131
  },
131
132
  },
132
133
  },
@@ -600,13 +600,20 @@ export declare abstract class OpportunityService {
600
600
  aprRecord: {
601
601
  cumulated: number;
602
602
  timestamp: bigint;
603
- breakdowns: {
603
+ breakdowns: ({
604
604
  id: string;
605
- type: import("@db/api").$Enums.AprType;
605
+ value: number;
606
+ aprRecordId: string;
607
+ distributionType: import("@db/api").$Enums.DistributionType;
606
608
  identifier: string;
609
+ type: "CAMPAIGN";
610
+ } | {
611
+ id: string;
607
612
  value: number;
608
613
  aprRecordId: string;
609
- }[];
614
+ identifier: string;
615
+ type: import("@db/api").$Enums.AprType;
616
+ })[];
610
617
  };
611
618
  tvlRecord: {
612
619
  id: string;
@@ -778,13 +785,20 @@ export declare abstract class OpportunityService {
778
785
  aprRecord: {
779
786
  cumulated: number;
780
787
  timestamp: bigint;
781
- breakdowns: {
788
+ breakdowns: ({
782
789
  id: string;
783
- type: import("@db/api").$Enums.AprType;
790
+ value: number;
791
+ aprRecordId: string;
792
+ distributionType: import("@db/api").$Enums.DistributionType;
784
793
  identifier: string;
794
+ type: "CAMPAIGN";
795
+ } | {
796
+ id: string;
785
797
  value: number;
786
798
  aprRecordId: string;
787
- }[];
799
+ identifier: string;
800
+ type: import("@db/api").$Enums.AprType;
801
+ })[];
788
802
  };
789
803
  tvlRecord: {
790
804
  id: string;
@@ -949,13 +963,20 @@ export declare abstract class OpportunityService {
949
963
  aprRecord: {
950
964
  cumulated: number;
951
965
  timestamp: bigint;
952
- breakdowns: {
966
+ breakdowns: ({
953
967
  id: string;
954
- type: import("@db/api").$Enums.AprType;
968
+ value: number;
969
+ aprRecordId: string;
970
+ distributionType: import("@db/api").$Enums.DistributionType;
955
971
  identifier: string;
972
+ type: "CAMPAIGN";
973
+ } | {
974
+ id: string;
956
975
  value: number;
957
976
  aprRecordId: string;
958
- }[];
977
+ identifier: string;
978
+ type: import("@db/api").$Enums.AprType;
979
+ })[];
959
980
  };
960
981
  tvlRecord: {
961
982
  id: string;
@@ -6,7 +6,7 @@ import { CampaignService } from "@/modules/v4/campaign/campaign.service";
6
6
  import { TokenService } from "@/modules/v4/token/token.service";
7
7
  import { UserService } from "@/modules/v4/user/user.service";
8
8
  import { log } from "@/utils/logger";
9
- import { Status } from "@db/api";
9
+ import { AprType, Status } from "@db/api";
10
10
  import { Campaign as CampaignType } from "@sdk";
11
11
  import moment from "moment";
12
12
  import { metadataBuilderFactory } from "../../../engine/metadata/factory";
@@ -202,7 +202,24 @@ export class OpportunityService {
202
202
  ? (AprRecords?.map(({ cumulated, timestamp, AprBreakdown: breakdowns }) => ({
203
203
  cumulated,
204
204
  timestamp,
205
- breakdowns,
205
+ breakdowns: breakdowns.map(({ identifier, type, ...breakdown }) => {
206
+ if (type === AprType.CAMPAIGN) {
207
+ const campaign = DailyRewardsRecords?.[0]?.DailyRewardsBreakdown?.map(breakdown => breakdown.Campaign).find(c => c.campaignId === identifier);
208
+ if (campaign) {
209
+ return {
210
+ distributionType: campaign.distributionType,
211
+ identifier,
212
+ type,
213
+ ...breakdown,
214
+ };
215
+ }
216
+ }
217
+ return {
218
+ identifier,
219
+ type,
220
+ ...breakdown,
221
+ };
222
+ }),
206
223
  }))?.[0] ?? undefined)
207
224
  : {
208
225
  cumulated: 0,
@@ -14,13 +14,20 @@ export declare abstract class RewardService {
14
14
  aprRecord: {
15
15
  cumulated: number;
16
16
  timestamp: bigint;
17
- breakdowns: {
17
+ breakdowns: ({
18
18
  id: string;
19
- type: import("@db/api").$Enums.AprType;
19
+ value: number;
20
+ aprRecordId: string;
21
+ distributionType: import("@db/api").$Enums.DistributionType;
20
22
  identifier: string;
23
+ type: "CAMPAIGN";
24
+ } | {
25
+ id: string;
21
26
  value: number;
22
27
  aprRecordId: string;
23
- }[];
28
+ identifier: string;
29
+ type: import("@db/api").$Enums.AprType;
30
+ })[];
24
31
  };
25
32
  tvlRecord: {
26
33
  id: string;
@@ -354,13 +354,20 @@ export declare const v4: Elysia<"/v4", false, {
354
354
  aprRecord: {
355
355
  cumulated: number;
356
356
  timestamp: bigint;
357
- breakdowns: {
357
+ breakdowns: ({
358
358
  id: string;
359
- type: import("@db/api").$Enums.AprType;
359
+ value: number;
360
+ aprRecordId: string;
361
+ distributionType: import("@db/api").$Enums.DistributionType;
360
362
  identifier: string;
363
+ type: "CAMPAIGN";
364
+ } | {
365
+ id: string;
361
366
  value: number;
362
367
  aprRecordId: string;
363
- }[];
368
+ identifier: string;
369
+ type: import("@db/api").$Enums.AprType;
370
+ })[];
364
371
  };
365
372
  tvlRecord: {
366
373
  id: string;
@@ -6,7 +6,7 @@ export class TokenRepository {
6
6
  const ids = query.id ? query.id.map(id => ({ id })) : [];
7
7
  const { page: _page, items: _items } = query;
8
8
  const page = _page ? _page : 0;
9
- const items = _items === 0 ? 10_000 : _items !== undefined ? _items : 100;
9
+ const items = _items === 0 ? 100_000 : _items !== undefined ? _items : 100;
10
10
  return {
11
11
  take: items === 0 ? undefined : items,
12
12
  skip: page * items,