@merkl/api 0.10.317 → 0.10.318

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.
@@ -608,7 +608,64 @@ declare const eden: {
608
608
  sum: string;
609
609
  };
610
610
  }>>;
611
- }) & {};
611
+ }) & {
612
+ max: ((params: {
613
+ field: string | number;
614
+ }) => {
615
+ get: (options: {
616
+ headers?: Record<string, unknown> | undefined;
617
+ query: {
618
+ sort?: string | undefined;
619
+ name?: string | undefined;
620
+ tokens?: string | undefined;
621
+ status?: string | undefined;
622
+ items?: number | undefined;
623
+ tags?: string | undefined;
624
+ page?: number | undefined;
625
+ chainId?: string | undefined;
626
+ action?: string | undefined;
627
+ creatorAddress?: string | undefined;
628
+ mainProtocolId?: string | undefined;
629
+ order?: string | undefined;
630
+ test?: boolean | undefined;
631
+ minimumTvl?: number | undefined;
632
+ };
633
+ fetch?: RequestInit | undefined;
634
+ }) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
635
+ 200: {
636
+ max: string;
637
+ };
638
+ }>>;
639
+ }) & {};
640
+ min: ((params: {
641
+ field: string | number;
642
+ }) => {
643
+ get: (options: {
644
+ headers?: Record<string, unknown> | undefined;
645
+ query: {
646
+ sort?: string | undefined;
647
+ name?: string | undefined;
648
+ tokens?: string | undefined;
649
+ status?: string | undefined;
650
+ items?: number | undefined;
651
+ tags?: string | undefined;
652
+ page?: number | undefined;
653
+ chainId?: string | undefined;
654
+ action?: string | undefined;
655
+ creatorAddress?: string | undefined;
656
+ mainProtocolId?: string | undefined;
657
+ order?: string | undefined;
658
+ test?: boolean | undefined;
659
+ minimumTvl?: number | undefined;
660
+ };
661
+ fetch?: RequestInit | undefined;
662
+ }) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
663
+ 200: {
664
+ min: string;
665
+ };
666
+ }>>;
667
+ }) & {};
668
+ };
612
669
  };
613
670
  campaigns: {
614
671
  engine: {
@@ -3699,6 +3756,80 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
3699
3756
  };
3700
3757
  };
3701
3758
  };
3759
+ } & {
3760
+ opportunities: {
3761
+ aggregate: {
3762
+ max: {
3763
+ ":field": {
3764
+ get: {
3765
+ body: unknown;
3766
+ params: {
3767
+ field: never;
3768
+ };
3769
+ query: {
3770
+ sort?: string | undefined;
3771
+ name?: string | undefined;
3772
+ tokens?: string | undefined;
3773
+ status?: string | undefined;
3774
+ items?: number | undefined;
3775
+ tags?: string | undefined;
3776
+ page?: number | undefined;
3777
+ chainId?: string | undefined;
3778
+ action?: string | undefined;
3779
+ creatorAddress?: string | undefined;
3780
+ mainProtocolId?: string | undefined;
3781
+ order?: string | undefined;
3782
+ test?: boolean | undefined;
3783
+ minimumTvl?: number | undefined;
3784
+ };
3785
+ headers: unknown;
3786
+ response: {
3787
+ 200: {
3788
+ max: string;
3789
+ };
3790
+ };
3791
+ };
3792
+ };
3793
+ };
3794
+ };
3795
+ };
3796
+ } & {
3797
+ opportunities: {
3798
+ aggregate: {
3799
+ min: {
3800
+ ":field": {
3801
+ get: {
3802
+ body: unknown;
3803
+ params: {
3804
+ field: never;
3805
+ };
3806
+ query: {
3807
+ sort?: string | undefined;
3808
+ name?: string | undefined;
3809
+ tokens?: string | undefined;
3810
+ status?: string | undefined;
3811
+ items?: number | undefined;
3812
+ tags?: string | undefined;
3813
+ page?: number | undefined;
3814
+ chainId?: string | undefined;
3815
+ action?: string | undefined;
3816
+ creatorAddress?: string | undefined;
3817
+ mainProtocolId?: string | undefined;
3818
+ order?: string | undefined;
3819
+ test?: boolean | undefined;
3820
+ minimumTvl?: number | undefined;
3821
+ };
3822
+ headers: unknown;
3823
+ response: {
3824
+ 200: {
3825
+ min: string;
3826
+ };
3827
+ };
3828
+ };
3829
+ };
3830
+ };
3831
+ };
3832
+ };
3702
3833
  } & {
3703
3834
  opportunities: {
3704
3835
  ":id": {
@@ -7403,7 +7534,64 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
7403
7534
  sum: string;
7404
7535
  };
7405
7536
  }>>;
7406
- }) & {};
7537
+ }) & {
7538
+ max: ((params: {
7539
+ field: string | number;
7540
+ }) => {
7541
+ get: (options: {
7542
+ headers?: Record<string, unknown> | undefined;
7543
+ query: {
7544
+ sort?: string | undefined;
7545
+ name?: string | undefined;
7546
+ tokens?: string | undefined;
7547
+ status?: string | undefined;
7548
+ items?: number | undefined;
7549
+ tags?: string | undefined;
7550
+ page?: number | undefined;
7551
+ chainId?: string | undefined;
7552
+ action?: string | undefined;
7553
+ creatorAddress?: string | undefined;
7554
+ mainProtocolId?: string | undefined;
7555
+ order?: string | undefined;
7556
+ test?: boolean | undefined;
7557
+ minimumTvl?: number | undefined;
7558
+ };
7559
+ fetch?: RequestInit | undefined;
7560
+ }) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
7561
+ 200: {
7562
+ max: string;
7563
+ };
7564
+ }>>;
7565
+ }) & {};
7566
+ min: ((params: {
7567
+ field: string | number;
7568
+ }) => {
7569
+ get: (options: {
7570
+ headers?: Record<string, unknown> | undefined;
7571
+ query: {
7572
+ sort?: string | undefined;
7573
+ name?: string | undefined;
7574
+ tokens?: string | undefined;
7575
+ status?: string | undefined;
7576
+ items?: number | undefined;
7577
+ tags?: string | undefined;
7578
+ page?: number | undefined;
7579
+ chainId?: string | undefined;
7580
+ action?: string | undefined;
7581
+ creatorAddress?: string | undefined;
7582
+ mainProtocolId?: string | undefined;
7583
+ order?: string | undefined;
7584
+ test?: boolean | undefined;
7585
+ minimumTvl?: number | undefined;
7586
+ };
7587
+ fetch?: RequestInit | undefined;
7588
+ }) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
7589
+ 200: {
7590
+ min: string;
7591
+ };
7592
+ }>>;
7593
+ }) & {};
7594
+ };
7407
7595
  };
7408
7596
  campaigns: {
7409
7597
  engine: {
@@ -678,6 +678,80 @@ declare const app: Elysia<"", false, {
678
678
  };
679
679
  };
680
680
  };
681
+ } & {
682
+ opportunities: {
683
+ aggregate: {
684
+ max: {
685
+ ":field": {
686
+ get: {
687
+ body: unknown;
688
+ params: {
689
+ field: never;
690
+ };
691
+ query: {
692
+ sort?: string | undefined;
693
+ name?: string | undefined;
694
+ tokens?: string | undefined;
695
+ status?: string | undefined;
696
+ items?: number | undefined;
697
+ tags?: string | undefined;
698
+ page?: number | undefined;
699
+ chainId?: string | undefined;
700
+ action?: string | undefined;
701
+ creatorAddress?: string | undefined;
702
+ mainProtocolId?: string | undefined;
703
+ order?: string | undefined;
704
+ test?: boolean | undefined;
705
+ minimumTvl?: number | undefined;
706
+ };
707
+ headers: unknown;
708
+ response: {
709
+ 200: {
710
+ max: string;
711
+ };
712
+ };
713
+ };
714
+ };
715
+ };
716
+ };
717
+ };
718
+ } & {
719
+ opportunities: {
720
+ aggregate: {
721
+ min: {
722
+ ":field": {
723
+ get: {
724
+ body: unknown;
725
+ params: {
726
+ field: never;
727
+ };
728
+ query: {
729
+ sort?: string | undefined;
730
+ name?: string | undefined;
731
+ tokens?: string | undefined;
732
+ status?: string | undefined;
733
+ items?: number | undefined;
734
+ tags?: string | undefined;
735
+ page?: number | undefined;
736
+ chainId?: string | undefined;
737
+ action?: string | undefined;
738
+ creatorAddress?: string | undefined;
739
+ mainProtocolId?: string | undefined;
740
+ order?: string | undefined;
741
+ test?: boolean | undefined;
742
+ minimumTvl?: number | undefined;
743
+ };
744
+ headers: unknown;
745
+ response: {
746
+ 200: {
747
+ min: string;
748
+ };
749
+ };
750
+ };
751
+ };
752
+ };
753
+ };
754
+ };
681
755
  } & {
682
756
  opportunities: {
683
757
  ":id": {
@@ -547,6 +547,80 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
547
547
  };
548
548
  };
549
549
  };
550
+ } & {
551
+ opportunities: {
552
+ aggregate: {
553
+ max: {
554
+ ":field": {
555
+ get: {
556
+ body: unknown;
557
+ params: {
558
+ field: never;
559
+ };
560
+ query: {
561
+ sort?: string | undefined;
562
+ name?: string | undefined;
563
+ tokens?: string | undefined;
564
+ status?: string | undefined;
565
+ items?: number | undefined;
566
+ tags?: string | undefined;
567
+ page?: number | undefined;
568
+ chainId?: string | undefined;
569
+ action?: string | undefined;
570
+ creatorAddress?: string | undefined;
571
+ mainProtocolId?: string | undefined;
572
+ order?: string | undefined;
573
+ test?: boolean | undefined;
574
+ minimumTvl?: number | undefined;
575
+ };
576
+ headers: unknown;
577
+ response: {
578
+ 200: {
579
+ max: string;
580
+ };
581
+ };
582
+ };
583
+ };
584
+ };
585
+ };
586
+ };
587
+ } & {
588
+ opportunities: {
589
+ aggregate: {
590
+ min: {
591
+ ":field": {
592
+ get: {
593
+ body: unknown;
594
+ params: {
595
+ field: never;
596
+ };
597
+ query: {
598
+ sort?: string | undefined;
599
+ name?: string | undefined;
600
+ tokens?: string | undefined;
601
+ status?: string | undefined;
602
+ items?: number | undefined;
603
+ tags?: string | undefined;
604
+ page?: number | undefined;
605
+ chainId?: string | undefined;
606
+ action?: string | undefined;
607
+ creatorAddress?: string | undefined;
608
+ mainProtocolId?: string | undefined;
609
+ order?: string | undefined;
610
+ test?: boolean | undefined;
611
+ minimumTvl?: number | undefined;
612
+ };
613
+ headers: unknown;
614
+ response: {
615
+ 200: {
616
+ min: string;
617
+ };
618
+ };
619
+ };
620
+ };
621
+ };
622
+ };
623
+ };
550
624
  } & {
551
625
  opportunities: {
552
626
  ":id": {
@@ -131,6 +131,16 @@ export const OpportunityController = new Elysia({
131
131
  .get("/aggregate/:field", async ({ query, params }) => await OpportunityService.aggregate(query, params.field), {
132
132
  params: OpportunityAggregateFieldDto,
133
133
  query: GetOpportunitiesQueryDto,
134
+ })
135
+ // ─── Get Aggregate Fields ────────────────────────────────────────────
136
+ .get("/aggregate/max/:field", async ({ query, params }) => await OpportunityService.aggregateMax(query, params.field), {
137
+ params: OpportunityAggregateFieldDto,
138
+ query: GetOpportunitiesQueryDto,
139
+ })
140
+ // ─── Get Aggregate Fields ────────────────────────────────────────────
141
+ .get("/aggregate/min/:field", async ({ query, params }) => await OpportunityService.aggregateMin(query, params.field), {
142
+ params: OpportunityAggregateFieldDto,
143
+ query: GetOpportunitiesQueryDto,
134
144
  })
135
145
  // ─── Update An Opportunity ───────────────────────────────────────────
136
146
  .patch("/:id", async ({ params, body }) => await OpportunityService.update(params.id, body), {
@@ -344,7 +344,7 @@ export declare const CreateOpportunityDto: import("@sinclair/typebox").TObject<{
344
344
  tags: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
345
345
  }>;
346
346
  export declare const OpportunityAggregateFieldDto: import("@sinclair/typebox").TObject<{
347
- field: import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<"dailyRewards">[]>;
347
+ field: import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<"tvl" | "apr" | "dailyRewards">[]>;
348
348
  }>;
349
349
  export declare const OpportunityIdDto: import("@sinclair/typebox").TObject<{
350
350
  id: import("@sinclair/typebox").TString;
@@ -87,7 +87,7 @@ export const CreateOpportunityDto = t.Object({
87
87
  tags: t.Optional(t.Array(t.String())),
88
88
  });
89
89
  export const OpportunityAggregateFieldDto = t.Object({
90
- field: t.Union(["dailyRewards"].map(v => t.Literal(v))),
90
+ field: t.Union(["dailyRewards", "tvl", "apr"].map(v => t.Literal(v))),
91
91
  });
92
92
  export const OpportunityIdDto = t.Object({ id: t.String() });
93
93
  export const UpdateOpportunityDto = t.Object({
@@ -902,6 +902,12 @@ export declare abstract class OpportunityRepository {
902
902
  static aggregateSum(field: keyof Prisma.OpportunitySumAggregateInputType, query: GetOpportunitiesQueryModel): Promise<{
903
903
  sum: string;
904
904
  }>;
905
+ static aggregateMin(field: keyof Prisma.OpportunityMinAggregateInputType, query: GetOpportunitiesQueryModel): Promise<{
906
+ min: string;
907
+ }>;
908
+ static aggregateMax(field: keyof Prisma.OpportunityMaxAggregateInputType, query: GetOpportunitiesQueryModel): Promise<{
909
+ max: string;
910
+ }>;
905
911
  static update(id: string, data: UpdateOpportunityModel): Promise<{
906
912
  name: string;
907
913
  type: import("../../../../database/api/.generated").$Enums.CampaignType;
@@ -382,6 +382,26 @@ export class OpportunityRepository {
382
382
  });
383
383
  return { sum: result._sum[field] ?? null };
384
384
  }
385
+ static async aggregateMin(field, query) {
386
+ const args = OpportunityRepository.#transformQueryToPrismaFilters(query);
387
+ const result = await apiDbClient.opportunity.aggregate({
388
+ _min: {
389
+ [field]: true,
390
+ },
391
+ ...args,
392
+ });
393
+ return { min: result._min[field] ?? null };
394
+ }
395
+ static async aggregateMax(field, query) {
396
+ const args = OpportunityRepository.#transformQueryToPrismaFilters(query);
397
+ const result = await apiDbClient.opportunity.aggregate({
398
+ _max: {
399
+ [field]: true,
400
+ },
401
+ ...args,
402
+ });
403
+ return { max: result._max[field] ?? null };
404
+ }
385
405
  static async update(id, data) {
386
406
  return await apiDbClient.opportunity.update({ where: { id }, data });
387
407
  }
@@ -451,6 +451,12 @@ export declare abstract class OpportunityService {
451
451
  static aggregate(query: GetOpportunitiesQueryModel, field: keyof Prisma.OpportunitySumAggregateInputType): Promise<{
452
452
  sum: string;
453
453
  }>;
454
+ static aggregateMin(query: GetOpportunitiesQueryModel, field: keyof Prisma.OpportunityMinAggregateInputType): Promise<{
455
+ min: string;
456
+ }>;
457
+ static aggregateMax(query: GetOpportunitiesQueryModel, field: keyof Prisma.OpportunityMaxAggregateInputType): Promise<{
458
+ max: string;
459
+ }>;
454
460
  static update(id: string, data: UpdateOpportunityModel): Promise<{
455
461
  name: string;
456
462
  type: import("../../../../database/api/.generated").$Enums.CampaignType;
@@ -266,6 +266,12 @@ export class OpportunityService {
266
266
  static aggregate(query, field) {
267
267
  return OpportunityRepository.aggregateSum(field, query);
268
268
  }
269
+ static aggregateMin(query, field) {
270
+ return OpportunityRepository.aggregateMin(field, query);
271
+ }
272
+ static aggregateMax(query, field) {
273
+ return OpportunityRepository.aggregateMax(field, query);
274
+ }
269
275
  static async update(id, data) {
270
276
  return await OpportunityRepository.update(id, data);
271
277
  }
@@ -556,6 +556,80 @@ export declare const v4: Elysia<"/v4", false, {
556
556
  };
557
557
  };
558
558
  };
559
+ } & {
560
+ opportunities: {
561
+ aggregate: {
562
+ max: {
563
+ ":field": {
564
+ get: {
565
+ body: unknown;
566
+ params: {
567
+ field: never;
568
+ };
569
+ query: {
570
+ sort?: string | undefined;
571
+ name?: string | undefined;
572
+ tokens?: string | undefined;
573
+ status?: string | undefined;
574
+ items?: number | undefined;
575
+ tags?: string | undefined;
576
+ page?: number | undefined;
577
+ chainId?: string | undefined;
578
+ action?: string | undefined;
579
+ creatorAddress?: string | undefined;
580
+ mainProtocolId?: string | undefined;
581
+ order?: string | undefined;
582
+ test?: boolean | undefined;
583
+ minimumTvl?: number | undefined;
584
+ };
585
+ headers: unknown;
586
+ response: {
587
+ 200: {
588
+ max: string;
589
+ };
590
+ };
591
+ };
592
+ };
593
+ };
594
+ };
595
+ };
596
+ } & {
597
+ opportunities: {
598
+ aggregate: {
599
+ min: {
600
+ ":field": {
601
+ get: {
602
+ body: unknown;
603
+ params: {
604
+ field: never;
605
+ };
606
+ query: {
607
+ sort?: string | undefined;
608
+ name?: string | undefined;
609
+ tokens?: string | undefined;
610
+ status?: string | undefined;
611
+ items?: number | undefined;
612
+ tags?: string | undefined;
613
+ page?: number | undefined;
614
+ chainId?: string | undefined;
615
+ action?: string | undefined;
616
+ creatorAddress?: string | undefined;
617
+ mainProtocolId?: string | undefined;
618
+ order?: string | undefined;
619
+ test?: boolean | undefined;
620
+ minimumTvl?: number | undefined;
621
+ };
622
+ headers: unknown;
623
+ response: {
624
+ 200: {
625
+ min: string;
626
+ };
627
+ };
628
+ };
629
+ };
630
+ };
631
+ };
632
+ };
559
633
  } & {
560
634
  opportunities: {
561
635
  ":id": {