@merkl/api 0.20.48 → 0.20.49

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 (31) hide show
  1. package/dist/database/api/.generated/drizzle/schema.d.ts +17 -0
  2. package/dist/database/api/.generated/drizzle/schema.js +1 -0
  3. package/dist/database/api/.generated/drizzle/schema.ts +1 -0
  4. package/dist/database/api/.generated/edge.js +4 -3
  5. package/dist/database/api/.generated/index-browser.js +9 -0
  6. package/dist/database/api/.generated/index.d.ts +133 -1
  7. package/dist/database/api/.generated/index.js +4 -3
  8. package/dist/database/api/.generated/package.json +1 -1
  9. package/dist/database/api/.generated/schema.prisma +1 -1
  10. package/dist/database/api/.generated/wasm.js +9 -0
  11. package/dist/src/eden/index.d.ts +430 -10
  12. package/dist/src/index.d.ts +98 -2
  13. package/dist/src/libs/tokens/balances.js +2 -1
  14. package/dist/src/modules/v4/campaign/campaign.controller.d.ts +93 -1
  15. package/dist/src/modules/v4/campaign/campaign.controller.js +23 -2
  16. package/dist/src/modules/v4/campaign/campaign.model.d.ts +15 -0
  17. package/dist/src/modules/v4/campaign/campaign.model.js +14 -0
  18. package/dist/src/modules/v4/campaign/campaign.repository.d.ts +8 -0
  19. package/dist/src/modules/v4/campaign/campaign.service.d.ts +28 -1
  20. package/dist/src/modules/v4/campaign/campaign.service.js +35 -0
  21. package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +4 -0
  22. package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +14 -0
  23. package/dist/src/modules/v4/opportunity/opportunity.model.js +2 -1
  24. package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +5 -0
  25. package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +5 -0
  26. package/dist/src/modules/v4/programPayload/programPayload.controller.d.ts +1 -1
  27. package/dist/src/modules/v4/protocol/protocol.repository.d.ts +1 -0
  28. package/dist/src/modules/v4/reward/reward.service.d.ts +1 -0
  29. package/dist/src/modules/v4/router.d.ts +98 -2
  30. package/dist/tsconfig.package.tsbuildinfo +1 -1
  31. package/package.json +1 -1
@@ -476,6 +476,7 @@ declare const app: Elysia<"", false, {
476
476
  computeChainId: number;
477
477
  distributionChainId: number;
478
478
  campaignId: string;
479
+ distributionType: import("@db/api").$Enums.DistributionType;
479
480
  rewardTokenId: string;
480
481
  amount: string;
481
482
  opportunityId: string;
@@ -583,6 +584,7 @@ declare const app: Elysia<"", false, {
583
584
  tags: string[];
584
585
  icon: string;
585
586
  } | null | undefined;
587
+ distributionType?: "DUTCH_AUCTION" | "FIX_REWARD_VALUE_PER_LIQUIDITY_VALUE" | "FIX_REWARD_AMOUNT_PER_LIQUIDITY_VALUE" | "FIX_REWARD_VALUE_PER_LIQUIDITY_AMOUNT" | "FIX_REWARD_AMOUNT_PER_LIQUIDITY_AMOUNT" | undefined;
586
588
  depositUrl?: string | undefined;
587
589
  explorerAddress?: string | undefined;
588
590
  aprRecord?: {
@@ -714,6 +716,7 @@ declare const app: Elysia<"", false, {
714
716
  tags: string[];
715
717
  icon: string;
716
718
  } | null | undefined;
719
+ distributionType?: "DUTCH_AUCTION" | "FIX_REWARD_VALUE_PER_LIQUIDITY_VALUE" | "FIX_REWARD_AMOUNT_PER_LIQUIDITY_VALUE" | "FIX_REWARD_VALUE_PER_LIQUIDITY_AMOUNT" | "FIX_REWARD_AMOUNT_PER_LIQUIDITY_AMOUNT" | undefined;
717
720
  depositUrl?: string | undefined;
718
721
  explorerAddress?: string | undefined;
719
722
  aprRecord?: {
@@ -879,6 +882,7 @@ declare const app: Elysia<"", false, {
879
882
  tags: string[];
880
883
  icon: string;
881
884
  } | null | undefined;
885
+ distributionType?: "DUTCH_AUCTION" | "FIX_REWARD_VALUE_PER_LIQUIDITY_VALUE" | "FIX_REWARD_AMOUNT_PER_LIQUIDITY_VALUE" | "FIX_REWARD_VALUE_PER_LIQUIDITY_AMOUNT" | "FIX_REWARD_AMOUNT_PER_LIQUIDITY_AMOUNT" | undefined;
882
886
  depositUrl?: string | undefined;
883
887
  explorerAddress?: string | undefined;
884
888
  aprRecord?: {
@@ -1222,6 +1226,7 @@ declare const app: Elysia<"", false, {
1222
1226
  computeChainId: number;
1223
1227
  distributionChainId: number;
1224
1228
  campaignId: string;
1229
+ distributionType: import("@db/api").$Enums.DistributionType;
1225
1230
  rewardTokenId: string;
1226
1231
  amount: string;
1227
1232
  opportunityId: string;
@@ -1310,6 +1315,7 @@ declare const app: Elysia<"", false, {
1310
1315
  computeChainId: number;
1311
1316
  distributionChainId: number;
1312
1317
  campaignId: string;
1318
+ distributionType: import("@db/api").$Enums.DistributionType;
1313
1319
  rewardTokenId: string;
1314
1320
  amount: string;
1315
1321
  opportunityId: string;
@@ -1360,11 +1366,42 @@ declare const app: Elysia<"", false, {
1360
1366
  };
1361
1367
  };
1362
1368
  };
1369
+ } & {
1370
+ "dry-run": {
1371
+ "dynamic-data": {
1372
+ list: {
1373
+ post: {
1374
+ body: string[];
1375
+ params: {};
1376
+ query: unknown;
1377
+ headers: {
1378
+ authorization: string;
1379
+ };
1380
+ response: {
1381
+ 200: unknown[];
1382
+ };
1383
+ };
1384
+ };
1385
+ };
1386
+ };
1363
1387
  } & {
1364
1388
  "dry-run": {
1365
1389
  "dynamic-data": {
1366
1390
  post: {
1367
- body: string[];
1391
+ body: {
1392
+ id?: string | undefined;
1393
+ subType?: number | undefined;
1394
+ campaignId?: string | undefined;
1395
+ amount?: string | undefined;
1396
+ creatorAddress?: string | undefined;
1397
+ type: string;
1398
+ params: any;
1399
+ computeChainId: number;
1400
+ distributionChainId: number;
1401
+ startTimestamp: number;
1402
+ endTimestamp: number;
1403
+ rewardToken: string;
1404
+ };
1368
1405
  params: {};
1369
1406
  query: unknown;
1370
1407
  headers: {
@@ -1376,6 +1413,62 @@ declare const app: Elysia<"", false, {
1376
1413
  };
1377
1414
  };
1378
1415
  };
1416
+ } & {
1417
+ "dry-run": {
1418
+ metadata: {
1419
+ post: {
1420
+ body: {
1421
+ id?: string | undefined;
1422
+ subType?: number | undefined;
1423
+ campaignId?: string | undefined;
1424
+ amount?: string | undefined;
1425
+ creatorAddress?: string | undefined;
1426
+ type: string;
1427
+ params: any;
1428
+ computeChainId: number;
1429
+ distributionChainId: number;
1430
+ startTimestamp: number;
1431
+ endTimestamp: number;
1432
+ rewardToken: string;
1433
+ };
1434
+ params: {};
1435
+ query: unknown;
1436
+ headers: {
1437
+ authorization: string;
1438
+ };
1439
+ response: {
1440
+ 200: {
1441
+ id: string;
1442
+ chainId: number;
1443
+ type: string;
1444
+ identifier: string;
1445
+ name: string;
1446
+ status: "PAST" | "LIVE" | "SOON";
1447
+ action: any;
1448
+ tokens: ({
1449
+ symbol: string;
1450
+ id: string;
1451
+ name: string | null;
1452
+ icon: string;
1453
+ address: string;
1454
+ chainId: number;
1455
+ decimals: number;
1456
+ verified: boolean;
1457
+ isTest: boolean;
1458
+ isPoint: boolean;
1459
+ isNative: boolean;
1460
+ } & {
1461
+ price?: number | null | undefined;
1462
+ })[];
1463
+ mainProtocol: "splice" | "morpho" | "quickswap" | "euler" | "ambient" | "uniswap" | "arthswap" | "base-swap" | "camelot" | "crust" | "fenix" | "horiza" | "izumi" | "kim" | "pancake-swap" | "ramses" | "retro" | "stryke" | "sushi-swap" | "swapr" | "thruster" | "voltage" | "zero" | "koi" | "supswap" | "zk-swap" | "thirdtrade" | "swap-x" | "velodrome" | "aerodrome" | "balancer" | "curve" | "cross_curve" | "curveNPool" | "aura" | "akron" | "beefy" | "dragonswap" | "poolside" | "syncswap" | "neptune" | "zkSwapThreePool" | "rfx" | "ra" | "maverick" | "trader-joe" | "hanji" | "radiant" | "aave" | "fraxlend" | "ironclad" | "gearbox" | "compound" | "sturdy" | "frax" | "ionic" | "moonwell" | "fluid" | "silo" | "dolomite" | "badger" | "ajna" | "layerbank" | "ion" | "venus" | "woofi" | "reactor_fusion" | "eigenlayer" | "vest" | "zerolend" | "hyperdrive" | "gamma" | "oku" | "hourglass" | "veda" | "kyo" | "sonex" | "lendle" | "tako-tako" | "equalizer" | "spectra" | "beraborrow" | "superlend" | "avalon" | "iguana" | "angles" | "enzyme" | "toros" | "vicuna" | "bunni" | "beratrax" | "concrete" | "cian" | "pendle" | "yei" | "filament" | "gammaswap" | "maha" | "tempest" | "uranium" | "holdstation" | "katana" | "satlayer" | undefined;
1464
+ depositUrl: any;
1465
+ explorerAddress: string | undefined;
1466
+ tags: string[];
1467
+ };
1468
+ };
1469
+ };
1470
+ };
1471
+ };
1379
1472
  } & {
1380
1473
  "dry-run": {
1381
1474
  metadata: {
@@ -1520,6 +1613,7 @@ declare const app: Elysia<"", false, {
1520
1613
  computeChainId: number;
1521
1614
  distributionChainId: number;
1522
1615
  campaignId: string;
1616
+ distributionType: import("@db/api").$Enums.DistributionType;
1523
1617
  rewardTokenId: string;
1524
1618
  amount: string;
1525
1619
  opportunityId: string;
@@ -1604,6 +1698,7 @@ declare const app: Elysia<"", false, {
1604
1698
  computeChainId: number;
1605
1699
  distributionChainId: number;
1606
1700
  campaignId: string;
1701
+ distributionType: import("@db/api").$Enums.DistributionType;
1607
1702
  rewardTokenId: string;
1608
1703
  amount: string;
1609
1704
  opportunityId: string;
@@ -1789,6 +1884,7 @@ declare const app: Elysia<"", false, {
1789
1884
  computeChainId: number;
1790
1885
  distributionChainId: number;
1791
1886
  campaignId: string;
1887
+ distributionType: import("@db/api").$Enums.DistributionType;
1792
1888
  rewardTokenId: string;
1793
1889
  amount: string;
1794
1890
  opportunityId: string;
@@ -4494,10 +4590,10 @@ declare const app: Elysia<"", false, {
4494
4590
  endTimestamp?: number | undefined;
4495
4591
  blacklist?: string[] | undefined;
4496
4592
  poolAddress?: string | undefined;
4593
+ contract?: string | undefined;
4497
4594
  marketId?: string | undefined;
4498
4595
  strategy?: string | undefined;
4499
4596
  poolId?: string | undefined;
4500
- contract?: string | undefined;
4501
4597
  forwarders?: (string | {})[] | undefined;
4502
4598
  whitelist?: string[] | undefined;
4503
4599
  targetToken?: string | undefined;
@@ -1,10 +1,11 @@
1
1
  import { TokenService } from "@/modules/v4/token/token.service";
2
2
  import { ChainId, ChainInteractionService, ETH_ADDRESS, ETH_ZKSYNC_ADDRESS, Erc20__factory, EthOnZKSync_INTERFACE, NETWORK_LABELS, } from "@sdk";
3
+ import { isAddress } from "viem";
3
4
  import { log } from "../../utils/logger";
4
5
  export async function getOnlyUserBalance(chainId, userAddress, tokenAddresses) {
5
6
  const calls = [];
6
7
  const ERC20_Interface = Erc20__factory.createInterface();
7
- for (const tokenAddress of tokenAddresses) {
8
+ for (const tokenAddress of tokenAddresses.filter(t => isAddress(t))) {
8
9
  if (chainId === ChainId.ZKSYNC && tokenAddress === ETH_ZKSYNC_ADDRESS) {
9
10
  calls.push({
10
11
  allowFailure: true,
@@ -45,6 +45,7 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
45
45
  computeChainId: number;
46
46
  distributionChainId: number;
47
47
  campaignId: string;
48
+ distributionType: import("@db/api").$Enums.DistributionType;
48
49
  rewardTokenId: string;
49
50
  amount: string;
50
51
  opportunityId: string;
@@ -133,6 +134,7 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
133
134
  computeChainId: number;
134
135
  distributionChainId: number;
135
136
  campaignId: string;
137
+ distributionType: import("@db/api").$Enums.DistributionType;
136
138
  rewardTokenId: string;
137
139
  amount: string;
138
140
  opportunityId: string;
@@ -183,11 +185,42 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
183
185
  };
184
186
  };
185
187
  };
188
+ } & {
189
+ "dry-run": {
190
+ "dynamic-data": {
191
+ list: {
192
+ post: {
193
+ body: string[];
194
+ params: {};
195
+ query: unknown;
196
+ headers: {
197
+ authorization: string;
198
+ };
199
+ response: {
200
+ 200: unknown[];
201
+ };
202
+ };
203
+ };
204
+ };
205
+ };
186
206
  } & {
187
207
  "dry-run": {
188
208
  "dynamic-data": {
189
209
  post: {
190
- body: string[];
210
+ body: {
211
+ id?: string | undefined;
212
+ subType?: number | undefined;
213
+ campaignId?: string | undefined;
214
+ amount?: string | undefined;
215
+ creatorAddress?: string | undefined;
216
+ type: string;
217
+ params: any;
218
+ computeChainId: number;
219
+ distributionChainId: number;
220
+ startTimestamp: number;
221
+ endTimestamp: number;
222
+ rewardToken: string;
223
+ };
191
224
  params: {};
192
225
  query: unknown;
193
226
  headers: {
@@ -199,6 +232,62 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
199
232
  };
200
233
  };
201
234
  };
235
+ } & {
236
+ "dry-run": {
237
+ metadata: {
238
+ post: {
239
+ body: {
240
+ id?: string | undefined;
241
+ subType?: number | undefined;
242
+ campaignId?: string | undefined;
243
+ amount?: string | undefined;
244
+ creatorAddress?: string | undefined;
245
+ type: string;
246
+ params: any;
247
+ computeChainId: number;
248
+ distributionChainId: number;
249
+ startTimestamp: number;
250
+ endTimestamp: number;
251
+ rewardToken: string;
252
+ };
253
+ params: {};
254
+ query: unknown;
255
+ headers: {
256
+ authorization: string;
257
+ };
258
+ response: {
259
+ 200: {
260
+ id: string;
261
+ chainId: number;
262
+ type: string;
263
+ identifier: string;
264
+ name: string;
265
+ status: "PAST" | "LIVE" | "SOON";
266
+ action: any;
267
+ tokens: ({
268
+ symbol: string;
269
+ id: string;
270
+ name: string | null;
271
+ icon: string;
272
+ address: string;
273
+ chainId: number;
274
+ decimals: number;
275
+ verified: boolean;
276
+ isTest: boolean;
277
+ isPoint: boolean;
278
+ isNative: boolean;
279
+ } & {
280
+ price?: number | null | undefined;
281
+ })[];
282
+ mainProtocol: "splice" | "morpho" | "quickswap" | "euler" | "ambient" | "uniswap" | "arthswap" | "base-swap" | "camelot" | "crust" | "fenix" | "horiza" | "izumi" | "kim" | "pancake-swap" | "ramses" | "retro" | "stryke" | "sushi-swap" | "swapr" | "thruster" | "voltage" | "zero" | "koi" | "supswap" | "zk-swap" | "thirdtrade" | "swap-x" | "velodrome" | "aerodrome" | "balancer" | "curve" | "cross_curve" | "curveNPool" | "aura" | "akron" | "beefy" | "dragonswap" | "poolside" | "syncswap" | "neptune" | "zkSwapThreePool" | "rfx" | "ra" | "maverick" | "trader-joe" | "hanji" | "radiant" | "aave" | "fraxlend" | "ironclad" | "gearbox" | "compound" | "sturdy" | "frax" | "ionic" | "moonwell" | "fluid" | "silo" | "dolomite" | "badger" | "ajna" | "layerbank" | "ion" | "venus" | "woofi" | "reactor_fusion" | "eigenlayer" | "vest" | "zerolend" | "hyperdrive" | "gamma" | "oku" | "hourglass" | "veda" | "kyo" | "sonex" | "lendle" | "tako-tako" | "equalizer" | "spectra" | "beraborrow" | "superlend" | "avalon" | "iguana" | "angles" | "enzyme" | "toros" | "vicuna" | "bunni" | "beratrax" | "concrete" | "cian" | "pendle" | "yei" | "filament" | "gammaswap" | "maha" | "tempest" | "uranium" | "holdstation" | "katana" | "satlayer" | undefined;
283
+ depositUrl: any;
284
+ explorerAddress: string | undefined;
285
+ tags: string[];
286
+ };
287
+ };
288
+ };
289
+ };
290
+ };
202
291
  } & {
203
292
  "dry-run": {
204
293
  metadata: {
@@ -343,6 +432,7 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
343
432
  computeChainId: number;
344
433
  distributionChainId: number;
345
434
  campaignId: string;
435
+ distributionType: import("@db/api").$Enums.DistributionType;
346
436
  rewardTokenId: string;
347
437
  amount: string;
348
438
  opportunityId: string;
@@ -427,6 +517,7 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
427
517
  computeChainId: number;
428
518
  distributionChainId: number;
429
519
  campaignId: string;
520
+ distributionType: import("@db/api").$Enums.DistributionType;
430
521
  rewardTokenId: string;
431
522
  amount: string;
432
523
  opportunityId: string;
@@ -612,6 +703,7 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
612
703
  computeChainId: number;
613
704
  distributionChainId: number;
614
705
  campaignId: string;
706
+ distributionType: import("@db/api").$Enums.DistributionType;
615
707
  rewardTokenId: string;
616
708
  amount: string;
617
709
  opportunityId: string;
@@ -8,7 +8,7 @@ import { throwOnUnsupportedChainId } from "src/utils/throw";
8
8
  import { DynamicDataService } from "../dynamicData/dynamicData.service";
9
9
  import { OpportunityService } from "../opportunity";
10
10
  import { OpportunityConvertorService } from "../opportunity/opportunity.converter";
11
- import { CampaignResourceDto, CampaignUniqueDto, CampaignsDto, CreateCampaignDto, GetCampaignQueryDto, RemoveManualOverrideDto, UpdateCampaignCreatorDto, UpdateCampaignDto, UpdateMetaDataCampaignDto, } from "./campaign.model";
11
+ import { CampaignConfigMinimal, CampaignResourceDto, CampaignUniqueDto, CampaignsDto, CreateCampaignDto, GetCampaignQueryDto, RemoveManualOverrideDto, UpdateCampaignCreatorDto, UpdateCampaignDto, UpdateMetaDataCampaignDto, } from "./campaign.model";
12
12
  import { CampaignService } from "./campaign.service";
13
13
  // ─── Campaigns Controller ────────────────────────────────────────────────────
14
14
  export const CampaignController = new Elysia({ prefix: "/campaigns", detail: { tags: ["Campaigns"] } })
@@ -66,7 +66,7 @@ export const CampaignController = new Elysia({ prefix: "/campaigns", detail: { t
66
66
  return await DynamicDataService.updateForCampaignType([campaignV3], campaignV3.campaignType, true);
67
67
  }, { beforeHandle: BackOfficeGuard, headers: AuthorizationHeadersDto, detail: { hide: true } })
68
68
  // ─── Test Dynamic data computation with a list of campaignId ───────────────────────
69
- .post("/dynamic-data", async ({ body }) => {
69
+ .post("/dynamic-data/list", async ({ body }) => {
70
70
  const listCampaigns = [];
71
71
  for (const campaignId of body) {
72
72
  const id = (await CampaignService.findMany({ campaignId: campaignId, test: true }))?.[0]?.id;
@@ -78,6 +78,27 @@ export const CampaignController = new Elysia({ prefix: "/campaigns", detail: { t
78
78
  }
79
79
  return await DynamicDataService.updateForCampaigns(listCampaigns, true);
80
80
  }, { beforeHandle: BackOfficeGuard, body: CampaignsDto, headers: AuthorizationHeadersDto, detail: { hide: true } })
81
+ // ─── Test Dynamic data computation with campaign config ───────────────────────
82
+ .post("/dynamic-data", async ({ body }) => {
83
+ const listCampaigns = [CampaignService.createFakeCampaign(body)];
84
+ return await DynamicDataService.updateForCampaigns(listCampaigns, true);
85
+ }, {
86
+ beforeHandle: BackOfficeGuard,
87
+ body: CampaignConfigMinimal,
88
+ headers: AuthorizationHeadersDto,
89
+ detail: { hide: true },
90
+ })
91
+ // ─── Test Opportunity creation through a campaign config ───────────────────────
92
+ // @dev Starts from the engine db to debug opportunity creation failing and preventing the api db to be filled
93
+ .post("/metadata", async ({ body }) => {
94
+ const engineCampaign = CampaignService.createFakeCampaignEngine(body);
95
+ return await OpportunityService.createFromCampaign(engineCampaign, false, false);
96
+ }, {
97
+ beforeHandle: BackOfficeGuard,
98
+ body: CampaignConfigMinimal,
99
+ headers: AuthorizationHeadersDto,
100
+ detail: { hide: true },
101
+ })
81
102
  // ─── Test Opportunity creation through a campaign Id and a chain ───────────────────────
82
103
  // @dev Starts from the engine db to debug opportunity creation failing and preventing the api db to be filled
83
104
  .get("/metadata", async ({ query }) => {
@@ -81,6 +81,20 @@ export declare const CampaignResourceDto: import("@sinclair/typebox").TObject<{
81
81
  }>>;
82
82
  createdAt: import("@sinclair/typebox").TString;
83
83
  }>;
84
+ export declare const CampaignConfigMinimal: import("@sinclair/typebox").TObject<{
85
+ computeChainId: import("@sinclair/typebox").TNumber;
86
+ params: import("@sinclair/typebox").TAny;
87
+ type: import("@sinclair/typebox").TString;
88
+ subType: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
89
+ distributionChainId: import("@sinclair/typebox").TNumber;
90
+ endTimestamp: import("@sinclair/typebox").TNumber;
91
+ startTimestamp: import("@sinclair/typebox").TNumber;
92
+ rewardToken: import("@sinclair/typebox").TString;
93
+ id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
94
+ campaignId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
95
+ amount: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
96
+ creatorAddress: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
97
+ }>;
84
98
  export declare const CreateCampaignDto: import("@sinclair/typebox").TObject<{
85
99
  computeChainId: import("@sinclair/typebox").TNumber;
86
100
  chainId: import("@sinclair/typebox").TNumber;
@@ -164,3 +178,4 @@ export type extendedUpdateCampaignModel = UpdateCampaignModel & {
164
178
  opportunityId: string;
165
179
  };
166
180
  export type GetCampaignQueryModel = typeof GetCampaignQueryDto.static;
181
+ export type CampaignConfigMinimalModel = typeof CampaignConfigMinimal.static;
@@ -34,6 +34,20 @@ export const CampaignResourceDto = t.Object({
34
34
  campaignStatus: t.Optional(CampaignStatusResourceDto),
35
35
  createdAt: t.String({ format: "date" }),
36
36
  });
37
+ export const CampaignConfigMinimal = t.Object({
38
+ computeChainId: t.Number(),
39
+ params: t.Any(),
40
+ type: t.String(),
41
+ subType: t.Optional(t.Number()),
42
+ distributionChainId: t.Number(),
43
+ endTimestamp: t.Number(),
44
+ startTimestamp: t.Number(),
45
+ rewardToken: t.String(),
46
+ id: t.Optional(t.String()),
47
+ campaignId: t.Optional(t.String()),
48
+ amount: t.Optional(t.String()),
49
+ creatorAddress: t.Optional(t.String()),
50
+ });
37
51
  export const CreateCampaignDto = t.Object({
38
52
  computeChainId: t.Number(),
39
53
  chainId: t.Number(),
@@ -327,6 +327,7 @@ export declare abstract class CampaignRepository {
327
327
  computeChainId: number;
328
328
  distributionChainId: number;
329
329
  campaignId: string;
330
+ distributionType: import("@db/api").$Enums.DistributionType;
330
331
  rewardTokenId: string;
331
332
  amount: string;
332
333
  opportunityId: string;
@@ -373,6 +374,7 @@ export declare abstract class CampaignRepository {
373
374
  computeChainId: number;
374
375
  distributionChainId: number;
375
376
  campaignId: string;
377
+ distributionType: import("@db/api").$Enums.DistributionType;
376
378
  rewardTokenId: string;
377
379
  amount: string;
378
380
  opportunityId: string;
@@ -435,6 +437,7 @@ export declare abstract class CampaignRepository {
435
437
  computeChainId: number;
436
438
  distributionChainId: number;
437
439
  campaignId: string;
440
+ distributionType: import("@db/api").$Enums.DistributionType;
438
441
  rewardTokenId: string;
439
442
  amount: string;
440
443
  opportunityId: string;
@@ -478,6 +481,7 @@ export declare abstract class CampaignRepository {
478
481
  computeChainId: number;
479
482
  distributionChainId: number;
480
483
  campaignId: string;
484
+ distributionType: import("@db/api").$Enums.DistributionType;
481
485
  rewardTokenId: string;
482
486
  amount: string;
483
487
  opportunityId: string;
@@ -555,6 +559,7 @@ export declare abstract class CampaignRepository {
555
559
  computeChainId: number;
556
560
  distributionChainId: number;
557
561
  campaignId: string;
562
+ distributionType: import("@db/api").$Enums.DistributionType;
558
563
  rewardTokenId: string;
559
564
  amount: string;
560
565
  opportunityId: string;
@@ -628,6 +633,7 @@ export declare abstract class CampaignRepository {
628
633
  computeChainId: number;
629
634
  distributionChainId: number;
630
635
  campaignId: string;
636
+ distributionType: import("@db/api").$Enums.DistributionType;
631
637
  rewardTokenId: string;
632
638
  amount: string;
633
639
  opportunityId: string;
@@ -710,6 +716,7 @@ export declare abstract class CampaignRepository {
710
716
  computeChainId: number;
711
717
  distributionChainId: number;
712
718
  campaignId: string;
719
+ distributionType: import("@db/api").$Enums.DistributionType;
713
720
  rewardTokenId: string;
714
721
  amount: string;
715
722
  opportunityId: string;
@@ -733,6 +740,7 @@ export declare abstract class CampaignRepository {
733
740
  computeChainId: number;
734
741
  distributionChainId: number;
735
742
  campaignId: string;
743
+ distributionType: import("@db/api").$Enums.DistributionType;
736
744
  rewardTokenId: string;
737
745
  amount: string;
738
746
  opportunityId: string;
@@ -1,4 +1,4 @@
1
- import type { CampaignUnique, CampaignWithParams, CreateCampaignModel, GetCampaignQueryModel, UpdateCampaignCreatorModel, UpdateCampaignModel, UpdateMetaDataCampaignModel } from "@/modules/v4/campaign";
1
+ import type { CampaignConfigMinimalModel, CampaignUnique, CampaignWithParams, CreateCampaignModel, GetCampaignQueryModel, UpdateCampaignCreatorModel, UpdateCampaignModel, UpdateMetaDataCampaignModel } from "@/modules/v4/campaign";
2
2
  import type { CampaignManualOverride } from "@db/api";
3
3
  import { Campaign as CampaignEnum, type CampaignParameters, type ChainId } from "@sdk";
4
4
  import { CampaignRepository } from "./campaign.repository";
@@ -34,6 +34,7 @@ export declare abstract class CampaignService {
34
34
  computeChainId: number;
35
35
  distributionChainId: number;
36
36
  campaignId: string;
37
+ distributionType: import("@db/api").$Enums.DistributionType;
37
38
  rewardTokenId: string;
38
39
  amount: string;
39
40
  opportunityId: string;
@@ -72,6 +73,7 @@ export declare abstract class CampaignService {
72
73
  computeChainId: number;
73
74
  distributionChainId: number;
74
75
  campaignId: string;
76
+ distributionType: import("@db/api").$Enums.DistributionType;
75
77
  rewardTokenId: string;
76
78
  amount: string;
77
79
  opportunityId: string;
@@ -126,6 +128,7 @@ export declare abstract class CampaignService {
126
128
  computeChainId: number;
127
129
  distributionChainId: number;
128
130
  campaignId: string;
131
+ distributionType: import("@db/api").$Enums.DistributionType;
129
132
  rewardTokenId: string;
130
133
  amount: string;
131
134
  opportunityId: string;
@@ -148,6 +151,7 @@ export declare abstract class CampaignService {
148
151
  computeChainId: number;
149
152
  distributionChainId: number;
150
153
  campaignId: string;
154
+ distributionType: import("@db/api").$Enums.DistributionType;
151
155
  rewardTokenId: string;
152
156
  amount: string;
153
157
  opportunityId: string;
@@ -169,6 +173,7 @@ export declare abstract class CampaignService {
169
173
  computeChainId: number;
170
174
  distributionChainId: number;
171
175
  campaignId: string;
176
+ distributionType: import("@db/api").$Enums.DistributionType;
172
177
  rewardTokenId: string;
173
178
  amount: string;
174
179
  opportunityId: string;
@@ -258,6 +263,7 @@ export declare abstract class CampaignService {
258
263
  computeChainId: number;
259
264
  distributionChainId: number;
260
265
  campaignId: string;
266
+ distributionType: import("@db/api").$Enums.DistributionType;
261
267
  rewardTokenId: string;
262
268
  amount: string;
263
269
  opportunityId: string;
@@ -329,6 +335,7 @@ export declare abstract class CampaignService {
329
335
  computeChainId: number;
330
336
  distributionChainId: number;
331
337
  campaignId: string;
338
+ distributionType: import("@db/api").$Enums.DistributionType;
332
339
  rewardTokenId: string;
333
340
  amount: string;
334
341
  opportunityId: string;
@@ -401,6 +408,7 @@ export declare abstract class CampaignService {
401
408
  computeChainId: number;
402
409
  distributionChainId: number;
403
410
  campaignId: string;
411
+ distributionType: import("@db/api").$Enums.DistributionType;
404
412
  rewardTokenId: string;
405
413
  amount: string;
406
414
  opportunityId: string;
@@ -473,6 +481,7 @@ export declare abstract class CampaignService {
473
481
  computeChainId: number;
474
482
  distributionChainId: number;
475
483
  campaignId: string;
484
+ distributionType: import("@db/api").$Enums.DistributionType;
476
485
  rewardTokenId: string;
477
486
  amount: string;
478
487
  opportunityId: string;
@@ -534,6 +543,7 @@ export declare abstract class CampaignService {
534
543
  computeChainId: number;
535
544
  distributionChainId: number;
536
545
  campaignId: string;
546
+ distributionType: import("@db/api").$Enums.DistributionType;
537
547
  rewardTokenId: string;
538
548
  amount: string;
539
549
  opportunityId: string;
@@ -607,6 +617,7 @@ export declare abstract class CampaignService {
607
617
  computeChainId: number;
608
618
  distributionChainId: number;
609
619
  campaignId: string;
620
+ distributionType: import("@db/api").$Enums.DistributionType;
610
621
  rewardTokenId: string;
611
622
  amount: string;
612
623
  opportunityId: string;
@@ -744,6 +755,7 @@ export declare abstract class CampaignService {
744
755
  computeChainId: number;
745
756
  distributionChainId: number;
746
757
  campaignId: string;
758
+ distributionType: import("@db/api").$Enums.DistributionType;
747
759
  rewardTokenId: string;
748
760
  amount: string;
749
761
  opportunityId: string;
@@ -757,4 +769,19 @@ export declare abstract class CampaignService {
757
769
  * @returns daily token amount
758
770
  */
759
771
  static getDailyAmount<T extends bigint | number>(start: T, end: T, amount: bigint): bigint;
772
+ static createFakeCampaign<C extends CampaignEnum>(body: CampaignConfigMinimalModel): CampaignParameters<C>;
773
+ static createFakeCampaignEngine(body: CampaignConfigMinimalModel): {
774
+ computeChainId: any;
775
+ chainId: any;
776
+ campaignId: any;
777
+ creator: any;
778
+ type: any;
779
+ subType: any;
780
+ rewardTokenAddress: any;
781
+ amount: any;
782
+ opportunityIdentifier: any;
783
+ startTimestamp: any;
784
+ endTimestamp: any;
785
+ params: string;
786
+ };
760
787
  }
@@ -322,4 +322,39 @@ export class CampaignService {
322
322
  const dailyAmount = isWithinTimespan ? BigInt(amount) / BigInt(dayspan) : 0n;
323
323
  return dailyAmount;
324
324
  }
325
+ static createFakeCampaign(body) {
326
+ return {
327
+ amount: body.amount ?? (10n ** 18n).toString(),
328
+ campaignId: body.campaignId ?? "campaignId",
329
+ computeChainId: body.computeChainId,
330
+ campaignParameters: body.params,
331
+ campaignSubType: body.subType ?? 0,
332
+ campaignType: CampaignEnum[body.type],
333
+ chainId: body.distributionChainId ?? 0,
334
+ creator: body.creatorAddress ?? "creator.address",
335
+ index: 0, // DEPRECATED
336
+ mainParameter: "opportunityIdentifier",
337
+ endTimestamp: body.endTimestamp,
338
+ startTimestamp: body.startTimestamp,
339
+ rewardToken: body.rewardToken,
340
+ amm: body.params?.amm,
341
+ };
342
+ }
343
+ static createFakeCampaignEngine(body) {
344
+ const fakeCampaign = CampaignService.createFakeCampaign(body);
345
+ return {
346
+ computeChainId: fakeCampaign.computeChainId,
347
+ chainId: fakeCampaign.chainId,
348
+ campaignId: fakeCampaign.campaignId,
349
+ creator: fakeCampaign.creator,
350
+ type: fakeCampaign.campaignType,
351
+ subType: fakeCampaign.campaignSubType,
352
+ rewardTokenAddress: fakeCampaign.rewardToken,
353
+ amount: fakeCampaign.amount,
354
+ opportunityIdentifier: fakeCampaign.mainParameter,
355
+ startTimestamp: fakeCampaign.startTimestamp.toString(),
356
+ endTimestamp: fakeCampaign.endTimestamp.toString(),
357
+ params: JSON.stringify(fakeCampaign.campaignParameters),
358
+ };
359
+ }
325
360
  }