@merkl/api 0.16.31 → 0.16.33

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 (39) hide show
  1. package/dist/src/eden/index.d.ts +308 -63
  2. package/dist/src/index.d.ts +64 -19
  3. package/dist/src/libs/campaigns/campaignTypes/ERC20DynamicData.js +6 -2
  4. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/GenericProcessor.d.ts +16 -1
  5. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/GenericProcessor.js +84 -10
  6. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/ownerFinder.js +1 -0
  7. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.d.ts +2 -2
  8. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.js +3 -3
  9. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/implementations/HanjiVaultProcessor.d.ts +43 -0
  10. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/implementations/HanjiVaultProcessor.js +58 -0
  11. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/implementations/curveNPoolProcessor.js +0 -1
  12. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/implementations/processorMapping.js +2 -2
  13. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1.d.ts +1 -1
  14. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1.js +17 -19
  15. package/dist/src/libs/campaigns/campaignTypes/RadiantDynamicData.js +13 -2
  16. package/dist/src/modules/v4/boost/boost.controller.d.ts +0 -19
  17. package/dist/src/modules/v4/boost/boost.controller.js +1 -2
  18. package/dist/src/modules/v4/boost/boost.service.d.ts +0 -4
  19. package/dist/src/modules/v4/boost/boost.service.js +0 -23
  20. package/dist/src/modules/v4/campaign/campaign.controller.d.ts +64 -0
  21. package/dist/src/modules/v4/campaign/campaign.controller.js +20 -0
  22. package/dist/src/modules/v4/campaign/campaign.repository.d.ts +37 -0
  23. package/dist/src/modules/v4/campaign/campaign.repository.js +7 -0
  24. package/dist/src/modules/v4/campaign/campaign.service.d.ts +37 -0
  25. package/dist/src/modules/v4/opportunity/opportunity.service.js +1 -1
  26. package/dist/src/modules/v4/programPayload/programPayload.repository.d.ts +69 -318
  27. package/dist/src/modules/v4/programPayload/programPayload.repository.js +237 -54
  28. package/dist/src/modules/v4/router.d.ts +64 -19
  29. package/dist/src/utils/decodeCalls.js +7 -1
  30. package/dist/src/utils/encodeCalls.js +17 -1
  31. package/dist/src/utils/generateCardName.d.ts +3 -0
  32. package/dist/src/utils/generateCardName.js +25 -3
  33. package/dist/src/utils/generateIcons.js +5 -0
  34. package/dist/tsconfig.package.tsbuildinfo +1 -1
  35. package/package.json +1 -1
  36. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/implementations/StakingProcessor.d.ts +0 -41
  37. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/implementations/StakingProcessor.js +0 -70
  38. package/dist/src/libs/campaigns/utils/getLastEligibilityRatio.d.ts +0 -2
  39. package/dist/src/libs/campaigns/utils/getLastEligibilityRatio.js +0 -65
@@ -185,6 +185,70 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
185
185
  };
186
186
  };
187
187
  };
188
+ } & {
189
+ ":id": {
190
+ get: {
191
+ body: unknown;
192
+ params: {
193
+ id: string;
194
+ };
195
+ query: unknown;
196
+ headers: unknown;
197
+ response: {
198
+ 200: {
199
+ params: any;
200
+ chain: {
201
+ name: string;
202
+ id: number;
203
+ icon: string;
204
+ };
205
+ rewardToken: {
206
+ symbol: string;
207
+ name: string | null;
208
+ id: string;
209
+ icon: string;
210
+ chainId: number;
211
+ address: string;
212
+ decimals: number;
213
+ verified: boolean;
214
+ isTest: boolean;
215
+ } & {
216
+ price?: number | null | undefined;
217
+ };
218
+ distributionChain: {
219
+ name: string;
220
+ id: number;
221
+ icon: string;
222
+ } | undefined;
223
+ campaignStatus: {
224
+ error: string;
225
+ details: import("database/api/.generated/runtime/library").JsonValue;
226
+ status: import("../../../../database/api/.generated").$Enums.RunStatus;
227
+ campaignId: string;
228
+ computedUntil: bigint;
229
+ processingStarted: bigint;
230
+ };
231
+ creatorAddress: string;
232
+ Creator: {
233
+ tags: string[];
234
+ address: string;
235
+ creatorId: string | null;
236
+ };
237
+ type: string;
238
+ id: string;
239
+ subType: number | null;
240
+ startTimestamp: bigint;
241
+ endTimestamp: bigint;
242
+ computeChainId: number;
243
+ distributionChainId: number;
244
+ campaignId: string;
245
+ rewardTokenId: string;
246
+ amount: string;
247
+ opportunityId: string;
248
+ };
249
+ };
250
+ };
251
+ };
188
252
  } & {
189
253
  count: {
190
254
  get: {
@@ -1,3 +1,4 @@
1
+ import { NotFoundError } from "../../../errors";
1
2
  import { BackOfficeGuard } from "../../../guards/BackOffice.guard";
2
3
  import { AuthorizationHeadersDto, EngineGuard } from "../../../guards/Engine.guard";
3
4
  import Elysia, { t } from "elysia";
@@ -34,6 +35,25 @@ export const CampaignController = new Elysia({ prefix: "/campaigns", detail: { t
34
35
  description: `**Retrieve Multiple Campaigns**
35
36
  <p>This endpoint enables you to search for campaigns by providing specific criteria through query parameters.</p>`,
36
37
  },
38
+ })
39
+ // ─── Get One Campaign ────────────────────────────────────────────────
40
+ .get("/:id", async ({ params }) => {
41
+ try {
42
+ if (!params.id.includes("-"))
43
+ return CampaignService.format(await CampaignService.findUniqueOrThrow(params.id));
44
+ const [distributionChain, campaignId] = params.id.split("-");
45
+ return CampaignService.format(await CampaignService.findUniqueOrThrow({ distributionChain: +distributionChain, campaignId }));
46
+ }
47
+ catch (_err) {
48
+ throw new NotFoundError("Campaign not found.");
49
+ }
50
+ }, {
51
+ params: t.Object({ id: t.String() }),
52
+ response: CampaignResourceDto,
53
+ detail: {
54
+ description: `**Retrieve A Campaign**
55
+ <p>This endpoint enables you to retrieve a campaign by providing its unique identifier.</p>`,
56
+ },
37
57
  })
38
58
  // ─── Get Total Campaigns Count ───────────────────────────────────────
39
59
  .get("/count", async ({ query }) => await CampaignService.countMany(query), {
@@ -124,6 +124,43 @@ export declare abstract class CampaignRepository {
124
124
  creatorAddress: string;
125
125
  } | null>;
126
126
  static findUniqueOrThrow(id: string): Promise<{
127
+ ComputeChain: {
128
+ name: string;
129
+ id: number;
130
+ icon: string;
131
+ };
132
+ DistributionChain: {
133
+ name: string;
134
+ id: number;
135
+ icon: string;
136
+ };
137
+ RewardToken: {
138
+ symbol: string;
139
+ name: string | null;
140
+ id: string;
141
+ icon: string;
142
+ chainId: number;
143
+ address: string;
144
+ decimals: number;
145
+ displaySymbol: string;
146
+ verified: boolean;
147
+ isTest: boolean;
148
+ price: number | null;
149
+ };
150
+ Creator: {
151
+ tags: string[];
152
+ address: string;
153
+ creatorId: string | null;
154
+ };
155
+ CampaignStatus: {
156
+ error: string;
157
+ details: Prisma.JsonValue;
158
+ status: import("../../../../database/api/.generated").$Enums.RunStatus;
159
+ campaignId: string;
160
+ computedUntil: bigint;
161
+ processingStarted: bigint;
162
+ }[];
163
+ } & {
127
164
  type: string;
128
165
  id: string;
129
166
  params: Prisma.JsonValue;
@@ -214,6 +214,13 @@ export class CampaignRepository {
214
214
  }
215
215
  static async findUniqueOrThrow(id) {
216
216
  return await apiDbClient.campaign.findUniqueOrThrow({
217
+ include: {
218
+ DistributionChain: true,
219
+ ComputeChain: true,
220
+ RewardToken: true,
221
+ CampaignStatus: true,
222
+ Creator: true,
223
+ },
217
224
  where: {
218
225
  id,
219
226
  },
@@ -127,6 +127,43 @@ export declare abstract class CampaignService {
127
127
  creatorAddress: string;
128
128
  } | null>;
129
129
  static findUniqueOrThrow(campaign: CampaignUnique | string): Promise<{
130
+ ComputeChain: {
131
+ name: string;
132
+ id: number;
133
+ icon: string;
134
+ };
135
+ DistributionChain: {
136
+ name: string;
137
+ id: number;
138
+ icon: string;
139
+ };
140
+ RewardToken: {
141
+ symbol: string;
142
+ name: string | null;
143
+ id: string;
144
+ icon: string;
145
+ chainId: number;
146
+ address: string;
147
+ decimals: number;
148
+ displaySymbol: string;
149
+ verified: boolean;
150
+ isTest: boolean;
151
+ price: number | null;
152
+ };
153
+ Creator: {
154
+ tags: string[];
155
+ address: string;
156
+ creatorId: string | null;
157
+ };
158
+ CampaignStatus: {
159
+ error: string;
160
+ details: import("database/api/.generated/runtime/library").JsonValue;
161
+ status: import("../../../../database/api/.generated").$Enums.RunStatus;
162
+ campaignId: string;
163
+ computedUntil: bigint;
164
+ processingStarted: bigint;
165
+ }[];
166
+ } & {
130
167
  type: string;
131
168
  id: string;
132
169
  params: import("database/api/.generated/runtime/library").JsonValue;
@@ -203,7 +203,7 @@ export class OpportunityService {
203
203
  const opportunity = await OpportunityRepository.findUnique(id);
204
204
  if (!opportunity)
205
205
  throw new NotFoundError();
206
- const firstCampaign = opportunity?.Campaigns.filter(campaign => campaignId ? campaign.campaignId === campaignId : true)[0];
206
+ const firstCampaign = opportunity?.Campaigns.filter(campaign => campaignId ? campaign.campaignId === campaignId : true).sort((a, b) => Number(b.endTimestamp) - Number(a.endTimestamp))[0];
207
207
  return await OpportunityService.createFromCampaign({
208
208
  ...firstCampaign,
209
209
  type: CampaignEnum[firstCampaign.type],