@merkl/api 0.10.138 → 0.10.140

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. package/dist/src/eden/index.d.ts +291 -520
  2. package/dist/src/index.d.ts +99 -186
  3. package/dist/src/index.js +1 -1
  4. package/dist/src/libs/deprecated-merklv3/index.js +1 -1
  5. package/dist/src/modules/v4/blacklist/blacklist.controller.d.ts +0 -21
  6. package/dist/src/modules/v4/blacklist/blacklist.controller.js +2 -2
  7. package/dist/src/modules/v4/blacklist/blacklist.repository.d.ts +0 -8
  8. package/dist/src/modules/v4/blacklist/blacklist.repository.js +1 -4
  9. package/dist/src/modules/v4/blacklist/blacklist.service.d.ts +1 -9
  10. package/dist/src/modules/v4/blacklist/blacklist.service.js +1 -4
  11. package/dist/src/modules/v4/campaign/campaign.controller.d.ts +3 -3
  12. package/dist/src/modules/v4/campaign/campaign.controller.js +8 -6
  13. package/dist/src/modules/v4/campaign/campaign.service.js +1 -2
  14. package/dist/src/modules/v4/chain/chain.controller.js +2 -1
  15. package/dist/src/modules/v4/dynamicData/dynamicData.controller.d.ts +20 -26
  16. package/dist/src/modules/v4/dynamicData/dynamicData.controller.js +5 -5
  17. package/dist/src/modules/v4/enso/enso.service.d.ts +1 -1
  18. package/dist/src/modules/v4/{participate/participate.controller.d.ts → interaction/interaction.controller.d.ts} +6 -6
  19. package/dist/src/modules/v4/{participate/participate.controller.js → interaction/interaction.controller.js} +12 -13
  20. package/dist/src/modules/v4/{participate/participate.model.d.ts → interaction/interaction.model.d.ts} +12 -12
  21. package/dist/src/modules/v4/{participate/participate.model.js → interaction/interaction.model.js} +3 -3
  22. package/dist/src/modules/v4/{participate/participate.service.d.ts → interaction/interaction.service.d.ts} +5 -5
  23. package/dist/src/modules/v4/{participate/participate.service.js → interaction/interaction.service.js} +3 -3
  24. package/dist/src/modules/v4/merklRoot/merklRoot.controller.d.ts +2 -2
  25. package/dist/src/modules/v4/merklRoot/merklRoot.controller.js +2 -2
  26. package/dist/src/modules/v4/opportunity/opportunity.controller.js +5 -1
  27. package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +28 -2
  28. package/dist/src/modules/v4/opportunity/opportunity.repository.js +16 -1
  29. package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +2 -1
  30. package/dist/src/modules/v4/opportunity/opportunity.service.js +30 -0
  31. package/dist/src/modules/v4/opportunity/subservices/getClammMetadata.service.js +1 -1
  32. package/dist/src/modules/v4/opportunity/subservices/getDolomiteMetadata.service.js +1 -1
  33. package/dist/src/modules/v4/opportunity/subservices/getErc20SnapshotMetadata.service.js +1 -1
  34. package/dist/src/modules/v4/opportunity/subservices/getJsonAirDropMetadata.service.js +3 -3
  35. package/dist/src/modules/v4/opportunity/subservices/getMorphoMetadata.service.js +2 -2
  36. package/dist/src/modules/v4/opportunity/subservices/getRadiantMetadata.service.js +1 -1
  37. package/dist/src/modules/v4/opportunity/subservices/getSiloMetadata.service.js +1 -1
  38. package/dist/src/modules/v4/price/price.controller.js +3 -0
  39. package/dist/src/modules/v4/reward/reward.controller.d.ts +31 -29
  40. package/dist/src/modules/v4/reward/reward.controller.js +3 -3
  41. package/dist/src/modules/v4/reward/{rewardConvertor.service.d.ts → subservices/converter.d.ts} +2 -2
  42. package/dist/src/modules/v4/reward/{rewardConvertor.service.js → subservices/converter.js} +1 -1
  43. package/dist/src/modules/v4/router.d.ts +99 -186
  44. package/dist/src/modules/v4/router.js +2 -2
  45. package/dist/src/modules/v4/status/status.controller.d.ts +40 -102
  46. package/dist/src/modules/v4/status/status.controller.js +16 -22
  47. package/dist/src/modules/v4/status/status.model.d.ts +33 -26
  48. package/dist/src/modules/v4/status/status.model.js +9 -20
  49. package/dist/src/modules/v4/status/status.repository.d.ts +12 -42
  50. package/dist/src/modules/v4/status/status.repository.js +10 -22
  51. package/dist/src/modules/v4/status/status.service.d.ts +4 -36
  52. package/dist/src/modules/v4/status/status.service.js +9 -18
  53. package/dist/src/modules/v4/uniswapV4/uniswapV4.controller.d.ts +1 -1
  54. package/dist/src/modules/v4/uniswapV4/uniswapV4.controller.js +1 -1
  55. package/dist/src/modules/v4/user/user.controller.js +3 -2
  56. package/dist/src/routes/v3/ERC20Campaigns.d.ts +99 -186
  57. package/dist/src/routes/v3/blacklist.d.ts +99 -186
  58. package/dist/src/routes/v3/campaigns.d.ts +99 -186
  59. package/dist/src/routes/v3/campaignsInfo.d.ts +99 -186
  60. package/dist/src/routes/v3/multiChainPositions.d.ts +99 -186
  61. package/dist/src/routes/v3/opportunity.d.ts +99 -186
  62. package/dist/src/routes/v3/positions.d.ts +99 -186
  63. package/dist/src/routes/v3/rewards.d.ts +99 -186
  64. package/dist/src/routes/v3/rewards.js +1 -1
  65. package/dist/src/routes/v3/updates.d.ts +99 -186
  66. package/dist/src/routes/v3/userRewards.d.ts +99 -186
  67. package/dist/src/routes/v3/userRewards.js +1 -1
  68. package/dist/tsconfig.package.tsbuildinfo +1 -1
  69. package/package.json +1 -2
  70. package/dist/src/modules/v4/apr/apr.repository.d.ts +0 -0
  71. package/dist/src/modules/v4/apr/apr.repository.js +0 -1
  72. package/dist/src/modules/v4/tvl/tvl.repository.d.ts +0 -0
  73. package/dist/src/modules/v4/tvl/tvl.repository.js +0 -1
@@ -1,5 +1,5 @@
1
1
  import Elysia from "elysia";
2
- export declare const StatusController: Elysia<"/campaignStatus", false, {
2
+ export declare const StatusController: Elysia<"/campaign-status", false, {
3
3
  decorator: {};
4
4
  store: {};
5
5
  derive: {};
@@ -12,11 +12,11 @@ export declare const StatusController: Elysia<"/campaignStatus", false, {
12
12
  macro: {};
13
13
  macroFn: {};
14
14
  }, {
15
- campaignStatus: {
15
+ "campaign-status": {
16
16
  engine: {
17
- post: {
18
- body: {
19
- status: {
17
+ ":campaignId": {
18
+ put: {
19
+ body: {
20
20
  value: "SUCCESS";
21
21
  computedUntil: number;
22
22
  } | {
@@ -30,90 +30,74 @@ export declare const StatusController: Elysia<"/campaignStatus", false, {
30
30
  details: string;
31
31
  value: "FAILED";
32
32
  };
33
- campaignId: string;
34
- distributionChain: number;
35
- };
36
- params: {};
37
- query: unknown;
38
- headers: {
39
- authorization: string;
40
- };
41
- response: {
42
- 200: void;
33
+ params: {
34
+ campaignId: string;
35
+ };
36
+ query: unknown;
37
+ headers: {
38
+ authorization: string;
39
+ };
40
+ response: {
41
+ 200: void;
42
+ };
43
43
  };
44
44
  };
45
45
  };
46
46
  };
47
47
  } & {
48
- campaignStatus: {
49
- index: {
50
- get: {
51
- body: unknown;
52
- params: {};
53
- query: unknown;
54
- headers: unknown;
55
- response: {
56
- 200: {
57
- error: string;
58
- details: import("database/api/.generated/runtime/library").JsonValue;
59
- status: import("../../../../database/api/.generated").$Enums.RunStatus;
48
+ "campaign-status": {
49
+ engine: {
50
+ overlaps: {
51
+ get: {
52
+ body: unknown;
53
+ params: {};
54
+ query: {
60
55
  campaignId: string;
61
- computedUntil: bigint;
62
- processingStarted: bigint;
63
- }[];
56
+ distributionChain: number;
57
+ };
58
+ headers: {
59
+ authorization: string;
60
+ };
61
+ response: {
62
+ 200: boolean;
63
+ };
64
64
  };
65
65
  };
66
66
  };
67
67
  };
68
68
  } & {
69
- campaignStatus: {
70
- status: {
69
+ "campaign-status": {
70
+ index: {
71
71
  get: {
72
72
  body: unknown;
73
73
  params: {};
74
74
  query: {
75
- status: "PROCESSING" | "SUCCESS" | "FAILED" | "SKIPPED" | ("PROCESSING" | "SUCCESS" | "FAILED" | "SKIPPED")[];
75
+ status?: "PROCESSING" | "SUCCESS" | "FAILED" | "SKIPPED" | ("PROCESSING" | "SUCCESS" | "FAILED" | "SKIPPED")[] | undefined;
76
+ computeChainId?: number | undefined;
76
77
  };
77
78
  headers: unknown;
78
79
  response: {
79
- 200: ({
80
- Campaign: {
81
- type: import("../../../../database/api/.generated").$Enums.CampaignType;
82
- id: string;
83
- params: import("database/api/.generated/runtime/library").JsonValue;
84
- subType: number | null;
85
- startTimestamp: bigint;
86
- endTimestamp: bigint;
87
- computeChainId: number;
88
- distributionChainId: number;
89
- campaignId: string;
90
- rewardTokenId: string;
91
- amount: string;
92
- opportunityId: string;
93
- creatorAddress: string;
94
- };
95
- } & {
80
+ 200: {
96
81
  error: string;
97
82
  details: import("database/api/.generated/runtime/library").JsonValue;
98
83
  status: import("../../../../database/api/.generated").$Enums.RunStatus;
99
84
  campaignId: string;
100
85
  computedUntil: bigint;
101
86
  processingStarted: bigint;
102
- })[];
87
+ }[];
103
88
  };
104
89
  };
105
90
  };
106
91
  };
107
92
  } & {
108
- campaignStatus: {
109
- unique: {
93
+ "campaign-status": {
94
+ ":campaignId": {
110
95
  get: {
111
96
  body: unknown;
112
- params: {};
113
- query: {
97
+ params: {
114
98
  campaignId: string;
115
- distributionChain: number;
116
99
  };
100
+ query: unknown;
117
101
  headers: unknown;
118
102
  response: {
119
103
  200: {
@@ -128,52 +112,6 @@ export declare const StatusController: Elysia<"/campaignStatus", false, {
128
112
  };
129
113
  };
130
114
  };
131
- } & {
132
- campaignStatus: {
133
- computeChain: {
134
- ":chainId": {
135
- get: {
136
- body: unknown;
137
- params: {
138
- chainId: number;
139
- };
140
- query: unknown;
141
- headers: unknown;
142
- response: {
143
- 200: {
144
- error: string;
145
- details: import("database/api/.generated/runtime/library").JsonValue;
146
- status: import("../../../../database/api/.generated").$Enums.RunStatus;
147
- campaignId: string;
148
- computedUntil: bigint;
149
- processingStarted: bigint;
150
- }[];
151
- };
152
- };
153
- };
154
- };
155
- };
156
- } & {
157
- campaignStatus: {
158
- engine: {
159
- overlaps: {
160
- get: {
161
- body: unknown;
162
- params: {};
163
- query: {
164
- campaignId: string;
165
- distributionChain: number;
166
- };
167
- headers: {
168
- authorization: string;
169
- };
170
- response: {
171
- 200: boolean;
172
- };
173
- };
174
- };
175
- };
176
- };
177
115
  }, {
178
116
  derive: {};
179
117
  resolve: {};
@@ -1,36 +1,30 @@
1
1
  import { AuthorizationHeadersDto, EngineGuard } from "../../../guards/Engine.guard";
2
- import { throwOnUnsupportedChainId } from "../../../utils/throw";
3
2
  import Elysia from "elysia";
4
3
  import { CampaignUniqueDto } from "../campaign";
5
- import { ChainDto, RunStatusListDto, UpdateStatusDto } from "./status.model";
4
+ import { QueryCampaignStatusDto, UpdateCampaignStatusDto } from "./status.model";
6
5
  import { StatusService } from "./status.service";
7
- export const StatusController = new Elysia({ prefix: "/campaignStatus", detail: { tags: ["Status"] } })
6
+ export const StatusController = new Elysia({ prefix: "/campaign-status", detail: { tags: ["Status"] } })
8
7
  // ─── Update a Campaign Status ──────────────────────────────────────
9
- .post("/engine", async ({ body }) => await StatusService.update(body), {
8
+ .put("/engine/:campaignId", async ({ params, body }) => {
9
+ const [distributionChain, campaignId] = params.campaignId.split("-");
10
+ return await StatusService.update({ distributionChain: +distributionChain, campaignId }, body);
11
+ }, {
10
12
  beforeHandle: EngineGuard,
11
13
  headers: AuthorizationHeadersDto,
12
- body: UpdateStatusDto,
13
- })
14
- // ─── Get All Status ────────────────────────────────────────────────
15
- .get("/", async () => await StatusService.findMany())
16
- .get("/status", async ({ query }) => await StatusService.findManyByRunStatus(query), { query: RunStatusListDto })
17
- // ─── Get A Status By Id ────────────────────────────────────────────
18
- .get("/unique", async ({ query }) => await StatusService.findUniqueOrThrow(query), {
19
- query: CampaignUniqueDto,
20
- beforeHandle: ({ query }) => {
21
- throwOnUnsupportedChainId(query.distributionChain);
22
- },
23
- })
24
- // ─── Get All Status on a chain ─────────────────────────────────────
25
- .get("/computeChain/:chainId", async ({ params }) => await StatusService.findManyPerChain(params.chainId), {
26
- params: ChainDto,
27
- beforeHandle: ({ params }) => {
28
- throwOnUnsupportedChainId(params.chainId);
29
- },
14
+ body: UpdateCampaignStatusDto,
30
15
  })
31
16
  // ─── Is Safe For Overlaps ──────────────────────────────────────────
32
17
  .get("/engine/overlaps", async ({ query }) => await StatusService.isSafeForOverlaps(query), {
33
18
  beforeHandle: EngineGuard,
34
19
  headers: AuthorizationHeadersDto,
35
20
  query: CampaignUniqueDto,
21
+ })
22
+ // ─── Find Many Status ────────────────────────────────────────────────
23
+ .get("/", async ({ query }) => await StatusService.findMany(query), { query: QueryCampaignStatusDto })
24
+ // ─── Get A Status By Id ────────────────────────────────────────────
25
+ .get("/:campaignId", async ({ params }) => {
26
+ if (!params.campaignId.includes("-"))
27
+ return await StatusService.findUniqueOrThrow(params.campaignId);
28
+ const [distributionChain, campaignId] = params.campaignId.split("-");
29
+ return await StatusService.findUniqueOrThrow({ distributionChain: +distributionChain, campaignId });
36
30
  });
@@ -1,28 +1,35 @@
1
- export declare const ChainDto: import("@sinclair/typebox").TObject<{
2
- chainId: import("@sinclair/typebox").TNumber;
1
+ import type { Campaign } from "../campaign";
2
+ import type { Resource } from "../prisma";
3
+ export type Status = Resource<"CampaignStatus", "campaignId", {
4
+ campaign: Campaign["model"];
3
5
  }>;
4
- export declare const UpdateStatusDto: import("@sinclair/typebox").TObject<{
5
- distributionChain: import("@sinclair/typebox").TNumber;
6
- campaignId: import("@sinclair/typebox").TString;
7
- status: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
8
- value: import("@sinclair/typebox").TLiteral<"SUCCESS">;
9
- computedUntil: import("@sinclair/typebox").TNumber;
10
- }>, import("@sinclair/typebox").TObject<{
11
- value: import("@sinclair/typebox").TLiteral<"PROCESSING">;
12
- }>, import("@sinclair/typebox").TObject<{
13
- value: import("@sinclair/typebox").TLiteral<"SKIPPED">;
14
- error: import("@sinclair/typebox").TString;
15
- details: import("@sinclair/typebox").TString;
16
- }>, import("@sinclair/typebox").TObject<{
17
- value: import("@sinclair/typebox").TLiteral<"FAILED">;
18
- error: import("@sinclair/typebox").TString;
19
- details: import("@sinclair/typebox").TString;
20
- }>]>;
6
+ export declare const UpdateCampaignStatusDto: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
7
+ value: import("@sinclair/typebox").TLiteral<"SUCCESS">;
8
+ computedUntil: import("@sinclair/typebox").TNumber;
9
+ }>, import("@sinclair/typebox").TObject<{
10
+ value: import("@sinclair/typebox").TLiteral<"PROCESSING">;
11
+ }>, import("@sinclair/typebox").TObject<{
12
+ value: import("@sinclair/typebox").TLiteral<"SKIPPED">;
13
+ error: import("@sinclair/typebox").TString;
14
+ details: import("@sinclair/typebox").TString;
15
+ }>, import("@sinclair/typebox").TObject<{
16
+ value: import("@sinclair/typebox").TLiteral<"FAILED">;
17
+ error: import("@sinclair/typebox").TString;
18
+ details: import("@sinclair/typebox").TString;
19
+ }>]>;
20
+ export declare const QueryCampaignStatusDto: import("@sinclair/typebox").TObject<{
21
+ computeChainId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
22
+ status: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TArray<import("@sinclair/typebox").TEnum<{
23
+ PROCESSING: "PROCESSING";
24
+ SUCCESS: "SUCCESS";
25
+ FAILED: "FAILED";
26
+ SKIPPED: "SKIPPED";
27
+ }>>, import("@sinclair/typebox").TEnum<{
28
+ PROCESSING: "PROCESSING";
29
+ SUCCESS: "SUCCESS";
30
+ FAILED: "FAILED";
31
+ SKIPPED: "SKIPPED";
32
+ }>]>>;
21
33
  }>;
22
- export declare const RunStatusDto: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"SUCCESS">, import("@sinclair/typebox").TLiteral<"FAILED">, import("@sinclair/typebox").TLiteral<"PROCESSING">, import("@sinclair/typebox").TLiteral<"SKIPPED">]>;
23
- export declare const RunStatusListDto: import("@sinclair/typebox").TObject<{
24
- status: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"SUCCESS">, import("@sinclair/typebox").TLiteral<"FAILED">, import("@sinclair/typebox").TLiteral<"PROCESSING">, import("@sinclair/typebox").TLiteral<"SKIPPED">]>>, import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"SUCCESS">, import("@sinclair/typebox").TLiteral<"FAILED">, import("@sinclair/typebox").TLiteral<"PROCESSING">, import("@sinclair/typebox").TLiteral<"SKIPPED">]>]>;
25
- }>;
26
- export type ChainModel = typeof ChainDto.static;
27
- export type RunStatusListModel = typeof RunStatusListDto.static;
28
- export type UpdateStatusModel = typeof UpdateStatusDto.static;
34
+ export type UpdateStatusModel = typeof UpdateCampaignStatusDto.static;
35
+ export type QueryCampaignStatus = typeof QueryCampaignStatusDto.static;
@@ -1,24 +1,13 @@
1
1
  import { RunStatus } from "../../../../database/api/.generated";
2
2
  import { t } from "elysia";
3
- export const ChainDto = t.Object({
4
- chainId: t.Numeric(),
5
- });
6
- export const UpdateStatusDto = t.Object({
7
- distributionChain: t.Numeric(),
8
- campaignId: t.String(), // Identifier of the campaign
9
- status: t.Union([
10
- t.Object({ value: t.Literal(RunStatus.SUCCESS), computedUntil: t.Numeric() }),
11
- t.Object({ value: t.Literal(RunStatus.PROCESSING) }),
12
- t.Object({ value: t.Literal(RunStatus.SKIPPED), error: t.String(), details: t.String() }),
13
- t.Object({ value: t.Literal(RunStatus.FAILED), error: t.String(), details: t.String() }),
14
- ]),
15
- });
16
- export const RunStatusDto = t.Union([
17
- t.Literal(RunStatus.SUCCESS),
18
- t.Literal(RunStatus.FAILED),
19
- t.Literal(RunStatus.PROCESSING),
20
- t.Literal(RunStatus.SKIPPED),
3
+ // ─── DTOs ────────────────────────────────────────────────────────────────────
4
+ export const UpdateCampaignStatusDto = t.Union([
5
+ t.Object({ value: t.Literal(RunStatus.SUCCESS), computedUntil: t.Numeric() }),
6
+ t.Object({ value: t.Literal(RunStatus.PROCESSING) }),
7
+ t.Object({ value: t.Literal(RunStatus.SKIPPED), error: t.String(), details: t.String() }),
8
+ t.Object({ value: t.Literal(RunStatus.FAILED), error: t.String(), details: t.String() }),
21
9
  ]);
22
- export const RunStatusListDto = t.Object({
23
- status: t.Union([t.Array(RunStatusDto), RunStatusDto]),
10
+ export const QueryCampaignStatusDto = t.Object({
11
+ computeChainId: t.Optional(t.Numeric()),
12
+ status: t.Optional(t.Union([t.Array(t.Enum(RunStatus)), t.Enum(RunStatus)])),
24
13
  });
@@ -1,49 +1,19 @@
1
- import type { RunStatus } from "../../../../database/api/.generated";
1
+ import type { Prisma, RunStatus } from "../../../../database/api/.generated";
2
2
  import { type CampaignUnique } from "../campaign";
3
+ import type { QueryCampaignStatus } from "./status.model";
3
4
  export declare class StatusRepository {
4
- static findMany(): Promise<{
5
+ #private;
6
+ static findMany(query: QueryCampaignStatus): Promise<{
5
7
  error: string;
6
- details: import("database/api/.generated/runtime/library").JsonValue;
8
+ details: Prisma.JsonValue;
7
9
  status: import("../../../../database/api/.generated").$Enums.RunStatus;
8
10
  campaignId: string;
9
11
  computedUntil: bigint;
10
12
  processingStarted: bigint;
11
13
  }[]>;
12
- static findManyByRunStatus(statuses: RunStatus[]): Promise<({
13
- Campaign: {
14
- type: import("../../../../database/api/.generated").$Enums.CampaignType;
15
- id: string;
16
- params: import("database/api/.generated/runtime/library").JsonValue;
17
- subType: number | null;
18
- startTimestamp: bigint;
19
- endTimestamp: bigint;
20
- computeChainId: number;
21
- distributionChainId: number;
22
- campaignId: string;
23
- rewardTokenId: string;
24
- amount: string;
25
- opportunityId: string;
26
- creatorAddress: string;
27
- };
28
- } & {
14
+ static findUniqueOrThrow(campaignId: string): Promise<{
29
15
  error: string;
30
- details: import("database/api/.generated/runtime/library").JsonValue;
31
- status: import("../../../../database/api/.generated").$Enums.RunStatus;
32
- campaignId: string;
33
- computedUntil: bigint;
34
- processingStarted: bigint;
35
- })[]>;
36
- static findManyPerChain(chainId: number): Promise<{
37
- error: string;
38
- details: import("database/api/.generated/runtime/library").JsonValue;
39
- status: import("../../../../database/api/.generated").$Enums.RunStatus;
40
- campaignId: string;
41
- computedUntil: bigint;
42
- processingStarted: bigint;
43
- }[]>;
44
- static findUniqueOrThrow(campaignUnique: CampaignUnique): Promise<{
45
- error: string;
46
- details: import("database/api/.generated/runtime/library").JsonValue;
16
+ details: Prisma.JsonValue;
47
17
  status: import("../../../../database/api/.generated").$Enums.RunStatus;
48
18
  campaignId: string;
49
19
  computedUntil: bigint;
@@ -51,7 +21,7 @@ export declare class StatusRepository {
51
21
  }>;
52
22
  static findUnique(campaignUnique: CampaignUnique): Promise<{
53
23
  error: string;
54
- details: import("database/api/.generated/runtime/library").JsonValue;
24
+ details: Prisma.JsonValue;
55
25
  status: import("../../../../database/api/.generated").$Enums.RunStatus;
56
26
  campaignId: string;
57
27
  computedUntil: bigint;
@@ -59,7 +29,7 @@ export declare class StatusRepository {
59
29
  } | null>;
60
30
  static create(campaign: CampaignUnique, startTimestamp: bigint): Promise<{
61
31
  error: string;
62
- details: import("database/api/.generated/runtime/library").JsonValue;
32
+ details: Prisma.JsonValue;
63
33
  status: import("../../../../database/api/.generated").$Enums.RunStatus;
64
34
  campaignId: string;
65
35
  computedUntil: bigint;
@@ -67,7 +37,7 @@ export declare class StatusRepository {
67
37
  }>;
68
38
  static updateSuccess(campaignUnique: CampaignUnique, computedUntil: number): Promise<{
69
39
  error: string;
70
- details: import("database/api/.generated/runtime/library").JsonValue;
40
+ details: Prisma.JsonValue;
71
41
  status: import("../../../../database/api/.generated").$Enums.RunStatus;
72
42
  campaignId: string;
73
43
  computedUntil: bigint;
@@ -75,7 +45,7 @@ export declare class StatusRepository {
75
45
  }>;
76
46
  static updateWithError(campaignUnique: CampaignUnique, status: Exclude<RunStatus, "SUCCESS" | "PROCESSING">, error: string, details: string): Promise<{
77
47
  error: string;
78
- details: import("database/api/.generated/runtime/library").JsonValue;
48
+ details: Prisma.JsonValue;
79
49
  status: import("../../../../database/api/.generated").$Enums.RunStatus;
80
50
  campaignId: string;
81
51
  computedUntil: bigint;
@@ -83,7 +53,7 @@ export declare class StatusRepository {
83
53
  }>;
84
54
  static updateProcessing(campaignUnique: CampaignUnique): Promise<{
85
55
  error: string;
86
- details: import("database/api/.generated/runtime/library").JsonValue;
56
+ details: Prisma.JsonValue;
87
57
  status: import("../../../../database/api/.generated").$Enums.RunStatus;
88
58
  campaignId: string;
89
59
  computedUntil: bigint;
@@ -2,34 +2,22 @@ import { apiDbClient } from "../../../utils/prisma";
2
2
  import moment from "moment";
3
3
  import { CampaignService } from "../campaign";
4
4
  export class StatusRepository {
5
- static async findMany() {
6
- return await apiDbClient.campaignStatus.findMany();
7
- }
8
- static async findManyByRunStatus(statuses) {
9
- return await apiDbClient.campaignStatus.findMany({
5
+ static #formatQuery(query) {
6
+ return {
10
7
  where: {
11
- status: {
12
- in: statuses,
13
- },
8
+ status: Array.isArray(query.status) ? { in: query.status } : query.status,
9
+ Campaign: query.computeChainId ? { computeChainId: query.computeChainId } : undefined,
14
10
  },
15
- include: {
16
- Campaign: true,
17
- },
18
- });
11
+ include: { Campaign: Boolean(query.status) },
12
+ };
19
13
  }
20
- static async findManyPerChain(chainId) {
21
- return await apiDbClient.campaignStatus.findMany({
22
- where: {
23
- Campaign: {
24
- computeChainId: chainId,
25
- },
26
- },
27
- });
14
+ static async findMany(query) {
15
+ return await apiDbClient.campaignStatus.findMany(StatusRepository.#formatQuery(query));
28
16
  }
29
- static async findUniqueOrThrow(campaignUnique) {
17
+ static async findUniqueOrThrow(campaignId) {
30
18
  return await apiDbClient.campaignStatus.findUniqueOrThrow({
31
19
  where: {
32
- campaignId: CampaignService.hashId(campaignUnique),
20
+ campaignId,
33
21
  },
34
22
  });
35
23
  }
@@ -1,7 +1,7 @@
1
1
  import { type CampaignUnique } from "../campaign";
2
- import type { RunStatusListModel, UpdateStatusModel } from "./status.model";
2
+ import type { QueryCampaignStatus, UpdateStatusModel } from "./status.model";
3
3
  export declare class StatusService {
4
- static findMany(): Promise<{
4
+ static findMany(query: QueryCampaignStatus): Promise<{
5
5
  error: string;
6
6
  details: import("database/api/.generated/runtime/library").JsonValue;
7
7
  status: import("../../../../database/api/.generated").$Enums.RunStatus;
@@ -9,39 +9,7 @@ export declare class StatusService {
9
9
  computedUntil: bigint;
10
10
  processingStarted: bigint;
11
11
  }[]>;
12
- static findManyByRunStatus(x: RunStatusListModel): Promise<({
13
- Campaign: {
14
- type: import("../../../../database/api/.generated").$Enums.CampaignType;
15
- id: string;
16
- params: import("database/api/.generated/runtime/library").JsonValue;
17
- subType: number | null;
18
- startTimestamp: bigint;
19
- endTimestamp: bigint;
20
- computeChainId: number;
21
- distributionChainId: number;
22
- campaignId: string;
23
- rewardTokenId: string;
24
- amount: string;
25
- opportunityId: string;
26
- creatorAddress: string;
27
- };
28
- } & {
29
- error: string;
30
- details: import("database/api/.generated/runtime/library").JsonValue;
31
- status: import("../../../../database/api/.generated").$Enums.RunStatus;
32
- campaignId: string;
33
- computedUntil: bigint;
34
- processingStarted: bigint;
35
- })[]>;
36
- static findManyPerChain(chainId: number): Promise<{
37
- error: string;
38
- details: import("database/api/.generated/runtime/library").JsonValue;
39
- status: import("../../../../database/api/.generated").$Enums.RunStatus;
40
- campaignId: string;
41
- computedUntil: bigint;
42
- processingStarted: bigint;
43
- }[]>;
44
- static findUniqueOrThrow(campaignUnique: CampaignUnique): Promise<{
12
+ static findUniqueOrThrow(campaignUnique: CampaignUnique | string): Promise<{
45
13
  error: string;
46
14
  details: import("database/api/.generated/runtime/library").JsonValue;
47
15
  status: import("../../../../database/api/.generated").$Enums.RunStatus;
@@ -57,6 +25,6 @@ export declare class StatusService {
57
25
  computedUntil: bigint;
58
26
  processingStarted: bigint;
59
27
  } | null>;
60
- static update(x: UpdateStatusModel): Promise<void>;
28
+ static update(campaignUnique: CampaignUnique, status: UpdateStatusModel): Promise<void>;
61
29
  static isSafeForOverlaps(campaignUnique: CampaignUnique): Promise<boolean>;
62
30
  }
@@ -4,27 +4,18 @@ import moment from "moment";
4
4
  import { CampaignService } from "../campaign";
5
5
  import { StatusRepository } from "./status.repository";
6
6
  export class StatusService {
7
- static async findMany() {
8
- return await StatusRepository.findMany();
9
- }
10
- static async findManyByRunStatus(x) {
11
- return await StatusRepository.findManyByRunStatus(typeof x.status === "string" ? [x.status] : x.status);
12
- }
13
- static async findManyPerChain(chainId) {
14
- return await StatusRepository.findManyPerChain(chainId);
7
+ static async findMany(query) {
8
+ return await StatusRepository.findMany(query);
15
9
  }
16
10
  static async findUniqueOrThrow(campaignUnique) {
17
- return await StatusRepository.findUniqueOrThrow(campaignUnique);
11
+ const campaignId = typeof campaignUnique === "string" ? campaignUnique : CampaignService.hashId(campaignUnique);
12
+ return await StatusRepository.findUniqueOrThrow(campaignId);
18
13
  }
19
14
  static async findUnique(campaignUnique) {
20
15
  return await StatusRepository.findUnique(campaignUnique);
21
16
  }
22
- static async update(x) {
17
+ static async update(campaignUnique, status) {
23
18
  // Check if the status exists already, otherwise create it
24
- const campaignUnique = {
25
- distributionChain: x.distributionChain,
26
- campaignId: x.campaignId,
27
- };
28
19
  const campaignExists = await StatusRepository.findUnique(campaignUnique);
29
20
  if (!campaignExists) {
30
21
  let campaign = await CampaignService.findUnique(campaignUnique);
@@ -35,18 +26,18 @@ export class StatusService {
35
26
  await StatusRepository.create(campaignUnique, campaign.startTimestamp);
36
27
  }
37
28
  // Update the run status
38
- switch (x.status.value) {
29
+ switch (status.value) {
39
30
  case RunStatus.SUCCESS:
40
- await StatusRepository.updateSuccess(campaignUnique, x.status.computedUntil);
31
+ await StatusRepository.updateSuccess(campaignUnique, status.computedUntil);
41
32
  return;
42
33
  case RunStatus.PROCESSING:
43
34
  await StatusRepository.updateProcessing(campaignUnique);
44
35
  return;
45
36
  case RunStatus.SKIPPED:
46
- await StatusRepository.updateWithError(campaignUnique, x.status.value, x.status.error, x.status.details);
37
+ await StatusRepository.updateWithError(campaignUnique, status.value, status.error, status.details);
47
38
  return;
48
39
  case RunStatus.FAILED:
49
- await StatusRepository.updateWithError(campaignUnique, x.status.value, x.status.error, x.status.details);
40
+ await StatusRepository.updateWithError(campaignUnique, status.value, status.error, status.details);
50
41
  return;
51
42
  }
52
43
  }
@@ -12,7 +12,7 @@ export declare const uniswapV4Controller: Elysia<"", false, {
12
12
  macro: {};
13
13
  macroFn: {};
14
14
  }, {
15
- uniswapV4: {
15
+ "uniswap-v4": {
16
16
  pools: {
17
17
  get: {
18
18
  body: unknown;
@@ -1,6 +1,6 @@
1
1
  import Elysia, { t } from "elysia";
2
2
  import { UniswapV4Service } from "./uniswapV4.service";
3
- export const uniswapV4Controller = new Elysia().group("uniswapV4", app => {
3
+ export const uniswapV4Controller = new Elysia().group("uniswap-v4", app => {
4
4
  return app.get("/pools", async ({ query }) => {
5
5
  return await UniswapV4Service.getPoolsByChain(query.chainId);
6
6
  }, {