@merkl/api 0.20.48 → 0.20.50
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.
- package/dist/database/api/.generated/drizzle/schema.d.ts +17 -0
- package/dist/database/api/.generated/drizzle/schema.js +1 -0
- package/dist/database/api/.generated/drizzle/schema.ts +1 -0
- package/dist/database/api/.generated/edge.js +4 -3
- package/dist/database/api/.generated/index-browser.js +9 -0
- package/dist/database/api/.generated/index.d.ts +133 -1
- package/dist/database/api/.generated/index.js +4 -3
- package/dist/database/api/.generated/package.json +1 -1
- package/dist/database/api/.generated/schema.prisma +1 -1
- package/dist/database/api/.generated/wasm.js +9 -0
- package/dist/src/eden/index.d.ts +435 -10
- package/dist/src/index.d.ts +99 -2
- package/dist/src/libs/tokens/balances.js +2 -1
- package/dist/src/modules/v4/campaign/campaign.controller.d.ts +93 -1
- package/dist/src/modules/v4/campaign/campaign.controller.js +23 -2
- package/dist/src/modules/v4/campaign/campaign.model.d.ts +15 -0
- package/dist/src/modules/v4/campaign/campaign.model.js +14 -0
- package/dist/src/modules/v4/campaign/campaign.repository.d.ts +8 -0
- package/dist/src/modules/v4/campaign/campaign.service.d.ts +28 -1
- package/dist/src/modules/v4/campaign/campaign.service.js +35 -0
- package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +5 -0
- package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +14 -0
- package/dist/src/modules/v4/opportunity/opportunity.model.js +2 -1
- package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +10 -0
- package/dist/src/modules/v4/opportunity/opportunity.repository.js +1 -0
- package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +8 -0
- package/dist/src/modules/v4/opportunity/opportunity.service.js +1 -0
- package/dist/src/modules/v4/programPayload/programPayload.controller.d.ts +1 -1
- package/dist/src/modules/v4/protocol/protocol.repository.d.ts +1 -0
- package/dist/src/modules/v4/reward/reward.model.d.ts +2 -0
- package/dist/src/modules/v4/reward/reward.service.d.ts +2 -0
- package/dist/src/modules/v4/router.d.ts +99 -2
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/src/index.d.ts
CHANGED
@@ -407,6 +407,7 @@ declare const app: Elysia<"", false, {
|
|
407
407
|
price: number | null;
|
408
408
|
};
|
409
409
|
amount: bigint;
|
410
|
+
distributionType: import("@db/api").$Enums.DistributionType;
|
410
411
|
}[];
|
411
412
|
};
|
412
413
|
campaigns: {
|
@@ -476,6 +477,7 @@ declare const app: Elysia<"", false, {
|
|
476
477
|
computeChainId: number;
|
477
478
|
distributionChainId: number;
|
478
479
|
campaignId: string;
|
480
|
+
distributionType: import("@db/api").$Enums.DistributionType;
|
479
481
|
rewardTokenId: string;
|
480
482
|
amount: string;
|
481
483
|
opportunityId: string;
|
@@ -583,6 +585,7 @@ declare const app: Elysia<"", false, {
|
|
583
585
|
tags: string[];
|
584
586
|
icon: string;
|
585
587
|
} | null | undefined;
|
588
|
+
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
589
|
depositUrl?: string | undefined;
|
587
590
|
explorerAddress?: string | undefined;
|
588
591
|
aprRecord?: {
|
@@ -714,6 +717,7 @@ declare const app: Elysia<"", false, {
|
|
714
717
|
tags: string[];
|
715
718
|
icon: string;
|
716
719
|
} | null | undefined;
|
720
|
+
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
721
|
depositUrl?: string | undefined;
|
718
722
|
explorerAddress?: string | undefined;
|
719
723
|
aprRecord?: {
|
@@ -879,6 +883,7 @@ declare const app: Elysia<"", false, {
|
|
879
883
|
tags: string[];
|
880
884
|
icon: string;
|
881
885
|
} | null | undefined;
|
886
|
+
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
887
|
depositUrl?: string | undefined;
|
883
888
|
explorerAddress?: string | undefined;
|
884
889
|
aprRecord?: {
|
@@ -1222,6 +1227,7 @@ declare const app: Elysia<"", false, {
|
|
1222
1227
|
computeChainId: number;
|
1223
1228
|
distributionChainId: number;
|
1224
1229
|
campaignId: string;
|
1230
|
+
distributionType: import("@db/api").$Enums.DistributionType;
|
1225
1231
|
rewardTokenId: string;
|
1226
1232
|
amount: string;
|
1227
1233
|
opportunityId: string;
|
@@ -1310,6 +1316,7 @@ declare const app: Elysia<"", false, {
|
|
1310
1316
|
computeChainId: number;
|
1311
1317
|
distributionChainId: number;
|
1312
1318
|
campaignId: string;
|
1319
|
+
distributionType: import("@db/api").$Enums.DistributionType;
|
1313
1320
|
rewardTokenId: string;
|
1314
1321
|
amount: string;
|
1315
1322
|
opportunityId: string;
|
@@ -1360,11 +1367,42 @@ declare const app: Elysia<"", false, {
|
|
1360
1367
|
};
|
1361
1368
|
};
|
1362
1369
|
};
|
1370
|
+
} & {
|
1371
|
+
"dry-run": {
|
1372
|
+
"dynamic-data": {
|
1373
|
+
list: {
|
1374
|
+
post: {
|
1375
|
+
body: string[];
|
1376
|
+
params: {};
|
1377
|
+
query: unknown;
|
1378
|
+
headers: {
|
1379
|
+
authorization: string;
|
1380
|
+
};
|
1381
|
+
response: {
|
1382
|
+
200: unknown[];
|
1383
|
+
};
|
1384
|
+
};
|
1385
|
+
};
|
1386
|
+
};
|
1387
|
+
};
|
1363
1388
|
} & {
|
1364
1389
|
"dry-run": {
|
1365
1390
|
"dynamic-data": {
|
1366
1391
|
post: {
|
1367
|
-
body:
|
1392
|
+
body: {
|
1393
|
+
id?: string | undefined;
|
1394
|
+
subType?: number | undefined;
|
1395
|
+
campaignId?: string | undefined;
|
1396
|
+
amount?: string | undefined;
|
1397
|
+
creatorAddress?: string | undefined;
|
1398
|
+
type: string;
|
1399
|
+
params: any;
|
1400
|
+
computeChainId: number;
|
1401
|
+
distributionChainId: number;
|
1402
|
+
startTimestamp: number;
|
1403
|
+
endTimestamp: number;
|
1404
|
+
rewardToken: string;
|
1405
|
+
};
|
1368
1406
|
params: {};
|
1369
1407
|
query: unknown;
|
1370
1408
|
headers: {
|
@@ -1376,6 +1414,62 @@ declare const app: Elysia<"", false, {
|
|
1376
1414
|
};
|
1377
1415
|
};
|
1378
1416
|
};
|
1417
|
+
} & {
|
1418
|
+
"dry-run": {
|
1419
|
+
metadata: {
|
1420
|
+
post: {
|
1421
|
+
body: {
|
1422
|
+
id?: string | undefined;
|
1423
|
+
subType?: number | undefined;
|
1424
|
+
campaignId?: string | undefined;
|
1425
|
+
amount?: string | undefined;
|
1426
|
+
creatorAddress?: string | undefined;
|
1427
|
+
type: string;
|
1428
|
+
params: any;
|
1429
|
+
computeChainId: number;
|
1430
|
+
distributionChainId: number;
|
1431
|
+
startTimestamp: number;
|
1432
|
+
endTimestamp: number;
|
1433
|
+
rewardToken: string;
|
1434
|
+
};
|
1435
|
+
params: {};
|
1436
|
+
query: unknown;
|
1437
|
+
headers: {
|
1438
|
+
authorization: string;
|
1439
|
+
};
|
1440
|
+
response: {
|
1441
|
+
200: {
|
1442
|
+
id: string;
|
1443
|
+
chainId: number;
|
1444
|
+
type: string;
|
1445
|
+
identifier: string;
|
1446
|
+
name: string;
|
1447
|
+
status: "PAST" | "LIVE" | "SOON";
|
1448
|
+
action: any;
|
1449
|
+
tokens: ({
|
1450
|
+
symbol: string;
|
1451
|
+
id: string;
|
1452
|
+
name: string | null;
|
1453
|
+
icon: string;
|
1454
|
+
address: string;
|
1455
|
+
chainId: number;
|
1456
|
+
decimals: number;
|
1457
|
+
verified: boolean;
|
1458
|
+
isTest: boolean;
|
1459
|
+
isPoint: boolean;
|
1460
|
+
isNative: boolean;
|
1461
|
+
} & {
|
1462
|
+
price?: number | null | undefined;
|
1463
|
+
})[];
|
1464
|
+
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;
|
1465
|
+
depositUrl: any;
|
1466
|
+
explorerAddress: string | undefined;
|
1467
|
+
tags: string[];
|
1468
|
+
};
|
1469
|
+
};
|
1470
|
+
};
|
1471
|
+
};
|
1472
|
+
};
|
1379
1473
|
} & {
|
1380
1474
|
"dry-run": {
|
1381
1475
|
metadata: {
|
@@ -1520,6 +1614,7 @@ declare const app: Elysia<"", false, {
|
|
1520
1614
|
computeChainId: number;
|
1521
1615
|
distributionChainId: number;
|
1522
1616
|
campaignId: string;
|
1617
|
+
distributionType: import("@db/api").$Enums.DistributionType;
|
1523
1618
|
rewardTokenId: string;
|
1524
1619
|
amount: string;
|
1525
1620
|
opportunityId: string;
|
@@ -1604,6 +1699,7 @@ declare const app: Elysia<"", false, {
|
|
1604
1699
|
computeChainId: number;
|
1605
1700
|
distributionChainId: number;
|
1606
1701
|
campaignId: string;
|
1702
|
+
distributionType: import("@db/api").$Enums.DistributionType;
|
1607
1703
|
rewardTokenId: string;
|
1608
1704
|
amount: string;
|
1609
1705
|
opportunityId: string;
|
@@ -1789,6 +1885,7 @@ declare const app: Elysia<"", false, {
|
|
1789
1885
|
computeChainId: number;
|
1790
1886
|
distributionChainId: number;
|
1791
1887
|
campaignId: string;
|
1888
|
+
distributionType: import("@db/api").$Enums.DistributionType;
|
1792
1889
|
rewardTokenId: string;
|
1793
1890
|
amount: string;
|
1794
1891
|
opportunityId: string;
|
@@ -4494,10 +4591,10 @@ declare const app: Elysia<"", false, {
|
|
4494
4591
|
endTimestamp?: number | undefined;
|
4495
4592
|
blacklist?: string[] | undefined;
|
4496
4593
|
poolAddress?: string | undefined;
|
4594
|
+
contract?: string | undefined;
|
4497
4595
|
marketId?: string | undefined;
|
4498
4596
|
strategy?: string | undefined;
|
4499
4597
|
poolId?: string | undefined;
|
4500
|
-
contract?: string | undefined;
|
4501
4598
|
forwarders?: (string | {})[] | undefined;
|
4502
4599
|
whitelist?: string[] | undefined;
|
4503
4600
|
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:
|
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
|
}
|