@merkl/api 0.20.171 → 0.20.173

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 (37) hide show
  1. package/dist/database/api/.generated/drizzle/schema.d.ts +57 -0
  2. package/dist/database/api/.generated/drizzle/schema.js +52 -4
  3. package/dist/database/api/.generated/drizzle/schema.ts +52 -4
  4. package/dist/database/api/.generated/edge.js +13 -7
  5. package/dist/database/api/.generated/index-browser.js +10 -4
  6. package/dist/database/api/.generated/index.d.ts +1624 -39
  7. package/dist/database/api/.generated/index.js +13 -7
  8. package/dist/database/api/.generated/package.json +1 -1
  9. package/dist/database/api/.generated/schema.prisma +23 -13
  10. package/dist/database/api/.generated/wasm.js +10 -4
  11. package/dist/src/eden/index.d.ts +430 -315
  12. package/dist/src/engine/deprecated/dynamicData/factory.js +0 -1
  13. package/dist/src/engine/metadata/factory.js +0 -1
  14. package/dist/src/index.d.ts +146 -105
  15. package/dist/src/modules/v4/campaign/campaign.controller.d.ts +133 -105
  16. package/dist/src/modules/v4/campaign/campaign.controller.js +7 -3
  17. package/dist/src/modules/v4/campaign/campaign.model.d.ts +8 -0
  18. package/dist/src/modules/v4/campaign/campaign.model.js +10 -0
  19. package/dist/src/modules/v4/campaign/campaign.repository.d.ts +48 -0
  20. package/dist/src/modules/v4/campaign/campaign.repository.js +3 -1
  21. package/dist/src/modules/v4/campaign/campaign.service.d.ts +24 -0
  22. package/dist/src/modules/v4/campaign/campaign.service.js +5 -1
  23. package/dist/src/modules/v4/campaign/campaign.test.controller.d.ts +4 -0
  24. package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +8 -0
  25. package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +2 -0
  26. package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +10 -0
  27. package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +10 -0
  28. package/dist/src/modules/v4/protocol/protocol.repository.d.ts +2 -0
  29. package/dist/src/modules/v4/reward/reward.controller.js +5 -9
  30. package/dist/src/modules/v4/reward/reward.model.d.ts +3 -1
  31. package/dist/src/modules/v4/reward/reward.repository.d.ts +2 -0
  32. package/dist/src/modules/v4/reward/reward.service.d.ts +9 -0
  33. package/dist/src/modules/v4/reward/reward.service.js +2 -1
  34. package/dist/src/modules/v4/router.d.ts +146 -105
  35. package/dist/src/modules/v4/user/user.controller.d.ts +3 -0
  36. package/dist/tsconfig.package.tsbuildinfo +1 -1
  37. package/package.json +1 -1
@@ -48,6 +48,8 @@ export declare abstract class CampaignService {
48
48
  creatorAddress: string;
49
49
  manualOverrides: import("@db/api").$Enums.CampaignManualOverride[];
50
50
  createdAt: Date;
51
+ rootCampaignId: string | null;
52
+ parentCampaignId: string | null;
51
53
  })[]>;
52
54
  static getFutureCampaigns(query?: {
53
55
  computeChainId?: number;
@@ -91,6 +93,8 @@ export declare abstract class CampaignService {
91
93
  creatorAddress: string;
92
94
  manualOverrides: import("@db/api").$Enums.CampaignManualOverride[];
93
95
  createdAt: Date;
96
+ rootCampaignId: string | null;
97
+ parentCampaignId: string | null;
94
98
  })[]>;
95
99
  static getLiveCampaigns(query?: {
96
100
  distributionChainId?: number;
@@ -151,6 +155,8 @@ export declare abstract class CampaignService {
151
155
  creatorAddress: string;
152
156
  manualOverrides: import("@db/api").$Enums.CampaignManualOverride[];
153
157
  createdAt: Date;
158
+ rootCampaignId: string | null;
159
+ parentCampaignId: string | null;
154
160
  })[]>;
155
161
  static countLives(query?: {
156
162
  distributionChainId?: number;
@@ -175,6 +181,8 @@ export declare abstract class CampaignService {
175
181
  creatorAddress: string;
176
182
  manualOverrides: import("@db/api").$Enums.CampaignManualOverride[];
177
183
  createdAt: Date;
184
+ rootCampaignId: string | null;
185
+ parentCampaignId: string | null;
178
186
  } | ({
179
187
  Tokens: {
180
188
  symbol: string;
@@ -272,6 +280,8 @@ export declare abstract class CampaignService {
272
280
  creatorAddress: string;
273
281
  manualOverrides: import("@db/api").$Enums.CampaignManualOverride[];
274
282
  createdAt: Date;
283
+ rootCampaignId: string | null;
284
+ parentCampaignId: string | null;
275
285
  }>;
276
286
  /**
277
287
  * @dev back-office function for manual overrides
@@ -332,6 +342,8 @@ export declare abstract class CampaignService {
332
342
  };
333
343
  createdAt: string;
334
344
  description: string | undefined;
345
+ parentCampaignId: string | undefined;
346
+ rootCampaignId: string | undefined;
335
347
  Opportunity: {
336
348
  status: import("@db/api").$Enums.Status;
337
349
  type: string;
@@ -409,6 +421,8 @@ export declare abstract class CampaignService {
409
421
  };
410
422
  createdAt: string;
411
423
  description: string | undefined;
424
+ parentCampaignId: string | undefined;
425
+ rootCampaignId: string | undefined;
412
426
  Opportunity: {
413
427
  status: import("@db/api").$Enums.Status;
414
428
  type: string;
@@ -487,6 +501,8 @@ export declare abstract class CampaignService {
487
501
  };
488
502
  createdAt: string;
489
503
  description: string | undefined;
504
+ parentCampaignId: string | undefined;
505
+ rootCampaignId: string | undefined;
490
506
  Opportunity: {
491
507
  status: import("@db/api").$Enums.Status;
492
508
  type: string;
@@ -565,6 +581,8 @@ export declare abstract class CampaignService {
565
581
  };
566
582
  createdAt: string;
567
583
  description: string | undefined;
584
+ parentCampaignId: string | undefined;
585
+ rootCampaignId: string | undefined;
568
586
  Opportunity: {
569
587
  status: import("@db/api").$Enums.Status;
570
588
  type: string;
@@ -664,6 +682,8 @@ export declare abstract class CampaignService {
664
682
  creatorAddress: string;
665
683
  manualOverrides: import("@db/api").$Enums.CampaignManualOverride[];
666
684
  createdAt: Date;
685
+ rootCampaignId: string | null;
686
+ parentCampaignId: string | null;
667
687
  }) | null>;
668
688
  static findUniqueOrThrow(campaign: CampaignUnique | string, withOpportunity?: boolean): Promise<{
669
689
  ComputeChain: {
@@ -743,6 +763,8 @@ export declare abstract class CampaignService {
743
763
  creatorAddress: string;
744
764
  manualOverrides: import("@db/api").$Enums.CampaignManualOverride[];
745
765
  createdAt: Date;
766
+ rootCampaignId: string | null;
767
+ parentCampaignId: string | null;
746
768
  }>;
747
769
  static findCampaignValue(params: GetCampaignComputedValueModel): Promise<{
748
770
  averageBoost: number | null;
@@ -856,6 +878,8 @@ export declare abstract class CampaignService {
856
878
  };
857
879
  createdAt: string;
858
880
  description: string | undefined;
881
+ parentCampaignId: string | undefined;
882
+ rootCampaignId: string | undefined;
859
883
  Opportunity: {
860
884
  status: import("@db/api").$Enums.Status;
861
885
  type: string;
@@ -61,6 +61,8 @@ export class CampaignService {
61
61
  creatorAddress: body.creator,
62
62
  createdAt: new Date().toISOString(),
63
63
  chain,
64
+ parentCampaignId: body.parentCampaignId,
65
+ rootCampaignId: body.rootCampaignId,
64
66
  };
65
67
  // Separate Worldchain ID only campaign opportunities
66
68
  if (campaign.params.hooks?.some(hook => hook.hookType === HOOK.WORLDCHAINID)) {
@@ -304,7 +306,7 @@ export class CampaignService {
304
306
  * TODO: remove CampaignService function in favor of prisma client extensions
305
307
  */
306
308
  static format(campaign) {
307
- const { DistributionChain, ComputeChain, Creator, RewardToken, params, CampaignStatus, createdAt, manualOverrides: _, description, ...c } = campaign;
309
+ const { DistributionChain, ComputeChain, Creator, RewardToken, params, CampaignStatus, createdAt, manualOverrides: _, description, parentCampaignId, rootCampaignId, ...c } = campaign;
308
310
  const updatedParams = params;
309
311
  return {
310
312
  ...c,
@@ -320,6 +322,8 @@ export class CampaignService {
320
322
  creator: Creator,
321
323
  createdAt: createdAt.toISOString(),
322
324
  description: !!description ? description : undefined,
325
+ parentCampaignId: parentCampaignId ?? undefined,
326
+ rootCampaignId: rootCampaignId ?? undefined,
323
327
  };
324
328
  }
325
329
  /**
@@ -170,6 +170,8 @@ export declare const CampaignTestController: Elysia<"/campaigns", false, {
170
170
  creatorAddress: string;
171
171
  manualOverrides: import("@db/api").$Enums.CampaignManualOverride[];
172
172
  createdAt: Date;
173
+ rootCampaignId: string | null;
174
+ parentCampaignId: string | null;
173
175
  } | {
174
176
  Tokens: {
175
177
  symbol: string;
@@ -280,6 +282,8 @@ export declare const CampaignTestController: Elysia<"/campaigns", false, {
280
282
  creatorAddress: string;
281
283
  manualOverrides: import("@db/api").$Enums.CampaignManualOverride[];
282
284
  createdAt: Date;
285
+ rootCampaignId: string | null;
286
+ parentCampaignId: string | null;
283
287
  } | {
284
288
  Tokens: {
285
289
  symbol: string;
@@ -451,6 +451,8 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
451
451
  };
452
452
  createdAt: string;
453
453
  description: string | undefined;
454
+ parentCampaignId: string | undefined;
455
+ rootCampaignId: string | undefined;
454
456
  Opportunity: {
455
457
  status: import("@db/api").$Enums.Status;
456
458
  type: string;
@@ -789,6 +791,8 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
789
791
  startTimestamp?: string | undefined;
790
792
  endTimestamp?: string | undefined;
791
793
  creatorAddress?: string | undefined;
794
+ rootCampaignId?: string | undefined;
795
+ parentCampaignId?: string | undefined;
792
796
  chainId?: number | undefined;
793
797
  creatorId?: string | undefined;
794
798
  mainParameter?: string | undefined;
@@ -899,6 +903,8 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
899
903
  creatorId?: string | null | undefined;
900
904
  address: string;
901
905
  } | undefined;
906
+ rootCampaignId?: string | undefined;
907
+ parentCampaignId?: string | undefined;
902
908
  campaignStatus?: {
903
909
  error?: string | undefined;
904
910
  details?: any;
@@ -1071,6 +1077,8 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
1071
1077
  creatorId?: string | null | undefined;
1072
1078
  address: string;
1073
1079
  } | undefined;
1080
+ rootCampaignId?: string | undefined;
1081
+ parentCampaignId?: string | undefined;
1074
1082
  campaignStatus?: {
1075
1083
  error?: string | undefined;
1076
1084
  details?: any;
@@ -289,6 +289,8 @@ export declare const OpportunityWithCampaignsResourceDto: import("@sinclair/type
289
289
  details: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>;
290
290
  }>>;
291
291
  createdAt: import("@sinclair/typebox").TString;
292
+ rootCampaignId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
293
+ parentCampaignId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
292
294
  }>>;
293
295
  }>;
294
296
  export declare const OpportunityUniqueDto: import("@sinclair/typebox").TObject<{
@@ -95,6 +95,8 @@ export declare abstract class OpportunityRepository {
95
95
  creatorAddress: string;
96
96
  manualOverrides: import("@db/api").$Enums.CampaignManualOverride[];
97
97
  createdAt: Date;
98
+ rootCampaignId: string | null;
99
+ parentCampaignId: string | null;
98
100
  })[];
99
101
  Tokens: {
100
102
  symbol: string;
@@ -241,6 +243,8 @@ export declare abstract class OpportunityRepository {
241
243
  creatorAddress: string;
242
244
  manualOverrides: import("@db/api").$Enums.CampaignManualOverride[];
243
245
  createdAt: Date;
246
+ rootCampaignId: string | null;
247
+ parentCampaignId: string | null;
244
248
  }[];
245
249
  Tokens: {
246
250
  symbol: string;
@@ -446,6 +450,8 @@ export declare abstract class OpportunityRepository {
446
450
  creatorAddress: string;
447
451
  manualOverrides: import("@db/api").$Enums.CampaignManualOverride[];
448
452
  createdAt: Date;
453
+ rootCampaignId: string | null;
454
+ parentCampaignId: string | null;
449
455
  })[];
450
456
  Tokens: {
451
457
  symbol: string;
@@ -599,6 +605,8 @@ export declare abstract class OpportunityRepository {
599
605
  creatorAddress: string;
600
606
  manualOverrides: import("@db/api").$Enums.CampaignManualOverride[];
601
607
  createdAt: Date;
608
+ rootCampaignId: string | null;
609
+ parentCampaignId: string | null;
602
610
  }[];
603
611
  Tokens: {
604
612
  symbol: string;
@@ -806,6 +814,8 @@ export declare abstract class OpportunityRepository {
806
814
  creatorAddress: string;
807
815
  manualOverrides: import("@db/api").$Enums.CampaignManualOverride[];
808
816
  createdAt: Date;
817
+ rootCampaignId: string | null;
818
+ parentCampaignId: string | null;
809
819
  })[];
810
820
  Tokens: {
811
821
  symbol: string;
@@ -426,6 +426,8 @@ export declare abstract class OpportunityService {
426
426
  creatorId?: string | null | undefined;
427
427
  address: string;
428
428
  } | undefined;
429
+ rootCampaignId?: string | undefined;
430
+ parentCampaignId?: string | undefined;
429
431
  campaignStatus?: {
430
432
  error?: string | undefined;
431
433
  details?: any;
@@ -570,6 +572,8 @@ export declare abstract class OpportunityService {
570
572
  creatorId?: string | null | undefined;
571
573
  address: string;
572
574
  } | undefined;
575
+ rootCampaignId?: string | undefined;
576
+ parentCampaignId?: string | undefined;
573
577
  campaignStatus?: {
574
578
  error?: string | undefined;
575
579
  details?: any;
@@ -725,6 +729,8 @@ export declare abstract class OpportunityService {
725
729
  };
726
730
  createdAt: string;
727
731
  description: string | undefined;
732
+ parentCampaignId: string | undefined;
733
+ rootCampaignId: string | undefined;
728
734
  Opportunity: {
729
735
  status: import("@db/api").$Enums.Status;
730
736
  type: string;
@@ -909,6 +915,8 @@ export declare abstract class OpportunityService {
909
915
  };
910
916
  createdAt: string;
911
917
  description: string | undefined;
918
+ parentCampaignId: string | undefined;
919
+ rootCampaignId: string | undefined;
912
920
  Opportunity: {
913
921
  status: import("@db/api").$Enums.Status;
914
922
  type: string;
@@ -1086,6 +1094,8 @@ export declare abstract class OpportunityService {
1086
1094
  };
1087
1095
  createdAt: string;
1088
1096
  description: string | undefined;
1097
+ parentCampaignId: string | undefined;
1098
+ rootCampaignId: string | undefined;
1089
1099
  Opportunity: {
1090
1100
  status: import("@db/api").$Enums.Status;
1091
1101
  type: string;
@@ -46,6 +46,8 @@ export declare abstract class ProtocolRepository {
46
46
  creatorAddress: string;
47
47
  manualOverrides: import("@db/api").$Enums.CampaignManualOverride[];
48
48
  createdAt: Date;
49
+ rootCampaignId: string | null;
50
+ parentCampaignId: string | null;
49
51
  }[];
50
52
  } & {
51
53
  status: import("@db/api").$Enums.Status;
@@ -73,25 +73,22 @@ export const RewardController = new Elysia({ prefix: "/rewards", detail: { tags:
73
73
  .get("/total", async ({ query }) => await RewardService.totalForToken(query))
74
74
  .get("/count", async ({ query }) => await RewardService.countForToken(query));
75
75
  })
76
- .group("/engine", app => {
76
+ .group("/engine", {
77
+ headers: AuthorizationHeadersDto,
78
+ beforeHandle: EngineGuard,
79
+ detail: { hide: true },
80
+ }, app => {
77
81
  return (app
78
82
  // ─── Create Many Rewards ─────────────────────────────────────────────
79
83
  .post("/", async ({ body }) => await RewardService.createManyReward(body), {
80
- headers: AuthorizationHeadersDto,
81
84
  body: CreateManyRewardDto,
82
- beforeHandle: EngineGuard,
83
- detail: { hide: true },
84
85
  })
85
86
  // ─── Create Many Reward Breakdowns ───────────────────────────────────
86
87
  .post("/breakdowns", async ({ body }) => await RewardService.createManyBreakdown(body), {
87
- headers: AuthorizationHeadersDto,
88
88
  body: CreateManyBreakdownDto,
89
- beforeHandle: EngineGuard,
90
- detail: { hide: true },
91
89
  })
92
90
  // ─── Register new claims ──────────────────────────────────────────────
93
91
  .post("/claims", async ({ body }) => await RewardService.registerClaims(body), {
94
- headers: AuthorizationHeadersDto,
95
92
  body: RegisterClaimsDto,
96
93
  beforeHandle: ({ headers, body }) => {
97
94
  EngineGuard({ headers });
@@ -101,7 +98,6 @@ export const RewardController = new Elysia({ prefix: "/rewards", detail: { tags:
101
98
  claim.recipient = throwOnInvalidRequiredAddress(claim.recipient);
102
99
  }
103
100
  },
104
- detail: { hide: true },
105
101
  }));
106
102
  })
107
103
  // ─── Get Reward Count By Chain And Root ──────────────────────────────
@@ -18,7 +18,9 @@ export type Reward = Resource<"Reward", "rewardTokenId" | "id", {
18
18
  * @description Describes one reward amount for one token and campaign
19
19
  * @see {@link Resource}
20
20
  */
21
- export type RewardBreakdown = Resource<"RewardBreakdown", "id" | "rewardId" | "protocolId">;
21
+ export type RewardBreakdown = Resource<"RewardBreakdown", "id" | "rewardId" | "protocolId", {
22
+ subCampaignId?: string;
23
+ }>;
22
24
  /**
23
25
  * Daily Rewards
24
26
  * @description Describes rewards breakdown from the opportunity view
@@ -91,6 +91,7 @@ export declare abstract class RewardRepository {
91
91
  claimed: string;
92
92
  protocolId: string | null;
93
93
  rewardId: string;
94
+ subCampaignId: string | null;
94
95
  })[];
95
96
  } & {
96
97
  pending: string;
@@ -116,6 +117,7 @@ export declare abstract class RewardRepository {
116
117
  claimed: string;
117
118
  protocolId: string | null;
118
119
  rewardId: string;
120
+ subCampaignId: string | null;
119
121
  })[];
120
122
  } & {
121
123
  pending: string;
@@ -109,6 +109,8 @@ export declare abstract class RewardService {
109
109
  };
110
110
  createdAt: string;
111
111
  description: string | undefined;
112
+ parentCampaignId: string | undefined;
113
+ rootCampaignId: string | undefined;
112
114
  Opportunity: {
113
115
  status: import("@db/api").$Enums.Status;
114
116
  type: string;
@@ -196,6 +198,7 @@ export declare abstract class RewardService {
196
198
  */
197
199
  static formatBreakdown(breakdown: Awaited<ReturnType<(typeof RewardRepository)["getByRecipient"]>>[number]["Breakdown"][number]): {
198
200
  campaignId: string;
201
+ subCampaignId: string | undefined;
199
202
  opportunity: {
200
203
  Chain: {
201
204
  name: string;
@@ -283,6 +286,7 @@ export declare abstract class RewardService {
283
286
  };
284
287
  breakdowns: {
285
288
  campaignId: string;
289
+ subCampaignId: string | undefined;
286
290
  opportunity: {
287
291
  Chain: {
288
292
  name: string;
@@ -442,6 +446,7 @@ export declare abstract class RewardService {
442
446
  claimed: string;
443
447
  protocolId: string | null;
444
448
  rewardId: string;
449
+ subCampaignId: string | null;
445
450
  })[];
446
451
  } & {
447
452
  pending: string;
@@ -494,6 +499,7 @@ export declare abstract class RewardService {
494
499
  };
495
500
  breakdowns: {
496
501
  campaignId: string;
502
+ subCampaignId: string | undefined;
497
503
  opportunity: {
498
504
  Chain: {
499
505
  name: string;
@@ -596,6 +602,7 @@ export declare abstract class RewardService {
596
602
  };
597
603
  breakdowns: {
598
604
  campaignId: string;
605
+ subCampaignId: string | undefined;
599
606
  opportunity: {
600
607
  Chain: {
601
608
  name: string;
@@ -668,6 +675,7 @@ export declare abstract class RewardService {
668
675
  }, "breakdowns"> & {
669
676
  breakdowns: {
670
677
  campaignId: string;
678
+ subCampaignId: string | undefined;
671
679
  reason: string;
672
680
  pending: string;
673
681
  amount: string;
@@ -764,6 +772,7 @@ export declare abstract class RewardService {
764
772
  claimed: string;
765
773
  protocolId: string | null;
766
774
  rewardId: string;
775
+ subCampaignId: string | null;
767
776
  })[];
768
777
  } & {
769
778
  pending: string;
@@ -79,10 +79,11 @@ export class RewardService {
79
79
  * @returns a RewardBreakdown model
80
80
  */
81
81
  static formatBreakdown(breakdown) {
82
- const { Campaign, id, rewardId, protocolId, ...rest } = breakdown;
82
+ const { Campaign, id, rewardId, protocolId, subCampaignId, ...rest } = breakdown;
83
83
  return {
84
84
  ...rest,
85
85
  campaignId: Campaign.campaignId,
86
+ subCampaignId: subCampaignId ?? undefined,
86
87
  opportunity: Campaign.Opportunity,
87
88
  };
88
89
  }