@merkl/api 0.20.57 → 0.20.58

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.
@@ -531,6 +531,7 @@ declare const eden: {
531
531
  get: (options: {
532
532
  headers?: Record<string, unknown> | undefined;
533
533
  query: {
534
+ search?: string | undefined;
534
535
  name?: string | undefined;
535
536
  type?: string | undefined;
536
537
  status?: string | undefined;
@@ -726,6 +727,7 @@ declare const eden: {
726
727
  get: (options: {
727
728
  headers?: Record<string, unknown> | undefined;
728
729
  query: {
730
+ search?: string | undefined;
729
731
  name?: string | undefined;
730
732
  type?: string | undefined;
731
733
  status?: string | undefined;
@@ -936,6 +938,7 @@ declare const eden: {
936
938
  get: (options: {
937
939
  headers?: Record<string, unknown> | undefined;
938
940
  query: {
941
+ search?: string | undefined;
939
942
  name?: string | undefined;
940
943
  type?: string | undefined;
941
944
  status?: string | undefined;
@@ -970,6 +973,7 @@ declare const eden: {
970
973
  get: (options: {
971
974
  headers?: Record<string, unknown> | undefined;
972
975
  query: {
976
+ search?: string | undefined;
973
977
  name?: string | undefined;
974
978
  type?: string | undefined;
975
979
  status?: string | undefined;
@@ -1004,6 +1008,7 @@ declare const eden: {
1004
1008
  get: (options: {
1005
1009
  headers?: Record<string, unknown> | undefined;
1006
1010
  query: {
1011
+ search?: string | undefined;
1007
1012
  name?: string | undefined;
1008
1013
  type?: string | undefined;
1009
1014
  status?: string | undefined;
@@ -4554,6 +4559,7 @@ declare const eden: {
4554
4559
  get: (options: {
4555
4560
  headers?: Record<string, unknown> | undefined;
4556
4561
  query: {
4562
+ search?: string | undefined;
4557
4563
  name?: string | undefined;
4558
4564
  type?: string | undefined;
4559
4565
  status?: string | undefined;
@@ -4749,6 +4755,7 @@ declare const eden: {
4749
4755
  get: (options: {
4750
4756
  headers?: Record<string, unknown> | undefined;
4751
4757
  query: {
4758
+ search?: string | undefined;
4752
4759
  name?: string | undefined;
4753
4760
  type?: string | undefined;
4754
4761
  status?: string | undefined;
@@ -4959,6 +4966,7 @@ declare const eden: {
4959
4966
  get: (options: {
4960
4967
  headers?: Record<string, unknown> | undefined;
4961
4968
  query: {
4969
+ search?: string | undefined;
4962
4970
  name?: string | undefined;
4963
4971
  type?: string | undefined;
4964
4972
  status?: string | undefined;
@@ -4993,6 +5001,7 @@ declare const eden: {
4993
5001
  get: (options: {
4994
5002
  headers?: Record<string, unknown> | undefined;
4995
5003
  query: {
5004
+ search?: string | undefined;
4996
5005
  name?: string | undefined;
4997
5006
  type?: string | undefined;
4998
5007
  status?: string | undefined;
@@ -5027,6 +5036,7 @@ declare const eden: {
5027
5036
  get: (options: {
5028
5037
  headers?: Record<string, unknown> | undefined;
5029
5038
  query: {
5039
+ search?: string | undefined;
5030
5040
  name?: string | undefined;
5031
5041
  type?: string | undefined;
5032
5042
  status?: string | undefined;
@@ -9091,6 +9101,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
9091
9101
  body: unknown;
9092
9102
  params: {};
9093
9103
  query: {
9104
+ search?: string | undefined;
9094
9105
  name?: string | undefined;
9095
9106
  type?: string | undefined;
9096
9107
  status?: string | undefined;
@@ -9291,6 +9302,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
9291
9302
  body: unknown;
9292
9303
  params: {};
9293
9304
  query: {
9305
+ search?: string | undefined;
9294
9306
  name?: string | undefined;
9295
9307
  type?: string | undefined;
9296
9308
  status?: string | undefined;
@@ -9793,6 +9805,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
9793
9805
  field: never;
9794
9806
  };
9795
9807
  query: {
9808
+ search?: string | undefined;
9796
9809
  name?: string | undefined;
9797
9810
  type?: string | undefined;
9798
9811
  status?: string | undefined;
@@ -9835,6 +9848,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
9835
9848
  field: never;
9836
9849
  };
9837
9850
  query: {
9851
+ search?: string | undefined;
9838
9852
  name?: string | undefined;
9839
9853
  type?: string | undefined;
9840
9854
  status?: string | undefined;
@@ -9878,6 +9892,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
9878
9892
  field: never;
9879
9893
  };
9880
9894
  query: {
9895
+ search?: string | undefined;
9881
9896
  name?: string | undefined;
9882
9897
  type?: string | undefined;
9883
9898
  status?: string | undefined;
@@ -15253,6 +15268,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
15253
15268
  get: (options: {
15254
15269
  headers?: Record<string, unknown> | undefined;
15255
15270
  query: {
15271
+ search?: string | undefined;
15256
15272
  name?: string | undefined;
15257
15273
  type?: string | undefined;
15258
15274
  status?: string | undefined;
@@ -15448,6 +15464,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
15448
15464
  get: (options: {
15449
15465
  headers?: Record<string, unknown> | undefined;
15450
15466
  query: {
15467
+ search?: string | undefined;
15451
15468
  name?: string | undefined;
15452
15469
  type?: string | undefined;
15453
15470
  status?: string | undefined;
@@ -15658,6 +15675,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
15658
15675
  get: (options: {
15659
15676
  headers?: Record<string, unknown> | undefined;
15660
15677
  query: {
15678
+ search?: string | undefined;
15661
15679
  name?: string | undefined;
15662
15680
  type?: string | undefined;
15663
15681
  status?: string | undefined;
@@ -15692,6 +15710,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
15692
15710
  get: (options: {
15693
15711
  headers?: Record<string, unknown> | undefined;
15694
15712
  query: {
15713
+ search?: string | undefined;
15695
15714
  name?: string | undefined;
15696
15715
  type?: string | undefined;
15697
15716
  status?: string | undefined;
@@ -15726,6 +15745,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
15726
15745
  get: (options: {
15727
15746
  headers?: Record<string, unknown> | undefined;
15728
15747
  query: {
15748
+ search?: string | undefined;
15729
15749
  name?: string | undefined;
15730
15750
  type?: string | undefined;
15731
15751
  status?: string | undefined;
@@ -19276,6 +19296,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
19276
19296
  get: (options: {
19277
19297
  headers?: Record<string, unknown> | undefined;
19278
19298
  query: {
19299
+ search?: string | undefined;
19279
19300
  name?: string | undefined;
19280
19301
  type?: string | undefined;
19281
19302
  status?: string | undefined;
@@ -19471,6 +19492,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
19471
19492
  get: (options: {
19472
19493
  headers?: Record<string, unknown> | undefined;
19473
19494
  query: {
19495
+ search?: string | undefined;
19474
19496
  name?: string | undefined;
19475
19497
  type?: string | undefined;
19476
19498
  status?: string | undefined;
@@ -19681,6 +19703,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
19681
19703
  get: (options: {
19682
19704
  headers?: Record<string, unknown> | undefined;
19683
19705
  query: {
19706
+ search?: string | undefined;
19684
19707
  name?: string | undefined;
19685
19708
  type?: string | undefined;
19686
19709
  status?: string | undefined;
@@ -19715,6 +19738,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
19715
19738
  get: (options: {
19716
19739
  headers?: Record<string, unknown> | undefined;
19717
19740
  query: {
19741
+ search?: string | undefined;
19718
19742
  name?: string | undefined;
19719
19743
  type?: string | undefined;
19720
19744
  status?: string | undefined;
@@ -19749,6 +19773,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
19749
19773
  get: (options: {
19750
19774
  headers?: Record<string, unknown> | undefined;
19751
19775
  query: {
19776
+ search?: string | undefined;
19752
19777
  name?: string | undefined;
19753
19778
  type?: string | undefined;
19754
19779
  status?: string | undefined;
@@ -334,6 +334,7 @@ declare const app: Elysia<"", false, {
334
334
  body: unknown;
335
335
  params: {};
336
336
  query: {
337
+ search?: string | undefined;
337
338
  name?: string | undefined;
338
339
  type?: string | undefined;
339
340
  status?: string | undefined;
@@ -534,6 +535,7 @@ declare const app: Elysia<"", false, {
534
535
  body: unknown;
535
536
  params: {};
536
537
  query: {
538
+ search?: string | undefined;
537
539
  name?: string | undefined;
538
540
  type?: string | undefined;
539
541
  status?: string | undefined;
@@ -1036,6 +1038,7 @@ declare const app: Elysia<"", false, {
1036
1038
  field: never;
1037
1039
  };
1038
1040
  query: {
1041
+ search?: string | undefined;
1039
1042
  name?: string | undefined;
1040
1043
  type?: string | undefined;
1041
1044
  status?: string | undefined;
@@ -1078,6 +1081,7 @@ declare const app: Elysia<"", false, {
1078
1081
  field: never;
1079
1082
  };
1080
1083
  query: {
1084
+ search?: string | undefined;
1081
1085
  name?: string | undefined;
1082
1086
  type?: string | undefined;
1083
1087
  status?: string | undefined;
@@ -1121,6 +1125,7 @@ declare const app: Elysia<"", false, {
1121
1125
  field: never;
1122
1126
  };
1123
1127
  query: {
1128
+ search?: string | undefined;
1124
1129
  name?: string | undefined;
1125
1130
  type?: string | undefined;
1126
1131
  status?: string | undefined;
@@ -189,6 +189,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
189
189
  body: unknown;
190
190
  params: {};
191
191
  query: {
192
+ search?: string | undefined;
192
193
  name?: string | undefined;
193
194
  type?: string | undefined;
194
195
  status?: string | undefined;
@@ -389,6 +390,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
389
390
  body: unknown;
390
391
  params: {};
391
392
  query: {
393
+ search?: string | undefined;
392
394
  name?: string | undefined;
393
395
  type?: string | undefined;
394
396
  status?: string | undefined;
@@ -891,6 +893,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
891
893
  field: never;
892
894
  };
893
895
  query: {
896
+ search?: string | undefined;
894
897
  name?: string | undefined;
895
898
  type?: string | undefined;
896
899
  status?: string | undefined;
@@ -933,6 +936,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
933
936
  field: never;
934
937
  };
935
938
  query: {
939
+ search?: string | undefined;
936
940
  name?: string | undefined;
937
941
  type?: string | undefined;
938
942
  status?: string | undefined;
@@ -976,6 +980,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
976
980
  field: never;
977
981
  };
978
982
  query: {
983
+ search?: string | undefined;
979
984
  name?: string | undefined;
980
985
  type?: string | undefined;
981
986
  status?: string | undefined;
@@ -293,6 +293,7 @@ export declare const AggregationResourceDto: import("@sinclair/typebox").TObject
293
293
  }>;
294
294
  export declare const GetOpportunitiesQueryDto: import("@sinclair/typebox").TObject<{
295
295
  name: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
296
+ search: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
296
297
  campaignId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
297
298
  chainId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRegExp>;
298
299
  action: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRegExp>;
@@ -52,6 +52,7 @@ export const AggregationResourceDto = t.Object({
52
52
  });
53
53
  export const GetOpportunitiesQueryDto = t.Object({
54
54
  name: t.Optional(t.String({ description: "Filter by name" })),
55
+ search: t.Optional(t.String({ description: "Search amongst multiple values (token, protocols, tags, campaigns)" })),
55
56
  campaignId: t.Optional(t.String({ description: "Search the opportunity linked to a given campaignId" })),
56
57
  //TODO: find a systemic way of handling query param arrays
57
58
  chainId: t.Optional(t.RegExp(/^\d+(,\d+)*$/, {
@@ -15,6 +15,7 @@ export class OpportunityRepository {
15
15
  const actions = query.action?.split(",");
16
16
  const status = query.status?.split(",");
17
17
  const tokens = query.tokens?.split(",");
18
+ const search = query.search?.split(" ");
18
19
  const rewardTokenSymbol = query.rewardTokenSymbol;
19
20
  const types = query.type?.split(",");
20
21
  const protocols = query.mainProtocolId?.split(",");
@@ -29,31 +30,57 @@ export class OpportunityRepository {
29
30
  return {
30
31
  orderBy,
31
32
  where: {
32
- tags: !filters.tags ? undefined : { has: filters.tags },
33
- type: !filters.type ? undefined : { in: types },
34
- tvl: filters.minimumTvl ? { gte: filters.minimumTvl } : undefined,
35
- chainId: !chainIds ? undefined : { in: chainIds },
36
- name: !filters.name ? undefined : { contains: filters.name, mode: "insensitive" },
37
- action: !actions ? undefined : { in: actions },
38
- status: !status ? undefined : { in: status },
39
- mainProtocolId: !protocols ? undefined : { in: protocols, mode: "insensitive" },
40
- identifier: !identifier ? undefined : { in: identifiers, mode: "insensitive" },
41
- Campaigns: test && !creatorAddress && !rewardTokenSymbol && !filters.campaignId
42
- ? undefined
43
- : {
44
- some: {
45
- campaignId: filters.campaignId ? filters.campaignId : undefined,
46
- RewardToken: test && !rewardTokenSymbol
47
- ? undefined
48
- : {
49
- isTest: !test ? false : undefined,
50
- isPoint: point,
51
- symbol: rewardTokenSymbol ? { equals: rewardTokenSymbol, mode: "insensitive" } : undefined,
33
+ AND: [
34
+ {
35
+ tags: !filters.tags ? undefined : { has: filters.tags },
36
+ type: !filters.type ? undefined : { in: types },
37
+ tvl: filters.minimumTvl ? { gte: filters.minimumTvl } : undefined,
38
+ chainId: !chainIds ? undefined : { in: chainIds },
39
+ name: !filters.name ? undefined : { contains: filters.name, mode: "insensitive" },
40
+ action: !actions ? undefined : { in: actions },
41
+ status: !status ? undefined : { in: status },
42
+ mainProtocolId: !protocols ? undefined : { in: protocols, mode: "insensitive" },
43
+ identifier: !identifier ? undefined : { in: identifiers, mode: "insensitive" },
44
+ Campaigns: test && !creatorAddress && !rewardTokenSymbol && !filters.campaignId
45
+ ? undefined
46
+ : {
47
+ some: {
48
+ campaignId: filters.campaignId ? filters.campaignId : undefined,
49
+ RewardToken: test && !rewardTokenSymbol
50
+ ? undefined
51
+ : {
52
+ isTest: !test ? false : undefined,
53
+ isPoint: point,
54
+ symbol: rewardTokenSymbol
55
+ ? { equals: rewardTokenSymbol, mode: "insensitive" }
56
+ : undefined,
57
+ },
58
+ creatorAddress: creatorAddress ? creatorAddress : undefined,
52
59
  },
53
- creatorAddress: creatorAddress ? creatorAddress : undefined,
54
- },
60
+ },
61
+ Tokens: { some: { symbol: { in: tokens } } },
55
62
  },
56
- Tokens: { some: { symbol: { in: tokens } } },
63
+ !search
64
+ ? {}
65
+ : {
66
+ AND: search?.map(keyword => ({
67
+ OR: [
68
+ { id: { contains: keyword, mode: "insensitive" } },
69
+ { name: { contains: keyword, mode: "insensitive" } },
70
+ { identifier: { contains: keyword, mode: "insensitive" } },
71
+ { explorerAddress: { contains: keyword, mode: "insensitive" } },
72
+ { type: { contains: keyword, mode: "insensitive" } },
73
+ { MainProtocol: { name: { contains: keyword, mode: "insensitive" } } },
74
+ { mainProtocolId: { contains: keyword, mode: "insensitive" } },
75
+ { Tokens: { some: { name: { contains: keyword, mode: "insensitive" } } } },
76
+ { Tokens: { some: { symbol: { contains: keyword, mode: "insensitive" } } } },
77
+ { Campaigns: { some: { campaignId: { contains: keyword, mode: "insensitive" } } } },
78
+ { Campaigns: { some: { id: { contains: keyword, mode: "insensitive" } } } },
79
+ { Chain: { name: { contains: keyword, mode: "insensitive" } } },
80
+ ],
81
+ })),
82
+ },
83
+ ],
57
84
  },
58
85
  };
59
86
  }
@@ -269,6 +296,7 @@ export class OpportunityRepository {
269
296
  const withPoints = query.point ?? false;
270
297
  const withCampaigns = query.campaigns ?? false;
271
298
  const args = OpportunityRepository.#transformQueryToPrismaFilters(query);
299
+ const search = query.search ?? undefined;
272
300
  return await apiDbClient.opportunity.findMany({
273
301
  take: items === 0 ? undefined : items,
274
302
  skip: page * items,
@@ -204,6 +204,7 @@ export declare const v4: Elysia<"/v4", false, {
204
204
  body: unknown;
205
205
  params: {};
206
206
  query: {
207
+ search?: string | undefined;
207
208
  name?: string | undefined;
208
209
  type?: string | undefined;
209
210
  status?: string | undefined;
@@ -404,6 +405,7 @@ export declare const v4: Elysia<"/v4", false, {
404
405
  body: unknown;
405
406
  params: {};
406
407
  query: {
408
+ search?: string | undefined;
407
409
  name?: string | undefined;
408
410
  type?: string | undefined;
409
411
  status?: string | undefined;
@@ -906,6 +908,7 @@ export declare const v4: Elysia<"/v4", false, {
906
908
  field: never;
907
909
  };
908
910
  query: {
911
+ search?: string | undefined;
909
912
  name?: string | undefined;
910
913
  type?: string | undefined;
911
914
  status?: string | undefined;
@@ -948,6 +951,7 @@ export declare const v4: Elysia<"/v4", false, {
948
951
  field: never;
949
952
  };
950
953
  query: {
954
+ search?: string | undefined;
951
955
  name?: string | undefined;
952
956
  type?: string | undefined;
953
957
  status?: string | undefined;
@@ -991,6 +995,7 @@ export declare const v4: Elysia<"/v4", false, {
991
995
  field: never;
992
996
  };
993
997
  query: {
998
+ search?: string | undefined;
994
999
  name?: string | undefined;
995
1000
  type?: string | undefined;
996
1001
  status?: string | undefined;