@merkl/api 0.16.1 → 0.16.3
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 +8 -9
- package/dist/database/api/.generated/drizzle/schema.js +2 -3
- package/dist/database/api/.generated/drizzle/schema.ts +2 -4
- package/dist/database/api/.generated/edge.js +5 -33
- package/dist/database/api/.generated/index-browser.js +2 -30
- package/dist/database/api/.generated/index.d.ts +123 -210
- package/dist/database/api/.generated/index.js +5 -33
- package/dist/database/api/.generated/package.json +1 -1
- package/dist/database/api/.generated/schema.prisma +2 -32
- package/dist/database/api/.generated/wasm.js +2 -30
- package/dist/src/constants.d.ts +259 -13
- package/dist/src/eden/index.d.ts +98 -98
- package/dist/src/index.d.ts +19 -19
- package/dist/src/libs/campaigns/campaignTypes/ERC20DynamicData.js +6 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/factoryFinder.js +1 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.d.ts +4 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.js +6 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/BalancerV3PoolProcessor.d.ts +44 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/BalancerV3PoolProcessor.js +69 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/HourglassProcessor.d.ts +36 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/HourglassProcessor.js +31 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/processorMapping.js +5 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1.js +10 -0
- package/dist/src/modules/v4/campaign/campaign.controller.d.ts +6 -6
- package/dist/src/modules/v4/campaign/campaign.model.d.ts +5 -65
- package/dist/src/modules/v4/campaign/campaign.model.js +1 -34
- package/dist/src/modules/v4/campaign/campaign.repository.d.ts +7 -7
- package/dist/src/modules/v4/campaign/campaign.service.d.ts +14 -15
- package/dist/src/modules/v4/campaign/campaign.service.js +6 -6
- package/dist/src/modules/v4/chain/chain.repository.d.ts +1 -1
- package/dist/src/modules/v4/dynamicData/dynamicData.controller.d.ts +2 -2
- package/dist/src/modules/v4/dynamicData/dynamicData.model.d.ts +2 -58
- package/dist/src/modules/v4/dynamicData/dynamicData.model.js +2 -3
- package/dist/src/modules/v4/dynamicData/dynamicData.service.d.ts +1 -8
- package/dist/src/modules/v4/dynamicData/dynamicData.service.js +4 -13
- package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +9 -9
- package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +3 -31
- package/dist/src/modules/v4/opportunity/opportunity.model.js +2 -2
- package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +33 -18
- package/dist/src/modules/v4/opportunity/opportunity.repository.js +9 -1
- package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +15 -15
- package/dist/src/modules/v4/opportunity/opportunity.service.js +3 -2
- package/dist/src/modules/v4/opportunity/subservices/getErc20Metadata.service.d.ts +1 -1
- package/dist/src/modules/v4/opportunity/subservices/getErc20Metadata.service.js +2 -2
- package/dist/src/modules/v4/opportunity/subservices/getEulerMetadata.service.d.ts +1 -1
- package/dist/src/modules/v4/opportunity/subservices/getEulerMetadata.service.js +3 -2
- package/dist/src/modules/v4/opportunity/validate-id.pipe.js +3 -3
- package/dist/src/modules/v4/protocol/protocol.repository.d.ts +2 -2
- package/dist/src/modules/v4/reward/reward.repository.d.ts +1 -1
- package/dist/src/modules/v4/reward/reward.service.d.ts +8 -8
- package/dist/src/modules/v4/reward/reward.service.js +2 -2
- package/dist/src/modules/v4/router.d.ts +19 -19
- package/dist/src/modules/v4/user/user.controller.d.ts +2 -2
- package/dist/src/utils/decodeCalls.js +9 -1
- package/dist/src/utils/encodeCalls.js +25 -1
- package/dist/src/utils/generateCardName.d.ts +1 -1
- package/dist/src/utils/generateCardName.js +17 -0
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
@@ -9,7 +9,7 @@ export declare abstract class OpportunityRepository {
|
|
9
9
|
#private;
|
10
10
|
static create(newOpp: CreateOpportunityModel, upsert?: boolean): Promise<{
|
11
11
|
name: string;
|
12
|
-
type:
|
12
|
+
type: string;
|
13
13
|
id: string;
|
14
14
|
status: import("../../../../database/api/.generated").$Enums.Status;
|
15
15
|
tags: string[];
|
@@ -43,7 +43,7 @@ export declare abstract class OpportunityRepository {
|
|
43
43
|
price: number | null;
|
44
44
|
};
|
45
45
|
} & {
|
46
|
-
type:
|
46
|
+
type: string;
|
47
47
|
id: string;
|
48
48
|
params: Prisma.JsonValue;
|
49
49
|
subType: number | null;
|
@@ -156,7 +156,7 @@ export declare abstract class OpportunityRepository {
|
|
156
156
|
})[];
|
157
157
|
} & {
|
158
158
|
name: string;
|
159
|
-
type:
|
159
|
+
type: string;
|
160
160
|
id: string;
|
161
161
|
status: import("../../../../database/api/.generated").$Enums.Status;
|
162
162
|
tags: string[];
|
@@ -274,7 +274,7 @@ export declare abstract class OpportunityRepository {
|
|
274
274
|
})[];
|
275
275
|
} & {
|
276
276
|
name: string;
|
277
|
-
type:
|
277
|
+
type: string;
|
278
278
|
id: string;
|
279
279
|
status: import("../../../../database/api/.generated").$Enums.Status;
|
280
280
|
tags: string[];
|
@@ -309,6 +309,11 @@ export declare abstract class OpportunityRepository {
|
|
309
309
|
computedUntil: bigint;
|
310
310
|
processingStarted: bigint;
|
311
311
|
}[];
|
312
|
+
Creator: {
|
313
|
+
tags: string[];
|
314
|
+
address: string;
|
315
|
+
creatorId: string | null;
|
316
|
+
};
|
312
317
|
ComputeChain: {
|
313
318
|
name: string;
|
314
319
|
id: number;
|
@@ -340,7 +345,7 @@ export declare abstract class OpportunityRepository {
|
|
340
345
|
price: number | null;
|
341
346
|
};
|
342
347
|
} & {
|
343
|
-
type:
|
348
|
+
type: string;
|
344
349
|
id: string;
|
345
350
|
params: Prisma.JsonValue;
|
346
351
|
subType: number | null;
|
@@ -453,7 +458,7 @@ export declare abstract class OpportunityRepository {
|
|
453
458
|
})[];
|
454
459
|
} & {
|
455
460
|
name: string;
|
456
|
-
type:
|
461
|
+
type: string;
|
457
462
|
id: string;
|
458
463
|
status: import("../../../../database/api/.generated").$Enums.Status;
|
459
464
|
tags: string[];
|
@@ -493,6 +498,11 @@ export declare abstract class OpportunityRepository {
|
|
493
498
|
computedUntil: bigint;
|
494
499
|
processingStarted: bigint;
|
495
500
|
}[];
|
501
|
+
Creator: {
|
502
|
+
tags: string[];
|
503
|
+
address: string;
|
504
|
+
creatorId: string | null;
|
505
|
+
};
|
496
506
|
ComputeChain: {
|
497
507
|
name: string;
|
498
508
|
id: number;
|
@@ -524,7 +534,7 @@ export declare abstract class OpportunityRepository {
|
|
524
534
|
price: number | null;
|
525
535
|
};
|
526
536
|
} & {
|
527
|
-
type:
|
537
|
+
type: string;
|
528
538
|
id: string;
|
529
539
|
params: Prisma.JsonValue;
|
530
540
|
subType: number | null;
|
@@ -637,7 +647,7 @@ export declare abstract class OpportunityRepository {
|
|
637
647
|
})[];
|
638
648
|
} & {
|
639
649
|
name: string;
|
640
|
-
type:
|
650
|
+
type: string;
|
641
651
|
id: string;
|
642
652
|
status: import("../../../../database/api/.generated").$Enums.Status;
|
643
653
|
tags: string[];
|
@@ -666,7 +676,7 @@ export declare abstract class OpportunityRepository {
|
|
666
676
|
price: number | null;
|
667
677
|
};
|
668
678
|
} & {
|
669
|
-
type:
|
679
|
+
type: string;
|
670
680
|
id: string;
|
671
681
|
params: Prisma.JsonValue;
|
672
682
|
subType: number | null;
|
@@ -682,7 +692,7 @@ export declare abstract class OpportunityRepository {
|
|
682
692
|
})[];
|
683
693
|
} & {
|
684
694
|
name: string;
|
685
|
-
type:
|
695
|
+
type: string;
|
686
696
|
id: string;
|
687
697
|
status: import("../../../../database/api/.generated").$Enums.Status;
|
688
698
|
tags: string[];
|
@@ -800,7 +810,7 @@ export declare abstract class OpportunityRepository {
|
|
800
810
|
})[];
|
801
811
|
} & {
|
802
812
|
name: string;
|
803
|
-
type:
|
813
|
+
type: string;
|
804
814
|
id: string;
|
805
815
|
status: import("../../../../database/api/.generated").$Enums.Status;
|
806
816
|
tags: string[];
|
@@ -828,6 +838,11 @@ export declare abstract class OpportunityRepository {
|
|
828
838
|
computedUntil: bigint;
|
829
839
|
processingStarted: bigint;
|
830
840
|
}[];
|
841
|
+
Creator: {
|
842
|
+
tags: string[];
|
843
|
+
address: string;
|
844
|
+
creatorId: string | null;
|
845
|
+
};
|
831
846
|
ComputeChain: {
|
832
847
|
name: string;
|
833
848
|
id: number;
|
@@ -852,7 +867,7 @@ export declare abstract class OpportunityRepository {
|
|
852
867
|
price: number | null;
|
853
868
|
};
|
854
869
|
} & {
|
855
|
-
type:
|
870
|
+
type: string;
|
856
871
|
id: string;
|
857
872
|
params: Prisma.JsonValue;
|
858
873
|
subType: number | null;
|
@@ -965,7 +980,7 @@ export declare abstract class OpportunityRepository {
|
|
965
980
|
})[];
|
966
981
|
} & {
|
967
982
|
name: string;
|
968
|
-
type:
|
983
|
+
type: string;
|
969
984
|
id: string;
|
970
985
|
status: import("../../../../database/api/.generated").$Enums.Status;
|
971
986
|
tags: string[];
|
@@ -1025,7 +1040,7 @@ export declare abstract class OpportunityRepository {
|
|
1025
1040
|
};
|
1026
1041
|
opportunity: {
|
1027
1042
|
name: string;
|
1028
|
-
type:
|
1043
|
+
type: string;
|
1029
1044
|
id: string;
|
1030
1045
|
status: import("../../../../database/api/.generated").$Enums.Status;
|
1031
1046
|
tags: string[];
|
@@ -1041,7 +1056,7 @@ export declare abstract class OpportunityRepository {
|
|
1041
1056
|
}>;
|
1042
1057
|
static updateStatus(id: string, status: Status): Promise<{
|
1043
1058
|
name: string;
|
1044
|
-
type:
|
1059
|
+
type: string;
|
1045
1060
|
id: string;
|
1046
1061
|
status: import("../../../../database/api/.generated").$Enums.Status;
|
1047
1062
|
tags: string[];
|
@@ -1056,7 +1071,7 @@ export declare abstract class OpportunityRepository {
|
|
1056
1071
|
}>;
|
1057
1072
|
static updateName(id: string, name: string): Promise<{
|
1058
1073
|
name: string;
|
1059
|
-
type:
|
1074
|
+
type: string;
|
1060
1075
|
id: string;
|
1061
1076
|
status: import("../../../../database/api/.generated").$Enums.Status;
|
1062
1077
|
tags: string[];
|
@@ -1071,7 +1086,7 @@ export declare abstract class OpportunityRepository {
|
|
1071
1086
|
}>;
|
1072
1087
|
static updateChainId(id: string, chainId: MerklChainId): Promise<{
|
1073
1088
|
name: string;
|
1074
|
-
type:
|
1089
|
+
type: string;
|
1075
1090
|
id: string;
|
1076
1091
|
status: import("../../../../database/api/.generated").$Enums.Status;
|
1077
1092
|
tags: string[];
|
@@ -1095,7 +1110,7 @@ export declare abstract class OpportunityRepository {
|
|
1095
1110
|
}>;
|
1096
1111
|
static update(id: string, data: UpdateOpportunityModel): Promise<{
|
1097
1112
|
name: string;
|
1098
|
-
type:
|
1113
|
+
type: string;
|
1099
1114
|
id: string;
|
1100
1115
|
status: import("../../../../database/api/.generated").$Enums.Status;
|
1101
1116
|
tags: string[];
|
@@ -164,6 +164,7 @@ export class OpportunityRepository {
|
|
164
164
|
Explorer: true,
|
165
165
|
},
|
166
166
|
},
|
167
|
+
Creator: true,
|
167
168
|
CampaignStatus: true, // [][0]
|
168
169
|
},
|
169
170
|
orderBy: {
|
@@ -210,6 +211,7 @@ export class OpportunityRepository {
|
|
210
211
|
Explorer: true,
|
211
212
|
},
|
212
213
|
},
|
214
|
+
Creator: true,
|
213
215
|
CampaignStatus: true, // [][0]
|
214
216
|
},
|
215
217
|
orderBy: {
|
@@ -301,7 +303,13 @@ export class OpportunityRepository {
|
|
301
303
|
include: {
|
302
304
|
...OpportunityRepository.#getRecordInclusion(),
|
303
305
|
Campaigns: {
|
304
|
-
include: {
|
306
|
+
include: {
|
307
|
+
RewardToken: true,
|
308
|
+
ComputeChain: true,
|
309
|
+
DistributionChain: true,
|
310
|
+
CampaignStatus: true,
|
311
|
+
Creator: true,
|
312
|
+
},
|
305
313
|
take: 1,
|
306
314
|
orderBy: { endTimestamp: "desc" },
|
307
315
|
},
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { type CreateCampaignModel, type GetCampaignQueryModel } from "../campaign";
|
2
2
|
import { Prisma } from "../../../../database/api/.generated";
|
3
|
-
import type
|
3
|
+
import { type ChainId, type MerklChainId } from "@sdk";
|
4
4
|
import type { CreateOpportunityModel, GetOpportunitiesQueryModel, LightOpportunityFromDB, OpportunityResourceModel, OpportunityUnique, OpportunityWithCampaignsResourceModel, UpdateOpportunityModel } from "./opportunity.model";
|
5
5
|
import { OpportunityRepository } from "./opportunity.repository";
|
6
6
|
export declare abstract class OpportunityService {
|
@@ -13,7 +13,7 @@ export declare abstract class OpportunityService {
|
|
13
13
|
*/
|
14
14
|
static create(newOpp: Omit<CreateOpportunityModel, "id">): Promise<{
|
15
15
|
name: string;
|
16
|
-
type:
|
16
|
+
type: string;
|
17
17
|
id: string;
|
18
18
|
status: import("../../../../database/api/.generated").$Enums.Status;
|
19
19
|
tags: string[];
|
@@ -29,7 +29,7 @@ export declare abstract class OpportunityService {
|
|
29
29
|
static fakeCreateFromCampaign(campaign: Omit<CreateCampaignModel, "id">): Promise<{
|
30
30
|
id: string;
|
31
31
|
chainId: number;
|
32
|
-
type:
|
32
|
+
type: string;
|
33
33
|
identifier: string;
|
34
34
|
name: string;
|
35
35
|
status: "SOON";
|
@@ -41,7 +41,7 @@ export declare abstract class OpportunityService {
|
|
41
41
|
static createFromCampaign(campaign: Omit<CreateCampaignModel, "id">, upsert?: boolean): Promise<{
|
42
42
|
id: string;
|
43
43
|
chainId: number;
|
44
|
-
type:
|
44
|
+
type: string;
|
45
45
|
identifier: string;
|
46
46
|
name: string;
|
47
47
|
status: "PAST" | "LIVE" | "SOON";
|
@@ -66,7 +66,7 @@ export declare abstract class OpportunityService {
|
|
66
66
|
static updateStatusFromCampaign(campaign: Omit<CreateCampaignModel, "id">, upsert?: boolean): Promise<{
|
67
67
|
id: string;
|
68
68
|
chainId: number;
|
69
|
-
type:
|
69
|
+
type: string;
|
70
70
|
identifier: string;
|
71
71
|
name: string;
|
72
72
|
status: "PAST" | "LIVE" | "SOON";
|
@@ -93,7 +93,7 @@ export declare abstract class OpportunityService {
|
|
93
93
|
static recreate(opportunityId: string | OpportunityUnique, campaignId?: string): Promise<{
|
94
94
|
id: string;
|
95
95
|
chainId: number;
|
96
|
-
type:
|
96
|
+
type: string;
|
97
97
|
identifier: string;
|
98
98
|
name: string;
|
99
99
|
status: "PAST" | "LIVE" | "SOON";
|
@@ -240,12 +240,13 @@ export declare abstract class OpportunityService {
|
|
240
240
|
computedUntil: bigint;
|
241
241
|
processingStarted: bigint;
|
242
242
|
};
|
243
|
+
creatorAddress: string;
|
243
244
|
Creator: {
|
244
245
|
tags: string[];
|
245
246
|
address: string;
|
246
247
|
creatorId: string | null;
|
247
248
|
};
|
248
|
-
type:
|
249
|
+
type: string;
|
249
250
|
id: string;
|
250
251
|
subType: number | null;
|
251
252
|
startTimestamp: bigint;
|
@@ -256,7 +257,6 @@ export declare abstract class OpportunityService {
|
|
256
257
|
rewardTokenId: string;
|
257
258
|
amount: string;
|
258
259
|
opportunityId: string;
|
259
|
-
creatorAddress: string;
|
260
260
|
}[];
|
261
261
|
})[]>;
|
262
262
|
static getUniqueWithCampaignsOrThrow(opportunityId: string | OpportunityUnique, withTest?: boolean): Promise<OpportunityWithCampaignsResourceModel>;
|
@@ -345,7 +345,7 @@ export declare abstract class OpportunityService {
|
|
345
345
|
icon: string;
|
346
346
|
} | undefined;
|
347
347
|
name: string;
|
348
|
-
type:
|
348
|
+
type: string;
|
349
349
|
status: import("../../../../database/api/.generated").$Enums.Status;
|
350
350
|
tags: string[];
|
351
351
|
identifier: string;
|
@@ -433,7 +433,7 @@ export declare abstract class OpportunityService {
|
|
433
433
|
icon: string;
|
434
434
|
} | undefined;
|
435
435
|
name: string;
|
436
|
-
type:
|
436
|
+
type: string;
|
437
437
|
status: import("../../../../database/api/.generated").$Enums.Status;
|
438
438
|
tags: string[];
|
439
439
|
identifier: string;
|
@@ -475,12 +475,13 @@ export declare abstract class OpportunityService {
|
|
475
475
|
computedUntil: bigint;
|
476
476
|
processingStarted: bigint;
|
477
477
|
};
|
478
|
+
creatorAddress: string;
|
478
479
|
Creator: {
|
479
480
|
tags: string[];
|
480
481
|
address: string;
|
481
482
|
creatorId: string | null;
|
482
483
|
};
|
483
|
-
type:
|
484
|
+
type: string;
|
484
485
|
id: string;
|
485
486
|
subType: number | null;
|
486
487
|
startTimestamp: bigint;
|
@@ -491,7 +492,6 @@ export declare abstract class OpportunityService {
|
|
491
492
|
rewardTokenId: string;
|
492
493
|
amount: string;
|
493
494
|
opportunityId: string;
|
494
|
-
creatorAddress: string;
|
495
495
|
}[];
|
496
496
|
})[]>;
|
497
497
|
static getAllIds(): Promise<{
|
@@ -583,7 +583,7 @@ export declare abstract class OpportunityService {
|
|
583
583
|
icon: string;
|
584
584
|
} | undefined;
|
585
585
|
name: string;
|
586
|
-
type:
|
586
|
+
type: string;
|
587
587
|
status: import("../../../../database/api/.generated").$Enums.Status;
|
588
588
|
tags: string[];
|
589
589
|
identifier: string;
|
@@ -622,7 +622,7 @@ export declare abstract class OpportunityService {
|
|
622
622
|
icon: string;
|
623
623
|
} | undefined;
|
624
624
|
name: string;
|
625
|
-
type:
|
625
|
+
type: string;
|
626
626
|
status: import("../../../../database/api/.generated").$Enums.Status;
|
627
627
|
tags: string[];
|
628
628
|
identifier: string;
|
@@ -643,7 +643,7 @@ export declare abstract class OpportunityService {
|
|
643
643
|
}>;
|
644
644
|
static update(id: string, data: UpdateOpportunityModel): Promise<{
|
645
645
|
name: string;
|
646
|
-
type:
|
646
|
+
type: string;
|
647
647
|
id: string;
|
648
648
|
status: import("../../../../database/api/.generated").$Enums.Status;
|
649
649
|
tags: string[];
|
@@ -1,8 +1,9 @@
|
|
1
1
|
import { NotFoundError } from "../../../errors";
|
2
|
-
import { CampaignService
|
2
|
+
import { CampaignService } from "../campaign";
|
3
3
|
import { log } from "../../../utils/logger";
|
4
4
|
import { OpportunityAction, Prisma, Status } from "../../../../database/api/.generated";
|
5
5
|
import { record } from "@elysiajs/opentelemetry";
|
6
|
+
import { Campaign as CampaignEnum } from "@sdk";
|
6
7
|
import moment from "moment";
|
7
8
|
import { CacheService } from "../cache";
|
8
9
|
import { TTLPresets } from "../cache/cache.model";
|
@@ -202,7 +203,7 @@ export class OpportunityService {
|
|
202
203
|
const firstCampaign = opportunity?.Campaigns.filter(campaign => campaignId ? campaign.campaignId === campaignId : true)[0];
|
203
204
|
return await OpportunityService.createFromCampaign({
|
204
205
|
...firstCampaign,
|
205
|
-
type:
|
206
|
+
type: CampaignEnum[firstCampaign.type],
|
206
207
|
chainId: firstCampaign.distributionChainId,
|
207
208
|
computeChainId: firstCampaign.computeChainId,
|
208
209
|
creator: firstCampaign.creatorAddress,
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { OpportunityMetadata } from "..";
|
2
|
-
import type
|
2
|
+
import { type ChainId, type ERC20Campaign } from "@sdk";
|
3
3
|
import type { ERC20FixAPRCampaign, ERC20LogCampaign } from "libs/sdk/src/types/merkl/campaignTypes/erc20Log";
|
4
4
|
import type { ERC20RebaseLogCampaign } from "libs/sdk/src/types/merkl/campaignTypes/erc20RebaseLog";
|
5
5
|
export declare const getErc20Metadata: (computeChainId: ChainId, distributionChainId: ChainId, campaignId: string, rewardToken: string, amount: string, params: ERC20Campaign["campaignParameters"] | ERC20LogCampaign["campaignParameters"] | ERC20RebaseLogCampaign["campaignParameters"] | ERC20FixAPRCampaign["campaignParameters"]) => Promise<OpportunityMetadata>;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { log } from "../../../../utils/logger";
|
2
|
-
import {
|
2
|
+
import { Campaign as CampaignEnum } from "@sdk";
|
3
3
|
import { CampaignService } from "../../campaign";
|
4
4
|
import { ProtocolService } from "../../protocol";
|
5
5
|
export const getErc20Metadata = async (computeChainId, distributionChainId, campaignId, rewardToken, amount, params) => {
|
@@ -8,7 +8,7 @@ export const getErc20Metadata = async (computeChainId, distributionChainId, camp
|
|
8
8
|
let mainProtocolId = undefined;
|
9
9
|
const tokens = [{ chainId: computeChainId, address: params.targetToken }];
|
10
10
|
try {
|
11
|
-
const [dynamicData] = await CampaignService.fetchDynamicData(computeChainId,
|
11
|
+
const [dynamicData] = await CampaignService.fetchDynamicData(computeChainId, CampaignEnum[CampaignEnum.ERC20], [
|
12
12
|
{
|
13
13
|
campaignId,
|
14
14
|
rewardToken,
|
@@ -1,3 +1,3 @@
|
|
1
|
-
import type
|
1
|
+
import { type ChainId, type EulerCampaign } from "@sdk";
|
2
2
|
import type { OpportunityMetadata } from "../opportunity.model";
|
3
3
|
export declare const getEulerMetadata: (chainId: ChainId, campaignId: string, campaignSubType: EulerCampaign["campaignSubType"], rewardToken: string, amount: string, params: EulerCampaign["campaignParameters"]) => Promise<OpportunityMetadata>;
|
@@ -1,12 +1,13 @@
|
|
1
1
|
import { log } from "../../../../utils/logger";
|
2
|
-
import {
|
2
|
+
import { OpportunityAction } from "../../../../../database/api/.generated";
|
3
|
+
import { Campaign as CampaignEnum } from "@sdk";
|
3
4
|
import { CampaignService } from "../../campaign";
|
4
5
|
export const getEulerMetadata = async (chainId, campaignId, campaignSubType, rewardToken, amount, params
|
5
6
|
// campaign: CampaignParameters<ConvertedCampaignType<"EULER">>
|
6
7
|
) => {
|
7
8
|
let name = `Hold ${params.symbolTargetToken}`;
|
8
9
|
try {
|
9
|
-
const [dynamicData] = await CampaignService.fetchDynamicData(chainId,
|
10
|
+
const [dynamicData] = await CampaignService.fetchDynamicData(chainId, CampaignEnum[CampaignEnum.EULER], [
|
10
11
|
{
|
11
12
|
campaignSubType,
|
12
13
|
campaignParameters: params,
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { BadRequestError } from "../../../errors";
|
2
|
-
import {
|
2
|
+
import { Campaign as CampaignEnum } from "@sdk";
|
3
3
|
export const validateId = ({ params }) => {
|
4
4
|
if (!params.id.includes("-")) {
|
5
5
|
if (/[0-9]{1,20}/.test(params.id))
|
@@ -7,6 +7,6 @@ export const validateId = ({ params }) => {
|
|
7
7
|
throw new BadRequestError("Invalid Opportunity id");
|
8
8
|
}
|
9
9
|
const [_chainId, type, _campaignId] = params.id.split("-");
|
10
|
-
if (!Object.values(
|
11
|
-
throw new BadRequestError("Invalid Campaign type", Object.
|
10
|
+
if (!Object.values(CampaignEnum).includes(type))
|
11
|
+
throw new BadRequestError("Invalid Campaign type", Object.keys(CampaignEnum));
|
12
12
|
};
|
@@ -28,7 +28,7 @@ export declare abstract class ProtocolRepository {
|
|
28
28
|
static findMany(query: GetProtocolsQueryModel): Promise<({
|
29
29
|
MainOpportunities: ({
|
30
30
|
Campaigns: {
|
31
|
-
type:
|
31
|
+
type: string;
|
32
32
|
id: string;
|
33
33
|
params: import("database/api/.generated/runtime/library").JsonValue;
|
34
34
|
subType: number | null;
|
@@ -44,7 +44,7 @@ export declare abstract class ProtocolRepository {
|
|
44
44
|
}[];
|
45
45
|
} & {
|
46
46
|
name: string;
|
47
|
-
type:
|
47
|
+
type: string;
|
48
48
|
id: string;
|
49
49
|
status: import("../../../../database/api/.generated").$Enums.Status;
|
50
50
|
tags: string[];
|
@@ -56,7 +56,7 @@ export declare abstract class RewardRepository {
|
|
56
56
|
} | null;
|
57
57
|
} & {
|
58
58
|
name: string;
|
59
|
-
type:
|
59
|
+
type: string;
|
60
60
|
id: string;
|
61
61
|
status: import("../../../../database/api/.generated").$Enums.Status;
|
62
62
|
tags: string[];
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import type { CacheKeys } from "../../../cache/keys";
|
2
2
|
import type { Chain } from "../../../../database/api/.generated";
|
3
|
-
import {
|
3
|
+
import { type CampaignDynamicData, Campaign as CampaignEnum, type ChainId, type MerklChainId } from "@sdk";
|
4
4
|
import { type LightOpportunityFromDB, type Opportunity } from "../opportunity";
|
5
5
|
import type { CampaignIdModel, CampaignIdWithoutPageModel, CreateManyBreakdownModel, CreateManyRewardModel, DailyRewardsRecord, RegisterClaimsModel, RewardBreakdown, TokenIdModel } from "./reward.model";
|
6
6
|
import { RewardRepository } from "./reward.repository";
|
@@ -52,7 +52,7 @@ export declare abstract class RewardService {
|
|
52
52
|
} | null;
|
53
53
|
} & {
|
54
54
|
name: string;
|
55
|
-
type:
|
55
|
+
type: string;
|
56
56
|
id: string;
|
57
57
|
status: import("../../../../database/api/.generated").$Enums.Status;
|
58
58
|
tags: string[];
|
@@ -128,7 +128,7 @@ export declare abstract class RewardService {
|
|
128
128
|
} | null;
|
129
129
|
} & {
|
130
130
|
name: string;
|
131
|
-
type:
|
131
|
+
type: string;
|
132
132
|
id: string;
|
133
133
|
status: import("../../../../database/api/.generated").$Enums.Status;
|
134
134
|
tags: string[];
|
@@ -207,7 +207,7 @@ export declare abstract class RewardService {
|
|
207
207
|
} | null;
|
208
208
|
} & {
|
209
209
|
name: string;
|
210
|
-
type:
|
210
|
+
type: string;
|
211
211
|
id: string;
|
212
212
|
status: import("../../../../database/api/.generated").$Enums.Status;
|
213
213
|
tags: string[];
|
@@ -317,7 +317,7 @@ export declare abstract class RewardService {
|
|
317
317
|
} | null;
|
318
318
|
} & {
|
319
319
|
name: string;
|
320
|
-
type:
|
320
|
+
type: string;
|
321
321
|
id: string;
|
322
322
|
status: import("../../../../database/api/.generated").$Enums.Status;
|
323
323
|
tags: string[];
|
@@ -408,7 +408,7 @@ export declare abstract class RewardService {
|
|
408
408
|
} | null;
|
409
409
|
} & {
|
410
410
|
name: string;
|
411
|
-
type:
|
411
|
+
type: string;
|
412
412
|
id: string;
|
413
413
|
status: import("../../../../database/api/.generated").$Enums.Status;
|
414
414
|
tags: string[];
|
@@ -496,7 +496,7 @@ export declare abstract class RewardService {
|
|
496
496
|
} | null;
|
497
497
|
} & {
|
498
498
|
name: string;
|
499
|
-
type:
|
499
|
+
type: string;
|
500
500
|
id: string;
|
501
501
|
status: import("../../../../database/api/.generated").$Enums.Status;
|
502
502
|
tags: string[];
|
@@ -569,5 +569,5 @@ export declare abstract class RewardService {
|
|
569
569
|
claimed: string;
|
570
570
|
}[]>;
|
571
571
|
static getUnclaimed(x: CampaignIdWithoutPageModel): Promise<Record<string, string>>;
|
572
|
-
static extractDailyRewardsRecordFromDynamicData<C extends
|
572
|
+
static extractDailyRewardsRecordFromDynamicData<C extends CampaignEnum>(type: C, dynamicData: CampaignDynamicData<C>[], timestamp?: bigint): Promise<DailyRewardsRecord["model"]>;
|
573
573
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { log } from "../../../utils/logger";
|
2
|
-
import { Campaign, DAY, DistributorService, NETWORK_LABELS, } from "@sdk";
|
2
|
+
import { Campaign as CampaignEnum, DAY, DistributorService, NETWORK_LABELS, } from "@sdk";
|
3
3
|
import moment from "moment";
|
4
4
|
import { BlacklistService } from "../blacklist";
|
5
5
|
import { CacheService } from "../cache";
|
@@ -301,7 +301,7 @@ export class RewardService {
|
|
301
301
|
}, {});
|
302
302
|
}
|
303
303
|
static async extractDailyRewardsRecordFromDynamicData(type, dynamicData, timestamp = BigInt(moment().unix())) {
|
304
|
-
const typesWithoutApr = [
|
304
|
+
const typesWithoutApr = [CampaignEnum.INVALID];
|
305
305
|
if (typesWithoutApr.includes(type))
|
306
306
|
return { timestamp, total: 0, breakdowns: [] };
|
307
307
|
const breakdowns = [];
|